summaryrefslogtreecommitdiff
path: root/src/intent-server-lib/intentserversysteminterface.cpp
blob: 08945c1212712ee30b1b6bbd3771868c84df735a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
// Copyright (C) 2021 The Qt Company Ltd.
// Copyright (C) 2019 Luxoft Sweden AB
// Copyright (C) 2018 Pelagicore AG
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only

#include "intentserversysteminterface.h"
#include "intentserver.h"

QT_BEGIN_NAMESPACE_AM

void IntentServerSystemInterface::initialize(IntentServer *intentServer)
{
    m_is = intentServer;

    connect(this, &IntentServerSystemInterface::replyFromApplication,
            m_is, &IntentServer::replyFromApplication);

    // we need to explicitly decouple here via QueuedConnection. Otherwise the request queue
    // handling in IntentServer can get out of sync
    connect(this, &IntentServerSystemInterface::applicationWasStarted,
            m_is, &IntentServer::applicationWasStarted, Qt::QueuedConnection);
}

IntentServer *IntentServerSystemInterface::intentServer() const
{
    return m_is;
}

IntentServerRequest *IntentServerSystemInterface::requestToSystem(const QString &requestingApplicationId,
                                                                  const QString &intentId,
                                                                  const QString &applicationId,
                                                                  const QVariantMap &parameters)
{
    // not possible to do via signal, due to return value
    return m_is->requestToSystem(requestingApplicationId, intentId, applicationId, parameters);
}

QT_END_NAMESPACE_AM

#include "moc_intentserversysteminterface.cpp"