Commit b7ebd04e authored by Aleix Pol Gonzalez's avatar Aleix Pol Gonzalez 🐧

Improve the updates page

Improves the message and adds a reboot button.

BUG: 404340
parent 0ef13233
......@@ -40,6 +40,9 @@
#include <QTimer>
#include <QSessionManager>
#include <QClipboard>
#include <QDBusConnection>
#include <QDBusInterface>
#include <QDBusPendingCall>
// KDE includes
#include <KAboutApplicationDialog>
......@@ -487,5 +490,10 @@ void DiscoverObject::copyTextToClipboard(const QString& text)
qGuiApp->clipboard()->setText(text);
}
void DiscoverObject::reboot()
{
QDBusInterface interface(QStringLiteral("org.kde.ksmserver"), QStringLiteral("/KSMServer"), QStringLiteral("org.kde.KSMServerInterface"), QDBusConnection::sessionBus());
interface.asyncCall(QStringLiteral("logout"), 0, 1, 2); // Options: do not ask again | reboot | force
}
#include "DiscoverObject.moc"
......@@ -69,6 +69,8 @@ class DiscoverObject : public QObject
void copyTextToClipboard(const QString &text);
void reboot();
private Q_SLOTS:
void reportBug();
void switchApplicationLanguage();
......
......@@ -159,6 +159,12 @@ DiscoverPage
width: Kirigami.Units.gridUnit * 12
height: width
}
Button {
Layout.alignment: Qt.AlignHCenter
text: i18n("Restart")
visible: resourcesUpdatesModel.needsReboot
onClicked: app.reboot()
}
Item {
visible: page.footerLabel === ""
height: Kirigami.Units.gridUnit
......@@ -332,7 +338,7 @@ DiscoverPage
},
State {
name: "reboot"
PropertyChanges { target: page; footerLabel: i18nc("@info", "The system requires a restart") }
PropertyChanges { target: page; footerLabel: i18nc("@info", "The system requires a restart to apply updates") }
},
State {
name: "now-uptodate"
......
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