diff --git a/CMakeLists.txt b/CMakeLists.txt --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -23,7 +23,7 @@ include (FeatureSummary) # KDE Frameworks -set (KF5_DEP_VERSION "5.17.0") # handled by release scripts +set (KF5_DEP_VERSION "5.70.0") # handled by release scripts find_package (ECM ${KF5_DEP_VERSION} NO_MODULE) set_package_properties (ECM PROPERTIES TYPE REQUIRED DESCRIPTION "Extra CMake Modules." URL "https://projects.kde.org/projects/kdesupport/extra-cmake-modules") diff --git a/plasma/package/contents/ui/ActionItem.qml b/plasma/package/contents/ui/ActionItem.qml deleted file mode 100644 --- a/plasma/package/contents/ui/ActionItem.qml +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Copyright 2017 by Ivan Cukic - * - * 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 QtQuick 2.1 -import QtQuick.Layouts 1.1 -import org.kde.plasma.core 2.0 as PlasmaCore -import org.kde.plasma.plasmoid 2.0 -import org.kde.plasma.components 2.0 as PlasmaComponents -import org.kde.plasma.extras 2.0 as PlasmaExtras - -MouseArea { - id: vaultItem - - property alias icon: actionIcon.source - property alias text: actionText.text - - signal activated() - - hoverEnabled: true - height: units.iconSizes.medium - - onContainsMouseChanged: { - vaultItem.ListView.view.currentIndex = (containsMouse ? index : -1) - } - - PlasmaCore.IconItem { - id: actionIcon - - anchors { - left: parent.left - verticalCenter: parent.verticalCenter - margins: units.smallSpacing - } - - width: units.iconSizes.medium - height: units.iconSizes.medium - } - - PlasmaComponents.Label { - id: actionText - - anchors { - left: actionIcon.right - right: parent.right - verticalCenter: parent.verticalCenter - margins: units.smallSpacing - } - - height: undefined - elide: Text.ElideRight - } - - MouseArea { - anchors.fill: parent - onClicked: { - vaultItem.activated(); - } - } -} - diff --git a/plasma/package/contents/ui/VaultItem.qml b/plasma/package/contents/ui/VaultItem.qml --- a/plasma/package/contents/ui/VaultItem.qml +++ b/plasma/package/contents/ui/VaultItem.qml @@ -1,5 +1,6 @@ /* * Copyright 2017, 2018, 2019 by Ivan Cukic + * Copyright 2020 by Nate Graham * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as @@ -19,221 +20,51 @@ */ import QtQuick 2.1 -import QtQuick.Layouts 1.1 -import org.kde.plasma.core 2.0 as PlasmaCore +import QtQuick.Controls 2.12 + import org.kde.plasma.plasmoid 2.0 -import org.kde.plasma.components 2.0 as PlasmaComponents import org.kde.plasma.extras 2.0 as PlasmaExtras -MouseArea { - id: vaultItem - - property alias icon: vaultIcon.source - property alias name: vaultName.text - property alias message: vaultMessage.text - property string device: "" - - property bool isOpened: false - property bool isBusy: false - property bool isEnabled: false - - property bool isOfflineOnly: false - - signal itemExpanded(variant item); - - function collapse() { - actionsList.visible = false; - } - - onIsEnabledChanged: if (!isEnabled) { collapse(); } - +PlasmaExtras.ExpandableListItem { + id: expandableListItem property var vaultsModelActions: plasmoid.nativeInterface.vaultsModel.actionsModel() - hoverEnabled: true - height: units.iconSizes.medium + 2 * units.smallSpacing - + (actionsList.visible ? (actionsList.height + actionsListSpacer.height) : 0) - - onContainsMouseChanged: { - vaultItem.ListView.view.currentIndex = (containsMouse ? index : -1) - } - - PlasmaCore.IconItem { - id: vaultIcon - - anchors { - left: parent.left - top: parent.top - margins: units.smallSpacing - } - - width: units.iconSizes.medium - height: units.iconSizes.medium - - PlasmaCore.IconItem { - anchors { - left: parent.left - bottom: parent.bottom + icon: model.icon + iconEmblem: model.message.length !== 0 ? "emblem-error" : + model.isOpened ? "emblem-mounted" : + model.isOfflineOnly ? "network-disconnect" : + "" + title: model.name + subtitle: model.message + defaultActionButtonAction: Action { + icon.name: model.isOpened ? "media-eject" : "media-mount" + text: model.isOpened ? i18nd("plasmavault-kde", "Close vault") : i18nd("plasmavault-kde", "Open vault") + onTriggered: { + if (model.isOpened) { + vaultsModelActions.toggle(model.device); + } else { + vaultsModelActions.openInFileManager(model.device); } - - width: units.iconSizes.small - height: units.iconSizes.small - - visible: source != "" - - source: { - return vaultItem.message != "" ? "emblem-error" : - vaultItem.isOpened ? "emblem-mounted" : - vaultItem.isOfflineOnly ? "network-disconnect" : - "" - } - } - } - - PlasmaComponents.ToolButton { - id: buttonOpenClose - - anchors { - right: parent.right - top: parent.top - margins: units.smallSpacing - } - - width: units.iconSizes.medium - height: units.iconSizes.medium - visible: !busyIndicator.visible - - iconName: isOpened ? "media-eject" : "media-mount" - - enabled: vaultItem.isEnabled - - onClicked: { - vaultsModelActions.toggle(vaultItem.device); - collapse(); - itemExpanded(null); } } - - PlasmaComponents.BusyIndicator { - id: busyIndicator - anchors.fill: buttonOpenClose - visible: isBusy - } - - Column { - anchors { - left: vaultIcon.right - right: buttonOpenClose.left - verticalCenter: parent.verticalCenter - margins: units.smallSpacing - leftMargin: 2 * units.smallSpacing + isBusy: Plasmoid.busy + isEnabled: model.isEnabled + contextualActionsModel: [ + Action { + icon.name: "system-file-manager" + text: i18nd("plasmavault-kde", "Open with File Manager") + onTriggered: vaultsModelActions.openInFileManager(model.device); + }, + Action { + icon.name: "window-close" + text: i18nd("plasmavault-kde", "Forcefully close") + onTriggered: vaultsModelActions.forceClose(model.device); + enabled: model.isOpened + }, + Action { + icon.name: "configure" + text: i18nd("plasmavault-kde", "Configure Vault...") + onTriggered: vaultsModelActions.configure(model.device); } - - PlasmaComponents.Label { - id: vaultName - - width: parent.width - height: undefined - elide: Text.ElideRight - } - - PlasmaComponents.Label { - id: vaultMessage - - width: parent.width - height: undefined - elide: Text.ElideRight - - visible: { - return vaultMessage.text != ""; - } - } - - Item { - id: actionsListSpacer - - height: units.largeSpacing - width: parent.width - visible: actionsList.visible - } - - ListView { - id: actionsList - - height: units.iconSizes.medium * model.count - width: parent.width - visible: false - - highlight: PlasmaComponents.Highlight { - id: highlight - } - - model: actionsModel - - ListModel { - id: actionsModel - } - - delegate: ActionItem { - icon: model.icon - text: model.text - - width: parent.width - - onActivated: { - if (model.action == "file-manager") { - vaultsModelActions.openInFileManager(vaultItem.device); - - } else if (model.action == "force-close") { - vaultsModelActions.forceClose(vaultItem.device); - - } else if (model.action == "configure") { - vaultsModelActions.configure(vaultItem.device); - - } - - collapse(); - itemExpanded(null); - } - } - } - } - - MouseArea { - anchors.fill: parent - - visible: !actionsList.visible - - onClicked: { - if (!vaultItem.isEnabled) return; - - actionsList.visible = !actionsList.visible; - if (actionsList.visible) { - vaultItem.itemExpanded(vaultItem); - - actionsModel.clear(); - - actionsModel.append({ - "icon" : "system-file-manager", - "text" : i18nd("plasmavault-kde", "Open with File Manager"), - "action" : "file-manager" - }); - - if (vaultItem.message != "") { - actionsModel.append({ - "icon" : "window-close", - "text" : i18nd("plasmavault-kde", "Forcefully close "), - "action" : "force-close" - }); - } - - actionsModel.append({ - "icon" : "configure", - "text" : i18nd("plasmavault-kde", "Configure Vault..."), - "action" : "configure" - }); - } - } - } + ] } - - diff --git a/plasma/package/contents/ui/main.qml b/plasma/package/contents/ui/main.qml --- a/plasma/package/contents/ui/main.qml +++ b/plasma/package/contents/ui/main.qml @@ -56,7 +56,6 @@ ListView { id: vaultsList - model: PlasmaCore.SortFilterModel { sortRole: "name" @@ -68,28 +67,10 @@ Layout.fillWidth: true Layout.fillHeight: true - highlight: PlasmaComponents.Highlight { - id: highlight - } - - delegate: VaultItem { - icon: model.icon - name: model.name - message: model.message - isOpened: model.isOpened - isEnabled: model.isEnabled - device: model.device - isOfflineOnly: model.isOfflineOnly - - width: parent.width - - onItemExpanded: { - if (expandedItem != null) { - expandedItem.collapse(); - } - expandedItem = item; - } - } + highlight: PlasmaComponents.Highlight {} + highlightMoveDuration: units.longDuration + highlightResizeDuration: units.longDuration + delegate: VaultItem {} visible: count > 0