Plugin Toolbar problem

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


On Tuesday 29 June 2004 13:44, you wrote:
> On Tuesday 29 June 2004 13:29, you wrote:
> > 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 :)
> 
> How about this:
> 
> Index: khtml_part.cpp
> ===================================================================
> RCS file: /home/kde/kdelibs/khtml/khtml_part.cpp,v
> retrieving revision 1.1009
> diff -u -3 -p -r1.1009 khtml_part.cpp
> --- khtml_part.cpp	19 Jun 2004 20:47:34 -0000	1.1009
> +++ khtml_part.cpp	29 Jun 2004 11:43:04 -0000
> @@ -163,8 +163,10 @@ KHTMLPart::KHTMLPart( QWidget *parentWid
>  {
>      d = 0;
>      KHTMLFactory::registerPart( this );
> -    setInstance( KHTMLFactory::instance(), prof == BrowserViewGUI && 
> !parentPart() );
> +    setInstance( KHTMLFactory::instance(), false );
>      init( new KHTMLView( this, parentWidget, widgetname ), prof );
> +    if ( prof == BrowserViewGUI && !parentPart() )
> +        loadPlugins( partObject(), this, instance() );
>  }
>  
>  KHTMLPart::KHTMLPart( KHTMLView *view, QObject *parent, const char *name, 
> GUIProfile prof )
> @@ -172,9 +174,11 @@ KHTMLPart::KHTMLPart( KHTMLView *view, Q
>  {
>      d = 0;
>      KHTMLFactory::registerPart( this );
> -    setInstance( KHTMLFactory::instance(), prof == BrowserViewGUI && 
> !parentPart() );
> +    setInstance( KHTMLFactory::instance(), false );
>      assert( view );
>      init( view, prof );
> +    if ( prof == BrowserViewGUI && !parentPart() )
> +        loadPlugins( partObject, this, instance() );
>  }

Should work too, but it duplicates more code between the two constructors,
whereas my patch reduces the duplicated code even more.
I don't mind much either way though. If you tested the above, I'm fine with it.
(It has the advantage that it reduces the risk of using the instance too early
in init())

-- 
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