Akonadi

agentsearchengine.cpp
1 /*
2  SPDX-FileCopyrightText: 2010 Volker Krause <[email protected]>
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 
15 using namespace Akonadi;
16 using 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() << QLatin1String("") << 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 }
QString message() const const
Represents a collection of PIM items.
Definition: collection.h:61
Definition: item.h:32
void removeSearch(qint64 id) override
Removes the collection with the given id from the search.
bool isValid() const const
void addSearch(const Collection &collection) override
Adds the given collection to the search.
QDBusError lastError() const const
QDBusMessage callWithArgumentList(QDBus::CallMode mode, const QString &method, const QList< QVariant > &args)
Helper integration between Akonadi and Qt.
This file is part of the KDE documentation.
Documentation copyright © 1996-2022 The KDE developers.
Generated on Sat Jul 2 2022 06:41:46 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.