1 /*
2    SPDX-FileCopyrightText: 2013-2021 Laurent Montel <montel@kde.org>
3 
4    SPDX-License-Identifier: GPL-2.0-or-later
5 */
6 #pragma once
7 
8 #include "kmail_private_export.h"
9 #include <Akonadi/Collection>
10 #include <KConfigGroup>
11 
12 class KMAILTESTS_TESTS_EXPORT FolderArchiveAccountInfo
13 {
14 public:
15     FolderArchiveAccountInfo();
16     FolderArchiveAccountInfo(const KConfigGroup &config);
17     ~FolderArchiveAccountInfo();
18 
19     enum FolderArchiveType {
20         UniqueFolder,
21         FolderByMonths,
22         FolderByYears,
23     };
24 
25     Q_REQUIRED_RESULT bool isValid() const;
26 
27     Q_REQUIRED_RESULT QString instanceName() const;
28     void setInstanceName(const QString &instance);
29 
30     void setArchiveTopLevel(Akonadi::Collection::Id id);
31     Q_REQUIRED_RESULT Akonadi::Collection::Id archiveTopLevel() const;
32 
33     void setFolderArchiveType(FolderArchiveType type);
34     Q_REQUIRED_RESULT FolderArchiveType folderArchiveType() const;
35 
36     void setEnabled(bool enabled);
37     Q_REQUIRED_RESULT bool enabled() const;
38 
39     void setKeepExistingStructure(bool b);
40     Q_REQUIRED_RESULT bool keepExistingStructure() const;
41 
42     void writeConfig(KConfigGroup &config);
43     void readConfig(const KConfigGroup &config);
44 
45     Q_REQUIRED_RESULT bool operator==(const FolderArchiveAccountInfo &other) const;
46 
47 private:
48     Akonadi::Collection::Id mArchiveTopLevelCollectionId = -1;
49     QString mInstanceName;
50     FolderArchiveAccountInfo::FolderArchiveType mArchiveType = UniqueFolder;
51     bool mEnabled = false;
52     bool mKeepExistingStructure = false;
53 };
54 
55