Plugin refactoring
- refactor the
ImporterPlugin::formatFilenameFilter()intoImporterPlugin::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 acomponentDisplayName()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'sIdin args - refactor
KMyMoneyPlugin::Plugin::Plugin()to use theIdof a plugin passed asQVariantin args. As perKCoreAddons'DesktopFileParserclass implementation, theX-KDE-PluginInfo-Namevalue corresponds to theIdfield from the plugin's json file, so we can do that. -
MyMoneyPlugin::Plugin::Plugin()runsetComponentName()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
- remove
- If KF5 available is >= 5.77, use the
KPluginMetaDataobject to obtain plugin'snameandId, instead of passing them asQVariantexplicitly in args. - Use a shorter
K_PLUGIN_CLASS_WITH_JSONmacro instead of theK_PLUGIN_FACTORY_WITH_JSON
Edited by Dawid Wrobel