kmail

expirejob.h
1 /*
2  * Copyright (c) 2004 David Faure <faure@kde.org>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; version 2 of the License
7  *
8  * This program is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * GNU General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License
14  * along with this program; if not, write to the Free Software
15  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
16  *
17  * In addition, as a special exception, the copyright holders give
18  * permission to link the code of this program with any edition of
19  * the TQt library by Trolltech AS, Norway (or with modified versions
20  * of TQt that use the same license as TQt), and distribute linked
21  * combinations including the two. You must obey the GNU General
22  * Public License in all respects for all of the code used other than
23  * TQt. If you modify this file, you may extend this exception to
24  * your version of the file, but you are not obligated to do so. If
25  * you do not wish to do so, delete this exception statement from
26  * your version.
27  */
28 #ifndef EXPIREJOB_H
29 #define EXPIREJOB_H
30 
31 #include "jobscheduler.h"
32 #include "kmcommands.h"
33 
34 namespace KMail {
35 
36 class ExpireJob : public ScheduledJob
37 {
38  TQ_OBJECT
39 
40 public:
41  ExpireJob( KMFolder* folder, bool immediate );
42  virtual ~ExpireJob();
43 
44  virtual void execute();
45  virtual void kill();
46 
47 private slots:
48  void slotDoWork();
49  void slotMessagesMoved( KMCommand *command );
50 
51 private:
52  void done();
53 
54 private:
55  TQTimer mTimer;
56  TQPtrList<KMMsgBase> mRemovedMsgs;
57  int mCurrentIndex;
58  int mMaxUnreadTime;
59  int mMaxReadTime;
60  bool mFolderOpen;
61  KMFolder *mMoveToFolder;
62 };
63 
66 {
67 public:
70  ScheduledExpireTask( KMFolder* folder, bool immediate )
71  : ScheduledTask( folder, immediate ) {}
72  virtual ~ScheduledExpireTask() {}
73  virtual ScheduledJob* run() {
74  return folder() ? new ExpireJob( folder(), isImmediate() ) : 0;
75  }
76  virtual int taskTypeId() const { return 1; }
77 };
78 
79 } // namespace
80 
81 #endif /* EXPIREJOB_H */
82 
Mail folder.
Definition: kmfolder.h:69
A scheduled "expire mails in this folder" task.
Definition: expirejob.h:66
virtual ScheduledJob * run()
Run this task, i.e.
Definition: expirejob.h:73
ScheduledExpireTask(KMFolder *folder, bool immediate)
If immediate is set, the job will execute synchronously.
Definition: expirejob.h:70
virtual int taskTypeId() const
An identifier for the type of task (a bit like TQListViewItem::rtti) This allows to automatically pre...
Definition: expirejob.h:76
Base class for scheduled jobs.
Definition: jobscheduler.h:144
A scheduled task is some information about a folder job that should be run later.
Definition: jobscheduler.h:54
KMFolder * folder() const
The folder which this task is about, 0 if it was deleted meanwhile.
Definition: jobscheduler.h:79
folderdiaquotatab.h
Definition: aboutdata.cpp:40