backups: UI improvements

Prompt for retype the backup password, more thoroughly test if the user
entered all required informations, use "dom0" instead of "None" for local
backup indication.
This commit is contained in:
Marek Marczykowski-Górecki 2013-11-28 03:52:02 +01:00
parent ced6fc672b
commit 21d72cdc6c
4 changed files with 64 additions and 20 deletions

View File

@ -6,7 +6,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>700</width>
<width>650</width>
<height>399</height>
</rect>
</property>
@ -215,7 +215,10 @@
<item row="4" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Backup directory:</string>
<string>Backup directory or VM command:</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
@ -227,7 +230,14 @@
<property name="title">
<string>Backup security</string>
</property>
<layout class="QGridLayout" name="gridLayout_4">
<layout class="QFormLayout" name="formLayout">
<item row="2" column="0">
<widget class="QLabel" name="label_12">
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Encryption / Verification&lt;br/&gt;passphrase:&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label_10">
<property name="text">
@ -235,13 +245,6 @@
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_11">
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Encryption / Verification&lt;br/&gt;passphrase:&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QCheckBox" name="encryption_checkbox">
<property name="layoutDirection">
@ -255,13 +258,27 @@
</property>
</widget>
</item>
<item row="2" column="1" colspan="2">
<item row="5" column="0">
<widget class="QLabel" name="label_11">
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Reenter passphrase:&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLineEdit" name="passphrase_line_edit">
<property name="echoMode">
<enum>QLineEdit::Password</enum>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QLineEdit" name="passphrase_line_edit_verify">
<property name="echoMode">
<enum>QLineEdit::Password</enum>
</property>
</widget>
</item>
</layout>
</widget>
</item>
@ -317,7 +334,7 @@ p, li { white-space: pre-wrap; }
<widget class="QWizardPage" name="commit_page">
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<widget class="QLabel" name="label_8">
<widget class="QLabel" name="progress_status">
<property name="font">
<font>
<pointsize>9</pointsize>

View File

@ -93,13 +93,25 @@ class BackupVMsWindow(Ui_Backup, QWizard):
self.shutdown_running_vms_button.clicked.connect(self.shutdown_all_running_selected)
self.connect(self.dev_combobox, SIGNAL("activated(int)"), self.dev_combobox_activated)
self.connect(self, SIGNAL("backup_progress(int)"), self.progress_bar.setValue)
self.dir_line_edit.connect(self.dir_line_edit, SIGNAL("textChanged(QString)"), self.backup_location_changed)
self.select_vms_page.isComplete = self.has_selected_vms
self.select_dir_page.isComplete = self.has_selected_dir
self.select_dir_page.isComplete = self.has_selected_dir_and_pass
#FIXME
#this causes to run isComplete() twice, I don't know why
self.select_vms_page.connect(self.select_vms_widget, SIGNAL("selected_changed()"), SIGNAL("completeChanged()"))
self.select_vms_page.connect(
self.select_vms_widget,
SIGNAL("selected_changed()"),
SIGNAL("completeChanged()"))
self.passphrase_line_edit.connect(
self.passphrase_line_edit,
SIGNAL("textChanged(QString)"),
self.backup_location_changed)
self.passphrase_line_edit_verify.connect(
self.passphrase_line_edit_verify,
SIGNAL("textChanged(QString)"),
self.backup_location_changed)
self.total_size = 0
self.__fill_vms_list__()
fill_devs_list(self)
@ -354,10 +366,16 @@ class BackupVMsWindow(Ui_Backup, QWizard):
def has_selected_vms(self):
return self.select_vms_widget.selected_list.count() > 0
def has_selected_dir(self):
return self.backup_dir != None
def has_selected_dir_and_pass(self):
if not len(self.passphrase_line_edit.text()):
return False
if self.passphrase_line_edit.text() != self.passphrase_line_edit_verify.text():
return False
return self.backup_location != None
def backup_location_changed(self, new_dir = None):
self.backup_location = str(self.dir_line_edit.text())
self.select_dir_page.emit(SIGNAL("completeChanged()"))
# Bases on the original code by:

View File

@ -77,7 +77,7 @@ def umount_device(dev_mount_path):
def fill_appvms_list(dialog):
dialog.appvm_combobox.clear()
dialog.appvm_combobox.addItem("None")
dialog.appvm_combobox.addItem("dom0")
dialog.appvm_combobox.setCurrentIndex(0) #current selected is null ""

View File

@ -88,9 +88,10 @@ class RestoreVMsWindow(Ui_Restore, QWizard):
self.select_dir_page.isComplete = self.has_selected_dir
self.select_vms_page.isComplete = self.has_selected_vms
self.confirm_page.isComplete = self.all_vms_good
#FIXME
#this causes to run isComplete() twice, I don't know why
self.select_vms_page.connect(self.select_vms_widget, SIGNAL("selected_changed()"), SIGNAL("completeChanged()"))
self.select_vms_page.connect(self.select_vms_widget, SIGNAL("selected_changed()"), SIGNAL("completeChanged()"))
fill_devs_list(self)
fill_appvms_list(self)
@ -222,6 +223,7 @@ class RestoreVMsWindow(Ui_Restore, QWizard):
self.confirm_text_edit.setFontFamily("Monospace")
self.confirm_text_edit.setText("\n".join(self.func_output))
self.confirm_page.emit(SIGNAL("completeChanged()"))
elif self.currentPage() is self.commit_page:
self.button(self.CancelButton).setDisabled(True)
@ -243,6 +245,13 @@ class RestoreVMsWindow(Ui_Restore, QWizard):
umount_device(self.dev_mount_path)
self.button(self.FinishButton).setEnabled(True)
def all_vms_good(self):
for vminfo in self.vms_to_restore.values():
if not vminfo['good-to-go']:
print vminfo['vm'].name, str(vminfo)
return False
return True
def reject(self):
if self.dev_mount_path != None:
umount_device(self.dev_mount_path)