From 586b583063ce6e6e11de1015238fd6dc82c1d125 Mon Sep 17 00:00:00 2001 From: tanyulong2021 Date: Thu, 8 Jul 2021 10:10:44 +0800 Subject: [PATCH] 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