123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103 |
- /****************************************************************************
- **
- ** Copyright (C) 2012 Róbert Márki
- **
- ** This file is part of Web Feeds.
- **
- ** Web Feeds 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 3 of the License, or
- ** (at your option) any later version.
- **
- ** Web Feeds 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 Web Feeds. If not, see <http://www.gnu.org/licenses/>.
- ****************************************************************************/
- import QtQuick 1.1
- import com.nokia.meego 1.0
- import com.nokia.extras 1.1
- import WebFeeds 1.0
- import "UIConstants.js" as UIConstants
- import "Utils.js" as Utils
- Page {
- id: root
- property bool contentsBusy: false
- property PageItem rootItem
- property Page parentPage
- property Component contents
- function pageForItem(item) {
- return "";
- }
- function showMessage(message) {
- serviceMessageBanner.text = message;
- serviceMessageBanner.show();
- }
- function createPageForItem(item) {
- var nextPageUrl = pageForItem(item);
- if(nextPageUrl) {
- var nextStackPage = Qt.createComponent(nextPageUrl);
- pageStack.push(nextStackPage, {parentPage: root, rootItem: item});
- }
- }
- function showContextMenuForItem(item) {
- var contextMenuItems = webFeedsApp.contextMenuItems(item);
- if(contextMenuItems.length > 0) {
- var menu = Utils.createMenu(contextMenuItems, true, item, root);
- menu.open();
- }
- }
- function changeRootItem(item) {
- if(item && (item != root.rootItem)) {
- var prevRootItem = root.rootItem;
- root.rootItem = item;
- root.rootItem.active = true;
- prevRootItem.active = false;
- }
- }
- onStatusChanged: {
- if(root.status == PageStatus.Active) {
- root.rootItem.active = true;
- }
- }
- Component.onDestruction: {
- if(root.rootItem)
- root.rootItem.active = false;
- }
- InfoBanner {
- id: serviceMessageBanner
- parent: root.pageStack ? root.pageStack.parent : root
- }
- Connections {
- target: root.rootItem
- onServiceMessage: {
- root.showMessage(message);
- }
- onAboutToBeRemovedFromParent: {
- if(root.status != PageStatus.Deactivating) {
- console.log("onAboutToBeRemovedFromParent " + root.rootItem.title);
- root.pageStack.pop(root.parentPage);
- }
- }
- }
- Loader {
- id: contentsLoader
- anchors.fill: parent
- sourceComponent: root.contents
- }
- }
|