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 }
Represents a collection of PIM items.
Definition: collection.h:63
qint64 Id
Describes the unique id type.
Definition: collection.h:69
void writeEntry(const QString &key, const QVariant &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.
Id id() const
Returns the unique identifier of the collection.
Definition: collection.cpp:98
AKONADICORE_EXPORT Collection getTrashCollection(const QString &resource)
Get the trash collection for the given resource.
Helper integration between Akonadi and Qt.
T readEntry(const QString &key, const T &aDefault) const
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Sat Nov 21 2020 23:17:06 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.