diff --git a/discover/qml/AboutPage.qml b/discover/qml/AboutPage.qml index 37342c47..5d691517 100644 --- a/discover/qml/AboutPage.qml +++ b/discover/qml/AboutPage.qml @@ -1,30 +1,38 @@ /* * Copyright (C) 2018 Aleix Pol Gonzalez * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library/Lesser General Public License * version 2, or (at your option) any later version, as published by the * Free Software Foundation * * 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 Library/Lesser General Public * License along with this program; if not, write to the * Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import QtQml 2.1 import org.kde.kirigami 2.6 as Kirigami Kirigami.AboutPage { - contextualActions: [ - KirigamiActionBridge { action: app.action("help_report_bug") } - ] + actions.main: Kirigami.Action { + function removeAmpersand(text) { + return text.replace("&", ""); + } + + readonly property QtObject action: app.action("help_report_bug") + text: removeAmpersand(action.text) + enabled: action.enabled + onTriggered: action.trigger() + icon.name: app.iconName(action.icon) + } aboutData: discoverAboutData } diff --git a/discover/qml/ActionBridge.qml b/discover/qml/ActionBridge.qml deleted file mode 100644 index 2bb55621..00000000 --- a/discover/qml/ActionBridge.qml +++ /dev/null @@ -1,38 +0,0 @@ -/*************************************************************************** - * 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 QtQuick.Controls 2.3 - -Action -{ - default property QtObject action: null - - function removeAmpersand(text) { - return text.replace("&", ""); - } - text: action ? removeAmpersand(action.text) : "" - checked: action && action.checked - enabled: action && action.enabled - icon.name: action ? app.iconName(action.icon) : "" - shortcut: action ? action.shortcut : undefined - - onTriggered: action.trigger() -} diff --git a/discover/qml/InstallApplicationButton.qml b/discover/qml/InstallApplicationButton.qml index 9c0727ef..6a426278 100644 --- a/discover/qml/InstallApplicationButton.qml +++ b/discover/qml/InstallApplicationButton.qml @@ -1,73 +1,70 @@ import QtQuick 2.1 import QtQuick.Controls 2.3 import QtQuick.Layouts 1.1 import org.kde.discover 2.0 import org.kde.kirigami 2.0 as Kirigami ConditionalLoader { id: root property alias application: listener.resource readonly property alias isActive: listener.isActive readonly property alias progress: listener.progress readonly property alias listener: listener readonly property string text: !application.isInstalled ? i18n("Install") : i18n("Remove") property Component additionalItem: null TransactionListener { id: listener } - readonly property QtObject action: Kirigami.Action { + readonly property Kirigami.Action action: Kirigami.Action { text: root.text icon { name: application.isInstalled ? "trash-empty" : "cloud-download" color: !enabled ? Kirigami.Theme.backgroundColor : !listener.isActive ? (application.isInstalled ? Kirigami.Theme.negativeTextColor : Kirigami.Theme.positiveTextColor) : Kirigami.Theme.backgroundColor } enabled: !listener.isActive && application.state != AbstractResource.Broken onTriggered: root.click() } - readonly property QtObject cancelAction: KirigamiActionBridge { - Action { - id: cancelQQCAction - text: i18n("Cancel") - icon.name: "dialog-cancel" - enabled: listener.isCancellable - onTriggered: listener.cancel() - } + readonly property Kirigami.Action cancelAction: Kirigami.Action { + text: i18n("Cancel") + icon.name: "dialog-cancel" + enabled: listener.isCancellable + onTriggered: listener.cancel() visible: listener.isActive } function click() { if (!isActive) { if(application.isInstalled) ResourcesModel.removeApplication(application); else ResourcesModel.installApplication(application); } else { console.warn("trying to un/install but resource still active", application.name) } } condition: listener.isActive componentTrue: RowLayout { ToolButton { Layout.fillHeight: true - action: cancelQQCAction + action: root.cancelAction } LabelBackground { Layout.fillWidth: true text: listener.statusText progress: listener.progress/100 } } componentFalse: Button { enabled: application.state != AbstractResource.Broken text: root.text focus: true onClicked: root.click() } } diff --git a/discover/qml/KirigamiActionBridge.qml b/discover/qml/KirigamiActionBridge.qml deleted file mode 100644 index e1be43d1..00000000 --- a/discover/qml/KirigamiActionBridge.qml +++ /dev/null @@ -1,39 +0,0 @@ -/*************************************************************************** - * 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 -{ - default 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/resources.qrc b/discover/resources.qrc index b93bd293..392e341d 100644 --- a/discover/resources.qrc +++ b/discover/resources.qrc @@ -1,39 +1,37 @@ qml/TopLevelPageData.qml qml/ApplicationsListPage.qml qml/ApplicationPage.qml qml/ReviewsPage.qml qml/AddonsView.qml qml/ApplicationDelegate.qml qml/InstallApplicationButton.qml qml/Rating.qml qml/UpdatesPage.qml qml/ReviewDialog.qml qml/ProgressView.qml qml/BrowsingPage.qml qml/InstalledPage.qml qml/SearchPage.qml qml/SourcesPage.qml qml/ReviewDelegate.qml qml/AddSourceDialog.qml qml/ConditionalLoader.qml qml/ConditionalObject.qml qml/ApplicationScreenshots.qml qml/LabelBackground.qml - qml/ActionBridge.qml - qml/KirigamiActionBridge.qml qml/DiscoverPage.qml qml/DiscoverWindow.qml qml/DiscoverDrawer.qml qml/ActionListItem.qml qml/LoadingPage.qml qml/SearchField.qml qml/Shadow.qml qml/DiscoverPopup.qml qml/AboutPage.qml qml/navigation.js