From 594b55de1dd64840c9856c9c6143e3a8420155ce Mon Sep 17 00:00:00 2001 From: Sarah Jamie Lewis Date: Wed, 21 Aug 2019 13:55:08 -0700 Subject: [PATCH] Toggle Allowing Unknown Peers --- go.mod | 9 +++++- go.sum | 31 ++++++++++++++------ go/characters/appEventListener.go | 8 +++++- go/constants/settings.go | 5 ++++ go/gothings/gcd.go | 45 +++++++++++++++++++++++++----- i18n/translation_de.ts | 17 +++++++---- i18n/translation_en.qm | Bin 4463 -> 4561 bytes i18n/translation_en.ts | 17 +++++++---- i18n/translation_fr.ts | 17 +++++++---- i18n/translation_pt.ts | 17 +++++++---- qml/panes/SettingsPane.qml | 22 ++++++++++++++- 11 files changed, 145 insertions(+), 43 deletions(-) create mode 100644 go/constants/settings.go diff --git a/go.mod b/go.mod index 48e723a3..13fb33de 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,14 @@ module cwtch.im/ui go 1.12 require ( - cwtch.im/cwtch v0.2.0 + cwtch.im/cwtch v0.2.1-pr-1 git.openprivacy.ca/openprivacy/libricochet-go v1.0.6 + github.com/gopherjs/gopherjs v0.0.0-20190812055157-5d271430af9f // indirect + github.com/kr/pretty v0.1.0 // indirect + github.com/stretchr/testify v1.4.0 // indirect github.com/therecipe/qt v0.0.0-20190824160953-615e084bab56 + golang.org/x/crypto v0.0.0-20190820162420-60c769a6c586 // indirect + golang.org/x/net v0.0.0-20190813141303-74dc4d7220e7 // indirect + golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a // indirect + gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 // indirect ) diff --git a/go.sum b/go.sum index 841772d2..0afc0332 100644 --- a/go.sum +++ b/go.sum @@ -1,5 +1,5 @@ -cwtch.im/cwtch v0.2.0 h1:kHjI/Ux+ft6/Zjfta5CIiwrBIpDQgxalyCjdvdjl6V4= -cwtch.im/cwtch v0.2.0/go.mod h1:8tmtp3c7fccWw9H7s9u6E8GD2PKI3ar21i0fjN8pzd0= +cwtch.im/cwtch v0.2.1-pr-1 h1:yC9aP9OnE6mUtLbZ5JNJjGMZGA3OWq6Vd+e5j8rihMg= +cwtch.im/cwtch v0.2.1-pr-1/go.mod h1:8tmtp3c7fccWw9H7s9u6E8GD2PKI3ar21i0fjN8pzd0= cwtch.im/tapir v0.1.10 h1:V+TkmwXNd6gySZqlVw468wMYEkmDwMSyvhkkpOfUw7w= cwtch.im/tapir v0.1.10/go.mod h1:EuRYdVrwijeaGBQ4OijDDRHf7R2MDSypqHkSl5DxI34= git.openprivacy.ca/openprivacy/libricochet-go v1.0.4/go.mod h1:yMSG1gBaP4f1U+RMZXN85d29D39OK5s8aTpyVRoH5FY= @@ -16,10 +16,16 @@ github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSs github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.2 h1:6nsPYzhq5kReh6QImI3k5qWzO4PEbvbIW2cwSfR/6xs= github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/gopherjs/gopherjs v0.0.0-20190411002643-bd77b112433e h1:XWcjeEtTFTOVA9Fs1w7n2XBftk5ib4oZrhzWk0B+3eA= github.com/gopherjs/gopherjs v0.0.0-20190411002643-bd77b112433e/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= +github.com/gopherjs/gopherjs v0.0.0-20190812055157-5d271430af9f h1:KMlcu9X58lhTA/KrfX8Bi1LQSO4pzoVjTiL3h4Jk+Zk= +github.com/gopherjs/gopherjs v0.0.0-20190812055157-5d271430af9f/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/konsorten/go-windows-terminal-sequences v1.0.2/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= +github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= +github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= +github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= +github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/mattn/go-colorable v0.1.2/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= github.com/mattn/go-runewidth v0.0.4/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= @@ -32,32 +38,39 @@ github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+ github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= -github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= +github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk= +github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/struCoder/pidusage v0.1.2/go.mod h1:pWBlW3YuSwRl6h7R5KbvA4N8oOqe9LjaKW5CwT1SPjI= -github.com/therecipe/qt v0.0.0-20190628021130-a9acd1ab63c1 h1:hqGfUSaL+5eJCyYJp89HNABOlkIUravsMVmqtK1fRX8= -github.com/therecipe/qt v0.0.0-20190628021130-a9acd1ab63c1/go.mod h1:SUUR2j3aE1z6/g76SdD6NwACEpvCxb3fvG82eKbD6us= github.com/therecipe/qt v0.0.0-20190824160953-615e084bab56 h1:CAFR/rHptsl8gEP6igtp6VbuQpPALEJ/B+gl9QkyFXU= github.com/therecipe/qt v0.0.0-20190824160953-615e084bab56/go.mod h1:SUUR2j3aE1z6/g76SdD6NwACEpvCxb3fvG82eKbD6us= golang.org/x/crypto v0.0.0-20190128193316-c7b33c32a30b/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190418165655-df01cb2cc480/go.mod h1:WFFai1msRO1wXaEeE5yQxYXgSfI8pQAWXbQop6sCtWE= golang.org/x/crypto v0.0.0-20190513172903-22d7a77e9e5f/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4 h1:HuIa8hRrWRSrqYzx1qI49NNxhdi2PrY7gxVSq1JjLDc= golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20190820162420-60c769a6c586 h1:7KByu05hhLed2MO29w7p1XfZvZ13m8mub3shuVftRs0= +golang.org/x/crypto v0.0.0-20190820162420-60c769a6c586/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/net v0.0.0-20190125091013-d26f9f9a57f3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190420063019-afa5a82059c6/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190628185345-da137c7871d7 h1:rTIdg5QFRR7XCaK4LCjBiPbx8j4DQRpdYMnGn/bJUEU= golang.org/x/net v0.0.0-20190628185345-da137c7871d7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20190813141303-74dc4d7220e7 h1:fHDIZ2oxGnUZRN6WgWFCbYBjH9uqVPRCUVUDhs0wnbA= +golang.org/x/net v0.0.0-20190813141303-74dc4d7220e7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190403152447-81d4e9dc473e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190419153524-e8e3143a4f4a h1:XCr/YX7O0uxRkLq2k1ApNQMims9eCioF9UpzIPBDmuo= golang.org/x/sys v0.0.0-20190419153524-e8e3143a4f4a/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a h1:aYOabOQFp6Vj6W1F80affTUvO9UxmJRx8K0gsfABByQ= +golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/tools v0.0.0-20190420181800-aa740d480789/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= +gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw= +gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= diff --git a/go/characters/appEventListener.go b/go/characters/appEventListener.go index 8c837a45..cad1799f 100644 --- a/go/characters/appEventListener.go +++ b/go/characters/appEventListener.go @@ -3,6 +3,7 @@ package characters import ( "cwtch.im/cwtch/app/plugins" "cwtch.im/cwtch/event" + "cwtch.im/ui/go/constants" "cwtch.im/ui/go/cwutil" "cwtch.im/ui/go/gobjects" "cwtch.im/ui/go/gothings" @@ -118,10 +119,15 @@ func AppEventListener(gcd *gothings.GrandCentralDispatcher, subscribed chan bool // load ui preferences gcd.RequestSettings() - locale, exists := the.Peer.GetProfile().GetAttribute("settings.locale") + locale, exists := the.Peer.GetProfile().GetAttribute(constants.LocaleSetting) if exists { gcd.SetLocale_helper(locale) } + + blockUnkownPeers, exists := the.Peer.GetProfile().GetAttribute(constants.BlockUnknownPeersSetting) + if exists && blockUnkownPeers == "true" { + the.EventBus.Publish(event.NewEvent(event.BlockUnknownPeers, map[event.Field]string{})) + } } } diff --git a/go/constants/settings.go b/go/constants/settings.go new file mode 100644 index 00000000..210ad84b --- /dev/null +++ b/go/constants/settings.go @@ -0,0 +1,5 @@ +package constants + +const BlockUnknownPeersSetting = "settings.blockunknownpeers" +const LocaleSetting = "settings.locale" +const ZoomSetting = "settings.zoom" diff --git a/go/gothings/gcd.go b/go/gothings/gcd.go index 3b8a724b..e661f536 100644 --- a/go/gothings/gcd.go +++ b/go/gothings/gcd.go @@ -51,7 +51,7 @@ type GrandCentralDispatcher struct { // settings helpers _ func(str string) `signal:"InvokePopup"` - _ func(zoom, locale string) `signal:"SupplySettings"` + _ func(zoom, locale string, blockunknownpeers bool) `signal:"SupplySettings"` _ func(groupID, name, server, invitation string, accepted bool, addrbooknames, addrbookaddrs []string) `signal:"SupplyGroupSettings"` _ func(onion, nick string, blocked bool) `signal:"SupplyPeerSettings"` @@ -77,6 +77,8 @@ type GrandCentralDispatcher struct { _ func(onion, key, nick string) `signal:"setAttribute,auto"` _ func(onion string) `signal:"deleteContact,auto""` _ func(locale string) `signal:"setLocale,auto"` + _ func() `signal:"allowUnknownPeers,auto"` + _ func() `signal:"blockUnknownPeers,auto"` } func (this *GrandCentralDispatcher) sendMessage(message string, mID string) { @@ -266,9 +268,10 @@ func (this *GrandCentralDispatcher) loadMessagesPaneHelper(handle string) { } func (this *GrandCentralDispatcher) requestSettings() { - zoom, _ := the.Peer.GetProfile().GetAttribute("settings.zoom") - locale, _ := the.Peer.GetProfile().GetAttribute("settings.locale") - this.SupplySettings(zoom, locale) + zoom, _ := the.Peer.GetProfile().GetAttribute(constants.ZoomSetting) + locale, _ := the.Peer.GetProfile().GetAttribute(constants.LocaleSetting) + blockunkownpeers, _ := the.Peer.GetProfile().GetAttribute(constants.BlockUnknownPeersSetting) + this.SupplySettings(zoom, locale, blockunkownpeers == "true") } func (this *GrandCentralDispatcher) saveSettings(zoom, locale string) { @@ -279,9 +282,10 @@ func (this *GrandCentralDispatcher) saveSettings(zoom, locale string) { } the.EventBus.Publish(event.NewEvent(event.SetAttribute, map[event.Field]string{ - event.Key: "settings.zoom", + event.Key: constants.ZoomSetting, event.Data: zoom, })) + the.Peer.GetProfile().SetAttribute(constants.ZoomSetting, zoom) } func (this *GrandCentralDispatcher) requestPeerSettings() { @@ -536,15 +540,42 @@ func (this *GrandCentralDispatcher) setAttribute(onion, key, value string) { } } +func (this *GrandCentralDispatcher) blockUnknownPeers() { + + // Save this setting + the.EventBus.Publish(event.NewEvent(event.SetAttribute, map[event.Field]string{ + event.Key: constants.BlockUnknownPeersSetting, + event.Data: "true", + })) + + the.Peer.GetProfile().SetAttribute(constants.BlockUnknownPeersSetting, "true") + the.EventBus.Publish(event.NewEvent(event.BlockUnknownPeers, map[event.Field]string{})) +} + +func (this *GrandCentralDispatcher) allowUnknownPeers() { + + // Save this setting + the.EventBus.Publish(event.NewEvent(event.SetAttribute, map[event.Field]string{ + event.Key: constants.BlockUnknownPeersSetting, + event.Data: "false", + })) + + the.Peer.GetProfile().SetAttribute(constants.BlockUnknownPeersSetting, "false") + the.EventBus.Publish(event.NewEvent(event.AllowUnknownPeers, map[event.Field]string{})) +} + func (this *GrandCentralDispatcher) setLocale(locale string) { this.SetLocale_helper(locale) the.EventBus.Publish(event.NewEvent(event.SetAttribute, map[event.Field]string{ - event.Key: "settings.locale", + event.Key: constants.LocaleSetting, event.Data: locale, })) - this.SupplySettings("", locale) + zoom, _ := the.Peer.GetProfile().GetAttribute(constants.ZoomSetting) + blockunkownpeers, _ := the.Peer.GetProfile().GetAttribute(constants.BlockUnknownPeersSetting) + this.SupplySettings(zoom, locale, blockunkownpeers == "true") + } func (this *GrandCentralDispatcher) SetLocale_helper(locale string) { diff --git a/i18n/translation_de.ts b/i18n/translation_de.ts index 84bb3bb6..a3f0cbdc 100644 --- a/i18n/translation_de.ts +++ b/i18n/translation_de.ts @@ -268,36 +268,41 @@ SettingsPane - + cwtch-settings-title Cwtch Settings title Cwtch Einstellungen - + version %1 builddate %2 Version: %1 Built on: %2 - + zoom-label Interface zoom (mostly affects text and button sizes) Benutzeroberflächen-Zoom (betriftt hauptsächlich Text- und Knopgrößen) - + + block-unknown-label + + + + large-text-label Groß - + default-scaling-text "Default size text (scale factor: " defaultmäßige Textgröße (Skalierungsfaktor: - + small-text-label Klein diff --git a/i18n/translation_en.qm b/i18n/translation_en.qm index b38f9584a5751dd4d131d8cbdab799e9788d6c7b..6ec2aa99957749a8126d16bce2bc9488f4c7423e 100644 GIT binary patch delta 187 zcmaE_bWwSNh~NwcvD-Ne49u+zUU_#I82F_ps=707n3$``ethB{1_oZ)iM`^C6%&`* zGnP+$8gF=lN96h&1_p+!5SnQ#k8a>51_r*(Jd39GF)%PyLTDZ_o`ZkR0L5)5mogeN z2}o>S#i+<@r^evKki(GAkj#+HpuiBykO!pmfc$bGslX7xkP3uF48sJ0RU=vG*|!t delta 113 zcmcbp{9b8-h~NYUvD-Ne49u+zUU_#I82AoORCQ+zo0zL8{`uHB1_oAV)_DQ*7#O%s zSTB~J0m{owTx-uLJMnEiW8P$6MsdkVo<&pp7#Nr;AvBK|&%r-Hb-a%!*D@M2@$cKb NiBXYvvo8M SettingsPane - + cwtch-settings-title Cwtch Settings title Cwtch Settings - + version %1 builddate %2 Version: %1 Built on: %2 Version: %1 Built on: %2 - + zoom-label Interface zoom (mostly affects text and button sizes) Interface zoom (mostly affects text and button sizes) - + + block-unknown-label + Block Unknown Peers + + + large-text-label Large - + default-scaling-text "Default size text (scale factor: " Default size text (scale factor: - + small-text-label Small diff --git a/i18n/translation_fr.ts b/i18n/translation_fr.ts index 8b493ee5..2c0d16cb 100644 --- a/i18n/translation_fr.ts +++ b/i18n/translation_fr.ts @@ -268,36 +268,41 @@ SettingsPane - + cwtch-settings-title Cwtch Settings title Préférences Cwtch - + version %1 builddate %2 Version: %1 Built on: %2 - + zoom-label Interface zoom (mostly affects text and button sizes) Interface zoom (essentiellement la taille du texte et des composants de l'interface) - + + block-unknown-label + + + + large-text-label Large - + default-scaling-text "Default size text (scale factor: " Taille par défaut du texte (échelle: - + small-text-label Petit diff --git a/i18n/translation_pt.ts b/i18n/translation_pt.ts index b73d4ac6..5c303071 100644 --- a/i18n/translation_pt.ts +++ b/i18n/translation_pt.ts @@ -268,36 +268,41 @@ SettingsPane - + cwtch-settings-title Cwtch Settings title Configurações do Cwtch - + version %1 builddate %2 Version: %1 Built on: %2 - + zoom-label Interface zoom (mostly affects text and button sizes) Zoom da interface (afeta principalmente tamanho de texto e botões) - + + block-unknown-label + + + + large-text-label Grande - + default-scaling-text "Default size text (scale factor: " Texto tamanho padrão (fator de escala: - + small-text-label Pequeno diff --git a/qml/panes/SettingsPane.qml b/qml/panes/SettingsPane.qml index 8d4efa0b..a5b358cb 100644 --- a/qml/panes/SettingsPane.qml +++ b/qml/panes/SettingsPane.qml @@ -5,6 +5,7 @@ import QtQuick.Controls.Material 2.0 import QtQuick.Layouts 1.3 import QtQuick.Window 2.11 import QtQuick.Controls 1.4 +import QtQuick.Controls.Styles 1.4 import "../widgets" import "../widgets/controls" @@ -66,6 +67,24 @@ ColumnLayout { // settingsPane width: 400 } + + CheckBox { + id: blockUnknownToggle + checked: true + onClicked: { + if (blockUnknownToggle.checked) { + gcd.blockUnknownPeers() + } else { + gcd.allowUnknownPeers() + } + } + style: CheckBoxStyle { + label: ScalingLabel { + text: qsTr("block-unknown-label") + } + } + } + ScalingLabel { wrapMode: TextEdit.Wrap text: qsTr("large-text-label") @@ -122,9 +141,10 @@ ColumnLayout { // settingsPane Connections { target: gcd - onSupplySettings: function(zoom, locale) { + onSupplySettings: function(zoom, locale, blockunknown) { if (zoom != "") zoomSlider.value = zoom // (locale is handled automatically by FlagButton) + blockUnknownToggle.checked = blockunknown } } }