summaryrefslogtreecommitdiff
path: root/core/launcher/launcher.cpp
Unidiff
Diffstat (limited to 'core/launcher/launcher.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--core/launcher/launcher.cpp35
1 files changed, 29 insertions, 6 deletions
diff --git a/core/launcher/launcher.cpp b/core/launcher/launcher.cpp
index d697c43..b312672 100644
--- a/core/launcher/launcher.cpp
+++ b/core/launcher/launcher.cpp
@@ -79,13 +79,13 @@
79 79
80 80
81static bool isVisibleWindow( int ); 81static bool isVisibleWindow( int );
82//=========================================================================== 82//===========================================================================
83 83
84LauncherTabWidget::LauncherTabWidget( Launcher* parent ) : 84LauncherTabWidget::LauncherTabWidget( Launcher* parent ) :
85 QVBox( parent ) 85 QVBox( parent ), docview( 0 )
86{ 86{
87 docLoadingWidgetEnabled = false; 87 docLoadingWidgetEnabled = false;
88 docLoadingWidget = 0; 88 docLoadingWidget = 0;
89 docLoadingWidgetProgress = 0; 89 docLoadingWidgetProgress = 0;
90 launcher = parent; 90 launcher = parent;
91 categoryBar = new LauncherTabBar( this ); 91 categoryBar = new LauncherTabBar( this );
@@ -128,26 +128,38 @@ void LauncherTabWidget::createDocLoadingWidget()
128 128
129 QLabel *waitPixmap = new QLabel( docLoadingVBox ); 129 QLabel *waitPixmap = new QLabel( docLoadingVBox );
130 waitPixmap->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)5, waitPixmap->sizePolicy().hasHeightForWidth() ) ); 130 waitPixmap->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)5, waitPixmap->sizePolicy().hasHeightForWidth() ) );
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" );
135 cfg.setGroup( "DocTab" );
136 bool docTabEnabled = cfg.readBoolEntry( "Enable", true );
137
134 QLabel *textLabel = new QLabel( docLoadingVBox ); 138 QLabel *textLabel = new QLabel( docLoadingVBox );
135 textLabel->setText( tr( "<b>Finding Documents...</b>" ) );
136 textLabel->setAlignment( int( QLabel::AlignCenter ) ); 139 textLabel->setAlignment( int( QLabel::AlignCenter ) );
137
138 docLoadingWidgetProgress = new QProgressBar( docLoadingVBox ); 140 docLoadingWidgetProgress = new QProgressBar( docLoadingVBox );
139 docLoadingWidgetProgress->setProgress( 0 ); 141 docLoadingWidgetProgress->setProgress( 0 );
140 docLoadingWidgetProgress->setCenterIndicator( TRUE ); 142 docLoadingWidgetProgress->setCenterIndicator( TRUE );
141 docLoadingWidgetProgress->setBackgroundMode( NoBackground ); // No flicker 143 docLoadingWidgetProgress->setBackgroundMode( NoBackground ); // No flicker
142 setProgressStyle(); 144 setProgressStyle();
143 145
146 if ( docTabEnabled )
147 {
148 textLabel->setText( tr( "<b>Finding Documents...</b>" ) );
149 }
150 else
151 {
152 textLabel->setText( tr( "<b>The Documents Tab<p>has been disabled.<p>"
153 "Use Settings->Launcher->DocTab<p>to reenable it.</b></center>" ) );
154 docLoadingWidgetProgress->hide();
155 }
156
144 QWidget *space2 = new QWidget( docLoadingVBox ); 157 QWidget *space2 = new QWidget( docLoadingVBox );
145 docLoadingVBox->setStretchFactor( space2, 1 ); 158 docLoadingVBox->setStretchFactor( space2, 1 );
146 159
147 Config cfg("Launcher");
148 cfg.setGroup( "Tab Documents" ); // No tr 160 cfg.setGroup( "Tab Documents" ); // No tr
149 setTabViewAppearance( docLoadingWidget, cfg ); 161 setTabViewAppearance( docLoadingWidget, cfg );
150 162
151 stack->addWidget( docLoadingWidget, 0 ); 163 stack->addWidget( docLoadingWidget, 0 );
152} 164}
153 165
@@ -426,12 +438,15 @@ void LauncherTabWidget::launcherMessage( const QCString &msg, const QByteArray &
426 438
427Launcher::Launcher() 439Launcher::Launcher()
428 : QMainWindow( 0, "PDA User Interface", QWidget::WStyle_Customize | QWidget::WGroupLeader ) 440 : QMainWindow( 0, "PDA User Interface", QWidget::WStyle_Customize | QWidget::WGroupLeader )
429{ 441{
430 tabs = 0; 442 tabs = 0;
431 tb = 0; 443 tb = 0;
444 Config cfg( "Launcher" );
445 cfg.setGroup( "DocTab" );
446 docTabEnabled = cfg.readBoolEntry( "Enable", true );
432} 447}
433 448
434void Launcher::createGUI() 449void Launcher::createGUI()
435{ 450{
436 setCaption( tr("Launcher") ); 451 setCaption( tr("Launcher") );
437 452
@@ -469,17 +484,17 @@ void Launcher::createGUI()
469 484
470 // all documents 485 // all documents
471 QImage img( Resource::loadImage( "DocsIcon" ) ); 486 QImage img( Resource::loadImage( "DocsIcon" ) );
472 QPixmap pm; 487 QPixmap pm;
473 pm = img.smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ); 488 pm = img.smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() );
474 // It could add this itself if it handles docs 489 // It could add this itself if it handles docs
490
475 tabs->newView("Documents", pm, tr("Documents") )->setToolsEnabled( TRUE ); 491 tabs->newView("Documents", pm, tr("Documents") )->setToolsEnabled( TRUE );
476 QTimer::singleShot( 0, tabs, SLOT( initLayout() ) );
477 492
493 QTimer::singleShot( 0, tabs, SLOT( initLayout() ) );
478 qApp->setMainWidget( this ); 494 qApp->setMainWidget( this );
479
480 QTimer::singleShot( 500, this, SLOT( makeVisible() ) ); 495 QTimer::singleShot( 500, this, SLOT( makeVisible() ) );
481} 496}
482 497
483Launcher::~Launcher() 498Launcher::~Launcher()
484{ 499{
485 if ( tb ) 500 if ( tb )
@@ -731,12 +746,20 @@ void Launcher::applicationScanningProgress( int percent )
731 break; 746 break;
732 } 747 }
733} 748}
734 749
735void Launcher::documentScanningProgress( int percent ) 750void Launcher::documentScanningProgress( int percent )
736{ 751{
752 if ( !docTabEnabled )
753 {
754 qDebug( "Launcher: document tab disabled!" );
755 tabs->setLoadingProgress( 100 );
756 tabs->setLoadingWidgetEnabled( TRUE );
757 return;
758 }
759
737 switch ( percent ) { 760 switch ( percent ) {
738 case 0: { 761 case 0: {
739 tabs->setLoadingProgress( 0 ); 762 tabs->setLoadingProgress( 0 );
740 tabs->setLoadingWidgetEnabled( TRUE ); 763 tabs->setLoadingWidgetEnabled( TRUE );
741 tabs->docView()->setUpdatesEnabled( FALSE ); 764 tabs->docView()->setUpdatesEnabled( FALSE );
742 tabs->docView()->setSortEnabled( FALSE ); 765 tabs->docView()->setSortEnabled( FALSE );