Readability integration - first draft
[quicknewsreader] / qml / QuickNewsReader / content / modelimpl / FavoriteFeedsSourceModel.qml
index fbbf451..922f9c3 100644 (file)
@@ -1,3 +1,21 @@
+/***
+** Copyright (C) 2012 Christophe CHAPUIS <chris.chapuis _at_ gmail _dot_ com>
+**
+** This package is free software; you can redistribute it and/or modify
+** it under the terms of the GNU General Public License as published by
+** the Free Software Foundation; either version 2 of the License, or
+** (at your option) any later version.
+**
+** This package is distributed in the hope that it will be useful,
+** but WITHOUT ANY WARRANTY; without even the implied warranty of
+** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+** GNU General Public License for more details.
+**
+** You should have received a copy of the GNU General Public License
+** along with this package; if not, write to the Free Software
+** Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
+**
+***/
 import QtQuick 1.0
 import "../modelitf"
 
@@ -5,18 +23,41 @@ SourceModel {
     name: "Favorite Feeds"
 
     listViews: [
-        { viewComponent: 'content/view/Categories.qml', viewId: 'categoriesRect' } ,
-        { viewComponent: 'content/view/News.qml', viewId: 'newsRect' }
+        { viewComponent: 'content/view/Categories.qml' } ,
+        { viewComponent: 'content/view/News.qml' },
+        { viewComponent: 'content/view/NewsDetailFromURL.qml' }
     ]
     listModels: [
         categoriesModel,
         newsModel,
+        newsModelDetail
     ]
 
+    function getNewsModelItem(prop)
+    {
+        var newsIndex = currentPath[2]
+
+        if( typeof newsModel.get(newsIndex) != "undefined" )
+            if( typeof newsModel.get(newsIndex)[prop] != "undefined" )
+                return newsModel.get(newsIndex)[prop]
+
+        return ""
+    }
+
     property variant categoriesModel: FavoriteRssFeeds { }
     property variant newsModel: RssFeedModel {
-        currentFeed: categoriesModel.get(window.currentCategoryIndex).feed
+        currentFeed: categoriesModel.get(currentPath[1]).feed
+    }
+    property variant newsModelDetail: QtObject {
+        property variant parentModel: newsModel
+        property int sourceDepth: 3
+
+        property string urllink: getNewsModelItem('link')
+        property string title: getNewsModelItem('title')
+        property string image: getNewsModelItem('image')
     }
 
     loading: newsModel.loading
+    hasSettings: true
+    settingsComponent: "FavoriteRssConfig.qml"
 }