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
00040
#include <kfoldertree.h>
00041
00042
#include <qdict.h>
00043
#include <qguardedptr.h>
00044
#include <qmap.h>
00045
00046
class KMFolder;
00047
class KMMessage;
00048
class KMFolderDir;
00049
class KMFolderTreeItem;
00050
00051
namespace {
00052
00053
00054
class ExtraFolder {
00055
public:
00056 ExtraFolder(
KMFolder* f, KMail::FolderContentsType t ) : folder( f ), type( t ) {}
00057
KMFolder* folder;
00058 KMail::FolderContentsType type;
00059 };
00060
00061
class Accumulator {
00062
public:
00063 Accumulator(
const QString& t,
const QString& f,
int c )
00064 :type( t ), folder( f ), count( c ) {}
00065
00066
void add(
const QString& incidence ) {
00067 incidences << incidence;
00068 count--;
00069 }
00070
bool isFull() {
return count == 0; }
00071
00072
const QString type;
00073
const QString folder;
00074
QStringList incidences;
00075
int count;
00076 };
00077
00078 }
00079
00080
class KMailICalIfaceImpl :
public QObject,
virtual public KMailICalIface {
00081 Q_OBJECT
00082
public:
00083 KMailICalIfaceImpl();
00084
00085
bool addIncidence(
const QString& type,
const QString& folder,
00086
const QString& uid,
const QString& ical );
00087
bool deleteIncidence(
const QString& type,
const QString& folder,
00088
const QString& uid );
00089
QStringList incidences(
const QString& type,
const QString& folder );
00090
00091
QStringList subresources(
const QString& type );
00092
00093
bool isWritableFolder(
const QString& type,
const QString& resource );
00094
00095
00096
00097
bool update(
const QString& type,
const QString& folder,
00098
const QStringList& entries );
00099
00100
00101
bool update(
const QString& type,
const QString& folder,
00102
const QString& uid,
const QString& entry );
00103
00104
00105
void msgRemoved(
KMFolder*, KMMessage* );
00106
00108
void initFolders();
00109
00111
void cleanup();
00112
00117
bool isResourceImapFolder(
KMFolder* folder )
const;
00118
00123
bool hideResourceImapFolder(
KMFolder* folder )
const;
00124
00129 KFolderTreeItem::Type folderType(
KMFolder* folder )
const;
00130
00135
QString folderPixmap( KFolderTreeItem::Type type )
const;
00136
00139
QString folderName( KFolderTreeItem::Type type,
int language = -1 )
const;
00140
00142
KMFolder* folderFromType(
const QString& type,
const QString& folder );
00143
00145
QString icalFolderType(
KMFolder* folder )
const;
00146
00148 KMMessage* findMessageByUID(
const QString& uid,
KMFolder* folder );
00149
00151
static void deleteMsg( KMMessage* msg );
00152
00153
bool isEnabled()
const {
return mUseResourceIMAP; }
00154
00156
void folderContentsTypeChanged(
KMFolder*, KMail::FolderContentsType );
00157
00158
public slots:
00159
00160
void readConfig();
00161
00162
void slotIncidenceAdded(
KMFolder* folder, Q_UINT32 sernum );
00163
void slotIncidenceDeleted(
KMFolder* folder, Q_UINT32 sernum );
00164
void slotRefresh(
const QString& type);
00165
00166
private slots:
00167
void slotRefreshCalendar();
00168
void slotRefreshTasks();
00169
void slotRefreshJournals();
00170
void slotRefreshContacts();
00171
void slotRefreshNotes();
00172
00173
void slotCheckDone();
00174
void slotMessageRetrieved( KMMessage* );
00175
00176
private:
00178
KMFolder* initFolder( KFolderTreeItem::Type itemType,
const char* typeString );
00179
00180
KMFolder* extraFolder(
const QString& type,
const QString& folder );
00181
00182
void loadPixmaps() const;
00183
00184
QGuardedPtr<
KMFolder> mContacts;
00185
QGuardedPtr<
KMFolder> mCalendar;
00186
QGuardedPtr<
KMFolder> mNotes;
00187
QGuardedPtr<
KMFolder> mTasks;
00188
QGuardedPtr<
KMFolder> mJournals;
00189
00190
00191
QDict<ExtraFolder> mExtraFolders;
00192
00193
00194
QDict<Accumulator> mAccumulators;
00195
00196
unsigned int mFolderLanguage;
00197
00198
KMFolderDir* mFolderParentDir;
00199
KMFolder* mFolderParent;
00200 KMFolderType mFolderType;
00201
00202
00203 static
QPixmap *pixContacts, *pixCalendar, *pixNotes, *pixTasks;
00204
00205
bool mUseResourceIMAP;
00206
bool mHideFolders;
00207
00208
00209
00210
00211
00212
00213
00214
QMap<
QString, Q_UINT32> mUIDToSerNum;
00215
QMap<Q_UINT32,
bool> mTheUnGetMes;
00216
QMap<QString, QString> mPendingUpdates;
00217
QMap<QString,
bool> mInTransit;
00218
00219 };
00220
00221 #endif