summaryrefslogtreecommitdiffstats
path: root/src/corelib/io/qsettings_mac.cpp
diff options
context:
space:
mode:
authorPalo Kisa <palo.kisa@gmail.com>2016-08-24 02:14:32 +0200
committerPalo Kisa <palo.kisa@gmail.com>2016-09-27 22:03:04 +0000
commitee35fbbf526d18d5cebd425d0d36dbdc74984273 (patch)
treed40759c5958dec0968b5c51557d6a3ddd2c072d9 /src/corelib/io/qsettings_mac.cpp
parent99b6eb4382e135815b53b567297be9cd4ecfd96a (diff)
qsettings: Simplify confFiles logic
Use a QVector to hold the QConfFile(s) to allow more configuration files than the statically defined number -> this will allow considering multiple system-wide configuration files if needed. To use a dynamic container we get rid of use QScopedSharedPointer, which actually wasn't needed anyway, as the "deref" logic was/is done manually in the QConfFileSettingsPrivate destructor. Change-Id: Ie9341da2cbe2e2b1379f9e2538cb4c9ebbd6fc97 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/io/qsettings_mac.cpp')
-rw-r--r--src/corelib/io/qsettings_mac.cpp13
1 files changed, 4 insertions, 9 deletions
diff --git a/src/corelib/io/qsettings_mac.cpp b/src/corelib/io/qsettings_mac.cpp
index bc397055ff..4ad5a7b398 100644
--- a/src/corelib/io/qsettings_mac.cpp
+++ b/src/corelib/io/qsettings_mac.cpp
@@ -419,20 +419,15 @@ QMacSettingsPrivate::QMacSettingsPrivate(QSettings::Scope scope, const QString &
javaPackageName.prepend(QLatin1String("com."));
suiteId = javaPackageName;
- if (scope == QSettings::SystemScope)
- spec |= F_System;
-
- if (application.isEmpty()) {
- spec |= F_Organization;
- } else {
+ if (!application.isEmpty()) {
javaPackageName += QLatin1Char('.');
javaPackageName += application;
applicationId = javaPackageName;
}
numDomains = 0;
- for (int i = (spec & F_System) ? 1 : 0; i < 2; ++i) {
- for (int j = (spec & F_Organization) ? 1 : 0; j < 3; ++j) {
+ for (int i = (scope == QSettings::SystemScope) ? 1 : 0; i < 2; ++i) {
+ for (int j = (application.isEmpty()) ? 1 : 0; j < 3; ++j) {
SearchDomain &domain = domains[numDomains++];
domain.userName = (i == 0) ? kCFPreferencesCurrentUser : kCFPreferencesAnyUser;
if (j == 0)
@@ -573,7 +568,7 @@ bool QMacSettingsPrivate::isWritable() const
QString QMacSettingsPrivate::fileName() const
{
QString result;
- if ((spec & F_System) == 0)
+ if (scope == QSettings::UserScope)
result = QDir::homePath();
result += QLatin1String("/Library/Preferences/");
result += QCFString::toQString(domains[0].applicationOrSuiteId);