Settings dialog infrastructure
[quicknewsreader] / qml / QuickNewsReader / content / view / NewsComments.qml
diff --git a/qml/QuickNewsReader/content/view/NewsComments.qml b/qml/QuickNewsReader/content/view/NewsComments.qml
new file mode 100644 (file)
index 0000000..3da859c
--- /dev/null
@@ -0,0 +1,61 @@
+import QtQuick 1.0
+import QtWebKit 1.0
+
+Item {
+    id: newsCommentsRect
+    width: window.width; height: window.height
+
+    function getNewsModelItem(prop)
+    {
+        if( typeof currentSource.listModels[componentDepth-1] != "undefined" )
+            if( typeof currentSource.listModels[componentDepth-1][prop] != "undefined" )
+                return currentSource.listModels[componentDepth-1][prop]
+
+        return ""
+    }
+
+    property string commentURL: getNewsModelItem('commentURL')
+    property string title: getNewsModelItem('title')
+    property string image: getNewsModelItem('image')
+
+    VisualItemModel {
+        id: itemModel
+
+        Column {
+            id: column
+            x: 0; y: 0
+            width: newsCommentsRect.width
+//            height: newsCommentsRect.height
+
+            Row {
+                id: titleRow
+                spacing: 5
+
+                Image {
+                    id: detailImage
+                    source: image
+                }
+
+                Text {
+                    anchors.verticalCenter: detailImage.verticalCenter
+                    text: title; width: column.width - detailImage.width - 10; wrapMode: Text.WordWrap
+                    font { bold: true; family: "Helvetica"; pointSize: 16 }
+                }
+            }
+
+            WebView {
+                id: newsCommentsWebView
+                width: newsCommentsRect.width
+                url: commentURL
+                preferredWidth: window.width
+//                preferredHeight: parent.height - titleRow.height
+            }
+        }
+    }
+    ListView {
+        id: itemListView
+        anchors.fill: newsCommentsRect
+        model: itemModel
+    }
+    ScrollBar { scrollArea: itemListView; height: itemListView.height; width: 8; anchors.right: itemListView.right }
+}