summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--x11/libqpe-x11/qpe/qpeapplication.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/x11/libqpe-x11/qpe/qpeapplication.cpp b/x11/libqpe-x11/qpe/qpeapplication.cpp
index c4f8f38..ed815f8 100644
--- a/x11/libqpe-x11/qpe/qpeapplication.cpp
+++ b/x11/libqpe-x11/qpe/qpeapplication.cpp
@@ -313,385 +313,392 @@ QPEApplication::QPEApplication(int &arg, char** argv, Type t)
313 d->enqueueQCop( chanel, message, data ); 313 d->enqueueQCop( chanel, message, data );
314 } 314 }
315 flock( file.handle(), LOCK_UN ); 315 flock( file.handle(), LOCK_UN );
316 file.close(); 316 file.close();
317 file.remove(); 317 file.remove();
318 } 318 }
319 319
320 // read in some stuff from the command line 320 // read in some stuff from the command line
321 // we do not have setArgs so we need to take 321 // we do not have setArgs so we need to take
322 // care of that 322 // care of that
323 for ( int a = 0; a < arg; a++ ) { 323 for ( int a = 0; a < arg; a++ ) {
324 if ( qstrcmp( argv[a], "-preload" ) == 0 ) { 324 if ( qstrcmp( argv[a], "-preload" ) == 0 ) {
325 d->preloaded = TRUE; 325 d->preloaded = TRUE;
326 }else if ( qstrcmp( argv[a ] , "-preload-show" ) == 0 ) { 326 }else if ( qstrcmp( argv[a ] , "-preload-show" ) == 0 ) {
327 d->preloaded = TRUE; 327 d->preloaded = TRUE;
328 d->forceshow = TRUE; 328 d->forceshow = TRUE;
329 } 329 }
330 } 330 }
331 initTranslations(); 331 initTranslations();
332 applyStyle(); 332 applyStyle();
333 333
334 if ( type() == GuiServer ) 334 if ( type() == GuiServer )
335 ; 335 ;
336 336
337 installEventFilter( this ); 337 installEventFilter( this );
338 QPEMenuToolFocusManager::initialize(); 338 QPEMenuToolFocusManager::initialize();
339} 339}
340void QPEApplication::initTranslations() { 340void QPEApplication::initTranslations() {
341 // Translations add it 341 // Translations add it
342 QStringList langs = Global::languageList(); 342 QStringList langs = Global::languageList();
343 for ( QStringList::ConstIterator it = langs.begin(); it != langs.end(); ++it ) { 343 for ( QStringList::ConstIterator it = langs.begin(); it != langs.end(); ++it ) {
344 QString lang = *it; 344 QString lang = *it;
345 345
346 QTranslator * trans; 346 QTranslator * trans;
347 QString tfn; 347 QString tfn;
348 348
349 trans = new QTranslator( this ); 349 trans = new QTranslator( this );
350 tfn = qpeDir() + "/i18n/" + lang + "/libqpe.qm"; 350 tfn = qpeDir() + "/i18n/" + lang + "/libqpe.qm";
351 if ( trans->load( tfn ) ) 351 if ( trans->load( tfn ) )
352 installTranslator( trans ); 352 installTranslator( trans );
353 else 353 else
354 delete trans; 354 delete trans;
355 355
356 trans = new QTranslator( this ); 356 trans = new QTranslator( this );
357 tfn = qpeDir() + "/i18n/" + lang + "/" + d->appName + ".qm"; 357 tfn = qpeDir() + "/i18n/" + lang + "/" + d->appName + ".qm";
358 if ( trans->load( tfn ) ) 358 if ( trans->load( tfn ) )
359 installTranslator( trans ); 359 installTranslator( trans );
360 else 360 else
361 delete trans; 361 delete trans;
362 } 362 }
363} 363}
364QString QPEApplication::qpeDir() { 364QString QPEApplication::qpeDir() {
365 const char * base = getenv( "OPIEDIR" ); 365 const char * base = getenv( "OPIEDIR" );
366 if ( base ) 366 if ( base )
367 return QString( base ) + "/"; 367 return QString( base ) + "/";
368 368
369 return QString( "../" ); 369 return QString( "../" );
370} 370}
371QString QPEApplication::documentDir() { 371QString QPEApplication::documentDir() {
372 const char* base = getenv( "HOME"); 372 const char* base = getenv( "HOME");
373 if ( base ) 373 if ( base )
374 return QString( base ) + "/Documents"; 374 return QString( base ) + "/Documents";
375 375
376 return QString( "../Documents" ); 376 return QString( "../Documents" );
377} 377}
378void QPEApplication::applyStyle() { 378void QPEApplication::applyStyle() {
379 Config config( "qpe" ); 379 Config config( "qpe" );
380 380
381 config.setGroup( "Appearance" ); 381 config.setGroup( "Appearance" );
382 382
383 // Widget style 383 // Widget style
384 QString style = config.readEntry( "Style", "Light" ); 384 QString style = config.readEntry( "Style", "Light" );
385 internalSetStyle( style ); 385 internalSetStyle( style );
386 386
387 // Colors 387 // Colors
388 QColor bgcolor( config.readEntry( "Background", "#E5E1D5" ) ); 388 QColor bgcolor( config.readEntry( "Background", "#E5E1D5" ) );
389 QColor btncolor( config.readEntry( "Button", "#D6CDBB" ) ); 389 QColor btncolor( config.readEntry( "Button", "#D6CDBB" ) );
390 QPalette pal( btncolor, bgcolor ); 390 QPalette pal( btncolor, bgcolor );
391 QString color = config.readEntry( "Highlight", "#800000" ); 391 QString color = config.readEntry( "Highlight", "#800000" );
392 pal.setColor( QColorGroup::Highlight, QColor( color ) ); 392 pal.setColor( QColorGroup::Highlight, QColor( color ) );
393 color = config.readEntry( "HighlightedText", "#FFFFFF" ); 393 color = config.readEntry( "HighlightedText", "#FFFFFF" );
394 pal.setColor( QColorGroup::HighlightedText, QColor( color ) ); 394 pal.setColor( QColorGroup::HighlightedText, QColor( color ) );
395 color = config.readEntry( "Text", "#000000" ); 395 color = config.readEntry( "Text", "#000000" );
396 pal.setColor( QColorGroup::Text, QColor( color ) ); 396 pal.setColor( QColorGroup::Text, QColor( color ) );
397 color = config.readEntry( "ButtonText", "#000000" ); 397 color = config.readEntry( "ButtonText", "#000000" );
398 pal.setColor( QPalette::Active, QColorGroup::ButtonText, QColor( color ) ); 398 pal.setColor( QPalette::Active, QColorGroup::ButtonText, QColor( color ) );
399 color = config.readEntry( "Base", "#FFFFFF" ); 399 color = config.readEntry( "Base", "#FFFFFF" );
400 pal.setColor( QColorGroup::Base, QColor( color ) ); 400 pal.setColor( QColorGroup::Base, QColor( color ) );
401 401
402 pal.setColor( QPalette::Disabled, QColorGroup::Text, 402 pal.setColor( QPalette::Disabled, QColorGroup::Text,
403 pal.color( QPalette::Active, QColorGroup::Background ).dark() ); 403 pal.color( QPalette::Active, QColorGroup::Background ).dark() );
404 404
405 setPalette( pal, TRUE ); 405 setPalette( pal, TRUE );
406 406
407 407
408 408
409 // Font 409 // Font
410 QString ff = config.readEntry( "FontFamily", font().family() ); 410 QString ff = config.readEntry( "FontFamily", font().family() );
411 int fs = config.readNumEntry( "FontSize", font().pointSize() ); 411 int fs = config.readNumEntry( "FontSize", font().pointSize() );
412 setFont( QFont(ff, fs) ); 412 setFont( QFont(ff, fs) );
413} 413}
414int QPEApplication::defaultRotation() { 414int QPEApplication::defaultRotation() {
415 return 0; 415 return 0;
416} 416}
417void QPEApplication::setDefaultRotation(int r ) { 417void QPEApplication::setDefaultRotation(int r ) {
418 418
419} 419}
420void QPEApplication::grabKeyboard() { 420void QPEApplication::grabKeyboard() {
421 QPEApplication::Private * d = ( ( QPEApplication* ) qApp ) ->d; 421 QPEApplication::Private * d = ( ( QPEApplication* ) qApp ) ->d;
422 if ( qApp->type() == QApplication::GuiServer ) 422 if ( qApp->type() == QApplication::GuiServer )
423 d->kbgrabber = 0; 423 d->kbgrabber = 0;
424 else { 424 else {
425 QCopEnvelope e( "QPE/System", "grabKeyboard(QString)" ); 425 QCopEnvelope e( "QPE/System", "grabKeyboard(QString)" );
426 e << d->appName; 426 e << d->appName;
427 427
428 d->kbgrabber = 2; // me 428 d->kbgrabber = 2; // me
429 } 429 }
430} 430}
431void QPEApplication::ungrabKeyboard() { 431void QPEApplication::ungrabKeyboard() {
432 QPEApplication::Private * d = ( ( QPEApplication* ) qApp ) ->d; 432 QPEApplication::Private * d = ( ( QPEApplication* ) qApp ) ->d;
433 if ( d->kbgrabber == 2 ) { 433 if ( d->kbgrabber == 2 ) {
434 QCopEnvelope e( "QPE/System", "grabKeyboard(QString)" ); 434 QCopEnvelope e( "QPE/System", "grabKeyboard(QString)" );
435 e << QString::null; 435 e << QString::null;
436 436
437 d->kbregrab = FALSE; 437 d->kbregrab = FALSE;
438 d->kbgrabber = 0; 438 d->kbgrabber = 0;
439 } 439 }
440} 440}
441void QPEApplication::showMainWidget( QWidget* wid, bool b) { 441void QPEApplication::showMainWidget( QWidget* wid, bool b) {
442 d->show(wid, b ); 442 d->show(wid, b );
443} 443}
444void QPEApplication::showMainDocumentWidget( QWidget* mw, bool m) { 444void QPEApplication::showMainDocumentWidget( QWidget* mw, bool m) {
445 if ( mw && argc() == 2 ) 445 if ( mw && argc() == 2 )
446 Global::setDocument( mw, QString::fromUtf8(argv()[1] ) ); 446 Global::setDocument( mw, QString::fromUtf8(argv()[1] ) );
447 447
448 d->show(mw, m ); 448 d->show(mw, m );
449} 449}
450void QPEApplication::showDialog( QDialog* d, bool nomax ) { 450void QPEApplication::showDialog( QDialog* d, bool nomax ) {
451 QSize sh = d->sizeHint(); 451 QSize sh = d->sizeHint();
452 int w = QMAX(sh.width(),d->width()); 452 int w = QMAX(sh.width(),d->width());
453 int h = QMAX(sh.height(),d->height()); 453 int h = QMAX(sh.height(),d->height());
454 if ( !nomax 454 if ( !nomax
455 && ( w > qApp->desktop()->width()*3/4 455 && ( w > qApp->desktop()->width()*3/4
456 || h > qApp->desktop()->height()*3/4 ) ) 456 || h > qApp->desktop()->height()*3/4 ) )
457 { 457 {
458 d->showMaximized(); 458 d->showMaximized();
459 } else { 459 } else {
460 d->resize(w,h); 460 d->resize(w,h);
461 d->show(); 461 d->show();
462 } 462 }
463} 463}
464int QPEApplication::execDialog( QDialog* d, bool nomax) { 464int QPEApplication::execDialog( QDialog* d, bool nomax) {
465 showDialog(d,nomax); 465 showDialog(d,nomax);
466 return d->exec(); 466 return d->exec();
467} 467}
468void QPEApplication::setKeepRunning() { 468void QPEApplication::setKeepRunning() {
469 if ( qApp && qApp->inherits( "QPEApplication" ) ) { 469 if ( qApp && qApp->inherits( "QPEApplication" ) ) {
470 QPEApplication * qpeApp = ( QPEApplication* ) qApp; 470 QPEApplication * qpeApp = ( QPEApplication* ) qApp;
471 qpeApp->d->keep_running = TRUE; 471 qpeApp->d->keep_running = TRUE;
472 } 472 }
473} 473}
474bool QPEApplication::keepRunning()const { 474bool QPEApplication::keepRunning()const {
475 return d->keep_running; 475 return d->keep_running;
476} 476}
477bool QPEApplication::keyboardGrabbed()const { 477bool QPEApplication::keyboardGrabbed()const {
478 return d->kbgrabber; 478 return d->kbgrabber;
479} 479}
480int QPEApplication::exec() { 480int QPEApplication::exec() {
481 /* now send the QCOP stuff gotten from the file */ 481 /* now send the QCOP stuff gotten from the file */
482 d->sendQCopQ(); 482 d->sendQCopQ();
483 483
484 if ( d->keep_running ) { 484 if ( d->keep_running ) {
485 qWarning("going to exec"); 485 qWarning("going to exec");
486 int a = QApplication::exec(); 486 int a = QApplication::exec();
487 qWarning("left"); 487 qWarning("left");
488 return a; 488 return a;
489 } 489 }
490 490
491 { 491 {
492 QCopEnvelope e( "QPE/System", "closing(QString)" ); 492 QCopEnvelope e( "QPE/System", "closing(QString)" );
493 e << d->appName; 493 e << d->appName;
494 } 494 }
495 qWarning("processing events!"); 495 qWarning("processing events!");
496 processEvents(); 496 processEvents();
497 return 0; 497 return 0;
498} 498}
499void QPEApplication::internalSetStyle( const QString& ) { 499void QPEApplication::internalSetStyle( const QString& ) {
500 500
501} 501}
502void QPEApplication::systemMessage( const QCString& chan, const QByteArray& ) { 502void QPEApplication::systemMessage( const QCString& chan, const QByteArray& ) {
503 qWarning("QPEApplication::systemMessage( %s )", chan.data() ); 503 qWarning("QPEApplication::systemMessage( %s )", chan.data() );
504} 504}
505void QPEApplication::pidMessage( const QCString&, const QByteArray& ) { 505void QPEApplication::pidMessage( const QCString& msg, const QByteArray& ) {
506 if ( msg == "flush()" ) {
507 emit flush();
508 QCopEnvelope e( "QPE/Desktop", "flushDone(QString)" );
509 e << d->appName;
510 }else if ( msg == "reload()" ) {
511 emit reload();
512 }
506 513
507} 514}
508void QPEApplication::timerEvent( QTimerEvent* e ) { 515void QPEApplication::timerEvent( QTimerEvent* e ) {
509 if ( e->timerId() == d->presstimer && d->presswidget ) { 516 if ( e->timerId() == d->presstimer && d->presswidget ) {
510 // Right pressed 517 // Right pressed
511 postEvent( d->presswidget, 518 postEvent( d->presswidget,
512 new QMouseEvent( QEvent::MouseButtonPress, d->presspos, 519 new QMouseEvent( QEvent::MouseButtonPress, d->presspos,
513 RightButton, LeftButton ) ); 520 RightButton, LeftButton ) );
514 killTimer( d->presstimer ); 521 killTimer( d->presstimer );
515 d->presstimer = 0; 522 d->presstimer = 0;
516 } 523 }
517} 524}
518 525
519// InputMethods Hints 526// InputMethods Hints
520namespace { 527namespace {
521 static QPtrDict<void>* inputMethodDict = 0; 528 static QPtrDict<void>* inputMethodDict = 0;
522 static void createInputMethodDict(){ 529 static void createInputMethodDict(){
523 if ( !inputMethodDict ) 530 if ( !inputMethodDict )
524 inputMethodDict = new QPtrDict<void>; 531 inputMethodDict = new QPtrDict<void>;
525 } 532 }
526 533
527 static QPtrDict<void>* stylusDict = 0; 534 static QPtrDict<void>* stylusDict = 0;
528 static void createDict() { 535 static void createDict() {
529 if ( !stylusDict ) 536 if ( !stylusDict )
530 stylusDict = new QPtrDict<void>; 537 stylusDict = new QPtrDict<void>;
531 } 538 }
532}; 539};
533 540
534void QPEApplication::setInputMethodHint( QWidget* w, InputMethodHint mode ) { 541void QPEApplication::setInputMethodHint( QWidget* w, InputMethodHint mode ) {
535 createInputMethodDict(); 542 createInputMethodDict();
536 if ( mode == Normal ) { 543 if ( mode == Normal ) {
537 inputMethodDict->remove 544 inputMethodDict->remove
538 ( w ); 545 ( w );
539 }else { 546 }else {
540 inputMethodDict->insert( w, ( void* ) mode ); 547 inputMethodDict->insert( w, ( void* ) mode );
541 } 548 }
542} 549}
543QPEApplication::InputMethodHint QPEApplication::inputMethodHint( QWidget* w) { 550QPEApplication::InputMethodHint QPEApplication::inputMethodHint( QWidget* w) {
544 if ( inputMethodDict && w ) 551 if ( inputMethodDict && w )
545 return ( InputMethodHint ) ( int ) inputMethodDict->find( w ); 552 return ( InputMethodHint ) ( int ) inputMethodDict->find( w );
546 return Normal; 553 return Normal;
547} 554}
548 555
549 556
550void QPEApplication::removeSenderFromStylusDict() { 557void QPEApplication::removeSenderFromStylusDict() {
551 stylusDict->remove( ( void* ) sender() ); 558 stylusDict->remove( ( void* ) sender() );
552 if ( d->presswidget == sender() ) 559 if ( d->presswidget == sender() )
553 d->presswidget = 0; 560 d->presswidget = 0;
554} 561}
555void QPEApplication::setStylusOperation( QWidget* w, StylusMode mode) { 562void QPEApplication::setStylusOperation( QWidget* w, StylusMode mode) {
556 createDict(); 563 createDict();
557 if ( mode == LeftOnly ) { 564 if ( mode == LeftOnly ) {
558 stylusDict->remove 565 stylusDict->remove
559 ( w ); 566 ( w );
560 w->removeEventFilter( qApp ); 567 w->removeEventFilter( qApp );
561 }else { 568 }else {
562 stylusDict->insert( w, ( void* ) mode ); 569 stylusDict->insert( w, ( void* ) mode );
563 connect( w, SIGNAL( destroyed() ), qApp, SLOT( removeSenderFromStylusDict() ) ); 570 connect( w, SIGNAL( destroyed() ), qApp, SLOT( removeSenderFromStylusDict() ) );
564 w->installEventFilter( qApp ); 571 w->installEventFilter( qApp );
565 } 572 }
566} 573}
567QPEApplication::StylusMode QPEApplication::stylusOperation( QWidget* w) { 574QPEApplication::StylusMode QPEApplication::stylusOperation( QWidget* w) {
568 if ( stylusDict ) 575 if ( stylusDict )
569 return ( StylusMode ) ( int ) stylusDict->find( w ); 576 return ( StylusMode ) ( int ) stylusDict->find( w );
570 return LeftOnly; 577 return LeftOnly;
571} 578}
572 579
573// eventFilter...... 580// eventFilter......
574bool QPEApplication::eventFilter( QObject* o, QEvent* e ) { 581bool QPEApplication::eventFilter( QObject* o, QEvent* e ) {
575 /* 582 /*
576 * We want our WM to show Ok and a X button 583 * We want our WM to show Ok and a X button
577 * on dialogs 584 * on dialogs
578 * our part is to set the _NET_WM_CONTEXT_ACCEPT 585 * our part is to set the _NET_WM_CONTEXT_ACCEPT
579 * propery 586 * propery
580 * and then wait for a client message -zecke 587 * and then wait for a client message -zecke
581 * on show we will add the prop 588 * on show we will add the prop
582 */ 589 */
583 if (o->inherits("QDialog") && e->type() == QEvent::Show ) { 590 if (o->inherits("QDialog") && e->type() == QEvent::Show ) {
584 QDialog* dialog = (QDialog*)o; 591 QDialog* dialog = (QDialog*)o;
585 Atom wm_prot[45]; 592 Atom wm_prot[45];
586 int n = 0; 593 int n = 0;
587 wm_prot[n++] = d->wm_delete_window; 594 wm_prot[n++] = d->wm_delete_window;
588 wm_prot[n++] = d->wm_take_focus; 595 wm_prot[n++] = d->wm_take_focus;
589 wm_prot[n++] = d->wm_context_accept; 596 wm_prot[n++] = d->wm_context_accept;
590 if ( dialog->testWFlags( WStyle_ContextHelp ) ) 597 if ( dialog->testWFlags( WStyle_ContextHelp ) )
591 wm_prot[n++] = d->wm_context_help; 598 wm_prot[n++] = d->wm_context_help;
592 XSetWMProtocols( qt_xdisplay(), dialog->winId(), wm_prot, n ); 599 XSetWMProtocols( qt_xdisplay(), dialog->winId(), wm_prot, n );
593 return TRUE; // should be save 600 return TRUE; // should be save
594 } 601 }
595 if ( stylusDict && e->type() >= QEvent::MouseButtonPress && e->type() <= QEvent::MouseMove ) { 602 if ( stylusDict && e->type() >= QEvent::MouseButtonPress && e->type() <= QEvent::MouseMove ) {
596 QMouseEvent * me = ( QMouseEvent* ) e; 603 QMouseEvent * me = ( QMouseEvent* ) e;
597 StylusMode mode = (StylusMode)(int)stylusDict->find(o); 604 StylusMode mode = (StylusMode)(int)stylusDict->find(o);
598 switch (mode) { 605 switch (mode) {
599 case RightOnHold: 606 case RightOnHold:
600 switch ( me->type() ) { 607 switch ( me->type() ) {
601 case QEvent::MouseButtonPress: 608 case QEvent::MouseButtonPress:
602 if ( me->button() == LeftButton ) { 609 if ( me->button() == LeftButton ) {
603 d->presstimer = startTimer(500); // #### pref. 610 d->presstimer = startTimer(500); // #### pref.
604 d->presswidget = (QWidget*)o; 611 d->presswidget = (QWidget*)o;
605 d->presspos = me->pos(); 612 d->presspos = me->pos();
606 d->rightpressed = FALSE; 613 d->rightpressed = FALSE;
607 } 614 }
608 break; 615 break;
609 case QEvent::MouseMove: 616 case QEvent::MouseMove:
610 if (d->presstimer && (me->pos() - d->presspos).manhattanLength() > 8) { 617 if (d->presstimer && (me->pos() - d->presspos).manhattanLength() > 8) {
611 killTimer(d->presstimer); 618 killTimer(d->presstimer);
612 d->presstimer = 0; 619 d->presstimer = 0;
613 } 620 }
614 break; 621 break;
615 case QEvent::MouseButtonRelease: 622 case QEvent::MouseButtonRelease:
616 if ( me->button() == LeftButton ) { 623 if ( me->button() == LeftButton ) {
617 if ( d->presstimer ) { 624 if ( d->presstimer ) {
618 killTimer(d->presstimer); 625 killTimer(d->presstimer);
619 d->presstimer = 0; 626 d->presstimer = 0;
620 } 627 }
621 if ( d->rightpressed && d->presswidget ) { 628 if ( d->rightpressed && d->presswidget ) {
622 // Right released 629 // Right released
623 postEvent( d->presswidget, 630 postEvent( d->presswidget,
624 new QMouseEvent( QEvent::MouseButtonRelease, me->pos(), 631 new QMouseEvent( QEvent::MouseButtonRelease, me->pos(),
625 RightButton, LeftButton + RightButton ) ); 632 RightButton, LeftButton + RightButton ) );
626 // Left released, off-widget 633 // Left released, off-widget
627 postEvent( d->presswidget, 634 postEvent( d->presswidget,
628 new QMouseEvent( QEvent::MouseMove, QPoint( -1, -1), 635 new QMouseEvent( QEvent::MouseMove, QPoint( -1, -1),
629 LeftButton, LeftButton ) ); 636 LeftButton, LeftButton ) );
630 postEvent( d->presswidget, 637 postEvent( d->presswidget,
631 new QMouseEvent( QEvent::MouseButtonRelease, QPoint( -1, -1), 638 new QMouseEvent( QEvent::MouseButtonRelease, QPoint( -1, -1),
632 LeftButton, LeftButton ) ); 639 LeftButton, LeftButton ) );
633 d->rightpressed = FALSE; 640 d->rightpressed = FALSE;
634 return TRUE; // don't send the real Left release 641 return TRUE; // don't send the real Left release
635 } 642 }
636 } 643 }
637 break; 644 break;
638 default: 645 default:
639 break; 646 break;
640 } 647 }
641 break; 648 break;
642 default: 649 default:
643 ; 650 ;
644 } 651 }
645 } 652 }
646 else if ( e->type() == QEvent::KeyPress || e->type() == QEvent::KeyRelease ) { 653 else if ( e->type() == QEvent::KeyPress || e->type() == QEvent::KeyRelease ) {
647 QKeyEvent *ke = (QKeyEvent *)e; 654 QKeyEvent *ke = (QKeyEvent *)e;
648 if ( ke->key() == Key_Enter ) { 655 if ( ke->key() == Key_Enter ) {
649 if ( o->isA( "QRadioButton" ) || o->isA( "QCheckBox" ) ) { 656 if ( o->isA( "QRadioButton" ) || o->isA( "QCheckBox" ) ) {
650 postEvent( o, new QKeyEvent( e->type(), Key_Space, ' ', 657 postEvent( o, new QKeyEvent( e->type(), Key_Space, ' ',
651 ke->state(), " ", ke->isAutoRepeat(), ke->count() ) ); 658 ke->state(), " ", ke->isAutoRepeat(), ke->count() ) );
652 return TRUE; 659 return TRUE;
653 } 660 }
654 } 661 }
655 } 662 }
656 return FALSE; 663 return FALSE;
657} 664}
658 665
659// Quit stuff 666// Quit stuff
660void QPEApplication::restart() { 667void QPEApplication::restart() {
661 668
662} 669}
663void QPEApplication::shutdown() { 670void QPEApplication::shutdown() {
664 671
665} 672}
666void QPEApplication::tryQuit() { 673void QPEApplication::tryQuit() {
667 qWarning("TryQuit!!"); 674 qWarning("TryQuit!!");
668 if ( activeModalWidget() || strcmp( argv() [ 0 ], "embeddedkonsole" ) == 0 ) 675 if ( activeModalWidget() || strcmp( argv() [ 0 ], "embeddedkonsole" ) == 0 )
669 return ; // Inside modal loop or konsole. Too hard to save state. 676 return ; // Inside modal loop or konsole. Too hard to save state.
670 { 677 {
671 QCopEnvelope e( "QPE/System", "closing(QString)" ); 678 QCopEnvelope e( "QPE/System", "closing(QString)" );
672 e << d->appName; 679 e << d->appName;
673 } 680 }
674 processEvents(); 681 processEvents();
675 682
676 quit(); 683 quit();
677} 684}
678void QPEApplication::hideOrQuit() { 685void QPEApplication::hideOrQuit() {
679 qWarning("hide or close"); 686 qWarning("hide or close");
680 processEvents(); 687 processEvents();
681 qWarning("past processing"); 688 qWarning("past processing");
682 689
683 // If we are a preloaded application we don't actually quit, so emit 690 // If we are a preloaded application we don't actually quit, so emit
684 // a System message indicating we're quasi-closing. 691 // a System message indicating we're quasi-closing.
685 if ( d->preloaded && d->qpe_main_widget ) 692 if ( d->preloaded && d->qpe_main_widget )
686 693
687 { 694 {
688 qWarning("hiding"); 695 qWarning("hiding");
689 QCopEnvelope e("QPE/System", "fastAppHiding(QString)" ); 696 QCopEnvelope e("QPE/System", "fastAppHiding(QString)" );
690 e << d->appName; 697 e << d->appName;
691 d->qpe_main_widget->hide(); 698 d->qpe_main_widget->hide();
692 } 699 }
693 else 700 else
694 quit(); 701 quit();
695} 702}
696 703
697/*! 704/*!