From 8fe8a359a1f92032578d292e6dcb0bbee63c9409 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=95=8F?= Date: Thu, 18 Jul 2024 02:12:14 +0000 Subject: [PATCH] =?UTF-8?q?!92=20fixbug=20Merge=20pull=20request=20!92=20f?= =?UTF-8?q?rom=20=E6=9D=A8=E6=95=8F/openkylin/nile?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- debian/changelog | 9 + debian/patches/0050-92-fixbug.patch | 317 ++++++++++++++++++++++++++++ debian/patches/series | 1 + 3 files changed, 327 insertions(+) create mode 100644 debian/patches/0050-92-fixbug.patch diff --git a/debian/changelog b/debian/changelog index 23594ca..b1375ee 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,12 @@ +ukui-screensaver (4.10.0.0-ok28~0718) nile; urgency=medium + + * BUG号:#IA41FW 切换用户出现其他用户选项 + * 需求号:无 + * 其他改动说明:登录成功有提示时,提示内容位置错误;登录选项字体大小偏小 + * 其他改动影响域:无 + + -- Yang Min Thu, 18 Jul 2024 09:56:51 +0800 + ukui-screensaver (4.10.0.0-ok27~0708) nile; urgency=medium * BUG号:#240144 睡眠唤醒会先进入桌面闪一下后退回到登录界面 diff --git a/debian/patches/0050-92-fixbug.patch b/debian/patches/0050-92-fixbug.patch new file mode 100644 index 0000000..2afe8f0 --- /dev/null +++ b/debian/patches/0050-92-fixbug.patch @@ -0,0 +1,317 @@ +From: =?utf-8?b?5p2o5pWP?= +Date: Thu, 18 Jul 2024 02:12:14 +0000 +Subject: =?utf-8?q?!92_fixbug_Merge_pull_request_!92_from_=E6=9D=A8?= + =?utf-8?q?=E6=95=8F/openkylin/nile?= + +--- + src/lock-backend/dbusupperinterface.cpp | 1 + + src/lock-dialog/backenddbushelper.cpp | 1 + + src/lock-dialog/lockdialogmodel.cpp | 39 ++++++++++++++++++++++++++++----- + src/lock-dialog/lockdialogmodel.h | 13 ++++++++++- + src/userinfo.cpp | 12 ++++++++++ + src/userinfo.h | 6 +++++ + src/widgets/authdialog.cpp | 3 +-- + src/widgets/lockwidget.cpp | 4 ++-- + src/widgets/powerlistwidget.cpp | 2 +- + src/widgets/userlistwidget.cpp | 3 +++ + 10 files changed, 73 insertions(+), 11 deletions(-) + +diff --git a/src/lock-backend/dbusupperinterface.cpp b/src/lock-backend/dbusupperinterface.cpp +index 4515621..90dac4f 100644 +--- a/src/lock-backend/dbusupperinterface.cpp ++++ b/src/lock-backend/dbusupperinterface.cpp +@@ -978,6 +978,7 @@ QJsonArray DbusUpperInterface::GenerateUserInfoList() + objUserInfo["backGround"] = userInfo->backGround(); + objUserInfo["lang"] = userInfo->lang(); + objUserInfo["headImg"] = userInfo->headImage(); ++ objUserInfo["systemAccount"] = userInfo->isSystemAccount(); + KylinUserDatePtr ptr = KYLINUSERDATAMNG::getInstance()->GetUserPtr(userInfo->name()); + if (nullptr != ptr) { + if (!ptr->backgroundPath().isEmpty()) { +diff --git a/src/lock-dialog/backenddbushelper.cpp b/src/lock-dialog/backenddbushelper.cpp +index fbbb703..16c655b 100644 +--- a/src/lock-dialog/backenddbushelper.cpp ++++ b/src/lock-dialog/backenddbushelper.cpp +@@ -1148,6 +1148,7 @@ QList BackendDbusHelper::ParseUsersInfo(const QJsonObject &objRes) + userPtr->updateLang(objUser.value("lang").toString()); + userPtr->updateGreeterBackground(objUser.value("greeterBackGround").toString()); + userPtr->updateBackgroundColor(objUser.value("color").toString()); ++ userPtr->updateSystemAccount(objUser.value("systemAccount").toBool(false)); + listUser.append(userPtr); + } + Q_EMIT usersInfoChanged(listUser); +diff --git a/src/lock-dialog/lockdialogmodel.cpp b/src/lock-dialog/lockdialogmodel.cpp +index 5992118..c7d84d7 100644 +--- a/src/lock-dialog/lockdialogmodel.cpp ++++ b/src/lock-dialog/lockdialogmodel.cpp +@@ -26,6 +26,7 @@ + #include + #include "utils.h" + #include "definetypes.h" ++#include + + LockDialogModel::LockDialogModel(QObject *parent) + : QObject(parent), m_isUseWayland(QGuiApplication::platformName().startsWith("wayland", Qt::CaseInsensitive)) +@@ -34,7 +35,7 @@ LockDialogModel::LockDialogModel(QObject *parent) + + bool LockDialogModel::parseCmdArguments(QStringList args, CommandLineArgs &cmdArgs) + { +- //命令行参数解析 ++ // 命令行参数解析 + QCommandLineParser parser; + parser.setApplicationDescription(QGuiApplication::translate("main", "Dialog for the ukui ScreenSaver.")); + parser.addHelpOption(); +@@ -102,8 +103,8 @@ bool LockDialogModel::parseCmdArguments(QStringList args, CommandLineArgs &cmdAr + } else { + if (!parser.isSet(sessionIdleOption) && !parser.isSet(lockOption) && !parser.isSet(lstOption) + && !parser.isSet(screensaverOption) && !parser.isSet(lscreensaverOption) && !parser.isSet(blankOption) +- && !parser.isSet(sessiontoolsOption) && !parser.isSet(switchuserOption) +- && !parser.isSet(appBlockOption) && !parser.isSet(multiUsersOption)) { ++ && !parser.isSet(sessiontoolsOption) && !parser.isSet(switchuserOption) && !parser.isSet(appBlockOption) ++ && !parser.isSet(multiUsersOption)) { + return false; + } + } +@@ -224,6 +225,20 @@ UserInfoPtr LockDialogModel::findUserByName(const QString &strName) + return user; + } + } ++ struct passwd *userInfo = getpwnam(strName.toLatin1().data()); ++ if (userInfo) { ++ UserInfoPtr userPtr = std::make_shared(); ++ userPtr->updateUid(userInfo->pw_uid); ++ userPtr->updateName(strName); ++ if (userInfo->pw_gecos && userInfo->pw_gecos[0] != '\0') { ++ QString geoces = QString(userInfo->pw_gecos); ++ QStringList list = geoces.split(QLatin1Char(',')); ++ if (list.size() > 0) { ++ userPtr->updateFullName(list[0]); ++ } ++ } ++ return userPtr; ++ } + return nullptr; + } + +@@ -234,6 +249,20 @@ UserInfoPtr LockDialogModel::findUserById(const uid_t &id) + return user; + } + } ++ struct passwd *userInfo = getpwuid(id); ++ if (userInfo) { ++ UserInfoPtr userPtr = std::make_shared(); ++ userPtr->updateUid(userInfo->pw_uid); ++ userPtr->updateName(userInfo->pw_name); ++ if (userInfo->pw_gecos && userInfo->pw_gecos[0] != '\0') { ++ QString geoces = QString(userInfo->pw_gecos); ++ QStringList list = geoces.split(QLatin1Char(',')); ++ if (list.size() > 0) { ++ userPtr->updateFullName(list[0]); ++ } ++ } ++ return userPtr; ++ } + return nullptr; + } + +@@ -256,6 +285,7 @@ void LockDialogModel::updateUsersInfo(QList list) + changedUserInfo->updateBackground(userinfo->backGround()); + changedUserInfo->updateGreeterBackground(userinfo->greeterBackGround()); + changedUserInfo->updateBackgroundColor(userinfo->backGroundColor()); ++ changedUserInfo->updateSystemAccount(userinfo->isSystemAccount()); + } + } else { + m_listUsersInfo.append(userinfo); +@@ -410,7 +440,7 @@ QString LockDialogModel::getXScreensaverPath(const QString &theme) + QStringList strs = theme.split("-"); + QString str = strs.at(strs.size() - 1); + QString filePath = QString("%1/%2").arg(XSCREENSAVER_DIRNAME, str); +- //除了判断gsetting值是否为空,还需要判断屏保文件是否存在,不存在就使用默认屏保。 ++ // 除了判断gsetting值是否为空,还需要判断屏保文件是否存在,不存在就使用默认屏保。 + if (QFile(filePath).exists()) + return filePath; + else +@@ -514,7 +544,6 @@ void LockDialogModel::updateUsdMediaKeys(QString keys, QString value) + } else if (keys == KEY_WINDOW_SCREENSHOT) { + m_windowScreenshot = value; + } +- + } + + void LockDialogModel::updateUsdMediaStateKeys(QString keys, int value) +diff --git a/src/lock-dialog/lockdialogmodel.h b/src/lock-dialog/lockdialogmodel.h +index 6c1d3ed..34d1067 100644 +--- a/src/lock-dialog/lockdialogmodel.h ++++ b/src/lock-dialog/lockdialogmodel.h +@@ -124,6 +124,17 @@ public: + return m_listUsersInfo; + } + ++ inline int normalUserCount() ++ { ++ int nCount = 0; ++ for (auto user : m_listUsersInfo) { ++ if (!user->isSystemAccount()) { ++ nCount++; ++ } ++ } ++ return nCount; ++ } ++ + void updateSessionsInfo(QStringList list); + + void updateScreensaverMode(QString value); +@@ -241,7 +252,7 @@ public: + return m_windowScreenshot; + } + +- inline int getUsdMediaRfkillState() ++ inline int getUsdMediaRfkillState() + { + return m_rfkillState; + } +diff --git a/src/userinfo.cpp b/src/userinfo.cpp +index 266d1cf..7808f3a 100644 +--- a/src/userinfo.cpp ++++ b/src/userinfo.cpp +@@ -32,6 +32,7 @@ UserInfo::UserInfo(QObject *parent) + , m_strLang(qgetenv("LANG")) + , m_strName("") + , m_strGreeterBackground("") ++ , m_isSystemAccount(false) + { + m_strHeadImage = getDefaultFace(); + } +@@ -46,6 +47,7 @@ UserInfo::UserInfo(const UserInfo &userInfo) + , m_strLang(userInfo.m_strLang) + , m_strName(userInfo.m_strName) + , m_strGreeterBackground(userInfo.m_strGreeterBackground) ++ , m_isSystemAccount(userInfo.m_isSystemAccount) + { + } + +@@ -104,6 +106,14 @@ void UserInfo::updateBackgroundColor(const QString &color) + m_strBackgroundColor = color; + } + ++void UserInfo::updateSystemAccount(const bool &isSystemAccount) ++{ ++ if (isSystemAccount == m_isSystemAccount) { ++ return; ++ } ++ m_isSystemAccount = isSystemAccount; ++} ++ + QDebug operator<<(QDebug stream, const UserInfo &userInfo) + { + stream << "[" << userInfo.uid() << userInfo.name() << userInfo.fullName() << userInfo.headImage() +@@ -202,6 +212,8 @@ void LocalUserInfo::initData() + if (!strBackground.isEmpty() && QFile(strBackground).exists() && QFile(strBackground).size()) { + m_strBackground = strBackground; + } ++ } else if (key == "SystemAccount") { ++ m_isSystemAccount = value.toBool(); + } + dbusArgs.endMapEntry(); + } +diff --git a/src/userinfo.h b/src/userinfo.h +index fbf8cc3..3b09d67 100644 +--- a/src/userinfo.h ++++ b/src/userinfo.h +@@ -69,6 +69,10 @@ public: + { + return m_strBackgroundColor; + } ++ inline bool isSystemAccount() const ++ { ++ return m_isSystemAccount; ++ } + + virtual inline QString path() const + { +@@ -85,6 +89,7 @@ public: + void updateName(const QString &name); + void updateGreeterBackground(const QString &background); + void updateBackgroundColor(const QString &color); ++ void updateSystemAccount(const bool &isSystemAccount); + + Q_SIGNALS: + void userPropChanged(const QString &userName); +@@ -99,6 +104,7 @@ protected: + QString m_strName; // 用户名 + QString m_strGreeterBackground; // 登录界面背景 + QString m_strBackgroundColor; // 桌面背景颜色 ++ bool m_isSystemAccount; // 系统用户 + }; + + typedef std::shared_ptr UserInfoPtr; +diff --git a/src/widgets/authdialog.cpp b/src/widgets/authdialog.cpp +index 1611e73..8914379 100644 +--- a/src/widgets/authdialog.cpp ++++ b/src/widgets/authdialog.cpp +@@ -277,7 +277,7 @@ void AuthDialog::updateAuthFontSize(double fontSize) + m_messageLabel->setFontSize((14 + fontSize) * m_ptToPx); + } + if (m_loginOpts) { +- m_loginOpts->updateLoginOptionFontSize(fontSize); ++ m_loginOpts->updateLoginOptionFontSize((16 + fontSize) * m_ptToPx); + } + if (m_labelQRCodeMsg) { + m_labelQRCodeMsg->setFontSize((14 + fontSize) * m_ptToPx); +@@ -1165,7 +1165,6 @@ void AuthDialog::showAuthenticated(bool successful /* = true*/) + switchLoginOptType(LOGINOPT_TYPE_PASSWORD); + if (!strMsgTip.isEmpty()) { + m_messageLabel->setText(strMsgTip); +- m_messageLabel->move(m_messageButton->x(), m_messageLabel->y()); + } + } else { + m_bNeedRetry = true; +diff --git a/src/widgets/lockwidget.cpp b/src/widgets/lockwidget.cpp +index 97a4386..139a9bb 100644 +--- a/src/widgets/lockwidget.cpp ++++ b/src/widgets/lockwidget.cpp +@@ -501,7 +501,7 @@ void LockWidget::initButtonWidget() + m_userButton->setIcon(QIcon(":/image/assets/switchuser.svg")); + buttonListWidget->addItem(m_btnItemUser); + connect(m_userButton, &StatusButton::clicked, this, [this]() { onShowUserListWidget(); }); +- if (m_modelLockDialog->usersInfo().count() > 1 || m_modelLockDialog->findUserByName("*login")) { ++ if (m_modelLockDialog->normalUserCount() > 1 || m_modelLockDialog->findUserByName("*login")) { + buttonListWidget->setItemHidden(m_btnItemUser, false); + } else { + buttonListWidget->setItemHidden(m_btnItemUser, true); +@@ -733,7 +733,7 @@ void LockWidget::onPowerItemClicked(QListWidgetItem *item) + void LockWidget::onUsersInfoChanged() + { + if (buttonListWidget && m_btnItemUser) { +- if (m_modelLockDialog->usersInfo().count() > 1 || m_modelLockDialog->findUserByName("*login")) { ++ if (m_modelLockDialog->normalUserCount() > 1 || m_modelLockDialog->findUserByName("*login")) { + buttonListWidget->setItemHidden(m_btnItemUser, false); + } else { + buttonListWidget->setItemHidden(m_btnItemUser, true); +diff --git a/src/widgets/powerlistwidget.cpp b/src/widgets/powerlistwidget.cpp +index 03461f6..cb9af05 100644 +--- a/src/widgets/powerlistwidget.cpp ++++ b/src/widgets/powerlistwidget.cpp +@@ -91,7 +91,7 @@ void PowerListWidget::updateBtnShowFlag() + m_powerBtnNum = 0; + for (int i = 0; i < sizeof(powerBtnList) / sizeof(powerBtnList[0]); i++) { + if (powerBtnList[i].canFuncName == QString("CanSwitchUser")) { +- powerBtnList[i].m_show_flag = (m_powerType == SESSION && m_modelLockDialog->usersInfo().count() > 1); ++ powerBtnList[i].m_show_flag = (m_powerType == SESSION && m_modelLockDialog->normalUserCount() > 1); + if (powerBtnList[i].m_show_flag) + m_powerBtnNum += 1; + } +diff --git a/src/widgets/userlistwidget.cpp b/src/widgets/userlistwidget.cpp +index 2a3ce87..954b709 100644 +--- a/src/widgets/userlistwidget.cpp ++++ b/src/widgets/userlistwidget.cpp +@@ -54,6 +54,9 @@ void UserListWidget::onUpdateListInfo() + { + this->clear(); + for (auto user : m_modelLockDialog->usersInfo()) { ++ if (user->isSystemAccount()) { ++ continue; ++ } + QListWidgetItem *userItem = new QListWidgetItem(); + userItem->setSizeHint(QSize(420, 40)); + insertItem(count(), userItem); diff --git a/debian/patches/series b/debian/patches/series index 0ad1ffe..8bf15ef 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -47,3 +47,4 @@ 0047-Deleted-translation-using-Weblate-Kyrgyz.patch 0048-Added-translation-using-Weblate-Kyrgyz.patch 0049-Translated-using-Weblate-Kyrgyz.patch +0050-92-fixbug.patch