Diffstat (limited to 'microkde/kresources/factory.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | microkde/kresources/factory.cpp | 38 |
1 files changed, 2 insertions, 36 deletions
diff --git a/microkde/kresources/factory.cpp b/microkde/kresources/factory.cpp index e44fce3..4e4456d 100644 --- a/microkde/kresources/factory.cpp +++ b/microkde/kresources/factory.cpp | |||
@@ -178,83 +178,49 @@ ConfigWidget *Factory::configWidget( const QString& type, QWidget *parent ) | |||
178 | } | 178 | } |
179 | 179 | ||
180 | ConfigWidget *wdg = pluginFactory->configWidget( parent ); | 180 | ConfigWidget *wdg = pluginFactory->configWidget( parent ); |
181 | if ( !wdg ) { | 181 | if ( !wdg ) { |
182 | //US kdDebug() << "'" << ptr->library() << "' is not a " + mResourceFamily + " plugin." << endl; | 182 | //US kdDebug() << "'" << ptr->library() << "' is not a " + mResourceFamily + " plugin." << endl; |
183 | qDebug("%s is not a %s plugin.", pi->library.latin1(), mResourceFamily.latin1()); | 183 | qDebug("%s is not a %s plugin.", pi->library.latin1(), mResourceFamily.latin1()); |
184 | return 0; | 184 | return 0; |
185 | } | 185 | } |
186 | return wdg; | 186 | return wdg; |
187 | 187 | ||
188 | } | 188 | } |
189 | 189 | ||
190 | SyncWidgetContainer *Factory::syncWidgetContainer( const QString& type ) | ||
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 | SyncWidgetContainer *wdg = pluginFactory->syncWidgetContainer( ); | ||
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 | |||
224 | QString Factory::typeName( const QString &type ) const | 190 | QString Factory::typeName( const QString &type ) const |
225 | { | 191 | { |
226 | if ( type.isEmpty() || !mTypeMap.contains( type ) ) | 192 | if ( type.isEmpty() || !mTypeMap.contains( type ) ) |
227 | return QString(); | 193 | return QString(); |
228 | 194 | ||
229 | 195 | ||
230 | //US KService::Ptr ptr = mTypeMap[ type ]; | 196 | //US KService::Ptr ptr = mTypeMap[ type ]; |
231 | //US return ptr->name(); | 197 | //US return ptr->name(); |
232 | PluginInfo* pi = mTypeMap[ type ]; | 198 | PluginInfo* pi = mTypeMap[ type ]; |
233 | return pi->nameLabel; | 199 | return pi->nameLabel; |
234 | 200 | ||
235 | } | 201 | } |
236 | 202 | ||
237 | QString Factory::typeDescription( const QString &type ) const | 203 | QString Factory::typeDescription( const QString &type ) const |
238 | { | 204 | { |
239 | if ( type.isEmpty() || !mTypeMap.contains( type ) ) | 205 | if ( type.isEmpty() || !mTypeMap.contains( type ) ) |
240 | return QString(); | 206 | return QString(); |
241 | 207 | ||
242 | //US KService::Ptr ptr = mTypeMap[ type ]; | 208 | //US KService::Ptr ptr = mTypeMap[ type ]; |
243 | //US return ptr->comment(); | 209 | //US return ptr->comment(); |
244 | PluginInfo* pi = mTypeMap[ type ]; | 210 | PluginInfo* pi = mTypeMap[ type ]; |
245 | return pi->descriptionLabel; | 211 | return pi->descriptionLabel; |
246 | } | 212 | } |
247 | 213 | ||
248 | Resource *Factory::resource( const QString& type, const KConfig *config, bool syncable ) | 214 | Resource *Factory::resource( const QString& type, const KConfig *config ) |
249 | { | 215 | { |
250 | 216 | ||
251 | 217 | ||
252 | if ( type.isEmpty() || !mTypeMap.contains( type ) ) | 218 | if ( type.isEmpty() || !mTypeMap.contains( type ) ) |
253 | return 0; | 219 | return 0; |
254 | 220 | ||
255 | /*US load the lib not dynamicly. !! | 221 | /*US load the lib not dynamicly. !! |
256 | KService::Ptr ptr = mTypeMap[ type ]; | 222 | KService::Ptr ptr = mTypeMap[ type ]; |
257 | KLibFactory *factory = KLibLoader::self()->factory( ptr->library().latin1() ); | 223 | KLibFactory *factory = KLibLoader::self()->factory( ptr->library().latin1() ); |
258 | if ( !factory ) { | 224 | if ( !factory ) { |
259 | kdDebug() << "KRES::Factory::resource(): Factory creation failed" << endl; | 225 | kdDebug() << "KRES::Factory::resource(): Factory creation failed" << endl; |
260 | return 0; | 226 | return 0; |
@@ -267,23 +233,23 @@ Resource *Factory::resource( const QString& type, const KConfig *config, bool sy | |||
267 | kdDebug() << "KRES::Factory::resource(): Factory creation failed" << endl; | 233 | kdDebug() << "KRES::Factory::resource(): Factory creation failed" << endl; |
268 | return 0; | 234 | return 0; |
269 | } | 235 | } |
270 | 236 | ||
271 | PluginFactoryBase *pluginFactory = static_cast<PluginFactoryBase *>( factory ); | 237 | PluginFactoryBase *pluginFactory = static_cast<PluginFactoryBase *>( factory ); |
272 | 238 | ||
273 | if ( !pluginFactory ) { | 239 | if ( !pluginFactory ) { |
274 | qDebug("KRES::Factory::resource(): no plugin factory for library %s", pi->library.latin1()); | 240 | qDebug("KRES::Factory::resource(): no plugin factory for library %s", pi->library.latin1()); |
275 | kdDebug() << "KRES::Factory::resource(): no plugin factory." << endl; | 241 | kdDebug() << "KRES::Factory::resource(): no plugin factory." << endl; |
276 | return 0; | 242 | return 0; |
277 | } | 243 | } |
278 | 244 | ||
279 | Resource *resource = pluginFactory->resource( config, syncable ); | 245 | Resource *resource = pluginFactory->resource( config ); |
280 | if ( !resource ) { | 246 | if ( !resource ) { |
281 | //US kdDebug() << "'" << ptr->library() << "' is not a " + mResourceFamily + " plugin." << endl; | 247 | //US kdDebug() << "'" << ptr->library() << "' is not a " + mResourceFamily + " plugin." << endl; |
282 | qDebug("%s is not a %s plugin.", pi->library.latin1(), mResourceFamily.latin1()); | 248 | qDebug("%s is not a %s plugin.", pi->library.latin1(), mResourceFamily.latin1()); |
283 | return 0; | 249 | return 0; |
284 | } | 250 | } |
285 | 251 | ||
286 | resource->setType( type ); | 252 | resource->setType( type ); |
287 | 253 | ||
288 | return resource; | 254 | return resource; |
289 | } | 255 | } |