Skip to content

Commit

Permalink
Remove usage of deprecated QStandardPaths::DataLocation
Browse files Browse the repository at this point in the history
* Rearrange the documention to match the enumeration order.

Fixes: QTBUG-87037
Change-Id: Iad001351e0f309e694b8bbd503813017e6586a21
Reviewed-by: Mitch Curtis <[email protected]>
Reviewed-by: Alex Blasche <[email protected]>
  • Loading branch information
kaheimri committed Oct 23, 2020
1 parent 25edeaa commit 216c2ed
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 28 deletions.
2 changes: 1 addition & 1 deletion doc/global/includes/standardpath/functiondocs.qdocinc
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@
or writing to the current user's configuration.

It affects the locations into which test programs might write
files: \c GenericDataLocation, \c DataLocation, \c ConfigLocation,
files: \c GenericDataLocation, \c AppDataLocation, \c ConfigLocation,
\c GenericConfigLocation, \c AppConfigLocation,
\c GenericCacheLocation, and \c CacheLocation. Other locations
are not affected.
Expand Down
27 changes: 8 additions & 19 deletions src/corelib/io/qstandardpaths.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,9 @@ QT_BEGIN_NAMESPACE
\value HomeLocation Returns the user's home directory (the same as QDir::homePath()). On Unix
systems, this is equal to the HOME environment variable. This value might be
generic or application-specific, but the returned path is never empty.
\value DataLocation Returns the same value as AppLocalDataLocation. This enumeration value
is deprecated. Using AppDataLocation is preferable since on Windows, the roaming path is
recommended.
\value AppLocalDataLocation Returns the local settings path on the Windows operating
system. On all other platforms, it returns the same value as AppDataLocation.
This enum value was added in Qt 5.4.
\value CacheLocation Returns a directory location where user-specific
non-essential (cached) data should be written. This is an application-specific directory.
The returned path is never empty.
Expand Down Expand Up @@ -149,9 +149,6 @@ QT_BEGIN_NAMESPACE
QStandardPaths::GenericDataLocation. The returned path is never empty.
On the Windows operating system, this returns the roaming path.
This enum value was added in Qt 5.4.
\value AppLocalDataLocation Returns the local settings path on the Windows operating
system. On all other platforms, it returns the same value as AppDataLocation.
This enum value was added in Qt 5.4.
\value AppConfigLocation Returns a directory location where user-specific
configuration files should be written. This is an application-specific directory,
and the returned path is never empty.
Expand Down Expand Up @@ -190,7 +187,7 @@ QT_BEGIN_NAMESPACE
\row \li HomeLocation
\li "~"
\li "C:/Users/<USER>"
\row \li DataLocation
\row \li AppLocalDataLocation
\li "~/Library/Application Support/<APPNAME>", "/Library/Application Support/<APPNAME>". "<APPDIR>/../Resources"
\li "C:/Users/<USER>/AppData/Local/<APPNAME>", "C:/ProgramData/<APPNAME>", "<APPDIR>", "<APPDIR>/data", "<APPDIR>/data/<APPNAME>"
\row \li CacheLocation
Expand All @@ -217,9 +214,6 @@ QT_BEGIN_NAMESPACE
\row \li AppDataLocation
\li "~/Library/Application Support/<APPNAME>", "/Library/Application Support/<APPNAME>". "<APPDIR>/../Resources"
\li "C:/Users/<USER>/AppData/Roaming/<APPNAME>", "C:/ProgramData/<APPNAME>", "<APPDIR>", "<APPDIR>/data", "<APPDIR>/data/<APPNAME>"
\row \li AppLocalDataLocation
\li "~/Library/Application Support/<APPNAME>", "/Library/Application Support/<APPNAME>". "<APPDIR>/../Resources"
\li "C:/Users/<USER>/AppData/Local/<APPNAME>", "C:/ProgramData/<APPNAME>", "<APPDIR>", "<APPDIR>/data", "<APPDIR>/data/<APPNAME>"
\row \li AppConfigLocation
\li "~/Library/Preferences/<APPNAME>"
\li "C:/Users/<USER>/AppData/Local/<APPNAME>", "C:/ProgramData/<APPNAME>"
Expand All @@ -245,7 +239,7 @@ QT_BEGIN_NAMESPACE
\li "/tmp"
\row \li HomeLocation
\li "~"
\row \li DataLocation
\row \li AppLocalDataLocation
\li "~/.local/share/<APPNAME>", "/usr/local/share/<APPNAME>", "/usr/share/<APPNAME>"
\row \li CacheLocation
\li "~/.cache/<APPNAME>"
Expand All @@ -263,8 +257,6 @@ QT_BEGIN_NAMESPACE
\li "~/.cache"
\row \li AppDataLocation
\li "~/.local/share/<APPNAME>", "/usr/local/share/<APPNAME>", "/usr/share/<APPNAME>"
\row \li AppLocalDataLocation
\li "~/.local/share/<APPNAME>", "/usr/local/share/<APPNAME>", "/usr/share/<APPNAME>"
\row \li AppConfigLocation
\li "~/.config/<APPNAME>", "/etc/xdg/<APPNAME>"
\endtable
Expand Down Expand Up @@ -298,7 +290,7 @@ QT_BEGIN_NAMESPACE
\row \li HomeLocation
\li "<APPROOT>/files"
\li system defined
\row \li DataLocation
\row \li AppLocalDataLocation
\li "<APPROOT>/files", "<USER>/<APPNAME>/files"
\li "<APPROOT>/Library/Application Support"
\row \li CacheLocation
Expand Down Expand Up @@ -328,9 +320,6 @@ QT_BEGIN_NAMESPACE
\row \li AppConfigLocation
\li "<APPROOT>/files/settings"
\li "<APPROOT>/Library/Preferences/<APPNAME>"
\row \li AppLocalDataLocation
\li "<APPROOT>/files", "<USER>/<APPNAME>/files"
\li "<APPROOT>/Library/Application Support"
\endtable
In the table above, \c <APPNAME> is usually the organization name, the
Expand Down Expand Up @@ -564,6 +553,8 @@ QString QStandardPaths::displayName(StandardLocation type)
return QCoreApplication::translate("QStandardPaths", "Temporary Directory");
case HomeLocation:
return QCoreApplication::translate("QStandardPaths", "Home");
case AppLocalDataLocation:
return QCoreApplication::translate("QStandardPaths", "Application Data");
case CacheLocation:
return QCoreApplication::translate("QStandardPaths", "Cache");
case GenericDataLocation:
Expand All @@ -579,8 +570,6 @@ QString QStandardPaths::displayName(StandardLocation type)
case DownloadLocation:
return QCoreApplication::translate("QStandardPaths", "Download");
case AppDataLocation:
case AppLocalDataLocation:
return QCoreApplication::translate("QStandardPaths", "Application Data");
case AppConfigLocation:
return QCoreApplication::translate("QStandardPaths", "Application Configuration");
}
Expand Down
6 changes: 2 additions & 4 deletions src/corelib/io/qstandardpaths.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ class Q_CORE_EXPORT QStandardPaths
Q_GADGET

