diff --git a/discover/qml/DiscoverDrawer.qml b/discover/qml/DiscoverDrawer.qml --- a/discover/qml/DiscoverDrawer.qml +++ b/discover/qml/DiscoverDrawer.qml @@ -29,24 +29,24 @@ Kirigami.GlobalDrawer { id: drawer + leftPadding: 0 + rightPadding: 0 + topPadding: 0 + // FIXME: Dirty workaround for 385992 width: Kirigami.Units.gridUnit * 14 property bool wideScreen: false - bannerImageSource: "qrc:/banners/banner.svg" - //make the left and bottom margins for search field the same - topPadding: drawer.wideScreen ? -toploader.height - leftPadding : 0 - bottomPadding: 0 + bannerImageSource: modal ? "qrc:/banners/banner.svg" : "" // In desktop view, it's a sidebar, and sidebars get the view BG color Kirigami.Theme.colorSet: modal ? Kirigami.Theme.Window : Kirigami.Theme.View resetMenuOnTriggered: false onBannerClicked: { Navigation.openHome(); - if (modal) - drawerOpen = false + drawerOpen = false } property string currentSearchText @@ -66,34 +66,57 @@ } topContent: ConditionalLoader { id: toploader - condition: drawer.wideScreen + condition: !modal Layout.fillWidth: true componentFalse: Item { Layout.minimumHeight: 1 } - componentTrue: SearchField { - id: searchField + componentTrue: Kirigami.AbstractApplicationHeader { + preferredHeight: 40 // Match Kirigami.ToolBarApplicationHeader, which is hardcoded to this + + RowLayout { + width: parent.width + anchors.centerIn: parent + + ToolButton { + Layout.leftMargin: Kirigami.Units.smallSpacing + + icon.name: "go-home" + onPressed: Navigation.openHome() + + ToolTip { + text: i18n("Return to the Featured page") + } + } + + SearchField { + id: searchField + + Layout.fillWidth: true + Layout.rightMargin: Kirigami.Units.smallSpacing - visible: window.leftPage && (window.leftPage.searchFor !== null || window.leftPage.hasOwnProperty("search")) + visible: window.leftPage && (window.leftPage.searchFor !== null || window.leftPage.hasOwnProperty("search")) - page: window.leftPage + page: window.leftPage - onCurrentSearchTextChanged: { - var curr = window.leftPage; + onCurrentSearchTextChanged: { + var curr = window.leftPage; - if (pageStack.depth>1) - pageStack.pop() + if (pageStack.depth>1) + pageStack.pop() - if (currentSearchText === "" && window.currentTopLevel === "" && !window.leftPage.category) { - Navigation.openHome() - } else if (!curr.hasOwnProperty("search")) { - if (currentSearchText) { - Navigation.clearStack() - Navigation.openApplicationList( { search: currentSearchText }) + if (currentSearchText === "" && window.currentTopLevel === "" && !window.leftPage.category) { + Navigation.openHome() + } else if (!curr.hasOwnProperty("search")) { + if (currentSearchText) { + Navigation.clearStack() + Navigation.openApplicationList( { search: currentSearchText }) + } + } else { + curr.search = currentSearchText; + curr.forceActiveFocus() + } } - } else { - curr.search = currentSearchText; - curr.forceActiveFocus() } } }