kmailicalifaceimpl.h
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034 #ifndef KMAILICALIFACEIMPL_H
00035 #define KMAILICALIFACEIMPL_H
00036
00037 #include "kmailicalIface.h"
00038 #include "kmfoldertype.h"
00039 #include <kfoldertree.h>
00040
00041 #include <qdict.h>
00042 #include <qguardedptr.h>
00043 #include <qmap.h>
00044
00045 class KMFolder;
00046 class KMMessage;
00047 class KMFolderDir;
00048 class KMFolderTreeItem;
00049
00050 namespace {
00051
00052
00053 class ExtraFolder {
00054 public:
00055 ExtraFolder( KMFolder* f, KMail::FolderContentsType t ) : folder( f ), type( t ) {}
00056 KMFolder* folder;
00057 KMail::FolderContentsType type;
00058 };
00059
00060 class Accumulator {
00061 public:
00062 Accumulator( const QString& t, const QString& f, int c )
00063 :type( t ), folder( f ), count( c ) {}
00064
00065 void add( const QString& incidence ) {
00066 incidences << incidence;
00067 count--;
00068 }
00069 bool isFull() { return count == 0; }
00070
00071 const QString type;
00072 const QString folder;
00073 QStringList incidences;
00074 int count;
00075 };
00076
00077 }
00078
00079 class KMailICalIfaceImpl : public QObject, virtual public KMailICalIface {
00080 Q_OBJECT
00081 public:
00082 KMailICalIfaceImpl();
00083
00084 bool addIncidence( const QString& type, const QString& folder,
00085 const QString& uid, const QString& ical );
00086 bool deleteIncidence( const QString& type, const QString& folder,
00087 const QString& uid );
00088 QStringList incidences( const QString& type, const QString& folder );
00089
00090 QStringList subresources( const QString& type );
00091
00092 bool isWritableFolder( const QString& type, const QString& resource );
00093
00094
00095
00096 bool update( const QString& type, const QString& folder,
00097 const QStringList& entries );
00098
00099
00100 bool update( const QString& type, const QString& folder,
00101 const QString& uid, const QString& entry );
00102
00103
00104 void msgRemoved( KMFolder*, KMMessage* );
00105
00107 void initFolders();
00108
00110 void cleanup();
00111
00116 bool isResourceImapFolder( KMFolder* folder ) const;
00117
00122 bool hideResourceImapFolder( KMFolder* folder ) const;
00123
00128 KFolderTreeItem::Type folderType( KMFolder* folder ) const;
00129
00134 QString folderPixmap( KFolderTreeItem::Type type ) const;
00135
00138 QString folderName( KFolderTreeItem::Type type, int language = -1 ) const;
00139
00141 KMFolder* folderFromType( const QString& type, const QString& folder );
00142
00144 QString icalFolderType( KMFolder* folder ) const;
00145
00147 KMMessage* findMessageByUID( const QString& uid, KMFolder* folder );
00148
00150 static void deleteMsg( KMMessage* msg );
00151
00152 bool isEnabled() const { return mUseResourceIMAP; }
00153
00155 void folderContentsTypeChanged( KMFolder*, KMail::FolderContentsType );
00156
00157 public slots:
00158
00159 void readConfig();
00160
00161 void slotIncidenceAdded( KMFolder* folder, Q_UINT32 sernum );
00162 void slotIncidenceDeleted( KMFolder* folder, Q_UINT32 sernum );
00163 void slotRefresh( const QString& type);
00164
00165 private slots:
00166 void slotRefreshFolder( KMFolder* folder );
00167 void slotCheckDone();
00168 void slotMessageRetrieved( KMMessage* );
00169
00170 private:
00172 KMFolder* initFolder( KFolderTreeItem::Type itemType, const char* typeString );
00173
00174 KMFolder* extraFolder( const QString& type, const QString& folder );
00175
00176 void loadPixmaps() const;
00177
00178 QGuardedPtr<KMFolder> mContacts;
00179 QGuardedPtr<KMFolder> mCalendar;
00180 QGuardedPtr<KMFolder> mNotes;
00181 QGuardedPtr<KMFolder> mTasks;
00182 QGuardedPtr<KMFolder> mJournals;
00183
00184
00185 QDict<ExtraFolder> mExtraFolders;
00186
00187
00188 QDict<Accumulator> mAccumulators;
00189
00190 unsigned int mFolderLanguage;
00191
00192 KMFolderDir* mFolderParentDir;
00193 KMFolder* mFolderParent;
00194 KMFolderType mFolderType;
00195
00196
00197 static QPixmap *pixContacts, *pixCalendar, *pixNotes, *pixTasks, *pixJournals;
00198
00199 bool mUseResourceIMAP;
00200 bool mHideFolders;
00201
00202
00203
00204
00205
00206
00207
00208 QMap<QString, Q_UINT32> mUIDToSerNum;
00209 QMap<Q_UINT32, bool> mTheUnGetMes;
00210 QMap<QString, QString> mPendingUpdates;
00211 QMap<QString, bool> mInTransit;
00212
00213 };
00214
00215 #endif // KMAILICALIFACEIMPL_H
This file is part of the documentation for kmail Library Version 3.3.2.