Diffstat (limited to 'microkde/kresources/factory.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | microkde/kresources/factory.cpp | 44 |
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 | |||
@@ -41,3 +41,3 @@ static KStaticDeleter< QDict<Factory> > staticDeleter; | |||
41 | 41 | ||
42 | Factory *Factory::self( const QString& resourceFamily ) | 42 | Factory *Factory::self( const QString& resourceFamily) |
43 | { | 43 | { |
@@ -54,3 +54,3 @@ Factory *Factory::self( const QString& resourceFamily ) | |||
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 ); |
@@ -61,3 +61,3 @@ Factory *Factory::self( const QString& resourceFamily ) | |||
61 | 61 | ||
62 | Factory::Factory( const QString& resourceFamily ) : | 62 | Factory::Factory( const QString& resourceFamily) : |
63 | mResourceFamily( resourceFamily ) | 63 | mResourceFamily( resourceFamily ) |
@@ -189,2 +189,36 @@ ConfigWidget *Factory::configWidget( const QString& type, QWidget *parent ) | |||
189 | 189 | ||
190 | SyncWidget *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 | |||
190 | QString Factory::typeName( const QString &type ) const | 224 | QString Factory::typeName( const QString &type ) const |
@@ -213,3 +247,3 @@ QString Factory::typeDescription( const QString &type ) const | |||
213 | 247 | ||
214 | Resource *Factory::resource( const QString& type, const KConfig *config ) | 248 | Resource *Factory::resource( const QString& type, const KConfig *config, bool syncable ) |
215 | { | 249 | { |
@@ -244,3 +278,3 @@ Resource *Factory::resource( const QString& type, const KConfig *config ) | |||
244 | 278 | ||
245 | Resource *resource = pluginFactory->resource( config ); | 279 | Resource *resource = pluginFactory->resource( config, syncable ); |
246 | if ( !resource ) { | 280 | if ( !resource ) { |