Skip to content

Commit

Permalink
fix: groups settings visible in deepin
Browse files Browse the repository at this point in the history
groups settings only show in uos (?_?)
pms: Bug-293977
  • Loading branch information
kegechen committed Dec 12, 2024
1 parent fd3c2e6 commit d10ed3d
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
13 changes: 13 additions & 0 deletions src/plugin-accounts/operation/accountscontroller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -245,13 +245,26 @@ 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();
}

QStringList AccountsController::groups(const QString &id)
{
if (!needShowGroups())
return QStringList();

if (m_groups.contains(id))
return m_groups.value(id);

Expand Down
1 change: 1 addition & 0 deletions src/plugin-accounts/operation/accountscontroller.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 3 additions & 1 deletion src/plugin-accounts/qml/AccountSettings.qml
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -457,8 +457,10 @@ DccObject {
}

Button {
id: groupSettingsBtn
Layout.alignment: Qt.AlignRight
text: qsTr("Group setting")
visible: dccData.needShowGroups()
onClicked: {
DccApp.showPage(groupSettings)
}
Expand Down

0 comments on commit d10ed3d

Please sign in to comment.