Astyle kdelibs
[kdepim.git] / kmail / folderarchive / folderarchivemanager.h
blobee8f15726b26e506862c32593a388d8a5edea78e
1 /*
2 Copyright (c) 2013, 2014 Montel Laurent <montel@kde.org>
4 This program is free software; you can redistribute it and/or modify it
5 under the terms of the GNU General Public License, version 2, as
6 published by the Free Software Foundation.
8 This program is distributed in the hope that it will be useful, but
9 WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 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
18 #ifndef FOLDERARCHIVEMANAGER_H
19 #define FOLDERARCHIVEMANAGER_H
21 #include <QObject>
22 #include <QQueue>
23 namespace Akonadi
25 class AgentInstance;
26 class Collection;
27 class Item;
30 class FolderArchiveAccountInfo;
31 class FolderArchiveAgentJob;
32 class FolderArchiveCache;
33 class KJob;
34 class FolderArchiveManager : public QObject
36 Q_OBJECT
37 public:
38 explicit FolderArchiveManager(QObject *parent = 0);
39 ~FolderArchiveManager();
41 void load();
42 void setArchiveItems(const QList<Akonadi::Item> &items, const QString &instanceName);
43 void setArchiveItem(qlonglong itemId);
45 void moveFailed(const QString &msg);
46 void moveDone();
48 void collectionRemoved(const Akonadi::Collection &collection);
50 FolderArchiveCache *folderArchiveCache() const;
51 void reloadConfig();
53 public Q_SLOTS:
54 void slotCollectionRemoved(const Akonadi::Collection &collection);
55 void slotInstanceRemoved(const Akonadi::AgentInstance &instance);
57 private Q_SLOTS:
58 void slotFetchParentCollection(KJob *job);
59 void slotFetchCollection(KJob *job);
61 private:
62 FolderArchiveAccountInfo *infoFromInstanceName(const QString &instanceName) const;
63 void nextJob();
64 void removeInfo(const QString &instanceName);
65 QQueue<FolderArchiveAgentJob *> mJobQueue;
66 FolderArchiveAgentJob *mCurrentJob;
67 QList<FolderArchiveAccountInfo *> mListAccountInfo;
68 FolderArchiveCache *mFolderArchiveCache;
71 #endif // FOLDERARCHIVEMANAGER_H