From 82dfceb953e24897c3885f264b63b1e8ef4e2191 Mon Sep 17 00:00:00 2001 From: Michael Zanetti Date: Fri, 3 Jun 2022 01:18:23 +0200 Subject: [PATCH] Allow launching custom pages from main menu entries --- nymea-app/ui/MainMenu.qml | 5 +++++ nymea-app/ui/Nymea.qml | 1 + nymea-app/ui/RootItem.qml | 4 ++++ 3 files changed, 10 insertions(+) diff --git a/nymea-app/ui/MainMenu.qml b/nymea-app/ui/MainMenu.qml index bfb2b15e..0fddef65 100644 --- a/nymea-app/ui/MainMenu.qml +++ b/nymea-app/ui/MainMenu.qml @@ -15,6 +15,7 @@ Drawer { signal openMagicSettings(); signal openAppSettings(); signal openSystemSettings(); + signal openCustomPage(string page); signal configureMainView(); signal startWirelessSetup(); @@ -215,6 +216,10 @@ Drawer { iconName: entry.iconName progressive: false onClicked: { + if (entry.page !== undefined) { + root.openCustomPage(entry.page) + } + if (entry.func !== undefined) { entry.func(app, root.currentEngine) } diff --git a/nymea-app/ui/Nymea.qml b/nymea-app/ui/Nymea.qml index af7eadec..68f64d4d 100644 --- a/nymea-app/ui/Nymea.qml +++ b/nymea-app/ui/Nymea.qml @@ -121,6 +121,7 @@ ApplicationWindow { onOpenMagicSettings: rootItem.openMagicSettings(); onOpenAppSettings: rootItem.openAppSettings(); onOpenSystemSettings: rootItem.openSystemSettings(); + onOpenCustomPage: rootItem.openCustomPage(page); onConfigureMainView: rootItem.configureMainView(); onStartManualConnection: rootItem.startManualConnection(); onStartWirelessSetup: rootItem.startWirelessSetup(); diff --git a/nymea-app/ui/RootItem.qml b/nymea-app/ui/RootItem.qml index 13ec193a..9eaa8c00 100644 --- a/nymea-app/ui/RootItem.qml +++ b/nymea-app/ui/RootItem.qml @@ -70,6 +70,10 @@ Item { function openSystemSettings() { d.pushSettingsPage("SettingsPage.qml") } + function openCustomPage(page) { + d.pushSettingsPage(page) + } + function configureMainView() { swipeView.currentItem.pageStack.pop(null) swipeView.currentItem.pageStack.currentItem.configureViews()