Commit 0c8e5af5 authored by Vladyslav Batyrenko's avatar Vladyslav Batyrenko
Browse files

Fix creating archives without extension

Add passing fixedMimeType through MainWindow::newArchive() and Part::openFile().

Differential Revision: D1654
parent 6b9bc44d
......@@ -314,11 +314,13 @@ void MainWindow::newArchive()
if (dialog.data()->exec()) {
const QUrl saveFileUrl = dialog.data()->selectedUrl();
const QString password = dialog.data()->password();
const QString fixedMimeType = dialog.data()->currentMimeType().name();
qCDebug(ARK) << "CreateDialog returned URL:" << saveFileUrl.toString();
qCDebug(ARK) << "CreateDialog returned mime:" << dialog.data()->currentMimeType().name();
qCDebug(ARK) << "CreateDialog returned mime:" << fixedMimeType;
m_openArgs.metaData()[QStringLiteral("createNewArchive")] = QStringLiteral("true");
m_openArgs.metaData()[QStringLiteral("fixedMimeType")] = fixedMimeType;
if (dialog.data()->compressionLevel() > -1) {
m_openArgs.metaData()[QStringLiteral("compressionLevel")] = QString::number(dialog.data()->compressionLevel());
}
......@@ -332,6 +334,7 @@ void MainWindow::newArchive()
m_openArgs.metaData().remove(QStringLiteral("showExtractDialog"));
m_openArgs.metaData().remove(QStringLiteral("createNewArchive"));
m_openArgs.metaData().remove(QStringLiteral("fixedMimeType"));
m_openArgs.metaData().remove(QStringLiteral("compressionLevel"));
m_openArgs.metaData().remove(QStringLiteral("encryptionPassword"));
m_openArgs.metaData().remove(QStringLiteral("encryptHeader"));
......
......@@ -612,7 +612,8 @@ bool Part::openFile()
return false;
}
QScopedPointer<Kerfuffle::Archive> archive(Kerfuffle::Archive::create(localFilePath(), m_model));
const QString fixedMimeType = arguments().metaData()[QStringLiteral("fixedMimeType")];
QScopedPointer<Kerfuffle::Archive> archive(Kerfuffle::Archive::create(localFilePath(), fixedMimeType, m_model));
Q_ASSERT(archive);
if (archive->error() == NoPlugin) {
......
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