kmail

compactionjob.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 COMPACTIONJOB_H
29#define COMPACTIONJOB_H
30
31#include "jobscheduler.h"
32#include <tqstringlist.h>
33
34namespace KMail {
35
40{
41 TQ_OBJECT
42
43public:
45 MboxCompactionJob( KMFolder* folder, bool immediate );
46 virtual ~MboxCompactionJob();
47
48 int executeNow( bool silent );
49 virtual void execute() { executeNow( false ); }
50 virtual void kill();
51
52private slots:
53 void slotDoWork();
54
55private:
56 // Real folder location, != location in case of symlinks
57 TQString realLocation() const;
58 void done( int rc );
59
60private:
61 TQTimer mTimer;
62 TQString mTempName;
63 FILE *mTmpFile;
64 off_t mOffset;
65 int mCurrentIndex;
66 bool mFolderOpen;
67 bool mSilent;
68};
69
74{
75 TQ_OBJECT
76
77public:
79 MaildirCompactionJob( KMFolder* folder, bool immediate );
80 virtual ~MaildirCompactionJob();
81
82 int executeNow( bool silent );
83 virtual void execute() { executeNow( false ); }
84 virtual void kill();
85
86private slots:
87 void slotDoWork();
88
89private:
90 void done( int rc );
91
92private:
93 TQTimer mTimer;
94 TQStringList mEntryList;
95 int mCurrentIndex;
96 bool mFolderOpen;
97 bool mSilent;
98};
99
102{
103public:
107 : ScheduledTask( folder, immediate ) {}
108 virtual ~ScheduledCompactionTask() {}
109 virtual ScheduledJob* run();
110 virtual int taskTypeId() const { return 2; }
111};
112
113} // namespace
114
115#endif /* COMPACTIONJOB_H */
116
Mail folder.
Definition: kmfolder.h:69
A job that runs in the background and compacts maildir folders.
Definition: compactionjob.h:74
MaildirCompactionJob(KMFolder *folder, bool immediate)
folder should be a folder with a KMFolderMaildir storage.
A job that runs in the background and compacts mbox folders.
Definition: compactionjob.h:40
MboxCompactionJob(KMFolder *folder, bool immediate)
folder should be a folder with a KMFolderMbox storage.
A scheduled "compact mails in this folder" task.
virtual int taskTypeId() const
An identifier for the type of task (a bit like TQListViewItem::rtti) This allows to automatically pre...
virtual ScheduledJob * run()
Run this task, i.e.
ScheduledCompactionTask(KMFolder *folder, bool immediate)
If immediate is set, the job will execute synchronously.
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