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 <thiago.macieira@intel.com>
This commit is contained in:
David Faure 2012-03-15 23:22:34 +01:00 committed by Qt by Nokia
parent 349c0de091
commit 3b2ccf1277
4 changed files with 42 additions and 18 deletions

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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