kmail

cachedimapjob.h
1/*
2 *
3 * This file is part of KMail, the KDE mail client.
4 * Copyright (c) 2002-2003 Bo Thorsen <bo@sonofthor.dk>
5 * 2002-2003 Steffen Hansen <hansen@kde.org>
6 * 2002-2003 Zack Rusin <zack@kde.org>
7 *
8 * KMail is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License, version 2, as
10 * published by the Free Software Foundation.
11 *
12 * KMail is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 *
21 * In addition, as a special exception, the copyright holders give
22 * permission to link the code of this program with any edition of
23 * the TQt library by Trolltech AS, Norway (or with modified versions
24 * of TQt that use the same license as TQt), and distribute linked
25 * combinations including the two. You must obey the GNU General
26 * Public License in all respects for all of the code used other than
27 * TQt. If you modify this file, you may extend this exception to
28 * your version of the file, but you are not obligated to do so. If
29 * you do not wish to do so, delete this exception statement from
30 * your version.
31 *
32 * In addition, as a special exception, the copyright holders give
33 * permission to link the code of this program with any edition of
34 * the TQt library by Trolltech AS, Norway (or with modified versions
35 * of TQt that use the same license as TQt), and distribute linked
36 * combinations including the two. You must obey the GNU General
37 * Public License in all respects for all of the code used other than
38 * TQt. If you modify this file, you may extend this exception to
39 * your version of the file, but you are not obligated to do so. If
40 * you do not wish to do so, delete this exception statement from
41 * your version.
42 */
43
44#ifndef CACHEDIMAPJOB_H
45#define CACHEDIMAPJOB_H
46
47#include "folderjob.h"
48#include <tdeio/job.h>
49#include <tdeio/global.h>
50
51#include <tqptrlist.h>
52#include <tqvaluelist.h>
53#include <tqcstring.h>
54
55class KMFolderCachedImap;
56class KMAcctCachedImap;
57class KMMessage;
58
59namespace KMail {
60
61class CachedImapJob : public FolderJob {
62 TQ_OBJECT
63
64public:
67 MsgForDownload() : uid(0),flags(0),size(0) {} // for TQValueList only
68 MsgForDownload( ulong _uid, int _flags, ulong _size )
69 : uid(_uid), flags(_flags), size(_size) {}
70 ulong uid;
71 int flags;
72 ulong size;
73 };
74
75 // Get messages
76 CachedImapJob( const TQValueList<MsgForDownload>& msgs,
77 JobType type = tGetMessage, KMFolderCachedImap* folder = 0 );
78 // Put messages
79 CachedImapJob( const TQPtrList<KMMessage>& msgs,
80 JobType type, KMFolderCachedImap* folder=0 );
81 CachedImapJob( const TQValueList<unsigned long>& msgs,
82 JobType type, KMFolderCachedImap* folder=0 );
83 // Add sub folders
84 CachedImapJob( const TQValueList<KMFolderCachedImap*>& folders,
85 JobType type = tAddSubfolders,
86 KMFolderCachedImap* folder = 0 );
87 // Rename folder
88 CachedImapJob( const TQString& string1, JobType type,
89 KMFolderCachedImap* folder );
90 // Delete folders or messages
91 CachedImapJob( const TQStringList& foldersOrMsgs, JobType type,
92 KMFolderCachedImap* folder );
93 // Other jobs (list messages,expunge folder, check uid validity)
94 CachedImapJob( JobType type, KMFolderCachedImap* folder );
95
96 virtual ~CachedImapJob();
97
98 void setParentFolder( const KMFolderCachedImap* parent );
99
100signals:
101 // only emitted for uid validity checking jobs with PERMANENTFLAGS responses
102 void permanentFlags( int flags );
103
104protected:
105 virtual void execute();
106 void expungeFolder();
107 void checkUidValidity();
108 void renameFolder( const TQString &newName );
109 void listMessages();
110
111protected slots:
112 virtual void slotGetNextMessage( TDEIO::Job *job = 0 );
113 virtual void slotAddNextSubfolder( TDEIO::Job *job = 0 );
114 virtual void slotPutNextMessage();
115 virtual void slotPutMessageDataReq( TDEIO::Job *job, TQByteArray &data );
116 virtual void slotPutMessageResult( TDEIO::Job *job );
117 virtual void slotPutMessageInfoData(TDEIO::Job *, const TQString &data);
118 virtual void slotExpungeResult( TDEIO::Job *job );
119 virtual void slotDeleteNextFolder( TDEIO::Job *job = 0 );
120 virtual void slotCheckUidValidityResult( TDEIO::Job *job );
121 virtual void slotRenameFolderResult( TDEIO::Job *job );
122 virtual void slotListMessagesResult( TDEIO::Job * job );
123 void slotDeleteNextMessages( TDEIO::Job* job = 0 );
124 void slotProcessedSize( TDEIO::Job *, TDEIO::filesize_t processed );
125 void slotSubscribtionChange1Done( const TQString&, bool );
126 void slotSubscribtionChange2Done( const TQString&, bool );
127 void slotSubscribtionChange1Failed( const TQString &errorMessage );
128 void slotSubscribtionChange2Failed( const TQString &errorMessage );
129
130private:
131
132 void renameOnDisk();
133 void revertLabelChange();
134
135 KMFolderCachedImap *mFolder;
136 KMAcctCachedImap *mAccount;
137 TQValueList<KMFolderCachedImap*> mFolderList;
138 TQValueList<MsgForDownload> mMsgsForDownload;
139 TQValueList<unsigned long> mSerNumMsgList;
140 ulong mSentBytes; // previous messages
141 ulong mTotalBytes;
142 TQStringList mFoldersOrMessages; // Folder deletion: path list. Message deletion: sets of uids
143 KMMessage* mMsg;
144 TQString mString; // Used as uids and as rename target
145 TQString mOldImapPath, mNewImapPath, mNewName; // used for renaming
146 KMFolderCachedImap *mParentFolder;
147};
148
149}
150
151#endif
This is a Mime Message.
Definition: kmmessage.h:68
folderdiaquotatab.h
Definition: aboutdata.cpp:40
Information about a message to be downloaded (from the 'IMAP envelope')
Definition: cachedimapjob.h:66