diff --git a/qubesmanager/settings.py b/qubesmanager/settings.py index 73bf647..a1221f2 100644 --- a/qubesmanager/settings.py +++ b/qubesmanager/settings.py @@ -209,8 +209,6 @@ class VMSettingsWindow(ui_settingsdlg.Ui_SettingsDialog, QtWidgets.QDialog): ####### services tab self.__init_services_tab__() - self.service_line_edit.lineEdit().returnPressed.connect( - self.__add_service__) self.add_srv_button.clicked.connect(self.__add_service__) self.remove_srv_button.clicked.connect(self.__remove_service__) @@ -397,12 +395,6 @@ class VMSettingsWindow(ui_settingsdlg.Ui_SettingsDialog, QtWidgets.QDialog): self.include_in_backups.setChecked(self.vm.include_in_backups) - try: - self.run_in_debug_mode.setChecked(self.vm.debug) - self.run_in_debug_mode.setVisible(True) - except AttributeError: - self.run_in_debug_mode.setVisible(False) - try: self.autostart_vm.setChecked(self.vm.autostart) self.autostart_vm.setVisible(True) @@ -479,14 +471,6 @@ class VMSettingsWindow(ui_settingsdlg.Ui_SettingsDialog, QtWidgets.QDialog): except qubesadmin.exc.QubesException as ex: msg.append(str(ex)) - # run_in_debug_mode - try: - if self.run_in_debug_mode.isVisible(): - if self.vm.debug != self.run_in_debug_mode.isChecked(): - self.vm.debug = self.run_in_debug_mode.isChecked() - except qubesadmin.exc.QubesException as ex: - msg.append(str(ex)) - # autostart_vm try: if self.autostart_vm.isVisible(): @@ -734,6 +718,12 @@ class VMSettingsWindow(ui_settingsdlg.Ui_SettingsDialog, QtWidgets.QDialog): "NetVM by the following qubes:\n") + "\n".join(domains_using)) + try: + self.run_in_debug_mode.setChecked(self.vm.debug) + self.run_in_debug_mode.setVisible(True) + except AttributeError: + self.run_in_debug_mode.setVisible(False) + def enable_seamless(self): self.vm.run_service_for_stdio("qubes.SetGuiMode", input=b'SEAMLESS') @@ -812,6 +802,14 @@ class VMSettingsWindow(ui_settingsdlg.Ui_SettingsDialog, QtWidgets.QDialog): except Exception as ex: # pylint: disable=broad-except msg.append(str(ex)) + # run_in_debug_mode + try: + if self.run_in_debug_mode.isVisible(): + if self.vm.debug != self.run_in_debug_mode.isChecked(): + self.vm.debug = self.run_in_debug_mode.isChecked() + except qubesadmin.exc.QubesException as ex: + msg.append(str(ex)) + return msg def include_in_balancing_changed(self, state): @@ -1074,35 +1072,49 @@ class VMSettingsWindow(ui_settingsdlg.Ui_SettingsDialog, QtWidgets.QDialog): self.services_list.addItem(item) self.new_srv_dict[service] = self.vm.features[feature] - # add suggested services - self.service_line_edit.addItem('clocksync') - self.service_line_edit.addItem('crond') - self.service_line_edit.addItem('cups') - self.service_line_edit.addItem('disable-default-route') - self.service_line_edit.addItem('disable-dns-server') - self.service_line_edit.addItem('network-manager') - self.service_line_edit.addItem('qubes-firewall') - self.service_line_edit.addItem('qubes-network') - self.service_line_edit.addItem('qubes-update-check') - self.service_line_edit.addItem('qubes-updates-proxy') - self.service_line_edit.addItem('qubes-yum-proxy') - self.service_line_edit.addItem('updates-proxy-setup') - self.service_line_edit.addItem('yum-proxy-setup') + self.service_line_edit.addItem("") + + supported_services = set() + service_prefix = "supported-service." + + for feature in self.vm.features: + if feature.startswith(service_prefix): + supported_services.add(feature[len(service_prefix):]) + if getattr(self.vm, "template", None): + for feature in self.vm.template.features: + if feature.startswith(service_prefix): + supported_services.add(feature[len(service_prefix):]) + + for service in sorted(supported_services): + self.service_line_edit.addItem(service) + + self.service_line_edit.addItem(self.tr('(custom...)')) self.service_line_edit.setEditText("") def __add_service__(self): srv = str(self.service_line_edit.currentText()).strip() + if srv != "": + if self.service_line_edit.currentIndex() == \ + len(self.service_line_edit) - 1: + (custom_name, ok) = QtWidgets.QInputDialog.getText( + self, self.tr("Custom service name"), + self.tr( + "Name of the service:")) + if ok: + srv = custom_name.strip() + else: + return if srv in self.new_srv_dict: QtWidgets.QMessageBox.information( self, '', self.tr('Service already on the list!')) - else: - item = QtWidgets.QListWidgetItem(srv) - item.setCheckState(ui_settingsdlg.QtCore.Qt.Checked) - self.services_list.addItem(item) - self.new_srv_dict[srv] = True + return + item = QtWidgets.QListWidgetItem(srv) + item.setCheckState(ui_settingsdlg.QtCore.Qt.Checked) + self.services_list.addItem(item) + self.new_srv_dict[srv] = True def __remove_service__(self): item = self.services_list.currentItem() diff --git a/ui/settingsdlg.ui b/ui/settingsdlg.ui index e5f7563..bb29417 100644 --- a/ui/settingsdlg.ui +++ b/ui/settingsdlg.ui @@ -29,7 +29,7 @@ - 1 + 5 @@ -373,13 +373,6 @@ - - - - Run in debug mode - - - @@ -813,14 +806,14 @@ border-width: 1px; 15 - + Provides network - + <html><head/><body><p>Allows using this qube as a template for DisposableVMs. The DisposableVMs will inherit the VM's state (configuration, installed programs etc.), but their state will not persist between restarts. </p><p>Setting this option will cause this qube to be listed as an option in the &quot;Default DisposableVM Template&quot; dropdown for all other qubes. </p></body></html> @@ -830,14 +823,14 @@ border-width: 1px; - + Boot qube from CDROM - + @@ -863,7 +856,7 @@ The qube must be running to disable seamless mode; this setting is not persisten - + @@ -893,6 +886,13 @@ The qube must be running to disable seamless mode; this setting is not persisten + + + + Run in debug mode + + + @@ -1322,7 +1322,7 @@ The qube must be running to disable seamless mode; this setting is not persisten This qube has direct network access and Qubes Firewall settings will not be used. Configure other qubes' network access in their network settings or in a dedicated firewall qube. - true + true @@ -1433,47 +1433,85 @@ The qube must be running to disable seamless mode; this setting is not persisten Services - - - - Qt::Vertical + + + + + 0 + 0 + - - - 20 - 40 - - - + - - - - + Checked services will be turned on. - - - - Unchecked services will be turned off. - - - - + Unlisted services will follow default settings. - + + + + Unchecked services will be turned off. + + + + + + + + + Select a service: + + + + + + + + 0 + 0 + + + + Services listed here are explicitly supported by the qube. Additional services may be added with the '+' button on the right. + + + + + + + + + + Add + + + + :/add.png:/add.png + + + + 24 + 24 + + + + + + + - + Remove service @@ -1487,32 +1525,18 @@ The qube must be running to disable seamless mode; this setting is not persisten - - - - Services listed here are only base Qubes services - other services may be installed and implemented. + + + + Qt::Vertical - - true - - - - - - - - - - - :/add.png:/add.png - - + - 24 - 24 + 20 + 40 - + @@ -1540,7 +1564,6 @@ The qube must be running to disable seamless mode; this setting is not persisten template_name netVM include_in_backups - run_in_debug_mode autostart_vm max_priv_storage root_resize @@ -1550,6 +1573,7 @@ The qube must be running to disable seamless mode; this setting is not persisten max_mem_size vcpus include_in_balancing + run_in_debug_mode provides_network_checkbox dvm_template_checkbox default_dispvm