diff --git a/discover/qml/ApplicationsListPage.qml b/discover/qml/ApplicationsListPage.qml --- a/discover/qml/ApplicationsListPage.qml +++ b/discover/qml/ApplicationsListPage.qml @@ -69,13 +69,6 @@ } } - headerPositioning: ListView.OverlayHeader - header: CategoryDisplay { - id: header - category: appsModel.filteredCategory - search: appsModel.search - extra: page.listHeaderExtra - } model: ResourcesProxyModel { id: appsModel sortRole: ResourcesProxyModel.RatingCountRole diff --git a/discover/qml/BrowsingPage.qml b/discover/qml/BrowsingPage.qml --- a/discover/qml/BrowsingPage.qml +++ b/discover/qml/BrowsingPage.qml @@ -51,11 +51,6 @@ 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 diff --git a/discover/qml/DiscoverWindow.qml b/discover/qml/DiscoverWindow.qml --- a/discover/qml/DiscoverWindow.qml +++ b/discover/qml/DiscoverWindow.qml @@ -4,7 +4,7 @@ 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,7 @@ objectName: "DiscoverMainWindow" title: leftPage ? leftPage.title : "" - header: null + header: Kirigami.ToolBarApplicationHeader {} visible: true minimumWidth: 300 diff --git a/discover/qml/InstalledPage.qml b/discover/qml/InstalledPage.qml --- a/discover/qml/InstalledPage.qml +++ b/discover/qml/InstalledPage.qml @@ -17,13 +17,4 @@ canNavigate: false listHeader: null - header: ToolBar { - Kirigami.Heading { - anchors { - right: parent.right - rightMargin: Kirigami.Units.largeSpacing - } - text: page.title - } - } } diff --git a/discover/qml/KirigamiActionBridge.qml b/discover/qml/KirigamiActionBridge.qml new file mode 100644 --- /dev/null +++ b/discover/qml/KirigamiActionBridge.qml @@ -0,0 +1,39 @@ +/*************************************************************************** + * Copyright © 2015 Aleix Pol Gonzalez * + * * + * 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 . * + ***************************************************************************/ + +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) : "" + 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() +} diff --git a/discover/qml/SourcesPage.qml b/discover/qml/SourcesPage.qml --- a/discover/qml/SourcesPage.qml +++ b/discover/qml/SourcesPage.qml @@ -21,38 +21,11 @@ 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 @@ actions: backendItem.backend ? backendItem.backend.actions : undefined } delegate: MenuItem { - action: ActionBridge { action: modelData } + action: ActionBridge { action: modelData.action } } onObjectAdded: { settingsMenu.insertItem(index, object) diff --git a/discover/resources.qrc b/discover/resources.qrc --- a/discover/resources.qrc +++ b/discover/resources.qrc @@ -26,6 +26,7 @@ qml/LabelBackground.qml qml/PageHeader.qml qml/ActionBridge.qml + qml/KirigamiActionBridge.qml qml/DiscoverSystemPalette.qml qml/DiscoverPage.qml qml/DiscoverWindow.qml