summaryrefslogtreecommitdiffabout
path: root/microkde/kresources/factory.cpp
authorulf69 <ulf69>2004-08-02 18:15:04 (UTC)
committer ulf69 <ulf69>2004-08-02 18:15:04 (UTC)
commite084a79b8aa0174e7587893f9b87d88670ed9f2c (patch) (side-by-side diff)
treed3250447b9352effc8fb953866c772418c5e166c /microkde/kresources/factory.cpp
parentb4203356adb6008a4b4e6782afdae7dd34178697 (diff)
downloadkdepimpi-e084a79b8aa0174e7587893f9b87d88670ed9f2c.zip
kdepimpi-e084a79b8aa0174e7587893f9b87d88670ed9f2c.tar.gz
kdepimpi-e084a79b8aa0174e7587893f9b87d88670ed9f2c.tar.bz2
added support for the syncing of resources
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
@@ -39,7 +39,7 @@ using namespace KRES;
QDict<Factory> *Factory::mSelves = 0;
static KStaticDeleter< QDict<Factory> > staticDeleter;
-Factory *Factory::self( const QString& resourceFamily )
+Factory *Factory::self( const QString& resourceFamily)
{
@@ -52,14 +52,14 @@ Factory *Factory::self( const QString& resourceFamily )
factory = mSelves->find( resourceFamily );
if ( !factory ) {
- factory = new Factory( resourceFamily );
+ factory = new Factory( resourceFamily);
mSelves->insert( resourceFamily, factory );
}
return factory;
}
-Factory::Factory( const QString& resourceFamily ) :
+Factory::Factory( const QString& resourceFamily) :
mResourceFamily( resourceFamily )
{
//US so far we have three types available for resourceFamily "contact"
@@ -187,6 +187,40 @@ 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
{
if ( type.isEmpty() || !mTypeMap.contains( type ) )
@@ -211,7 +245,7 @@ QString Factory::typeDescription( const QString &type ) const
return pi->descriptionLabel;
}
-Resource *Factory::resource( const QString& type, const KConfig *config )
+Resource *Factory::resource( const QString& type, const KConfig *config, bool syncable )
{
@@ -242,7 +276,7 @@ Resource *Factory::resource( const QString& type, const KConfig *config )
return 0;
}
- Resource *resource = pluginFactory->resource( config );
+ Resource *resource = pluginFactory->resource( config, syncable );
if ( !resource ) {
//US kdDebug() << "'" << ptr->library() << "' is not a " + mResourceFamily + " plugin." << endl;
qDebug("%s is not a %s plugin.", pi->library.latin1(), mResourceFamily.latin1());