From 9ba0a755e4588dd5e1100ff6b817f81cd6188da1 Mon Sep 17 00:00:00 2001 From: Carl Schwan Date: Tue, 29 Dec 2020 14:27:28 +0000 Subject: [PATCH] Disable menu item when login in Fix #204 --- qml/main.qml | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/qml/main.qml b/qml/main.qml index acd297080..cb76e78aa 100644 --- a/qml/main.qml +++ b/qml/main.qml @@ -139,13 +139,13 @@ Kirigami.ApplicationWindow { text: i18n("Explore rooms") icon.name: "compass" onTriggered: pushReplaceLayer("qrc:/imports/NeoChat/Page/JoinRoomPage.qml", {"connection": Controller.activeConnection}) - enabled: pageStack.layers.currentItem.title !== i18n("Explore Rooms") + enabled: pageStack.layers.currentItem.title !== i18n("Explore Rooms") && Controller.accountCount > 0 }, Kirigami.Action { text: i18n("Start a Chat") icon.name: "irc-join-channel" onTriggered: pushReplaceLayer("qrc:/imports/NeoChat/Page/StartChatPage.qml", {"connection": Controller.activeConnection}) - enabled: pageStack.layers.currentItem.title !== i18n("Start a Chat") + enabled: pageStack.layers.currentItem.title !== i18n("Start a Chat") && Controller.accountCount > 0 }, Kirigami.Action { text: i18n("Create a Room") @@ -155,19 +155,20 @@ Kirigami.ApplicationWindow { dialog.open(); } shortcut: StandardKey.New - enabled: pageStack.layers.currentItem.title !== i18n("Start a Chat") + enabled: pageStack.layers.currentItem.title !== i18n("Start a Chat") && Controller.accountCount > 0 }, Kirigami.Action { text: i18n("Accounts") icon.name: "im-user" onTriggered: pushReplaceLayer("qrc:/imports/NeoChat/Page/AccountsPage.qml") - enabled: pageStack.layers.currentItem.title !== i18n("Accounts") + enabled: pageStack.layers.currentItem.title !== i18n("Accounts") && Controller.accountCount > 0 + }, Kirigami.Action { text: i18n("Devices") iconName: "network-connect" onTriggered: pageStack.layers.push("qrc:/imports/NeoChat/Page/DevicesPage.qml") - enabled: pageStack.layers.currentItem.title !== i18n("Devices") + enabled: pageStack.layers.currentItem.title !== i18n("Devices") && Controller.accountCount > 0 }, Kirigami.Action { text: i18n("Settings") @@ -185,6 +186,7 @@ Kirigami.ApplicationWindow { Kirigami.Action { text: i18n("Logout") icon.name: "list-remove-user" + enabled: Controller.accountCount > 0 onTriggered: Controller.logout(Controller.activeConnection, true) }, Kirigami.Action {