From bcb704366cb5e333a626c18c308c7e0448a8e69f Mon Sep 17 00:00:00 2001 From: toma Date: Wed, 25 Nov 2009 17:56:58 +0000 Subject: Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features. BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdenetwork@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- kopete/protocols/oscar/oscarversionupdater.h | 120 +++++++++++++++++++++++++++ 1 file changed, 120 insertions(+) create mode 100644 kopete/protocols/oscar/oscarversionupdater.h (limited to 'kopete/protocols/oscar/oscarversionupdater.h') diff --git a/kopete/protocols/oscar/oscarversionupdater.h b/kopete/protocols/oscar/oscarversionupdater.h new file mode 100644 index 00000000..d6851f73 --- /dev/null +++ b/kopete/protocols/oscar/oscarversionupdater.h @@ -0,0 +1,120 @@ +/* + oscarversionupdater.h - Version Updater + + Copyright (c) 2006 by Roman Jarosz + Kopete (c) 2006 by the Kopete developers + + ************************************************************************* + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ************************************************************************* +*/ + +#ifndef OSCARVERSIONUPDATER_H +#define OSCARVERSIONUPDATER_H + +#include + +#include + +namespace KIO +{ +class Job; +class TransferJob; +} + +class QDomElement; +class QDomDocument; + +/** + @author Roman Jarosz +*/ + +class OscarVersionUpdater : public QObject +{ + Q_OBJECT + +public: + OscarVersionUpdater(); + ~OscarVersionUpdater(); + + static OscarVersionUpdater* self(); + + /** + * Update version info from server. + * @param stamp is update number. + */ + bool update( unsigned int stamp ); + + /** + * Update version info from server. + * @return true if update is in progress or starts. + */ + unsigned int stamp() const; + + /** + * Return structure with version info for ICQ. + * @return Oscar::ClientVersion. + */ + const Oscar::ClientVersion* getICQVersion() const { return &mICQVersion; } + + /** + * Return structure with version info for AIM. + * @return Oscar::ClientVersion. + */ + const Oscar::ClientVersion* getAIMVersion() const { return &mAIMVersion; } + + /** + * Set structure with ICQ version info to default. + */ + void initICQVersionInfo(); + + /** + * Set structure with AIM version info to default. + */ + void initAIMVersionInfo(); + + /** + * Print debug info. + */ + void printDebug(); + +private slots: + void slotTransferData( KIO::Job *job, const QByteArray &data ); + void slotTransferResult( KIO::Job *job ); + +private: + void parseDocument( QDomDocument& doc ); + bool parseVersion( Oscar::ClientVersion& version, QDomElement& element ); + + /** + * Store version info structure to KConfigGroup + * @param group is the group name. + * @param version is version info structure. + */ + void storeVersionInfo( const QString& group, const Oscar::ClientVersion& version ) const; + + /** + * Compare two versions. + * @return true if a and b is equal. + */ + bool equal( const Oscar::ClientVersion& a, const Oscar::ClientVersion& b ) const; + +private: + static OscarVersionUpdater *versionUpdaterStatic; + + Oscar::ClientVersion mICQVersion; + Oscar::ClientVersion mAIMVersion; + + KIO::TransferJob *mTransferJob; + QByteArray mVersionData; + + unsigned int mStamp; + bool mUpdating; +}; + +#endif -- cgit v1.2.1