Add option to turn off computer after backup to Backup GUI

A simple checkbox to turn off the computer after backup finishes
successfully. It is off by default and must be switched on every time
(unexpected system shutdowns are a huge pain, much more problematic
than forgetting to shut down can be).

fixes QubesOS/qubes-issues#2039
This commit is contained in:
Marta Marczykowska-Górecka 2018-07-12 22:47:02 +02:00
parent b0e275bb3e
commit 80b3a82963
No known key found for this signature in database
GPG Key ID: 9A752C30B26FD04B
2 changed files with 28 additions and 0 deletions

View File

@ -348,6 +348,12 @@ class BackupVMsWindow(ui_backupdlg.Ui_Backup, multiselectwidget.QtGui.QWizard):
self.button(self.FinishButton).setEnabled(True) self.button(self.FinishButton).setEnabled(True)
self.showFileDialog.setEnabled(False) self.showFileDialog.setEnabled(False)
self.cleanup_temporary_files() self.cleanup_temporary_files()
# turn off only when backup was successful
if self.thread_monitor.success and \
self.turn_off_checkbox.isChecked():
os.system('systemctl poweroff')
signal.signal(signal.SIGCHLD, old_sigchld_handler) signal.signal(signal.SIGCHLD, old_sigchld_handler)
def reject(self): def reject(self):

View File

@ -310,6 +310,28 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="4" column="0">
<widget class="QGroupBox" name="groupBox_4">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="title">
<string>Other</string>
</property>
<layout class="QGridLayout" name="gridLayout_4">
<item row="0" column="0">
<widget class="QCheckBox" name="turn_off_checkbox">
<property name="text">
<string>Turn computer off after backup is finished</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout> </layout>
</widget> </widget>
<widget class="QWizardPage" name="confirm_page"> <widget class="QWizardPage" name="confirm_page">