diff options
Diffstat (limited to 'src/gui/util')
-rw-r--r-- | src/gui/util/qdesktopservices.cpp | 86 | ||||
-rw-r--r-- | src/gui/util/qdesktopservices.h | 29 |
2 files changed, 1 insertions, 114 deletions
diff --git a/src/gui/util/qdesktopservices.cpp b/src/gui/util/qdesktopservices.cpp index 763f309fc7..3b86d0c584 100644 --- a/src/gui/util/qdesktopservices.cpp +++ b/src/gui/util/qdesktopservices.cpp @@ -145,9 +145,6 @@ void QOpenUrlHandlerRegistry::handlerDestroyed(QObject *handler) openUrl() function can also be exposed to other applications, opening up for application deep linking or a very basic URL-based IPC mechanism. - \note Since Qt 5, storageLocation() and displayName() are replaced by functionality - provided by the QStandardPaths class. - \sa QSystemTrayIcon, QProcess, QStandardPaths */ @@ -290,89 +287,6 @@ void QDesktopServices::unsetUrlHandler(const QString &scheme) setUrlHandler(scheme, nullptr, nullptr); } -#if QT_DEPRECATED_SINCE(5, 0) -/*! - \enum QDesktopServices::StandardLocation - \since 4.4 - \obsolete - Use QStandardPaths::StandardLocation (see storageLocation() for porting notes) - - This enum describes the different locations that can be queried by - QDesktopServices::storageLocation and QDesktopServices::displayName. - - \value DesktopLocation Returns the user's desktop directory. - \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 MoviesLocation Returns the user's movies. - \value PicturesLocation Returns the user's pictures. - \value TempLocation Returns the system's temporary directory. - \value HomeLocation Returns the user's home directory. - \value DataLocation Returns a directory location where persistent - application data can be stored. QCoreApplication::applicationName - and QCoreApplication::organizationName should work on all - platforms. - \value CacheLocation Returns a directory location where user-specific - non-essential (cached) data should be written. - - \sa storageLocation(), displayName() -*/ - -/*! - \fn QString QDesktopServices::storageLocation(StandardLocation type) - \obsolete - Use QStandardPaths::writableLocation() - - \note when porting QDesktopServices::DataLocation to QStandardPaths::DataLocation, - a different path will be returned. - - \c{QDesktopServices::DataLocation} was \c{GenericDataLocation + "/data/organization/application"}, - while QStandardPaths::DataLocation is \c{GenericDataLocation + "/organization/application"}. - - Also note that \c{application} could be empty in Qt 4, if QCoreApplication::setApplicationName() - wasn't called, while in Qt 5 it defaults to the name of the executable. - - Therefore, if you still need to access the Qt 4 path (for example for data migration to Qt 5), replace - \snippet code/src_gui_util_qdesktopservices.cpp 5 - with - \snippet code/src_gui_util_qdesktopservices.cpp 6 - (assuming an organization name and an application name were set). -*/ - -/*! - \fn QString QDesktopServices::displayName(StandardLocation type) - \obsolete - Use QStandardPaths::displayName() -*/ -#endif - -extern Q_CORE_EXPORT QString qt_applicationName_noFallback(); - -QString QDesktopServices::storageLocationImpl(QStandardPaths::StandardLocation type) -{ - if (type == QStandardPaths::AppLocalDataLocation) { - // Preserve Qt 4 compatibility: - // * QCoreApplication::applicationName() must default to empty - // * Unix data location is under the "data/" subdirectory - const QString compatAppName = qt_applicationName_noFallback(); - const QString baseDir = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation); - const QString organizationName = QCoreApplication::organizationName(); -#if defined(Q_OS_WIN) || defined(Q_OS_MAC) - QString result = baseDir; - if (!organizationName.isEmpty()) - result += QLatin1Char('/') + organizationName; - if (!compatAppName.isEmpty()) - result += QLatin1Char('/') + compatAppName; - return result; -#elif defined(Q_OS_UNIX) - return baseDir + QLatin1String("/data/") - + organizationName + QLatin1Char('/') + compatAppName; -#endif - } - return QStandardPaths::writableLocation(type); -} - QT_END_NAMESPACE #include "qdesktopservices.moc" diff --git a/src/gui/util/qdesktopservices.h b/src/gui/util/qdesktopservices.h index 21705e2757..6e2836e26a 100644 --- a/src/gui/util/qdesktopservices.h +++ b/src/gui/util/qdesktopservices.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2016 The Qt Company Ltd. +** Copyright (C) 2020 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the QtGui module of the Qt Toolkit. @@ -42,7 +42,6 @@ #include <QtGui/qtguiglobal.h> #include <QtCore/qstring.h> -#include <QtCore/qstandardpaths.h> QT_BEGIN_NAMESPACE @@ -59,32 +58,6 @@ public: static bool openUrl(const QUrl &url); static void setUrlHandler(const QString &scheme, QObject *receiver, const char *method); static void unsetUrlHandler(const QString &scheme); - -#if QT_DEPRECATED_SINCE(5, 0) - //Must match QStandardPaths::StandardLocation - enum StandardLocation { - DesktopLocation, - DocumentsLocation, - FontsLocation, - ApplicationsLocation, - MusicLocation, - MoviesLocation, - PicturesLocation, - TempLocation, - HomeLocation, - DataLocation, - CacheLocation - }; - - QT_DEPRECATED static QString storageLocation(StandardLocation type) { - return storageLocationImpl(static_cast<QStandardPaths::StandardLocation>(type)); - } - QT_DEPRECATED static QString displayName(StandardLocation type) { - return QStandardPaths::displayName(static_cast<QStandardPaths::StandardLocation>(type)); - } -#endif -private: - static QString storageLocationImpl(QStandardPaths::StandardLocation type); }; #endif // QT_NO_DESKTOPSERVICES |