File indexing completed on 2024-11-10 04:50:07
0001 /* 0002 SPDX-FileCopyrightText: 2017-2024 Laurent Montel <montel@kde.org> 0003 0004 SPDX-License-Identifier: GPL-2.0-or-later 0005 */ 0006 0007 #include "filterimporterpathcache.h" 0008 0009 using namespace MailCommon; 0010 FilterImporterPathCache::FilterImporterPathCache(QObject *parent) 0011 : QObject(parent) 0012 { 0013 } 0014 0015 FilterImporterPathCache::~FilterImporterPathCache() = default; 0016 0017 FilterImporterPathCache *FilterImporterPathCache::self() 0018 { 0019 static FilterImporterPathCache s_self; 0020 return &s_self; 0021 } 0022 0023 int FilterImporterPathCache::count() const 0024 { 0025 return mFilterCache.count(); 0026 } 0027 0028 void FilterImporterPathCache::insert(const QString &original, const Akonadi::Collection &newValue) 0029 { 0030 if (original.isEmpty() || !newValue.isValid()) { 0031 return; 0032 } 0033 0034 mFilterCache.insert(original, newValue); 0035 } 0036 0037 Akonadi::Collection FilterImporterPathCache::convertedFilterPath(const QString &original) 0038 { 0039 return mFilterCache.value(original); 0040 } 0041 0042 void FilterImporterPathCache::clear() 0043 { 0044 mFilterCache.clear(); 0045 } 0046 0047 #include "moc_filterimporterpathcache.cpp"