KUtils
kidletime.h
Go to the documentation of this file.
00001 /* This file is part of the KDE libraries 00002 Copyright (C) 2009 Dario Freddi <drf at kde.org> 00003 00004 This library is free software; you can redistribute it and/or 00005 modify it under the terms of the GNU Library General Public 00006 License version 2 as published by the Free Software Foundation. 00007 00008 This library is distributed in the hope that it will be useful, 00009 but WITHOUT ANY WARRANTY; without even the implied warranty of 00010 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00011 Library General Public License for more details. 00012 00013 You should have received a copy of the GNU Library General Public License 00014 along with this library; see the file COPYING.LIB. If not, write to 00015 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00016 Boston, MA 02110-1301, USA. 00017 */ 00018 00019 #ifndef KIDLETIME_H 00020 #define KIDLETIME_H 00021 00022 #include <QtCore/QObject> 00023 #include <QtCore/QHash> 00024 #include <kidletime_export.h> 00025 class KIdleTimePrivate; 00026 00039 class KIDLETIME_EXPORT KIdleTime : public QObject 00040 { 00041 Q_OBJECT 00042 Q_DECLARE_PRIVATE(KIdleTime) 00043 Q_DISABLE_COPY(KIdleTime) 00044 00045 public: 00051 static KIdleTime *instance(); 00052 00056 virtual ~KIdleTime(); 00057 00063 int idleTime() const; 00064 00073 QHash<int, int> idleTimeouts() const; 00074 00082 void simulateUserActivity(); 00083 00084 public Q_SLOTS: 00101 int addIdleTimeout(int msec); 00102 00110 void removeIdleTimeout(int identifier); 00111 00119 void removeAllIdleTimeouts(); 00120 00138 void catchNextResumeEvent(); 00139 00149 void stopCatchingResumeEvent(); 00150 00151 Q_SIGNALS: 00158 void resumingFromIdle(); 00159 00172 void timeoutReached(int identifier); 00173 00183 void timeoutReached(int identifier, int msec); 00184 00185 private: 00186 KIdleTime(); 00187 00188 KIdleTimePrivate * const d_ptr; 00189 00190 Q_PRIVATE_SLOT(d_func(), void _k_resumingFromIdle()) 00191 Q_PRIVATE_SLOT(d_func(), void _k_timeoutReached(int)) 00192 00193 }; 00194 00195 #endif /* KIDLETIME_H */
KDE 4.6 API Reference