[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [kdepim/KDE/4.14] libkdepim/addressline: Don't duplicate when we have:
From:       Montel Laurent <montel () kde ! org>
Date:       2015-02-04 20:48:23
Message-ID: E1YJ6s3-0003OG-3y () scm ! kde ! org
[Download RAW message or body]

Git commit 875eb02fdd5d97cf4d8db127cc73755b2f3b0076 by Montel Laurent.
Committed on 04/02/2015 at 20:17.
Pushed by mlaurent into branch 'KDE/4.14'.

Don't duplicate when we have:

"  John Doe <john.doe@example.com>
  Doe John <John.Doe@example.com>
  John.Doe@example.com"

M  +15   -0    libkdepim/addressline/autotests/baloocompletionemailtest.cpp
M  +1    -0    libkdepim/addressline/autotests/baloocompletionemailtest.h
M  +2    -2    libkdepim/addressline/baloocompletionemail.cpp

http://commits.kde.org/kdepim/875eb02fdd5d97cf4d8db127cc73755b2f3b0076

diff --git a/libkdepim/addressline/autotests/baloocompletionemailtest.cpp b=
/libkdepim/addressline/autotests/baloocompletionemailtest.cpp
index d541209..bc563d7 100644
--- a/libkdepim/addressline/autotests/baloocompletionemailtest.cpp
+++ b/libkdepim/addressline/autotests/baloocompletionemailtest.cpp
@@ -188,4 +188,19 @@ void BalooCompletionEmailTest::shouldExcludeDuplicateE=
ntryWithDisplayNameAddAddr
 =

 }
 =

+void BalooCompletionEmailTest::shouldExcludeDuplicateEntryWithDifferentDis=
playNameAddAddressWithDifferentCase()
+{
+    KPIM::BalooCompletionEmail completion;
+    QStringList emailList;
+    emailList << QLatin1String("John Doe <doe@example.com>");
+    emailList << QLatin1String("\"John Doe\" <doe@example.com>");
+    emailList << QLatin1String("\"\'John Doe\'\" <doe@example.com>");
+    emailList << QLatin1String("John Doe <doe@example.com>");
+    emailList << QLatin1String("Doe John <Doe@example.com>");
+    emailList << QLatin1String("John <DOE@example.com>");
+    emailList << QLatin1String("Doe <dOE@example.com>");
+    completion.setEmailList(emailList);
+    QCOMPARE(completion.cleanupEmailList().count(), 1);
+}
+
 QTEST_KDEMAIN(BalooCompletionEmailTest, NoGUI)
diff --git a/libkdepim/addressline/autotests/baloocompletionemailtest.h b/l=
ibkdepim/addressline/autotests/baloocompletionemailtest.h
index 7237b07..e4c6978 100644
--- a/libkdepim/addressline/autotests/baloocompletionemailtest.h
+++ b/libkdepim/addressline/autotests/baloocompletionemailtest.h
@@ -41,6 +41,7 @@ private Q_SLOTS:
     void shouldDontDuplicateEmailWhenUseCase();
     void shouldExcludeDuplicateEntryWithDisplayName();
     void shouldExcludeDuplicateEntryWithDisplayNameAddAddressWithDifferent=
Case();
+    void shouldExcludeDuplicateEntryWithDifferentDisplayNameAddAddressWith=
DifferentCase();
 };
 =

 #endif // BALOOCOMPLETIONEMAILTEST_H
diff --git a/libkdepim/addressline/baloocompletionemail.cpp b/libkdepim/add=
ressline/baloocompletionemail.cpp
index df81099..9221801 100644
--- a/libkdepim/addressline/baloocompletionemail.cpp
+++ b/libkdepim/addressline/baloocompletionemail.cpp
@@ -65,8 +65,8 @@ QStringList BalooCompletionEmail::cleanupEmailList()
                     }
                 }
             }
-            if (!excludeMail && !hashEmail.contains(email.toLower())) {
-                hashEmail.insert(email.toLower(), email);
+            if (!excludeMail && !hashEmail.contains(address.toLower())) {
+                hashEmail.insert(address.toLower(), email);
             }
         }
     }

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic