KCMUtils: Add option to append service file to list of arguments
AbandonedPublic

Authored by alex on Apr 26 2020, 2:13 PM.

Details

Reviewers
ngraham
meven
broulik
mart
Group Reviewers
Plasma
Summary

By setting the new variable to true the service path gets appended
to the list of arguments. Otherwise there is no way
(at least not that I know of, please correct me if I am wrong) of getting the service
file which was used to launch the module.

Accessing the service file is a requirement for T13079: Make runner KCMs easier to extend.

Test Plan

Add m_pluginSelector->setAppendServicePath(true); in the
kcms/runners/kcm.cpp in the repo plasma-desktop. If you print out the arguments of
a runner config module (plasma-workspace contains some) you should see the service file.

Diff Detail

Repository
R295 KCMUtils
Branch
service_path_append (branched from master)
Lint
No Linters Available
Unit
No Unit Test Coverage
Build Status
Buildable 26315
Build 26333: arc lint + arc unit
alex created this revision.Apr 26 2020, 2:13 PM
Restricted Application added a project: Frameworks. Β· View Herald TranscriptApr 26 2020, 2:13 PM
Restricted Application added a subscriber: kde-frameworks-devel. Β· View Herald Transcript
alex requested review of this revision.Apr 26 2020, 2:13 PM
alex edited the summary of this revision. (Show Details)May 3 2020, 9:52 AM
alex added reviewers: meven, broulik.
alex updated this revision to Diff 81798.May 3 2020, 2:06 PM

Rename method

alex updated this revision to Diff 81799.May 3 2020, 2:08 PM

Little typo :-)

apol added a subscriber: apol.May 3 2020, 11:20 PM

I have the feeling there's a missing piece here.

Would it make sense to always pass it? Would it regress in any way?

At the very least, on the API documentation, explain why one would want that.

alex added a comment.May 4 2020, 4:57 AM

Would it make sense to always pass it? Would it regress in any way?

It would make sense, but it would change the existing behavior.
If you use the method setConfigurationArguments then you expect your argument list to be the list of arguments you specified + an entry for the metadata.
So adding an entry by default could break things.

mart added a subscriber: mart.May 4 2020, 9:13 AM

indeed, a bit more documentation then go for it

alex updated this revision to Diff 81855.May 4 2020, 9:35 AM

Improve documentation

Is that what you had in mind :-) ?

And should I maybe add a comment to make this the default in KF6?

alex updated this revision to Diff 81856.May 4 2020, 9:36 AM

Linebreak

alex added a reviewer: mart.May 4 2020, 9:38 AM
alex updated this revision to Diff 81873.May 4 2020, 11:15 AM

Increase @since to 5.71

alex added a comment.May 12 2020, 4:55 PM

Friendly Ping πŸ˜ƒ

meven added inline comments.May 13 2020, 7:34 AM
src/kpluginselector.cpp
855

Adding a fileName field to KCModuleProxy would make more sense to me, and do it by default.
Plus KCModuleProxy has already access to the fileName since it receives moduleInfo.
But I am not a specialist.

alex added inline comments.May 13 2020, 8:14 AM
src/kpluginselector.cpp
855

You could add a field to the KCModule class (thats where you ultimately want to access the fileName).
But then the downside is that you don't have them as a constructor argument.

meven added inline comments.May 16 2020, 3:51 PM
src/kpluginselector.cpp
855

moduleInfo is part of the ctor here, so the fileName is already available indirectly.
A good thing would be to avoid having an option for such a niche usage although legitimate.

alex added inline comments.May 16 2020, 5:08 PM
src/kpluginselector.cpp
855

moduleInfo is part of the ctor here, so the fileName is already available indirectly.

Yes, but the KCModuleProxy is just a wrapper class for the KCModule.
The actual KCModule gets created in kcmoduleloader.cpp line 93+.

PS: The moduleInfo is also available there, but I don't see any elegant way to make it available to the KCModule other than a property or appending it to the list of arguments.

A good thing would be to avoid having an option for such a niche usage although legitimate.

Always open to suggestions πŸ˜ƒ

meven added inline comments.May 19 2020, 6:12 PM
src/kpluginselector.cpp
855

Seems like a property would make sense, after all it is about it, or a ref to the KCModuleInfo

alex added inline comments.May 19 2020, 7:13 PM
src/kpluginselector.cpp
855

I have created a PR on Gitlab for this

alex abandoned this revision.May 19 2020, 7:15 PM

Abandoning this in favor of https://invent.kde.org/frameworks/kconfigwidgets/-/merge_requests/1 and a follow up PR.