kmail

kmfiltermgr.h
1/*
2 * kmail: KDE mail client
3 * Copyright (c) 1996-1998 Stefan Taferner <taferner@kde.org>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 *
19 */
20#ifndef kmfiltermgr_h
21#define kmfiltermgr_h
22
23#include "kmfilteraction.h" // for KMFilterAction::ReturnCode
24#include "kmfolder.h"
25
26#include <tqguardedptr.h>
27#include <tqobject.h>
28
29class KMFilter;
30class KMFilterDlg;
31template <typename T> class TQValueVector;
32template <typename T> class TQValueList;
33
34class KMFilterMgr: public TQObject
35{
36 TQ_OBJECT
37
38
39public:
40 KMFilterMgr(bool popFilter = false);
41 virtual ~KMFilterMgr();
42
44 void clear();
45
46 enum FilterSet { NoSet = 0x0, Inbound = 0x1, Outbound = 0x2, Explicit = 0x4,
47 All = Inbound|Outbound|Explicit };
48
50 void readConfig(void);
51
53 void writeConfig(bool withSync=TRUE);
54
58 void openDialog( TQWidget *parent, bool checkForEmptyFilterList = true );
59
62 void createFilter( const TQCString & field, const TQString & value );
63
64 bool beginFiltering(KMMsgBase *msgBase) const;
65 int moveMessage(KMMessage *msg) const;
66 void endFiltering(KMMsgBase *msgBase) const;
67
73 bool atLeastOneFilterAppliesTo( unsigned int accountID ) const;
79 bool atLeastOneIncomingFilterAppliesTo( unsigned int accountID ) const;
83 bool atLeastOneOnlineImapFolderTarget();
84
87 const TQString createUniqueName( const TQString & name );
88
92 void appendFilters( const TQValueList<KMFilter*> &filters,
93 bool replaceIfNameExists = false );
94
97 void setFilters( const TQValueList<KMFilter*> &filters );
98
100 const TQValueList<KMFilter*> & filters() const { return mFilters; }
101
116 int process( KMMessage * msg, FilterSet aSet = Inbound,
117 bool account = false, uint accountId = 0 );
118
123 int process( KMMessage * msg, const KMFilter * filter );
124
127 int process( TQ_UINT32 serNum, const KMFilter * filter );
128
129 void cleanup();
132 void ref();
138 void deref(bool force = false);
139
144 int tempOpenFolder(KMFolder* aFolder);
145
148 void beginUpdate() {}
149
151 void endUpdate();
152
154#ifndef NDEBUG
155 void dump() const;
156#endif
157
162 bool folderRemoved(KMFolder* aFolder, KMFolder* aNewFolder);
163
166 void folderCreated(KMFolder*) {}
167
169 void setShowLaterMsgs( bool show ) {
170 mShowLater = show;
171 }
172
174 bool showLaterMsgs() const {
175 return mShowLater;
176 }
177public slots:
178 void slotFolderRemoved( KMFolder *aFolder );
179
180signals:
181 void filterListUpdated();
182
183private:
184 int processPop( KMMessage *msg ) const;
186 bool isMatching( TQ_UINT32 serNum, const KMFilter *filter );
187
188 TQGuardedPtr<KMFilterDlg> mEditDialog;
189 TQValueVector<KMFolder *> mOpenFolders;
190 TQValueList<KMFilter *> mFilters;
191 bool bPopFilter;
192 bool mShowLater;
193 bool mDirtyBufferedFolderTarget;
194 bool mBufferedFolderTarget;
195
196 int mRefCount;
197};
198
199#endif /*kmfiltermgr_h*/
The filter dialog.
Definition: kmfilterdlg.h:340
Mail folder.
Definition: kmfolder.h:69
This is a Mime Message.
Definition: kmmessage.h:68