Warning, /utilities/kweather/src/plasmoid/package/contents/ui/LocationSelector.qml is written in an unsupported language. File is not indexed.

0001 /*
0002     SPDX-FileCopyrightText: 2021 HanY <hanyoung@protonmail.com>
0003     SPDX-License-Identifier: LGPL-2.1-or-later
0004 */
0005 import QtQuick
0006 import QtQuick.Layouts
0007 import QtQuick.Controls
0008 import org.kde.plasma.plasmoid
0009 import org.kde.kirigami as Kirigami
0010 import org.kde.kirigamiaddons.delegates as Delegates
0011 
0012 Rectangle {
0013     id: container
0014 
0015     signal selected()
0016 
0017     color: Kirigami.Theme.backgroundColor
0018     radius: 8
0019 
0020     Layout.preferredWidth: Kirigami.Units.gridUnit * 12
0021     Layout.preferredHeight: Kirigami.Units.gridUnit * 12
0022 
0023     ListView {
0024         id: listView
0025 
0026         anchors.fill: parent
0027         model: plasmoid.nativeInterface.locationsInSystem()
0028 
0029         delegate: Delegates.RoundedItemDelegate {
0030             text: modelData
0031 
0032             onClicked: {
0033                 selected()
0034                 plasmoid.nativeInterface.setLocation(modelData)
0035             }
0036         }
0037 
0038         Label {
0039             anchors {
0040                 bottom: parent.bottom
0041                 bottomMargin: Kirigami.Units.gridUnit
0042             }
0043 
0044             color: Kirigami.Theme.disabledTextColor
0045             text: listView.count == 0 ? i18n("No location found on system, please add some in kweather") : i18n("Please select the location")
0046         }
0047     }
0048 }