diff options
author | Morten Johan Sørvig <morten.sorvig@nokia.com> | 2009-10-30 13:49:05 (GMT) |
---|---|---|
committer | Morten Johan Sørvig <morten.sorvig@nokia.com> | 2009-10-30 13:50:33 (GMT) |
commit | 4510c18ed3ffd2c01d11159fc2d2ec7f0eb48e42 (patch) | |
tree | 0734081121e4aa284168515e7ddb5732b04471d1 | |
parent | 5cca60ad593cc5b8778d7be0b8137ffecd34b247 (diff) | |
download | Qt-4510c18ed3ffd2c01d11159fc2d2ec7f0eb48e42.zip Qt-4510c18ed3ffd2c01d11159fc2d2ec7f0eb48e42.tar.gz Qt-4510c18ed3ffd2c01d11159fc2d2ec7f0eb48e42.tar.bz2 |
Fix QDesktopServices::DataLocation on Mac.
DataLocation now behaves as on the other platforms,
QCoreApplication::organizationName() and applicationName()
is included in the returned path.
-rw-r--r-- | dist/changes-4.6.0 | 4 | ||||
-rw-r--r-- | src/gui/util/qdesktopservices.cpp | 9 | ||||
-rw-r--r-- | src/gui/util/qdesktopservices_mac.cpp | 9 |
3 files changed, 10 insertions, 12 deletions
diff --git a/dist/changes-4.6.0 b/dist/changes-4.6.0 index 7f723da..abe4427 100644 --- a/dist/changes-4.6.0 +++ b/dist/changes-4.6.0 @@ -143,3 +143,7 @@ information about a particular change. function setFloatingPointPrecision(). Set Qt_4_5 as the version of the QDataStream to get the behavior of previous versions. + - On Mac OS X, QDesktopServices::storageLocation(DataLocation) now includes + QCoreApplication::organizationName() and QCoreApplication::applicationName() + if those are set. This matches the behavior on the other platforms. +
\ No newline at end of file diff --git a/src/gui/util/qdesktopservices.cpp b/src/gui/util/qdesktopservices.cpp index 1690d87..85b539f 100644 --- a/src/gui/util/qdesktopservices.cpp +++ b/src/gui/util/qdesktopservices.cpp @@ -294,15 +294,6 @@ void QDesktopServices::unsetUrlHandler(const QString &scheme) Rest of the standard locations point to folder on same drive with executable, except that if executable is in ROM the folder from C drive is returned. - \note On Mac OS X, DataLocation does not include QCoreApplication::organizationName. - Use code like this to add it: - - \code - QString location = QDesktopServices::storageLocation(QDesktopServices::DataLocation); - #ifdef Q_WS_MAC - location.insert(location.count() - QCoreApplication::applicationName().count(), - QCoreApplication::organizationName() + "/"); - #endif \endcode */ diff --git a/src/gui/util/qdesktopservices_mac.cpp b/src/gui/util/qdesktopservices_mac.cpp index 0626e0a..23f9e60 100644 --- a/src/gui/util/qdesktopservices_mac.cpp +++ b/src/gui/util/qdesktopservices_mac.cpp @@ -153,9 +153,12 @@ QString QDesktopServices::storageLocation(StandardLocation type) QString path = getFullPath(ref); - QString appName = QCoreApplication::applicationName(); - if (!appName.isEmpty() && (type == DataLocation || type == CacheLocation)) - path += QLatin1Char('/') + appName; + if (type == DataLocation || type == CacheLocation) { + if (QCoreApplication::organizationName().isEmpty() == false) + path += QLatin1Char('/') + QCoreApplication::organizationName(); + if (QCoreApplication::applicationName().isEmpty() == false) + path += QLatin1Char('/') + QCoreApplication::applicationName(); + } return path; } |