kmail
actionscheduler.hGo to the documentation of this file.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 #ifndef actionscheduler_h
00033 #define actionscheduler_h
00034
00035 #include "kmfilteraction.h"
00036 #include "kmfilter.h"
00037 #include "kmfiltermgr.h"
00038 #include "kmcommands.h"
00039
00040 #include <qobject.h>
00041 #include <qguardedptr.h>
00042 #include <qtimer.h>
00043
00044 class KMHeaders;
00045
00046 namespace KMail {
00047
00048
00049 class ActionScheduler : public QObject
00050 {
00051 Q_OBJECT
00052
00053 public:
00054 enum ReturnCode { ResultOk, ResultError, ResultCriticalError };
00055
00056 ActionScheduler(KMFilterMgr::FilterSet set,
00057 QValueList<KMFilter*> filters,
00058 KMHeaders *headers = 0,
00059 KMFolder *srcFolder = 0);
00060 ~ActionScheduler();
00061
00064 void setAutoDestruct( bool );
00065
00067 void setAlwaysMatch( bool );
00068
00070 void setDefaultDestinationFolder( KMFolder* );
00071
00073 void setSourceFolder( KMFolder* );
00074
00078 void setFilterList( QValueList<KMFilter*> filters );
00079
00081 void setAccountId( uint id ) { mAccountId = id; mAccount = true; }
00082
00084 void clearAccountId() { mAccountId = 0; mAccount = false; }
00085
00087 void execFilters(const QValueList<Q_UINT32> serNums);
00088 void execFilters(const QPtrList<KMMsgBase> msgList);
00089 void execFilters(KMMsgBase* msgBase);
00090 void execFilters(Q_UINT32 serNum);
00091
00092 static QString debug();
00093 static bool isEnabled();
00094
00099 bool ignoreChanges( bool ignore );
00100
00101 signals:
00103 void result(ReturnCode);
00104 void filtered(Q_UINT32);
00105
00106 public slots:
00108 void actionMessage(KMFilterAction::ReturnCode = KMFilterAction::GoOn);
00109
00111 void copyMessageFinished( KMCommand *command );
00112
00113 private slots:
00114 KMMsgBase* messageBase(Q_UINT32 serNum);
00115 KMMessage* message(Q_UINT32 serNum);
00116 void finish();
00117
00118 void folderClosedOrExpunged();
00119
00120 int tempOpenFolder(KMFolder* aFolder);
00121 void tempCloseFolders();
00122
00123
00124 void fetchMessage();
00125 void messageFetched( KMMessage *msg );
00126 void msgAdded( KMFolder*, Q_UINT32 );
00127 void enqueue(Q_UINT32 serNum);
00128
00129
00130 void processMessage();
00131 void messageRetrieved(KMMessage*);
00132 void filterMessage();
00133 void moveMessage();
00134 void moveMessageFinished( KMCommand *command );
00135 void timeOut();
00136 void fetchTimeOut();
00137
00138 private:
00139 static QValueList<ActionScheduler*> *schedulerList;
00140 static KMFolderMgr *tempFolderMgr;
00141 static int refCount, count;
00142 static bool sEnabled, sEnabledChecked;
00143 QValueListIterator<Q_UINT32> mMessageIt;
00144 QValueListIterator<KMFilter> mFilterIt;
00145 QValueList<Q_UINT32> mSerNums, mFetchSerNums;
00146 QValueList<QGuardedPtr<KMFolder> > mOpenFolders;
00147 QValueList<KMFilter> mFilters, mQueuedFilters;
00148 KMFilterAction* mFilterAction;
00149 KMFilterMgr::FilterSet mSet;
00150 KMHeaders *mHeaders;
00151 QGuardedPtr<KMFolder> mSrcFolder, mDestFolder;
00152 bool mExecuting, mExecutingLock, mFetchExecuting;
00153 bool mUnget, mFetchUnget;
00154 bool mIgnore;
00155 bool mFiltersAreQueued;
00156 bool mAutoDestruct;
00157 bool mAlwaysMatch;
00158 bool mAccount;
00159 uint mAccountId;
00160 Q_UINT32 mOriginalSerNum;
00161 bool mDeleteSrcFolder;
00162 ReturnCode mResult;
00163 QTimer *finishTimer, *fetchMessageTimer, *tempCloseFoldersTimer;
00164 QTimer *processMessageTimer, *filterMessageTimer;
00165 QTimer *timeOutTimer, *fetchTimeOutTimer;
00166 QTime timeOutTime, fetchTimeOutTime;
00167 KMCommand *lastCommand;
00168 FolderJob *lastJob;
00169 };
00170
00171 }
00172
00173 #endif
|