00001
00023 #ifndef _TelepathyQt4_channel_request_h_HEADER_GUARD_
00024 #define _TelepathyQt4_channel_request_h_HEADER_GUARD_
00025
00026 #ifndef IN_TELEPATHY_QT4_HEADER
00027 #error IN_TELEPATHY_QT4_HEADER
00028 #endif
00029
00030 #include <TelepathyQt4/_gen/cli-channel-request.h>
00031
00032 #include <TelepathyQt4/Constants>
00033 #include <TelepathyQt4/DBus>
00034 #include <TelepathyQt4/DBusProxy>
00035 #include <TelepathyQt4/Feature>
00036 #include <TelepathyQt4/OptionalInterfaceFactory>
00037 #include <TelepathyQt4/ReadinessHelper>
00038 #include <TelepathyQt4/Types>
00039 #include <TelepathyQt4/SharedPtr>
00040
00041 #include <QSharedDataPointer>
00042 #include <QString>
00043 #include <QStringList>
00044 #include <QVariantMap>
00045
00046 namespace Tp
00047 {
00048
00049 class ChannelRequestHints;
00050 class PendingOperation;
00051
00052 class TELEPATHY_QT4_EXPORT ChannelRequest : public StatefulDBusProxy,
00053 public OptionalInterfaceFactory<ChannelRequest>
00054 {
00055 Q_OBJECT
00056 Q_DISABLE_COPY(ChannelRequest)
00057
00058 public:
00059 static const Feature FeatureCore;
00060
00061 static ChannelRequestPtr create(const QDBusConnection &bus,
00062 const QString &objectPath, const QVariantMap &immutableProperties,
00063 const AccountFactoryConstPtr &accountFactory,
00064 const ConnectionFactoryConstPtr &connectionFactory,
00065 const ChannelFactoryConstPtr &channelFactory,
00066 const ContactFactoryConstPtr &contactFactory);
00067
00068 static ChannelRequestPtr create(const AccountPtr &account,
00069 const QString &objectPath, const QVariantMap &immutableProperties);
00070
00071 virtual ~ChannelRequest();
00072
00073 AccountPtr account() const;
00074 QDateTime userActionTime() const;
00075 QString preferredHandler() const;
00076 QualifiedPropertyValueMapList requests() const;
00077 ChannelRequestHints hints() const;
00078
00079 QVariantMap immutableProperties() const;
00080
00081 PendingOperation *cancel();
00082
00083 ChannelPtr channel() const;
00084
00085 Q_SIGNALS:
00086 void failed(const QString &errorName, const QString &errorMessage);
00087 void succeeded();
00088 void succeeded(const Tp::ChannelPtr &channel);
00089
00090 protected:
00091 ChannelRequest(const QDBusConnection &bus,
00092 const QString &objectPath, const QVariantMap &immutableProperties,
00093 const AccountFactoryConstPtr &accountFactory,
00094 const ConnectionFactoryConstPtr &connectionFactory,
00095 const ChannelFactoryConstPtr &channelFactory,
00096 const ContactFactoryConstPtr &contactFactory);
00097
00098 ChannelRequest(const AccountPtr &account,
00099 const QString &objectPath, const QVariantMap &immutableProperties);
00100
00101 Client::ChannelRequestInterface *baseInterface() const;
00102
00103 protected:
00104
00105 void connectNotify(const char *);
00106
00107 private Q_SLOTS:
00108 TELEPATHY_QT4_NO_EXPORT void gotMainProperties(QDBusPendingCallWatcher *watcher);
00109 TELEPATHY_QT4_NO_EXPORT void onAccountReady(Tp::PendingOperation *op);
00110
00111 TELEPATHY_QT4_NO_EXPORT void onLegacySucceeded();
00112 TELEPATHY_QT4_NO_EXPORT void onSucceededWithChannel(const QDBusObjectPath &connPath, const QVariantMap &connProps,
00113 const QDBusObjectPath &chanPath, const QVariantMap &chanProps);
00114 TELEPATHY_QT4_NO_EXPORT void onChanBuilt(Tp::PendingOperation *op);
00115
00116 private:
00117 friend class PendingChannelRequest;
00118
00119 PendingOperation *proceed();
00120
00121 struct Private;
00122 friend struct Private;
00123 Private *mPriv;
00124 };
00125
00126 class TELEPATHY_QT4_EXPORT ChannelRequestHints
00127 {
00128 public:
00129 ChannelRequestHints();
00130 ChannelRequestHints(const QVariantMap &hints);
00131 ChannelRequestHints(const ChannelRequestHints &other);
00132 ~ChannelRequestHints();
00133
00134 ChannelRequestHints &operator=(const ChannelRequestHints &other);
00135
00136 bool isValid() const;
00137
00138 bool hasHint(const QString &reversedDomain, const QString &localName) const;
00139 QVariant hint(const QString &reversedDomain, const QString &localName) const;
00140 void setHint(const QString &reversedDomain, const QString &localName, const QVariant &value);
00141
00142 QVariantMap allHints() const;
00143
00144 private:
00145 struct Private;
00146 friend struct Private;
00147 QSharedDataPointer<Private> mPriv;
00148 };
00149
00150 }
00151
00152 Q_DECLARE_METATYPE(Tp::ChannelRequestHints);
00153
00154 #endif