author | sandman <sandman> | 2002-06-24 22:38:00 (UTC) |
---|---|---|
committer | sandman <sandman> | 2002-06-24 22:38:00 (UTC) |
commit | 1a3970869e87b41d475368e089a656de96a27561 (patch) (unidiff) | |
tree | 8e247a5ea8092e7d3abfda0a4d42b5e24653f9f0 /library | |
parent | b5e6ed78ad6075550985b092211318da47904897 (diff) | |
download | opie-1a3970869e87b41d475368e089a656de96a27561.zip opie-1a3970869e87b41d475368e089a656de96a27561.tar.gz opie-1a3970869e87b41d475368e089a656de96a27561.tar.bz2 |
Default font should be helvetica (compatiblity and looks nicer IMHO)
Do not hard-code the encoding, let FontDatabase pick it, when not
explicitly specified
-rw-r--r-- | library/qpeapplication.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/library/qpeapplication.cpp b/library/qpeapplication.cpp index 1534b0b..87a9739 100644 --- a/library/qpeapplication.cpp +++ b/library/qpeapplication.cpp | |||
@@ -416,388 +416,388 @@ static void setScreenSaverIntervals(int i1, int i2, int i3) | |||
416 | 416 | ||
417 | int v[4]; | 417 | int v[4]; |
418 | i1 = ssi(i1, config, "Dim","Interval_Dim", 30); | 418 | i1 = ssi(i1, config, "Dim","Interval_Dim", 30); |
419 | i2 = ssi(i2, config, "LightOff","Interval_LightOff", 20); | 419 | i2 = ssi(i2, config, "LightOff","Interval_LightOff", 20); |
420 | i3 = ssi(i3, config, "","Interval", 60); | 420 | i3 = ssi(i3, config, "","Interval", 60); |
421 | 421 | ||
422 | //qDebug("screen saver intervals: %d %d %d", i1, i2, i3); | 422 | //qDebug("screen saver intervals: %d %d %d", i1, i2, i3); |
423 | 423 | ||
424 | v[0] = QMAX( 1000*i1, 100); | 424 | v[0] = QMAX( 1000*i1, 100); |
425 | v[1] = QMAX( 1000*i2, 100); | 425 | v[1] = QMAX( 1000*i2, 100); |
426 | v[2] = QMAX( 1000*i3, 100); | 426 | v[2] = QMAX( 1000*i3, 100); |
427 | v[3] = 0; | 427 | v[3] = 0; |
428 | dim_on = ( (i1 != 0) ? config.readNumEntry("Dim",1) : FALSE ); | 428 | dim_on = ( (i1 != 0) ? config.readNumEntry("Dim",1) : FALSE ); |
429 | lightoff_on = ( (i2 != 0 ) ? config.readNumEntry("LightOff",1) : FALSE ); | 429 | lightoff_on = ( (i2 != 0 ) ? config.readNumEntry("LightOff",1) : FALSE ); |
430 | if ( !i1 && !i2 && !i3 ) | 430 | if ( !i1 && !i2 && !i3 ) |
431 | QWSServer::setScreenSaverInterval(0); | 431 | QWSServer::setScreenSaverInterval(0); |
432 | else | 432 | else |
433 | QWSServer::setScreenSaverIntervals(v); | 433 | QWSServer::setScreenSaverIntervals(v); |
434 | } | 434 | } |
435 | 435 | ||
436 | static void setScreenSaverInterval(int interval) | 436 | static void setScreenSaverInterval(int interval) |
437 | { | 437 | { |
438 | setScreenSaverIntervals(-1,-1,interval); | 438 | setScreenSaverIntervals(-1,-1,interval); |
439 | } | 439 | } |
440 | 440 | ||
441 | 441 | ||
442 | /*! | 442 | /*! |
443 | \class QPEApplication qpeapplication.h | 443 | \class QPEApplication qpeapplication.h |
444 | \brief The QPEApplication class implements various system services | 444 | \brief The QPEApplication class implements various system services |
445 | that are available to all Qtopia applications. | 445 | that are available to all Qtopia applications. |
446 | 446 | ||
447 | Simply by using QPEApplication instead of QApplication, a plain Qt | 447 | Simply by using QPEApplication instead of QApplication, a plain Qt |
448 | application becomes a Qtopia application. It automatically follows | 448 | application becomes a Qtopia application. It automatically follows |
449 | style changes, quits and raises, and in the | 449 | style changes, quits and raises, and in the |
450 | case of \link docwidget.html document-oriented\endlink applications, | 450 | case of \link docwidget.html document-oriented\endlink applications, |
451 | changes the current displayed document in response to the environment. | 451 | changes the current displayed document in response to the environment. |
452 | */ | 452 | */ |
453 | 453 | ||
454 | /*! | 454 | /*! |
455 | \fn void QPEApplication::clientMoused() | 455 | \fn void QPEApplication::clientMoused() |
456 | 456 | ||
457 | \internal | 457 | \internal |
458 | */ | 458 | */ |
459 | 459 | ||
460 | /*! | 460 | /*! |
461 | \fn void QPEApplication::timeChanged(); | 461 | \fn void QPEApplication::timeChanged(); |
462 | 462 | ||
463 | This signal is emitted when the time jumps forward or backwards | 463 | This signal is emitted when the time jumps forward or backwards |
464 | by more than the normal passage of time. | 464 | by more than the normal passage of time. |
465 | */ | 465 | */ |
466 | 466 | ||
467 | /*! | 467 | /*! |
468 | \fn void QPEApplication::clockChanged( bool ampm ); | 468 | \fn void QPEApplication::clockChanged( bool ampm ); |
469 | 469 | ||
470 | This signal is emitted when the user changes the style | 470 | This signal is emitted when the user changes the style |
471 | of clock. If \a ampm is TRUE, the user wants a 12-hour | 471 | of clock. If \a ampm is TRUE, the user wants a 12-hour |
472 | AM/PM close, otherwise, they want a 24-hour clock. | 472 | AM/PM close, otherwise, they want a 24-hour clock. |
473 | */ | 473 | */ |
474 | 474 | ||
475 | /*! | 475 | /*! |
476 | \fn void QPEApplication::appMessage( const QCString& msg, const QByteArray& data ) | 476 | \fn void QPEApplication::appMessage( const QCString& msg, const QByteArray& data ) |
477 | 477 | ||
478 | This signal is emitted when a message is received on the | 478 | This signal is emitted when a message is received on the |
479 | QPE/Application/<i>appname</i> QCop channel for this application. | 479 | QPE/Application/<i>appname</i> QCop channel for this application. |
480 | 480 | ||
481 | The slot to which you connect this signal uses \a msg and \a data | 481 | The slot to which you connect this signal uses \a msg and \a data |
482 | in the following way: | 482 | in the following way: |
483 | 483 | ||
484 | \code | 484 | \code |
485 | void MyWidget::receive( const QCString& msg, const QByteArray& data ) | 485 | void MyWidget::receive( const QCString& msg, const QByteArray& data ) |
486 | { | 486 | { |
487 | QDataStream stream( data, IO_ReadOnly ); | 487 | QDataStream stream( data, IO_ReadOnly ); |
488 | if ( msg == "someMessage(int,int,int)" ) { | 488 | if ( msg == "someMessage(int,int,int)" ) { |
489 | int a,b,c; | 489 | int a,b,c; |
490 | stream >> a >> b >> c; | 490 | stream >> a >> b >> c; |
491 | ... | 491 | ... |
492 | } else if ( msg == "otherMessage(QString)" ) { | 492 | } else if ( msg == "otherMessage(QString)" ) { |
493 | ... | 493 | ... |
494 | } | 494 | } |
495 | } | 495 | } |
496 | \endcode | 496 | \endcode |
497 | 497 | ||
498 | \sa qcop.html | 498 | \sa qcop.html |
499 | */ | 499 | */ |
500 | 500 | ||
501 | /*! | 501 | /*! |
502 | Constructs a QPEApplication just as you would construct | 502 | Constructs a QPEApplication just as you would construct |
503 | a QApplication, passing \a argc, \a argv, and \a t. | 503 | a QApplication, passing \a argc, \a argv, and \a t. |
504 | */ | 504 | */ |
505 | QPEApplication::QPEApplication( int& argc, char **argv, Type t ) | 505 | QPEApplication::QPEApplication( int& argc, char **argv, Type t ) |
506 | : QApplication( hack(argc), argv, t ) | 506 | : QApplication( hack(argc), argv, t ) |
507 | { | 507 | { |
508 | int dw = desktop()->width(); | 508 | int dw = desktop()->width(); |
509 | if ( dw < 200 ) { | 509 | if ( dw < 200 ) { |
510 | // setFont( QFont( "helvetica", 8 ) ); | 510 | // setFont( QFont( "helvetica", 8 ) ); |
511 | AppLnk::setSmallIconSize(10); | 511 | AppLnk::setSmallIconSize(10); |
512 | AppLnk::setBigIconSize(28); | 512 | AppLnk::setBigIconSize(28); |
513 | } | 513 | } |
514 | 514 | ||
515 | d = new QPEApplicationData; | 515 | d = new QPEApplicationData; |
516 | QMimeSourceFactory::setDefaultFactory(new ResourceMimeFactory); | 516 | QMimeSourceFactory::setDefaultFactory(new ResourceMimeFactory); |
517 | 517 | ||
518 | connect(this, SIGNAL(lastWindowClosed()), this, SLOT(hideOrQuit())); | 518 | connect(this, SIGNAL(lastWindowClosed()), this, SLOT(hideOrQuit())); |
519 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) | 519 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) |
520 | 520 | ||
521 | QString qcopfn("/tmp/qcop-msg-"); | 521 | QString qcopfn("/tmp/qcop-msg-"); |
522 | qcopfn += QString(argv[0]); // append command name | 522 | qcopfn += QString(argv[0]); // append command name |
523 | 523 | ||
524 | QFile f(qcopfn); | 524 | QFile f(qcopfn); |
525 | if ( f.open(IO_ReadOnly) ) { | 525 | if ( f.open(IO_ReadOnly) ) { |
526 | flock(f.handle(), LOCK_EX); | 526 | flock(f.handle(), LOCK_EX); |
527 | } | 527 | } |
528 | 528 | ||
529 | sysChannel = new QCopChannel( "QPE/System", this ); | 529 | sysChannel = new QCopChannel( "QPE/System", this ); |
530 | connect( sysChannel, SIGNAL(received(const QCString &, const QByteArray &)), | 530 | connect( sysChannel, SIGNAL(received(const QCString &, const QByteArray &)), |
531 | this, SLOT(systemMessage( const QCString &, const QByteArray &)) ); | 531 | this, SLOT(systemMessage( const QCString &, const QByteArray &)) ); |
532 | 532 | ||
533 | QCString channel = QCString(argv[0]); | 533 | QCString channel = QCString(argv[0]); |
534 | channel.replace(QRegExp(".*/"),""); | 534 | channel.replace(QRegExp(".*/"),""); |
535 | d->appName = channel; | 535 | d->appName = channel; |
536 | channel = "QPE/Application/" + channel; | 536 | channel = "QPE/Application/" + channel; |
537 | pidChannel = new QCopChannel( channel, this); | 537 | pidChannel = new QCopChannel( channel, this); |
538 | connect( pidChannel, SIGNAL(received(const QCString &, const QByteArray &)), | 538 | connect( pidChannel, SIGNAL(received(const QCString &, const QByteArray &)), |
539 | this, SLOT(pidMessage(const QCString &, const QByteArray &))); | 539 | this, SLOT(pidMessage(const QCString &, const QByteArray &))); |
540 | 540 | ||
541 | if ( f.isOpen() ) { | 541 | if ( f.isOpen() ) { |
542 | d->keep_running = FALSE; | 542 | d->keep_running = FALSE; |
543 | QDataStream ds(&f); | 543 | QDataStream ds(&f); |
544 | QCString channel, message; | 544 | QCString channel, message; |
545 | QByteArray data; | 545 | QByteArray data; |
546 | while(!ds.atEnd()) { | 546 | while(!ds.atEnd()) { |
547 | ds >> channel >> message >> data; | 547 | ds >> channel >> message >> data; |
548 | d->enqueueQCop(channel,message,data); | 548 | d->enqueueQCop(channel,message,data); |
549 | } | 549 | } |
550 | 550 | ||
551 | flock(f.handle(), LOCK_UN); | 551 | flock(f.handle(), LOCK_UN); |
552 | f.close(); | 552 | f.close(); |
553 | f.remove(); | 553 | f.remove(); |
554 | } | 554 | } |
555 | 555 | ||
556 | for (int a=0; a<argc; a++) { | 556 | for (int a=0; a<argc; a++) { |
557 | if ( qstrcmp(argv[a],"-preload")==0 ) { | 557 | if ( qstrcmp(argv[a],"-preload")==0 ) { |
558 | argv[a] = argv[a+1]; | 558 | argv[a] = argv[a+1]; |
559 | a++; | 559 | a++; |
560 | d->preloaded = TRUE; | 560 | d->preloaded = TRUE; |
561 | argc-=1; | 561 | argc-=1; |
562 | } else if ( qstrcmp(argv[a],"-preload-show")==0 ) { | 562 | } else if ( qstrcmp(argv[a],"-preload-show")==0 ) { |
563 | argv[a] = argv[a+1]; | 563 | argv[a] = argv[a+1]; |
564 | a++; | 564 | a++; |
565 | d->preloaded = TRUE; | 565 | d->preloaded = TRUE; |
566 | d->forceshow = TRUE; | 566 | d->forceshow = TRUE; |
567 | argc-=1; | 567 | argc-=1; |
568 | } | 568 | } |
569 | } | 569 | } |
570 | 570 | ||
571 | /* overide stored arguments */ | 571 | /* overide stored arguments */ |
572 | setArgs(argc, argv); | 572 | setArgs(argc, argv); |
573 | 573 | ||
574 | #endif | 574 | #endif |
575 | 575 | ||
576 | qwsSetDecoration( new QPEDecoration() ); | 576 | qwsSetDecoration( new QPEDecoration() ); |
577 | 577 | ||
578 | #ifndef QT_NO_TRANSLATION | 578 | #ifndef QT_NO_TRANSLATION |
579 | QStringList langs = Global::languageList(); | 579 | QStringList langs = Global::languageList(); |
580 | for (QStringList::ConstIterator it = langs.begin(); it!=langs.end(); ++it) { | 580 | for (QStringList::ConstIterator it = langs.begin(); it!=langs.end(); ++it) { |
581 | QString lang = *it; | 581 | QString lang = *it; |
582 | 582 | ||
583 | QTranslator * trans; | 583 | QTranslator * trans; |
584 | QString tfn; | 584 | QString tfn; |
585 | 585 | ||
586 | trans = new QTranslator(this); | 586 | trans = new QTranslator(this); |
587 | tfn = qpeDir()+"/i18n/"+lang+"/libqpe.qm"; | 587 | tfn = qpeDir()+"/i18n/"+lang+"/libqpe.qm"; |
588 | if ( trans->load( tfn )) | 588 | if ( trans->load( tfn )) |
589 | installTranslator( trans ); | 589 | installTranslator( trans ); |
590 | else | 590 | else |
591 | delete trans; | 591 | delete trans; |
592 | 592 | ||
593 | trans = new QTranslator(this); | 593 | trans = new QTranslator(this); |
594 | tfn = qpeDir()+"/i18n/"+lang+"/"+d->appName+".qm"; | 594 | tfn = qpeDir()+"/i18n/"+lang+"/"+d->appName+".qm"; |
595 | if ( trans->load( tfn )) | 595 | if ( trans->load( tfn )) |
596 | installTranslator( trans ); | 596 | installTranslator( trans ); |
597 | else | 597 | else |
598 | delete trans; | 598 | delete trans; |
599 | 599 | ||
600 | //###language/font hack; should look it up somewhere | 600 | //###language/font hack; should look it up somewhere |
601 | if ( lang == "ja" || lang == "zh_CN" || lang == "zh_TW" || lang == "ko" ) { | 601 | if ( lang == "ja" || lang == "zh_CN" || lang == "zh_TW" || lang == "ko" ) { |
602 | QFont fn = FontManager::unicodeFont( FontManager::Proportional ); | 602 | QFont fn = FontManager::unicodeFont( FontManager::Proportional ); |
603 | setFont( fn ); | 603 | setFont( fn ); |
604 | } | 604 | } |
605 | else { | 605 | else { |
606 | Config config( "qpe" ); | 606 | Config config( "qpe" ); |
607 | config.setGroup( "Appearance" ); | 607 | config.setGroup( "Appearance" ); |
608 | QString familyStr = config.readEntry( "FontFamily", "fixed" ); | 608 | QString familyStr = config.readEntry( "FontFamily", "helvetica" ); |
609 | QString styleStr = config.readEntry( "FontStyle", "Regular" ); | 609 | QString styleStr = config.readEntry( "FontStyle", "Regular" ); |
610 | QString sizeStr = config.readEntry( "FontSize", "10" ); | 610 | QString sizeStr = config.readEntry( "FontSize", "10" ); |
611 | QString charSetStr = config.readEntry( "FontCharSet", "iso10646-1" ); | 611 | QString charSetStr = config.readEntry( "FontCharSet", QString::null ); |
612 | bool ok; | 612 | bool ok; |
613 | int i_size = sizeStr.toInt( &ok, 10 ); | 613 | int i_size = sizeStr.toInt( &ok, 10 ); |
614 | FontDatabase fdb; | 614 | FontDatabase fdb; |
615 | QFont selectedFont = fdb.font( familyStr, styleStr, i_size, charSetStr ); | 615 | QFont selectedFont = fdb.font( familyStr, styleStr, i_size, charSetStr ); |
616 | setFont( selectedFont ); | 616 | setFont( selectedFont ); |
617 | } | 617 | } |
618 | } | 618 | } |
619 | 619 | ||
620 | #endif | 620 | #endif |
621 | 621 | ||
622 | applyStyle(); | 622 | applyStyle(); |
623 | 623 | ||
624 | if ( type() == GuiServer ) { | 624 | if ( type() == GuiServer ) { |
625 | setScreenSaverInterval(-1); | 625 | setScreenSaverInterval(-1); |
626 | setVolume(); | 626 | setVolume(); |
627 | QWSServer::setScreenSaver(new QPEScreenSaver); | 627 | QWSServer::setScreenSaver(new QPEScreenSaver); |
628 | } | 628 | } |
629 | 629 | ||
630 | installEventFilter( this ); | 630 | installEventFilter( this ); |
631 | 631 | ||
632 | QPEMenuToolFocusManager::initialize(); | 632 | QPEMenuToolFocusManager::initialize(); |
633 | 633 | ||
634 | #ifdef QT_NO_QWS_CURSOR | 634 | #ifdef QT_NO_QWS_CURSOR |
635 | // if we have no cursor, probably don't want tooltips | 635 | // if we have no cursor, probably don't want tooltips |
636 | QToolTip::setEnabled( FALSE ); | 636 | QToolTip::setEnabled( FALSE ); |
637 | #endif | 637 | #endif |
638 | } | 638 | } |
639 | 639 | ||
640 | static QPtrDict<void>* inputMethodDict=0; | 640 | static QPtrDict<void>* inputMethodDict=0; |
641 | static void createInputMethodDict() | 641 | static void createInputMethodDict() |
642 | { | 642 | { |
643 | if ( !inputMethodDict ) | 643 | if ( !inputMethodDict ) |
644 | inputMethodDict = new QPtrDict<void>; | 644 | inputMethodDict = new QPtrDict<void>; |
645 | } | 645 | } |
646 | 646 | ||
647 | /*! | 647 | /*! |
648 | Returns the currently set hint to the system as to whether | 648 | Returns the currently set hint to the system as to whether |
649 | \a w has any use for text input methods. | 649 | \a w has any use for text input methods. |
650 | 650 | ||
651 | \sa setInputMethodHint() | 651 | \sa setInputMethodHint() |
652 | */ | 652 | */ |
653 | QPEApplication::InputMethodHint QPEApplication::inputMethodHint( QWidget* w ) | 653 | QPEApplication::InputMethodHint QPEApplication::inputMethodHint( QWidget* w ) |
654 | { | 654 | { |
655 | if ( inputMethodDict && w ) | 655 | if ( inputMethodDict && w ) |
656 | return (InputMethodHint)(int)inputMethodDict->find(w); | 656 | return (InputMethodHint)(int)inputMethodDict->find(w); |
657 | return Normal; | 657 | return Normal; |
658 | } | 658 | } |
659 | 659 | ||
660 | /*! | 660 | /*! |
661 | \enum QPEApplication::InputMethodHint | 661 | \enum QPEApplication::InputMethodHint |
662 | 662 | ||
663 | \value Normal the application sometimes needs text input (the default). | 663 | \value Normal the application sometimes needs text input (the default). |
664 | \value AlwaysOff the application never needs text input. | 664 | \value AlwaysOff the application never needs text input. |
665 | \value AlwaysOn the application always needs text input. | 665 | \value AlwaysOn the application always needs text input. |
666 | */ | 666 | */ |
667 | 667 | ||
668 | /*! | 668 | /*! |
669 | Hints to the system that \a w has use for text input methods | 669 | Hints to the system that \a w has use for text input methods |
670 | as specified by \a mode. | 670 | as specified by \a mode. |
671 | 671 | ||
672 | \sa inputMethodHint() | 672 | \sa inputMethodHint() |
673 | */ | 673 | */ |
674 | void QPEApplication::setInputMethodHint( QWidget* w, InputMethodHint mode ) | 674 | void QPEApplication::setInputMethodHint( QWidget* w, InputMethodHint mode ) |
675 | { | 675 | { |
676 | createInputMethodDict(); | 676 | createInputMethodDict(); |
677 | if ( mode == Normal ) { | 677 | if ( mode == Normal ) { |
678 | inputMethodDict->remove(w); | 678 | inputMethodDict->remove(w); |
679 | } else { | 679 | } else { |
680 | inputMethodDict->insert(w,(void*)mode); | 680 | inputMethodDict->insert(w,(void*)mode); |
681 | } | 681 | } |
682 | } | 682 | } |
683 | 683 | ||
684 | class HackDialog : public QDialog | 684 | class HackDialog : public QDialog |
685 | { | 685 | { |
686 | public: | 686 | public: |
687 | void acceptIt() { accept(); } | 687 | void acceptIt() { accept(); } |
688 | void rejectIt() { reject(); } | 688 | void rejectIt() { reject(); } |
689 | }; | 689 | }; |
690 | 690 | ||
691 | 691 | ||
692 | void QPEApplication::mapToDefaultAction( QWSKeyEvent *ke, int key ) | 692 | void QPEApplication::mapToDefaultAction( QWSKeyEvent *ke, int key ) |
693 | { | 693 | { |
694 | // specialised actions for certain widgets. May want to | 694 | // specialised actions for certain widgets. May want to |
695 | // add more stuff here. | 695 | // add more stuff here. |
696 | if ( activePopupWidget() && activePopupWidget()->inherits( "QListBox" ) | 696 | if ( activePopupWidget() && activePopupWidget()->inherits( "QListBox" ) |
697 | && activePopupWidget()->parentWidget() | 697 | && activePopupWidget()->parentWidget() |
698 | && activePopupWidget()->parentWidget()->inherits( "QComboBox" ) ) | 698 | && activePopupWidget()->parentWidget()->inherits( "QComboBox" ) ) |
699 | key = Qt::Key_Return; | 699 | key = Qt::Key_Return; |
700 | 700 | ||
701 | if ( activePopupWidget() && activePopupWidget()->inherits( "QPopupMenu" ) ) | 701 | if ( activePopupWidget() && activePopupWidget()->inherits( "QPopupMenu" ) ) |
702 | key = Qt::Key_Return; | 702 | key = Qt::Key_Return; |
703 | 703 | ||
704 | ke->simpleData.keycode = key; | 704 | ke->simpleData.keycode = key; |
705 | } | 705 | } |
706 | 706 | ||
707 | class HackWidget : public QWidget | 707 | class HackWidget : public QWidget |
708 | { | 708 | { |
709 | public: | 709 | public: |
710 | bool needsOk() | 710 | bool needsOk() |
711 | { return (getWState() & WState_Reserved1 ); } | 711 | { return (getWState() & WState_Reserved1 ); } |
712 | }; | 712 | }; |
713 | 713 | ||
714 | /*! | 714 | /*! |
715 | \internal | 715 | \internal |
716 | */ | 716 | */ |
717 | bool QPEApplication::qwsEventFilter( QWSEvent *e ) | 717 | bool QPEApplication::qwsEventFilter( QWSEvent *e ) |
718 | { | 718 | { |
719 | if ( !d->notbusysent && e->type == QWSEvent::Focus ) { | 719 | if ( !d->notbusysent && e->type == QWSEvent::Focus ) { |
720 | if ( qApp->type() != QApplication::GuiServer ) { | 720 | if ( qApp->type() != QApplication::GuiServer ) { |
721 | QCopEnvelope e("QPE/System", "notBusy(QString)" ); | 721 | QCopEnvelope e("QPE/System", "notBusy(QString)" ); |
722 | e << d->appName; | 722 | e << d->appName; |
723 | } | 723 | } |
724 | d->notbusysent=TRUE; | 724 | d->notbusysent=TRUE; |
725 | } | 725 | } |
726 | if ( type() == GuiServer ) { | 726 | if ( type() == GuiServer ) { |
727 | switch ( e->type ) { | 727 | switch ( e->type ) { |
728 | case QWSEvent::Mouse: | 728 | case QWSEvent::Mouse: |
729 | if ( e->asMouse()->simpleData.state && !QWidget::find(e->window()) ) | 729 | if ( e->asMouse()->simpleData.state && !QWidget::find(e->window()) ) |
730 | emit clientMoused(); | 730 | emit clientMoused(); |
731 | } | 731 | } |
732 | } | 732 | } |
733 | if ( e->type == QWSEvent::Key ) { | 733 | if ( e->type == QWSEvent::Key ) { |
734 | if ( d->kbgrabber == 1 ) | 734 | if ( d->kbgrabber == 1 ) |
735 | return TRUE; | 735 | return TRUE; |
736 | QWSKeyEvent *ke = (QWSKeyEvent *)e; | 736 | QWSKeyEvent *ke = (QWSKeyEvent *)e; |
737 | if ( ke->simpleData.keycode == Qt::Key_F33 ) { | 737 | if ( ke->simpleData.keycode == Qt::Key_F33 ) { |
738 | // Use special "OK" key to press "OK" on top level widgets | 738 | // Use special "OK" key to press "OK" on top level widgets |
739 | QWidget *active = activeWindow(); | 739 | QWidget *active = activeWindow(); |
740 | QWidget *popup = 0; | 740 | QWidget *popup = 0; |
741 | if ( active && active->isPopup() ) { | 741 | if ( active && active->isPopup() ) { |
742 | popup = active; | 742 | popup = active; |
743 | active = active->parentWidget(); | 743 | active = active->parentWidget(); |
744 | } | 744 | } |
745 | if ( active && (int)active->winId() == ke->simpleData.window && | 745 | if ( active && (int)active->winId() == ke->simpleData.window && |
746 | !active->testWFlags( WStyle_Customize|WType_Popup|WType_Desktop )) { | 746 | !active->testWFlags( WStyle_Customize|WType_Popup|WType_Desktop )) { |
747 | if ( ke->simpleData.is_press ) { | 747 | if ( ke->simpleData.is_press ) { |
748 | if ( popup ) | 748 | if ( popup ) |
749 | popup->close(); | 749 | popup->close(); |
750 | if ( active->inherits( "QDialog" ) ) { | 750 | if ( active->inherits( "QDialog" ) ) { |
751 | HackDialog *d = (HackDialog *)active; | 751 | HackDialog *d = (HackDialog *)active; |
752 | d->acceptIt(); | 752 | d->acceptIt(); |
753 | return TRUE; | 753 | return TRUE; |
754 | } else if ( ((HackWidget *)active)->needsOk() ) { | 754 | } else if ( ((HackWidget *)active)->needsOk() ) { |
755 | QSignal s; | 755 | QSignal s; |
756 | s.connect( active, SLOT( accept() ) ); | 756 | s.connect( active, SLOT( accept() ) ); |
757 | s.activate(); | 757 | s.activate(); |
758 | } else { | 758 | } else { |
759 | // do the same as with the select key: Map to the default action of the widget: | 759 | // do the same as with the select key: Map to the default action of the widget: |
760 | mapToDefaultAction( ke, Qt::Key_Return ); | 760 | mapToDefaultAction( ke, Qt::Key_Return ); |
761 | } | 761 | } |
762 | } | 762 | } |
763 | } | 763 | } |
764 | } else if ( ke->simpleData.keycode == Qt::Key_F30 ) { | 764 | } else if ( ke->simpleData.keycode == Qt::Key_F30 ) { |
765 | // Use special "select" key to do whatever default action a widget has | 765 | // Use special "select" key to do whatever default action a widget has |
766 | mapToDefaultAction( ke, Qt::Key_Space ); | 766 | mapToDefaultAction( ke, Qt::Key_Space ); |
767 | } else if ( ke->simpleData.keycode == Qt::Key_Escape && | 767 | } else if ( ke->simpleData.keycode == Qt::Key_Escape && |
768 | ke->simpleData.is_press ) { | 768 | ke->simpleData.is_press ) { |
769 | // Escape key closes app if focus on toplevel | 769 | // Escape key closes app if focus on toplevel |
770 | QWidget *active = activeWindow(); | 770 | QWidget *active = activeWindow(); |
771 | if ( active && active->testWFlags( WType_TopLevel ) && | 771 | if ( active && active->testWFlags( WType_TopLevel ) && |
772 | (int)active->winId() == ke->simpleData.window && | 772 | (int)active->winId() == ke->simpleData.window && |
773 | !active->testWFlags( WStyle_Dialog|WStyle_Customize|WType_Popup|WType_Desktop )) { | 773 | !active->testWFlags( WStyle_Dialog|WStyle_Customize|WType_Popup|WType_Desktop )) { |
774 | if ( active->inherits( "QDialog" ) ) { | 774 | if ( active->inherits( "QDialog" ) ) { |
775 | HackDialog *d = (HackDialog *)active; | 775 | HackDialog *d = (HackDialog *)active; |
776 | d->rejectIt(); | 776 | d->rejectIt(); |
777 | return TRUE; | 777 | return TRUE; |
778 | } else if ( strcmp( argv()[0], "embeddedkonsole") != 0 ) { | 778 | } else if ( strcmp( argv()[0], "embeddedkonsole") != 0 ) { |
779 | active->close(); | 779 | active->close(); |
780 | } | 780 | } |
781 | } | 781 | } |
782 | } | 782 | } |
783 | 783 | ||
784 | #if QT_VERSION < 231 | 784 | #if QT_VERSION < 231 |
785 | // Filter out the F4/Launcher key from apps | 785 | // Filter out the F4/Launcher key from apps |
786 | // ### The launcher key may not always be F4 on all devices | 786 | // ### The launcher key may not always be F4 on all devices |
787 | if ( ((QWSKeyEvent *)e)->simpleData.keycode == Qt::Key_F4 ) | 787 | if ( ((QWSKeyEvent *)e)->simpleData.keycode == Qt::Key_F4 ) |
788 | return TRUE; | 788 | return TRUE; |
789 | #endif | 789 | #endif |
790 | } | 790 | } |
791 | if ( e->type == QWSEvent::Focus ) { | 791 | if ( e->type == QWSEvent::Focus ) { |
792 | QWSFocusEvent *fe = (QWSFocusEvent*)e; | 792 | QWSFocusEvent *fe = (QWSFocusEvent*)e; |
793 | QWidget* nfw = QWidget::find(e->window()); | 793 | QWidget* nfw = QWidget::find(e->window()); |
794 | if ( !fe->simpleData.get_focus ) { | 794 | if ( !fe->simpleData.get_focus ) { |
795 | QWidget *active = activeWindow(); | 795 | QWidget *active = activeWindow(); |
796 | while ( active && active->isPopup() ) { | 796 | while ( active && active->isPopup() ) { |
797 | active->close(); | 797 | active->close(); |
798 | active = activeWindow(); | 798 | active = activeWindow(); |
799 | } | 799 | } |
800 | if ( !nfw && d->kbgrabber == 2 ) { | 800 | if ( !nfw && d->kbgrabber == 2 ) { |
801 | ungrabKeyboard(); | 801 | ungrabKeyboard(); |
802 | d->kbregrab = TRUE; // want kb back when we're active | 802 | d->kbregrab = TRUE; // want kb back when we're active |
803 | } | 803 | } |