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

ktimetracker

  • sources
  • kde-4.12
  • kdepim
  • ktimetracker
idletimedetector.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2003 by Scott Monachello <smonach@cox.net>
3  * 2007 the ktimetracker developers
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License along
16  * with this program; if not, write to the
17  * Free Software Foundation, Inc.
18  * 51 Franklin Street, Fifth Floor
19  * Boston, MA 02110-1301 USA.
20  *
21  */
22 
23 #ifndef KTIMETRACKER_IDLE_TIME_DETECTOR_H
24 #define KTIMETRACKER_IDLE_TIME_DETECTOR_H
25 
26 #include "ktimetrackerutility.h" // SecsPerMinute
27 #include <QDateTime>
28 #include <QObject>
29 #include <config-ktimetracker.h> // HAVE_LIBXSS
30 
31 class QTimer;
32 
33 #if defined(HAVE_LIBXSS) && defined(Q_WS_X11)
34  #include <X11/Xlib.h>
35  #include <X11/Xutil.h>
36  #include <X11/extensions/scrnsaver.h>
37  #include <fixx11h.h>
38 #endif // HAVE_LIBXSS
39 
40 // Minutes between each idle overrun test.
41 const int testInterval= secsPerMinute * 1000;
42 
47 class IdleTimeDetector :public QObject
48 {
49 Q_OBJECT
50 
51 public:
56  explicit IdleTimeDetector(int maxIdle);
57 
63  bool isIdleDetectionPossible();
64 
65 Q_SIGNALS:
72  void subtractTime(int minutes);
73 
77  void stopAllTimers(QDateTime time);
78 
79 public Q_SLOTS:
80  void revert();
81 
86  void setMaxIdle(int maxIdle);
87 
91  void startIdleDetection();
92 
96  void stopIdleDetection();
97 
103  void toggleOverAllIdleDetection(bool on);
104 
105 
106 protected:
107 #if defined(HAVE_LIBXSS) && defined(Q_WS_X11)
108  void informOverrun();
109 #endif // HAVE_LIBXSS
110 
111 protected Q_SLOTS:
112  void check();
113 
114 private:
115 #if defined(HAVE_LIBXSS) && defined(Q_WS_X11)
116  XScreenSaverInfo *_mit_info;
117 #endif
118  bool _idleDetectionPossible;
119  bool _overAllIdleDetect; // Based on preferences.
120  int _maxIdle;
121  QTimer *_timer;
122  QDateTime start; // when the idletimedetectordialog started
123  QDateTime idlestart; // when the idleness started
124  int idleminutes;
125 };
126 
127 #endif // KTIMETRACKER_IDLE_TIME_DETECTOR_H
IdleTimeDetector::stopIdleDetection
void stopIdleDetection()
Stops detecting idle time.
Definition: idletimedetector.cpp:139
IdleTimeDetector::isIdleDetectionPossible
bool isIdleDetectionPossible()
Returns true if it is possible to do idle detection.
Definition: idletimedetector.cpp:57
IdleTimeDetector::subtractTime
void subtractTime(int minutes)
Tells the listener to subtract time from current timing.
IdleTimeDetector::startIdleDetection
void startIdleDetection()
Starts detecting idle time.
Definition: idletimedetector.cpp:131
IdleTimeDetector::check
void check()
Definition: idletimedetector.cpp:62
IdleTimeDetector::stopAllTimers
void stopAllTimers(QDateTime time)
Tells the listener to stop timing.
IdleTimeDetector
Keep track of how long the computer has been idle.
Definition: idletimedetector.h:47
QObject
secsPerMinute
const int secsPerMinute
Definition: ktimetrackerutility.h:53
IdleTimeDetector::setMaxIdle
void setMaxIdle(int maxIdle)
Sets the maximum allowed idle.
Definition: idletimedetector.cpp:80
IdleTimeDetector::revert
void revert()
Definition: idletimedetector.cpp:85
IdleTimeDetector::toggleOverAllIdleDetection
void toggleOverAllIdleDetection(bool on)
Sets whether idle detection should be done at all.
Definition: idletimedetector.cpp:147
IdleTimeDetector::IdleTimeDetector
IdleTimeDetector(int maxIdle)
Initializes and idle test timer.
Definition: idletimedetector.cpp:42
ktimetrackerutility.h
testInterval
const int testInterval
Definition: idletimedetector.h:41
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:55:10 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

ktimetracker

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

kdepim API Reference

Skip menu "kdepim API Reference"
  • akonadi_next
  • akregator
  • blogilo
  • calendarsupport
  • console
  •   kabcclient
  •   konsolekalendar
  • kaddressbook
  • kalarm
  •   lib
  • kdgantt2
  • kjots
  • kleopatra
  • kmail
  • knode
  • knotes
  • kontact
  • korgac
  • korganizer
  • ktimetracker
  • libkdepim
  • libkleo
  • libkpgp
  • mailcommon
  • messagelist
  • messageviewer

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal