-rw-r--r-- | core/launcher/documentlist.cpp | 22 | ||||
-rw-r--r-- | core/launcher/launcher.cpp | 16 | ||||
-rw-r--r-- | core/launcher/launcher.h | 2 |
3 files changed, 15 insertions, 25 deletions
diff --git a/core/launcher/documentlist.cpp b/core/launcher/documentlist.cpp index dcea4b9..1a7de33 100644 --- a/core/launcher/documentlist.cpp +++ b/core/launcher/documentlist.cpp @@ -83,56 +83,46 @@ public: ServerInterface *serverGui; bool needToSendAllDocLinks; bool sendAppLnks; bool sendDocLnks; bool scanDocs; }; DocumentList::DocumentList( ServerInterface *serverGui, bool scanDocs, QObject *parent, const char *name ) : QObject( parent, name ) { appLnkSet = new AppLnkSet( MimeType::appsFolderName() ); d = new DocumentListPrivate( serverGui ); - d->scanDocs = scanDocs; d->needToSendAllDocLinks = false; + Config cfg( "Launcher" ); + cfg.setGroup( "DocTab" ); + d->scanDocs = cfg.readBoolEntry( "Enable", true ); + qDebug( "DocumentList::DocumentList() : scanDocs = %d", d->scanDocs ); + QTimer::singleShot( 10, this, SLOT( startInitialScan() ) ); } void DocumentList::startInitialScan() { reloadAppLnks(); - - Config cfg( "Launcher" ); - cfg.setGroup( "DocTab" ); - bool docTabEnabled = cfg.readBoolEntry( "Enable", true ); - if ( docTabEnabled ) - reloadDocLnks(); - else - { - if ( d->sendDocLnks && d->serverGui ) - { - d->serverGui->documentScanningProgress( 0 ); - d->serverGui->allDocumentsRemoved(); - } - } - + reloadDocLnks(); } DocumentList::~DocumentList() { delete appLnkSet; delete d; } void DocumentList::add( const DocLnk& doc ) { if ( d->serverGui && QFile::exists( doc.file() ) ) d->serverGui->documentAdded( doc ); } 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 @@ -139,32 +139,33 @@ void LauncherTabWidget::createDocLoadingWidget() textLabel->setAlignment( int( QLabel::AlignCenter ) ); docLoadingWidgetProgress = new QProgressBar( docLoadingVBox ); docLoadingWidgetProgress->setProgress( 0 ); docLoadingWidgetProgress->setCenterIndicator( TRUE ); docLoadingWidgetProgress->setBackgroundMode( NoBackground ); // No flicker setProgressStyle(); if ( docTabEnabled ) { textLabel->setText( tr( "<b>Finding Documents...</b>" ) ); } else { textLabel->setText( tr( "<b>The Documents Tab<p>has been disabled.<p>" "Use Settings->Launcher->DocTab<p>to reenable it.</b></center>" ) ); docLoadingWidgetProgress->hide(); + docLoadingWidgetEnabled = true; } QWidget *space2 = new QWidget( docLoadingVBox ); docLoadingVBox->setStretchFactor( space2, 1 ); cfg.setGroup( "Tab Documents" ); // No tr setTabViewAppearance( docLoadingWidget, cfg ); stack->addWidget( docLoadingWidget, 0 ); } void LauncherTabWidget::initLayout() { layout()->activate(); docView()->setFocus(); categoryBar->showTab("Documents"); @@ -488,32 +489,39 @@ void Launcher::createGUI() pm = img.smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ); // It could add this itself if it handles docs tabs->newView("Documents", pm, tr("Documents") )->setToolsEnabled( TRUE ); QTimer::singleShot( 0, tabs, SLOT( initLayout() ) ); qApp->setMainWidget( this ); QTimer::singleShot( 500, this, SLOT( makeVisible() ) ); } Launcher::~Launcher() { if ( tb ) destroyGUI(); } + bool Launcher::requiresDocuments() const + { + Config cfg( "Launcher" ); + cfg.setGroup( "DocTab" ); + return cfg.readBoolEntry( "Enable", true ); +} + void Launcher::makeVisible() { showMaximized(); } void Launcher::destroyGUI() { delete tb; tb = 0; delete tabs; tabs =0; } bool Launcher::eventFilter( QObject*, QEvent *ev ) { #ifdef QT_QWS_CUSTOM @@ -736,40 +744,32 @@ void Launcher::applicationScanningProgress( int percent ) break; } case 100: { for ( QStringList::ConstIterator it=ids.begin(); it!= ids.end(); ++it) { tabs->view( (*it) )->setUpdatesEnabled( TRUE ); tabs->view( (*it) )->setSortEnabled( TRUE ); } break; } default: break; } } void Launcher::documentScanningProgress( int percent ) { - if ( !docTabEnabled ) - { - qDebug( "Launcher: document tab disabled!" ); - tabs->setLoadingProgress( 100 ); - tabs->setLoadingWidgetEnabled( TRUE ); - return; - } - switch ( percent ) { case 0: { tabs->setLoadingProgress( 0 ); tabs->setLoadingWidgetEnabled( TRUE ); tabs->docView()->setUpdatesEnabled( FALSE ); tabs->docView()->setSortEnabled( FALSE ); break; } case 100: { tabs->docView()->updateTools(); tabs->docView()->setSortEnabled( TRUE ); tabs->docView()->setUpdatesEnabled( TRUE ); tabs->setLoadingWidgetEnabled( FALSE ); break; } default: diff --git a/core/launcher/launcher.h b/core/launcher/launcher.h index 1d046ee..4f3ff8c 100644 --- a/core/launcher/launcher.h +++ b/core/launcher/launcher.h @@ -103,33 +103,33 @@ public: void createGUI(); void destroyGUI(); void typeAdded( const QString& type, const QString& name, const QPixmap& pixmap, const QPixmap& bgPixmap ); void typeRemoved( const QString& type ); void applicationAdded( const QString& type, const AppLnk& doc ); void applicationRemoved( const QString& type, const AppLnk& doc ); void allApplicationsRemoved(); void applicationStateChanged( const QString& name, ApplicationState state ); void documentAdded( const DocLnk& doc ); void documentRemoved( const DocLnk& doc ); void allDocumentsRemoved(); void documentChanged( const DocLnk& oldDoc, const DocLnk& newDoc ); void storageChanged( const QList<FileSystem> & ); void applicationScanningProgress( int percent ); void documentScanningProgress( int percent ); bool requiresApplications() const { return TRUE; } - bool requiresDocuments() const { return TRUE; } + bool requiresDocuments() const; void showLoadingDocs(); void showDocTab(); QStringList idList() const { return ids; } public slots: void viewSelected(const QString&); void showTab(const QString&); void select( const AppLnk * ); void properties( AppLnk * ); void makeVisible(); signals: void executing( const AppLnk * ); private slots: |