From e85fe47a13afe5c714ca51b0953aae8ebeb344d6 Mon Sep 17 00:00:00 2001 From: Joey Payne Date: Sun, 27 Sep 2015 13:13:32 -0600 Subject: [PATCH] Added ability to specify comma separated values for the trust anchor. --- command_line.py | 3 +++ files/settings.cfg | 2 +- main.py | 13 +++++++++++++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/command_line.py b/command_line.py index d3abbef..4c41617 100644 --- a/command_line.py +++ b/command_line.py @@ -528,6 +528,9 @@ class CommandBase(object): setting.type == 'folder'): val_str = self.convert_val_to_str(new_dic[item]) setting.value = val_str + if setting.type == 'strings': + strs = self.convert_val_to_str(new_dic[item]).split(',') + setting.value = strs if setting.type == 'check': setting.value = new_dic[item] if setting.type == 'list': diff --git a/files/settings.cfg b/files/settings.cfg index 80bd8b0..d4683bf 100644 --- a/files/settings.cfg +++ b/files/settings.cfg @@ -91,7 +91,7 @@ linux_64_dir_prefix = 'node-webkit-v{}-linux-x64' [[[additional_trust_anchors]]] display_name='Trust Anchors' default_value='' - type='string' + type='strings' description='A list of PEM-encoded certificates. Used as additional root certificates for validation to allow connecting to services using a self-signed certificate.' [[webkit_settings]] diff --git a/main.py b/main.py index 0c76675..2bf5db1 100644 --- a/main.py +++ b/main.py @@ -872,6 +872,8 @@ class MainWindow(QtGui.QMainWindow, CommandBase): setting = self.get_setting(name) if setting.type == 'string': return self.create_text_input_setting(name) + elif setting.type == 'strings': + return self.create_text_input_setting(name) elif setting.type == 'file': return self.create_text_input_with_file_setting(name) elif setting.type == 'folder': @@ -1042,6 +1044,12 @@ class MainWindow(QtGui.QMainWindow, CommandBase): setting.value = old_val.replace('\\', '\\\\') widget.setText(unicode(old_val)) + elif setting.type == 'strings': + old_val = [] + if setting.default_value is not None: + old_val = setting.default_value + setting.value = [unicode(v.replace('\\', '\\\\')) for v in old_val] + widget.setText(','.join(setting.value)) elif setting.type == 'check': old_val = False @@ -1093,6 +1101,8 @@ class MainWindow(QtGui.QMainWindow, CommandBase): setting.type == 'file' or setting.type == 'folder'): setting.value = args[0] + elif setting.type == 'strings': + setting.value = args[0].split(',') elif setting.type == 'check': setting.value = obj.isChecked() check_action = setting.check_action @@ -1229,6 +1239,9 @@ class MainWindow(QtGui.QMainWindow, CommandBase): setting.type == 'folder'): val_str = self.convert_val_to_str(setting.value) setting_field.setText(setting.filter_name(val_str)) + if setting.type == 'strings': + vals = [self.convert_val_to_str(v) for v in setting.value] + setting_field.setText(','.join(vals)) if setting.type == 'check': setting_field.setChecked(setting.value) if setting.type == 'list':