Commit 6576bc3d authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Make it compile against qt5.15. SkipEmptyParts is part of Qt::.

parent 9c901d16
......@@ -108,7 +108,11 @@ void Archive::Entry::setParent(Archive::Entry *parent)
void Archive::Entry::setFullPath(const QString &fullPath)
{
m_fullPath = fullPath;
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
const QStringList pieces = m_fullPath.split(QLatin1Char('/'), QString::SkipEmptyParts);
#else
const QStringList pieces = m_fullPath.split(QLatin1Char('/'), Qt::SkipEmptyParts);
#endif
m_name = pieces.isEmpty() ? QString() : pieces.last();
}
......
......@@ -214,7 +214,11 @@ QStringList ReadOnlyArchiveInterface::entryPathsFromDestination(QStringList entr
}
newPath = destinationPath + entryPath.right(charsCount);
} else {
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
const QString name = entryPath.split(QLatin1Char('/'), QString::SkipEmptyParts).last();
#else
const QString name = entryPath.split(QLatin1Char('/'), Qt::SkipEmptyParts).last();
#endif
if (entriesWithoutChildren != 1) {
newPath = destinationPath + name;
if (entryPath.right(1) == QLatin1String("/")) {
......
......@@ -184,7 +184,11 @@ bool CliInterface::addFiles(const QVector<Archive::Entry*> &files, const Archive
qCDebug(ARK) << "Changing working dir again to " << m_extractTempDir->path();
QDir::setCurrent(m_extractTempDir->path());
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
filesToPass.push_back(new Archive::Entry(preservedParent, destinationPath.split(QLatin1Char('/'), QString::SkipEmptyParts).at(0)));
#else
filesToPass.push_back(new Archive::Entry(preservedParent, destinationPath.split(QLatin1Char('/'), Qt::SkipEmptyParts).at(0)));
#endif
} else {
filesToPass = files;
}
......
......@@ -361,7 +361,11 @@ void ArchiveModel::initRootEntry()
Archive::Entry *ArchiveModel::parentFor(const Archive::Entry *entry, InsertBehaviour behaviour)
{
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
QStringList pieces = entry->fullPath().split(QLatin1Char('/'), QString::SkipEmptyParts);
#else
QStringList pieces = entry->fullPath().split(QLatin1Char('/'), Qt::SkipEmptyParts);
#endif
if (pieces.isEmpty()) {
return nullptr;
}
......@@ -439,7 +443,11 @@ void ArchiveModel::slotEntryRemoved(const QString & path)
return;
}
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
Archive::Entry *entry = m_rootEntry->findByPath(entryFileName.split(QLatin1Char('/'), QString::SkipEmptyParts));
#else
Archive::Entry *entry = m_rootEntry->findByPath(entryFileName.split(QLatin1Char('/'), Qt::SkipEmptyParts));
#endif
if (entry) {
Archive::Entry *parent = entry->getParent();
QModelIndex index = indexForEntry(entry);
......@@ -537,7 +545,11 @@ void ArchiveModel::newEntry(Archive::Entry *receivedEntry, InsertBehaviour behav
Archive::Entry *parent = parentFor(receivedEntry, behaviour);
// Create an Archive::Entry.
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
const QStringList path = entryFileName.split(QLatin1Char('/'), QString::SkipEmptyParts);
#else
const QStringList path = entryFileName.split(QLatin1Char('/'), Qt::SkipEmptyParts);
#endif
Archive::Entry *entry = parent->find(path.last());
if (entry) {
entry->copyMetaData(receivedEntry);
......@@ -746,7 +758,11 @@ bool ArchiveModel::conflictingEntries(QList<const Archive::Entry*> &conflictingE
// We can't accept destination as an argument, because it can be a new entry path for renaming.
const Archive::Entry *destination;
{
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
QStringList destinationParts = entries.first().split(QLatin1Char('/'), QString::SkipEmptyParts);
#else
QStringList destinationParts = entries.first().split(QLatin1Char('/'), Qt::SkipEmptyParts);
#endif
destinationParts.removeLast();
if (destinationParts.count() > 0) {
destination = m_rootEntry->findByPath(destinationParts);
......@@ -769,7 +785,11 @@ bool ArchiveModel::conflictingEntries(QList<const Archive::Entry*> &conflictingE
}
bool isDir = entry.right(1) == QLatin1String("/");
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
const Archive::Entry *archiveEntry = lastDirEntry->find(entry.split(QLatin1Char('/'), QString::SkipEmptyParts).last());
#else
const Archive::Entry *archiveEntry = lastDirEntry->find(entry.split(QLatin1Char('/'), Qt::SkipEmptyParts).last());
#endif
if (archiveEntry != nullptr) {
if (archiveEntry->isDir() != isDir || !allowMerging) {
......
......@@ -125,7 +125,11 @@ void InfoPanel::setIndex(const QModelIndex& index)
}
}
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
const QStringList nameParts = entry->fullPath().split(QLatin1Char( '/' ), QString::SkipEmptyParts);
#else
const QStringList nameParts = entry->fullPath().split(QLatin1Char( '/' ), Qt::SkipEmptyParts);
#endif
const QString name = (nameParts.count() > 0) ? nameParts.last() : entry->fullPath();
fileName->setText(name);
......
......@@ -186,7 +186,11 @@ bool CliPlugin::readListLine(const QString& line)
m_numberOfVolumes = line.section(QLatin1Char('='), 1).trimmed().toInt();
} else if (line.startsWith(QLatin1String("Method = "))) {
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
QStringList methods = line.section(QLatin1Char('='), 1).trimmed().split(QLatin1Char(' '), QString::SkipEmptyParts);
#else
QStringList methods = line.section(QLatin1Char('='), 1).trimmed().split(QLatin1Char(' '), Qt::SkipEmptyParts);
#endif
handleMethods(methods);
} else if (line.startsWith(QLatin1String("Comment = "))) {
......@@ -265,7 +269,11 @@ bool CliPlugin::readListLine(const QString& line)
// For zip archives we need to check method for each entry.
if (m_archiveType == ArchiveTypeZip) {
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
QStringList methods = line.section(QLatin1Char('='), 1).trimmed().split(QLatin1Char(' '), QString::SkipEmptyParts);
#else
QStringList methods = line.section(QLatin1Char('='), 1).trimmed().split(QLatin1Char(' '), Qt::SkipEmptyParts);
#endif
handleMethods(methods);
}
......
......@@ -109,7 +109,11 @@ bool CliPlugin::readListLine(const QString &line)
return true;
}
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
QStringList fileprops = line.split(QLatin1Char(' '), QString::SkipEmptyParts);
#else
QStringList fileprops = line.split(QLatin1Char(' '), Qt::SkipEmptyParts);
#endif
m_entryFilename = QDir::fromNativeSeparators(m_entryFilename);
bool isDirectory = (bool)(fileprops[ 5 ].contains(QLatin1Char('d'), Qt::CaseInsensitive));
......
......@@ -457,7 +457,11 @@ bool CliPlugin::handleUnrar4Line(const QString &line)
// pass a QStringList containing the details. We need to store
// it due to symlinks (see below).
m_unrar4Details.append(line.split(QLatin1Char(' '),
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
QString::SkipEmptyParts));
#else
Qt::SkipEmptyParts));
#endif
// The details line contains 9 fields, so m_unrar4Details
// should now contain 9 + the filename = 10 strings. If not, this is
......
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