Merge lp:~renatofilho/address-book-app/fix-1200397 into lp:address-book-app

Proposed by Renato Araujo Oliveira Filho
Status: Merged
Approved by: Renato Araujo Oliveira Filho
Approved revision: 11
Merged at revision: 11
Proposed branch: lp:~renatofilho/address-book-app/fix-1200397
Merge into: lp:address-book-app
Prerequisite: lp:~renatofilho/address-book-app/fix-1199107
Diff against target: 109 lines (+53/-16)
1 file modified
src/imports/ContactList/ContactList.qml (+53/-16)
To merge this branch: bzr merge lp:~renatofilho/address-book-app/fix-1200397
Reviewer Review Type Date Requested Status
Renato Araujo Oliveira Filho (community) Approve
PS Jenkins bot continuous-integration Approve
Bill Filler (community) Needs Fixing
Review via email: mp+174417@code.launchpad.net

Commit message

Fixed busy indicator timeout to 2sec.

If the model reports a error show the contact load error dialog and stop the spinner.
If the model stay static for 2secs stop the busy indicator.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Bill Filler (bfiller) wrote :

This solution has problems. If the address book service is not running when you launch the app and you have many contacts the spinner stops after two seconds and the screen is still blank. Then after like 10 seconds the results show up.

A better way to implement this
1) start the spinner when app starts
2) to do an initial query for the number of contacts found on the server
3) if result is 0, stop spinner
4) else stop after you've received first page of results

review: Needs Fixing
11. By Renato Araujo Oliveira Filho

Increased spinner timeout to avoid problems when the server still starting.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Renato Araujo Oliveira Filho (renatofilho) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'src/imports/ContactList/ContactList.qml'
--- src/imports/ContactList/ContactList.qml 2013-07-12 00:13:01 +0000
+++ src/imports/ContactList/ContactList.qml 2013-07-12 22:08:27 +0000
@@ -18,6 +18,7 @@
18import QtContacts 5.018import QtContacts 5.0
19import Ubuntu.Components 0.119import Ubuntu.Components 0.1
20import Ubuntu.Components.ListItems 0.1 as ListItem20import Ubuntu.Components.ListItems 0.1 as ListItem
21import Ubuntu.Components.Popups 0.1 as Popups
2122
22import "ContactList.js" as Sections23import "ContactList.js" as Sections
2324
@@ -26,6 +27,23 @@
2627
27 title: i18n.tr("Contacts")28 title: i18n.tr("Contacts")
2829
30 Component {
31 id: dialog
32
33 Popups.Dialog {
34 id: dialogue
35
36 title: i18n.tr("Error")
37 text: i18n.tr("Fail to Load contacts")
38
39 Button {
40 text: "Cancel"
41 gradient: UbuntuColors.greyGradient
42 onClicked: PopupUtils.close(dialogue)
43 }
44 }
45 }
46
29 ContactModel {47 ContactModel {
30 id: contactsModel48 id: contactsModel
3149
@@ -46,6 +64,11 @@
46 ContactDetail.PhoneNumber]64 ContactDetail.PhoneNumber]
47 }65 }
4866
67 onErrorChanged: {
68 busyIndicator.busy = false
69 PopupUtils.open(dialog, null)
70 }
71
49 Component.onCompleted: {72 Component.onCompleted: {
50 if (manager == "memory")73 if (manager == "memory")
51 contactsModel.importContacts(Qt.resolvedUrl("example.vcf"))74 contactsModel.importContacts(Qt.resolvedUrl("example.vcf"))
@@ -69,7 +92,7 @@
69 anchors.fill: parent92 anchors.fill: parent
70 model: contactsModel93 model: contactsModel
71 onCountChanged: {94 onCountChanged: {
72 dirtyTimer.restart()95 busyIndicator.ping()
73 }96 }
7497
75 function isNotEmptyString(string) {98 function isNotEmptyString(string) {
@@ -131,23 +154,37 @@
131 }154 }
132 }155 }
133156
134 Timer {157 Item {
135 id: dirtyTimer
136
137 interval: 2000
138 running: false
139 repeat: false
140 onTriggered: {
141 Sections.initSectionData(contactListView)
142 }
143 }
144
145 ActivityIndicator {
146 id: busyIndicator158 id: busyIndicator
147159
148 running: contactListView.count == 0160 property alias busy: activity.running
149 visible: running161
150 anchors.centerIn: contactListView162 function ping()
163 {
164 timer.restart()
165 }
166
167 visible: busy
168 anchors.fill: parent
169
170 // This is a workaround to make sure the spinner will disappear if the model is empty
171 // FIXME: implement a model property to say if the model still busy or not
172 Timer {
173 id: timer
174
175 interval: 6000
176 running: true
177 repeat: false
178 onTriggered: busyIndicator.busy = false
179 }
180
181 ActivityIndicator {
182 id: activity
183
184 anchors.centerIn: parent
185 running: contactListView.count == 0
186 visible: running
187 }
151 }188 }
152189
153 tools: ToolbarItems {190 tools: ToolbarItems {

Subscribers

People subscribed via source and target branches