From: Tofe Date: Thu, 23 Feb 2012 21:08:35 +0000 (+0100) Subject: Automatically switch to the next view X-Git-Url: http://git.maemo.org/git/?p=quicknewsreader;a=commitdiff_plain;h=d01d157c4f2340a8e52a891209159d1ad0b0f6cc Automatically switch to the next view When an item is selected and adds a new view on the right, that new view is made the current one automatically. --- diff --git a/qml/QuickNewsReader/content/view/CategoryDelegate.qml b/qml/QuickNewsReader/content/view/CategoryDelegate.qml index 16a3717..617846d 100644 --- a/qml/QuickNewsReader/content/view/CategoryDelegate.qml +++ b/qml/QuickNewsReader/content/view/CategoryDelegate.qml @@ -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; } } } diff --git a/qml/QuickNewsReader/content/view/NewsDelegate.qml b/qml/QuickNewsReader/content/view/NewsDelegate.qml index a0db12d..82cfd63 100644 --- a/qml/QuickNewsReader/content/view/NewsDelegate.qml +++ b/qml/QuickNewsReader/content/view/NewsDelegate.qml @@ -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 diff --git a/qml/QuickNewsReader/content/view/NewsDetail.qml b/qml/QuickNewsReader/content/view/NewsDetail.qml index 049de65..22f60a1 100644 --- a/qml/QuickNewsReader/content/view/NewsDetail.qml +++ b/qml/QuickNewsReader/content/view/NewsDetail.qml @@ -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 "" } diff --git a/qml/QuickNewsReader/content/view/SourceDelegate.qml b/qml/QuickNewsReader/content/view/SourceDelegate.qml index dfb2880..e3e72e0 100644 --- a/qml/QuickNewsReader/content/view/SourceDelegate.qml +++ b/qml/QuickNewsReader/content/view/SourceDelegate.qml @@ -89,6 +89,8 @@ Item { listSourceModel[window.currentSourceIndex].currentPath = [index] window.currentSourceIndex = index + + window.windowViewsList.currentIndex = 1; } } } diff --git a/qml/QuickNewsReader/main.qml b/qml/QuickNewsReader/main.qml index ebee529..2a72511 100644 --- a/qml/QuickNewsReader/main.qml +++ b/qml/QuickNewsReader/main.qml @@ -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