Skip to content

Plugin refactoring

Dawid Wrobel requested to merge work/importers_use_mimetypes into master
  • refactor the ImporterPlugin::formatFilenameFilter() into ImporterPlugin::formatMimeTypes(), which now takes a list of MIME types supported by a plugin
  • provide a default implementation of ImporterPlugin::isMyFormat() that checks whether the MIME type of an imported file inherits any of the types supported by a plugin
  • ImporterPlugin::formatName() was misused as a name of the plugin, so refactor the code properly and add a componentDisplayName() property to base Plugin class instead
  • resort to the default implementation of ImporterPlugin::isMyFormat() in CSV importer plugin
  • in KMyMoneyPlugin::pluginHandling(), when creating a Plugin in factory, also pass the plugin's Id in args
  • refactor KMyMoneyPlugin::Plugin::Plugin() to use the Id of a plugin passed as QVariant in args. As per KCoreAddons' DesktopFileParser class implementation, the X-KDE-PluginInfo-Name value corresponds to the Id field from the plugin's json file, so we can do that.
  • MyMoneyPlugin::Plugin::Plugin() run setComponentName() and use the i18n-ed name passed in args (which is sourced from the plugin's .json file)
  • Classes inheriting KMyMoneyPlugin::Plugin:
    • remove setComponentName() usage
    • remove Q_UNUSED(args), since we now pass args to Plugin base class
  • If KF5 available is >= 5.77, use the KPluginMetaData object to obtain plugin's name and Id, instead of passing them as QVariant explicitly in args.
  • Use a shorter K_PLUGIN_CLASS_WITH_JSON macro instead of the K_PLUGIN_FACTORY_WITH_JSON
Edited by Dawid Wrobel

Merge request reports