summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMontel Laurent <[email protected]>2017-03-29 15:39:40 +0200
committerPali Roh├ír <[email protected]>2017-12-22 09:10:26 +0100
commite8f277a1602c1f5fa1445c1e28ead396ef6d643c (patch)
tree5f8a00d8436549507345a444dbcde33f4061cee1
parent78d8b0041d8633775ac3ac55548c6c1ca281f8a4 (diff)
Try to fix qt warning
-rw-r--r--libkopete/kopetemetacontact.cpp5
-rw-r--r--libkopete/kopetepicture.cpp2
2 files changed, 6 insertions, 1 deletions
diff --git a/libkopete/kopetemetacontact.cpp b/libkopete/kopetemetacontact.cpp
index 9aefef7..cd5314d 100644
--- a/libkopete/kopetemetacontact.cpp
+++ b/libkopete/kopetemetacontact.cpp
@@ -704,7 +704,10 @@ QString nameFromContact(Kopete::Contact *c) /*const*/
QUrl MetaContact::customPhoto() const
{
- return QUrl(d->customPicture.path());
+ if (d->customPicture.path().isEmpty()) {
+ return QUrl();
+ }
+ return QUrl::fromLocalFile(d->customPicture.path());
}
void MetaContact::setPhoto(const QUrl &url)
diff --git a/libkopete/kopetepicture.cpp b/libkopete/kopetepicture.cpp
index d7c52b0..5f80fdf 100644
--- a/libkopete/kopetepicture.cpp
+++ b/libkopete/kopetepicture.cpp
@@ -18,6 +18,7 @@
#include <kcontacts/picture.h>
+#include <QDir>
#include <kcodecs.h>
#include <kdebug.h>
@@ -119,6 +120,7 @@ QString Picture::path()
context.addData(tempArray);
// Save the image to a file.
localPhotoPath = context.result() + QLatin1String(".png");
+ QDir().mkpath(QStandardPaths::writableLocation(QStandardPaths::DataLocation) + QLatin1Char('/') + QStringLiteral("metacontactpicturecache/"));
localPhotoPath = QStandardPaths::writableLocation(QStandardPaths::DataLocation) + QLatin1Char('/') + QStringLiteral("metacontactpicturecache/%1").arg(localPhotoPath);
if (image().save(localPhotoPath, "PNG")) {
d->picturePath = localPhotoPath;