author | zecke <zecke> | 2002-04-27 17:39:49 (UTC) |
---|---|---|
committer | zecke <zecke> | 2002-04-27 17:39:49 (UTC) |
commit | f3ee6db944094c61ecf803f07ff736bf6d70141d (patch) (unidiff) | |
tree | 590ce81223de721a2d4fdfa0d807e0e2e62ecea1 | |
parent | 1096acae0705c6679a918dafaa7c7388da3828cb (diff) | |
download | opie-f3ee6db944094c61ecf803f07ff736bf6d70141d.zip opie-f3ee6db944094c61ecf803f07ff736bf6d70141d.tar.gz opie-f3ee6db944094c61ecf803f07ff736bf6d70141d.tar.bz2 |
restore original behaviour this can be changed by the MediumMountSettings app
-rw-r--r-- | core/launcher/launcher.cpp | 53 |
1 files changed, 42 insertions, 11 deletions
diff --git a/core/launcher/launcher.cpp b/core/launcher/launcher.cpp index f9c6c02..1a52f69 100644 --- a/core/launcher/launcher.cpp +++ b/core/launcher/launcher.cpp | |||
@@ -78,11 +78,11 @@ | |||
78 | // uidGen | 78 | // uidGen |
79 | namespace { | 79 | namespace { |
80 | QStringList configToMime( Config *cfg ){ | 80 | QStringList configToMime( Config *cfg ){ |
81 | QStringList mimes; | 81 | QStringList mimes; |
82 | bool tmpMime; | 82 | bool tmpMime = true; |
83 | cfg->setGroup("mimetypes" ); | 83 | cfg->setGroup("mimetypes" ); |
84 | tmpMime = cfg->readBoolEntry("all" ,false); | 84 | tmpMime = cfg->readBoolEntry("all" ,true); |
85 | if( tmpMime ){ | 85 | if( tmpMime ){ |
86 | mimes << QString::null; | 86 | mimes << QString::null; |
87 | return mimes; | 87 | return mimes; |
88 | }else{ | 88 | }else{ |
@@ -533,21 +533,36 @@ void Launcher::updateMimeTypes(AppLnkSet* folder) | |||
533 | MimeType::registerApp(*app); | 533 | MimeType::registerApp(*app); |
534 | } | 534 | } |
535 | } | 535 | } |
536 | } | 536 | } |
537 | 537 | /** This is a HACK.... | |
538 | * Reason: scanning huge mediums, microdirvers for examples | ||
539 | * consomes time. To avoid that we invented the MediumMountCheck | ||
540 | * | ||
541 | * a) the user globally disabled medium checking. We can ignore | ||
542 | * all removable medium | ||
543 | * b) the user enabled medium checking globally and we need to use this mimefilter | ||
544 | * c) the user enabled medium checking on a per medium bases | ||
545 | * c1) we already checked and its not ask again turns | ||
546 | * c2) we need to ask and then apply the mimefilter | ||
547 | */ | ||
538 | void Launcher::loadDocs() // ok here comes a hack belonging to Global:: | 548 | void Launcher::loadDocs() // ok here comes a hack belonging to Global:: |
539 | { | 549 | { |
540 | qWarning("loading Documents" ); | ||
541 | qWarning("The currentTimeStamp is: %s", m_timeStamp.latin1() ); | ||
542 | delete docsFolder; | 550 | delete docsFolder; |
543 | docsFolder = new DocLnkSet; | 551 | docsFolder = new DocLnkSet; |
544 | qWarning("new DocLnkSet" ); | 552 | |
545 | DocLnkSet *tmp = 0; | 553 | DocLnkSet *tmp = 0; |
546 | QString home = QString(getenv("HOME")) + "/Documents"; | 554 | QString home = QString(getenv("HOME")) + "/Documents"; |
547 | tmp = new DocLnkSet( home , QString::null); | 555 | tmp = new DocLnkSet( home , QString::null); |
548 | docsFolder->appendFrom( *tmp ); | 556 | docsFolder->appendFrom( *tmp ); |
549 | delete tmp; | 557 | delete tmp; |
558 | |||
559 | Config mediumCfg( "medium"); | ||
560 | mediumCfg.setGroup("main"); | ||
561 | // a) -zecke we don't want to check | ||
562 | if(!mediumCfg.readBoolEntry("use", true ) ) | ||
563 | return; | ||
564 | |||
550 | // find out wich filesystems are new in this round | 565 | // find out wich filesystems are new in this round |
551 | // We will do this by having a timestamp inside each mountpoint | 566 | // We will do this by having a timestamp inside each mountpoint |
552 | // if the current timestamp doesn't match this is a new file system and | 567 | // if the current timestamp doesn't match this is a new file system and |
553 | // come up with our MediumMountGui :) let the hacking begin | 568 | // come up with our MediumMountGui :) let the hacking begin |
@@ -556,37 +571,53 @@ void Launcher::loadDocs() // ok here comes a hack belonging to Global:: | |||
556 | QString newStamp = QString::number( stamp ); // generates newtime Stamp | 571 | QString newStamp = QString::number( stamp ); // generates newtime Stamp |
557 | StorageInfo storage; | 572 | StorageInfo storage; |
558 | const QList<FileSystem> &fileSystems = storage.fileSystems(); | 573 | const QList<FileSystem> &fileSystems = storage.fileSystems(); |
559 | QListIterator<FileSystem> it ( fileSystems ); | 574 | QListIterator<FileSystem> it ( fileSystems ); |
560 | 575 | ||
561 | 576 | // b) | |
577 | if( mediumCfg.readBoolEntry("global", true ) ){ | ||
578 | QString mime = configToMime(&mediumCfg).join(";"); | ||
579 | for( ; it.current(); ++it ){ | ||
580 | if( (*it)->isRemovable() ){ | ||
581 | tmp = new DocLnkSet( (*it)->path(), mime ); | ||
582 | docsFolder->appendFrom( *tmp ); | ||
583 | delete tmp; | ||
584 | } | ||
585 | } // done | ||
586 | return; // save the else | ||
587 | } | ||
588 | // c) zecke | ||
562 | for ( ; it.current(); ++it ) { | 589 | for ( ; it.current(); ++it ) { |
563 | if ( (*it)->isRemovable() ) { // let's find out if we should search on it | 590 | if ( (*it)->isRemovable() ) { // let's find out if we should search on it |
564 | qWarning("%s is removeable", (*it)->path().latin1() ); | 591 | Config cfg( (*it)->path() + "/.opiestorage.cf", Config::File); |
565 | OConfig cfg( (*it)->path() + "/.opiestorage.cf"); | ||
566 | cfg.setGroup("main"); | 592 | cfg.setGroup("main"); |
567 | QString stamp = cfg.readEntry("timestamp", QDateTime::currentDateTime().toString() ); | 593 | QString stamp = cfg.readEntry("timestamp", QDateTime::currentDateTime().toString() ); |
594 | /** This medium is uptodate | ||
595 | */ | ||
568 | if( stamp == m_timeStamp ){ // ok we know this card | 596 | if( stamp == m_timeStamp ){ // ok we know this card |
569 | cfg.writeEntry("timestamp", newStamp ); //just write a new timestamp | 597 | cfg.writeEntry("timestamp", newStamp ); //just write a new timestamp |
570 | // we need to scan the list now. Hopefully the cache will be there | 598 | // we need to scan the list now. Hopefully the cache will be there |
571 | // read the mimetypes from the config and search for documents | 599 | // read the mimetypes from the config and search for documents |
572 | QStringList mimetypes = configToMime( &cfg); | 600 | QStringList mimetypes = configToMime( &cfg); |
573 | tmp = new DocLnkSet( (*it)->path(), mimetypes.join(";") ); | 601 | tmp = new DocLnkSet( (*it)->path(), mimetypes.join(";") ); |
574 | docsFolder->appendFrom( *tmp ); | 602 | docsFolder->appendFrom( *tmp ); |
575 | delete tmp; | 603 | delete tmp; |
576 | 604 | ||
577 | }else{ // come up with the gui cause this a new card | 605 | }else{ // come up with the gui cause this a new card |
578 | MediumMountGui medium(&cfg, (*it)->path() ); | 606 | MediumMountGui medium(&cfg, (*it)->path() ); |
579 | if( medium.check() ){ // we did not ask before or ask again is off | 607 | if( medium.check() ){ // we did not ask before or ask again is off |
608 | /** c2) */ | ||
580 | if( medium.exec() ){ // he clicked yes so search it | 609 | if( medium.exec() ){ // he clicked yes so search it |
581 | // speicher | 610 | // speicher |
582 | //cfg.read(); // cause of a race we need to reread - fixed | 611 | //cfg.read(); // cause of a race we need to reread - fixed |
612 | cfg.setGroup("main"); | ||
583 | cfg.writeEntry("timestamp", newStamp ); | 613 | cfg.writeEntry("timestamp", newStamp ); |
584 | cfg.write(); | 614 | cfg.write(); |
585 | tmp = new DocLnkSet( (*it)->path(), medium.mimeTypes().join(";" ) ); | 615 | tmp = new DocLnkSet( (*it)->path(), medium.mimeTypes().join(";" ) ); |
586 | docsFolder->appendFrom( *tmp ); | 616 | docsFolder->appendFrom( *tmp ); |
587 | delete tmp; | 617 | delete tmp; |
588 | }// no else | 618 | }// no else |
619 | /** c1) */ | ||
589 | }else{ // we checked | 620 | }else{ // we checked |
590 | // do something different see what we need to do | 621 | // do something different see what we need to do |
591 | // let's see if we should check the device | 622 | // let's see if we should check the device |
592 | cfg.setGroup("main" ); | 623 | cfg.setGroup("main" ); |