Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
K
KDE PIM Add-ons
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
PIM
KDE PIM Add-ons
Commits
f6960615
Commit
f6960615
authored
Jun 23, 2016
by
Laurent Montel
😁
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Extract emails
parent
6fdf0005
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
23 deletions
+28
-23
kmail/editorsendcheckplugins/checkbeforesend/autotests/checkduplicateemailsjobtest.cpp
...checkbeforesend/autotests/checkduplicateemailsjobtest.cpp
+20
-20
kmail/editorsendcheckplugins/checkbeforesend/checkduplicateemailsjob.cpp
...dcheckplugins/checkbeforesend/checkduplicateemailsjob.cpp
+8
-3
No files found.
kmail/editorsendcheckplugins/checkbeforesend/autotests/checkduplicateemailsjobtest.cpp
View file @
f6960615
...
@@ -55,38 +55,38 @@ void CheckDuplicateEmailsJobTest::shouldReturnEmails_data()
...
@@ -55,38 +55,38 @@ void CheckDuplicateEmailsJobTest::shouldReturnEmails_data()
QTest
::
newRow
(
"empty"
)
<<
QStringList
()
<<
QMap
<
QString
,
int
>
();
QTest
::
newRow
(
"empty"
)
<<
QStringList
()
<<
QMap
<
QString
,
int
>
();
QStringList
lst
;
QStringList
lst
;
lst
.
append
(
QStringLiteral
(
"foo"
));
lst
.
append
(
QStringLiteral
(
"foo
@kde.org
"
));
lst
.
append
(
QStringLiteral
(
"bla"
));
lst
.
append
(
QStringLiteral
(
"bla
@kde.org
"
));
lst
.
append
(
QStringLiteral
(
"blo"
));
lst
.
append
(
QStringLiteral
(
"blo
@kde.org
"
));
QTest
::
newRow
(
"emptyresultbutnotemptylist"
)
<<
lst
<<
QMap
<
QString
,
int
>
();
QTest
::
newRow
(
"emptyresultbutnotemptylist"
)
<<
lst
<<
QMap
<
QString
,
int
>
();
lst
.
clear
();
lst
.
clear
();
lst
.
append
(
QStringLiteral
(
"foo"
));
lst
.
append
(
QStringLiteral
(
"foo
@kde.org
"
));
lst
.
append
(
QStringLiteral
(
"foo"
));
lst
.
append
(
QStringLiteral
(
"foo
@kde.org
"
));
lst
.
append
(
QStringLiteral
(
"blo"
));
lst
.
append
(
QStringLiteral
(
"blo
@kde.org
"
));
QMap
<
QString
,
int
>
result
;
QMap
<
QString
,
int
>
result
;
result
.
insert
(
QStringLiteral
(
"foo"
),
2
);
result
.
insert
(
QStringLiteral
(
"foo
@kde.org
"
),
2
);
QTest
::
newRow
(
"oneduplicateemails"
)
<<
lst
<<
result
;
QTest
::
newRow
(
"oneduplicateemails"
)
<<
lst
<<
result
;
lst
.
clear
();
lst
.
clear
();
lst
.
append
(
QStringLiteral
(
"foo"
));
lst
.
append
(
QStringLiteral
(
"foo
@kde.org
"
));
lst
.
append
(
QStringLiteral
(
"foo"
));
lst
.
append
(
QStringLiteral
(
"foo
@kde.org
"
));
lst
.
append
(
QStringLiteral
(
"blo"
));
lst
.
append
(
QStringLiteral
(
"blo
@kde.org
"
));
lst
.
append
(
QStringLiteral
(
"blo"
));
lst
.
append
(
QStringLiteral
(
"blo
@kde.org
"
));
result
.
clear
();
result
.
clear
();
result
.
insert
(
QStringLiteral
(
"foo"
),
2
);
result
.
insert
(
QStringLiteral
(
"foo
@kde.org
"
),
2
);
result
.
insert
(
QStringLiteral
(
"blo"
),
2
);
result
.
insert
(
QStringLiteral
(
"blo
@kde.org
"
),
2
);
QTest
::
newRow
(
"twoduplicateemails"
)
<<
lst
<<
result
;
QTest
::
newRow
(
"twoduplicateemails"
)
<<
lst
<<
result
;
lst
.
clear
();
lst
.
clear
();
lst
.
append
(
QStringLiteral
(
"foo"
));
lst
.
append
(
QStringLiteral
(
"foo
@kde.org
"
));
lst
.
append
(
QStringLiteral
(
"foo"
));
lst
.
append
(
QStringLiteral
(
"foo
@kde.org
"
));
lst
.
append
(
QStringLiteral
(
"foo"
));
lst
.
append
(
QStringLiteral
(
"foo
@kde.org
"
));
lst
.
append
(
QStringLiteral
(
"blo"
));
lst
.
append
(
QStringLiteral
(
"blo
@kde.org
"
));
lst
.
append
(
QStringLiteral
(
"blo"
));
lst
.
append
(
QStringLiteral
(
"blo
@kde.org
"
));
result
.
clear
();
result
.
clear
();
result
.
insert
(
QStringLiteral
(
"foo"
),
3
);
result
.
insert
(
QStringLiteral
(
"foo
@kde.org
"
),
3
);
result
.
insert
(
QStringLiteral
(
"blo"
),
2
);
result
.
insert
(
QStringLiteral
(
"blo
@kde.org
"
),
2
);
QTest
::
newRow
(
"twoduplicateemailswithdifferentvalue"
)
<<
lst
<<
result
;
QTest
::
newRow
(
"twoduplicateemailswithdifferentvalue"
)
<<
lst
<<
result
;
}
}
...
...
kmail/editorsendcheckplugins/checkbeforesend/checkduplicateemailsjob.cpp
View file @
f6960615
...
@@ -17,6 +17,8 @@
...
@@ -17,6 +17,8 @@
Boston, MA 02110-1301, USA.
Boston, MA 02110-1301, USA.
*/
*/
#include "checkduplicateemailsjob.h"
#include "checkduplicateemailsjob.h"
#include <KEmailAddress>
#include <QDebug>
CheckDuplicateEmailsJob
::
CheckDuplicateEmailsJob
()
CheckDuplicateEmailsJob
::
CheckDuplicateEmailsJob
()
{
{
...
@@ -36,11 +38,14 @@ void CheckDuplicateEmailsJob::start()
...
@@ -36,11 +38,14 @@ void CheckDuplicateEmailsJob::start()
}
}
QMap
<
QString
,
int
>
results
;
QMap
<
QString
,
int
>
results
;
Q_FOREACH
(
const
QString
&
email
,
mEmails
)
{
Q_FOREACH
(
const
QString
&
email
,
mEmails
)
{
int
val
=
results
.
value
(
email
,
0
);
QString
tname
,
temail
;
KEmailAddress
::
extractEmailAddressAndName
(
email
,
temail
,
tname
);
// ignore return value
int
val
=
results
.
value
(
temail
,
0
);
if
(
val
==
0
)
{
if
(
val
==
0
)
{
results
.
insert
(
email
,
val
+
1
);
results
.
insert
(
t
email
,
val
+
1
);
}
else
{
}
else
{
results
[
email
]
=
val
+
1
;
results
[
t
email
]
=
val
+
1
;
}
}
}
}
QMapIterator
<
QString
,
int
>
i
(
results
);
QMapIterator
<
QString
,
int
>
i
(
results
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment