Plugin Toolbar problem

David Faure faure at kde.org
Tue Jun 29 12:29:45 BST 2004


On Tuesday 22 June 2004 23:23, David Faure wrote:
> Hopefully no code in init() needs instance().
OK, that was a wrong assumption. setXMLFile needs the instance, of course.
I was wondering why I had no more khtml menu items :)

New try then.

Index: khtml_part.cpp
===================================================================
RCS file: /home/kde/kdelibs/khtml/khtml_part.cpp,v
retrieving revision 1.1009
diff -u -p -b -r1.1009 khtml_part.cpp
--- khtml_part.cpp      19 Jun 2004 20:47:34 -0000      1.1009
+++ khtml_part.cpp      29 Jun 2004 11:28:12 -0000
@@ -163,7 +163,6 @@ KHTMLPart::KHTMLPart( QWidget *parentWid
 {
     d = 0;
     KHTMLFactory::registerPart( this );
-    setInstance( KHTMLFactory::instance(), prof == BrowserViewGUI && !parentPart() );
     init( new KHTMLView( this, parentWidget, widgetname ), prof );
 }

@@ -172,22 +171,14 @@ KHTMLPart::KHTMLPart( KHTMLView *view, Q
 {
     d = 0;
     KHTMLFactory::registerPart( this );
-    setInstance( KHTMLFactory::instance(), prof == BrowserViewGUI && !parentPart() );
     assert( view );
     init( view, prof );
 }

 void KHTMLPart::init( KHTMLView *view, GUIProfile prof )
 {
-  if ( prof == DefaultGUI )
-    setXMLFile( "khtml.rc" );
-  else if ( prof == BrowserViewGUI )
-    setXMLFile( "khtml_browser.rc" );
-
   d = new KHTMLPartPrivate(parent());
-
   d->m_view = view;
-  setWidget( d->m_view );

   d->m_guiProfile = prof;
   d->m_extension = new KHTMLPartBrowserExtension( this );
@@ -387,6 +378,16 @@ void KHTMLPart::init( KHTMLView *view, G

   d->m_dcopobject = new KHTMLPartIface(this);

+  // Now that the d pointer is ready, call setInstance, which also loads plugins
+  setInstance( KHTMLFactory::instance(), prof == BrowserViewGUI && !parentPart() );
+
+  if ( prof == DefaultGUI )
+    setXMLFile( "khtml.rc" );
+  else if ( prof == BrowserViewGUI )
+    setXMLFile( "khtml_browser.rc" );
+
+  setWidget( d->m_view );
+
   // "khtml" catalog does not exist, our translations are in kdelibs.
   // removing this catalog from KGlobal::locale() prevents problems
   // with changing the language in applications at runtime -Thomas Reitelbach


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




More information about the kfm-devel mailing list