karm
idletimedetector.h00001 #ifndef KARM_IDLE_TIME_DETECTOR_H
00002 #define KARM_IDLE_TIME_DETECTOR_H
00003
00004 #include <qobject.h>
00005 #include "config.h"
00006 #include <qdatetime.h>
00007 #include <kdebug.h>
00008
00009 class QTimer;
00010
00011 #ifdef HAVE_LIBXSS
00012 #include <X11/Xlib.h>
00013 #include <X11/Xutil.h>
00014 #include <X11/extensions/scrnsaver.h>
00015 #include <fixx11h.h>
00016 #endif // HAVE_LIBXSS
00017
00018
00019 const int secsPerMinute = 60;
00020
00021
00022 const int testInterval= secsPerMinute * 1000;
00023
00028 class IdleTimeDetector :public QObject
00029 {
00030 Q_OBJECT
00031
00032 public:
00037 IdleTimeDetector(int maxIdle);
00038
00044 bool isIdleDetectionPossible();
00045
00046 signals:
00053 void extractTime(int minutes);
00054
00056 void stopAllTimers();
00057
00059 void stopAllTimersAt(QDateTime qdt);
00060
00061 public slots:
00066 void setMaxIdle(int maxIdle);
00067
00071 void startIdleDetection();
00072
00076 void stopIdleDetection();
00077
00083 void toggleOverAllIdleDetection(bool on);
00084
00085
00086 protected:
00087 #ifdef HAVE_LIBXSS
00088 void informOverrun(int idle);
00089 #endif // HAVE_LIBXSS
00090
00091 protected slots:
00092 void check();
00093
00094 private:
00095 #ifdef HAVE_LIBXSS
00096 XScreenSaverInfo *_mit_info;
00097 #endif
00098 bool _idleDetectionPossible;
00099 bool _overAllIdleDetect;
00100 int _maxIdle;
00101 QTimer *_timer;
00102 };
00103
00104 #endif // KARM_IDLE_TIME_DETECTOR_H
|