Home · All Classes · All Namespaces · Modules · Functions · Files
Public Member Functions | Protected Member Functions | List of all members
Tp::DBusProxyFactory Class Referenceabstract

The DBusProxyFactory class is a base class for all D-Bus proxy factory classes. Handles proxy caching and making them ready as appropriate. More...

#include <TelepathyQt/DBusProxyFactory>

Inheritance diagram for Tp::DBusProxyFactory:
Inheritance graph
[legend]

Public Member Functions

virtual ~DBusProxyFactory ()
 
const QDBusConnectiondbusConnection () const
 
- Public Member Functions inherited from QObject
 QObject (QObject *parent)
 
virtual  ~QObject ()
 
virtual bool event (QEvent *e)
 
virtual bool eventFilter (QObject *watched, QEvent *event)
 
virtual const QMetaObjectmetaObject () const
 
QString objectName () const
 
void setObjectName (const QString &name)
 
bool isWidgetType () const
 
bool signalsBlocked () const
 
bool blockSignals (bool block)
 
QThreadthread () const
 
void moveToThread (QThread *targetThread)
 
int startTimer (int interval)
 
void killTimer (int id)
 
findChild (const QString &name) const
 
QList< T > findChildren (const QString &name) const
 
QList< T > findChildren (const QRegExp &regExp) const
 
QObjectchild (const char *objName, const char *inheritsClass, bool recursiveSearch) const
 
const QObjectList & children () const
 
void setParent (QObject *parent)
 
void installEventFilter (QObject *filterObj)
 
void removeEventFilter (QObject *obj)
 
bool connect (const QObject *sender, const char *signal, const char *method, Qt::ConnectionType type) const
 
bool disconnect (const char *signal, const QObject *receiver, const char *method)
 
bool disconnect (const QObject *receiver, const char *method)
 
void dumpObjectTree ()
 
void dumpObjectInfo ()
 
bool setProperty (const char *name, const QVariant &value)
 
QVariant property (const char *name) const
 
QList< QByteArraydynamicPropertyNames () const
 
void destroyed (QObject *obj)
 
QObjectparent () const
 
bool inherits (const char *className) const
 
void deleteLater ()
 
 QObject (QObject *parent, const char *name)
 
void insertChild (QObject *object)
 
void removeChild (QObject *object)
 
bool isA (const char *className) const
 
const char * className () const
 
const char * name () const
 
const char * name (const char *defaultName) const
 
void setName (const char *name)
 
- Public Member Functions inherited from Tp::RefCounted
 RefCounted ()
 
virtual ~RefCounted ()
 

Protected Member Functions

 DBusProxyFactory (const QDBusConnection &bus)
 
DBusProxyPtr cachedProxy (const QString &busName, const QString &objectPath) const
 
PendingReadynowHaveProxy (const DBusProxyPtr &proxy) const
 
virtual QString finalBusNameFrom (const QString &uniqueOrWellKnown) const =0
 
virtual PendingOperationinitialPrepare (const DBusProxyPtr &proxy) const
 
virtual PendingOperationreadyPrepare (const DBusProxyPtr &proxy) const
 
virtual Features featuresFor (const DBusProxyPtr &proxy) const =0
 
- Protected Member Functions inherited from QObject
QObjectsender () const
 
int senderSignalIndex () const
 
int receivers (const char *signal) const
 
virtual void timerEvent (QTimerEvent *event)
 
virtual void childEvent (QChildEvent *event)
 
virtual void customEvent (QEvent *event)
 
virtual void connectNotify (const char *signal)
 
virtual void disconnectNotify (const char *signal)
 
bool checkConnectArgs (const char *signal, const QObject *object, const char *method)
 

Additional Inherited Members

- Static Public Member Functions inherited from QObject
QString tr (const char *sourceText, const char *disambiguation, int n)
 
QString trUtf8 (const char *sourceText, const char *disambiguation, int n)
 
bool connect (const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
 
bool connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type)
 
bool disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *method)
 
bool disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method)
 
- Static Protected Member Functions inherited from QObject
QByteArray normalizeSignalSlot (const char *signalSlot)
 
- Properties inherited from QObject
 objectName
 

Detailed Description

The DBusProxyFactory class is a base class for all D-Bus proxy factory classes. Handles proxy caching and making them ready as appropriate.

Constructor & Destructor Documentation

Tp::DBusProxyFactory::~DBusProxyFactory ( )
virtual

Class destructor.

Tp::DBusProxyFactory::DBusProxyFactory ( const QDBusConnection bus)
protected

Construct a new DBusProxyFactory object.

The intention for storing the bus here is that it generally doesn't make sense to construct proxies for multiple buses in the same context. Allowing that would lead to more complex keying needs in the cache, as well.

