00001
00023 #ifndef _TelepathyQt4_connection_manager_h_HEADER_GUARD_
00024 #define _TelepathyQt4_connection_manager_h_HEADER_GUARD_
00025
00026 #ifndef IN_TELEPATHY_QT4_HEADER
00027 #error IN_TELEPATHY_QT4_HEADER
00028 #endif
00029
00030 #include <TelepathyQt4/_gen/cli-connection-manager.h>
00031
00032 #include <TelepathyQt4/ChannelFactory>
00033 #include <TelepathyQt4/ConnectionFactory>
00034 #include <TelepathyQt4/Constants>
00035 #include <TelepathyQt4/ContactFactory>
00036 #include <TelepathyQt4/DBus>
00037 #include <TelepathyQt4/DBusProxy>
00038 #include <TelepathyQt4/OptionalInterfaceFactory>
00039 #include <TelepathyQt4/ProtocolInfo>
00040 #include <TelepathyQt4/ProtocolParameter>
00041 #include <TelepathyQt4/ReadinessHelper>
00042 #include <TelepathyQt4/SharedPtr>
00043 #include <TelepathyQt4/Types>
00044
00045 namespace Tp
00046 {
00047
00048 class ConnectionManagerLowlevel;
00049 class PendingConnection;
00050 class PendingStringList;
00051
00052 class TELEPATHY_QT4_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_TELEPATHY_QT4) || defined(TP_QT4_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 TELEPATHY_QT4_NO_EXPORT void gotMainProperties(QDBusPendingCallWatcher *);
00111 TELEPATHY_QT4_NO_EXPORT void gotProtocolsLegacy(QDBusPendingCallWatcher *);
00112 TELEPATHY_QT4_NO_EXPORT void gotParametersLegacy(QDBusPendingCallWatcher *);
00113 TELEPATHY_QT4_NO_EXPORT void onProtocolReady(Tp::PendingOperation *);
00114
00115 private:
00116 friend class PendingConnection;
00117
00118 struct Private;
00119 friend struct Private;
00120 Private *mPriv;
00121 };
00122
00123 }
00124
00125 #endif