-
Notifications
You must be signed in to change notification settings - Fork 671
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
Prevent downgrade of vfs folder #9119
Conversation
TheOneRing
commented
Oct 5, 2021
•
edited
Loading
edited
2a2a329
to
a8a8d18
Compare
src/gui/folder.cpp
Outdated
@@ -1299,9 +1310,9 @@ void FolderDefinition::save(QSettings &settings, const FolderDefinition &folder) | |||
|
|||
// Ensure new vfs modes won't be attempted by older clients | |||
if (folder.virtualFilesMode == Vfs::WindowsCfApi) { | |||
settings.setValue(QLatin1String(versionC), 3); | |||
settings.setValue(versionC(), 4); |
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.
shouldn't this call maxSettingsVersion()
?
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.
Hmm as you can see two lines later it doesn't always need to be the max version.
But I'll extract the two versions.
* [Accounts] | ||
* 0\version=1 | ||
*/ | ||
auto versionC() |
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.
Isn't this a duplicate of the one in folder.cpp
?
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.
Both are version but in different section that are evaluated independently.
But yes...
However refactoring the settings stuff is stuff for a major release...
if (foldersVersion <= maxFoldersVersion) { | ||
const auto &childGroups = settings->childGroups(); | ||
for (const auto &folderAlias : childGroups) { | ||
settings->beginGroup(folderAlias); | ||
const int folderVersion = settings->value(QLatin1String(versionC), 1).toInt(); | ||
const int folderVersion = settings->value(versionC(), 1).toInt(); |
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.
1
is another magic number. Can you make constants somewhere in 1 place (in a header file?) and add some comments to them? I've now seen 1, 2, and 4. Oh, and there was a 3, but that's now "old"?
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.
For some reason someone decided to start to count with 1, that's why we default to 1 if no version at all is set.
a8a8d18
to
5d9461f
Compare
Kudos, SonarCloud Quality Gate passed! |