diff options
-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 | ||||
-rw-r--r-- | tests/auto/corelib/io/qstandardpaths/tst_qstandardpaths.cpp | 1 |
6 files changed, 14 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); diff --git a/tests/auto/corelib/io/qstandardpaths/tst_qstandardpaths.cpp b/tests/auto/corelib/io/qstandardpaths/tst_qstandardpaths.cpp index d8b22ae134..5c2bb0bb69 100644 --- a/tests/auto/corelib/io/qstandardpaths/tst_qstandardpaths.cpp +++ b/tests/auto/corelib/io/qstandardpaths/tst_qstandardpaths.cpp @@ -266,6 +266,7 @@ void tst_qstandardpaths::testAllWritableLocations_data() QTest::newRow("TempLocation") << QStandardPaths::TempLocation; QTest::newRow("HomeLocation") << QStandardPaths::HomeLocation; QTest::newRow("DataLocation") << QStandardPaths::DataLocation; + QTest::newRow("DownloadLocation") << QStandardPaths::DownloadLocation; } void tst_qstandardpaths::testAllWritableLocations() |