diff --git a/CMakeLists.txt b/CMakeLists.txt --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -16,17 +16,17 @@ include(KDECMakeSettings) include(KDEFrameworkCompilerSettings NO_POLICY_SCOPE) -include(GenerateExportHeader) +include(ECMGenerateExportHeader) include(CMakePackageConfigHelpers) include(ECMSetupVersion) include(ECMGenerateHeaders) include(ECMAddQch) include(ECMMarkNonGuiExecutable) include(ECMQtDeclareLoggingCategory) - - include(ECMPoQmTools) +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/autotests/kglobalshortcuttest.cpp b/autotests/kglobalshortcuttest.cpp --- a/autotests/kglobalshortcuttest.cpp +++ b/autotests/kglobalshortcuttest.cpp @@ -104,8 +104,8 @@ } // Ensure that the previous test did cleanup correctly +#if KGLOBALACCEL_ENABLE_DEPRECATED_SINCE(4, 2) KGlobalAccel *kga = KGlobalAccel::self(); -#ifndef KGLOBALACCEL_NO_DEPRECATED QList components = kga->allMainComponents(); QStringList componentId; componentId << componentName << QString() << "KDE Test Program" << QString(); @@ -343,16 +343,16 @@ } // As in kdebase/workspace/kcontrol/keys/globalshortcuts.cpp +#if KGLOBALACCEL_ENABLE_DEPRECATED_SINCE(4, 2) KGlobalAccel *kga = KGlobalAccel::self(); -#ifndef KGLOBALACCEL_NO_DEPRECATED QList components = kga->allMainComponents(); //qDebug() << components; QStringList componentId; componentId << "qttest" << QString() << "KDE Test Program" << QString(); QVERIFY(components.contains(componentId)); #endif -#ifndef KGLOBALACCEL_NO_DEPRECATED +#if KGLOBALACCEL_ENABLE_DEPRECATED_SINCE(4, 2) QList actions = kga->allActionsForComponent(componentId); QVERIFY(!actions.isEmpty()); QStringList actionIdA; @@ -510,8 +510,8 @@ // kglobalaccel writes asynchronous. QThread::sleep(1); +#if KGLOBALACCEL_ENABLE_DEPRECATED_SINCE(4, 2) KGlobalAccel *kga = KGlobalAccel::self(); -#ifndef KGLOBALACCEL_NO_DEPRECATED QList components = kga->allMainComponents(); QStringList componentId; componentId << "qttest" << QString() << "KDE Test Program" << QString(); diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -20,8 +20,15 @@ install(FILES ${kglobalaccel_component_xml} DESTINATION ${KDE_INSTALL_DBUSINTERFACEDIR} RENAME kf5_org.kde.kglobalaccel.Component.xml) add_library(KF5GlobalAccel ${kglobalaccel_SRCS}) -generate_export_header(KF5GlobalAccel BASE_NAME KGlobalAccel) add_library(KF5::GlobalAccel ALIAS KF5GlobalAccel) +ecm_generate_export_header(KF5GlobalAccel + BASE_NAME KGlobalAccel + # GROUP_BASE_NAME KF <- enable once all of KF modules use ecm_generate_export_header + VERSION ${KF5_VERSION} + DEPRECATED_BASE_VERSION 0 + DEPRECATION_VERSIONS 4.2 4.4 5.9 + EXCLUDE_DEPRECATED_BEFORE_AND_AT ${EXCLUDE_DEPRECATED_BEFORE_AND_AT} +) target_include_directories(KF5GlobalAccel INTERFACE "$") diff --git a/src/kglobalaccel.h b/src/kglobalaccel.h --- a/src/kglobalaccel.h +++ b/src/kglobalaccel.h @@ -289,66 +289,68 @@ */ bool hasShortcut(const QAction *action) const; +#if KGLOBALACCEL_ENABLE_DEPRECATED_SINCE(4, 4) /** * No effect. * - * @deprecated + * @deprecated Since 4.4. */ -#ifndef KGLOBALACCEL_NO_DEPRECATED - KGLOBALACCEL_DEPRECATED bool isEnabled() const; + KGLOBALACCEL_DEPRECATED_VERSION(4, 4, "Property no longer used") + bool isEnabled() const; #endif +#if KGLOBALACCEL_ENABLE_DEPRECATED_SINCE(4, 4) /** * No effect. * - * @deprecated + * @deprecated Since 4.4. */ -#ifndef KGLOBALACCEL_NO_DEPRECATED - KGLOBALACCEL_DEPRECATED void setEnabled(bool enabled); + KGLOBALACCEL_DEPRECATED_VERSION(4, 4, "Property no longer used") + void setEnabled(bool enabled); #endif +#if KGLOBALACCEL_ENABLE_DEPRECATED_SINCE(4, 2) /** * Return the unique and common names of all main components that have global shortcuts. * The action strings of the returned actionId stringlists will be empty. * - * @deprecated + * @deprecated Since 4.2. Do not use. */ -#ifndef KGLOBALACCEL_NO_DEPRECATED - KGLOBALACCEL_DEPRECATED QList allMainComponents(); + KGLOBALACCEL_DEPRECATED_VERSION(4, 2, "Do not use") + QList allMainComponents(); #endif +#if KGLOBALACCEL_ENABLE_DEPRECATED_SINCE(4, 2) /** - * @see getGlobalShortcutsByComponent - * - * @deprecated + * @deprecated Since 4.2. Do not use */ -#ifndef KGLOBALACCEL_NO_DEPRECATED - KGLOBALACCEL_DEPRECATED QList allActionsForComponent(const QStringList &actionId); + KGLOBALACCEL_DEPRECATED_VERSION(4, 2, "Do not use") + QList allActionsForComponent(const QStringList &actionId); #endif +#if KGLOBALACCEL_ENABLE_DEPRECATED_SINCE(4, 2) /** - * @see getGlobalShortcutsByKey - * - * @deprecated + * @deprecated Since 4.2, use KGlobalAccel::getGlobalShortcutsByKey(const QKeySequence &) */ -#ifndef KGLOBALACCEL_NO_DEPRECATED - KGLOBALACCEL_DEPRECATED static QStringList findActionNameSystemwide(const QKeySequence &seq); + KGLOBALACCEL_DEPRECATED_VERSION(4, 2, "Use KGlobalAccel::getGlobalShortcutsByKey(const QKeySequence &)") + static QStringList findActionNameSystemwide(const QKeySequence &seq); #endif +#if KGLOBALACCEL_ENABLE_DEPRECATED_SINCE(4, 2) /** - * @see promptStealShortcutSystemwide below - * - * @deprecated + * @deprecated Since 4.2, use KGlobalAccel::promptStealShortcutSystemwide(QWidget *, const QList &, const QKeySequence &) */ -#ifndef KGLOBALACCEL_NO_DEPRECATED - KGLOBALACCEL_DEPRECATED static bool promptStealShortcutSystemwide(QWidget *parent, const QStringList &actionIdentifier, const QKeySequence &seq); + KGLOBALACCEL_DEPRECATED_VERSION(4, 2, "Use KGlobalAccel::promptStealShortcutSystemwide(QWidget *, const QList &, const QKeySequence &)") + static bool promptStealShortcutSystemwide(QWidget *parent, const QStringList &actionIdentifier, const QKeySequence &seq); #endif +#if KGLOBALACCEL_BUILD_DEPRECATED_SINCE(5, 9) /** - * TODO KF6 remove * @internal + * Override no longer needed, left for BIC */ bool eventFilter(QObject *watched, QEvent *event) override; +#endif Q_SIGNALS: /** diff --git a/src/kglobalaccel.cpp b/src/kglobalaccel.cpp --- a/src/kglobalaccel.cpp +++ b/src/kglobalaccel.cpp @@ -114,7 +114,7 @@ KGlobalAccelPrivate::KGlobalAccelPrivate(KGlobalAccel *q) : -#ifndef KGLOBALACCEL_NO_DEPRECATED +#if KGLOBALACCEL_BUILD_DEPRECATED_SINCE(4, 4) enabled(true), #endif q(q), @@ -192,7 +192,7 @@ return component->isActive(); } -#ifndef KGLOBALACCEL_NO_DEPRECATED +#if KGLOBALACCEL_BUILD_DEPRECATED_SINCE(4, 4) bool KGlobalAccel::isEnabled() const { return d->enabled; @@ -204,7 +204,7 @@ return d->getComponent(componentUnique); } -#ifndef KGLOBALACCEL_NO_DEPRECATED +#if KGLOBALACCEL_BUILD_DEPRECATED_SINCE(4, 4) void KGlobalAccel::setEnabled(bool enabled) { d->enabled = enabled; @@ -511,22 +511,22 @@ } } -#ifndef KGLOBALACCEL_NO_DEPRECATED +#if KGLOBALACCEL_BUILD_DEPRECATED_SINCE(4, 2) QList KGlobalAccel::allMainComponents() { return d->iface()->allMainComponents(); } #endif -#ifndef KGLOBALACCEL_NO_DEPRECATED +#if KGLOBALACCEL_BUILD_DEPRECATED_SINCE(4, 2) QList KGlobalAccel::allActionsForComponent(const QStringList &actionId) { return d->iface()->allActionsForComponent(actionId); } #endif //static -#ifndef KGLOBALACCEL_NO_DEPRECATED +#if KGLOBALACCEL_BUILD_DEPRECATED_SINCE(4, 2) QStringList KGlobalAccel::findActionNameSystemwide(const QKeySequence &seq) { return self()->d->iface()->action(seq[0]); @@ -544,7 +544,7 @@ } //static -#ifndef KGLOBALACCEL_NO_DEPRECATED +#if KGLOBALACCEL_BUILD_DEPRECATED_SINCE(4, 2) bool KGlobalAccel::promptStealShortcutSystemwide(QWidget *parent, const QStringList &actionIdentifier, const QKeySequence &seq) { @@ -703,10 +703,12 @@ return d->actionShortcuts.contains(action) || d->actionDefaultShortcuts.contains(action); } +#if KGLOBALACCEL_BUILD_DEPRECATED_SINCE(5, 9) bool KGlobalAccel::eventFilter(QObject *watched, QEvent *event) { return QObject::eventFilter(watched, event); } +#endif bool KGlobalAccel::setGlobalShortcut(QAction *action, const QList &shortcut) { diff --git a/src/kglobalaccel_p.h b/src/kglobalaccel_p.h --- a/src/kglobalaccel_p.h +++ b/src/kglobalaccel_p.h @@ -84,7 +84,9 @@ QMultiHash nameToAction; QSet actions; +#if KGLOBALACCEL_BUILD_DEPRECATED_SINCE(4, 4) bool enabled; +#endif org::kde::KGlobalAccel *iface(); diff --git a/src/runtime/CMakeLists.txt b/src/runtime/CMakeLists.txt --- a/src/runtime/CMakeLists.txt +++ b/src/runtime/CMakeLists.txt @@ -19,8 +19,16 @@ configure_file(config-kglobalaccel.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-kglobalaccel.h ) add_library(KF5GlobalAccelPrivate ${kglobalaccelprivate_SRCS}) -generate_export_header(KF5GlobalAccelPrivate BASE_NAME KF5GlobalAccelPrivate) add_library(KF5::GlobalAccelPrivate ALIAS KF5GlobalAccelPrivate) +ecm_generate_export_header(KF5GlobalAccelPrivate + EXPORT_FILE_NAME kf5globalaccelprivate_export.h + BASE_NAME KGlobalAccelPrivate + # GROUP_BASE_NAME KF <- enable once all of KF modules use ecm_generate_export_header + VERSION ${KF5_VERSION} + DEPRECATED_BASE_VERSION 0 + DEPRECATION_VERSIONS 4.3 + EXCLUDE_DEPRECATED_BEFORE_AND_AT ${EXCLUDE_DEPRECATED_BEFORE_AND_AT} +) target_include_directories(KF5GlobalAccelPrivate INTERFACE "$") diff --git a/src/runtime/kglobalaccel_interface.h b/src/runtime/kglobalaccel_interface.h --- a/src/runtime/kglobalaccel_interface.h +++ b/src/runtime/kglobalaccel_interface.h @@ -30,7 +30,7 @@ /** * Abstract interface for plugins to implement */ -class KF5GLOBALACCELPRIVATE_EXPORT KGlobalAccelInterface : public QObject +class KGLOBALACCELPRIVATE_EXPORT KGlobalAccelInterface : public QObject { Q_OBJECT diff --git a/src/runtime/kglobalacceld.h b/src/runtime/kglobalacceld.h --- a/src/runtime/kglobalacceld.h +++ b/src/runtime/kglobalacceld.h @@ -35,7 +35,7 @@ /** * @todo get rid of all of those QStringList parameters. */ -class KF5GLOBALACCELPRIVATE_EXPORT KGlobalAccelD : public QObject, protected QDBusContext +class KGLOBALACCELPRIVATE_EXPORT KGlobalAccelD : public QObject, protected QDBusContext { Q_OBJECT Q_CLASSINFO("D-Bus Interface", "org.kde.KGlobalAccel") @@ -100,8 +100,11 @@ Q_SCRIPTABLE void doRegister(const QStringList &actionId); - //! @see unregister - Q_SCRIPTABLE QT_DEPRECATED void unRegister(const QStringList &actionId); +#if KGLOBALACCELPRIVATE_ENABLE_DEPRECATED_SINCE(4, 3) + //! @deprecated Since 4.3, use KGlobalAccelD::unregister + KGLOBALACCELPRIVATE_DEPRECATED_VERSION(4, 3, "Use KGlobalAccelD::unregister(const QString&, const QString&") + Q_SCRIPTABLE void unRegister(const QStringList &actionId); +#endif Q_SCRIPTABLE void activateGlobalShortcutContext( const QString &component, diff --git a/src/runtime/kglobalacceld.cpp b/src/runtime/kglobalacceld.cpp --- a/src/runtime/kglobalacceld.cpp +++ b/src/runtime/kglobalacceld.cpp @@ -491,6 +491,7 @@ } +#if KGLOBALACCELPRIVATE_BUILD_DEPRECATED_SINCE(4, 3) void KGlobalAccelD::unRegister(const QStringList &actionId) { #ifdef KDEDGLOBALACCEL_TRACE @@ -505,7 +506,7 @@ } } - +#endif QList KGlobalAccelD::setShortcut(const QStringList &actionId, const QList &keys, uint flags)