From abb88958ceb4c8ce47804ff4b991f7a58daa9d8d Mon Sep 17 00:00:00 2001 From: toma Date: Sat, 4 Aug 2007 11:07:20 +0000 Subject: [PATCH] Add dbus interface for idleTime() and fix bug where idleTime() was reporting false info when rsibreak was suspended. Should be backported. git-svn-id: svn+ssh://svn.kde.org/home/kde/trunk/extragear/utils/rsibreak@696259 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- src/org.rsibreak.rsiwidget.xml | 3 +++ src/rsitimer.cpp | 7 +++++-- src/rsiwidget.h | 1 + 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/org.rsibreak.rsiwidget.xml b/src/org.rsibreak.rsiwidget.xml index cf15fb6..660d702 100644 --- a/src/org.rsibreak.rsiwidget.xml +++ b/src/org.rsibreak.rsiwidget.xml @@ -11,5 +11,8 @@ + + + diff --git a/src/rsitimer.cpp b/src/rsitimer.cpp index c2f3774..253cb34 100644 --- a/src/rsitimer.cpp +++ b/src/rsitimer.cpp @@ -256,6 +256,11 @@ void RSITimer::slotRequestBigBreak() void RSITimer::timerEvent( QTimerEvent * ) { + // although we might be suspended, we still want to return a valid value + // when restarted, so m_lastActivity shouls still be updated. This way + // the dbus call to idleTime() does not return false info. + int t = idleTime(); + // Dont change the tray icon when suspended, or evaluate // a possible break. if ( m_suspended ) @@ -263,8 +268,6 @@ void RSITimer::timerEvent( QTimerEvent * ) RSIGlobals::instance()->stats()->increaseStat( TOTAL_TIME ); - int t = idleTime(); - if ( t == 0 ) { RSIGlobals::instance()->stats()->increaseStat( ACTIVITY ); diff --git a/src/rsiwidget.h b/src/rsiwidget.h index 55e8ec2..6422af5 100644 --- a/src/rsiwidget.h +++ b/src/rsiwidget.h @@ -113,6 +113,7 @@ class RSIWidget: public QLabel void doTinyBreak() {m_rsiobject->timer()->slotRequestTinyBreak();}; void resume() {m_rsiobject->timer()->slotSuspended( false ); }; void suspend() {m_rsiobject->timer()->slotSuspended( true ); }; + int idleTime() {return m_rsiobject->timer()->idleTime(); }; private: RSIObject* m_rsiobject; -- 2.11.4.GIT