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
=== modified file 'src/imports/Ubuntu/Contacts/ContactListView.qml'
--- src/imports/Ubuntu/Contacts/ContactListView.qml 2016-02-11 23:43:01 +0000
+++ src/imports/Ubuntu/Contacts/ContactListView.qml 2016-02-22 14:19:12 +0000
@@ -526,10 +526,16 @@
526 visible: (typeof(pageStack) !== "undefined") &&526 visible: (typeof(pageStack) !== "undefined") &&
527 ((simList.sims.length > 0) && (simList.present.length > 0))527 ((simList.sims.length > 0) && (simList.present.length > 0))
528 onClicked: {528 onClicked: {
529 pageStack.addPageToNextColumn(pageStack.primaryPage, Qt.resolvedUrl("SIMCardImportPage.qml"),529 if (pageStack.addPageToNextColumn)
530 pageStack.addPageToNextColumn(pageStack.primaryPage, Qt.resolvedUrl("SIMCardImportPage.qml"),
530 {"objectName": "simCardImportPage",531 {"objectName": "simCardImportPage",
531 "targetModel": view.listModel,532 "targetModel": view.listModel,
532 "sims": simList.sims})533 "sims": simList.sims})
534 else
535 pageStack.push(Qt.resolvedUrl("SIMCardImportPage.qml"),
536 {"objectName": "simCardImportPage",
537 "targetModel": view.listModel,
538 "sims": simList.sims})
533 }539 }
534 }540 }
535 }541 }
536542
=== modified file 'src/imports/Ubuntu/Contacts/SIMCardImportPage.qml'
--- src/imports/Ubuntu/Contacts/SIMCardImportPage.qml 2015-12-02 13:36:03 +0000
+++ src/imports/Ubuntu/Contacts/SIMCardImportPage.qml 2016-02-22 14:19:12 +0000
@@ -26,7 +26,7 @@
26Page {26Page {
27 id: root27 id: root
2828
29 readonly property string exportFile: "file://%1/ubuntu_contacts_sim.vcf".arg(Contacts.tempPath)29 readonly property string exportFile: Contacts.tempFile("ubuntu_contacts_XXXXXX.vcf")
30 readonly property alias hasContacts: simCardContacts.hasContacts30 readonly property alias hasContacts: simCardContacts.hasContacts
31 property var targetModel: null31 property var targetModel: null
32 property var sims: []32 property var sims: []
@@ -98,7 +98,7 @@
98 multiSelectionEnabled: true98 multiSelectionEnabled: true
99 multipleSelection: true99 multipleSelection: true
100 showSections: false100 showSections: false
101 visible: !indicator.visible101 visible: !indicator.visible && !statusMessage.visible
102 showBusyIndicator: false102 showBusyIndicator: false
103103
104 manager: "memory"104 manager: "memory"
@@ -147,7 +147,6 @@
147 if (vcardFile != "" && !contactImported) {147 if (vcardFile != "" && !contactImported) {
148 contactImported = true148 contactImported = true
149 contactList.listModel.importContacts(vcardFile)149 contactList.listModel.importContacts(vcardFile)
150
151 }150 }
152 }151 }
153 onVcardFileChanged: {152 onVcardFileChanged: {
@@ -156,7 +155,10 @@
156 contactList.listModel.importContacts(vcardFile)155 contactList.listModel.importContacts(vcardFile)
157 }156 }
158 }157 }
159 onImportFail: root.state = "error"158 onImportFail: {
159 console.error("Sim card import fail")
160 root.state = "error"
161 }
160 }162 }
161163
162 Connections {164 Connections {
@@ -168,9 +170,30 @@
168170
169 onExportCompleted: {171 onExportCompleted: {
170 if ((error === ContactModel.ExportNoError) && targetModel) {172 if ((error === ContactModel.ExportNoError) && targetModel) {
173 root.state = "saving"
171 targetModel.importContacts(url)174 targetModel.importContacts(url)
175 } else {
176 console.error("Failt to export selected contacts")
177 root.state = "error"
178 }
179 }
180 }
181
182 Connections {
183 target: root.targetModel
184 onImportCompleted: {
185 if (error === ContactModel.ImportNoError) {
186 Contacts.removeFile(root.exportFile)
187 root.state = ""
188 if (pageStack.removePages)
189 pageStack.removePages(root)
190 else
191 pageStack.pop()
192 root.importCompleted()
193 } else {
194 console.error("Fail to import contacts on device")
195 root.state = "error"
172 }196 }
173 root.importCompleted()
174 }197 }
175 }198 }
176199
@@ -235,7 +258,15 @@
235 name: "importing"258 name: "importing"
236 PropertyChanges {259 PropertyChanges {
237 target: indicator260 target: indicator
238 title: i18n.dtr("address-book-app", "Importing...")261 title: i18n.dtr("address-book-app", "Reading contacts from SIM...")
262 visible: true
263 }
264 },
265 State {
266 name: "saving"
267 PropertyChanges {
268 target: indicator
269 title: i18n.dtr("address-book-app", "Saving contacts on phone...")
239 visible: true270 visible: true
240 }271 }
241 },272 },
242273
=== modified file 'src/imports/Ubuntu/Contacts/contacts.cpp'
--- src/imports/Ubuntu/Contacts/contacts.cpp 2016-01-22 19:32:28 +0000
+++ src/imports/Ubuntu/Contacts/contacts.cpp 2016-02-22 14:19:12 +0000
@@ -109,6 +109,17 @@
109 return QFile::exists(updaterLockFile());109 return QFile::exists(updaterLockFile());
110}110}
111111
112
113QUrl UbuntuContacts::tempFile(const QString &templateName)
114{
115 QTemporaryFile tmp(QString("%1/%2").arg(tempPath()).arg(templateName));
116 tmp.setAutoRemove(false);
117 if (tmp.open())
118 return QUrl::fromLocalFile(tmp.fileName());
119 else
120 return QUrl();
121}
122
112uint UbuntuContacts::qHash(const QString &str)123uint UbuntuContacts::qHash(const QString &str)
113{124{
114 return ::qHash(str);125 return ::qHash(str);
115126
=== modified file 'src/imports/Ubuntu/Contacts/contacts.h'
--- src/imports/Ubuntu/Contacts/contacts.h 2016-01-22 19:32:28 +0000
+++ src/imports/Ubuntu/Contacts/contacts.h 2016-02-22 14:19:12 +0000
@@ -40,6 +40,7 @@
40 Q_INVOKABLE bool containsLetters(const QString &value);40 Q_INVOKABLE bool containsLetters(const QString &value);
41 Q_INVOKABLE bool removeFile(const QUrl &file);41 Q_INVOKABLE bool removeFile(const QUrl &file);
42 Q_INVOKABLE bool updateIsRunning() const;42 Q_INVOKABLE bool updateIsRunning() const;
43 Q_INVOKABLE QUrl tempFile(const QString &suffix);
43 Q_INVOKABLE uint qHash(const QString &str);44 Q_INVOKABLE uint qHash(const QString &str);
4445
45Q_SIGNALS:46Q_SIGNALS:

Subscribers

People subscribed via source and target branches