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

List:       kde-commits
Subject:    [kdepim-addons] kmail/editorsendcheckplugins/checkbeforesend: Move code to improve autotests
From:       Montel Laurent <montel () kde ! org>
Date:       2016-06-26 5:48:01
Message-ID: E1bH2vJ-00063b-UD () code ! kde ! org
[Download RAW message or body]

Git commit ca0dfa527d52f55581b8a26277dc3ee7b498c908 by Montel Laurent.
Committed on 26/06/2016 at 05:47.
Pushed by mlaurent into branch 'master'.

Move code to improve autotests

M  +9    -0    kmail/editorsendcheckplugins/checkbeforesend/autotests/checkduplicateemailsjobtest.cpp
 M  +2    -4    kmail/editorsendcheckplugins/checkbeforesend/checkbeforesendinterface.cpp
 M  +4    -1    kmail/editorsendcheckplugins/checkbeforesend/checkduplicateemailsjob.cpp


http://commits.kde.org/kdepim-addons/ca0dfa527d52f55581b8a26277dc3ee7b498c908

diff --git a/kmail/editorsendcheckplugins/checkbeforesend/autotests/checkduplicateemailsjobtest.cpp \
b/kmail/editorsendcheckplugins/checkbeforesend/autotests/checkduplicateemailsjobtest.cpp
 index 46beeea..c3bbfea 100644
--- a/kmail/editorsendcheckplugins/checkbeforesend/autotests/checkduplicateemailsjobtest.cpp
                
+++ b/kmail/editorsendcheckplugins/checkbeforesend/autotests/checkduplicateemailsjobtest.cpp
 @@ -100,6 +100,15 @@ void CheckDuplicateEmailsJobTest::shouldReturnEmails_data()
     result.insert(QStringLiteral("foo@kde.org"), 3);
     result.insert(QStringLiteral("blo@kde.org"), 2);
     QTest::newRow("twoduplicateemailswithemailname") << lst << result;
+
+
+    lst.clear();
+    lst.append(QStringLiteral("foo <foo@kde.org>, foo@kde.org, foo@kde.org"));
+    lst.append(QStringLiteral("foo@kde.org"));
+
+    result.clear();
+    result.insert(QStringLiteral("foo@kde.org"), 4);
+    QTest::newRow("emailseparatedbycommat") << lst << result;
 }
 
 void CheckDuplicateEmailsJobTest::shouldReturnEmails()
diff --git a/kmail/editorsendcheckplugins/checkbeforesend/checkbeforesendinterface.cpp \
b/kmail/editorsendcheckplugins/checkbeforesend/checkbeforesendinterface.cpp index \
                cc0414a..cbb9f02 100644
--- a/kmail/editorsendcheckplugins/checkbeforesend/checkbeforesendinterface.cpp
+++ b/kmail/editorsendcheckplugins/checkbeforesend/checkbeforesendinterface.cpp
@@ -71,12 +71,10 @@ bool CheckBeforeSendInterface::exec(const \
MessageComposer::PluginEditorCheckBefo  }
     if (mCheckDuplicateEmails) {
         const QStringList lst{ params.bccAddresses(), params.toAddresses(), \
                params.ccAddresses() };
-        const QString str = lst.join(QStringLiteral(", "));
-        const QStringList emails = str.split(QStringLiteral(", "));
 
-        if (!emails.isEmpty()) {
+        if (!lst.isEmpty()) {
             CheckDuplicateEmailsJob job;
-            job.setEmails(emails);
+            job.setEmails(lst);
             job.start();
             const QMap<QString, int> results = job.result();
             if (!results.isEmpty()) {
diff --git a/kmail/editorsendcheckplugins/checkbeforesend/checkduplicateemailsjob.cpp \
b/kmail/editorsendcheckplugins/checkbeforesend/checkduplicateemailsjob.cpp index \
                72d472f..2a0ec79 100644
--- a/kmail/editorsendcheckplugins/checkbeforesend/checkduplicateemailsjob.cpp
+++ b/kmail/editorsendcheckplugins/checkbeforesend/checkduplicateemailsjob.cpp
@@ -61,7 +61,10 @@ void CheckDuplicateEmailsJob::start()
 
 void CheckDuplicateEmailsJob::setEmails(const QStringList &list)
 {
-    mEmails = list;
+    const QString str = list.join(QStringLiteral(", "));
+    const QStringList emails = str.split(QStringLiteral(", "));
+
+    mEmails = emails;
 }
 
 QMap<QString, int> CheckDuplicateEmailsJob::result() const


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

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