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

List:       kde-core-devel
Subject:    Re: KXMLGUIClient
From:       David Faure <david () mandrakesoft ! com>
Date:       2002-01-07 0:24:09
[Download RAW message or body]

On Wednesday 02 January 2002 02:57, Ellis Whitehead wrote:
> On Tuesday 01 January 2002 07:31 pm, Waldo Bastian wrote:
> > On Tuesday 01 January 2002 03:16 pm, Ellis Whitehead wrote:
> > > Hi guys,
> > >
> > > I believe I've figured out an elegant solution to the KAccel problems
> > > I've been having with KAction -- but it would require that KXMLGUIClient
> > > know which QWidget* it's a part of, so that it can pass that pointer to
> > > "new KActionCollection()", so that actions created on that collection are
> > > not all placed in one single monolithic top-level-window KAccel object
> > > full of key conflicts.
> >
> > I think the reason for lumping them together is that otherwise keybindings
> > don't work when e.g. the menubar isn't visible.
> >
> > Of course, the accels for a file-open dialog shouldn't end up in e.g.
> > kedit's mainwindow, but should be collected in the mainwindow of the
> > file-dialog itself. Could that be what is going wrong?
> 
> Yes, that's exactly what's going wrong.

That's obviously a bug then :}
Sounds like the determination of the parent kmainwindow in kaction.cpp
is wrong, it should stop at the dialog instead of going up to the mainwindow.

Would something like this help ? (untested)

Index: kaction.cpp
===================================================================
RCS file: /home/kde/kdelibs/kdeui/kaction.cpp,v
retrieving revision 1.215
diff -u -p -r1.215 kaction.cpp
--- kaction.cpp 2002/01/05 22:03:50     1.215
+++ kaction.cpp 2002/01/07 00:22:49
@@ -642,7 +642,7 @@ void KAction::plugMainWindowAccel( QWidg
   // Note: topLevelWidget() stops too early, we can't use it.
   QWidget * tl = w;
   QWidget * n;
-  while ( ( n = tl->parentWidget() ) ) // lookup parent and store
+  while ( !tl->isDialog() && ( n = tl->parentWidget() ) ) // lookup parent and store
     tl = n;

   KMainWindow * mw = dynamic_cast<KMainWindow *>(tl); // try to see if it's a kmainwindow


Note: isTopLevel() would be wrong, since popupmenus in a menubar return
isTopLevel()==true, IIRC. But isDialog() should do the job, for the file-dialog case.

-- 
David FAURE, david@mandrakesoft.com, faure@kde.org
http://www.kde.org/people/david.html (my real webpage is down)
KDE 3.0: Konquering the Desktops
[prev in list] [next in list] [prev in thread] [next in thread] 

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