Commit 107f91f1 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Fix add recipients

parent 914e294c
Pipeline #88611 passed with stage
in 41 minutes and 49 seconds
......@@ -141,7 +141,7 @@ void ComposerViewBase::setMessage(const KMime::Message::Ptr &msg, bool allowDecr
if (auto hrd = m_msg->headerByType("X-KMail-UnExpanded-CC")) {
const QStringList spl = hrd->asUnicodeString().split(QLatin1Char(','));
for (const QString &addr : spl) {
if (!m_recipientsEditor->addRecipient(addr, MessageComposer::Recipient::Cc)) {
if (m_recipientsEditor->addRecipient(addr, MessageComposer::Recipient::Cc)) {
qCWarning(MESSAGECOMPOSER_LOG) << "Impossible to add recipient.";
resultTooManyRecipients = true;
break;
......@@ -153,7 +153,7 @@ void ComposerViewBase::setMessage(const KMime::Message::Ptr &msg, bool allowDecr
if (auto hrd = m_msg->headerByType("X-KMail-UnExpanded-BCC")) {
const QStringList spl = hrd->asUnicodeString().split(QLatin1Char(','));
for (const QString &addr : spl) {
if (!m_recipientsEditor->addRecipient(addr, MessageComposer::Recipient::Bcc)) {
if (m_recipientsEditor->addRecipient(addr, MessageComposer::Recipient::Bcc)) {
qCWarning(MESSAGECOMPOSER_LOG) << "Impossible to add recipient.";
resultTooManyRecipients = true;
break;
......@@ -165,7 +165,7 @@ void ComposerViewBase::setMessage(const KMime::Message::Ptr &msg, bool allowDecr
if (auto hrd = m_msg->headerByType("X-KMail-UnExpanded-Reply-To")) {
const QStringList spl = hrd->asUnicodeString().split(QLatin1Char(','));
for (const QString &addr : spl) {
if (!m_recipientsEditor->addRecipient(addr, MessageComposer::Recipient::ReplyTo)) {
if (m_recipientsEditor->addRecipient(addr, MessageComposer::Recipient::ReplyTo)) {
qCWarning(MESSAGECOMPOSER_LOG) << "Impossible to add recipient.";
resultTooManyRecipients = true;
break;
......
......@@ -110,7 +110,6 @@ void RecipientsEditor::addRecipient(RecipientLineNG *line, const QString &recipi
bool RecipientsEditor::setRecipientString(const QVector<KMime::Types::Mailbox> &mailboxes, Recipient::Type type)
{
int count = 1;
for (const KMime::Types::Mailbox &mailbox : mailboxes) {
if (count++ > MessageComposer::MessageComposerSettings::self()->maximumRecipients()) {
KMessageBox::sorry(this,
......@@ -121,10 +120,8 @@ bool RecipientsEditor::setRecipientString(const QVector<KMime::Types::Mailbox> &
MessageComposer::MessageComposerSettings::self()->maximumRecipients()));
return true;
}
if (!addRecipient(mailbox.prettyAddress(KMime::Types::Mailbox::QuoteWhenNecessary), type)) {
KMessageBox::sorry(
this,
i18nc("@info:status", "Truncating recipients list to %1.", MessageComposer::MessageComposerSettings::self()->maximumRecipients()));
// Too many
if (addRecipient(mailbox.prettyAddress(KMime::Types::Mailbox::QuoteWhenNecessary), type)) {
return true;
}
}
......
Markdown is supported
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