diff --git a/logout-greeter/shutdowndlg.cpp b/logout-greeter/shutdowndlg.cpp --- a/logout-greeter/shutdowndlg.cpp +++ b/logout-greeter/shutdowndlg.cpp @@ -30,6 +30,7 @@ #include #include #include +#include #include #include #include @@ -66,6 +67,12 @@ #include #include +static const QString s_login1Service = QStringLiteral("org.freedesktop.login1"); +static const QString s_login1Path = QStringLiteral("/org/freedesktop/login1"); +static const QString s_dbusPropertiesInterface = QStringLiteral("org.freedesktop.DBus.Properties"); +static const QString s_login1ManagerInterface = QStringLiteral("org.freedesktop.login1.Manager"); +static const QString s_login1RebootToFirmwareSetup = QStringLiteral("RebootToFirmwareSetup"); + Q_DECLARE_METATYPE(Solid::PowerManagement::SleepState) KSMShutdownDlg::KSMShutdownDlg(QWindow* parent, @@ -118,6 +125,18 @@ context->setContextProperty(QStringLiteral("spdMethods"), mapSpdMethods); context->setContextProperty(QStringLiteral("canLogout"), KAuthorized::authorize(QStringLiteral("logout"))); + bool rebootToFirmwareSetup = false; + QDBusMessage message = QDBusMessage::createMethodCall(s_login1Service, s_login1Path, s_dbusPropertiesInterface, QStringLiteral("Get")); + message.setArguments({s_login1ManagerInterface, s_login1RebootToFirmwareSetup}); + QDBusMessage reply = QDBusConnection::systemBus().call(message); + if (reply.type() == QDBusMessage::ReplyMessage && reply.arguments().count() == 1) { + const QVariant propertyVariant = reply.arguments().constFirst().value().variant(); + if (propertyVariant.type() == QVariant::Bool) { + rebootToFirmwareSetup = propertyVariant.toBool(); + } + } + context->setContextProperty("rebootToFirmwareSetup", rebootToFirmwareSetup); + // TODO KF6 remove, used to read "BootManager" from kdmrc context->setContextProperty(QStringLiteral("bootManager"), QStringLiteral("None")); diff --git a/lookandfeel/contents/logout/Logout.qml b/lookandfeel/contents/logout/Logout.qml --- a/lookandfeel/contents/logout/Logout.qml +++ b/lookandfeel/contents/logout/Logout.qml @@ -155,6 +155,18 @@ visible: sessionsModel.count > 1 } + PlasmaComponents.Label { + font.pointSize: theme.defaultFont.pointSize + 1 + Layout.maximumWidth: units.gridUnit * 16 + Layout.alignment: Qt.AlignHCenter + Layout.fillWidth: true + horizontalAlignment: Text.AlignHCenter + wrapMode: Text.WordWrap + font.italic: true + text: i18nd("plasma_lookandfeel_org.kde.lookandfeel", "When rebooted, the system will enter the firmware setup screen.") + visible: rebootToFirmwareSetup + } + RowLayout { spacing: units.largeSpacing * 2 Layout.alignment: Qt.AlignHCenter