Home · All Classes · All Namespaces · Modules · Functions · Files
base-connection-manager.h
00001 
00023 #ifndef _TelepathyQt_base_connection_manager_h_HEADER_GUARD_
00024 #define _TelepathyQt_base_connection_manager_h_HEADER_GUARD_
00025 
00026 #ifndef IN_TP_QT_HEADER
00027 #error IN_TP_QT_HEADER
00028 #endif
00029 
00030 #include <TelepathyQt/DBusService>
00031 #include <TelepathyQt/Global>
00032 #include <TelepathyQt/Types>
00033 
00034 #include <QDBusConnection>
00035 
00036 class QString;
00037 
00038 namespace Tp
00039 {
00040 
00041 class TP_QT_EXPORT BaseConnectionManager : public DBusService
00042 {
00043     Q_OBJECT
00044     Q_DISABLE_COPY(BaseConnectionManager)
00045 
00046 public:
00047     static BaseConnectionManagerPtr create(const QString &name)
00048     {
00049         return BaseConnectionManagerPtr(new BaseConnectionManager(
00050                     QDBusConnection::sessionBus(), name));
00051     }
00052     template<typename BaseConnectionManagerSubclass>
00053     static SharedPtr<BaseConnectionManagerSubclass> create(const QString &name)
00054     {
00055         return SharedPtr<BaseConnectionManagerSubclass>(new BaseConnectionManagerSubclass(
00056                     QDBusConnection::sessionBus(), name));
00057     }
00058     static BaseConnectionManagerPtr create(const QDBusConnection &dbusConnection,
00059             const QString &name)
00060     {
00061         return BaseConnectionManagerPtr(new BaseConnectionManager(dbusConnection, name));
00062     }
00063     template<typename BaseConnectionManagerSubclass>
00064     static SharedPtr<BaseConnectionManagerSubclass> create(const QDBusConnection &dbusConnection,
00065             const QString &name)
00066     {
00067         return SharedPtr<BaseConnectionManagerSubclass>(new BaseConnectionManagerSubclass(
00068                     dbusConnection, name));
00069     }
00070 
00071     virtual ~BaseConnectionManager();
00072 
00073     QString name() const;
00074 
00075     QVariantMap immutableProperties() const;
00076 
00077     QList<BaseProtocolPtr> protocols() const;
00078     BaseProtocolPtr protocol(const QString &protocolName) const;
00079     bool hasProtocol(const QString &protocolName) const;
00080     bool addProtocol(const BaseProtocolPtr &protocol);
00081 
00082     bool registerObject(DBusError *error = NULL);
00083 
00084     QList<BaseConnectionPtr> connections() const;
00085 
00086 Q_SIGNALS:
00087     void newConnection(const BaseConnectionPtr &connection);
00088 
00089 protected:
00090     BaseConnectionManager(const QDBusConnection &dbusConnection, const QString &name);
00091 
00092     virtual bool registerObject(const QString &busName, const QString &objectPath,
00093             DBusError *error);
00094 
00095 private Q_SLOTS:
00096     TP_QT_NO_EXPORT void removeConnection();
00097 
00098 private:
00099     TP_QT_NO_EXPORT void addConnection(const BaseConnectionPtr &connection);
00100 
00101     class Adaptee;
00102     friend class Adaptee;
00103     class Private;
00104     friend class Private;
00105     Private *mPriv;
00106 };
00107 
00108 }
00109 
00110 #endif


Copyright © 2008-2011 Collabora Ltd. and Nokia Corporation
Telepathy-Qt 0.9.3