summaryrefslogtreecommitdiff
path: root/noncore/settings/networksettings/mainwindow/mainwindowimp.cpp
Unidiff
Diffstat (limited to 'noncore/settings/networksettings/mainwindow/mainwindowimp.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/networksettings/mainwindow/mainwindowimp.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/noncore/settings/networksettings/mainwindow/mainwindowimp.cpp b/noncore/settings/networksettings/mainwindow/mainwindowimp.cpp
index fb7d7c9..5f23aea 100644
--- a/noncore/settings/networksettings/mainwindow/mainwindowimp.cpp
+++ b/noncore/settings/networksettings/mainwindow/mainwindowimp.cpp
@@ -243,97 +243,97 @@ void MainWindowImp::getAllInterfaces()
243 } 243 }
244 // now lets ask the plugins too ;) 244 // now lets ask the plugins too ;)
245 QMap<Module*, QLibrary*>::Iterator it; 245 QMap<Module*, QLibrary*>::Iterator it;
246 QList<Interface> ilist; 246 QList<Interface> ilist;
247 for( it = libraries.begin(); it != libraries.end(); ++it ) 247 for( it = libraries.begin(); it != libraries.end(); ++it )
248 { 248 {
249 if(it.key()) 249 if(it.key())
250 { 250 {
251 ilist = it.key()->getInterfaces(); 251 ilist = it.key()->getInterfaces();
252 for( i = ilist.first(); i != 0; i = ilist.next() ) 252 for( i = ilist.first(); i != 0; i = ilist.next() )
253 { 253 {
254 owarn << "Adding interface " << i->getInterfaceName().latin1() << " to interfaceNames\n" << oendl; 254 owarn << "Adding interface " << i->getInterfaceName().latin1() << " to interfaceNames\n" << oendl;
255 interfaceNames.insert(i->getInterfaceName(), i); 255 interfaceNames.insert(i->getInterfaceName(), i);
256 updateInterface(i); 256 updateInterface(i);
257 connect(i, SIGNAL(updateInterface(Interface*)), 257 connect(i, SIGNAL(updateInterface(Interface*)),
258 this, SLOT(updateInterface(Interface*))); 258 this, SLOT(updateInterface(Interface*)));
259 } 259 }
260 } 260 }
261 } 261 }
262} 262}
263 263
264/** 264/**
265 * Load all modules that are found in the path 265 * Load all modules that are found in the path
266 * @param path a directory that is scaned for any plugins that can be loaded 266 * @param path a directory that is scaned for any plugins that can be loaded
267 * and attempts to load them 267 * and attempts to load them
268 */ 268 */
269void MainWindowImp::loadModules(const QString &path) 269void MainWindowImp::loadModules(const QString &path)
270{ 270{
271#ifdef DEBUG 271#ifdef DEBUG
272 odebug << "MainWindowImp::loadModules: " << path.latin1() << "" << oendl; 272 odebug << "MainWindowImp::loadModules: " << path.latin1() << "" << oendl;
273#endif 273#endif
274 QDir d(path); 274 QDir d(path);
275 if(!d.exists()) 275 if(!d.exists())
276 return; 276 return;
277 277
278 QString lang = ::getenv("LANG"); 278 QString lang = ::getenv("LANG");
279 // Don't want sym links 279 // Don't want sym links
280 d.setFilter( QDir::Files | QDir::NoSymLinks ); 280 d.setFilter( QDir::Files | QDir::NoSymLinks );
281 const QFileInfoList *list = d.entryInfoList(); 281 const QFileInfoList *list = d.entryInfoList();
282 QFileInfoListIterator it( *list ); 282 QFileInfoListIterator it( *list );
283 QFileInfo *fi; 283 QFileInfo *fi;
284 while ( (fi=it.current()) ) 284 while ( (fi=it.current()) )
285 { 285 {
286 if(fi->fileName().contains(".so")) 286 if(fi->fileName().contains(".so"))
287 { 287 {
288 /* if loaded install translation */ 288 /* if loaded install translation */
289 if( loadPlugin(path + "/" + fi->fileName()) != 0l ){ 289 if( loadPlugin(path + "/" + fi->fileName()) != 0l ){
290 QTranslator *trans = new QTranslator(qApp); 290 QTranslator *trans = new QTranslator(qApp);
291 QString fn = QPEApplication::qpeDir()+"/i18n/"+lang+"/"+ fi->fileName().left( fi->fileName().find(".") )+".qm"; 291 QString fn = QPEApplication::qpeDir()+"i18n/"+lang+"/"+ fi->fileName().left( fi->fileName().find(".") )+".qm";
292 if( trans->load( fn ) ) 292 if( trans->load( fn ) )
293 qApp->installTranslator( trans ); 293 qApp->installTranslator( trans );
294 else 294 else
295 delete trans; 295 delete trans;
296 } 296 }
297 odebug << "loaded plugin: >" << QString(path + "/" + fi->fileName()).latin1() << "< " << oendl; 297 odebug << "loaded plugin: >" << QString(path + "/" + fi->fileName()).latin1() << "< " << oendl;
298 } 298 }
299 ++it; 299 ++it;
300 } 300 }
301} 301}
302 302
303/** 303/**
304 * Attempt to load a function and resolve a function. 304 * Attempt to load a function and resolve a function.
305 * @param pluginFileName - the name of the file in which to attempt to load 305 * @param pluginFileName - the name of the file in which to attempt to load
306 * @param resolveString - function pointer to resolve 306 * @param resolveString - function pointer to resolve
307 * @return pointer to the function with name resolveString or NULL 307 * @return pointer to the function with name resolveString or NULL
308 */ 308 */
309Module* MainWindowImp::loadPlugin(const QString &pluginFileName, const QString &resolveString) 309Module* MainWindowImp::loadPlugin(const QString &pluginFileName, const QString &resolveString)
310{ 310{
311#ifdef DEBUG 311#ifdef DEBUG
312 odebug << "MainWindowImp::loadPlugin: " << pluginFileName.latin1() << ": resolving " << resolveString.latin1() << "" << oendl; 312 odebug << "MainWindowImp::loadPlugin: " << pluginFileName.latin1() << ": resolving " << resolveString.latin1() << "" << oendl;
313#endif 313#endif
314 QLibrary *lib = new QLibrary(pluginFileName); 314 QLibrary *lib = new QLibrary(pluginFileName);
315 void *functionPointer = lib->resolve(resolveString); 315 void *functionPointer = lib->resolve(resolveString);
316 if( !functionPointer ) 316 if( !functionPointer )
317 { 317 {
318#ifdef DEBUG 318#ifdef DEBUG
319 odebug << "MainWindowImp::loadPlugin: Warning: " << pluginFileName.latin1() << " is not a plugin" << oendl; 319 odebug << "MainWindowImp::loadPlugin: Warning: " << pluginFileName.latin1() << " is not a plugin" << oendl;
320#endif 320#endif
321 delete lib; 321 delete lib;
322 return 0; 322 return 0;
323 } 323 }
324 // Try to get an object. 324 // Try to get an object.
325 Module *object = ((Module* (*)()) functionPointer)(); 325 Module *object = ((Module* (*)()) functionPointer)();
326 if(object == 0) 326 if(object == 0)
327 { 327 {
328#ifdef DEBUG 328#ifdef DEBUG
329 odebug << "MainWindowImp: Couldn't create object, but did load library!" << oendl; 329 odebug << "MainWindowImp: Couldn't create object, but did load library!" << oendl;
330#endif 330#endif
331 delete lib; 331 delete lib;
332 return 0; 332 return 0;
333 } 333 }
334 334
335 m_handledIfaces += object->handledInterfaceNames(); 335 m_handledIfaces += object->handledInterfaceNames();
336 // Store for deletion later 336 // Store for deletion later
337 libraries.insert(object, lib); 337 libraries.insert(object, lib);
338 return object; 338 return object;
339} 339}