Коммит c0a4662c создал по автору ramil2004nur's avatar ramil2004nur
Просмотр файлов

powerdevil: Add low battery reminder on resume from suspend without screen lock

Extend the low/critical battery reminder feature to also trigger when waking
from suspend if the screen is not locked.
This is achieved by connecting to BackendInterface::resumeFromSuspend and
re-using the same emitBatteryChargePercentNotification(percent, 1000) call
as on screen unlock and daemon startup.
владелец 593181bb
Конвейер #36220 неудачно
......@@ -190,6 +190,7 @@ void Core::onBackendReady()
});
connect(PowerDevil::PolicyAgent::instance(), &PowerDevil::PolicyAgent::screenLockerActiveChanged, this, &Core::onScreenLockerActiveChanged);
connect(backend(), &PowerDevil::BackendInterface::resumeFromSuspend, this, &Core::onResumeFromSuspend);
// Initialize the action pool, which will also load the needed startup actions.
PowerDevil::ActionPool::instance()->init(this);
......@@ -999,6 +1000,12 @@ void Core::onScreenLockerActiveChanged(bool active)
emitBatteryChargePercentNotification(percent, 1000);
}
void Core::onResumeFromSuspend()
{
const int percent = currentChargePercent();
emitBatteryChargePercentNotification(percent, 1000);
}
void Core::readChargeThreshold()
{
KAuth::Action action(QStringLiteral("org.kde.powerdevil.chargethresholdhelper.getthreshold"));
......
......@@ -205,6 +205,7 @@ private Q_SLOTS:
void resetAndScheduleNextWakeup();
void timerfdEventHandler();
void onScreenLockerActiveChanged(bool active);
void onResumeFromSuspend();
};
}
......
Поддерживает Markdown
0% или .
You are about to add 0 people to the discussion. Proceed with caution.
Сначала завершите редактирование этого сообщения!
Пожалуйста, зарегистрируйтесь или чтобы прокомментировать