From 586b583063ce6e6e11de1015238fd6dc82c1d125 Mon Sep 17 00:00:00 2001 From: tanyulong2021 Date: Thu, 8 Jul 2021 10:10:44 +0800 Subject: [PATCH 1/2] add judgment when Bluetooth does not exist --- ...dgment-when-Bluetooth-does-not-exist.patch | 82 +++++++++++++++++++ ukui-control-center.spec | 9 +- 2 files changed, 88 insertions(+), 3 deletions(-) create mode 100644 0001-add-judgment-when-Bluetooth-does-not-exist.patch diff --git a/0001-add-judgment-when-Bluetooth-does-not-exist.patch b/0001-add-judgment-when-Bluetooth-does-not-exist.patch new file mode 100644 index 0000000..123f813 --- /dev/null +++ b/0001-add-judgment-when-Bluetooth-does-not-exist.patch @@ -0,0 +1,82 @@ +From 28369c2426ec8ed4c3e8dad596a1e24ade5161de Mon Sep 17 00:00:00 2001 +From: tanyulong +Date: Thu, 8 Jul 2021 09:58:50 +0800 +Subject: [PATCH] add judgment when Bluetooth does not exist + +--- + shell/mainwindow.cpp | 30 +++++++++++++++++++----------- + shell/mainwindow.h | 2 +- + 2 files changed, 20 insertions(+), 12 deletions(-) + +diff --git a/shell/mainwindow.cpp b/shell/mainwindow.cpp +index ed872de..a85b68a 100755 +--- a/shell/mainwindow.cpp ++++ b/shell/mainwindow.cpp +@@ -547,7 +547,6 @@ void MainWindow::loadPlugins(){ + pluginsDir = QDir(qApp->applicationDirPath() + "/plugins"); + } + +- bool isExistCloud = isExitsCloudAccount(); + foreach (QString fileName, pluginsDir.entryList(QDir::Files)){ + //三权分立开启 + #ifdef WITHKYSEC +@@ -558,17 +557,17 @@ void MainWindow::loadPlugins(){ + continue; + } + #endif +- +- if (!fileName.endsWith(".so")) +- continue; +- if (fileName == "libexperienceplan.so") +- continue; +- if ("libnetworkaccount.so" == fileName && !isExistCloud) { +- continue; +- } +- +- if (!QGSettings::isSchemaInstalled(kVinoSchemas) && "libvino.so" == fileName) { ++ ++ if (!fileName.endsWith(".so")) { + continue; ++ } else if (fileName == "libexperienceplan.so") { ++ continue; ++ } else if ("libnetworkaccount.so" == fileName && !isExitsCloudAccount()) { ++ continue; ++ } else if (!QGSettings::isSchemaInstalled(kVinoSchemas) && "libvino.so" == fileName) { ++ continue; ++ } else if ("libbluetooth.so" == fileName && !isExitBluetooth()) { ++ continue; + } + + qDebug() << "Scan Plugin: " << fileName; +@@ -822,6 +821,15 @@ void MainWindow::initStyleSheet() { + "QPushButton:hover:pressed#closeBtn{background: #E54A50; border-radius: 4px;width:32px;height:32px;}"); + } + ++bool MainWindow::isExitBluetooth() { ++ QProcess process; ++ process.start("rfkill list"); ++ process.waitForFinished(); ++ QByteArray output = process.readAllStandardOutput(); ++ QString str_output = output; ++ return str_output.contains(QString("bluetooth"), Qt::CaseInsensitive); ++} ++ + void MainWindow::setModuleBtnHightLight(int id) { + leftBtnGroup->button(id)->setChecked(true); + leftMicBtnGroup->button(id)->setChecked(true); +diff --git a/shell/mainwindow.h b/shell/mainwindow.h +index d14f1ef..bb44d7e 100755 +--- a/shell/mainwindow.h ++++ b/shell/mainwindow.h +@@ -107,7 +107,7 @@ private: + + bool dblOnEdge(QMouseEvent *event); + void initStyleSheet(); +- ++ bool isExitBluetooth(); + public slots: + void functionBtnClicked(QObject * plugin); + void sltMessageReceived(const QString &msg); +-- +2.23.0 + diff --git a/ukui-control-center.spec b/ukui-control-center.spec index eb16df9..b69dfa7 100644 --- a/ukui-control-center.spec +++ b/ukui-control-center.spec @@ -1,7 +1,7 @@ %define debug_package %{nil} Name: ukui-control-center Version: 3.0.1 -Release: 4 +Release: 5 Summary: utilities to configure the UKUI desktop License: GPL-2+ URL: http://www.ukui.org @@ -74,7 +74,7 @@ patch1: 0002-fix-autologin-nopasswdlogin-failed.patch 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 Recommends: qt5-qtquickcontrols Suggests: gsettings-desktop-schemas @@ -99,7 +99,7 @@ Suggests: ukui-settings-daemon %patch2 -p1 %patch3 -p1 %patch4 -p1 - +%patch5 -p1 %build qmake-qt5 make @@ -142,6 +142,9 @@ rm -rf $RPM_BUILD_ROOT %{_datadir}/polkit-1/actions/org.ukui.groupmanager.policy %changelog +* Thu Jul 08 2021 tanyulong - 3.0.1-5 +- add-judgment-when-Bluetooth-does-not-exist.patch + * Thu Jan 21 2021 lvhan - 3.0.1-4 - fix-blueman-tray-and-groupadd-autologin From 4bb76a17abc084107032f7ca54854a7da2e9d460 Mon Sep 17 00:00:00 2001 From: tanyulong2021 Date: Thu, 8 Jul 2021 14:05:03 +0800 Subject: [PATCH 2/2] Fix Group members are not displayed --- ...-fix-Group-members-are-not-displayed.patch | 248 ++++++++++++++++++ ukui-control-center.spec | 9 +- 2 files changed, 256 insertions(+), 1 deletion(-) create mode 100644 0006-fix-Group-members-are-not-displayed.patch diff --git a/0006-fix-Group-members-are-not-displayed.patch b/0006-fix-Group-members-are-not-displayed.patch new file mode 100644 index 0000000..6a983eb --- /dev/null +++ b/0006-fix-Group-members-are-not-displayed.patch @@ -0,0 +1,248 @@ +From 1113ae6574950d672514621e0f8090d1f1241a72 Mon Sep 17 00:00:00 2001 +From: tanyulong +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 > reply = iproperty->call("GetAll", "org.freedesktop.Accounts.User"); ++ if (reply.isValid()){ ++ QMap 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 + #include + +-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 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 > reply = iproperty->call("GetAll", "org.freedesktop.Accounts.User"); ++ if (reply.isValid()){ ++ QMap 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 + #include + #include ++#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 allUserInfoMap; ++ SystemDbusDispatcher * sysdispatcher; + + void setupInit(); + void signalsBind(); ++ UserInfomations _acquireUserInfo(QString objpath); + + signals: + void needRefresh(); +-- +2.23.0 + diff --git a/ukui-control-center.spec b/ukui-control-center.spec index b69dfa7..90e0784 100644 --- a/ukui-control-center.spec +++ b/ukui-control-center.spec @@ -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 - 3.0.1-6 +- fix-Group-members-are-not-displayed + * Thu Jul 08 2021 tanyulong - 3.0.1-5 - add-judgment-when-Bluetooth-does-not-exist.patch