Home · All Classes · All Namespaces · Modules · Functions · Files |
The ClientRegistrar class is responsible for registering Telepathy clients (Observer, Approver, Handler). More...
#include <TelepathyQt4/ClientRegistrar>
Inherits Tp::Object.
The ClientRegistrar class is responsible for registering Telepathy clients (Observer, Approver, Handler).
Clients should inherit AbstractClientObserver, AbstractClientApprover, AbstractClientHandler or some combination of these, by using multiple inheritance, and register themselves using registerClient().
See the individual classes descriptions for more details.
One way to create a ClientRegistrar object is to just call the create method. For example:
ClientRegistrarPtr cr = ClientRegistrar::create();
You can also provide a D-Bus connection as a QDBusConnection:
ClientRegistrarPtr cr = ClientRegistrar::create(QDBusConnection::systemBus());
To register a client, just call registerClient() with a given AbstractClientPtr pointing to a valid AbstractClient instance.
class MyClient : public AbstractClientObserver, public AbstractClientHandler { ... }; ... ClientRegistrarPtr cr = ClientRegistrar::create(); SharedPtr<MyClient> client = SharedPtr<MyClient>(new MyClient(...)); cr->registerClient(AbstractClientPtr::dynamicCast(client), "myclient");
See Asynchronous Object Model, Shared Pointer Usage
Tp::ClientRegistrar::~ClientRegistrar | ( | ) |
Class destructor.
ClientRegistrarPtr Tp::ClientRegistrar::create | ( | const QDBusConnection & | bus | ) | [static] |
Create a new client registrar object using the given bus.
The instance will use an account factory creating Tp::Account objects with no features ready, a connection factory creating Tp::Connection objects with no features ready, and a channel factory creating stock Telepathy-Qt4 channel subclasses, as appropriate, with no features ready.
bus | QDBusConnection to use. |
ClientRegistrarPtr Tp::ClientRegistrar::create | ( | const AccountFactoryConstPtr & | accountFactory = AccountFactory::create(QDBusConnection::sessionBus()) , |
|
const ConnectionFactoryConstPtr & | connectionFactory = ConnectionFactory::create(QDBusConnection::sessionBus()) , |
|||
const ChannelFactoryConstPtr & | channelFactory = ChannelFactory::create(QDBusConnection::sessionBus()) , |
|||
const ContactFactoryConstPtr & | contactFactory = ContactFactory::create() |
|||
) | [static] |
Create a new client registrar object using QDBusConnection::sessionBus() and the given factories.
accountFactory | The account factory to use. | |
connectionFactory | The connection factory to use. | |
channelFactory | The channel factory to use. | |
contactFactory | The contact factory to use. |
ClientRegistrarPtr Tp::ClientRegistrar::create | ( | const QDBusConnection & | bus, | |
const AccountFactoryConstPtr & | accountFactory, | |||
const ConnectionFactoryConstPtr & | connectionFactory, | |||
const ChannelFactoryConstPtr & | channelFactory, | |||
const ContactFactoryConstPtr & | contactFactory | |||
) | [static] |
Create a new client registrar object using the given bus and the given factories.
bus | QDBusConnection to use. | |
accountFactory | The account factory to use. | |
connectionFactory | The connection factory to use. | |
channelFactory | The channel factory to use. | |
contactFactory | The contact factory to use. |
ClientRegistrarPtr Tp::ClientRegistrar::create | ( | const AccountManagerPtr & | manager | ) | [static] |
Create a new client registrar object using the bus and factories of the given Account manager.
Using this create method will enable (like any other way of passing the same factories to an AM and a registrar) getting the same Account/Connection etc. proxy instances from both AccountManager and AbstractClient implementations.
manager | The AccountManager the bus and factories of which should be used. |
QDBusConnection Tp::ClientRegistrar::dbusConnection | ( | ) | const |
Return the D-Bus connection being used by this client registrar.
AccountFactoryConstPtr Tp::ClientRegistrar::accountFactory | ( | ) | const |
Get the account factory used by this client registrar.
Only read access is provided. This allows constructing object instances and examining the object construction settings, but not changing settings. Allowing changes would lead to tricky situations where objects constructed at different times by the registrar would have unpredictably different construction settings (eg. subclass).
ConnectionFactoryConstPtr Tp::ClientRegistrar::connectionFactory | ( | ) | const |
Get the connection factory used by this client registrar.
Only read access is provided. This allows constructing object instances and examining the object construction settings, but not changing settings. Allowing changes would lead to tricky situations where objects constructed at different times by the registrar would have unpredictably different construction settings (eg. subclass).
ChannelFactoryConstPtr Tp::ClientRegistrar::channelFactory | ( | ) | const |
Get the channel factory used by this client registrar.
Only read access is provided. This allows constructing object instances and examining the object construction settings, but not changing settings. Allowing changes would lead to tricky situations where objects constructed at different times by the registrar would have unpredictably different construction settings (eg. subclass).
ContactFactoryConstPtr Tp::ClientRegistrar::contactFactory | ( | ) | const |
Get the contact factory used by this client registrar.
Only read access is provided. This allows constructing object instances and examining the object construction settings, but not changing settings. Allowing changes would lead to tricky situations where objects constructed at different times by the registrar would have unpredictably different construction settings (eg. subclass).
QList< AbstractClientPtr > Tp::ClientRegistrar::registeredClients | ( | ) | const |
Return the list of clients registered using registerClient() on this client registrar.
bool Tp::ClientRegistrar::registerClient | ( | const AbstractClientPtr & | client, | |
const QString & | clientName, | |||
bool | unique = false |
|||
) |
Register a client on D-Bus.
The client registrar will export the appropriate D-Bus interfaces, based on the abstract classes subclassed by
client. | If each of a client instance should be able to manipulate channels separately, set unique to true. |
The client name MUST be a non-empty string of ASCII digits, letters, dots and/or underscores, starting with a letter, and without sets of two consecutive dots or a dot followed by a digit.
This method will do nothing if the client is already registered, and true
will be returned.
To unregister a client use unregisterClient().
client | The client to register. | |
clientName | The client name used to register. | |
unique | Whether each of a client instance is able to manipulate channels separately. |
true
if client was successfully registered, false
otherwise.bool Tp::ClientRegistrar::unregisterClient | ( | const AbstractClientPtr & | client | ) |
Unregister a client registered using registerClient() on this client registrar.
If client was not registered previously, false
will be returned.
client | The client to unregister. |
true
if client was successfully unregistered, false
otherwise.void Tp::ClientRegistrar::unregisterClients | ( | ) |
Unregister all clients registered using registerClient() on this client registrar.
Copyright © 2008-2011 Collabora Ltd. and Nokia Corporation |
Telepathy-Qt4 0.6.5
|