Warning, /plasma/kdeplasma-addons/applets/weather/package/contents/ui/FullRepresentation.qml is written in an unsupported language. File is not indexed.
0001 /* 0002 * SPDX-FileCopyrightText: 2018 Friedrich W. H. Kossebau <kossebau@kde.org> 0003 * 0004 * SPDX-License-Identifier: GPL-2.0-or-later 0005 */ 0006 0007 import QtQuick 0008 0009 import QtQuick.Layouts 0010 import QtQuick.Controls as QQC2 0011 0012 import org.kde.plasma.plasmoid 0013 import org.kde.plasma.extras as PlasmaExtras 0014 import org.kde.plasma.core as PlasmaCore 0015 import org.kde.kirigami as Kirigami 0016 import org.kde.plasma.components as PlasmaComponents 0017 0018 import org.kde.plasma.private.weather 0019 0020 ColumnLayout { 0021 id: fullRoot 0022 0023 Layout.margins: Kirigami.Units.smallSpacing 0024 0025 property alias generalModel: topPanel.generalModel 0026 property alias observationModel: topPanel.observationModel 0027 0028 Layout.minimumWidth: Math.max(Kirigami.Units.gridUnit * 10, implicitWidth) 0029 Layout.minimumHeight: Math.max(Kirigami.Units.gridUnit * 10, implicitHeight) 0030 0031 PlasmaExtras.PlaceholderMessage { 0032 Layout.alignment: Qt.AlignVCenter | Qt.AlignHCenter 0033 Layout.margins: Kirigami.Units.gridUnit 0034 // when not in panel, a configure button is already shown for needsConfiguration 0035 visible: (root.status === Util.NeedsConfiguration) && (Plasmoid.formFactor === PlasmaCore.Types.Vertical || Plasmoid.formFactor === PlasmaCore.Types.Horizontal) 0036 iconName: "mark-location" 0037 text: i18n("Please set your location") 0038 helpfulAction: QQC2.Action { 0039 icon.name: "configure" 0040 text: i18n("Set location…") 0041 onTriggered: { 0042 Plasmoid.internalAction("configure").trigger(); 0043 } 0044 } 0045 } 0046 0047 PlasmaExtras.PlaceholderMessage { 0048 Layout.alignment: Qt.AlignVCenter | Qt.AlignHCenter 0049 Layout.margins: Kirigami.Units.gridUnit 0050 Layout.maximumWidth: Kirigami.Units.gridUnit * 20 0051 visible: root.status === Util.Timeout 0052 iconName: "network-disconnect" 0053 text: { 0054 const sourceTokens = root.weatherSource.split("|"); 0055 return i18n("Weather information retrieval for %1 timed out.", sourceTokens[2]); 0056 } 0057 } 0058 0059 TopPanel { 0060 id: topPanel 0061 visible: root.status !== Util.NeedsConfiguration && root.status !== Util.Timeout 0062 0063 Layout.fillWidth: true 0064 } 0065 0066 SwitchPanel { 0067 id: switchPanel 0068 visible: root.status === Util.Normal 0069 Layout.fillWidth: true 0070 0071 forecastViewTitle: generalModel.forecastTitle 0072 forecastViewNightRow: generalModel.forecastNightRow 0073 forecastModel: root.forecastModel 0074 detailsModel: root.detailsModel 0075 noticesModel: root.noticesModel 0076 } 0077 0078 PlasmaComponents.Label { 0079 id: sourceLabel 0080 visible: root.status === Util.Normal 0081 readonly property string creditUrl: generalModel.creditUrl 0082 0083 Layout.alignment: Qt.AlignVCenter | Qt.AlignRight 0084 0085 MouseArea { 0086 anchors.fill: parent 0087 hoverEnabled: true 0088 acceptedButtons: Qt.NoButton 0089 cursorShape: !!parent.creditUrl ? Qt.PointingHandCursor : Qt.ArrowCursor 0090 } 0091 0092 wrapMode: Text.WordWrap 0093 horizontalAlignment: Text.AlignRight 0094 font { 0095 pointSize: Kirigami.Theme.smallFont.pointSize 0096 underline: !!creditUrl 0097 } 0098 linkColor : color 0099 opacity: 0.6 0100 textFormat: Text.StyledText 0101 0102 text: { 0103 let result = generalModel.courtesy; 0104 if (creditUrl) { 0105 result = "<a href=\"" + creditUrl + "\">" + result + "</a>"; 0106 } 0107 return result; 0108 } 0109 0110 onLinkActivated: link => { 0111 Qt.openUrlExternally(link); 0112 } 0113 } 0114 }