@@ -144,14 +144,16 @@ FocusScope {
144 x: previewListView.open ? -width : 0
144 x: previewListView.open ? -width : 0
145 Behavior on x { UbuntuNumberAnimation { } }
145 Behavior on x { UbuntuNumberAnimation { } }
146 width: parent.width
146 width: parent.width
147+ height: floatingSeeLess.visible ? parent.height - floatingSeeLess.height + floatingSeeLess.yOffset
147− height: parent.height
149+ clip: height != parent.height
149 model: scopeView.categories
151 model: scopeView.categories
150 forceNoClip: previewListView.open
152 forceNoClip: previewListView.open
151 pixelAligned: true
153 pixelAligned: true
152 interactive: !navigationShown
154 interactive: !navigationShown
154− property string expandedCategoryId: ""
156+ property Item expandedCategoryItem: null
156 readonly property bool pageHeaderTotallyVisible: scopeView.showPageHeader &&
158 readonly property bool pageHeaderTotallyVisible: scopeView.showPageHeader &&
157 ((headerItemShownHeight == 0 && categoryView.contentY <= categoryView.originY) || (headerItemShownHeight == pageHeaderLoader.item.height))
159 ((headerItemShownHeight == 0 && categoryView.contentY <= categoryView.originY) || (headerItemShownHeight == pageHeaderLoader.item.height))
@@ -162,6 +164,8 @@ FocusScope {
162 highlightWhenPressed: false
164 highlightWhenPressed: false
163 showDivider: false
165 showDivider: false
167+ property Item seeAllButton: seeAll
165 readonly property bool expandable: {
169 readonly property bool expandable: {
166 if (categoryView.model.count === 1) return false;
170 if (categoryView.model.count === 1) return false;
167 if (cardTool.template && cardTool.template["collapsed-rows"] === 0) return false;
171 if (cardTool.template && cardTool.template["collapsed-rows"] === 0) return false;
@@ -191,7 +195,7 @@ FocusScope {
191 // 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
192 // 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
193 if (expandable) {
197 if (expandable) {
194− var shouldExpand = baseItem.category === categoryView.expandedCategoryId;
198+ var shouldExpand = baseItem === categoryView.expandedCategoryItem;
195 baseItem.expand(shouldExpand, false /*animate*/);
199 baseItem.expand(shouldExpand, false /*animate*/);
@@ -242,7 +246,7 @@ FocusScope {
242 item.objectName = Qt.binding(function() { return categoryId })
246 item.objectName = Qt.binding(function() { return categoryId })
243 item.scopeStyle = scopeView.scopeStyle;
247 item.scopeStyle = scopeView.scopeStyle;
244 if (baseItem.expandable) {
248 if (baseItem.expandable) {
245− var shouldExpand = categoryId === categoryView.expandedCategoryId;
249+ var shouldExpand = baseItem === categoryView.expandedCategoryItem;
246 baseItem.expand(shouldExpand, false /*animate*/);
250 baseItem.expand(shouldExpand, false /*animate*/);
248 updateDelegateCreationRange();
252 updateDelegateCreationRange();
@@ -279,13 +283,13 @@ FocusScope {
280 Connections {
284 Connections {
281 target: categoryView
285 target: categoryView
282− onExpandedCategoryIdChanged: {
286+ onExpandedCategoryItemChanged: {
283 collapseAllButExpandedCategory();
287 collapseAllButExpandedCategory();
285 function collapseAllButExpandedCategory() {
289 function collapseAllButExpandedCategory() {
286 var item = rendererLoader.item;
290 var item = rendererLoader.item;
287 if (baseItem.expandable) {
291 if (baseItem.expandable) {
288− var shouldExpand = categoryId === categoryView.expandedCategoryId;
292+ var shouldExpand = baseItem === categoryView.expandedCategoryItem;
289 if (shouldExpand != baseItem.expanded) {
293 if (shouldExpand != baseItem.expanded) {
290 // 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
291 var shrinkingVisible = !shouldExpand && y + item.collapsedHeight + seeAll.height < categoryView.height;
295 var shrinkingVisible = !shouldExpand && y + item.collapsedHeight + seeAll.height < categoryView.height;
@@ -346,13 +350,13 @@ FocusScope {
346 left: parent.left
350 left: parent.left
347 right: parent.right
351 right: parent.right
349− height: seeAllLabel.visible ? seeAllLabel.font.pixelSize + units.gu(6) : 0
353+ height: seeAllLabel.visible ? seeAllLabel.font.pixelSize + units.gu(4) : 0
351 onClicked: {
355 onClicked: {
352− if (categoryView.expandedCategoryId != baseItem.category) {
356+ if (categoryView.expandedCategoryItem !== baseItem) {
353− categoryView.expandedCategoryId = baseItem.category;
357+ categoryView.expandedCategoryItem = baseItem;
355− categoryView.expandedCategoryId = "";
359+ categoryView.expandedCategoryItem = null;
@@ -443,6 +447,57 @@ FocusScope {
452+ objectName: "floatingSeeLess"
454+ property Item companionTo: companionBase ? companionBase.seeAllButton : null
455+ property Item companionBase: categoryView.expandedCategoryItem
456+ property bool showBecausePosition: false
457+ property real yOffset: 0
460+ left: categoryView.left
461+ right: categoryView.right
463+ y: parent.height - height + yOffset
464+ height: seeLessLabel.font.pixelSize + units.gu(4)
465+ visible: companionTo && showBecausePosition
467+ onClicked: categoryView.expandedCategoryItem = null;
469+ function updateVisibility() {
470+ var companionPos = companionTo.mapToItem(floatingSeeLess, 0, 0);
471+ showBecausePosition = companionPos.y > 0;
473+ var posToBase = floatingSeeLess.mapToItem(companionBase, 0, -yOffset).y;
474+ yOffset = Math.max(0, companionBase.item.collapsedHeight - posToBase);
475+ yOffset = Math.min(yOffset, height);
480+ text: i18n.tr("See less")
483+ verticalCenterOffset: units.gu(-0.5)
486+ font.weight: Font.Bold
487+ color: scopeStyle ? scopeStyle.foreground : Theme.palette.normal.baseText
491+ target: floatingSeeLess.companionTo ? categoryView : null
492+ onContentYChanged: floatingSeeLess.updateVisibility();
496+ target: floatingSeeLess.companionTo
497+ onYChanged: floatingSeeLess.updateVisibility();
446 LimitProxyModel {
501 LimitProxyModel {
447 id: previewLimitModel
502 id: previewLimitModel