Verified Commit ac4f9bdc authored by Fushan Wen's avatar Fushan Wen 💬
Browse files

kcm: provide restart button in InlineMessage after Global scale is changed on X11

This slightly improves the usability.
parent 2a5bdbba
Pipeline #190445 passed with stage
in 2 minutes and 7 seconds
......@@ -26,6 +26,7 @@ add_library(kcm_kscreen MODULE ${kcm_kscreen_SRCS})
kconfig_add_kcfg_files(kcm_kscreen GENERATE_MOC globalscalesettings.kcfgc)
target_link_libraries(kcm_kscreen
Qt::DBus
Qt::Sensors
KF5::ConfigGui
KF5::CoreAddons
......
......@@ -25,6 +25,9 @@
#include <KPluginFactory>
#include <KSharedConfig>
#include <QDBusConnection>
#include <QDBusMessage>
#include <QDBusPendingReply>
#include <QTimer>
K_PLUGIN_FACTORY_WITH_JSON(KCMDisplayConfigurationFactory, "kcm_kscreen.json", registerPlugin<KCMKScreen>();)
......@@ -104,6 +107,15 @@ void KCMKScreen::revertSettings()
}
}
void KCMKScreen::requestReboot()
{
QDBusMessage msg = QDBusMessage::createMethodCall(QStringLiteral("org.kde.LogoutPrompt"),
QStringLiteral("/LogoutPrompt"),
QStringLiteral("org.kde.LogoutPrompt"),
QStringLiteral("promptReboot"));
QDBusConnection::sessionBus().asyncCall(msg);
}
void KCMKScreen::setStopUpdatesFromBackend(bool value)
{
m_stopUpdatesFromBackend = value;
......
......@@ -69,6 +69,7 @@ public:
Q_INVOKABLE void forceSave();
void doSave(bool force);
Q_INVOKABLE void revertSettings();
Q_INVOKABLE void requestReboot();
Q_INVOKABLE void setStopUpdatesFromBackend(bool value);
Q_INVOKABLE void updateFromBackend();
......
......@@ -68,6 +68,13 @@ KCM.SimpleKCM {
text: i18n("New global scale applied. Change will come into effect after restart.")
visible: false
showCloseButton: true
actions: [
Kirigami.Action {
icon.name: "system-reboot"
text: i18n("Restart")
onTriggered: kcm.requestReboot();
}
]
}
Kirigami.InlineMessage {
id: connectMsg
......
Supports Markdown
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