summaryrefslogtreecommitdiff
authorharlekin <harlekin>2003-04-07 08:50:40 (UTC)
committer harlekin <harlekin>2003-04-07 08:50:40 (UTC)
commit7e43e12cf57a39f957096889d6b38563f73402df (patch) (unidiff)
treee2f01d497421b6cdae28fec9afcbdc6acdfc1433
parent1725b536c8a5a939a481196cce1dc35af2d9a63a (diff)
downloadopie-7e43e12cf57a39f957096889d6b38563f73402df.zip
opie-7e43e12cf57a39f957096889d6b38563f73402df.tar.gz
opie-7e43e12cf57a39f957096889d6b38563f73402df.tar.bz2
show owait and a message in taskbar while scanning for documents
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/launcher/launcher.cpp35
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 @@
50#include <qregexp.h> 50#include <qregexp.h>
51#include <qmessagebox.h> 51#include <qmessagebox.h>
52#include <qframe.h> 52#include <qframe.h>
53#include <qpainter.h> 53#include <qpainter.h>
54#include <qlabel.h> 54#include <qlabel.h>
55#include <qtextstream.h> 55#include <qtextstream.h>
56#include <qpopupmenu.h> 56#include <qpopupmenu.h>
57 57
58#include <opie/owait.h>
59
60
58#include "launcherview.h" 61#include "launcherview.h"
59#include "launcher.h" 62#include "launcher.h"
60#include "syncdialog.h" 63#include "syncdialog.h"
61#include "desktop.h" 64#include "desktop.h"
62#include <qpe/lnkproperties.h> 65#include <qpe/lnkproperties.h>
63//#include "mrulist.h" 66//#include "mrulist.h"
64#include "qrsync.h" 67#include "qrsync.h"
65#include <stdlib.h> 68#include <stdlib.h>
@@ -355,16 +358,17 @@ LauncherView* CategoryTabWidget::newView( const QString& id, const QPixmap& pm,
355 stack->addWidget( view, tabs++ ); 358 stack->addWidget( view, tabs++ );
356 return view; 359 return view;
357} 360}
358 361
359void CategoryTabWidget::updateLink(const QString& linkfile) 362void CategoryTabWidget::updateLink(const QString& linkfile)
360{ 363{
361 int i=0; 364 int i=0;
362 LauncherView* view; 365 LauncherView* view;
366 qApp->processEvents();
363 while ((view = (LauncherView*)stack->widget(i++))) { 367 while ((view = (LauncherView*)stack->widget(i++))) {
364 if ( view->removeLink(linkfile) ) 368 if ( view->removeLink(linkfile) )
365 break; 369 break;
366 } 370 }
367 addItem(linkfile); 371 addItem(linkfile);
368 docview->updateTools(); 372 docview->updateTools();
369} 373}
370 374
@@ -723,16 +727,23 @@ void Launcher::updateMimeTypes(AppLnkSet* folder)
723 * all removable medium 727 * all removable medium
724 * b) the user enabled medium checking globally and we need to use this mimefilter 728 * b) the user enabled medium checking globally and we need to use this mimefilter
725 * c) the user enabled medium checking on a per medium bases 729 * c) the user enabled medium checking on a per medium bases
726 * c1) we already checked and its not ask again turns 730 * c1) we already checked and its not ask again turns
727 * c2) we need to ask and then apply the mimefilter 731 * c2) we need to ask and then apply the mimefilter
728 */ 732 */
729void Launcher::loadDocs() // ok here comes a hack belonging to Global:: 733void Launcher::loadDocs() // ok here comes a hack belonging to Global::
730{ 734{
735
736 OWait *owait = new OWait();
737 Global::statusMessage( tr( "Finding documents" ) );
738
739 owait->show();
740 qApp->processEvents();
741
731 delete docsFolder; 742 delete docsFolder;
732 docsFolder = new DocLnkSet; 743 docsFolder = new DocLnkSet;
733 744
734 DocLnkSet *tmp = 0; 745 DocLnkSet *tmp = 0;
735 QString home = QString(getenv("HOME")) + "/Documents"; 746 QString home = QString(getenv("HOME")) + "/Documents";
736 tmp = new DocLnkSet( home , QString::null); 747 tmp = new DocLnkSet( home , QString::null);
737 docsFolder->appendFrom( *tmp ); 748 docsFolder->appendFrom( *tmp );
738 delete tmp; 749 delete tmp;
@@ -783,51 +794,60 @@ void Launcher::loadDocs() // ok here comes a hack belonging to Global::
783 cfg.setGroup("main"); 794 cfg.setGroup("main");
784 QString stamp = cfg.readEntry("timestamp", QDateTime::currentDateTime().toString() ); 795 QString stamp = cfg.readEntry("timestamp", QDateTime::currentDateTime().toString() );
785 /** This medium is uptodate 796 /** This medium is uptodate
786 */ 797 */
787 if( stamp == m_timeStamp ){ // ok we know this card 798 if( stamp == m_timeStamp ){ // ok we know this card
788 cfg.writeEntry("timestamp", newStamp ); //just write a new timestamp 799 cfg.writeEntry("timestamp", newStamp ); //just write a new timestamp
789 // we need to scan the list now. Hopefully the cache will be there 800 // we need to scan the list now. Hopefully the cache will be there
790 // read the mimetypes from the config and search for documents 801 // read the mimetypes from the config and search for documents
791 QStringList mimetypes = configToMime( &cfg); 802 QStringList mimetypes = configToMime( &cfg);
792 tmp = new DocLnkSet( (*it)->path(), mimetypes.join(";") ); 803 qApp->processEvents();
804 Global::statusMessage( tr( "Searching documents" ) );
805 tmp = new DocLnkSet( (*it)->path(), mimetypes.join(";") );
793 docsFolder->appendFrom( *tmp ); 806 docsFolder->appendFrom( *tmp );
794 delete tmp; 807 delete tmp;
795 808
796 }else{ // come up with the gui cause this a new card 809 }else{ // come up with the gui cause this a new card
797 MediumMountGui medium(&cfg, (*it)->path() ); 810 MediumMountGui medium(&cfg, (*it)->path() );
798 if( medium.check() ){ // we did not ask before or ask again is off 811 if( medium.check() ){ // we did not ask before or ask again is off
799 /** c2) */ 812 /** c2) */
800 if( medium.exec() ){ // he clicked yes so search it 813 if( medium.exec() ){ // he clicked yes so search it
801 // speicher 814 // speicher
802 //cfg.read(); // cause of a race we need to reread - fixed 815 //cfg.read(); // cause of a race we need to reread - fixed
803 cfg.setGroup("main"); 816 cfg.setGroup("main");
804 cfg.writeEntry("timestamp", newStamp ); 817 cfg.writeEntry("timestamp", newStamp );
805 cfg.write(); 818 cfg.write();
806 tmp = new DocLnkSet( (*it)->path(), medium.mimeTypes().join(";" ) ); 819
807 docsFolder->appendFrom( *tmp ); 820 qApp->processEvents();
821 tmp = new DocLnkSet( (*it)->path(), medium.mimeTypes().join(";" ) );
822 docsFolder->appendFrom( *tmp );
808 delete tmp; 823 delete tmp;
809 }// no else 824 }// no else
810 /** c1) */ 825 /** c1) */
811 }else{ // we checked 826 }else{ // we checked
812 // do something different see what we need to do 827 // do something different see what we need to do
813 // let's see if we should check the device 828 // let's see if we should check the device
814 cfg.setGroup("main" ); 829 cfg.setGroup("main" );
815 bool check = cfg.readBoolEntry("autocheck", true ); 830 bool check = cfg.readBoolEntry("autocheck", true );
816 if( check ){ // find the documents 831 if( check ){ // find the documents
817 tmp = new DocLnkSet( (*it)->path(), configToMime(&cfg ).join(";") ); 832
833 qApp->processEvents();
834 Global::statusMessage( tr( "Searching documents" ) );
835 tmp = new DocLnkSet( (*it)->path(), configToMime(&cfg ).join(";") );
818 docsFolder->appendFrom( *tmp ); 836 docsFolder->appendFrom( *tmp );
819 delete tmp; 837 delete tmp;
820 } 838 }
821 } 839 }
822 } 840 }
823 } 841 }
824 } 842 }
825 m_timeStamp = newStamp; 843 m_timeStamp = newStamp;
844 owait->hide();
845 delete owait;
826} 846}
827 847
828void Launcher::updateTabs() 848void Launcher::updateTabs()
829{ 849{
830 MimeType::updateApplications(); // ### reads all applnks twice 850 MimeType::updateApplications(); // ### reads all applnks twice
831 851
832 delete rootFolder; 852 delete rootFolder;
833 rootFolder = new AppLnkSet( MimeType::appsFolderName() ); 853 rootFolder = new AppLnkSet( MimeType::appsFolderName() );
@@ -1099,17 +1119,20 @@ void Launcher::systemMessage( const QCString &msg, const QByteArray &data)
1099 syncDialog->whatLabel->setText( "<b>" + what + "</b>" ); 1119 syncDialog->whatLabel->setText( "<b>" + what + "</b>" );
1100 connect( syncDialog->buttonCancel, SIGNAL( clicked() ), 1120 connect( syncDialog->buttonCancel, SIGNAL( clicked() ),
1101 SLOT( cancelSync() ) ); 1121 SLOT( cancelSync() ) );
1102 } else if ( msg == "stopSync()") { 1122 } else if ( msg == "stopSync()") {
1103 delete syncDialog; syncDialog = 0; 1123 delete syncDialog; syncDialog = 0;
1104 } else if ( msg == "getAllDocLinks()" ) { 1124 } else if ( msg == "getAllDocLinks()" ) {
1105 loadDocs(); 1125 loadDocs();
1106 1126
1107 QString contents; 1127 // directly show updated docs in document tab
1128 updateDocs();
1129
1130 QString contents;
1108 1131
1109 //Categories cats; 1132 //Categories cats;
1110 for ( QListIterator<DocLnk> it( docsFolder->children() ); it.current(); ++it ) { 1133 for ( QListIterator<DocLnk> it( docsFolder->children() ); it.current(); ++it ) {
1111 DocLnk *doc = it.current(); 1134 DocLnk *doc = it.current();
1112 QFileInfo fi( doc->file() ); 1135 QFileInfo fi( doc->file() );
1113 if ( !fi.exists() ) 1136 if ( !fi.exists() )
1114 continue; 1137 continue;
1115 1138