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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
|
// 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
#ifndef INTENTSERVERREQUEST_H
#define INTENTSERVERREQUEST_H
#include <QtCore/QObject>
#include <QtCore/QString>
#include <QtCore/QVariantMap>
#include <QtCore/QUuid>
#include <QtCore/QVector>
#include <QtCore/QPointer>
#include <QtAppManCommon/global.h>
#include <QtAppManIntentServer/intent.h>
QT_BEGIN_NAMESPACE_AM
class IntentServer;
class IntentServerRequest : public QObject
{
Q_OBJECT
public:
IntentServerRequest(const QString &requestingApplicationId, const QString &intentId,
const QVector<Intent *> &potentialIntents, const QVariantMap ¶meters,
bool broadcast);
enum class State {
ReceivedRequest,
WaitingForDisambiguation,
Disambiguated,
WaitingForApplicationStart,
StartedApplication,
WaitingForReplyFromApplication,
ReceivedReplyFromApplication,
};
Q_ENUM(State)
State state() const;
QUuid requestId() const;
QString intentId() const;
QString requestingApplicationId() const;
Intent *selectedIntent() const;
QList<Intent *> potentialIntents() const;
QVariantMap parameters() const;
bool succeeded() const;
QVariantMap result() const;
bool isBroadcast() const;
void setState(State newState);
void setSelectedIntent(Intent *intent);
void setRequestFailed(const QString &errorMessage);
void setRequestSucceeded(const QVariantMap &result);
private:
QUuid m_id;
State m_state;
bool m_succeeded = false;
bool m_broadcast = false;
QString m_intentId;
QString m_requestingApplicationId;
// These are copies of the real intents, as QML cannot cope with QPointer<Intent> and the
// real Intent pointers could die during handling, due to app removal.
Intent *m_selectedIntent = nullptr;
QVector<Intent *> m_potentialIntents;
QVariantMap m_parameters;
QVariantMap m_result;
};
QT_END_NAMESPACE_AM
#endif // INTENTSERVERREQUEST_H
|