add judgment when Bluetooth does not exist

This commit is contained in:
tanyulong2021 2021-07-08 10:10:44 +08:00
parent fe92ea913e
commit 586b583063
2 changed files with 88 additions and 3 deletions

View 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

View File

@ -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<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
- fix-blueman-tray-and-groupadd-autologin