kmail

messageproperty.h
1 /* Message Property
2 
3  This file is part of KMail, the KDE mail client.
4  Copyright (c) Don Sanders <sanders@kde.org>
5 
6  KMail is free software; you can redistribute it and/or modify it
7  under the terms of the GNU General Public License, version 2, as
8  published by the Free Software Foundation.
9 
10  KMail is distributed in the hope that it will be useful, but
11  WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  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  In addition, as a special exception, the copyright holders give
20  permission to link the code of this program with any edition of
21  the TQt library by Trolltech AS, Norway (or with modified versions
22  of TQt that use the same license as TQt), and distribute linked
23  combinations including the two. You must obey the GNU General
24  Public License in all respects for all of the code used other than
25  TQt. If you modify this file, you may extend this exception to
26  your version of the file, but you are not obligated to do so. If
27  you do not wish to do so, delete this exception statement from
28  your version.
29 */
30 #ifndef messageproperty_h
31 #define messageproperty_h
32 
33 #include "kmfilteraction.h" // for KMFilterAction::ReturnCode
34 #include "kmfolder.h"
35 
36 #include <tqptrlist.h>
37 #include <tqguardedptr.h>
38 #include <tqobject.h>
39 
40 class KMFilter;
41 class KMFilterDlg;
42 
43 namespace KMail {
44 
45 class ActionScheduler;
46 
47 /* A place to store properties that some but not necessarily all messages
48  have.
49 
50  These properties do not need to be stored persistantly on disk but
51  rather only are required while KMail is running.
52 
53  Furthermore some properties, namely complete, transferInProgress, and
54  serialCache should only exist during the lifetime of a particular
55  KMMsgBase based instance.
56  */
57 class MessageProperty : public TQObject
58 {
59  TQ_OBJECT
60 
61 
62 public:
64  static bool filtering( TQ_UINT32 );
65  static void setFiltering( TQ_UINT32, bool filtering );
66  static bool filtering( const KMMsgBase* );
67  static void setFiltering( const KMMsgBase*, bool filtering );
71  static KMFolder* filterFolder( TQ_UINT32 );
72  static void setFilterFolder( TQ_UINT32, KMFolder* folder );
73  static KMFolder* filterFolder( const KMMsgBase* );
74  static void setFilterFolder( const KMMsgBase*, KMFolder* folder );
75  /* Set the filterHandler for a message */
76  static ActionScheduler* filterHandler( TQ_UINT32 );
77  static void setFilterHandler( TQ_UINT32, ActionScheduler* filterHandler );
78  static ActionScheduler* filterHandler( const KMMsgBase* );
79  static void setFilterHandler( const KMMsgBase*, ActionScheduler* filterHandler );
80 
81  /* Caches the serial number for a message, or more correctly for a
82  KMMsgBase based instance representing a message.
83  This property becomes invalid when the message is destructed or
84  assigned a new value */
85  static void setSerialCache( const KMMsgBase*, TQ_UINT32 );
86  static TQ_UINT32 serialCache( const KMMsgBase* );
87 
88  /* Set the transferInProgress for a message
89  This property becomes invalid when the message is destructed or
90  assigned a new value */
91  static void setTransferInProgress( const KMMsgBase*, bool, bool = false );
92  static bool transferInProgress( const KMMsgBase* );
93  static void setTransferInProgress( TQ_UINT32, bool, bool = false );
94  static bool transferInProgress( TQ_UINT32 );
95 
99  static void forget( const KMMsgBase* );
100 
101 private:
102  // The folder a message is to be moved into once filtering is finished if any
103  static TQMap<TQ_UINT32, TQGuardedPtr<KMFolder> > sFolders;
104 
105  // The action scheduler currently processing a message if any
106  static TQMap<TQ_UINT32, TQGuardedPtr<ActionScheduler> > sHandlers;
107 
108  // The transferInProgres state of a message if any.
109  static TQMap<TQ_UINT32, int > sTransfers;
110 
111  // The cached serial number of a message if any.
112  static TQMap<const KMMsgBase*, long > sSerialCache;
113 };
114 
115 }
116 
117 #endif /*messageproperty_h*/
The filter dialog.
Definition: kmfilterdlg.h:340
Mail folder.
Definition: kmfolder.h:69
folderdiaquotatab.h
Definition: aboutdata.cpp:40