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

Proposed by Renato Araujo Oliveira Filho
Status: Merged
Approved by: Gustavo Pichorim Boiko
Approved revision: 540
Merged at revision: 540
Proposed branch: lp:~renatofilho/address-book-app/fix-1450252
Merge into: lp:address-book-app
Prerequisite: lp:~renatofilho/address-book-app/visuals-update
Diff against target: 146 lines (+56/-7)
4 files modified
src/imports/Ubuntu/Contacts/ContactListView.qml (+7/-1)
src/imports/Ubuntu/Contacts/SIMCardImportPage.qml (+37/-6)
src/imports/Ubuntu/Contacts/contacts.cpp (+11/-0)
src/imports/Ubuntu/Contacts/contacts.h (+1/-0)
To merge this branch: bzr merge lp:~renatofilho/address-book-app/fix-1450252
Reviewer Review Type Date Requested Status
Gustavo Pichorim Boiko (community) Approve
PS Jenkins bot continuous-integration Needs Fixing
Review via email: mp+284908@code.launchpad.net

This proposal supersedes a proposal from 2016-02-03.

Commit message

Make sure the import page still visible while importing contacts from sim.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
536. By Renato Araujo Oliveira Filho

Add debug messages.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
537. By Renato Araujo Oliveira Filho

Pop import contacts from sim page on import complet.

538. By Renato Araujo Oliveira Filho

Parent merged.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
539. By Renato Araujo Oliveira Filho

Removed debug messages.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
540. By Renato Araujo Oliveira Filho

Remove debug messages.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Gustavo Pichorim Boiko (boiko) wrote :

Looks good!

review: Approve
541. By Renato Araujo Oliveira Filho

Trunk merged.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/imports/Ubuntu/Contacts/ContactListView.qml'
2--- src/imports/Ubuntu/Contacts/ContactListView.qml 2016-02-11 23:43:01 +0000
3+++ src/imports/Ubuntu/Contacts/ContactListView.qml 2016-02-22 14:19:12 +0000
4@@ -526,10 +526,16 @@
5 visible: (typeof(pageStack) !== "undefined") &&
6 ((simList.sims.length > 0) && (simList.present.length > 0))
7 onClicked: {
8- pageStack.addPageToNextColumn(pageStack.primaryPage, Qt.resolvedUrl("SIMCardImportPage.qml"),
9+ if (pageStack.addPageToNextColumn)
10+ pageStack.addPageToNextColumn(pageStack.primaryPage, Qt.resolvedUrl("SIMCardImportPage.qml"),
11 {"objectName": "simCardImportPage",
12 "targetModel": view.listModel,
13 "sims": simList.sims})
14+ else
15+ pageStack.push(Qt.resolvedUrl("SIMCardImportPage.qml"),
16+ {"objectName": "simCardImportPage",
17+ "targetModel": view.listModel,
18+ "sims": simList.sims})
19 }
20 }
21 }
22
23=== modified file 'src/imports/Ubuntu/Contacts/SIMCardImportPage.qml'
24--- src/imports/Ubuntu/Contacts/SIMCardImportPage.qml 2015-12-02 13:36:03 +0000
25+++ src/imports/Ubuntu/Contacts/SIMCardImportPage.qml 2016-02-22 14:19:12 +0000
26@@ -26,7 +26,7 @@
27 Page {
28 id: root
29
30- readonly property string exportFile: "file://%1/ubuntu_contacts_sim.vcf".arg(Contacts.tempPath)
31+ readonly property string exportFile: Contacts.tempFile("ubuntu_contacts_XXXXXX.vcf")
32 readonly property alias hasContacts: simCardContacts.hasContacts
33 property var targetModel: null
34 property var sims: []
35@@ -98,7 +98,7 @@
36 multiSelectionEnabled: true
37 multipleSelection: true
38 showSections: false
39- visible: !indicator.visible
40+ visible: !indicator.visible && !statusMessage.visible
41 showBusyIndicator: false
42
43 manager: "memory"
44@@ -147,7 +147,6 @@
45 if (vcardFile != "" && !contactImported) {
46 contactImported = true
47 contactList.listModel.importContacts(vcardFile)
48-
49 }
50 }
51 onVcardFileChanged: {
52@@ -156,7 +155,10 @@
53 contactList.listModel.importContacts(vcardFile)
54 }
55 }
56- onImportFail: root.state = "error"
57+ onImportFail: {
58+ console.error("Sim card import fail")
59+ root.state = "error"
60+ }
61 }
62
63 Connections {
64@@ -168,9 +170,30 @@
65
66 onExportCompleted: {
67 if ((error === ContactModel.ExportNoError) && targetModel) {
68+ root.state = "saving"
69 targetModel.importContacts(url)
70+ } else {
71+ console.error("Failt to export selected contacts")
72+ root.state = "error"
73+ }
74+ }
75+ }
76+
77+ Connections {
78+ target: root.targetModel
79+ onImportCompleted: {
80+ if (error === ContactModel.ImportNoError) {
81+ Contacts.removeFile(root.exportFile)
82+ root.state = ""
83+ if (pageStack.removePages)
84+ pageStack.removePages(root)
85+ else
86+ pageStack.pop()
87+ root.importCompleted()
88+ } else {
89+ console.error("Fail to import contacts on device")
90+ root.state = "error"
91 }
92- root.importCompleted()
93 }
94 }
95
96@@ -235,7 +258,15 @@
97 name: "importing"
98 PropertyChanges {
99 target: indicator
100- title: i18n.dtr("address-book-app", "Importing...")
101+ title: i18n.dtr("address-book-app", "Reading contacts from SIM...")
102+ visible: true
103+ }
104+ },
105+ State {
106+ name: "saving"
107+ PropertyChanges {
108+ target: indicator
109+ title: i18n.dtr("address-book-app", "Saving contacts on phone...")
110 visible: true
111 }
112 },
113
114=== modified file 'src/imports/Ubuntu/Contacts/contacts.cpp'
115--- src/imports/Ubuntu/Contacts/contacts.cpp 2016-01-22 19:32:28 +0000
116+++ src/imports/Ubuntu/Contacts/contacts.cpp 2016-02-22 14:19:12 +0000
117@@ -109,6 +109,17 @@
118 return QFile::exists(updaterLockFile());
119 }
120
121+
122+QUrl UbuntuContacts::tempFile(const QString &templateName)
123+{
124+ QTemporaryFile tmp(QString("%1/%2").arg(tempPath()).arg(templateName));
125+ tmp.setAutoRemove(false);
126+ if (tmp.open())
127+ return QUrl::fromLocalFile(tmp.fileName());
128+ else
129+ return QUrl();
130+}
131+
132 uint UbuntuContacts::qHash(const QString &str)
133 {
134 return ::qHash(str);
135
136=== modified file 'src/imports/Ubuntu/Contacts/contacts.h'
137--- src/imports/Ubuntu/Contacts/contacts.h 2016-01-22 19:32:28 +0000
138+++ src/imports/Ubuntu/Contacts/contacts.h 2016-02-22 14:19:12 +0000
139@@ -40,6 +40,7 @@
140 Q_INVOKABLE bool containsLetters(const QString &value);
141 Q_INVOKABLE bool removeFile(const QUrl &file);
142 Q_INVOKABLE bool updateIsRunning() const;
143+ Q_INVOKABLE QUrl tempFile(const QString &suffix);
144 Q_INVOKABLE uint qHash(const QString &str);
145
146 Q_SIGNALS:

Subscribers

People subscribed via source and target branches