Automatically switch to the next view
[quicknewsreader] / qml / QuickNewsReader / content / view / NewsDetail.qml
1 import QtQuick 1.0
2 //import QtWebKit 1.0
3
4 Item {
5     id: newsDetailRect
6     width: window.width; height: window.height
7
8     function getNewsModelItem(prop)
9     {
10         var newsIndex = listSourceModel[window.currentSourceIndex].currentPath[componentDepth-1]
11
12         if( typeof currentSource.listModels[componentDepth-1] != "undefined" )
13             if( typeof currentSource.listModels[componentDepth-1].get(newsIndex) != "undefined" )
14                 if( typeof currentSource.listModels[componentDepth-1].get(newsIndex)[prop] != "undefined" )
15                     return currentSource.listModels[componentDepth-1].get(newsIndex)[prop]
16
17         return ""
18     }
19
20     property string urllink: getNewsModelItem('link')
21     property string htmlcontent: getNewsModelItem('detailedContent')
22     property string title: getNewsModelItem('title')
23     property string image: getNewsModelItem('image')
24
25     VisualItemModel {
26         id: itemModel
27
28         Column {
29             id: column
30             x: 10; y: 10
31             width: newsDetailRect.width - 20
32
33             Row {
34                 spacing: 5
35
36                 Image {
37                     id: detailImage
38                     source: image
39                 }
40
41                 Text {
42                     text: title; width: column.width - detailImage.width - 10; wrapMode: Text.WordWrap
43                     font { bold: true; family: "Helvetica"; pointSize: 16 }
44                 }
45             }
46
47             Text {
48                 id: detailText
49                 text: htmlcontent; width: newsDetailRect.width - 20; wrapMode: Text.WordWrap
50                 font.family: "Helvetica"
51             }
52         }
53     }
54     ListView {
55         id: itemListView
56         anchors.fill: newsDetailRect
57         model: itemModel
58     }
59     ScrollBar { scrollArea: itemListView; height: itemListView.height; width: 8; anchors.right: itemListView.right }
60 /*
61     WebView {
62         id: newsDetailWebView
63         anchors.fill: parent
64         html: htmlcontent
65         url: urllink
66         preferredWidth: window.width
67         preferredHeight: window.height
68     }
69 */
70 }