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

Proposed by Renato Araujo Oliveira Filho on 2014-12-15
Status: Merged
Approved by: Bill Filler on 2015-01-09
Approved revision: 351
Merged at revision: 356
Proposed branch: lp:~renatofilho/address-book-app/fix-1367906
Merge into: lp:address-book-app
Prerequisite: lp:~renatofilho/address-book-app/fix-search-by-name
Diff against target: 60 lines (+21/-3)
3 files modified
src/imports/Ubuntu/Contacts/ContactListModel.qml (+4/-3)
src/imports/Ubuntu/Contacts/contacts.cpp (+16/-0)
src/imports/Ubuntu/Contacts/contacts.h (+1/-0)
To merge this branch: bzr merge lp:~renatofilho/address-book-app/fix-1367906
Reviewer Review Type Date Requested Status
Bill Filler (community) 2014-12-15 Approve on 2015-01-09
PS Jenkins bot continuous-integration Needs Fixing on 2015-01-05
Review via email: mp+244788@code.launchpad.net

This proposal supersedes a proposal from 2014-12-15.

Commit message

Implemented search for unaccented contact names.

To post a comment you must log in.
351. By Renato Araujo Oliveira Filho on 2015-01-05

Fixed contact filter when using contact manager != "galera"

Bill Filler (bfiller) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/imports/Ubuntu/Contacts/ContactListModel.qml'
2--- src/imports/Ubuntu/Contacts/ContactListModel.qml 2014-12-15 13:38:41 +0000
3+++ src/imports/Ubuntu/Contacts/ContactListModel.qml 2015-01-05 18:32:29 +0000
4@@ -16,6 +16,7 @@
5
6 import QtQuick 2.2
7 import QtContacts 5.0
8+import Ubuntu.Contacts 0.1
9
10 ContactModel {
11 id: root
12@@ -75,9 +76,9 @@
13
14 filters: [
15 DetailFilter {
16- detail: ContactDetail.DisplayLabel
17- field: DisplayLabel.Label
18- value: contactTermFilter.value
19+ detail: (root.manager === "galera" ? ContactDetail.ExtendedDetail : ContactDetail.DisplayLabel)
20+ field: (root.manager === "galera" ? ExtendedDetail.Data : DisplayLabel.Label)
21+ value: (root.manager === "galera" ? Contacts.normalized(contactTermFilter.value) : contactTermFilter.value)
22 matchFlags: DetailFilter.MatchContains
23 }
24 ]
25
26=== modified file 'src/imports/Ubuntu/Contacts/contacts.cpp'
27--- src/imports/Ubuntu/Contacts/contacts.cpp 2014-07-05 22:00:02 +0000
28+++ src/imports/Ubuntu/Contacts/contacts.cpp 2015-01-05 18:32:29 +0000
29@@ -39,3 +39,19 @@
30
31 return initials;
32 }
33+
34+QString UbuntuContacts::normalized(const QString &value)
35+{
36+ QString s2 = value.normalized(QString::NormalizationForm_D);
37+ QString out;
38+
39+ for (int i=0, j=s2.length(); i<j; i++)
40+ {
41+ // strip diacritic marks
42+ if (s2.at(i).category() != QChar::Mark_NonSpacing &&
43+ s2.at(i).category() != QChar::Mark_SpacingCombining) {
44+ out.append(s2.at(i));
45+ }
46+ }
47+ return out;
48+}
49
50=== modified file 'src/imports/Ubuntu/Contacts/contacts.h'
51--- src/imports/Ubuntu/Contacts/contacts.h 2014-07-05 22:00:02 +0000
52+++ src/imports/Ubuntu/Contacts/contacts.h 2015-01-05 18:32:29 +0000
53@@ -28,6 +28,7 @@
54 UbuntuContacts(QObject *parent = 0);
55
56 Q_INVOKABLE QString contactInitialsFromString(const QString &value);
57+ Q_INVOKABLE QString normalized(const QString &value);
58 };
59
60 #endif //_UBUNTU_CONTACTS_H_

Subscribers

People subscribed via source and target branches