diff options
author | David Faure <faure@kde.org> | 2011-10-21 20:12:01 +0200 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2011-10-23 00:56:31 +0200 |
commit | 86558de34134f67cf3815a29612edc2d730f2ea2 (patch) | |
tree | 868417b17bac24be1f17080680af0f614a98b9b6 /src/gui/util/qdesktopservices_mac.cpp | |
parent | 4a788eb8313d7c089e3a59594fc6a5c9a7dd6499 (diff) |
Move path information from QDesktopServices (gui) to QStandardPaths (core)
Change-Id: Ic596c21894d83b4dab0c3f5b1aed916ddd590f2f
Reviewed-by: Thiago Macieira (Intel) <thiago.macieira@intel.com>
Diffstat (limited to 'src/gui/util/qdesktopservices_mac.cpp')
-rw-r--r-- | src/gui/util/qdesktopservices_mac.cpp | 61 |
1 files changed, 0 insertions, 61 deletions
diff --git a/src/gui/util/qdesktopservices_mac.cpp b/src/gui/util/qdesktopservices_mac.cpp index d1711b0f15..f4b5263f62 100644 --- a/src/gui/util/qdesktopservices_mac.cpp +++ b/src/gui/util/qdesktopservices_mac.cpp @@ -45,7 +45,6 @@ #include <qstringlist.h> #include <qdir.h> #include <qurl.h> -#include <qstringlist.h> #include <private/qcore_mac_p.h> #include <qcoreapplication.h> @@ -123,66 +122,6 @@ static bool openDocument(const QUrl &file) return QProcess::startDetached(QLatin1String("open"), QStringList() << file.toLocalFile()); } -/* - Constructs a full unicode path from a FSRef. -*/ -static QString getFullPath(const FSRef &ref) -{ - QByteArray ba(2048, 0); - if (FSRefMakePath(&ref, reinterpret_cast<UInt8 *>(ba.data()), ba.size()) == noErr) - return QString::fromUtf8(ba).normalized(QString::NormalizationForm_C); - return QString(); -} - -QString QDesktopServices::storageLocation(StandardLocation type) -{ - if (type == HomeLocation) - return QDir::homePath(); - - if (type == TempLocation) - return QDir::tempPath(); - - short domain = kOnAppropriateDisk; - - if (type == DataLocation || type == CacheLocation) - domain = kUserDomain; - - // http://developer.apple.com/documentation/Carbon/Reference/Folder_Manager/Reference/reference.html - FSRef ref; - OSErr err = FSFindFolder(domain, translateLocation(type), false, &ref); - if (err) - return QString(); - - QString path = getFullPath(ref); - - 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; -} - -QString QDesktopServices::displayName(StandardLocation type) -{ - if (QDesktopServices::HomeLocation == type) - return QObject::tr("Home"); - - FSRef ref; - OSErr err = FSFindFolder(kOnAppropriateDisk, translateLocation(type), false, &ref); - if (err) - return QString(); - - QCFString displayName; - err = LSCopyDisplayNameForRef(&ref, &displayName); - if (err) - return QString(); - - return static_cast<QString>(displayName); -} - QT_END_NAMESPACE #endif // QT_NO_DESKTOPSERVICES |