bool IdlePlatform::init() { if (secondsIdle() == -1) return false; return true; }
void Maemo6Idle::timerEvent(QTimerEvent* ev) { Q_UNUSED(ev); if (m_activity != MeeGo::QmActivity::Active) { m_idleSeconds += 60; } emit secondsIdle(m_idleSeconds); }
void Maemo6Idle::activityChanged (MeeGo::QmActivity::Activity activity) { m_activity = activity; if (m_activity == MeeGo::QmActivity::Active) { m_idleSeconds = 0; idle_timer->stop(); } else { m_idleSeconds = 0; idle_timer->start(60000,this); } emit secondsIdle(m_idleSeconds); }
void Idle::doCheck() { int i; if(usePlatform()) // VOXOX -ASV- 08-07-2009 i = platform->secondsIdle(); else { QPoint curMousePos = QCursor::pos(); QDateTime curDateTime = QDateTime::currentDateTime(); if(d->lastMousePos != curMousePos) { d->lastMousePos = curMousePos; d->idleSince = curDateTime; } i = d->idleSince.secsTo(curDateTime); } // set 'beginIdle' to the beginning of the idle time (by backtracking 'i' seconds from now) QDateTime beginIdle = QDateTime::currentDateTime().addSecs(-i); // set 't' to hold the number of seconds between 'beginIdle' and 'startTime' int t = beginIdle.secsTo(d->startTime); // beginIdle later than (or equal to) startTime? if(t <= 0) { // scoot ourselves up to the new idle start d->startTime = beginIdle; } // beginIdle earlier than startTime? else if(t > 0) { // do nothing } // how long have we been idle? int idleTime = d->startTime.secsTo(QDateTime::currentDateTime()); secondsIdle(idleTime); }
void Idle::doCheck() { emit secondsIdle(secondsIdle()); }
bool Idle::isActive() { return (secondsIdle() == 0); }