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
1=== modified file 'src/imports/ContactList/ContactList.qml'
2--- src/imports/ContactList/ContactList.qml 2013-07-12 00:13:01 +0000
3+++ src/imports/ContactList/ContactList.qml 2013-07-12 22:08:27 +0000
4@@ -18,6 +18,7 @@
5 import QtContacts 5.0
6 import Ubuntu.Components 0.1
7 import Ubuntu.Components.ListItems 0.1 as ListItem
8+import Ubuntu.Components.Popups 0.1 as Popups
9
10 import "ContactList.js" as Sections
11
12@@ -26,6 +27,23 @@
13
14 title: i18n.tr("Contacts")
15
16+ Component {
17+ id: dialog
18+
19+ Popups.Dialog {
20+ id: dialogue
21+
22+ title: i18n.tr("Error")
23+ text: i18n.tr("Fail to Load contacts")
24+
25+ Button {
26+ text: "Cancel"
27+ gradient: UbuntuColors.greyGradient
28+ onClicked: PopupUtils.close(dialogue)
29+ }
30+ }
31+ }
32+
33 ContactModel {
34 id: contactsModel
35
36@@ -46,6 +64,11 @@
37 ContactDetail.PhoneNumber]
38 }
39
40+ onErrorChanged: {
41+ busyIndicator.busy = false
42+ PopupUtils.open(dialog, null)
43+ }
44+
45 Component.onCompleted: {
46 if (manager == "memory")
47 contactsModel.importContacts(Qt.resolvedUrl("example.vcf"))
48@@ -69,7 +92,7 @@
49 anchors.fill: parent
50 model: contactsModel
51 onCountChanged: {
52- dirtyTimer.restart()
53+ busyIndicator.ping()
54 }
55
56 function isNotEmptyString(string) {
57@@ -131,23 +154,37 @@
58 }
59 }
60
61- Timer {
62- id: dirtyTimer
63-
64- interval: 2000
65- running: false
66- repeat: false
67- onTriggered: {
68- Sections.initSectionData(contactListView)
69- }
70- }
71-
72- ActivityIndicator {
73+ Item {
74 id: busyIndicator
75
76- running: contactListView.count == 0
77- visible: running
78- anchors.centerIn: contactListView
79+ property alias busy: activity.running
80+
81+ function ping()
82+ {
83+ timer.restart()
84+ }
85+
86+ visible: busy
87+ anchors.fill: parent
88+
89+ // This is a workaround to make sure the spinner will disappear if the model is empty
90+ // FIXME: implement a model property to say if the model still busy or not
91+ Timer {
92+ id: timer
93+
94+ interval: 6000
95+ running: true
96+ repeat: false
97+ onTriggered: busyIndicator.busy = false
98+ }
99+
100+ ActivityIndicator {
101+ id: activity
102+
103+ anchors.centerIn: parent
104+ running: contactListView.count == 0
105+ visible: running
106+ }
107 }
108
109 tools: ToolbarItems {

Subscribers

People subscribed via source and target branches