diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -52,7 +52,7 @@ RunnerSyntax QueryMatch - PREFIX KRunner + PREFIX Plasma REQUIRED_HEADERS KRunner_HEADERS ) @@ -63,13 +63,13 @@ ${KF5_INSTALL_TARGETS_DEFAULT_ARGS}) install(FILES ${KRunner_CamelCase_HEADERS} - DESTINATION ${KF5_INCLUDE_INSTALL_DIR}/KRunner/KRunner + DESTINATION ${KF5_INCLUDE_INSTALL_DIR}/KRunner/Plasma COMPONENT Devel) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/krunner_export.h ${KRunner_HEADERS} - DESTINATION ${KF5_INCLUDE_INSTALL_DIR}/KRunner/krunner + DESTINATION ${KF5_INCLUDE_INSTALL_DIR}/KRunner/plasma COMPONENT Devel) install(FILES @@ -107,3 +107,92 @@ "data/org.kde.krunner1.xml" DESTINATION ${KDE_INSTALL_DBUSINTERFACEDIR} RENAME kf5_org.kde.krunner1.xml) + + +# Backward compatibility: install also to wrong C++ namespace path layer KRunner/ & krunner/ +# KF6: remove + +include(CMakeParseArguments) + +# loosely modeled after ECM_GENERATE_HEADERS +function(GENERATE_BACKWARDHEADERS camelcase_forwarding_headers_var) + set(options) + set(oneValueArgs PREFIX BACKWARD_PREFIX REQUIRED_HEADERS) + set(multiValueArgs HEADER_NAMES) + cmake_parse_arguments(GBH "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) + + if (GBH_UNPARSED_ARGUMENTS) + message(FATAL_ERROR "Unexpected arguments to GENERATE_BACKWARDHEADERS: ${GBH_UNPARSED_ARGUMENTS}") + endif() + + if(NOT GBH_HEADER_NAMES OR NOT GBH_PREFIX OR NOT GBH_BACKWARD_PREFIX OR NOT GBH_REQUIRED_HEADERS) + message(FATAL_ERROR "Missing argument HEADER_NAMES, PREFIX, BACKWARD_PREFIX or REQUIRED_HEADERS to GENERATE_BACKWARDHEADERS") + endif() + + set(GBH_OUTPUT_DIR "${CMAKE_CURRENT_BINARY_DIR}") + + if (NOT "${GBH_PREFIX}" MATCHES "^.*/$") + set(GBH_PREFIX "${GBH_PREFIX}/") + endif() + string(TOLOWER "${GBH_PREFIX}" originalprefix) + + if (NOT "${GBH_BACKWARD_PREFIX}" MATCHES "^.*/$") + set(GBH_BACKWARD_PREFIX "${GBH_BACKWARD_PREFIX}/") + endif() + string(TOLOWER "${GBH_BACKWARD_PREFIX}" originalbackwardprefix) + + foreach(_CLASSNAME ${GBH_HEADER_NAMES}) + string(TOLOWER "${_CLASSNAME}" originalclassname) + + set(_actualheader "${CMAKE_CURRENT_SOURCE_DIR}/${originalclassname}.h") + if (NOT EXISTS ${_actualheader}) + message(FATAL_ERROR "Could not find \"${_actualheader}\"") + endif() + + # CamelCase forwarding header + set(FANCY_HEADER_FILE "${GBH_OUTPUT_DIR}/${GBH_BACKWARD_PREFIX}${_CLASSNAME}") + if (NOT EXISTS ${FANCY_HEADER_FILE}) + file(WRITE ${FANCY_HEADER_FILE} + "#warning Use of header <${GBH_BACKWARD_PREFIX}${_CLASSNAME}> is deprecated since KRunner v5.44, switch to <${GBH_PREFIX}${_CLASSNAME}>\n" + "#include <${originalprefix}${originalclassname}.h>\n" + ) + endif() + list(APPEND ${camelcase_forwarding_headers_var} "${FANCY_HEADER_FILE}") + + # normal forwarding header + set(REGULAR_HEADER_NAME ${GBH_OUTPUT_DIR}/${originalbackwardprefix}${originalclassname}.h) + if (NOT EXISTS ${REGULAR_HEADER_NAME}) + file(WRITE ${REGULAR_HEADER_NAME} + "#warning Use of header <${originalbackwardprefix}${originalclassname}.h> is deprecated since KRunner v5.44, switch to <${originalprefix}${originalclassname}.h>\n" + "#include <${originalprefix}${originalclassname}.h>\n" + ) + endif() + list(APPEND _REQUIRED_HEADERS "${REGULAR_HEADER_NAME}") + endforeach() + + set(${camelcase_forwarding_headers_var} ${${camelcase_forwarding_headers_var}} PARENT_SCOPE) + set(${GBH_REQUIRED_HEADERS} ${${GBH_REQUIRED_HEADERS}} ${_REQUIRED_HEADERS} PARENT_SCOPE) +endfunction() + +generate_backwardheaders(KRunner_CamelCase_BACKWARD_HEADERS + HEADER_NAMES + AbstractRunner + RunnerContext + RunnerManager + RunnerSyntax + QueryMatch + + PREFIX Plasma + BACKWARD_PREFIX KRunner + REQUIRED_HEADERS KRunner_BACKWARD_HEADERS +) + +install(FILES ${KRunner_CamelCase_BACKWARD_HEADERS} + DESTINATION ${KF5_INCLUDE_INSTALL_DIR}/KRunner/KRunner + COMPONENT Devel +) +install(FILES ${KRunner_BACKWARD_HEADERS} + ${CMAKE_CURRENT_BINARY_DIR}/krunner_export.h # also simple copy just in case someone includes it + DESTINATION ${KF5_INCLUDE_INSTALL_DIR}/KRunner/krunner + COMPONENT Devel +) diff --git a/src/abstractrunner.h b/src/abstractrunner.h --- a/src/abstractrunner.h +++ b/src/abstractrunner.h @@ -47,7 +47,7 @@ class AbstractRunnerPrivate; /** - * @class AbstractRunner abstractrunner.h + * @class AbstractRunner abstractrunner.h * * @short An abstract base class for Plasma Runner plugins. * diff --git a/src/dbusrunner_p.h b/src/dbusrunner_p.h --- a/src/dbusrunner_p.h +++ b/src/dbusrunner_p.h @@ -18,7 +18,7 @@ #pragma once -#include +#include #include "dbusutils_p.h" class OrgKdeKrunner1Interface; diff --git a/src/dbusutils_p.h b/src/dbusutils_p.h --- a/src/dbusutils_p.h +++ b/src/dbusutils_p.h @@ -4,7 +4,7 @@ #include #include #include -#include +#include struct RemoteMatch { diff --git a/src/declarative/runnermodel.h b/src/declarative/runnermodel.h --- a/src/declarative/runnermodel.h +++ b/src/declarative/runnermodel.h @@ -23,7 +23,7 @@ #include #include -#include +#include namespace Plasma { diff --git a/src/declarative/runnermodel.cpp b/src/declarative/runnermodel.cpp --- a/src/declarative/runnermodel.cpp +++ b/src/declarative/runnermodel.cpp @@ -25,7 +25,7 @@ #include "krunner_debug.h" -#include +#include RunnerModel::RunnerModel(QObject *parent) : QAbstractListModel(parent), diff --git a/src/declarative/runnermodelplugin.cpp b/src/declarative/runnermodelplugin.cpp --- a/src/declarative/runnermodelplugin.cpp +++ b/src/declarative/runnermodelplugin.cpp @@ -23,7 +23,7 @@ #include "krunner_debug.h" -#include +#include #include "runnermodel.h" diff --git a/src/querymatch.h b/src/querymatch.h --- a/src/querymatch.h +++ b/src/querymatch.h @@ -40,7 +40,7 @@ class QueryMatchPrivate; /** - * @class QueryMatch querymatch.h + * @class QueryMatch querymatch.h * * @short A match returned by an AbstractRunner in response to a given * RunnerContext. diff --git a/src/runnercontext.h b/src/runnercontext.h --- a/src/runnercontext.h +++ b/src/runnercontext.h @@ -36,7 +36,7 @@ class RunnerContextPrivate; /** - * @class RunnerContext runnercontext.h + * @class RunnerContext runnercontext.h * * @short The RunnerContext class provides information related to a search, * including the search term, metadata on the search term and collected diff --git a/src/runnermanager.h b/src/runnermanager.h --- a/src/runnermanager.h +++ b/src/runnermanager.h @@ -41,7 +41,7 @@ class RunnerManagerPrivate; /** - * @class RunnerManager runnermanager.h + * @class RunnerManager runnermanager.h * * @short The RunnerManager class decides what installed runners are runnable, * and their ratings. It is the main proxy to the runners. diff --git a/src/runnersyntax.h b/src/runnersyntax.h --- a/src/runnersyntax.h +++ b/src/runnersyntax.h @@ -29,7 +29,7 @@ class RunnerSyntaxPrivate; /** - * @class RunnerSyntax runnersyntax.h + * @class RunnerSyntax runnersyntax.h * @since 4.3 * * Represents a query prototype that the runner accepts. These can be diff --git a/templates/runner/CMakeLists.txt b/templates/runner/CMakeLists.txt --- a/templates/runner/CMakeLists.txt +++ b/templates/runner/CMakeLists.txt @@ -3,7 +3,7 @@ project(%{APPNAMELC}) set(QT_MIN_VERSION "5.9.0") -set(KF5_MIN_VERSION "5.42.0") +set(KF5_MIN_VERSION "5.44.0") find_package(ECM ${KF5_MIN_VERSION} REQUIRED NO_MODULE) set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR}) diff --git a/templates/runner/src/%{APPNAMELC}.h b/templates/runner/src/%{APPNAMELC}.h --- a/templates/runner/src/%{APPNAMELC}.h +++ b/templates/runner/src/%{APPNAMELC}.h @@ -18,7 +18,7 @@ #ifndef %{APPNAMEUC}_H #define %{APPNAMEUC}_H -#include +#include class %{APPNAME} : public Plasma::AbstractRunner {