dde-session-shell/0001-Solve-the-user-switching-login-problem.patch

46 lines
2.0 KiB
Diff
Raw Normal View History

2024-04-09 14:03:22 +08:00
From b1a4628480f1e9387ae5ac2c1bc298aaeab48abb Mon Sep 17 00:00:00 2001
From: root <root@localhost.localdomain>
Date: Tue, 12 Dec 2023 14:29:36 +0800
Subject: [PATCH] Solve-the-user-switching-login-problem
---
src/session-widgets/lockcontent.cpp | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/src/session-widgets/lockcontent.cpp b/src/session-widgets/lockcontent.cpp
index 1325addc..9437c468 100644
--- a/src/session-widgets/lockcontent.cpp
+++ b/src/session-widgets/lockcontent.cpp
@@ -129,6 +129,17 @@ void LockContent::initConnections()
{
connect(m_model, &SessionBaseModel::currentUserChanged, this, &LockContent::onCurrentUserChanged);
connect(m_controlWidget, &ControlWidget::requestSwitchUser, this, [this] {
+ // 在服务器版本中,如果没有用户登录,当点击切换用户时,直接切回到账户输入界面
+ if (m_model->isServerModel() && m_model->loginedUserList().isEmpty()) {
+ std::shared_ptr<User> user_ptr = m_model->findUserByName("...");
+
+ if (user_ptr) {
+ m_controlWidget->setUserSwitchEnable(false);
+ emit requestSwitchToUser(user_ptr);
+ return;
+ }
+ }
+
m_model->setCurrentModeState(SessionBaseModel::ModeStatus::UserMode);
emit requestEndAuthentication(m_model->currentUser()->name(), AuthCommon::AT_All);
});
@@ -304,6 +315,10 @@ void LockContent::onCurrentUserChanged(std::shared_ptr<User> user)
m_centerTopWidget->setCurrentUser(user.get());
m_logoWidget->updateLocale(locale);
+ // 在服务器版中,当没有用户登录时,在登录界面切换到之前登录过的用户时,显示切换用户按钮,供用户重新输入新的账户登录
+ if (m_model->isServerModel() && user->type() == User::Native && m_model->loginedUserList().isEmpty()) {
+ m_controlWidget->setUserSwitchEnable(true);
+ }
}
void LockContent::pushPasswordFrame()
--
2.39.3