File: 1003_ContactReader-support-case-insensitive-search.patch

package info (click to toggle)
qtcontacts-sqlite 0.3.20-4
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 3,952 kB
  • sloc: cpp: 32,880; ansic: 1,269; xml: 62; makefile: 32; sh: 18
file content (39 lines) | stat: -rw-r--r-- 2,062 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
Author: Alberto Mardegan <alberto.mardegan@canonical.com>
Description: ContactReader: support case insensitive search
 It's not clear why the case insensitive filter was limited to the
 MatchFixedString, as that makes impossible to implement a contact
 search.

--- a/src/engine/contactreader.cpp
+++ b/src/engine/contactreader.cpp
@@ -1156,9 +1156,8 @@
             globValue = QContactFilter::MatchContains;
         }
 
-        // We need to perform case-insensitive matching if MatchFixedString is specified (unless
-        // CaseSensitive is also specified)
-        bool caseInsensitive = stringField && fixedString && ((filter.matchFlags() & QContactFilter::MatchCaseSensitive) == 0);
+        // We need to perform case-insensitive unless CaseSensitive is specified
+        bool caseInsensitive = stringField && ((filter.matchFlags() & QContactFilter::MatchCaseSensitive) == 0);
 
         QString clause(detail.where(queryContacts));
         QString comparison = QStringLiteral("%1");
@@ -1308,7 +1307,6 @@
     bool dateField = field.fieldType == DateField;
     bool stringField = field.fieldType == StringField || field.fieldType == LocalizedField;
     bool caseInsensitive = stringField &&
-                           filter.matchFlags() & QContactFilter::MatchFixedString &&
                            (filter.matchFlags() & QContactFilter::MatchCaseSensitive) == 0;
 
     bool needsAnd = false;
--- a/tests/auto/qcontactmanager/tst_qcontactmanager.cpp
+++ b/tests/auto/qcontactmanager/tst_qcontactmanager.cpp
@@ -4987,7 +4987,7 @@
     QCOMPARE(m->contactIds().count(), currCount+1);
 
     QCOMPARE(m->contactIds(exactMatch).count(), originalCount[0] + 1);
-    QCOMPARE(m->contactIds(exactMismatch).count(), originalCount[1]);
+    QCOMPARE(m->contactIds(exactMismatch).count(), originalCount[1] + 1);
     QCOMPARE(m->contactIds(insensitiveMatch).count(), originalCount[2] + 1);
     QCOMPARE(m->contactIds(insensitiveMismatch).count(), originalCount[3] + 1);
     QCOMPARE(m->contactIds(sensitiveMatch).count(), originalCount[4] + 1);