Add warning if trying to change template VM

This commit is contained in:
donoban 2021-02-03 00:05:37 +01:00
parent 37513dec7e
commit 1edc4effd8
No known key found for this signature in database
GPG Key ID: 141310D8E3ED08A5

View File

@ -432,6 +432,7 @@ class VMSettingsWindow(ui_settingsdlg.Ui_SettingsDialog, QtWidgets.QDialog):
self.netVM.setCurrentIndex(-1)
self.netVM.currentIndexChanged.connect(self.check_warn_dispvmnetvm)
self.netVM.currentIndexChanged.connect(self.check_warn_templatenetvm)
try:
self.include_in_backups.setChecked(self.vm.include_in_backups)
@ -625,6 +626,16 @@ class VMSettingsWindow(ui_settingsdlg.Ui_SettingsDialog, QtWidgets.QDialog):
self.init_mem.value() * 10 < self.max_mem_size.value():
self.warn_too_much_mem_label.setVisible(True)
def check_warn_templatenetvm(self):
if self.vm.klass == 'TemplateVM':
QtWidgets.QMessageBox.warning(
self,
self.tr("Warning!"),
self.tr("Connecting a TemplateVM directly to a network is higly "
"discouraged! <br> <small>You are breaking a basic part"
" of Qubes security and there is probably no real need "
"to do so. Continue at your own risk.</small>"))
def check_warn_dispvmnetvm(self):
if not hasattr(self.vm, 'default_dispvm'):
self.warn_netvm_dispvm.setVisible(False)