summaryrefslogtreecommitdiffabout
path: root/microkde/kresources/factory.cpp
Side-by-side diff
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;
static KStaticDeleter< QDict<Factory> > staticDeleter;
-Factory *Factory::self( const QString& resourceFamily )
+Factory *Factory::self( const QString& resourceFamily)
{
@@ -53,5 +53,5 @@ Factory *Factory::self( const QString& resourceFamily )
if ( !factory ) {
- factory = new Factory( resourceFamily );
+ factory = new Factory( resourceFamily);
mSelves->insert( resourceFamily, factory );
}
@@ -60,5 +60,5 @@ Factory *Factory::self( const QString& resourceFamily )
}
-Factory::Factory( const QString& resourceFamily ) :
+Factory::Factory( const QString& resourceFamily) :
mResourceFamily( resourceFamily )
{
@@ -188,4 +188,38 @@ ConfigWidget *Factory::configWidget( const QString& type, QWidget *parent )
}
+SyncWidget *Factory::syncWidget( const QString& type, QWidget *parent )
+{
+ if ( type.isEmpty() || !mTypeMap.contains( type ) )
+ return 0;
+
+//US KService::Ptr ptr = mTypeMap[ type ];
+//US KLibFactory *factory = KLibLoader::self()->factory( ptr->library().latin1() );
+ PluginInfo* pi = mTypeMap[ type ];
+ KLibFactory *factory = (KLibFactory *)KLibLoader::self()->factory( pi->library.latin1() );
+ if ( !factory ) {
+ qDebug("KRES::Factory::syncWidget(): Factory creation failed for library %s", pi->library.latin1());
+ kdDebug() << "KRES::Factory::syncWidget(): Factory creation failed" << endl;
+ return 0;
+ }
+
+ PluginFactoryBase *pluginFactory = static_cast<PluginFactoryBase *>( factory );
+
+ if ( !pluginFactory ) {
+ qDebug("KRES::Factory::syncWidget(): no plugin factory for library %s", pi->library.latin1());
+ kdDebug() << "KRES::Factory::syncWidget(): no plugin factory." << endl;
+ return 0;
+ }
+
+ SyncWidget *wdg = pluginFactory->syncWidget( parent );
+ if ( !wdg ) {
+//US kdDebug() << "'" << ptr->library() << "' is not a " + mResourceFamily + " plugin." << endl;
+ qDebug("%s is not a %s plugin.", pi->library.latin1(), mResourceFamily.latin1());
+ return 0;
+ }
+ return wdg;
+
+}
+
+
QString Factory::typeName( const QString &type ) const
{
@@ -212,5 +246,5 @@ QString Factory::typeDescription( const QString &type ) const
}
-Resource *Factory::resource( const QString& type, const KConfig *config )
+Resource *Factory::resource( const QString& type, const KConfig *config, bool syncable )
{
@@ -243,5 +277,5 @@ Resource *Factory::resource( const QString& type, const KConfig *config )
}
- Resource *resource = pluginFactory->resource( config );
+ Resource *resource = pluginFactory->resource( config, syncable );
if ( !resource ) {
//US kdDebug() << "'" << ptr->library() << "' is not a " + mResourceFamily + " plugin." << endl;