summaryrefslogtreecommitdiff
authorsandman <sandman>2002-11-25 01:14:19 (UTC)
committer sandman <sandman>2002-11-25 01:14:19 (UTC)
commit1b4665ddf28fdb59810b90138a5a88f87a2d9bc6 (patch) (unidiff)
tree14254d02145e88f1970f3c26af4ad006ab00c15a
parentda8050fe68a443773447ee176793a30df256ea9b (diff)
downloadopie-1b4665ddf28fdb59810b90138a5a88f87a2d9bc6.zip
opie-1b4665ddf28fdb59810b90138a5a88f87a2d9bc6.tar.gz
opie-1b4665ddf28fdb59810b90138a5a88f87a2d9bc6.tar.bz2
*** empty log message ***
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/launcher/desktop.cpp23
-rw-r--r--core/launcher/desktop.h1
-rw-r--r--core/launcher/startmenu.cpp7
3 files changed, 10 insertions, 21 deletions
diff --git a/core/launcher/desktop.cpp b/core/launcher/desktop.cpp
index 3e8c731..34b52d2 100644
--- a/core/launcher/desktop.cpp
+++ b/core/launcher/desktop.cpp
@@ -291,132 +291,132 @@ void DesktopApplication::systemMessage( const QCString & msg, const QByteArray &
291 291
292void DesktopApplication::reloadPowerWarnSettings() { 292void DesktopApplication::reloadPowerWarnSettings() {
293 Config cfg( "apm" ); 293 Config cfg( "apm" );
294 cfg.setGroup( "Warnings" ); 294 cfg.setGroup( "Warnings" );
295 295
296 // m_timer->changeInterval( cfg.readNumEntry( "checkinterval", 10000 ) ); 296 // m_timer->changeInterval( cfg.readNumEntry( "checkinterval", 10000 ) );
297 m_powerVeryLow = cfg.readNumEntry( "powerverylow", 10 ); 297 m_powerVeryLow = cfg.readNumEntry( "powerverylow", 10 );
298 m_powerCritical = cfg.readNumEntry( "powervcritical", 5 ); 298 m_powerCritical = cfg.readNumEntry( "powervcritical", 5 );
299} 299}
300 300
301 301
302enum MemState { Unknown, VeryLow, Low, Normal } memstate = Unknown; 302enum MemState { Unknown, VeryLow, Low, Normal } memstate = Unknown;
303 303
304#ifdef Q_WS_QWS 304#ifdef Q_WS_QWS
305bool DesktopApplication::qwsEventFilter( QWSEvent *e ) 305bool DesktopApplication::qwsEventFilter( QWSEvent *e )
306{ 306{
307 qpedesktop->checkMemory(); 307 qpedesktop->checkMemory();
308 308
309 if ( e->type == QWSEvent::Key ) { 309 if ( e->type == QWSEvent::Key ) {
310 QWSKeyEvent * ke = ( QWSKeyEvent * ) e; 310 QWSKeyEvent * ke = ( QWSKeyEvent * ) e;
311 if ( !loggedin && ke->simpleData.keycode != Key_F34 ) 311 if ( !loggedin && ke->simpleData.keycode != Key_F34 )
312 return TRUE; 312 return TRUE;
313 bool press = ke->simpleData.is_press; 313 bool press = ke->simpleData.is_press;
314 bool autoRepeat = ke->simpleData.is_auto_repeat; 314 bool autoRepeat = ke->simpleData.is_auto_repeat;
315 315
316 /* 316 /*
317 app that registers key/message to be sent back to the app, when it doesn't have focus, 317 app that registers key/message to be sent back to the app, when it doesn't have focus,
318 when user presses key, unless keyboard has been requested from app. 318 when user presses key, unless keyboard has been requested from app.
319 will not send multiple repeats if user holds key 319 will not send multiple repeats if user holds key
320 i.e. one shot 320 i.e. one shot
321 */ 321 */
322 if ( !keyRegisterList.isEmpty() && ke->simpleData.keycode !=0 && press) { 322 if ( !keyRegisterList.isEmpty() && ke->simpleData.keycode !=0 && press) {
323// qDebug("<<<<<<<<<<<<<keycode %d", ke->simpleData.keycode); 323// qDebug("<<<<<<<<<<<<<keycode %d", ke->simpleData.keycode);
324 KeyRegisterList::Iterator it; 324 KeyRegisterList::Iterator it;
325 for ( it = keyRegisterList.begin(); it != keyRegisterList.end(); ++it ) { 325 for ( it = keyRegisterList.begin(); it != keyRegisterList.end(); ++it ) {
326 if ( ( *it ).getKeyCode() == ke->simpleData.keycode && !autoRepeat && !keyboardGrabbed() ) { 326 if ( ( *it ).getKeyCode() == ke->simpleData.keycode && !autoRepeat && !keyboardGrabbed() ) {
327 if ( press ) 327 if ( press )
328 qDebug( "press" ); 328 qDebug( "press" );
329 else 329 else
330 qDebug( "release" ); 330 qDebug( "release" );
331 QCopEnvelope( ( *it ).getChannel().utf8(), ( *it ).getMessage().utf8() ); 331 QCopEnvelope( ( *it ).getChannel().utf8(), ( *it ).getMessage().utf8() );
332 } 332 }
333 } 333 }
334 } 334 }
335 335
336 if ( !keyboardGrabbed() ) { 336 if ( !keyboardGrabbed() ) {
337 if ( ke->simpleData.keycode == Key_F9 ) { 337 if ( ke->simpleData.keycode == Key_F9 ) {
338 if ( press ) 338 if ( press )
339 emit datebook(); 339 emit datebook();
340 return TRUE; 340 return TRUE;
341 } 341 }
342 if ( ke->simpleData.keycode == Key_F10 ) { 342 if ( ke->simpleData.keycode == Key_F10 ) {
343 if ( !press && cardSendTimer ) { 343 if ( !press && cardSendTimer ) {
344 emit contacts(); 344 emit contacts();
345 delete cardSendTimer; 345 delete cardSendTimer;
346 } 346 }
347 else if ( press ) { 347 else if ( press ) {
348 cardSendTimer = new QTimer(); 348 cardSendTimer = new QTimer();
349 cardSendTimer->start( 2000, TRUE ); 349 cardSendTimer->start( 2000, TRUE );
350 connect( cardSendTimer, SIGNAL( timeout() ), this, SLOT( sendCard() ) ); 350 connect( cardSendTimer, SIGNAL( timeout() ), this, SLOT( sendCard() ) );
351 } 351 }
352 return TRUE; 352 return TRUE;
353 } 353 }
354 354
355// if ( ke->simpleData.keycode == Key_F11 ) { 355 if ( ke->simpleData.keycode == Key_F11 ) {
356// if ( press ) emit menu(); 356 if ( press ) emit menu();
357// return TRUE; 357 return TRUE;
358// } 358 }
359 359
360 if ( ke->simpleData.keycode == Key_F12 ) { 360 if ( ke->simpleData.keycode == Key_F12 ) {
361 while ( activePopupWidget() ) 361 while ( activePopupWidget() )
362 activePopupWidget() ->close(); 362 activePopupWidget() ->close();
363 if ( press ) 363 if ( press )
364 emit launch(); 364 emit launch();
365 return TRUE; 365 return TRUE;
366 } 366 }
367 if ( ke->simpleData.keycode == Key_F13 ) { 367 if ( ke->simpleData.keycode == Key_F13 ) {
368 if ( press ) 368 if ( press )
369 emit email(); 369 emit email();
370 return TRUE; 370 return TRUE;
371 } 371 }
372 } 372 }
373 373
374 if ( ke->simpleData.keycode == Key_F34 ) { 374 if ( ke->simpleData.keycode == Key_F34 ) {
375 if ( press ) 375 if ( press )
376 emit power(); 376 emit power();
377 return TRUE; 377 return TRUE;
378 } 378 }
379 // This was used for the iPAQ PowerButton 379 // This was used for the iPAQ PowerButton
380 // See main.cpp for new KeyboardFilter 380 // See main.cpp for new KeyboardFilter
381 // 381 //
382 // if ( ke->simpleData.keycode == Key_SysReq ) { 382 // if ( ke->simpleData.keycode == Key_SysReq ) {
383 // if ( press ) emit power(); 383 // if ( press ) emit power();
384 // return TRUE; 384 // return TRUE;
385 // } 385 // }
386 if ( ke->simpleData.keycode == Key_F35 ) { 386 if ( ke->simpleData.keycode == Key_F35 ) {
387 if ( press ) 387 if ( press )
388 emit backlight(); 388 emit backlight();
389 return TRUE; 389 return TRUE;
390 } 390 }
391 if ( ke->simpleData.keycode == Key_F32 ) { 391 if ( ke->simpleData.keycode == Key_F32 ) {
392 if ( press ) 392 if ( press )
393 QCopEnvelope e( "QPE/Desktop", "startSync()" ); 393 QCopEnvelope e( "QPE/Desktop", "startSync()" );
394 return TRUE; 394 return TRUE;
395 } 395 }
396 if ( ke->simpleData.keycode == Key_F31 && !ke->simpleData.modifiers ) { 396 if ( ke->simpleData.keycode == Key_F31 && !ke->simpleData.modifiers ) {
397 if ( press ) 397 if ( press )
398 emit symbol(); 398 emit symbol();
399 return TRUE; 399 return TRUE;
400 } 400 }
401 if ( ke->simpleData.keycode == Key_NumLock ) { 401 if ( ke->simpleData.keycode == Key_NumLock ) {
402 if ( press ) 402 if ( press )
403 emit numLockStateToggle(); 403 emit numLockStateToggle();
404 } 404 }
405 if ( ke->simpleData.keycode == Key_CapsLock ) { 405 if ( ke->simpleData.keycode == Key_CapsLock ) {
406 if ( press ) 406 if ( press )
407 emit capsLockStateToggle(); 407 emit capsLockStateToggle();
408 } 408 }
409 if ( ( press && !autoRepeat ) || ( !press && autoRepeat ) ) 409 if ( ( press && !autoRepeat ) || ( !press && autoRepeat ) )
410 qpedesktop->keyClick(); 410 qpedesktop->keyClick();
411 } 411 }
412 else { 412 else {
413 if ( e->type == QWSEvent::Mouse ) { 413 if ( e->type == QWSEvent::Mouse ) {
414 QWSMouseEvent * me = ( QWSMouseEvent * ) e; 414 QWSMouseEvent * me = ( QWSMouseEvent * ) e;
415 static bool up = TRUE; 415 static bool up = TRUE;
416 if ( me->simpleData.state & LeftButton ) { 416 if ( me->simpleData.state & LeftButton ) {
417 if ( up ) { 417 if ( up ) {
418 up = FALSE; 418 up = FALSE;
419 qpedesktop->screenClick(); 419 qpedesktop->screenClick();
420 } 420 }
421 } 421 }
422 else { 422 else {
@@ -842,79 +842,64 @@ void DesktopApplication::restart()
842 842
843 exit( 1 ); 843 exit( 1 );
844#endif 844#endif
845} 845}
846 846
847void Desktop::startTransferServer() 847void Desktop::startTransferServer()
848{ 848{
849 // start qcop bridge server 849 // start qcop bridge server
850 qcopBridge = new QCopBridge( 4243 ); 850 qcopBridge = new QCopBridge( 4243 );
851 if ( !qcopBridge->ok() ) { 851 if ( !qcopBridge->ok() ) {
852 delete qcopBridge; 852 delete qcopBridge;
853 qcopBridge = 0; 853 qcopBridge = 0;
854 } 854 }
855 // start transfer server 855 // start transfer server
856 transferServer = new TransferServer( 4242 ); 856 transferServer = new TransferServer( 4242 );
857 if ( !transferServer->ok() ) { 857 if ( !transferServer->ok() ) {
858 delete transferServer; 858 delete transferServer;
859 transferServer = 0; 859 transferServer = 0;
860 } 860 }
861 if ( !transferServer || !qcopBridge ) 861 if ( !transferServer || !qcopBridge )
862 startTimer( 2000 ); 862 startTimer( 2000 );
863} 863}
864 864
865void Desktop::timerEvent( QTimerEvent *e ) 865void Desktop::timerEvent( QTimerEvent *e )
866{ 866{
867 killTimer( e->timerId() ); 867 killTimer( e->timerId() );
868 startTransferServer(); 868 startTransferServer();
869} 869}
870 870
871void Desktop::terminateServers() 871void Desktop::terminateServers()
872{ 872{
873 delete transferServer; 873 delete transferServer;
874 delete qcopBridge; 874 delete qcopBridge;
875 transferServer = 0; 875 transferServer = 0;
876 qcopBridge = 0; 876 qcopBridge = 0;
877} 877}
878 878
879void Desktop::rereadVolumes() 879void Desktop::rereadVolumes()
880{ 880{
881 Config cfg( "qpe" ); 881 Config cfg( "qpe" );
882 cfg.setGroup( "Volume" ); 882 cfg.setGroup( "Volume" );
883 touchclick = cfg.readBoolEntry( "TouchSound" ); 883 touchclick = cfg.readBoolEntry( "TouchSound" );
884 keyclick = cfg.readBoolEntry( "KeySound" ); 884 keyclick = cfg.readBoolEntry( "KeySound" );
885 alarmsound = cfg.readBoolEntry( "AlarmSound" ); 885 alarmsound = cfg.readBoolEntry( "AlarmSound" );
886} 886}
887 887
888void Desktop::keyClick() 888void Desktop::keyClick()
889{ 889{
890 if ( keyclick ) 890 if ( keyclick )
891 ODevice::inst ( ) -> keySound ( ); 891 ODevice::inst ( ) -> keySound ( );
892} 892}
893 893
894void Desktop::screenClick() 894void Desktop::screenClick()
895{ 895{
896 if ( touchclick ) 896 if ( touchclick )
897 ODevice::inst ( ) -> touchSound ( ); 897 ODevice::inst ( ) -> touchSound ( );
898} 898}
899 899
900void Desktop::soundAlarm() 900void Desktop::soundAlarm()
901{ 901{
902 if ( qpedesktop-> alarmsound ) 902 if ( qpedesktop-> alarmsound )
903 ODevice::inst ( ) -> alarmSound ( ); 903 ODevice::inst ( ) -> alarmSound ( );
904} 904}
905 905
906bool Desktop::eventFilter( QObject *, QEvent *ev )
907{
908 if ( ev->type() == QEvent::KeyPress ) {
909 QKeyEvent *ke = (QKeyEvent *)ev;
910 if ( ke->key() == Qt::Key_F11 ) { // menu key
911 QWidget *active = qApp->activeWindow();
912 if ( active && active->isPopup() ) {
913 active->close();
914 }
915 raiseMenu();
916 return TRUE;
917 }
918 }
919 return FALSE;
920}
diff --git a/core/launcher/desktop.h b/core/launcher/desktop.h
index f6059b8..13f28b3 100644
--- a/core/launcher/desktop.h
+++ b/core/launcher/desktop.h
@@ -69,85 +69,84 @@ protected:
69#endif 69#endif
70 70
71 void shutdown(); 71 void shutdown();
72 void restart(); 72 void restart();
73 73
74public slots: 74public slots:
75 virtual void desktopMessage ( const QCString &msg, const QByteArray &data ); 75 virtual void desktopMessage ( const QCString &msg, const QByteArray &data );
76 virtual void systemMessage ( const QCString &msg, const QByteArray &data ); 76 virtual void systemMessage ( const QCString &msg, const QByteArray &data );
77 77
78protected slots: 78protected slots:
79 void shutdown( ShutdownImpl::Type ); 79 void shutdown( ShutdownImpl::Type );
80 void apmTimeout(); 80 void apmTimeout();
81 void sendCard(); 81 void sendCard();
82private: 82private:
83 void reloadPowerWarnSettings(); 83 void reloadPowerWarnSettings();
84 DesktopPowerAlerter *pa; 84 DesktopPowerAlerter *pa;
85 PowerStatus *m_ps, *m_ps_last; 85 PowerStatus *m_ps, *m_ps_last;
86 QTimer *cardSendTimer; 86 QTimer *cardSendTimer;
87 QCopChannel *channel; 87 QCopChannel *channel;
88 OpieScreenSaver *m_screensaver; 88 OpieScreenSaver *m_screensaver;
89 QTimer * m_timer; 89 QTimer * m_timer;
90 int m_powerVeryLow; 90 int m_powerVeryLow;
91 int m_powerCritical; 91 int m_powerCritical;
92 int m_currentPowerLevel; 92 int m_currentPowerLevel;
93}; 93};
94 94
95 95
96class Desktop : public QWidget 96class Desktop : public QWidget
97{ 97{
98 Q_OBJECT 98 Q_OBJECT
99public: 99public:
100 Desktop(); 100 Desktop();
101 ~Desktop(); 101 ~Desktop();
102 102
103 static bool screenLocked(); 103 static bool screenLocked();
104 104
105 void show(); 105 void show();
106 void checkMemory(); 106 void checkMemory();
107 107
108 void keyClick(); 108 void keyClick();
109 void screenClick(); 109 void screenClick();
110 static void soundAlarm(); 110 static void soundAlarm();
111 111
112public slots: 112public slots:
113 void raiseDatebook(); 113 void raiseDatebook();
114 void raiseContacts(); 114 void raiseContacts();
115 void raiseMenu(); 115 void raiseMenu();
116 void raiseLauncher(); 116 void raiseLauncher();
117 void raiseEmail(); 117 void raiseEmail();
118 void execAutoStart(); 118 void execAutoStart();
119 void togglePower(); 119 void togglePower();
120 void toggleLight(); 120 void toggleLight();
121 void toggleNumLockState(); 121 void toggleNumLockState();
122 void toggleCapsLockState(); 122 void toggleCapsLockState();
123 void toggleSymbolInput(); 123 void toggleSymbolInput();
124 void terminateServers(); 124 void terminateServers();
125 void rereadVolumes(); 125 void rereadVolumes();
126 126
127 void home ( ); 127 void home ( );
128 128
129protected: 129protected:
130 void executeOrModify( const QString& appLnkFile ); 130 void executeOrModify( const QString& appLnkFile );
131 void styleChange( QStyle & ); 131 void styleChange( QStyle & );
132 void timerEvent( QTimerEvent *e ); 132 void timerEvent( QTimerEvent *e );
133 bool eventFilter( QObject *, QEvent * );
134 133
135 QWidget *bg; 134 QWidget *bg;
136 Launcher *launcher; 135 Launcher *launcher;
137 TaskBar *tb; 136 TaskBar *tb;
138 137
139private: 138private:
140 void startTransferServer(); 139 void startTransferServer();
141 bool recoverMemory(); 140 bool recoverMemory();
142 141
143 QCopBridge *qcopBridge; 142 QCopBridge *qcopBridge;
144 TransferServer *transferServer; 143 TransferServer *transferServer;
145 PackageSlave *packageSlave; 144 PackageSlave *packageSlave;
146 145
147 QDateTime suspendTime; 146 QDateTime suspendTime;
148 bool keyclick, touchclick, alarmsound; 147 bool keyclick, touchclick, alarmsound;
149}; 148};
150 149
151 150
152#endif // __DESKTOP_H__ 151#endif // __DESKTOP_H__
153 152
diff --git a/core/launcher/startmenu.cpp b/core/launcher/startmenu.cpp
index d9382d2..e663072 100644
--- a/core/launcher/startmenu.cpp
+++ b/core/launcher/startmenu.cpp
@@ -186,130 +186,135 @@ bool StartMenu::loadMenu( AppLnkSet *folder, QPopupMenu *menu )
186 for (QStringList::Iterator tit=typs.fromLast(); ; --tit) { 186 for (QStringList::Iterator tit=typs.fromLast(); ; --tit) {
187 if ( !(*tit).isEmpty() ) { 187 if ( !(*tit).isEmpty() ) {
188 QPopupMenu *new_menu; 188 QPopupMenu *new_menu;
189 if ( ltabs ) { 189 if ( ltabs ) {
190 new_menu = new StartPopupMenu( menu ); 190 new_menu = new StartPopupMenu( menu );
191 connect( new_menu, SIGNAL(activated(int)), SLOT(itemSelected(int)) ); 191 connect( new_menu, SIGNAL(activated(int)), SLOT(itemSelected(int)) );
192 int id = menu->insertItem( folder->typePixmap(*tit), folder->typeName(*tit), new_menu, -1, 0 ); 192 int id = menu->insertItem( folder->typePixmap(*tit), folder->typeName(*tit), new_menu, -1, 0 );
193 tabdict. insert ( id, new_menu ); 193 tabdict. insert ( id, new_menu );
194 } else { 194 } else {
195 new_menu = (QPopupMenu*)1; 195 new_menu = (QPopupMenu*)1;
196 } 196 }
197 typpop.insert(*tit, new_menu); 197 typpop.insert(*tit, new_menu);
198 } 198 }
199 if ( tit == typs. begin ( )) 199 if ( tit == typs. begin ( ))
200 break; 200 break;
201 } 201 }
202 QListIterator<AppLnk> it( folder->children() ); 202 QListIterator<AppLnk> it( folder->children() );
203 bool f=TRUE; 203 bool f=TRUE;
204 for ( ; it.current(); ++it ) { 204 for ( ; it.current(); ++it ) {
205 AppLnk *app = it.current(); 205 AppLnk *app = it.current();
206 if ( app->type() == "Separator" ) { // No tr 206 if ( app->type() == "Separator" ) { // No tr
207 if ( lot ) { 207 if ( lot ) {
208 menu->insertSeparator(); 208 menu->insertSeparator();
209 } 209 }
210 } else { 210 } else {
211 f = FALSE; 211 f = FALSE;
212 QString t = app->type(); 212 QString t = app->type();
213 QPopupMenu* pmenu = typpop.find(t); 213 QPopupMenu* pmenu = typpop.find(t);
214 if ( ltabs ) { 214 if ( ltabs ) {
215 if ( !pmenu && lot ) 215 if ( !pmenu && lot )
216 pmenu = menu; 216 pmenu = menu;
217 } else { 217 } else {
218 if ( !pmenu ) 218 if ( !pmenu )
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
244void StartMenu::launch() 244void 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 QWidget *active = qApp->activeWindow();
252 if ( active && active->isPopup() )
253 active->close();
254
251 launchMenu->popup( QPoint( 1, y ) ); 255 launchMenu->popup( QPoint( 1, y ) );
256 }
252} 257}
253 258
254const AppLnk* StartMenu::execToLink(const QString& appname) 259const AppLnk* StartMenu::execToLink(const QString& appname)
255{ 260{
256 const AppLnk* a = apps->findExec( appname ); 261 const AppLnk* a = apps->findExec( appname );
257 return a; 262 return a;
258} 263}
259 264
260void StartPopupMenu::keyPressEvent( QKeyEvent *e ) 265void StartPopupMenu::keyPressEvent( QKeyEvent *e )
261{ 266{
262 if ( e->key() == Key_F33 || e->key() == Key_Space ) { 267 if ( e->key() == Key_F33 || e->key() == Key_Space ) {
263 // "OK" button, little hacky 268 // "OK" button, little hacky
264 QKeyEvent ke(QEvent::KeyPress, Key_Enter, 13, 0); 269 QKeyEvent ke(QEvent::KeyPress, Key_Enter, 13, 0);
265 QPopupMenu::keyPressEvent( &ke ); 270 QPopupMenu::keyPressEvent( &ke );
266 } else { 271 } else {
267 QPopupMenu::keyPressEvent( e ); 272 QPopupMenu::keyPressEvent( e );
268 } 273 }
269} 274}
270 275
271static int compareAppletPositions(const void *a, const void *b) 276static int compareAppletPositions(const void *a, const void *b)
272{ 277{
273 const MenuApplet* aa = *(const MenuApplet**)a; 278 const MenuApplet* aa = *(const MenuApplet**)a;
274 const MenuApplet* ab = *(const MenuApplet**)b; 279 const MenuApplet* ab = *(const MenuApplet**)b;
275 int d = aa->iface->position() - ab->iface->position(); 280 int d = aa->iface->position() - ab->iface->position();
276 if ( d ) return d; 281 if ( d ) return d;
277 return QString::compare(aa->library->library(),ab->library->library()); 282 return QString::compare(aa->library->library(),ab->library->library());
278} 283}
279 284
280void StartMenu::clearApplets() 285void StartMenu::clearApplets()
281{ 286{
282 launchMenu-> hide(); 287 launchMenu-> hide();
283 288
284 for ( QIntDictIterator<MenuApplet> it ( applets ); it. current ( ); ++it ) { 289 for ( QIntDictIterator<MenuApplet> it ( applets ); it. current ( ); ++it ) {
285 MenuApplet *applet = it. current ( ); 290 MenuApplet *applet = it. current ( );
286 if ( launchMenu ) { 291 if ( launchMenu ) {
287 launchMenu-> removeItem ( applet-> id ); 292 launchMenu-> removeItem ( applet-> id );
288 delete applet-> popup; 293 delete applet-> popup;
289 } 294 }
290 295
291 applet-> iface-> release(); 296 applet-> iface-> release();
292 applet-> library-> unload(); 297 applet-> library-> unload();
293 delete applet-> library; 298 delete applet-> library;
294 } 299 }
295 applets.clear(); 300 applets.clear();
296} 301}
297 302
298 303
299 304
300void StartMenu::loadApplets() 305void StartMenu::loadApplets()
301{ 306{
302 Config cfg( "StartMenu" ); 307 Config cfg( "StartMenu" );
303 cfg.setGroup( "Applets" ); 308 cfg.setGroup( "Applets" );
304 309
305 // SafeMode causes too much problems, so we disable it for now -- 310 // 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 311 // maybe we should reenable it for OPIE 1.0 - sandman 26.09.02
307 312
308 bool safe = false; //cfg.readBoolEntry("SafeMode",FALSE); 313 bool safe = false; //cfg.readBoolEntry("SafeMode",FALSE);
309 if ( safe && !safety_tid ) 314 if ( safe && !safety_tid )
310 return; 315 return;
311 cfg.writeEntry("SafeMode",TRUE); 316 cfg.writeEntry("SafeMode",TRUE);
312 cfg.write(); 317 cfg.write();
313 QStringList exclude = cfg.readListEntry( "ExcludeApplets", ',' ); 318 QStringList exclude = cfg.readListEntry( "ExcludeApplets", ',' );
314 319
315 QString lang = getenv( "LANG" ); 320 QString lang = getenv( "LANG" );