Commit 4d0edc91 authored by Raphael Kubo da Costa's avatar Raphael Kubo da Costa
Browse files

Specify when the extraction dialog's settings should be followed.

On ExtractJob's side, we make the extraction options it received
publicly accessible.

On Part's side, we set a "FollowExtractionDialogSettings" option to
true only when the extraction dialog was used to extract files, and
only actually follow these settings (for now, open the destination
directory and/or quit Ark after the extraction) when that option is
set.

Forwardport of r1242113.

CCBUG: 188857

svn path=/trunk/KDE/kdeutils/ark/; revision=1242115
parent a717ac6d
......@@ -269,6 +269,11 @@ QString ExtractJob::destinationDirectory() const
return m_destinationDir;
}
ExtractionOptions ExtractJob::extractionOptions() const
{
return m_options;
}
AddJob::AddJob(const QStringList& files, const CompressionOptions& options , ReadWriteArchiveInterface *interface, QObject *parent)
: Job(interface, parent)
, m_files(files)
......
......@@ -120,6 +120,7 @@ public:
ExtractJob(const QVariantList& files, const QString& destinationDir, ExtractionOptions options, ReadOnlyArchiveInterface *interface, QObject *parent = 0);
QString destinationDirectory() const;
ExtractionOptions extractionOptions() const;
public slots:
virtual void doWork();
......
......@@ -627,6 +627,8 @@ void Part::slotExtractFiles()
options[QLatin1String("PreservePaths")] = true;
}
options[QLatin1String("FollowExtractionDialogSettings")] = true;
const QString destinationDirectory = dialog.data()->destinationDirectory().pathOrUrl();
ExtractJob *job = m_model->extractFiles(files, destinationDirectory, options);
registerJob(job);
......@@ -690,9 +692,16 @@ void Part::slotExtractionDone(KJob* job)
if (job->error()) {
KMessageBox::error(widget(), job->errorString());
} else {
ExtractJob *extractJob = qobject_cast<ExtractJob*>(job);
Q_ASSERT(extractJob);
const bool followExtractionDialogSettings =
extractJob->extractionOptions().value(QLatin1String("FollowExtractionDialogSettings"), false).toBool();
if (!followExtractionDialogSettings) {
return;
}
if (ArkSettings::openDestinationFolderAfterExtraction()) {
ExtractJob *extractJob = qobject_cast<ExtractJob*>(job);
Q_ASSERT(extractJob);
KUrl destinationDirectory(extractJob->destinationDirectory());
destinationDirectory.cleanPath();
......
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