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 "Previews" as Previews
26 property int initialIndex: -1
27 property var scope: null
28 property var scopeStyle: null
30 property alias showSignatureLine: header.showSignatureLine
32 property alias open: previewListView.open
33 property alias model: previewListView.model
34 property alias currentIndex: previewListView.currentIndex
35 property alias currentItem: previewListView.currentItem
36 property alias count: previewListView.count
38 readonly property bool processing: currentItem && (!currentItem.previewModel.loaded
39 || currentItem.previewModel.processingAction)
45 objectName: "pageHeader"
47 title: root.scope ? root.scope.name : ""
49 searchEntryEnabled: false
50 scopeStyle: root.scopeStyle
52 onBackClicked: root.backClicked()
57 objectName: "listView"
64 orientation: ListView.Horizontal
65 highlightRangeMode: ListView.StrictlyEnforceRange
66 snapMode: ListView.SnapOneItem
67 boundsBehavior: Flickable.DragAndOvershootBounds
68 highlightMoveDuration: 250
69 flickDeceleration: units.gu(625)
70 maximumFlickVelocity: width * 5
73 property bool open: false
77 // Cancel any pending preview requests or actions
78 if (previewListView.currentItem && previewListView.currentItem.previewData !== undefined) {
79 previewListView.currentItem.previewData.cancelAction();
81 root.scope.cancelActivation();
87 if (count > 0 && initialIndex >= 0) {
88 currentIndex = initialIndex;
93 delegate: Previews.Preview {
95 objectName: "preview" + index
96 height: previewListView.height
97 width: previewListView.width
99 isCurrent: ListView.isCurrentItem
102 var previewStack = root.scope.preview(result);
103 return previewStack.getPreviewModel(0);
105 scopeStyle: root.scopeStyle
110 id: processingMouseArea
111 objectName: "processingMouseArea"
116 bottom: parent.bottom
119 enabled: root.processing