akonadi
agentbase_p.h
00001 /* 00002 Copyright (c) 2007 Volker Krause <vkrause@kde.org> 00003 Copyright (c) 2008 Kevin Krammer <kevin.krammer@gmx.at> 00004 00005 This library is free software; you can redistribute it and/or modify it 00006 under the terms of the GNU Library General Public License as published by 00007 the Free Software Foundation; either version 2 of the License, or (at your 00008 option) any later version. 00009 00010 This library is distributed in the hope that it will be useful, but WITHOUT 00011 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 00012 FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public 00013 License for more details. 00014 00015 You should have received a copy of the GNU Library General Public License 00016 along with this library; see the file COPYING.LIB. If not, write to the 00017 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 00018 02110-1301, USA. 00019 */ 00020 00021 #ifndef AKONADI_AGENTBASE_P_H 00022 #define AKONADI_AGENTBASE_P_H 00023 00024 #include "agentbase.h" 00025 #include "tracerinterface.h" 00026 00027 #include <klocale.h> 00028 00029 #include <solid/networking.h> 00030 00031 class QSettings; 00032 00033 namespace Akonadi { 00034 00038 class AgentBasePrivate : public QObject 00039 { 00040 Q_OBJECT 00041 public: 00042 AgentBasePrivate( AgentBase *parent ); 00043 virtual ~AgentBasePrivate(); 00044 void init(); 00045 virtual void delayedInit(); 00046 00047 void slotStatus( int status, const QString &message ); 00048 void slotPercent( int progress ); 00049 void slotWarning( const QString& message ); 00050 void slotError( const QString& message ); 00051 void slotNetworkStatusChange( Solid::Networking::Status ); 00052 00053 virtual void changeProcessed(); 00054 00055 QString defaultReadyMessage() const 00056 { 00057 if ( mOnline ) 00058 return i18nc( "@info:status Application ready for work", "Ready" ); 00059 return i18nc( "@info:status", "Offline" ); 00060 } 00061 00062 QString defaultSyncingMessage() const 00063 { 00064 return i18nc( "@info:status", "Syncing..." ); 00065 } 00066 00067 QString defaultErrorMessage() const 00068 { 00069 return i18nc( "@info:status", "Error." ); 00070 } 00071 00072 void setProgramName(); 00073 00074 AgentBase *q_ptr; 00075 Q_DECLARE_PUBLIC( AgentBase ) 00076 00077 QString mId; 00078 QString mName; 00079 QString mResourceTypeName; 00080 00082 QDBusConnection mDBusConnection; 00083 00084 int mStatusCode; 00085 QString mStatusMessage; 00086 00087 uint mProgress; 00088 QString mProgressMessage; 00089 00090 bool mNeedsNetwork; 00091 bool mOnline; 00092 00093 QSettings *mSettings; 00094 00095 ChangeRecorder *mChangeRecorder; 00096 00097 org::freedesktop::Akonadi::Tracer *mTracer; 00098 00099 AgentBase::Observer *mObserver; 00100 00101 protected Q_SLOTS: 00102 virtual void itemAdded( const Akonadi::Item &item, const Akonadi::Collection &collection ); 00103 virtual void itemChanged( const Akonadi::Item &item, const QSet<QByteArray> &partIdentifiers ); 00104 virtual void itemMoved( const Akonadi::Item &, const Akonadi::Collection &source, const Akonadi::Collection &destination ); 00105 virtual void itemRemoved( const Akonadi::Item &item ); 00106 void itemLinked( const Akonadi::Item &item, const Akonadi::Collection &collection ); 00107 void itemUnlinked( const Akonadi::Item &item, const Akonadi::Collection &collection ); 00108 00109 virtual void collectionAdded( const Akonadi::Collection &collection, const Akonadi::Collection &parent ); 00110 virtual void collectionChanged( const Akonadi::Collection &collection ); 00111 virtual void collectionChanged( const Akonadi::Collection &collection, const QSet<QByteArray> &partIdentifiers ); 00112 virtual void collectionMoved( const Akonadi::Collection &collection, const Akonadi::Collection &source, const Akonadi::Collection &destination ); 00113 virtual void collectionRemoved( const Akonadi::Collection &collection ); 00114 void collectionSubscribed( const Akonadi::Collection &collection, const Akonadi::Collection &parent ); 00115 void collectionUnsubscribed( const Akonadi::Collection &collection ); 00116 }; 00117 00118 } 00119 00120 #endif