Skip to content

Commit

Permalink
fix: turning off 'Unlocking is required to wake up the computer' does…
Browse files Browse the repository at this point in the history
… not work

RequestSuspend 中有锁屏逻辑,取消主动锁屏

Bug: https://pms.uniontech.com/bug-view-287959.html
  • Loading branch information
zsien committed Nov 29, 2024
1 parent 510ab68 commit 6860da7
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
19 changes: 17 additions & 2 deletions src/dde-lock/lockworker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@ LockWorker::LockWorker(SessionBaseModel *const model, QObject *parent)
}
}

if (QGSettings::isSchemaInstalled("com.deepin.dde.power")) {
m_powerGsettings = new QGSettings("com.deepin.dde.power", "/com/deepin/dde/power/", this);
}

m_resetSessionTimer->setSingleShot(true);
connect(m_resetSessionTimer, &QTimer::timeout, this, [ = ] {
endAuthentication(m_account, AT_All);
Expand Down Expand Up @@ -380,8 +384,19 @@ void LockWorker::doPowerAction(const SessionBaseModel::PowerAction action)
switch (action) {
case SessionBaseModel::PowerAction::RequireSuspend:
{
m_model->setIsBlackMode(true);
m_model->setCurrentModeState(SessionBaseModel::ModeStatus::PasswordMode);
bool sleepLock = true;
if (m_powerGsettings && m_powerGsettings->keys().contains("sleep-lock")){
sleepLock = m_powerGsettings->get("sleep-lock").toBool();
}

if (sleepLock) {
m_model->setIsBlackMode(true);
m_model->setCurrentModeState(SessionBaseModel::ModeStatus::PasswordMode);
} else {
m_model->setIsBlackMode(false);
m_model->setVisible(false);
}

int delayTime = 500;
if(m_gsettings && m_gsettings->keys().contains("delaytime")){
delayTime = m_gsettings->get("delaytime").toInt();
Expand Down
1 change: 1 addition & 0 deletions src/session-widgets/authinterface.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ class AuthInterface : public QObject {
Authenticate* m_authenticateInter;
DBusObjectInter* m_dbusInter;
QGSettings* m_gsettings = nullptr;
QGSettings* m_powerGsettings = nullptr;
uint m_lastLogoutUid;
uint m_currentUserUid;
std::list<uint> m_loginUserList;
Expand Down

0 comments on commit 6860da7

Please sign in to comment.