Commit 301cfeb8 authored by Julius Künzel's avatar Julius Künzel
Browse files

Archive import: Fix dialog, allow *.zip

CCBUG: 386398
Related to #973
parent 68e559ec
......@@ -250,6 +250,8 @@ ArchiveWidget::ArchiveWidget(QUrl url, QWidget *parent)
proxy_only->setHidden(true);
project_files->setHidden(true);
files_list->setHidden(true);
timeline_archive->setHidden(true);
compression_type->setHidden(true);
label->setText(i18n("Extract to"));
setWindowTitle(i18n("Open Archived Project"));
archive_url->setUrl(QUrl::fromLocalFile(QDir::homePath()));
......@@ -282,7 +284,14 @@ void ArchiveWidget::slotJobResult(bool success, const QString &text)
void ArchiveWidget::openArchiveForExtraction()
{
emit showMessage(QStringLiteral("system-run"), i18n("Opening archive..."));
m_extractArchive = new KTar(m_extractUrl.toLocalFile());
QMimeDatabase db;
QMimeType mime = db.mimeTypeForUrl(m_extractUrl);
if (mime.inherits(QStringLiteral("application/x-compressed-tar"))) {
m_extractArchive = new KTar(m_extractUrl.toLocalFile());
} else {
m_extractArchive = new KZip(m_extractUrl.toLocalFile());
}
if (!m_extractArchive->isOpen() && !m_extractArchive->open(QIODevice::ReadOnly)) {
emit showMessage(QStringLiteral("dialog-close"), i18n("Cannot open archive file:\n %1", m_extractUrl.toLocalFile()));
groupBox->setEnabled(false);
......
......@@ -56,7 +56,7 @@ the Free Software Foundation, either version 3 of the License, or
static QString getProjectNameFilters(bool ark=true) {
auto filter = i18n("Kdenlive project (*.kdenlive)");
if (ark) {
filter.append(";;" + i18n("Archived project (*.tar.gz)"));
filter.append(";;" + i18n("Archived project (*.tar.gz *.zip)"));
}
return filter;
}
......@@ -484,7 +484,7 @@ void ProjectManager::openFile(const QUrl &url)
QMimeDatabase db;
// Make sure the url is a Kdenlive project file
QMimeType mime = db.mimeTypeForUrl(url);
if (mime.inherits(QStringLiteral("application/x-compressed-tar"))) {
if (mime.inherits(QStringLiteral("application/x-compressed-tar")) || mime.inherits(QStringLiteral("application/zip"))) {
// Opening a compressed project file, we need to process it
// qCDebug(KDENLIVE_LOG)<<"Opening archive, processing";
QPointer<ArchiveWidget> ar = new ArchiveWidget(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