Compare commits

...

1 Commits

Author SHA1 Message Date
Carl Schwan
9a27a1e70f Start purpose integration 2021-10-24 16:45:43 +02:00
3 changed files with 88 additions and 0 deletions

View File

@@ -64,6 +64,18 @@ target_include_directories(neochat PRIVATE ${CMAKE_BINARY_DIR})
target_link_libraries(neochat PRIVATE Qt::Quick Qt::Qml Qt::Gui Qt::Network Qt::QuickControls2 KF5::I18n KF5::Kirigami2 KF5::Notifications KF5::ConfigCore KF5::ConfigGui KF5::CoreAddons Quotient cmark::cmark ${QTKEYCHAIN_LIBRARIES} QCoro::QCoro)
kconfig_add_kcfg_files(neochat GENERATE_MOC neochatconfig.kcfgc)
if(TARGET KF5::Purpose)
function(add_share_plugin name)
kcoreaddons_add_plugin(${name} SOURCES ${ARGN} INSTALL_NAMESPACE "kf5/purpose")
target_link_libraries(${name} Qt5::Core KF5::Purpose)
set_target_properties(${name} PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin/kf5/purpose")
endfunction()
add_share_plugin(neochatpurposeplugin neochatpurposeplugin.cpp)
target_link_libraries(neochatpurposeplugin KF5::I18n KF5::Service)
endif()
if(NEOCHAT_FLATPAK)
target_compile_definitions(neochat PRIVATE NEOCHAT_FLATPAK)
endif()

View File

@@ -0,0 +1,54 @@
// SPDX-FileCopyrightText: 2021 Carl Schwan <carl@carlschwan.eu>
// SPDX-License-Identifier: LGPL-2.1-or-later
#include <purpose/pluginbase.h>
#include <KApplicationTrader>
#include <KLocalizedString>
#include <KPluginFactory>
#include <QDesktopServices>
#include <QJsonArray>
#include <QProcess>
#include <QStandardPaths>
#include <QUrl>
#include <QUrlQuery>
EXPORT_SHARE_VERSION
namespace
{
class NeoChatShareJob : public Purpose::Job
{
Q_OBJECT
public:
explicit NeoChatShareJob(QObject *parent = nullptr)
: Purpose::Job(parent)
{
}
void start() override
{
}
};
}
class Q_DECL_EXPORT NeoChatPurposePlugin : public Purpose::PluginBase
{
Q_OBJECT
public:
NeoChatPurposePlugin(QObject *parent, const QVariantList &)
: Purpose::PluginBase(parent)
{
}
Purpose::Job *createJob() const override
{
return new NeoChatShareJob(nullptr);
}
};
K_PLUGIN_CLASS_WITH_JSON(NeoChatPurposePlugin, "neochatpurposeplugin.json")
#include "neochatpurposeplugin.moc"

View File

@@ -0,0 +1,22 @@
{
"KPlugin": {
"Authors": [
{
"Name": "Carl Schwan"
}
],
"Category": "Utilities",
"Description": "Send vith NeoChat",
"Icon": "mail-message",
"License": "GPL",
"Name": "Send with NeoChat",
"X-Purpose-ActionDisplay": "Send with NeoChat..."
},
"X-Purpose-Configuration": [],
"X-Purpose-Constraints": [],
"X-Purpose-PluginTypes": [
"Export",
"ShareUrl"
]
}