summaryrefslogtreecommitdiffabout
path: root/microkde/kresources/factory.cpp
Unidiff
Diffstat (limited to 'microkde/kresources/factory.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--microkde/kresources/factory.cpp44
1 files changed, 39 insertions, 5 deletions
diff --git a/microkde/kresources/factory.cpp b/microkde/kresources/factory.cpp
index f82e94c..7a5c2f6 100644
--- a/microkde/kresources/factory.cpp
+++ b/microkde/kresources/factory.cpp
@@ -40,5 +40,5 @@ QDict<Factory> *Factory::mSelves = 0;
40static KStaticDeleter< QDict<Factory> > staticDeleter; 40static KStaticDeleter< QDict<Factory> > staticDeleter;
41 41
42Factory *Factory::self( const QString& resourceFamily ) 42Factory *Factory::self( const QString& resourceFamily)
43{ 43{
44 44
@@ -53,5 +53,5 @@ Factory *Factory::self( const QString& resourceFamily )
53 53
54 if ( !factory ) { 54 if ( !factory ) {
55 factory = new Factory( resourceFamily ); 55 factory = new Factory( resourceFamily);
56 mSelves->insert( resourceFamily, factory ); 56 mSelves->insert( resourceFamily, factory );
57 } 57 }
@@ -60,5 +60,5 @@ Factory *Factory::self( const QString& resourceFamily )
60} 60}
61 61
62Factory::Factory( const QString& resourceFamily ) : 62Factory::Factory( const QString& resourceFamily) :
63 mResourceFamily( resourceFamily ) 63 mResourceFamily( resourceFamily )
64{ 64{
@@ -188,4 +188,38 @@ ConfigWidget *Factory::configWidget( const QString& type, QWidget *parent )
188} 188}
189 189
190SyncWidget *Factory::syncWidget( const QString& type, QWidget *parent )
191{
192 if ( type.isEmpty() || !mTypeMap.contains( type ) )
193 return 0;
194
195//US KService::Ptr ptr = mTypeMap[ type ];
196//US KLibFactory *factory = KLibLoader::self()->factory( ptr->library().latin1() );
197 PluginInfo* pi = mTypeMap[ type ];
198 KLibFactory *factory = (KLibFactory *)KLibLoader::self()->factory( pi->library.latin1() );
199 if ( !factory ) {
200 qDebug("KRES::Factory::syncWidget(): Factory creation failed for library %s", pi->library.latin1());
201 kdDebug() << "KRES::Factory::syncWidget(): Factory creation failed" << endl;
202 return 0;
203 }
204
205 PluginFactoryBase *pluginFactory = static_cast<PluginFactoryBase *>( factory );
206
207 if ( !pluginFactory ) {
208 qDebug("KRES::Factory::syncWidget(): no plugin factory for library %s", pi->library.latin1());
209 kdDebug() << "KRES::Factory::syncWidget(): no plugin factory." << endl;
210 return 0;
211 }
212
213 SyncWidget *wdg = pluginFactory->syncWidget( parent );
214 if ( !wdg ) {
215//US kdDebug() << "'" << ptr->library() << "' is not a " + mResourceFamily + " plugin." << endl;
216 qDebug("%s is not a %s plugin.", pi->library.latin1(), mResourceFamily.latin1());
217 return 0;
218 }
219 return wdg;
220
221}
222
223
190QString Factory::typeName( const QString &type ) const 224QString Factory::typeName( const QString &type ) const
191{ 225{
@@ -212,5 +246,5 @@ QString Factory::typeDescription( const QString &type ) const
212} 246}
213 247
214Resource *Factory::resource( const QString& type, const KConfig *config ) 248Resource *Factory::resource( const QString& type, const KConfig *config, bool syncable )
215{ 249{
216 250
@@ -243,5 +277,5 @@ Resource *Factory::resource( const QString& type, const KConfig *config )
243 } 277 }
244 278
245 Resource *resource = pluginFactory->resource( config ); 279 Resource *resource = pluginFactory->resource( config, syncable );
246 if ( !resource ) { 280 if ( !resource ) {
247//US kdDebug() << "'" << ptr->library() << "' is not a " + mResourceFamily + " plugin." << endl; 281//US kdDebug() << "'" << ptr->library() << "' is not a " + mResourceFamily + " plugin." << endl;