summaryrefslogtreecommitdiffstats
path: root/qt/connection.h
diff options
context:
space:
mode:
authorZack Rusin <zack@kde.org>2003-11-24 05:21:12 +0000
committerZack Rusin <zack@kde.org>2003-11-24 05:21:12 +0000
commit63a1458aaf2d5fcd0425ec3f6c0dc89d68059206 (patch)
treee3becb5f9bd9aa5d62aa5ffb59c09eb86073ffc7 /qt/connection.h
parentfb1df4eaff4f0c562610e440355858892b613cbe (diff)
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.
Diffstat (limited to 'qt/connection.h')
-rw-r--r--qt/connection.h48
1 files changed, 17 insertions, 31 deletions
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 <qobject.h>
#include <qstring.h>
#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<Connection*>( data );
- con->addWatch( watch );
- }
- dbus_bool_t dbusRemoveWatch( DBusWatch *watch, void *data )
- {
- Connection *con = static_cast<Connection*>( data );
- con->removeWatch( watch );
- }
-
- dbus_bool_t dbusToggleWatch( DBusWatch*, void* )
- {
- //I don't know how to handle this one right now
-#warning "FIXME: implement"
- }
- //////////////////////////////////////////////////////////////
-
}