KLibLoader + KPartFactory + loading oneself problem.

Simon Hausmann hausmann at kde.org
Sat Jun 7 17:18:21 BST 2003


On Sat, Jun 07, 2003 at 05:55:02PM +0200, Luis Pedro Coelho wrote:
> Is this a good solution or a hack?

IMHO it's a good solution. I'd use KCF instead of the direct
KLibLoader/dynamic_cast usage though (see also attached patch) .

Simon
-------------- next part --------------
Index: kgvshell.cpp
===================================================================
RCS file: /home/kde/kdegraphics/kghostview/kgvshell.cpp,v
retrieving revision 1.60
diff -u -p -b -r1.60 kgvshell.cpp
--- kgvshell.cpp	4 Jun 2003 09:59:02 -0000	1.60
+++ kgvshell.cpp	7 Jun 2003 16:16:59 -0000
@@ -36,6 +36,7 @@
 #include <kglobal.h>
 #include <klocale.h>
 #include <kpopupmenu.h>
+#include <kparts/componentfactory.h>
 
 #include <qcursor.h>
 
@@ -54,7 +55,8 @@ KGVShell::KGVShell() :
     m_isFullScreen( false ),
     _tmpFile( 0 )
 {
-    m_gvpart = new KGVPart( this, "kgvpart", this, "kgvpart" );
+    m_gvpart = KParts::ComponentFactory::createPartInstanceFromLibrary< KGVPart >( "libkghostviewpart", this, "kgvpart",
+                                                                                   this, "kgvpart" );
 
     /*---- File -----------------------------------------------------------*/
     openact =


More information about the kde-core-devel mailing list