File indexing completed on 2024-09-22 04:50:04

0001 /*
0002   SPDX-FileCopyrightText: 2017-2024 Laurent Montel <montel@kde.org>
0003 
0004   SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 #pragma once
0008 
0009 #include "mailcommon_export.h"
0010 #include <Akonadi/Collection>
0011 #include <QHash>
0012 #include <QObject>
0013 namespace MailCommon
0014 {
0015 /**
0016  * @brief The FilterImporterPathCache class
0017  * @author Laurent Montel <montel@kde.org>
0018  */
0019 class MAILCOMMON_EXPORT FilterImporterPathCache : public QObject
0020 {
0021     Q_OBJECT
0022 public:
0023     static FilterImporterPathCache *self();
0024 
0025     explicit FilterImporterPathCache(QObject *parent = nullptr);
0026     ~FilterImporterPathCache() override;
0027 
0028     void insert(const QString &original, const Akonadi::Collection &newValue);
0029     [[nodiscard]] Akonadi::Collection convertedFilterPath(const QString &original);
0030     void clear();
0031     [[nodiscard]] int count() const;
0032 
0033 private:
0034     QHash<QString, Akonadi::Collection> mFilterCache;
0035 };
0036 }