Warning, /plasma/kdeplasma-addons/applets/weather/package/contents/ui/NoticesView.qml is written in an unsupported language. File is not indexed.

0001 /*
0002  * SPDX-FileCopyrightText: 2018 Friedrich W. H. Kossebau <kossebau@kde.org>
0003  * SPDX-FileCopyrightText: 2023 Ismael Asensio <isma.af@gmail.com>
0004  *
0005  * SPDX-License-Identifier: GPL-2.0-or-later
0006  */
0007 
0008 import QtQuick
0009 import QtQuick.Layouts
0010 import QtQuick.Controls as QQC2
0011 
0012 import org.kde.plasma.components as PlasmaComponents
0013 import org.kde.kirigami as Kirigami
0014 
0015 ListView {
0016     id: root
0017 
0018     anchors.fill: parent
0019     boundsBehavior: Flickable.StopAtBounds
0020 
0021     delegate: RowLayout {
0022         width: ListView.view.width - (scrollBar.visible ? scrollBar.width : 0)
0023         spacing: 0
0024 
0025         PlasmaComponents.Label {
0026             Layout.alignment: Qt.AlignTop
0027             Layout.minimumWidth: Kirigami.Units.gridUnit * 5
0028             Layout.maximumWidth: Kirigami.Units.gridUnit * 10
0029             Layout.margins: Kirigami.Units.largeSpacing
0030 
0031             text: modelData.timestamp
0032             textFormat: Text.PlainText
0033             horizontalAlignment: Text.AlignRight
0034             wrapMode: Text.Wrap
0035         }
0036 
0037         Kirigami.Icon {
0038             Layout.alignment: Qt.AlignTop
0039             Layout.minimumWidth: implicitWidth
0040             implicitWidth: Kirigami.Units.iconSizes.smallMedium
0041             source: (modelData.priority >= 3) ? 'flag-red-symbolic' :
0042                     (modelData.priority >= 2) ? 'flag-yellow-symbolic' :
0043                                                 'flag-blue-symbolic'
0044         }
0045 
0046         Kirigami.SelectableLabel {
0047             Layout.fillWidth: true
0048             Layout.alignment: Qt.AlignTop
0049             Layout.minimumWidth: Kirigami.Units.gridUnit * 5
0050             Layout.margins: Kirigami.Units.largeSpacing
0051 
0052             text: modelData.description
0053             wrapMode: Text.Wrap
0054         }
0055 
0056         PlasmaComponents.ToolButton {
0057             visible: !!modelData.infoUrl
0058             Layout.alignment: Qt.AlignTop
0059             Layout.minimumWidth: implicitWidth
0060             icon.name: 'showinfo-symbolic'
0061             text: i18nc("@action:button", "Show more information")
0062             display: PlasmaComponents.ToolButton.IconOnly
0063             onClicked: {
0064                 Qt.openUrlExternally(Qt.resolvedUrl(modelData.infoUrl))
0065             }
0066         }
0067     }
0068 
0069     QQC2.ScrollBar.vertical: QQC2.ScrollBar {
0070         id: scrollBar
0071         anchors.right: parent.right
0072         visible: root.contentHeight > root.height
0073     }
0074 
0075     Kirigami.Separator {
0076         anchors {
0077             top: parent.top
0078             left: parent.left
0079             right: parent.right
0080         }
0081         visible: !root.atYBeginning
0082     }
0083 
0084     Kirigami.Separator {
0085         anchors {
0086             bottom: parent.bottom
0087             left: parent.left
0088             right: parent.right
0089         }
0090         visible: !root.atYEnd
0091     }
0092 }