Skip to content
Snippets Groups Projects
Unverified Commit 0d1d4116 authored by Kali Kaneko's avatar Kali Kaneko
Browse files

[ui] avoid blank location item

- Resolves: #522
parent c32d07c7
No related branches found
No related tags found
No related merge requests found
...@@ -252,6 +252,16 @@ ApplicationWindow { ...@@ -252,6 +252,16 @@ ApplicationWindow {
return ctx.manualLocation == "true" return ctx.manualLocation == "true"
} }
function hasMultipleGateways() {
// could also count the gateways
let provider = Logic.getSelectedProvider(providers);
if (provider == "riseup") {
return true;
} else {
return false;
}
}
function setGwSelection() { function setGwSelection() {
if (!isManualLocation()) { if (!isManualLocation()) {
...@@ -341,7 +351,7 @@ ApplicationWindow { ...@@ -341,7 +351,7 @@ ApplicationWindow {
MenuItem { MenuItem {
id: manualSelectionItem id: manualSelectionItem
text: { text: {
if (isManualLocation()) { if (isManualLocation() != "") {
locationStr() locationStr()
} else { } else {
qsTr("Pick location…") qsTr("Pick location…")
...@@ -350,6 +360,12 @@ ApplicationWindow { ...@@ -350,6 +360,12 @@ ApplicationWindow {
checkable: true checkable: true
checked: isManualLocation() checked: isManualLocation()
onTriggered: setGwSelection() onTriggered: setGwSelection()
visible: hasMultipleGateways()
}
MenuItem {
text: qsTr("Preferences…")
visible: !hasMultipleGateways()
} }
MenuSeparator {} MenuSeparator {}
...@@ -490,7 +506,11 @@ ApplicationWindow { ...@@ -490,7 +506,11 @@ ApplicationWindow {
} }
function locationStr() { function locationStr() {
return ctx.currentLocation + ", " + ctx.currentCountry if (ctx.currentLocation && ctx.currentCountry) {
return ctx.currentLocation + ", " + ctx.currentCountry
} else {
return ""
}
} }
function useBridges(value) { function useBridges(value) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment