[Service Runner] Look up relative entryPaths
ClosedPublic

Authored by broulik on Aug 2 2018, 8:44 AM.

Details

Summary

For KCMs we get a relative entryPath() for our KService resulting in an invalid URL being created.

CCBUG: 397070

Test Plan
  • I can now search for "colors" and drag the colors KCM search result to the desktop and have a fully functioning shortcut

The KSycocaEntry::entryPath() docs say

The path can be absolute or relative.
The corresponding factory should know relative to what.

I'm not really a fan of adjusting all kinds of places where we use entryPath(), such as Kicker (as reported in the bug report), is there some better way? or at least a static resolve path function somewhere?

Diff Detail

Repository
R120 Plasma Workspace
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
broulik created this revision.Aug 2 2018, 8:44 AM
Restricted Application added a project: Plasma. · View Herald TranscriptAug 2 2018, 8:44 AM
Restricted Application added a subscriber: plasma-devel. · View Herald Transcript
broulik requested review of this revision.Aug 2 2018, 8:44 AM
hein added a comment.Aug 2 2018, 3:08 PM

I agree a more general fix would be nice, but at least Kicker has a whole bunch of downstreams itself ... I'd probably accept this, but I'd like to hear David's take.

anthonyfieroni added inline comments.
runners/services/servicerunner.cpp
481

Does it better to check that file exists?

broulik added inline comments.Aug 3 2018, 6:28 AM
runners/services/servicerunner.cpp
481

QStandardPaths::locate already does that:

The full path to the first file […] found is returned. If no such file […] can be found, an empty string is returned.

dfaure accepted this revision.Aug 4 2018, 10:19 AM

This relies on the fact that nowadays entryPath() is absolute for application desktop files (for a reason I forgot, must be related to the vfolder stuff), so relative means indeed relative to "kservices5".

BTW the reason why KService doesn't offer an absolute-file-path method is because one entry can be a merged view of local+global files (so the right way to read it is with KConfig, not QFile).
But yeah QMimeData doesn't support that :-)

I have no objection to this commit.

This revision is now accepted and ready to land.Aug 4 2018, 10:19 AM
This revision was automatically updated to reflect the committed changes.