From 6f822a30bb1b8a6672464d0a1e998160728ff09a Mon Sep 17 00:00:00 2001 From: Ivailo Monev Date: Sun, 3 Sep 2023 00:16:00 +0300 Subject: [PATCH] solid: implicitly convert the D-Bus reply to the value type in Solid::PowerManagement::beginSuppressingSleep() and Solid::PowerManagement::stopSuppressingSleep() Signed-off-by: Ivailo Monev --- solid/solid/button.h | 2 +- solid/solid/powermanagement.cpp | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/solid/solid/button.h b/solid/solid/button.h index 3270827e..ef977a87 100644 --- a/solid/solid/button.h +++ b/solid/solid/button.h @@ -56,7 +56,7 @@ namespace Solid * - LidButton : The switch on a laptop that senses whether the lid is open or closed. * - PowerButton : The main power button on the computer. * - SleepButton : The sleep button on a computer capable of putting the computer into a suspend state. - * - TabletButton : The tablet switch on a laptop that senses if the monitor is rotated or not. + * - TabletButton : The tablet switch on a laptop that senses if the monitor is rotated or not. * - UnknownButtonType : The type of the button is unknow. */ enum ButtonType{ LidButton, PowerButton, SleepButton, UnknownButtonType, TabletButton }; diff --git a/solid/solid/powermanagement.cpp b/solid/solid/powermanagement.cpp index 491b718f..48540fd6 100644 --- a/solid/solid/powermanagement.cpp +++ b/solid/solid/powermanagement.cpp @@ -116,8 +116,9 @@ void Solid::PowerManagement::requestSleep(SleepState state) uint Solid::PowerManagement::beginSuppressingSleep(const QString &reason) { QDBusReply reply = globalPowerManager()->inhibitIface.call("Inhibit", QCoreApplication::applicationName(), reason); - if (reply.isValid()) - return reply; + if (reply.isValid()) { + return reply.value(); + } return 0; } @@ -145,7 +146,7 @@ uint Solid::PowerManagement::beginSuppressingScreenPowerManagement(const QString globalPowerManager()->screensaverCookies.append(ssReply.value()); } - return ssReply; + return ssReply.value(); } // No way to fallback on something, hence return failure (0 is invalid cookie) return 0;