Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit 3f890a26 authored by Laurent Montel's avatar Laurent Montel 😁 Committed by Pali Rohár

Make sure that directory is created

parent f23d81a0
......@@ -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;
}
......
......@@ -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();
......
......@@ -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 );
......
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