Merge lp:~renatofilho/address-book-service/hint-max-count into lp:address-book-service

Proposed by Renato Araujo Oliveira Filho
Status: Superseded
Proposed branch: lp:~renatofilho/address-book-service/hint-max-count
Merge into: lp:address-book-service
Diff against target: 252 lines (+144/-15)
4 files modified
contacts/contacts-service.cpp (+10/-5)
contacts/qcontact-backend.cpp (+8/-6)
tests/tst_tools/mock/mock-buteo.py (+5/-4)
tests/tst_tools/mock/mock-galera.py (+121/-0)
To merge this branch: bzr merge lp:~renatofilho/address-book-service/hint-max-count
Reviewer Review Type Date Requested Status
Gustavo Pichorim Boiko (community) Approve
PS Jenkins bot continuous-integration Approve
Review via email: mp+270544@code.launchpad.net

This proposal has been superseded by a proposal from 2015-10-15.

Commit message

Implemented 'maxCountHint' support for queries.

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

Optimize query when using phone number.

Do a initial filter on contacts based on phone number used in the query.

162. By Renato Araujo Oliveira Filho

Use the last 7 number of the phone as key for the phone number index.

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

Use 'QThreadPool' to filter threads in View class.

This will avoid several threads running at the same time.

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

Optmize union filter with phoneNumber.

165. By Renato Araujo Oliveira Filho

Lock contact-mode for read-only instead of full lock.

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

Removed debug messages.
Added optimizations for interserc filter with phone number.

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

Update tests with the new DBUS API.

168. By Renato Araujo Oliveira Filho

Make sure to update contact map whe a contact change came from folks.

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

Typo fixed.

170. By Renato Araujo Oliveira Filho

Merged 'lp:~tiagosh/address-book-service/close-view-asynchronously'

171. By Renato Araujo Oliveira Filho

Fixed wrong merge.

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

Fixed contact service crash.
Fixed contact sort order while searching for contacts.

173. By Renato Araujo Oliveira Filho

Fixed test enviroment setup.

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 :

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 CHANGED

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
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
174. By Renato Araujo Oliveira Filho

Run tests using ctest and without thread.

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

Set request fetch hint for sync "contacts" function.

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

Avoid emit serviceChanged twice on initialization.

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

Only accepts queries if service is ready.

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

Trunk merged.

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

Export 'isReady' property on galera mock.

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

Looks good and works as expected!

review: Approve
180. By Renato Araujo Oliveira Filho

Trunk merged.

181. By Renato Araujo Oliveira Filho

Merged: ~renatofilho/address-book-service/fix-translation-pkg

