Icon choosing in kedittoolbar

David Faure faure at kde.org
Thu Apr 29 21:20:11 BST 2004


On Thursday 29 April 2004 22:03, Andras Mantia wrote:
> Isn't factory()->addClient() an xmlgui way to add them?
Yes it is. But that's not what I'm talking about. See the action->plug() call in the code!
The addClient call does nothing, since the action collection of the client is empty.

> The reason why I 
> do it like you saw is because this was the only way I could get it work
> (don't ask me the exact problems, as I coded almost 2 years ago). 
Well I think the exact problem is the wrong actioncollection as parent.

> What 
> we do there is loading a toolbar XML and an action XML file and
> creating a toolbar for it, which is not a standard KDE toolbar, as it's
> in a tabwidget. This exposed many problems, and the way it is now was
> the solution until now.
A dynamically-generated XML for a guiclient sounds fine (and fun),
but the actioncollection for that guiclient has to hold those actions,
and you have to let xmlgui handle the plugging.

>  Hm, thinking more, I think one of the problems was this check:
> " if (! actionCollection()->action(actionName))". If I put the action in
> the newly created xmlguiclient's actioncollection, then it's not
> trivial to look up if there is also an action with that name or not.
> This action searching and juggling happens on other places as well, and
> an action might move from one actionCollection to another (or be
> present in two in that case), which makes things even worser in the
> toolbar edit dialog (like duplicate actions). I remember a version when
> I had to delete & move actions prior to calling the edit toolbar dialog
> in order to get something useful. The current way is the most cleanest
> so far I could create.
The more hacks you pile up, the more chances you have that something doesn't work :)

> > No wonder kedittoolbar is confused....
> It wasn't confused prior to yesterday. ;-)
It certainly was. It showed all actions, sure, but did you try actually moving
actions from the left to the right? In many cases nothing would happen.
With the new mechanism, it is guaranteed that any move done in the dialog
will work in the real application.

> Can you tell me from where do you got this code? I cannot find any
> actionCollection()->insert now.
The code was a bit old, it was from the old quanta module (oops).
I'll update kdewebdev now :)
Anyway shouldn't matter, since we're both seeing the same.

-- 
David Faure, faure at kde.org, sponsored by Trolltech to work on KDE,
Konqueror (http://www.konqueror.org), and KOffice (http://www.koffice.org).




More information about the kde-core-devel mailing list