author | zecke <zecke> | 2004-10-14 01:26:40 (UTC) |
---|---|---|
committer | zecke <zecke> | 2004-10-14 01:26:40 (UTC) |
commit | a1aed5edd5ccef77d79ccdd2d74f5c029d037617 (patch) (unidiff) | |
tree | 64f8342d651e968478df58d1a98db978e950b372 /noncore/settings/networksettings/mainwindow/mainwindowimp.cpp | |
parent | b17b6c77af35b610d236321279d3f18eb3060c90 (diff) | |
download | opie-a1aed5edd5ccef77d79ccdd2d74f5c029d037617.zip opie-a1aed5edd5ccef77d79ccdd2d74f5c029d037617.tar.gz opie-a1aed5edd5ccef77d79ccdd2d74f5c029d037617.tar.bz2 |
Old Patch from BRANCH 1.0 to install Translations of the Plugins
Diffstat (limited to 'noncore/settings/networksettings/mainwindow/mainwindowimp.cpp') (more/less context) (ignore whitespace changes)
-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 | |||
57 | // /usr/local/kde/lib/libinterfaces.la | 57 | // /usr/local/kde/lib/libinterfaces.la |
58 | #ifdef QWS | ||
59 | loadModules(QPEApplication::qpeDir() + "plugins/networksettings"); | 58 | loadModules(QPEApplication::qpeDir() + "plugins/networksettings"); |
60 | #else | ||
61 | loader = KLibLoader::self(); | ||
62 | loadModules(QString("/usr/")+KStandardDirs::kde_default("lib")); | ||
63 | #endif | ||
64 | getAllInterfaces(); | 59 | getAllInterfaces(); |
@@ -148,3 +143,2 @@ MainWindowImp::~MainWindowImp() | |||
148 | 143 | ||
149 | #ifdef QWS | ||
150 | // Delete Modules and Libraries | 144 | // Delete Modules and Libraries |
@@ -158,5 +152,2 @@ MainWindowImp::~MainWindowImp() | |||
158 | } | 152 | } |
159 | #else | ||
160 | // klibloader automaticly deletes the libraries for us... | ||
161 | #endif | ||
162 | } | 153 | } |
@@ -286,2 +277,3 @@ void MainWindowImp::loadModules(const QString &path) | |||
286 | 277 | ||
278 | QString lang = ::getenv("LANG"); | ||
287 | // Don't want sym links | 279 | // Don't want sym links |
@@ -293,10 +285,13 @@ void MainWindowImp::loadModules(const QString &path) | |||
293 | { | 285 | { |
294 | #ifdef QWS | ||
295 | if(fi->fileName().contains(".so")) | 286 | if(fi->fileName().contains(".so")) |
296 | { | 287 | { |
297 | #else | 288 | /* if loaded install translation */ |
298 | if(fi->fileName().contains(".so") && fi->fileName().contains("networksettings_")) | 289 | if( loadPlugin(path + "/" + fi->fileName()) != 0l ){ |
299 | { | 290 | QTranslator *trans = new QTranslator(qApp); |
300 | #endif | 291 | QString fn = QPEApplication::qpeDir()+"/i18n/"+lang+"/"+ fi->fileName().left( fi->fileName().find(".") )+".qm"; |
301 | loadPlugin(path + "/" + fi->fileName()); | 292 | if( trans->load( fn ) ) |
293 | qApp->installTranslator( trans ); | ||
294 | else | ||
295 | delete trans; | ||
296 | } | ||
302 | odebug << "loaded plugin: >" << QString(path + "/" + fi->fileName()).latin1() << "< " << oendl; | 297 | odebug << "loaded plugin: >" << QString(path + "/" + fi->fileName()).latin1() << "< " << oendl; |
@@ -318,3 +313,2 @@ Module* MainWindowImp::loadPlugin(const QString &pluginFileName, const QString & | |||
318 | #endif | 313 | #endif |
319 | #ifdef QWS | ||
320 | QLibrary *lib = new QLibrary(pluginFileName); | 314 | QLibrary *lib = new QLibrary(pluginFileName); |
@@ -327,3 +321,3 @@ Module* MainWindowImp::loadPlugin(const QString &pluginFileName, const QString & | |||
327 | delete lib; | 321 | delete lib; |
328 | return NULL; | 322 | return 0; |
329 | } | 323 | } |
@@ -331,3 +325,3 @@ Module* MainWindowImp::loadPlugin(const QString &pluginFileName, const QString & | |||
331 | Module *object = ((Module* (*)()) functionPointer)(); | 325 | Module *object = ((Module* (*)()) functionPointer)(); |
332 | if(object == NULL) | 326 | if(object == 0) |
333 | { | 327 | { |
@@ -337,3 +331,3 @@ Module* MainWindowImp::loadPlugin(const QString &pluginFileName, const QString & | |||
337 | delete lib; | 331 | delete lib; |
338 | return NULL; | 332 | return 0; |
339 | } | 333 | } |
@@ -344,26 +338,2 @@ Module* MainWindowImp::loadPlugin(const QString &pluginFileName, const QString & | |||
344 | return object; | 338 | return object; |
345 | |||
346 | #else | ||
347 | QLibrary *lib = loader->library(pluginFileName); | ||
348 | if( !lib || !lib->hasSymbol(resolveString) ) | ||
349 | { | ||
350 | odebug << QString("MainWindowImp::loadPlugin: File: %1 is not a plugin, but though was.").arg(pluginFileName).latin1() << oendl; | ||
351 | return NULL; | ||
352 | } | ||
353 | // Try to get an object. | ||
354 | Module *object = ((Module* (*)()) lib->symbol(resolveString))(); | ||
355 | if(object == NULL) | ||
356 | { | ||
357 | #ifdef DEBUG | ||
358 | odebug << "MainWindowImp: Couldn't create object, but did load library!" << oendl; | ||
359 | #endif | ||
360 | return NULL; | ||
361 | } | ||
362 | #ifdef DEBUG | ||
363 | odebug << "MainWindowImp::loadPlugin:: Found object, storing." << oendl; | ||
364 | #endif | ||
365 | // Store for deletion later | ||
366 | libraries.insert(object, lib); | ||
367 | return object; | ||
368 | #endif | ||
369 | } | 339 | } |