Unmerged revisions

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'contacts/contacts-service.cpp'
--- contacts/contacts-service.cpp 2015-09-18 14:58:37 +0000
+++ contacts/contacts-service.cpp 2015-10-05 12:36:29 +0000
@@ -183,8 +183,11 @@
183183
184void GaleraContactsService::onServiceReady()184void GaleraContactsService::onServiceReady()
185{185{
186 m_serviceIsReady = m_iface.data()->property("isReady").toBool();186 bool isReady = m_iface.data()->property("isReady").toBool();
187 Q_EMIT serviceChanged();187 if (isReady != m_serviceIsReady) {
188 m_serviceIsReady = isReady;
189 Q_EMIT serviceChanged();
190 }
188}191}
189192
190void GaleraContactsService::initialize()193void GaleraContactsService::initialize()
@@ -195,12 +198,14 @@
195 CPIM_ADDRESSBOOK_IFACE_NAME));198 CPIM_ADDRESSBOOK_IFACE_NAME));
196 if (!m_iface->lastError().isValid()) {199 if (!m_iface->lastError().isValid()) {
197 m_serviceIsReady = m_iface.data()->property("isReady").toBool();200 m_serviceIsReady = m_iface.data()->property("isReady").toBool();
198 connect(m_iface.data(), SIGNAL(readyChanged()), this, SLOT(onServiceReady()));201 connect(m_iface.data(), SIGNAL(readyChanged()), this, SLOT(onServiceReady()), Qt::UniqueConnection);
199 connect(m_iface.data(), SIGNAL(safeModeChanged()), this, SIGNAL(serviceChanged()));202 connect(m_iface.data(), SIGNAL(safeModeChanged()), this, SIGNAL(serviceChanged()));
200 connect(m_iface.data(), SIGNAL(contactsAdded(QStringList)), this, SLOT(onContactsAdded(QStringList)));203 connect(m_iface.data(), SIGNAL(contactsAdded(QStringList)), this, SLOT(onContactsAdded(QStringList)));
201 connect(m_iface.data(), SIGNAL(contactsRemoved(QStringList)), this, SLOT(onContactsRemoved(QStringList)));204 connect(m_iface.data(), SIGNAL(contactsRemoved(QStringList)), this, SLOT(onContactsRemoved(QStringList)));
202 connect(m_iface.data(), SIGNAL(contactsUpdated(QStringList)), this, SLOT(onContactsUpdated(QStringList)));205 connect(m_iface.data(), SIGNAL(contactsUpdated(QStringList)), this, SLOT(onContactsUpdated(QStringList)));
203 Q_EMIT serviceChanged();206 if (m_serviceIsReady) {
207 Q_EMIT serviceChanged();
208 }
204 } else {209 } else {
205 qWarning() << "Fail to connect with service:" << m_iface->lastError();210 qWarning() << "Fail to connect with service:" << m_iface->lastError();
206 m_iface.clear();211 m_iface.clear();
@@ -231,7 +236,7 @@
231236
232bool GaleraContactsService::isOnline() const237bool GaleraContactsService::isOnline() const
233{238{
234 return !m_iface.isNull();239 return !m_iface.isNull() && m_serviceIsReady;
235}240}
236241
237void GaleraContactsService::fetchContactsById(QtContacts::QContactFetchByIdRequest *request)242void GaleraContactsService::fetchContactsById(QtContacts::QContactFetchByIdRequest *request)
238243
=== modified file 'contacts/qcontact-backend.cpp'
--- contacts/qcontact-backend.cpp 2015-09-16 15:57:58 +0000
+++ contacts/qcontact-backend.cpp 2015-10-05 12:36:29 +0000
@@ -78,7 +78,7 @@
78 connect(m_service, SIGNAL(contactsAdded(QList<QContactId>)), this, SIGNAL(contactsAdded(QList<QContactId>)));78 connect(m_service, SIGNAL(contactsAdded(QList<QContactId>)), this, SIGNAL(contactsAdded(QList<QContactId>)));
79 connect(m_service, SIGNAL(contactsRemoved(QList<QContactId>)), this, SIGNAL(contactsRemoved(QList<QContactId>)));79 connect(m_service, SIGNAL(contactsRemoved(QList<QContactId>)), this, SIGNAL(contactsRemoved(QList<QContactId>)));
80 connect(m_service, SIGNAL(contactsUpdated(QList<QContactId>)), this, SIGNAL(contactsChanged(QList<QContactId>)));80 connect(m_service, SIGNAL(contactsUpdated(QList<QContactId>)), this, SIGNAL(contactsChanged(QList<QContactId>)));
81 connect(m_service, SIGNAL(serviceChanged()), this, SIGNAL(dataChanged()));81 connect(m_service, SIGNAL(serviceChanged()), this, SIGNAL(dataChanged()), Qt::QueuedConnection);
82}82}
8383
84/*! Frees any memory used by this engine */84/*! Frees any memory used by this engine */
@@ -121,14 +121,13 @@
121121
122QList<QtContacts::QContact> GaleraManagerEngine::contacts(const QtContacts::QContactFilter &filter,122QList<QtContacts::QContact> GaleraManagerEngine::contacts(const QtContacts::QContactFilter &filter,
123 const QList<QtContacts::QContactSortOrder>& sortOrders,123 const QList<QtContacts::QContactSortOrder>& sortOrders,
124 const QContactFetchHint &fetchHint, QtContacts::QContactManager::Error *error) const124 const QContactFetchHint &fetchHint,
125 QtContacts::QContactManager::Error *error) const
125{126{
126 Q_UNUSED(fetchHint);
127 Q_UNUSED(error);
128
129 QContactFetchRequest request;127 QContactFetchRequest request;
130 request.setFilter(filter);128 request.setFilter(filter);
131 request.setSorting(sortOrders);129 request.setSorting(sortOrders);
130 request.setFetchHint(fetchHint);
132131
133 const_cast<GaleraManagerEngine*>(this)->startRequest(&request);132 const_cast<GaleraManagerEngine*>(this)->startRequest(&request);
134 const_cast<GaleraManagerEngine*>(this)->waitForRequestFinished(&request, -1);133 const_cast<GaleraManagerEngine*>(this)->waitForRequestFinished(&request, -1);
@@ -140,7 +139,10 @@
140 return request.contacts();139 return request.contacts();
141}140}
142141
143QList<QContact> GaleraManagerEngine::contacts(const QList<QContactId> &contactIds, const QContactFetchHint &fetchHint, QMap<int, QContactManager::Error> *errorMap, QContactManager::Error *error) const142QList<QContact> GaleraManagerEngine::contacts(const QList<QContactId> &contactIds,
143 const QContactFetchHint &fetchHint,
144 QMap<int, QContactManager::Error> *errorMap,
145 QContactManager::Error *error) const
144{146{
145 QContactFetchByIdRequest request;147 QContactFetchByIdRequest request;
146 request.setIds(contactIds);148 request.setIds(contactIds);
147149
=== modified file 'tests/tst_tools/mock/mock-buteo.py'
--- tests/tst_tools/mock/mock-buteo.py 2015-09-29 14:19:23 +0000
+++ tests/tst_tools/mock/mock-buteo.py 2015-10-05 12:36:29 +0000
@@ -60,6 +60,11 @@
60 return profileName60 return profileName
6161
62 @dbus.service.method(dbus_interface=MAIN_IFACE,62 @dbus.service.method(dbus_interface=MAIN_IFACE,
63 out_signature='as')
64 def runningSyncs(self):
65 return []
66
67 @dbus.service.method(dbus_interface=MAIN_IFACE,
63 in_signature='ss', out_signature='as')68 in_signature='ss', out_signature='as')
64 def syncProfilesByKey(self, key, value):69 def syncProfilesByKey(self, key, value):
65 if key == "accountid" and (value in self._profiles):70 if key == "accountid" and (value in self._profiles):
@@ -85,10 +90,6 @@
85 def signalProfileChanged(self, profileId, status, changedProfile):90 def signalProfileChanged(self, profileId, status, changedProfile):
86 print("profileChanged called")91 print("profileChanged called")
8792
88 @dbus.service.signal(dbus_interface=MAIN_IFACE)
89 def safeModeChanged(self):
90 print("safeModeChanged called")
91
92 def _run(self):93 def _run(self):
93 self._mainloop.run()94 self._mainloop.run()
9495
9596
=== modified file 'tests/tst_tools/mock/mock-galera.py'
--- tests/tst_tools/mock/mock-galera.py 2015-09-29 14:19:23 +0000
+++ tests/tst_tools/mock/mock-galera.py 2015-10-05 12:36:29 +0000
@@ -52,6 +52,7 @@
52 dbus.service.Object.__init__(self, dbus.SessionBus(), object_path)52 dbus.service.Object.__init__(self, dbus.SessionBus(), object_path)
53 self._mainloop = GObject.MainLoop()53 self._mainloop = GObject.MainLoop()
54 self._view = AddressBookView(VIEW_OBJ)54 self._view = AddressBookView(VIEW_OBJ)
55 self._isReady = True
55 self._sources = {}56 self._sources = {}
5657
57 @dbus.service.method(dbus_interface=MAIN_IFACE,58 @dbus.service.method(dbus_interface=MAIN_IFACE,
@@ -111,6 +112,126 @@
111 def contactsUpdated(self, contacts):112 def contactsUpdated(self, contacts):
112 print("contactsUpdated called")113 print("contactsUpdated called")
113114
115 @dbus.service.signal(dbus_interface=MAIN_IFACE)
116 def safeModeChanged(self):
117 print("safeModeChanged called")
118
119 @dbus.service.signal(dbus_interface=MAIN_IFACE)
120 def readyChanged(self):
121 print("readyChanged called")
122
123
124 #properties
125 @dbus.service.method(dbus_interface='org.freedesktop.DBus.Introspectable',
126 out_signature='s')
127 def Introspect(self):
128 return """<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN"
129 "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
130 <node name="/com/canonical/pim/AddressBook">
131 <interface name="com.canonical.pim.AddressBook">
132 <property name="isReady" type="b" access="read"/>
133 <signal name="readyChanged">
134 </signal>
135 <method name="reset">
136 <arg direction="out" type="b" />
137 </method>
138 <method name="availableSources">
139 <arg direction="out" type="a(ssssubb)" />
140 </method>
141 <signal name="safeModeChanged">
142 </signal>
143 <method name="query">
144 <arg direction="in" type="s" name="clause" />
145 <arg direction="in" type="s" name="sort" />
146 <arg direction="in" type="i" name="max_count" />
147 <arg direction="in" type="b" name="show_invisible" />
148 <arg direction="in" type="as" name="sources" />
149 <arg direction="out" type="o" />
150 </method>
151 <method name="createSource">
152 <arg direction="in" type="s" name="sourceId" />
153 <arg direction="in" type="s" name="sourceName" />
154 <arg direction="in" type="s" name="provider" />
155 <arg direction="in" type="s" name="applicationId" />
156 <arg direction="in" type="i" name="accountId" />
157 <arg direction="in" type="b" name="readOnly" />
158 <arg direction="in" type="b" name="primary" />
159 <arg direction="out" type="b" />
160 </method>
161 <signal name="contactsRemoved">
162 <arg type="as" name="contacts" />
163 </signal>
164 <method name="removeSource">
165 <arg direction="in" type="s" name="sourceId" />
166 <arg direction="out" type="b" />
167 </method>
168 <signal name="contactsAdded">
169 <arg type="as" name="contacts" />
170 </signal>
171 <method name="removeContacts">
172 <arg direction="in" type="as" name="contactIds" />
173 <arg direction="out" type="i" />
174 </method>
175 <signal name="contactsUpdated">
176 <arg type="as" name="contacts" />
177 </signal>
178 </interface>
179 <interface name="org.freedesktop.DBus.Introspectable">
180 <method name="Introspect">
181 <arg direction="out" type="s" />
182 </method>
183 </interface>
184 <interface name="org.freedesktop.DBus.Properties">
185 <method name="Set">
186 <arg direction="in" type="s" name="interface_name" />
187 <arg direction="in" type="s" name="property_name" />
188 <arg direction="in" type="v" name="new_value" />
189 </method>
190 <signal name="PropertiesChanged">
191 <arg type="s" name="interface_name" />
192 <arg type="a{sv}" name="changed_properties" />
193 <arg type="as" name="invalidated_properties" />
194 </signal>
195 <method name="Get">
196 <arg direction="in" type="s" name="interface_name" />
197 <arg direction="in" type="s" name="property_name" />
198 <arg direction="out" type="v" />
199 </method>
200 <method name="GetAll">
201 <arg direction="in" type="s" name="interface_name" />
202 <arg direction="out" type="a{sv}" />
203 </method>
204 </interface>
205 </node>
206 """
207
208 @dbus.service.method(dbus_interface=dbus.PROPERTIES_IFACE,
209 in_signature='ss', out_signature='v')
210 def Get(self, interface_name, property_name):
211 return self.GetAll(interface_name)[property_name]
212
213 @dbus.service.method(dbus_interface=dbus.PROPERTIES_IFACE,
214 in_signature='s', out_signature='a{sv}')
215 def GetAll(self, interface_name):
216 print("Get Property")
217 return {'isReady': True}
218
219 @dbus.service.method(dbus_interface=dbus.PROPERTIES_IFACE,
220 in_signature='ssv')
221 def Set(self, interface_name, property_name, new_value):
222 # validate the property name and value, update internal stateā€¦
223 if property_name == 'isReady':
224 self._isReady = new_value
225 self.readyChanged()
226
227 self.PropertiesChanged(interface_name,
228 { property_name: new_value }, [])
229
230 @dbus.service.signal(dbus_interface=dbus.PROPERTIES_IFACE,
231 signature='sa{sv}as')
232 def PropertiesChanged(self, interface_name, changed_properties,
233 invalidated_properties):
234 pass
114235
115 #helper functions236 #helper functions
116 @dbus.service.method(dbus_interface=MAIN_IFACE,237 @dbus.service.method(dbus_interface=MAIN_IFACE,

Subscribers

People subscribed via source and target branches