049de6593f3ef24490bd75d3fb6460a7418d6ad9
[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].get(newsIndex) != "undefined" )
13             if( typeof currentSource.listModels[componentDepth-1].get(newsIndex)[prop] != "undefined" )
14                 return currentSource.listModels[componentDepth-1].get(newsIndex)[prop]
15
16         return ""
17     }
18
19     property string urllink: getNewsModelItem('link')
20     property string htmlcontent: getNewsModelItem('detailedContent')
21     property string title: getNewsModelItem('title')
22     property string image: getNewsModelItem('image')
23
24     VisualItemModel {
25         id: itemModel
26
27         Column {
28             id: column
29             x: 10; y: 10
30             width: newsDetailRect.width - 20
31
32             Row {
33                 spacing: 5
34
35                 Image {
36                     id: detailImage
37                     source: image
38                 }
39
40                 Text {
41                     text: title; width: column.width - detailImage.width - 10; wrapMode: Text.WordWrap
42                     font { bold: true; family: "Helvetica"; pointSize: 16 }
43                 }
44             }
45
46             Text {
47                 id: detailText
48                 text: htmlcontent; width: newsDetailRect.width - 20; wrapMode: Text.WordWrap
49                 font.family: "Helvetica"
50             }
51         }
52     }
53     ListView {
54         id: itemListView
55         anchors.fill: newsDetailRect
56         model: itemModel
57     }
58     ScrollBar { scrollArea: itemListView; height: itemListView.height; width: 8; anchors.right: itemListView.right }
59 /*
60     WebView {
61         id: newsDetailWebView
62         anchors.fill: parent
63         html: htmlcontent
64         url: urllink
65         preferredWidth: window.width
66         preferredHeight: window.height
67     }
68 */
69 }