diff --git a/fileitemactionplugin/CMakeLists.txt b/fileitemactionplugin/CMakeLists.txt index 90ac70d..b507508 100644 --- a/fileitemactionplugin/CMakeLists.txt +++ b/fileitemactionplugin/CMakeLists.txt @@ -40,6 +40,7 @@ if (KF_PACKAGE_PREFIX MATCHES ".*KF([0-9]+).*") set(KF_VERSION ${CMAKE_MATCH_1}) if (KF_VERSION GREATER_EQUAL 6) list(APPEND KIO_MODULE_TARGETS) + set(META_PLUGIN_CATEGORY kf${KF_VERSION}/kfileitemaction) else () list(APPEND KIO_MODULE_TARGETS "${KF_PACKAGE_PREFIX}::KIONTLM") endif () @@ -56,13 +57,19 @@ include(AppUtilities) # configure and install desktop file include(TemplateFinder) -find_template_file("${META_PROJECT_NAME}.desktop" "${META_PROJECT_NAME}" DESKTOP_TEMPLATE_FILE) -set(DESKTOP_TARGET_FILE "${CMAKE_CURRENT_BINARY_DIR}/${META_TARGET_NAME}.desktop") -configure_file("${DESKTOP_TEMPLATE_FILE}" "${DESKTOP_TARGET_FILE}") -install( - FILES "${DESKTOP_TARGET_FILE}" - DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/kservices${KF_MAJOR_VERSION}" - COMPONENT desktop) +if (KF_MAJOR_VERSION LESS 6) + find_template_file("${META_PROJECT_NAME}.desktop" "${META_PROJECT_NAME}" DESKTOP_TEMPLATE_FILE) + set(DESKTOP_TARGET_FILE "${CMAKE_CURRENT_BINARY_DIR}/${META_TARGET_NAME}.desktop") + configure_file("${DESKTOP_TEMPLATE_FILE}" "${DESKTOP_TARGET_FILE}") + install( + FILES "${DESKTOP_TARGET_FILE}" + DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/kservices${KF_MAJOR_VERSION}" + COMPONENT desktop) +else () + find_template_file("${META_PROJECT_NAME}.json" "${META_PROJECT_NAME}" JSON_TEMPLATE_FILE) + set(JSON_TARGET_FILE "${CMAKE_CURRENT_BINARY_DIR}/metadata.json") + configure_file("${JSON_TEMPLATE_FILE}" "${JSON_TARGET_FILE}") +endif () # install appstream file add_appstream_file() diff --git a/fileitemactionplugin/cmake/templates/syncthingfileitemaction.json.in b/fileitemactionplugin/cmake/templates/syncthingfileitemaction.json.in new file mode 100644 index 0000000..8509164 --- /dev/null +++ b/fileitemactionplugin/cmake/templates/syncthingfileitemaction.json.in @@ -0,0 +1,23 @@ +{ + "KPlugin": { + "Authors": [ + { + "Email": "@META_APP_AUTHOR_MAIL@", + "Name": "@META_APP_AUTHOR@" + } + ], + "Icon": "syncthing.fa", + "Id": "@META_ID@", + "License": "@META_PROJECT_LICENSE@", + "MimeTypes": [ + "application/octet-stream", + "inode/directory" + ], + "Name": "Trigger Syncthing scan", + "Name[de]": "\"Syncthing-Rescan\" im Servicemenü", + "ServiceTypes": ["KFileItemAction/Plugin"], + "Version": "@META_VERSION_MAJOR@.@META_VERSION_MINOR@.@META_VERSION_PATCH@" + }, + "MimeType": "application/octet-stream;inode/directory", + "X-KDE-Submenu": "Syncthing" +} diff --git a/fileitemactionplugin/syncthingfileitemaction.cpp b/fileitemactionplugin/syncthingfileitemaction.cpp index 502753e..eb75f7a 100644 --- a/fileitemactionplugin/syncthingfileitemaction.cpp +++ b/fileitemactionplugin/syncthingfileitemaction.cpp @@ -21,7 +21,11 @@ using namespace std; using namespace Data; +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) +K_PLUGIN_CLASS_WITH_JSON(SyncthingFileItemAction, "metadata.json"); +#else K_PLUGIN_FACTORY(SyncthingFileItemActionFactory, registerPlugin();) +#endif struct SyncthingItem { SyncthingItem(const SyncthingDir *dir, const QString &path);