diff options
Diffstat (limited to 'contents/ui/ActivityView.qml')
-rw-r--r-- | contents/ui/ActivityView.qml | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/contents/ui/ActivityView.qml b/contents/ui/ActivityView.qml index 6c58b68..6c3bb87 100644 --- a/contents/ui/ActivityView.qml +++ b/contents/ui/ActivityView.qml @@ -94,8 +94,27 @@ RowLayout { Layout.fillWidth: true PlasmaComponents3.CheckBox { id: activityCheckbox + checkState: finished ? Qt.Checked : Qt.Unchecked onToggled: () => { + finished = (checkState == Qt.Checked) activityLabel.font.strikeout = (checkState == Qt.Checked) + + const configKeys = { + announcement: "finishedAnnouncements", + assignment: "finishedAssignments", + } + + let finishedActivities = plasmoid.configuration[configKeys[type]] + if (finished) { + if (!finishedActivities.includes(activityId)) { + finishedActivities.push(activityId) + } + } else { + // remove activityId from list + finishedActivities.splice(finishedActivities.indexOf(activityId), 1) + } + // save config + plasmoid.configuration[configKeys[type]] = finishedActivities } } @@ -104,6 +123,7 @@ RowLayout { id: activityLabel text: `[${course}] ${title}` font.bold: important + font.strikeout: finished color: important ? PlasmaCore.Theme.negativeTextColor : PlasmaCore.Theme.textColor wrapMode: Text.WordWrap Layout.fillWidth: true |