Commit 809460f2 authored by Aleix Pol Gonzalez's avatar Aleix Pol Gonzalez 🐧

Add a search section for phones

parent d6318b0d
......@@ -28,6 +28,7 @@ Kirigami.BasicListItem {
icon: action.iconName
label: action.text
separatorVisible: false
visible: action.enabled
onClicked: {
drawer.resetMenu()
action.trigger()
......
......@@ -42,6 +42,7 @@ DiscoverPage {
property alias allBackends: appsModel.allBackends
property alias count: apps.count
property alias listHeader: apps.header
property Component listHeaderExtra
property bool compact: page.width < 500 || !applicationWindow().wideScreen
property bool canNavigate: true
......@@ -66,8 +67,10 @@ DiscoverPage {
headerPositioning: ListView.OverlayHeader
header: CategoryDisplay {
id: header
category: appsModel.filteredCategory
search: appsModel.search
extra: page.listHeaderExtra
}
model: ResourcesProxyModel {
id: appsModel
......
......@@ -31,7 +31,7 @@ Kirigami.GlobalDrawer {
property bool wideScreen: false
bannerImageSource: "qrc:/banners/banner.svg"
//make the left and bottom margins for search field the same
topPadding: -searchField.height - leftPadding
topPadding: searchField.visible ? -searchField.height - leftPadding : 0
bottomPadding: 0
resetMenuOnTriggered: false
......@@ -54,9 +54,11 @@ Kirigami.GlobalDrawer {
}
topContent: TextField {
topContent: drawer.wideScreen ? searchField : null
TextField {
id: searchField
Layout.fillWidth: true
visible: drawer.wideScreen
enabled: window.leftPage && (window.leftPage.searchFor != null || window.leftPage.hasOwnProperty("search"))
Keys.forwardTo: [window.pageStack]
......@@ -116,6 +118,9 @@ Kirigami.GlobalDrawer {
separatorVisible: false
}
ActionListItem {
action: searchAction
}
ActionListItem {
action: installedAction
}
......
......@@ -16,6 +16,7 @@ Kirigami.ApplicationWindow
//toplevels
readonly property string topBrowsingComp: ("qrc:/qml/BrowsingPage.qml")
readonly property string topInstalledComp: ("qrc:/qml/InstalledPage.qml")
readonly property string topSearchComp: ("qrc:/qml/SearchPage.qml")
readonly property string topUpdateComp: ("qrc:/qml/UpdatesPage.qml")
readonly property string topSourcesComp: ("qrc:/qml/SourcesPage.qml")
readonly property string loadingComponent: ("qrc:/qml/LoadingPage.qml")
......@@ -48,6 +49,16 @@ Kirigami.ApplicationWindow
objectName: "discover"
shortcut: "Alt+D"
}
TopLevelPageData {
id: searchAction
enabled: !window.wideScreen
iconName: "search"
text: i18n("Search")
component: topSearchComp
objectName: "discover"
shortcut: "Ctrl+F"
}
TopLevelPageData {
id: installedAction
text: i18n("Installed")
......
/***************************************************************************
* Copyright © 2017 Aleix Pol Gonzalez <aleixpol@blue-systems.com> *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License as *
* published by the Free Software Foundation; either version 2 of *
* the License or (at your option) version 3 or any later version *
* accepted by the membership of KDE e.V. (or its successor approved *
* by the membership of KDE e.V.), which shall act as a proxy *
* defined in Section 14 of version 3 of the license. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
***************************************************************************/
import QtQuick.Controls 1.1
import org.kde.discover 2.0
ApplicationsListPage {
id: page
listHeaderExtra: TextField {
focus: true
onTextChanged: page.search = text
}
}
......@@ -15,6 +15,7 @@
<file>qml/ProgressView.qml</file>
<file>qml/BrowsingPage.qml</file>
<file>qml/InstalledPage.qml</file>
<file>qml/SearchPage.qml</file>
<file>qml/Information.qml</file>
<file>qml/SourcesPage.qml</file>
<file>qml/ReviewDelegate.qml</file>
......
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