Akonadi

trashsettings.cpp
1 /*
2  SPDX-FileCopyrightText: 2011 Christian Mollekopf <[email protected]>
3 
4  SPDX-License-Identifier: LGPL-2.0-or-later
5  */
6 
7 #include "trashsettings.h"
8 #include "akonadicore_debug.h"
9 
10 #include <KConfig>
11 #include <KConfigGroup>
12 
13 #include <QHash>
14 #include <QString>
15 
16 using namespace Akonadi;
17 
19 {
20  KConfig config(QStringLiteral("akonaditrashrc"));
21  KConfigGroup group(&config, resource);
22  const auto colId = group.readEntry<Akonadi::Collection::Id>("TrashCollection", -1);
23  qCWarning(AKONADICORE_LOG) << resource << colId;
24  return Collection(colId);
25 }
26 
27 void TrashSettings::setTrashCollection(const QString &resource, const Akonadi::Collection &collection)
28 {
29  KConfig config(QStringLiteral("akonaditrashrc"));
30  KConfigGroup group(&config, resource);
31  qCWarning(AKONADICORE_LOG) << resource << collection.id();
32  group.writeEntry("TrashCollection", collection.id());
33 }
QString readEntry(const char *key, const char *aDefault=nullptr) const
void writeEntry(const char *key, const char *value, WriteConfigFlags pFlags=Normal)
AKONADICORE_EXPORT void setTrashCollection(const QString &resource, const Collection &collection)
Set the trash collection for the given resource which is then used by the TrashJob.
Represents a collection of PIM items.
Definition: collection.h:61
AKONADICORE_EXPORT Collection getTrashCollection(const QString &resource)
Get the trash collection for the given resource.
qint64 Id
Describes the unique id type.
Definition: collection.h:79
Helper integration between Akonadi and Qt.
This file is part of the KDE documentation.
Documentation copyright © 1996-2022 The KDE developers.
Generated on Sat Jun 25 2022 06:00:33 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.