summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Sturmlechner <asturm@gentoo.org>2022-01-20 13:07:31 +0100
committerAndreas Sturmlechner <asturm@gentoo.org>2022-01-20 14:24:19 +0100
commit9cce54b509898e120239847fb54850a05f75f5ae (patch)
tree0a252be972419c26ae48c564f391e3879914f598 /kde-frameworks
parentkde-frameworks/kholidays: Drop 5.90.0 (r0) (diff)
downloadgentoo-9cce54b509898e120239847fb54850a05f75f5ae.tar.gz
gentoo-9cce54b509898e120239847fb54850a05f75f5ae.tar.bz2
gentoo-9cce54b509898e120239847fb54850a05f75f5ae.zip
kde-frameworks/solid: Properly round up battery's capacity
Upstream commit 2f305a7134f27489203c3fd2e9ca81790f35ac3b KDE-bug: https://bugs.kde.org/show_bug.cgi?id=448372 Package-Manager: Portage-3.0.30, Repoman-3.0.3 Signed-off-by: Andreas Sturmlechner <asturm@gentoo.org>
Diffstat (limited to 'kde-frameworks')
-rw-r--r--kde-frameworks/solid/files/solid-5.90.0-properly-round-battery-capacity.patch31
-rw-r--r--kde-frameworks/solid/solid-5.90.0-r1.ebuild55
2 files changed, 86 insertions, 0 deletions
diff --git a/kde-frameworks/solid/files/solid-5.90.0-properly-round-battery-capacity.patch b/kde-frameworks/solid/files/solid-5.90.0-properly-round-battery-capacity.patch
new file mode 100644
index 000000000000..77296074bfa7
--- /dev/null
+++ b/kde-frameworks/solid/files/solid-5.90.0-properly-round-battery-capacity.patch
@@ -0,0 +1,31 @@
+From 2f305a7134f27489203c3fd2e9ca81790f35ac3b Mon Sep 17 00:00:00 2001
+From: ivan tkachenko <me@ratijas.tk>
+Date: Mon, 17 Jan 2022 02:24:44 +0300
+Subject: [PATCH] [upower] Properly round up battery's capacity
+
+The same rounding is already used for charge percent just few lines
+above. Without it, for example, values that are close to 100%
+(e.g. 99.9825%) were rounded down to 99% instead of up to 100%.
+
+BUG: 448372
+FIXED-IN: 5.91
+---
+ src/solid/devices/backends/upower/upowerbattery.cpp | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/solid/devices/backends/upower/upowerbattery.cpp b/src/solid/devices/backends/upower/upowerbattery.cpp
+index 22b25d9..055856b 100644
+--- a/src/solid/devices/backends/upower/upowerbattery.cpp
++++ b/src/solid/devices/backends/upower/upowerbattery.cpp
+@@ -84,7 +84,7 @@ int Battery::chargePercent() const
+
+ int Battery::capacity() const
+ {
+- return m_device.data()->prop("Capacity").toDouble();
++ return qRound(m_device.data()->prop("Capacity").toDouble());
+ }
+
+ bool Battery::isRechargeable() const
+--
+GitLab
+
diff --git a/kde-frameworks/solid/solid-5.90.0-r1.ebuild b/kde-frameworks/solid/solid-5.90.0-r1.ebuild
new file mode 100644
index 000000000000..4848819bb62a
--- /dev/null
+++ b/kde-frameworks/solid/solid-5.90.0-r1.ebuild
@@ -0,0 +1,55 @@
+# Copyright 1999-2022 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+QTMIN=5.15.2
+VIRTUALX_REQUIRED="test"
+inherit ecm kde.org optfeature
+
+DESCRIPTION="Provider for platform independent hardware discovery, abstraction and management"
+
+LICENSE="LGPL-2.1+"
+KEYWORDS="~amd64 ~arm ~arm64 ~ppc64 ~riscv ~x86"
+IUSE="ios nls"
+
+RDEPEND="
+ >=dev-qt/qtdbus-${QTMIN}:5
+ >=dev-qt/qtdeclarative-${QTMIN}:5
+ >=dev-qt/qtgui-${QTMIN}:5
+ >=dev-qt/qtxml-${QTMIN}:5
+ sys-apps/util-linux
+ sys-fs/udisks:2
+ virtual/libudev:=
+ ios? (
+ app-pda/libimobiledevice:=
+ app-pda/libplist:=
+ )
+"
+DEPEND="${RDEPEND}
+ test? ( >=dev-qt/qtconcurrent-${QTMIN}:5 )
+"
+BDEPEND="
+ sys-devel/bison
+ sys-devel/flex
+ nls? ( >=dev-qt/linguist-tools-${QTMIN}:5 )
+"
+
+PATCHES=(
+ "${FILESDIR}/${P}-properly-round-battery-capacity.patch" # KDE-bug 448372
+)
+
+src_configure() {
+ local mycmakeargs=(
+ $(cmake_use_find_package ios IMobileDevice)
+ $(cmake_use_find_package ios PList)
+ )
+ ecm_src_configure
+}
+
+pkg_postinst() {
+ if [[ -z "${REPLACING_VERSIONS}" ]]; then
+ optfeature "media player devices support" app-misc/media-player-info
+ fi
+ ecm_pkg_postinst
+}