summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Mollekopf <mollekopf@kolabsys.com>2015-05-08 13:27:41 +0200
committerChristian Mollekopf <mollekopf@kolabsys.com>2015-05-08 13:27:41 +0200
commit3702ef6507fcddd97e15a9cddd2c03a0eeb5fd4e (patch)
tree54b9c049cc15011e564437dce1b87014be4c981e
parent6cfa34b354a67f537f2ce61c0f550ba582f2e4eb (diff)
downloadlibkolab-3702ef6507fcddd97e15a9cddd2c03a0eeb5fd4e.tar.gz
Fixed mimeobjecttest.
Reverted header reordering, and use the full name for the From header.
-rw-r--r--kolabformat/mimeobject.cpp3
-rw-r--r--mime/mimeutils.cpp3
-rw-r--r--tests/mimeobjecttest.cpp4
3 files changed, 4 insertions, 6 deletions
diff --git a/kolabformat/mimeobject.cpp b/kolabformat/mimeobject.cpp
index 1aa36c5..13195d4 100644
--- a/kolabformat/mimeobject.cpp
+++ b/kolabformat/mimeobject.cpp
@@ -630,6 +630,9 @@ std::string MIMEObject::writeContact(const Contact &contact, Version version, co
QPair<std::string, std::string> pair = Conversion::fromMailto(preferredEmail.address());
std::string name = pair.second;
std::string email = pair.first;
+ if (name.empty()) {
+ name = contact.name();
+ }
if (version == KolabV3) {
msg = Mime::createMessage(xCardMimeType(), contactKolabType(), xml, true, productId, email, name, contact.uid());
diff --git a/mime/mimeutils.cpp b/mime/mimeutils.cpp
index 3492912..76001bb 100644
--- a/mime/mimeutils.cpp
+++ b/mime/mimeutils.cpp
@@ -97,14 +97,13 @@ KMime::Message::Ptr createMessage(const QByteArray &mimetype, const QByteArray &
const QByteArray &fromEmail, const QString &fromName, const QString &subject)
{
KMime::Message::Ptr message = createMessage(xKolabType, v3, productId);
+ message->subject()->fromUnicodeString(subject, "utf-8");
if (!fromEmail.isEmpty()) {
KMime::Types::Mailbox mb;
mb.setName(fromName);
mb.setAddress(fromEmail);
message->from()->addAddress(mb);
}
- qWarning() << "Create message subject: " << subject;
- message->subject()->fromUnicodeString(subject, "utf-8");
message->addContent(createMainPart(mimetype, xml));
return message;
}
diff --git a/tests/mimeobjecttest.cpp b/tests/mimeobjecttest.cpp
index 29485f1..7d2d931 100644
--- a/tests/mimeobjecttest.cpp
+++ b/tests/mimeobjecttest.cpp
@@ -23,11 +23,9 @@
#include <fstream>
#include <sstream>
#include <QString>
-#include <ksystemtimezone.h>
void MIMEObjectTest::initTestCase()
{
- QVERIFY2(KSystemTimeZones::isTimeZoneDaemonAvailable(), "Timezone support is required for this test. Either use libcalendaring or make sure KTimeZoned is available");
}
void MIMEObjectTest::testEvent(){
@@ -96,9 +94,7 @@ void MIMEObjectTest::testNote(){
normalizeMimemessage(qMessage);
normalizeMimemessage(input);
- QEXPECT_FAIL("", "Currently failing due to reordered headers.", Continue);
QCOMPARE(input.simplified(), qMessage.simplified());
-
}
void MIMEObjectTest::testContact(){