• Skip to content
  • Skip to link menu
KDE 4.2 API Reference
  • KDE API Reference
  • kdepim
  • Sitemap
  • Contact Us
 

ktimetracker

idletimedetector.h

Go to the documentation of this file.
00001 /*
00002  *     Copyright (C) 2003 by Scott Monachello <smonach@cox.net>
00003  *                   2007 the ktimetracker developers
00004  *
00005  *   This program is free software; you can redistribute it and/or modify
00006  *   it under the terms of the GNU General Public License as published by
00007  *   the Free Software Foundation; either version 2 of the License, or
00008  *   (at your option) any later version.
00009  *
00010  *   This program is distributed in the hope that it will be useful,
00011  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013  *   GNU General Public License for more details.
00014  *
00015  *   You should have received a copy of the GNU General Public License along
00016  *   with this program; if not, write to the
00017  *      Free Software Foundation, Inc.
00018  *      51 Franklin Street, Fifth Floor
00019  *      Boston, MA  02110-1301  USA.
00020  *
00021  */
00022 
00023 #ifndef KARM_IDLE_TIME_DETECTOR_H
00024 #define KARM_IDLE_TIME_DETECTOR_H
00025 
00026 #include "ktimetrackerutility.h" // SecsPerMinute
00027 #include <QDateTime>
00028 #include <QObject>
00029 #include <config-karm.h> // HAVE_LIBXSS
00030 
00031 class QTimer;
00032 
00033 #if defined(HAVE_LIBXSS) && defined(Q_WS_X11)
00034  #include <X11/Xlib.h>
00035  #include <X11/Xutil.h>
00036  #include <X11/extensions/scrnsaver.h>
00037  #include <fixx11h.h>
00038 #endif // HAVE_LIBXSS
00039 
00040 // Minutes between each idle overrun test.
00041 const int testInterval= secsPerMinute * 1000;
00042 
00047 class IdleTimeDetector :public QObject
00048 {
00049 Q_OBJECT
00050 
00051 public:
00056   IdleTimeDetector(int maxIdle);
00057 
00063   bool isIdleDetectionPossible();
00064 
00065 Q_SIGNALS:
00072   void extractTime(int minutes);
00073 
00077   void stopAllTimers(QDateTime time);
00078 
00079 public Q_SLOTS:
00080   void revert();
00081 
00086   void setMaxIdle(int maxIdle);
00087 
00091   void startIdleDetection();
00092 
00096   void stopIdleDetection();
00097 
00103   void toggleOverAllIdleDetection(bool on);
00104 
00105 
00106 protected:
00107 #if defined(HAVE_LIBXSS) && defined(Q_WS_X11)
00108   void informOverrun();
00109 #endif // HAVE_LIBXSS
00110 
00111 protected Q_SLOTS:
00112   void check();
00113 
00114 private:
00115 #if defined(HAVE_LIBXSS) && defined(Q_WS_X11)
00116   XScreenSaverInfo *_mit_info;
00117 #endif
00118   bool _idleDetectionPossible;
00119   bool _overAllIdleDetect; // Based on preferences.
00120   int _maxIdle;
00121   QTimer *_timer;
00122   QDateTime start; // when the idletimedetectordialog started
00123   QDateTime idlestart; // when the idleness started
00124   int idleminutes;
00125 };
00126 
00127 #endif // KARM_IDLE_TIME_DETECTOR_H

ktimetracker

Skip menu "ktimetracker"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Class Members
  • Related Pages

kdepim

Skip menu "kdepim"
  • akonadi
  •   clients
  •   kabc
  •   kcal
  •   kcm
  • akregator
  • console
  •   kabcclient
  •   konsolekalendar
  • kaddressbook
  • kalarm
  •   lib
  • kdgantt
  • kdgantt1
  • kjots
  • kleopatra
  • kmail
  • kmobiletools
  • knode
  • knotes
  • kontact
  • kontactinterfaces
  • korganizer
  •   korgac
  • kpilot
  • ktimetracker
  • libkdepim
  • libkholidays
  • libkleo
  • libkpgp
  • maildir
Generated for kdepim by doxygen 1.5.4
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal