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

Move destination directory retrieval to ExtractJob.

Part::m_destinationDirectory was only set when the files were
extracted using the extraction dialog.

This meant that if the user had chosen to open the destination
directory after an extraction he would always have his home directory
open when the extraction was done via quick extract or drag'n'drop, as
KRun::runUrl would have an empty KUrl as its parameter.

We now make the destination directory passed to ExtractJob publicly
available, and retrieve it from there.

Forwardport of r1242112.

CCBUG: 188857

svn path=/trunk/KDE/kdeutils/ark/; revision=1242114
parent cfc59cc2
......@@ -264,6 +264,11 @@ void ExtractJob::fillInDefaultValues(ExtractionOptions& options)
}
}
QString ExtractJob::destinationDirectory() const
{
return m_destinationDir;
}
AddJob::AddJob(const QStringList& files, const CompressionOptions& options , ReadWriteArchiveInterface *interface, QObject *parent)
: Job(interface, parent)
, m_files(files)
......
......@@ -119,6 +119,8 @@ class KERFUFFLE_EXPORT ExtractJob : public Job
public:
ExtractJob(const QVariantList& files, const QString& destinationDir, ExtractionOptions options, ReadOnlyArchiveInterface *interface, QObject *parent = 0);
QString destinationDirectory() const;
public slots:
virtual void doWork();
......
......@@ -611,8 +611,6 @@ void Part::slotExtractFiles()
//this is done to update the quick extract menu
updateActions();
m_destinationDirectory = dialog.data()->destinationDirectory().pathOrUrl();
QVariantList files;
//if the user has chosen to extract only selected entries, fetch these
......@@ -629,7 +627,8 @@ void Part::slotExtractFiles()
options[QLatin1String("PreservePaths")] = true;
}
ExtractJob *job = m_model->extractFiles(files, m_destinationDirectory, options);
const QString destinationDirectory = dialog.data()->destinationDirectory().pathOrUrl();
ExtractJob *job = m_model->extractFiles(files, destinationDirectory, options);
registerJob(job);
connect(job, SIGNAL(result(KJob*)),
......@@ -692,10 +691,13 @@ void Part::slotExtractionDone(KJob* job)
KMessageBox::error(widget(), job->errorString());
} else {
if (ArkSettings::openDestinationFolderAfterExtraction()) {
KUrl destinationFolder(m_destinationDirectory);
destinationFolder.cleanPath();
ExtractJob *extractJob = qobject_cast<ExtractJob*>(job);
Q_ASSERT(extractJob);
KUrl destinationDirectory(extractJob->destinationDirectory());
destinationDirectory.cleanPath();
KRun::runUrl(destinationFolder, QLatin1String( "inode/directory" ), widget());
KRun::runUrl(destinationDirectory, QLatin1String("inode/directory"), widget());
}
if (ArkSettings::closeAfterExtraction()) {
......
......@@ -116,7 +116,6 @@ private:
QSplitter *m_splitter;
KTempDir *m_previewDir;
bool m_busy;
QString m_destinationDirectory;
KAbstractWidgetJobTracker *m_jobTracker;
KParts::StatusBarExtension *m_statusBarExtension;
......
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