Sisyphus repositório
Última atualização: 1 outubro 2023 | SRPMs: 18631 | Visitas: 37905813
en ru br
ALT Linux repositórios
S:5.6.2-alt2

Group :: Desktop gráfico/Outros
RPM: deepin-dock

 Main   Changelog   Spec   Patches   Sources   Download   Gear   Bugs e FR  Repocop 

Patch: 0001-fix-bluetooth-switch-button-735.patch
Download


From fdd5f4cfe529385e284f99b4bb5e93838c1b23f4 Mon Sep 17 00:00:00 2001
From: chenjun <104487271+chenjun1982@users.noreply.github.com>
Date: Mon, 19 Dec 2022 16:32:05 +0800
Subject: [PATCH] fix: 蓝牙设备不可用时使能开关按钮 (#735)
1、删除使用错误的调色板,直接使用系统默认调色板。
2、蓝牙设备不可用时使能开关按钮,不禁用整个界面,避免界面文字内容不清
Log: 控制中心-个性化内设置为深色,从任务栏打开蓝牙面板后,蓝牙设置字体未变成浅色
Bug: https://pms.uniontech.com/bug-view-176333.html
Influence: 蓝牙设置字体跟随系统主题变化
---
 plugins/bluetooth/componments/bluetoothadapteritem.cpp | 14 +++++++++++++-
 plugins/bluetooth/componments/bluetoothadapteritem.h   |  2 ++
 plugins/bluetooth/componments/bluetoothapplet.cpp      | 23 ++---------------------
 plugins/bluetooth/componments/bluetoothapplet.h        |  3 ---
 4 files changed, 17 insertions(+), 25 deletions(-)
diff --git a/plugins/bluetooth/componments/bluetoothadapteritem.cpp b/plugins/bluetooth/componments/bluetoothadapteritem.cpp
index 1ad8013..5da0d47 100644
--- a/plugins/bluetooth/componments/bluetoothadapteritem.cpp
+++ b/plugins/bluetooth/componments/bluetoothadapteritem.cpp
@@ -140,4 +140,5 @@ BluetoothAdapterItem::BluetoothAdapterItem(Adapter *adapter, QWidget *parent)
     , m_bluetoothInter(new DBusBluetooth("com.deepin.daemon.Bluetooth", "/com/deepin/daemon/Bluetooth", QDBusConnection::sessionBus(), this))
     , m_showUnnamedDevices(false)
+    , m_stateBtnEnabled(true)
     , m_seperator(new HorizontalSeperator(this))
 {
@@ -227,4 +228,15 @@ QStringList BluetoothAdapterItem::connectedDevicesName()
 }
 
+void BluetoothAdapterItem::setStateBtnEnabled(bool enable)
+{
+    if (m_stateBtnEnabled != enable) {
+        m_stateBtnEnabled = enable;
+    }
+
+    if (m_adapterStateBtn) {
+        m_adapterStateBtn->setEnabled(m_stateBtnEnabled);
+    }
+}
+
 void BluetoothAdapterItem::initData()
 {
@@ -382,5 +394,5 @@ void BluetoothAdapterItem::initConnect()
         m_seperator->setVisible(state);
         m_adapterStateBtn->setChecked(state);
-        m_adapterStateBtn->setEnabled(true);
+        m_adapterStateBtn->setEnabled(m_stateBtnEnabled);
         emit adapterPowerChanged();
     });
diff --git a/plugins/bluetooth/componments/bluetoothadapteritem.h b/plugins/bluetooth/componments/bluetoothadapteritem.h
index 074fb4c..cd1b32d 100644
--- a/plugins/bluetooth/componments/bluetoothadapteritem.h
+++ b/plugins/bluetooth/componments/bluetoothadapteritem.h
@@ -85,4 +85,5 @@ public:
     Adapter *adapter() { return m_adapter; }
     QStringList connectedDevicesName();
+    void setStateBtnEnabled(bool);
 
 public slots:
@@ -126,4 +127,5 @@ private:
     DBusBluetooth *m_bluetoothInter;
     bool m_showUnnamedDevices;
+    bool m_stateBtnEnabled;
 
     QMap<QString, BluetoothDeviceItem *> m_deviceItems;
diff --git a/plugins/bluetooth/componments/bluetoothapplet.cpp b/plugins/bluetooth/componments/bluetoothapplet.cpp
index 9cb9f7c..d65ee47 100644
--- a/plugins/bluetooth/componments/bluetoothapplet.cpp
+++ b/plugins/bluetooth/componments/bluetoothapplet.cpp
@@ -44,5 +44,4 @@ SettingLabel::SettingLabel(QString text, QWidget *parent)
 
     m_label->setForegroundRole(QPalette::BrightText);
-    updateEnabledStatus();
 }
 
@@ -53,22 +52,4 @@ void SettingLabel::addButton(QWidget *button, int space)
 }
 
-void SettingLabel::updateEnabledStatus()
-{
-    QPalette p = m_label->palette();
-    if (m_label->isEnabled())
-        p.setColor(QPalette::BrightText, QColor(0, 0, 0));
-    else
-        p.setColor(QPalette::BrightText, QColor(51, 51, 51));
-    m_label->setPalette(p);
-}
-
-void SettingLabel::changeEvent(QEvent *event)
-{
-    if (event->type() == QEvent::EnabledChange)
-        updateEnabledStatus();
-
-    QWidget::changeEvent(event);
-}
-
 void SettingLabel::mousePressEvent(QMouseEvent *ev)
 {
@@ -176,5 +157,5 @@ void BluetoothApplet::onAdapterAdded(Adapter *adapter)
     // 如果开启了飞行模式,置灰蓝牙适配器使能开关
     foreach (const auto item, m_adapterItems) {
-        item->setEnabled(!m_airPlaneModeInter->enabled());
+        item->setStateBtnEnabled(!m_airPlaneModeInter->enabled());
     }
 
@@ -273,5 +254,5 @@ void BluetoothApplet::initConnect()
     connect(m_airPlaneModeInter, &DBusAirplaneMode::EnabledChanged, this, [this](bool enabled) {
         foreach (const auto item, m_adapterItems) {
-            item->setEnabled(!enabled);
+            item->setStateBtnEnabled(!enabled);
         }
     });
diff --git a/plugins/bluetooth/componments/bluetoothapplet.h b/plugins/bluetooth/componments/bluetoothapplet.h
index 0b26529..3548f70 100644
--- a/plugins/bluetooth/componments/bluetoothapplet.h
+++ b/plugins/bluetooth/componments/bluetoothapplet.h
@@ -47,7 +47,4 @@ protected:
     void mousePressEvent(QMouseEvent *ev) override;
     void paintEvent(QPaintEvent *event) override;
-    void changeEvent(QEvent *event) override;
-
-    void updateEnabledStatus();
 
 private:
--
libgit2 1.3.2
 
projeto & código: Vladimir Lettiev aka crux © 2004-2005, Andrew Avramenko aka liks © 2007-2008
mantenedor atual: Michael Shigorin
mantenedor da tradução: Fernando Martini aka fmartini © 2009