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 @@ -42,32 +42,35 @@ #include <qcombobox.h> #include <qvbox.h> #include <qlayout.h> #include <qstyle.h> #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> #include <sys/vfs.h> #include <mntent.h> #endif @@ -347,32 +350,33 @@ LauncherView* CategoryTabWidget::newView( const QString& id, const QPixmap& pm, { LauncherView* view = new LauncherView( stack ); connect( view, SIGNAL(clicked(const AppLnk*)), this, SIGNAL(clicked(const AppLnk*))); 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(); pal.setColor( QColorGroup::Light, pal.color(QPalette::Active,QColorGroup::Shadow) ); pal.setColor( QColorGroup::Background, pal.active().background().light(110) ); categoryBar->setPalette( pal ); categoryBar->update(); @@ -715,32 +719,39 @@ void Launcher::updateMimeTypes(AppLnkSet* folder) } } /** This is a HACK.... * 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(); QListIterator<FileSystem> it ( fileSystems ); for ( ; it.current(); ++it ) { if ( (*it)->disk() == "/dev/mtdblock6" || (*it)->disk() == "tmpfs" ) { @@ -775,67 +786,76 @@ void Launcher::loadDocs() // ok here comes a hack belonging to Global:: } } // done return; // save the else } // 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()); } void Launcher::updateDocs() { @@ -1091,33 +1111,36 @@ void Launcher::systemMessage( const QCString &msg, const QByteArray &data) } else if ( msg == "startSync(QString)" ) { QString what; stream >> what; delete syncDialog; syncDialog = 0; 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 ) ) { QTextStream ts( &f ); ts.setEncoding( QTextStream::UnicodeUTF8 ); contents += ts.read(); f.close(); |