-rw-r--r-- | x11/libqpe-x11/qpe/qpeapplication.cpp | 9 |
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 | |||
@@ -441,129 +441,136 @@ void QPEApplication::ungrabKeyboard() { | |||
441 | void QPEApplication::showMainWidget( QWidget* wid, bool b) { | 441 | void QPEApplication::showMainWidget( QWidget* wid, bool b) { |
442 | d->show(wid, b ); | 442 | d->show(wid, b ); |
443 | } | 443 | } |
444 | void QPEApplication::showMainDocumentWidget( QWidget* mw, bool m) { | 444 | void 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 | } |
450 | void QPEApplication::showDialog( QDialog* d, bool nomax ) { | 450 | void 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 | } |
464 | int QPEApplication::execDialog( QDialog* d, bool nomax) { | 464 | int QPEApplication::execDialog( QDialog* d, bool nomax) { |
465 | showDialog(d,nomax); | 465 | showDialog(d,nomax); |
466 | return d->exec(); | 466 | return d->exec(); |
467 | } | 467 | } |
468 | void QPEApplication::setKeepRunning() { | 468 | void 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 | } |
474 | bool QPEApplication::keepRunning()const { | 474 | bool QPEApplication::keepRunning()const { |
475 | return d->keep_running; | 475 | return d->keep_running; |
476 | } | 476 | } |
477 | bool QPEApplication::keyboardGrabbed()const { | 477 | bool QPEApplication::keyboardGrabbed()const { |
478 | return d->kbgrabber; | 478 | return d->kbgrabber; |
479 | } | 479 | } |
480 | int QPEApplication::exec() { | 480 | int 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 | } |
499 | void QPEApplication::internalSetStyle( const QString& ) { | 499 | void QPEApplication::internalSetStyle( const QString& ) { |
500 | 500 | ||
501 | } | 501 | } |
502 | void QPEApplication::systemMessage( const QCString& chan, const QByteArray& ) { | 502 | void QPEApplication::systemMessage( const QCString& chan, const QByteArray& ) { |
503 | qWarning("QPEApplication::systemMessage( %s )", chan.data() ); | 503 | qWarning("QPEApplication::systemMessage( %s )", chan.data() ); |
504 | } | 504 | } |
505 | void QPEApplication::pidMessage( const QCString&, const QByteArray& ) { | 505 | void 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 | } |
508 | void QPEApplication::timerEvent( QTimerEvent* e ) { | 515 | void 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 |
520 | namespace { | 527 | namespace { |
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 | ||
534 | void QPEApplication::setInputMethodHint( QWidget* w, InputMethodHint mode ) { | 541 | void 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 | } |
543 | QPEApplication::InputMethodHint QPEApplication::inputMethodHint( QWidget* w) { | 550 | QPEApplication::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 | ||
550 | void QPEApplication::removeSenderFromStylusDict() { | 557 | void 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 | } |
555 | void QPEApplication::setStylusOperation( QWidget* w, StylusMode mode) { | 562 | void 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 | } |
567 | QPEApplication::StylusMode QPEApplication::stylusOperation( QWidget* w) { | 574 | QPEApplication::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 ); |