Skip to content

Commit

Permalink
Minor (lock screen)
Browse files Browse the repository at this point in the history
  • Loading branch information
rodlie committed Feb 2, 2024
1 parent 5cf94be commit 62e270f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 11 deletions.
13 changes: 5 additions & 8 deletions src/powerkit_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,6 @@ Manager::Manager(QObject *parent) : QObject(parent)
, wakeAlarm(false)
, suspendWakeupBattery(0)
, suspendWakeupAC(0)
, lockScreenOnSuspend(true)
, lockScreenOnResume(false)
{
setup();
timer.setInterval(TIMEOUT_CHECK);
Expand Down Expand Up @@ -434,7 +432,7 @@ void Manager::handleSuspend()
{
if (HasLogind()) { return; }
qDebug() << "handle suspend from upower";
if (lockScreenOnSuspend) { LockScreen(); }
LockScreen();
emit PrepareForSuspend();
}

Expand Down Expand Up @@ -529,7 +527,7 @@ bool Manager::registerSuspendLock()
suspendLock.reset(new QDBusUnixFileDescriptor(reply.value()));
return true;
} else {
qDebug() << reply.error();
qWarning() << reply.error();
}
return false;
}
Expand Down Expand Up @@ -641,11 +639,11 @@ const QString Manager::PowerOff()
const QString Manager::Suspend()
{
qDebug() << "try to suspend";
if (lockScreenOnSuspend) { LockScreen(); }
if (HasLogind()) {
SetWakeAlarmFromSettings();
return executeAction(PKSuspendAction, PKLogind);
} else if (HasUPower()) {
LockScreen();
return executeAction(PKSuspendAction, PKUPower);
}
return QObject::tr(PK_NO_BACKEND);
Expand All @@ -654,10 +652,10 @@ const QString Manager::Suspend()
const QString Manager::Hibernate()
{
qDebug() << "try to hibernate";
if (lockScreenOnSuspend) { LockScreen(); }
if (HasLogind()) {
return executeAction(PKHibernateAction, PKLogind);
} else if (HasUPower()) {
LockScreen();
return executeAction(PKHibernateAction, PKUPower);
}
return QObject::tr(PK_NO_BACKEND);
Expand All @@ -666,7 +664,6 @@ const QString Manager::Hibernate()
const QString Manager::HybridSleep()
{
qDebug() << "try to hybridsleep";
if (lockScreenOnSuspend) { LockScreen(); }
if (HasLogind()) {
return executeAction(PKHybridSleepAction, PKLogind);
}
Expand Down Expand Up @@ -861,7 +858,7 @@ const QDateTime Manager::GetWakeAlarm()
void Manager::ReleaseSuspendLock()
{
qDebug() << "release suspend lock";
suspendLock.reset(NULL);
suspendLock.reset(nullptr);
}

void Manager::SetSuspendWakeAlarmOnBattery(int value)
Expand Down
3 changes: 0 additions & 3 deletions src/powerkit_manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,6 @@ namespace PowerKit
int suspendWakeupBattery;
int suspendWakeupAC;

bool lockScreenOnSuspend;
bool lockScreenOnResume;

signals:
void Update();
void UpdatedDevices();
Expand Down

0 comments on commit 62e270f

Please sign in to comment.