Git commit a8e2a54073de7e5ecef60e6275880d88f3f71cf4 by Ragnar Thomsen. Committed on 31/05/2015 at 20:47. Pushed by rthomsen into branch 'frameworks'. Revert "Implement a cancelled() signal for CliInterface" This reverts commit ee006cb6a83e6cbd01a2dc459b8b0c8be664c05e. M +0 -1 kerfuffle/archiveinterface.h M +0 -2 kerfuffle/cliinterface.cpp M +0 -12 kerfuffle/jobs.cpp M +0 -3 kerfuffle/jobs.h M +21 -27 part/part.cpp http://commits.kde.org/ark/a8e2a54073de7e5ecef60e6275880d88f3f71cf4 diff --git a/kerfuffle/archiveinterface.h b/kerfuffle/archiveinterface.h index 6c88384..3126a4c 100644 --- a/kerfuffle/archiveinterface.h +++ b/kerfuffle/archiveinterface.h @@ -101,7 +101,6 @@ signals: void info(const QString &info); void finished(bool result); void userQuery(Query *query); - void cancelled(); = protected: QString password() const; diff --git a/kerfuffle/cliinterface.cpp b/kerfuffle/cliinterface.cpp index 53f8d57..089f36c 100644 --- a/kerfuffle/cliinterface.cpp +++ b/kerfuffle/cliinterface.cpp @@ -165,8 +165,6 @@ bool CliInterface::copyFiles(const QList & fi= les, const QString & dest = if (query.responseCancelled()) { failOperation(); - emit cancelled(); - emit finished(false); return false; } setPassword(query.password()); diff --git a/kerfuffle/jobs.cpp b/kerfuffle/jobs.cpp index 9bef297..f573498 100644 --- a/kerfuffle/jobs.cpp +++ b/kerfuffle/jobs.cpp @@ -70,7 +70,6 @@ Job::Job(ReadOnlyArchiveInterface *interface, QObject *pa= rent) : KJob(parent) , m_archiveInterface(interface) , m_isRunning(false) - , m_wasCancelled(false) , d(new Private(this)) { static bool onlyOnce =3D false; @@ -101,11 +100,6 @@ bool Job::isRunning() const return m_isRunning; } = -bool Job::wasCancelled() const -{ - return m_wasCancelled; -} - void Job::start() { jobTimer.start(); @@ -128,12 +122,6 @@ void Job::connectToArchiveInterfaceSignals() connect(archiveInterface(), SIGNAL(info(QString)), SLOT(onInfo(QString= ))); connect(archiveInterface(), SIGNAL(finished(bool)), SLOT(onFinished(bo= ol)), Qt::DirectConnection); connect(archiveInterface(), SIGNAL(userQuery(Query*)), SLOT(onUserQuer= y(Query*))); - connect(archiveInterface(), SIGNAL(cancelled()), SLOT(onCancelled())); -} - -void Job::onCancelled() -{ - m_wasCancelled =3D true; } = void Job::onError(const QString & message, const QString & details) diff --git a/kerfuffle/jobs.h b/kerfuffle/jobs.h index 55c4510..0b85534 100644 --- a/kerfuffle/jobs.h +++ b/kerfuffle/jobs.h @@ -52,7 +52,6 @@ public: void start(); = bool isRunning() const; - bool wasCancelled() const; = protected: Job(ReadOnlyArchiveInterface *interface, QObject *parent =3D 0); @@ -75,7 +74,6 @@ protected slots: virtual void onEntryRemoved(const QString &path); virtual void onFinished(bool result); virtual void onUserQuery(Query *query); - virtual void onCancelled(); = signals: void entryRemoved(const QString & entry); @@ -87,7 +85,6 @@ private: ReadOnlyArchiveInterface *m_archiveInterface; = bool m_isRunning; - bool m_wasCancelled; QElapsedTimer jobTimer; = class Private; diff --git a/part/part.cpp b/part/part.cpp index fa853cc..6fc9f55 100644 --- a/part/part.cpp +++ b/part/part.cpp @@ -603,36 +603,30 @@ void Part::slotPreviewExtracted(KJob *job) // if there's an error or an overwrite dialog, // the preview dialog will be launched anyway if (!job->error()) { + const ArchiveEntry& entry =3D + m_model->entryForIndex(m_view->selectionModel()->currentIndex(= )); = ExtractJob *extractJob =3D qobject_cast(job); Q_ASSERT(extractJob); - - // If the job was cancelled don't open preview - if (!extractJob->wasCancelled()) { - - const ArchiveEntry& entry =3D - m_model->entryForIndex(m_view->selectionModel()->currentIn= dex()); - - QString fullName =3D extractJob->destinationDirectory() + QLat= in1Char('/') + entry[FileName].toString(); - - // Make sure a maliciously crafted archive with parent folders= named ".." do - // not cause the previewed file path to be located outside the= temporary - // directory, resulting in a directory traversal issue. - fullName.remove(QLatin1String("../")); - - // TODO: get rid of m_previewMode by extending ExtractJob with= a PreviewJob. - // This would prevent race conditions if we ever stop disabling - // the whole UI while extracting a file to preview it. - switch (m_previewMode) { - case InternalViewer: - ArkViewer::view(fullName, widget()); - break; - case ExternalProgram: - QList list; - list.append(QUrl::fromUserInput(fullName, QString(), QUrl:= :AssumeLocalFile)); - KRun::displayOpenWithDialog(list, widget(), true); - break; - } + QString fullName =3D extractJob->destinationDirectory() + QLatin1C= har('/') + entry[FileName].toString(); + + // Make sure a maliciously crafted archive with parent folders nam= ed ".." do + // not cause the previewed file path to be located outside the tem= porary + // directory, resulting in a directory traversal issue. + fullName.remove(QLatin1String("../")); + + // TODO: get rid of m_previewMode by extending ExtractJob with a P= reviewJob. + // This would prevent race conditions if we ever stop disabling + // the whole UI while extracting a file to preview it. + switch (m_previewMode) { + case InternalViewer: + ArkViewer::view(fullName, widget()); + break; + case ExternalProgram: + QList list; + list.append(QUrl::fromUserInput(fullName, QString(), QUrl::Ass= umeLocalFile)); + KRun::displayOpenWithDialog(list, widget(), true); + break; } } else { KMessageBox::error(widget(), job->errorString());