summaryrefslogtreecommitdiffstats
path: root/k9devices/k9dbusdispatch.h
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-02-17 00:32:19 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-02-17 00:32:19 +0000
commit0d382a262c0638d0f572fc37193ccc5ed3dc895f (patch)
tree8578dcddfce4191f3f7a142a37769df7add48475 /k9devices/k9dbusdispatch.h
downloadk9copy-0d382a262c0638d0f572fc37193ccc5ed3dc895f.tar.gz
k9copy-0d382a262c0638d0f572fc37193ccc5ed3dc895f.zip
Added old abandoned version of k9copy
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/k9copy@1091546 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'k9devices/k9dbusdispatch.h')
-rw-r--r--k9devices/k9dbusdispatch.h66
1 files changed, 66 insertions, 0 deletions
diff --git a/k9devices/k9dbusdispatch.h b/k9devices/k9dbusdispatch.h
new file mode 100644
index 0000000..a93c2b0
--- /dev/null
+++ b/k9devices/k9dbusdispatch.h
@@ -0,0 +1,66 @@
+//
+// C++ Interface: k9dbusdispatch
+//
+// Description: the main goal of this class is to dispatch dbus messages so that libhal can
+// detect changes on devices.
+// This code is based on QDBusConnectionPrivate from the new Qt DBus bindings
+//
+//
+// Author: Jean-Michel PETIT <k9copy@free.fr>, (C) 2007
+//
+// Copyright: See COPYING file that comes with this distribution
+//
+//
+#ifndef K9DBUSDISPATCH_H
+#define K9DBUSDISPATCH_H
+#include "k9common.h"
+
+#ifdef HAVE_HAL
+
+#include <qobject.h>
+#include <qtimer.h>
+#define DBUS_API_SUBJECT_TO_CHANGE
+#include <dbus/dbus.h>
+#include <qsocketnotifier.h>
+#include <qvaluelist.h>
+#include <qmap.h>
+
+/**
+ @author Jean-Michel PETIT <k9copy@free.fr>
+*/
+
+class k9Watcher {
+public:
+ k9Watcher() { read=write=0; watch=0;};
+ DBusWatch *watch;
+ QSocketNotifier *read,*write;
+};
+
+class K9DBusDispatch : public QObject
+{
+Q_OBJECT
+public:
+ K9DBusDispatch(QObject *parent = 0, const char *name = 0);
+
+ ~K9DBusDispatch();
+ void setConnection(DBusConnection* _value);
+ typedef QValueList<k9Watcher> WatcherList;
+ WatcherList removedWatches;
+ typedef QMap<int, WatcherList> WatcherHash;
+ WatcherHash watchers;
+
+private:
+ QTimer *m_dispatcher;
+ DBusConnection *m_connection;
+
+ void purgeRemovedWatches();
+ void scheduleDispatch();
+private slots:
+ void socketRead(int fd);
+ void socketWrite(int fd);
+ void dispatch();
+
+
+};
+#endif
+#endif