From 3b2ccf1277e1d673a0a4bcfd81565fc7cf5cc5a6 Mon Sep 17 00:00:00 2001 From: David Faure Date: Thu, 15 Mar 2012 23:22:34 +0100 Subject: QStandardPaths: implement displayName() on all platforms. It was only implemented on Mac OSX until now (all this came from the QDesktopServices code). Change-Id: I7fd81d80ca77cf0ca6c213f59813a6163abe7dc5 Reviewed-by: Thiago Macieira --- src/corelib/io/qstandardpaths.cpp | 42 ++++++++++++++++++++++++++++++++++ src/corelib/io/qstandardpaths_json.cpp | 6 ----- src/corelib/io/qstandardpaths_unix.cpp | 6 ----- src/corelib/io/qstandardpaths_win.cpp | 6 ----- 4 files changed, 42 insertions(+), 18 deletions(-) (limited to 'src') diff --git a/src/corelib/io/qstandardpaths.cpp b/src/corelib/io/qstandardpaths.cpp index 78bf6c7b96..55f824cdeb 100644 --- a/src/corelib/io/qstandardpaths.cpp +++ b/src/corelib/io/qstandardpaths.cpp @@ -267,6 +267,48 @@ QString QStandardPaths::findExecutable(const QString &executableName, const QStr an empty QString if no relevant location can be found. */ +#ifndef Q_OS_MAC +QString QStandardPaths::displayName(StandardLocation type) +{ + switch (type) { + case DesktopLocation: + return QCoreApplication::translate("QStandardPaths", "Desktop"); + case DocumentsLocation: + return QCoreApplication::translate("QStandardPaths", "Documents"); + case FontsLocation: + return QCoreApplication::translate("QStandardPaths", "Fonts"); + case ApplicationsLocation: + return QCoreApplication::translate("QStandardPaths", "Applications"); + case MusicLocation: + return QCoreApplication::translate("QStandardPaths", "Music"); + case MoviesLocation: + return QCoreApplication::translate("QStandardPaths", "Movies"); + case PicturesLocation: + return QCoreApplication::translate("QStandardPaths", "Pictures"); + case TempLocation: + return QCoreApplication::translate("QStandardPaths", "Temporary Directory"); + case HomeLocation: + return QCoreApplication::translate("QStandardPaths", "Home"); + case DataLocation: + return QCoreApplication::translate("QStandardPaths", "Application Data"); + case CacheLocation: + return QCoreApplication::translate("QStandardPaths", "Cache"); + case GenericDataLocation: + return QCoreApplication::translate("QStandardPaths", "Shared Data"); + case RuntimeLocation: + return QCoreApplication::translate("QStandardPaths", "Runtime"); + case ConfigLocation: + return QCoreApplication::translate("QStandardPaths", "Configuration"); + case GenericCacheLocation: + return QCoreApplication::translate("QStandardPaths", "Shared Cache"); + case DownloadLocation: + return QCoreApplication::translate("QStandardPaths", "Download"); + } + // not reached + return QString(); +} +#endif + QT_END_NAMESPACE #endif // QT_NO_STANDARDPATHS diff --git a/src/corelib/io/qstandardpaths_json.cpp b/src/corelib/io/qstandardpaths_json.cpp index 52b194bea8..7d7a0a9f28 100644 --- a/src/corelib/io/qstandardpaths_json.cpp +++ b/src/corelib/io/qstandardpaths_json.cpp @@ -173,12 +173,6 @@ QStringList QStandardPaths::standardLocations(StandardLocation type) return dirs; } -QString QStandardPaths::displayName(StandardLocation type) -{ - Q_UNUSED(type); - return QString(); -} - QT_END_NAMESPACE #endif // QT_NO_STANDARDPATHS diff --git a/src/corelib/io/qstandardpaths_unix.cpp b/src/corelib/io/qstandardpaths_unix.cpp index b27b19eac9..1a2ae96edb 100644 --- a/src/corelib/io/qstandardpaths_unix.cpp +++ b/src/corelib/io/qstandardpaths_unix.cpp @@ -280,12 +280,6 @@ QStringList QStandardPaths::standardLocations(StandardLocation type) return dirs; } -QString QStandardPaths::displayName(StandardLocation type) -{ - Q_UNUSED(type); - return QString(); -} - QT_END_NAMESPACE #endif // QT_NO_STANDARDPATHS diff --git a/src/corelib/io/qstandardpaths_win.cpp b/src/corelib/io/qstandardpaths_win.cpp index 848dd448eb..8bd32eb1d4 100644 --- a/src/corelib/io/qstandardpaths_win.cpp +++ b/src/corelib/io/qstandardpaths_win.cpp @@ -206,12 +206,6 @@ QStringList QStandardPaths::standardLocations(StandardLocation type) return dirs; } -QString QStandardPaths::displayName(StandardLocation type) -{ - Q_UNUSED(type); - return QString(); -} - QT_END_NAMESPACE #endif // QT_NO_STANDARDPATHS -- cgit v1.2.3