summaryrefslogtreecommitdiff
path: root/contents/ui/AnnouncementView.qml
diff options
context:
space:
mode:
authorFrederick Yin <fkfd@fkfd.me>2022-04-07 15:31:55 +0800
committerFrederick Yin <fkfd@fkfd.me>2022-04-07 15:31:55 +0800
commit5a280f20286e34319414881d84d4f024d95fc3da (patch)
tree9b47106b140447f965d1a8e2bba31c9d35af2150 /contents/ui/AnnouncementView.qml
parentb026a7f1b2920b3b9639f9b9fe30f8dc8473461d (diff)
Merge announcement/assignment views as ActivityView
Diffstat (limited to 'contents/ui/AnnouncementView.qml')
-rw-r--r--contents/ui/AnnouncementView.qml82
1 files changed, 0 insertions, 82 deletions
diff --git a/contents/ui/AnnouncementView.qml b/contents/ui/AnnouncementView.qml
deleted file mode 100644
index 53c78be..0000000
--- a/contents/ui/AnnouncementView.qml
+++ /dev/null
@@ -1,82 +0,0 @@
-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
-
-RowLayout {
- id: announcementView
- width: parent.width
- Layout.fillWidth: true
-
- RowLayout {
- Layout.fillWidth: true
- PlasmaComponents3.CheckBox {
- id: announcementCheckbox
- onToggled: () => {
- announcementLabel.font.strikeout = (checkState == Qt.Checked)
- }
- }
-
- PlasmaComponents3.Label {
- id: announcementLabel
- text: `[${course}] ${title}`
- font.bold: important
- color: important ? PlasmaCore.Theme.negativeTextColor : PlasmaCore.Theme.textColor
- elide: Text.ElideRight
- Layout.fillWidth: true
-
- MouseArea {
- anchors.fill: parent
- onClicked: () => {
- announcementCheckbox.toggle() // toggle checkbox
- announcementCheckbox.toggled() // and trigger the onToggled effects
- }
- }
- }
- }
-
- RowLayout {
- Layout.alignment: Qt.AlignRight
-
- PlasmaComponents3.ToolButton {
- icon.name: "view-visible"
- onClicked: () => {
- Qt.openUrlExternally(url)
- }
- }
-
- PlasmaComponents3.ToolButton {
- icon.name: "emblem-important-symbolic"
- onClicked: () => {
- 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
- }
- }
-
- PlasmaComponents3.ToolButton {
- icon.name: "delete"
- onClicked: () => {
- // avoid non-fatal TypeError due to announcementView.parent=null but .width=parent.width
- announcementView.width = 0
- announcementsModel.remove(index)
- }
- }
- }
-}