Deprecate service based KFileItemAction plugin loading
Open, Needs TriagePublic

Description

Instead use JSON metadata.

dfaure added a subscriber: dfaure.Nov 25 2019, 5:35 PM

Well, if everything goes according to plan, *all* servicetypes will disappear, even the servicetype concept itself :-)

That would mean that desktopfile-only services like in https://cgit.kde.org/plasma-desktop.git/tree/kcms/kfontinst/apps/installfont.desktop would no longer be possible, right? One would need to write a C++ plugin.
That would be at least a bit sad

dfaure added a comment.Dec 4 2019, 7:59 AM

Right, we are going too far. What we want to deprecate is desktop files pointing to c++ plugins.
And therefore the class that loads such plugins.

We need to keep desktop files for pop-up menu actions like this one. And therefore KServiceTypeTrader... That's what Dolphin uses, right?

It is indeed. This is making me reconsider the plan to drop KServiceTypeTrader :(

Or maybe I should rename KApplicationTrader to KServiceTrader in order to have only one trader class, and add a queryByServiceType method for the dolphin use case.

The alternative is to install all KonqPopupMenu/Plugin desktop files together into a specific dir, and let dolphin parse them from scratch. But that's ugly and slow when we have a nice cache with a nice API.

alex added a subscriber: alex.EditedOct 19 2020, 7:08 AM

The alternative is to install all KonqPopupMenu/Plugin desktop files together into a specific dir, and let dolphin parse them from scratch. But that's ugly and slow when we have a nice cache with a nice API.

KRunner does sth. similar like this, but there they are in most cases parsed only once in the lifetime of the RunnerManager. But that suggestion also implies that it should be removed from the framework, have I understood this correctly?

alex claimed this task.Apr 18 2021, 2:36 PM

Update: I have implemented some caching logic for the c++ plugin instances which keeps them around for the lifetime of the KFileItemActions instance. See https://invent.kde.org/frameworks/kio/-/merge_requests/411/commits.

The alternative is to install all KonqPopupMenu/Plugin desktop files together into a specific dir, and let dolphin parse them from scratch. But that's ugly and slow when we have a nice cache with a nice API.

We could implement reusing the parsing results, but I am not sure if this is wanted.

@dfaure Should this task only be about getting rid of KonqPopupMenu/Plugin and use KFileItemAction/Plugin instead for the desktop files? For the c++ plugin stuff https://phabricator.kde.org/T12250 already exists.

Seems sensible. I think what you mean is that I posted my thoughts into the wrong task, 16 months ago, that's quite possible :)

alex added a comment.Apr 18 2021, 7:43 PM

But then we would still need to use KServiceTypeTrader which supposed to go away in T12179 🤔

No, you don't. The code in KFileItemActions says:

 const auto jsonPlugins = KPluginLoader::findPlugins(QStringLiteral("kf5/kfileitemaction"), [&db, commonMimeType](const KPluginMetaData &metaData) {
     if (!metaData.serviceTypes().contains(QLatin1String("KFileItemAction/Plugin"))) {
         return false;
     }
     ....
}

In other words, the plugins are installed into a specific subdir (which is how we do the "filtering"), and in addition (for some reason....) we check the servicetype in the JSON metadata.

No desktop file is needed anymore.

alex added a comment.EditedApr 19 2021, 4:48 AM

Okay now all makes sense :D Then the task is not at all about the KonqPopupMenu/Plugin service type.

alex moved this task from Backlog to Done on the KF6 board.May 5 2021, 4:53 PM
alex renamed this task from Phase out KonqPopupMenu/Plugin service type to Deprecate service based KFileItemAction plugin loading.May 7 2021, 9:27 AM
alex updated the task description. (Show Details)