summaryrefslogtreecommitdiff
path: root/gui
diff options
context:
space:
mode:
authorkali kaneko (leap communications) <kali@leap.se>2021-07-09 20:21:08 +0200
committerkali kaneko (leap communications) <kali@leap.se>2021-07-12 19:47:46 +0200
commit0d1d4116eb283a684b93bd432cb1f3b8331b2d4d (patch)
tree893c30c5e328d1ae2845c4d957c85826a258d3f8 /gui
parentc32d07c7bde5e9438dc96d41f6f32a7c9db8763a (diff)
[ui] avoid blank location item
- Resolves: #522
Diffstat (limited to 'gui')
-rw-r--r--gui/qml/main.qml24
1 files changed, 22 insertions, 2 deletions
diff --git a/gui/qml/main.qml b/gui/qml/main.qml
index cc5b17e..1d67924 100644
--- a/gui/qml/main.qml
+++ b/gui/qml/main.qml
@@ -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) {