on xenial help sign in
Move expansion button from section header to category footer. Fixes: 1261300

Approved by: Michal Hruby, Albert Astals Cid

commit6097094d221aaf16d9fa037c0af98425942b1ead authorMichał Sawicz <michal.sawicz@canonical.com> dateThu 24 Jul 2014, 20:39 (12 years ago) parentc7c13efb334d19
4 files changed+90−63
po/unity8.pot+17−9 qml/Dash/GenericScopeView.qml+54−32 tests/autopilot/unity8/shell/emulators/dash.py+1−1 tests/qmltests/Dash/tst_GenericScopeView.qml+18−21
po/unity8.pot+17−9
@@ -8,7 +8,7 @@ msgid ""
88msgstr ""
99"Project-Id-Version: unity8\n"
1010"Report-Msgid-Bugs-To: \n"
11−"POT-Creation-Date: 2014-07-07 12:15+0100\n"
11+"POT-Creation-Date: 2014-07-11 14:59+0200\n"
1212"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
1313"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
1414"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -80,10 +80,6 @@ msgstr ""
8080msgid "OK"
8181msgstr ""
8282
83−#: qml/Components/PageHeader.qml:366
84−msgid "Recent searches"
85−msgstr ""
86−
8783#: qml/Components/PassphraseLockscreen.qml:60
8884#, qt-format
8985msgid "Hello %1"
@@ -105,7 +101,7 @@ msgstr ""
105101msgid "See more"
106102msgstr ""
107103
108−#: qml/Components/SeeMore.qml:58
104+#: qml/Components/SeeMore.qml:58 qml/Dash/GenericScopeView.qml:330
109105msgid "See less"
110106msgstr ""
111107
@@ -113,6 +109,10 @@ msgstr ""
113109msgid "Recent"
114110msgstr ""
115111
112+#: qml/Dash/GenericScopeView.qml:330
113+msgid "See all"
114+msgstr ""
115+
116116#: qml/Dash/Previews/PreviewActionCombo.qml:34
117117msgid "More..."
118118msgstr ""
@@ -121,15 +121,15 @@ msgstr ""
121121msgid "Less..."
122122msgstr ""
123123
124−#: qml/Dash/Previews/PreviewRatingInput.qml:82
124+#: qml/Dash/Previews/PreviewRatingInput.qml:81
125125msgid "Rate this"
126126msgstr ""
127127
128−#: qml/Dash/Previews/PreviewRatingInput.qml:128
128+#: qml/Dash/Previews/PreviewRatingInput.qml:126
129129msgid "Add a review"
130130msgstr ""
131131
132−#: qml/Dash/Previews/PreviewRatingInput.qml:168
132+#: qml/Dash/Previews/PreviewRatingInput.qml:166
133133msgid "Send"
134134msgstr ""
135135
@@ -165,6 +165,14 @@ msgstr ""
165165msgid "Please enter SIM PIN"
166166msgstr ""
167167
168+#: qml/Panel/ActiveCallHint.qml:77
169+msgid "Tap to return to call..."
170+msgstr ""
171+
172+#: qml/Panel/ActiveCallHint.qml:90
173+msgid "Conference"
174+msgstr ""
175+
168176#: qml/Panel/Indicators/MenuItemFactory.qml:583
169177msgid "In queue…"
170178msgstr ""
qml/Dash/GenericScopeView.qml+54−32
@@ -260,13 +260,13 @@ FocusScope {
260260 var shouldExpand = categoryId === categoryView.expandedCategoryId;
261261 if (shouldExpand != baseItem.expanded) {
262262 // If the filter animation will be seen start it, otherwise, just flip the switch
263− var shrinkingVisible = !shouldExpand && y + item.collapsedHeight < categoryView.height;
263+ var shrinkingVisible = !shouldExpand && y + item.collapsedHeight + seeAll.height < categoryView.height;
264264 var growingVisible = shouldExpand && y + height < categoryView.height;
265265 if (!previewListView.open || shouldExpand) {
266266 var animate = shrinkingVisible || growingVisible;
267267 baseItem.expand(shouldExpand, animate)
268268 if (shouldExpand && !previewListView.open) {
269− categoryView.maximizeVisibleArea(index, item.expandedHeight);
269+ categoryView.maximizeVisibleArea(index, item.expandedHeight + seeAll.height);
270270 }
271271 }
272272 }
@@ -303,36 +303,69 @@ FocusScope {
303303 item.displayMarginEnd = -baseItem.height;
304304 } else {
305305 item.displayMarginBeginning = -Math.max(-baseItem.y, 0);
306− item.displayMarginEnd = -Math.max(baseItem.height - categoryView.height + baseItem.y, 0)
306+ item.displayMarginEnd = -Math.max(baseItem.height - seeAll.height
307+ - categoryView.height + baseItem.y, 0)
307308 }
308309 }
309310 }
311+ }
310312
311− Image {
312− visible: index != 0
313− anchors {
314− top: parent.top
315− left: parent.left
316− right: parent.right
313+ AbstractButton {
314+ id: seeAll
315+ objectName: "seeAll"
316+ anchors {
317+ top: rendererLoader.bottom
318+ left: parent.left
319+ right: parent.right
320+ }
321+ height: baseItem.expandable ? seeAllLabel.font.pixelSize + units.gu(6) : 0
322+
323+ onClicked: {
324+ if (categoryView.expandedCategoryId != baseItem.category) {
325+ categoryView.expandedCategoryId = baseItem.category;
326+ } else {
327+ categoryView.expandedCategoryId = "";
317328 }
318− fillMode: Image.Stretch
319− source: "graphics/dash_divider_top_lightgrad.png"
320− z: -1
321329 }
322330
323− Image {
324− // FIXME Should not rely on model.count but view.count, but ListViewWithPageHeader doesn't expose it yet.
325− visible: index != categoryView.model.count - 1
331+ Label {
332+ id: seeAllLabel
333+ text: baseItem.expanded ? i18n.tr("See less") : i18n.tr("See all")
326334 anchors {
327− bottom: parent.bottom
328− left: parent.left
329− right: parent.right
335+ centerIn: parent
336+ verticalCenterOffset: units.gu(-0.5)
330337 }
331− fillMode: Image.Stretch
332− source: "graphics/dash_divider_top_darkgrad.png"
333− z: -1
338+ fontSize: "small"
339+ font.weight: Font.Bold
340+ color: scopeStyle ? scopeStyle.foreground : "grey"
341+ visible: baseItem.expandable
334342 }
335343 }
344+
345+ Image {
346+ visible: index != 0
347+ anchors {
348+ top: parent.top
349+ left: parent.left
350+ right: parent.right
351+ }
352+ fillMode: Image.Stretch
353+ source: "graphics/dash_divider_top_lightgrad.png"
354+ z: -1
355+ }
356+
357+ Image {
358+ // FIXME Should not rely on model.count but view.count, but ListViewWithPageHeader doesn't expose it yet.
359+ visible: index != categoryView.model.count - 1
360+ anchors {
361+ bottom: seeAll.bottom
362+ left: parent.left
363+ right: parent.right
364+ }
365+ fillMode: Image.Stretch
366+ source: "graphics/dash_divider_top_darkgrad.png"
367+ z: -1
368+ }
336369 }
337370
338371 sectionProperty: "name"
@@ -342,17 +375,6 @@ FocusScope {
342375 width: categoryView.width
343376 text: section
344377 textColor: scopeStyle ? scopeStyle.foreground : "grey"
345− image: {
346− if (delegate && delegate.expandable)
347− return delegate.expanded ? "graphics/header_handlearrow2.png" : "graphics/header_handlearrow.png"
348− return "";
349− }
350− onClicked: {
351− if (categoryView.expandedCategoryId != delegate.category)
352− categoryView.expandedCategoryId = delegate.category;
353− else
354− categoryView.expandedCategoryId = "";
355− }
356378 }
357379
358380 pageHeader: PageHeader {
tests/autopilot/unity8/shell/emulators/dash.py+1−1
@@ -209,7 +209,7 @@ class DashApps(GenericScopeView):
209209
210210 result = []
211211 for card in application_cards:
212− if card.objectName != 'cardToolCard':
212+ if card.objectName not in ('cardToolCard', 'seeAll'):
213213 result.append(card.title)
214214 return result
215215
tests/qmltests/Dash/tst_GenericScopeView.qml+18−21
@@ -104,53 +104,50 @@ Item {
104104 tryCompare(genericScopeView.scope, "searchQuery", "test")
105105 }
106106
107− function test_filter_expand_collapse() {
107+ function test_expand_collapse() {
108108 tryCompareFunction(function() { return findChild(genericScopeView, "dashSectionHeader0") != null; }, true);
109109
110− var header = findChild(genericScopeView, "dashSectionHeader0")
111110 var category = findChild(genericScopeView, "dashCategory0")
111+ var seeAll = findChild(category, "seeAll")
112112
113− waitForRendering(header);
113+ waitForRendering(seeAll);
114114 verify(category.expandable);
115115 verify(!category.expanded);
116116
117117 var initialHeight = category.height;
118− var middleHeight;
119− mouseClick(header, header.width / 2, header.height / 2);
120− tryCompareFunction(function() { middleHeight = category.height; return category.height > initialHeight; }, true);
121− tryCompare(category, "expanded", true);
122− tryCompareFunction(function() { return category.height > middleHeight; }, true);
118+ mouseClick(seeAll, seeAll.width / 2, seeAll.height / 2);
119+ verify(category.expanded);
120+ tryCompareFunction(function() { return category.height > initialHeight; }, true);
123121
124− mouseClick(header, header.width / 2, header.height / 2);
125− verify(category.expandable);
126− tryCompare(category, "expanded", false);
122+ mouseClick(seeAll, seeAll.width / 2, seeAll.height / 2);
123+ verify(!category.expanded);
127124 }
128125
129− function test_filter_expand_expand_collapse() {
126+ function test_expand_expand_collapse() {
130127 // wait for the item to be there
131128 tryCompareFunction(function() { return findChild(genericScopeView, "dashSectionHeader2") != null; }, true);
132129
133130 var categoryListView = findChild(genericScopeView, "categoryListView");
134131 categoryListView.contentY = categoryListView.height;
135132
136− var header2 = findChild(genericScopeView, "dashSectionHeader2")
137133 var category2 = findChild(genericScopeView, "dashCategory2")
134+ var seeAll2 = findChild(category2, "seeAll")
138135
139− waitForRendering(header2);
136+ waitForRendering(seeAll2);
140137 verify(category2.expandable);
141138 verify(!category2.expanded);
142139
143− mouseClick(header2, header2.width / 2, header2.height / 2);
140+ mouseClick(seeAll2, seeAll2.width / 2, seeAll2.height / 2);
144141 tryCompare(category2, "expanded", true);
145142
146143 categoryListView.positionAtBeginning();
147144
148− var header0 = findChild(genericScopeView, "dashSectionHeader0")
149145 var category0 = findChild(genericScopeView, "dashCategory0")
150− mouseClick(header0, header0.width / 2, header0.height / 2);
146+ var seeAll0 = findChild(category0, "seeAll")
147+ mouseClick(seeAll0, seeAll0.width / 2, seeAll0.height / 2);
151148 tryCompare(category0, "expanded", true);
152149 tryCompare(category2, "expanded", false);
153− mouseClick(header0, header0.width / 2, header0.height / 2);
150+ mouseClick(seeAll0, seeAll0.width / 2, seeAll0.height / 2);
154151 tryCompare(category0, "expanded", false);
155152 tryCompare(category2, "expanded", false);
156153 }
@@ -163,11 +160,11 @@ Item {
163160 shell.width = units.gu(20)
164161 var categoryListView = findChild(genericScopeView, "categoryListView");
165162 categoryListView.contentY = units.gu(20);
166− var header0 = findChild(genericScopeView, "dashSectionHeader0")
167− mouseClick(header0, header0.width / 2, header0.height / 2);
163+ var seeAll = findChild(category, "seeAll")
164+ mouseClick(seeAll, seeAll.width / 2, seeAll.height / 2);
168165 tryCompare(category, "expanded", true);
169166 tryCompareFunction(function() { return category.item.height == genericScopeView.height - category.item.displayMarginBeginning - category.item.displayMarginEnd; }, true);
170− mouseClick(header0, header0.width / 2, header0.height / 2);
167+ mouseClick(seeAll, seeAll.width / 2, seeAll.height / 2);
171168 tryCompare(category, "expanded", false);
172169 }
173170