diff --git a/autotests/qmltests/tst_NavigationActionBar.qml b/autotests/qmltests/tst_NavigationActionBar.qml --- a/autotests/qmltests/tst_NavigationActionBar.qml +++ b/autotests/qmltests/tst_NavigationActionBar.qml @@ -23,7 +23,7 @@ FocusScope { - property string filterState: "" + property bool expandedFilterView: false function i18nc(string1,string2) { return string2 @@ -45,8 +45,8 @@ Binding { target: navigationActionBar1 - property: "state" - value: filterState + property: "expandedFilterView" + value: expandedFilterView } NavigationActionBar { @@ -69,7 +69,7 @@ enableGoBack: false allowArtistNavigation: false showRating: false - state: 'expanded' + expandedFilterView: true height: 100 y: 200 @@ -151,7 +151,7 @@ filterViewChangedSpy2.clear(); showArtistSpy1.clear(); showArtistSpy2.clear(); - filterState = ""; + expandedFilterView = false; } function test_goBack() { @@ -206,23 +206,24 @@ compare(showArtistSpy1.count, 0); compare(showArtistSpy2.count, 0); - navigationActionBar1.state = "" var showFilterButtonItem1 = findChild(navigationActionBar1, "showFilterButton"); verify(showFilterButtonItem1 !== null, "valid showFilterButton") mouseClick(showFilterButtonItem1); compare(filterViewChangedSpy1.count, 1); var signalArgument1 = filterViewChangedSpy1.signalArguments[0]; - filterState = signalArgument1[0]; - compare(filterState,'expanded') + expandedFilterView = signalArgument1[0]; + compare(expandedFilterView,true); + compare(navigationActionBar1.state,'expanded') var showFilterButtonItem2 = findChild(navigationActionBar2, "showFilterButton"); verify(showFilterButtonItem2 !== null, "valid showFilterButton") mouseClick(showFilterButtonItem2); compare(filterViewChangedSpy2.count, 1); var signalArgument2 = filterViewChangedSpy2.signalArguments[0]; - compare(signalArgument2[0],"") - filterState = signalArgument2[0]; - compare(filterState,"") - compare(navigationActionBar1.state,"") + compare(signalArgument2[0],false) + expandedFilterView = signalArgument2[0]; + compare(expandedFilterView,false) + compare(navigationActionBar1.expandedFilterView, false) + compare(navigationActionBar1.state,'collapsed') } function test_replaceAndPlay() { @@ -266,10 +267,7 @@ } function test_filterRating() { - var showFilterButtonItem1 = findChild(navigationActionBar1, "showFilterButton"); - verify(showFilterButtonItem1 !== null, "valid showFilterButton") - mouseClick(showFilterButtonItem1); - compare(filterViewChangedSpy1.count, 1); + expandedFilterView = true; wait(200); var ratingFilterItem1 = findChild(navigationActionBar1, "ratingFilter"); verify(ratingFilterItem1 !== null, "valid ratingFilter") diff --git a/src/elisaapplication.h b/src/elisaapplication.h --- a/src/elisaapplication.h +++ b/src/elisaapplication.h @@ -156,6 +156,8 @@ void goBack(); + void find(); + private: void setupActions(const QString &actionName); diff --git a/src/elisaapplication.cpp b/src/elisaapplication.cpp --- a/src/elisaapplication.cpp +++ b/src/elisaapplication.cpp @@ -144,6 +144,11 @@ d->mCollection.addAction(goBackAction->objectName(), goBackAction); } + if (actionName == QStringLiteral("edit_find") && KAuthorized::authorizeAction(actionName)) { + auto findAction = KStandardAction::find(this, &ElisaApplication::find, this); + d->mCollection.addAction(findAction->objectName(), findAction); + } + d->mCollection.readSettings(); #endif } @@ -230,6 +235,8 @@ void ElisaApplication::goBack() {} +void ElisaApplication::find() {} + QStringList ElisaApplication::checkFileListAndMakeAbsolute(const QStringList &filesList, const QString &workingDirectory) const { QStringList filesToOpen; diff --git a/src/qml/ContentView.qml b/src/qml/ContentView.qml --- a/src/qml/ContentView.qml +++ b/src/qml/ContentView.qml @@ -23,10 +23,13 @@ import org.kde.elisa 1.0 RowLayout { + id: contentViewContainer spacing: 0 property alias playList: playList + signal toggleSearch() + function goBack() { localAlbums.goBack() localArtists.goBack() @@ -154,11 +157,11 @@ Binding { target: allAlbumsView - property: 'filterState' - value: persistentSettings.filterState + property: 'expandedFilterView' + value: persistentSettings.expandedFilterView } - onFilterViewChanged: persistentSettings.filterState = filterState + onFilterViewChanged: persistentSettings.expandedFilterView = expandedFilterView } visible: opacity > 0 @@ -202,11 +205,11 @@ Binding { target: allArtistsView - property: 'filterState' - value: persistentSettings.filterState + property: 'expandedFilterView' + value: persistentSettings.expandedFilterView } - onFilterViewChanged: persistentSettings.filterState = filterState + onFilterViewChanged: persistentSettings.expandedFilterView = expandedFilterView } visible: opacity > 0 @@ -233,11 +236,11 @@ Binding { target: allTracksView - property: 'filterState' - value: persistentSettings.filterState + property: 'expandedFilterView' + value: persistentSettings.expandedFilterView } - onFilterViewChanged: persistentSettings.filterState = filterState + onFilterViewChanged: persistentSettings.expandedFilterView = expandedFilterView } visible: opacity > 0 @@ -566,11 +569,11 @@ Binding { target: innerAlbumGridView - property: 'filterState' - value: persistentSettings.filterState + property: 'expandedFilterView' + value: persistentSettings.expandedFilterView } - onFilterViewChanged: persistentSettings.filterState = filterState + onFilterViewChanged: persistentSettings.expandedFilterView = expandedFilterView } } @@ -600,13 +603,15 @@ } onGoBack: stackView.pop() + expandedFilterView: true + Binding { target: albumGridView - property: 'filterState' - value: persistentSettings.filterState + property: 'expandedFilterView' + value: persistentSettings.expandedFilterView } - onFilterViewChanged: persistentSettings.filterState = filterState + onFilterViewChanged: persistentSettings.expandedFilterView = expandedFilterView } } } diff --git a/src/qml/ElisaMainWindow.qml b/src/qml/ElisaMainWindow.qml --- a/src/qml/ElisaMainWindow.qml +++ b/src/qml/ElisaMainWindow.qml @@ -44,7 +44,19 @@ title: i18n("Elisa") property var goBackAction: elisa.action("go_back") + property var findAction: elisa.action("edit_find") + Controls1.Action { + shortcut: findAction.shortcut + onTriggered: { + if ( persistentSettings.expandedFilterView == true) + { + persistentSettings.expandedFilterView = false + } else { + persistentSettings.expandedFilterView = true + } + } + } Controls1.Action { shortcut: goBackAction.shortcut onTriggered: contentView.goBack() @@ -87,7 +99,7 @@ property double playControlItemVolume : 100.0 property bool playControlItemMuted : false - property string filterState + property bool expandedFilterView: false } diff --git a/src/qml/GridBrowserView.qml b/src/qml/GridBrowserView.qml --- a/src/qml/GridBrowserView.qml +++ b/src/qml/GridBrowserView.qml @@ -36,11 +36,11 @@ property alias contentModel: contentDirectoryView.model property alias showRating: navigationBar.showRating property bool delegateDisplaySecondaryText: true - property alias filterState: navigationBar.state + property alias expandedFilterView: navigationBar.expandedFilterView signal open(var innerMainTitle, var innerSecondaryTitle, var innerImage, var databaseId) signal goBack() - signal filterViewChanged(string filterState) + signal filterViewChanged(bool expandedFilterView) SystemPalette { id: myPalette @@ -87,7 +87,7 @@ onGoBack: gridView.goBack() - onFilterViewChanged: gridView.filterViewChanged(filterState) + onFilterViewChanged: gridView.filterViewChanged(expandedFilterView) } Rectangle { diff --git a/src/qml/MediaAlbumView.qml b/src/qml/MediaAlbumView.qml --- a/src/qml/MediaAlbumView.qml +++ b/src/qml/MediaAlbumView.qml @@ -31,13 +31,13 @@ property var artistName property var albumArtUrl property bool isSingleDiscAlbum - property alias filterState: navigationBar.state + property alias expandedFilterView: navigationBar.expandedFilterView property var albumId property alias contentModel: contentDirectoryView.model signal showArtist(var name) signal goBack(); - signal filterViewChanged(string filterState) + signal filterViewChanged(bool expandedFilterView) SystemPalette { id: myPalette @@ -81,7 +81,7 @@ onGoBack: topListing.goBack() - onFilterViewChanged: topListing.filterViewChanged(filterState) + onFilterViewChanged: topListing.filterViewChanged(expandedFilterView) onShowArtist: topListing.showArtist(topListing.contentModel.sourceModel.author) diff --git a/src/qml/MediaAllTracksView.qml b/src/qml/MediaAllTracksView.qml --- a/src/qml/MediaAllTracksView.qml +++ b/src/qml/MediaAllTracksView.qml @@ -31,9 +31,9 @@ property var stackView property alias contentModel: contentDirectoryView.model - property alias filterState: navigationBar.state + property alias expandedFilterView: navigationBar.expandedFilterView - signal filterViewChanged(string filterState) + signal filterViewChanged(bool expandedFilterView) SystemPalette { id: myPalette @@ -76,7 +76,7 @@ onEnqueue: contentModel.enqueueToPlayList() - onFilterViewChanged: rootElement.filterViewChanged(filterState) + onFilterViewChanged: rootElement.filterViewChanged(expandedFilterView) onReplaceAndPlay: contentModel.replaceAndPlayOfPlayList() } diff --git a/src/qml/NavigationActionBar.qml b/src/qml/NavigationActionBar.qml --- a/src/qml/NavigationActionBar.qml +++ b/src/qml/NavigationActionBar.qml @@ -36,12 +36,13 @@ property alias filterText: filterTextInput.text property alias filterRating: ratingFilter.starRating property bool enableGoBack: true + property bool expandedFilterView: false signal enqueue(); signal replaceAndPlay(); signal goBack(); signal showArtist(); - signal filterViewChanged(string filterState); + signal filterViewChanged(bool expandedFilterView); Controls1.Action { id: goPreviousAction @@ -52,12 +53,9 @@ Controls1.Action { id: showFilterAction - text: navigationBar.state === "" ? i18nc("Show filters in the navigation bar", "Show Search Options") : i18nc("Hide filters in the navigation bar", "Hide Search Options") - iconName: navigationBar.state === "" ? "go-down-search" : "go-up-search" - onTriggered: { - navigationBar.state === "" ? navigationBar.state = 'expanded' : navigationBar.state = "" - filterViewChanged(navigationBar.state) - } + text: !navigationBar.expandedFilterView ? i18nc("Show filters in the navigation bar", "Show Search Options") : i18nc("Hide filters in the navigation bar", "Hide Search Options") + iconName: !navigationBar.expandedFilterView ? "go-down-search" : "go-up-search" + onTriggered: filterViewChanged(!navigationBar.expandedFilterView) } ColumnLayout { @@ -325,7 +323,8 @@ states: [ State { - name: "" + name: 'collapsed' + when: !expandedFilterView PropertyChanges { target: navigationBar height: elisaTheme.navigationBarHeight @@ -337,6 +336,7 @@ }, State { name: 'expanded' + when: expandedFilterView PropertyChanges { target: navigationBar height: elisaTheme.navigationBarHeight + elisaTheme.navigationBarFilterHeight @@ -348,6 +348,7 @@ } ] transitions: Transition { + from: "expanded,collapsed" PropertyAnimation { properties: "height" easing.type: Easing.Linear