Hello community, here is the log from the commit of package kparts for openSUSE:Factory checked in at 2020-12-15 12:29:16 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/kparts (Old) and /work/SRC/openSUSE:Factory/.kparts.new.2328 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "kparts" Tue Dec 15 12:29:16 2020 rev:84 rq:855452 version:5.77.0 Changes: -------- --- /work/SRC/openSUSE:Factory/kparts/kparts.changes 2020-11-23 10:32:53.813519554 +0100 +++ /work/SRC/openSUSE:Factory/.kparts.new.2328/kparts.changes 2020-12-15 12:31:33.236056846 +0100 @@ -1,0 +2,11 @@ +Sat Dec 5 18:56:51 UTC 2020 - Christophe Giboudeaux <[email protected]> + +- Update to 5.77.0 + * New feature release + * For more details please see: + * https://kde.org/announcements/kde-frameworks-5.77.0 +- Changes since 5.76.0: + * Deprecate embed() method, for lack of usage + * Make KParts use KPluginMetaData instead of KAboutData + +------------------------------------------------------------------- Old: ---- kparts-5.76.0.tar.xz kparts-5.76.0.tar.xz.sig New: ---- kparts-5.77.0.tar.xz kparts-5.77.0.tar.xz.sig ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ kparts.spec ++++++ --- /var/tmp/diff_new_pack.PGmoTT/_old 2020-12-15 12:31:34.012057471 +0100 +++ /var/tmp/diff_new_pack.PGmoTT/_new 2020-12-15 12:31:34.016057475 +0100 @@ -17,14 +17,14 @@ %define lname libKF5Parts5 -%define _tar_path 5.76 +%define _tar_path 5.77 # Full KF5 version (e.g. 5.33.0) %{!?_kf5_version: %global _kf5_version %{version}} # Last major and minor KF5 version (e.g. 5.33) %{!?_kf5_bugfix_version: %define _kf5_bugfix_version %(echo %{_kf5_version} | awk -F. '{print $1"."$2}')} %bcond_without lang Name: kparts -Version: 5.76.0 +Version: 5.77.0 Release: 0 Summary: Plugin framework for user interface components License: LGPL-2.1-or-later @@ -54,11 +54,11 @@ BuildRequires: cmake(KF5WidgetsAddons) >= %{_kf5_bugfix_version} BuildRequires: cmake(KF5WindowSystem) >= %{_kf5_bugfix_version} BuildRequires: cmake(KF5XmlGui) >= %{_kf5_bugfix_version} -BuildRequires: cmake(Qt5Core) >= 5.12.0 -BuildRequires: cmake(Qt5Network) >= 5.12.0 -BuildRequires: cmake(Qt5Test) >= 5.12.0 -BuildRequires: cmake(Qt5Widgets) >= 5.12.0 -BuildRequires: cmake(Qt5Xml) >= 5.12.0 +BuildRequires: cmake(Qt5Core) >= 5.13.0 +BuildRequires: cmake(Qt5Network) >= 5.13.0 +BuildRequires: cmake(Qt5Test) >= 5.13.0 +BuildRequires: cmake(Qt5Widgets) >= 5.13.0 +BuildRequires: cmake(Qt5Xml) >= 5.13.0 %description This library implements the framework for KDE parts, which are ++++++ kparts-5.76.0.tar.xz -> kparts-5.77.0.tar.xz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kparts-5.76.0/CMakeLists.txt new/kparts-5.77.0/CMakeLists.txt --- old/kparts-5.76.0/CMakeLists.txt 2020-11-07 13:14:21.000000000 +0100 +++ new/kparts-5.77.0/CMakeLists.txt 2020-12-05 13:53:09.000000000 +0100 @@ -1,11 +1,11 @@ cmake_minimum_required(VERSION 3.5) -set(KF5_VERSION "5.76.0") # handled by release scripts -set(KF5_DEP_VERSION "5.76.0") # handled by release scripts +set(KF5_VERSION "5.77.0") # handled by release scripts +set(KF5_DEP_VERSION "5.77.0") # handled by release scripts project(KParts VERSION ${KF5_VERSION}) include(FeatureSummary) -find_package(ECM 5.76.0 NO_MODULE) +find_package(ECM 5.77.0 NO_MODULE) set_package_properties(ECM PROPERTIES TYPE REQUIRED DESCRIPTION "Extra CMake Modules." URL "https://commits.kde.org/extra-cmake-modules") feature_summary(WHAT REQUIRED_PACKAGES_NOT_FOUND FATAL_ON_MISSING_REQUIRED_PACKAGES) @@ -32,7 +32,7 @@ PACKAGE_VERSION_FILE "${CMAKE_CURRENT_BINARY_DIR}/KF5PartsConfigVersion.cmake" SOVERSION 5) -set(REQUIRED_QT_VERSION 5.12.0) +set(REQUIRED_QT_VERSION 5.13.0) find_package(Qt5 ${REQUIRED_QT_VERSION} CONFIG REQUIRED Core Widgets Xml) find_package(KF5Config ${KF5_DEP_VERSION} REQUIRED) @@ -58,6 +58,7 @@ add_definitions(-DQT_DISABLE_DEPRECATED_BEFORE=0x050d00) add_definitions(-DKF_DISABLE_DEPRECATED_BEFORE_AND_AT=0x054B00) add_definitions(-DKIOWIDGETS_DISABLE_DEPRECATED_BEFORE_AND_AT=0x054600) # We need KRun for BrowserRun +add_definitions(-DKCOREADDONS_DISABLE_DEPRECATED_BEFORE_AND_AT=0x054000) # We need KAboutData::fromPluginMetaData add_definitions(-DQT_NO_FOREACH) add_subdirectory( src ) add_subdirectory(templates) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kparts-5.76.0/autotests/notepad.cpp new/kparts-5.77.0/autotests/notepad.cpp --- old/kparts-5.76.0/autotests/notepad.cpp 2020-11-07 13:14:21.000000000 +0100 +++ new/kparts-5.77.0/autotests/notepad.cpp 2020-12-05 13:53:09.000000000 +0100 @@ -26,11 +26,11 @@ NotepadPart::NotepadPart(QWidget *parentWidget, QObject *parent, + const KPluginMetaData &metaData, const QVariantList &) : KParts::ReadWritePart(parent) { - KAboutData aboutData(QStringLiteral("notepadpart"), QStringLiteral("Notepad Part"), QStringLiteral("0.1")); - setComponentData(aboutData, false); + setMetaData(metaData); m_edit = new QTextEdit(parentWidget); m_edit->setPlainText(QStringLiteral("NotepadPart's multiline edit")); @@ -64,11 +64,6 @@ ReadWritePart::setReadWrite(rw); } -KAboutData *NotepadPart::createAboutData() -{ - return new KAboutData(QStringLiteral("notepadpart"), i18n("Notepad"), QStringLiteral("2.0")); -} - bool NotepadPart::openFile() { // qDebug() << "NotepadPart: opening " << localFilePath(); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kparts-5.76.0/autotests/notepad.h new/kparts-5.77.0/autotests/notepad.h --- old/kparts-5.76.0/autotests/notepad.h 2020-11-07 13:14:21.000000000 +0100 +++ new/kparts-5.77.0/autotests/notepad.h 2020-12-05 13:53:09.000000000 +0100 @@ -11,7 +11,7 @@ #include <kparts/readwritepart.h> #include <KPluginFactory> -class KAboutData; +class KPluginMetaData; class QTextEdit; /** @@ -25,13 +25,12 @@ public: NotepadPart(QWidget *parentWidget, QObject *parent, + const KPluginMetaData &metaData, const QVariantList &args = QVariantList()); virtual ~NotepadPart(); void setReadWrite(bool rw) override; - static KAboutData *createAboutData(); - protected: bool openFile() override; bool saveFile() override; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kparts-5.76.0/po/ml/kparts5.po new/kparts-5.77.0/po/ml/kparts5.po --- old/kparts-5.76.0/po/ml/kparts5.po 2020-11-07 13:14:21.000000000 +0100 +++ new/kparts-5.77.0/po/ml/kparts5.po 2020-12-05 13:53:09.000000000 +0100 @@ -20,8 +20,6 @@ "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" -"X-Generator: Weblate 3.9.1\n" -"X-Poedit-Country: INDIA\n" #, kde-format msgctxt "NAME OF TRANSLATORS" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kparts-5.76.0/po/zh_CN/kparts5.po new/kparts-5.77.0/po/zh_CN/kparts5.po --- old/kparts-5.76.0/po/zh_CN/kparts5.po 2020-11-07 13:14:21.000000000 +0100 +++ new/kparts-5.77.0/po/zh_CN/kparts5.po 2020-12-05 13:53:09.000000000 +0100 @@ -15,7 +15,7 @@ "Project-Id-Version: kdeorg\n" "Report-Msgid-Bugs-To: https://bugs.kde.org\n" "POT-Creation-Date: 2020-09-15 02:11+0200\n" -"PO-Revision-Date: 2020-10-08 19:21\n" +"PO-Revision-Date: 2020-11-10 15:01\n" "Last-Translator: \n" "Language-Team: Chinese Simplified\n" "Language: zh_CN\n" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kparts-5.76.0/src/CMakeLists.txt new/kparts-5.77.0/src/CMakeLists.txt --- old/kparts-5.76.0/src/CMakeLists.txt 2020-11-07 13:14:21.000000000 +0100 +++ new/kparts-5.77.0/src/CMakeLists.txt 2020-12-05 13:53:09.000000000 +0100 @@ -1,6 +1,7 @@ set(KParts_LIB_SRCS partbase.cpp part.cpp + partmetadatautil_p.cpp partloader.cpp openurlarguments.cpp readonlypart.cpp @@ -91,7 +92,7 @@ GROUP_BASE_NAME KF VERSION ${KF5_VERSION} DEPRECATED_BASE_VERSION 0 - DEPRECATION_VERSIONS 3.0 4.4 5.0 5.72 + DEPRECATION_VERSIONS 3.0 4.4 5.0 5.72 5.77 EXCLUDE_DEPRECATED_BEFORE_AND_AT ${EXCLUDE_DEPRECATED_BEFORE_AND_AT} ) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kparts-5.76.0/src/mainwindow.cpp new/kparts-5.77.0/src/mainwindow.cpp --- old/kparts-5.76.0/src/mainwindow.cpp 2020-11-07 13:14:21.000000000 +0100 +++ new/kparts-5.77.0/src/mainwindow.cpp 2020-12-05 13:53:09.000000000 +0100 @@ -88,7 +88,7 @@ } if (!d->m_bShellGUIActivated) { - loadPlugins(this, this, KAboutData::applicationData()); + loadPlugins(this, this, KAboutData::applicationData().componentName()); createShellGUI(); d->m_bShellGUIActivated = true; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kparts-5.76.0/src/part.cpp new/kparts-5.77.0/src/part.cpp --- old/kparts-5.76.0/src/part.cpp 2020-11-07 13:14:21.000000000 +0100 +++ new/kparts-5.77.0/src/part.cpp 2020-12-05 13:53:09.000000000 +0100 @@ -61,6 +61,7 @@ delete d->m_iconLoader; } +#if KPARTS_BUILD_DEPRECATED_SINCE(5, 77) void Part::embed(QWidget *parentWidget) { if (widget()) { @@ -69,6 +70,7 @@ widget()->show(); } } +#endif QWidget *Part::widget() { @@ -99,6 +101,13 @@ return d->m_iconLoader; } +KPluginMetaData Part::metaData() const +{ + Q_D(const Part); + + return d->m_metaData; +} + void Part::setManager(PartManager *manager) { Q_D(Part); @@ -206,7 +215,31 @@ void Part::loadPlugins() { - PartBase::loadPlugins(this, this, componentData()); + Q_D(Part); + + PartBase::loadPlugins(this, this, d->m_metaData.pluginId()); +} + +void Part::setMetaData(const KPluginMetaData& metaData) +{ + Q_D(Part); + + d->m_metaData = metaData; +#if KPARTS_BUILD_DEPRECATED_SINCE(5, 77) +QT_WARNING_PUSH +QT_WARNING_DISABLE_CLANG("-Wdeprecated-declarations") +QT_WARNING_DISABLE_GCC("-Wdeprecated-declarations") + d->PartBasePrivate::setComponentData(KAboutData::fromPluginMetaData(metaData)); + + // backward-compatible registration, usage deprecated +#if KCOREADDONS_BUILD_DEPRECATED_SINCE(5, 76) + KAboutData::registerPluginData(d->componentData()); +#endif +QT_WARNING_POP +#endif + + KXMLGUIClient::setComponentName(metaData.pluginId(), metaData.name()); } + #include "moc_part.cpp" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kparts-5.76.0/src/part.h new/kparts-5.77.0/src/part.h --- old/kparts-5.76.0/src/part.h 2020-11-07 13:14:21.000000000 +0100 +++ new/kparts-5.77.0/src/part.h 2020-12-05 13:53:09.000000000 +0100 @@ -11,6 +11,7 @@ #include <kparts/partbase.h> +class KPluginMetaData; class KIconLoader; class QWidget; class QEvent; @@ -80,6 +81,7 @@ */ ~Part() override; +#if KPARTS_BUILD_DEPRECATED_SINCE(5, 77) /** * Embed this part into a host widget. * @@ -90,8 +92,12 @@ * then the widget gets destroyed as well, and vice-versa. * This method is not recommended since creating the widget with the correct * parent is simpler anyway. + * + * @deprecated Since 5.77, for lack of usage. */ + KPARTS_DEPRECATED_VERSION(5, 77, "Deprecated for lack of usage") virtual void embed(QWidget *parentWidget); +#endif /** * @return The widget defined by this part, set by setWidget(). @@ -160,11 +166,16 @@ #endif /** + * @since 5.77 + */ + KPluginMetaData metaData() const; + + /** * Use this icon loader to load any icons that are specific to this part, * i.e. icons installed into this part's own directories as opposed to standard * kde icons. * - * Make sure to call setComponentData before calling iconLoader. + * Make sure to call setMetaData (or deprevated setComponentData) before calling iconLoader. */ KIconLoader *iconLoader(); @@ -231,13 +242,22 @@ /** * Load this part's plugins now. - * Normally you want to call this at the end of the part constructor, - * if you used setComponentData(componentData, false) + * Call this at the end of the part constructor, unless you are still using the + * deprecated setComponentData(componentData, true)). * @since 4.1 */ void loadPlugins(); using PartBase::loadPlugins; + /** + * Set the meta data for this part. + * + * Call this at the begin of the part constructor. + * + * @since 5.77 + */ + void setMetaData(const KPluginMetaData &metatData); + protected Q_SLOTS: /** * @internal diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kparts-5.76.0/src/part_p.h new/kparts-5.77.0/src/part_p.h --- old/kparts-5.76.0/src/part_p.h 2020-11-07 13:14:21.000000000 +0100 +++ new/kparts-5.77.0/src/part_p.h 2020-12-05 13:53:09.000000000 +0100 @@ -11,7 +11,12 @@ #include "partbase_p.h" #include "part.h" - +#if KPARTS_BUILD_DEPRECATED_SINCE(5, 77) +#include "partmetadatautil_p.h" +#endif +// KF +#include <KPluginMetaData> +// Qt #include <QWidget> #include <QPointer> @@ -40,6 +45,15 @@ { } +#if KPARTS_BUILD_DEPRECATED_SINCE(5, 77) + void setComponentData(const KAboutData &componentData) override + { + m_metaData = PartMetaDataUtil::fromKAboutData(componentData); + PartBasePrivate::setComponentData(componentData); + } +#endif + + KPluginMetaData m_metaData; KIconLoader *m_iconLoader; #if KPARTS_BUILD_DEPRECATED_SINCE(5, 72) bool m_bSelectable; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kparts-5.76.0/src/partbase.cpp new/kparts-5.77.0/src/partbase.cpp --- old/kparts-5.76.0/src/partbase.cpp 2020-11-07 13:14:21.000000000 +0100 +++ new/kparts-5.77.0/src/partbase.cpp 2020-12-05 13:53:09.000000000 +0100 @@ -43,22 +43,28 @@ return d->m_obj; } +#if KPARTS_BUILD_DEPRECATED_SINCE(5, 77) KAboutData PartBase::componentData() const { Q_D(const PartBase); - return d->m_componentData; + + return d->componentData(); } +#endif +#if KPARTS_BUILD_DEPRECATED_SINCE(5, 77) void PartBase::setComponentData(const KAboutData &componentData) { setComponentData(componentData, true); } +#endif +#if KPARTS_BUILD_DEPRECATED_SINCE(5, 77) void PartBase::setComponentData(const KAboutData &pluginData, bool bLoadPlugins) { Q_D(PartBase); - d->m_componentData = pluginData; + d->setComponentData(pluginData); // backward-compatible registration, usage deprecated #if KCOREADDONS_BUILD_DEPRECATED_SINCE(5, 76) @@ -71,16 +77,24 @@ KXMLGUIClient::setComponentName(pluginData.componentName(), pluginData.displayName()); if (bLoadPlugins) { - loadPlugins(d->m_obj, this, pluginData); + loadPlugins(d->m_obj, this, pluginData.componentName()); } } +#endif +#if KPARTS_BUILD_DEPRECATED_SINCE(5, 77) void PartBase::loadPlugins(QObject *parent, KXMLGUIClient *parentGUIClient, const KAboutData &instance) { + loadPlugins(parent, parentGUIClient, instance.componentName()); +} +#endif + +void PartBase::loadPlugins(QObject *parent, KXMLGUIClient *parentGuiClient, const QString &parentInstanceName) +{ Q_D(PartBase); if (d->m_pluginLoadingMode != DoNotLoadPlugins) { - Plugin::loadPlugins(parent, parentGUIClient, instance.componentName(), d->m_pluginLoadingMode == LoadPlugins, d->m_pluginInterfaceVersion); + Plugin::loadPlugins(parent, parentGuiClient, parentInstanceName, d->m_pluginLoadingMode == LoadPlugins, d->m_pluginInterfaceVersion); } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kparts-5.76.0/src/partbase.h new/kparts-5.77.0/src/partbase.h --- old/kparts-5.76.0/src/partbase.h 2020-11-07 13:14:21.000000000 +0100 +++ new/kparts-5.77.0/src/partbase.h 2020-12-05 13:53:09.000000000 +0100 @@ -21,7 +21,9 @@ inline const Class##Private* d_func() const { return reinterpret_cast<const Class##Private *>(PartBase::d_ptr); } \ friend class Class##Private; +#if KPARTS_BUILD_DEPRECATED_SINCE(5, 77) class KAboutData; +#endif namespace KParts { @@ -58,33 +60,43 @@ void setPartObject(QObject *object); QObject *partObject() const; +#if KPARTS_ENABLE_DEPRECATED_SINCE(5, 77) + /** + * @deprecated Since 5.77, use Part::metaData() or KXMLGUIClient::componentName() instead. + */ + KPARTS_DEPRECATED_VERSION(5, 77, "Use Part::metaData() or KXMLGUIClient::componentName() instead") KAboutData componentData() const; +#endif protected: +#if KPARTS_BUILD_DEPRECATED_SINCE(5, 77) /** * Set the componentData(KAboutData) for this part. * - * Call this *first* in the inherited class constructor, - * because it loads the i18n catalogs. + * Call this *first* in the inherited class constructor. + * @deprecated Since 5.77, use Part::setMetaData(const KPluginMetaData&) + * or KXMLGUIClient::setComponentName(const QString &, const QString &) instead. */ + KPARTS_DEPRECATED_VERSION(5, 77, "Use Part::setMetaData(const KPluginMetaData&) or KXMLGUIClient::setComponentName(const QString &, const QString &) instead") virtual void setComponentData(const KAboutData &componentData); +#endif +#if KPARTS_BUILD_DEPRECATED_SINCE(5, 77) /** * Set the componentData(KAboutData) for this part. * - * Call this *first* in the inherited class constructor, - * because it loads the i18n catalogs. + * Call this *first* in the inherited class constructor. * * It is recommended to call setComponentData with loadPlugins set to false, * and to load plugins at the end of your part constructor (in the case of * KParts::MainWindow, plugins are automatically loaded in createGUI anyway, * so set loadPlugins to false for KParts::MainWindow as well). + * @deprecated Since 5.77, use Part::setMetaData(const KPluginMetaData&) + * or KXMLGUIClient::setComponentName(const QString &, const QString &) instead. */ + KPARTS_DEPRECATED_VERSION(5, 77, "Use Part::setMetaData(const KPluginMetaData&) or KXMLGUIClient::setComponentName(const QString &, const QString &) instead") virtual void setComponentData(const KAboutData &pluginData, bool loadPlugins); - // TODO KDE5: merge the above two methods, using loadPlugins=true. Or better, remove loadPlugins - // altogether and change plugins to call loadPlugins() manually at the end of their ctor. - // In the case of KParts MainWindows, plugins are automatically loaded in createGUI anyway, - // so setComponentData() should really not load the plugins. +#endif /** * We have three different policies, whether to load new plugins or not. The @@ -112,6 +124,7 @@ LoadPluginsIfEnabled = 2 }; +#if KPARTS_ENABLE_DEPRECATED_SINCE(5, 77) /** * Load the Plugins honoring the PluginLoadingMode. * @@ -127,8 +140,31 @@ * } * } * \endcode + * @deprecated Since 5.77, use loadPlugins(QObject *parent, KXMLGUIClient *, const QString &) instead. */ + KPARTS_DEPRECATED_VERSION(5, 77, "Use loadPlugins(QObject *parent, KXMLGUIClient *, const QString &) instead") void loadPlugins(QObject *parent, KXMLGUIClient *parentGUIClient, const KAboutData &aboutData); +#endif + + /** + * Load the Plugins honoring the PluginLoadingMode. + * + * If you call this method in an already constructed GUI (like when the user + * has changed which plugins are enabled) you need to add the new plugins to + * the KXMLGUIFactory: + * \code + * if( factory() ) + * { + * const QList<KParts::Plugin *> plugins = KParts::Plugin::pluginObjects(this); + * for (auto *plugin : plugins) { + * factory()->addClient(plugin); + * } + * } + * \endcode + * + * @since 5.77 + */ + void loadPlugins(QObject *parent, KXMLGUIClient *parentGUIClient, const QString &parentInstanceName); /** * Set how plugins should be loaded diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kparts-5.76.0/src/partbase_p.h new/kparts-5.77.0/src/partbase_p.h --- old/kparts-5.76.0/src/partbase_p.h 2020-11-07 13:14:21.000000000 +0100 +++ new/kparts-5.77.0/src/partbase_p.h 2020-12-05 13:53:09.000000000 +0100 @@ -11,7 +11,9 @@ #include "partbase.h" +#if KPARTS_BUILD_DEPRECATED_SINCE(5, 77) #include <KAboutData> +#endif namespace KParts { @@ -24,8 +26,10 @@ PartBasePrivate(PartBase *q): q_ptr(q), m_pluginLoadingMode(PartBase::LoadPlugins), m_pluginInterfaceVersion(0), - m_obj(nullptr), - m_componentData(KAboutData::applicationData()) + m_obj(nullptr) +#if KPARTS_BUILD_DEPRECATED_SINCE(5, 77) + , m_componentData(KAboutData::applicationData()) +#endif { } @@ -33,11 +37,22 @@ { } +#if KPARTS_BUILD_DEPRECATED_SINCE(5, 77) + // allows the KPart-subclasses to catch in its overridden method + // the deprecated setting of KAboutData and update its KPluginMetaData to that + virtual void setComponentData(const KAboutData &componentData) { m_componentData = componentData; } + const KAboutData& componentData() const { return m_componentData; } +#endif + PartBase *q_ptr; PartBase::PluginLoadingMode m_pluginLoadingMode; int m_pluginInterfaceVersion; QObject *m_obj; + +#if KPARTS_BUILD_DEPRECATED_SINCE(5, 77) +private: KAboutData m_componentData; +#endif }; } // namespace diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kparts-5.76.0/src/partmetadatautil_p.cpp new/kparts-5.77.0/src/partmetadatautil_p.cpp --- old/kparts-5.76.0/src/partmetadatautil_p.cpp 1970-01-01 01:00:00.000000000 +0100 +++ new/kparts-5.77.0/src/partmetadatautil_p.cpp 2020-12-05 13:53:09.000000000 +0100 @@ -0,0 +1,72 @@ +/* + This file is part of the KDE project + SPDX-FileCopyrightText: 2020 Friedrich W. H. Kossebau <[email protected]> + + SPDX-License-Identifier: LGPL-2.0-or-later +*/ + +#include "partmetadatautil_p.h" + +// KF +#include <KAboutData> +#include <KPluginMetaData> +// Qt +#include <QJsonObject> +#include <QJsonArray> + +#if KPARTS_BUILD_DEPRECATED_SINCE(5, 77) + +namespace PartMetaDataUtil { + +static +QJsonArray jsonArrayFromKAboutPersonList(const QList<KAboutPerson>& persons) +{ + QJsonArray array; + for (const auto &person : persons) { + QJsonObject authorsObject; + authorsObject[QStringLiteral("Name")] = person.name(); + authorsObject[QStringLiteral("Email")] = person.emailAddress(); + authorsObject[QStringLiteral("Website")] = person.webAddress(); + authorsObject[QStringLiteral("Task")] = person.task(); + authorsObject[QStringLiteral("UserName")] = person.ocsUsername(); + array.append(authorsObject); + } + return array; +} + +KPluginMetaData fromKAboutData(const KAboutData &aboutData) +{ + QJsonObject kplugin; + kplugin[QStringLiteral("Id")] = aboutData.componentName(); + kplugin[QStringLiteral("Name")] = aboutData.displayName(); + kplugin[QStringLiteral("Description")] = aboutData.shortDescription(); + kplugin[QStringLiteral("Version")] = aboutData.version(); + const auto licenses = aboutData.licenses(); + if (!licenses.isEmpty()) { + kplugin[QStringLiteral("License")] = licenses.first().spdx(); + } + kplugin[QStringLiteral("Copyright")] = aboutData.copyrightStatement(); + kplugin[QStringLiteral("ExtraInformation")] = aboutData.otherText(); + kplugin[QStringLiteral("Website")] = aboutData.homepage(); +#if KCOREADDONS_BUILD_DEPRECATED_SINCE(5, 2) +QT_WARNING_PUSH +QT_WARNING_DISABLE_CLANG("-Wdeprecated-declarations") +QT_WARNING_DISABLE_GCC("-Wdeprecated-declarations") + kplugin[QStringLiteral("Icon")] = aboutData.programIconName(); +QT_WARNING_POP +#endif + + kplugin[QStringLiteral("Authors")] = jsonArrayFromKAboutPersonList(aboutData.authors()); + kplugin[QStringLiteral("Translators")] = jsonArrayFromKAboutPersonList(aboutData.translators()); + kplugin[QStringLiteral("OtherContributors")] = jsonArrayFromKAboutPersonList(aboutData.credits()); + + QJsonObject json; + json[QStringLiteral("KPlugin")] = kplugin; + + KPluginMetaData metaData(json, QString()); + return metaData; +} + +} + +#endif diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kparts-5.76.0/src/partmetadatautil_p.h new/kparts-5.77.0/src/partmetadatautil_p.h --- old/kparts-5.76.0/src/partmetadatautil_p.h 1970-01-01 01:00:00.000000000 +0100 +++ new/kparts-5.77.0/src/partmetadatautil_p.h 2020-12-05 13:53:09.000000000 +0100 @@ -0,0 +1,26 @@ +/* + This file is part of the KDE project + SPDX-FileCopyrightText: 2020 Friedrich W. H. Kossebau <[email protected]> + + SPDX-License-Identifier: LGPL-2.0-or-later +*/ + +#ifndef KPARTS_METADATAUTIL_H +#define KPARTS_METADATAUTIL_H + +#include <kparts/kparts_export.h> + +#if KPARTS_BUILD_DEPRECATED_SINCE(5, 77) + +class KPluginMetaData; +class KAboutData; + +namespace PartMetaDataUtil { + +KPluginMetaData fromKAboutData(const KAboutData &aboutData); + +} + +#endif + +#endif diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kparts-5.76.0/src/plugin.cpp new/kparts-5.77.0/src/plugin.cpp --- old/kparts-5.76.0/src/plugin.cpp 2020-11-07 13:14:21.000000000 +0100 +++ new/kparts-5.77.0/src/plugin.cpp 2020-12-05 13:53:09.000000000 +0100 @@ -17,7 +17,10 @@ #include <KDesktopFile> #include <KSharedConfig> #include <KConfigGroup> +#include <KPluginMetaData> +#if ! KPARTS_BUILD_DEPRECATED_SINCE(5, 77) || KCOREADDONS_BUILD_DEPRECATED_SINCE(5, 76) #include <KAboutData> +#endif #include <QFile> #include <QFileInfo> @@ -184,6 +187,7 @@ }); } +#if KPARTS_BUILD_DEPRECATED_SINCE(5, 77) void Plugin::setComponentData(const KAboutData &pluginData) { // backward-compatible registration, usage deprecated @@ -197,6 +201,21 @@ KXMLGUIClient::setComponentName(pluginData.componentName(), pluginData.displayName()); } +#endif + +void Plugin::setMetaData(const KPluginMetaData &metaData) +{ + // backward-compatible registration, usage deprecated +#if KCOREADDONS_BUILD_DEPRECATED_SINCE(5, 76) +QT_WARNING_PUSH +QT_WARNING_DISABLE_CLANG("-Wdeprecated-declarations") +QT_WARNING_DISABLE_GCC("-Wdeprecated-declarations") + KAboutData::registerPluginData(KAboutData::fromPluginMetaData(metaData)); +QT_WARNING_POP +#endif + + KXMLGUIClient::setComponentName(metaData.pluginId(), metaData.name()); +} void Plugin::loadPlugins(QObject *parent, KXMLGUIClient *parentGUIClient, const QString &componentName, bool enableNewPluginsByDefault, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kparts-5.76.0/src/plugin.h new/kparts-5.77.0/src/plugin.h --- old/kparts-5.76.0/src/plugin.h 2020-11-07 13:14:21.000000000 +0100 +++ new/kparts-5.77.0/src/plugin.h 2020-12-05 13:53:09.000000000 +0100 @@ -14,7 +14,10 @@ #include <QDomElement> #include <QObject> +#if KPARTS_BUILD_DEPRECATED_SINCE(5, 77) class KAboutData; +#endif +class KPluginMetaData; namespace KParts { @@ -145,7 +148,18 @@ static QList<Plugin *> pluginObjects(QObject *parent); protected: +#if KPARTS_BUILD_DEPRECATED_SINCE(5, 77) + /** + * @deprecated Since 5.77, use setMetaData(const KPluginMetaData&) instead. + */ + KPARTS_DEPRECATED_VERSION(5, 77, "Use setMetaData(const KPluginMetaData&) instead") virtual void setComponentData(const KAboutData &pluginData); +#endif + + /** + * @since 5.77 + */ + void setMetaData(const KPluginMetaData &metaData); private: /** diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kparts-5.76.0/src/readonlypart.cpp new/kparts-5.77.0/src/readonlypart.cpp --- old/kparts-5.76.0/src/readonlypart.cpp 2020-11-07 13:14:21.000000000 +0100 +++ new/kparts-5.77.0/src/readonlypart.cpp 2020-12-05 13:53:09.000000000 +0100 @@ -196,7 +196,7 @@ if (!ext.isEmpty() && !m_url.hasQuery()) { // not if the URL has a query, e.g. cgi.pl?something extension = QLatin1Char('.') + ext; // keep the '.' } - QTemporaryFile tempFile(QDir::tempPath() + QLatin1Char('/') + q->componentData().componentName() + QLatin1String("XXXXXX") + extension); + QTemporaryFile tempFile(QDir::tempPath() + QLatin1Char('/') + m_metaData.pluginId() + QLatin1String("XXXXXX") + extension); tempFile.setAutoRemove(false); tempFile.open(); m_file = tempFile.fileName(); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kparts-5.76.0/templates/kpartsapp/src/part/%{APPNAMELC}part.cpp new/kparts-5.77.0/templates/kpartsapp/src/part/%{APPNAMELC}part.cpp --- old/kparts-5.76.0/templates/kpartsapp/src/part/%{APPNAMELC}part.cpp 2020-11-07 13:14:21.000000000 +0100 +++ new/kparts-5.77.0/templates/kpartsapp/src/part/%{APPNAMELC}part.cpp 2020-12-05 13:53:09.000000000 +0100 @@ -8,7 +8,7 @@ // KF headers #include <KPluginFactory> -#include <KAboutData> +#include <KPluginMetaData> #include <KLocalizedString> #include <KActionCollection> #include <KStandardAction> @@ -20,17 +20,15 @@ #include <QTextEdit> #include <QTextDocument> -K_PLUGIN_FACTORY(%{APPNAME}PartFactory, registerPlugin<%{APPNAME}Part>();) +K_PLUGIN_CLASS_WITH_JSON(%{APPNAME}Part, "%{APPNAMELC}part.json") -%{APPNAME}Part::%{APPNAME}Part(QWidget* parentWidget, QObject* parent, const QVariantList& /*args*/) +%{APPNAME}Part::%{APPNAME}Part(QWidget* parentWidget, QObject* parent, + const KPluginMetaData &metaData, const QVariantList& /*args*/) : KParts::ReadWritePart(parent) { // set component data - // the first arg must be the same as the subdirectory into which the part's rc file is installed - KAboutData aboutData("%{APPNAMELC}part", i18n("%{APPNAME}Part"), QStringLiteral("%{VERSION}")); - aboutData.addAuthor(i18n("%{AUTHOR}"), i18n("Author"), QStringLiteral("%{EMAIL}")); - setComponentData(aboutData); + setMetaData(metaData); // set internal UI // TODO: replace with your custom UI @@ -150,5 +148,5 @@ } } -// needed for K_PLUGIN_FACTORY +// needed for K_PLUGIN_CLASS #include <%{APPNAMELC}part.moc> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kparts-5.76.0/templates/kpartsapp/src/part/%{APPNAMELC}part.desktop new/kparts-5.77.0/templates/kpartsapp/src/part/%{APPNAMELC}part.desktop --- old/kparts-5.76.0/templates/kpartsapp/src/part/%{APPNAMELC}part.desktop 2020-11-07 13:14:21.000000000 +0100 +++ new/kparts-5.77.0/templates/kpartsapp/src/part/%{APPNAMELC}part.desktop 2020-12-05 13:53:09.000000000 +0100 @@ -1,8 +1,16 @@ [Desktop Entry] Type=Service Name=%{APPNAME}Part +Comment=A %{APPNAME} KPart Icon=%{APPNAMELC} # TODO: replace with your custom supported mime types MimeType=text/plain; X-KDE-ServiceTypes=KParts/ReadOnlyPart,KParts/ReadWritePart -X-KDE-Library=%{APPNAMELC}part +X-KDE-Library=kf5/parts/%{APPNAMELC}part + +X-KDE-PluginInfo-Name=%{APPNAMELC}part +X-KDE-PluginInfo-Version=%{VERSION} +X-KDE-PluginInfo-License=GPLv2+ +X-KDE-PluginInfo-Author=%{AUTHOR} +X-KDE-PluginInfo-Email=%{EMAIL} +X-KDE-PluginInfo-Website= diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kparts-5.76.0/templates/kpartsapp/src/part/%{APPNAMELC}part.h new/kparts-5.77.0/templates/kpartsapp/src/part/%{APPNAMELC}part.h --- old/kparts-5.76.0/templates/kpartsapp/src/part/%{APPNAMELC}part.h 2020-11-07 13:14:21.000000000 +0100 +++ new/kparts-5.77.0/templates/kpartsapp/src/part/%{APPNAMELC}part.h 2020-12-05 13:53:09.000000000 +0100 @@ -26,7 +26,8 @@ /** * Default constructor, with arguments as expected by KPluginFactory */ - %{APPNAME}Part(QWidget* parentWidget, QObject* parent, const QVariantList& arg); + %{APPNAME}Part(QWidget* parentWidget, QObject* parent, + const KPluginMetaData &metaData, const QVariantList& arg); /** * Destructor diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kparts-5.76.0/templates/kpartsapp/src/part/%{APPNAMELC}part.qrc new/kparts-5.77.0/templates/kpartsapp/src/part/%{APPNAMELC}part.qrc --- old/kparts-5.76.0/templates/kpartsapp/src/part/%{APPNAMELC}part.qrc 1970-01-01 01:00:00.000000000 +0100 +++ new/kparts-5.77.0/templates/kpartsapp/src/part/%{APPNAMELC}part.qrc 2020-12-05 13:53:09.000000000 +0100 @@ -0,0 +1,7 @@ +<!DOCTYPE RCC> +<RCC version="1.0"> + <!-- prefix folder must match the metadata's pluginId, set by X-KDE-PluginInfo-Name --> + <qresource prefix="/kxmlgui5/%{APPNAMELC}part"> + <file>%{APPNAMELC}partui.rc</file> + </qresource> +</RCC> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kparts-5.76.0/templates/kpartsapp/src/part/CMakeLists.txt new/kparts-5.77.0/templates/kpartsapp/src/part/CMakeLists.txt --- old/kparts-5.76.0/templates/kpartsapp/src/part/CMakeLists.txt 2020-11-07 13:14:21.000000000 +0100 +++ new/kparts-5.77.0/templates/kpartsapp/src/part/CMakeLists.txt 2020-12-05 13:53:09.000000000 +0100 @@ -4,13 +4,17 @@ %{APPNAMELC}part.cpp ) +qt5_add_resources(%{APPNAMELC}_PART_SRCS + %{APPNAMELC}part.qrc +) + add_library(%{APPNAMELC}part MODULE ${%{APPNAMELC}_PART_SRCS}) +kcoreaddons_desktop_to_json(%{APPNAMELC}part %{APPNAMELC}part.desktop) target_link_libraries(%{APPNAMELC}part KF5::I18n KF5::Parts ) -install(TARGETS %{APPNAMELC}part DESTINATION ${KDE_INSTALL_PLUGINDIR}) +install(TARGETS %{APPNAMELC}part DESTINATION ${KDE_INSTALL_PLUGINDIR}/kf5/parts) install(FILES %{APPNAMELC}part.desktop DESTINATION ${KDE_INSTALL_KSERVICES5DIR}) -install(FILES %{APPNAMELC}partui.rc DESTINATION ${KDE_INSTALL_KXMLGUI5DIR}/%{APPNAMELC}part) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kparts-5.76.0/templates/kpartsapp/src/shell/%{APPNAMELC}.qrc new/kparts-5.77.0/templates/kpartsapp/src/shell/%{APPNAMELC}.qrc --- old/kparts-5.76.0/templates/kpartsapp/src/shell/%{APPNAMELC}.qrc 1970-01-01 01:00:00.000000000 +0100 +++ new/kparts-5.77.0/templates/kpartsapp/src/shell/%{APPNAMELC}.qrc 2020-12-05 13:53:09.000000000 +0100 @@ -0,0 +1,6 @@ +<!DOCTYPE RCC> +<RCC version="1.0"> + <qresource prefix="/kxmlgui5/%{APPNAMELC}"> + <file>%{APPNAMELC}ui.rc</file> + </qresource> +</RCC> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kparts-5.76.0/templates/kpartsapp/src/shell/%{APPNAMELC}shell.cpp new/kparts-5.77.0/templates/kpartsapp/src/shell/%{APPNAMELC}shell.cpp --- old/kparts-5.76.0/templates/kpartsapp/src/shell/%{APPNAMELC}shell.cpp 2020-11-07 13:14:21.000000000 +0100 +++ new/kparts-5.77.0/templates/kpartsapp/src/shell/%{APPNAMELC}shell.cpp 2020-12-05 13:53:09.000000000 +0100 @@ -10,6 +10,7 @@ #include <KParts/ReadWritePart> #include <KPluginLoader> #include <KPluginFactory> +#include <KPluginMetaData> #include <KActionCollection> #include <KStandardAction> #include <KLocalizedString> @@ -29,10 +30,13 @@ setupActions(); // find and load the part - // Doing it by name, which is a bad idea usually but alright here - // since this part is made for this shell - KPluginLoader loader(QStringLiteral("%{APPNAMELC}part")); - auto factory = loader.factory(); + const auto plugins = KPluginLoader::findPlugins(QStringLiteral("kf5/parts"), + [](const KPluginMetaData& metaData) { + return metaData.pluginId() == QLatin1String("%{APPNAMELC}part"); + }); + + KPluginFactory *factory = plugins.isEmpty() ? nullptr : KPluginLoader(plugins.first().fileName()).factory(); + if (!factory) { // can't do anything useful without part, thus quit the app KMessageBox::error(this, i18n("Could not find %{APPNAME} part!")); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kparts-5.76.0/templates/kpartsapp/src/shell/CMakeLists.txt new/kparts-5.77.0/templates/kpartsapp/src/shell/CMakeLists.txt --- old/kparts-5.76.0/templates/kpartsapp/src/shell/CMakeLists.txt 2020-11-07 13:14:21.000000000 +0100 +++ new/kparts-5.77.0/templates/kpartsapp/src/shell/CMakeLists.txt 2020-12-05 13:53:09.000000000 +0100 @@ -3,6 +3,10 @@ %{APPNAMELC}shell.cpp ) +qt5_add_resources(%{APPNAMELC}_SRCS + %{APPNAMELC}.qrc +) + add_executable(%{APPNAMELC} ${%{APPNAMELC}_SRCS}) target_link_libraries(%{APPNAMELC} @@ -12,4 +16,3 @@ install(TARGETS %{APPNAMELC} ${KDE_INSTALL_TARGETS_DEFAULT_ARGS}) install(PROGRAMS %{APPNAMELC}.desktop DESTINATION ${KDE_INSTALL_APPDIR}) -install(FILES %{APPNAMELC}ui.rc DESTINATION ${KDE_INSTALL_KXMLGUI5DIR}/%{APPNAMELC}) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kparts-5.76.0/tests/parts.cpp new/kparts-5.77.0/tests/parts.cpp --- old/kparts-5.76.0/tests/parts.cpp 2020-11-07 13:14:21.000000000 +0100 +++ new/kparts-5.77.0/tests/parts.cpp 2020-12-05 13:53:09.000000000 +0100 @@ -11,6 +11,7 @@ #include <KActionMenu> #include <KActionCollection> +#include <KPluginMetaData> #include <QAction> #include <QCheckBox> @@ -18,16 +19,23 @@ #include <QTextStream> #include <QTextEdit> #include <QLineEdit> +#include <QJsonDocument> #include <QTest> #include <QDebug> #include <KLocalizedString> + Part1::Part1(QObject *parent, QWidget *parentWidget) - : KParts::ReadOnlyPart(parent), - m_componentData(QStringLiteral("kpartstestpart"), i18n("KParts test part"), QStringLiteral("0.1")) + : KParts::ReadOnlyPart(parent) { - setComponentData(m_componentData, false); + QJsonObject jo = QJsonDocument::fromJson("{ \"KPlugin\": {\n" + " \"Id\": \"kpartstestpart\",\n" + " \"Name\": \"KParts test part\",\n" + " \"Version\": \"0.1\"\n" + "}\n}").object(); + setMetaData(KPluginMetaData(jo, QString())); + m_edit = new QTextEdit(parentWidget); setWidget(m_edit); @@ -89,10 +97,15 @@ } Part2::Part2(QObject *parent, QWidget *parentWidget) - : KParts::Part(parent), - m_componentData(QStringLiteral("part2"), QStringLiteral("Part 2"), QStringLiteral("0.2")) + : KParts::Part(parent) { - setComponentData(m_componentData, false); + QJsonObject jo = QJsonDocument::fromJson("{ \"KPlugin\": {\n" + " \"Id\": \"part2\",\n" + " \"Name\": \"Part 2\",\n" + " \"Version\": \"0.2\"\n" + "}\n}").object(); + setMetaData(KPluginMetaData(jo, QString())); + QWidget *w = new QWidget(parentWidget); w->setObjectName(QStringLiteral("Part2Widget")); setWidget(w); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kparts-5.76.0/tests/parts.h new/kparts-5.77.0/tests/parts.h --- old/kparts-5.76.0/tests/parts.h 2020-11-07 13:14:21.000000000 +0100 +++ new/kparts-5.77.0/tests/parts.h 2020-12-05 13:53:09.000000000 +0100 @@ -9,7 +9,6 @@ #define __parts_h__ #include <kparts/readonlypart.h> -#include <KAboutData> class QTextEdit; namespace KParts @@ -33,7 +32,6 @@ protected: QTextEdit *m_edit; - KAboutData m_componentData; }; class Part2 : public KParts::Part @@ -49,7 +47,6 @@ // (i.e. in a part manager) // There is a default impl for ReadOnlyPart... void guiActivateEvent(KParts::GUIActivateEvent *) override; - KAboutData m_componentData; }; #endif _______________________________________________ openSUSE Commits mailing list -- [email protected] To unsubscribe, email [email protected] List Netiquette: https://en.opensuse.org/openSUSE:Mailing_list_netiquette List Archives: https://lists.opensuse.org/archives/list/[email protected]
