summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMontel Laurent <montel@kde.org>2016-10-26 04:51:58 (GMT)
committerMontel Laurent <montel@kde.org>2016-10-26 04:51:58 (GMT)
commit4b271a1d7d130fee03e1f23bbe62b621fa334015 (patch)
tree6697b005f8339484672520c432e225e8b3f1c36b
parent5e1a25641a9996f155dd09ae2550ec2eec41a71c (diff)
Minor optimization
-rw-r--r--messagecomposer/src/helper/messagefactory.cpp5
-rw-r--r--messagecore/src/helpers/messagehelpers.cpp10
-rw-r--r--templateparser/src/templateparser.cpp4
3 files changed, 14 insertions, 5 deletions
diff --git a/messagecomposer/src/helper/messagefactory.cpp b/messagecomposer/src/helper/messagefactory.cpp
index 52f5efe..c22b7f8 100644
--- a/messagecomposer/src/helper/messagefactory.cpp
+++ b/messagecomposer/src/helper/messagefactory.cpp
@@ -616,7 +616,10 @@ KMime::Message::Ptr MessageFactory::createRedirect(const QString &toStr, const Q
KMime::Message::Ptr MessageFactory::createDeliveryReceipt()
{
- QString receiptTo = m_origMsg->headerByType("Disposition-Notification-To") ? m_origMsg->headerByType("Disposition-Notification-To")->asUnicodeString() : QStringLiteral("");
+ QString receiptTo;
+ if (auto hrd = m_origMsg->headerByType("Disposition-Notification-To")) {
+ receiptTo = hrd->asUnicodeString();
+ }
if (receiptTo.trimmed().isEmpty()) {
return KMime::Message::Ptr();
}
diff --git a/messagecore/src/helpers/messagehelpers.cpp b/messagecore/src/helpers/messagehelpers.cpp
index 25dd6f5..c6a5c4f 100644
--- a/messagecore/src/helpers/messagehelpers.cpp
+++ b/messagecore/src/helpers/messagehelpers.cpp
@@ -42,12 +42,18 @@ void MessageCore::Util::addLinkInformation(const KMime::Message::Ptr &msg, Akona
{
Q_ASSERT(status.isReplied() || status.isForwarded() || status.isDeleted());
- QString message = msg->headerByType("X-KMail-Link-Message") ? msg->headerByType("X-KMail-Link-Message")->asUnicodeString() : QString();
+ QString message;
+ if (auto hrd = msg->headerByType("X-KMail-Link-Message")) {
+ message = hrd->asUnicodeString();
+ }
if (!message.isEmpty()) {
message += QChar::fromLatin1(',');
}
- QString type = msg->headerByType("X-KMail-Link-Type") ? msg->headerByType("X-KMail-Link-Type")->asUnicodeString() : QString();
+ QString type;
+ if (auto hrd = msg->headerByType("X-KMail-Link-Type")) {
+ type = hrd->asUnicodeString();
+ }
if (!type.isEmpty()) {
type += QChar::fromLatin1(',');
}
diff --git a/templateparser/src/templateparser.cpp b/templateparser/src/templateparser.cpp
index 36234a5..66e61dc 100644
--- a/templateparser/src/templateparser.cpp
+++ b/templateparser/src/templateparser.cpp
@@ -1633,8 +1633,8 @@ QString TemplateParser::quotedHtmlText(const QString &selection) const
uint TemplateParser::identityUoid(const KMime::Message::Ptr &msg) const
{
QString idString;
- if (msg->headerByType("X-KMail-Identity")) {
- idString = msg->headerByType("X-KMail-Identity")->asUnicodeString().trimmed();
+ if (auto hrd = msg->headerByType("X-KMail-Identity")) {
+ idString = hrd->asUnicodeString().trimmed();
}
bool ok = false;
int id = idString.toUInt(&ok);