solid: implicitly convert the D-Bus reply to the value type in Solid::PowerManagement::beginSuppressingSleep() and Solid::PowerManagement::stopSuppressingSleep()

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
Ivailo Monev 2023-09-03 00:16:00 +03:00
parent b75a45c5d6
commit 6f822a30bb
2 changed files with 5 additions and 4 deletions

View file

@ -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 };

View file

@ -116,8 +116,9 @@ void Solid::PowerManagement::requestSleep(SleepState state)
uint Solid::PowerManagement::beginSuppressingSleep(const QString &reason)
{
QDBusReply<uint> 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;