Skip to content

Commit

Permalink
Add option to turn off computer after backup to Backup GUI
Browse files Browse the repository at this point in the history
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
  • Loading branch information
marmarta committed Jul 12, 2018
1 parent b0e275b commit 80b3a82
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
6 changes: 6 additions & 0 deletions qubesmanager/backup.py
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,12 @@ def current_page_changed(self, page_id): # pylint: disable=unused-argument
self.button(self.FinishButton).setEnabled(True)
self.showFileDialog.setEnabled(False)
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)

def reject(self):
Expand Down
22 changes: 22 additions & 0 deletions ui/backupdlg.ui
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,28 @@
</property>
</widget>
</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>
</widget>
<widget class="QWizardPage" name="confirm_page">
Expand Down

0 comments on commit 80b3a82

Please sign in to comment.