2 * Copyright (c) 2005 Till Adam <adam@kde.org>
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
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.
13 * You should have received a copy of the GNU General Public License along
14 * with this program; if not, write to the Free Software Foundation, Inc.,
15 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
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 Qt library by Trolltech AS, Norway (or with modified versions
20 * of Qt that use the same license as Qt), 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 * Qt. 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
28 #ifndef COPYFOLDERJOB_H
29 #define COPYFOLDERJOB_H
31 #include "folderjob.h"
45 * Copy a hierarchy of folders somewhere else in the folder tree. Currently
46 * online imap folders are not supported as target folders, and the same is
47 * true for search folders where it does not make much sense for them to be
50 class CopyFolderJob
: public FolderJob
56 * @param storage of the folder that should be copied
57 * @param newParent the target parent folder
59 explicit CopyFolderJob( FolderStorage
* const storage
, KMFolderDir
* const newParent
= 0 );
61 virtual ~CopyFolderJob();
63 virtual void execute();
66 Returns the newly created target folder.
68 KMFolder
* targetFolder() const { return mNewFolder
; }
72 /** Create the target directory under the new parent. Returns success or failure.*/
73 bool createTargetDir();
75 /** Copy all messages from the original folder to mNewFolder */
76 void copyMessagesToTargetDir();
78 /** Called when the CopyCommand has either successfully completed copying
79 * the contents of our folder to the new location or failed. */
80 void slotCopyCompleted( KMCommand
*command
);
82 /** Called when the previous sibling's copy operation completed.
83 * @param success indicates whether the last copy was successful. */
84 void slotCopyNextChild( bool success
= true );
86 /** Called when one of the operations of the foldre itself or one of it's
87 * child folders failed and the already created target folder needs to be
92 Called when the online IMAP folder creation finished.
94 void folderCreationDone( const QString
&name
, bool success
);
97 /** Emitted when the job is done, check the success bool */
98 void folderCopyComplete( bool success
);
101 QPointer
<FolderStorage
> const mStorage
;
102 KMFolderDir
* const mNewParent
;
103 QPointer
<KMFolder
> mNewFolder
;
104 QList
<KMFolderNode
*>::Iterator mChildFolderNodeIterator
;
105 KMFolder
* mNextChildFolder
;
106 bool mHasChildFolders
;
111 #endif /* COPYFOLDERJOB_H */