summaryrefslogtreecommitdiffstats
path: root/karm/desktoptracker.h
diff options
context:
space:
mode:
authortoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
committertoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
commit460c52653ab0dcca6f19a4f492ed2c5e4e963ab0 (patch)
tree67208f7c145782a7e90b123b982ca78d88cc2c87 /karm/desktoptracker.h
downloadtdepim-460c52653ab0dcca6f19a4f492ed2c5e4e963ab0.tar.gz
tdepim-460c52653ab0dcca6f19a4f492ed2c5e4e963ab0.zip
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdepim@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'karm/desktoptracker.h')
-rw-r--r--karm/desktoptracker.h55
1 files changed, 55 insertions, 0 deletions
diff --git a/karm/desktoptracker.h b/karm/desktoptracker.h
new file mode 100644
index 000000000..fee7a026f
--- /dev/null
+++ b/karm/desktoptracker.h
@@ -0,0 +1,55 @@
+#ifndef KARM_DESKTOP_TRACKER_H
+#define KARM_DESKTOP_TRACKER_H
+
+#include <vector>
+
+#include <kwinmodule.h>
+
+#include "desktoplist.h"
+
+class Task;
+class QTimer;
+
+typedef std::vector<Task *> TaskVector;
+const int maxDesktops = 20;
+
+/** A utility to associate tasks with desktops
+ * As soon as a desktop is activated/left - an signal is emited for
+ * each task tracking that all tasks that want to track that desktop
+ */
+
+class DesktopTracker: public QObject
+{
+ Q_OBJECT
+
+ public:
+ DesktopTracker();
+ void printTrackers();
+ QString startTracking();
+ void registerForDesktops( Task* task, DesktopList dl );
+ int desktopCount() const { return _desktopCount; };
+
+ private: // member variables
+ KWinModule kWinModule;
+
+ // define vectors for at most 16 virtual desktops
+ // E.g.: desktopTrackerStop[3] contains a vector with
+ // all tasks to be notified, when switching to/from desk 3.
+ TaskVector desktopTracker[maxDesktops];
+ int _previousDesktop;
+ int _desktopCount;
+ int _desktop;
+ QTimer *_timer;
+
+ signals:
+ void reachedtActiveDesktop( Task* task );
+ void leftActiveDesktop( Task* task );
+
+ public slots:
+ void handleDesktopChange( int desktop );
+
+ private slots:
+ void changeTimers();
+};
+
+#endif // KARM_DESKTOP_TRACKER_H