summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMontel Laurent <[email protected]>2017-09-29 13:20:20 +0200
committerMontel Laurent <[email protected]>2017-09-29 13:20:20 +0200
commitd59a70e8ac113ccd1787aa509c3f7aed0afa7429 (patch)
tree8531db29a8d881288ea072a6314614b84ce2df58
parent9a89c1703705143388962836bf92220ed50288fb (diff)
USe directly QByteArray not necessary to use QString for reconvert after that as qbytearray
-rw-r--r--resources/kolab/libkolab/kolabformat/v2helpers.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/resources/kolab/libkolab/kolabformat/v2helpers.cpp b/resources/kolab/libkolab/kolabformat/v2helpers.cpp
index 94dda23..bddc2b1 100644
--- a/resources/kolab/libkolab/kolabformat/v2helpers.cpp
+++ b/resources/kolab/libkolab/kolabformat/v2helpers.cpp
@@ -149,12 +149,12 @@ KContacts::Addressee addresseeFromKolab(const QByteArray &xmlData, QString &pict
return addressee;
}
-static QByteArray createPicture(const QImage &img, const QString &/*format*/, QString &type)
+static QByteArray createPicture(const QImage &img, const QString &/*format*/, QByteArray &type)
{
QByteArray pic;
QBuffer buffer(&pic);
buffer.open(QIODevice::WriteOnly);
- type = QStringLiteral("image/png");
+ type = "image/png";
//FIXME it's not possible to save jpegs lossless, so we always use png. otherwise we would compress the image on every write.
// if (format == "image/jpeg") {
// type = "image/jpeg";
@@ -180,16 +180,16 @@ KMime::Message::Ptr contactToKolabFormat(const KolabV2::Contact& contact, const
message->addContent( content );
if ( !contact.picture().isNull() ) {
- QString type;
+ QByteArray type;
const QByteArray &pic = createPicture(contact.picture(), contact.pictureFormat(), type);
- content = Mime::createAttachmentPart(QByteArray(), type.toLatin1(), /*"kolab-picture.png"*/contact.pictureAttachmentName(), pic );
+ content = Mime::createAttachmentPart(QByteArray(), type, /*"kolab-picture.png"*/contact.pictureAttachmentName(), pic );
message->addContent(content);
}
if ( !contact.logo().isNull() ) {
- QString type;
+ QByteArray type;
const QByteArray &pic = createPicture(contact.logo(), contact.logoFormat(), type);
- content = Mime::createAttachmentPart(QByteArray(), type.toLatin1(), /*"kolab-logo.png"*/contact.logoAttachmentName(), pic );
+ content = Mime::createAttachmentPart(QByteArray(), type, /*"kolab-logo.png"*/contact.logoAttachmentName(), pic );
message->addContent(content);
}