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
1
Merge Requests
1
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
c4f820d9
Commit
c4f820d9
authored
Jul 01, 2016
by
Laurent Montel
😁
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add more autotest
parent
34dc6dfc
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
48 additions
and
3 deletions
+48
-3
kmail/editorsendcheckplugins/checkbeforesend/autotests/checkattachmentjobtest.cpp
...gins/checkbeforesend/autotests/checkattachmentjobtest.cpp
+25
-0
kmail/editorsendcheckplugins/checkbeforesend/autotests/checkattachmentjobtest.h
...lugins/checkbeforesend/autotests/checkattachmentjobtest.h
+2
-0
kmail/editorsendcheckplugins/checkbeforesend/checkbeforesendinterface.cpp
...checkplugins/checkbeforesend/checkbeforesendinterface.cpp
+5
-2
kmail/editorsendcheckplugins/checkbeforesend/sendattachments/checkattachmentdialog.cpp
...checkbeforesend/sendattachments/checkattachmentdialog.cpp
+5
-0
kmail/editorsendcheckplugins/checkbeforesend/sendattachments/checkattachmentdialog.h
...s/checkbeforesend/sendattachments/checkattachmentdialog.h
+2
-0
kmail/editorsendcheckplugins/checkbeforesend/sendattachments/checkattachmentjob.cpp
...ns/checkbeforesend/sendattachments/checkattachmentjob.cpp
+9
-1
No files found.
kmail/editorsendcheckplugins/checkbeforesend/autotests/checkattachmentjobtest.cpp
View file @
c4f820d9
...
...
@@ -52,4 +52,29 @@ void CheckAttachmentJobTest::shouldAssignEmails()
QCOMPARE
(
job
.
originalEmails
(),
lst
);
}
void
CheckAttachmentJobTest
::
shouldRemoveDuplicatedEmails
()
{
QFETCH
(
QStringList
,
originalEmails
);
QFETCH
(
QStringList
,
result
);
CheckAttachmentJob
job
;
job
.
setOriginalEmails
(
originalEmails
);
job
.
start
();
QCOMPARE
(
job
.
resultList
(),
result
);
}
void
CheckAttachmentJobTest
::
shouldRemoveDuplicatedEmails_data
()
{
QTest
::
addColumn
<
QStringList
>
(
"originalEmails"
);
QTest
::
addColumn
<
QStringList
>
(
"result"
);
QTest
::
newRow
(
"empty"
)
<<
QStringList
()
<<
QStringList
();
QStringList
lst
{
QStringLiteral
(
"foo@kde.org"
),
QStringLiteral
(
"bla@kde.org"
)};
QTest
::
newRow
(
"samelist"
)
<<
lst
<<
lst
;
QStringList
original
{
QStringLiteral
(
"foo@kde.org"
),
QStringLiteral
(
"bla@kde.org"
),
QStringLiteral
(
"bla@kde.org"
)};
QStringList
result
{
QStringLiteral
(
"foo@kde.org"
),
QStringLiteral
(
"bla@kde.org"
)};
QTest
::
newRow
(
"oneduplicate"
)
<<
original
<<
result
;
}
QTEST_MAIN
(
CheckAttachmentJobTest
)
kmail/editorsendcheckplugins/checkbeforesend/autotests/checkattachmentjobtest.h
View file @
c4f820d9
...
...
@@ -31,6 +31,8 @@ public:
private
Q_SLOTS
:
void
shouldHaveDefaultValue
();
void
shouldAssignEmails
();
void
shouldRemoveDuplicatedEmails
();
void
shouldRemoveDuplicatedEmails_data
();
};
#endif // CHECKATTACHMENTJOBTEST_H
kmail/editorsendcheckplugins/checkbeforesend/checkbeforesendinterface.cpp
View file @
c4f820d9
...
...
@@ -21,6 +21,7 @@
#include "duplicateemails/checkduplicateemailsjob.h"
#include "duplicateemails/checkduplicateemailsdialog.h"
#include "sendattachments/checkattachmentdialog.h"
#include "sendattachments/checkattachmentjob.h"
#include <KMessageBox>
#include <KConfigGroup>
...
...
@@ -96,8 +97,10 @@ bool CheckBeforeSendInterface::exec(const MessageComposer::PluginEditorCheckBefo
if
(
params
.
hasAttachment
())
{
QPointer
<
CheckAttachmentDialog
>
dlg
=
new
CheckAttachmentDialog
(
parentWidget
());
const
QStringList
lst
{
params
.
bccAddresses
(),
params
.
toAddresses
(),
params
.
ccAddresses
()
};
//dlg->setListOfEmails();
//TODO
CheckAttachmentJob
job
;
job
.
setOriginalEmails
(
lst
);
job
.
start
();
dlg
->
setEmails
(
job
.
resultList
());
if
(
dlg
->
exec
())
{
delete
dlg
;
return
true
;
...
...
kmail/editorsendcheckplugins/checkbeforesend/sendattachments/checkattachmentdialog.cpp
View file @
c4f820d9
...
...
@@ -49,6 +49,11 @@ CheckAttachmentDialog::~CheckAttachmentDialog()
writeConfig
();
}
void
CheckAttachmentDialog
::
setEmails
(
const
QStringList
&
emails
)
{
mListWidget
->
clear
();
mListWidget
->
addItems
(
emails
);
}
void
CheckAttachmentDialog
::
writeConfig
()
{
...
...
kmail/editorsendcheckplugins/checkbeforesend/sendattachments/checkattachmentdialog.h
View file @
c4f820d9
...
...
@@ -28,6 +28,8 @@ class CheckAttachmentDialog : public QDialog
public:
explicit
CheckAttachmentDialog
(
QWidget
*
parent
=
Q_NULLPTR
);
~
CheckAttachmentDialog
();
void
setEmails
(
const
QStringList
&
emails
);
private:
void
writeConfig
();
void
readConfig
();
...
...
kmail/editorsendcheckplugins/checkbeforesend/sendattachments/checkattachmentjob.cpp
View file @
c4f820d9
...
...
@@ -18,6 +18,7 @@
*/
#include "checkattachmentjob.h"
#include <KEmailAddress>
CheckAttachmentJob
::
CheckAttachmentJob
()
{
...
...
@@ -32,8 +33,15 @@ CheckAttachmentJob::~CheckAttachmentJob()
void
CheckAttachmentJob
::
start
()
{
mResultList
.
clear
();
Q_FOREACH
(
const
QString
&
email
,
mOriginalEmails
)
{
Q_FOREACH
(
const
QString
&
email
,
mOriginalEmails
)
{
QString
tname
,
temail
;
KEmailAddress
::
extractEmailAddressAndName
(
email
,
temail
,
tname
);
// ignore return value
if
(
!
temail
.
isEmpty
())
{
if
(
!
mResultList
.
contains
(
temail
))
{
mResultList
.
append
(
temail
);
}
}
}
}
...
...
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