Akonadi

agentthread.cpp
1 /*
2  SPDX-FileCopyrightText: 2010 Volker Krause <[email protected]>
3 
4  SPDX-License-Identifier: LGPL-2.0-or-later
5 */
6 
7 #include "agentthread.h"
8 #include "akonadiagentserver_debug.h"
9 
10 #include <QWidget> // Needed for WId
11 
12 #include <shared/akdebug.h>
13 #include <QMetaObject>
14 
15 using namespace Akonadi;
16 
17 AgentThread::AgentThread(const QString &identifier, QObject *factory, QObject *parent)
18  : QThread(parent)
19  , m_identifier(identifier)
20  , m_factory(factory)
21 {
22 }
23 
24 void AgentThread::run()
25 {
26  const bool invokeSucceeded = QMetaObject::invokeMethod(m_factory,
27  "createInstance",
29  Q_RETURN_ARG(QObject*, m_instance),
30  Q_ARG(QString, m_identifier));
31  if (invokeSucceeded) {
32  qCDebug(AKONADIAGENTSERVER_LOG) << Q_FUNC_INFO << "agent instance created: " << m_instance;
33  } else {
34  qCDebug(AKONADIAGENTSERVER_LOG) << Q_FUNC_INFO << "agent instance creation failed";
35  }
36 
37  exec();
38  delete m_instance;
39  m_instance = nullptr;
40 }
41 
42 void AgentThread::configure(qlonglong windowId)
43 {
44  QMetaObject::invokeMethod(m_instance,
45  "configure",
47  Q_ARG(WId, (WId)windowId));
48 }
bool invokeMethod(QObject *obj, const char *member, Qt::ConnectionType type, QGenericReturnArgument ret, QGenericArgument val0, QGenericArgument val1, QGenericArgument val2, QGenericArgument val3, QGenericArgument val4, QGenericArgument val5, QGenericArgument val6, QGenericArgument val7, QGenericArgument val8, QGenericArgument val9)
Helper integration between Akonadi and Qt.
AgentThread(const QString &identifier, QObject *factory, QObject *parent=nullptr)
Creates a new agent thread.
Definition: agentthread.cpp:17
DirectConnection
int exec()
void configure(qlonglong windowId)
Configures the agent.
Definition: agentthread.cpp:42
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.