Parameters
busThe D-Bus bus connection for the objects constructed using this factory.

Member Function Documentation

const QDBusConnection & Tp::DBusProxyFactory::dbusConnection ( ) const

Return the D-Bus connection all of the proxies from this factory communicate with.

Returns
A QDBusConnection object.
DBusProxyPtr Tp::DBusProxyFactory::cachedProxy ( const QString busName,
const QString objectPath 
) const
protected

Return a cached proxy with the given busName and objectPath.

If a proxy has not been previously put into the cache by nowHaveProxy for those identifying attributes, or a previously cached proxy has since been invalidated and/or destroyed, a Null shared pointer is returned instead.

Parameters
busNameBus name of the proxy to return.
objectPathObject path of the proxy to return.
Returns
A pointer to the DBusProxy object, if any.
PendingReady * Tp::DBusProxyFactory::nowHaveProxy ( const DBusProxyPtr &  proxy) const
protected

Should be called by subclasses when they have a proxy, be it a newly-constructed one or one from the cache.

This function will then do the rest of the factory work, including caching the proxy if it's not cached already, doing any initialPrepare()/readyPrepare() work if appropriate, and making the features from featuresFor() ready if they aren't already.

The returned PendingReady only finishes when the initialPrepare() and readyPrepare() operations for the proxy has completed, and the requested features have all been made ready (or found unable to be made ready). Note that this might have happened already before calling this function, if the proxy was not a newly created one, but was looked up from the cache. DBusProxyFactory handles the necessary subleties for this to work.

Access to the proxy instance is allowed as soon as this method returns through PendingReady::proxy(), if the proxy is needed in a context where it's not required to be ready.

Parameters
proxyThe proxy which the factory should now make sure is prepared and made ready.
Returns
A PendingReady operation which will emit PendingReady::finished when the proxy is usable.
QString Tp::DBusProxyFactory::finalBusNameFrom ( const QString uniqueOrWellKnown) const
protectedpure virtual

"Normalize" a bus name according to the rules for the proxy class to construct.

Should be implemented by subclasses to transform the application-specified name uniqueOrWellKnown to whatever the proxy constructed for that name would have in its DBusProxy::busName() in the end.

For StatelessDBusProxy sub-classes this should mostly be an identity transform, while for StatefulDBusProxy sub-classes StatefulDBusProxy::uniqueNameFrom() or an equivalent thereof should be used in most cases.

If this is not implemented correctly, caching won't work properly.

Parameters
uniqueOrWellKnownAny valid D-Bus service name, either unique or well-known.
Returns
Whatever that name would turn to, when a proxy is constructed for it.

Implemented in Tp::ChannelFactory, Tp::AccountFactory, and Tp::ConnectionFactory.

PendingOperation * Tp::DBusProxyFactory::initialPrepare ( const DBusProxyPtr &  proxy) const
protectedvirtual

Allows subclasses to do arbitrary manipulation on the proxy before it is attempted to be made ready.

If a non-NULL operation is returned, the completion of that operation is waited for before starting to make the object ready whenever nowHaveProxy() is called the first time around for a given proxy.

Todo:
FIXME actually implement this... :) Currently just a vtable placeholder.
Parameters
proxyThe just-constructed proxy to be prepared.
Returns
NULL ie. nothing to do.
PendingOperation * Tp::DBusProxyFactory::readyPrepare ( const DBusProxyPtr &  proxy) const
protectedvirtual

Allows subclasses to do arbitrary manipulation on the proxy after it has been made ready.

If a non-NULL operation is returned, the completion of that operation is waited for before signaling that the object is ready for use after ReadyObject::becomeReady() for it has finished whenever nowHaveProxy() is called the first time around for a given proxy.

Todo:
FIXME actually implement this... :) Currently just a vtable placeholder.
Parameters
proxyThe just-readified proxy to be prepared.
Returns
NULL ie. nothing to do.
Features Tp::DBusProxyFactory::featuresFor ( const DBusProxyPtr &  proxy) const
protectedpure virtual

Return the features which should be made ready on a given proxy.

This can be used to implement instance-specific features based on arbitrary criteria. FixedFeatureFactory implements this as a fixed set of features independent of the instance, however.

It should be noted that if an empty set of features is returned, ReadyObject::becomeReady() is not called at all. In other words, any "core feature" is not automatically added to the requested features. This is to enable setting a factory to not make proxies ready at all, which is useful eg. in the case of account editing UIs which aren't interested in the state of Connection objects for the Account objects they're editing.

Parameters
proxyThe proxy on which the returned features will be made ready.
Returns
A list of Feature objects.

Implemented in Tp::ChannelFactory, and Tp::FixedFeatureFactory.


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