summaryrefslogtreecommitdiff
authorcniehaus <cniehaus>2002-11-21 10:41:31 (UTC)
committer cniehaus <cniehaus>2002-11-21 10:41:31 (UTC)
commita098d09ef14e4b41a0120dd431ef4777fd420042 (patch) (unidiff)
tree0c428827e9f4b02c5c78d1037feb741d227edfc9
parent354951c2751663e0a2f4fffe3fd3be71908df8b7 (diff)
downloadopie-a098d09ef14e4b41a0120dd431ef4777fd420042.zip
opie-a098d09ef14e4b41a0120dd431ef4777fd420042.tar.gz
opie-a098d09ef14e4b41a0120dd431ef4777fd420042.tar.bz2
applied one of Simons patches.
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/launcher/startmenu.cpp2
-rw-r--r--core/launcher/systray.cpp2
2 files changed, 2 insertions, 2 deletions
diff --git a/core/launcher/startmenu.cpp b/core/launcher/startmenu.cpp
index 7373ea8..d9382d2 100644
--- a/core/launcher/startmenu.cpp
+++ b/core/launcher/startmenu.cpp
@@ -315,72 +315,72 @@ void StartMenu::loadApplets()
315 QString lang = getenv( "LANG" ); 315 QString lang = getenv( "LANG" );
316 QString path = QPEApplication::qpeDir() + "/plugins/applets"; 316 QString path = QPEApplication::qpeDir() + "/plugins/applets";
317 QDir dir( path, "lib*.so" ); 317 QDir dir( path, "lib*.so" );
318 QStringList list = dir.entryList(); 318 QStringList list = dir.entryList();
319 QStringList::Iterator it; 319 QStringList::Iterator it;
320 int napplets=0; 320 int napplets=0;
321 MenuApplet* *xapplets = new MenuApplet*[list.count()]; 321 MenuApplet* *xapplets = new MenuApplet*[list.count()];
322 for ( it = list.begin(); it != list.end(); ++it ) { 322 for ( it = list.begin(); it != list.end(); ++it ) {
323 if ( exclude.find( *it ) != exclude.end() ) 323 if ( exclude.find( *it ) != exclude.end() )
324 continue; 324 continue;
325 MenuAppletInterface *iface = 0; 325 MenuAppletInterface *iface = 0;
326 QLibrary *lib = new QLibrary( path + "/" + *it ); 326 QLibrary *lib = new QLibrary( path + "/" + *it );
327 if (( lib->queryInterface( IID_MenuApplet, (QUnknownInterface**)&iface ) == QS_OK ) && iface ) { 327 if (( lib->queryInterface( IID_MenuApplet, (QUnknownInterface**)&iface ) == QS_OK ) && iface ) {
328 MenuApplet *applet = new MenuApplet; 328 MenuApplet *applet = new MenuApplet;
329 xapplets[napplets++] = applet; 329 xapplets[napplets++] = applet;
330 applet->library = lib; 330 applet->library = lib;
331 applet->iface = iface; 331 applet->iface = iface;
332 332
333 QTranslator *trans = new QTranslator(qApp); 333 QTranslator *trans = new QTranslator(qApp);
334 QString type = (*it).left( (*it).find(".") ); 334 QString type = (*it).left( (*it).find(".") );
335 QString tfn = QPEApplication::qpeDir()+"/i18n/"+lang+"/"+type+".qm"; 335 QString tfn = QPEApplication::qpeDir()+"/i18n/"+lang+"/"+type+".qm";
336 if ( trans->load( tfn )) 336 if ( trans->load( tfn ))
337 qApp->installTranslator( trans ); 337 qApp->installTranslator( trans );
338 else 338 else
339 delete trans; 339 delete trans;
340 } else { 340 } else {
341 exclude += *it; 341 exclude += *it;
342 delete lib; 342 delete lib;
343 } 343 }
344 } 344 }
345 cfg.writeEntry( "ExcludeApplets", exclude, ',' ); 345 cfg.writeEntry( "ExcludeApplets", exclude, ',' );
346 qsort(xapplets,napplets,sizeof(applets[0]),compareAppletPositions); 346 qsort(xapplets,napplets,sizeof(applets[0]),compareAppletPositions);
347 347
348 if ( sepId ) 348 if ( sepId )
349 launchMenu-> removeItem ( sepId ); 349 launchMenu-> removeItem ( sepId );
350 sepId = ( launchMenu-> count ( )) ? launchMenu-> insertSeparator ( ) : 0; 350 sepId = ( launchMenu-> count ( )) ? launchMenu-> insertSeparator ( ) : 0;
351 351
352 while (napplets--) { 352 while (napplets--) {
353 MenuApplet *applet = xapplets[napplets]; 353 MenuApplet *applet = xapplets[napplets];
354 354
355 applet-> popup = applet-> iface-> popup ( this ); 355 applet-> popup = applet-> iface-> popup ( this );
356 356
357 if ( applet-> popup ) 357 if ( applet-> popup )
358 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 );
359 else 359 else
360 applet-> id = launchMenu-> insertItem ( applet-> iface-> icon ( ), applet-> iface-> text ( ) ); 360 applet-> id = launchMenu-> insertItem ( applet-> iface-> icon ( ), applet-> iface-> text ( ) );
361 applets.insert ( applet-> id, new MenuApplet(*applet)); 361 applets.insert ( applet-> id, new MenuApplet(*applet));
362 } 362 }
363 delete xapplets; 363 delete [] xapplets;
364 364
365 if ( sepId && ( launchMenu-> idAt ( launchMenu-> count ( ) - 1 ) == sepId )) { // no applets 365 if ( sepId && ( launchMenu-> idAt ( launchMenu-> count ( ) - 1 ) == sepId )) { // no applets
366 launchMenu-> removeItem ( sepId ); 366 launchMenu-> removeItem ( sepId );
367 sepId = 0; 367 sepId = 0;
368 } 368 }
369 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
370 sepId = launchMenu-> insertSeparator ( ); 370 sepId = launchMenu-> insertSeparator ( );
371 371
372 if ( !safety_tid ) 372 if ( !safety_tid )
373 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)
374} 374}
375 375
376void StartMenu::timerEvent(QTimerEvent* e) 376void StartMenu::timerEvent(QTimerEvent* e)
377{ 377{
378 if ( e->timerId() == safety_tid ) { 378 if ( e->timerId() == safety_tid ) {
379 Config cfg( "StartMenu" ); 379 Config cfg( "StartMenu" );
380 cfg.setGroup( "Applets" ); 380 cfg.setGroup( "Applets" );
381 cfg.writeEntry( "SafeMode", FALSE ); 381 cfg.writeEntry( "SafeMode", FALSE );
382 killTimer(safety_tid); 382 killTimer(safety_tid);
383 safety_tid = 0; 383 safety_tid = 0;
384 } 384 }
385} 385}
386 386
diff --git a/core/launcher/systray.cpp b/core/launcher/systray.cpp
index 4859e48..be55791 100644
--- a/core/launcher/systray.cpp
+++ b/core/launcher/systray.cpp
@@ -83,71 +83,71 @@ void SysTray::addApplets()
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 lang = getenv( "LANG" );
95 QString path = QPEApplication::qpeDir() + "/plugins/applets"; 95 QString path = QPEApplication::qpeDir() + "/plugins/applets";
96 QDir dir( path, "lib*.so" ); 96 QDir dir( path, "lib*.so" );
97 QStringList list = dir.entryList(); 97 QStringList list = dir.entryList();
98 QStringList::Iterator it; 98 QStringList::Iterator it;
99 int napplets=0; 99 int napplets=0;
100 TaskbarApplet* *applets = new TaskbarApplet*[list.count()]; 100 TaskbarApplet* *applets = new TaskbarApplet*[list.count()];
101 for ( it = list.begin(); it != list.end(); ++it ) { 101 for ( it = list.begin(); it != list.end(); ++it ) {
102 if ( exclude.find( *it ) != exclude.end() ) 102 if ( exclude.find( *it ) != exclude.end() )
103 continue; 103 continue;
104 TaskbarAppletInterface *iface = 0; 104 TaskbarAppletInterface *iface = 0;
105 QLibrary *lib = new QLibrary( path + "/" + *it ); 105 QLibrary *lib = new QLibrary( path + "/" + *it );
106 if (( lib->queryInterface( IID_TaskbarApplet, (QUnknownInterface**)&iface ) == QS_OK ) && iface ) { 106 if (( lib->queryInterface( IID_TaskbarApplet, (QUnknownInterface**)&iface ) == QS_OK ) && iface ) {
107 TaskbarApplet *applet = new TaskbarApplet; 107 TaskbarApplet *applet = new TaskbarApplet;
108 applets[napplets++] = applet; 108 applets[napplets++] = applet;
109 applet->library = lib; 109 applet->library = lib;
110 applet->iface = iface; 110 applet->iface = iface;
111 111
112 QTranslator *trans = new QTranslator(qApp); 112 QTranslator *trans = new QTranslator(qApp);
113 QString type = (*it).left( (*it).find(".") ); 113 QString type = (*it).left( (*it).find(".") );
114 QString tfn = QPEApplication::qpeDir()+"/i18n/"+lang+"/"+type+".qm"; 114 QString tfn = QPEApplication::qpeDir()+"/i18n/"+lang+"/"+type+".qm";
115 if ( trans->load( tfn )) 115 if ( trans->load( tfn ))
116 qApp->installTranslator( trans ); 116 qApp->installTranslator( trans );
117 else 117 else
118 delete trans; 118 delete trans;
119 } else { 119 } else {
120 exclude += *it; 120 exclude += *it;
121 delete lib; 121 delete lib;
122 } 122 }
123 } 123 }
124 cfg.writeEntry( "ExcludeApplets", exclude, ',' ); 124 cfg.writeEntry( "ExcludeApplets", exclude, ',' );
125 qsort(applets,napplets,sizeof(applets[0]),compareAppletPositions); 125 qsort(applets,napplets,sizeof(applets[0]),compareAppletPositions);
126 while (napplets--) { 126 while (napplets--) {
127 TaskbarApplet *applet = applets[napplets]; 127 TaskbarApplet *applet = applets[napplets];
128 applet->applet = applet->iface->applet( this ); 128 applet->applet = applet->iface->applet( this );
129 appletList.append(*applet); 129 appletList.append(*applet);
130 } 130 }
131 delete applets; 131 delete [] applets;
132#else 132#else
133 TaskbarApplet applet; 133 TaskbarApplet applet;
134 applet.iface = new ClockAppletImpl(); 134 applet.iface = new ClockAppletImpl();
135 applet.applet = applet.iface->applet( this ); 135 applet.applet = applet.iface->applet( this );
136 appletList.append( a ); 136 appletList.append( a );
137#endif 137#endif
138 show(); 138 show();
139 139
140 if ( !safety_tid ) 140 if ( !safety_tid )
141 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)
142} 142}
143 143
144void SysTray::timerEvent(QTimerEvent* e) 144void SysTray::timerEvent(QTimerEvent* e)
145{ 145{
146 if ( e->timerId() == safety_tid ) { 146 if ( e->timerId() == safety_tid ) {
147 Config cfg( "Taskbar" ); 147 Config cfg( "Taskbar" );
148 cfg.setGroup( "Applets" ); 148 cfg.setGroup( "Applets" );
149 cfg.writeEntry( "SafeMode", FALSE ); 149 cfg.writeEntry( "SafeMode", FALSE );
150 killTimer(safety_tid); 150 killTimer(safety_tid);
151 safety_tid = 0; 151 safety_tid = 0;
152 } 152 }
153} 153}