Akonadi

trashsettings.cpp
1/*
2 SPDX-FileCopyrightText: 2011 Christian Mollekopf <chrigi_1@fastmail.fm>
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
16using 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
27void 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:62
qint64 Id
Describes the unique id type.
Definition collection.h:79
void writeEntry(const char *key, const char *value, WriteConfigFlags pFlags=Normal)
QString readEntry(const char *key, const char *aDefault=nullptr) const
AKONADICORE_EXPORT Collection getTrashCollection(const QString &resource)
Get the trash collection for the given resource.
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.
Helper integration between Akonadi and Qt.
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 4 2024 16:31:58 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.