Iss klar

Das ganze sieht jetzt ungefähr so aus: (Nicht erschrecken, da ist bestimmt einiges dabei, was dir bekannt vorkommt! )
Code:
   // Query nach Services unseres ServiceTypes
   offers = KTrader::self()->query( s );
	
   qDebug("Requesting factory for service " + s );
	
   svcptr = offers.first();
	
   if( part != 0L ) {
	
       qDebug( "... deleting old part ..." );
       delete part;
       part = 0L;

       qDebug( "... unloading library ..." );		
       library->unload();
		
       qDebug( "... done ..." ); 
   }

   
   part = 0L;	
   factory = 0L;
	
   if( svcptr == 0L ) {
	
      kdDebug() << "No offers for service " << s << endl;
      kdDebug() << "This might be caused by an incomplete installation," << endl;
      kdDebug() << "or by KDE not recognizing the new services." << endl;

      factory = 0L;

   } else {
	
      library = KLibLoader::self()->library( ((ModulItem*)lastItem)->library ); 
		
      if( !library ) {
		
         qDebug( "Could not create a KLibrary" );
         return;
      }
		
      factory = library->factory();//KLibLoader::self()->factory( ((ModulItem*)lastItem)->library );//svcptr->library() );
				
      if( factory == 0L ) {
		
         qDebug( "Could not create a factory for KTrader's offer!" );
			
 	 library->unload();
         part = 0L;
      } else {
		
         factory->setName( "JargoFactory" );
			
         kdDebug( ) << "Got factory (" << factory << "). Creating KPart..." << endl;

            
         KParts::Factory* fac = static_cast<KParts::Factory*>( factory );
            
         part = static_cast<JargoPart*>( fac->createPart( workSpace, "name", this ) );
      }
}