-rw-r--r-- | core/launcher/documentlist.cpp | 8 | ||||
-rw-r--r-- | core/launcher/launcher.cpp | 10 | ||||
-rw-r--r-- | core/launcher/launcher.h | 2 | ||||
-rw-r--r-- | core/launcher/serverinterface.h | 2 |
4 files changed, 20 insertions, 2 deletions
diff --git a/core/launcher/documentlist.cpp b/core/launcher/documentlist.cpp index 59dd721..19ceb0f 100644 --- a/core/launcher/documentlist.cpp +++ b/core/launcher/documentlist.cpp @@ -47,49 +47,49 @@ using namespace Opie::Core; #include <qcopchannel_qws.h> #include <qlistview.h> #include <qlist.h> #include <qpixmap.h> AppLnkSet *DocumentList::appLnkSet = 0; static const int MAX_SEARCH_DEPTH = 10; class DocumentListPrivate : public QObject { Q_OBJECT public: DocumentListPrivate( ServerInterface *gui ); ~DocumentListPrivate(); void initialize(); const QString nextFile(); const DocLnk *iterate(); bool store( DocLnk* dl ); void estimatedPercentScanned(); void appendDocpath(FileSystem*); - + DocLnkSet dls; QDict<void> reference; QDictIterator<void> *dit; enum { Find, RemoveKnownFiles, MakeUnknownFiles, Done } state; QStringList docPaths; unsigned int docPathsSearched; int searchDepth; QDir *listDirs[MAX_SEARCH_DEPTH]; const QFileInfoList *lists[MAX_SEARCH_DEPTH]; unsigned int listPositions[MAX_SEARCH_DEPTH]; StorageInfo *storage; int tid; ServerInterface *serverGui; bool needToSendAllDocLinks; bool sendAppLnks; bool sendDocLnks; bool scanDocs; @@ -169,62 +169,66 @@ void DocumentList::resend() void DocumentList::resendWorker() { const QList<DocLnk> &list = d->dls.children(); for ( QListIterator<DocLnk> it( list ); it.current(); ++it ) add( *(*it) ); resume(); } */ void DocumentList::rescan() { //odebug << "rescan" << oendl; pause(); d->initialize(); resume(); } void DocumentList::timerEvent( QTimerEvent *te ) { if ( te->timerId() == d->tid ) { // Do 3 at a time + if ( d->serverGui ) + d->serverGui->aboutToAddBegin(); for (int i = 0; i < 3; i++ ) { const DocLnk *lnk = d->iterate(); if ( lnk ) { add( *lnk ); } else { // stop when done pause(); if ( d->serverGui ) d->serverGui->documentScanningProgress( 100 ); if ( d->needToSendAllDocLinks ) sendAllDocLinks(); break; } - } + } + if ( d->serverGui ) + d->serverGui->aboutToAddEnd(); } } void DocumentList::reloadAppLnks() { if ( d->sendAppLnks && d->serverGui ) { d->serverGui->applicationScanningProgress( 0 ); d->serverGui->allApplicationsRemoved(); } delete appLnkSet; appLnkSet = new AppLnkSet( MimeType::appsFolderName() ); if ( d->sendAppLnks && d->serverGui ) { static QStringList prevTypeList; QStringList types = appLnkSet->types(); for ( QStringList::Iterator ittypes=types.begin(); ittypes!=types.end(); ++ittypes) { if ( !(*ittypes).isEmpty() ) { if ( !prevTypeList.contains(*ittypes) ) { QString name = appLnkSet->typeName(*ittypes); QPixmap pm = appLnkSet->typePixmap(*ittypes); QPixmap bgPm = appLnkSet->typeBigPixmap(*ittypes); diff --git a/core/launcher/launcher.cpp b/core/launcher/launcher.cpp index bf2287d..6afbcd8 100644 --- a/core/launcher/launcher.cpp +++ b/core/launcher/launcher.cpp @@ -675,48 +675,58 @@ void Launcher::applicationAdded( const QString& type, const AppLnk& app ) MimeType::registerApp( app ); } void Launcher::applicationRemoved( const QString& type, const AppLnk& app ) { LauncherView *view = tabs->view( type ); if ( view ) view->removeLink( app.linkFile() ); else owarn << "removeAppLnk: No view for " << type << "!" << oendl; } void Launcher::allApplicationsRemoved() { MimeType::clear(); for ( QStringList::ConstIterator it=ids.begin(); it!= ids.end(); ++it) tabs->view( (*it) )->removeAllItems(); } void Launcher::documentAdded( const DocLnk& doc ) { tabs->docView()->addItem( new DocLnk( doc ), FALSE ); } +void Launcher::aboutToAddBegin() +{ + tabs->docView()->setUpdatesEnabled( false ); +} + +void Launcher::aboutToAddEnd() +{ + tabs->docView()->setUpdatesEnabled( true ); +} + void Launcher::showLoadingDocs() { tabs->docView()->hide(); } void Launcher::showDocTab() { if ( tabs->categoryBar->currentView() == tabs->docView() ) tabs->docView()->show(); } void Launcher::documentRemoved( const DocLnk& doc ) { tabs->docView()->removeLink( doc.linkFile() ); } void Launcher::documentChanged( const DocLnk& oldDoc, const DocLnk& newDoc ) { documentRemoved( oldDoc ); documentAdded( newDoc ); } void Launcher::allDocumentsRemoved() { diff --git a/core/launcher/launcher.h b/core/launcher/launcher.h index 4f3ff8c..29bd7db 100644 --- a/core/launcher/launcher.h +++ b/core/launcher/launcher.h @@ -89,48 +89,50 @@ private: QWidgetStack *stack; LauncherView *docLoadingWidget; QProgressBar *docLoadingWidgetProgress; bool docLoadingWidgetEnabled; }; class Launcher : public QMainWindow, public ServerInterface { Q_OBJECT public: Launcher(); ~Launcher(); // implementing ServerInterface 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 aboutToAddBegin(); + void aboutToAddEnd(); 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; 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: void systemMessage( const QCString &, const QByteArray &); diff --git a/core/launcher/serverinterface.h b/core/launcher/serverinterface.h index e57ea51..132766f 100644 --- a/core/launcher/serverinterface.h +++ b/core/launcher/serverinterface.h @@ -29,44 +29,46 @@ class ServerInterface { public: virtual ~ServerInterface(); virtual void createGUI() = 0; virtual void destroyGUI() = 0; // These notify of the application categories, like what is used in the current launcher tabs, // for example "Applications", "Games" etc. virtual void typeAdded( const QString& type, const QString& name, const QPixmap& pixmap, const QPixmap& bgPixmap ) = 0; virtual void typeRemoved( const QString& type ) = 0; // These functions notify when an application is added or removed and to which category it belongs virtual void applicationAdded( const QString& type, const AppLnk& doc ) = 0; virtual void applicationRemoved( const QString& type, const AppLnk& doc ) = 0; virtual void allApplicationsRemoved() = 0; // Useful for wait icons, or running application lists etc enum ApplicationState { Launching, Running, Terminated }; virtual void applicationStateChanged( const QString& name, ApplicationState state ) = 0; static const AppLnkSet& appLnks(); // These functions notify of adding, removal and changes of document links used in the documents tab for example + virtual void aboutToAddBegin() {} + virtual void aboutToAddEnd() {} virtual void documentAdded( const DocLnk& doc ) = 0; virtual void documentRemoved( const DocLnk& doc ) = 0; virtual void allDocumentsRemoved() = 0; virtual void documentChanged( const DocLnk& oldDoc, const DocLnk& newDoc ) = 0; virtual void storageChanged( const QList<FileSystem> & ) = 0; virtual void applicationScanningProgress( int percent ) = 0; virtual void documentScanningProgress( int percent ) = 0; // Tells the server if the GUI needs to be updated about documents or applnks virtual bool requiresApplications() const = 0; virtual bool requiresDocuments() const = 0; enum DockArea { Top, Bottom, Left, Right }; static void dockWidget( QWidget *w, DockArea placement ); }; #endif // SERVER_INTERFACE_H |