-rw-r--r-- | noncore/settings/networksettings/mainwindow/mainwindowimp.cpp | 56 |
1 files changed, 13 insertions, 43 deletions
diff --git a/noncore/settings/networksettings/mainwindow/mainwindowimp.cpp b/noncore/settings/networksettings/mainwindow/mainwindowimp.cpp index a4a2875..fb7d7c9 100644 --- a/noncore/settings/networksettings/mainwindow/mainwindowimp.cpp +++ b/noncore/settings/networksettings/mainwindow/mainwindowimp.cpp @@ -57,8 +57,3 @@ MainWindowImp::MainWindowImp(QWidget *parent, const char *name, WFlags) : MainWi // /usr/local/kde/lib/libinterfaces.la -#ifdef QWS loadModules(QPEApplication::qpeDir() + "plugins/networksettings"); -#else - loader = KLibLoader::self(); - loadModules(QString("/usr/")+KStandardDirs::kde_default("lib")); -#endif getAllInterfaces(); @@ -148,3 +143,2 @@ MainWindowImp::~MainWindowImp() -#ifdef QWS // Delete Modules and Libraries @@ -158,5 +152,2 @@ MainWindowImp::~MainWindowImp() } -#else - // klibloader automaticly deletes the libraries for us... -#endif } @@ -286,2 +277,3 @@ void MainWindowImp::loadModules(const QString &path) + QString lang = ::getenv("LANG"); // Don't want sym links @@ -293,10 +285,13 @@ void MainWindowImp::loadModules(const QString &path) { -#ifdef QWS if(fi->fileName().contains(".so")) { -#else - if(fi->fileName().contains(".so") && fi->fileName().contains("networksettings_")) - { -#endif - loadPlugin(path + "/" + fi->fileName()); + /* if loaded install translation */ + if( loadPlugin(path + "/" + fi->fileName()) != 0l ){ + QTranslator *trans = new QTranslator(qApp); + QString fn = QPEApplication::qpeDir()+"/i18n/"+lang+"/"+ fi->fileName().left( fi->fileName().find(".") )+".qm"; + if( trans->load( fn ) ) + qApp->installTranslator( trans ); + else + delete trans; + } odebug << "loaded plugin: >" << QString(path + "/" + fi->fileName()).latin1() << "< " << oendl; @@ -318,3 +313,2 @@ Module* MainWindowImp::loadPlugin(const QString &pluginFileName, const QString & #endif -#ifdef QWS QLibrary *lib = new QLibrary(pluginFileName); @@ -327,3 +321,3 @@ Module* MainWindowImp::loadPlugin(const QString &pluginFileName, const QString & delete lib; - return NULL; + return 0; } @@ -331,3 +325,3 @@ Module* MainWindowImp::loadPlugin(const QString &pluginFileName, const QString & Module *object = ((Module* (*)()) functionPointer)(); - if(object == NULL) + if(object == 0) { @@ -337,3 +331,3 @@ Module* MainWindowImp::loadPlugin(const QString &pluginFileName, const QString & delete lib; - return NULL; + return 0; } @@ -344,26 +338,2 @@ Module* MainWindowImp::loadPlugin(const QString &pluginFileName, const QString & return object; - -#else - QLibrary *lib = loader->library(pluginFileName); - if( !lib || !lib->hasSymbol(resolveString) ) - { - odebug << QString("MainWindowImp::loadPlugin: File: %1 is not a plugin, but though was.").arg(pluginFileName).latin1() << oendl; - return NULL; - } - // Try to get an object. - Module *object = ((Module* (*)()) lib->symbol(resolveString))(); - if(object == NULL) - { -#ifdef DEBUG - odebug << "MainWindowImp: Couldn't create object, but did load library!" << oendl; -#endif - return NULL; - } -#ifdef DEBUG - odebug << "MainWindowImp::loadPlugin:: Found object, storing." << oendl; -#endif - // Store for deletion later - libraries.insert(object, lib); - return object; -#endif } |