Automatically switch to the next view
authorTofe <chris.chapuis+gitorious@gmail.com>
Thu, 23 Feb 2012 21:08:35 +0000 (22:08 +0100)
committerTofe <chris.chapuis+gitorious@gmail.com>
Thu, 23 Feb 2012 21:08:35 +0000 (22:08 +0100)
When an item is selected and adds a new view on the right, that new view
is made the current one automatically.

qml/QuickNewsReader/content/view/CategoryDelegate.qml
qml/QuickNewsReader/content/view/NewsDelegate.qml
qml/QuickNewsReader/content/view/NewsDetail.qml
qml/QuickNewsReader/content/view/SourceDelegate.qml
qml/QuickNewsReader/main.qml

index 16a3717..617846d 100644 (file)
@@ -89,6 +89,8 @@ Item {
             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;
         }
     }
 }
index a0db12d..82cfd63 100644 (file)
@@ -93,6 +93,8 @@ Item {
                                                  componentId: listSourceModel[window.currentSourceIndex].listViews[currentSourceDepth].viewId,
                                                  componentDepth: currentSourceDepth+1 })
 
+                window.windowViewsList.currentIndex = currentSourceDepth+1;
+
                 //newsDetailRect.webViewAction.enabled = false
            ////     sourcesRect.x -= window.width + newsRect.x
                 //newsDetailRect.webViewAction.enabled = true
index 049de65..22f60a1 100644 (file)
@@ -9,9 +9,10 @@ Item {
     {
         var newsIndex = listSourceModel[window.currentSourceIndex].currentPath[componentDepth-1]
 
-        if( typeof currentSource.listModels[componentDepth-1].get(newsIndex) != "undefined" )
-            if( typeof currentSource.listModels[componentDepth-1].get(newsIndex)[prop] != "undefined" )
-                return currentSource.listModels[componentDepth-1].get(newsIndex)[prop]
+        if( typeof currentSource.listModels[componentDepth-1] != "undefined" )
+            if( typeof currentSource.listModels[componentDepth-1].get(newsIndex) != "undefined" )
+                if( typeof currentSource.listModels[componentDepth-1].get(newsIndex)[prop] != "undefined" )
+                    return currentSource.listModels[componentDepth-1].get(newsIndex)[prop]
 
         return ""
     }
index dfb2880..e3e72e0 100644 (file)
@@ -89,6 +89,8 @@ Item {
                 listSourceModel[window.currentSourceIndex].currentPath = [index]
 
                 window.currentSourceIndex = index
+
+                window.windowViewsList.currentIndex = 1;
             }
         }
     }
index ebee529..2a72511 100644 (file)
@@ -24,6 +24,7 @@ Rectangle {
     property variant currentSource: listSourceModel[currentSourceIndex]
     property bool loading: currentSource.loading
     property ListModel windowViewsModel: viewsModel
+    property ListView windowViewsList: viewsList
 
     ListView {
         id: viewsList