diff --git a/CMakeLists.txt b/CMakeLists.txt --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -25,6 +25,7 @@ include(CMakePackageConfigHelpers) include(ECMSetupVersion) include(ECMGenerateHeaders) +include(ECMGenerateExportHeader) include(ECMMarkNonGuiExecutable) include(ECMAddQch) @@ -42,6 +43,8 @@ set(HAVE_X11 FALSE) endif() +set(EXCLUDE_DEPRECATED_BEFORE_AND_AT 0 CACHE STRING "Control the range of deprecated API excluded from the build [default=0].") + option(BUILD_QCH "Build API documentation in QCH format (for e.g. Qt Assistant, Qt Creator & KDevelop)" OFF) add_feature_info(QCH ${BUILD_QCH} "API documentation in QCH format (for e.g. Qt Assistant, Qt Creator & KDevelop)") diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -36,7 +36,14 @@ KDBusServiceExtensionsAdaptor) add_library(KF5DBusAddons ${libkdbusaddons_SRCS}) -generate_export_header(KF5DBusAddons BASE_NAME KDBusAddons) +ecm_generate_export_header(KF5DBusAddons + BASE_NAME KDBusAddons + GROUP_BASE_NAME KF + VERSION ${KF5_VERSION} + DEPRECATED_BASE_VERSION 0 + DEPRECATION_VERSIONS 5.68 + EXCLUDE_DEPRECATED_BEFORE_AND_AT ${EXCLUDE_DEPRECATED_BEFORE_AND_AT} +) add_library(KF5::DBusAddons ALIAS KF5DBusAddons) diff --git a/src/kdbusconnectionpool.h b/src/kdbusconnectionpool.h --- a/src/kdbusconnectionpool.h +++ b/src/kdbusconnectionpool.h @@ -10,12 +10,14 @@ #include +#if KDBUSADDONS_ENABLE_DEPRECATED_SINCE(5, 68) #include /** * @namespace KDBusConnectionPool * Provides utility functions working around the problem * of QDBusConnection not being thread-safe. + * @deprecated since 5.68 QDBusConnection has been fixed. */ namespace KDBusConnectionPool { @@ -41,9 +43,14 @@ * ends up being called from. Library developers using * this facility are strongly encouraged to note this * caveat in the library's documentation. + * + * @deprecated since 5.68 Use QDBusConnection::sessionBus() instead. + * QDBusConnection is nowadays safe to use in multiple threads as well. */ +KDBUSADDONS_DEPRECATED_VERSION(5, 68, "Use QDBusConnection::sessionBus()") KDBUSADDONS_EXPORT QDBusConnection threadConnection(); } +#endif #endif diff --git a/src/kdbusconnectionpool.cpp b/src/kdbusconnectionpool.cpp --- a/src/kdbusconnectionpool.cpp +++ b/src/kdbusconnectionpool.cpp @@ -11,6 +11,7 @@ #include #include +#if KDBUSADDONS_BUILD_DEPRECATED_SINCE(5, 68) namespace { QAtomicInt s_connectionCounter; @@ -59,4 +60,4 @@ return s_perThreadConnection.localData()->connection(); } - +#endif diff --git a/src/kdeinitinterface.cpp b/src/kdeinitinterface.cpp --- a/src/kdeinitinterface.cpp +++ b/src/kdeinitinterface.cpp @@ -7,9 +7,9 @@ */ #include "kdeinitinterface.h" -#include "kdbusconnectionpool.h" #include "kdbusaddons_debug.h" +#include #include #include #include @@ -21,7 +21,7 @@ void KDEInitInterface::ensureKdeinitRunning() { - QDBusConnectionInterface *dbusDaemon = KDBusConnectionPool::threadConnection().interface(); + QDBusConnectionInterface *dbusDaemon = QDBusConnection::sessionBus().interface(); if (dbusDaemon->isServiceRegistered(QStringLiteral("org.kde.klauncher5"))) { return; }