From b78347b90c2b7760da419f93d98b9adfffa211dd Mon Sep 17 00:00:00 2001 From: Frederick Yin Date: Thu, 14 Mar 2024 08:51:57 -0400 Subject: Port to KF6 --- contents/ui/ActivityView.qml | 25 ++++++++++++------------ contents/ui/configCanvas.qml | 2 +- contents/ui/configGeneral.qml | 2 +- contents/ui/main.qml | 45 +++++++++++++++++++++---------------------- 4 files changed, 36 insertions(+), 38 deletions(-) (limited to 'contents/ui') diff --git a/contents/ui/ActivityView.qml b/contents/ui/ActivityView.qml index a1569aa..8ee1718 100644 --- a/contents/ui/ActivityView.qml +++ b/contents/ui/ActivityView.qml @@ -2,17 +2,16 @@ import QtQuick 2.15 import QtQuick.Layouts 1.15 import QtQuick.Controls 2.15 -import org.kde.plasma.plasmoid 2.0 -import org.kde.plasma.core 2.0 as PlasmaCore -import org.kde.plasma.components 2.0 as PlasmaComponents -import org.kde.plasma.components 3.0 as PlasmaComponents3 -import org.kde.plasma.extras 2.0 as PlasmaExtras +import org.kde.plasma.plasmoid +import org.kde.plasma.core as PlasmaCore +import org.kde.plasma.components as PlasmaComponents3 +import org.kde.plasma.extras as PlasmaExtras +import org.kde.kirigami as Kirigami import "activity.js" as Activity // container for one single activity -// TODO: port to PlasmaComponents3 before release of KF6 -PlasmaComponents.ListItem { +PlasmaExtras.ListItem { id: activityItem separatorVisible: false enabled: true // enable mouse event handling @@ -22,7 +21,7 @@ PlasmaComponents.ListItem { width: (type == "announcement" ? announcementsListView : assignmentsListView).width - - PlasmaCore.Units.gridUnit // HACK: clearance for scrollbar + - Kirigami.Units.gridUnit // HACK: clearance for scrollbar Layout.fillWidth: true RowLayout { // "finished" checkbox and activity title @@ -104,8 +103,8 @@ PlasmaComponents.ListItem { important = !important activityLabel.font.bold = important activityLabel.color = important - ? PlasmaCore.Theme.negativeTextColor - : PlasmaCore.Theme.textColor + ? Kirigami.Theme.negativeTextColor + : Kirigami.Theme.textColor const configKeys = { announcement: "importantAnnouncements", @@ -114,7 +113,7 @@ PlasmaComponents.ListItem { let importantActivities = plasmoid.configuration[configKeys[type]] const activityIdStr = activityId.toString() - + if (important) { if (!importantActivities.includes(activityIdStr)) { importantActivities.push(activityIdStr) @@ -133,11 +132,11 @@ PlasmaComponents.ListItem { } // announcement message - PlasmaExtras.Paragraph { + PlasmaComponents3.Label { Layout.fillWidth: true visible: expanded text: message - horizontalAlignment: PlasmaExtras.Paragraph.AlignLeft + horizontalAlignment: Text.AlignLeft } PlasmaComponents3.Button { diff --git a/contents/ui/configCanvas.qml b/contents/ui/configCanvas.qml index 26f611e..25ea9d0 100644 --- a/contents/ui/configCanvas.qml +++ b/contents/ui/configCanvas.qml @@ -1,7 +1,7 @@ import QtQuick 2.15 import QtQuick.Controls 2.15 import QtQuick.Layouts 1.15 -import org.kde.kirigami 2.5 as Kirigami +import org.kde.kirigami as Kirigami Kirigami.FormLayout { property alias cfg_canvasUrl: canvasUrl.text diff --git a/contents/ui/configGeneral.qml b/contents/ui/configGeneral.qml index b6cd22a..90a2c30 100644 --- a/contents/ui/configGeneral.qml +++ b/contents/ui/configGeneral.qml @@ -1,7 +1,7 @@ import QtQuick 2.15 import QtQuick.Controls 2.15 import QtQuick.Layouts 1.15 -import org.kde.kirigami 2.5 as Kirigami +import org.kde.kirigami as Kirigami Kirigami.FormLayout { property alias cfg_showSubmittedAssignments: showSubmittedAssignments.checked diff --git a/contents/ui/main.qml b/contents/ui/main.qml index 4e3be19..ee8bbdd 100644 --- a/contents/ui/main.qml +++ b/contents/ui/main.qml @@ -2,19 +2,18 @@ import QtQuick 2.15 import QtQuick.Layouts 1.15 import QtQuick.Controls 2.15 -import org.kde.plasma.plasmoid 2.0 -import org.kde.plasma.core 2.0 as PlasmaCore -import org.kde.plasma.components 2.0 as PlasmaComponents -import org.kde.plasma.components 3.0 as PlasmaComponents3 -import org.kde.plasma.extras 2.0 as PlasmaExtras -import org.kde.plasma.networkmanagement 0.2 as PlasmaNM +import org.kde.plasma.plasmoid +import org.kde.plasma.core as PlasmaCore +import org.kde.plasma.components as PlasmaComponents3 +import org.kde.plasma.extras as PlasmaExtras +import org.kde.plasma.networkmanagement as PlasmaNM +import org.kde.kirigami as Kirigami import "kanvas.js" as Kanvas -// TODO: change to PlasmoidItem on KF6 -Item { - width: PlasmaCore.Units.gridUnit * 20 - height: PlasmaCore.Units.gridUnit * 40 +PlasmoidItem { + width: Kirigami.Units.gridUnit * 20 + height: Kirigami.Units.gridUnit * 40 clip: true readonly property string canvasUrl: plasmoid.configuration.canvasUrl @@ -69,8 +68,8 @@ Item { } ScrollView { - implicitHeight: PlasmaCore.Units.gridUnit * 20 - Layout.margins: PlasmaCore.Units.smallSpacing + implicitHeight: Kirigami.Units.gridUnit * 20 + Layout.margins: Kirigami.Units.smallSpacing Layout.fillWidth: true Layout.fillHeight: true ScrollBar.horizontal.policy: ScrollBar.AlwaysOff @@ -84,7 +83,7 @@ Item { PlasmaExtras.PlaceholderMessage { anchors.centerIn: parent - width: parent.width - (PlasmaCore.Units.largeSpacing * 4) + width: parent.width - (Kirigami.Units.gridUnit * 4) visible: announcementsModel.count == 0 iconName: "mail-read-symbolic" text: i18n("No announcements") @@ -115,8 +114,8 @@ Item { } ScrollView { - implicitHeight: PlasmaCore.Units.gridUnit * 20 - Layout.margins: PlasmaCore.Units.smallSpacing + implicitHeight: Kirigami.Units.gridUnit * 20 + Layout.margins: Kirigami.Units.smallSpacing Layout.fillWidth: true Layout.fillHeight: true ScrollBar.horizontal.policy: ScrollBar.AlwaysOff @@ -124,13 +123,13 @@ Item { ListView { id: assignmentsListView Layout.fillWidth: true - spacing: PlasmaCore.Units.smallSpacing + spacing: Kirigami.Units.smallSpacing delegate: ActivityView {} model: assignmentsModel PlasmaExtras.PlaceholderMessage { anchors.centerIn: parent - width: parent.width - (PlasmaCore.Units.largeSpacing * 4) + width: parent.width - (Kirigami.Units.gridUnit * 4) visible: assignmentsModel.count == 0 iconName: "mail-read-symbolic" text: i18n("No assignments") @@ -145,12 +144,12 @@ Item { onClicked: Kanvas.syncCanvas() } - PlasmaComponents3.Label { - id: offlineLabel - visible: networkStatus.networkStatus != "Connected" - text: i18n("Network disconnected") - color: PlasmaCore.Theme.negativeTextColor - } + // PlasmaComponents3.Label { + // id: offlineLabel + // visible: networkStatus.networkStatus != "Connected" + // text: i18n("Network disconnected") + // color: PlasmaCore.Theme.negativeTextColor + // } } } } -- cgit v1.2.3