-
Notifications
You must be signed in to change notification settings - Fork 667
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Change local collision to follow the ownCloud convention #11117
Conversation
src/gui/folderman.cpp
Outdated
@@ -786,8 +786,8 @@ QString FolderMan::checkPathValidityForNewFolder(const QString &path) const | |||
|
|||
QString FolderMan::findGoodPathForNewSyncFolder(const QString &basePath, const QString &newFolder) const | |||
{ | |||
// reserve 3 characters to allow appending of a number 0-100 | |||
const QString normalisedPath = FileSystem::createPortableFileName(basePath, FileSystem::pathEscape(newFolder), 3); | |||
// reserve 3 characters to allow appending of a number 0-100, plus 2 for " (" and 1 for ")" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we could use std::stringview(" (100)").size()
to have a compile time placeholder?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
src/gui/folderman.cpp
Outdated
if (!QFileInfo::exists(folder) | ||
&& FolderMan::instance()->checkPathValidityForNewFolder(folder).isEmpty()) { | ||
return canonicalPath(folder); | ||
} | ||
folder = normalisedPath + QString::number(attempt); | ||
folder = normalisedPath + QStringLiteral(" (") + QString::number(attempt) + QStringLiteral(")"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
folder = normalisedPath + QStringLiteral(" (") + QString::number(attempt) + QStringLiteral(")"); | |
folder = normalisedPath + QStringLiteral(" (%1)").arg(QString::number(attempt)); |
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
Looks like we have unit tests for this :D |
If the default folder name exists, a different one was offered in the form of "ownCloud2". This is now changed to follow the ownCloud convention, and "ownCloud (2)" is now offered.
6de1497
to
1fa982f
Compare
Kudos, SonarCloud Quality Gate passed! |
If the default folder name exists, a different one was offered in the form of "ownCloud2". This is now changed to follow the ownCloud convention, and "ownCloud (2)" is now offered.