From d2cf7fa5691c06a6ebcc112fbbf1ca9ff1bc54a8 Mon Sep 17 00:00:00 2001 From: tpearson Date: Thu, 21 Apr 2011 23:56:57 +0000 Subject: Add dbus-1-tqt to this SVN tree Please keep it in sync with the master at svn.trinitydesktop.org This is revision 167 from that source git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/dependencies/dbus-1-tqt@1228687 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- tqdbusconnection_p.h | 149 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 149 insertions(+) create mode 100644 tqdbusconnection_p.h (limited to 'tqdbusconnection_p.h') diff --git a/tqdbusconnection_p.h b/tqdbusconnection_p.h new file mode 100644 index 0000000..d43ee9a --- /dev/null +++ b/tqdbusconnection_p.h @@ -0,0 +1,149 @@ +/* qdbusconnection_p.h TQT_DBusConnection private object + * + * Copyright (C) 2005 Harald Fernengel + * Copyright (C) 2005 Kevin Krammer + * + * Licensed under the Academic Free License version 2.1 + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, + * USA. + * + */ + +// +// W A R N I N G +// ------------- +// +// This file is not part of the public API. This header file may +// change from version to version without notice, or even be +// removed. +// +// We mean it. +// +// + +#ifndef TQDBUSCONNECTION_P_H +#define TQDBUSCONNECTION_P_H + +#include +#include +#include +#include + +#include + +#include "tqdbusatomic.h" +#include "tqdbuserror.h" +#include "tqdbusobject.h" + +class TQT_DBusMessage; +class TQSocketNotifier; +class TQTimer; +class TQTimerEvent; + +struct DBusConnection; +struct DBusServer; + +class TQT_DBusConnectionPrivate: public TQObject +{ + Q_OBJECT + TQ_OBJECT + +public: + TQT_DBusConnectionPrivate(TQObject *tqparent = 0); + ~TQT_DBusConnectionPrivate(); + + void bindToApplication(); + + void setConnection(DBusConnection *connection); + void setServer(DBusServer *server); + void closeConnection(); + void timerEvent(TQTimerEvent *e); + + bool handleSignal(DBusMessage *msg); + bool handleObjectCall(DBusMessage *message); + bool handleError(); + + void emitPendingCallReply(const TQT_DBusMessage& message); + +signals: + void dbusSignal(const TQT_DBusMessage& message); + + void dbusPendingCallReply(const TQT_DBusMessage& message); + +public slots: + void socketRead(int); + void socketWrite(int); + + void objectDestroyed(TQObject* object); + + void purgeRemovedWatches(); + + void scheduleDispatch(); + void dispatch(); + +public: + DBusError error; + TQT_DBusError lastError; + + enum ConnectionMode { InvalidMode, ServerMode, ClientMode }; + + // FIXME TQAtomic ref; + Atomic ref; + ConnectionMode mode; + DBusConnection *connection; + DBusServer *server; + + TQTimer* dispatcher; + + static int messageMetaType; + static int registerMessageMetaType(); + int sendWithReplyAsync(const TQT_DBusMessage &message, TQObject *receiver, + const char *method); + void flush(); + + struct Watcher + { + Watcher(): watch(0), read(0), write(0) {} + DBusWatch *watch; + TQSocketNotifier *read; + TQSocketNotifier *write; + }; + // FIXME typedef TQMultiHash WatcherHash; + typedef TQValueList WatcherList; + WatcherList removedWatches; + typedef TQMap WatcherHash; + WatcherHash watchers; + + // FIXME typedef TQHash TimeoutHash; + typedef TQMap TimeoutHash; + TimeoutHash timeouts; + + typedef TQMap ObjectMap; + ObjectMap registeredObjects; + + TQValueList pendingTimeouts; + + struct TQT_DBusPendingCall + { + TQGuardedPtr receiver; + TQCString method; + DBusPendingCall *pending; + }; + typedef TQMap PendingCallMap; + PendingCallMap pendingCalls; +}; + +#endif -- cgit v1.2.1