kmail
kmfiltermgr.h00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef kmfiltermgr_h
00021 #define kmfiltermgr_h
00022
00023 #include "kmfilteraction.h"
00024 #include "kmfolder.h"
00025
00026 #include <tqguardedptr.h>
00027 #include <tqobject.h>
00028
00029 class KMFilter;
00030 class KMFilterDlg;
00031 template <typename T> class TQValueVector;
00032 template <typename T> class TQValueList;
00033
00034 class KMFilterMgr: public TQObject
00035 {
00036 Q_OBJECT
00037
00038
00039 public:
00040 KMFilterMgr(bool popFilter = false);
00041 virtual ~KMFilterMgr();
00042
00044 void clear();
00045
00046 enum FilterSet { NoSet = 0x0, Inbound = 0x1, Outbound = 0x2, Explicit = 0x4,
00047 All = Inbound|Outbound|Explicit };
00048
00050 void readConfig(void);
00051
00053 void writeConfig(bool withSync=TRUE);
00054
00058 void openDialog( TQWidget *parent, bool checkForEmptyFilterList = true );
00059
00062 void createFilter( const TQCString & field, const TQString & value );
00063
00064 bool beginFiltering(KMMsgBase *msgBase) const;
00065 int moveMessage(KMMessage *msg) const;
00066 void endFiltering(KMMsgBase *msgBase) const;
00067
00073 bool atLeastOneFilterAppliesTo( unsigned int accountID ) const;
00079 bool atLeastOneIncomingFilterAppliesTo( unsigned int accountID ) const;
00083 bool atLeastOneOnlineImapFolderTarget();
00084
00087 const TQString createUniqueName( const TQString & name );
00088
00092 void appendFilters( const TQValueList<KMFilter*> &filters,
00093 bool replaceIfNameExists = false );
00094
00097 void setFilters( const TQValueList<KMFilter*> &filters );
00098
00100 const TQValueList<KMFilter*> & filters() const { return mFilters; }
00101
00116 int process( KMMessage * msg, FilterSet aSet = Inbound,
00117 bool account = false, uint accountId = 0 );
00118
00123 int process( KMMessage * msg, const KMFilter * filter );
00124
00127 int process( TQ_UINT32 serNum, const KMFilter * filter );
00128
00129 void cleanup();
00132 void ref();
00138 void deref(bool force = false);
00139
00144 int tempOpenFolder(KMFolder* aFolder);
00145
00148 void beginUpdate() {}
00149
00151 void endUpdate();
00152
00154 #ifndef NDEBUG
00155 void dump() const;
00156 #endif
00157
00162 bool folderRemoved(KMFolder* aFolder, KMFolder* aNewFolder);
00163
00166 void folderCreated(KMFolder*) {}
00167
00169 void setShowLaterMsgs( bool show ) {
00170 mShowLater = show;
00171 }
00172
00174 bool showLaterMsgs() const {
00175 return mShowLater;
00176 }
00177 public slots:
00178 void slotFolderRemoved( KMFolder *aFolder );
00179
00180 signals:
00181 void filterListUpdated();
00182
00183 private:
00184 int processPop( KMMessage *msg ) const;
00186 bool isMatching( TQ_UINT32 serNum, const KMFilter *filter );
00187
00188 TQGuardedPtr<KMFilterDlg> mEditDialog;
00189 TQValueVector<KMFolder *> mOpenFolders;
00190 TQValueList<KMFilter *> mFilters;
00191 bool bPopFilter;
00192 bool mShowLater;
00193 bool mDirtyBufferedFolderTarget;
00194 bool mBufferedFolderTarget;
00195
00196 int mRefCount;
00197 };
00198
00199 #endif
|