From 2bda8f7717adf28da4af0d34fb82f63d2868c31d Mon Sep 17 00:00:00 2001 From: toma Date: Wed, 25 Nov 2009 17:56:58 +0000 Subject: Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features. BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdeutils@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- klaptopdaemon/xautolock.h | 77 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 klaptopdaemon/xautolock.h (limited to 'klaptopdaemon/xautolock.h') diff --git a/klaptopdaemon/xautolock.h b/klaptopdaemon/xautolock.h new file mode 100644 index 0000000..aa618f2 --- /dev/null +++ b/klaptopdaemon/xautolock.h @@ -0,0 +1,77 @@ +//=========================================================================== +// +// This file is part of the KDE project +// +// Copyright (c) 1999 Martin R. Jones +// + +#ifndef __XAUTOLOCK_H__ +#define __XAUTOLOCK_H__ + +#include + +#include + +//=========================================================================== +// +// Detect user inactivity. +// Named XAutoLock after the program that it is based on. +// +class XAutoLock : public QWidget +{ + Q_OBJECT +public: + XAutoLock(); + ~XAutoLock(); + + //----------------------------------------------------------------------- + // + // The time in seconds of continuous inactivity. + // + void setTimeout(int t); + + void setDPMS(bool s); + + //----------------------------------------------------------------------- + // + // Start watching Activity + // + void start(); + + //----------------------------------------------------------------------- + // + // Stop watching Activity + // + void stop(); + + //----------------------------------------------------------------------- + // + // Should be called only from a slot connected to the timeout() signal. Will + // result in the timeout() signal being emitted again with a delay (i.e. postponed). + // + void postpone(); + + // internal + void resetTrigger(); + // internal + void setTrigger( time_t ); + // internal + bool ignoreWindow( WId ); + +signals: + void timeout(); + +protected: + virtual void timerEvent(QTimerEvent *ev); + virtual bool x11Event( XEvent* ); + +protected: + int mTimerId; + int mTimeout; + time_t mTrigger; + bool mActive; + time_t mLastTimeout; + bool mDPMS; +}; + +#endif -- cgit v1.2.1