summaryrefslogtreecommitdiff
path: root/contents/ui/AnnouncementView.qml
blob: cba1d00afe952c71c10399a65eb548df52f879c4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
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 {
            onToggled: () => {
                announcementLabel.font.strikeout = (checkState == Qt.Checked)
            }
        }

        PlasmaComponents3.Label {
            id: announcementLabel
            text: `[${course}] ${title}`
            elide: Text.ElideRight
            Layout.fillWidth: true
        }
    }

    RowLayout {
        Layout.alignment: Qt.AlignRight

        PlasmaComponents3.ToolButton {
            icon.name: "view-visible"
            onClicked: () => {
                Qt.openUrlExternally(url)
            }
        }

        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)
            }
        }
    }
}