Add a new template for KCMs
Needs RevisionPublic

Authored by tcanabrava on Mon, Nov 4, 11:18 PM.

Details

Reviewers
mart
ervin
Group Reviewers
Plasma
Frameworks
Summary

Starting a new KCM from scratch is currently a time consuming task,
you have to copy files or mount the correct hierarchy in disk and pray that it's correct, create files in the correct places and reference them in .desktop files,
the metadata file also references files or classes that are supposed to be in the project.
if you look at some KCM's, the code does not help as sometimes they reference as kcm_ other as KCM within the CMake.
As I'm porting KCM's from C++ to Qml, I realized that I'd spend *more* time just creating the initial skeleton than actually creating the code to handle the settings,
this will sabe my time, and hopefully, others.

Test Plan

Created a new project via KAppTemplate, compiled, run the kcm stuvb

Diff Detail

Repository
R242 Plasma Framework (Library)
Branch
arcpatch-D25149
Lint
No Linters Available
Unit
No Unit Test Coverage
Build Status
Buildable 18724
Build 18742: arc lint + arc unit
tcanabrava created this revision.Mon, Nov 4, 11:18 PM
Restricted Application added a project: Frameworks. · View Herald TranscriptMon, Nov 4, 11:18 PM
Restricted Application added a subscriber: kde-frameworks-devel. · View Herald Transcript
tcanabrava requested review of this revision.Mon, Nov 4, 11:18 PM
tcanabrava edited the summary of this revision. (Show Details)Mon, Nov 4, 11:21 PM
tcanabrava updated this revision to Diff 69296.Mon, Nov 4, 11:24 PM
  • Update readme
ervin added a subscriber: ervin.Tue, Nov 5, 7:22 AM

What about having the template use kcfg and ManagedConfigModule as well? It'd give better behaving modules by default and is a better practice than starting without them. I'd rather have people make the conscious decision to remove them because it turns out it's a KCM with no KConfig at all than people overlooking proper KConfig use by default.

ognarb added a subscriber: ognarb.Wed, Nov 6, 12:19 AM

Another related todo would be to update/rewrite https://techbase.kde.org/Development/Tutorials/KCM_HowTo after this template is merged and include information about it ;)

A very sensible idea. ++

templates/kcm-qml/qml-plasmoid.png

What's this about?

templates/kcm-qml/package/contents/ui/main.qml
27

lets not encourage this import

yurchor added a subscriber: yurchor.Wed, Nov 6, 6:24 AM
yurchor added inline comments.
templates/kcm-qml/package/contents/ui/main.qml
38

Typo: Exemple -> Example

tcanabrava updated this revision to Diff 69400.Thu, Nov 7, 3:44 PM
  • Add KConfigXT

A very sensible idea. ++

templates/kcm-qml/qml-plasmoid.png

What's this about?

We need a better icon. it's the icon for the Plasmoid template.

ngraham retitled this revision from Add a new Template for KCM's. to Add a new template for KCMs.Thu, Nov 7, 4:16 PM
GB_2 added a subscriber: GB_2.Sun, Nov 10, 9:25 AM

We need a better icon. it's the icon for the Plasmoid template.

Why not use the system settings icon as it's a KCM template?

GB_2 added a project: Plasma.
GB_2 added a subscriber: Plasma.
tcanabrava updated this revision to Diff 69649.Tue, Nov 12, 6:45 PM
tcanabrava marked 2 inline comments as done.
  • Add KConfigXT
  • Remove wrong icon
mart accepted this revision.Wed, Nov 13, 8:23 PM
This revision is now accepted and ready to land.Wed, Nov 13, 8:23 PM
ervin requested changes to this revision.Wed, Nov 13, 9:59 PM
ervin added inline comments.
templates/kcm-qml/%{APPNAMELC}settings.kcfgc
5

You also want "ParentInConstructor=true" in here.

templates/kcm-qml/kcm.cpp
32

Pass this as parent here (currently you're leaking it)

43

Shouldn't be needed anymore (and likely wrong in most cases).

templates/kcm-qml/kcm.h
26

This should inherit from ManagedConfigModule now.

36

None of those slots are needed with a ManagedConfigModule (except if you need to do something outside the realm of the settings of course, which is not the case by default.

templates/kcm-qml/package/contents/ui/main.qml
39

What about disabling it if the setting is immutable?

This revision now requires changes to proceed.Wed, Nov 13, 9:59 PM
tcanabrava added inline comments.Thu, Nov 14, 7:42 AM
templates/kcm-qml/kcm.cpp
43

What's the correct form then? No need to connect the settings *at all*?

templates/kcm-qml/package/contents/ui/main.qml
39

The default fake setting will not be immutable, or you mean that you want me to do one mutable and one immutable settings for the example?

ervin added inline comments.Thu, Nov 14, 9:13 AM
templates/kcm-qml/kcm.cpp
43

No need indeed... it's *magic*! ;-)

templates/kcm-qml/package/contents/ui/main.qml
39

In fact you can't predict that, any setting can be made immutable (it's user and sysadmin controlled). No need to introduce another one.