kmail

folderjob.h
1 /*
2  *
3  * This file is part of KMail, the KDE mail client.
4  * Copyright (c) 2003 Zack Rusin <zack@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 
31 #ifndef FOLDERJOB_H
32 #define FOLDERJOB_H
33 
34 #include "kmmessage.h"
35 
36 #include <tqobject.h>
37 #include <tqptrlist.h>
38 #include <tqstring.h>
39 
40 class KMFolder;
41 
42 namespace KMail {
43 
44 class FolderJob : public TQObject
45 {
46  TQ_OBJECT
47 
48 
49 public:
50  enum JobType { tListMessages, tGetFolder, tCreateFolder, tExpungeFolder,
51  tDeleteMessage, tGetMessage, tPutMessage, tAddSubfolders,
52  tDeleteFolders, tCheckUidValidity, tRenameFolder,
53  tCopyMessage, tMoveMessage, tOther /* used by subclasses */ };
58  FolderJob( KMMessage *msg, JobType jt = tGetMessage, KMFolder *folder = 0,
59  TQString partSpecifier = TQString() );
60 
66  FolderJob( const TQPtrList<KMMessage>& msgList, const TQString& sets,
67  JobType jt = tGetMessage, KMFolder *folder = 0 );
73  FolderJob( JobType jt );
74  virtual ~FolderJob();
75 
76  TQPtrList<KMMessage> msgList() const;
80  void start();
81 
87  virtual void kill();
88 
93  int error() const { return mErrorCode; }
94 
98  bool isCancellable() const { return mCancellable; }
99 
106  void setCancellable( bool b ) { mCancellable = b; }
107 
108  void setPassiveDestructor( bool passive ) { mPassiveDestructor = passive; }
109  bool passiveDestructor() { return mPassiveDestructor; }
110 
111 signals:
116  void messageRetrieved( KMMessage * );
117 
121  void messageUpdated( KMMessage *, TQString );
122 
127  void messageStored( KMMessage * );
128 
134  void messageCopied( TQPtrList<KMMessage> );
135 
141  void messageCopied( KMMessage * );
142 
146  void finished();
147 
154  void result( KMail::FolderJob* job );
155 
161  void progress( unsigned long bytesDownloaded, unsigned long bytesTotal );
162 
163 private:
164  void init();
165 
166 protected:
171  virtual void execute()=0;
172 
173  TQPtrList<KMMessage> mMsgList;
174  JobType mType;
175  TQString mSets;
176  KMFolder* mSrcFolder;
177  KMFolder* mDestFolder;
178  TQString mPartSpecifier;
179  int mErrorCode;
180 
181  //finished() won't be emitted when this is set
182  bool mPassiveDestructor;
183  bool mStarted;
184  bool mCancellable;
185 };
186 
187 }
188 
189 #endif
Mail folder.
Definition: kmfolder.h:69
This is a Mime Message.
Definition: kmmessage.h:68
folderdiaquotatab.h
Definition: aboutdata.cpp:40