-rw-r--r-- | core/launcher/launcher.cpp | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/core/launcher/launcher.cpp b/core/launcher/launcher.cpp index 344cd46..bdddd37 100644 --- a/core/launcher/launcher.cpp +++ b/core/launcher/launcher.cpp | |||
@@ -468,261 +468,260 @@ void Launcher::createGUI() | |||
468 | connect( qApp, SIGNAL(numLockStateToggle()), this, SLOT(toggleNumLockState()) ); | 468 | connect( qApp, SIGNAL(numLockStateToggle()), this, SLOT(toggleNumLockState()) ); |
469 | connect( qApp, SIGNAL(capsLockStateToggle()), this, SLOT(toggleCapsLockState()) ); | 469 | connect( qApp, SIGNAL(capsLockStateToggle()), this, SLOT(toggleCapsLockState()) ); |
470 | 470 | ||
471 | connect( tb, SIGNAL(tabSelected(const QString&)), | 471 | connect( tb, SIGNAL(tabSelected(const QString&)), |
472 | this, SLOT(showTab(const QString&)) ); | 472 | this, SLOT(showTab(const QString&)) ); |
473 | connect( tabs, SIGNAL(selected(const QString&)), | 473 | connect( tabs, SIGNAL(selected(const QString&)), |
474 | this, SLOT(viewSelected(const QString&)) ); | 474 | this, SLOT(viewSelected(const QString&)) ); |
475 | connect( tabs, SIGNAL(clicked(const AppLnk*)), | 475 | connect( tabs, SIGNAL(clicked(const AppLnk*)), |
476 | this, SLOT(select(const AppLnk*))); | 476 | this, SLOT(select(const AppLnk*))); |
477 | connect( tabs, SIGNAL(rightPressed(AppLnk*)), | 477 | connect( tabs, SIGNAL(rightPressed(AppLnk*)), |
478 | this, SLOT(properties(AppLnk*))); | 478 | this, SLOT(properties(AppLnk*))); |
479 | 479 | ||
480 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) | 480 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) |
481 | QCopChannel* sysChannel = new QCopChannel( "QPE/System", this ); | 481 | QCopChannel* sysChannel = new QCopChannel( "QPE/System", this ); |
482 | connect( sysChannel, SIGNAL(received(const QCString &, const QByteArray &)), | 482 | connect( sysChannel, SIGNAL(received(const QCString &, const QByteArray &)), |
483 | this, SLOT(systemMessage( const QCString &, const QByteArray &)) ); | 483 | this, SLOT(systemMessage( const QCString &, const QByteArray &)) ); |
484 | #endif | 484 | #endif |
485 | 485 | ||
486 | // all documents | 486 | // all documents |
487 | QImage img( Resource::loadImage( "DocsIcon" ) ); | 487 | QImage img( Resource::loadImage( "DocsIcon" ) ); |
488 | QPixmap pm; | 488 | QPixmap pm; |
489 | pm = img.smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ); | 489 | pm = img.smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ); |
490 | // It could add this itself if it handles docs | 490 | // It could add this itself if it handles docs |
491 | 491 | ||
492 | tabs->newView("Documents", pm, tr("Documents") )->setToolsEnabled( TRUE ); | 492 | tabs->newView("Documents", pm, tr("Documents") )->setToolsEnabled( TRUE ); |
493 | 493 | ||
494 | QTimer::singleShot( 0, tabs, SLOT( initLayout() ) ); | 494 | QTimer::singleShot( 0, tabs, SLOT( initLayout() ) ); |
495 | qApp->setMainWidget( this ); | 495 | qApp->setMainWidget( this ); |
496 | QTimer::singleShot( 500, this, SLOT( makeVisible() ) ); | 496 | QTimer::singleShot( 500, this, SLOT( makeVisible() ) ); |
497 | } | 497 | } |
498 | 498 | ||
499 | Launcher::~Launcher() | 499 | Launcher::~Launcher() |
500 | { | 500 | { |
501 | if ( tb ) | 501 | if ( tb ) |
502 | destroyGUI(); | 502 | destroyGUI(); |
503 | } | 503 | } |
504 | 504 | ||
505 | bool Launcher::requiresDocuments() const | 505 | bool Launcher::requiresDocuments() const |
506 | { | 506 | { |
507 | Config cfg( "Launcher" ); | 507 | Config cfg( "Launcher" ); |
508 | cfg.setGroup( "DocTab" ); | 508 | cfg.setGroup( "DocTab" ); |
509 | return cfg.readBoolEntry( "Enable", true ); | 509 | return cfg.readBoolEntry( "Enable", true ); |
510 | } | 510 | } |
511 | 511 | ||
512 | void Launcher::makeVisible() | 512 | void Launcher::makeVisible() |
513 | { | 513 | { |
514 | showMaximized(); | 514 | showMaximized(); |
515 | } | 515 | } |
516 | 516 | ||
517 | void Launcher::destroyGUI() | 517 | void Launcher::destroyGUI() |
518 | { | 518 | { |
519 | delete tb; | 519 | delete tb; |
520 | tb = 0; | 520 | tb = 0; |
521 | delete tabs; | 521 | delete tabs; |
522 | tabs =0; | 522 | tabs =0; |
523 | } | 523 | } |
524 | 524 | ||
525 | bool Launcher::eventFilter( QObject*, QEvent *ev ) | 525 | bool Launcher::eventFilter( QObject*, QEvent *ev ) |
526 | { | 526 | { |
527 | #ifdef QT_QWS_CUSTOM | 527 | #ifdef QT_QWS_CUSTOM |
528 | if ( ev->type() == QEvent::KeyPress ) { | 528 | if ( ev->type() == QEvent::KeyPress ) { |
529 | QKeyEvent *ke = (QKeyEvent *)ev; | 529 | QKeyEvent *ke = (QKeyEvent *)ev; |
530 | if ( ke->key() == Qt::Key_F11 ) { // menu key | 530 | if ( ke->key() == Qt::Key_F11 ) { // menu key |
531 | QWidget *active = qApp->activeWindow(); | 531 | QWidget *active = qApp->activeWindow(); |
532 | if ( active && active->isPopup() ) | 532 | if ( active && active->isPopup() ) |
533 | active->close(); | 533 | active->close(); |
534 | else { | 534 | else { |
535 | Global::terminateBuiltin("calibrate"); // No tr | 535 | Global::terminateBuiltin("calibrate"); // No tr |
536 | tb->launchStartMenu(); | 536 | tb->launchStartMenu(); |
537 | } | 537 | } |
538 | return TRUE; | 538 | return TRUE; |
539 | } | 539 | } |
540 | } | 540 | } |
541 | #else | 541 | #else |
542 | Q_UNUSED(ev); | 542 | Q_UNUSED(ev); |
543 | #endif | 543 | #endif |
544 | return FALSE; | 544 | return FALSE; |
545 | } | 545 | } |
546 | 546 | ||
547 | void Launcher::toggleSymbolInput() | 547 | void Launcher::toggleSymbolInput() |
548 | { | 548 | { |
549 | tb->toggleSymbolInput(); | 549 | tb->toggleSymbolInput(); |
550 | } | 550 | } |
551 | 551 | ||
552 | void Launcher::toggleNumLockState() | 552 | void Launcher::toggleNumLockState() |
553 | { | 553 | { |
554 | tb->toggleNumLockState(); | 554 | tb->toggleNumLockState(); |
555 | } | 555 | } |
556 | 556 | ||
557 | void Launcher::toggleCapsLockState() | 557 | void Launcher::toggleCapsLockState() |
558 | { | 558 | { |
559 | tb->toggleCapsLockState(); | 559 | tb->toggleCapsLockState(); |
560 | } | 560 | } |
561 | 561 | ||
562 | static bool isVisibleWindow(int wid) | 562 | static bool isVisibleWindow(int wid) |
563 | { | 563 | { |
564 | #ifdef Q_WS_QWS | 564 | #ifdef Q_WS_QWS |
565 | const QList<QWSWindow> &list = qwsServer->clientWindows(); | 565 | const QList<QWSWindow> &list = qwsServer->clientWindows(); |
566 | QWSWindow* w; | 566 | QWSWindow* w; |
567 | for (QListIterator<QWSWindow> it(list); (w=it.current()); ++it) { | 567 | for (QListIterator<QWSWindow> it(list); (w=it.current()); ++it) { |
568 | if ( w->winId() == wid ) | 568 | if ( w->winId() == wid ) |
569 | return !w->isFullyObscured(); | 569 | return !w->isFullyObscured(); |
570 | } | 570 | } |
571 | #endif | 571 | #endif |
572 | return FALSE; | 572 | return FALSE; |
573 | } | 573 | } |
574 | 574 | ||
575 | void Launcher::viewSelected(const QString& s) | 575 | void Launcher::viewSelected(const QString& s) |
576 | { | 576 | { |
577 | setCaption( s + tr(" - Launcher") ); | 577 | setCaption( s + tr(" - Launcher") ); |
578 | } | 578 | } |
579 | 579 | ||
580 | void Launcher::showTab(const QString& id) | 580 | void Launcher::showTab(const QString& id) |
581 | { | 581 | { |
582 | tabs->categoryBar->showTab(id); | 582 | tabs->categoryBar->showTab(id); |
583 | raise(); | 583 | raise(); |
584 | } | 584 | } |
585 | 585 | ||
586 | void Launcher::select( const AppLnk *appLnk ) | 586 | void Launcher::select( const AppLnk *appLnk ) |
587 | { | 587 | { |
588 | if ( appLnk->type() == "Folder" ) { // No tr | 588 | if ( appLnk->type() == "Folder" ) { // No tr |
589 | // Not supported: flat is simpler for the user | 589 | // Not supported: flat is simpler for the user |
590 | } else { | 590 | } else { |
591 | if ( appLnk->exec().isNull() ) { | 591 | if ( appLnk->exec().isNull() ) { |
592 | int i = QMessageBox::information(this,tr("No application"), | 592 | int i = QMessageBox::information(this,tr("No application"), |
593 | tr("<p>No application is defined for this document." | 593 | tr("<p>No application is defined for this document." |
594 | "<p>Type is %1.").arg(appLnk->type()), tr("OK"), tr("View as text"), 0, 0, 1); | 594 | "<p>Type is %1.").arg(appLnk->type()), tr("OK"), tr("View as text"), 0, 0, 1); |
595 | 595 | ||
596 | #if 0 | ||
597 | /* ### Fixme */ | 596 | /* ### Fixme */ |
598 | if ( i == 1 ) | 597 | if ( i == 1 ) |
599 | Global::execute(Service::app("Open/text/*"),appLnk->file()); | 598 | Global::execute("textedit",appLnk->file()); |
600 | #endif | 599 | |
601 | return; | 600 | return; |
602 | } | 601 | } |
603 | tabs->setBusy(TRUE); | 602 | tabs->setBusy(TRUE); |
604 | emit executing( appLnk ); | 603 | emit executing( appLnk ); |
605 | appLnk->execute(); | 604 | appLnk->execute(); |
606 | } | 605 | } |
607 | } | 606 | } |
608 | 607 | ||
609 | void Launcher::properties( AppLnk *appLnk ) | 608 | void Launcher::properties( AppLnk *appLnk ) |
610 | { | 609 | { |
611 | if ( appLnk->type() == "Folder" ) { // No tr | 610 | if ( appLnk->type() == "Folder" ) { // No tr |
612 | // Not supported: flat is simpler for the user | 611 | // Not supported: flat is simpler for the user |
613 | } else { | 612 | } else { |
614 | /* ### libqtopia FIXME also moving docLnks... */ | 613 | /* ### libqtopia FIXME also moving docLnks... */ |
615 | LnkProperties prop(appLnk,0 ); | 614 | LnkProperties prop(appLnk,0 ); |
616 | 615 | ||
617 | prop.showMaximized(); | 616 | prop.showMaximized(); |
618 | prop.exec(); | 617 | prop.exec(); |
619 | } | 618 | } |
620 | } | 619 | } |
621 | 620 | ||
622 | void Launcher::storageChanged( const QList<FileSystem> &fs ) | 621 | void Launcher::storageChanged( const QList<FileSystem> &fs ) |
623 | { | 622 | { |
624 | // ### update combo boxes if we had a combo box for the storage type | 623 | // ### update combo boxes if we had a combo box for the storage type |
625 | } | 624 | } |
626 | 625 | ||
627 | void Launcher::systemMessage( const QCString &msg, const QByteArray &data) | 626 | void Launcher::systemMessage( const QCString &msg, const QByteArray &data) |
628 | { | 627 | { |
629 | QDataStream stream( data, IO_ReadOnly ); | 628 | QDataStream stream( data, IO_ReadOnly ); |
630 | if ( msg == "busy()" ) { | 629 | if ( msg == "busy()" ) { |
631 | tb->startWait(); | 630 | tb->startWait(); |
632 | } else if ( msg == "notBusy(QString)" ) { | 631 | } else if ( msg == "notBusy(QString)" ) { |
633 | QString app; | 632 | QString app; |
634 | stream >> app; | 633 | stream >> app; |
635 | tabs->setBusy(FALSE); | 634 | tabs->setBusy(FALSE); |
636 | tb->stopWait(app); | 635 | tb->stopWait(app); |
637 | } else if (msg == "applyStyle()") { | 636 | } else if (msg == "applyStyle()") { |
638 | tabs->currentView()->relayout(); | 637 | tabs->currentView()->relayout(); |
639 | } | 638 | } |
640 | } | 639 | } |
641 | 640 | ||
642 | // These are the update functions from the server | 641 | // These are the update functions from the server |
643 | void Launcher::typeAdded( const QString& type, const QString& name, | 642 | void Launcher::typeAdded( const QString& type, const QString& name, |
644 | const QPixmap& pixmap, const QPixmap& ) | 643 | const QPixmap& pixmap, const QPixmap& ) |
645 | { | 644 | { |
646 | tabs->newView( type, pixmap, name ); | 645 | tabs->newView( type, pixmap, name ); |
647 | ids.append( type ); | 646 | ids.append( type ); |
648 | tb->refreshStartMenu(); | 647 | tb->refreshStartMenu(); |
649 | 648 | ||
650 | static bool first = TRUE; | 649 | static bool first = TRUE; |
651 | if ( first ) { | 650 | if ( first ) { |
652 | first = FALSE; | 651 | first = FALSE; |
653 | tabs->categoryBar->showTab(type); | 652 | tabs->categoryBar->showTab(type); |
654 | } | 653 | } |
655 | 654 | ||
656 | tabs->view( type )->setUpdatesEnabled( FALSE ); | 655 | tabs->view( type )->setUpdatesEnabled( FALSE ); |
657 | tabs->view( type )->setSortEnabled( FALSE ); | 656 | tabs->view( type )->setSortEnabled( FALSE ); |
658 | } | 657 | } |
659 | 658 | ||
660 | void Launcher::typeRemoved( const QString& type ) | 659 | void Launcher::typeRemoved( const QString& type ) |
661 | { | 660 | { |
662 | tabs->view( type )->removeAllItems(); | 661 | tabs->view( type )->removeAllItems(); |
663 | tabs->deleteView( type ); | 662 | tabs->deleteView( type ); |
664 | ids.remove( type ); | 663 | ids.remove( type ); |
665 | tb->refreshStartMenu(); | 664 | tb->refreshStartMenu(); |
666 | } | 665 | } |
667 | 666 | ||
668 | void Launcher::applicationAdded( const QString& type, const AppLnk& app ) | 667 | void Launcher::applicationAdded( const QString& type, const AppLnk& app ) |
669 | { | 668 | { |
670 | if ( app.type() == "Separator" ) // No tr | 669 | if ( app.type() == "Separator" ) // No tr |
671 | return; | 670 | return; |
672 | 671 | ||
673 | LauncherView *view = tabs->view( type ); | 672 | LauncherView *view = tabs->view( type ); |
674 | if ( view ) | 673 | if ( view ) |
675 | view->addItem( new AppLnk( app ), FALSE ); | 674 | view->addItem( new AppLnk( app ), FALSE ); |
676 | else | 675 | else |
677 | qWarning("addAppLnk: No view for type %s. Can't add app %s!", | 676 | qWarning("addAppLnk: No view for type %s. Can't add app %s!", |
678 | type.latin1(),app.name().latin1() ); | 677 | type.latin1(),app.name().latin1() ); |
679 | 678 | ||
680 | MimeType::registerApp( app ); | 679 | MimeType::registerApp( app ); |
681 | } | 680 | } |
682 | 681 | ||
683 | void Launcher::applicationRemoved( const QString& type, const AppLnk& app ) | 682 | void Launcher::applicationRemoved( const QString& type, const AppLnk& app ) |
684 | { | 683 | { |
685 | LauncherView *view = tabs->view( type ); | 684 | LauncherView *view = tabs->view( type ); |
686 | if ( view ) | 685 | if ( view ) |
687 | view->removeLink( app.linkFile() ); | 686 | view->removeLink( app.linkFile() ); |
688 | else | 687 | else |
689 | qWarning("removeAppLnk: No view for %s!", type.latin1() ); | 688 | qWarning("removeAppLnk: No view for %s!", type.latin1() ); |
690 | } | 689 | } |
691 | 690 | ||
692 | void Launcher::allApplicationsRemoved() | 691 | void Launcher::allApplicationsRemoved() |
693 | { | 692 | { |
694 | MimeType::clear(); | 693 | MimeType::clear(); |
695 | for ( QStringList::ConstIterator it=ids.begin(); it!= ids.end(); ++it) | 694 | for ( QStringList::ConstIterator it=ids.begin(); it!= ids.end(); ++it) |
696 | tabs->view( (*it) )->removeAllItems(); | 695 | tabs->view( (*it) )->removeAllItems(); |
697 | } | 696 | } |
698 | 697 | ||
699 | void Launcher::documentAdded( const DocLnk& doc ) | 698 | void Launcher::documentAdded( const DocLnk& doc ) |
700 | { | 699 | { |
701 | tabs->docView()->addItem( new DocLnk( doc ), FALSE ); | 700 | tabs->docView()->addItem( new DocLnk( doc ), FALSE ); |
702 | } | 701 | } |
703 | 702 | ||
704 | void Launcher::showLoadingDocs() | 703 | void Launcher::showLoadingDocs() |
705 | { | 704 | { |
706 | tabs->docView()->hide(); | 705 | tabs->docView()->hide(); |
707 | } | 706 | } |
708 | 707 | ||
709 | void Launcher::showDocTab() | 708 | void Launcher::showDocTab() |
710 | { | 709 | { |
711 | if ( tabs->categoryBar->currentView() == tabs->docView() ) | 710 | if ( tabs->categoryBar->currentView() == tabs->docView() ) |
712 | tabs->docView()->show(); | 711 | tabs->docView()->show(); |
713 | } | 712 | } |
714 | 713 | ||
715 | void Launcher::documentRemoved( const DocLnk& doc ) | 714 | void Launcher::documentRemoved( const DocLnk& doc ) |
716 | { | 715 | { |
717 | tabs->docView()->removeLink( doc.linkFile() ); | 716 | tabs->docView()->removeLink( doc.linkFile() ); |
718 | } | 717 | } |
719 | 718 | ||
720 | void Launcher::documentChanged( const DocLnk& oldDoc, const DocLnk& newDoc ) | 719 | void Launcher::documentChanged( const DocLnk& oldDoc, const DocLnk& newDoc ) |
721 | { | 720 | { |
722 | documentRemoved( oldDoc ); | 721 | documentRemoved( oldDoc ); |
723 | documentAdded( newDoc ); | 722 | documentAdded( newDoc ); |
724 | } | 723 | } |
725 | 724 | ||
726 | void Launcher::allDocumentsRemoved() | 725 | void Launcher::allDocumentsRemoved() |
727 | { | 726 | { |
728 | tabs->docView()->removeAllItems(); | 727 | tabs->docView()->removeAllItems(); |