From 6860da7d1674523c0dd9c1fc07759554fbf5d72a Mon Sep 17 00:00:00 2001 From: zsien Date: Wed, 27 Nov 2024 13:39:09 +0800 Subject: [PATCH] fix: turning off 'Unlocking is required to wake up the computer' does not work MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit RequestSuspend 中有锁屏逻辑,取消主动锁屏 Bug: https://pms.uniontech.com/bug-view-287959.html --- src/dde-lock/lockworker.cpp | 19 +++++++++++++++++-- src/session-widgets/authinterface.h | 1 + 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/src/dde-lock/lockworker.cpp b/src/dde-lock/lockworker.cpp index b551e688..dac4bcd3 100644 --- a/src/dde-lock/lockworker.cpp +++ b/src/dde-lock/lockworker.cpp @@ -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); @@ -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(); diff --git a/src/session-widgets/authinterface.h b/src/session-widgets/authinterface.h index 116a6181..23e72b03 100644 --- a/src/session-widgets/authinterface.h +++ b/src/session-widgets/authinterface.h @@ -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 m_loginUserList;