10import QtQuick.Controls as QQC2
11import QtQuick.Templates as T
12import org.kde.kirigami as Kirigami
13import org.kde.kirigami.templates.private as TP
87 property int position: InlineMessage.Position.Inline
93 signal linkHovered(string link)
99 signal linkActivated(string link)
104 readonly property alias hoveredLink: label.hoveredLink
111 property int type: Kirigami.MessageType.Information
122 property TP.IconPropertiesGroup icon: TP.IconPropertiesGroup {}
134 property bool showCloseButton: false
141 property list<T.Action> actions
146 readonly
property bool animating: _animating
148 property bool _animating:
false
150 implicitHeight: visible ? (contentLayout.implicitHeight + topPadding + bottomPadding) : 0
152 padding: Kirigami.
Units.smallSpacing
154 Behavior on implicitHeight {
155 enabled: !root.visible
157 SequentialAnimation {
158 PropertyAction { targets: root; property:
"_animating"; value:
true }
159 NumberAnimation { duration: Kirigami.Units.longDuration }
165 contentLayout.opacity = 0;
169 opacity: visible ? 1 : 0
171 Behavior on opacity {
172 enabled: !root.visible
174 NumberAnimation { duration: Kirigami.Units.shortDuration }
179 contentLayout.opacity = 0;
180 }
else if (opacity === 1) {
181 contentLayout.opacity = 1;
185 onImplicitHeightChanged: {
186 height = implicitHeight;
194 property bool complete:
false
196 Behavior on opacity {
197 enabled: root.
visible && contentLayout.complete
199 SequentialAnimation {
200 NumberAnimation { duration: Kirigami.Units.shortDuration * 2 }
201 PropertyAction { targets: root; property:
"_animating"; value:
false }
207 return label.implicitHeight + actionsLayout.implicitHeight + actionsLayout.anchors.topMargin
209 return Math.max(icon.implicitHeight,
label.implicitHeight, closeButton.implicitHeight, actionsLayout.implicitHeight)
213 readonly
property real remainingWidth: width - (
215 +
label.anchors.leftMargin +
label.implicitWidth +
label.anchors.rightMargin
216 + (root.showCloseButton ? closeButton.width : 0)
218 readonly property
bool multiline: remainingWidth <= 0 || atBottom
220 readonly property
bool atBottom: (root.actions.length > 0) && (label.lineCount > 1 || actionsLayout.implicitWidth > remainingWidth)
225 width: Kirigami.Units.iconSizes.smallMedium
226 height: Kirigami.Units.iconSizes.smallMedium
228 anchors.left: parent.left
231 if (root.icon.name) {
232 return root.icon.name;
233 }
else if (root.icon.source) {
238 case Kirigami.MessageType.Positive:
239 return "emblem-positive";
240 case Kirigami.MessageType.Warning:
241 return "emblem-warning";
242 case Kirigami.MessageType.Error:
243 return "emblem-error";
245 return "emblem-information";
249 color: root.icon.color
253 when: contentLayout.atBottom
256 anchors.top: contentLayout.top
265 anchors.verticalCenter: contentLayout.verticalCenter
271 Kirigami.SelectableLabel {
276 leftMargin: Kirigami.Units.smallSpacing
277 right: root.showCloseButton ? closeButton.left : parent.right
278 rightMargin: root.showCloseButton ? Kirigami.Units.smallSpacing : 0
282 color: Kirigami.Theme.textColor
283 wrapMode: Text.WordWrap
287 verticalAlignment: Text.AlignVCenter
295 when: contentLayout.multiline
298 anchors.bottom: undefined
302 height:
label.implicitHeight
312 anchors.bottom:
label.parent.bottom
317 onLinkHovered:
link => root.linkHovered(link)
318 onLinkActivated:
link => root.linkActivated(link)
321 Kirigami.ActionToolBar {
325 actions: root.actions
326 visible: root.actions.length > 0
327 alignment:
Qt.AlignRight
331 top: contentLayout.atBottom ?
label.bottom : parent.top
332 topMargin: contentLayout.atBottom ? Kirigami.Units.largeSpacing : 0
333 right: (!contentLayout.atBottom && root.showCloseButton) ? closeButton.left : parent.
right
334 rightMargin: !contentLayout.atBottom && root.showCloseButton ? Kirigami.
Units.smallSpacing : 0
341 visible: root.showCloseButton
350 when: contentLayout.atBottom
353 anchors.top: parent.top
354 anchors.verticalCenter: undefined
361 anchors.top: undefined
362 anchors.verticalCenter: parent.verticalCenter
367 height: contentLayout.atBottom ? implicitHeight : implicitHeight
369 icon.
name:
"dialog-close"
371 onClicked: root.visible = false
374 Component.onCompleted: complete = true
KIOCORE_EXPORT CopyJob * link(const QList< QUrl > &src, const QUrl &destDir, JobFlags flags=DefaultFlags)
QString label(StandardShortcut id)
QString name(StandardShortcut id)
QTextStream & left(QTextStream &stream)
QTextStream & right(QTextStream &stream)