|
|
ca0e41 |
diff --git a/app/batchextract.cpp b/app/batchextract.cpp
|
|
|
ca0e41 |
index 9e466350568384247e99362745205c417b27873f..86f946b18f94f83b42d4bcd0bc320e6a5a3e7e64 100644
|
|
|
ca0e41 |
--- a/app/batchextract.cpp
|
|
|
ca0e41 |
+++ b/app/batchextract.cpp
|
|
|
ca0e41 |
@@ -68,9 +68,9 @@ void BatchExtract::addExtraction(Kerfuffle::Archive* archive)
|
|
|
ca0e41 |
{
|
|
|
ca0e41 |
QString destination = destinationFolder();
|
|
|
ca0e41 |
|
|
|
ca0e41 |
- if ((autoSubfolder()) && (!archive->isSingleFolderArchive())) {
|
|
|
ca0e41 |
+ if ((autoSubfolder()) && (!archive->isSingleFolderArchive() || !archive->fileBaseName().startsWith(archive->subfolderName()))) {
|
|
|
ca0e41 |
const QDir d(destination);
|
|
|
ca0e41 |
- QString subfolderName = archive->subfolderName();
|
|
|
ca0e41 |
+ QString subfolderName = archive->fileBaseName();
|
|
|
ca0e41 |
|
|
|
ca0e41 |
if (d.exists(subfolderName)) {
|
|
|
ca0e41 |
subfolderName = KIO::RenameDialog::suggestName(destination, subfolderName);
|
|
|
ca0e41 |
diff --git a/kerfuffle/archive.h b/kerfuffle/archive.h
|
|
|
ca0e41 |
index 515788f978c1d29146c25dcb57a9dad2d46371f7..38049f2c949eb2ab804fc61f9da9336e6e848b77 100644
|
|
|
ca0e41 |
--- a/kerfuffle/archive.h
|
|
|
ca0e41 |
+++ b/kerfuffle/archive.h
|
|
|
ca0e41 |
@@ -95,6 +95,7 @@ public:
|
|
|
ca0e41 |
~Archive();
|
|
|
ca0e41 |
|
|
|
ca0e41 |
QString fileName() const;
|
|
|
ca0e41 |
+ QString fileBaseName() const;
|
|
|
ca0e41 |
bool isReadOnly() const;
|
|
|
ca0e41 |
|
|
|
ca0e41 |
KJob* open();
|
|
|
ca0e41 |
diff --git a/kerfuffle/archive.cpp b/kerfuffle/archive.cpp
|
|
|
ca0e41 |
index c2c5b18528def63405a8703475b1c592ca945973..470fc56879a2d5e579389b69591da9f230af74ea 100644
|
|
|
ca0e41 |
--- a/kerfuffle/archive.cpp
|
|
|
ca0e41 |
+++ b/kerfuffle/archive.cpp
|
|
|
ca0e41 |
@@ -196,6 +196,16 @@ QString Archive::fileName() const
|
|
|
ca0e41 |
return m_iface->filename();
|
|
|
ca0e41 |
}
|
|
|
ca0e41 |
|
|
|
ca0e41 |
+QString Archive::fileBaseName() const
|
|
|
ca0e41 |
+{
|
|
|
ca0e41 |
+ QString base = QFileInfo(m_iface->filename()).completeBaseName();
|
|
|
ca0e41 |
+ //special case for tar.gz/bzip2 files
|
|
|
ca0e41 |
+ if (base.right(4).toUpper() == QLatin1String(".TAR")) {
|
|
|
ca0e41 |
+ base.chop(4);
|
|
|
ca0e41 |
+ }
|
|
|
ca0e41 |
+ return base;
|
|
|
ca0e41 |
+}
|
|
|
ca0e41 |
+
|
|
|
ca0e41 |
void Archive::onAddFinished(KJob* job)
|
|
|
ca0e41 |
{
|
|
|
ca0e41 |
//if the archive was previously a single folder archive and an add job
|
|
|
ca0e41 |
@@ -217,15 +227,7 @@ void Archive::onListFinished(KJob* job)
|
|
|
ca0e41 |
m_isPasswordProtected = ljob->isPasswordProtected();
|
|
|
ca0e41 |
m_subfolderName = ljob->subfolderName();
|
|
|
ca0e41 |
if (m_subfolderName.isEmpty()) {
|
|
|
ca0e41 |
- QFileInfo fi(fileName());
|
|
|
ca0e41 |
- QString base = fi.completeBaseName();
|
|
|
ca0e41 |
-
|
|
|
ca0e41 |
- //special case for tar.gz/bzip2 files
|
|
|
ca0e41 |
- if (base.right(4).toUpper() == QLatin1String(".TAR")) {
|
|
|
ca0e41 |
- base.chop(4);
|
|
|
ca0e41 |
- }
|
|
|
ca0e41 |
-
|
|
|
ca0e41 |
- m_subfolderName = base;
|
|
|
ca0e41 |
+ m_subfolderName = fileBaseName();
|
|
|
ca0e41 |
}
|
|
|
ca0e41 |
|
|
|
ca0e41 |
m_hasBeenListed = true;
|
|
|
ca0e41 |
diff --git a/kerfuffle/jobs.cpp b/kerfuffle/jobs.cpp
|
|
|
ca0e41 |
index aedc62c4c9902c4f3207c648747f2e427446d5e5..de16439ce46283956e7741662bda19d1e8e591fa 100644
|
|
|
ca0e41 |
--- a/kerfuffle/jobs.cpp
|
|
|
ca0e41 |
+++ b/kerfuffle/jobs.cpp
|
|
|
ca0e41 |
@@ -217,7 +217,8 @@ void ListJob::onNewEntry(const ArchiveEntry& entry)
|
|
|
ca0e41 |
m_isPasswordProtected |= entry [ IsPasswordProtected ].toBool();
|
|
|
ca0e41 |
|
|
|
ca0e41 |
if (m_isSingleFolderArchive) {
|
|
|
ca0e41 |
- const QString fileName(entry[FileName].toString());
|
|
|
ca0e41 |
+ const QString fileName(entry[FileName].toString()
|
|
|
ca0e41 |
+ .replace(QRegExp(QString::fromAscii("^\\./")), QString()));
|
|
|
ca0e41 |
const QString basePath(fileName.split(QLatin1Char( '/' )).at(0));
|
|
|
ca0e41 |
|
|
|
ca0e41 |
if (m_basePath.isEmpty()) {
|