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 AgentBase *q_ptr; 00073 Q_DECLARE_PUBLIC( AgentBase ) 00074 00075 QString mId; 00076 QString mName; 00077 00079 QDBusConnection mDBusConnection; 00080 00081 int mStatusCode; 00082 QString mStatusMessage; 00083 00084 uint mProgress; 00085 QString mProgressMessage; 00086 00087 bool mNeedsNetwork; 00088 bool mOnline; 00089 00090 QSettings *mSettings; 00091 00092 ChangeRecorder *mChangeRecorder; 00093 00094 org::freedesktop::Akonadi::Tracer *mTracer; 00095 00096 AgentBase::Observer *mObserver; 00097 00098 protected Q_SLOTS: 00099 void itemAdded( const Akonadi::Item &item, const Akonadi::Collection &collection ); 00100 void itemChanged( const Akonadi::Item &item, const QSet<QByteArray> &partIdentifiers ); 00101 void itemMoved( const Akonadi::Item &, const Akonadi::Collection &source, const Akonadi::Collection &destination ); 00102 void itemRemoved( const Akonadi::Item &item ); 00103 void itemLinked( const Akonadi::Item &item, const Akonadi::Collection &collection ); 00104 void itemUnlinked( const Akonadi::Item &item, const Akonadi::Collection &collection ); 00105 00106 void collectionAdded( const Akonadi::Collection &collection, const Akonadi::Collection &parent ); 00107 void collectionChanged( const Akonadi::Collection &collection ); 00108 void collectionChanged( const Akonadi::Collection &collection, const QSet<QByteArray> &partIdentifiers ); 00109 void collectionMoved( const Akonadi::Collection &collection, const Akonadi::Collection &source, const Akonadi::Collection &destination ); 00110 void collectionRemoved( const Akonadi::Collection &collection ); 00111 void collectionSubscribed( const Akonadi::Collection &collection, const Akonadi::Collection &parent ); 00112 void collectionUnsubscribed( const Akonadi::Collection &collection ); 00113 }; 00114 00115 } 00116 00117 #endif