on xenial help sign in
Merge lp:~unity-team/unity8/seeLessStuckBottom
75f4736Michał Sawicz
qml/Dash/GenericScopeView.qml+16−25
@@ -47,11 +47,6 @@ FocusScope {
47
47
48 signal backClicked()
48 signal backClicked()
49
49
50− onScopeChanged: {
51− floatingSeeLess.companionTo = null;
52− floatingSeeLess.companionBase = null;
53− }
54−
55 function positionAtBeginning() {
50 function positionAtBeginning() {
56 categoryView.positionAtBeginning()
51 categoryView.positionAtBeginning()
57 }
52 }
@@ -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
148+ : parent.height
153 clip: height != parent.height
149 clip: height != parent.height
154
150
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
159
155
160− property string expandedCategoryId: ""
156+ property Item expandedCategoryItem: null
161
157
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
170
166
167+ property Item seeAllButton: seeAll
168+
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*/);
202 }
200 }
203 }
201 }
@@ -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*/);
253 }
251 }
254 updateDelegateCreationRange();
252 updateDelegateCreationRange();
@@ -285,13 +283,13 @@ FocusScope {
285 }
283 }
286 Connections {
284 Connections {
287 target: categoryView
285 target: categoryView
288− onExpandedCategoryIdChanged: {
286+ onExpandedCategoryItemChanged: {
289 collapseAllButExpandedCategory();
287 collapseAllButExpandedCategory();
290 }
288 }
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
356
354
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;
362 } else {
358 } else {
363− categoryView.expandedCategoryId = "";
359+ categoryView.expandedCategoryItem = null;
364 }
360 }
365 }
361 }
366
362
@@ -454,8 +450,8 @@ FocusScope {
454 id: floatingSeeLess
450 id: floatingSeeLess
455 objectName: "floatingSeeLess"
451 objectName: "floatingSeeLess"
456
452
457− property var companionTo: null
453+ property Item companionTo: companionBase ? companionBase.seeAllButton : null
458− property var companionBase: null
454+ property Item companionBase: categoryView.expandedCategoryItem
459 property bool showBecausePosition: false
455 property bool showBecausePosition: false
460 property real yOffset: 0
456 property real yOffset: 0
461
457
@@ -467,7 +463,7 @@ FocusScope {
467 height: seeLessLabel.font.pixelSize + units.gu(4)
463 height: seeLessLabel.font.pixelSize + units.gu(4)
468 visible: companionTo && showBecausePosition
464 visible: companionTo && showBecausePosition
469
465
470− onClicked: categoryView.expandedCategoryId = "";
466+ onClicked: categoryView.expandedCategoryItem = null;
471
467
472 function updateVisibility() {
468 function updateVisibility() {
473 var companionPos = companionTo.mapToItem(floatingSeeLess, 0, 0);
469 var companionPos = companionTo.mapToItem(floatingSeeLess, 0, 0);
@@ -476,11 +472,6 @@ FocusScope {
476 var posToBase = floatingSeeLess.mapToItem(companionBase, 0, -yOffset).y;
472 var posToBase = floatingSeeLess.mapToItem(companionBase, 0, -yOffset).y;
477 yOffset = Math.max(0, companionBase.item.collapsedHeight - posToBase);
473 yOffset = Math.max(0, companionBase.item.collapsedHeight - posToBase);
478 yOffset = Math.min(yOffset, height);
474 yOffset = Math.min(yOffset, height);
479−
480− if (!showBecausePosition && categoryView.expandedCategoryId === "") {
481− companionTo = null;
482− companionBase = null;
483− }
484 }
475 }
485
476
486 Label {
477 Label {
@@ -501,7 +492,7 @@ FocusScope {
501 }
492 }
502
493
503 Connections {
494 Connections {
504− target: floatingSeeLess.companionTo ? floatingSeeLess.companionTo : null
495+ target: floatingSeeLess.companionTo
505 onYChanged: floatingSeeLess.updateVisibility();
496 onYChanged: floatingSeeLess.updateVisibility();
506 }
497 }
507 }
498 }
qml/Dash/PageHeader.qml+1
@@ -368,6 +368,7 @@ Item {
368
368
369 // FIXME this doesn't work with solid scope backgrounds due to z-ordering
369 // FIXME this doesn't work with solid scope backgrounds due to z-ordering
370 Rectangle {
370 Rectangle {
371+ visible: bottomBorder.visible
371 anchors {
372 anchors {
372 top: bottomContainer.top
373 top: bottomContainer.top
373 left: parent.left
374 left: parent.left
tests/qmltests/Dash/tst_GenericScopeView.qml+7−4
@@ -20,7 +20,7 @@ import Unity 0.2
20import ".."
20import ".."
21import "../../../qml/Dash"
21import "../../../qml/Dash"
22import "../../../qml/Components"
22import "../../../qml/Components"
23−import Ubuntu.Components 0.1
23+import Ubuntu.Components 1.1
24import Unity.Test 0.1 as UT
24import Unity.Test 0.1 as UT
25
25
26Item {
26Item {
@@ -217,7 +217,10 @@ Item {
217 var floatingSeeLess = findChild(genericScopeView, "floatingSeeLess");
217 var floatingSeeLess = findChild(genericScopeView, "floatingSeeLess");
218 mouseClick(seeAll, seeAll.width / 2, seeAll.height / 2);
218 mouseClick(seeAll, seeAll.width / 2, seeAll.height / 2);
219 tryCompare(category, "expanded", true);
219 tryCompare(category, "expanded", true);
220+ tryCompareFunction(function() {
221+ return category.item.height + floatingSeeLess.height ==
220− tryCompareFunction(function() { return category.item.height + floatingSeeLess.height == genericScopeView.height - category.item.displayMarginBeginning - category.item.displayMarginEnd; }, true);
222+ genericScopeView.height - category.item.displayMarginBeginning - category.item.displayMarginEnd;
223+ }, true);
221 mouseClick(floatingSeeLess, floatingSeeLess.width / 2, floatingSeeLess.height / 2);
224 mouseClick(floatingSeeLess, floatingSeeLess.width / 2, floatingSeeLess.height / 2);
222 tryCompare(category, "expanded", false);
225 tryCompare(category, "expanded", false);
223 }
226 }
@@ -334,9 +337,9 @@ Item {
334
337
335 function test_header_style_data() {
338 function test_header_style_data() {
336 return [
339 return [
337− { tag: "Default", index: 0, foreground: Theme.palette.normal.baseText, background: "color:///#f5f5f5", logo: "" },
340+ { tag: "Default", index: 0, foreground: UbuntuColors.darkGrey, background: "color:///#f5f5f5", logo: "" },
338 { tag: "Foreground", index: 1, foreground: "yellow", background: "color:///#f5f5f5", logo: "" },
341 { tag: "Foreground", index: 1, foreground: "yellow", background: "color:///#f5f5f5", logo: "" },
339− { tag: "Logo+Background", index: 2, foreground: Theme.palette.normal.baseText, background: "gradient:///lightgrey/grey",
342+ { tag: "Logo+Background", index: 2, foreground: UbuntuColors.darkGrey, background: "gradient:///lightgrey/grey",
340 logo: Qt.resolvedUrl("../Dash/tst_PageHeader/logo-ubuntu-orange.svg") },
343 logo: Qt.resolvedUrl("../Dash/tst_PageHeader/logo-ubuntu-orange.svg") },
341 ];
344 ];
342 }
345 }