[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-core-devel
Subject:    Re: Icon choosing in kedittoolbar
From:       David Faure <faure () kde ! org>
Date:       2004-04-29 23:11:30
Message-ID: 200404300111.30736.faure () kde ! org
[Download RAW message or body]

On Friday 30 April 2004 00:53, David Faure wrote:
> Well you apparently need to fix much more than that, in particular letting
> the normal xmlgui plugging mechanism do its work (you're creating a real toolbar,
> so AFAICS it should work, if xmlguifactory can find the action).

Just to prove that it works indeed: proof-of-concept patch attached.

Note the TODO, and note that you'll have to fix slotRemoveToolbar to
fix the crash on exit :). And you can probably clean up a lot of
slotConfigureToolbars().

But the point is that it works fine that way, with no manual plugging,
the toolbars appear and the edittoolbar dialog works as you expect.

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

["quanta.diff" (text/x-diff)]

Index: quanta.cpp
===================================================================
RCS file: /home/kde/kdewebdev/quanta/src/quanta.cpp,v
retrieving revision 1.523
diff -u -p -r1.523 quanta.cpp
--- quanta.cpp	28 Apr 2004 11:30:43 -0000	1.523
+++ quanta.cpp	29 Apr 2004 23:06:10 -0000
@@ -1630,6 +1630,7 @@ QWidget* QuantaApp::createContainer( QWi
     QuantaToolBar *tb = new QuantaToolBar(w, element.attribute("name"), true, true);
     tb->loadState(element);
     tb->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Minimum);
+#if 0
     KAction *action;
     QDomNode node = element.firstChild();
     while (!node.isNull())
@@ -1639,6 +1640,7 @@ QWidget* QuantaApp::createContainer( QWi
         action = actionCollection()->action(node.toElement().attribute("name") );
         if (action)
         {
+            kdDebug() << k_funcinfo << "manually plugging action " << action->name() << endl;
           action->plug(tb);
         }
       }
@@ -1651,6 +1653,7 @@ QWidget* QuantaApp::createContainer( QWi
         tb->insertLineSeparator();
       node = node.nextSibling();
     }
+#endif
     //kdDebug(24000) << "QuantaToolBar minimumSizeHeight :" << tb->minimumSizeHint().height() << endl;
     if (tb->minimumSizeHint().height() > 30)
     {
@@ -2095,6 +2098,11 @@ void QuantaApp::slotLoadToolbarFile(cons
     }
    }
 
+   // Make all actions available to the guiclient
+   // (TODO rewrite in a less-deprecated way....)
+   // (Note that insert() isn't deprecated anymore, that was temporary)
+   *(toolbarGUI->actionCollection()) += *actionCollection();
+
    guiFactory()->addClient(toolbarGUI);
 
    //Plug in the actions & build the menu


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic