Akonadi

agentsearchengine.cpp
1/*
2 SPDX-FileCopyrightText: 2010 Volker Krause <vkrause@kde.org>
3
4 SPDX-License-Identifier: LGPL-2.0-or-later
5*/
6
7#include "agentsearchengine.h"
8#include "akonadiserver_search_debug.h"
9#include "entities.h"
10
11#include "private/dbus_p.h"
12
13#include <QDBusInterface>
14
15using namespace Akonadi;
16using namespace Akonadi::Server;
17
19{
20 QDBusInterface agentMgr(DBus::serviceName(DBus::Control),
21 QStringLiteral(AKONADI_DBUS_AGENTMANAGER_PATH),
22 QStringLiteral("org.freedesktop.Akonadi.AgentManagerInternal"));
23 if (agentMgr.isValid()) {
24 const QList<QVariant> args = QList<QVariant>() << collection.queryString() << QLatin1StringView("") << collection.id();
25 agentMgr.callWithArgumentList(QDBus::NoBlock, QStringLiteral("addSearch"), args);
26 return;
27 }
28
29 qCCritical(AKONADISERVER_SEARCH_LOG) << "Failed to connect to agent manager: " << agentMgr.lastError().message();
30}
31
33{
34 QDBusInterface agentMgr(DBus::serviceName(DBus::Control),
35 QStringLiteral(AKONADI_DBUS_AGENTMANAGER_PATH),
36 QStringLiteral("org.freedesktop.Akonadi.AgentManagerInternal"));
37 if (agentMgr.isValid()) {
38 const QList<QVariant> args = {id};
39 agentMgr.callWithArgumentList(QDBus::NoBlock, QStringLiteral("removeSearch"), args);
40 return;
41 }
42
43 qCCritical(AKONADISERVER_SEARCH_LOG) << "Failed to connect to agent manager: " << agentMgr.lastError().message();
44}
Represents a collection of PIM items.
Definition collection.h:62
void addSearch(const Collection &collection) override
Adds the given collection to the search.
void removeSearch(qint64 id) override
Removes the collection with the given id from the search.
Helper integration between Akonadi and Qt.
QDBusMessage callWithArgumentList(QDBus::CallMode mode, const QString &method, const QList< QVariant > &args)
bool isValid() const const
QDBusError lastError() const const
QString message() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Jun 21 2024 11:57:49 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.