on xenial help sign in
Move expansion button below category.
commit0c59801344ab477804180790c2f5dc3e754fc98b authorMichał Sawicz <michal.sawicz@canonical.com> dateFri 11 Jul 2014, 15:27 (12 years ago) parent7b5efe3
1 file changed+34−14
qml/Dash/GenericScopeView.qml+34−14
qml/Dash/GenericScopeView.qml+34−14
@@ -259,13 +259,13 @@ FocusScope {
259259 var shouldExpand = categoryId === categoryView.expandedCategoryId;
260260 if (shouldExpand != baseItem.expanded) {
261261 // If the filter animation will be seen start it, otherwise, just flip the switch
262− var shrinkingVisible = !shouldExpand && y + item.collapsedHeight < categoryView.height;
262+ var shrinkingVisible = !shouldExpand && y + item.collapsedHeight + seeAll.height < categoryView.height;
263263 var growingVisible = shouldExpand && y + height < categoryView.height;
264264 if (!previewListView.open || shouldExpand) {
265265 var animate = shrinkingVisible || growingVisible;
266266 baseItem.expand(shouldExpand, animate)
267267 if (shouldExpand && !previewListView.open) {
268− categoryView.maximizeVisibleArea(index, item.expandedHeight);
268+ categoryView.maximizeVisibleArea(index, item.expandedHeight + seeAll.height);
269269 }
270270 }
271271 }
@@ -302,10 +302,41 @@ FocusScope {
302302 item.displayMarginEnd = -baseItem.height;
303303 } else {
304304 item.displayMarginBeginning = -Math.max(-baseItem.y, 0);
305− item.displayMarginEnd = -Math.max(baseItem.height - categoryView.height + baseItem.y, 0)
305+ item.displayMarginEnd = -Math.max(baseItem.height - seeAll.height
306+ - categoryView.height + baseItem.y, 0)
306307 }
307308 }
308309 }
310+ }
311+
312+ AbstractButton {
313+ id: seeAll
314+ anchors {
315+ top: rendererLoader.bottom
316+ left: parent.left
317+ right: parent.right
318+ }
319+ height: baseItem.expandable ? seeAllLabel.font.pixelSize + units.gu(6) : 0
320+
321+ onClicked: {
322+ if (categoryView.expandedCategoryId != baseItem.category)
323+ categoryView.expandedCategoryId = baseItem.category;
324+ else
325+ categoryView.expandedCategoryId = "";
326+ }
327+
328+ Label {
329+ id: seeAllLabel
330+ text: baseItem.expanded ? i18n.tr("See less") : i18n.tr("See all")
331+ anchors {
332+ centerIn: parent
333+ verticalCenterOffset: units.gu(-0.5)
334+ }
335+ fontSize: "small"
336+ font.weight: Font.Bold
337+ color: scopeStyle ? scopeStyle.foreground : "grey"
338+ visible: baseItem.expandable
339+ }
309340
310341 Image {
311342 visible: index != 0
@@ -341,17 +372,6 @@ FocusScope {
341372 width: categoryView.width
342373 text: section
343374 textColor: scopeStyle ? scopeStyle.foreground : "grey"
344− image: {
345− if (delegate && delegate.expandable)
346− return delegate.expanded ? "graphics/header_handlearrow2.png" : "graphics/header_handlearrow.png"
347− return "";
348− }
349− onClicked: {
350− if (categoryView.expandedCategoryId != delegate.category)
351− categoryView.expandedCategoryId = delegate.category;
352− else
353− categoryView.expandedCategoryId = "";
354− }
355375 }
356376
357377 pageHeader: PageHeader {