public:
// Do not re-order, must match QDesktopServices
enum StandardLocation {
DesktopLocation,
DocumentsLocation,
Expand All @@ -64,7 +63,7 @@ class Q_CORE_EXPORT QStandardPaths
PicturesLocation,
TempLocation,
HomeLocation,
DataLocation,
AppLocalDataLocation,
CacheLocation,
GenericDataLocation,
RuntimeLocation,
Expand All @@ -73,8 +72,7 @@ class Q_CORE_EXPORT QStandardPaths
GenericCacheLocation,
GenericConfigLocation,
AppDataLocation,
AppConfigLocation,
AppLocalDataLocation = DataLocation
AppConfigLocation
};
Q_ENUM(StandardLocation)

Expand Down
4 changes: 2 additions & 2 deletions src/corelib/io/qstandardpaths_win.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ static GUID writableSpecialFolderId(QStandardPaths::StandardLocation type)
FOLDERID_Videos, // MoviesLocation
FOLDERID_Pictures, // PicturesLocation
GUID(), GUID(), // TempLocation/HomeLocation
FOLDERID_LocalAppData, // AppLocalDataLocation ("Local" path), AppLocalDataLocation = DataLocation
FOLDERID_LocalAppData, // AppLocalDataLocation ("Local" path)
GUID(), // CacheLocation
FOLDERID_LocalAppData, // GenericDataLocation ("Local" path)
GUID(), // RuntimeLocation
Expand All @@ -159,7 +159,7 @@ static GUID writableSpecialFolderId(QStandardPaths::StandardLocation type)
FOLDERID_Videos, // MoviesLocation
FOLDERID_Pictures, // PicturesLocation
GUID(), GUID(), // TempLocation/HomeLocation
FOLDERID_LocalAppDataLow,// AppLocalDataLocation ("Local" path), AppLocalDataLocation = DataLocation
FOLDERID_LocalAppDataLow,// AppLocalDataLocation ("Local" path)
GUID(), // CacheLocation
FOLDERID_LocalAppDataLow,// GenericDataLocation ("Local" path)
GUID(), // RuntimeLocation
Expand Down
4 changes: 2 additions & 2 deletions tests/auto/corelib/io/qstandardpaths/tst_qstandardpaths.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ static const char * const enumNames[MaxStandardLocation + 1 - int(QStandardPaths
"PicturesLocation",
"TempLocation",
"HomeLocation",
"DataLocation",
"AppLocalDataLocation",
"CacheLocation",
"GenericDataLocation",
"RuntimeLocation",
Expand Down Expand Up @@ -307,7 +307,7 @@ void tst_qstandardpaths::testLocateAll()

void tst_qstandardpaths::testDataLocation()
{
// On all platforms, DataLocation should be GenericDataLocation / organization name / app name
// On all platforms, AppLocalDataLocation should be GenericDataLocation / organization name / app name
// This allows one app to access the data of another app.
// Android is an exception to this case, owing to the fact that
// applications are sandboxed.
Expand Down

0 comments on commit 216c2ed

Please sign in to comment.