Warning, /plasma/plasma-mobile/kcms/cellularnetwork/ui/MessagesList.qml is written in an unsupported language. File is not indexed.

0001 // SPDX-FileCopyrightText: 2021 Devin Lin <devin@kde.org>
0002 // SPDX-License-Identifier: GPL-2.0-or-later
0003 
0004 import QtQuick 2.12
0005 import QtQuick.Layouts 1.2
0006 import QtQuick.Controls 2.12 as Controls
0007 
0008 import org.kde.kirigami 2.12 as Kirigami
0009 
0010 import cellularnetworkkcm 1.0
0011 
0012 ColumnLayout {
0013     id: root
0014     
0015     property var model
0016     property alias count: repeater.count
0017     
0018     spacing: 0
0019     visible: count > 0
0020     
0021     Repeater {
0022         id: repeater
0023         model: root.model
0024         
0025         delegate: Kirigami.InlineMessage {
0026             Layout.bottomMargin: Kirigami.Units.largeSpacing
0027             Layout.fillWidth: true
0028             visible: true
0029             text: modelData.message
0030             type: {
0031                 switch (modelData.type) {
0032                     case InlineMessage.Information: return Kirigami.MessageType.Information;
0033                     case InlineMessage.Positive: return Kirigami.MessageType.Positive;
0034                     case InlineMessage.Warning: return Kirigami.MessageType.Warning;
0035                     case InlineMessage.Error: return Kirigami.MessageType.Error;
0036                 }
0037                 return Kirigami.MessageType.Error; 
0038             }
0039             
0040             actions: [
0041                 Kirigami.Action {
0042                     icon.name: "dialog-close"
0043                     onTriggered: kcm.removeMessage(model.index)
0044                 }
0045             ]
0046         }
0047     }
0048 }