Commit fed9a47f authored by Laurent Montel's avatar Laurent Montel 😁

Minor optimization

parent 3a5c8c5b
...@@ -610,14 +610,15 @@ void AbstractImportExportJob::importDataSubdirectory(const QString &subdirectory ...@@ -610,14 +610,15 @@ void AbstractImportExportJob::importDataSubdirectory(const QString &subdirectory
const KArchiveEntry *entry = themeDir->entry(entryName); const KArchiveEntry *entry = themeDir->entry(entryName);
if (entry && entry->isDirectory()) { if (entry && entry->isDirectory()) {
QString subFolderName = entryName; QString subFolderName = entryName;
QDir themeDirectory(QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + QLatin1Char('/') + subdirectoryRelativePath + QStringLiteral("/%1").arg(entryName)); const QString topLevelPath = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + QLatin1Char('/') + subdirectoryRelativePath;
QDir themeDirectory(topLevelPath + QStringLiteral("/%1").arg(entryName));
int i = 1; int i = 1;
while (themeDirectory.exists()) { while (themeDirectory.exists()) {
subFolderName = entryName + QStringLiteral("_%1").arg(i); subFolderName = entryName + QStringLiteral("_%1").arg(i);
themeDirectory = QDir(QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + QLatin1Char('/') + subdirectoryRelativePath + QStringLiteral("/%1").arg(subFolderName)); themeDirectory = QDir(topLevelPath + QStringLiteral("/%1").arg(subFolderName));
++i; ++i;
} }
copyToDirectory(entry, QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + QLatin1Char('/') + subdirectoryRelativePath + QStringLiteral("/%1").arg(subFolderName)); copyToDirectory(entry, topLevelPath + QStringLiteral("/%1").arg(subFolderName));
} }
} }
} }
......
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