1 /*
2  Copyright (c) 2011 Christian Mollekopf <[email protected]>
4  This library is free software; you can redistribute it and/or modify it
5  under the terms of the GNU Library General Public License as published by
6  the Free Software Foundation; either version 2 of the License, or (at your
7  option) any later version.
9  This library is distributed in the hope that it will be useful, but WITHOUT
10  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11  FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
12  License for more details.
14  You should have received a copy of the GNU Library General Public License
15  along with this library; see the file COPYING.LIB. If not, write to the
16  Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
17  02110-1301, USA.
18  */
20 #include "trashsettings.h"
21 #include "akonadicore_debug.h"
23 #include <KConfig>
24 #include <KConfigGroup>
26 #include <QHash>
27 #include <QString>
29 using namespace Akonadi;
32 {
33  KConfig config(QStringLiteral("akonaditrashrc"));
34  KConfigGroup group(&config, resource);
35  const Akonadi::Collection::Id colId = group.readEntry<Akonadi::Collection::Id> ("TrashCollection", -1);
36  qCWarning(AKONADICORE_LOG) << resource << colId;
37  return Collection(colId);
38 }
40 void TrashSettings::setTrashCollection(const QString &resource, const Akonadi::Collection &collection)
41 {
42  KConfig config(QStringLiteral("akonaditrashrc"));
43  KConfigGroup group(&config, resource);
44  qCWarning(AKONADICORE_LOG) << resource << collection.id();
45  group.writeEntry("TrashCollection", collection.id());
46 }
Represents a collection of PIM items.
Definition: collection.h:76
qint64 Id
Describes the unique id type.
Definition: collection.h:82
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:112
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 Mon May 25 2020 22:46:12 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.