Icon choosing in kedittoolbar

Andras Mantia amantia at kde.org
Thu Apr 29 21:03:00 BST 2004


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Thursday 29 April 2004 17:44, David Faure wrote:
> On Thursday 29 April 2004 16:12, Andras Mantia wrote:
> > This is how they are created (in quanta.cpp,
> > QuantaApp::slotLoadToolbarFile(const KURL& url)):
> >     if (! actionCollection()->action(actionName))
> >     {
> >       TagAction *tagAction = new TagAction(&el, actionCollection()
> > ); ...
> >     }
>
> OK so this action is in the actionCollection of the _mainwindow_,
> not of the right kxmlguiclient.

Well, yes.

> You create other xmlguiclients and add them to the factory yourself,
Right, because I load every file in their own xmlguiclient.

> BUT you don't use the xmlgui mechanism, you plug the actions by hand!

Isn't factory()->addClient() an xmlgui way to add them? 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). 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.
 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.

> No wonder kedittoolbar is confused....
It wasn't confused prior to yesterday. ;-)

> From quanta.cpp:
>
>    for (uint i = 0; i < nodeList.count(); i++)
>    {
>      action =
> actionCollection()->action(nodeList.item(i).cloneNode().toElement().a
>ttribute("name") ); if (action)
>      {
>        toolbarGUI->actionCollection()->insert(action);
>        action->plug(menu);
>      }
>    }
>    m_tagsMenu->insertItem(name,menu);
>    p_toolbar->menu = menu;
>
>    factory()->addClient(toolbarGUI);

Can you tell me from where do you got this code? I cannot find any 
actionCollection()->insert now.

>
> Plugging actions by hand into an xmlgui is a very bad idea IMHO.
> You should let the GUI merging do its work - but for that you need to
> create the actions with the right parent and let addClient handle the
> plugging.
>
> The actionCollection()->insert() above is a nice try, but a bad idea
> :) (it's like having a QObject with two parents....)
> Hmm in fact it looks like it doesn't work, since I see 0 actions in
> the guiclient's collection.
> Isn't it possible to create the action with the right action
> collection as parent in the first place?

I will try now, let's see the result, but I doubt it will work...

Andras

- -- 
Quanta Plus developer - http://quanta.sourceforge.net
K Desktop Environment - http://www.kde.org
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2 (GNU/Linux)

iD8DBQFAkV90TQdfac6L/08RAtbSAJ9kqygcPvuCIt+/px+AQTa2wiVicgCePB3i
o6WRgkVziVqsBpiW9FiUQ8g=
=VHLu
-----END PGP SIGNATURE-----




More information about the kde-core-devel mailing list