Fix Group members are not displayed
This commit is contained in:
parent
586b583063
commit
4bb76a17ab
248
0006-fix-Group-members-are-not-displayed.patch
Normal file
248
0006-fix-Group-members-are-not-displayed.patch
Normal file
@ -0,0 +1,248 @@
|
||||
From 1113ae6574950d672514621e0f8090d1f1241a72 Mon Sep 17 00:00:00 2001
|
||||
From: tanyulong <tanyulong@kylinos.cn>
|
||||
Date: Thu, 8 Jul 2021 13:46:27 +0800
|
||||
Subject: [PATCH] Fix Group members are not displayed
|
||||
|
||||
---
|
||||
.../account/userinfo/creategroupdialog.cpp | 61 +++++++++++++++++-
|
||||
plugins/account/userinfo/creategroupdialog.h | 22 ++++++-
|
||||
plugins/account/userinfo/editgroupdialog.cpp | 62 ++++++++++++++++++-
|
||||
plugins/account/userinfo/editgroupdialog.h | 19 +++++-
|
||||
4 files changed, 155 insertions(+), 9 deletions(-)
|
||||
|
||||
diff --git a/plugins/account/userinfo/creategroupdialog.cpp b/plugins/account/userinfo/creategroupdialog.cpp
|
||||
index 56f7b2c..4507260 100755
|
||||
--- a/plugins/account/userinfo/creategroupdialog.cpp
|
||||
+++ b/plugins/account/userinfo/creategroupdialog.cpp
|
||||
@@ -70,12 +70,67 @@ void CreateGroupDialog::refreshCertainBtnStatus(){
|
||||
ui->certainBtn->setEnabled(_nameHasModified || _idHasModified);
|
||||
}
|
||||
|
||||
+UserInfomationss CreateGroupDialog::_acquireUserInfo(QString objpath){
|
||||
+ UserInfomationss user;
|
||||
+
|
||||
+ //默认值
|
||||
+ user.current = false;
|
||||
+ user.logined = false;
|
||||
+ user.autologin = false;
|
||||
+
|
||||
+ QDBusInterface * iproperty = new QDBusInterface("org.freedesktop.Accounts",
|
||||
+ objpath,
|
||||
+ "org.freedesktop.DBus.Properties",
|
||||
+ QDBusConnection::systemBus());
|
||||
+ QDBusReply<QMap<QString, QVariant> > reply = iproperty->call("GetAll", "org.freedesktop.Accounts.User");
|
||||
+ if (reply.isValid()){
|
||||
+ QMap<QString, QVariant> propertyMap;
|
||||
+ propertyMap = reply.value();
|
||||
+ user.username = propertyMap.find("UserName").value().toString();
|
||||
+ if (user.username == QString(g_get_user_name())) {
|
||||
+ user.current = true;
|
||||
+ user.logined = true;
|
||||
+ }
|
||||
+ }
|
||||
+ else
|
||||
+ qDebug() << "reply failed";
|
||||
+
|
||||
+ delete iproperty;
|
||||
+
|
||||
+ return user;
|
||||
+}
|
||||
+
|
||||
void CreateGroupDialog::getUsersList()
|
||||
{
|
||||
qDebug() << "当前文件 :" << __FILE__ << "当前函数 :" << __FUNCTION__ << "当前行号 :" << __LINE__;
|
||||
- UserInfo * userinfo = new UserInfo;
|
||||
- QStringList usersList = userinfo->getUsersList();
|
||||
-// qDebug() << "CreateGroupDialog::getUsersList" << usersList.at(0) << usersList.at(1);
|
||||
+ QStringList allUsers;
|
||||
+ sysdispatcher = new SystemDbusDispatcher(this);
|
||||
+
|
||||
+ QStringList objectpaths = sysdispatcher->list_cached_users();
|
||||
+ allUserInfoMap.clear();
|
||||
+ //root
|
||||
+ if (!getuid()){
|
||||
+ UserInfomationss root;
|
||||
+ root.username = g_get_user_name();
|
||||
+ root.current = true;
|
||||
+ root.logined = true;
|
||||
+ root.autologin = false;
|
||||
+ root.uid = 0;
|
||||
+ root.accounttype = ADMINISTRATOR;
|
||||
+ // root.iconfile = DEFAULTFACE;
|
||||
+ allUserInfoMap.insert(root.username, root);
|
||||
+ }
|
||||
+ for (QString objectpath : objectpaths){
|
||||
+ UserInfomationss user;
|
||||
+ user = _acquireUserInfo(objectpath);
|
||||
+ allUserInfoMap.insert(user.username, user);
|
||||
+ }
|
||||
+ for (QVariant tmp : allUserInfoMap.keys()){
|
||||
+ allUsers << tmp.toString();
|
||||
+
|
||||
+ }
|
||||
+ QStringList usersList = allUsers;
|
||||
+
|
||||
for(int i = 0; i < usersList.size(); i++){
|
||||
QListWidgetItem * item = new QListWidgetItem(ui->listWidget);
|
||||
item->setSizeHint(QSize(ui->listWidget->width(), 36));
|
||||
diff --git a/plugins/account/userinfo/creategroupdialog.h b/plugins/account/userinfo/creategroupdialog.h
|
||||
index e0432fc..1ca0225 100755
|
||||
--- a/plugins/account/userinfo/creategroupdialog.h
|
||||
+++ b/plugins/account/userinfo/creategroupdialog.h
|
||||
@@ -30,7 +30,22 @@
|
||||
#include <QLineEdit>
|
||||
#include <QListWidget>
|
||||
|
||||
-class UserInfo;
|
||||
+#include "qtdbus/systemdbusdispatcher.h"
|
||||
+
|
||||
+typedef struct _UserInfomationss {
|
||||
+ QString objpath;
|
||||
+ QString username;
|
||||
+ QString iconfile;
|
||||
+ QString passwd;
|
||||
+ int accounttype;
|
||||
+ int passwdtype;
|
||||
+ bool current;
|
||||
+ bool logined;
|
||||
+ bool autologin;
|
||||
+ bool noPwdLogin;
|
||||
+ qint64 uid;
|
||||
+}UserInfomationss;
|
||||
+
|
||||
class ChangeGroupDialog;
|
||||
namespace Ui {
|
||||
class CreateGroupDialog;
|
||||
@@ -62,9 +77,12 @@ private:
|
||||
bool _nameHasModified;
|
||||
bool _idHasModified;
|
||||
bool _boxModified;
|
||||
-
|
||||
+ QMap<QString, UserInfomationss> allUserInfoMap;
|
||||
+ SystemDbusDispatcher * sysdispatcher;
|
||||
+
|
||||
void setupInit();
|
||||
void signalsBind();
|
||||
+ UserInfomationss _acquireUserInfo(QString objpath);
|
||||
};
|
||||
|
||||
#endif // CREATEGROUPDIALOG_H
|
||||
diff --git a/plugins/account/userinfo/editgroupdialog.cpp b/plugins/account/userinfo/editgroupdialog.cpp
|
||||
index a90b9cd..d3971cd 100755
|
||||
--- a/plugins/account/userinfo/editgroupdialog.cpp
|
||||
+++ b/plugins/account/userinfo/editgroupdialog.cpp
|
||||
@@ -73,11 +73,67 @@ void EditGroupDialog::refreshCertainBtnStatus(){
|
||||
ui->certainBtn->setEnabled(_nameHasModified || _idHasModified || _boxModified);
|
||||
}
|
||||
|
||||
+UserInfomations EditGroupDialog::_acquireUserInfo(QString objpath){
|
||||
+ UserInfomations user;
|
||||
+
|
||||
+ //默认值
|
||||
+ user.current = false;
|
||||
+ user.logined = false;
|
||||
+ user.autologin = false;
|
||||
+
|
||||
+ QDBusInterface * iproperty = new QDBusInterface("org.freedesktop.Accounts",
|
||||
+ objpath,
|
||||
+ "org.freedesktop.DBus.Properties",
|
||||
+ QDBusConnection::systemBus());
|
||||
+ QDBusReply<QMap<QString, QVariant> > reply = iproperty->call("GetAll", "org.freedesktop.Accounts.User");
|
||||
+ if (reply.isValid()){
|
||||
+ QMap<QString, QVariant> propertyMap;
|
||||
+ propertyMap = reply.value();
|
||||
+ user.username = propertyMap.find("UserName").value().toString();
|
||||
+ if (user.username == QString(g_get_user_name())) {
|
||||
+ user.current = true;
|
||||
+ user.logined = true;
|
||||
+ }
|
||||
+ }
|
||||
+ else
|
||||
+ qDebug() << "reply failed";
|
||||
+
|
||||
+ delete iproperty;
|
||||
+
|
||||
+ return user;
|
||||
+}
|
||||
+
|
||||
+
|
||||
void EditGroupDialog::getUsersList(QString usergroup)
|
||||
{
|
||||
- UserInfo * userinfo = new UserInfo;
|
||||
- QStringList usersList = userinfo->getUsersList();
|
||||
- qDebug() << "EditGroupDialog::getUsersList";
|
||||
+ QStringList usergroupList = usergroup.split(",");
|
||||
+ QStringList allUsers;
|
||||
+ sysdispatcher = new SystemDbusDispatcher(this);
|
||||
+
|
||||
+ QStringList objectpaths = sysdispatcher->list_cached_users();
|
||||
+ allUserInfoMap.clear();
|
||||
+ //root
|
||||
+ if (!getuid()){
|
||||
+ UserInfomations root;
|
||||
+ root.username = g_get_user_name();
|
||||
+ root.current = true;
|
||||
+ root.logined = true;
|
||||
+ root.autologin = false;
|
||||
+ root.uid = 0;
|
||||
+ root.accounttype = ADMINISTRATOR;
|
||||
+ // root.iconfile = DEFAULTFACE;
|
||||
+ allUserInfoMap.insert(root.username, root);
|
||||
+ }
|
||||
+ for (QString objectpath : objectpaths){
|
||||
+ UserInfomations user;
|
||||
+ user = _acquireUserInfo(objectpath);
|
||||
+ allUserInfoMap.insert(user.username, user);
|
||||
+ }
|
||||
+ for (QVariant tmp : allUserInfoMap.keys()){
|
||||
+ allUsers << tmp.toString();
|
||||
+
|
||||
+ }
|
||||
+ QStringList usersList = allUsers;
|
||||
QStringList usergroupList = usergroup.split(",");
|
||||
|
||||
for(int i = 0; i < usersList.size(); i++){
|
||||
diff --git a/plugins/account/userinfo/editgroupdialog.h b/plugins/account/userinfo/editgroupdialog.h
|
||||
index 9a065fb..b66ea55 100755
|
||||
--- a/plugins/account/userinfo/editgroupdialog.h
|
||||
+++ b/plugins/account/userinfo/editgroupdialog.h
|
||||
@@ -29,8 +29,22 @@
|
||||
#include <QRegExpValidator>
|
||||
#include <QLineEdit>
|
||||
#include <QListWidget>
|
||||
+#include "qtdbus/systemdbusdispatcher.h"
|
||||
+
|
||||
+typedef struct _UserInfomations {
|
||||
+ QString objpath;
|
||||
+ QString username;
|
||||
+ QString iconfile;
|
||||
+ QString passwd;
|
||||
+ int accounttype;
|
||||
+ int passwdtype;
|
||||
+ bool current;
|
||||
+ bool logined;
|
||||
+ bool autologin;
|
||||
+ bool noPwdLogin;
|
||||
+ qint64 uid;
|
||||
+}UserInfomations;
|
||||
|
||||
-class UserInfo;
|
||||
class ChangeGroupDialog;
|
||||
namespace Ui {
|
||||
class EditGroupDialog;
|
||||
@@ -63,9 +77,12 @@ private:
|
||||
bool _boxModified;
|
||||
QString userGroup;
|
||||
QString groupId;
|
||||
+ QMap<QString, UserInfomations> allUserInfoMap;
|
||||
+ SystemDbusDispatcher * sysdispatcher;
|
||||
|
||||
void setupInit();
|
||||
void signalsBind();
|
||||
+ UserInfomations _acquireUserInfo(QString objpath);
|
||||
|
||||
signals:
|
||||
void needRefresh();
|
||||
--
|
||||
2.23.0
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
%define debug_package %{nil}
|
||||
Name: ukui-control-center
|
||||
Version: 3.0.1
|
||||
Release: 5
|
||||
Release: 6
|
||||
Summary: utilities to configure the UKUI desktop
|
||||
License: GPL-2+
|
||||
URL: http://www.ukui.org
|
||||
@ -75,6 +75,8 @@ patch2: 0003-fix-dialog-pop-twice-after-modifying-resolution-bug.patch
|
||||
patch3: 0004-fix-effects-mode-not-available-bug.patch
|
||||
patch4: 0005-fix-blueman-tray-and-groupadd-autologin.patch
|
||||
patch5: 0001-add-judgment-when-Bluetooth-does-not-exist.patch
|
||||
patch6: 0006-fix-Group-members-are-not-displayed.patch
|
||||
|
||||
Recommends: qt5-qtquickcontrols
|
||||
|
||||
Suggests: gsettings-desktop-schemas
|
||||
@ -100,6 +102,8 @@ Suggests: ukui-settings-daemon
|
||||
%patch3 -p1
|
||||
%patch4 -p1
|
||||
%patch5 -p1
|
||||
%patch6 -p1
|
||||
|
||||
%build
|
||||
qmake-qt5
|
||||
make
|
||||
@ -142,6 +146,9 @@ rm -rf $RPM_BUILD_ROOT
|
||||
%{_datadir}/polkit-1/actions/org.ukui.groupmanager.policy
|
||||
|
||||
%changelog
|
||||
* Thu Jul 08 2021 tanyulong<tanyulong@kylinos.cn> - 3.0.1-6
|
||||
- fix-Group-members-are-not-displayed
|
||||
|
||||
* Thu Jul 08 2021 tanyulong<tanyulong@kylinos.cn> - 3.0.1-5
|
||||
- add-judgment-when-Bluetooth-does-not-exist.patch
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user