author | sandman <sandman> | 2002-10-23 21:55:13 (UTC) |
---|---|---|
committer | sandman <sandman> | 2002-10-23 21:55:13 (UTC) |
commit | 3c9835537b2fdccab4c0f720a4d77a98ad8bba10 (patch) (unidiff) | |
tree | bedafdbcd4410bca7fe177e5ffeab982f81496bb | |
parent | 482c5cfe8b3653888ba97716a1b29dae05200d70 (diff) | |
download | opie-3c9835537b2fdccab4c0f720a4d77a98ad8bba10.zip opie-3c9835537b2fdccab4c0f720a4d77a98ad8bba10.tar.gz opie-3c9835537b2fdccab4c0f720a4d77a98ad8bba10.tar.bz2 |
Fixed a translation bug regarding launcher applets, that got in when I
merged with Qtopia 1.6 (TT bug).
found by Héctor GarcíaÁlvarez <hector@disoft.es>, but I modified his patch,
since running the applet widget constructor *before* the QTranslator gets
installed seems like a bad idea.
-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 | |||
@@ -219,167 +219,168 @@ bool StartMenu::loadMenu( AppLnkSet *folder, QPopupMenu *menu ) | |||
219 | pmenu = menu; | 219 | pmenu = menu; |
220 | else | 220 | else |
221 | pmenu = 0; | 221 | pmenu = 0; |
222 | } | 222 | } |
223 | if ( pmenu ) { | 223 | if ( pmenu ) { |
224 | QString t = app->name(); | 224 | QString t = app->name(); |
225 | t.replace(QRegExp("&"),"&&"); // escape shortcut character | 225 | t.replace(QRegExp("&"),"&&"); // escape shortcut character |
226 | pmenu->insertItem( app->pixmap(), t, app->id() ); | 226 | pmenu->insertItem( app->pixmap(), t, app->id() ); |
227 | } | 227 | } |
228 | result=TRUE; | 228 | result=TRUE; |
229 | } | 229 | } |
230 | } | 230 | } |
231 | } | 231 | } |
232 | 232 | ||
233 | if ( sepId && ( menu-> idAt ( 0 ) == sepId )) { // no tabs entries | 233 | if ( sepId && ( menu-> idAt ( 0 ) == sepId )) { // no tabs entries |
234 | menu-> removeItem ( sepId ); | 234 | menu-> removeItem ( sepId ); |
235 | sepId = 0; | 235 | sepId = 0; |
236 | } | 236 | } |
237 | if ( !menu-> count ( )) // if we don't do this QPopupMenu will insert a dummy Separator, which won't go away later | 237 | if ( !menu-> count ( )) // if we don't do this QPopupMenu will insert a dummy Separator, which won't go away later |
238 | sepId = menu-> insertSeparator ( ); | 238 | sepId = menu-> insertSeparator ( ); |
239 | 239 | ||
240 | return result; | 240 | return result; |
241 | } | 241 | } |
242 | 242 | ||
243 | 243 | ||
244 | void StartMenu::launch() | 244 | void StartMenu::launch() |
245 | { | 245 | { |
246 | int y = mapToGlobal( QPoint() ).y() - launchMenu->sizeHint().height(); | 246 | int y = mapToGlobal( QPoint() ).y() - launchMenu->sizeHint().height(); |
247 | 247 | ||
248 | if ( launchMenu->isVisible() ) | 248 | if ( launchMenu->isVisible() ) |
249 | launchMenu->hide(); | 249 | launchMenu->hide(); |
250 | else | 250 | else |
251 | launchMenu->popup( QPoint( 1, y ) ); | 251 | launchMenu->popup( QPoint( 1, y ) ); |
252 | } | 252 | } |
253 | 253 | ||
254 | const AppLnk* StartMenu::execToLink(const QString& appname) | 254 | const AppLnk* StartMenu::execToLink(const QString& appname) |
255 | { | 255 | { |
256 | const AppLnk* a = apps->findExec( appname ); | 256 | const AppLnk* a = apps->findExec( appname ); |
257 | return a; | 257 | return a; |
258 | } | 258 | } |
259 | 259 | ||
260 | void StartPopupMenu::keyPressEvent( QKeyEvent *e ) | 260 | void StartPopupMenu::keyPressEvent( QKeyEvent *e ) |
261 | { | 261 | { |
262 | if ( e->key() == Key_F33 || e->key() == Key_Space ) { | 262 | if ( e->key() == Key_F33 || e->key() == Key_Space ) { |
263 | // "OK" button, little hacky | 263 | // "OK" button, little hacky |
264 | QKeyEvent ke(QEvent::KeyPress, Key_Enter, 13, 0); | 264 | QKeyEvent ke(QEvent::KeyPress, Key_Enter, 13, 0); |
265 | QPopupMenu::keyPressEvent( &ke ); | 265 | QPopupMenu::keyPressEvent( &ke ); |
266 | } else { | 266 | } else { |
267 | QPopupMenu::keyPressEvent( e ); | 267 | QPopupMenu::keyPressEvent( e ); |
268 | } | 268 | } |
269 | } | 269 | } |
270 | 270 | ||
271 | static int compareAppletPositions(const void *a, const void *b) | 271 | static int compareAppletPositions(const void *a, const void *b) |
272 | { | 272 | { |
273 | const MenuApplet* aa = *(const MenuApplet**)a; | 273 | const MenuApplet* aa = *(const MenuApplet**)a; |
274 | const MenuApplet* ab = *(const MenuApplet**)b; | 274 | const MenuApplet* ab = *(const MenuApplet**)b; |
275 | int d = aa->iface->position() - ab->iface->position(); | 275 | int d = aa->iface->position() - ab->iface->position(); |
276 | if ( d ) return d; | 276 | if ( d ) return d; |
277 | return QString::compare(aa->library->library(),ab->library->library()); | 277 | return QString::compare(aa->library->library(),ab->library->library()); |
278 | } | 278 | } |
279 | 279 | ||
280 | void StartMenu::clearApplets() | 280 | void StartMenu::clearApplets() |
281 | { | 281 | { |
282 | launchMenu-> hide(); | 282 | launchMenu-> hide(); |
283 | 283 | ||
284 | for ( QIntDictIterator<MenuApplet> it ( applets ); it. current ( ); ++it ) { | 284 | for ( QIntDictIterator<MenuApplet> it ( applets ); it. current ( ); ++it ) { |
285 | MenuApplet *applet = it. current ( ); | 285 | MenuApplet *applet = it. current ( ); |
286 | if ( launchMenu ) { | 286 | if ( launchMenu ) { |
287 | launchMenu-> removeItem ( applet-> id ); | 287 | launchMenu-> removeItem ( applet-> id ); |
288 | delete applet-> popup; | 288 | delete applet-> popup; |
289 | } | 289 | } |
290 | 290 | ||
291 | applet-> iface-> release(); | 291 | applet-> iface-> release(); |
292 | applet-> library-> unload(); | 292 | applet-> library-> unload(); |
293 | delete applet-> library; | 293 | delete applet-> library; |
294 | } | 294 | } |
295 | applets.clear(); | 295 | applets.clear(); |
296 | } | 296 | } |
297 | 297 | ||
298 | 298 | ||
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 |
369 | sepId = launchMenu-> insertSeparator ( ); | 370 | sepId = launchMenu-> insertSeparator ( ); |
370 | 371 | ||
371 | if ( !safety_tid ) | 372 | if ( !safety_tid ) |
372 | safety_tid = startTimer(2000); // TT has 5000, but this is a PITA for a developer ;) (sandman) | 373 | safety_tid = startTimer(2000); // TT has 5000, but this is a PITA for a developer ;) (sandman) |
373 | } | 374 | } |
374 | 375 | ||
375 | void StartMenu::timerEvent(QTimerEvent* e) | 376 | void StartMenu::timerEvent(QTimerEvent* e) |
376 | { | 377 | { |
377 | if ( e->timerId() == safety_tid ) { | 378 | if ( e->timerId() == safety_tid ) { |
378 | Config cfg( "StartMenu" ); | 379 | Config cfg( "StartMenu" ); |
379 | cfg.setGroup( "Applets" ); | 380 | cfg.setGroup( "Applets" ); |
380 | cfg.writeEntry( "SafeMode", FALSE ); | 381 | cfg.writeEntry( "SafeMode", FALSE ); |
381 | killTimer(safety_tid); | 382 | killTimer(safety_tid); |
382 | safety_tid = 0; | 383 | safety_tid = 0; |
383 | } | 384 | } |
384 | } | 385 | } |
385 | 386 | ||
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 | |||
@@ -1,152 +1,153 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of the Qtopia Environment. | 4 | ** This file is part of the Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | 20 | ||
21 | #include <qpe/qpeapplication.h> | 21 | #include <qpe/qpeapplication.h> |
22 | #include <qpe/qlibrary.h> | 22 | #include <qpe/qlibrary.h> |
23 | #include <qpe/config.h> | 23 | #include <qpe/config.h> |
24 | 24 | ||
25 | #include <qlayout.h> | 25 | #include <qlayout.h> |
26 | #include <qdir.h> | 26 | #include <qdir.h> |
27 | #include <qtranslator.h> | 27 | #include <qtranslator.h> |
28 | 28 | ||
29 | #include "quicklauncher.h" | 29 | #include "quicklauncher.h" |
30 | #include "systray.h" | 30 | #include "systray.h" |
31 | 31 | ||
32 | #include <stdlib.h> | 32 | #include <stdlib.h> |
33 | 33 | ||
34 | #ifdef SINGLE_APP | 34 | #ifdef SINGLE_APP |
35 | #include "clockappletimpl.h" | 35 | #include "clockappletimpl.h" |
36 | #endif | 36 | #endif |
37 | 37 | ||
38 | SysTray::SysTray( QWidget *parent ) : QFrame( parent ), layout(0) | 38 | SysTray::SysTray( QWidget *parent ) : QFrame( parent ), layout(0) |
39 | { | 39 | { |
40 | safety_tid = 0; | 40 | safety_tid = 0; |
41 | //setFrameStyle( QFrame::Panel | QFrame::Sunken ); | 41 | //setFrameStyle( QFrame::Panel | QFrame::Sunken ); |
42 | loadApplets(); | 42 | loadApplets(); |
43 | } | 43 | } |
44 | 44 | ||
45 | static int compareAppletPositions(const void *a, const void *b) | 45 | static int compareAppletPositions(const void *a, const void *b) |
46 | { | 46 | { |
47 | const TaskbarApplet* aa = *(const TaskbarApplet**)a; | 47 | const TaskbarApplet* aa = *(const TaskbarApplet**)a; |
48 | const TaskbarApplet* ab = *(const TaskbarApplet**)b; | 48 | const TaskbarApplet* ab = *(const TaskbarApplet**)b; |
49 | int d = ab->iface->position() - aa->iface->position(); | 49 | int d = ab->iface->position() - aa->iface->position(); |
50 | if ( d ) return d; | 50 | if ( d ) return d; |
51 | return QString::compare(ab->library->library(),aa->library->library()); | 51 | return QString::compare(ab->library->library(),aa->library->library()); |
52 | } | 52 | } |
53 | 53 | ||
54 | void SysTray::loadApplets() | 54 | void SysTray::loadApplets() |
55 | { | 55 | { |
56 | clearApplets(); | 56 | clearApplets(); |
57 | addApplets(); | 57 | addApplets(); |
58 | } | 58 | } |
59 | 59 | ||
60 | void SysTray::clearApplets() | 60 | void SysTray::clearApplets() |
61 | { | 61 | { |
62 | hide(); | 62 | hide(); |
63 | #ifndef SINGLE_APP | 63 | #ifndef SINGLE_APP |
64 | QValueList<TaskbarApplet>::Iterator mit; | 64 | QValueList<TaskbarApplet>::Iterator mit; |
65 | for ( mit = appletList.begin(); mit != appletList.end(); ++mit ) { | 65 | for ( mit = appletList.begin(); mit != appletList.end(); ++mit ) { |
66 | (*mit).iface->release(); | 66 | (*mit).iface->release(); |
67 | (*mit).library->unload(); | 67 | (*mit).library->unload(); |
68 | delete (*mit).library; | 68 | delete (*mit).library; |
69 | } | 69 | } |
70 | #endif | 70 | #endif |
71 | appletList.clear(); | 71 | appletList.clear(); |
72 | if ( layout ) | 72 | if ( layout ) |
73 | delete layout; | 73 | delete layout; |
74 | layout = new QHBoxLayout( this, 0, 1 ); | 74 | layout = new QHBoxLayout( this, 0, 1 ); |
75 | layout->setAutoAdd(TRUE); | 75 | layout->setAutoAdd(TRUE); |
76 | } | 76 | } |
77 | 77 | ||
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 | { |
145 | if ( e->timerId() == safety_tid ) { | 146 | if ( e->timerId() == safety_tid ) { |
146 | Config cfg( "Taskbar" ); | 147 | Config cfg( "Taskbar" ); |
147 | cfg.setGroup( "Applets" ); | 148 | cfg.setGroup( "Applets" ); |
148 | cfg.writeEntry( "SafeMode", FALSE ); | 149 | cfg.writeEntry( "SafeMode", FALSE ); |
149 | killTimer(safety_tid); | 150 | killTimer(safety_tid); |
150 | safety_tid = 0; | 151 | safety_tid = 0; |
151 | } | 152 | } |
152 | } | 153 | } |