kmail Library API Documentation

actionscheduler.h

00001 /* -*- mode: C++ -*- 00002 Action Scheduler 00003 00004 This file is part of KMail, the KDE mail client. 00005 Copyright (c) Don Sanders <sanders@kde.org> 00006 00007 KMail is free software; you can redistribute it and/or modify it 00008 under the terms of the GNU General Public License, version 2, as 00009 published by the Free Software Foundation. 00010 00011 KMail is distributed in the hope that it will be useful, but 00012 WITHOUT ANY WARRANTY; without even the implied warranty of 00013 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00014 General Public License for more details. 00015 00016 You should have received a copy of the GNU General Public License 00017 along with this program; if not, write to the Free Software 00018 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00019 00020 In addition, as a special exception, the copyright holders give 00021 permission to link the code of this program with any edition of 00022 the Qt library by Trolltech AS, Norway (or with modified versions 00023 of Qt that use the same license as Qt), and distribute linked 00024 combinations including the two. You must obey the GNU General 00025 Public License in all respects for all of the code used other than 00026 Qt. If you modify this file, you may extend this exception to 00027 your version of the file, but you are not obligated to do so. If 00028 you do not wish to do so, delete this exception statement from 00029 your version. 00030 */ 00031 00032 #ifndef actionscheduler_h 00033 #define actionscheduler_h 00034 00035 #include "kmfilteraction.h" // for KMFilterAction::ReturnCode 00036 #include "kmfilter.h" 00037 #include "kmfiltermgr.h" // KMFilterMgr::FilterSet 00038 #include "kmcommands.h" 00039 00040 #include <qobject.h> 00041 #include <qguardedptr.h> 00042 #include <qtimer.h> 00043 00044 class KMHeaders; 00045 00046 /* A class for asynchronous filtering of messages */ 00047 00048 namespace KMail { 00049 00050 class ActionScheduler : public QObject 00051 { 00052 Q_OBJECT 00053 00054 public: 00055 enum ReturnCode { ResultOk, ResultError, ResultCriticalError }; 00056 00057 ActionScheduler(KMFilterMgr::FilterSet set, 00058 QPtrList<KMFilter> filters, 00059 KMHeaders *headers = 0, 00060 KMFolder *srcFolder = 0); 00061 ~ActionScheduler(); 00062 00065 void setAutoDestruct( bool ); 00066 00068 void setAlwaysMatch( bool ); 00069 00071 void setDefaultDestinationFolder( KMFolder* ); 00072 00074 void setSourceFolder( KMFolder* ); 00075 00079 void setFilterList( QPtrList<KMFilter> filters ); 00080 00082 void execFilters(const QValueList<Q_UINT32> serNums); 00083 void execFilters(const QPtrList<KMMsgBase> msgList); 00084 void execFilters(KMMsgBase* msgBase); 00085 void execFilters(Q_UINT32 serNum); 00086 00087 signals: 00089 void result(ReturnCode); 00090 00091 public slots: 00093 void actionMessage(KMFilterAction::ReturnCode = KMFilterAction::GoOn); 00094 00095 private slots: 00096 KMMsgBase* messageBase(Q_UINT32 serNum); 00097 KMMessage* message(Q_UINT32 serNum); 00098 void finish(); 00099 00100 int tempOpenFolder(KMFolder* aFolder); 00101 void tempCloseFolders(); 00102 00103 //Fetching slots 00104 void fetchMessage(); 00105 void messageFetched( KMMessage *msg ); 00106 void msgAdded( KMFolder*, Q_UINT32 ); 00107 void enqueue(Q_UINT32 serNum); 00108 00109 //Filtering slots 00110 void processMessage(); 00111 void messageRetrieved(KMMessage*); 00112 void filterMessage(); 00113 void moveMessage(); 00114 void moveMessageFinished( KMCommand *command ); 00115 00116 private: 00117 static KMFolderMgr *tempFolderMgr; 00118 static int refCount, count; 00119 QValueListIterator<Q_UINT32> mMessageIt; 00120 QValueListIterator<KMFilter> mFilterIt; 00121 QValueList<Q_UINT32> mSerNums, mFetchSerNums; 00122 QValueList<QGuardedPtr<KMFolder> > mOpenFolders; 00123 QValueList<KMFilter> mFilters, mQueuedFilters; 00124 KMFilterAction* mFilterAction; 00125 KMFilterMgr::FilterSet mSet; 00126 KMHeaders *mHeaders; 00127 QGuardedPtr<KMFolder> mSrcFolder, mDestFolder; 00128 bool mExecuting, mExecutingLock, mFetchExecuting; 00129 bool mUnget, mFetchUnget; 00130 bool mIgnore; 00131 bool mFiltersAreQueued; 00132 bool mAutoDestruct; 00133 bool mAlwaysMatch; 00134 Q_UINT32 mOriginalSerNum; 00135 bool mDeleteSrcFolder; 00136 ReturnCode mResult; 00137 QTimer *finishTimer, *fetchMessageTimer, *tempCloseFoldersTimer; 00138 QTimer *processMessageTimer, *filterMessageTimer; 00139 }; 00140 00141 } 00142 00143 #endif /*actionscheduler_h*/
KDE Logo
This file is part of the documentation for kmail Library Version 3.3.0.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Fri Aug 27 12:52:01 2004 by doxygen 1.3.8 written by Dimitri van Heesch, © 1997-2003