summaryrefslogtreecommitdiff
path: root/raveos-calamares/0003-restart-button.patch
blob: a06ea5224ec6d95888f0f564eec9550bc0aa0092 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
--- a/src/calamares/CalamaresWindow.cpp
+++ b/src/calamares/CalamaresWindow.cpp
@@ -35,6 +35,9 @@
 #include <QFile>
 #include <QFileInfo>
 #include <QLabel>
+#include <QMessageBox>
+#include <QProcess>
+#include <QPushButton>
 #ifdef WITH_QML
 #include <QQmlContext>
 #include <QQmlEngine>
@@ -216,6 +219,36 @@
 {
     QWidget* navigation = new QWidget( parent );
     QBoxLayout* bottomLayout = new QHBoxLayout;
+
+    // RaveOS: globalis ujrainditas gomb a bal also sarokban (minden oldalon lathato)
+    {
+        auto* restart = new QPushButton(
+            getButtonIcon( QStringLiteral( "view-refresh" ) ),
+            QCoreApplication::translate( CalamaresWindow::staticMetaObject.className(), "&Restart", "@button" ),
+            navigation );
+        restart->setObjectName( "restartButton" );
+        restart->setToolTip( QCoreApplication::translate( CalamaresWindow::staticMetaObject.className(),
+                                                          "Restart the computer",
+                                                          "@tooltip" ) );
+        QObject::connect( restart,
+                          &QPushButton::clicked,
+                          navigation,
+                          []()
+                          {
+                              if ( QMessageBox::question( nullptr,
+                                                          QStringLiteral( "RaveOS" ),
+                                                          QCoreApplication::translate( "calamares-sidebar",
+                                                                                       "Restart the computer?",
+                                                                                       "@info" ) )
+                                   == QMessageBox::Yes )
+                              {
+                                  QProcess::startDetached( QStringLiteral( "systemctl" ),
+                                                           { QStringLiteral( "-i" ), QStringLiteral( "reboot" ) } );
+                              }
+                          } );
+        bottomLayout->addWidget( restart );
+    }
+
     bottomLayout->addStretch();
 
     // Create buttons and sets an initial icon; the icons may change
@@ -272,7 +305,7 @@
         bottomLayout->addWidget( quit );
     }
 
-    bottomLayout->setContentsMargins( 0, 0, 6, 6 );
+    bottomLayout->setContentsMargins( 6, 0, 6, 6 );
     navigation->setLayout( bottomLayout );
     return navigation;
 }