From 63a1458aaf2d5fcd0425ec3f6c0dc89d68059206 Mon Sep 17 00:00:00 2001 From: Zack Rusin Date: Mon, 24 Nov 2003 05:21:12 +0000 Subject: Seperating integration with D-BUS from Connection to the internal Integrator class. I simply hated the interfaces in the public Connection when it had to contain a bunch of friends and protected members that were never really meant to be seen. --- qt/connection.h | 48 +++++++++++++++++------------------------------- 1 file changed, 17 insertions(+), 31 deletions(-) (limited to 'qt/connection.h') diff --git a/qt/connection.h b/qt/connection.h index 7c0d5bac..b9ff9438 100644 --- a/qt/connection.h +++ b/qt/connection.h @@ -23,12 +23,17 @@ #ifndef DBUS_QT_CONNECTION_H #define DBUS_QT_CONNECTION_H +#include "message.h" + #include #include #include "dbus/dbus.h" namespace DBusQt { + namespace Internal { + class Integrator; + } class Connection : public QObject { @@ -39,52 +44,33 @@ namespace DBusQt { bool isConnected() const; bool isAuthenticated() const; + Message borrowMessage(); + Message popMessage(); + void stealBorrowMessage( const Message& ); + public slots: void open( const QString& ); void close(); void flush(); + void send( const Message& ); + void sendWithReply( const Message& ); + void sendWithReplyAndBlock( const Message& ); protected slots: - void slotRead( int ); - void slotWrite( int ); - - protected: - void addWatch( DBusWatch* ); - void removeWatch( DBusWatch* ); - - public: - friend dbus_bool_t dbusAddWatch( DBusWatch*, void* ); - friend dbus_bool_t dbusRemoveWatch( DBusWatch*, void* ); - friend dbus_bool_t dbusToggleWatch( DBusWatch*, void* ); + void dispatchRead(); protected: void init( const QString& host ); + void initDbus(); virtual void* virtual_hook( int id, void* data ); + private: + friend class Internal::Integrator; + DBusConnection* connection() const; private: struct Private; Private *d; }; - ////////////////////////////////////////////////////////////// - //Friends - dbus_bool_t dbusAddWatch( DBusWatch *watch, void *data ) - { - Connection *con = static_cast( data ); - con->addWatch( watch ); - } - dbus_bool_t dbusRemoveWatch( DBusWatch *watch, void *data ) - { - Connection *con = static_cast( data ); - con->removeWatch( watch ); - } - - dbus_bool_t dbusToggleWatch( DBusWatch*, void* ) - { - //I don't know how to handle this one right now -#warning "FIXME: implement" - } - ////////////////////////////////////////////////////////////// - } -- cgit