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'sId
in args - refactor
KMyMoneyPlugin::Plugin::Plugin()
to use theId
of a plugin passed asQVariant
in args. As perKCoreAddons
'DesktopFileParser
class implementation, theX-KDE-PluginInfo-Name
value corresponds to theId
field 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
KPluginMetaData
object to obtain plugin'sname
andId
, instead of passing them asQVariant
explicitly in args. - Use a shorter
K_PLUGIN_CLASS_WITH_JSON
macro instead of theK_PLUGIN_FACTORY_WITH_JSON
Edited by Dawid Wrobel