channel-request.h Source File

| Home · All Classes · All Namespaces · Modules · Functions · Files

channel-request.h
1
23 #ifndef _TelepathyQt_channel_request_h_HEADER_GUARD_
24 #define _TelepathyQt_channel_request_h_HEADER_GUARD_
25
26 #ifndef IN_TP_QT_HEADER
27 #error IN_TP_QT_HEADER
28 #endif
29
30 #include <TelepathyQt/_gen/cli-channel-request.h>
31
32 #include <TelepathyQt/Constants>
33 #include <TelepathyQt/DBus>
34 #include <TelepathyQt/DBusProxy>
35 #include <TelepathyQt/Feature>
36 #include <TelepathyQt/OptionalInterfaceFactory>
37 #include <TelepathyQt/ReadinessHelper>
38 #include <TelepathyQt/Types>
39 #include <TelepathyQt/SharedPtr>
40
41 #include <QSharedDataPointer>
42 #include <QString>
43 #include <QStringList>
44 #include <QVariantMap>
45
46 namespace Tp
47 {
48
49 class ChannelRequestHints;
50 class PendingOperation;
51
52 class TP_QT_EXPORT ChannelRequest : public StatefulDBusProxy,
53 public OptionalInterfaceFactory<ChannelRequest>
54 {
55 Q_OBJECT
56 Q_DISABLE_COPY(ChannelRequest)
57
58 public:
59 static const Feature FeatureCore;
60
61 static ChannelRequestPtr create(const QDBusConnection &bus,
62 const QString &objectPath, const QVariantMap &immutableProperties,
63 const AccountFactoryConstPtr &accountFactory,
64 const ConnectionFactoryConstPtr &connectionFactory,
65 const ChannelFactoryConstPtr &channelFactory,
66 const ContactFactoryConstPtr &contactFactory);
67
68 static ChannelRequestPtr create(const AccountPtr &account,
69 const QString &objectPath, const QVariantMap &immutableProperties);
70
71 virtual ~ChannelRequest();
72
73 AccountPtr account() const;
74 QDateTime userActionTime() const;
75 QString preferredHandler() const;
76 QualifiedPropertyValueMapList requests() const;
77 ChannelRequestHints hints() const;
78
79 QVariantMap immutableProperties() const;
80
81 PendingOperation *cancel();
82
83 ChannelPtr channel() const;
84
85 Q_SIGNALS:
86 void failed(const QString &errorName, const QString &errorMessage);
87 void succeeded(const Tp::ChannelPtr &channel);
88
89 protected:
90 ChannelRequest(const QDBusConnection &bus,
91 const QString &objectPath, const QVariantMap &immutableProperties,
92 const AccountFactoryConstPtr &accountFactory,
93 const ConnectionFactoryConstPtr &connectionFactory,
94 const ChannelFactoryConstPtr &channelFactory,
95 const ContactFactoryConstPtr &contactFactory);
96
97 ChannelRequest(const AccountPtr &account,
98 const QString &objectPath, const QVariantMap &immutableProperties);
99
100 Client::ChannelRequestInterface *baseInterface() const;
101
102 private Q_SLOTS:
103 TP_QT_NO_EXPORT void gotMainProperties(QDBusPendingCallWatcher *watcher);
104 TP_QT_NO_EXPORT void onAccountReady(Tp::PendingOperation *op);
105
106 TP_QT_NO_EXPORT void onLegacySucceeded();
107 TP_QT_NO_EXPORT void onSucceededWithChannel(const QDBusObjectPath &connPath, const QVariantMap &connProps,
108 const QDBusObjectPath &chanPath, const QVariantMap &chanProps);
109 TP_QT_NO_EXPORT void onChanBuilt(Tp::PendingOperation *op);
110
111 private:
112 friend class PendingChannelRequest;
113
114 PendingOperation *proceed();
115
116 struct Private;
117 friend struct Private;
118 Private *mPriv;
119 };
120
121 class TP_QT_EXPORT ChannelRequestHints
122 {
123 public:
124 ChannelRequestHints();
125 ChannelRequestHints(const QVariantMap &hints);
126 ChannelRequestHints(const ChannelRequestHints &other);
127 ~ChannelRequestHints();
128
129 ChannelRequestHints &operator=(const ChannelRequestHints &other);
130
131 bool isValid() const;
132
133 bool hasHint(const QString &reversedDomain, const QString &localName) const;
134 QVariant hint(const QString &reversedDomain, const QString &localName) const;
135 void setHint(const QString &reversedDomain, const QString &localName, const QVariant &value);
136
137 QVariantMap allHints() const;
138
139 private:
140 struct Private;
141 friend struct Private;
142 QSharedDataPointer<Private> mPriv;
143 };
144
145 } // Tp
146
147 Q_DECLARE_METATYPE(Tp::ChannelRequestHints);
148
149 #endif
Tp::ChannelRequestHints
The ChannelRequestHints class represents a dictionary of metadata provided by the channel requester w...
Definition: channel-request.h:121
Tp::Feature
The Feature class represents a feature that can be enabled on demand.
Definition: feature.h:41
Tp::StatefulDBusProxy
The StatefulDBusProxy class is a base class representing a remote object whose API is stateful...
Definition: dbus-proxy.h:96
Tp::PendingOperation
The PendingOperation class is a base class for pending asynchronous operations.
Definition: pending-operation.h:45
Tp::ChannelRequest::FeatureCore
static const Feature FeatureCore
Definition: channel-request.h:59
Tp::ChannelRequest
The ChannelRequest class represents a Telepathy channel request.
Definition: channel-request.h:52
Tp::QualifiedPropertyValueMapList
QList< QualifiedPropertyValueMap > QualifiedPropertyValueMapList
Definition: build/TelepathyQt/_gen/types.h:2417
Tp::PendingChannelRequest
The PendingChannelRequest class represents the parameters of and the reply to an asynchronous Channel...
Definition: pending-channel-request.h:46
Tp::Client::ChannelRequestInterface
Definition: cli-channel-request.h:44
Tp::OptionalInterfaceFactory
The OptionalInterfaceFactory class is a helper class for high-level D-Bus proxy classes willing to of...
Definition: optional-interface-factory.h:65