diff options
Diffstat (limited to 'src/corelib/io/qsettings_mac.cpp')
-rw-r--r-- | src/corelib/io/qsettings_mac.cpp | 40 |
1 files changed, 21 insertions, 19 deletions
diff --git a/src/corelib/io/qsettings_mac.cpp b/src/corelib/io/qsettings_mac.cpp index 23cff6af27..7d1fb1a7c5 100644 --- a/src/corelib/io/qsettings_mac.cpp +++ b/src/corelib/io/qsettings_mac.cpp @@ -405,7 +405,6 @@ QMacSettingsPrivate::QMacSettingsPrivate(QSettings::Scope scope, const QString & } // if no bundle identifier yet. use a hard coded string. if (domainName.isEmpty()) { - setStatus(QSettings::AccessError); domainName = QLatin1String("unknown-organization.trolltech.com"); } @@ -540,27 +539,30 @@ void QMacSettingsPrivate::sync() // only report failures for the primary file (the one we write to) if (!ok && i == 0 && hostNames[j] == hostName && status == QSettings::NoError) { #if 1 - // work around what seems to be a bug in CFPreferences: - // don't report an error if there are no preferences for the application - QCFType<CFArrayRef> appIds = CFPreferencesCopyApplicationList(domains[i].userName, - hostNames[j]); - - // iterate through all the applications and see if we're there - CFIndex size = CFArrayGetCount(appIds); - for (CFIndex k = 0; k < size; ++k) { - const void *cfvalue = CFArrayGetValueAtIndex(appIds, k); - if (CFGetTypeID(cfvalue) == CFStringGetTypeID()) { - if (CFStringCompare(static_cast<CFStringRef>(cfvalue), - domains[i].applicationOrSuiteId, - kCFCompareCaseInsensitive) == kCFCompareEqualTo) { - setStatus(QSettings::AccessError); - break; + if (QSysInfo::macVersion() < QSysInfo::MV_10_7) { + // work around what seems to be a bug in CFPreferences: + // don't report an error if there are no preferences for the application + QCFType<CFArrayRef> appIds = CFPreferencesCopyApplicationList(domains[i].userName, + hostNames[j]); + + // iterate through all the applications and see if we're there + CFIndex size = CFArrayGetCount(appIds); + for (CFIndex k = 0; k < size; ++k) { + const void *cfvalue = CFArrayGetValueAtIndex(appIds, k); + if (CFGetTypeID(cfvalue) == CFStringGetTypeID()) { + if (CFStringCompare(static_cast<CFStringRef>(cfvalue), + domains[i].applicationOrSuiteId, + kCFCompareCaseInsensitive) == kCFCompareEqualTo) { + setStatus(QSettings::AccessError); + break; + } } } - } -#else - setStatus(QSettings::AccessError); + } else #endif + { + setStatus(QSettings::AccessError); + } } } } |