summaryrefslogtreecommitdiff
path: root/core/launcher/startmenu.cpp
Unidiff
Diffstat (limited to 'core/launcher/startmenu.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--core/launcher/startmenu.cpp17
1 files changed, 9 insertions, 8 deletions
diff --git a/core/launcher/startmenu.cpp b/core/launcher/startmenu.cpp
index 917f4c1..7373ea8 100644
--- a/core/launcher/startmenu.cpp
+++ b/core/launcher/startmenu.cpp
@@ -309,12 +309,13 @@ void StartMenu::loadApplets()
309 if ( safe && !safety_tid ) 309 if ( safe && !safety_tid )
310 return; 310 return;
311 cfg.writeEntry("SafeMode",TRUE); 311 cfg.writeEntry("SafeMode",TRUE);
312 cfg.write(); 312 cfg.write();
313 QStringList exclude = cfg.readListEntry( "ExcludeApplets", ',' ); 313 QStringList exclude = cfg.readListEntry( "ExcludeApplets", ',' );
314 314
315 QString lang = getenv( "LANG" );
315 QString path = QPEApplication::qpeDir() + "/plugins/applets"; 316 QString path = QPEApplication::qpeDir() + "/plugins/applets";
316 QDir dir( path, "lib*.so" ); 317 QDir dir( path, "lib*.so" );
317 QStringList list = dir.entryList(); 318 QStringList list = dir.entryList();
318 QStringList::Iterator it; 319 QStringList::Iterator it;
319 int napplets=0; 320 int napplets=0;
320 MenuApplet* *xapplets = new MenuApplet*[list.count()]; 321 MenuApplet* *xapplets = new MenuApplet*[list.count()];
@@ -325,12 +326,20 @@ void StartMenu::loadApplets()
325 QLibrary *lib = new QLibrary( path + "/" + *it ); 326 QLibrary *lib = new QLibrary( path + "/" + *it );
326 if (( lib->queryInterface( IID_MenuApplet, (QUnknownInterface**)&iface ) == QS_OK ) && iface ) { 327 if (( lib->queryInterface( IID_MenuApplet, (QUnknownInterface**)&iface ) == QS_OK ) && iface ) {
327 MenuApplet *applet = new MenuApplet; 328 MenuApplet *applet = new MenuApplet;
328 xapplets[napplets++] = applet; 329 xapplets[napplets++] = applet;
329 applet->library = lib; 330 applet->library = lib;
330 applet->iface = iface; 331 applet->iface = iface;
332
333 QTranslator *trans = new QTranslator(qApp);
334 QString type = (*it).left( (*it).find(".") );
335 QString tfn = QPEApplication::qpeDir()+"/i18n/"+lang+"/"+type+".qm";
336 if ( trans->load( tfn ))
337 qApp->installTranslator( trans );
338 else
339 delete trans;
331 } else { 340 } else {
332 exclude += *it; 341 exclude += *it;
333 delete lib; 342 delete lib;
334 } 343 }
335 } 344 }
336 cfg.writeEntry( "ExcludeApplets", exclude, ',' ); 345 cfg.writeEntry( "ExcludeApplets", exclude, ',' );
@@ -339,20 +348,12 @@ void StartMenu::loadApplets()
339 if ( sepId ) 348 if ( sepId )
340 launchMenu-> removeItem ( sepId ); 349 launchMenu-> removeItem ( sepId );
341 sepId = ( launchMenu-> count ( )) ? launchMenu-> insertSeparator ( ) : 0; 350 sepId = ( launchMenu-> count ( )) ? launchMenu-> insertSeparator ( ) : 0;
342 351
343 while (napplets--) { 352 while (napplets--) {
344 MenuApplet *applet = xapplets[napplets]; 353 MenuApplet *applet = xapplets[napplets];
345 QString lang = getenv( "LANG" );
346 QTranslator * trans = new QTranslator(qApp);
347 QString type = (*it).left( (*it).find(".") );
348 QString tfn = QPEApplication::qpeDir()+"/i18n/"+lang+"/"+type+".qm";
349 if ( trans->load( tfn ))
350 qApp->installTranslator( trans );
351 else
352 delete trans;
353 354
354 applet-> popup = applet-> iface-> popup ( this ); 355 applet-> popup = applet-> iface-> popup ( this );
355 356
356 if ( applet-> popup ) 357 if ( applet-> popup )
357 applet-> id = launchMenu-> insertItem ( applet-> iface-> icon ( ), applet-> iface-> text ( ), applet-> popup ); 358 applet-> id = launchMenu-> insertItem ( applet-> iface-> icon ( ), applet-> iface-> text ( ), applet-> popup );
358 else 359 else