diff --git a/qubesmanager/settings.py b/qubesmanager/settings.py index 0340f44..a1dc52b 100644 --- a/qubesmanager/settings.py +++ b/qubesmanager/settings.py @@ -437,6 +437,31 @@ class VMSettingsWindow(ui_settingsdlg.Ui_SettingsDialog, QtWidgets.QDialog): except qubesadmin.exc.QubesDaemonAccessError: self.include_in_backups.setEnabled(False) + try: + has_shutdown_idle = self.vm.features.get( + "supported-service.shutdown-idle", False) + if has_shutdown_idle: + self.idle_shutdown_checkbox.setChecked(self.vm.features.get( + "shutdown-idle", False)) + else: + text = "Shut down when idle " + if getattr(self.vm, 'template', None): + additional_text = "(unavailable: package " \ + "qubes-app-shutdown-idle missing " \ + "in the template)" + else: + additional_text = "(unavailable: package " \ + "qubes-app-shutdown-idle missing " \ + "in the qube)" + self.idle_shutdown_checkbox.setText( + text + additional_text) + self.idle_shutdown_checkbox.setEnabled(False) + except qubesadmin.exc.QubesDaemonCommunicationError: + self.idle_shutdown_checkbox.setText( + self.idle_shutdown_checkbox.text() + + " (unavailable: permission denied)") + self.idle_shutdown_checkbox.setEnabled(False) + try: self.autostart_vm.setChecked(self.vm.autostart) self.autostart_vm.setVisible(True) @@ -538,6 +563,16 @@ class VMSettingsWindow(ui_settingsdlg.Ui_SettingsDialog, QtWidgets.QDialog): except qubesadmin.exc.QubesException as ex: msg.append(str(ex)) + # shutdown-idle + try: + current_idle = self.vm.features.get("shutdown-idle", False) + if self.idle_shutdown_checkbox.isEnabled() and \ + self.idle_shutdown_checkbox.isChecked() != current_idle: + self.vm.features["shutdown-idle"] = \ + self.idle_shutdown_checkbox.isChecked() + except qubesadmin.exc.QubesException as ex: + msg.append(str(ex)) + # max priv storage if self.max_priv_storage.isEnabled(): priv_size = self.max_priv_storage.value() diff --git a/test-packages/qubesadmin/exc.py b/test-packages/qubesadmin/exc.py index 7e40d7a..2f79e31 100644 --- a/test-packages/qubesadmin/exc.py +++ b/test-packages/qubesadmin/exc.py @@ -5,24 +5,34 @@ class QubesException(BaseException): pass + class QubesVMNotStartedError(BaseException): pass + class QubesPropertyAccessError(BaseException): pass + class QubesDaemonAccessError(BaseException): pass + class QubesNoSuchPropertyError(BaseException): pass + class QubesDaemonNoResponseError(BaseException): pass + class BackupCancelledError(BaseException): pass class BackupAlreadyRunningError(BaseException): pass + + +class QubesDaemonCommunicationError(BaseException): + pass diff --git a/ui/settingsdlg.ui b/ui/settingsdlg.ui index 778e791..655c8c7 100644 --- a/ui/settingsdlg.ui +++ b/ui/settingsdlg.ui @@ -29,7 +29,7 @@ - 1 + 0 @@ -128,6 +128,16 @@ + + + + true + + + System storage max. size: + + + @@ -163,16 +173,6 @@ - - - - true - - - System storage max. size: - - - @@ -285,6 +285,26 @@ + + + + background-color: qlineargradient(spread:pad, x1:1, y1:1, x2:1, y2:0, stop:0 rgba(255, 179, 179, 255), stop:1 rgba(255, 108, 108, 255)); +border-color: rgb(170, 0, 0); +border-style: solid; +border-width: 1px; + + + Delete qube + + + + + + + Clone qube + + + @@ -294,16 +314,27 @@ 15 - - - - <html><head/><body><p>Name &amp;&amp; label<span style=" color:#ff0000;">*</span>:</p></body></html> - - - vmname + + + + true + + + + + + + + + Start qube automatically on boot + + + + + @@ -314,20 +345,39 @@ - - - - Networking: + + + + <html><head/><body><p>Some applications enabled in the Applications tab cannot be found in the current template. The most likely cause is a template change - to restore them, install them in the template.</p></body></html> - - netVM + + + + + :/warning.png - - - - true + + + + <html><head/><body><p>Name &amp;&amp; label<span style=" color:#ff0000;">*</span>:</p></body></html> + + + vmname + + + + + + + <html><head/><body><p><span style=" font-weight:600;">Caution:</span> The Default DisposableVM Template (see the Advanced tab) has a different Networking setting than this qube. This configuration may result in unexpected network access. For example, you may have set this qube's Networking to &quot;none&quot; in order to prevent any data from being transmitted out. However, if the Default DisposableVM Template's Networking is set to &quot;sys-firewall,&quot; then a DisposableVM started from this qube may be able to transmit data out, contrary to your intention. You may wish to set the Default DisposableVM Template for this qube to one with equally restrictive Networking settings.</p></body></html> + + + + + + :/warning.png @@ -348,9 +398,6 @@ - - - @@ -358,7 +405,7 @@ - + @@ -375,66 +422,26 @@ - - - - - - Start qube automatically on boot - - - - - - - - - <html><head/><body><p><span style=" font-weight:600;">Caution:</span> The Default DisposableVM Template (see the Advanced tab) has a different Networking setting than this qube. This configuration may result in unexpected network access. For example, you may have set this qube's Networking to &quot;none&quot; in order to prevent any data from being transmitted out. However, if the Default DisposableVM Template's Networking is set to &quot;sys-firewall,&quot; then a DisposableVM started from this qube may be able to transmit data out, contrary to your intention. You may wish to set the Default DisposableVM Template for this qube to one with equally restrictive Networking settings.</p></body></html> - + + - + Networking: - - :/warning.png + + netVM - - - - <html><head/><body><p>Some applications enabled in the Applications tab cannot be found in the current template. The most likely cause is a template change - to restore them, install them in the template.</p></body></html> - + + - - - - :/warning.png + Shut down when idle for more than 15 minutes - - - - background-color: qlineargradient(spread:pad, x1:1, y1:1, x2:1, y2:0, stop:0 rgba(255, 179, 179, 255), stop:1 rgba(255, 108, 108, 255)); -border-color: rgb(170, 0, 0); -border-style: solid; -border-width: 1px; - - - Delete qube - - - - - - - Clone qube - - -