kmail
expirejob.h
00001 /* -*- mode: C++ -*- 00002 * Copyright (c) 2004 David Faure <faure@kde.org> 00003 * 00004 * This program is free software; you can redistribute it and/or modify 00005 * it under the terms of the GNU General Public License as published by 00006 * the Free Software Foundation; version 2 of the License 00007 * 00008 * This program is distributed in the hope that it will be useful, 00009 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00010 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00011 * GNU General Public License for more details. 00012 * 00013 * You should have received a copy of the GNU General Public License 00014 * along with this program; if not, write to the Free Software 00015 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 00016 * 00017 * In addition, as a special exception, the copyright holders give 00018 * permission to link the code of this program with any edition of 00019 * the TQt library by Trolltech AS, Norway (or with modified versions 00020 * of TQt that use the same license as TQt), and distribute linked 00021 * combinations including the two. You must obey the GNU General 00022 * Public License in all respects for all of the code used other than 00023 * TQt. If you modify this file, you may extend this exception to 00024 * your version of the file, but you are not obligated to do so. If 00025 * you do not wish to do so, delete this exception statement from 00026 * your version. 00027 */ 00028 #ifndef EXPIREJOB_H 00029 #define EXPIREJOB_H 00030 00031 #include "jobscheduler.h" 00032 #include "kmcommands.h" 00033 00034 namespace KMail { 00035 00036 class ExpireJob : public ScheduledJob 00037 { 00038 Q_OBJECT 00039 00040 public: 00041 ExpireJob( KMFolder* folder, bool immediate ); 00042 virtual ~ExpireJob(); 00043 00044 virtual void execute(); 00045 virtual void kill(); 00046 00047 private slots: 00048 void slotDoWork(); 00049 void slotMessagesMoved( KMCommand *command ); 00050 00051 private: 00052 void done(); 00053 00054 private: 00055 TQTimer mTimer; 00056 TQPtrList<KMMsgBase> mRemovedMsgs; 00057 int mCurrentIndex; 00058 int mMaxUnreadTime; 00059 int mMaxReadTime; 00060 bool mFolderOpen; 00061 KMFolder *mMoveToFolder; 00062 }; 00063 00065 class ScheduledExpireTask : public ScheduledTask 00066 { 00067 public: 00070 ScheduledExpireTask( KMFolder* folder, bool immediate ) 00071 : ScheduledTask( folder, immediate ) {} 00072 virtual ~ScheduledExpireTask() {} 00073 virtual ScheduledJob* run() { 00074 return folder() ? new ExpireJob( folder(), isImmediate() ) : 0; 00075 } 00076 virtual int taskTypeId() const { return 1; } 00077 }; 00078 00079 } // namespace 00080 00081 #endif /* EXPIREJOB_H */ 00082