psa: Moved harmattand code to Qt project with sync option
[feedingit] / FeedingIt-Sync / qml / ArticleDelegate.qml
1 import QtQuick 1.0
2
3  Package {
4
5      Item {
6              id: listing;
7              Package.name: 'list'
8              //visible: wrapper.state === 'inList'
9              height: listItem.height
10              width: articleViewer.width
11
12              Item {
13                  width: parent.width; height: backRect.height + 3
14                  id: listItem
15
16                  Rectangle {
17                      id: backRect; color: settings.backColour; opacity: index % 2 ? 0.2 : 0.4;
18                      height: articleText.height + 22; width: listItem.width;
19                      y: 1
20                  }
21                  Text {
22                      id: articleText
23                      anchors.verticalCenter: backRect.verticalCenter
24                      x: 3
25                      width: listItem.width - 6;
26
27                      anchors.margins: 5
28                      verticalAlignment: Text.AlignVCenter;
29                      text: title;
30                      color: (unread=="True") ? settings.mainTextColour : settings.secondaryTextColour;
31
32                       wrapMode: Text.WordWrap; font.bold: false;
33                      font.pointSize: settings.articleListingTextSize
34                  }
35                  MouseArea { anchors.fill: listItem;
36                      onClicked: {
37                          //wrapper.state = 'inArticleDisplay';
38                          articleView.positionViewAtIndex(index, ListView.Contain);
39                          articleView.visible = true;
40                      }
41                  }
42              }
43
44      }
45
46      Item {
47          id: viewer
48          Package.name: 'article'
49          //visible: wrapper.state === 'inArticleDisplay'
50          height: articleViewer.height
51          width: articleViewer.width
52
53          Item {
54              id: flipItem;
55              width: parent.width; height: parent.height;
56
57              //property string url: (articleView.visible && Math.abs(articleView.currentIndex-index)<2) ? path: "";
58              property string html: controller.getArticle(articleViewer.feedid, articleid)
59              ArticleDisplay {
60                  zoomEnabled: articleViewer.zoomEnabled;
61                  property bool vertPanningEnabled: articleViewer.vertPanningEnabled;
62
63                  states: [ State {
64                          name: 'articleIsRead';
65                      when: articleView.visible && articleView.currentIndex === index;
66                      StateChangeScript {
67                          name: "myScript"
68                          script: {
69                              //flipItem.url=path;
70                              controller.setEntryRead(articleViewer.feedid, articleid)
71                          }
72                      }
73                      }
74                  ]
75              }
76          }
77      }
78
79 //         state: 'inList'
80 //         states: [
81 //             State {
82 //                 name: 'inList'
83 //                 ParentChange { target: wrapper; parent: listDelegate }
84 //             },
85 //             State {
86 //                 name: 'inArticleDisplay'
87 //                 ParentChange {
88 //                     target: wrapper; parent: articleDelegate
89 //                     //x: 0; y: 0; width: gridDelegate.width; height: gridDelegate.height
90 //                 }
91 //             }
92 //         ]
93
94 //         transitions: [
95 //             Transition {
96 //                 ParentAnimation {
97 //                     NumberAnimation { properties: 'x,y,width,height'; duration: 300 }
98 //                 }
99 //             }
100 //         ]
101 //     }
102  }