Commit 0d52e4f1 authored by Alexander Stippich's avatar Alexander Stippich
Browse files

Fix setup of search shortcut

Summary:
The setup of the search shortcut was seriously broken.
Since multiple NavigationActionBars were instantiated
for each view, the shortcut would also be instantiated
multiple times, which could even crash Elisa.

Test Plan:
toggling the search fieed works, Elisa does not crash
when using the shortcut with different view

Reviewers: ngraham, ognarb, mgallien

Reviewed By: ngraham, ognarb

Tags: #elisa

Differential Revision: https://phabricator.kde.org/D22781
parent c003df06
......@@ -26,10 +26,9 @@ RowLayout {
spacing: 0
property bool showPlaylist
property bool showExpandedFilterView
property alias currentViewIndex: listViews.currentIndex
signal toggleSearch()
function goBack() {
viewManager.goBack()
}
......@@ -357,6 +356,7 @@ RowLayout {
DataGridView {
StackView.onActivated: viewManager.viewIsLoaded(viewType)
expandedFilterView: showExpandedFilterView
}
}
......@@ -365,6 +365,7 @@ RowLayout {
DataListView {
StackView.onActivated: viewManager.viewIsLoaded(viewType)
expandedFilterView: showExpandedFilterView
}
}
......@@ -373,6 +374,7 @@ RowLayout {
FileBrowserView {
StackView.onActivated: viewManager.viewIsLoaded(viewType)
expandedFilterView: showExpandedFilterView
}
}
......
......@@ -33,6 +33,7 @@ FocusScope {
property alias showRating: gridView.showRating
property alias delegateDisplaySecondaryText: gridView.delegateDisplaySecondaryText
property alias isSubPage: gridView.isSubPage
property alias expandedFilterView: gridView.expandedFilterView
property string genreFilterText
property string artistFilter
......
......@@ -30,6 +30,7 @@ FocusScope {
property alias secondaryTitle: listView.secondaryTitle
property int databaseId
property alias showSection: listView.showSection
property alias expandedFilterView: listView.expandedFilterView
property alias image: listView.image
property var modelType
property alias sortRole: proxyModel.sortRole
......
......@@ -47,6 +47,7 @@ ApplicationWindow {
property var seekAction: elisa.action("Seek")
property var scrubAction: elisa.action("Scrub")
property var playPauseAction: elisa.action("Play-Pause")
property var findAction: elisa.action("edit_find")
Action {
shortcut: goBackAction.shortcut
......@@ -54,18 +55,23 @@ ApplicationWindow {
}
Action {
shortcut: seekAction.shortcut
onTriggered: elisa.audioControl.seek(headerBar.playerControl.position + 10000)
shortcut: seekAction.shortcut
onTriggered: elisa.audioControl.seek(headerBar.playerControl.position + 10000)
}
Action {
shortcut: scrubAction.shortcut
onTriggered: elisa.audioControl.seek(headerBar.playerControl.position - 10000)
shortcut: scrubAction.shortcut
onTriggered: elisa.audioControl.seek(headerBar.playerControl.position - 10000)
}
Action {
shortcut: playPauseAction.shortcut
onTriggered: elisa.audioControl.playPause()
shortcut: playPauseAction.shortcut
onTriggered: elisa.audioControl.playPause()
}
Action {
shortcut: findAction.shortcut
onTriggered: persistentSettings.expandedFilterView = !persistentSettings.expandedFilterView
}
ApplicationMenu {
......@@ -249,6 +255,7 @@ ApplicationWindow {
Layout.fillHeight: true
Layout.fillWidth: true
showPlaylist: persistentSettings.showPlaylist
showExpandedFilterView: persistentSettings.expandedFilterView
}
}
}
......
......@@ -35,10 +35,10 @@ ColumnLayout {
property alias filterText: filterTextInput.text
property alias filterRating: ratingFilter.starRating
property bool enableGoBack: true
property bool expandedFilterView: persistentSettings.expandedFilterView
property bool expandedFilterView
property bool enableSorting: true
property bool sortOrder
property var findAction: elisa.action("edit_find")
signal enqueue();
signal replaceAndPlay();
......@@ -70,18 +70,11 @@ ColumnLayout {
Action {
id: showFilterAction
shortcut: findAction.shortcut
text: !navigationBar.expandedFilterView ? i18nc("Show filters in the navigation bar", "Show Search Options") : i18nc("Hide filters in the navigation bar", "Hide Search Options")
icon.name: 'search'
checkable: true
checked: filterRow.opacity == 1.0
onTriggered: {
persistentSettings.expandedFilterView = !persistentSettings.expandedFilterView
expandedFilterView = persistentSettings.expandedFilterView
if (expandedFilterView) {
filterTextInput.forceActiveFocus()
}
}
checked: expandedFilterView
onTriggered: persistentSettings.expandedFilterView = !persistentSettings.expandedFilterView
}
Action {
......@@ -296,6 +289,9 @@ ColumnLayout {
target: filterRow
opacity: 1.0
}
StateChangeScript {
script: filterTextInput.forceActiveFocus()
}
}
]
transitions: Transition {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment