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.
This commit is contained in:
Sale Djenic 2021-08-16 14:05:29 +02:00
parent c63cbedebf
commit d5bd64b742
1 changed files with 7 additions and 10 deletions

View File

@ -11,17 +11,14 @@ StatusPopupMenu {
property var searchPopup property var searchPopup
property var locationModel property var locationModel
signal subMenuClicked() signal itemClicked(string firstLevelItemValue, string secondLevelItemValue)
signal subMenuItemClicked()
signal anywhereItemClicked()
signal menuItemNoSubMenuClicked()
StatusMenuItem { StatusMenuItem {
text: "Anywhere" text: "Anywhere"
onTriggered: { onTriggered: {
searchPopup.resetSelectionBadge(); searchPopup.resetSelectionBadge();
searchPopup.searchSelectionButton.primaryText = text; searchPopup.searchSelectionButton.primaryText = text;
root.anywhereItemClicked(); root.itemClicked("", "");
} }
} }
StatusMenuSeparator { } StatusMenuSeparator { }
@ -74,7 +71,7 @@ StatusPopupMenu {
searchPopup.searchSelectionButton.iconSettings.name = iconSettings.name; searchPopup.searchSelectionButton.iconSettings.name = iconSettings.name;
searchPopup.searchSelectionButton.iconSettings.color = !!iconSettings.color ? iconSettings.color : Theme.palette.primaryColor1 searchPopup.searchSelectionButton.iconSettings.color = !!iconSettings.color ? iconSettings.color : Theme.palette.primaryColor1
searchPopup.searchSelectionButton.iconSettings.isLetterIdenticon = !iconSettings.name && !image.source 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.color = !!menuLoader.parentIdenticonColor ? menuLoader.parentIdenticonColor : Theme.palette.primaryColor1;
searchPopup.searchSelectionButton.iconSettings.isLetterIdenticon = !menuLoader.parentIconName && !menuLoader.parentImageSource searchPopup.searchSelectionButton.iconSettings.isLetterIdenticon = !menuLoader.parentIconName && !menuLoader.parentImageSource
} }
root.subMenuItemClicked(); root.itemClicked(menuLoader.parentValue, value)
root.dismiss(); root.dismiss()
} }
} }
} }
@ -142,8 +139,8 @@ StatusPopupMenu {
searchPopup.searchSelectionButton.iconSettings.name = menuItem.parentIconName; searchPopup.searchSelectionButton.iconSettings.name = menuItem.parentIconName;
searchPopup.searchSelectionButton.iconSettings.color = menuItem.parentIdenticonColor; searchPopup.searchSelectionButton.iconSettings.color = menuItem.parentIdenticonColor;
searchPopup.searchSelectionButton.iconSettings.isLetterIdenticon = !menuItem.parentIconName && !menuItem.parentImageSource 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." //TODO fix error "QML StatusPopupMenu: cannot find any window to open popup in."
root.dismiss(); root.dismiss()
} }
} }