Commit d454886a authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Merge remote-tracking branch 'origin/Applications/17.04'

parents 9d4bfe5b 6466a612
......@@ -25,7 +25,7 @@
AttachmentUpdateJobTest::AttachmentUpdateJobTest(QObject *parent)
: QObject(parent)
{
qputenv("KDE_FORK_SLAVES", "yes"); // To avoid a runtime dependency on klauncher
}
AttachmentUpdateJobTest::~AttachmentUpdateJobTest()
......
......@@ -68,8 +68,9 @@ void AttachmentFromFolderJob::Private::compressFolder()
return;
}
mZip->setCompression(mCompression);
mZip->writeDir(q->url().fileName(), QString(), QString(), 040755, mArchiveTime, mArchiveTime, mArchiveTime);
qCDebug(MESSAGECORE_LOG) << "writing root directory : " << q->url().fileName();
const QString filename = q->url().fileName();
mZip->writeDir(filename, QString(), QString(), 040755, mArchiveTime, mArchiveTime, mArchiveTime);
qCDebug(MESSAGECORE_LOG) << "writing root directory : " << filename;
addEntity(QDir(q->url().path()).entryInfoList(QDir::Dirs | QDir::NoDotAndDotDot |
QDir::NoSymLinks | QDir::Files, QDir::DirsFirst), fileName + QLatin1Char('/'));
mZip->close();
......@@ -105,26 +106,29 @@ void AttachmentFromFolderJob::Private::addEntity(const QFileInfoList &f, const Q
return;
}
const QString infoFileName = info.fileName();
if (info.isDir()) {
qCDebug(MESSAGECORE_LOG) << "adding directory " << info.fileName() << "to zip";
if (!mZip->writeDir(path + info.fileName(), QString(), QString(), 040755, mArchiveTime, mArchiveTime, mArchiveTime)) {
qCDebug(MESSAGECORE_LOG) << "adding directory " << infoFileName << "to zip";
if (!mZip->writeDir(path + infoFileName, QString(), QString(), 040755, mArchiveTime, mArchiveTime, mArchiveTime)) {
q->setError(KJob::UserDefinedError);
q->setErrorText(i18n("Could not add %1 to the archive", info.fileName()));
q->setErrorText(i18n("Could not add %1 to the archive", infoFileName));
q->emitResult();
return;
}
addEntity(QDir(info.filePath()).entryInfoList(QDir::Dirs | QDir::NoDotAndDotDot |
QDir::NoSymLinks | QDir::Files, QDir::DirsFirst), path + info.fileName() + QLatin1Char('/'));
QDir::NoSymLinks | QDir::Files, QDir::DirsFirst), path + infoFileName + QLatin1Char('/'));
}
if (info.isFile()) {
qCDebug(MESSAGECORE_LOG) << "Adding file " << path + info.fileName() << "to zip";
qCDebug(MESSAGECORE_LOG) << "Adding file " << path + infoFileName << "to zip";
QFile file(info.filePath());
if (!file.open(QIODevice::ReadOnly)) {
q->setError(KJob::UserDefinedError);
q->setErrorText(i18n("Could not open %1 for reading.", file.fileName()));
q->emitResult();
return;
}
if (!mZip->writeFile(path + info.fileName(), file.readAll(), archivePerms,
if (!mZip->writeFile(path + infoFileName, file.readAll(), archivePerms,
QString(), QString(), mArchiveTime, mArchiveTime, mArchiveTime)) {
q->setError(KJob::UserDefinedError);
q->setErrorText(i18n("Could not add %1 to the archive", file.fileName()));
......
......@@ -228,7 +228,7 @@ qint64 AttachmentPart::size() const
bool AttachmentPart::isMessageOrMessageCollection() const
{
return (mimeType() == "message/rfc822") || (mimeType() == "multipart/digest");
return (mimeType() == QByteArrayLiteral("message/rfc822")) || (mimeType() == QByteArrayLiteral("multipart/digest"));
}
void AttachmentPart::setUrl(const QUrl &url)
......
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