Commit d435e886 authored by Aleix Pol Gonzalez's avatar Aleix Pol Gonzalez 🐧
Browse files

Use Kirgami.ToolBarApplicationHeader instead of the view headers

Summary:
Use the standard Kirigami component as header for Discover. Will need
some polishing on the kirigami component but will pay off in the long
run.

CCBUG: 385973
Supports {T7958}

Reviewers: ngraham

Subscribers: plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D10471
parent bc533aaf
......@@ -86,57 +86,21 @@ DiscoverPage {
}
}
header: QQC2.ToolBar {
anchors {
right: parent.right
left: parent.left
actions {
main: appbutton.action
right: Kirigami.Action {
visible: application.isInstalled && application.canExecute
text: application.executeLabel
icon.name: "media-playback-start"
onTriggered: application.invokeApplication()
}
}
contentItem: RowLayout {
spacing: Kirigami.Units.smallSpacing
ToolButton {
Layout.leftMargin: Kirigami.Units.smallSpacing
iconName: "draw-arrow-back"
tooltip: i18n("Back")
enabled: appInfo.sClose.enabled
onClicked: appInfo.sClose.activated()
}
Item {
Layout.fillWidth: true
}
Kirigami.Heading {
level: 3
Layout.maximumWidth: parent.width/2
text: appInfo.application.name
maximumLineCount: 1
elide: Text.ElideRight
horizontalAlignment: Text.AlignHCenter
}
Item {
Layout.fillWidth: true
}
Binding {
target: appInfo.actions
property: "main"
value: appbutton.action
}
InstallApplicationButton {
id: appbutton
Layout.rightMargin: Kirigami.Units.smallSpacing
application: appInfo.application
visible: applicationWindow().wideScreen
}
Button {
Layout.rightMargin: Kirigami.Units.smallSpacing
visible: application.isInstalled && application.canExecute
text: application.executeLabel
onClicked: application.invokeApplication()
}
}
InstallApplicationButton {
id: appbutton
Layout.rightMargin: Kirigami.Units.smallSpacing
application: appInfo.application
visible: false
}
leftPadding: Kirigami.Units.largeSpacing * (applicationWindow().wideScreen ? 2 : 1)
......@@ -146,7 +110,6 @@ DiscoverPage {
spacing: 0
RowLayout {
Kirigami.Icon {
Layout.topMargin: Kirigami.Units.smallSpacing * 2
Layout.preferredHeight: 80
Layout.preferredWidth: 80
source: appInfo.application.icon
......
......@@ -43,7 +43,7 @@ DiscoverPage {
property alias allBackends: appsModel.allBackends
property alias count: apps.count
property alias listHeader: apps.header
property Component listHeaderExtra
property alias listHeaderPositioning: apps.headerPositioning
property bool compact: page.width < 500 || !applicationWindow().wideScreen
property bool canNavigate: true
......@@ -69,13 +69,6 @@ DiscoverPage {
}
}
headerPositioning: ListView.OverlayHeader
header: CategoryDisplay {
id: header
category: appsModel.filteredCategory
search: appsModel.search
extra: page.listHeaderExtra
}
model: ResourcesProxyModel {
id: appsModel
sortRole: ResourcesProxyModel.RatingCountRole
......
......@@ -51,11 +51,6 @@ DiscoverPage
ListView {
id: browsingView
headerPositioning: ListView.OverlayHeader
header: Kirigami.ItemViewHeader {
backgroundImage.source: "qrc:/banners/coffee.jpg"
title: page.title
}
model: FeaturedModel {}
spacing: Kirigami.Units.gridUnit
currentIndex: -1
......
......@@ -4,7 +4,7 @@ import QtQuick.Controls 1.1
import QtQuick.Controls 2.1 as QQC2
import org.kde.discover 2.0
import org.kde.discover.app 1.0
import org.kde.kirigami 2.0 as Kirigami
import org.kde.kirigami 2.2 as Kirigami
import "navigation.js" as Navigation
Kirigami.ApplicationWindow
......@@ -28,7 +28,12 @@ Kirigami.ApplicationWindow
objectName: "DiscoverMainWindow"
title: leftPage ? leftPage.title : ""
header: null
header: Kirigami.ToolBarApplicationHeader {}
// header: (window.wideScreen ? desktopHeader : mobileHeader).createObject()
//
// Component { id: desktopHeader; Kirigami.ToolBarApplicationHeader {} }
// Component { id: mobileHeader; Kirigami.ApplicationHeader {} }
visible: true
minimumWidth: 300
......
......@@ -25,7 +25,7 @@ ConditionalLoader
name: application.isInstalled ? "trash-empty" : "cloud-download"
color: application.isInstalled ? Kirigami.Theme.negativeTextColor : Kirigami.Theme.positiveTextColor
}
visible: !listener.isActive && !applicationWindow().wideScreen
visible: !listener.isActive
onTriggered: root.click()
}
......
......@@ -17,13 +17,4 @@ ApplicationsListPage {
canNavigate: false
listHeader: null
header: ToolBar {
Kirigami.Heading {
anchors {
right: parent.right
rightMargin: Kirigami.Units.largeSpacing
}
text: page.title
}
}
}
/***************************************************************************
* Copyright © 2015 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 QtQml 2.0
import org.kde.kirigami 2.1 as Kirigami
Kirigami.Action
{
property QtObject action: null
function removeAmpersand(text) {
return text.replace("&", "");
}
text: action ? removeAmpersand(action.text) : "<null>"
checked: action && action.checked
enabled: action && action.enabled
tooltip: action ? action.toolTip : ""
iconName: action ? app.iconName(action.icon) : ""
shortcut: action ? action.shortcut : undefined
onTriggered: action.trigger()
}
......@@ -32,9 +32,12 @@ ApplicationsListPage {
}
}
listHeaderExtra: SearchField {
listHeaderPositioning: ListView.OverlayHeader
listHeader: SearchField {
id: searchField
width: parent.width
focus: true
z: 100
Component.onCompleted: forceActiveFocus()
Connections {
......
......@@ -21,38 +21,11 @@ DiscoverPage {
color: Kirigami.Theme.backgroundColor
}
header: QQC2.ToolBar {
Kirigami.Theme.inherit: false
Kirigami.Theme.colorSet: Kirigami.Theme.Window
anchors {
right: parent.right
left: parent.left
}
contentItem: RowLayout {
anchors {
topMargin: Kirigami.Units.smallSpacing
bottomMargin: Kirigami.Units.smallSpacing
}
Item {
Layout.fillWidth: true
}
ToolButton {
action: refreshAction
}
ToolButton {
text: i18n("Help...")
menu: Menu {
MenuItem { action: ActionBridge { action: app.action("help_contents") } }
MenuItem { action: ActionBridge { action: app.action("help_about_app") } }
MenuItem { action: ActionBridge { action: app.action("help_report_bug") } }
}
}
}
}
contextualActions: [
KirigamiActionBridge { action: app.action("help_contents") },
KirigamiActionBridge { action: app.action("help_about_app") },
KirigamiActionBridge { action: app.action("help_report_bug") }
]
mainItem: ListView {
id: sourcesView
......@@ -130,7 +103,7 @@ DiscoverPage {
actions: backendItem.backend ? backendItem.backend.actions : undefined
}
delegate: MenuItem {
action: ActionBridge { action: modelData }
action: ActionBridge { action: modelData.action }
}
onObjectAdded: {
settingsMenu.insertItem(index, object)
......
......@@ -26,6 +26,7 @@
<file>qml/LabelBackground.qml</file>
<file>qml/PageHeader.qml</file>
<file>qml/ActionBridge.qml</file>
<file>qml/KirigamiActionBridge.qml</file>
<file>qml/DiscoverSystemPalette.qml</file>
<file>qml/DiscoverPage.qml</file>
<file>qml/DiscoverWindow.qml</file>
......
Supports Markdown
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