From aa7b37949ae72cc1e1c37fc1c60a3abeb48d7bf1 Mon Sep 17 00:00:00 2001
From: "kali kaneko (leap communications)" <kali@leap.se>
Date: Wed, 17 Mar 2021 15:14:56 +0100
Subject: [PATCH] undo qualified namespace

---
 Makefile               |  2 +
 gui/qml/FailDialog.qml |  3 +-
 gui/qml/main.qml       | 90 +++++++++++++++++++++++++++++++++---------
 3 files changed, 76 insertions(+), 19 deletions(-)

diff --git a/Makefile b/Makefile
index 70ca3943..09ffc1dc 100644
--- a/Makefile
+++ b/Makefile
@@ -377,6 +377,8 @@ endif
 #########################################################################
 # packaging action
 #########################################################################
+run:
+	./build/qt/release/riseup-vpn
 
 builder_image:
 	@make -C docker build
diff --git a/gui/qml/FailDialog.qml b/gui/qml/FailDialog.qml
index d151feb3..401fa255 100644
--- a/gui/qml/FailDialog.qml
+++ b/gui/qml/FailDialog.qml
@@ -16,7 +16,8 @@ MessageDialog {
         if (ctx.loginDialog == 'true') {
             login.visible = true
         } else {
-            // FIXME - we probably want to distinguish 
+
+            // FIXME - we probably want to distinguish
             // fatal from recoverable errors. For the time being
             // we can avoid quitting so that people can try reconnects if it's
             // a network problem, it's confusing to quit the app.
diff --git a/gui/qml/main.qml b/gui/qml/main.qml
index 502379b1..fd5421a2 100644
--- a/gui/qml/main.qml
+++ b/gui/qml/main.qml
@@ -1,13 +1,14 @@
 import QtQuick 2.9
-import QtQuick.Controls 1.4
+import QtQuick.Window 2.2
 import QtQuick.Dialogs 1.2
 import QtQuick.Layouts 1.0
-import QtQuick.Extras 1.2
-
-import Qt.labs.platform 1.1 as LabsPlatform
+import QtQuick.Controls 1.4
 
-ApplicationWindow {
+//import QtQuick.Extras 1.2
+import Qt.labs.platform 1.0
 
+//as LabsPlatform
+Window {
     id: app
     visible: true
     width: 300
@@ -229,7 +230,7 @@ ApplicationWindow {
         id: vpn
     }
 
-    LabsPlatform.SystemTrayIcon {
+    SystemTrayIcon {
 
         id: systray
         visible: systrayVisible
@@ -239,7 +240,12 @@ ApplicationWindow {
             systray.activatedSignal()
         }
 
-        menu: LabsPlatform.Menu {
+
+        /* the systray menu cannot be buried in a child qml file because
+         * otherwise the ids are not available
+         * from other components
+         */
+        menu: Menu {
 
             id: systrayMenu
 
@@ -253,13 +259,61 @@ ApplicationWindow {
                 }
             }
 
-            LabsPlatform.MenuItem {
+            MenuItem {
                 id: statusItem
                 text: qsTr("Checking status…")
                 enabled: false
             }
 
-            LabsPlatform.MenuItem {
+            MenuItem {
+                id: autoSelectionItem
+                text: qsTr("automatic")
+                checkable: true
+                checked: true
+                enabled: false
+            }
+
+
+            /* a minimal segfault for submenu */
+            // Menu {}
+
+            /* this segfaults too (but it's the way to do dynamic item creation */
+
+            /*
+            Menu {
+                id: manualGatewaysSubmenu
+                title: qsTr("Manual Gateways")
+                enabled: true
+
+                Instantiator {
+                    id: manualGatewayInstantiator
+                    //model: settings.recentFiles
+
+                    delegate: MenuItem {
+                        text: "test gateway"
+                    }
+
+                    onObjectAdded: manualGatewaysSubmenu.insertItem(index, object)
+                    onObjectRemoved: manualGatewaysSubmenu.removeItem(object)
+                }
+
+                MenuSeparator {}
+            }
+            */
+            MenuSeparator {}
+
+            MenuItem {
+                id: manualSelectionItem
+                text: qsTr("Pick gateway…")
+                checkable: true
+                checked: false
+                enabled: true
+            }
+
+            MenuSeparator {}
+
+
+            MenuItem {
                 text: {
                     if (vpn.state == "failed")
                         qsTr("Reconnect")
@@ -273,7 +327,7 @@ ApplicationWindow {
                                 || ctx.status == "failed") : false
             }
 
-            LabsPlatform.MenuItem {
+            MenuItem {
                 text: {
                     if (ctx && ctx.status == "starting")
                         qsTr("Cancel")
@@ -287,9 +341,9 @@ ApplicationWindow {
                                 || ctx.status == "failed") : false
             }
 
-            LabsPlatform.MenuSeparator {}
+            MenuSeparator {}
 
-            LabsPlatform.MenuItem {
+            MenuItem {
                 text: qsTr("About…")
                 onTriggered: {
                     about.visible = true
@@ -298,7 +352,7 @@ ApplicationWindow {
                 }
             }
 
-            LabsPlatform.MenuItem {
+            MenuItem {
                 id: donateItem
                 text: qsTr("Donate…")
                 visible: ctx ? ctx.donateURL : false
@@ -307,9 +361,9 @@ ApplicationWindow {
                 }
             }
 
-            LabsPlatform.MenuSeparator {}
+            MenuSeparator {}
 
-            LabsPlatform.MenuItem {
+            MenuItem {
                 text: qsTr("Help…")
 
                 onTriggered: {
@@ -318,7 +372,7 @@ ApplicationWindow {
                 }
             }
 
-            LabsPlatform.MenuItem {
+            MenuItem {
                 text: qsTr("Report a bug…")
 
                 onTriggered: {
@@ -328,9 +382,9 @@ ApplicationWindow {
                 }
             }
 
-            LabsPlatform.MenuSeparator {}
+            MenuSeparator {}
 
-            LabsPlatform.MenuItem {
+            MenuItem {
                 text: qsTr("Quit")
                 onTriggered: backend.quit()
             }
-- 
GitLab