summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/launcher/documentlist.cpp22
-rw-r--r--core/launcher/launcher.cpp16
-rw-r--r--core/launcher/launcher.h2
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
@@ -87,48 +87,38 @@ public:
87 bool sendAppLnks; 87 bool sendAppLnks;
88 bool sendDocLnks; 88 bool sendDocLnks;
89 bool scanDocs; 89 bool scanDocs;
90}; 90};
91 91
92 92
93DocumentList::DocumentList( ServerInterface *serverGui, bool scanDocs, 93DocumentList::DocumentList( ServerInterface *serverGui, bool scanDocs,
94 QObject *parent, const char *name ) 94 QObject *parent, const char *name )
95 : QObject( parent, name ) 95 : QObject( parent, name )
96{ 96{
97 appLnkSet = new AppLnkSet( MimeType::appsFolderName() ); 97 appLnkSet = new AppLnkSet( MimeType::appsFolderName() );
98 d = new DocumentListPrivate( serverGui ); 98 d = new DocumentListPrivate( serverGui );
99 d->scanDocs = scanDocs;
100 d->needToSendAllDocLinks = false; 99 d->needToSendAllDocLinks = false;
101 100
101 Config cfg( "Launcher" );
102 cfg.setGroup( "DocTab" );
103 d->scanDocs = cfg.readBoolEntry( "Enable", true );
104 qDebug( "DocumentList::DocumentList() : scanDocs = %d", d->scanDocs );
105
102 QTimer::singleShot( 10, this, SLOT( startInitialScan() ) ); 106 QTimer::singleShot( 10, this, SLOT( startInitialScan() ) );
103} 107}
104 108
105void DocumentList::startInitialScan() 109void DocumentList::startInitialScan()
106{ 110{
107 reloadAppLnks(); 111 reloadAppLnks();
108 112 reloadDocLnks();
109 Config cfg( "Launcher" );
110 cfg.setGroup( "DocTab" );
111 bool docTabEnabled = cfg.readBoolEntry( "Enable", true );
112 if ( docTabEnabled )
113 reloadDocLnks();
114 else
115 {
116 if ( d->sendDocLnks && d->serverGui )
117 {
118 d->serverGui->documentScanningProgress( 0 );
119 d->serverGui->allDocumentsRemoved();
120 }
121 }
122
123} 113}
124 114
125DocumentList::~DocumentList() 115DocumentList::~DocumentList()
126{ 116{
127 delete appLnkSet; 117 delete appLnkSet;
128 delete d; 118 delete d;
129} 119}
130 120
131 121
132void DocumentList::add( const DocLnk& doc ) 122void DocumentList::add( const DocLnk& doc )
133{ 123{
134 if ( d->serverGui && QFile::exists( doc.file() ) ) 124 if ( d->serverGui && QFile::exists( doc.file() ) )
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
@@ -143,24 +143,25 @@ void LauncherTabWidget::createDocLoadingWidget()
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
166void LauncherTabWidget::initLayout() 167void LauncherTabWidget::initLayout()
@@ -492,24 +493,31 @@ void Launcher::createGUI()
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
498Launcher::~Launcher() 499Launcher::~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
504void Launcher::makeVisible() 512void Launcher::makeVisible()
505{ 513{
506 showMaximized(); 514 showMaximized();
507} 515}
508 516
509void Launcher::destroyGUI() 517void 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}
@@ -740,32 +748,24 @@ void Launcher::applicationScanningProgress( int percent )
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
750void Launcher::documentScanningProgress( int percent ) 758void 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 );
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
@@ -107,25 +107,25 @@ public:
107 void applicationAdded( const QString& type, const AppLnk& doc ); 107 void applicationAdded( const QString& type, const AppLnk& doc );
108 void applicationRemoved( const QString& type, const AppLnk& doc ); 108 void applicationRemoved( const QString& type, const AppLnk& doc );
109 void allApplicationsRemoved(); 109 void allApplicationsRemoved();
110 void applicationStateChanged( const QString& name, ApplicationState state ); 110 void applicationStateChanged( const QString& name, ApplicationState state );
111 void documentAdded( const DocLnk& doc ); 111 void documentAdded( const DocLnk& doc );
112 void documentRemoved( const DocLnk& doc ); 112 void documentRemoved( const DocLnk& doc );
113 void allDocumentsRemoved(); 113 void allDocumentsRemoved();
114 void documentChanged( const DocLnk& oldDoc, const DocLnk& newDoc ); 114 void documentChanged( const DocLnk& oldDoc, const DocLnk& newDoc );
115 void storageChanged( const QList<FileSystem> & ); 115 void storageChanged( const QList<FileSystem> & );
116 void applicationScanningProgress( int percent ); 116 void applicationScanningProgress( int percent );
117 void documentScanningProgress( int percent ); 117 void documentScanningProgress( int percent );
118 bool requiresApplications() const { return TRUE; } 118 bool requiresApplications() const { return TRUE; }
119 bool requiresDocuments() const { return TRUE; } 119 bool requiresDocuments() const;
120 void showLoadingDocs(); 120 void showLoadingDocs();
121 void showDocTab(); 121 void showDocTab();
122 122
123 QStringList idList() const { return ids; } 123 QStringList idList() const { return ids; }
124 124
125public slots: 125public slots:
126 void viewSelected(const QString&); 126 void viewSelected(const QString&);
127 void showTab(const QString&); 127 void showTab(const QString&);
128 void select( const AppLnk * ); 128 void select( const AppLnk * );
129 void properties( AppLnk * ); 129 void properties( AppLnk * );
130 void makeVisible(); 130 void makeVisible();
131 131