@@ -47,11 +47,6 @@ FocusScope {
48 signal backClicked()
48 signal backClicked()
51− floatingSeeLess.companionTo = null;
52− floatingSeeLess.companionBase = null;
55 function positionAtBeginning() {
50 function positionAtBeginning() {
56 categoryView.positionAtBeginning()
51 categoryView.positionAtBeginning()
@@ -149,7 +144,8 @@ FocusScope {
149 x: previewListView.open ? -width : 0
144 x: previewListView.open ? -width : 0
150 Behavior on x { UbuntuNumberAnimation { } }
145 Behavior on x { UbuntuNumberAnimation { } }
151 width: parent.width
146 width: parent.width
152− height: floatingSeeLess.visible ? parent.height - floatingSeeLess.height + floatingSeeLess.yOffset : parent.height
147+ height: floatingSeeLess.visible ? parent.height - floatingSeeLess.height + floatingSeeLess.yOffset
153 clip: height != parent.height
149 clip: height != parent.height
155 model: scopeView.categories
151 model: scopeView.categories
@@ -157,7 +153,7 @@ FocusScope {
157 pixelAligned: true
153 pixelAligned: true
158 interactive: !navigationShown
154 interactive: !navigationShown
160− property string expandedCategoryId: ""
156+ property Item expandedCategoryItem: null
162 readonly property bool pageHeaderTotallyVisible: scopeView.showPageHeader &&
158 readonly property bool pageHeaderTotallyVisible: scopeView.showPageHeader &&
163 ((headerItemShownHeight == 0 && categoryView.contentY <= categoryView.originY) || (headerItemShownHeight == pageHeaderLoader.item.height))
159 ((headerItemShownHeight == 0 && categoryView.contentY <= categoryView.originY) || (headerItemShownHeight == pageHeaderLoader.item.height))
@@ -168,6 +164,8 @@ FocusScope {
168 highlightWhenPressed: false
164 highlightWhenPressed: false
169 showDivider: false
165 showDivider: false
167+ property Item seeAllButton: seeAll
171 readonly property bool expandable: {
169 readonly property bool expandable: {
172 if (categoryView.model.count === 1) return false;
170 if (categoryView.model.count === 1) return false;
173 if (cardTool.template && cardTool.template["collapsed-rows"] === 0) return false;
171 if (cardTool.template && cardTool.template["collapsed-rows"] === 0) return false;
@@ -197,7 +195,7 @@ FocusScope {
197 // This can happen with the VJ that doesn't know how height it will be on creation
195 // This can happen with the VJ that doesn't know how height it will be on creation
198 // so doesn't set expandable until a bit too late for onLoaded
196 // so doesn't set expandable until a bit too late for onLoaded
199 if (expandable) {
197 if (expandable) {
200− var shouldExpand = baseItem.category === categoryView.expandedCategoryId;
198+ var shouldExpand = baseItem === categoryView.expandedCategoryItem;
201 baseItem.expand(shouldExpand, false /*animate*/);
199 baseItem.expand(shouldExpand, false /*animate*/);
@@ -248,7 +246,7 @@ FocusScope {
248 item.objectName = Qt.binding(function() { return categoryId })
246 item.objectName = Qt.binding(function() { return categoryId })
249 item.scopeStyle = scopeView.scopeStyle;
247 item.scopeStyle = scopeView.scopeStyle;
250 if (baseItem.expandable) {
248 if (baseItem.expandable) {
251− var shouldExpand = categoryId === categoryView.expandedCategoryId;
249+ var shouldExpand = baseItem === categoryView.expandedCategoryItem;
252 baseItem.expand(shouldExpand, false /*animate*/);
250 baseItem.expand(shouldExpand, false /*animate*/);
254 updateDelegateCreationRange();
252 updateDelegateCreationRange();
@@ -285,13 +283,13 @@ FocusScope {
286 Connections {
284 Connections {
287 target: categoryView
285 target: categoryView
288− onExpandedCategoryIdChanged: {
286+ onExpandedCategoryItemChanged: {
289 collapseAllButExpandedCategory();
287 collapseAllButExpandedCategory();
291 function collapseAllButExpandedCategory() {
289 function collapseAllButExpandedCategory() {
292 var item = rendererLoader.item;
290 var item = rendererLoader.item;
293 if (baseItem.expandable) {
291 if (baseItem.expandable) {
294− var shouldExpand = categoryId === categoryView.expandedCategoryId;
292+ var shouldExpand = baseItem === categoryView.expandedCategoryItem;
295 if (shouldExpand != baseItem.expanded) {
293 if (shouldExpand != baseItem.expanded) {
296 // If the filter animation will be seen start it, otherwise, just flip the switch
294 // If the filter animation will be seen start it, otherwise, just flip the switch
297 var shrinkingVisible = !shouldExpand && y + item.collapsedHeight + seeAll.height < categoryView.height;
295 var shrinkingVisible = !shouldExpand && y + item.collapsedHeight + seeAll.height < categoryView.height;
@@ -355,12 +353,10 @@ FocusScope {
355 height: seeAllLabel.visible ? seeAllLabel.font.pixelSize + units.gu(4) : 0
353 height: seeAllLabel.visible ? seeAllLabel.font.pixelSize + units.gu(4) : 0
357 onClicked: {
355 onClicked: {
358− if (categoryView.expandedCategoryId != baseItem.category) {
356+ if (categoryView.expandedCategoryItem !== baseItem) {
359− categoryView.expandedCategoryId = baseItem.category;
357+ categoryView.expandedCategoryItem = baseItem;
360− floatingSeeLess.companionTo = seeAll;
361− floatingSeeLess.companionBase = baseItem;
363− categoryView.expandedCategoryId = "";
359+ categoryView.expandedCategoryItem = null;
@@ -455,8 +451,8 @@ FocusScope {
455 id: floatingSeeLess
451 id: floatingSeeLess
456 objectName: "floatingSeeLess"
452 objectName: "floatingSeeLess"
458− property var companionTo: null
454+ property Item companionTo: companionBase ? companionBase.seeAllButton : null
459− property var companionBase: null
455+ property Item companionBase: categoryView.expandedCategoryItem
460 property bool showBecausePosition: false
456 property bool showBecausePosition: false
461 property real yOffset: 0
457 property real yOffset: 0
@@ -468,7 +464,7 @@ FocusScope {
468 height: seeLessLabel.font.pixelSize + units.gu(4)
464 height: seeLessLabel.font.pixelSize + units.gu(4)
469 visible: companionTo && showBecausePosition
465 visible: companionTo && showBecausePosition
471− onClicked: categoryView.expandedCategoryId = "";
467+ onClicked: categoryView.expandedCategoryItem = null;
473 function updateVisibility() {
469 function updateVisibility() {
474 var companionPos = companionTo.mapToItem(floatingSeeLess, 0, 0);
470 var companionPos = companionTo.mapToItem(floatingSeeLess, 0, 0);
@@ -477,11 +473,6 @@ FocusScope {
477 var posToBase = floatingSeeLess.mapToItem(companionBase, 0, -yOffset).y;
473 var posToBase = floatingSeeLess.mapToItem(companionBase, 0, -yOffset).y;
478 yOffset = Math.max(0, companionBase.item.collapsedHeight - posToBase);
474 yOffset = Math.max(0, companionBase.item.collapsedHeight - posToBase);
479 yOffset = Math.min(yOffset, height);
475 yOffset = Math.min(yOffset, height);
481− if (!showBecausePosition && categoryView.expandedCategoryId === "") {
483− companionBase = null;
@@ -502,7 +493,7 @@ FocusScope {
504 Connections {
495 Connections {
505− target: floatingSeeLess.companionTo ? floatingSeeLess.companionTo : null
496+ target: floatingSeeLess.companionTo
506 onYChanged: floatingSeeLess.updateVisibility();
497 onYChanged: floatingSeeLess.updateVisibility();