From d10ed3d820d86e72953d3a5b70cfdde71ec4af48 Mon Sep 17 00:00:00 2001 From: ck Date: Thu, 12 Dec 2024 10:40:01 +0800 Subject: [PATCH] fix: groups settings visible in deepin groups settings only show in uos (?_?) pms: Bug-293977 --- .../operation/accountscontroller.cpp | 13 +++++++++++++ src/plugin-accounts/operation/accountscontroller.h | 1 + src/plugin-accounts/qml/AccountSettings.qml | 4 +++- 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/plugin-accounts/operation/accountscontroller.cpp b/src/plugin-accounts/operation/accountscontroller.cpp index 07f677ce0c..3637c9178e 100644 --- a/src/plugin-accounts/operation/accountscontroller.cpp +++ b/src/plugin-accounts/operation/accountscontroller.cpp @@ -245,6 +245,16 @@ bool AccountsController::isOnline(const QString &id) return user ? user->online() : false; } +bool AccountsController::needShowGroups() +{ +#ifdef QT_DEBUG + // alwayls show groups for test + return true; +#endif + + return !DSysInfo::isCommunityEdition(); +} + QStringList AccountsController::allGroups() const { return m_model->getAllGroups(); @@ -252,6 +262,9 @@ QStringList AccountsController::allGroups() const QStringList AccountsController::groups(const QString &id) { + if (!needShowGroups()) + return QStringList(); + if (m_groups.contains(id)) return m_groups.value(id); diff --git a/src/plugin-accounts/operation/accountscontroller.h b/src/plugin-accounts/operation/accountscontroller.h index 6fa5c22173..9d5dac80c1 100644 --- a/src/plugin-accounts/operation/accountscontroller.h +++ b/src/plugin-accounts/operation/accountscontroller.h @@ -50,6 +50,7 @@ public slots: bool nopasswdLogin(const QString &id); void setNopasswdLogin(const QString &id, const bool enable); bool isOnline(const QString &id); + bool needShowGroups(); QStringList allGroups() const; QStringList groups(const QString &id); diff --git a/src/plugin-accounts/qml/AccountSettings.qml b/src/plugin-accounts/qml/AccountSettings.qml index 5ba89d9cf8..4ad39c4d39 100644 --- a/src/plugin-accounts/qml/AccountSettings.qml +++ b/src/plugin-accounts/qml/AccountSettings.qml @@ -433,7 +433,7 @@ DccObject { pageType: DccObject.Item page: RowLayout { Button { - Layout.alignment: Qt.AlignLeft + Layout.alignment: groupSettingsBtn.visible ? Qt.AlignLeft : Qt.AlignRight text: qsTr("Delete current account") enabled: dccData.isDeleteAble(settings.userId) Loader { @@ -457,8 +457,10 @@ DccObject { } Button { + id: groupSettingsBtn Layout.alignment: Qt.AlignRight text: qsTr("Group setting") + visible: dccData.needShowGroups() onClicked: { DccApp.showPage(groupSettings) }