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 "entities.h"
9 #include "akonadiserver_search_debug.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()
25  << QLatin1String("")
26  << collection.id();
27  agentMgr.callWithArgumentList(QDBus::NoBlock, QStringLiteral("addSearch"), args);
28  return;
29  }
30 
31  qCCritical(AKONADISERVER_SEARCH_LOG) << "Failed to connect to agent manager: " << agentMgr.lastError().message();
32 }
33 
35 {
36  QDBusInterface agentMgr(DBus::serviceName(DBus::Control),
37  QStringLiteral(AKONADI_DBUS_AGENTMANAGER_PATH),
38  QStringLiteral("org.freedesktop.Akonadi.AgentManagerInternal"));
39  if (agentMgr.isValid()) {
40  const QList<QVariant> args = {id};
41  agentMgr.callWithArgumentList(QDBus::NoBlock, QStringLiteral("removeSearch"), args);
42  return;
43  }
44 
45  qCCritical(AKONADISERVER_SEARCH_LOG) << "Failed to connect to agent manager: " << agentMgr.lastError().message();
46 }
bool isValid() const const
Represents a collection of PIM items.
Definition: collection.h:63
QString message() const const
void removeSearch(qint64 id) override
Removes the collection with the given id from the search.
void addSearch(const Collection &collection) override
Adds the given collection to the search.
Id id() const
Returns the unique identifier of the collection.
Definition: collection.cpp:98
Helper integration between Akonadi and Qt.
QDBusError lastError() const const
QDBusMessage callWithArgumentList(QDBus::CallMode mode, const QString &method, const QList< QVariant > &args)
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Sat Jan 23 2021 07:17:46 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.