diff options
Diffstat (limited to 'src/plugins/coreplugin/editormanager/editormanager.cpp')
-rw-r--r-- | src/plugins/coreplugin/editormanager/editormanager.cpp | 61 |
1 files changed, 36 insertions, 25 deletions
diff --git a/src/plugins/coreplugin/editormanager/editormanager.cpp b/src/plugins/coreplugin/editormanager/editormanager.cpp index 2374db934d..8366c179f1 100644 --- a/src/plugins/coreplugin/editormanager/editormanager.cpp +++ b/src/plugins/coreplugin/editormanager/editormanager.cpp @@ -1234,11 +1234,6 @@ void EditorManagerPrivate::saveSettings() qsettings->setValueWithDefault(maxRecentFilesKey, d->m_settings.maxRecentFiles, def.maxRecentFiles); - - qsettings->setValueWithDefault(fileSystemCaseSensitivityKey, - int(HostOsInfo::fileNameCaseSensitivity()), - int(OsSpecificAspects::fileNameCaseSensitivity( - HostOsInfo::hostOs()))); qsettings->setValueWithDefault(preferredEditorFactoriesKey, toMap(userPreferredEditorFactories())); } @@ -1256,26 +1251,14 @@ void EditorManagerPrivate::readSettings() if (maxRecentFiles > 0) d->m_settings.maxRecentFiles = maxRecentFiles; - if (qs->contains(fileSystemCaseSensitivityKey)) { - Qt::CaseSensitivity defaultSensitivity - = OsSpecificAspects::fileNameCaseSensitivity(HostOsInfo::hostOs()); - bool ok = false; - Qt::CaseSensitivity sensitivity = defaultSensitivity; - int sensitivitySetting = qs->value(fileSystemCaseSensitivityKey).toInt(&ok); - if (ok) { - switch (Qt::CaseSensitivity(sensitivitySetting)) { - case Qt::CaseSensitive: - sensitivity = Qt::CaseSensitive; - break; - case Qt::CaseInsensitive: - sensitivity = Qt::CaseInsensitive; - } - } - if (sensitivity == defaultSensitivity) - HostOsInfo::unsetOverrideFileNameCaseSensitivity(); - else - HostOsInfo::setOverrideFileNameCaseSensitivity(sensitivity); - } + const Qt::CaseSensitivity defaultSensitivity = OsSpecificAspects::fileNameCaseSensitivity( + HostOsInfo::hostOs()); + const Qt::CaseSensitivity sensitivity = readFileSystemSensitivity(qs); + if (sensitivity == defaultSensitivity) + HostOsInfo::unsetOverrideFileNameCaseSensitivity(); + else + HostOsInfo::setOverrideFileNameCaseSensitivity(sensitivity); + const QHash<Utils::MimeType, IEditorFactory *> preferredEditorFactories = fromMap( qs->value(preferredEditorFactoriesKey).toMap()); setUserPreferredEditorFactories(preferredEditorFactories); @@ -1302,6 +1285,34 @@ void EditorManagerPrivate::readSettings() updateAutoSave(); } +Qt::CaseSensitivity EditorManagerPrivate::readFileSystemSensitivity(QSettings *settings) +{ + const Qt::CaseSensitivity defaultSensitivity = OsSpecificAspects::fileNameCaseSensitivity( + HostOsInfo::hostOs()); + if (!settings->contains(fileSystemCaseSensitivityKey)) + return defaultSensitivity; + bool ok = false; + const int sensitivitySetting = settings->value(fileSystemCaseSensitivityKey).toInt(&ok); + if (ok) { + switch (Qt::CaseSensitivity(sensitivitySetting)) { + case Qt::CaseSensitive: + return Qt::CaseSensitive; + case Qt::CaseInsensitive: + return Qt::CaseInsensitive; + } + } + return defaultSensitivity; +} + +void EditorManagerPrivate::writeFileSystemSensitivity(Utils::QtcSettings *settings, + Qt::CaseSensitivity sensitivity) +{ + settings->setValueWithDefault(fileSystemCaseSensitivityKey, + int(sensitivity), + int(OsSpecificAspects::fileNameCaseSensitivity( + HostOsInfo::hostOs()))); +} + void EditorManagerPrivate::setAutoSaveEnabled(bool enabled) { d->m_settings.autoSaveEnabled = enabled; |