Merge remote-tracking branch 'origin/KDE/4.10'
[kdepim.git] / archivemailagent / archivemailinfo.h
blob0a40b7ae85d383f4585bf14b94749459beeb6a83
1 /*
2 Copyright (c) 2012-2013 Montel Laurent <montel.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
17 #ifndef ARCHIVEMAILINFO_H
18 #define ARCHIVEMAILINFO_H
20 #include "mailcommon/backupjob.h"
21 #include <KConfigGroup>
22 #include <Akonadi/Collection>
23 #include <KUrl>
24 #include <QDate>
27 class ArchiveMailInfo
29 public:
30 explicit ArchiveMailInfo();
31 explicit ArchiveMailInfo(const KConfigGroup& config);
32 ~ArchiveMailInfo();
34 enum ArchiveUnit {
35 ArchiveDays = 0,
36 ArchiveWeeks,
37 ArchiveMonths,
38 ArchiveMaxUnits
41 KUrl realUrl(const QString &folderName) const;
43 bool isEmpty() const;
45 Akonadi::Collection::Id saveCollectionId() const;
46 void setSaveCollectionId(Akonadi::Collection::Id collectionId);
48 void setSaveSubCollection(bool b);
49 bool saveSubCollection() const;
51 void setUrl(const KUrl& url);
52 KUrl url() const;
54 void readConfig(const KConfigGroup& config);
55 void writeConfig(KConfigGroup & config );
57 void setArchiveType( MailCommon::BackupJob::ArchiveType type );
58 MailCommon::BackupJob::ArchiveType archiveType() const;
60 void setArchiveUnit( ArchiveMailInfo::ArchiveUnit unit );
61 ArchiveMailInfo::ArchiveUnit archiveUnit() const;
63 void setArchiveAge( int age );
64 int archiveAge() const;
66 void setLastDateSaved( const QDate& date );
67 QDate lastDateSaved() const;
69 int maximumArchiveCount() const;
70 void setMaximumArchiveCount( int max );
72 QStringList listOfArchive(const QString& foldername) const;
74 private:
75 QString dirArchive() const;
76 QDate mLastDateSaved;
77 int mArchiveAge;
78 MailCommon::BackupJob::ArchiveType mArchiveType;
79 ArchiveUnit mArchiveUnit;
80 Akonadi::Collection::Id mSaveCollectionId;
81 KUrl mPath;
82 int mMaximumArchiveCount;
83 bool mSaveSubCollection;
86 #endif // ARCHIVEMAILINFO_H