kwriteconfig: add delete option
ClosedPublic

Authored by esjeon on Thu, Nov 14, 4:34 PM.

Details

Summary

Add a simple delete option to kwriteconfig. A possible usecase of this option is to delete unused shortcut bindings.

Diff Detail

Repository
R237 KConfig
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
esjeon created this revision.Thu, Nov 14, 4:34 PM
Restricted Application added a project: Frameworks. · View Herald TranscriptThu, Nov 14, 4:34 PM
Restricted Application added a subscriber: kde-frameworks-devel. · View Herald Transcript
esjeon requested review of this revision.Thu, Nov 14, 4:34 PM

I don't think deleting a entry from a config file makes sense. If you delete an entry you will get the default value on the next read.

For shortcuts it's a bit more complicated. What shortcuts had you in mind to delete?

What shortcuts had you in mind to delete?

My specific interest is deleting shortcuts of removed KWin scripts. ( e.g. https://github.com/esjeon/krohnkite/issues/31 ) Such shortcuts keep appearing on Global Shortcuts dialog unless manually deleted. Also, while developing the script, I leave garbage values behind, and having this around will be handy.

If you delete an entry you will get the default value on the next read.

I believe some people will find such behaviour(?) useful. You can safely "reset" configs from CLI without worrying about putting wrong values.

What shortcuts had you in mind to delete?

My specific interest is deleting shortcuts of removed KWin scripts. ( e.g. https://github.com/esjeon/krohnkite/issues/31 ) Such shortcuts keep appearing on Global Shortcuts dialog unless manually deleted. Also, while developing the script, I leave garbage values behind, and having this around will be handy.

As noted in that issue for removing shortcuts modifying kglobalshortcutsrc is not enough as kglobaccel will write back. A reliable way to do that is via DBus.

What shortcuts had you in mind to delete?

My specific interest is deleting shortcuts of removed KWin scripts. ( e.g. https://github.com/esjeon/krohnkite/issues/31 ) Such shortcuts keep appearing on Global Shortcuts dialog unless manually deleted. Also, while developing the script, I leave garbage values behind, and having this around will be handy.

As noted in that issue for removing shortcuts modifying kglobalshortcutsrc is not enough as kglobaccel will write back. A reliable way to do that is via DBus.

Yeah, that sounds like a better approach for the shortcut thing. But I want to make clear that I submitted this patch only after verifying that this works for my case, for whatever reason.

Also, I don't see anything wrong with adding this, since it merely exposes deleteEntry method already in the API. Some projects do rely on it, so why should it be kept away from actual human beings?

Also, I don't see anything wrong with adding this, since it merely exposes deleteEntry method already in the API. Some projects do rely on it, so why should it be kept away from actual human beings?

I am in no way against this. I just wanted to know what the motivation behind this is :).

Also, I don't see anything wrong with adding this, since it merely exposes deleteEntry method already in the API. Some projects do rely on it, so why should it be kept away from actual human beings?

FWIW, I don't disapprove; the above logic is reasonable IMO.

davidedmundson accepted this revision.Thu, Nov 14, 8:23 PM
davidedmundson added a subscriber: davidedmundson.

Shortcuts aside, the patch makes sense.

In general, I want to encourage people to wipe config entries rather than write in the current default as it makes several other things work better.

Do you have commit access?

This revision is now accepted and ready to land.Thu, Nov 14, 8:23 PM

Do you have commit access?

I don't think so. I'm a first timer around here.

Can you provide your email address so we can land this patch with correct authorship information?

Can you provide your email address

Eon S. Jeon <esjeon@hyunmu.am>

This revision was automatically updated to reflect the committed changes.

Thanks very much for the nice patch. May it be the first of many! :)

Thanks all. I hope I can be of help.