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 <QMetaObject>
11 #include <shared/akdebug.h>
12 
13 using namespace Akonadi;
14 
15 AgentThread::AgentThread(const QString &identifier, QObject *factory, QObject *parent)
16  : QThread(parent)
17  , m_identifier(identifier)
18  , m_factory(factory)
19 {
20 }
21 
22 void AgentThread::run()
23 {
24  // // clang-format off
25  const bool invokeSucceeded =
26  QMetaObject::invokeMethod(m_factory, "createInstance", Qt::DirectConnection, Q_RETURN_ARG(QObject *, m_instance), Q_ARG(QString, m_identifier));
27  // clang-format on
28  if (invokeSucceeded) {
29  qCDebug(AKONADIAGENTSERVER_LOG) << Q_FUNC_INFO << "agent instance created: " << m_instance;
30  } else {
31  qCDebug(AKONADIAGENTSERVER_LOG) << Q_FUNC_INFO << "agent instance creation failed";
32  }
33 
34  exec();
35  delete m_instance;
36  m_instance = nullptr;
37 }
38 
39 void AgentThread::configure(qlonglong windowId)
40 {
41  QMetaObject::invokeMethod(m_instance, "configure", Qt::DirectConnection, Q_ARG(quintptr, (quintptr)windowId));
42 }
void configure(qlonglong windowId)
Configures the agent.
Definition: agentthread.cpp:39
int exec()
AgentThread(const QString &identifier, QObject *factory, QObject *parent=nullptr)
Creates a new agent thread.
Definition: agentthread.cpp:15
DirectConnection
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.
This file is part of the KDE documentation.
Documentation copyright © 1996-2022 The KDE developers.
Generated on Thu Jun 30 2022 03:51:45 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.