Merge remote-tracking branch 'qubesos/pr/10'

* qubesos/pr/10:
  Require typing name of VM to remove

Fixes QubesOS/qubes-issues#1329
This commit is contained in:
Marek Marczykowski-Górecki 2016-11-22 11:53:18 +01:00
commit cf0fbcd908
No known key found for this signature in database
GPG Key ID: 063938BA42CFA724

View File

@ -1011,15 +1011,25 @@ class VmManagerWindow(Ui_VmManagerWindow, QMainWindow):
return return
reply = QMessageBox.question( (requested_name, ok) = QInputDialog.getText(
None, "VM Removal Confirmation", None, "VM Removal Confirmation",
"Are you sure you want to remove the VM <b>'{0}'</b>?<br>" "Are you sure you want to remove the VM <b>'{0}'</b>?<br>"
"<small>All data on this VM's private storage will be lost!</small>" "All data on this VM's private storage will be lost!<br><br>"
.format(vm.name), "Type the name of the VM (<b>{1}</b>) below to confirm:"
QMessageBox.Yes | QMessageBox.Cancel) .format(vm.name, vm.name))
if reply == QMessageBox.Yes: if not ok:
# user clicked cancel
return
elif requested_name != vm.name:
# name did not match
QMessageBox.warning(None, "VM removal confirmation failed",
"Entered name did not match! Not removing {0}.".format(vm.name))
return
else:
# remove the VM
thread_monitor = ThreadMonitor() thread_monitor = ThreadMonitor()
thread = threading.Thread(target=self.do_remove_vm, thread = threading.Thread(target=self.do_remove_vm,
args=(vm, thread_monitor)) args=(vm, thread_monitor))