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

Remove unnecessary preservePaths parameter from addExtraction, implement a...

Remove unnecessary preservePaths parameter from addExtraction, implement a getter for m_preservePaths

svn path=/trunk/KDE/kdeutils/ark/; revision=1001688
parent 1612124f
......@@ -58,7 +58,7 @@ BatchExtract::~BatchExtract()
}
}
void BatchExtract::addExtraction(Kerfuffle::Archive* archive, bool preservePaths, QString destinationFolder)
void BatchExtract::addExtraction(Kerfuffle::Archive* archive, QString destinationFolder)
{
kDebug();
......@@ -80,7 +80,7 @@ void BatchExtract::addExtraction(Kerfuffle::Archive* archive, bool preservePaths
}
Kerfuffle::ExtractionOptions options;
options["PreservePaths"] = preservePaths;
options["PreservePaths"] = preservePaths();
Kerfuffle::ExtractJob *job = archive->copyFiles(
QVariantList(), //extract all files
......@@ -90,7 +90,7 @@ void BatchExtract::addExtraction(Kerfuffle::Archive* archive, bool preservePaths
connect(job, SIGNAL(userQuery(Query*)), this, SLOT(slotUserQuery(Query*)));
kDebug() << QString("Registering job from archive %1, to %2, preservePaths %3").arg(archive->fileName()).arg(autoDestination).arg(preservePaths);
kDebug() << QString("Registering job from archive %1, to %2, preservePaths %3").arg(archive->fileName()).arg(autoDestination).arg(preservePaths());
addSubjob(job);
m_fileNames[job] = qMakePair(archive->fileName(), destinationFolder);
......@@ -131,7 +131,7 @@ void BatchExtract::start()
finalDestination = m_destinationFolder;
}
addExtraction(archive, m_preservePaths, finalDestination);
addExtraction(archive, finalDestination);
}
KIO::getJobTracker()->registerJob(this);
......@@ -213,6 +213,11 @@ bool BatchExtract::addInput(const KUrl& url)
return true;
}
bool BatchExtract::preservePaths()
{
return m_preservePaths;
}
void BatchExtract::setDestinationFolder(QString folder)
{
if (!folder.isEmpty())
......
......@@ -60,7 +60,7 @@ public:
*/
virtual ~BatchExtract();
void addExtraction(Archive* archive, bool preservePaths = true, QString destinationFolder = QString());
void addExtraction(Archive* archive, QString destinationFolder = QString());
/**
* Starts the extraction of all files.
......@@ -86,6 +86,26 @@ public:
bool showExtractDialog();
void setDestinationFolder(QString folder);
void setSubfolder(QString subfolder);
/**
* Whether all files should be extracted to the same directory,
* even if they're in different directories in the archive.
*
* This is also known as "flat" extraction.
*
* @return @c true Paths should be preserved.
* @return @c false Paths should be ignored.
*/
bool preservePaths();
/**
* Set whether paths should be preserved during extraction.
*
* When it is set to false, all files are extracted to a single
* directory, regardless of their hierarchy in the archive.
*
* @param value Whether to preserve paths.
*/
void setPreservePaths(bool value);
private slots:
......
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