File indexing completed on 2024-10-27 04:51:03
0001 /* 0002 SPDX-FileCopyrightText: 2013-2024 Laurent Montel <montel@kde.org> 0003 0004 SPDX-License-Identifier: GPL-2.0-or-later 0005 */ 0006 #pragma once 0007 0008 #include <Akonadi/Collection> 0009 #include <QDateTime> 0010 #include <QHash> 0011 #include <QObject> 0012 0013 class FolderArchiveAccountInfo; 0014 0015 struct ArchiveCache { 0016 QDate date = QDate::currentDate(); 0017 Akonadi::Collection::Id colId = -1; 0018 }; 0019 0020 class FolderArchiveCache : public QObject 0021 { 0022 Q_OBJECT 0023 public: 0024 explicit FolderArchiveCache(QObject *parent = nullptr); 0025 ~FolderArchiveCache() override; 0026 0027 void addToCache(const QString &resourceName, Akonadi::Collection::Id id); 0028 0029 [[nodiscard]] Akonadi::Collection::Id collectionId(FolderArchiveAccountInfo *info); 0030 0031 void clearCacheWithContainsCollection(Akonadi::Collection::Id id); 0032 0033 void clearCache(); 0034 0035 private: 0036 QHash<QString, ArchiveCache> mCache; 0037 };