From kde-commits Wed Jan 31 23:14:04 2007 From: Kevin Krammer Date: Wed, 31 Jan 2007 23:14:04 +0000 To: kde-commits Subject: branches/work/dbus-qt4-qt3backport/dbus Message-Id: <1170285244.579194.16702.nullmailer () svn ! kde ! org> X-MARC-Message: https://marc.info/?l=kde-commits&m=117028537328585 SVN commit 628926 by krake: Adding method to QDBusObjectBase to allow subclasses to pass method calls to each other in order to enable composite objects to hand method calls to their respective interface implementation instance. M +29 -1 qdbusobject.h --- branches/work/dbus-qt4-qt3backport/dbus/qdbusobject.h #628925:628926 @@ -268,7 +268,7 @@ * // delegate call to its interface handler * QDBusObjectBase* handler = m_interfaces[message.interface()]; * if (handler != 0) - * return handler->handleMethodCall(message); + * return delegateMethodCall->(message, handler); * else * return false; // no such interface * } @@ -339,6 +339,34 @@ * unknown */ virtual bool handleMethodCall(const QDBusMessage& message) = 0; + + /** + * @brief Delegate a method call to another object + * + * When a service object is built as a collection of separated interface + * class instances, i.e. each interface of the object is implemented in + * its own QDBusObjectBase subclass and the main object just wanst to pass + * on the method calls to the respective interface implementations, it + * can do so by calling this base class method. + * + * Since it is a method of the base class, it can call the otherwise + * protected handleMethodCall() of the interface implementor. + * + * See @ref dbusservice-interfaces for an example. + * + * @param message the method call to delegate + * @param delegate the object which should handle the call instead + * + * @return @c true if the message can be handled independent if handling + * resulted in an error. In this case implementations should an + * error reply. Returns @c false only if interface or method are + * unknown + * + */ + bool delegateMethodCall(const QDBusMessage& message, QDBusObjectBase* delegate) + { + return delegate->handleMethodCall(message); + } }; #endif