File indexing completed on 2024-11-10 04:40:26
0001 /* 0002 SPDX-FileCopyrightText: 2010 Volker Krause <vkrause@kde.org> 0003 0004 SPDX-License-Identifier: LGPL-2.0-or-later 0005 */ 0006 0007 #include "agentthread.h" 0008 #include "akonadiagentserver_debug.h" 0009 0010 #include "shared/akdebug.h" 0011 #include <QMetaObject> 0012 0013 using namespace Akonadi; 0014 0015 AgentThread::AgentThread(const QString &identifier, QObject *factory, QObject *parent) 0016 : QThread(parent) 0017 , m_identifier(identifier) 0018 , m_factory(factory) 0019 { 0020 } 0021 0022 void AgentThread::run() 0023 { 0024 // // clang-format off 0025 const bool invokeSucceeded = 0026 QMetaObject::invokeMethod(m_factory, "createInstance", Qt::DirectConnection, Q_RETURN_ARG(QObject *, m_instance), Q_ARG(QString, m_identifier)); 0027 // clang-format on 0028 if (invokeSucceeded) { 0029 qCDebug(AKONADIAGENTSERVER_LOG) << Q_FUNC_INFO << "agent instance created: " << m_instance; 0030 } else { 0031 qCDebug(AKONADIAGENTSERVER_LOG) << Q_FUNC_INFO << "agent instance creation failed"; 0032 } 0033 0034 exec(); 0035 delete m_instance; 0036 m_instance = nullptr; 0037 } 0038 0039 void AgentThread::configure(qlonglong windowId) 0040 { 0041 QMetaObject::invokeMethod(m_instance, "configure", Qt::DirectConnection, Q_ARG(quintptr, (quintptr)windowId)); 0042 } 0043 0044 #include "moc_agentthread.cpp"