00001
00023 #ifndef _TelepathyQt_connection_manager_h_HEADER_GUARD_
00024 #define _TelepathyQt_connection_manager_h_HEADER_GUARD_
00025
00026 #ifndef IN_TP_QT_HEADER
00027 #error IN_TP_QT_HEADER
00028 #endif
00029
00030 #include <TelepathyQt/_gen/cli-connection-manager.h>
00031
00032 #include <TelepathyQt/ChannelFactory>
00033 #include <TelepathyQt/ConnectionFactory>
00034 #include <TelepathyQt/Constants>
00035 #include <TelepathyQt/ContactFactory>
00036 #include <TelepathyQt/DBus>
00037 #include <TelepathyQt/DBusProxy>
00038 #include <TelepathyQt/OptionalInterfaceFactory>
00039 #include <TelepathyQt/ProtocolInfo>
00040 #include <TelepathyQt/ProtocolParameter>
00041 #include <TelepathyQt/ReadinessHelper>
00042 #include <TelepathyQt/SharedPtr>
00043 #include <TelepathyQt/Types>
00044
00045 namespace Tp
00046 {
00047
00048 class ConnectionManagerLowlevel;
00049 class PendingConnection;
00050 class PendingStringList;
00051
00052 class TP_QT_EXPORT ConnectionManager : public StatelessDBusProxy,
00053 public OptionalInterfaceFactory<ConnectionManager>
00054 {
00055 Q_OBJECT
00056 Q_DISABLE_COPY(ConnectionManager)
00057 Q_PROPERTY(QString name READ name)
00058 Q_PROPERTY(QStringList supportedProtocols READ supportedProtocols)
00059 Q_PROPERTY(ProtocolInfoList protocols READ protocols)
00060
00061 public:
00062 static const Feature FeatureCore;
00063
00064 static ConnectionManagerPtr create(const QDBusConnection &bus,
00065 const QString &name);
00066 static ConnectionManagerPtr create(const QString &name,
00067 const ConnectionFactoryConstPtr &connectionFactory =
00068 ConnectionFactory::create(QDBusConnection::sessionBus()),
00069 const ChannelFactoryConstPtr &channelFactory =
00070 ChannelFactory::create(QDBusConnection::sessionBus()),
00071 const ContactFactoryConstPtr &contactFactory =
00072 ContactFactory::create());
00073 static ConnectionManagerPtr create(const QDBusConnection &bus,
00074 const QString &name,
00075 const ConnectionFactoryConstPtr &connectionFactory,
00076 const ChannelFactoryConstPtr &channelFactory,
00077 const ContactFactoryConstPtr &contactFactory =
00078 ContactFactory::create());
00079
00080 virtual ~ConnectionManager();
00081
00082 QString name() const;
00083
00084 ConnectionFactoryConstPtr connectionFactory() const;
00085 ChannelFactoryConstPtr channelFactory() const;
00086 ContactFactoryConstPtr contactFactory() const;
00087
00088 QStringList supportedProtocols() const;
00089 const ProtocolInfoList &protocols() const;
00090 bool hasProtocol(const QString &protocolName) const;
00091 ProtocolInfo protocol(const QString &protocolName) const;
00092
00093 static PendingStringList *listNames(
00094 const QDBusConnection &bus = QDBusConnection::sessionBus());
00095
00096 #if defined(BUILDING_TP_QT) || defined(TP_QT_ENABLE_LOWLEVEL_API)
00097 ConnectionManagerLowlevelPtr lowlevel();
00098 ConnectionManagerLowlevelConstPtr lowlevel() const;
00099 #endif
00100
00101 protected:
00102 ConnectionManager(const QDBusConnection &bus, const QString &name,
00103 const ConnectionFactoryConstPtr &connectionFactory,
00104 const ChannelFactoryConstPtr &channelFactory,
00105 const ContactFactoryConstPtr &contactFactory);
00106
00107 Client::ConnectionManagerInterface *baseInterface() const;
00108
00109 private Q_SLOTS:
00110 TP_QT_NO_EXPORT void gotMainProperties(Tp::PendingOperation *op);
00111 TP_QT_NO_EXPORT void gotProtocolsLegacy(QDBusPendingCallWatcher *watcher);
00112 TP_QT_NO_EXPORT void gotParametersLegacy(QDBusPendingCallWatcher *watcher);
00113 TP_QT_NO_EXPORT void onProtocolReady(Tp::PendingOperation *watcher);
00114
00115 private:
00116 friend class PendingConnection;
00117
00118 struct Private;
00119 friend struct Private;
00120 Private *mPriv;
00121 };
00122
00123 }
00124
00125 #endif