/*** ** Copyright (C) 2012 Christophe CHAPUIS ** ** 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 QtWebKit 1.0 Item { id: newsDetailRect 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 urllink: getNewsModelItem('urllink') property string htmlcontent: getNewsModelItem('htmlcontent') property string title: getNewsModelItem('title') property string image: getNewsModelItem('image') VisualItemModel { id: itemModel Item { x: 0; y: 0 width: newsDetailRect.width height: column.height + 10 Column { id: column x: 10; y: 10 width: parent.width - 20 Row { 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 } } } Text { id: detailText text: htmlcontent; width: newsDetailRect.width - 20; wrapMode: Text.WordWrap horizontalAlignment: Text.AlignJustify; font.family: "Helvetica" } } MouseArea { anchors.fill: column onClicked: { var currentSourceDepth = currentSource.listModels[componentDepth-1].sourceDepth 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.slice(0,currentSourceDepth+1) window.windowViewsModel.append({ component: listSourceModel[window.currentSourceIndex].listViews[currentSourceDepth].viewComponent, componentDepth: currentSourceDepth+1 }) } } } } } ListView { id: itemListView anchors.fill: newsDetailRect model: itemModel } ScrollBar { scrollArea: itemListView; height: itemListView.height; width: 8; anchors.right: itemListView.right } }