summaryrefslogtreecommitdiff
authorzecke <zecke>2002-03-24 19:30:27 (UTC)
committer zecke <zecke>2002-03-24 19:30:27 (UTC)
commit4802684dd785274be50b472c87e315da0e325449 (patch) (unidiff)
treee15bb479f443d5ce410ccbd9368e663213210517
parent6ce8bbff9eb16e0d731755010bda63e7fb43f70b (diff)
downloadopie-4802684dd785274be50b472c87e315da0e325449.zip
opie-4802684dd785274be50b472c87e315da0e325449.tar.gz
opie-4802684dd785274be50b472c87e315da0e325449.tar.bz2
Hija this adds the "Do you want to scan this device?"
to launcher and should speed up some things. Please test launcher and report bugs to me
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/launcher/launcher.cpp84
-rw-r--r--core/launcher/mediummountgui.cpp10
2 files changed, 66 insertions, 28 deletions
diff --git a/core/launcher/launcher.cpp b/core/launcher/launcher.cpp
index 1c38a05..cf1a3c8 100644
--- a/core/launcher/launcher.cpp
+++ b/core/launcher/launcher.cpp
@@ -78,2 +78,33 @@
78// uidGen 78// uidGen
79namespace {
80 QStringList configToMime( Config *cfg ){
81 QStringList mimes;
82 bool tmpMime;
83 cfg->setGroup("mimetypes" );
84 tmpMime = cfg->readBoolEntry("all" ,false);
85 if( tmpMime ){
86 mimes << QString::null;
87 return mimes;
88 }else{
89 tmpMime = cfg->readBoolEntry("audio", true );
90 if(tmpMime )
91 mimes.append("audio//*" );
92
93 tmpMime = cfg->readBoolEntry("image", true );
94 if(tmpMime )
95 mimes.append("image//*" );
96
97 tmpMime = cfg->readBoolEntry("text", true );
98 if(tmpMime )
99 mimes.append("text//*");
100
101 tmpMime = cfg->readBoolEntry("video", true );
102 if(tmpMime )
103 mimes.append("video//*" );
104 }
105 return mimes;
106 }
107
108}
109
79 110
@@ -428,4 +459,4 @@ Launcher::Launcher( QWidget* parent, const char* name, WFlags fl )
428 docsFolder = 0; 459 docsFolder = 0;
429 int stamp = uidgen.generate(); 460 int stamp = uidgen.generate(); // this is our timestamp to see which devices we know
430 uidgen.store( stamp ); 461 //uidgen.store( stamp );
431 m_timeStamp = QString::number( stamp ); 462 m_timeStamp = QString::number( stamp );
@@ -513,2 +544,7 @@ void Launcher::loadDocs() // ok here comes a hack belonging to Global::
513 qWarning("new DocLnkSet" ); 544 qWarning("new DocLnkSet" );
545 DocLnkSet *tmp = 0;
546 QString home = QString(getenv("HOME")) + "/Documents";
547 tmp = new DocLnkSet( home , QString::null);
548 docsFolder->appendFrom( *tmp );
549 delete tmp;
514 // find out wich filesystems are new in this round 550 // find out wich filesystems are new in this round
@@ -519,12 +555,7 @@ void Launcher::loadDocs() // ok here comes a hack belonging to Global::
519 555
520 QString newStamp = QString::number( stamp ); 556 QString newStamp = QString::number( stamp ); // generates newtime Stamp
521 qWarning("new time stamp is: %s", newStamp.latin1() );
522 StorageInfo storage; 557 StorageInfo storage;
523 const QList<FileSystem> &fileSystems = storage.fileSystems(); 558 const QList<FileSystem> &fileSystems = storage.fileSystems();
524 qWarning("QList<FileSystem>" );
525 QListIterator<FileSystem> it ( fileSystems ); 559 QListIterator<FileSystem> it ( fileSystems );
526 qWarning("iterator initiliazed" );
527 for ( ; it.current(); ++it ) { 560 for ( ; it.current(); ++it ) {
528 qWarning("inside for loop" );
529 qWarning("checking device %s", (*it)->path().latin1() );
530 if ( (*it)->isRemovable() ) { // let's find out if we should search on it 561 if ( (*it)->isRemovable() ) { // let's find out if we should search on it
@@ -535,20 +566,28 @@ void Launcher::loadDocs() // ok here comes a hack belonging to Global::
535 if( stamp == m_timeStamp ){ // ok we know this card 566 if( stamp == m_timeStamp ){ // ok we know this card
536 qWarning("time stamp match" ); 567 cfg.writeEntry("timestamp", newStamp ); //just write a new timestamp
537 cfg.writeEntry("timestamp", newStamp );
538 // we need to scan the list now. Hopefully the cache will be there 568 // we need to scan the list now. Hopefully the cache will be there
539 }else{ // come up with the gui 569 // read the mimetypes from the config and search for documents
540 qWarning("time stamp doesn't match" ); 570 QStringList mimetypes = configToMime( &cfg);
571 tmp = new DocLnkSet( (*it)->path(), mimetypes.join(";") );
572 docsFolder->appendFrom( *tmp );
573 delete tmp;
574
575 }else{ // come up with the gui cause this a new card
541 MediumMountGui medium((*it)->path() ); 576 MediumMountGui medium((*it)->path() );
542 qWarning("medium mount gui created" ); 577 if( medium.check() ){ // we did not ask before or ask again is off
543 if( medium.check() ){ 578 if( medium.exec() ){ // he clicked yes so search it
544 qWarning("need to check this device" );
545 if( medium.exec() ){ //ok
546 // speicher 579 // speicher
547 qWarning("execed" ); 580 cfg.read(); // cause of a race we need to reread
548 cfg.read();
549 cfg.writeEntry("timestamp", newStamp ); 581 cfg.writeEntry("timestamp", newStamp );
550 } 582 }// no else
551 }else{ 583 }else{ // we checked
552 qWarning("wrong :(" );
553 // do something different see what we need to do 584 // do something different see what we need to do
585 // let's see if we should check the device
586 cfg.setGroup("main" );
587 bool check = cfg.readBoolEntry("autocheck", true );
588 if( check ){ // find the documents
589 tmp = new DocLnkSet( (*it)->path(), configToMime(&cfg ).join(";") );
590 docsFolder->appendFrom( *tmp );
591 delete tmp;
592 }
554 } 593 }
@@ -557,5 +596,2 @@ void Launcher::loadDocs() // ok here comes a hack belonging to Global::
557 } 596 }
558 qWarning("findDocuments" );
559 Global::findDocuments(docsFolder); // get rid of this call later
560 qWarning("done" );
561 m_timeStamp = newStamp; 597 m_timeStamp = newStamp;
diff --git a/core/launcher/mediummountgui.cpp b/core/launcher/mediummountgui.cpp
index e3fa5bd..f0de85b 100644
--- a/core/launcher/mediummountgui.cpp
+++ b/core/launcher/mediummountgui.cpp
@@ -82,5 +82,6 @@ void MediumMountGui::writeConfig(bool autocheck) {
82 82
83 // if all is checked then add only "null" to the list. 83 // if all is checked then add only "QString::null" to the list.
84 if (checkmimeall) { 84 if (checkmimeall) {
85 mimeTypeList += ("null"); 85 mimeTypeList.clear();
86 mimeTypeList += QString::null;
86 } else { 87 } else {
@@ -99,6 +100,7 @@ void MediumMountGui::writeConfig(bool autocheck) {
99 if (checkmimeall) { 100 if (checkmimeall) {
100 mimeTypeList << ("null"); 101 mimeTypeList.clear();
102 mimeTypeList << QString::null;
101 } 103 }
102 } 104 }
103 cfg.write(); 105 cfg.write(); // not really needed here but just to be sure
104} 106}