diff --git a/src/core/batchrenamejob.cpp b/src/core/batchrenamejob.cpp --- a/src/core/batchrenamejob.cpp +++ b/src/core/batchrenamejob.cpp @@ -25,7 +25,6 @@ #include #include #include -#include using namespace KIO; @@ -59,9 +58,16 @@ // Check for extensions. QSet extensions; - QMimeDatabase db; foreach (const QUrl &url, m_srcList) { - const QString extension = db.suffixForFileName(url.toDisplayString().toLower()); + const QString urlStr=url.toDisplayString(); + QString extension; + + //If the oldFileName contains a '.' then its extension is all to the right of the last dot + int dotIndex = urlStr.lastIndexOf(QStringLiteral(".")); + if (dotIndex != -1){ + extension = urlStr.mid(dotIndex+1); + } + if (extensions.contains(extension)) { m_allExtensionsDifferent = false; break; @@ -168,8 +174,16 @@ if (m_listIterator != m_srcList.constEnd()) { QString newName = indexedName(m_newName, m_index, m_placeHolder); const QUrl oldUrl = *m_listIterator; - QMimeDatabase db; - const QString extension = db.suffixForFileName(oldUrl.path().toLower()); + + const QString oldFileName = oldUrl.fileName(); + QString extension; + + //If the oldFileName contains a '.' then its extension is all to the right of the last dot + int dotIndex = oldFileName.lastIndexOf(QStringLiteral(".")); + if (dotIndex != -1){ + extension = oldFileName.mid(dotIndex+1); + } + if (!extension.isEmpty()) { newName += QLatin1Char('.') + extension; }