Merge lp:~renatofilho/buteo-sync-plugins-contacts/rename-account-service into lp:buteo-sync-plugins-contacts

Proposed by Renato Araujo Oliveira Filho
Status: Merged
Approved by: Michael Sheldon
Approved revision: 17
Merged at revision: 7
Proposed branch: lp:~renatofilho/buteo-sync-plugins-contacts/rename-account-service
Merge into: lp:buteo-sync-plugins-contacts
Diff against target: 200 lines (+36/-16)
9 files modified
accounts/CMakeLists.txt (+1/-1)
accounts/address-book-app.application (+1/-1)
accounts/google-buteo-contacts.service (+2/-2)
buteo-contact-client/UAuth.cpp (+5/-0)
buteo-contact-client/UContactsBackend.cpp (+10/-4)
buteo-contact-client/UContactsClient.cpp (+14/-5)
google/GContactsClient.cpp (+1/-1)
google/xmls/sync/CMakeLists.txt (+1/-1)
google/xmls/sync/google-buteo-contacts.xml (+1/-1)
To merge this branch: bzr merge lp:~renatofilho/buteo-sync-plugins-contacts/rename-account-service
Reviewer Review Type Date Requested Status
PS Jenkins bot continuous-integration Approve
Michael Sheldon (community) Approve
Review via email: mp+273532@code.launchpad.net

Commit message

Append 'buteo' on online account files to avoid conflict with EDS files.

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

Renamed uoa related service names, to avoid conflict with old services.

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

Renamed online account service to 'google-contacts'.

10. By Renato Araujo Oliveira Filho

Revert category name change.

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

Rename service id to avoid conflicts with EDS.

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

Renamed sync profile teplate to the new service id name.

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

Fixed cmake with the new file name.

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

Fixed typo on filename.

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

Updated missing string with the new service name.

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

Append a extra space in source name to avoid problems with syncevolution.

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) wrote :

Are there any related MPs required for this MP to build/function as expected?
NO

Is your branch in sync with latest trunk?
YES

Did you perform an exploratory manual test run of your code change and any related functionality on device or emulator?
YES

Did you successfully run all tests found in your component's Test Plan on device or emulator?
YES

If you changed the UI, was the change specified/approved by design?
NO UI CHANGE.

If you changed UI labels, did you update the pot file?
NO LABEL CHANGED

If you changed the packaging (debian), did you add a core-dev as a reviewer to this MP?
NO PACKAGE CHANGED

Revision history for this message
Michael Sheldon (michael-sheldon) wrote :

Code looks good

review: Approve
17. By Renato Araujo Oliveira Filho

