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

Revert most of r948055.

Single-file archives should _be_ considered single-folder archives.

CCBUG: 225426

svn path=/trunk/KDE/kdeutils/ark/; revision=1137712
parent 305bb08c
......@@ -157,26 +157,23 @@ void ListJob::onNewEntry(const ArchiveEntry& entry)
m_extractedFilesSize += entry[ Size ].toLongLong();
m_isPasswordProtected |= entry [ IsPasswordProtected ].toBool();
QString filename = entry[ FileName ].toString();
QString fileBaseRoot = filename.split(QDir::separator()).first();
if (m_isSingleFolderArchive) {
const QString fileName(entry[FileName].toString());
const QString basePath(fileName.split('/').at(0));
if (m_previousEntry.isEmpty()) { // Set the root path of the filename
m_previousEntry = fileBaseRoot;
m_subfolderName = fileBaseRoot;
m_isSingleFolderArchive = entry[ IsDirectory ].toBool();
} else {
if (m_previousEntry != fileBaseRoot) {
m_isSingleFolderArchive = false;
m_subfolderName.clear();
if (m_basePath.isEmpty()) {
m_basePath = basePath;
m_subfolderName = basePath;
} else {
// The state may change only if the folder's files were added before itself
if (entry[ IsDirectory ].toBool())
m_isSingleFolderArchive = true;
if (m_basePath != basePath) {
m_isSingleFolderArchive = false;
m_subfolderName.clear();
}
}
}
}
QString ListJob::subfolderName()
QString ListJob::subfolderName()
{
return m_subfolderName;
}
......
......@@ -96,7 +96,7 @@ private:
bool m_isSingleFolderArchive;
bool m_isPasswordProtected;
QString m_subfolderName;
QString m_previousEntry;
QString m_basePath;
qlonglong m_extractedFilesSize;
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