summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrederick Yin <fkfd@fkfd.me>2024-03-14 08:51:57 -0400
committerFrederick Yin <fkfd@fkfd.me>2024-03-14 08:51:57 -0400
commitb78347b90c2b7760da419f93d98b9adfffa211dd (patch)
tree0472e0ac69c9b80c71fc90300b20704ee6ecb84e
parentfcfda88feb1c69188245a812290bf244b8e3919b (diff)
Port to KF6
-rw-r--r--.gitignore2
-rw-r--r--README.md5
-rw-r--r--contents/ui/ActivityView.qml25
-rw-r--r--contents/ui/configCanvas.qml2
-rw-r--r--contents/ui/configGeneral.qml2
-rw-r--r--contents/ui/main.qml45
-rw-r--r--img/screenshot_0.3.0.pngbin0 -> 148677 bytes
-rw-r--r--metadata.json6
8 files changed, 42 insertions, 45 deletions
diff --git a/.gitignore b/.gitignore
index 64ff03c..c271d14 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,5 +1,5 @@
# vim
.undodir/
-
+.directory
res/
releases/
diff --git a/README.md b/README.md
index 7a3860a..2169bc5 100644
--- a/README.md
+++ b/README.md
@@ -9,7 +9,7 @@ I have not touched JavaScript in two years, so the code sucks.
Right now, it looks like this:
-![Screenshot](img/screenshot_0.1.1.png)
+![Screenshot](img/screenshot_0.3.0.png)
## Development
@@ -17,6 +17,7 @@ First obviously you need the Plasma framework. If you have zero Plasma
development experience like me, here are some useful links:
- [Techbase: Plasma 5](https://techbase.kde.org/Development/Tutorials/Plasma5)
+- [Plasma QML API](https://api.kde.org/frameworks/plasma-framework/html/index.html)
- [Developer: Plasma Widget Testing](https://develop.kde.org/docs/plasma/widget/testing/)
After you clone this repo, run `make install` to copy the plasmoid to
@@ -37,8 +38,8 @@ add the widget to your desktop it has to be configured again.
- [ ] Sort assignments by urgency
- [ ] More friendly course list in config dialog
- [ ] Ignore activity and undo ignore
-- [ ] Show announcement details
- [ ] Migrate to KF6 when it replaces KF5 (see [Porting guide](https://develop.kde.org/docs/plasma/widget/porting_kf6/))
+- [ ] Improve accessibility [with help of this article](https://carlschwan.eu/2023/07/30/debugging-the-keyboard-navigation-in-your-qml-application/)
## Contributing
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
+ // }
}
}
}
diff --git a/img/screenshot_0.3.0.png b/img/screenshot_0.3.0.png
new file mode 100644
index 0000000..d2f1d8d
--- /dev/null
+++ b/img/screenshot_0.3.0.png
Binary files differ
diff --git a/metadata.json b/metadata.json
index 8e5ed28..58f2682 100644
--- a/metadata.json
+++ b/metadata.json
@@ -17,12 +17,10 @@
"Name[zh_CN]": "Kanvas",
"Name[zh_TW]": "Kanvas",
"Icon": "institution",
- "ServiceTypes": [
- "Plasma/Applet"
- ],
- "Version": "0.2.0",
+ "Version": "0.3.0",
"Website": "https://fkfd.me/projects/kanvas/"
},
+ "KPackageStructure": "Plasma/Applet",
"X-Plasma-API": "declarativeappletscript",
"X-Plasma-MainScript": "ui/main.qml"
}