Added GUI daemon options to global settings

fixes QubesOS/qubes-issues#2304
This commit is contained in:
Marta Marczykowska-Górecka 2020-07-07 21:56:37 +02:00
parent a41908f92f
commit 31eb6f9df7
No known key found for this signature in database
GPG Key ID: 9A752C30B26FD04B
2 changed files with 301 additions and 122 deletions

View File

@ -71,6 +71,7 @@ class GlobalSettingsWindow(ui_globalsettingsdlg.Ui_GlobalSettings,
self.app = app
self.qvm_collection = qvm_collection
self.vm = self.qvm_collection.domains[self.qvm_collection.local_name]
self.setupUi(self)
@ -81,6 +82,7 @@ class GlobalSettingsWindow(ui_globalsettingsdlg.Ui_GlobalSettings,
self.__init_kernel_defaults__()
self.__init_mem_defaults__()
self.__init_updates__()
self.__init_gui_defaults()
def setup_application(self):
self.app.setApplicationName(self.tr("Qubes Global Settings"))
@ -180,6 +182,94 @@ class GlobalSettingsWindow(ui_globalsettingsdlg.Ui_GlobalSettings,
self.qvm_collection.default_kernel = \
self.kernels_list[self.default_kernel_combo.currentIndex()]
def __init_gui_defaults(self):
utils.prepare_choice_data(
widget=self.allow_fullscreen,
choices=[
('default (disallow)', None),
('allow', True),
('disallow', False)
],
selected_value=utils.get_boolean_feature(
self.vm,
'gui-default-allow-fullscreen'))
self.allow_fullscreen_initial = self.allow_fullscreen.currentIndex()
utils.prepare_choice_data(
widget=self.allow_utf8,
choices=[
('default (disallow)', None),
('allow', True),
('disallow', False)
],
selected_value=utils.get_boolean_feature(
self.vm,
'gui-default-allow-utf8-titles'))
self.allow_utf8_initial = self.allow_utf8.currentIndex()
utils.prepare_choice_data(
widget=self.trayicon,
choices=[
('default (thin border)', None),
('full background', 'bg'),
('thin border', 'border1'),
('thick border', 'border2'),
('tinted icon', 'tint'),
('tinted icon with modified white', 'tint+whitehack'),
('tinted icon with 50% saturation', 'tint+saturation50')
],
selected_value=self.vm.features.get('gui-default-trayicon-mode',
None))
self.trayicon_initial = self.trayicon.currentIndex()
utils.prepare_choice_data(
widget=self.securecopy,
choices=[
('default (Ctrl+Shift+C)', None),
('Ctrl+Shift+C', 'Ctrl-Shift-c'),
('Ctrl+Win+C', 'Ctrl-Mod4-c'),
],
selected_value=self.vm.features.get(
'gui-default-secure-copy-sequence', None))
self.securecopy_initial = self.securecopy.currentIndex()
utils.prepare_choice_data(
widget=self.securepaste,
choices=[
('default (Ctrl+Shift+V)', None),
('Ctrl+Shift+V', 'Ctrl-Shift-V'),
('Ctrl+Win+V', 'Ctrl-Mod4-v'),
('Ctrl+Insert', 'Ctrl-Ins'),
],
selected_value=self.vm.features.get(
'gui-default-secure-paste-sequence', None))
self.securepaste_initial = self.securepaste.currentIndex()
def __apply_feature_change(self, widget, feature, inital_index):
if inital_index != widget.currentIndex():
if widget.currentData() is None:
del self.vm.features[feature]
else:
self.vm.features[feature] = widget.currentData()
def __apply_gui_defaults(self):
self.__apply_feature_change(widget=self.allow_fullscreen,
feature='gui-default-allow-fullscreen',
inital_index=self.allow_fullscreen_initial)
self.__apply_feature_change(widget=self.allow_utf8,
feature='gui-default-allow-utf8-titles',
inital_index=self.allow_utf8_initial)
self.__apply_feature_change(widget=self.trayicon,
feature='gui-default-trayicon-mode',
inital_index=self.trayicon_initial)
self.__apply_feature_change(widget=self.securecopy,
feature='gui-default-secure-copy-sequence',
inital_index=self.securecopy_initial)
self.__apply_feature_change(widget=self.securepaste,
feature='gui-default-secure-paste-sequence',
inital_index=self.securepaste_initial)
def __init_mem_defaults__(self):
# qmemman settings
self.qmemman_config = ConfigParser()
@ -417,6 +507,7 @@ class GlobalSettingsWindow(ui_globalsettingsdlg.Ui_GlobalSettings,
self.__apply_mem_defaults__()
self.__apply_updates__()
self.__apply_repos__()
self.__apply_gui_defaults()
def main():

View File

@ -6,108 +6,14 @@
<rect>
<x>0</x>
<y>0</y>
<width>831</width>
<height>517</height>
<width>842</width>
<height>660</height>
</rect>
</property>
<property name="windowTitle">
<string>Qubes Global Settings</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QGroupBox" name="groupBox">
<property name="enabled">
<bool>true</bool>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>140</height>
</size>
</property>
<property name="title">
<string>System defaults</string>
</property>
<layout class="QFormLayout" name="formLayout">
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Dom0 UpdateVM:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QComboBox" name="update_vm_combo">
<property name="toolTip">
<string>This is updateVM ONLY for dom0; if you want to change updateVMs for other VMs, use /etc/qubes-rpc/policy/qubes.UpdatesProxy</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>ClockVM:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QComboBox" name="clock_vm_combo"/>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Default netVM:</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QComboBox" name="default_netvm_combo"/>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_4">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Default template:</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QComboBox" name="default_template_combo"/>
</item>
<item row="4" column="0">
<widget class="QLabel" name="label_8">
<property name="text">
<string>Default DisposableVM Template:</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QComboBox" name="default_dispvm_combo"/>
</item>
</layout>
</widget>
</item>
<item row="4" column="0" colspan="2">
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QGroupBox" name="groupBox_3">
<property name="enabled">
@ -194,32 +100,7 @@
</layout>
</widget>
</item>
<item row="1" column="0" colspan="2">
<widget class="QGroupBox" name="groupBox_2">
<property name="enabled">
<bool>true</bool>
</property>
<property name="title">
<string>Kernel</string>
</property>
<layout class="QFormLayout" name="formLayout_2">
<property name="fieldGrowthPolicy">
<enum>QFormLayout::AllNonFixedFieldsGrow</enum>
</property>
<item row="0" column="0">
<widget class="QLabel" name="label_5">
<property name="text">
<string>Default kernel:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QComboBox" name="default_kernel_combo"/>
</item>
</layout>
</widget>
</item>
<item row="2" column="0" colspan="2">
<item row="3" column="0" colspan="2">
<widget class="QGroupBox" name="groupBox_4">
<property name="title">
<string>Updates</string>
@ -319,6 +200,213 @@
</layout>
</widget>
</item>
<item row="1" column="0">
<widget class="QGroupBox" name="groupBox_5">
<property name="title">
<string>Window defaults</string>
</property>
<layout class="QGridLayout" name="gridLayout_4">
<item row="1" column="0">
<widget class="QLabel" name="label_11">
<property name="text">
<string>Allow UTF-8 window titles:</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label_10">
<property name="text">
<string>Allow fullscreen:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QComboBox" name="allow_fullscreen"/>
</item>
<item row="1" column="1">
<widget class="QComboBox" name="allow_utf8"/>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_12">
<property name="text">
<string>Tray icon mode:</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QComboBox" name="trayicon"/>
</item>
</layout>
</widget>
</item>
<item row="0" column="0">
<widget class="QGroupBox" name="groupBox">
<property name="enabled">
<bool>true</bool>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>140</height>
</size>
</property>
<property name="title">
<string>System defaults</string>
</property>
<layout class="QFormLayout" name="formLayout">
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Dom0 UpdateVM:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QComboBox" name="update_vm_combo">
<property name="toolTip">
<string>This is updateVM ONLY for dom0; if you want to change updateVMs for other VMs, use /etc/qubes-rpc/policy/qubes.UpdatesProxy</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>ClockVM:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QComboBox" name="clock_vm_combo"/>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Default netVM:</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QComboBox" name="default_netvm_combo"/>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_4">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Default template:</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QComboBox" name="default_template_combo"/>
</item>
<item row="4" column="0">
<widget class="QLabel" name="label_8">
<property name="text">
<string>Default DisposableVM Template:</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QComboBox" name="default_dispvm_combo"/>
</item>
</layout>
</widget>
</item>
<item row="1" column="1">
<widget class="QGroupBox" name="groupBox_6">
<property name="title">
<string>Clipboard defaults</string>
</property>
<layout class="QGridLayout" name="gridLayout_5">
<item row="0" column="0">
<widget class="QLabel" name="label_14">
<property name="text">
<string>Keyboard shortcuts:</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_13">
<property name="text">
<string>Secure copy:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QComboBox" name="securecopy"/>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_15">
<property name="text">
<string>Secure paste:</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QComboBox" name="securepaste"/>
</item>
</layout>
</widget>
</item>
<item row="2" column="0" colspan="2">
<widget class="QGroupBox" name="groupBox_2">
<property name="enabled">
<bool>true</bool>
</property>
<property name="title">
<string>Kernel</string>
</property>
<layout class="QFormLayout" name="formLayout_2">
<property name="fieldGrowthPolicy">
<enum>QFormLayout::AllNonFixedFieldsGrow</enum>
</property>
<item row="0" column="0">
<widget class="QLabel" name="label_5">
<property name="text">
<string>Default kernel:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QComboBox" name="default_kernel_combo"/>
</item>
</layout>
</widget>
</item>
<item row="6" column="0" colspan="2">
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
<item row="5" column="0">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<tabstops>