koIcon - what to keep in mind

Friedrich W. H. Kossebau kossebau at kde.org
Tue Aug 7 09:52:31 BST 2012


Am Dienstag, 7. August 2012, 09:24:25 schrieb Inge Wallin:
> On Tuesday, August 07, 2012 03:18:38 Friedrich W. H. Kossebau wrote:
> > Hi,
> > 
> > finally koIcon made it into master, yippie (IMHO). From now on it should
> > be
> > quite easy for anyone to check what icons are missing, now that all icon
> > names are tagged with macros which can be extracted with gettext and
> > compared against the existing icons.
> > 
> > But: this is not free lunch, as discussed. It needs everyone who adds new
> > icon usages to also use the macros from KoIcon.h (besides in QML files,
> > these are not covered, no proper idea yet how to tag without a footprint).
> > 
> > Basically you just need to remember this:
> > 	KIcon("pretty_icon")   ->   koIcon("pretty_icon")
> 
> Hmm, is the classname really koIcon?  Should be KoIcon, shouldn't it? Or is
> this a function? But in that case it's not just a simple text
> substitution...

No, the koIcon* family are just macros, perhaps best look at /KoIcon.h to 
understand the idea.
The macros are more or less used for tagging all icon name strings and, 
depending on the variant of macro used, will insert the code needed to create 
the wanted object type, a KIcon or QString or const char*. Other than that 
they do not result in any runtime change, also no buildtime change (after the 
preprocessor is run).

> > Should be doable by you, right? :P
> 
> You mean we should change the existing KIcon's to KoIcon? Can do, but please
> give confirmation that this is what you mean.

No more need to change the existing KIcon("icon"), object.iconName="icon" and 
similar calls, I did that already (see the commit).  After all that is how I 
have collected all the missing icons before, in case you wondered :)

But for any _new_ code which sets an icon or an iconname (like e.g. in the 
toolfactories, which have a property iconName) from now on the macros should 
be used.
Rule of thumb: no literal string which refers to an icon without a tagging 
koIcon* macro.

Seems I worked too long already on this and things seem obvious to me :) So 
please continue asking if there is more which needs explanation.

Cheers
Friedrich



More information about the calligra-devel mailing list