Commit 9508f6b0 authored by Friedrich W. H. Kossebau's avatar Friedrich W. H. Kossebau
Browse files

Port to new KPluginMetaData-based KParts API

parent 2a3f7758
......@@ -79,6 +79,8 @@ install(TARGETS kimagemapeditor_bin ${INSTALL_TARGETS_DEFAULT_ARGS} )
########### next target ###############
configure_file(kimagemapeditorpart.desktop.in ${CMAKE_CURRENT_BINARY_DIR}/kimagemapeditorpart.desktop)
set(kimagemapeditor_PART_SRCS
areacreator.cpp
kimearea.cpp
......@@ -95,7 +97,7 @@ set(kimagemapeditor_PART_SRCS
qt5_add_resources(kimagemapeditor_PART_SRCS kimagemapeditorpart.qrc)
add_library(kimagemapeditorpart MODULE ${kimagemapeditor_PART_SRCS})
kcoreaddons_desktop_to_json(kimagemapeditorpart kimagemapeditorpart.desktop)
kcoreaddons_desktop_to_json(kimagemapeditorpart ${CMAKE_CURRENT_BINARY_DIR}/kimagemapeditorpart.desktop)
target_link_libraries(kimagemapeditorpart
KF5::CoreAddons
......@@ -115,7 +117,7 @@ install(TARGETS kimagemapeditorpart DESTINATION ${KDE_INSTALL_PLUGINDIR}/kf5/par
install( FILES org.kde.kimagemapeditor.desktop DESTINATION ${KDE_INSTALL_APPDIR})
install( FILES org.kde.kimagemapeditor.appdata.xml DESTINATION ${KDE_INSTALL_METAINFODIR})
install( FILES kimagemapeditorpart.desktop DESTINATION ${KDE_INSTALL_KSERVICES5DIR})
install( FILES ${CMAKE_CURRENT_BINARY_DIR}/kimagemapeditorpart.desktop DESTINATION ${KDE_INSTALL_KSERVICES5DIR})
if (NOT ECM_VERSION VERSION_LESS "5.59.0")
install( FILES kimagemapeditor.categories DESTINATION ${KDE_INSTALL_LOGGINGCATEGORIESDIR} )
......
......@@ -52,7 +52,11 @@
// KDE Frameworks
#include "kimagemapeditor_debug.h"
#if KPARTS_VERSION >= QT_VERSION_CHECK(5, 77, 0)
#include <KPluginMetaData>
#else
#include <KAboutData>
#endif
#include <KActionCollection>
#include <KConfigGroup>
#include <KIO/Job>
......@@ -78,15 +82,22 @@
K_PLUGIN_FACTORY_WITH_JSON(KImageMapEditorFactory, "kimagemapeditorpart.json", registerPlugin<KImageMapEditor>();)
KImageMapEditor::KImageMapEditor(QWidget *parentWidget,
QObject *parent, const QVariantList & )
KImageMapEditor::KImageMapEditor(QWidget *parentWidget, QObject *parent,
#if KPARTS_VERSION >= QT_VERSION_CHECK(5, 77, 0)
const KPluginMetaData &metaData,
#endif
const QVariantList & )
: KParts::ReadWritePart(parent)
{
#if KPARTS_VERSION >= QT_VERSION_CHECK(5, 77, 0)
setMetaData(metaData);
#else
KAboutData aboutData( "kimagemapeditor", i18n("KImageMapEditor"),
KIMAGEMAPEDITOR_VERSION_STRING, i18n( "An HTML imagemap editor" ),
KAboutLicense::GPL,
i18n("(c) 2001-2003 Jan Sch&auml;fer <email>janschaefer@users.sourceforge.net</email>"));
i18n("Copyright 2001-2003 Jan Schäfer <janschaefer@users.sourceforge.net>"));
setComponentData(aboutData, false);
#endif
// KDockMainWindow* mainWidget;
......@@ -221,6 +232,16 @@ KImageMapEditor::~KImageMapEditor() {
}
QString KImageMapEditor::componentName() const
{
// the part ui.rc file is in the program folder, not a separate one
// TODO: change the component name to "kimagemapeditorpart" by removing this method and
// adapting the folder where the file is placed.
// Needs a way to also move any potential custom user ui.rc files
// from kimagemapeditor/ to kimagemapeditorpart/
return QStringLiteral("kimagemapeditor");
}
MapTag::MapTag() {
modified = false;
name.clear();
......
......@@ -27,6 +27,7 @@
#include <QTextStream>
#include <QUrl>
#include <kparts_version.h>
#include <KConfig>
#include <KParts/ReadWritePart>
......@@ -137,10 +138,18 @@ public :
AddPoint,
RemovePoint };
KImageMapEditor(QWidget *parentWidget,
QObject *parent, const QVariantList &args = QVariantList());
KImageMapEditor(QWidget *parentWidget, QObject *parent,
#if KPARTS_VERSION >= QT_VERSION_CHECK(5, 77, 0)
const KPluginMetaData &metaData,
#endif
const QVariantList &args = QVariantList());
~KImageMapEditor() override;
/**
* Return custom componentName for KXMLGUIClient, as for historical reasons the plugin id is not used
*/
QString componentName() const override;
static KConfig *config();
/**
......
......@@ -109,3 +109,10 @@ Name[x-test]=xxKImageMapEditorxx
Name[zh_CN]=KImageMapEditor
Name[zh_HK]=KImageMapEditor
Name[zh_TW]=KImageMapEditor
X-KDE-PluginInfo-Name=kimagemapeditorpart
X-KDE-PluginInfo-Version=@kimagemapeditor_VERSION@
X-KDE-PluginInfo-License=GPLv2+
X-KDE-PluginInfo-Copyright=Copyright 2001-2003 Jan Schäfer
X-KDE-PluginInfo-Author=Jan Schäfer
X-KDE-PluginInfo-Email=janschaefer@users.sourceforge.net
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment