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