2 * Copyright (C) 2013 Canonical, Ltd.
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 3.
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 import Ubuntu.Components 0.1
20 import "../Components"
21 import "../Components/Flickables" as Flickables
22 import "Previews" as Previews
27 property int initialIndex: -1
28 property var scope: null
29 property var scopeStyle: null
31 property alias showSignatureLine: header.showSignatureLine
33 property alias open: previewListView.open
34 property alias model: previewListView.model
35 property alias currentIndex: previewListView.currentIndex
36 property alias currentItem: previewListView.currentItem
37 property alias count: previewListView.count
39 readonly property bool processing: currentItem && (!currentItem.previewModel.loaded
40 || currentItem.previewModel.processingAction)
46 objectName: "pageHeader"
48 title: root.scope ? root.scope.name : ""
50 searchEntryEnabled: false
51 scopeStyle: root.scopeStyle
53 onBackClicked: root.backClicked()
58 objectName: "listView"
65 orientation: ListView.Horizontal
66 highlightRangeMode: ListView.StrictlyEnforceRange
67 snapMode: ListView.SnapOneItem
68 boundsBehavior: Flickable.DragAndOvershootBounds
69 highlightMoveDuration: 250
72 property bool open: false
76 // Cancel any pending preview requests or actions
77 if (previewListView.currentItem && previewListView.currentItem.previewData !== undefined) {
78 previewListView.currentItem.previewData.cancelAction();
80 root.scope.cancelActivation();
86 if (count > 0 && initialIndex >= 0) {
87 currentIndex = initialIndex;
92 delegate: Previews.Preview {
94 objectName: "preview" + index
95 height: previewListView.height
96 width: previewListView.width
98 isCurrent: ListView.isCurrentItem
101 var previewStack = root.scope.preview(result);
102 return previewStack.getPreviewModel(0);
104 scopeStyle: root.scopeStyle
109 id: processingMouseArea
110 objectName: "processingMouseArea"
115 bottom: parent.bottom
118 enabled: root.processing