From c2038ec20b22a016802d237238078888e180e5e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Date: Thu, 15 May 2014 03:06:51 +0200 Subject: [PATCH] backups: open file selection dialog at the end for unmounting the disk (#831) --- backupdlg.ui | 7 +++++++ qubesmanager/backup.py | 14 ++++++++++++++ qubesmanager/restore.py | 15 ++++++++++++++- restoredlg.ui | 7 +++++++ 4 files changed, 42 insertions(+), 1 deletion(-) diff --git a/backupdlg.ui b/backupdlg.ui index 77850ee..15e5c6f 100644 --- a/backupdlg.ui +++ b/backupdlg.ui @@ -362,6 +362,13 @@ p, li { white-space: pre-wrap; } + + + + When finished, open file selection dialog to allow me unmount the disk + + + diff --git a/qubesmanager/backup.py b/qubesmanager/backup.py index eb57ba0..3c41e34 100644 --- a/qubesmanager/backup.py +++ b/qubesmanager/backup.py @@ -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): diff --git a/qubesmanager/restore.py b/qubesmanager/restore.py index 3729a03..a34cf5c 100644 --- a/qubesmanager/restore.py +++ b/qubesmanager/restore.py @@ -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)"), + '{0}'.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) diff --git a/restoredlg.ui b/restoredlg.ui index 29ae20c..451cfcc 100644 --- a/restoredlg.ui +++ b/restoredlg.ui @@ -288,6 +288,13 @@ p, li { white-space: pre-wrap; } + + + + When finished, open file selection dialog to allow me unmount the disk + + +