Add log info message to be printed on log level 6;

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 'accounts/CMakeLists.txt'
2--- accounts/CMakeLists.txt 2015-07-09 15:57:07 +0000
3+++ accounts/CMakeLists.txt 2015-10-15 19:20:43 +0000
4@@ -1,5 +1,5 @@
5 set(SERVICE_FILES
6- google-contacts.service
7+ google-buteo-contacts.service
8 )
9 set(APPLICATION_FILES
10 address-book-app.application
11
12=== modified file 'accounts/address-book-app.application'
13--- accounts/address-book-app.application 2015-07-09 15:57:07 +0000
14+++ accounts/address-book-app.application 2015-10-15 19:20:43 +0000
15@@ -4,7 +4,7 @@
16 <desktop-entry>address-book-app.desktop</desktop-entry>
17
18 <service-types>
19- <service-type id="contacts">
20+ <service-type id="buteo-contacts">
21 <description>Synchronize your contacts</description>
22 </service-type>
23 </service-types>
24
25=== renamed file 'accounts/google-contacts.service' => 'accounts/google-buteo-contacts.service'
26--- accounts/google-contacts.service 2015-07-09 15:57:07 +0000
27+++ accounts/google-buteo-contacts.service 2015-10-15 19:20:43 +0000
28@@ -1,6 +1,6 @@
29 <?xml version="1.0" encoding="UTF-8"?>
30-<service id="google-contacts">
31- <type>contacts</type>
32+<service id="google-buteo-contacts">
33+ <type>buteo-contacts</type>
34 <name>Google Contacts</name>
35 <provider>google</provider>
36 </service>
37
38=== modified file 'buteo-contact-client/UAuth.cpp'
39--- buteo-contact-client/UAuth.cpp 2015-07-21 19:15:51 +0000
40+++ buteo-contact-client/UAuth.cpp 2015-10-15 19:20:43 +0000
41@@ -69,6 +69,11 @@
42 {
43 Q_D(UAuth);
44
45+ if ((accountId == 0) || serviceName.isEmpty()) {
46+ LOG_DEBUG("Invalid account id or service name:" << accountId << serviceName);
47+ return false;
48+ }
49+
50 d->mServiceName = serviceName;
51 if (d->mAccountManager && d_ptr->mAccount) {
52 LOG_DEBUG("GAuth already initialized");
53
54=== modified file 'buteo-contact-client/UContactsBackend.cpp'
55--- buteo-contact-client/UContactsBackend.cpp 2015-09-16 13:32:10 +0000
56+++ buteo-contact-client/UContactsBackend.cpp 2015-10-15 19:20:43 +0000
57@@ -97,7 +97,13 @@
58 contact.setType(QContactType::TypeGroup);
59
60 QContactDisplayLabel label;
61- label.setLabel(syncTarget);
62+ //WORKAROUND: append a extra space in the end of the source name
63+ //this is necessary to avoid conflict with old sources used by syncevolution
64+ //SyncEvolution sync profile sync contacts from gooble based on the source name
65+ //creating a new source with the same name could cause the sync to happen in the
66+ //wrong source
67+ //FIXME: remove this when syncevolution get removed from image
68+ label.setLabel(syncTarget + " ");
69 contact.saveDetail(&label);
70
71 // set the new source as default
72@@ -333,11 +339,11 @@
73 QMap<int, QContactManager::Error> errors;
74 QMap<int, UContactsStatus> statusMap;
75
76- if(iMgr->removeContacts(aContactIDList , &errors)) {
77+ if(aContactIDList.isEmpty() || iMgr->removeContacts(aContactIDList , &errors)) {
78 LOG_DEBUG("Successfully Removed all contacts ");
79 }
80 else {
81- LOG_WARNING("Failed Removing Contacts");
82+ LOG_WARNING("Failed Removing Contacts" << errors);
83 }
84
85 // QContactManager will populate errorMap only for errors, but we use this as a status map,
86@@ -356,8 +362,8 @@
87 }
88 else
89 {
90- LOG_DEBUG("contact with id " << contactId << " and index " << i <<" is in error");
91 QContactManager::Error errorCode = errors.value(i);
92+ LOG_WARNING("Removing contact with id " << contactId << " and index " << i <<" is an error" << errorCode);
93 status.errorCode = errorCode;
94 statusMap.insert(i, status);
95 }
96
97=== modified file 'buteo-contact-client/UContactsClient.cpp'
98--- buteo-contact-client/UContactsClient.cpp 2015-09-24 17:49:06 +0000
99+++ buteo-contact-client/UContactsClient.cpp 2015-10-15 19:20:43 +0000
100@@ -49,8 +49,13 @@
101 : mAuth(0),
102 mContactBackend(0),
103 mRemoteSource(0),
104+ mSlowSync(false),
105+ mAborted(false),
106 mServiceName(serviceName),
107- mAborted(false)
108+ mProgress(0),
109+ mAccountId(0),
110+ mSyncDirection(Buteo::SyncProfile::SYNC_DIRECTION_TWO_WAY),
111+ mConflictResPolicy(Buteo::SyncProfile::CR_POLICY_PREFER_REMOTE_CHANGES)
112 {
113 }
114
115@@ -115,6 +120,7 @@
116 return false;
117 }
118
119+ LOG_INFO ("Init sync for account:" << d->mAccountId << d->mServiceName);
120 d->mAuth = crateAuthenticator(this);
121 if (!d->mAuth || !d->mAuth->init(d->mAccountId, d->mServiceName)) {
122 LOG_CRITICAL("Fail to create auth object");
123@@ -135,8 +141,6 @@
124 goto init_fail;
125 }
126
127- d->mItemResults.insert(syncTargetId(), Buteo::DatabaseResults());
128-
129 // sign in.
130 connect(d->mAuth, SIGNAL(success()), SLOT(start()));
131 connect(d->mAuth, SIGNAL(failed()), SLOT(onAuthenticationError()));
132@@ -150,7 +154,8 @@
133 // Take necessary action when sync is finished
134 connect(this,
135 SIGNAL(syncFinished(Sync::SyncStatus)),
136- SLOT(onSyncFinished(Sync::SyncStatus)));
137+ SLOT(onSyncFinished(Sync::SyncStatus)),
138+ Qt::QueuedConnection);
139
140 return true;
141
142@@ -300,11 +305,13 @@
143 return false;
144 }
145
146- if (!d->mContactBackend->init(d->mAccountId, d->mAuth->accountDisplayName())) {
147+ if (!d->mContactBackend->init(d->mAccountId,
148+ d->mAuth->accountDisplayName())) {
149 LOG_WARNING("Fail to init contact backend");
150 return false;
151 }
152
153+ d->mItemResults.insert(syncTargetId(), Buteo::DatabaseResults());
154 switch (d->mSyncDirection)
155 {
156 case Buteo::SyncProfile::SYNC_DIRECTION_TWO_WAY:
157@@ -788,6 +795,8 @@
158 FUNCTION_CALL_TRACE;
159 Q_D(UContactsClient);
160
161+ LOG_INFO("Sync finished with state:" << aState);
162+
163 switch(aState)
164 {
165 case Sync::SYNC_ERROR:
166
167=== modified file 'google/GContactsClient.cpp'
168--- google/GContactsClient.cpp 2015-07-21 19:15:51 +0000
169+++ google/GContactsClient.cpp 2015-10-15 19:20:43 +0000
170@@ -38,7 +38,7 @@
171
172 #include "buteosyncfw_p.h"
173
174-static const QString GOOGLE_CONTACTS_SERVICE ("google-contacts");
175+static const QString GOOGLE_CONTACTS_SERVICE ("google-buteo-contacts");
176
177 extern "C" GContactsClient* createPlugin(const QString& aPluginName,
178 const Buteo::SyncProfile& aProfile,
179
180=== modified file 'google/xmls/sync/CMakeLists.txt'
181--- google/xmls/sync/CMakeLists.txt 2015-07-09 15:57:07 +0000
182+++ google/xmls/sync/CMakeLists.txt 2015-10-15 19:20:43 +0000
183@@ -1,3 +1,3 @@
184-install(FILES google-contacts.xml
185+install(FILES google-buteo-contacts.xml
186 DESTINATION "/etc/buteo/profiles/sync"
187 )
188
189=== renamed file 'google/xmls/sync/google-contacts.xml' => 'google/xmls/sync/google-buteo-contacts.xml'
190--- google/xmls/sync/google-contacts.xml 2015-07-17 13:52:41 +0000
191+++ google/xmls/sync/google-buteo-contacts.xml 2015-10-15 19:20:43 +0000
192@@ -1,7 +1,7 @@
193 <?xml version="1.0" encoding="UTF-8"?>
194 <profile type="sync" name="google-contacts">
195 <key value="contacts" name="category"/>
196- <key value="google-contacts" name="remote_service_name"/>
197+ <key value="google-buteo-contacts" name="remote_service_name"/>
198 <key value="online" name="destinationtype"/>
199 <key value="false" name="enabled"/>
200 <key value="true" name="hidden"/>

Subscribers

People subscribed via source and target branches