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

Port to new KPluginMetaData-based KParts API

parent a71e6f64
......@@ -51,6 +51,8 @@ target_link_libraries(kuiviewer KF5::Parts )
install(TARGETS kuiviewer ${KDE_INSTALL_TARGETS_DEFAULT_ARGS} )
configure_file(kuiviewer_part.desktop ${CMAKE_CURRENT_BINARY_DIR}/kuiviewer_part.desktop @ONLY)
set(kuiviewerpart_PART_SRCS kuiviewer_part.cpp )
qt5_add_resources(kuiviewerpart_PART_SRCS
......@@ -64,7 +66,7 @@ ecm_qt_declare_logging_category(kuiviewerpart_PART_SRCS
)
add_library(kuiviewerpart MODULE ${kuiviewerpart_PART_SRCS})
kcoreaddons_desktop_to_json(kuiviewerpart kuiviewer_part.desktop)
kcoreaddons_desktop_to_json(kuiviewerpart ${CMAKE_CURRENT_BINARY_DIR}/kuiviewer_part.desktop)
target_link_libraries(kuiviewerpart KF5::Parts Qt5::Designer Qt5::UiTools)
......@@ -85,7 +87,11 @@ target_link_libraries(quithumbnail
install(TARGETS quithumbnail DESTINATION ${KDE_INSTALL_PLUGINDIR} )
install( PROGRAMS org.kde.kuiviewer.desktop DESTINATION ${KDE_INSTALL_APPDIR} )
install( FILES designerthumbnail.desktop kuiviewer_part.desktop DESTINATION ${KDE_INSTALL_KSERVICES5DIR} )
install(FILES
designerthumbnail.desktop
${CMAKE_CURRENT_BINARY_DIR}/kuiviewer_part.desktop
DESTINATION ${KDE_INSTALL_KSERVICES5DIR}
)
install(FILES org.kde.kuiviewer.metainfo.xml DESTINATION ${KDE_INSTALL_METAINFODIR})
ecm_install_icons(ICONS
......
......@@ -20,7 +20,11 @@
#include <KConfigGroup>
#include <KSharedConfig>
#include <KLocalizedString>
#if KPARTS_VERSION >= QT_VERSION_CHECK(5, 77, 0)
#include <KPluginMetaData>
#else
#include <KAboutData>
#endif
#include <KPluginFactory>
// Qt
......@@ -42,11 +46,17 @@ K_PLUGIN_FACTORY_WITH_JSON(KUIViewerPartFactory, "kuiviewer_part.json",
KUIViewerPart::KUIViewerPart(QWidget* parentWidget,
QObject* parent,
#if KPARTS_VERSION >= QT_VERSION_CHECK(5, 77, 0)
const KPluginMetaData& metaData,
#endif
const QVariantList& /*args*/)
: KParts::ReadOnlyPart(parent)
, m_subWindow(nullptr)
, m_view(nullptr)
{
#if KPARTS_VERSION >= QT_VERSION_CHECK(5, 77, 0)
setMetaData(metaData);
#else
// we need an instance
KAboutData about(QStringLiteral("kuiviewerpart"),
i18n("KUIViewerPart"),
......@@ -57,6 +67,7 @@ KUIViewerPart::KUIViewerPart(QWidget* parentWidget,
about.addAuthor(i18n("Ian Reinhart Geiser"), i18n("Original author"), QStringLiteral("geiseri@kde.org"));
about.addAuthor(i18n("Friedrich W. H. Kossebau"), i18n("Subwindow-like display of UI files"), QStringLiteral("kossebau@kde.org"));
setComponentData(about);
#endif
// this should be your custom internal widget
m_widget = new QMdiArea(parentWidget);
......
......@@ -55,8 +55,17 @@ Name[uk]=KUIViewerPart
Name[x-test]=xxKUIViewerPartxx
Name[zh_CN]=KUIViewerPart
Name[zh_TW]=KUIViewerPart
Comment=Displays Designer's UI files
Icon=kuiviewer
MimeType=application/x-designer;
ServiceTypes=KParts/ReadOnlyPart
X-KDE-Library=kf5/parts/kuiviewerpart
Type=Service
X-KDE-PluginInfo-Name=kuiviewerpart
X-KDE-PluginInfo-Version=@KUIVIEWER_VERSION@
X-KDE-PluginInfo-License=LGPL
X-KDE-PluginInfo-Copyright=
X-KDE-PluginInfo-Authors=Richard Moore,Ian Reinhart Geiser,Friedrich W. H. Kossebau
X-KDE-PluginInfo-Emails=rich@kde.org,geiseri@kde.org,kossebau@kde.org
X-KDE-PluginInfo-Website=
......@@ -12,6 +12,7 @@
#include "kuiviewer_part_interface.h"
// KF
#include <kparts_version.h>
#include <KParts/ReadOnlyPart>
// Qt
#include <QPointer>
......@@ -20,6 +21,7 @@
#include <QSize>
class KSelectAction;
class KPluginMetaData;
class QIODevice;
class QMdiArea;
class QMdiSubWindow;
......@@ -41,7 +43,11 @@ public:
/**
* Default constructor
*/
#if KPARTS_VERSION >= QT_VERSION_CHECK(5, 77, 0)
KUIViewerPart(QWidget* parentWidget, QObject* parent, const KPluginMetaData& metaData, const QVariantList& args);
#else
KUIViewerPart(QWidget* parentWidget, QObject* parent, const QVariantList& args);
#endif
/**
* Destructor
......
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