diff options
author | David Faure <faure@kde.org> | 2011-11-03 19:13:32 +0100 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2011-11-04 10:54:54 +0100 |
commit | 272d20ce27bfde44fe0ea85d90fe178bb01198da (patch) | |
tree | cbf115bf061c1af44f29286a569ad07ab0988842 /src | |
parent | ae6e7e3d59439008e7369da8083f4e5c4f6f980a (diff) |
QStandardPaths: add DownloadLocation.
Only properly implemented on unix (XDG), falls back to Document location
on Mac and Windows, because not easily available with the current API
being used by either one.
Change-Id: Id269f0e3c4e3a68e19205de96c0b39980fde80ff
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/corelib/io/qstandardpaths.cpp | 3 | ||||
-rw-r--r-- | src/corelib/io/qstandardpaths.h | 3 | ||||
-rw-r--r-- | src/corelib/io/qstandardpaths_mac.cpp | 2 | ||||
-rw-r--r-- | src/corelib/io/qstandardpaths_unix.cpp | 7 | ||||
-rw-r--r-- | src/corelib/io/qstandardpaths_win.cpp | 1 |
5 files changed, 13 insertions, 3 deletions
diff --git a/src/corelib/io/qstandardpaths.cpp b/src/corelib/io/qstandardpaths.cpp index 7deaceefc8..43ae5c07ab 100644 --- a/src/corelib/io/qstandardpaths.cpp +++ b/src/corelib/io/qstandardpaths.cpp @@ -72,7 +72,7 @@ QT_BEGIN_NAMESPACE \value DocumentsLocation Returns the user's document. \value FontsLocation Returns the user's fonts. \value ApplicationsLocation Returns the user's applications. - \value MusicLocation Returns the users music. + \value MusicLocation Returns the user's music. \value MoviesLocation Returns the user's movies. \value PicturesLocation Returns the user's pictures. \value TempLocation Returns the system's temporary directory. @@ -89,6 +89,7 @@ QT_BEGIN_NAMESPACE files should be written. For instance unix local sockets. \value ConfigLocation Returns a directory location where user-specific configuration files should be written. + \value DownloadLocation Returns a directory for user's downloaded files. \sa writableLocation() standardLocations() displayName() locate() locateAll() diff --git a/src/corelib/io/qstandardpaths.h b/src/corelib/io/qstandardpaths.h index 1bef1be7f6..d91da9de2f 100644 --- a/src/corelib/io/qstandardpaths.h +++ b/src/corelib/io/qstandardpaths.h @@ -72,7 +72,8 @@ public: CacheLocation, GenericDataLocation, RuntimeLocation, - ConfigLocation + ConfigLocation, + DownloadLocation }; static QString writableLocation(StandardLocation type); diff --git a/src/corelib/io/qstandardpaths_mac.cpp b/src/corelib/io/qstandardpaths_mac.cpp index 65c7f01fb4..84fc81494c 100644 --- a/src/corelib/io/qstandardpaths_mac.cpp +++ b/src/corelib/io/qstandardpaths_mac.cpp @@ -60,6 +60,8 @@ OSType translateLocation(QStandardPaths::StandardLocation type) return kPreferencesFolderType; case QStandardPaths::DesktopLocation: return kDesktopFolderType; + case QStandardPaths::DownloadLocation: // needs NSSearchPathForDirectoriesInDomains with NSDownloadsDirectory + // which needs an objective-C *.mm file... case QStandardPaths::DocumentsLocation: return kDocumentsFolderType; case QStandardPaths::FontsLocation: diff --git a/src/corelib/io/qstandardpaths_unix.cpp b/src/corelib/io/qstandardpaths_unix.cpp index 059bf3bd10..b1c5869f71 100644 --- a/src/corelib/io/qstandardpaths_unix.cpp +++ b/src/corelib/io/qstandardpaths_unix.cpp @@ -173,6 +173,9 @@ QString QStandardPaths::writableLocation(StandardLocation type) case MoviesLocation: key = QLatin1String("VIDEOS"); break; + case DownloadLocation: + key = QLatin1String("DOWNLOAD"); + break; default: break; } @@ -210,7 +213,9 @@ QString QStandardPaths::writableLocation(StandardLocation type) case MoviesLocation: path = QDir::homePath() + QLatin1String("/Videos"); break; - + case DownloadLocation: + path = QDir::homePath() + QLatin1String("/Downloads"); + break; case ApplicationsLocation: path = writableLocation(GenericDataLocation) + QLatin1String("/applications"); break; diff --git a/src/corelib/io/qstandardpaths_win.cpp b/src/corelib/io/qstandardpaths_win.cpp index 5716ffc6a8..e9093649f3 100644 --- a/src/corelib/io/qstandardpaths_win.cpp +++ b/src/corelib/io/qstandardpaths_win.cpp @@ -123,6 +123,7 @@ QString QStandardPaths::writableLocation(StandardLocation type) result = convertCharArray(path); break; + case DownloadLocation: // TODO implement with SHGetKnownFolderPath(FOLDERID_Downloads) (starting from Vista) case DocumentsLocation: if (SHGetSpecialFolderPath(0, path, CSIDL_PERSONAL, FALSE)) result = convertCharArray(path); |