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 @@ -50,16 +50,19 @@ #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> @@ -355,16 +358,17 @@ LauncherView* CategoryTabWidget::newView( const QString& id, const QPixmap& pm, 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(); } @@ -723,16 +727,23 @@ void Launcher::updateMimeTypes(AppLnkSet* folder) * 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; @@ -783,51 +794,60 @@ void Launcher::loadDocs() // ok here comes a hack belonging to Global:: 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() ); @@ -1099,17 +1119,20 @@ void Launcher::systemMessage( const QCString &msg, const QByteArray &data) 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; |