Commit 4c28cc33 authored by Kai Uwe Broulik's avatar Kai Uwe Broulik 🍇

[Logout Screen] Show info that rebooting will enter firmware setup

When the flag to reboot into BIOS/UEFI setup is set, show a hint on the logout screen.
For simplicity and to avoid the layout from shifting, and since the user had to explicitly enable the flag
and probably know what they're doing, it is shown regardless of what action is highlighted.

Differential Revision: https://phabricator.kde.org/D19562
parent 0e4148bc
......@@ -30,6 +30,9 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include <QDBusConnection>
#include <QDBusMessage>
#include <QDBusPendingCall>
#include <QDBusPendingCallWatcher>
#include <QDBusPendingReply>
#include <QDBusVariant>
#include <QQuickView>
#include <QQmlContext>
#include <QQmlEngine>
......@@ -66,6 +69,12 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include <KWayland/Client/surface.h>
#include <KWayland/Client/plasmashell.h>
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 +127,22 @@ KSMShutdownDlg::KSMShutdownDlg(QWindow* parent,
context->setContextProperty(QStringLiteral("spdMethods"), mapSpdMethods);
context->setContextProperty(QStringLiteral("canLogout"), KAuthorized::authorize(QStringLiteral("logout")));
// Trying to access a non-existant context property throws an error, always create the property and then update it later
context->setContextProperty("rebootToFirmwareSetup", false);
QDBusMessage message = QDBusMessage::createMethodCall(s_login1Service, s_login1Path, s_dbusPropertiesInterface, QStringLiteral("Get"));
message.setArguments({s_login1ManagerInterface, s_login1RebootToFirmwareSetup});
QDBusPendingReply<QVariant> call = QDBusConnection::systemBus().asyncCall(message);
QDBusPendingCallWatcher *callWatcher = new QDBusPendingCallWatcher(call, this);
connect(callWatcher, &QDBusPendingCallWatcher::finished, context, [context](QDBusPendingCallWatcher *watcher) {
QDBusPendingReply<QVariant> reply = *watcher;
watcher->deleteLater();
if (reply.value().toBool()) {
context->setContextProperty("rebootToFirmwareSetup", true);
}
});
// TODO KF6 remove, used to read "BootManager" from kdmrc
context->setContextProperty(QStringLiteral("bootManager"), QStringLiteral("None"));
......
......@@ -155,6 +155,18 @@ PlasmaCore.ColorScope {
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 restarted, the computer will enter the firmware setup screen.")
visible: rebootToFirmwareSetup
}
RowLayout {
spacing: units.largeSpacing * 2
Layout.alignment: Qt.AlignHCenter
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment