@@ -0,0 +1,104 @@
1+/*
2+ * Copyright (C) 2014 Canonical, Ltd.
3+ *
4+ * This program is free software; you can redistribute it and/or modify
5+ * it under the terms of the GNU General Public License as published by
6+ * the Free Software Foundation; version 3.
7+ *
8+ * This program is distributed in the hope that it will be useful,
9+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
10+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11+ * GNU General Public License for more details.
12+ *
13+ * You should have received a copy of the GNU General Public License
14+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
15+ */
16+
17+import QtQuick 2.0
18+import Ubuntu.Components 1.1;
19+import Dash 0.1
20+import "../Components/ListItems" as ListItems
21+
22+Item {
23+ id: root
24+
25+ property alias model: repeater.model
26+ property var scopeStyle
27+ property bool isFavoriteFeeds: false
28+
29+ signal requestFavorite(string scopeId, bool favorite)
30+
31+ implicitHeight: childrenRect.height
32+
33+ ListItems.Header {
34+ id: header
35+ width: root.width
36+ height: units.gu(5)
37+ text: isFavoriteFeeds ? i18n.tr("Favourite Feeds") : i18n.tr("Other Subscribed Feeds")
38+ color: scopeStyle ? scopeStyle.foreground : Theme.palette.normal.baseText
39+ }
40+
41+ property var myTemplate: JSON.parse('{"card-layout":"horizontal","card-size":"small","category-layout":"grid","collapsed-rows":2}')
42+ property var myComponents: JSON.parse('{"art":{"aspect-ratio":1,"field":"art"},"title":{"field":"title"},"attributes":{}}')
43+
44+
45+ Column {
46+ anchors.top: header.bottom
47+ Repeater {
48+ id: repeater
49+
50+ delegate: Loader {
51+ asynchronous: true
52+ width: root.width
53+ sourceComponent: Item {
54+ height: units.gu(6)
55+ UbuntuShape {
56+ id: shape
57+ anchors {
58+ left: parent.left
59+ leftMargin: units.gu(1)
60+ verticalCenter: parent.verticalCenter
61+ }
62+ width: units.gu(5)
63+ height: units.gu(5)
64+ image: Image {
65+ source: model["art"] || ""
66+ cache: true
67+ fillMode: Image.PreserveAspectCrop
68+ }
69+ }
70+ Label {
71+ id: titleLabel
72+ anchors {
73+ left: shape.right
74+ leftMargin: units.gu(1)
75+ right: star.right
76+ rightMargin: units.gu(1)
77+ verticalCenter: parent.verticalCenter
78+ }
79+ text: model["title"] || ""
80+ elide: Text.ElideRight
81+ wrapMode: Text.Wrap
82+ maximumLineCount: 1
83+ verticalAlignment: Text.AlignHCenter
84+ }
85+ Icon {
86+ id: star
87+ anchors {
88+ right: parent.right
89+ rightMargin: units.gu(1)
90+ verticalCenter: parent.verticalCenter
91+ }
92+ height: units.gu(2)
93+ width: units.gu(2)
94+ source: isFavoriteFeeds ? "image://theme/starred" : "image://theme/non-starred"
95+ MouseArea {
96+ anchors.fill: parent
97+ onClicked: root.requestFavorite(model.scopeId, !isFavoriteFeeds);
98+ }
99+ }
100+ }
101+ }
102+ }
103+ }
104+}