FullRepresentation.qml 2.08 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
/*
 * Copyright 2018  Friedrich W. H. Kossebau <kossebau@kde.org>
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License as
 * published by the Free Software Foundation; either version 2 of
 * the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

18
import QtQuick 2.9
19

20
import QtQuick.Layouts 1.3
21 22

import org.kde.plasma.plasmoid 2.0
23
import org.kde.plasma.components 3.0 as PlasmaComponents
24

25
ColumnLayout {
26 27
    id: fullRoot

28
    Layout.margins: units.smallSpacing
29 30

    TopPanel {
31
        Layout.fillWidth: true
32 33 34 35

        model: plasmoid.nativeInterface.panelModel
    }

36 37
    SwitchPanel {
        Layout.fillWidth: true
38

39 40 41 42
        forecastViewTitle: plasmoid.nativeInterface.panelModel.totalDays
        forecastModel: plasmoid.nativeInterface.forecastModel
        detailsModel: plasmoid.nativeInterface.detailsModel
        noticesModel: plasmoid.nativeInterface.noticesModel
43 44 45
    }

    PlasmaComponents.Label {
46
        readonly property string creditUrl: plasmoid.nativeInterface.panelModel.creditUrl
47

48 49
        Layout.alignment: Qt.AlignVCenter | Qt.AlignRight

50 51 52 53 54 55 56 57 58
        wrapMode: Text.WordWrap
        horizontalAlignment: Text.AlignRight
        font {
            pointSize: theme.smallestFont.pointSize
            underline: !!creditUrl
        }
        linkColor : color
        opacity: 0.6
        textFormat: Text.StyledText
59

60 61 62 63 64 65 66 67 68 69 70 71 72
        text: {
            var result = plasmoid.nativeInterface.panelModel.courtesy;
            if (creditUrl) {
                result = "<a href=\"" + creditUrl + "\">" + result + "</a>";
            }
            return result;
        }

        onLinkActivated: {
            Qt.openUrlExternally(link);
        }
    }
}