aboutsummaryrefslogtreecommitdiffstats
path: root/desktop/NotificationHistory.qml
blob: 3fdb85d7a252892dc214f0dd817abe3310a12e06 (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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
// Copyright (C) 2026 Danilo M. <danix@danix.xyz>
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License version 2 as
// published by the Free Software Foundation.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.

import QtQuick

// The history ring: the last 20 dismissed or evicted notifications, newest
// first, with a clear all. Rows are inert; only clear-all removes them, since
// the daemon has no per-id history deletion.
Column {
    id: page

    spacing: 4

    Item {
        width: parent.width
        height: 28

        Text {
            anchors { left: parent.left; verticalCenter: parent.verticalCenter }
            text: Notify.history.length + " in history"
            font { family: Theme.fontFamily; pixelSize: Theme.fontSize - 4 }
            color: Theme.subtext
        }

        Text {
            id: clearBtn
            anchors { right: parent.right; verticalCenter: parent.verticalCenter }
            visible: Notify.history.length > 0
            text: "Clear all"
            font { family: Theme.fontFamily; pixelSize: Theme.fontSize - 4 }
            color: clearArea.containsMouse ? Theme.red : Theme.subtext

            MouseArea {
                id: clearArea
                anchors.fill: parent
                anchors.margins: -6
                hoverEnabled: true
                cursorShape: Qt.PointingHandCursor
                onClicked: Notify.clearHistory()
            }
        }
    }

    Repeater {
        model: Notify.history

        NotificationRow {
            required property var modelData
            width: page.width
            notification: modelData
            live: false
        }
    }

    Text {
        width: parent.width
        visible: Notify.history.length === 0
        text: "Nothing in history"
        font { family: Theme.fontFamily; pixelSize: Theme.fontSize - 4 }
        color: Theme.overlay
    }
}