diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-03-25 22:14:43 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-03-25 22:14:43 +0000 |
commit | 8bf92ab4856dbb1470bf3dddf40f80408dd4999f (patch) | |
tree | b8605a88ed9829157818c3c647caebcf0e1fea77 /dbus-qt.h | |
download | dbus-tqt-8bf92ab4856dbb1470bf3dddf40f80408dd4999f.tar.gz dbus-tqt-8bf92ab4856dbb1470bf3dddf40f80408dd4999f.zip |
Import of revision 66 from svn.trinitydesktop.org
Please keep this in sync with the upstream SVN
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/dependencies/dbus-tqt@1225998 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'dbus-qt.h')
-rw-r--r-- | dbus-qt.h | 81 |
1 files changed, 81 insertions, 0 deletions
diff --git a/dbus-qt.h b/dbus-qt.h new file mode 100644 index 0000000..6b05f67 --- /dev/null +++ b/dbus-qt.h @@ -0,0 +1,81 @@ +/* -*- mode: C; c-file-style: "gnu" -*- */ +/* + * dbus-qt.h TQt integration + * + * Copyright (C) 2002 DBus Developers + * + * Licensed under the Academic Free License version 2.1 + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + * 02111-1307 USA + * + */ +#ifndef DBUS_TQT_H +#define DBUS_TQT_H + +#include <dbus/dbus.h> +/* + * Two approaches - one presented below a DBusQtConnection + * object which is a TQt wrapper around DBusConnection +class DBusQtConnection : public TQObject { + TQ_OBJECT +public: + DBusQtConnection( const char *address=0, TQObject *tqparent=0, + const char *name=0 ); + + bool open( const char *address ); + bool isConnected() const; + int numMessages() const; + +public slots: + void disconnect(); + void flush(); + void sendMessage( DBusMessage *message ); + +signals: + void message( DBusMessage* message ); + void error( const char* error ); +private: + DBusConnection *mConnection; + TQSocketNotifier *mReadNotifier; + TQSocketNotifier *mWriteNotifier; +}; + * + * Second approach is to have a static TQt dispatcher like: +class DBusQtNotifier : public TQObject { + TQ_OBJECT +public: + static DBusQtNotifier* dbus_qt_notifier(); + void addConnection(DBusConnection* connection); +signals: + void message (DBusConnection* connection, DBusMessage* message); + +private: + DBusQtNotifier(TQObject *tqparent); +private slots: + void processNotifiers( int socket ); +private: + //implemented in terms of TQSocketNotifiers + TQAsciiDict<DBusConnection> mReadNotifiers; + TQAsciiDict<DBusConnection> mWriteNotifiers; +}; + * + * First one gives us a full wrapper for DBusConnection (the TQt way), + * the other exposes DBusConnection, so would be easier to maintain + * and keep up while DBus evolves. + * + */ + +#endif /* DBUS_TQT_H */ |