-rw-r--r-- | core/launcher/startmenu.cpp | 17 | ||||
-rw-r--r-- | core/launcher/systray.cpp | 17 |
2 files changed, 18 insertions, 16 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 | |||
@@ -299,70 +299,71 @@ void StartMenu::clearApplets() | |||
299 | 299 | ||
300 | void StartMenu::loadApplets() | 300 | void StartMenu::loadApplets() |
301 | { | 301 | { |
302 | Config cfg( "StartMenu" ); | 302 | Config cfg( "StartMenu" ); |
303 | cfg.setGroup( "Applets" ); | 303 | cfg.setGroup( "Applets" ); |
304 | 304 | ||
305 | // SafeMode causes too much problems, so we disable it for now -- | 305 | // SafeMode causes too much problems, so we disable it for now -- |
306 | // maybe we should reenable it for OPIE 1.0 - sandman 26.09.02 | 306 | // maybe we should reenable it for OPIE 1.0 - sandman 26.09.02 |
307 | 307 | ||
308 | bool safe = false; //cfg.readBoolEntry("SafeMode",FALSE); | 308 | bool safe = false; //cfg.readBoolEntry("SafeMode",FALSE); |
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()]; |
321 | for ( it = list.begin(); it != list.end(); ++it ) { | 322 | for ( it = list.begin(); it != list.end(); ++it ) { |
322 | if ( exclude.find( *it ) != exclude.end() ) | 323 | if ( exclude.find( *it ) != exclude.end() ) |
323 | continue; | 324 | continue; |
324 | MenuAppletInterface *iface = 0; | 325 | MenuAppletInterface *iface = 0; |
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, ',' ); |
337 | qsort(xapplets,napplets,sizeof(applets[0]),compareAppletPositions); | 346 | qsort(xapplets,napplets,sizeof(applets[0]),compareAppletPositions); |
338 | 347 | ||
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 |
359 | applet-> id = launchMenu-> insertItem ( applet-> iface-> icon ( ), applet-> iface-> text ( ) ); | 360 | applet-> id = launchMenu-> insertItem ( applet-> iface-> icon ( ), applet-> iface-> text ( ) ); |
360 | applets.insert ( applet-> id, new MenuApplet(*applet)); | 361 | applets.insert ( applet-> id, new MenuApplet(*applet)); |
361 | } | 362 | } |
362 | delete xapplets; | 363 | delete xapplets; |
363 | 364 | ||
364 | if ( sepId && ( launchMenu-> idAt ( launchMenu-> count ( ) - 1 ) == sepId )) { // no applets | 365 | if ( sepId && ( launchMenu-> idAt ( launchMenu-> count ( ) - 1 ) == sepId )) { // no applets |
365 | launchMenu-> removeItem ( sepId ); | 366 | launchMenu-> removeItem ( sepId ); |
366 | sepId = 0; | 367 | sepId = 0; |
367 | } | 368 | } |
368 | if ( !launchMenu-> count ( )) // if we don't do this QPopupMenu will insert a dummy Separator, which won't go away later | 369 | if ( !launchMenu-> count ( )) // if we don't do this QPopupMenu will insert a dummy Separator, which won't go away later |
diff --git a/core/launcher/systray.cpp b/core/launcher/systray.cpp index 406c662..4859e48 100644 --- a/core/launcher/systray.cpp +++ b/core/launcher/systray.cpp | |||
@@ -78,67 +78,68 @@ void SysTray::clearApplets() | |||
78 | void SysTray::addApplets() | 78 | void SysTray::addApplets() |
79 | { | 79 | { |
80 | #ifndef SINGLE_APP | 80 | #ifndef SINGLE_APP |
81 | Config cfg( "Taskbar" ); | 81 | Config cfg( "Taskbar" ); |
82 | cfg.setGroup( "Applets" ); | 82 | cfg.setGroup( "Applets" ); |
83 | 83 | ||
84 | // SafeMode causes too much problems, so we disable it for now -- | 84 | // SafeMode causes too much problems, so we disable it for now -- |
85 | // maybe we should reenable it for OPIE 1.0 - sandman 26.09.02 | 85 | // maybe we should reenable it for OPIE 1.0 - sandman 26.09.02 |
86 | 86 | ||
87 | bool safe = false; //cfg.readBoolEntry("SafeMode",FALSE); | 87 | bool safe = false; //cfg.readBoolEntry("SafeMode",FALSE); |
88 | if ( safe && !safety_tid ) | 88 | if ( safe && !safety_tid ) |
89 | return; | 89 | return; |
90 | cfg.writeEntry("SafeMode",TRUE); | 90 | cfg.writeEntry("SafeMode",TRUE); |
91 | cfg.write(); | 91 | cfg.write(); |
92 | QStringList exclude = cfg.readListEntry( "ExcludeApplets", ',' ); | 92 | QStringList exclude = cfg.readListEntry( "ExcludeApplets", ',' ); |
93 | 93 | ||
94 | QString lang = getenv( "LANG" ); | ||
94 | QString path = QPEApplication::qpeDir() + "/plugins/applets"; | 95 | QString path = QPEApplication::qpeDir() + "/plugins/applets"; |
95 | QDir dir( path, "lib*.so" ); | 96 | QDir dir( path, "lib*.so" ); |
96 | QStringList list = dir.entryList(); | 97 | QStringList list = dir.entryList(); |
97 | QStringList::Iterator it; | 98 | QStringList::Iterator it; |
98 | int napplets=0; | 99 | int napplets=0; |
99 | TaskbarApplet* *applets = new TaskbarApplet*[list.count()]; | 100 | TaskbarApplet* *applets = new TaskbarApplet*[list.count()]; |
100 | for ( it = list.begin(); it != list.end(); ++it ) { | 101 | for ( it = list.begin(); it != list.end(); ++it ) { |
101 | if ( exclude.find( *it ) != exclude.end() ) | 102 | if ( exclude.find( *it ) != exclude.end() ) |
102 | continue; | 103 | continue; |
103 | TaskbarAppletInterface *iface = 0; | 104 | TaskbarAppletInterface *iface = 0; |
104 | QLibrary *lib = new QLibrary( path + "/" + *it ); | 105 | QLibrary *lib = new QLibrary( path + "/" + *it ); |
105 | if (( lib->queryInterface( IID_TaskbarApplet, (QUnknownInterface**)&iface ) == QS_OK ) && iface ) { | 106 | if (( lib->queryInterface( IID_TaskbarApplet, (QUnknownInterface**)&iface ) == QS_OK ) && iface ) { |
106 | TaskbarApplet *applet = new TaskbarApplet; | 107 | TaskbarApplet *applet = new TaskbarApplet; |
107 | applets[napplets++] = applet; | 108 | applets[napplets++] = applet; |
108 | applet->library = lib; | 109 | applet->library = lib; |
109 | applet->iface = iface; | 110 | applet->iface = iface; |
111 | |||
112 | QTranslator *trans = new QTranslator(qApp); | ||
113 | QString type = (*it).left( (*it).find(".") ); | ||
114 | QString tfn = QPEApplication::qpeDir()+"/i18n/"+lang+"/"+type+".qm"; | ||
115 | if ( trans->load( tfn )) | ||
116 | qApp->installTranslator( trans ); | ||
117 | else | ||
118 | delete trans; | ||
110 | } else { | 119 | } else { |
111 | exclude += *it; | 120 | exclude += *it; |
112 | delete lib; | 121 | delete lib; |
113 | } | 122 | } |
114 | } | 123 | } |
115 | cfg.writeEntry( "ExcludeApplets", exclude, ',' ); | 124 | cfg.writeEntry( "ExcludeApplets", exclude, ',' ); |
116 | qsort(applets,napplets,sizeof(applets[0]),compareAppletPositions); | 125 | qsort(applets,napplets,sizeof(applets[0]),compareAppletPositions); |
117 | while (napplets--) { | 126 | while (napplets--) { |
118 | TaskbarApplet *applet = applets[napplets]; | 127 | TaskbarApplet *applet = applets[napplets]; |
119 | applet->applet = applet->iface->applet( this ); | 128 | applet->applet = applet->iface->applet( this ); |
120 | appletList.append(*applet); | 129 | appletList.append(*applet); |
121 | QString lang = getenv( "LANG" ); | ||
122 | QTranslator * trans = new QTranslator(qApp); | ||
123 | QString type = (*it).left( (*it).find(".") ); | ||
124 | QString tfn = QPEApplication::qpeDir()+"/i18n/"+lang+"/"+type+".qm"; | ||
125 | if ( trans->load( tfn )) | ||
126 | qApp->installTranslator( trans ); | ||
127 | else | ||
128 | delete trans; | ||
129 | } | 130 | } |
130 | delete applets; | 131 | delete applets; |
131 | #else | 132 | #else |
132 | TaskbarApplet applet; | 133 | TaskbarApplet applet; |
133 | applet.iface = new ClockAppletImpl(); | 134 | applet.iface = new ClockAppletImpl(); |
134 | applet.applet = applet.iface->applet( this ); | 135 | applet.applet = applet.iface->applet( this ); |
135 | appletList.append( a ); | 136 | appletList.append( a ); |
136 | #endif | 137 | #endif |
137 | show(); | 138 | show(); |
138 | 139 | ||
139 | if ( !safety_tid ) | 140 | if ( !safety_tid ) |
140 | safety_tid = startTimer(2000); // TT has 5000, but this is a PITA for a developer ;) (sandman) | 141 | safety_tid = startTimer(2000); // TT has 5000, but this is a PITA for a developer ;) (sandman) |
141 | } | 142 | } |
142 | 143 | ||
143 | void SysTray::timerEvent(QTimerEvent* e) | 144 | void SysTray::timerEvent(QTimerEvent* e) |
144 | { | 145 | { |