on xenial help sign in
Merge
commit268044f322a9f6cbadf4eb55c5125437a8090a44 authorAlbert Astals <albert.astals@canonical.com> dateThu 7 Aug 2014, 10:23 (12 years ago) parentb36e2bfd45d3e8
6 files changed+46
qml/Components/PageHeader.qml+21 qml/Components/graphics/pagination_dot_off@30.png qml/Components/graphics/pagination_dot_on@30.png qml/Dash/DashContent.qml+2 qml/Dash/GenericScopeView.qml+2 tests/qmltests/Components/tst_PageHeader.qml+21
qml/Components/PageHeader.qml+21
@@ -36,6 +36,8 @@ Item {
3636 property alias showSignatureLine: bottomBorder.visible
3737
3838 property alias bottomItem: bottomContainer.children
39+ property int paginationCount: 0
40+ property int paginationIndex: -1
3941
4042 // TODO We should use foreground for the icons
4143 // of the toolbar but unfortunately Action does not have
@@ -296,6 +298,25 @@ Item {
296298 }
297299 }
298300
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+
299320 Component {
300321 id: popoverComponent
301322 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 {
148148 item.scope = Qt.binding(function() { return scope })
149149 item.isCurrent = Qt.binding(function() { return visible && ListView.isCurrentItem })
150150 dashContent.scopeLoaded(item.scope.id)
151+ item.paginationCount = Qt.binding(function() { return dashContentList.count } )
152+ item.paginationIndex = Qt.binding(function() { return dashContentList.currentIndex } )
151153 }
152154 Connections {
153155 target: isCurrent ? scope : null
qml/Dash/GenericScopeView.qml+2
@@ -35,6 +35,8 @@ FocusScope {
3535 property var categoryView: categoryView
3636 property bool showPageHeader: true
3737 readonly property alias previewShown: previewListView.open
38+ property alias paginationCount: pageHeader.paginationCount
39+ property alias paginationIndex: pageHeader.paginationIndex
3840
3941 property var scopeStyle: ScopeStyle {
4042 style: scope ? scope.customizations : {}
tests/qmltests/Components/tst_PageHeader.qml+21
@@ -192,6 +192,27 @@ Item {
192192 ];
193193 }
194194
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+
195216 function test_popup_closing(data) {
196217 searchEnabled = true;
197218 pageHeader.searchHistory.clear();