Commit 6ff69185 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Modernize code

parent 557e9ec6
Pipeline #60357 passed with stage
in 5 minutes and 2 seconds
......@@ -35,7 +35,7 @@ void MailSerializerPluginTest::testMailPlugin()
item.setPayloadFromData(serialized);
QVERIFY(item.hasPayload<KMime::Message::Ptr>());
KMime::Message::Ptr msg = item.payload<KMime::Message::Ptr>();
auto msg = item.payload<KMime::Message::Ptr>();
QVERIFY(msg != nullptr);
QCOMPARE(msg->to()->asUnicodeString(), QStringLiteral("receiver@test.org"));
......@@ -66,7 +66,7 @@ void MailSerializerPluginTest::testMessageIntegrity()
item.setPayloadFromData(serialized);
QVERIFY(item.hasPayload<KMime::Message::Ptr>());
KMime::Message::Ptr msg = item.payload<KMime::Message::Ptr>();
auto msg = item.payload<KMime::Message::Ptr>();
QVERIFY(msg != nullptr);
qDebug() << "original data:" << serialized;
......
......@@ -103,7 +103,7 @@ void MailSerializerTest::testEnvelopeDeserialize()
}
QVERIFY(i.hasPayload<KMime::Message::Ptr>());
KMime::Message::Ptr msg = i.payload<KMime::Message::Ptr>();
auto msg = i.payload<KMime::Message::Ptr>();
QCOMPARE(msg->date()->dateTime(), date);
QCOMPARE(msg->subject()->asUnicodeString(), subject);
QCOMPARE(msg->from()->asUnicodeString(), from);
......@@ -249,7 +249,7 @@ void MailSerializerTest::testHeaderFetch()
serializer->deserialize(i, MessagePart::Header, buffer, 0);
QVERIFY(i.hasPayload<KMime::Message::Ptr>());
KMime::Message::Ptr msg = i.payload<KMime::Message::Ptr>();
auto msg = i.payload<KMime::Message::Ptr>();
QCOMPARE(msg->subject()->asUnicodeString(), expectedSubject);
QCOMPARE(msg->from()->asUnicodeString(), expectedFrom);
QCOMPARE(msg->to()->asUnicodeString(), expectedTo);
......@@ -292,7 +292,7 @@ void MailSerializerTest::testMultiDeserialize()
serializer->deserialize(i, MessagePart::Body, buffer, 0);
QVERIFY(i.hasPayload<KMime::Message::Ptr>());
KMime::Message::Ptr msg = i.payload<KMime::Message::Ptr>();
auto msg = i.payload<KMime::Message::Ptr>();
QCOMPARE(msg->subject()->asUnicodeString(), expectedSubject);
QCOMPARE(msg->from()->asUnicodeString(), expectedFrom);
QCOMPARE(msg->to()->asUnicodeString(), expectedTo);
......
......@@ -217,7 +217,7 @@ void SerializerPluginMail::serialize(const Item &item, const QByteArray &label,
{
version = 1;
KMime::Message::Ptr m = item.payload<KMime::Message::Ptr>();
auto m = item.payload<KMime::Message::Ptr>();
if (label == MessagePart::Body) {
data.write(m->encodedContent());
} else if (label == MessagePart::Envelope) {
......@@ -244,7 +244,7 @@ QSet<QByteArray> SerializerPluginMail::parts(const Item &item) const
return set;
}
KMime::Message::Ptr msg = item.payload<KMime::Message::Ptr>();
auto msg = item.payload<KMime::Message::Ptr>();
if (!msg) {
return set;
}
......@@ -264,7 +264,7 @@ QString SerializerPluginMail::extractGid(const Item &item) const
if (!item.hasPayload<KMime::Message::Ptr>()) {
return QString();
}
const KMime::Message::Ptr msg = item.payload<KMime::Message::Ptr>();
const auto msg = item.payload<KMime::Message::Ptr>();
KMime::Headers::MessageID *mid = msg->messageID(false);
if (mid) {
return mid->asUnicodeString();
......
......@@ -70,7 +70,7 @@ public:
for (int i = 0; i < numberOfItems; ++i) {
Akonadi::Item item = items.at(i);
if (item.hasPayload<KMime::Message::Ptr>()) {
KMime::Message::Ptr message = item.payload<KMime::Message::Ptr>();
auto message = item.payload<KMime::Message::Ptr>();
QByteArray idStr = message->messageID()->as7BitString(false);
// TODO: Maybe do some more check in case of idStr.isEmpty()
// like when the first message's body is different from the 2nd,
......
......@@ -31,7 +31,7 @@ public:
SpecialMailCollections *mInstance = nullptr;
};
typedef SpecialMailCollectionsSettings Settings;
using Settings = SpecialMailCollectionsSettings;
Q_GLOBAL_STATIC(SpecialMailCollectionsPrivate, sInstance)
......
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