author | ulf69 <ulf69> | 2004-07-16 23:24:05 (UTC) |
---|---|---|
committer | ulf69 <ulf69> | 2004-07-16 23:24:05 (UTC) |
commit | b78f5351ef7432aae4104ed306b52975c91eacb0 (patch) (unidiff) | |
tree | b1b797c79174da9265781f15406cb37f00f47fde /microkde | |
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 ) | |||
43 | { | 43 | { |
44 | 44 | ||
45 | 45 | ||
@@ -56,3 +56,3 @@ Factory *Factory::self( const QString& resourceFamily ) | |||
56 | mSelves->insert( resourceFamily, factory ); | 56 | mSelves->insert( resourceFamily, factory ); |
57 | } | 57 | } |
58 | 58 | ||
@@ -66,4 +66,4 @@ Factory::Factory( const QString& resourceFamily ) : | |||
66 | // and that are "file", "dir", "ldap" | 66 | // and that are "file", "dir", "ldap" |
67 | /*US | 67 | /*US |
68 | 68 | ||
69 | KTrader::OfferList plugins = KTrader::self()->query( "KResources/Plugin", QString( "[X-KDE-ResourceFamily] == '%1'" ) | 69 | KTrader::OfferList plugins = KTrader::self()->query( "KResources/Plugin", QString( "[X-KDE-ResourceFamily] == '%1'" ) |
@@ -76,5 +76,5 @@ Factory::Factory( const QString& resourceFamily ) : | |||
76 | } | 76 | } |
77 | */ | 77 | */ |
78 | 78 | ||
79 | //US new | 79 | //US new |
80 | PluginInfo* info = new PluginInfo; | 80 | PluginInfo* info = new PluginInfo; |
@@ -90,3 +90,3 @@ Factory::Factory( const QString& resourceFamily ) : | |||
90 | mTypeMap.insert( "dir", info ); | 90 | mTypeMap.insert( "dir", info ); |
91 | 91 | ||
92 | info = new PluginInfo; | 92 | info = new PluginInfo; |
@@ -97,3 +97,3 @@ Factory::Factory( const QString& resourceFamily ) : | |||
97 | 97 | ||
98 | //US add opie plugin only, if the library exists | 98 | //US add opie plugin only, if the library exists. |
99 | QString libname = "microkabc_opie"; | 99 | QString libname = "microkabc_opie"; |
@@ -109,3 +109,3 @@ Factory::Factory( const QString& resourceFamily ) : | |||
109 | 109 | ||
110 | //US add qtopia plugin only, if the library exists | 110 | //US add qtopia plugin only, if the library exists. |
111 | libname = "microkabc_qtopia"; | 111 | libname = "microkabc_qtopia"; |
@@ -120,3 +120,15 @@ Factory::Factory( const QString& resourceFamily ) : | |||
120 | } | 120 | } |
121 | 121 | ||
122 | //US add sharp plugin only, if the library exists. | ||
123 | libname = "microkabc_sharpdtm"; | ||
124 | path = KLibLoader::findLibrary( QFile::encodeName( libname ) ); | ||
125 | if ( !path.isEmpty() ) | ||
126 | { | ||
127 | info = new PluginInfo; | ||
128 | info->library = libname; | ||
129 | info->nameLabel = i18n( "sharp" ); | ||
130 | info->descriptionLabel = i18n( "Sharp DTM Addressbook." ); | ||
131 | mTypeMap.insert( "sharp", info ); | ||
132 | } | ||
133 | |||
122 | 134 | ||
@@ -132,5 +144,5 @@ QStringList Factory::typeNames() const | |||
132 | //US return mTypeMap.keys(); | 144 | //US return mTypeMap.keys(); |
133 | 145 | ||
134 | QStringList result; | 146 | QStringList result; |
135 | 147 | ||
136 | QMap<QString, PluginInfo*>::ConstIterator it; | 148 | QMap<QString, PluginInfo*>::ConstIterator it; |
@@ -174,3 +186,3 @@ ConfigWidget *Factory::configWidget( const QString& type, QWidget *parent ) | |||
174 | return wdg; | 186 | return wdg; |
175 | 187 | ||
176 | } | 188 | } |
@@ -182,3 +194,3 @@ QString Factory::typeName( const QString &type ) const | |||
182 | 194 | ||
183 | 195 | ||
184 | //US KService::Ptr ptr = mTypeMap[ type ]; | 196 | //US KService::Ptr ptr = mTypeMap[ type ]; |
@@ -187,3 +199,3 @@ QString Factory::typeName( const QString &type ) const | |||
187 | return pi->nameLabel; | 199 | return pi->nameLabel; |
188 | 200 | ||
189 | } | 201 | } |
@@ -203,3 +215,3 @@ Resource *Factory::resource( const QString& type, const KConfig *config ) | |||
203 | { | 215 | { |
204 | 216 | ||
205 | 217 | ||
@@ -208,3 +220,3 @@ Resource *Factory::resource( const QString& type, const KConfig *config ) | |||
208 | 220 | ||
209 | /*US load the lib not dynamicly. !! | 221 | /*US load the lib not dynamicly. !! |
210 | KService::Ptr ptr = mTypeMap[ type ]; | 222 | KService::Ptr ptr = mTypeMap[ type ]; |
@@ -223,3 +235,3 @@ Resource *Factory::resource( const QString& type, const KConfig *config ) | |||
223 | } | 235 | } |
224 | 236 | ||
225 | PluginFactoryBase *pluginFactory = static_cast<PluginFactoryBase *>( factory ); | 237 | PluginFactoryBase *pluginFactory = static_cast<PluginFactoryBase *>( factory ); |
@@ -231,5 +243,5 @@ Resource *Factory::resource( const QString& type, const KConfig *config ) | |||
231 | } | 243 | } |
232 | 244 | ||
233 | Resource *resource = pluginFactory->resource( config ); | 245 | Resource *resource = pluginFactory->resource( config ); |
234 | if ( !resource ) { | 246 | if ( !resource ) { |
235 | //US kdDebug() << "'" << ptr->library() << "' is not a " + mResourceFamily + " plugin." << endl; | 247 | //US kdDebug() << "'" << ptr->library() << "' is not a " + mResourceFamily + " plugin." << endl; |
@@ -240,3 +252,3 @@ Resource *Factory::resource( const QString& type, const KConfig *config ) | |||
240 | resource->setType( type ); | 252 | resource->setType( type ); |
241 | 253 | ||
242 | return resource; | 254 | return resource; |