Major changes
[quicknewsreader] / qml / QuickNewsReader / content / view / NewsDetail.qml
index da55341..295b440 100644 (file)
@@ -25,11 +25,11 @@ Item {
         Item {
             x: 0; y: 0
             width: newsDetailRect.width
-            height: column.height
+            height: column.height + 10
 
             Column {
                 id: column
-                x: 0; y: 0
+                x: 10; y: 10
                 width: parent.width - 20
 
                 Row {
@@ -50,6 +50,7 @@ Item {
                 Text {
                     id: detailText
                     text: htmlcontent; width: newsDetailRect.width - 20; wrapMode: Text.WordWrap
+                    horizontalAlignment: Text.AlignJustify;
                     font.family: "Helvetica"
                 }
             }
@@ -60,19 +61,19 @@ Item {
                 onClicked: {
                     var currentSourceDepth = currentSource.listModels[componentDepth-1].sourceDepth
 
-                    // here we remove everything in viewsModel after index "currentSourceDepth"
-                    while(window.windowViewsModel.count>currentSourceDepth+1)
-                        window.windowViewsModel.remove(window.windowViewsModel.count-1)
+                    if (listSourceModel[window.currentSourceIndex].listViews.length >= currentSourceDepth+1)
+                    {
+                        // here we remove everything in viewsModel after index "currentSourceDepth"
+                        while(window.windowViewsModel.count>currentSourceDepth+1)
+                            window.windowViewsModel.remove(window.windowViewsModel.count-1)
 
-                    var path = listSourceModel[window.currentSourceIndex].currentPath
-                    path[currentSourceDepth] = index
-                    listSourceModel[window.currentSourceIndex].currentPath = path
+                        var path = listSourceModel[window.currentSourceIndex].currentPath
+                        path[currentSourceDepth] = index
+                        listSourceModel[window.currentSourceIndex].currentPath = path.slice(0,currentSourceDepth+1)
 
-                    window.windowViewsModel.append({ component: listSourceModel[window.currentSourceIndex].listViews[currentSourceDepth].viewComponent,
-                                                     componentId: listSourceModel[window.currentSourceIndex].listViews[currentSourceDepth].viewId,
-                                                     componentDepth: currentSourceDepth+1 })
-
-                    window.windowViewsList.currentIndex = currentSourceDepth+1;
+                        window.windowViewsModel.append({ component: listSourceModel[window.currentSourceIndex].listViews[currentSourceDepth].viewComponent,
+                                                         componentDepth: currentSourceDepth+1 })
+                    }
                 }
             }
         }