From e10c8f5d16c6d1d5835d19e9bd1b777ed3f266f5 Mon Sep 17 00:00:00 2001 From: Sale Djenic Date: Mon, 16 Aug 2021 14:05:29 +0200 Subject: [PATCH] refactor(StatusSearchLocationMenu): expose a single itemClicked signal A single `signal itemClicked(string firstLevelItemValue, string secondLevelItemValue)` with parameters referring to the first level and second level item is exposed and replaced multiple signals we had before for the same purpose. --- .../StatusQ/Popups/StatusSearchLocationMenu.qml | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/ui/StatusQ/src/StatusQ/Popups/StatusSearchLocationMenu.qml b/ui/StatusQ/src/StatusQ/Popups/StatusSearchLocationMenu.qml index 1c709c57f3..cb806efda5 100644 --- a/ui/StatusQ/src/StatusQ/Popups/StatusSearchLocationMenu.qml +++ b/ui/StatusQ/src/StatusQ/Popups/StatusSearchLocationMenu.qml @@ -11,17 +11,14 @@ StatusPopupMenu { property var searchPopup property var locationModel - signal subMenuClicked() - signal subMenuItemClicked() - signal anywhereItemClicked() - signal menuItemNoSubMenuClicked() + signal itemClicked(string firstLevelItemValue, string secondLevelItemValue) StatusMenuItem { text: "Anywhere" onTriggered: { searchPopup.resetSelectionBadge(); searchPopup.searchSelectionButton.primaryText = text; - root.anywhereItemClicked(); + root.itemClicked("", ""); } } StatusMenuSeparator { } @@ -74,7 +71,7 @@ StatusPopupMenu { searchPopup.searchSelectionButton.iconSettings.name = iconSettings.name; searchPopup.searchSelectionButton.iconSettings.color = !!iconSettings.color ? iconSettings.color : Theme.palette.primaryColor1 searchPopup.searchSelectionButton.iconSettings.isLetterIdenticon = !iconSettings.name && !image.source - root.menuItemNoSubMenuClicked(); + root.itemClicked(value, "") } } } @@ -125,8 +122,8 @@ StatusPopupMenu { searchPopup.searchSelectionButton.iconSettings.color = !!menuLoader.parentIdenticonColor ? menuLoader.parentIdenticonColor : Theme.palette.primaryColor1; searchPopup.searchSelectionButton.iconSettings.isLetterIdenticon = !menuLoader.parentIconName && !menuLoader.parentImageSource } - root.subMenuItemClicked(); - root.dismiss(); + root.itemClicked(menuLoader.parentValue, value) + root.dismiss() } } } @@ -142,8 +139,8 @@ StatusPopupMenu { searchPopup.searchSelectionButton.iconSettings.name = menuItem.parentIconName; searchPopup.searchSelectionButton.iconSettings.color = menuItem.parentIdenticonColor; searchPopup.searchSelectionButton.iconSettings.isLetterIdenticon = !menuItem.parentIconName && !menuItem.parentImageSource - root.subMenuClicked(); + root.itemClicked(menuItem.parentValue, "") //TODO fix error "QML StatusPopupMenu: cannot find any window to open popup in." - root.dismiss(); + root.dismiss() } }