2 KNode, the KDE newsreader
3 Copyright (c) 1999-2005 the KNode authors.
4 See file AUTHORS for details
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
10 You should have received a copy of the GNU General Public License
11 along with this program; if not, write to the Free Software Foundation,
12 Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, US
15 #ifndef KNFOLDERMANAGER_H
16 #define KNFOLDERMANAGER_H
23 class KNArticleManager
;
27 /** Folder manager. */
28 class KNFolderManager
: public QObject
33 KNFolderManager(KNArticleManager
*a
);
37 void setCurrentFolder( KNFolder::Ptr f
);
38 KNFolder::Ptr
currentFolder() const { return c_urrentFolder
; }
39 bool hasCurrentFolder() const { return (c_urrentFolder
!=0); }
40 KNFolder::Ptr
folder( int id
);
41 KNFolder::List
folders() const { return mFolderList
; }
43 /// Returns the root folder.
44 KNFolder::Ptr
root() const { return mFolderList
[0]; }
45 /// Returns the drafts folder.
46 KNFolder::Ptr
drafts() const { return mFolderList
[1]; }
47 /// Returns the outbox folder.
48 KNFolder::Ptr
outbox() const { return mFolderList
[2]; }
49 /// Returns the sent folder.
50 KNFolder::Ptr
sent() const { return mFolderList
[3]; }
53 bool loadHeaders( KNFolder::Ptr f
);
54 bool unloadHeaders( KNFolder::Ptr f
, bool force
= true );
55 bool loadDrafts() { return loadHeaders(drafts()); }
56 bool loadOutbox() { return loadHeaders(outbox()); }
57 bool loadSent() { return loadHeaders(sent()); }
59 // returns the new folder
60 KNFolder::Ptr
newFolder( KNFolder::Ptr p
);
61 bool deleteFolder( KNFolder::Ptr f
);
62 void emptyFolder( KNFolder::Ptr f
);
65 Returns true if the folder @p f can be moved under
68 bool canMoveFolder( KNFolder::Ptr f
, KNFolder::Ptr p
);
70 Move the folder @p f to a new parent @p p.
71 @returns false if the move is not possible.
73 bool moveFolder( KNFolder::Ptr f
, KNFolder::Ptr p
);
76 int unsentForAccount(int accId
);
79 void compactFolder( KNFolder::Ptr f
);
80 void compactAll(KNCleanUp
*cup
);
84 void importFromMBox( KNFolder::Ptr f
);
85 void exportToMBox( KNFolder::Ptr f
);
91 // signals for the collection tree to update the UI
93 * Emitted when a folder is added.
95 void folderAdded( KNFolder::Ptr f
);
97 * Emitted when a folder is removed.
99 void folderRemoved( KNFolder::Ptr f
);
100 void folderActivated( KNFolder::Ptr f
);
103 int loadCustomFolders();
105 KNFolder::Ptr c_urrentFolder
;
106 KNFolder::List mFolderList
;
108 KNArticleManager
*a_rtManager
;