on xenial help sign in
Merge
268044fAlbert Astals
qml/Components/PageHeader.qml+21
@@ -36,6 +36,8 @@ Item {
36 property alias showSignatureLine: bottomBorder.visible
36 property alias showSignatureLine: bottomBorder.visible
37
37
38 property alias bottomItem: bottomContainer.children
38 property alias bottomItem: bottomContainer.children
39+ property int paginationCount: 0
40+ property int paginationIndex: -1
39
41
40 // TODO We should use foreground for the icons
42 // TODO We should use foreground for the icons
41 // of the toolbar but unfortunately Action does not have
43 // of the toolbar but unfortunately Action does not have
@@ -296,6 +298,25 @@ Item {
296 }
298 }
297 }
299 }
298
300
301+ Row {
302+ spacing: units.gu(.5)
303+ Repeater {
304+ objectName: "paginationRepeater"
305+ model: root.paginationCount
306+ Image {
307+ objectName: "paginationDots_" + index
308+ height: units.gu(1)
309+ width: height
310+ source: (index == root.paginationIndex) ? "graphics/pagination_dot_on.png" : "graphics/pagination_dot_off.png"
311+ }
312+ }
313+ anchors {
314+ top: headerContainer.bottom
315+ horizontalCenter: headerContainer.horizontalCenter
316+ topMargin: units.gu(.5)
317+ }
318+ }
319+
299 Component {
320 Component {
300 id: popoverComponent
321 id: popoverComponent
301 Popover {
322 Popover {
qml/Components/graphics/pagination_dot_off@30.pngnew file

Binary file not shown.

qml/Components/graphics/pagination_dot_on@30.pngnew file

Binary file not shown.

qml/Dash/DashContent.qml+2
@@ -148,6 +148,8 @@ Item {
148 item.scope = Qt.binding(function() { return scope })
148 item.scope = Qt.binding(function() { return scope })
149 item.isCurrent = Qt.binding(function() { return visible && ListView.isCurrentItem })
149 item.isCurrent = Qt.binding(function() { return visible && ListView.isCurrentItem })
150 dashContent.scopeLoaded(item.scope.id)
150 dashContent.scopeLoaded(item.scope.id)
151+ item.paginationCount = Qt.binding(function() { return dashContentList.count } )
152+ item.paginationIndex = Qt.binding(function() { return dashContentList.currentIndex } )
151 }
153 }
152 Connections {
154 Connections {
153 target: isCurrent ? scope : null
155 target: isCurrent ? scope : null
qml/Dash/GenericScopeView.qml+2
@@ -35,6 +35,8 @@ FocusScope {
35 property var categoryView: categoryView
35 property var categoryView: categoryView
36 property bool showPageHeader: true
36 property bool showPageHeader: true
37 readonly property alias previewShown: previewListView.open
37 readonly property alias previewShown: previewListView.open
38+ property alias paginationCount: pageHeader.paginationCount
39+ property alias paginationIndex: pageHeader.paginationIndex
38
40
39 property var scopeStyle: ScopeStyle {
41 property var scopeStyle: ScopeStyle {
40 style: scope ? scope.customizations : {}
42 style: scope ? scope.customizations : {}
tests/qmltests/Components/tst_PageHeader.qml+21
@@ -192,6 +192,27 @@ Item {
192 ];
192 ];
193 }
193 }
194
194
195+ function test_pagination() {
196+ var paginationRepeater = findChild(pageHeader, "paginationRepeater");
197+ tryCompare(paginationRepeater, "count", 0);
198+ pageHeader.paginationCount = 5;
199+ tryCompare(paginationRepeater, "count", 5);
200+ for (var i=0; i<pageHeader.paginationCount; i++) {
201+ pageHeader.paginationIndex = i;
202+ for (var j=0; j<paginationRepeater.count; j++) {
203+ var paginationDot = findChild(pageHeader, "paginationDots_"+j);
204+ if (i==j) {
205+ compare(paginationDot.source.toString().indexOf("pagination_dot_on") > -1, true);
206+ } else {
207+ compare(paginationDot.source.toString().indexOf("pagination_dot_off") > -1, true);
208+ }
209+ }
210+ }
211+ pageHeader.paginationIndex = -1;
212+ pageHeader.paginationCount = 0;
213+ tryCompare(paginationRepeater, "count", 0);
214+ }
215+
195 function test_popup_closing(data) {
216 function test_popup_closing(data) {
196 searchEnabled = true;
217 searchEnabled = true;
197 pageHeader.searchHistory.clear();
218 pageHeader.searchHistory.clear();