summaryrefslogtreecommitdiffstats
path: root/components/package/contents/ui/Notification.qml
diff options
context:
space:
mode:
Diffstat (limited to 'components/package/contents/ui/Notification.qml')
-rw-r--r--components/package/contents/ui/Notification.qml65
1 files changed, 38 insertions, 27 deletions
diff --git a/components/package/contents/ui/Notification.qml b/components/package/contents/ui/Notification.qml
index 2e01eabb..81275b02 100644
--- a/components/package/contents/ui/Notification.qml
+++ b/components/package/contents/ui/Notification.qml
@@ -4,13 +4,37 @@ import org.kde.kirigami 1.0 as Kirigami
4 4
5MouseArea { 5MouseArea {
6 id: popup 6 id: popup
7 anchors.top: parent.top 7
8 anchors.horizontalCenter: parent.horizontalCenter
9 width: Math.max(300, message.contentWidth + (Kirigami.Units.largeSpacing * 2))
10 height: Math.max(50, message.contentHeight + (Kirigami.Units.largeSpacing * 2))
11 property alias title: message.text 8 property alias title: message.text
12 property alias timeout: hideTimer.interval 9 property alias timeout: hideTimer.interval
13 property alias background: bg.color 10 property alias background: bg.color
11
12 function hide() {
13 if (hideTimer.running)
14 hideTimer.stop()
15 popup.opacity = 0.0
16 }
17
18 function show() {
19 console.warn("Trying to show the notification", title);
20 popup.opacity = 1.0
21 hideTimer.restart()
22 }
23
24 function notify(text) {
25 popup.title = text
26 bg.color = Kirigami.Theme.highlightColor
27 show()
28 }
29
30 anchors {
31 top: parent.top
32 horizontalCenter: parent.horizontalCenter
33 }
34
35 width: Math.max(300, message.contentWidth + (Kirigami.Units.largeSpacing * 2))
36 height: Math.max(50, message.contentHeight + (Kirigami.Units.largeSpacing * 2))
37
14 visible: opacity > 0 38 visible: opacity > 0
15 opacity: 0.0 39 opacity: 0.0
16 40
@@ -35,33 +59,20 @@ MouseArea {
35 onTriggered: popup.hide() 59 onTriggered: popup.hide()
36 } 60 }
37 61
38 function hide() {
39 if (hideTimer.running)
40 hideTimer.stop()
41 popup.opacity = 0.0
42 }
43
44 function show() {
45 console.warn("Trying to show the notification", title);
46 popup.opacity = 1.0
47 hideTimer.restart()
48 }
49
50 function notify(text) {
51 popup.title = text
52 bg.color = Kirigami.Theme.highlightColor
53 show()
54 }
55
56 Label { 62 Label {
57 id: message 63 id: message
58 anchors.verticalCenter: popup.verticalCenter 64
65 anchors {
66 verticalCenter: popup.verticalCenter
67 left: parent.left
68 leftMargin: Kirigami.Units.largeSpacing
69 right: parent.right
70 rightMargin: Kirigami.Units.largeSpacing
71 }
72
59 font.pixelSize: 16 73 font.pixelSize: 16
74
60 color: Kirigami.Theme.highlightedTextColor 75 color: Kirigami.Theme.highlightedTextColor
61 anchors.left: parent.left
62 anchors.leftMargin: Kirigami.Units.largeSpacing
63 anchors.right: parent.right
64 anchors.rightMargin: Kirigami.Units.largeSpacing
65 horizontalAlignment: Text.AlignHCenter 76 horizontalAlignment: Text.AlignHCenter
66 elide: Text.ElideRight 77 elide: Text.ElideRight
67 wrapMode: Text.Wrap 78 wrapMode: Text.Wrap