Akonadi
7#include "resourcemanager.h"
8#include "resourcemanageradaptor.h"
9#include "storage/datastore.h"
10#include "storage/transaction.h"
13#include "private/capabilities_p.h"
14#include "shared/akranges.h"
16#include <QDBusConnection>
18using namespace Akonadi::Server;
19using namespace AkRanges;
21ResourceManager::ResourceManager(
Tracer &tracer)
24 new ResourceManagerAdaptor(
this);
28void ResourceManager::addResourceInstance(
const QString &name,
const QStringList &capabilities)
30 Transaction transaction(
DataStore::self(), QStringLiteral(
"ADD RESOURCE INSTANCE"));
31 Resource resource = Resource::retrieveByName(name);
32 if (resource.isValid()) {
33 mTracer.error(
"ResourceManager", QStringLiteral(
"Resource '%1' already exists.").arg(name));
39 resource.setIsVirtual(
capabilities.contains(QLatin1StringView(AKONADI_AGENT_CAPABILITY_VIRTUAL)));
40 if (!resource.insert()) {
41 mTracer.error(
"ResourceManager", QStringLiteral(
"Could not create resource '%1'.").arg(name));
46void ResourceManager::removeResourceInstance(
const QString &name)
49 Resource resource = Resource::retrieveByName(name);
50 if (resource.isValid()) {
51 resource.collections() | Actions::forEach([](Collection col) {
60QStringList ResourceManager::resourceInstances()
const
62 return Resource::retrieveAll() | Views::transform(&
Resource::name) | Actions::toQList;
65#include "moc_resourcemanager.cpp"
virtual bool cleanupCollection(Collection &collection)
removes the given collection and all its content
static DataStore * self()
Per thread singleton.
The global tracer instance where all akonadi components can send their tracing information to.
void setName(QString value)
Capabilities capabilities()
bool registerObject(const QString &path, QObject *object, RegisterOptions options)
QDBusConnection sessionBus()
This file is part of the KDE documentation.
Documentation copyright © 1996-2025 The KDE developers.
Generated on Fri Jan 24 2025 11:49:57 by
doxygen 1.13.2 written
by
Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.