!18 (bluetooth): add judgment when Bluetooth does not exist
From: @tanyulong2021 Reviewed-by: @dou33 Signed-off-by: @dou33
This commit is contained in:
commit
7807777c28
82
0001-add-judgment-when-Bluetooth-does-not-exist.patch
Normal file
82
0001-add-judgment-when-Bluetooth-does-not-exist.patch
Normal file
@ -0,0 +1,82 @@
|
|||||||
|
From 28369c2426ec8ed4c3e8dad596a1e24ade5161de Mon Sep 17 00:00:00 2001
|
||||||
|
From: tanyulong <tanyulong@kylinos.cn>
|
||||||
|
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
|
||||||
|
|
||||||
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}
|
%define debug_package %{nil}
|
||||||
Name: ukui-control-center
|
Name: ukui-control-center
|
||||||
Version: 3.0.1
|
Version: 3.0.1
|
||||||
Release: 4
|
Release: 6
|
||||||
Summary: utilities to configure the UKUI desktop
|
Summary: utilities to configure the UKUI desktop
|
||||||
License: GPL-2+
|
License: GPL-2+
|
||||||
URL: http://www.ukui.org
|
URL: http://www.ukui.org
|
||||||
@ -74,6 +74,8 @@ patch1: 0002-fix-autologin-nopasswdlogin-failed.patch
|
|||||||
patch2: 0003-fix-dialog-pop-twice-after-modifying-resolution-bug.patch
|
patch2: 0003-fix-dialog-pop-twice-after-modifying-resolution-bug.patch
|
||||||
patch3: 0004-fix-effects-mode-not-available-bug.patch
|
patch3: 0004-fix-effects-mode-not-available-bug.patch
|
||||||
patch4: 0005-fix-blueman-tray-and-groupadd-autologin.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
|
Recommends: qt5-qtquickcontrols
|
||||||
|
|
||||||
@ -99,6 +101,8 @@ Suggests: ukui-settings-daemon
|
|||||||
%patch2 -p1
|
%patch2 -p1
|
||||||
%patch3 -p1
|
%patch3 -p1
|
||||||
%patch4 -p1
|
%patch4 -p1
|
||||||
|
%patch5 -p1
|
||||||
|
%patch6 -p1
|
||||||
|
|
||||||
%build
|
%build
|
||||||
qmake-qt5
|
qmake-qt5
|
||||||
@ -142,6 +146,12 @@ rm -rf $RPM_BUILD_ROOT
|
|||||||
%{_datadir}/polkit-1/actions/org.ukui.groupmanager.policy
|
%{_datadir}/polkit-1/actions/org.ukui.groupmanager.policy
|
||||||
|
|
||||||
%changelog
|
%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
|
||||||
|
|
||||||
* Thu Jan 21 2021 lvhan <lvhan@kylinos.cn> - 3.0.1-4
|
* Thu Jan 21 2021 lvhan <lvhan@kylinos.cn> - 3.0.1-4
|
||||||
- fix-blueman-tray-and-groupadd-autologin
|
- fix-blueman-tray-and-groupadd-autologin
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user