Merge lp:~renatofilho/address-book-app/fix-1390128 into lp:~phablet-team/address-book-app/staging

Proposed by Renato Araujo Oliveira Filho
Status: Merged
Approved by: Gustavo Pichorim Boiko
Approved revision: 319
Merged at revision: 318
Proposed branch: lp:~renatofilho/address-book-app/fix-1390128
Merge into: lp:~phablet-team/address-book-app/staging
Diff against target: 117 lines (+39/-28)
2 files modified
src/imports/ContactList/ContactListPage.qml (+14/-22)
src/imports/ContactList/OnlineAccountsMessage.qml (+25/-6)
To merge this branch: bzr merge lp:~renatofilho/address-book-app/fix-1390128
Reviewer Review Type Date Requested Status
PS Jenkins bot continuous-integration Approve
Gustavo Pichorim Boiko (community) Approve
Review via email: mp+240906@code.launchpad.net

Commit message

Avoid show online account dialog if the app was called from another app.
Close the online account dialog if a new contact get created.

To post a comment you must log in.
319. By Renato Araujo Oliveira Filho

Fixed typo.

Revision history for this message
Gustavo Pichorim Boiko (boiko) wrote :

Looks good!

review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/imports/ContactList/ContactListPage.qml'
2--- src/imports/ContactList/ContactListPage.qml 2014-10-23 15:17:14 +0000
3+++ src/imports/ContactList/ContactListPage.qml 2014-11-06 16:58:24 +0000
4@@ -236,14 +236,6 @@
5 emptyStateScreen.visible = false
6
7 }
8-
9- if ((count > 0) && mainPage.onlineAccountsMessageDialog) {
10- // Because of some contacts can take longer to arrive due the dbus delay,
11- // we need to destroy the online account dialog if this happen
12- PopupUtils.close(mainPage.onlineAccountsMessageDialog)
13- mainPage.onlineAccountsMessageDialog = null
14- application.unsetFirstRun()
15- }
16 }
17
18 onAddContactClicked: mainPage.createContactWithPhoneNumber(label)
19@@ -514,16 +506,6 @@
20 }
21 }
22
23- onSyncEnabledChanged: {
24- // close online account dialog if any account get registered
25- // while the app is running
26- if (syncEnabled && mainPage.onlineAccountsMessageDialog) {
27- PopupUtils.close(mainPage.onlineAccountsMessageDialog)
28- mainPage.onlineAccountsMessageDialog = null
29- application.unsetFirstRun()
30- }
31- }
32-
33 // We need to reset the page proprerties in case of the page was created pre-populated,
34 // with phonenumber or contact.
35 onBottomEdgeDismissed: {
36@@ -550,7 +532,7 @@
37 width: childrenRect.width
38 spacing: units.gu(2)
39
40- visible: (contactList.count === 0 && !indicator.visible)
41+ visible: (contactList.count === 0 && !indicator.visible && (mainPage.newPhoneToAdd === ""))
42
43 Icon {
44 id: emptyStateIcon
45@@ -604,11 +586,21 @@
46
47 Loader {
48 id: onlineAccount
49- source: (contactList.count === 0) &&
50- application.firstRun ? Qt.resolvedUrl("./OnlineAccountsMessage.qml") : ""
51+ asynchronous: true
52+ source: Qt.resolvedUrl("./OnlineAccountsMessage.qml")
53+ Binding {
54+ target: onlineAccount.item
55+ property: "dialogVisible"
56+ when: onlineAccount.status === Loader.Ready
57+ value: (contactList.count === 0) &&
58+ !mainPage.syncEnabled &&
59+ !mainPage.pickMode &&
60+ !onlineAccount.item.hasAccounts &&
61+ mainPage.newPhoneToAdd === "" &&
62+ application.firstRun
63+ }
64 }
65
66-
67 Component {
68 id: removeContactDialog
69
70
71=== modified file 'src/imports/ContactList/OnlineAccountsMessage.qml'
72--- src/imports/ContactList/OnlineAccountsMessage.qml 2014-10-22 13:07:18 +0000
73+++ src/imports/ContactList/OnlineAccountsMessage.qml 2014-11-06 16:58:24 +0000
74@@ -23,7 +23,32 @@
75 Item {
76 id: root
77
78+ readonly property bool hasAccounts: (accounts.count > 0)
79 property var onlineAccountsMessageDialog: null
80+ property bool dialogVisible: false
81+
82+ // Add some delay before show or hide the dialog to avoid dialog to get created unnecessary
83+ Behavior on dialogVisible {
84+ SequentialAnimation {
85+ PauseAnimation { duration: 500 }
86+ ScriptAction {
87+ script: {
88+ if (dialogVisible) {
89+ showDialog()
90+ } else {
91+ closeDialog()
92+ }
93+ }
94+ }
95+ }
96+ }
97+
98+ function showDialog()
99+ {
100+ if (root.onlineAccountsMessageDialog == null) {
101+ root.onlineAccountsMessageDialog = PopupUtils.open(noAccountDialog, null)
102+ }
103+ }
104
105 function closeDialog()
106 {
107@@ -86,10 +111,4 @@
108 }
109 }
110 }
111-
112- Component.onCompleted: {
113- if (accounts.count === 0) {
114- root.onlineAccountsMessageDialog = PopupUtils.open(noAccountDialog, null)
115- }
116- }
117 }

Subscribers

People subscribed via source and target branches