Warning, /graphics/krita/libs/libqml/plugins/components/NewsList.qml is written in an unsupported language. File is not indexed.

0001 /* This file is part of the KDE project
0002  * SPDX-FileCopyrightText: 2012 Arjen Hiemstra <ahiemstra@heimr.nl>
0003  *
0004  * SPDX-License-Identifier: GPL-2.0-or-later
0005  */
0006 
0007 import QtQuick 2.3
0008 import org.krita.sketch 1.0
0009 
0010 PageStack {
0011     id: base;
0012     clip: true;
0013 
0014     initialPage: Page {
0015         ListView {
0016             anchors.fill: parent;
0017             id: listView;
0018 
0019             delegate: ListItem {
0020                 title: model.title;
0021                 description: model.pubDate;
0022 
0023                 gradient: Gradient {
0024                     GradientStop { position: 0; color: Settings.theme.color("components/newsList/listItem/start") }
0025                     GradientStop { position: 0.4; color: Settings.theme.color("components/newsList/listItem/stop"); }
0026                 }
0027 
0028                 onClicked: {
0029                     base.push( detailsPage,
0030                               { title: model.title,
0031                                 description: model.description,
0032                                 pubDate: model.pubDate});
0033                 }
0034 
0035                 Label {
0036                     anchors.right: parent.right;
0037                     anchors.rightMargin: Constants.GridWidth * 0.5;
0038                     anchors.verticalCenter: parent.verticalCenter;
0039 
0040                     text: "More >";
0041                     color: Settings.theme.color("components/newsList/listItem/moreLink")
0042 
0043                     font.italic: true;
0044                 }
0045             }
0046 
0047             model: {
0048                 if (KritaFeedRssModel.articleCount > 0)
0049                     return KritaFeedRssModel
0050                 else {
0051                     return fallbackNewsModel
0052                 }
0053             }
0054 
0055             ScrollDecorator { }
0056         }
0057     }
0058 
0059     ListModel {
0060         id: fallbackNewsModel;
0061         ListElement {
0062             title: "Welcome to Krita Sketch 1.0";
0063             blogName: "The Krita Team";
0064             description: "<div>Krita Sketch: Painting for Pro's on the Go</div> <p>With Krita Sketch you have all the power of Krita Desktop under your fingers. Paint with a stylus, rub with your fingers, zoom, pan, erase, select, filter and add layers. Sketch, speedpaint, polish and publish! Have fun and share!</p>";
0065             link: "";
0066             pubDate: "Today!";
0067         }
0068     }
0069 
0070     Component {
0071         id: detailsPage;
0072 
0073         Page {
0074 
0075             property string title;
0076             property string pubDate;
0077             property string description;
0078 
0079             Flickable {
0080                 anchors.fill: parent;
0081                 anchors.leftMargin: Constants.DefaultMargin;
0082                 anchors.rightMargin: Constants.DefaultMargin;
0083                 anchors.bottomMargin: Constants.DefaultMargin;
0084 
0085                 contentWidth: width;
0086                 contentHeight: contents.height;
0087 
0088                 Column {
0089                     id: contents;
0090                     width: parent.width;
0091 
0092                     Item {
0093                         width: parent.width;
0094                         height: Constants.GridHeight;
0095 
0096                         Label {
0097                             anchors {
0098                                 top: parent.top;
0099                                 topMargin: Constants.DefaultMargin;
0100                             }
0101 
0102                             text: title
0103                             verticalAlignment: Text.AlignTop;
0104                             color: Settings.theme.color("components/newsList/title")
0105                         }
0106 
0107                         Label {
0108                             anchors {
0109                                 bottom: parent.bottom;
0110                                 bottomMargin: Constants.DefaultMargin;
0111                             }
0112 
0113                             text: pubDate;
0114                             font.pixelSize: Constants.SmallFontSize;
0115                             color: Settings.theme.color("components/newsList/date")
0116                             verticalAlignment: Text.AlignBottom;
0117                         }
0118 
0119 
0120                     }
0121 
0122                     Label {
0123                         width: parent.width;
0124                         height: paintedHeight;
0125 
0126                         textFormat: Text.RichText;
0127                         elide: Text.ElideNone;
0128                         wrapMode: Text.WordWrap;
0129                         horizontalAlignment: Text.AlignJustify;
0130 
0131                         text: description;
0132                         color: Settings.theme.color("components/newsList/description")
0133                     }
0134 
0135                     Label {
0136                         text: "< Back";
0137                         font.pixelSize: Constants.SmallFontSize;
0138                         color: Settings.theme.color("components/newsList/backLink")
0139                     }
0140                 }
0141 
0142                 MouseArea {
0143                     anchors.fill: parent;
0144                     onClicked: pageStack.pop();
0145                 }
0146             }
0147         }
0148     }
0149 
0150 }