diff --git a/templates/runner/%{APPNAMELC}.h b/templates/runner/%{APPNAMELC}.h deleted file mode 100644 --- a/templates/runner/%{APPNAMELC}.h +++ /dev/null @@ -1,19 +0,0 @@ -#ifndef %{APPNAMEUC}_H -#define %{APPNAMEUC}_H - -#include - -class %{APPNAME} : public Plasma::AbstractRunner -{ - Q_OBJECT - -public: - %{APPNAME}(QObject *parent, const QVariantList &args); - ~%{APPNAME}(); - -public: // Plasma::AbstractRunner API - void match(Plasma::RunnerContext &context) override; - void run(const Plasma::RunnerContext &context, const Plasma::QueryMatch &match) override; -}; - -#endif diff --git a/templates/runner/%{APPNAMELC}.cpp b/templates/runner/%{APPNAMELC}.cpp deleted file mode 100644 --- a/templates/runner/%{APPNAMELC}.cpp +++ /dev/null @@ -1,32 +0,0 @@ -#include "%{APPNAMELC}.h" - -K_EXPORT_PLASMA_RUNNER(%{APPNAMELC}, %{APPNAME}) - -%{APPNAME}::%{APPNAME}(QObject *parent, const QVariantList &args) - : Plasma::AbstractRunner(parent, args) -{ - setObjectName("%{APPNAME}"); -} - -%{APPNAME}::~%{APPNAME}() -{ -} - - -void %{APPNAME}::match(Plasma::RunnerContext &context) -{ - - const QString term = context.query(); - if (term.length() < 3) { - return; - } - //TODO -} - -void %{APPNAME}::run(const Plasma::RunnerContext &context, const Plasma::QueryMatch &match) -{ - Q_UNUSED(context) - Q_UNUSED(match) -} - -#include "%{APPNAMELC}.moc" diff --git a/templates/runner/CMakeLists.txt b/templates/runner/CMakeLists.txt --- a/templates/runner/CMakeLists.txt +++ b/templates/runner/CMakeLists.txt @@ -1,31 +1,20 @@ -project(plasma-%{APPNAMELC}) +cmake_minimum_required(VERSION 3.0) -cmake_minimum_required(VERSION 2.8.12 FATAL_ERROR) +project(%{APPNAMELC}) -set(QT_MIN_VERSION "5.4.0") -set(KF5_MIN_VERSION "5.14.0") -set(INSTALL_SDDM_THEME TRUE) -find_package(Qt5 ${QT_MIN_VERSION} CONFIG REQUIRED COMPONENTS Widgets ) -find_package(ECM 1.8.0 REQUIRED NO_MODULE) +set(QT_MIN_VERSION "5.9.0") +set(KF5_MIN_VERSION "5.42.0") + +find_package(ECM ${KF5_MIN_VERSION} REQUIRED NO_MODULE) set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR}) -find_package(KF5 ${KF5_MIN_VERSION} REQUIRED COMPONENTS Runner) +find_package(Qt5 ${QT_MIN_VERSION} CONFIG REQUIRED COMPONENTS Widgets) +find_package(KF5 ${KF5_MIN_VERSION} REQUIRED COMPONENTS Runner I18n) include(KDEInstallDirs) include(KDECMakeSettings) include(KDECompilerSettings NO_POLICY_SCOPE) -include(ECMPackageConfigHelpers) -include(ECMMarkNonGuiExecutable) -include(CMakePackageConfigHelpers) -include(WriteBasicConfigVersionFile) -include(CheckIncludeFiles) include(FeatureSummary) -include(ECMOptionalAddSubdirectory) - -set(%{APPNAMELC}_SRCS %{APPNAMELC}.cpp) - -add_library(krunner_%{APPNAMELC} MODULE ${%{APPNAMELC}_SRCS}) -target_link_libraries(krunner_%{APPNAMELC} KF5::Runner) -install(TARGETS krunner_%{APPNAMELC} DESTINATION ${KDE_INSTALL_PLUGINDIR}) +add_subdirectory(src) -install(FILES %{APPNAMELC}.desktop DESTINATION ${KDE_INSTALL_KSERVICES5DIR}) +feature_summary(WHAT ALL INCLUDE_QUIET_PACKAGES FATAL_ON_MISSING_REQUIRED_PACKAGES) diff --git a/templates/runner/Messages.sh b/templates/runner/Messages.sh new file mode 100755 --- /dev/null +++ b/templates/runner/Messages.sh @@ -0,0 +1,2 @@ +#! /usr/bin/env bash +$XGETTEXT src/*.cpp -o $podir/plasma_runner_org.kde.%{APPNAMELC}.pot diff --git a/templates/runner/src/%{APPNAMELC}.h b/templates/runner/src/%{APPNAMELC}.h new file mode 100644 --- /dev/null +++ b/templates/runner/src/%{APPNAMELC}.h @@ -0,0 +1,36 @@ +/* + Copyright %{CURRENT_YEAR} by %{AUTHOR} <%{EMAIL}> + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library. If not, see . +*/ + +#ifndef %{APPNAMEUC}_H +#define %{APPNAMEUC}_H + +#include + +class %{APPNAME} : public Plasma::AbstractRunner +{ + Q_OBJECT + +public: + %{APPNAME}(QObject *parent, const QVariantList &args); + ~%{APPNAME}() override; + +public: // Plasma::AbstractRunner API + void match(Plasma::RunnerContext &context) override; + void run(const Plasma::RunnerContext &context, const Plasma::QueryMatch &match) override; +}; + +#endif diff --git a/templates/runner/src/%{APPNAMELC}.cpp b/templates/runner/src/%{APPNAMELC}.cpp new file mode 100644 --- /dev/null +++ b/templates/runner/src/%{APPNAMELC}.cpp @@ -0,0 +1,55 @@ +/* + Copyright %{CURRENT_YEAR} by %{AUTHOR} <%{EMAIL}> + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library. If not, see . +*/ + +#include "%{APPNAMELC}.h" + +// KF +#include + +%{APPNAME}::%{APPNAME}(QObject *parent, const QVariantList &args) + : Plasma::AbstractRunner(parent, args) +{ + setObjectName("%{APPNAME}"); +} + +%{APPNAME}::~%{APPNAME}() +{ +} + + +void %{APPNAME}::match(Plasma::RunnerContext &context) +{ + const QString term = context.query(); + if (term.length() < 3) { + return; + } + + // TODO +} + +void %{APPNAME}::run(const Plasma::RunnerContext &context, const Plasma::QueryMatch &match) +{ + Q_UNUSED(context) + Q_UNUSED(match) + + // TODO +} + +K_EXPORT_PLASMA_RUNNER(%{APPNAMELC}, %{APPNAME}) + +// needed for the QObject subclass declared as part of K_EXPORT_PLASMA_RUNNER +#include "%{APPNAMELC}.moc" diff --git a/templates/runner/src/CMakeLists.txt b/templates/runner/src/CMakeLists.txt new file mode 100644 --- /dev/null +++ b/templates/runner/src/CMakeLists.txt @@ -0,0 +1,10 @@ +add_definitions(-DTRANSLATION_DOMAIN=\"plasma_runner_org.kde.%{APPNAMELC}\") + +set(%{APPNAMELC}_SRCS %{APPNAMELC}.cpp) + +add_library(krunner_%{APPNAMELC} MODULE ${%{APPNAMELC}_SRCS}) +target_link_libraries(krunner_%{APPNAMELC} KF5::Runner KF5::I18n) + +install(TARGETS krunner_%{APPNAMELC} DESTINATION ${KDE_INSTALL_PLUGINDIR}) + +install(FILES plasma-runner-%{APPNAMELC}.desktop DESTINATION ${KDE_INSTALL_KSERVICES5DIR}) diff --git a/templates/runner/%{APPNAMELC}.desktop b/templates/runner/src/plasma-runner-%{APPNAMELC}.desktop rename from templates/runner/%{APPNAMELC}.desktop rename to templates/runner/src/plasma-runner-%{APPNAMELC}.desktop --- a/templates/runner/%{APPNAMELC}.desktop +++ b/templates/runner/src/plasma-runner-%{APPNAMELC}.desktop @@ -10,5 +10,5 @@ X-KDE-PluginInfo-Email=%{EMAIL} X-KDE-PluginInfo-Name=%{APPNAMELC} X-KDE-PluginInfo-Version=0.1 -X-KDE-PluginInfo-License=GPL +X-KDE-PluginInfo-License=LGPL 2.1+ X-KDE-PluginInfo-EnabledByDefault=true