-rw-r--r-- | core/launcher/launcher.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/core/launcher/launcher.cpp b/core/launcher/launcher.cpp index b312672..344cd46 100644 --- a/core/launcher/launcher.cpp +++ b/core/launcher/launcher.cpp | |||
@@ -131,48 +131,49 @@ void LauncherTabWidget::createDocLoadingWidget() | |||
131 | waitPixmap->setPixmap( Resource::loadPixmap( "bigwait" ) ); | 131 | waitPixmap->setPixmap( Resource::loadPixmap( "bigwait" ) ); |
132 | waitPixmap->setAlignment( int( QLabel::AlignCenter ) ); | 132 | waitPixmap->setAlignment( int( QLabel::AlignCenter ) ); |
133 | 133 | ||
134 | Config cfg( "Launcher" ); | 134 | Config cfg( "Launcher" ); |
135 | cfg.setGroup( "DocTab" ); | 135 | cfg.setGroup( "DocTab" ); |
136 | bool docTabEnabled = cfg.readBoolEntry( "Enable", true ); | 136 | bool docTabEnabled = cfg.readBoolEntry( "Enable", true ); |
137 | 137 | ||
138 | QLabel *textLabel = new QLabel( docLoadingVBox ); | 138 | QLabel *textLabel = new QLabel( docLoadingVBox ); |
139 | textLabel->setAlignment( int( QLabel::AlignCenter ) ); | 139 | textLabel->setAlignment( int( QLabel::AlignCenter ) ); |
140 | docLoadingWidgetProgress = new QProgressBar( docLoadingVBox ); | 140 | docLoadingWidgetProgress = new QProgressBar( docLoadingVBox ); |
141 | docLoadingWidgetProgress->setProgress( 0 ); | 141 | docLoadingWidgetProgress->setProgress( 0 ); |
142 | docLoadingWidgetProgress->setCenterIndicator( TRUE ); | 142 | docLoadingWidgetProgress->setCenterIndicator( TRUE ); |
143 | docLoadingWidgetProgress->setBackgroundMode( NoBackground ); // No flicker | 143 | docLoadingWidgetProgress->setBackgroundMode( NoBackground ); // No flicker |
144 | setProgressStyle(); | 144 | setProgressStyle(); |
145 | 145 | ||
146 | if ( docTabEnabled ) | 146 | if ( docTabEnabled ) |
147 | { | 147 | { |
148 | textLabel->setText( tr( "<b>Finding Documents...</b>" ) ); | 148 | textLabel->setText( tr( "<b>Finding Documents...</b>" ) ); |
149 | } | 149 | } |
150 | else | 150 | else |
151 | { | 151 | { |
152 | textLabel->setText( tr( "<b>The Documents Tab<p>has been disabled.<p>" | 152 | textLabel->setText( tr( "<b>The Documents Tab<p>has been disabled.<p>" |
153 | "Use Settings->Launcher->DocTab<p>to reenable it.</b></center>" ) ); | 153 | "Use Settings->Launcher->DocTab<p>to reenable it.</b></center>" ) ); |
154 | docLoadingWidgetProgress->hide(); | 154 | docLoadingWidgetProgress->hide(); |
155 | docLoadingWidgetEnabled = true; | ||
155 | } | 156 | } |
156 | 157 | ||
157 | QWidget *space2 = new QWidget( docLoadingVBox ); | 158 | QWidget *space2 = new QWidget( docLoadingVBox ); |
158 | docLoadingVBox->setStretchFactor( space2, 1 ); | 159 | docLoadingVBox->setStretchFactor( space2, 1 ); |
159 | 160 | ||
160 | cfg.setGroup( "Tab Documents" ); // No tr | 161 | cfg.setGroup( "Tab Documents" ); // No tr |
161 | setTabViewAppearance( docLoadingWidget, cfg ); | 162 | setTabViewAppearance( docLoadingWidget, cfg ); |
162 | 163 | ||
163 | stack->addWidget( docLoadingWidget, 0 ); | 164 | stack->addWidget( docLoadingWidget, 0 ); |
164 | } | 165 | } |
165 | 166 | ||
166 | void LauncherTabWidget::initLayout() | 167 | void LauncherTabWidget::initLayout() |
167 | { | 168 | { |
168 | layout()->activate(); | 169 | layout()->activate(); |
169 | docView()->setFocus(); | 170 | docView()->setFocus(); |
170 | categoryBar->showTab("Documents"); | 171 | categoryBar->showTab("Documents"); |
171 | } | 172 | } |
172 | 173 | ||
173 | void LauncherTabWidget::appMessage(const QCString& message, const QByteArray&) | 174 | void LauncherTabWidget::appMessage(const QCString& message, const QByteArray&) |
174 | { | 175 | { |
175 | if ( message == "nextView()" ) | 176 | if ( message == "nextView()" ) |
176 | categoryBar->nextTab(); | 177 | categoryBar->nextTab(); |
177 | } | 178 | } |
178 | 179 | ||
@@ -480,48 +481,55 @@ void Launcher::createGUI() | |||
480 | QCopChannel* sysChannel = new QCopChannel( "QPE/System", this ); | 481 | QCopChannel* sysChannel = new QCopChannel( "QPE/System", this ); |
481 | connect( sysChannel, SIGNAL(received(const QCString &, const QByteArray &)), | 482 | connect( sysChannel, SIGNAL(received(const QCString &, const QByteArray &)), |
482 | this, SLOT(systemMessage( const QCString &, const QByteArray &)) ); | 483 | this, SLOT(systemMessage( const QCString &, const QByteArray &)) ); |
483 | #endif | 484 | #endif |
484 | 485 | ||
485 | // all documents | 486 | // all documents |
486 | QImage img( Resource::loadImage( "DocsIcon" ) ); | 487 | QImage img( Resource::loadImage( "DocsIcon" ) ); |
487 | QPixmap pm; | 488 | QPixmap pm; |
488 | pm = img.smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ); | 489 | pm = img.smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ); |
489 | // It could add this itself if it handles docs | 490 | // It could add this itself if it handles docs |
490 | 491 | ||
491 | tabs->newView("Documents", pm, tr("Documents") )->setToolsEnabled( TRUE ); | 492 | tabs->newView("Documents", pm, tr("Documents") )->setToolsEnabled( TRUE ); |
492 | 493 | ||
493 | QTimer::singleShot( 0, tabs, SLOT( initLayout() ) ); | 494 | QTimer::singleShot( 0, tabs, SLOT( initLayout() ) ); |
494 | qApp->setMainWidget( this ); | 495 | qApp->setMainWidget( this ); |
495 | QTimer::singleShot( 500, this, SLOT( makeVisible() ) ); | 496 | QTimer::singleShot( 500, this, SLOT( makeVisible() ) ); |
496 | } | 497 | } |
497 | 498 | ||
498 | Launcher::~Launcher() | 499 | Launcher::~Launcher() |
499 | { | 500 | { |
500 | if ( tb ) | 501 | if ( tb ) |
501 | destroyGUI(); | 502 | destroyGUI(); |
502 | } | 503 | } |
503 | 504 | ||
505 | bool Launcher::requiresDocuments() const | ||
506 | { | ||
507 | Config cfg( "Launcher" ); | ||
508 | cfg.setGroup( "DocTab" ); | ||
509 | return cfg.readBoolEntry( "Enable", true ); | ||
510 | } | ||
511 | |||
504 | void Launcher::makeVisible() | 512 | void Launcher::makeVisible() |
505 | { | 513 | { |
506 | showMaximized(); | 514 | showMaximized(); |
507 | } | 515 | } |
508 | 516 | ||
509 | void Launcher::destroyGUI() | 517 | void Launcher::destroyGUI() |
510 | { | 518 | { |
511 | delete tb; | 519 | delete tb; |
512 | tb = 0; | 520 | tb = 0; |
513 | delete tabs; | 521 | delete tabs; |
514 | tabs =0; | 522 | tabs =0; |
515 | } | 523 | } |
516 | 524 | ||
517 | bool Launcher::eventFilter( QObject*, QEvent *ev ) | 525 | bool Launcher::eventFilter( QObject*, QEvent *ev ) |
518 | { | 526 | { |
519 | #ifdef QT_QWS_CUSTOM | 527 | #ifdef QT_QWS_CUSTOM |
520 | if ( ev->type() == QEvent::KeyPress ) { | 528 | if ( ev->type() == QEvent::KeyPress ) { |
521 | QKeyEvent *ke = (QKeyEvent *)ev; | 529 | QKeyEvent *ke = (QKeyEvent *)ev; |
522 | if ( ke->key() == Qt::Key_F11 ) { // menu key | 530 | if ( ke->key() == Qt::Key_F11 ) { // menu key |
523 | QWidget *active = qApp->activeWindow(); | 531 | QWidget *active = qApp->activeWindow(); |
524 | if ( active && active->isPopup() ) | 532 | if ( active && active->isPopup() ) |
525 | active->close(); | 533 | active->close(); |
526 | else { | 534 | else { |
527 | Global::terminateBuiltin("calibrate"); // No tr | 535 | Global::terminateBuiltin("calibrate"); // No tr |
@@ -728,53 +736,45 @@ void Launcher::applicationStateChanged( const QString& name, ApplicationState st | |||
728 | void Launcher::applicationScanningProgress( int percent ) | 736 | void Launcher::applicationScanningProgress( int percent ) |
729 | { | 737 | { |
730 | switch ( percent ) { | 738 | switch ( percent ) { |
731 | case 0: { | 739 | case 0: { |
732 | for ( QStringList::ConstIterator it=ids.begin(); it!= ids.end(); ++it) { | 740 | for ( QStringList::ConstIterator it=ids.begin(); it!= ids.end(); ++it) { |
733 | tabs->view( (*it) )->setUpdatesEnabled( FALSE ); | 741 | tabs->view( (*it) )->setUpdatesEnabled( FALSE ); |
734 | tabs->view( (*it) )->setSortEnabled( FALSE ); | 742 | tabs->view( (*it) )->setSortEnabled( FALSE ); |
735 | } | 743 | } |
736 | break; | 744 | break; |
737 | } | 745 | } |
738 | case 100: { | 746 | case 100: { |
739 | for ( QStringList::ConstIterator it=ids.begin(); it!= ids.end(); ++it) { | 747 | for ( QStringList::ConstIterator it=ids.begin(); it!= ids.end(); ++it) { |
740 | tabs->view( (*it) )->setUpdatesEnabled( TRUE ); | 748 | tabs->view( (*it) )->setUpdatesEnabled( TRUE ); |
741 | tabs->view( (*it) )->setSortEnabled( TRUE ); | 749 | tabs->view( (*it) )->setSortEnabled( TRUE ); |
742 | } | 750 | } |
743 | break; | 751 | break; |
744 | } | 752 | } |
745 | default: | 753 | default: |
746 | break; | 754 | break; |
747 | } | 755 | } |
748 | } | 756 | } |
749 | 757 | ||
750 | void Launcher::documentScanningProgress( int percent ) | 758 | void Launcher::documentScanningProgress( int percent ) |
751 | { | 759 | { |
752 | if ( !docTabEnabled ) | ||
753 | { | ||
754 | qDebug( "Launcher: document tab disabled!" ); | ||
755 | tabs->setLoadingProgress( 100 ); | ||
756 | tabs->setLoadingWidgetEnabled( TRUE ); | ||
757 | return; | ||
758 | } | ||
759 | |||
760 | switch ( percent ) { | 760 | switch ( percent ) { |
761 | case 0: { | 761 | case 0: { |
762 | tabs->setLoadingProgress( 0 ); | 762 | tabs->setLoadingProgress( 0 ); |
763 | tabs->setLoadingWidgetEnabled( TRUE ); | 763 | tabs->setLoadingWidgetEnabled( TRUE ); |
764 | tabs->docView()->setUpdatesEnabled( FALSE ); | 764 | tabs->docView()->setUpdatesEnabled( FALSE ); |
765 | tabs->docView()->setSortEnabled( FALSE ); | 765 | tabs->docView()->setSortEnabled( FALSE ); |
766 | break; | 766 | break; |
767 | } | 767 | } |
768 | case 100: { | 768 | case 100: { |
769 | tabs->docView()->updateTools(); | 769 | tabs->docView()->updateTools(); |
770 | tabs->docView()->setSortEnabled( TRUE ); | 770 | tabs->docView()->setSortEnabled( TRUE ); |
771 | tabs->docView()->setUpdatesEnabled( TRUE ); | 771 | tabs->docView()->setUpdatesEnabled( TRUE ); |
772 | tabs->setLoadingWidgetEnabled( FALSE ); | 772 | tabs->setLoadingWidgetEnabled( FALSE ); |
773 | break; | 773 | break; |
774 | } | 774 | } |
775 | default: | 775 | default: |
776 | tabs->setLoadingProgress( percent ); | 776 | tabs->setLoadingProgress( percent ); |
777 | break; | 777 | break; |
778 | } | 778 | } |
779 | } | 779 | } |
780 | 780 | ||