author | zecke <zecke> | 2003-11-30 13:23:51 (UTC) |
---|---|---|
committer | zecke <zecke> | 2003-11-30 13:23:51 (UTC) |
commit | 16756af1bf59a8c59b16c852e311316aacd3351f (patch) (side-by-side diff) | |
tree | fb173ed7bdca4a1691ce5ed31bebf436624f74b1 | |
parent | 8339a705567a3bd50af2e41805e9256973eedcc4 (diff) | |
download | opie-16756af1bf59a8c59b16c852e311316aacd3351f.zip opie-16756af1bf59a8c59b16c852e311316aacd3351f.tar.gz opie-16756af1bf59a8c59b16c852e311316aacd3351f.tar.bz2 |
Allow to process mouse and key events during document scanning...
I use 20 as a value for now... someone tuned it but forgot to commit it?!
-rw-r--r-- | core/launcher/documentlist.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/core/launcher/documentlist.cpp b/core/launcher/documentlist.cpp index 1a7de33..ece6931 100644 --- a/core/launcher/documentlist.cpp +++ b/core/launcher/documentlist.cpp @@ -50,193 +50,193 @@ 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(); 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; }; DocumentList::DocumentList( ServerInterface *serverGui, bool scanDocs, QObject *parent, const char *name ) : QObject( parent, name ) { appLnkSet = new AppLnkSet( MimeType::appsFolderName() ); d = new DocumentListPrivate( serverGui ); 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(); reloadDocLnks(); } DocumentList::~DocumentList() { delete appLnkSet; delete d; } void DocumentList::add( const DocLnk& doc ) { if ( d->serverGui && QFile::exists( doc.file() ) ) d->serverGui->documentAdded( doc ); } void DocumentList::start() { resume(); } void DocumentList::pause() { //qDebug("pause %i", d->tid); killTimer( d->tid ); d->tid = 0; } void DocumentList::resume() { if ( d->tid == 0 ) { - d->tid = startTimer( 0 ); + d->tid = startTimer( 20 ); //qDebug("resumed %i", d->tid); } } /* void DocumentList::resend() { // Re-emits all the added items to the list (firstly letting everyone know to // clear what they have as it is being sent again) pause(); emit allRemoved(); QTimer::singleShot( 5, this, SLOT( resendWorker() ) ); } void DocumentList::resendWorker() { const QList<DocLnk> &list = d->dls.children(); for ( QListIterator<DocLnk> it( list ); it.current(); ++it ) add( *(*it) ); resume(); } */ void DocumentList::rescan() { //qDebug("rescan"); pause(); d->initialize(); resume(); } void DocumentList::timerEvent( QTimerEvent *te ) { if ( te->timerId() == d->tid ) { // Do 3 at a time 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; } } } } 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); if (pm.isNull()) { QImage img( Resource::loadImage( "UnknownDocument" ) ); pm = img.smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ); bgPm = img.smoothScale( AppLnk::bigIconSize(), AppLnk::bigIconSize() ); } //qDebug("adding type %s", (*ittypes).latin1()); // ### our current launcher expects docs tab to be last d->serverGui->typeAdded( *ittypes, name.isNull() ? (*ittypes) : name, pm, bgPm ); } prevTypeList.remove(*ittypes); } } for ( QStringList::Iterator ittypes=prevTypeList.begin(); ittypes!=prevTypeList.end(); ++ittypes) { //qDebug("removing type %s", (*ittypes).latin1()); d->serverGui->typeRemoved(*ittypes); } prevTypeList = types; } |