summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMontel Laurent <montel@kde.org>2016-11-16 20:16:01 (GMT)
committerMontel Laurent <montel@kde.org>2016-11-16 20:16:01 (GMT)
commitcb76152becb85e0be8ec1f93dfeb9bf34c4eccc0 (patch)
treee97ffe91482a0458beeeb04d6c20fe5ffe3cf978
parente31bba2f5c244acd9f3fd1205711da51c7f04619 (diff)
Don't add empty list
-rw-r--r--kmail/editorsendcheckplugins/automaticaddcontacts/automaticaddcontactsinterface.cpp11
-rw-r--r--kmail/editorsendcheckplugins/checkbeforesend/checkbeforesendinterface.cpp23
-rw-r--r--kmail/editorsendcheckplugins/confirm-address/confirmaddressinterface.cpp11
-rw-r--r--kmail/editorsendcheckplugins/confirm-address/confirmaddresswidget.cpp6
4 files changed, 43 insertions, 8 deletions
diff --git a/kmail/editorsendcheckplugins/automaticaddcontacts/automaticaddcontactsinterface.cpp b/kmail/editorsendcheckplugins/automaticaddcontacts/automaticaddcontactsinterface.cpp
index e6fab66..5d247ad 100644
--- a/kmail/editorsendcheckplugins/automaticaddcontacts/automaticaddcontactsinterface.cpp
+++ b/kmail/editorsendcheckplugins/automaticaddcontacts/automaticaddcontactsinterface.cpp
@@ -39,7 +39,16 @@ bool AutomaticAddContactsInterface::exec(const MessageComposer::PluginEditorChec
AutomaticAddContactsSettings setting = mHashSettings.value(params.identity());
if (setting.mEnabled) {
if (setting.mContactCollection.isValid()) {
- const QStringList lst{ params.bccAddresses(), params.toAddresses(), params.ccAddresses() };
+ QStringList lst;
+ if (!params.ccAddresses().trimmed().isEmpty()) {
+ lst << params.ccAddresses();
+ }
+ if (!params.bccAddresses().trimmed().isEmpty()) {
+ lst << params.bccAddresses();
+ }
+ if (!params.toAddresses().trimmed().isEmpty()) {
+ lst << params.toAddresses();
+ }
if (!lst.isEmpty()) {
//Don't delete it, it's autodelete
AutomaticAddContactsJob *job = new AutomaticAddContactsJob;
diff --git a/kmail/editorsendcheckplugins/checkbeforesend/checkbeforesendinterface.cpp b/kmail/editorsendcheckplugins/checkbeforesend/checkbeforesendinterface.cpp
index 40fb40b..717f433 100644
--- a/kmail/editorsendcheckplugins/checkbeforesend/checkbeforesendinterface.cpp
+++ b/kmail/editorsendcheckplugins/checkbeforesend/checkbeforesendinterface.cpp
@@ -68,8 +68,16 @@ bool CheckBeforeSendInterface::exec(const MessageComposer::PluginEditorCheckBefo
}
}
if (mCheckDuplicateEmails) {
- const QStringList lst{ params.bccAddresses(), params.toAddresses(), params.ccAddresses() };
-
+ QStringList lst;
+ if (!params.ccAddresses().trimmed().isEmpty()) {
+ lst << params.ccAddresses();
+ }
+ if (!params.bccAddresses().trimmed().isEmpty()) {
+ lst << params.bccAddresses();
+ }
+ if (!params.toAddresses().trimmed().isEmpty()) {
+ lst << params.toAddresses();
+ }
if (!lst.isEmpty()) {
CheckDuplicateEmailsJob job;
job.setEmails(lst);
@@ -91,7 +99,16 @@ bool CheckBeforeSendInterface::exec(const MessageComposer::PluginEditorCheckBefo
if (mCheckSendAttachments) {
if (params.hasAttachment()) {
QPointer<CheckAttachmentDialog> dlg = new CheckAttachmentDialog(parentWidget());
- const QStringList lst{ params.bccAddresses(), params.toAddresses(), params.ccAddresses() };
+ QStringList lst;
+ if (!params.ccAddresses().trimmed().isEmpty()) {
+ lst << params.ccAddresses();
+ }
+ if (!params.bccAddresses().trimmed().isEmpty()) {
+ lst << params.bccAddresses();
+ }
+ if (!params.toAddresses().trimmed().isEmpty()) {
+ lst << params.toAddresses();
+ }
CheckAttachmentJob job;
job.setOriginalEmails(lst);
job.start();
diff --git a/kmail/editorsendcheckplugins/confirm-address/confirmaddressinterface.cpp b/kmail/editorsendcheckplugins/confirm-address/confirmaddressinterface.cpp
index 9311fd7..e1c1463 100644
--- a/kmail/editorsendcheckplugins/confirm-address/confirmaddressinterface.cpp
+++ b/kmail/editorsendcheckplugins/confirm-address/confirmaddressinterface.cpp
@@ -44,7 +44,16 @@ ConfirmAddressInterface::~ConfirmAddressInterface()
bool ConfirmAddressInterface::exec(const MessageComposer::PluginEditorCheckBeforeSendParams &params)
{
- const QStringList lst{ params.bccAddresses(), params.toAddresses(), params.ccAddresses() };
+ QStringList lst;
+ if (!params.ccAddresses().trimmed().isEmpty()) {
+ lst << params.ccAddresses();
+ }
+ if (!params.bccAddresses().trimmed().isEmpty()) {
+ lst << params.bccAddresses();
+ }
+ if (!params.toAddresses().trimmed().isEmpty()) {
+ lst << params.toAddresses();
+ }
if (lst.isEmpty()) {
return true;
}
diff --git a/kmail/editorsendcheckplugins/confirm-address/confirmaddresswidget.cpp b/kmail/editorsendcheckplugins/confirm-address/confirmaddresswidget.cpp
index ac25b7a..53ae1ba 100644
--- a/kmail/editorsendcheckplugins/confirm-address/confirmaddresswidget.cpp
+++ b/kmail/editorsendcheckplugins/confirm-address/confirmaddresswidget.cpp
@@ -61,12 +61,12 @@ void ConfirmAddressWidget::createAddressItems(const QStringList &address, bool v
Q_FOREACH (const QString &email, address) {
QListWidgetItem *item = new QListWidgetItem(email, mListEmails);
item->setFlags(item->flags() | Qt::ItemIsUserCheckable);
- if (!valid) {
+ if (valid) {
+ item->setFlags(item->flags() & ~ Qt::ItemIsUserCheckable);
+ } else {
item->setFlags(item->flags() | Qt::ItemIsUserCheckable);
item->setCheckState(Qt::Unchecked);
item->setTextColor(Qt::red);
- } else {
- item->setFlags(item->flags() & ~ Qt::ItemIsUserCheckable);
}
mListEmails->addItem(item);
}