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

List:       kfm-devel
Subject:    [PATCH?] Re: Merging parts with global UI doesn't work.. and may never have
From:       Kurt Granroth <granroth () suse ! com>
Date:       2001-01-17 23:08:05
[Download RAW message or body]

Kurt Granroth wrote:
> There was a report on kde-devel about kparts menu merging not working
> correctly.  I slightly remembered this happening before but I didn't
> have time to look into it then.  Well, I do know and it looks like
> there really is a problem.
> 
> Basically, the XML and actions in a Part isn't correctly merged into
> the Shell's XML and actions if the global ui_standards.rc and
> KStdAction actions are used.
[snip]

Okay, I have a possible patch for this.  I'm putting it here since I'm
not 100% sure that this is the correct way to fix it.

Basically, I moved the shell menu creation (createShellGUI) to AFTER
the Part menu creation.  Also (and this is the big one), I copied over
all of the Part's actions into the Shell's actions just before
creating anything.

I did tests with some homemade Parts and they all worked.  The
kparts/tests tests worked.  Konqueror and KOffice work.  In fact, it
looks like *everything* works like expected now.

But was the fix really that easy?
-- 
Kurt Granroth            | http://www.granroth.org
KDE Developer/Evangelist | SuSE Labs Open Source Developer
granroth@kde.org         | granroth@suse.com
            KDE -- Conquer Your Desktop

["mainwindow.diff" (text/plain)]

Index: mainwindow.cpp
===================================================================
RCS file: /home/kde/kdelibs/kparts/mainwindow.cpp,v
retrieving revision 1.43
diff -b -u -u -r1.43 mainwindow.cpp
--- mainwindow.cpp	2000/08/31 14:11:02	1.43
+++ mainwindow.cpp	2001/01/17 23:03:07
@@ -109,14 +109,12 @@
              this, SLOT( slotSetStatusBarText( const QString & ) ) );
   }
 
-  if ( !d->m_bShellGUIActivated )
-  {
-    createShellGUI();
-    d->m_bShellGUIActivated = true;
-  }
-
   if ( part )
   {
+    // copy the current part's actions to our own.  this allows us to
+    // merge globally
+    *actionCollection() += *part->actionCollection();
+
     // do this before sending the activate event
     connect( part, SIGNAL( setWindowCaption( const QString & ) ),
              this, SLOT( setCaption( const QString & ) ) );
@@ -132,6 +130,12 @@
     QListIterator<Plugin> pIt( plugins );
     for (; pIt.current(); ++pIt )
       factory->addClient( pIt.current() );
+  }
+
+  if ( !d->m_bShellGUIActivated )
+  {
+    createShellGUI();
+    d->m_bShellGUIActivated = true;
   }
 
   setUpdatesEnabled( true );


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

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