diff --git a/kerfuffle/archiveinterface.h b/kerfuffle/archiveinterface.h --- a/kerfuffle/archiveinterface.h +++ b/kerfuffle/archiveinterface.h @@ -162,7 +162,6 @@ void cancelled(); void error(const QString &message, const QString &details = QString()); void entry(Archive::Entry *archiveEntry); - void entryRemoved(const QString &path); void progress(double progress); void info(const QString &info); void finished(bool result); @@ -194,7 +193,6 @@ private slots: void onEntry(Archive::Entry *archiveEntry); - void onEntryRemoved(const QString &path); }; class KERFUFFLE_EXPORT ReadWriteArchiveInterface: public ReadOnlyArchiveInterface @@ -215,6 +213,12 @@ virtual bool copyFiles(const QVector &files, Archive::Entry *destination, const CompressionOptions& options) = 0; virtual bool deleteFiles(const QVector &files) = 0; virtual bool addComment(const QString &comment) = 0; + +signals: + void entryRemoved(const QString &path); + +private slots: + void onEntryRemoved(const QString &path); }; } // namespace Kerfuffle diff --git a/kerfuffle/archiveinterface.cpp b/kerfuffle/archiveinterface.cpp --- a/kerfuffle/archiveinterface.cpp +++ b/kerfuffle/archiveinterface.cpp @@ -49,7 +49,6 @@ qCDebug(ARK) << "Created read-only interface for" << args.first().toString(); m_filename = args.first().toString(); connect(this, &ReadOnlyArchiveInterface::entry, this, &ReadOnlyArchiveInterface::onEntry); - connect(this, &ReadOnlyArchiveInterface::entryRemoved, this, &ReadOnlyArchiveInterface::onEntryRemoved); } ReadOnlyArchiveInterface::~ReadOnlyArchiveInterface() @@ -62,12 +61,6 @@ m_numberOfEntries++; } -void ReadOnlyArchiveInterface::onEntryRemoved(const QString &path) -{ - Q_UNUSED(path) - m_numberOfEntries--; -} - QString ReadOnlyArchiveInterface::filename() const { return m_filename; @@ -155,6 +148,8 @@ : ReadOnlyArchiveInterface(parent, args) { qCDebug(ARK) << "Created read-write interface for" << args.first().toString(); + + connect(this, &ReadWriteArchiveInterface::entryRemoved, this, &ReadWriteArchiveInterface::onEntryRemoved); } ReadWriteArchiveInterface::~ReadWriteArchiveInterface() @@ -280,4 +275,10 @@ return m_numberOfEntries; } +void ReadWriteArchiveInterface::onEntryRemoved(const QString &path) +{ + Q_UNUSED(path) + m_numberOfEntries--; +} + } // namespace Kerfuffle diff --git a/kerfuffle/jobs.cpp b/kerfuffle/jobs.cpp --- a/kerfuffle/jobs.cpp +++ b/kerfuffle/jobs.cpp @@ -156,11 +156,15 @@ connect(archiveInterface(), &ReadOnlyArchiveInterface::cancelled, this, &Job::onCancelled); connect(archiveInterface(), &ReadOnlyArchiveInterface::error, this, &Job::onError); connect(archiveInterface(), &ReadOnlyArchiveInterface::entry, this, &Job::onEntry); - connect(archiveInterface(), &ReadOnlyArchiveInterface::entryRemoved, this, &Job::onEntryRemoved); connect(archiveInterface(), &ReadOnlyArchiveInterface::progress, this, &Job::onProgress); connect(archiveInterface(), &ReadOnlyArchiveInterface::info, this, &Job::onInfo); connect(archiveInterface(), &ReadOnlyArchiveInterface::finished, this, &Job::onFinished); connect(archiveInterface(), &ReadOnlyArchiveInterface::userQuery, this, &Job::onUserQuery); + + auto readWriteInterface = qobject_cast(archiveInterface()); + if (readWriteInterface) { + connect(readWriteInterface, &ReadWriteArchiveInterface::entryRemoved, this, &Job::onEntryRemoved); + } } void Job::onCancelled()