-rw-r--r-- | core/launcher/launcher.cpp | 107 |
1 files changed, 64 insertions, 43 deletions
diff --git a/core/launcher/launcher.cpp b/core/launcher/launcher.cpp index ccc2114..970b8cb 100644 --- a/core/launcher/launcher.cpp +++ b/core/launcher/launcher.cpp | |||
@@ -379,83 +379,104 @@ void LauncherTabWidget::setBusyIndicatorType( const QString& str ) { | |||
379 | 379 | ||
380 | LauncherView *LauncherTabWidget::currentView(void) | 380 | LauncherView *LauncherTabWidget::currentView(void) |
381 | { | 381 | { |
382 | return (LauncherView*)stack->visibleWidget(); | 382 | return (LauncherView*)stack->visibleWidget(); |
383 | } | 383 | } |
384 | 384 | ||
385 | 385 | ||
386 | 386 | ||
387 | void LauncherTabWidget::launcherMessage( const QCString &msg, const QByteArray &data) | 387 | void LauncherTabWidget::launcherMessage( const QCString &msg, const QByteArray &data) |
388 | { | 388 | { |
389 | QDataStream stream( data, IO_ReadOnly ); | 389 | QDataStream stream( data, IO_ReadOnly ); |
390 | if ( msg == "setTabView(QString,int)" ) { | 390 | if ( msg == "setTabView(QString,int)" ) { |
391 | QString id; | 391 | QString id; |
392 | stream >> id; | 392 | stream >> id; |
393 | int mode; | 393 | int mode; |
394 | stream >> mode; | 394 | stream >> mode; |
395 | if ( view(id) ) | 395 | if ( view(id) ) |
396 | view(id)->setViewMode( (LauncherView::ViewMode)mode ); | 396 | view(id)->setViewMode( (LauncherView::ViewMode)mode ); |
397 | } else if ( msg == "setTabBackground(QString,int,QString)" ) { | 397 | } else if ( msg == "setTabBackground(QString,int,QString)" ) { |
398 | QString id; | 398 | QString id; |
399 | stream >> id; | 399 | stream >> id; |
400 | int mode; | 400 | int mode; |
401 | stream >> mode; | 401 | stream >> mode; |
402 | QString pixmapOrColor; | 402 | QString pixmapOrColor; |
403 | stream >> pixmapOrColor; | 403 | stream >> pixmapOrColor; |
404 | if ( view(id) ) | 404 | if ( view(id) ) |
405 | view(id)->setBackgroundType( (LauncherView::BackgroundType)mode, pixmapOrColor ); | 405 | view(id)->setBackgroundType( (LauncherView::BackgroundType)mode, pixmapOrColor ); |
406 | if ( id == "Documents" ) | 406 | if ( id == "Documents" ) |
407 | docLoadingWidget->setBackgroundType( (LauncherView::BackgroundType)mode, pixmapOrColor ); | 407 | docLoadingWidget->setBackgroundType( (LauncherView::BackgroundType)mode, pixmapOrColor ); |
408 | } else if ( msg == "setTextColor(QString,QString)" ) { | 408 | } else if ( msg == "setTextColor(QString,QString)" ) { |
409 | QString id; | 409 | QString id; |
410 | stream >> id; | 410 | stream >> id; |
411 | QString color; | 411 | QString color; |
412 | stream >> color; | 412 | stream >> color; |
413 | if ( view(id) ) | 413 | if ( view(id) ) |
414 | view(id)->setTextColor( QColor(color) ); | 414 | view(id)->setTextColor( QColor(color) ); |
415 | if ( id == "Documents" ) | 415 | if ( id == "Documents" ) |
416 | docLoadingWidget->setTextColor( QColor(color) ); | 416 | docLoadingWidget->setTextColor( QColor(color) ); |
417 | } else if ( msg == "setFont(QString,QString,int,int,int)" ) { | 417 | } else if ( msg == "setFont(QString,QString,int,int,int)" ) { |
418 | QString id; | 418 | QString id; |
419 | stream >> id; | 419 | stream >> id; |
420 | QString fam; | 420 | QString fam; |
421 | stream >> fam; | 421 | stream >> fam; |
422 | int size; | 422 | int size; |
423 | stream >> size; | 423 | stream >> size; |
424 | int weight; | 424 | int weight; |
425 | stream >> weight; | 425 | stream >> weight; |
426 | int italic; | 426 | int italic; |
427 | stream >> italic; | 427 | stream >> italic; |
428 | if ( view(id) ) { | 428 | if ( view(id) ) { |
429 | if ( !fam.isEmpty() ) { | 429 | if ( !fam.isEmpty() ) { |
430 | view(id)->setViewFont( QFont(fam, size, weight, italic!=0) ); | 430 | view(id)->setViewFont( QFont(fam, size, weight, italic!=0) ); |
431 | odebug << "setFont: " << fam << ", " << size << ", " << weight << ", " << italic << "" << oendl; | 431 | odebug << "setFont: " << fam << ", " << size << ", " << weight << ", " << italic << "" << oendl; |
432 | } else { | 432 | } else { |
433 | view(id)->clearViewFont(); | 433 | view(id)->clearViewFont(); |
434 | } | ||
434 | } | 435 | } |
435 | } | ||
436 | }else if ( msg == "setBusyIndicatorType(QString)" ) { | 436 | }else if ( msg == "setBusyIndicatorType(QString)" ) { |
437 | QString type; | 437 | QString type; |
438 | stream >> type; | 438 | stream >> type; |
439 | setBusyIndicatorType( type ); | 439 | setBusyIndicatorType( type ); |
440 | }else if ( msg == "home()" ) { | 440 | }else if ( msg == "home()" ) { |
441 | if ( isVisibleWindow( static_cast<QWidget*>(parent())->winId() ) ) { | 441 | if ( isVisibleWindow( static_cast<QWidget*>(parent())->winId() ) ) { |
442 | if (categoryBar) | 442 | if (categoryBar) |
443 | categoryBar->nextTab(); | 443 | categoryBar->nextTab(); |
444 | }else | 444 | }else { |
445 | static_cast<QWidget*>(parent())->raise(); | 445 | static_cast<QWidget*>(parent())->raise(); |
446 | } | ||
447 | } else if (msg=="doctabEnabled(int)") { | ||
448 | int id; stream >> id; | ||
449 | odebug << "Doctab enabled " << id << oendl; | ||
450 | reCheckDoctab(id); | ||
446 | } | 451 | } |
447 | } | 452 | } |
448 | 453 | ||
449 | 454 | void LauncherTabWidget::reCheckDoctab(int how) | |
455 | { | ||
456 | if ((bool)how == docTabEnabled) { | ||
457 | /* nothing to do */ | ||
458 | return; | ||
459 | } | ||
460 | if (docLoadingWidget) { | ||
461 | stack->removeWidget(docLoadingWidget); | ||
462 | delete docLoadingWidget; | ||
463 | docLoadingWidget = 0; | ||
464 | } | ||
465 | createDocLoadingWidget(); | ||
466 | { | ||
467 | QCopEnvelope( "QPE/System", "reforceDocuments()" ); | ||
468 | odebug << "Sending doc rescan" << oendl; | ||
469 | } | ||
470 | } | ||
450 | 471 | ||
451 | //--------------------------------------------------------------------------- | 472 | //--------------------------------------------------------------------------- |
452 | 473 | ||
453 | Launcher::Launcher() | 474 | Launcher::Launcher() |
454 | : QMainWindow( 0, "PDA User Interface", QWidget::WStyle_Customize | QWidget::WGroupLeader ) | 475 | : QMainWindow( 0, "PDA User Interface", QWidget::WStyle_Customize | QWidget::WGroupLeader ) |
455 | { | 476 | { |
456 | tabs = 0; | 477 | tabs = 0; |
457 | tb = 0; | 478 | tb = 0; |
458 | Config cfg( "Launcher" ); | 479 | Config cfg( "Launcher" ); |
459 | cfg.setGroup( "DocTab" ); | 480 | cfg.setGroup( "DocTab" ); |
460 | docTabEnabled = cfg.readBoolEntry( "Enable", true ); | 481 | docTabEnabled = cfg.readBoolEntry( "Enable", true ); |
461 | } | 482 | } |