Skip to content

Add new adoption api

Alexander Lohnau requested to merge work/new_adoption_api into master

This MR fixes the clicking of the "Use" button in the frontend.

Also this MR handles the execution of the adoption internally. This allows us to display warnings/errors based on the output of the process.

To try out the cases where everything runs fine, displays a warning or displays en error you can use these commands:

m_adoptionCommand = QStringLiteral("echo \"nothing to see here\"");
m_adoptionCommand = QStringLiteral("bash -c 'echo \"This is a warning\" 1>&2;exit 0'");
m_adoptionCommand = QStringLiteral("bash -c 'echo \"Very very urgent error\" 1>&2;exit 1'");

Also the label text is configurable, just "Use" is not intuitive. For example in the context of wallpapers "Use" could mean "Use for all monitors" or "Use just for this monitor". Now the string value can be set in the knsrc file.

Also the adoption command construction failed in some case the file paths contained a space, that is why they are now quoted. The creation of this command got moved to the private impl, because the API user should only use the adoptEntry method from now on.

To make sure the KCMs can react accordingly to the changes the signalEntryEvent(const EntryInternal &entry, EntryInternal::EntryEvent event) was added. Using the EntryEvent enum we can differentiate between stateful events(install/update/uninstall) and non-stateful events like the entry adoption.
In KF6 we should use this instead of the old signalEntryChanged event. A MR to use the new signal will follow. Thanks to @leinir for discussing that with me on IRC :).

CCBUG: 417983

Edited by Alexander Lohnau

Merge request reports

Loading