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

channel-request.h

    00001
    00023 #ifndef _TelepathyQt_channel_request_h_HEADER_GUARD_
    00024 #define _TelepathyQt_channel_request_h_HEADER_GUARD_
    00025
    00026 #ifndef IN_TP_QT_HEADER
    00027 #error IN_TP_QT_HEADER
    00028 #endif
    00029
    00030 #include <TelepathyQt/_gen/cli-channel-request.h>
    00031
    00032 #include <TelepathyQt/Constants>
    00033 #include <TelepathyQt/DBus>
    00034 #include <TelepathyQt/DBusProxy>
    00035 #include <TelepathyQt/Feature>
    00036 #include <TelepathyQt/OptionalInterfaceFactory>
    00037 #include <TelepathyQt/ReadinessHelper>
    00038 #include <TelepathyQt/Types>
    00039 #include <TelepathyQt/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 TP_QT_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(const Tp::ChannelPtr &channel);
    00088
    00089 protected:
    00090     ChannelRequest(const QDBusConnection &bus,
    00091             const QString &objectPath, const QVariantMap &immutableProperties,
    00092             const AccountFactoryConstPtr &accountFactory,
    00093             const ConnectionFactoryConstPtr &connectionFactory,
    00094             const ChannelFactoryConstPtr &channelFactory,
    00095             const ContactFactoryConstPtr &contactFactory);
    00096
    00097     ChannelRequest(const AccountPtr &account,
    00098             const QString &objectPath, const QVariantMap &immutableProperties);
    00099
    00100     Client::ChannelRequestInterface *baseInterface() const;
    00101
    00102 private Q_SLOTS:
    00103     TP_QT_NO_EXPORT void gotMainProperties(QDBusPendingCallWatcher *watcher);
    00104     TP_QT_NO_EXPORT void onAccountReady(Tp::PendingOperation *op);
    00105
    00106     TP_QT_NO_EXPORT void onLegacySucceeded();
    00107     TP_QT_NO_EXPORT void onSucceededWithChannel(const QDBusObjectPath &connPath, const QVariantMap &connProps,
    00108             const QDBusObjectPath &chanPath, const QVariantMap &chanProps);
    00109     TP_QT_NO_EXPORT void onChanBuilt(Tp::PendingOperation *op);
    00110
    00111 private:
    00112     friend class PendingChannelRequest;
    00113
    00114     PendingOperation *proceed();
    00115
    00116     struct Private;
    00117     friend struct Private;
    00118     Private *mPriv;
    00119 };
    00120
    00121 class TP_QT_EXPORT ChannelRequestHints
    00122 {
    00123 public:
    00124     ChannelRequestHints();
    00125     ChannelRequestHints(const QVariantMap &hints);
    00126     ChannelRequestHints(const ChannelRequestHints &other);
    00127     ~ChannelRequestHints();
    00128
    00129     ChannelRequestHints &operator=(const ChannelRequestHints &other);
    00130
    00131     bool isValid() const;
    00132
    00133     bool hasHint(const QString &reversedDomain, const QString &localName) const;
    00134     QVariant hint(const QString &reversedDomain, const QString &localName) const;
    00135     void setHint(const QString &reversedDomain, const QString &localName, const QVariant &value);
    00136
    00137     QVariantMap allHints() const;
    00138
    00139 private:
    00140     struct Private;
    00141     friend struct Private;
    00142     QSharedDataPointer<Private> mPriv;
    00143 };
    00144
    00145 } // Tp
    00146
    00147 Q_DECLARE_METATYPE(Tp::ChannelRequestHints);
    00148
    00149 #endif