client-registrar.h Source File

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

client-registrar.h
1
23 #ifndef _TelepathyQt_client_registrar_h_HEADER_GUARD_
24 #define _TelepathyQt_client_registrar_h_HEADER_GUARD_
25
26 #ifndef IN_TP_QT_HEADER
27 #error IN_TP_QT_HEADER
28 #endif
29
30 #include <TelepathyQt/AccountFactory>
31 #include <TelepathyQt/ChannelFactory>
32 #include <TelepathyQt/ConnectionFactory>
33 #include <TelepathyQt/ContactFactory>
34 #include <TelepathyQt/Object>
35 #include <TelepathyQt/Types>
36
37 #include <QDBusConnection>
38 #include <QString>
39
40 namespace Tp
41 {
42
43 class TP_QT_EXPORT ClientRegistrar : public Object
44 {
45 Q_OBJECT
46 Q_DISABLE_COPY(ClientRegistrar)
47
48 public:
49 static ClientRegistrarPtr create(const QDBusConnection &bus);
50 static ClientRegistrarPtr create(
51 const AccountFactoryConstPtr &accountFactory =
52 AccountFactory::create(QDBusConnection::sessionBus()),
53 const ConnectionFactoryConstPtr &connectionFactory =
54 ConnectionFactory::create(QDBusConnection::sessionBus()),
55 const ChannelFactoryConstPtr &channelFactory =
56 ChannelFactory::create(QDBusConnection::sessionBus()),
57 const ContactFactoryConstPtr &contactFactory =
58 ContactFactory::create());
59 static ClientRegistrarPtr create(const QDBusConnection &bus,
60 const AccountFactoryConstPtr &accountFactory,
61 const ConnectionFactoryConstPtr &connectionFactory,
62 const ChannelFactoryConstPtr &channelFactory,
63 const ContactFactoryConstPtr &contactFactory);
64 static ClientRegistrarPtr create(const AccountManagerPtr &accountManager);
65
66 ~ClientRegistrar();
67
68 QDBusConnection dbusConnection() const;
69
70 AccountFactoryConstPtr accountFactory() const;
71 ConnectionFactoryConstPtr connectionFactory() const;
72 ChannelFactoryConstPtr channelFactory() const;
73 ContactFactoryConstPtr contactFactory() const;
74
75 QList<AbstractClientPtr> registeredClients() const;
76 bool registerClient(const AbstractClientPtr &client,
77 const QString &clientName, bool unique = false);
78 bool unregisterClient(const AbstractClientPtr &client);
79 void unregisterClients();
80
81 private:
82 ClientRegistrar(const QDBusConnection &bus,
83 const AccountFactoryConstPtr &accountFactory,
84 const ConnectionFactoryConstPtr &connectionFactory,
85 const ChannelFactoryConstPtr &channelFactory,
86 const ContactFactoryConstPtr &contactFactory);
87
88 struct Private;
89 friend struct Private;
90 Private *mPriv;
91
92 static QHash<QPair<QString, QString>, ClientRegistrar *> registrarForConnection;
93 };
94
95 } // Tp
96
97 #endif
Tp::ConnectionFactory::create
static ConnectionFactoryPtr create(const QDBusConnection &bus, const Features &features=Features())
Definition: connection-factory.cpp:57
Tp::ContactFactory::create
static ContactFactoryPtr create(const Features &features=Features())
Definition: contact-factory.cpp:48
Tp::Object
The Object class provides an object with property notification.
Definition: object.h:39
Tp::AccountFactory::create
static AccountFactoryPtr create(const QDBusConnection &bus, const Features &features=Features())
Definition: account-factory.cpp:58
Tp::ChannelFactory::create
static ChannelFactoryPtr create(const QDBusConnection &bus)
Definition: channel-factory.cpp:86
Tp::ClientRegistrar
The ClientRegistrar class is responsible for registering Telepathy clients (Observer, Approver, Handler).
Definition: client-registrar.h:43