diff options
Diffstat (limited to 'contents/ui/AnnouncementView.qml')
-rw-r--r-- | contents/ui/AnnouncementView.qml | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/contents/ui/AnnouncementView.qml b/contents/ui/AnnouncementView.qml index 95caf9e..53c78be 100644 --- a/contents/ui/AnnouncementView.qml +++ b/contents/ui/AnnouncementView.qml @@ -25,6 +25,8 @@ RowLayout { PlasmaComponents3.Label { id: announcementLabel text: `[${course}] ${title}` + font.bold: important + color: important ? PlasmaCore.Theme.negativeTextColor : PlasmaCore.Theme.textColor elide: Text.ElideRight Layout.fillWidth: true @@ -51,8 +53,20 @@ RowLayout { PlasmaComponents3.ToolButton { icon.name: "emblem-important-symbolic" onClicked: () => { - announcementLabel.font.bold = true - announcementLabel.color = PlasmaCore.Theme.negativeTextColor + important = !important + announcementLabel.font.bold = important + announcementLabel.color = important ? PlasmaCore.Theme.negativeTextColor : PlasmaCore.Theme.textColor + let importantAnnouncements = plasmoid.configuration.importantAnnouncements + if (important) { + if (!importantAnnouncements.includes(announcementId)) { + importantAnnouncements.push(announcementId) + } + } else { + // remove announcementId from list + importantAnnouncements.splice(importantAnnouncements.indexOf(announcementId), 1) + } + // save config + plasmoid.configuration.importantAnnouncements = importantAnnouncements } } |