From 082eebe6a47c910593f87798bf688149e6ca5534 Mon Sep 17 00:00:00 2001 From: Volker Hilsheimer Date: Tue, 12 May 2020 14:30:36 +0200 Subject: Remove deprecated QDesktopServices APIs Change-Id: Ic21ad2938b20c1aa3ae499a921c9cff92f615816 Reviewed-by: Lars Knoll --- src/corelib/kernel/qcoreapplication.cpp | 6 --- src/gui/util/qdesktopservices.cpp | 86 -------------------------------- src/gui/util/qdesktopservices.h | 29 +---------- src/network/access/qnetworkdiskcache.cpp | 2 +- 4 files changed, 2 insertions(+), 121 deletions(-) (limited to 'src') diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp index 0c5e6cdb4a..b3aa8f5a51 100644 --- a/src/corelib/kernel/qcoreapplication.cpp +++ b/src/corelib/kernel/qcoreapplication.cpp @@ -2606,12 +2606,6 @@ QString QCoreApplication::applicationName() return coreappdata() ? coreappdata()->application : QString(); } -// Exported for QDesktopServices (Qt4 behavior compatibility) -Q_CORE_EXPORT QString qt_applicationName_noFallback() -{ - return coreappdata()->applicationNameSet ? coreappdata()->application : QString(); -} - /*! \property QCoreApplication::applicationVersion \since 4.4 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 #include -#include 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(type)); - } - QT_DEPRECATED static QString displayName(StandardLocation type) { - return QStandardPaths::displayName(static_cast(type)); - } -#endif -private: - static QString storageLocationImpl(QStandardPaths::StandardLocation type); }; #endif // QT_NO_DESKTOPSERVICES diff --git a/src/network/access/qnetworkdiskcache.cpp b/src/network/access/qnetworkdiskcache.cpp index b30d1c9664..1ee075cb71 100644 --- a/src/network/access/qnetworkdiskcache.cpp +++ b/src/network/access/qnetworkdiskcache.cpp @@ -132,7 +132,7 @@ QString QNetworkDiskCache::cacheDirectory() const Prepared cache items will be stored in the new cache directory when they are inserted. - \sa QDesktopServices::CacheLocation + \sa QStandardPaths::CacheLocation */ void QNetworkDiskCache::setCacheDirectory(const QString &cacheDir) { -- cgit v1.2.3