Explorar o código

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

Marek Marczykowski-Górecki %!s(int64=10) %!d(string=hai) anos
pai
achega
c2038ec20b
Modificáronse 4 ficheiros con 42 adicións e 1 borrados
  1. 7 0
      backupdlg.ui
  2. 14 0
      qubesmanager/backup.py
  3. 14 1
      qubesmanager/restore.py
  4. 7 0
      restoredlg.ui

+ 7 - 0
backupdlg.ui

@@ -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>

+ 14 - 0
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):

+ 14 - 1
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)"),
+                          '<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)
 

+ 7 - 0
restoredlg.ui

@@ -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>