fix(power):Fix has really battery while it is present
- 适配真实电池存在场景 Related #31917
This commit is contained in:
parent
72ede7c5db
commit
13bd1da7d6
@ -0,0 +1,56 @@
|
|||||||
|
From 25384cbcc740634b4c3ee80026728a11603111cf Mon Sep 17 00:00:00 2001
|
||||||
|
From: meizhigang <meizhigang@kylinsec.com.cn>
|
||||||
|
Date: Mon, 8 Apr 2024 16:13:17 +0800
|
||||||
|
Subject: [PATCH 3/3] fix(power):Fix has really battery while it is present
|
||||||
|
MIME-Version: 1.0
|
||||||
|
Content-Type: text/plain; charset=UTF-8
|
||||||
|
Content-Transfer-Encoding: 8bit
|
||||||
|
|
||||||
|
- 适配真实电池存在场景
|
||||||
|
|
||||||
|
Related #31917
|
||||||
|
---
|
||||||
|
plugins/power/upower-interface.cpp | 11 ++++++++---
|
||||||
|
1 file changed, 8 insertions(+), 3 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/plugins/power/upower-interface.cpp b/plugins/power/upower-interface.cpp
|
||||||
|
index 4c964a6..4c04130 100644
|
||||||
|
--- a/plugins/power/upower-interface.cpp
|
||||||
|
+++ b/plugins/power/upower-interface.cpp
|
||||||
|
@@ -14,8 +14,8 @@
|
||||||
|
|
||||||
|
#include "upower-interface.h"
|
||||||
|
#include <upower.h>
|
||||||
|
-#include <cstdio>
|
||||||
|
#include <QtGlobal>
|
||||||
|
+#include <cstdio>
|
||||||
|
|
||||||
|
// 由于Glib定义与Qt内部相关定义冲突,将该函数单独封装起来
|
||||||
|
bool UPowerInterface::haveBattery()
|
||||||
|
@@ -43,16 +43,21 @@ bool UPowerInterface::haveBattery()
|
||||||
|
#endif
|
||||||
|
void *device = nullptr;
|
||||||
|
UpDeviceKind kind;
|
||||||
|
+ gboolean is_present = FALSE;
|
||||||
|
for (unsigned int i = 0; i < devices->len; i++)
|
||||||
|
{
|
||||||
|
device = g_ptr_array_index(devices, i);
|
||||||
|
g_object_get(device,
|
||||||
|
"kind", &kind,
|
||||||
|
NULL);
|
||||||
|
- if (kind == UP_DEVICE_KIND_BATTERY)
|
||||||
|
+
|
||||||
|
+ g_object_get(device,
|
||||||
|
+ "is-present", &is_present,
|
||||||
|
+ NULL);
|
||||||
|
+ if (kind == UP_DEVICE_KIND_BATTERY && is_present)
|
||||||
|
hasBattery = true;
|
||||||
|
}
|
||||||
|
- g_ptr_array_unref (devices);
|
||||||
|
+ g_ptr_array_unref(devices);
|
||||||
|
g_object_unref(upClient);
|
||||||
|
return hasBattery;
|
||||||
|
}
|
||||||
|
--
|
||||||
|
2.27.0
|
||||||
|
|
||||||
@ -1,6 +1,6 @@
|
|||||||
Name: kiran-control-panel
|
Name: kiran-control-panel
|
||||||
Version: 2.6.1
|
Version: 2.6.1
|
||||||
Release: 3%{?dist}
|
Release: 4%{?dist}
|
||||||
Summary: Kiran Control Panel
|
Summary: Kiran Control Panel
|
||||||
Summary(zh_CN): Kiran桌面控制面板
|
Summary(zh_CN): Kiran桌面控制面板
|
||||||
|
|
||||||
@ -10,6 +10,7 @@ Source0: %{name}-%{version}.tar.gz
|
|||||||
Patch000: 0000-fix-audio-when-the-tray-is-initialized-determine-whe.patch
|
Patch000: 0000-fix-audio-when-the-tray-is-initialized-determine-whe.patch
|
||||||
Patch001: 0001-fix-keybinding-don-t-convert-normal-key-if-use-shift.patch
|
Patch001: 0001-fix-keybinding-don-t-convert-normal-key-if-use-shift.patch
|
||||||
Patch002: 0002-fix-audio-network-Compatible-for-versions-below-5.15.patch
|
Patch002: 0002-fix-audio-network-Compatible-for-versions-below-5.15.patch
|
||||||
|
Patch003: 0003-fix-power-Fix-has-really-battery-while-it-is-present.patch
|
||||||
|
|
||||||
BuildRequires: gcc-c++
|
BuildRequires: gcc-c++
|
||||||
BuildRequires: cmake >= 3.2
|
BuildRequires: cmake >= 3.2
|
||||||
@ -159,6 +160,9 @@ make %{?_smp_mflags}
|
|||||||
rm -rf %{buildroot}
|
rm -rf %{buildroot}
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Wed Apr 10 2024 meizhigang <meizhigang@kylinsec.com.cn> - 2.6.1-4
|
||||||
|
- KYOS-B: Fix has really battery while it is present (#31917)
|
||||||
|
|
||||||
* Tue Apr 9 2024 youzhengcai <youzhengcai@kylinsec.com.cn> - 2.6.1-3
|
* Tue Apr 9 2024 youzhengcai <youzhengcai@kylinsec.com.cn> - 2.6.1-3
|
||||||
- KYOS-F: fix(audio&network):Compatible for versions below 5.15
|
- KYOS-F: fix(audio&network):Compatible for versions below 5.15
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user