Home · All Classes · All Namespaces · Modules · Functions · Files
base-connection-manager.h
1 
23 #ifndef _TelepathyQt_base_connection_manager_h_HEADER_GUARD_
24 #define _TelepathyQt_base_connection_manager_h_HEADER_GUARD_
25 
26 #ifndef IN_TP_QT_HEADER
27 #error IN_TP_QT_HEADER
28 #endif
29 
30 #include <TelepathyQt/DBusService>
31 #include <TelepathyQt/Global>
32 #include <TelepathyQt/Types>
33 
34 #include <QDBusConnection>
35 
36 class QString;
37 
38 namespace Tp
39 {
40 
41 class TP_QT_EXPORT BaseConnectionManager : public DBusService
42 {
43  Q_OBJECT
44  Q_DISABLE_COPY(BaseConnectionManager)
45 
46 public:
47  static BaseConnectionManagerPtr create(const QString &name)
48  {
49  return BaseConnectionManagerPtr(new BaseConnectionManager(
50  QDBusConnection::sessionBus(), name));
51  }
52  template<typename BaseConnectionManagerSubclass>
54  {
55  return SharedPtr<BaseConnectionManagerSubclass>(new BaseConnectionManagerSubclass(
56  QDBusConnection::sessionBus(), name));
57  }
58  static BaseConnectionManagerPtr create(const QDBusConnection &dbusConnection,
59  const QString &name)
60  {
61  return BaseConnectionManagerPtr(new BaseConnectionManager(dbusConnection, name));
62  }
63  template<typename BaseConnectionManagerSubclass>
64  static SharedPtr<BaseConnectionManagerSubclass> create(const QDBusConnection &dbusConnection,
65  const QString &name)
66  {
67  return SharedPtr<BaseConnectionManagerSubclass>(new BaseConnectionManagerSubclass(
68  dbusConnection, name));
69  }
70 
71  virtual ~BaseConnectionManager();
72 
73  QString name() const;
74 
75  QVariantMap immutableProperties() const;
76 
77  QList<BaseProtocolPtr> protocols() const;
78  BaseProtocolPtr protocol(const QString &protocolName) const;
79  bool hasProtocol(const QString &protocolName) const;
80  bool addProtocol(const BaseProtocolPtr &protocol);
81 
82  bool registerObject(DBusError *error = NULL);
83 
84  QList<BaseConnectionPtr> connections() const;
85 
86 Q_SIGNALS:
87  void newConnection(const BaseConnectionPtr &connection);
88 
89 protected:
90  BaseConnectionManager(const QDBusConnection &dbusConnection, const QString &name);
91 
92  virtual bool registerObject(const QString &busName, const QString &objectPath,
93  DBusError *error);
94 
95 private Q_SLOTS:
96  TP_QT_NO_EXPORT void removeConnection();
97 
98 private:
99  TP_QT_NO_EXPORT void addConnection(const BaseConnectionPtr &connection);
100 
101  class Adaptee;
102  friend class Adaptee;
103  class Private;
104  friend class Private;
105  Private *mPriv;
106 };
107 
108 }
109 
110 #endif
static BaseConnectionManagerPtr create(const QString &name)
Definition: base-connection-manager.h:47
Base class for connection manager implementations.
Definition: base-connection-manager.h:41
Small container class, containing a D-Bus error.
Definition: dbus-error.h:35
static SharedPtr< BaseConnectionManagerSubclass > create(const QDBusConnection &dbusConnection, const QString &name)
Definition: base-connection-manager.h:64
static SharedPtr< BaseConnectionManagerSubclass > create(const QString &name)
Definition: base-connection-manager.h:53
The SharedPtr class is a pointer to an explicitly shared object.
Definition: shared-ptr.h:39
static BaseConnectionManagerPtr create(const QDBusConnection &dbusConnection, const QString &name)
Definition: base-connection-manager.h:58
Base class for D-Bus services.
Definition: dbus-service.h:46


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