author | ulf69 <ulf69> | 2004-07-16 23:24:05 (UTC) |
---|---|---|
committer | ulf69 <ulf69> | 2004-07-16 23:24:05 (UTC) |
commit | b78f5351ef7432aae4104ed306b52975c91eacb0 (patch) (side-by-side diff) | |
tree | b1b797c79174da9265781f15406cb37f00f47fde | |
parent | 2670b9dec6a26a22eb6063b0f7837984c935c765 (diff) | |
download | kdepimpi-b78f5351ef7432aae4104ed306b52975c91eacb0.zip kdepimpi-b78f5351ef7432aae4104ed306b52975c91eacb0.tar.gz kdepimpi-b78f5351ef7432aae4104ed306b52975c91eacb0.tar.bz2 |
load sharp dtm plugin if the lib is available
-rw-r--r-- | microkde/kresources/factory.cpp | 54 |
1 files changed, 33 insertions, 21 deletions
diff --git a/microkde/kresources/factory.cpp b/microkde/kresources/factory.cpp index 2253de4..f82e94c 100644 --- a/microkde/kresources/factory.cpp +++ b/microkde/kresources/factory.cpp @@ -43,3 +43,3 @@ Factory *Factory::self( const QString& resourceFamily ) { - + @@ -56,3 +56,3 @@ Factory *Factory::self( const QString& resourceFamily ) mSelves->insert( resourceFamily, factory ); - } + } @@ -66,4 +66,4 @@ Factory::Factory( const QString& resourceFamily ) : // and that are "file", "dir", "ldap" -/*US - +/*US + KTrader::OfferList plugins = KTrader::self()->query( "KResources/Plugin", QString( "[X-KDE-ResourceFamily] == '%1'" ) @@ -76,5 +76,5 @@ Factory::Factory( const QString& resourceFamily ) : } -*/ +*/ -//US new +//US new PluginInfo* info = new PluginInfo; @@ -90,3 +90,3 @@ Factory::Factory( const QString& resourceFamily ) : mTypeMap.insert( "dir", info ); - + info = new PluginInfo; @@ -97,3 +97,3 @@ Factory::Factory( const QString& resourceFamily ) : - //US add opie plugin only, if the library exists + //US add opie plugin only, if the library exists. QString libname = "microkabc_opie"; @@ -109,3 +109,3 @@ Factory::Factory( const QString& resourceFamily ) : - //US add qtopia plugin only, if the library exists + //US add qtopia plugin only, if the library exists. libname = "microkabc_qtopia"; @@ -120,3 +120,15 @@ Factory::Factory( const QString& resourceFamily ) : } - + + //US add sharp plugin only, if the library exists. + libname = "microkabc_sharpdtm"; + path = KLibLoader::findLibrary( QFile::encodeName( libname ) ); + if ( !path.isEmpty() ) + { + info = new PluginInfo; + info->library = libname; + info->nameLabel = i18n( "sharp" ); + info->descriptionLabel = i18n( "Sharp DTM Addressbook." ); + mTypeMap.insert( "sharp", info ); + } + @@ -132,5 +144,5 @@ QStringList Factory::typeNames() const //US return mTypeMap.keys(); - + QStringList result; - + QMap<QString, PluginInfo*>::ConstIterator it; @@ -174,3 +186,3 @@ ConfigWidget *Factory::configWidget( const QString& type, QWidget *parent ) return wdg; - + } @@ -182,3 +194,3 @@ QString Factory::typeName( const QString &type ) const - + //US KService::Ptr ptr = mTypeMap[ type ]; @@ -187,3 +199,3 @@ QString Factory::typeName( const QString &type ) const return pi->nameLabel; - + } @@ -203,3 +215,3 @@ Resource *Factory::resource( const QString& type, const KConfig *config ) { - + @@ -208,3 +220,3 @@ Resource *Factory::resource( const QString& type, const KConfig *config ) -/*US load the lib not dynamicly. !! +/*US load the lib not dynamicly. !! KService::Ptr ptr = mTypeMap[ type ]; @@ -223,3 +235,3 @@ Resource *Factory::resource( const QString& type, const KConfig *config ) } - + PluginFactoryBase *pluginFactory = static_cast<PluginFactoryBase *>( factory ); @@ -231,5 +243,5 @@ Resource *Factory::resource( const QString& type, const KConfig *config ) } - + Resource *resource = pluginFactory->resource( config ); - if ( !resource ) { + if ( !resource ) { //US kdDebug() << "'" << ptr->library() << "' is not a " + mResourceFamily + " plugin." << endl; @@ -240,3 +252,3 @@ Resource *Factory::resource( const QString& type, const KConfig *config ) resource->setType( type ); - + return resource; |