author | harlekin <harlekin> | 2003-04-07 08:50:40 (UTC) |
---|---|---|
committer | harlekin <harlekin> | 2003-04-07 08:50:40 (UTC) |
commit | 7e43e12cf57a39f957096889d6b38563f73402df (patch) (side-by-side diff) | |
tree | e2f01d497421b6cdae28fec9afcbdc6acdfc1433 | |
parent | 1725b536c8a5a939a481196cce1dc35af2d9a63a (diff) | |
download | opie-7e43e12cf57a39f957096889d6b38563f73402df.zip opie-7e43e12cf57a39f957096889d6b38563f73402df.tar.gz opie-7e43e12cf57a39f957096889d6b38563f73402df.tar.bz2 |
show owait and a message in taskbar while scanning for documents
-rw-r--r-- | core/launcher/launcher.cpp | 35 |
1 files changed, 29 insertions, 6 deletions
diff --git a/core/launcher/launcher.cpp b/core/launcher/launcher.cpp index e74301c..3eb561a 100644 --- a/core/launcher/launcher.cpp +++ b/core/launcher/launcher.cpp @@ -46,24 +46,27 @@ #include <qpushbutton.h> #include <qtabbar.h> #include <qwidgetstack.h> #include <qlayout.h> #include <qregexp.h> #include <qmessagebox.h> #include <qframe.h> #include <qpainter.h> #include <qlabel.h> #include <qtextstream.h> #include <qpopupmenu.h> +#include <opie/owait.h> + + #include "launcherview.h" #include "launcher.h" #include "syncdialog.h" #include "desktop.h" #include <qpe/lnkproperties.h> //#include "mrulist.h" #include "qrsync.h" #include <stdlib.h> #include <unistd.h> #if defined(_OS_LINUX_) || defined(Q_OS_LINUX) #include <stdio.h> @@ -351,24 +354,25 @@ LauncherView* CategoryTabWidget::newView( const QString& id, const QPixmap& pm, connect( view, SIGNAL(rightPressed(AppLnk*)), this, SIGNAL(rightPressed(AppLnk*))); ids.append(id); categoryBar->addTab( new CategoryTab( pm, label ) ); stack->addWidget( view, tabs++ ); return view; } void CategoryTabWidget::updateLink(const QString& linkfile) { int i=0; LauncherView* view; + qApp->processEvents(); while ((view = (LauncherView*)stack->widget(i++))) { if ( view->removeLink(linkfile) ) break; } addItem(linkfile); docview->updateTools(); } void CategoryTabWidget::paletteChange( const QPalette &p ) { QVBox::paletteChange( p ); QPalette pal = palette(); @@ -719,24 +723,31 @@ void Launcher::updateMimeTypes(AppLnkSet* folder) * Reason: scanning huge mediums, microdirvers for examples * consomes time. To avoid that we invented the MediumMountCheck * * a) the user globally disabled medium checking. We can ignore * all removable medium * b) the user enabled medium checking globally and we need to use this mimefilter * c) the user enabled medium checking on a per medium bases * c1) we already checked and its not ask again turns * c2) we need to ask and then apply the mimefilter */ void Launcher::loadDocs() // ok here comes a hack belonging to Global:: { + + OWait *owait = new OWait(); + Global::statusMessage( tr( "Finding documents" ) ); + + owait->show(); + qApp->processEvents(); + delete docsFolder; docsFolder = new DocLnkSet; DocLnkSet *tmp = 0; QString home = QString(getenv("HOME")) + "/Documents"; tmp = new DocLnkSet( home , QString::null); docsFolder->appendFrom( *tmp ); delete tmp; // RAM documents StorageInfo storage; const QList<FileSystem> &fileSystems = storage.fileSystems(); @@ -779,59 +790,68 @@ void Launcher::loadDocs() // ok here comes a hack belonging to Global:: // c) zecke for ( it.toFirst(); it.current(); ++it ) { if ( (*it)->isRemovable() ) { // let's find out if we should search on it Config cfg( (*it)->path() + "/.opiestorage.cf", Config::File); cfg.setGroup("main"); QString stamp = cfg.readEntry("timestamp", QDateTime::currentDateTime().toString() ); /** This medium is uptodate */ if( stamp == m_timeStamp ){ // ok we know this card cfg.writeEntry("timestamp", newStamp ); //just write a new timestamp // we need to scan the list now. Hopefully the cache will be there // read the mimetypes from the config and search for documents - QStringList mimetypes = configToMime( &cfg); - tmp = new DocLnkSet( (*it)->path(), mimetypes.join(";") ); + QStringList mimetypes = configToMime( &cfg); + qApp->processEvents(); + Global::statusMessage( tr( "Searching documents" ) ); + tmp = new DocLnkSet( (*it)->path(), mimetypes.join(";") ); docsFolder->appendFrom( *tmp ); delete tmp; }else{ // come up with the gui cause this a new card MediumMountGui medium(&cfg, (*it)->path() ); if( medium.check() ){ // we did not ask before or ask again is off /** c2) */ if( medium.exec() ){ // he clicked yes so search it // speicher //cfg.read(); // cause of a race we need to reread - fixed cfg.setGroup("main"); cfg.writeEntry("timestamp", newStamp ); cfg.write(); - tmp = new DocLnkSet( (*it)->path(), medium.mimeTypes().join(";" ) ); - docsFolder->appendFrom( *tmp ); + + qApp->processEvents(); + tmp = new DocLnkSet( (*it)->path(), medium.mimeTypes().join(";" ) ); + docsFolder->appendFrom( *tmp ); delete tmp; }// no else /** c1) */ }else{ // we checked // do something different see what we need to do // let's see if we should check the device cfg.setGroup("main" ); bool check = cfg.readBoolEntry("autocheck", true ); if( check ){ // find the documents - tmp = new DocLnkSet( (*it)->path(), configToMime(&cfg ).join(";") ); + + qApp->processEvents(); + Global::statusMessage( tr( "Searching documents" ) ); + tmp = new DocLnkSet( (*it)->path(), configToMime(&cfg ).join(";") ); docsFolder->appendFrom( *tmp ); delete tmp; } } } } } m_timeStamp = newStamp; + owait->hide(); + delete owait; } void Launcher::updateTabs() { MimeType::updateApplications(); // ### reads all applnks twice delete rootFolder; rootFolder = new AppLnkSet( MimeType::appsFolderName() ); loadDocs(); tabs->initializeCategories(rootFolder, docsFolder, storage->fileSystems()); @@ -1095,25 +1115,28 @@ void Launcher::systemMessage( const QCString &msg, const QByteArray &data) syncDialog = new SyncDialog( this, "syncProgress", FALSE, WStyle_Tool | WStyle_Customize | Qt::WStyle_StaysOnTop ); syncDialog->showMaximized(); syncDialog->whatLabel->setText( "<b>" + what + "</b>" ); connect( syncDialog->buttonCancel, SIGNAL( clicked() ), SLOT( cancelSync() ) ); } else if ( msg == "stopSync()") { delete syncDialog; syncDialog = 0; } else if ( msg == "getAllDocLinks()" ) { loadDocs(); - QString contents; + // directly show updated docs in document tab + updateDocs(); + + QString contents; // Categories cats; for ( QListIterator<DocLnk> it( docsFolder->children() ); it.current(); ++it ) { DocLnk *doc = it.current(); QFileInfo fi( doc->file() ); if ( !fi.exists() ) continue; bool fake = !doc->linkFileKnown(); if ( !fake ) { QFile f( doc->linkFile() ); if ( f.open( IO_ReadOnly ) ) { |