Commit e5fcaedc authored by Elvis Angelaccio's avatar Elvis Angelaccio
Browse files

Don't run a ListJob when creating a new archive

Currently if we create a new archive using the New action, Ark creates a
ListJob which is obviously going to fail, since the archive does not exist yet.
Previously Ark would just ignore such failing jobs, but with Ark 15.12 the
clirar plugin actually parses the error message of unrar as a valid comment.

We can solve the problem at the root and only run a ListJob if the archive to
be listed actually exists.

Differential Revision: D712
parent 71e59d51
......@@ -875,7 +875,7 @@ Kerfuffle::Archive* ArchiveModel::archive() const
KJob* ArchiveModel::setArchive(Kerfuffle::Archive *archive)
KJob* ArchiveModel::setArchive(Kerfuffle::Archive *archive, bool existingArchive)
......@@ -886,7 +886,7 @@ KJob* ArchiveModel::setArchive(Kerfuffle::Archive *archive)
Kerfuffle::ListJob *job = Q_NULLPTR;
if (m_archive) {
if (m_archive && existingArchive) {
job = m_archive->list(); // TODO: call "open" or "create"?
connect(job, &Kerfuffle::ListJob::newEntry, this, &ArchiveModel::slotNewEntryFromSetArchive);
......@@ -63,7 +63,7 @@ public:
QMimeData * mimeData(const QModelIndexList & indexes) const Q_DECL_OVERRIDE;
bool dropMimeData(const QMimeData * data, Qt::DropAction action, int row, int column, const QModelIndex & parent) Q_DECL_OVERRIDE;
KJob* setArchive(Kerfuffle::Archive *archive);
KJob* setArchive(Kerfuffle::Archive *archive, bool existingArchive = false);
Kerfuffle::Archive *archive() const;
Kerfuffle::ArchiveEntry entryForIndex(const QModelIndex &index);
......@@ -505,9 +505,14 @@ bool Part::openFile()
// Plugin loaded successfully.
KJob *job = m_model->setArchive(archive.take());
KJob *job = m_model->setArchive(archive.take(), localFileInfo.exists());
if (job) {
} else {
if (arguments().metaData()[QStringLiteral("showExtractDialog")] == QLatin1String("true")) {
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