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 {
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() {
if (!isManualLocation()) {
......@@ -341,7 +351,7 @@ ApplicationWindow {
MenuItem {
id: manualSelectionItem
text: {
if (isManualLocation()) {
if (isManualLocation() != "") {
locationStr()
} else {
qsTr("Pick location…")
......@@ -350,6 +360,12 @@ ApplicationWindow {
checkable: true
checked: isManualLocation()
onTriggered: setGwSelection()
visible: hasMultipleGateways()
}
MenuItem {
text: qsTr("Preferences…")
visible: !hasMultipleGateways()
}
MenuSeparator {}
......@@ -490,7 +506,11 @@ ApplicationWindow {
}
function locationStr() {
return ctx.currentLocation + ", " + ctx.currentCountry
if (ctx.currentLocation && ctx.currentCountry) {
return ctx.currentLocation + ", " + ctx.currentCountry
} else {
return ""
}
}
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