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

List:       kde-devel
Subject:    [PATCH] KParts::DockMainWindow
From:       Björn Sahlström <kbjorn () users ! sourceforge ! net>
Date:       2002-09-06 18:14:51
[Download RAW message or body]

Hi
This PATCH fix the problem with KParts::Plugins getting merged twice into GUI. 
What it actually does is changing createGUI and createShellGUI so they work 
in the same way as KParts::MainWindow.
-- 
MVH
Björn Sahlström
kbjorn@users.sourceforge.net
["dockmainwindow.patch" (text/x-diff)]

Index: dockmainwindow.cpp
===================================================================
RCS file: /home/kde/kdelibs/kparts/dockmainwindow.cpp,v
retrieving revision 1.8
diff -u -r1.8 dockmainwindow.cpp
--- dockmainwindow.cpp	21 Oct 2001 00:16:19 -0000	1.8
+++ dockmainwindow.cpp	6 Sep 2002 18:05:28 -0000
@@ -22,6 +22,7 @@
 #include <kparts/dockmainwindow.h>
 #include <kparts/event.h>
 #include <kparts/part.h>
+#include <kaccel.h>
 #include <kparts/plugin.h>
 #include <kstatusbar.h>
 #include <kinstance.h>
@@ -84,11 +85,6 @@
     GUIActivateEvent ev( false );
     QApplication::sendEvent( d->m_activePart, &ev );
 
-    plugins = Plugin::pluginObjects( d->m_activePart );
-    Plugin *plugin = plugins.last();
-    for (; plugin; plugin = plugins.prev() )
-      factory->removeClient( plugin );
-
     factory->removeClient( d->m_activePart );
 
     disconnect( d->m_activePart, SIGNAL( setWindowCaption( const QString & ) ),
@@ -99,6 +95,7 @@
 
   if ( !d->m_bShellGUIActivated )
   {
+    loadPlugins( this, this, KGlobal::instance() );
     createShellGUI();
     d->m_bShellGUIActivated = true;
   }
@@ -116,11 +113,6 @@
     GUIActivateEvent ev( true );
     QApplication::sendEvent( part, &ev );
 
-    plugins = Plugin::pluginObjects( part );
-    QPtrListIterator<Plugin> pIt( plugins );
-
-    for (; pIt.current(); ++pIt )
-      factory->addClient( pIt.current() );
   }
 
   setUpdatesEnabled( true );
@@ -135,6 +127,8 @@
 
 void DockMainWindow::createShellGUI( bool create )
 {
+    bool bAccelAutoUpdate = accel()->setAutoUpdate( false );
+    assert( d->m_bShellGUIActivated != create );
     if ( create )
     {
         if ( isHelpMenuEnabled() )
@@ -155,23 +149,15 @@
 
         guiFactory()->addClient( this );
 
-        QPtrList<Plugin> plugins = Plugin::pluginObjects( this );
-        QPtrListIterator<Plugin> pIt( plugins );
-        for (; pIt.current(); ++pIt )
-            guiFactory()->addClient( pIt.current() );
     }
     else
     {
         GUIActivateEvent ev( false );
         QApplication::sendEvent( this, &ev );
 
-        QPtrList<Plugin> plugins = Plugin::pluginObjects( this );
-        Plugin *plugin = plugins.last();
-        for (; plugin; plugin = plugins.prev() )
-            guiFactory()->removeClient( plugin );
-
         guiFactory()->removeClient( this );
     }
+    accel()->setAutoUpdate( bAccelAutoUpdate );
 }
 
 #include "dockmainwindow.moc"

>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<

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

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