Add static method to check start condition
ClosedPublic

Authored by hchain on Mar 30 2020, 7:56 AM.

Details

Summary

Needed for systemd autostart generator will add a ExecCondition=kde-systemd-start-condition rcfile:section:entry:default, as described in T12627

Diff Detail

Repository
R309 KService
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
hchain created this revision.Mar 30 2020, 7:56 AM
Restricted Application added a project: Frameworks. · View Herald TranscriptMar 30 2020, 7:56 AM
Restricted Application added a subscriber: kde-frameworks-devel. · View Herald Transcript
hchain requested review of this revision.Mar 30 2020, 7:56 AM

Code is fine; both the change in KAutostart and the helper.

I'm not sure if this the helper should be in the framework.

X-KDE-Autostart condition is very tied to Plasma doing the booting, at which point we're better off putting the binary in plasma-workspace/startkde somewhere.

src/utils/kde-systemd-start-condition.cpp
17 ↗(On Diff #78848)

Should it be showHelp(255)?

Not that we should end up here in the generated case.

20 ↗(On Diff #78848)

A group name can have a space in it.

For example:
X-KDE-autostart-condition=baloofilerc:Basic Settings:Indexing-Enabled:true

I assume this will be ok as long as we make sure that we make the generator put things in quotes. But can you double check.

hchain added inline comments.Mar 30 2020, 8:20 AM
src/utils/kde-systemd-start-condition.cpp
17 ↗(On Diff #78848)

I intentionally return 0 here to mimic the behavior of KAutostart which returns true if the condition is malformed or empty

20 ↗(On Diff #78848)

so I could silently join the arguments with spaces ?

davidedmundson added inline comments.Mar 30 2020, 8:23 AM
src/utils/kde-systemd-start-condition.cpp
20 ↗(On Diff #78848)

As long as

kde-systemd-start-condition "foo bar:foo bar:foo:true"

does work properly, we can leave this as-is and just make sure the generator is correct.

hchain updated this revision to Diff 78863.Mar 30 2020, 9:15 AM

remove binary

hchain retitled this revision from Add a new standalone executable to replace X-KDE-Autostart-Condition to Add static method to check start condition.Mar 30 2020, 9:16 AM
hchain edited the summary of this revision. (Show Details)
hchain edited the test plan for this revision. (Show Details)
davidedmundson accepted this revision.Mar 30 2020, 9:22 AM
This revision is now accepted and ready to land.Mar 30 2020, 9:22 AM
This revision was automatically updated to reflect the committed changes.
dfaure added inline comments.Apr 3 2020, 11:09 PM
src/services/kautostart.h
289

This is new public API, it's missing @since 5.69

hchain added inline comments.Apr 4 2020, 9:43 AM
src/services/kautostart.h
289

I think you added it to the wrong method ;)

kossebau added inline comments.Apr 4 2020, 10:46 AM
src/services/kautostart.h
289

That was embarrassing, I shouldn't try and rush. Sorry. Thanks for cleaning up after me.