KPropertiesDialog: filter out plugins with inappropriate mime types
As I understand, any plugin should be loaded for some file only if plugin metadata MimeTypes contains the mime type of this file. This mechanism is now broken for some reason in case of PropertiesDialog plugins.
There is a test plugin to demonstrate this: https://invent.kde.org/ptrnine/propertiesdialogplugintest It is loaded for any file in spite of "inode/directory" in the MimeTypes list of the plugin's metadata. To make sure - build and install this plugin (make sure that plugin's .so was installed in the right place), launch Dolphin from terminal, open properties for any file and see the "Hello from the test plugin!" output. The plugin prints this for any file, not only for directories.
Also there is a easier way to make sure - the network fileshare plugin (network/kdenetwork-filesharing!22 (comment 367588)).
Now it also works with files with any mime type. This plugin uses X-KDE-ServiceTypes
in the .desktop file (that is converted to JSON metadata) to specify the mime types it can handle and this also does not work. You can also reproduce this if you launch the test plugin built from this commit ptrnine/propertiesdialogplugintest@2ff7778c
This MR does not take into account mime types specified in the X-KDE-ServiceTypes
therefore it does not fix the problem in case of fileshare plugin. It only introduce (or reintroduce?) working plugin-mime-type-filtering mechanism. The serviceTypes()
member function in the KPluginMetaData
was marked as deprecated, seems like X-KDE-ServiceTypes
should not be more used for this purpose: https://api.kde.org/frameworks/kcoreaddons/html/classKPluginMetaData.html#a6f5ecd49a16d1abb1009e024d53e39da