Changeset View
Changeset View
Standalone View
Standalone View
daemon/powerdevilpolicyagent.cpp
Show First 20 Lines • Show All 359 Lines • ▼ Show 20 Line(s) | |||||
360 | void PolicyAgent::onActiveSessionChanged(const QString& activeSession) | 360 | void PolicyAgent::onActiveSessionChanged(const QString& activeSession) | ||
361 | { | 361 | { | ||
362 | if (activeSession.isEmpty() || activeSession == QLatin1String("/")) { | 362 | if (activeSession.isEmpty() || activeSession == QLatin1String("/")) { | ||
363 | qCDebug(POWERDEVIL) << "Switched to inactive session - leaving unchanged"; | 363 | qCDebug(POWERDEVIL) << "Switched to inactive session - leaving unchanged"; | ||
364 | return; | 364 | return; | ||
365 | } else if ((!m_sdSessionInterface.isNull() && activeSession == m_sdSessionInterface.data()->path()) || | 365 | } else if ((!m_sdSessionInterface.isNull() && activeSession == m_sdSessionInterface.data()->path()) || | ||
366 | (!m_ckSessionInterface.isNull() && activeSession == m_ckSessionInterface.data()->path())) { | 366 | (!m_ckSessionInterface.isNull() && activeSession == m_ckSessionInterface.data()->path())) { | ||
367 | qCDebug(POWERDEVIL) << "Current session is now active"; | 367 | qCDebug(POWERDEVIL) << "Current session is now active"; | ||
368 | if (!m_wasLastActiveSession) { | ||||
368 | m_wasLastActiveSession = true; | 369 | m_wasLastActiveSession = true; | ||
369 | 370 | Q_EMIT sessionActiveChanged(true); | |||
370 | // sessions usually don't switch themselves, prevents session from suspending when switching back to it after a while | 371 | } | ||
371 | KIdleTime::instance()->simulateUserActivity(); | | |||
372 | } else { | 372 | } else { | ||
373 | qCDebug(POWERDEVIL) << "Current session is now inactive"; | 373 | qCDebug(POWERDEVIL) << "Current session is now inactive"; | ||
374 | if (m_wasLastActiveSession) { | ||||
374 | m_wasLastActiveSession = false; | 375 | m_wasLastActiveSession = false; | ||
376 | Q_EMIT sessionActiveChanged(false); | ||||
377 | } | ||||
375 | } | 378 | } | ||
376 | } | 379 | } | ||
377 | 380 | | |||
378 | void PolicyAgent::onServiceUnregistered(const QString& serviceName) | 381 | void PolicyAgent::onServiceUnregistered(const QString& serviceName) | ||
379 | { | 382 | { | ||
380 | if (m_cookieToBusService.values().contains(serviceName)) { | 383 | if (m_cookieToBusService.values().contains(serviceName)) { | ||
381 | // Ouch - the application quit or crashed without releasing its inhibitions. Let's fix that. | 384 | // Ouch - the application quit or crashed without releasing its inhibitions. Let's fix that. | ||
382 | Q_FOREACH (uint key, m_cookieToBusService.keys(serviceName)) { | 385 | Q_FOREACH (uint key, m_cookieToBusService.keys(serviceName)) { | ||
▲ Show 20 Lines • Show All 303 Lines • Show Last 20 Lines |