2 * Copyright (C) 2013-2015 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 1.3
22 import "../Components"
23 import "../Components/ListItems" as ListItems
28 readonly property bool navigationDisableParentInteractive: pageHeaderLoader.item ? pageHeaderLoader.item.bottomItem[0].disableParentInteractive : false
29 property bool forceNonInteractive: false
30 property var scope: null
31 property UnitySortFilterProxyModel categories: categoryFilter
32 property bool isCurrent: false
33 property alias moving: categoryView.moving
34 property bool hasBackAction: false
35 property bool enableHeightBehaviorOnNextCreation: false
36 property var categoryView: categoryView
37 property bool showPageHeader: true
38 readonly property alias subPageShown: subPageLoader.subPageShown
39 property int paginationCount: 0
40 property int paginationIndex: 0
41 property bool visibleToParent: false
42 property alias pageHeaderTotallyVisible: categoryView.pageHeaderTotallyVisible
43 property var holdingList: null
44 property bool wasCurrentOnMoveStart: false
46 property var scopeStyle: ScopeStyle {
47 style: scope ? scope.customizations : {}
50 readonly property bool processing: scope ? scope.searchInProgress || subPageLoader.processing : false
55 floatingSeeLess.companionBase = null;
58 function positionAtBeginning() {
59 categoryView.positionAtBeginning()
62 function showHeader() {
63 categoryView.showHeader()
66 function closePreview() {
67 subPageLoader.closeSubPage()
70 function resetSearch() {
71 if(pageHeaderLoader.item && showPageHeader)
72 pageHeaderLoader.item.resetSearch()
75 property var maybePreviewResult;
76 property int maybePreviewIndex;
77 property var maybePreviewResultsModel;
78 property int maybePreviewLimitedCategoryItemCount;
79 property string maybePreviewCategoryId;
81 function clearMaybePreviewData() {
82 scopeView.maybePreviewResult = undefined;
83 scopeView.maybePreviewIndex = -1;
84 scopeView.maybePreviewResultsModel = undefined;
85 scopeView.maybePreviewLimitedCategoryItemCount = -1;
86 scopeView.maybePreviewCategoryId = "";
89 function itemClicked(index, result, itemModel, resultsModel, limitedCategoryItemCount, categoryId) {
90 scopeView.maybePreviewResult = result;
91 scopeView.maybePreviewIndex = index;
92 scopeView.maybePreviewResultsModel = resultsModel;
93 scopeView.maybePreviewLimitedCategoryItemCount = limitedCategoryItemCount;
94 scopeView.maybePreviewCategoryId = categoryId;
96 scope.activate(result, categoryId);
99 function itemPressedAndHeld(index, result, resultsModel, limitedCategoryItemCount, categoryId) {
100 clearMaybePreviewData();
102 openPreview(result, index, resultsModel, limitedCategoryItemCount, categoryId);
105 function openPreview(result, index, resultsModel, limitedCategoryItemCount, categoryId) {
106 var previewStack = scope.preview(result, categoryId);
108 if (limitedCategoryItemCount > 0) {
109 previewLimitModel.model = resultsModel;
110 previewLimitModel.limit = limitedCategoryItemCount;
111 subPageLoader.model = previewLimitModel;
113 subPageLoader.model = resultsModel;
115 subPageLoader.initialIndex = -1;
116 subPageLoader.initialIndex = index;
117 subPageLoader.categoryId = categoryId;
118 subPageLoader.previewStack = previewStack;
119 subPageLoader.openSubPage("preview");
126 value: isCurrent && !subPageLoader.open && (Qt.application.state == Qt.ApplicationActive)
129 UnitySortFilterProxyModel {
131 model: scope ? scope.categories : null
132 dynamicSortFilter: true
133 filterRole: Categories.RoleCount
138 onIsCurrentChanged: {
139 if (!holdingList || !holdingList.moving) {
140 wasCurrentOnMoveStart = scopeView.isCurrent;
142 if (pageHeaderLoader.item && showPageHeader) {
143 pageHeaderLoader.item.resetSearch();
145 subPageLoader.closeSubPage();
149 target: scopeView.scope
150 property: "searchQuery"
151 value: pageHeaderLoader.item ? pageHeaderLoader.item.searchQuery : ""
152 when: isCurrent && showPageHeader
156 target: pageHeaderLoader.item
157 property: "searchQuery"
158 value: scopeView.scope ? scopeView.scope.searchQuery : ""
159 when: isCurrent && showPageHeader
163 target: scopeView.scope
164 onShowDash: subPageLoader.closeSubPage()
165 onHideDash: subPageLoader.closeSubPage()
166 onPreviewRequested: { // (QVariant const& result)
167 if (result === scopeView.maybePreviewResult) {
169 scopeView.maybePreviewIndex,
170 scopeView.maybePreviewResultsModel,
171 scopeView.maybePreviewLimitedCategoryItemCount,
172 scopeView.maybePreviewCategoryId);
174 clearMaybePreviewData();
183 wasCurrentOnMoveStart = scopeView.isCurrent;
190 color: scopeView.scopeStyle ? scopeView.scopeStyle.background : "transparent"
191 visible: color != "transparent"
196 objectName: "categoryListView"
197 interactive: !forceNonInteractive
199 x: subPageLoader.open ? -width : 0
201 Behavior on x { UbuntuNumberAnimation { } }
203 height: floatingSeeLess.visible ? parent.height - floatingSeeLess.height + floatingSeeLess.yOffset
205 clip: height != parent.height
207 model: scopeView.categories
208 forceNoClip: subPageLoader.open
211 property string expandedCategoryId: ""
212 property int runMaximizeAfterSizeChanges: 0
214 readonly property bool pageHeaderTotallyVisible: scopeView.showPageHeader &&
215 ((headerItemShownHeight == 0 && categoryView.contentY <= categoryView.originY) || (headerItemShownHeight == pageHeaderLoader.item.height))
217 onExpandedCategoryIdChanged: {
218 var firstCreated = firstCreatedIndex();
219 var shrinkingAny = false;
220 var shrinkHeightDifference = 0;
221 for (var i = 0; i < createdItemCount(); ++i) {
222 var baseItem = item(firstCreated + i);
223 if (baseItem.expandable) {
224 var shouldExpand = baseItem.category === expandedCategoryId;
225 if (shouldExpand != baseItem.expanded) {
227 if (!subPageLoader.open) {
228 var animateShrinking = !shouldExpand && baseItem.y + baseItem.item.collapsedHeight + baseItem.seeAllButton.height < categoryView.height;
229 var animateGrowing = shouldExpand && baseItem.y + baseItem.height < categoryView.height;
230 animate = shrinkingAny || animateShrinking || animateGrowing;
235 shrinkHeightDifference = baseItem.item.expandedHeight - baseItem.item.collapsedHeight;
238 if (shouldExpand && !subPageLoader.open) {
240 categoryView.maximizeVisibleArea(firstCreated + i, baseItem.item.expandedHeight + baseItem.seeAllButton.height);
242 // If the space that shrinking is smaller than the one we need to grow we'll call maximizeVisibleArea
243 // after the shrink/grow animation ends
244 var growHeightDifference = baseItem.item.expandedHeight - baseItem.item.collapsedHeight;
245 if (growHeightDifference > shrinkHeightDifference) {
246 runMaximizeAfterSizeChanges = 2;
248 runMaximizeAfterSizeChanges = 0;
253 baseItem.expand(shouldExpand, animate);
259 delegate: DashCategoryBase {
261 objectName: "dashCategory" + category
263 property Item seeAllButton: seeAll
265 readonly property bool expandable: {
266 if (categoryView.model.count === 1) return false;
267 if (cardTool.template && cardTool.template["collapsed-rows"] === 0) return false;
268 if (item && item.expandedHeight > item.collapsedHeight) return true;
271 property bool expanded: false
272 readonly property string category: categoryId
273 readonly property string headerLink: model.headerLink
274 readonly property var item: rendererLoader.item
276 function expand(expand, animate) {
277 heightBehaviour.enabled = animate;
283 objectName: "cardTool"
284 count: results ? results.count : 0
285 template: model.renderer
286 components: model.components
287 viewWidth: parent.width
290 onExpandableChanged: {
291 // This can happen with the VJ that doesn't know how height it will be on creation
292 // so doesn't set expandable until a bit too late for onLoaded
294 var shouldExpand = baseItem.category === categoryView.expandedCategoryId;
295 baseItem.expand(shouldExpand, false /*animate*/);
299 onHeightChanged: rendererLoader.updateRanges();
300 onYChanged: rendererLoader.updateRanges();
308 topMargin: name != "" ? 0 : units.gu(2)
314 animation: UbuntuNumberAnimation {
315 duration: UbuntuAnimation.FastDuration
318 heightBehaviour.enabled = false
319 if (categoryView.runMaximizeAfterSizeChanges > 0) {
320 categoryView.runMaximizeAfterSizeChanges--;
321 if (categoryView.runMaximizeAfterSizeChanges == 0) {
322 var firstCreated = categoryView.firstCreatedIndex();
323 for (var i = 0; i < categoryView.createdItemCount(); ++i) {
324 var baseItem = categoryView.item(firstCreated + i);
325 if (baseItem.category === categoryView.expandedCategoryId) {
326 categoryView.maximizeVisibleArea(firstCreated + i, baseItem.item.expandedHeight + baseItem.seeAllButton.height);
337 readonly property bool expanded: baseItem.expanded || !baseItem.expandable
338 height: expanded ? item.expandedHeight : item.collapsedHeight
341 switch (cardTool.categoryLayout) {
342 case "carousel": return "CardCarousel.qml";
343 case "vertical-journal": return "CardVerticalJournal.qml";
344 case "horizontal-list": return "CardHorizontalList.qml";
346 default: return "CardGrid.qml";
351 if (item.enableHeightBehavior !== undefined && item.enableHeightBehaviorOnNextCreation !== undefined) {
352 item.enableHeightBehavior = scopeView.enableHeightBehaviorOnNextCreation;
353 scopeView.enableHeightBehaviorOnNextCreation = false;
355 item.model = Qt.binding(function() { return results })
356 item.objectName = Qt.binding(function() { return categoryId })
357 item.scopeStyle = scopeView.scopeStyle;
358 if (baseItem.expandable) {
359 var shouldExpand = baseItem.category === categoryView.expandedCategoryId;
360 baseItem.expand(shouldExpand, false /*animate*/);
363 if (scope && scope.id === "clickscope") {
364 if (categoryId === "predefined" || categoryId === "local") {
366 if (scopeView.width > units.gu(45)) {
367 if (scopeView.width >= units.gu(70)) {
368 cardTool.cardWidth = units.gu(9);
370 cardTool.cardWidth = units.gu(10);
373 cardTool.artShapeSize = Qt.size(units.gu(8), units.gu(7.5));
374 item.artShapeStyle = "icon";
376 // Should be ubuntu store icon
377 item.artShapeStyle = "flat";
378 item.backgroundShapeStyle = "shadow";
381 item.cardTool = cardTool;
384 Component.onDestruction: {
385 if (item.enableHeightBehavior !== undefined && item.enableHeightBehaviorOnNextCreation !== undefined) {
386 scopeView.enableHeightBehaviorOnNextCreation = item.enableHeightBehaviorOnNextCreation;
391 target: rendererLoader.item
392 onClicked: { // (int index, var result, var item, var itemModel)
393 scopeView.itemClicked(index, result, itemModel, target.model, categoryItemCount(), baseItem.category);
396 onPressAndHold: { // (int index, var result, var itemModel)
397 scopeView.itemPressedAndHeld(index, result, target.model, categoryItemCount(), baseItem.category);
400 function categoryItemCount() {
401 var categoryItemCount = -1;
402 if (!rendererLoader.expanded && !seeAllLabel.visible && target.collapsedItemCount > 0) {
403 categoryItemCount = target.collapsedItemCount;
405 return categoryItemCount;
410 onOriginYChanged: rendererLoader.updateRanges();
411 onContentYChanged: rendererLoader.updateRanges();
412 onHeightChanged: rendererLoader.updateRanges();
413 onContentHeightChanged: rendererLoader.updateRanges();
417 onIsCurrentChanged: rendererLoader.updateRanges();
418 onVisibleToParentChanged: rendererLoader.updateRanges();
422 onMovingChanged: if (!moving) rendererLoader.updateRanges();
425 function updateRanges() {
426 // Don't want to create stress by requesting more items during scope
427 // changes so unless you're not part of the visible scopes just return.
428 // For the visible scopes we need to do some work, the previously non visible
429 // scope needs to adjust its ranges so that we define the new visible range,
430 // that still means no creation/destruction of delegates, it's just about changing
431 // the culling of the items so they are actually visible
432 if (holdingList && holdingList.moving && !scopeView.visibleToParent) {
436 if (categoryView.moving) {
437 // Do not update the range if we are overshooting up or down, since we'll come back
438 // to the stable position and delete/create items without any reason
439 if (categoryView.contentY < categoryView.originY) {
441 } else if (categoryView.contentHeight - categoryView.originY > categoryView.height &&
442 categoryView.contentY + categoryView.height > categoryView.contentHeight) {
447 if (item && item.hasOwnProperty("displayMarginBeginning")) {
448 var buffer = wasCurrentOnMoveStart ? categoryView.height * 1.5 : 0;
449 var onViewport = baseItem.y + baseItem.height > 0 &&
450 baseItem.y < categoryView.height;
451 var onBufferViewport = baseItem.y + baseItem.height > -buffer &&
452 baseItem.y < categoryView.height + buffer;
454 if (item.growsVertically) {
455 // A item view creates its delegates synchronously from
456 // -displayMarginBeginning
458 // height + displayMarginEnd
459 // Around that area it adds the cacheBuffer area where delegates are created async
461 // We adjust displayMarginBeginning and displayMarginEnd so
462 // * In non visible scopes nothing is considered visible and we set cacheBuffer
463 // so that creates the items that would be in the viewport asynchronously
464 // * For the current scope set the visible range to the viewport and then
465 // use cacheBuffer to create extra items for categoryView.height * 1.5
466 // to make scrolling nicer by mantaining a higher number of
468 // * For non current but visible scopes (i.e. when the user changes from one scope
469 // to the next, we set the visible range to the viewport so
470 // items are not culled (invisible) but still use no cacheBuffer
471 // (it will be set once the scope is the current one)
472 var displayMarginBeginning = baseItem.y + rendererLoader.anchors.topMargin;
473 displayMarginBeginning = -Math.max(-displayMarginBeginning, 0);
474 displayMarginBeginning = -Math.min(-displayMarginBeginning, baseItem.height);
475 displayMarginBeginning = Math.round(displayMarginBeginning);
476 var displayMarginEnd = -baseItem.height + seeAll.height + categoryView.height - baseItem.y;
477 displayMarginEnd = -Math.max(-displayMarginEnd, 0);
478 displayMarginEnd = -Math.min(-displayMarginEnd, baseItem.height);
479 displayMarginEnd = Math.round(displayMarginEnd);
481 if (onBufferViewport && (scopeView.isCurrent || scopeView.visibleToParent)) {
482 item.displayMarginBeginning = displayMarginBeginning;
483 item.displayMarginEnd = displayMarginEnd;
484 if (holdingList && holdingList.moving) {
485 // If we are moving we need to reset the cache buffer of the
486 // view that was not visible (i.e. !wasCurrentOnMoveStart) to 0 since
487 // otherwise the cache buffer we had set to preload the items of the
488 // visible range will trigger some item creations and we want move to
489 // be as smooth as possible meaning no need creations
490 if (!wasCurrentOnMoveStart) {
491 item.cacheBuffer = 0;
494 // Protect us against cases where the item hasn't yet been positioned
495 if (!(categoryView.contentY === 0 && baseItem.y === 0 && index !== 0)) {
496 item.cacheBuffer = categoryView.height * 1.5;
500 var visibleRange = baseItem.height + displayMarginEnd + displayMarginBeginning;
501 if (visibleRange < 0) {
502 item.displayMarginBeginning = displayMarginBeginning;
503 item.displayMarginEnd = displayMarginEnd;
504 item.cacheBuffer = 0;
506 // This should be visibleRange/2 in each of the properties
507 // but some item views still (like GridView) like creating sync delegates even if
508 // the visible range is 0 so let's make sure the visible range is negative
509 item.displayMarginBeginning = displayMarginBeginning - visibleRange;
510 item.displayMarginEnd = displayMarginEnd - visibleRange;
511 item.cacheBuffer = visibleRange;
515 if (!onBufferViewport) {
516 // If not on the buffered viewport, don't load anything
517 item.displayMarginBeginning = 0;
518 item.displayMarginEnd = -item.innerWidth;
519 item.cacheBuffer = 0;
521 if (onViewport && (scopeView.isCurrent || scopeView.visibleToParent)) {
522 // If on the buffered viewport and the viewport and the on a visible scope
523 // Set displayMargin so that cards are rendered
524 // And if not moving the parent list also give it some extra asynchronously
526 item.displayMarginBeginning = 0;
527 item.displayMarginEnd = 0;
528 if (holdingList && holdingList.moving) {
529 // If we are moving we need to reset the cache buffer of the
530 // view that was not visible (i.e. !wasCurrentOnMoveStart) to 0 since
531 // otherwise the cache buffer we had set to preload the items of the
532 // visible range will trigger some item creations and we want move to
533 // be as smooth as possible meaning no need creations
534 if (!wasCurrentOnMoveStart) {
535 item.cacheBuffer = 0;
538 item.cacheBuffer = baseItem.width * 1.5;
541 // If on the buffered viewport but either not in the real viewport
542 // or in the viewport of the non current scope, use displayMargin + cacheBuffer
543 // to render asynchronously the width of cards
544 item.displayMarginBeginning = 0;
545 item.displayMarginEnd = -item.innerWidth;
546 item.cacheBuffer = item.innerWidth;
558 top: rendererLoader.bottom
562 height: baseItem.expandable && !baseItem.headerLink ? seeAllLabel.font.pixelSize + units.gu(4) : 0
566 if (categoryView.expandedCategoryId !== baseItem.category) {
567 categoryView.expandedCategoryId = baseItem.category;
568 floatingSeeLess.companionBase = baseItem;
570 categoryView.expandedCategoryId = "";
576 text: baseItem.expanded ? i18n.tr("See less") : i18n.tr("See all")
579 verticalCenterOffset: units.gu(-0.5)
582 font.weight: Font.Bold
583 color: scopeStyle ? scopeStyle.foreground : theme.palette.normal.baseText
594 fillMode: Image.Stretch
595 source: "graphics/dash_divider_top_lightgrad.png"
600 // FIXME Should not rely on model.count but view.count, but ListViewWithPageHeader doesn't expose it yet.
601 visible: index != categoryView.model.count - 1
603 bottom: seeAll.bottom
607 fillMode: Image.Stretch
608 source: "graphics/dash_divider_top_darkgrad.png"
613 sectionProperty: "name"
614 sectionDelegate: ListItems.Header {
615 objectName: "dashSectionHeader" + (delegate ? delegate.category : "")
616 readonly property var delegate: categoryView.item(delegateIndex)
617 width: categoryView.width
618 height: section != "" ? units.gu(5) : 0
620 color: scopeStyle ? scopeStyle.foreground : theme.palette.normal.baseText
621 iconName: delegate && delegate.headerLink ? "go-next" : ""
623 if (delegate.headerLink) scopeView.scope.performQuery(delegate.headerLink);
627 pageHeader: scopeView.showPageHeader ? pageHeaderLoader : null
631 sourceComponent: scopeView.showPageHeader ? pageHeaderComponent : undefined
633 id: pageHeaderComponent
635 objectName: "scopePageHeader"
637 title: scopeView.scope ? scopeView.scope.name : ""
638 searchHint: scopeView.scope && scopeView.scope.searchHint || i18n.ctr("Label: Hint for dash search line edit", "Search")
639 showBackButton: scopeView.hasBackAction
640 searchEntryEnabled: true
641 settingsEnabled: scopeView.scope && scopeView.scope.settings && scopeView.scope.settings.count > 0 || false
642 favoriteEnabled: scopeView.scope && scopeView.scope.id !== "clickscope"
643 favorite: scopeView.scope && scopeView.scope.favorite
644 scopeStyle: scopeView.scopeStyle
645 paginationCount: scopeView.paginationCount
646 paginationIndex: scopeView.paginationIndex
648 bottomItem: DashNavigation {
649 scope: scopeView.scope
650 anchors { left: parent.left; right: parent.right }
651 windowHeight: scopeView.height
652 windowWidth: scopeView.width
653 scopeStyle: scopeView.scopeStyle
656 onBackClicked: scopeView.backClicked()
657 onSettingsClicked: subPageLoader.openSubPage("settings")
658 onFavoriteClicked: scopeView.scope.favorite = !scopeView.scope.favorite
659 onSearchTextFieldFocused: scopeView.showHeader()
666 id: pullToRefreshClippingItem
667 anchors.left: parent.left
668 anchors.right: parent.right
669 anchors.bottom: parent.bottom
670 height: parent.height - pullToRefresh.contentY + (pageHeaderLoader.item ? pageHeaderLoader.item.bottomItem[0].height - pageHeaderLoader.item.height : 0)
675 objectName: "pullToRefresh"
678 readonly property real contentY: categoryView.contentY - categoryView.originY
679 y: -contentY - units.gu(5)
683 scopeView.scope.refresh()
685 anchors.left: parent.left
686 anchors.right: parent.right
690 onProcessingChanged: if (!scopeView.processing) pullToRefresh.refreshing = false
693 style: PullToRefreshScopeStyle {
695 activationThreshold: units.gu(14)
702 objectName: "floatingSeeLess"
704 property Item companionTo: companionBase ? companionBase.seeAllButton : null
705 property Item companionBase: null
706 property bool showBecausePosition: false
707 property real yOffset: 0
710 left: categoryView.left
711 right: categoryView.right
713 y: parent.height - height + yOffset
714 height: seeLessLabel.font.pixelSize + units.gu(4)
715 visible: companionTo && showBecausePosition
717 onClicked: categoryView.expandedCategoryId = "";
719 function updateVisibility() {
720 var companionPos = companionTo.mapToItem(floatingSeeLess, 0, 0);
721 showBecausePosition = companionPos.y > 0;
723 var posToBase = floatingSeeLess.mapToItem(companionBase, 0, -yOffset).y;
724 yOffset = Math.max(0, companionBase.item.collapsedHeight - posToBase);
725 yOffset = Math.min(yOffset, height);
727 if (!showBecausePosition && categoryView.expandedCategoryId === "") {
728 companionBase = null;
734 text: i18n.tr("See less")
737 verticalCenterOffset: units.gu(-0.5)
740 font.weight: Font.Bold
741 color: scopeStyle ? scopeStyle.foreground : theme.palette.normal.baseText
745 target: floatingSeeLess.companionTo ? categoryView : null
746 onContentYChanged: floatingSeeLess.updateVisibility();
750 target: floatingSeeLess.companionTo
751 onYChanged: floatingSeeLess.updateVisibility();
756 id: previewLimitModel
761 objectName: "subPageLoader"
764 height: parent.height
765 anchors.left: categoryView.right
767 property bool open: false
768 property var scope: scopeView.scope
769 property var scopeStyle: scopeView.scopeStyle
770 property int initialIndex: -1
771 property var previewStack;
772 property string categoryId
773 property var model: null
775 readonly property bool processing: item && item.processing || false
776 readonly property int count: item && item.count || 0
777 readonly property int currentIndex: item && item.currentIndex || 0
778 readonly property var currentItem: item && item.currentItem || null
780 property string subPage: ""
781 readonly property bool subPageShown: visible && status === Loader.Ready
783 function openSubPage(page) {
787 function closeSubPage() {
791 source: switch(subPage) {
792 case "preview": return "PreviewListView.qml";
793 case "settings": return "ScopeSettingsPage.qml";
798 item.scope = Qt.binding(function() { return subPageLoader.scope; } )
799 item.scopeStyle = Qt.binding(function() { return subPageLoader.scopeStyle; } )
800 if (subPage == "preview") {
801 item.open = Qt.binding(function() { return subPageLoader.open; } )
802 item.initialIndex = Qt.binding(function() { return subPageLoader.initialIndex; } )
803 item.model = Qt.binding(function() { return subPageLoader.model; } )
804 item.categoryId = Qt.binding(function() { return subPageLoader.categoryId; } )
805 item.initialIndexPreviewStack = subPageLoader.previewStack;
806 subPageLoader.previewStack = null;
811 onOpenChanged: pageHeaderLoader.item.unfocus()
813 onVisibleChanged: if (!visible) subPage = ""
816 target: subPageLoader.item
817 onBackClicked: subPageLoader.closeSubPage()