Commit cb76152b authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Don't add empty list

parent e31bba2f
......@@ -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;
......
......@@ -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();
......
......@@ -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;
}
......
......@@ -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);
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment