backups: open file selection dialog at the end for unmounting the disk (#831)

This commit is contained in:
Marek Marczykowski-Górecki 2014-05-15 03:06:51 +02:00
parent f096f0050a
commit c2038ec20b
4 changed files with 42 additions and 1 deletions

View File

@ -362,6 +362,13 @@ p, li { white-space: pre-wrap; }
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="showFileDialog">
<property name="text">
<string>When finished, open file selection dialog to allow me unmount the disk</string>
</property>
</widget>
</item>
</layout>
</widget>
</widget>

View File

@ -372,6 +372,11 @@ class BackupVMsWindow(Ui_Backup, QWizard):
elif self.currentPage() is self.commit_page:
self.button(self.FinishButton).setDisabled(True)
self.showFileDialog.setEnabled(
self.appvm_combobox.currentIndex() != 0)
self.showFileDialog.setChecked(self.showFileDialog.isEnabled()
and str(self.dir_line_edit.text())
.count("media/") > 0)
self.thread_monitor = ThreadMonitor()
thread = threading.Thread (target= self.__do_backup__ , args=(self.thread_monitor,))
thread.daemon = True
@ -409,8 +414,17 @@ class BackupVMsWindow(Ui_Backup, QWizard):
detach_device(self, str(self.dev_combobox.itemData(
self.dev_combobox.currentIndex()).toString()))
self.dev_mount_path = None
elif self.showFileDialog.isChecked():
orig_text = self.progress_status.text
self.progress_status.setText(
orig_text + " Please unmount your backup volume and cancel "
"the file selection dialog.")
if self.target_appvm:
self.target_appvm.run("QUBESRPC %s dom0" % "qubes"
".SelectDirectory")
self.button(self.CancelButton).setEnabled(False)
self.button(self.FinishButton).setEnabled(True)
self.showFileDialog.setEnabled(False)
signal.signal(signal.SIGCHLD, old_sigchld_handler)
def reject(self):

View File

@ -240,6 +240,11 @@ class RestoreVMsWindow(Ui_Restore, QWizard):
elif self.currentPage() is self.commit_page:
self.button(self.FinishButton).setDisabled(True)
self.showFileDialog.setEnabled(
self.appvm_combobox.currentIndex() != 0)
self.showFileDialog.setChecked(self.showFileDialog.isEnabled()
and str(self.dir_line_edit.text())
.count("media/") > 0)
self.thread_monitor = ThreadMonitor()
thread = threading.Thread (target= self.__do_restore__ , args=(self.thread_monitor,))
@ -274,10 +279,18 @@ class RestoreVMsWindow(Ui_Restore, QWizard):
self.dev_mount_path = None
detach_device(self, str(self.dev_combobox.itemData(
self.dev_combobox.currentIndex()).toString()))
elif self.showFileDialog.isChecked():
self.emit(SIGNAL("restore_progress(QString)"),
'<b><font color="black">{0}</font></b>'.format(
"Please unmount your backup volume and cancel "
"the file selection dialog."))
if self.target_appvm:
self.target_appvm.run("QUBESRPC %s dom0" % "qubes"
".SelectDirectory")
self.progress_bar.setValue(100)
self.button(self.FinishButton).setEnabled(True)
self.button(self.CancelButton).setEnabled(False)
self.showFileDialog.setEnabled(False)
signal.signal(signal.SIGCHLD, old_sigchld_handler)

View File

@ -288,6 +288,13 @@ p, li { white-space: pre-wrap; }
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="showFileDialog">
<property name="text">
<string>When finished, open file selection dialog to allow me unmount the disk</string>
</property>
</widget>
</item>
</layout>
</widget>
</widget>