ui option for allowing untrusted connections

pull/4/head
Zlatin Balevsky 2019-06-05 15:47:44 +01:00
parent 2edeb046be
commit cdb6e22522
3 changed files with 16 additions and 4 deletions

View File

@ -52,7 +52,11 @@ class OptionsController {
text = view.updateField.text
model.updateCheckInterval = text
settings.updateCheckInterval = Integer.valueOf(text)
boolean allowUntrusted = view.allowUntrustedCheckbox.model.isSelected()
model.allowUntrusted = allowUntrusted
settings.setAllowUntrusted(allowUntrusted)
File settingsFile = new File(core.home, "MuWire.properties")
settingsFile.withOutputStream {
settings.write(it)

View File

@ -1,6 +1,7 @@
package com.muwire.gui
import com.muwire.core.Core
import com.muwire.core.MuWireSettings
import griffon.core.artifact.GriffonModel
import griffon.transform.Observable
@ -10,6 +11,7 @@ import griffon.metadata.ArtifactProviderFor
class OptionsModel {
@Observable String downloadRetryInterval
@Observable String updateCheckInterval
@Observable boolean allowUntrusted
// i2p options
@Observable String inboundLength
@ -18,8 +20,10 @@ class OptionsModel {
@Observable String outboundQuantity
void mvcGroupInit(Map<String, String> args) {
downloadRetryInterval = application.context.get("muwire-settings").downloadRetryInterval
updateCheckInterval = application.context.get("muwire-settings").updateCheckInterval
MuWireSettings settings = application.context.get("muwire-settings")
downloadRetryInterval = settings.downloadRetryInterval
updateCheckInterval = settings.updateCheckInterval
allowUntrusted = settings.allowUntrusted()
Core core = application.context.get("core")
inboundLength = core.i2pOptions["inbound.length"]

View File

@ -27,6 +27,7 @@ class OptionsView {
def i
def retryField
def updateField
def allowUntrustedCheckbox
def inboundLengthField
def inboundQuantityField
@ -50,7 +51,10 @@ class OptionsView {
label(text : "Check for updates every", constraints : gbc(gridx : 0, gridy: 1))
updateField = textField(text : bind {model.updateCheckInterval }, columns : 2, constraints : gbc(gridx : 1, gridy: 1))
label(text : "hours", constraints : gbc(gridx: 2, gridy : 1))
label(text : "Allow untrusted connections", constraints : gbc(gridx: 0, gridy : 2))
allowUntrustedCheckbox = checkBox(selected : bind {model.allowUntrusted}, constraints : gbc(gridx: 1, gridy : 2))
}
i = builder.panel {
gridBagLayout()