summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMontel Laurent <[email protected]>2017-04-10 07:50:12 +0200
committerPali Roh├ír <[email protected]>2017-12-22 09:10:29 +0100
commit3f890a26741e35d96223f85bde74a30e7025b21e (patch)
tree573f0eda7b3935791bd66b50c79d54eef1149fd7
parentf23d81a0b73da00e6f2d4db55291c76073aefb1e (diff)
Make sure that directory is created
-rw-r--r--libkopete/kopetepicture.cpp5
-rw-r--r--plugins/otr/otrplugin.cpp6
-rw-r--r--protocols/jabber/jabbercontact.cpp5
3 files changed, 11 insertions, 5 deletions
diff --git a/libkopete/kopetepicture.cpp b/libkopete/kopetepicture.cpp
index 3c3a176..c3b21bb 100644
--- a/libkopete/kopetepicture.cpp
+++ b/libkopete/kopetepicture.cpp
@@ -120,8 +120,9 @@ 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);
+ const QString metacontactpicturecachepath = QStandardPaths::writableLocation(QStandardPaths::DataLocation) + QLatin1Char('/') + QStringLiteral("metacontactpicturecache/");
+ QDir().mkpath(metacontactpicturecachepath);
+ localPhotoPath = metacontactpicturecachepath + localPhotoPath;
if (image().save(localPhotoPath, "PNG")) {
d->picturePath = localPhotoPath;
}
diff --git a/plugins/otr/otrplugin.cpp b/plugins/otr/otrplugin.cpp
index d5d1eea..e3b1b20 100644
--- a/plugins/otr/otrplugin.cpp
+++ b/plugins/otr/otrplugin.cpp
@@ -27,6 +27,7 @@
#include <qregexp.h>
#include <qfile.h>
#include <qcolor.h>
+#include <QDir>
#include <KLocalizedString>
#include <KGlobal>
@@ -84,8 +85,9 @@ OTRPlugin::OTRPlugin (QObject *parent, const QVariantList & /*args*/)
otrlChatInterface->setPlugin(this);
// Checking file Permissions
- OtrlChatInterface::self()->checkFilePermissions(QString(QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + QLatin1Char('/') + QStringLiteral("kopete_otr/")));
- OtrlChatInterface::self()->checkFilePermissions(QString(QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + QLatin1Char('/') + QStringLiteral("kopete_otr/")));
+ const QString otrPath = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + QLatin1Char('/') + QStringLiteral("kopete_otr/");
+ QDir().mkdir(otrPath);
+ OtrlChatInterface::self()->checkFilePermissions(otrPath);
//setting the policy
slotSettingsChanged();
diff --git a/protocols/jabber/jabbercontact.cpp b/protocols/jabber/jabbercontact.cpp
index f206033..bc77941 100644
--- a/protocols/jabber/jabbercontact.cpp
+++ b/protocols/jabber/jabbercontact.cpp
@@ -76,6 +76,8 @@ JabberContact::JabberContact (const XMPP::RosterItem &rosterItem, Kopete::Accoun
qCDebug(JABBER_PROTOCOL_LOG) << contactId() << " is created - " << this;
// this contact is able to transfer files
setFileCapable ( true );
+ const QString jabberPhotoPath = QStandardPaths::writableLocation(QStandardPaths::DataLocation) + QLatin1Char('/') + "jabberphotos/";
+ QDir().mkpath(jabberPhotoPath);
/*
* Catch when we're going online for the first time to
@@ -814,8 +816,9 @@ void JabberContact::setPhoto( const QString &photoPath )
QString newPhotoPath = photoPath;
if(contactPhoto.width() > 96 || contactPhoto.height() > 96)
{
+ const QString jabberPhotoPath = QStandardPaths::writableLocation(QStandardPaths::DataLocation) + QLatin1Char('/') + "jabberphotos/";
// Save image to a new location if the image isn't the correct format.
- QString newLocation( QStandardPaths::writableLocation(QStandardPaths::DataLocation) + QLatin1Char('/') + "jabberphotos/"+ QUrl(photoPath).fileName().toLower() ) ;
+ QString newLocation( jabberPhotoPath + QUrl(photoPath).fileName().toLower() ) ;
// Scale and crop the picture.
contactPhoto = contactPhoto.scaled( 96, 96, Qt::KeepAspectRatio, Qt::SmoothTransformation );