summaryrefslogtreecommitdiff
authorsandman <sandman>2002-09-29 13:32:19 (UTC)
committer sandman <sandman>2002-09-29 13:32:19 (UTC)
commit3e8ee39d31b43f01524670df6cb048efc2194b9a (patch) (unidiff)
treef0f20464e77c4d0e3d03cf5065dc77070279c4f9
parentb7fcdc189dacc8e054a32090af4677bc86955491 (diff)
downloadopie-3e8ee39d31b43f01524670df6cb048efc2194b9a.zip
opie-3e8ee39d31b43f01524670df6cb048efc2194b9a.tar.gz
opie-3e8ee39d31b43f01524670df6cb048efc2194b9a.tar.bz2
Fast-load should work now again -- I think this was a Qtopia merge problem
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--library/global.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/library/global.cpp b/library/global.cpp
index 7438891..2e4d03f 100644
--- a/library/global.cpp
+++ b/library/global.cpp
@@ -439,256 +439,259 @@ QWidget *Global::restart( bool )
439 Input methods are indicated in the taskbar by a small icon. If the 439 Input methods are indicated in the taskbar by a small icon. If the
440 input method is activated (shown) then it takes up some proportion 440 input method is activated (shown) then it takes up some proportion
441 of the bottom of the screen, to allow the user to interact (input 441 of the bottom of the screen, to allow the user to interact (input
442 characters) with it. 442 characters) with it.
443 443
444 \sa hideInputMethod() 444 \sa hideInputMethod()
445*/ 445*/
446void Global::showInputMethod() 446void Global::showInputMethod()
447{ 447{
448#if defined(Q_WS_QWS) && !defined(QT_NO_COP) 448#if defined(Q_WS_QWS) && !defined(QT_NO_COP)
449 QCopChannel::send( "QPE/TaskBar", "showInputMethod()" ); 449 QCopChannel::send( "QPE/TaskBar", "showInputMethod()" );
450#endif 450#endif
451} 451}
452 452
453/*! 453/*!
454 Explicitly hide the current input method. 454 Explicitly hide the current input method.
455 455
456 The current input method is still indicated in the taskbar, but no 456 The current input method is still indicated in the taskbar, but no
457 longer takes up screen space, and can no longer be interacted with. 457 longer takes up screen space, and can no longer be interacted with.
458 458
459 \sa showInputMethod() 459 \sa showInputMethod()
460*/ 460*/
461void Global::hideInputMethod() 461void Global::hideInputMethod()
462{ 462{
463#if defined(Q_WS_QWS) && !defined(QT_NO_COP) 463#if defined(Q_WS_QWS) && !defined(QT_NO_COP)
464 QCopChannel::send( "QPE/TaskBar", "hideInputMethod()" ); 464 QCopChannel::send( "QPE/TaskBar", "hideInputMethod()" );
465#endif 465#endif
466} 466}
467 467
468 468
469/*! 469/*!
470 \internal 470 \internal
471*/ 471*/
472bool Global::isBuiltinCommand( const QString &name ) 472bool Global::isBuiltinCommand( const QString &name )
473{ 473{
474 if(!builtin) 474 if(!builtin)
475 return FALSE; // yes, it can happen 475 return FALSE; // yes, it can happen
476 for (int i = 0; builtin[i].file; i++) { 476 for (int i = 0; builtin[i].file; i++) {
477 if ( builtin[i].file == name ) { 477 if ( builtin[i].file == name ) {
478 return TRUE; 478 return TRUE;
479 } 479 }
480 } 480 }
481 return FALSE; 481 return FALSE;
482} 482}
483 483
484Global::Command* Global::builtin=0; 484Global::Command* Global::builtin=0;
485QGuardedPtr<QWidget> *Global::running=0; 485QGuardedPtr<QWidget> *Global::running=0;
486 486
487/*! 487/*!
488 \class Global::Command 488 \class Global::Command
489 \brief The Global::Command class is internal. 489 \brief The Global::Command class is internal.
490 \internal 490 \internal
491*/ 491*/
492 492
493/*! 493/*!
494 \internal 494 \internal
495*/ 495*/
496void Global::setBuiltinCommands( Command* list ) 496void Global::setBuiltinCommands( Command* list )
497{ 497{
498 if ( running ) 498 if ( running )
499 delete [] running; 499 delete [] running;
500 500
501 builtin = list; 501 builtin = list;
502 int count = 0; 502 int count = 0;
503 if (!builtin) 503 if (!builtin)
504 return; 504 return;
505 while ( builtin[count].file ) 505 while ( builtin[count].file )
506 count++; 506 count++;
507 507
508 running = new QGuardedPtr<QWidget> [ count ]; 508 running = new QGuardedPtr<QWidget> [ count ];
509} 509}
510 510
511/*! 511/*!
512 \internal 512 \internal
513*/ 513*/
514void Global::setDocument( QWidget* receiver, const QString& document ) 514void Global::setDocument( QWidget* receiver, const QString& document )
515{ 515{
516 Emitter emitter(receiver,document); 516 Emitter emitter(receiver,document);
517} 517}
518 518
519/*! 519/*!
520 \internal 520 \internal
521*/ 521*/
522bool Global::terminateBuiltin( const QString& n ) 522bool Global::terminateBuiltin( const QString& n )
523{ 523{
524 if (!builtin) 524 if (!builtin)
525 return FALSE; 525 return FALSE;
526 for (int i = 0; builtin[i].file; i++) { 526 for (int i = 0; builtin[i].file; i++) {
527 if ( builtin[i].file == n ) { 527 if ( builtin[i].file == n ) {
528 delete running[i]; 528 delete running[i];
529 return TRUE; 529 return TRUE;
530 } 530 }
531 } 531 }
532 return FALSE; 532 return FALSE;
533} 533}
534 534
535/*! 535/*!
536 \internal 536 \internal
537*/ 537*/
538void Global::terminate( const AppLnk* app ) 538void Global::terminate( const AppLnk* app )
539{ 539{
540 //if ( terminateBuiltin(app->exec()) ) return; // maybe? haven't tried this 540 //if ( terminateBuiltin(app->exec()) ) return; // maybe? haven't tried this
541 541
542#ifndef QT_NO_COP 542#ifndef QT_NO_COP
543 QCString channel = "QPE/Application/" + app->exec().utf8(); 543 QCString channel = "QPE/Application/" + app->exec().utf8();
544 if ( QCopChannel::isRegistered(channel) ) { 544 if ( QCopChannel::isRegistered(channel) ) {
545 QCopEnvelope e(channel, "quit()"); 545 QCopEnvelope e(channel, "quit()");
546 } 546 }
547#endif 547#endif
548} 548}
549 549
550/*! 550/*!
551 Low-level function to run command \a c. 551 Low-level function to run command \a c.
552 552
553 \warning Do not use this function. Use execute instead. 553 \warning Do not use this function. Use execute instead.
554 554
555 \sa execute() 555 \sa execute()
556*/ 556*/
557void Global::invoke(const QString &c) 557void Global::invoke(const QString &c)
558{ 558{
559 // Convert the command line in to a list of arguments 559 // Convert the command line in to a list of arguments
560 QStringList list = QStringList::split(QRegExp(" *"),c); 560 QStringList list = QStringList::split(QRegExp(" *"),c);
561 561
562#if defined(Q_WS_QWS) && !defined(QT_NO_COP) 562#if defined(Q_WS_QWS) && !defined(QT_NO_COP)
563 QString ap=list[0]; 563 QString ap=list[0];
564 // see if the application is already running 564 // see if the application is already running
565 // XXX should lock file /tmp/qcop-msg-ap 565 // XXX should lock file /tmp/qcop-msg-ap
566 if ( QCopChannel::isRegistered( ("QPE/Application/" + ap).latin1() ) ) { 566 if ( QCopChannel::isRegistered( ("QPE/Application/" + ap).latin1() ) ) {
567 // If the channel is already register, the app is already running, so show it.
568 { QCopEnvelope env( ("QPE/Application/" + ap).latin1(), "raise()" ); }
569
567 QCopEnvelope e("QPE/System", "notBusy(QString)" ); 570 QCopEnvelope e("QPE/System", "notBusy(QString)" );
568 e << ap; 571 e << ap;
569 return; 572 return;
570 } 573 }
571 // XXX should unlock file /tmp/qcop-msg-ap 574 // XXX should unlock file /tmp/qcop-msg-ap
572 //see if it is being started 575 //see if it is being started
573 if ( StartingAppList::isStarting( ap ) ) { 576 if ( StartingAppList::isStarting( ap ) ) {
574 QCopEnvelope e("QPE/System", "notBusy(QString)" ); 577 QCopEnvelope e("QPE/System", "notBusy(QString)" );
575 e << ap; 578 e << ap;
576 return; 579 return;
577 } 580 }
578 581
579#endif 582#endif
580 583
581#ifdef QT_NO_QWS_MULTIPROCESS 584#ifdef QT_NO_QWS_MULTIPROCESS
582 QMessageBox::warning( 0, "Error", "Could not find the application " + c, "Ok", 0, 0, 0, 1 ); 585 QMessageBox::warning( 0, "Error", "Could not find the application " + c, "Ok", 0, 0, 0, 1 );
583#else 586#else
584 587
585 QStrList slist; 588 QStrList slist;
586 unsigned int j; 589 unsigned int j;
587 for ( j = 0; j < list.count(); j++ ) 590 for ( j = 0; j < list.count(); j++ )
588 slist.append( list[j].utf8() ); 591 slist.append( list[j].utf8() );
589 592
590 const char **args = new (const char *)[slist.count() + 1]; 593 const char **args = new (const char *)[slist.count() + 1];
591 for ( j = 0; j < slist.count(); j++ ) 594 for ( j = 0; j < slist.count(); j++ )
592 args[j] = slist.at(j); 595 args[j] = slist.at(j);
593 args[j] = NULL; 596 args[j] = NULL;
594 597
595#if defined(Q_WS_QWS) && !defined(QT_NO_COP) 598#if defined(Q_WS_QWS) && !defined(QT_NO_COP)
596 // an attempt to show a wait... 599 // an attempt to show a wait...
597 // more logic should be used, but this will be fine for the moment... 600 // more logic should be used, but this will be fine for the moment...
598 QCopEnvelope ( "QPE/System", "busy()" ); 601 QCopEnvelope ( "QPE/System", "busy()" );
599#endif 602#endif
600 603
601#ifdef HAVE_QUICKEXEC 604#ifdef HAVE_QUICKEXEC
602 QString libexe = qpeDir()+"/binlib/lib"+args[0] + ".so"; 605 QString libexe = qpeDir()+"/binlib/lib"+args[0] + ".so";
603 qDebug("libfile = %s", libexe.latin1() ); 606 qDebug("libfile = %s", libexe.latin1() );
604 if ( QFile::exists( libexe ) ) { 607 if ( QFile::exists( libexe ) ) {
605 qDebug("calling quickexec %s", libexe.latin1() ); 608 qDebug("calling quickexec %s", libexe.latin1() );
606 quickexecv( libexe.utf8().data(), (const char **)args ); 609 quickexecv( libexe.utf8().data(), (const char **)args );
607 } else 610 } else
608#endif 611#endif
609 { 612 {
610 if ( !::vfork() ) { 613 if ( !::vfork() ) {
611 for ( int fd = 3; fd < 100; fd++ ) 614 for ( int fd = 3; fd < 100; fd++ )
612 ::close( fd ); 615 ::close( fd );
613 ::setpgid( ::getpid(), ::getppid() ); 616 ::setpgid( ::getpid(), ::getppid() );
614 // Try bindir first, so that foo/bar works too 617 // Try bindir first, so that foo/bar works too
615 ::execv( qpeDir()+"/bin/"+args[0], (char * const *)args ); 618 ::execv( qpeDir()+"/bin/"+args[0], (char * const *)args );
616 ::execvp( args[0], (char * const *)args ); 619 ::execvp( args[0], (char * const *)args );
617 _exit( -1 ); 620 _exit( -1 );
618 } 621 }
619 } 622 }
620 StartingAppList::add( list[0] ); 623 StartingAppList::add( list[0] );
621#endif //QT_NO_QWS_MULTIPROCESS 624#endif //QT_NO_QWS_MULTIPROCESS
622} 625}
623 626
624 627
625/*! 628/*!
626 Executes the application identfied by \a c, passing \a 629 Executes the application identfied by \a c, passing \a
627 document if it isn't null. 630 document if it isn't null.
628 631
629 Note that a better approach might be to send a QCop message to the 632 Note that a better approach might be to send a QCop message to the
630 application's QPE/Application/\e{appname} channel. 633 application's QPE/Application/\e{appname} channel.
631*/ 634*/
632void Global::execute( const QString &c, const QString& document ) 635void Global::execute( const QString &c, const QString& document )
633{ 636{
634 if ( qApp->type() != QApplication::GuiServer ) { 637 if ( qApp->type() != QApplication::GuiServer ) {
635 // ask the server to do the work 638 // ask the server to do the work
636#if defined(Q_WS_QWS) && !defined(QT_NO_COP) 639#if defined(Q_WS_QWS) && !defined(QT_NO_COP)
637 if ( document.isNull() ) { 640 if ( document.isNull() ) {
638 QCopEnvelope e( "QPE/System", "execute(QString)" ); 641 QCopEnvelope e( "QPE/System", "execute(QString)" );
639 e << c; 642 e << c;
640 } else { 643 } else {
641 QCopEnvelope e( "QPE/System", "execute(QString,QString)" ); 644 QCopEnvelope e( "QPE/System", "execute(QString,QString)" );
642 e << c << document; 645 e << c << document;
643 } 646 }
644#endif 647#endif
645 return; 648 return;
646 } 649 }
647 650
648 // Attempt to execute the app using a builtin class for the app first 651 // Attempt to execute the app using a builtin class for the app first
649 // else try and find it in the bin directory 652 // else try and find it in the bin directory
650 if (builtin) { 653 if (builtin) {
651 for (int i = 0; builtin[i].file; i++) { 654 for (int i = 0; builtin[i].file; i++) {
652 if ( builtin[i].file == c ) { 655 if ( builtin[i].file == c ) {
653 if ( running[i] ) { 656 if ( running[i] ) {
654 if ( !document.isNull() && builtin[i].documentary ) 657 if ( !document.isNull() && builtin[i].documentary )
655 setDocument(running[i], document); 658 setDocument(running[i], document);
656 running[i]->raise(); 659 running[i]->raise();
657 running[i]->show(); 660 running[i]->show();
658 running[i]->setActiveWindow(); 661 running[i]->setActiveWindow();
659 } else { 662 } else {
660 running[i] = builtin[i].func( builtin[i].maximized ); 663 running[i] = builtin[i].func( builtin[i].maximized );
661 } 664 }
662#ifndef QT_NO_COP 665#ifndef QT_NO_COP
663 QCopEnvelope e("QPE/System", "notBusy(QString)" ); 666 QCopEnvelope e("QPE/System", "notBusy(QString)" );
664 e << c; // that was quick ;-) 667 e << c; // that was quick ;-)
665#endif 668#endif
666 return; 669 return;
667 } 670 }
668 } 671 }
669 } 672 }
670 673
671 //Global::invoke(c, document); 674 //Global::invoke(c, document);
672 675
673 // Convert the command line in to a list of arguments 676 // Convert the command line in to a list of arguments
674 QStringList list = QStringList::split(QRegExp(" *"),c); 677 QStringList list = QStringList::split(QRegExp(" *"),c);
675 678
676#if defined(Q_WS_QWS) && !defined(QT_NO_COP) 679#if defined(Q_WS_QWS) && !defined(QT_NO_COP)
677 QString ap=list[0]; 680 QString ap=list[0];
678 681
679 qDebug("executing %s", ap.latin1() ); 682 qDebug("executing %s", ap.latin1() );
680 if ( ap == "suspend" ) { 683 if ( ap == "suspend" ) {
681 QWSServer::sendKeyEvent( 0xffff, Qt::Key_F34, FALSE, TRUE, FALSE ); 684 QWSServer::sendKeyEvent( 0xffff, Qt::Key_F34, FALSE, TRUE, FALSE );
682 return; 685 return;
683 } 686 }
684 687
685 /* if need be, sending a qcop message will result in an invoke, see 688 /* if need be, sending a qcop message will result in an invoke, see
686 preceeding function */ 689 preceeding function */
687 invoke( ap ); 690 invoke( ap );
688 //{ QCopEnvelope env( ("QPE/Application/" + ap).latin1(), "raise()" ); } 691 //{ QCopEnvelope env( ("QPE/Application/" + ap).latin1(), "raise()" ); }
689 if ( !document.isEmpty() ) { 692 if ( !document.isEmpty() ) {
690 QCopEnvelope env( ("QPE/Application/" + ap).latin1(), "setDocument(QString)" ); 693 QCopEnvelope env( ("QPE/Application/" + ap).latin1(), "setDocument(QString)" );
691 env << document; 694 env << document;
692 } 695 }
693#endif 696#endif
694} 697}