summaryrefslogtreecommitdiff
path: root/core/launcher/launcher.cpp
Unidiff
Diffstat (limited to 'core/launcher/launcher.cpp') (more/less context) (show whitespace changes)
-rw-r--r--core/launcher/launcher.cpp20
1 files changed, 0 insertions, 20 deletions
diff --git a/core/launcher/launcher.cpp b/core/launcher/launcher.cpp
index 87a54bf..aa357ca 100644
--- a/core/launcher/launcher.cpp
+++ b/core/launcher/launcher.cpp
@@ -380,288 +380,268 @@ LauncherView *LauncherTabWidget::currentView(void)
380} 380}
381 381
382 382
383 383
384void LauncherTabWidget::launcherMessage( const QCString &msg, const QByteArray &data) 384void LauncherTabWidget::launcherMessage( const QCString &msg, const QByteArray &data)
385{ 385{
386 QDataStream stream( data, IO_ReadOnly ); 386 QDataStream stream( data, IO_ReadOnly );
387 if ( msg == "setTabView(QString,int)" ) { 387 if ( msg == "setTabView(QString,int)" ) {
388 QString id; 388 QString id;
389 stream >> id; 389 stream >> id;
390 int mode; 390 int mode;
391 stream >> mode; 391 stream >> mode;
392 if ( view(id) ) 392 if ( view(id) )
393 view(id)->setViewMode( (LauncherView::ViewMode)mode ); 393 view(id)->setViewMode( (LauncherView::ViewMode)mode );
394 } else if ( msg == "setTabBackground(QString,int,QString)" ) { 394 } else if ( msg == "setTabBackground(QString,int,QString)" ) {
395 QString id; 395 QString id;
396 stream >> id; 396 stream >> id;
397 int mode; 397 int mode;
398 stream >> mode; 398 stream >> mode;
399 QString pixmapOrColor; 399 QString pixmapOrColor;
400 stream >> pixmapOrColor; 400 stream >> pixmapOrColor;
401 if ( view(id) ) 401 if ( view(id) )
402 view(id)->setBackgroundType( (LauncherView::BackgroundType)mode, pixmapOrColor ); 402 view(id)->setBackgroundType( (LauncherView::BackgroundType)mode, pixmapOrColor );
403 if ( id == "Documents" ) 403 if ( id == "Documents" )
404 docLoadingWidget->setBackgroundType( (LauncherView::BackgroundType)mode, pixmapOrColor ); 404 docLoadingWidget->setBackgroundType( (LauncherView::BackgroundType)mode, pixmapOrColor );
405 } else if ( msg == "setTextColor(QString,QString)" ) { 405 } else if ( msg == "setTextColor(QString,QString)" ) {
406 QString id; 406 QString id;
407 stream >> id; 407 stream >> id;
408 QString color; 408 QString color;
409 stream >> color; 409 stream >> color;
410 if ( view(id) ) 410 if ( view(id) )
411 view(id)->setTextColor( QColor(color) ); 411 view(id)->setTextColor( QColor(color) );
412 if ( id == "Documents" ) 412 if ( id == "Documents" )
413 docLoadingWidget->setTextColor( QColor(color) ); 413 docLoadingWidget->setTextColor( QColor(color) );
414 } else if ( msg == "setFont(QString,QString,int,int,int)" ) { 414 } else if ( msg == "setFont(QString,QString,int,int,int)" ) {
415 QString id; 415 QString id;
416 stream >> id; 416 stream >> id;
417 QString fam; 417 QString fam;
418 stream >> fam; 418 stream >> fam;
419 int size; 419 int size;
420 stream >> size; 420 stream >> size;
421 int weight; 421 int weight;
422 stream >> weight; 422 stream >> weight;
423 int italic; 423 int italic;
424 stream >> italic; 424 stream >> italic;
425 if ( view(id) ) { 425 if ( view(id) ) {
426 if ( !fam.isEmpty() ) { 426 if ( !fam.isEmpty() ) {
427 view(id)->setViewFont( QFont(fam, size, weight, italic!=0) ); 427 view(id)->setViewFont( QFont(fam, size, weight, italic!=0) );
428 odebug << "setFont: " << fam << ", " << size << ", " << weight << ", " << italic << "" << oendl; 428 odebug << "setFont: " << fam << ", " << size << ", " << weight << ", " << italic << "" << oendl;
429 } else { 429 } else {
430 view(id)->clearViewFont(); 430 view(id)->clearViewFont();
431 } 431 }
432 } 432 }
433 }else if ( msg == "setBusyIndicatorType(QString)" ) { 433 }else if ( msg == "setBusyIndicatorType(QString)" ) {
434 QString type; 434 QString type;
435 stream >> type; 435 stream >> type;
436 setBusyIndicatorType( type ); 436 setBusyIndicatorType( type );
437 }else if ( msg == "home()" ) { 437 }else if ( msg == "home()" ) {
438 if ( isVisibleWindow( static_cast<QWidget*>(parent())->winId() ) ) { 438 if ( isVisibleWindow( static_cast<QWidget*>(parent())->winId() ) ) {
439 if (categoryBar) 439 if (categoryBar)
440 categoryBar->nextTab(); 440 categoryBar->nextTab();
441 }else 441 }else
442 static_cast<QWidget*>(parent())->raise(); 442 static_cast<QWidget*>(parent())->raise();
443 } 443 }
444} 444}
445 445
446 446
447 447
448//--------------------------------------------------------------------------- 448//---------------------------------------------------------------------------
449 449
450Launcher::Launcher() 450Launcher::Launcher()
451 : QMainWindow( 0, "PDA User Interface", QWidget::WStyle_Customize | QWidget::WGroupLeader ) 451 : QMainWindow( 0, "PDA User Interface", QWidget::WStyle_Customize | QWidget::WGroupLeader )
452{ 452{
453 tabs = 0; 453 tabs = 0;
454 tb = 0; 454 tb = 0;
455 Config cfg( "Launcher" ); 455 Config cfg( "Launcher" );
456 cfg.setGroup( "DocTab" ); 456 cfg.setGroup( "DocTab" );
457 docTabEnabled = cfg.readBoolEntry( "Enable", true ); 457 docTabEnabled = cfg.readBoolEntry( "Enable", true );
458} 458}
459 459
460void Launcher::createGUI() 460void Launcher::createGUI()
461{ 461{
462 setCaption( tr("Launcher") ); 462 setCaption( tr("Launcher") );
463 463
464 // we have a pretty good idea how big we'll be 464 // we have a pretty good idea how big we'll be
465 setGeometry( 0, 0, qApp->desktop()->width(), qApp->desktop()->height() ); 465 setGeometry( 0, 0, qApp->desktop()->width(), qApp->desktop()->height() );
466 466
467 tb = new TaskBar; 467 tb = new TaskBar;
468 tabs = new LauncherTabWidget( this ); 468 tabs = new LauncherTabWidget( this );
469 setCentralWidget( tabs ); 469 setCentralWidget( tabs );
470 470
471 ServerInterface::dockWidget( tb, ServerInterface::Bottom ); 471 ServerInterface::dockWidget( tb, ServerInterface::Bottom );
472 tb->show(); 472 tb->show();
473 473
474 qApp->installEventFilter( this ); 474 qApp->installEventFilter( this );
475 475
476
477 connect( qApp, SIGNAL(symbol()), this, SLOT(toggleSymbolInput()) );
478 connect( qApp, SIGNAL(numLockStateToggle()), this, SLOT(toggleNumLockState()) );
479 connect( qApp, SIGNAL(capsLockStateToggle()), this, SLOT(toggleCapsLockState()) );
480
481 connect( tb, SIGNAL(tabSelected(const QString&)), 476 connect( tb, SIGNAL(tabSelected(const QString&)),
482 this, SLOT(showTab(const QString&)) ); 477 this, SLOT(showTab(const QString&)) );
483 connect( tabs, SIGNAL(selected(const QString&)), 478 connect( tabs, SIGNAL(selected(const QString&)),
484 this, SLOT(viewSelected(const QString&)) ); 479 this, SLOT(viewSelected(const QString&)) );
485 connect( tabs, SIGNAL(clicked(const AppLnk*)), 480 connect( tabs, SIGNAL(clicked(const AppLnk*)),
486 this, SLOT(select(const AppLnk*))); 481 this, SLOT(select(const AppLnk*)));
487 connect( tabs, SIGNAL(rightPressed(AppLnk*)), 482 connect( tabs, SIGNAL(rightPressed(AppLnk*)),
488 this, SLOT(properties(AppLnk*))); 483 this, SLOT(properties(AppLnk*)));
489 484
490#if defined(Q_WS_QWS) && !defined(QT_NO_COP) 485#if defined(Q_WS_QWS) && !defined(QT_NO_COP)
491 QCopChannel* sysChannel = new QCopChannel( "QPE/System", this ); 486 QCopChannel* sysChannel = new QCopChannel( "QPE/System", this );
492 connect( sysChannel, SIGNAL(received(const QCString&,const QByteArray&)), 487 connect( sysChannel, SIGNAL(received(const QCString&,const QByteArray&)),
493 this, SLOT(systemMessage(const QCString&,const QByteArray&)) ); 488 this, SLOT(systemMessage(const QCString&,const QByteArray&)) );
494#endif 489#endif
495 490
496 // all documents 491 // all documents
497 QImage img( Resource::loadImage( "DocsIcon" ) ); 492 QImage img( Resource::loadImage( "DocsIcon" ) );
498 QPixmap pm; 493 QPixmap pm;
499 pm = img.smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ); 494 pm = img.smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() );
500 // It could add this itself if it handles docs 495 // It could add this itself if it handles docs
501 496
502 tabs->newView("Documents", pm, tr("Documents") )->setToolsEnabled( TRUE ); 497 tabs->newView("Documents", pm, tr("Documents") )->setToolsEnabled( TRUE );
503 498
504 QTimer::singleShot( 0, tabs, SLOT( initLayout() ) ); 499 QTimer::singleShot( 0, tabs, SLOT( initLayout() ) );
505 qApp->setMainWidget( this ); 500 qApp->setMainWidget( this );
506 QTimer::singleShot( 500, this, SLOT( makeVisible() ) ); 501 QTimer::singleShot( 500, this, SLOT( makeVisible() ) );
507} 502}
508 503
509Launcher::~Launcher() 504Launcher::~Launcher()
510{ 505{
511 if ( tb ) 506 if ( tb )
512 destroyGUI(); 507 destroyGUI();
513} 508}
514 509
515 bool Launcher::requiresDocuments() const 510 bool Launcher::requiresDocuments() const
516 { 511 {
517 Config cfg( "Launcher" ); 512 Config cfg( "Launcher" );
518 cfg.setGroup( "DocTab" ); 513 cfg.setGroup( "DocTab" );
519 return cfg.readBoolEntry( "Enable", true ); 514 return cfg.readBoolEntry( "Enable", true );
520} 515}
521 516
522void Launcher::makeVisible() 517void Launcher::makeVisible()
523{ 518{
524 showMaximized(); 519 showMaximized();
525} 520}
526 521
527void Launcher::destroyGUI() 522void Launcher::destroyGUI()
528{ 523{
529 delete tb; 524 delete tb;
530 tb = 0; 525 tb = 0;
531 delete tabs; 526 delete tabs;
532 tabs =0; 527 tabs =0;
533} 528}
534 529
535bool Launcher::eventFilter( QObject*, QEvent *ev ) 530bool Launcher::eventFilter( QObject*, QEvent *ev )
536{ 531{
537#ifdef QT_QWS_CUSTOM 532#ifdef QT_QWS_CUSTOM
538 if ( ev->type() == QEvent::KeyPress ) { 533 if ( ev->type() == QEvent::KeyPress ) {
539 QKeyEvent *ke = (QKeyEvent *)ev; 534 QKeyEvent *ke = (QKeyEvent *)ev;
540 if ( ke->key() == Qt::Key_F11 ) { // menu key 535 if ( ke->key() == Qt::Key_F11 ) { // menu key
541 QWidget *active = qApp->activeWindow(); 536 QWidget *active = qApp->activeWindow();
542 if ( active && active->isPopup() ) 537 if ( active && active->isPopup() )
543 active->close(); 538 active->close();
544 else { 539 else {
545 Global::terminateBuiltin("calibrate"); // No tr 540 Global::terminateBuiltin("calibrate"); // No tr
546 tb->launchStartMenu(); 541 tb->launchStartMenu();
547 } 542 }
548 return TRUE; 543 return TRUE;
549 } 544 }
550 } 545 }
551#else 546#else
552 Q_UNUSED(ev); 547 Q_UNUSED(ev);
553#endif 548#endif
554 return FALSE; 549 return FALSE;
555} 550}
556 551
557void Launcher::toggleSymbolInput()
558{
559 tb->toggleSymbolInput();
560}
561
562void Launcher::toggleNumLockState()
563{
564 tb->toggleNumLockState();
565}
566
567void Launcher::toggleCapsLockState()
568{
569 tb->toggleCapsLockState();
570}
571
572static bool isVisibleWindow(int wid) 552static bool isVisibleWindow(int wid)
573{ 553{
574#ifdef Q_WS_QWS 554#ifdef Q_WS_QWS
575 const QList<QWSWindow> &list = qwsServer->clientWindows(); 555 const QList<QWSWindow> &list = qwsServer->clientWindows();
576 QWSWindow* w; 556 QWSWindow* w;
577 for (QListIterator<QWSWindow> it(list); (w=it.current()); ++it) { 557 for (QListIterator<QWSWindow> it(list); (w=it.current()); ++it) {
578 if ( w->winId() == wid ) 558 if ( w->winId() == wid )
579 return !w->isFullyObscured(); 559 return !w->isFullyObscured();
580 } 560 }
581#endif 561#endif
582 return FALSE; 562 return FALSE;
583} 563}
584 564
585void Launcher::viewSelected(const QString& s) 565void Launcher::viewSelected(const QString& s)
586{ 566{
587 setCaption( s + tr(" - Launcher") ); 567 setCaption( s + tr(" - Launcher") );
588} 568}
589 569
590void Launcher::showTab(const QString& id) 570void Launcher::showTab(const QString& id)
591{ 571{
592 tabs->categoryBar->showTab(id); 572 tabs->categoryBar->showTab(id);
593 raise(); 573 raise();
594} 574}
595 575
596void Launcher::select( const AppLnk *appLnk ) 576void Launcher::select( const AppLnk *appLnk )
597{ 577{
598 if ( appLnk->type() == "Folder" ) { // No tr 578 if ( appLnk->type() == "Folder" ) { // No tr
599 // Not supported: flat is simpler for the user 579 // Not supported: flat is simpler for the user
600 } else { 580 } else {
601 if ( appLnk->exec().isNull() ) { 581 if ( appLnk->exec().isNull() ) {
602 int i = QMessageBox::information(this,tr("No application"), 582 int i = QMessageBox::information(this,tr("No application"),
603 tr("<p>No application is defined for this document." 583 tr("<p>No application is defined for this document."
604 "<p>Type is %1.").arg(appLnk->type()), tr("OK"), tr("View as text"), 0, 0, 1); 584 "<p>Type is %1.").arg(appLnk->type()), tr("OK"), tr("View as text"), 0, 0, 1);
605 585
606 /* ### Fixme */ 586 /* ### Fixme */
607 if ( i == 1 ) 587 if ( i == 1 )
608 Global::execute("textedit",appLnk->file()); 588 Global::execute("textedit",appLnk->file());
609 589
610 return; 590 return;
611 } 591 }
612 tabs->setBusy(TRUE); 592 tabs->setBusy(TRUE);
613 emit executing( appLnk ); 593 emit executing( appLnk );
614 appLnk->execute(); 594 appLnk->execute();
615 } 595 }
616} 596}
617 597
618void Launcher::properties( AppLnk *appLnk ) 598void Launcher::properties( AppLnk *appLnk )
619{ 599{
620 if ( appLnk->type() == "Folder" ) { // No tr 600 if ( appLnk->type() == "Folder" ) { // No tr
621 // Not supported: flat is simpler for the user 601 // Not supported: flat is simpler for the user
622 } else { 602 } else {
623/* ### libqtopia FIXME also moving docLnks... */ 603/* ### libqtopia FIXME also moving docLnks... */
624 LnkProperties prop(appLnk,0 ); 604 LnkProperties prop(appLnk,0 );
625 605
626 QPEApplication::execDialog( &prop ); 606 QPEApplication::execDialog( &prop );
627 } 607 }
628} 608}
629 609
630void Launcher::storageChanged( const QList<FileSystem> &fs ) 610void Launcher::storageChanged( const QList<FileSystem> &fs )
631{ 611{
632 // ### update combo boxes if we had a combo box for the storage type 612 // ### update combo boxes if we had a combo box for the storage type
633} 613}
634 614
635void Launcher::systemMessage( const QCString &msg, const QByteArray &data) 615void Launcher::systemMessage( const QCString &msg, const QByteArray &data)
636{ 616{
637 QDataStream stream( data, IO_ReadOnly ); 617 QDataStream stream( data, IO_ReadOnly );
638 if ( msg == "busy()" ) { 618 if ( msg == "busy()" ) {
639 tb->startWait(); 619 tb->startWait();
640 } else if ( msg == "notBusy(QString)" ) { 620 } else if ( msg == "notBusy(QString)" ) {
641 QString app; 621 QString app;
642 stream >> app; 622 stream >> app;
643 tabs->setBusy(FALSE); 623 tabs->setBusy(FALSE);
644 tb->stopWait(app); 624 tb->stopWait(app);
645 } else if (msg == "applyStyle()") { 625 } else if (msg == "applyStyle()") {
646 tabs->currentView()->relayout(); 626 tabs->currentView()->relayout();
647 } 627 }
648} 628}
649 629
650// These are the update functions from the server 630// These are the update functions from the server
651void Launcher::typeAdded( const QString& type, const QString& name, 631void Launcher::typeAdded( const QString& type, const QString& name,
652 const QPixmap& pixmap, const QPixmap& ) 632 const QPixmap& pixmap, const QPixmap& )
653{ 633{
654 tabs->newView( type, pixmap, name ); 634 tabs->newView( type, pixmap, name );
655 ids.append( type ); 635 ids.append( type );
656 /* this will be called in applicationScanningProgress with value 100! */ 636 /* this will be called in applicationScanningProgress with value 100! */
657// tb->refreshStartMenu(); 637// tb->refreshStartMenu();
658 638
659 static bool first = TRUE; 639 static bool first = TRUE;
660 if ( first ) { 640 if ( first ) {
661 first = FALSE; 641 first = FALSE;
662 tabs->categoryBar->showTab(type); 642 tabs->categoryBar->showTab(type);
663 } 643 }
664 644
665 tabs->view( type )->setUpdatesEnabled( FALSE ); 645 tabs->view( type )->setUpdatesEnabled( FALSE );
666 tabs->view( type )->setSortEnabled( FALSE ); 646 tabs->view( type )->setSortEnabled( FALSE );
667} 647}