File indexing completed on 2024-11-24 04:43:56
0001 /* 0002 SPDX-FileCopyrightText: 2013-2024 Laurent Montel <montel@kde.org> 0003 0004 SPDX-License-Identifier: LGPL-2.0-or-later 0005 */ 0006 0007 #pragma once 0008 0009 #include "folderarchivesettings_private_export.h" 0010 #include <Akonadi/Collection> 0011 #include <KConfigGroup> 0012 0013 class FOLDERARCHIVESETTINGS_TESTS_EXPORT FolderArchiveAccountInfo 0014 { 0015 public: 0016 FolderArchiveAccountInfo(); 0017 explicit FolderArchiveAccountInfo(const KConfigGroup &config); 0018 ~FolderArchiveAccountInfo(); 0019 0020 enum FolderArchiveType { 0021 UniqueFolder, 0022 FolderByMonths, 0023 FolderByYears, 0024 }; 0025 0026 [[nodiscard]] bool isValid() const; 0027 0028 [[nodiscard]] QString instanceName() const; 0029 void setInstanceName(const QString &instance); 0030 0031 void setArchiveTopLevel(Akonadi::Collection::Id id); 0032 [[nodiscard]] Akonadi::Collection::Id archiveTopLevel() const; 0033 0034 void setFolderArchiveType(FolderArchiveType type); 0035 [[nodiscard]] FolderArchiveType folderArchiveType() const; 0036 0037 void setEnabled(bool enabled); 0038 [[nodiscard]] bool enabled() const; 0039 0040 void setKeepExistingStructure(bool b); 0041 [[nodiscard]] bool keepExistingStructure() const; 0042 0043 void writeConfig(KConfigGroup &config); 0044 void readConfig(const KConfigGroup &config); 0045 0046 [[nodiscard]] bool operator==(const FolderArchiveAccountInfo &other) const; 0047 0048 [[nodiscard]] bool useDateFromMessage() const; 0049 void setUseDateFromMessage(bool newUseDateFromMessage); 0050 0051 private: 0052 FolderArchiveAccountInfo::FolderArchiveType mArchiveType = UniqueFolder; 0053 Akonadi::Collection::Id mArchiveTopLevelCollectionId = -1; 0054 QString mInstanceName; 0055 bool mUseDateFromMessage = false; 0056 bool mEnabled = false; 0057 bool mKeepExistingStructure = false; 0058 };