File indexing completed on 2024-11-10 04:40:46
0001 /* 0002 SPDX-FileCopyrightText: 2011 Christian Mollekopf <chrigi_1@fastmail.fm> 0003 0004 SPDX-License-Identifier: LGPL-2.0-or-later 0005 */ 0006 0007 #include "trashsettings.h" 0008 #include "akonadicore_debug.h" 0009 0010 #include <KConfig> 0011 #include <KConfigGroup> 0012 0013 #include <QHash> 0014 #include <QString> 0015 0016 using namespace Akonadi; 0017 0018 Akonadi::Collection TrashSettings::getTrashCollection(const QString &resource) 0019 { 0020 KConfig config(QStringLiteral("akonaditrashrc")); 0021 KConfigGroup group(&config, resource); 0022 const auto colId = group.readEntry<Akonadi::Collection::Id>("TrashCollection", -1); 0023 qCWarning(AKONADICORE_LOG) << resource << colId; 0024 return Collection(colId); 0025 } 0026 0027 void TrashSettings::setTrashCollection(const QString &resource, const Akonadi::Collection &collection) 0028 { 0029 KConfig config(QStringLiteral("akonaditrashrc")); 0030 KConfigGroup group(&config, resource); 0031 qCWarning(AKONADICORE_LOG) << resource << collection.id(); 0032 group.writeEntry("TrashCollection", collection.id()); 0033 }