/usr/lib/x86_64-linux-gnu/qt5/qml/org/kde/kirigami.2/templates/private/PassiveNotification.qml is in qml-module-org-kde-kirigami2 5.44.0-0ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 | /*
* Copyright 2015 Marco Martin <mart@kde.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2, or
* (at your option) any later version.
*
* 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 Library General Public License for more details
*
* You should have received a copy of the GNU Library General Public
* License along with this program; if not, write to the
* Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
import QtQuick 2.5
import QtQuick.Controls 2.0 as QQC2
import QtQuick.Layouts 1.2
import QtGraphicalEffects 1.0
import org.kde.kirigami 2.2
MouseArea {
id: root
z: 9999999
width: background.width
height: background.height
opacity: 0
enabled: appearAnimation.appear
anchors {
horizontalCenter: parent.horizontalCenter
bottom: parent.bottom
bottomMargin: Units.gridUnit * 4
}
function showNotification(message, timeout, actionText, callBack) {
if (!message) {
return;
}
appearAnimation.running = false;
appearAnimation.appear = true;
appearAnimation.running = true;
if (timeout == "short") {
timer.interval = 1000;
} else if (timeout == "long") {
timer.interval = 4500;
} else if (timeout > 0) {
timer.interval = timeout;
} else {
timer.interval = 4500;
}
messageLabel.text = message ? message : "";
actionButton.text = actionText ? actionText : "";
actionButton.callBack = callBack ? callBack : "";
timer.restart();
}
function hideNotification() {
appearAnimation.running = false;
appearAnimation.appear = false;
appearAnimation.running = true;
}
onClicked: {
appearAnimation.appear = false;
appearAnimation.running = true;
}
transform: Translate {
id: transform
y: root.height
}
Timer {
id: timer
interval: 4000
onTriggered: {
appearAnimation.appear = false;
appearAnimation.running = true;
}
}
ParallelAnimation {
id: appearAnimation
property bool appear: true
NumberAnimation {
target: root
properties: "opacity"
to: appearAnimation.appear ? 1 : 0
duration: Units.longDuration
easing.type: Easing.InOutQuad
}
NumberAnimation {
target: transform
properties: "y"
to: appearAnimation.appear ? 0 : background.height
duration: Units.longDuration
easing.type: appearAnimation.appear ? Easing.OutQuad : Easing.InQuad
}
}
Item {
id: background
width: backgroundRect.width + Units.gridUnit
height: backgroundRect.height + Units.gridUnit
Rectangle {
id: backgroundRect
anchors.centerIn: parent
radius: Units.smallSpacing
color: Theme.textColor
opacity: 0.6
width: mainLayout.width + Math.round((height - mainLayout.height))
height: Math.max(mainLayout.height + Units.smallSpacing*2, Units.gridUnit*2)
}
RowLayout {
id: mainLayout
anchors.centerIn: parent
QQC2.Label {
id: messageLabel
Layout.maximumWidth: Math.min(root.parent.width - Units.largeSpacing*2, implicitWidth)
elide: Text.ElideRight
wrapMode: Text.WordWrap
maximumLineCount: 4
color: Theme.backgroundColor
}
QQC2.Button {
id: actionButton
property var callBack
visible: text != ""
onClicked: {
appearAnimation.appear = false;
appearAnimation.running = true;
if (callBack) {
callBack();
}
}
}
}
layer.enabled: true
layer.effect: DropShadow {
horizontalOffset: 0
verticalOffset: 0
radius: Units.gridUnit
samples: 32
color: Qt.rgba(0, 0, 0, 0.5)
}
}
}
|