Replaced single check vm updates checkbox

Now there is a checkbox for the default for new VMs, and two
buttons to either disable checking for updates in all VMs or enable it
in all VMs.
This commit is contained in:
Marta Marczykowska-Górecka 2018-01-26 22:36:54 +01:00
parent 02117b1870
commit b08ce9524f
No known key found for this signature in database
GPG Key ID: 9A752C30B26FD04B
2 changed files with 46 additions and 12 deletions

View File

@ -212,12 +212,35 @@ class GlobalSettingsWindow(ui_globalsettingsdlg.Ui_GlobalSettings,
self.updates_dom0.setChecked(self.updates_dom0_val)
self.updates_val = False
updates_vms = updates_vms_status(self.qvm_collection)
if updates_vms is None:
self.updates_vm.setCheckState(QtCore.Qt.PartiallyChecked)
else:
self.updates_vm.setCheckState(updates_vms)
self.updates_vm.setChecked(self.qvm_collection.check_updates_vm)
self.enable_updates_all.clicked.connect(self.__enable_updates_all)
self.disable_updates_all.clicked.connect(self.__disable_updates_all)
def __enable_updates_all(self):
reply = QtGui.QMessageBox.question(
self, self.tr("Change state of all qubes"),
self.tr("Are you sure you want to set all qubes to check "
"for updates?"),
QtGui.QMessageBox.Yes | QtGui.QMessageBox.Cancel)
if reply == QtGui.QMessageBox.Cancel:
return
self.__set_updates_all(True)
def __disable_updates_all(self):
reply = QtGui.QMessageBox.question(
self, self.tr("Change state of all qubes"),
self.tr("Are you sure you want to set all qubes to not check "
"for updates?"),
QtGui.QMessageBox.Yes | QtGui.QMessageBox.Cancel)
if reply == QtGui.QMessageBox.Cancel:
return
self.__set_updates_all(False)
def __set_updates_all(self, state):
for vm in self.qvm_collection.domains:
vm.features['check-updates'] = state
def __apply_updates__(self):
if self.updates_dom0.isChecked() != self.updates_dom0_val:
@ -231,10 +254,7 @@ class GlobalSettingsWindow(ui_globalsettingsdlg.Ui_GlobalSettings,
else:
open(self.dom0_updates_file_path, 'a').close()
if self.updates_vm.checkState() != QtCore.Qt.PartiallyChecked:
for vm in self.qvm_collection.domains:
vm.features['check-updates'] = \
bool(self.updates_vm.checkState())
self.qvm_collection.check_updates_vm = self.updates_vm.isChecked()
def reject(self):
self.done(0)

View File

@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>678</width>
<height>331</height>
<width>651</width>
<height>386</height>
</rect>
</property>
<property name="windowTitle">
@ -195,6 +195,13 @@
<string>Updates</string>
</property>
<layout class="QGridLayout" name="gridLayout_3">
<item row="1" column="1">
<widget class="QPushButton" name="disable_updates_all">
<property name="text">
<string>Disable checking for updates for all VMs</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QCheckBox" name="updates_dom0">
<property name="text">
@ -215,6 +222,13 @@
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QPushButton" name="enable_updates_all">
<property name="text">
<string>Enable checking for updates for all VMs</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>