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
1=== modified file 'contacts/contacts-service.cpp'
2--- contacts/contacts-service.cpp 2015-09-18 14:58:37 +0000
3+++ contacts/contacts-service.cpp 2015-10-05 12:36:29 +0000
4@@ -183,8 +183,11 @@
5
6 void GaleraContactsService::onServiceReady()
7 {
8- m_serviceIsReady = m_iface.data()->property("isReady").toBool();
9- Q_EMIT serviceChanged();
10+ bool isReady = m_iface.data()->property("isReady").toBool();
11+ if (isReady != m_serviceIsReady) {
12+ m_serviceIsReady = isReady;
13+ Q_EMIT serviceChanged();
14+ }
15 }
16
17 void GaleraContactsService::initialize()
18@@ -195,12 +198,14 @@
19 CPIM_ADDRESSBOOK_IFACE_NAME));
20 if (!m_iface->lastError().isValid()) {
21 m_serviceIsReady = m_iface.data()->property("isReady").toBool();
22- connect(m_iface.data(), SIGNAL(readyChanged()), this, SLOT(onServiceReady()));
23+ connect(m_iface.data(), SIGNAL(readyChanged()), this, SLOT(onServiceReady()), Qt::UniqueConnection);
24 connect(m_iface.data(), SIGNAL(safeModeChanged()), this, SIGNAL(serviceChanged()));
25 connect(m_iface.data(), SIGNAL(contactsAdded(QStringList)), this, SLOT(onContactsAdded(QStringList)));
26 connect(m_iface.data(), SIGNAL(contactsRemoved(QStringList)), this, SLOT(onContactsRemoved(QStringList)));
27 connect(m_iface.data(), SIGNAL(contactsUpdated(QStringList)), this, SLOT(onContactsUpdated(QStringList)));
28- Q_EMIT serviceChanged();
29+ if (m_serviceIsReady) {
30+ Q_EMIT serviceChanged();
31+ }
32 } else {
33 qWarning() << "Fail to connect with service:" << m_iface->lastError();
34 m_iface.clear();
35@@ -231,7 +236,7 @@
36
37 bool GaleraContactsService::isOnline() const
38 {
39- return !m_iface.isNull();
40+ return !m_iface.isNull() && m_serviceIsReady;
41 }
42
43 void GaleraContactsService::fetchContactsById(QtContacts::QContactFetchByIdRequest *request)
44
45=== modified file 'contacts/qcontact-backend.cpp'
46--- contacts/qcontact-backend.cpp 2015-09-16 15:57:58 +0000
47+++ contacts/qcontact-backend.cpp 2015-10-05 12:36:29 +0000
48@@ -78,7 +78,7 @@
49 connect(m_service, SIGNAL(contactsAdded(QList<QContactId>)), this, SIGNAL(contactsAdded(QList<QContactId>)));
50 connect(m_service, SIGNAL(contactsRemoved(QList<QContactId>)), this, SIGNAL(contactsRemoved(QList<QContactId>)));
51 connect(m_service, SIGNAL(contactsUpdated(QList<QContactId>)), this, SIGNAL(contactsChanged(QList<QContactId>)));
52- connect(m_service, SIGNAL(serviceChanged()), this, SIGNAL(dataChanged()));
53+ connect(m_service, SIGNAL(serviceChanged()), this, SIGNAL(dataChanged()), Qt::QueuedConnection);
54 }
55
56 /*! Frees any memory used by this engine */
57@@ -121,14 +121,13 @@
58
59 QList<QtContacts::QContact> GaleraManagerEngine::contacts(const QtContacts::QContactFilter &filter,
60 const QList<QtContacts::QContactSortOrder>& sortOrders,
61- const QContactFetchHint &fetchHint, QtContacts::QContactManager::Error *error) const
62+ const QContactFetchHint &fetchHint,
63+ QtContacts::QContactManager::Error *error) const
64 {
65- Q_UNUSED(fetchHint);
66- Q_UNUSED(error);
67-
68 QContactFetchRequest request;
69 request.setFilter(filter);
70 request.setSorting(sortOrders);
71+ request.setFetchHint(fetchHint);
72
73 const_cast<GaleraManagerEngine*>(this)->startRequest(&request);
74 const_cast<GaleraManagerEngine*>(this)->waitForRequestFinished(&request, -1);
75@@ -140,7 +139,10 @@
76 return request.contacts();
77 }
78
79-QList<QContact> GaleraManagerEngine::contacts(const QList<QContactId> &contactIds, const QContactFetchHint &fetchHint, QMap<int, QContactManager::Error> *errorMap, QContactManager::Error *error) const
80+QList<QContact> GaleraManagerEngine::contacts(const QList<QContactId> &contactIds,
81+ const QContactFetchHint &fetchHint,
82+ QMap<int, QContactManager::Error> *errorMap,
83+ QContactManager::Error *error) const
84 {
85 QContactFetchByIdRequest request;
86 request.setIds(contactIds);
87
88=== modified file 'tests/tst_tools/mock/mock-buteo.py'
89--- tests/tst_tools/mock/mock-buteo.py 2015-09-29 14:19:23 +0000
90+++ tests/tst_tools/mock/mock-buteo.py 2015-10-05 12:36:29 +0000
91@@ -60,6 +60,11 @@
92 return profileName
93
94 @dbus.service.method(dbus_interface=MAIN_IFACE,
95+ out_signature='as')
96+ def runningSyncs(self):
97+ return []
98+
99+ @dbus.service.method(dbus_interface=MAIN_IFACE,
100 in_signature='ss', out_signature='as')
101 def syncProfilesByKey(self, key, value):
102 if key == "accountid" and (value in self._profiles):
103@@ -85,10 +90,6 @@
104 def signalProfileChanged(self, profileId, status, changedProfile):
105 print("profileChanged called")
106
107- @dbus.service.signal(dbus_interface=MAIN_IFACE)
108- def safeModeChanged(self):
109- print("safeModeChanged called")
110-
111 def _run(self):
112 self._mainloop.run()
113
114
115=== modified file 'tests/tst_tools/mock/mock-galera.py'
116--- tests/tst_tools/mock/mock-galera.py 2015-09-29 14:19:23 +0000
117+++ tests/tst_tools/mock/mock-galera.py 2015-10-05 12:36:29 +0000
118@@ -52,6 +52,7 @@
119 dbus.service.Object.__init__(self, dbus.SessionBus(), object_path)
120 self._mainloop = GObject.MainLoop()
121 self._view = AddressBookView(VIEW_OBJ)
122+ self._isReady = True
123 self._sources = {}
124
125 @dbus.service.method(dbus_interface=MAIN_IFACE,
126@@ -111,6 +112,126 @@
127 def contactsUpdated(self, contacts):
128 print("contactsUpdated called")
129
130+ @dbus.service.signal(dbus_interface=MAIN_IFACE)
131+ def safeModeChanged(self):
132+ print("safeModeChanged called")
133+
134+ @dbus.service.signal(dbus_interface=MAIN_IFACE)
135+ def readyChanged(self):
136+ print("readyChanged called")
137+
138+
139+ #properties
140+ @dbus.service.method(dbus_interface='org.freedesktop.DBus.Introspectable',
141+ out_signature='s')
142+ def Introspect(self):
143+ return """<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN"
144+ "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
145+ <node name="/com/canonical/pim/AddressBook">
146+ <interface name="com.canonical.pim.AddressBook">
147+ <property name="isReady" type="b" access="read"/>
148+ <signal name="readyChanged">
149+ </signal>
150+ <method name="reset">
151+ <arg direction="out" type="b" />
152+ </method>
153+ <method name="availableSources">
154+ <arg direction="out" type="a(ssssubb)" />
155+ </method>
156+ <signal name="safeModeChanged">
157+ </signal>
158+ <method name="query">
159+ <arg direction="in" type="s" name="clause" />
160+ <arg direction="in" type="s" name="sort" />
161+ <arg direction="in" type="i" name="max_count" />
162+ <arg direction="in" type="b" name="show_invisible" />
163+ <arg direction="in" type="as" name="sources" />
164+ <arg direction="out" type="o" />
165+ </method>
166+ <method name="createSource">
167+ <arg direction="in" type="s" name="sourceId" />
168+ <arg direction="in" type="s" name="sourceName" />
169+ <arg direction="in" type="s" name="provider" />
170+ <arg direction="in" type="s" name="applicationId" />
171+ <arg direction="in" type="i" name="accountId" />
172+ <arg direction="in" type="b" name="readOnly" />
173+ <arg direction="in" type="b" name="primary" />
174+ <arg direction="out" type="b" />
175+ </method>
176+ <signal name="contactsRemoved">
177+ <arg type="as" name="contacts" />
178+ </signal>
179+ <method name="removeSource">
180+ <arg direction="in" type="s" name="sourceId" />
181+ <arg direction="out" type="b" />
182+ </method>
183+ <signal name="contactsAdded">
184+ <arg type="as" name="contacts" />
185+ </signal>
186+ <method name="removeContacts">
187+ <arg direction="in" type="as" name="contactIds" />
188+ <arg direction="out" type="i" />
189+ </method>
190+ <signal name="contactsUpdated">
191+ <arg type="as" name="contacts" />
192+ </signal>
193+ </interface>
194+ <interface name="org.freedesktop.DBus.Introspectable">
195+ <method name="Introspect">
196+ <arg direction="out" type="s" />
197+ </method>
198+ </interface>
199+ <interface name="org.freedesktop.DBus.Properties">
200+ <method name="Set">
201+ <arg direction="in" type="s" name="interface_name" />
202+ <arg direction="in" type="s" name="property_name" />
203+ <arg direction="in" type="v" name="new_value" />
204+ </method>
205+ <signal name="PropertiesChanged">
206+ <arg type="s" name="interface_name" />
207+ <arg type="a{sv}" name="changed_properties" />
208+ <arg type="as" name="invalidated_properties" />
209+ </signal>
210+ <method name="Get">
211+ <arg direction="in" type="s" name="interface_name" />
212+ <arg direction="in" type="s" name="property_name" />
213+ <arg direction="out" type="v" />
214+ </method>
215+ <method name="GetAll">
216+ <arg direction="in" type="s" name="interface_name" />
217+ <arg direction="out" type="a{sv}" />
218+ </method>
219+ </interface>
220+ </node>
221+ """
222+
223+ @dbus.service.method(dbus_interface=dbus.PROPERTIES_IFACE,
224+ in_signature='ss', out_signature='v')
225+ def Get(self, interface_name, property_name):
226+ return self.GetAll(interface_name)[property_name]
227+
228+ @dbus.service.method(dbus_interface=dbus.PROPERTIES_IFACE,
229+ in_signature='s', out_signature='a{sv}')
230+ def GetAll(self, interface_name):
231+ print("Get Property")
232+ return {'isReady': True}
233+
234+ @dbus.service.method(dbus_interface=dbus.PROPERTIES_IFACE,
235+ in_signature='ssv')
236+ def Set(self, interface_name, property_name, new_value):
237+ # validate the property name and value, update internal stateā€¦
238+ if property_name == 'isReady':
239+ self._isReady = new_value
240+ self.readyChanged()
241+
242+ self.PropertiesChanged(interface_name,
243+ { property_name: new_value }, [])
244+
245+ @dbus.service.signal(dbus_interface=dbus.PROPERTIES_IFACE,
246+ signature='sa{sv}as')
247+ def PropertiesChanged(self, interface_name, changed_properties,
248+ invalidated_properties):
249+ pass
250
251 #helper functions
252 @dbus.service.method(dbus_interface=MAIN_IFACE,

Subscribers

People subscribed via source and target branches