• Skip to content
  • Skip to link menu
  • KDE API Reference
  • kdelibs-4.14.38 API Reference
  • KDE Home
  • Contact Us
 

KUtils

  • kutils
  • kidletime
kidletime.h
Go to the documentation of this file.
1/* This file is part of the KDE libraries
2 Copyright (C) 2009 Dario Freddi <drf at kde.org>
3
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public
6 License version 2 as published by the Free Software Foundation.
7
8 This library is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 Library General Public License for more details.
12
13 You should have received a copy of the GNU Library General Public License
14 along with this library; see the file COPYING.LIB. If not, write to
15 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
16 Boston, MA 02110-1301, USA.
17*/
18
19#ifndef KIDLETIME_H
20#define KIDLETIME_H
21
22#include <QtCore/QObject>
23#include <QtCore/QHash>
24#include <kidletime_export.h>
25class KIdleTimePrivate;
26
39class KIDLETIME_EXPORT KIdleTime : public QObject
40{
41 Q_OBJECT
42 Q_DECLARE_PRIVATE(KIdleTime)
43 Q_DISABLE_COPY(KIdleTime)
44
45public:
51 static KIdleTime *instance();
52
56 virtual ~KIdleTime();
57
63 int idleTime() const;
64
73 QHash<int, int> idleTimeouts() const;
74
82 void simulateUserActivity();
83
84public Q_SLOTS:
101 int addIdleTimeout(int msec);
102
110 void removeIdleTimeout(int identifier);
111
119 void removeAllIdleTimeouts();
120
138 void catchNextResumeEvent();
139
149 void stopCatchingResumeEvent();
150
151Q_SIGNALS:
158 void resumingFromIdle();
159
172 void timeoutReached(int identifier);
173
183 void timeoutReached(int identifier, int msec);
184
185private:
186 KIdleTime();
187
188 KIdleTimePrivate * const d_ptr;
189
190 Q_PRIVATE_SLOT(d_func(), void _k_resumingFromIdle())
191 Q_PRIVATE_SLOT(d_func(), void _k_timeoutReached(int))
192
193};
194
195#endif /* KIDLETIME_H */
KIdleTime::catchNextResumeEvent
void catchNextResumeEvent()
Catches the next resume from idle event.
Definition kidletime.cpp:106
KIdleTime::addIdleTimeout
int addIdleTimeout(int msec)
Adds a new timeout to catch.
Definition kidletime.cpp:126
KIdleTime::idleTime
int idleTime() const
Retrieves the idle time of the system, in milliseconds.
Definition kidletime.cpp:255
KIdleTime::timeoutReached
void timeoutReached(int identifier, int msec)
Overload.
KIdleTime::resumingFromIdle
void resumingFromIdle()
Triggered, if KIdleTime is catching resume events, when the system resumes from an idle state.
KIdleTime::timeoutReached
void timeoutReached(int identifier)
Triggered when the system has been idle for x milliseconds, identified by the previously set timeout.
KIdleTime::simulateUserActivity
void simulateUserActivity()
Attempts to simulate user activity.
Definition kidletime.cpp:248
KIdleTime::stopCatchingResumeEvent
void stopCatchingResumeEvent()
Stops listening for resume event.
Definition kidletime.cpp:116
KIdleTime::removeIdleTimeout
void removeIdleTimeout(int identifier)
Stops catching the idle timeout identified by the token identifier, if it was registered earlier with...
Definition kidletime.cpp:138
KIdleTime::removeAllIdleTimeouts
void removeAllIdleTimeouts()
Stops catching every set timeout (if any).
Definition kidletime.cpp:155
KIdleTime::instance
static KIdleTime * instance()
Returns the singleton instance.
Definition kidletime.cpp:55
KIdleTime::idleTimeouts
QHash< int, int > idleTimeouts() const
Returns the list of timeout identifiers associated with their duration, in milliseconds,...
Definition kidletime.cpp:262
QHash
QObject
kidletime_export.h
This file is part of the KDE documentation.
Documentation copyright © 1996-2025 The KDE developers.
Generated on Fri Jan 17 2025 00:00:00 by doxygen 1.13.2 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KUtils

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

kdelibs-4.14.38 API Reference

Skip menu "kdelibs-4.14.38 API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
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