-rw-r--r-- | core/launcher/launcher.cpp | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/core/launcher/launcher.cpp b/core/launcher/launcher.cpp index 02124d2..effcd24 100644 --- a/core/launcher/launcher.cpp +++ b/core/launcher/launcher.cpp | |||
@@ -527,95 +527,105 @@ void Launcher::updateMimeTypes(AppLnkSet* folder) | |||
527 | { | 527 | { |
528 | for ( QListIterator<AppLnk> it( folder->children() ); it.current(); ++it ) { | 528 | for ( QListIterator<AppLnk> it( folder->children() ); it.current(); ++it ) { |
529 | AppLnk *app = it.current(); | 529 | AppLnk *app = it.current(); |
530 | if ( app->type() == "Folder" ) | 530 | if ( app->type() == "Folder" ) |
531 | updateMimeTypes((AppLnkSet *)app); | 531 | updateMimeTypes((AppLnkSet *)app); |
532 | else { | 532 | else { |
533 | MimeType::registerApp(*app); | 533 | MimeType::registerApp(*app); |
534 | } | 534 | } |
535 | } | 535 | } |
536 | } | 536 | } |
537 | /** This is a HACK.... | 537 | /** This is a HACK.... |
538 | * Reason: scanning huge mediums, microdirvers for examples | 538 | * Reason: scanning huge mediums, microdirvers for examples |
539 | * consomes time. To avoid that we invented the MediumMountCheck | 539 | * consomes time. To avoid that we invented the MediumMountCheck |
540 | * | 540 | * |
541 | * a) the user globally disabled medium checking. We can ignore | 541 | * a) the user globally disabled medium checking. We can ignore |
542 | * all removable medium | 542 | * all removable medium |
543 | * b) the user enabled medium checking globally and we need to use this mimefilter | 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 | 544 | * c) the user enabled medium checking on a per medium bases |
545 | * c1) we already checked and its not ask again turns | 545 | * c1) we already checked and its not ask again turns |
546 | * c2) we need to ask and then apply the mimefilter | 546 | * c2) we need to ask and then apply the mimefilter |
547 | */ | 547 | */ |
548 | void Launcher::loadDocs() // ok here comes a hack belonging to Global:: | 548 | void Launcher::loadDocs() // ok here comes a hack belonging to Global:: |
549 | { | 549 | { |
550 | delete docsFolder; | 550 | delete docsFolder; |
551 | docsFolder = new DocLnkSet; | 551 | docsFolder = new DocLnkSet; |
552 | 552 | ||
553 | DocLnkSet *tmp = 0; | 553 | DocLnkSet *tmp = 0; |
554 | QString home = QString(getenv("HOME")) + "/Documents"; | 554 | QString home = QString(getenv("HOME")) + "/Documents"; |
555 | tmp = new DocLnkSet( home , QString::null); | 555 | tmp = new DocLnkSet( home , QString::null); |
556 | docsFolder->appendFrom( *tmp ); | 556 | docsFolder->appendFrom( *tmp ); |
557 | delete tmp; | 557 | delete tmp; |
558 | 558 | ||
559 | // RAM documents | ||
560 | StorageInfo storage; | ||
561 | const QList<FileSystem> &fileSystems = storage.fileSystems(); | ||
562 | QListIterator<FileSystem> it ( fileSystems ); | ||
563 | |||
564 | for ( ; it.current(); ++it ) { | ||
565 | if ( (*it)->disk() == "/dev/mtdblock6" || (*it)->disk() == "tmpfs" ) { | ||
566 | tmp = new DocLnkSet( (*it)->path(), QString::null ); | ||
567 | docsFolder->appendFrom( *tmp ); | ||
568 | delete tmp; | ||
569 | } | ||
570 | } | ||
571 | |||
559 | Config mediumCfg( "medium"); | 572 | Config mediumCfg( "medium"); |
560 | mediumCfg.setGroup("main"); | 573 | mediumCfg.setGroup("main"); |
561 | // a) -zecke we don't want to check | 574 | // a) -zecke we don't want to check |
562 | if(!mediumCfg.readBoolEntry("use", true ) ) | 575 | if(!mediumCfg.readBoolEntry("use", true ) ) |
563 | return; | 576 | return; |
564 | 577 | ||
565 | // find out wich filesystems are new in this round | 578 | // find out wich filesystems are new in this round |
566 | // We will do this by having a timestamp inside each mountpoint | 579 | // We will do this by having a timestamp inside each mountpoint |
567 | // if the current timestamp doesn't match this is a new file system and | 580 | // if the current timestamp doesn't match this is a new file system and |
568 | // come up with our MediumMountGui :) let the hacking begin | 581 | // come up with our MediumMountGui :) let the hacking begin |
569 | int stamp = uidgen.generate(); | 582 | int stamp = uidgen.generate(); |
570 | 583 | ||
571 | QString newStamp = QString::number( stamp ); // generates newtime Stamp | 584 | QString newStamp = QString::number( stamp ); // generates newtime Stamp |
572 | StorageInfo storage; | ||
573 | const QList<FileSystem> &fileSystems = storage.fileSystems(); | ||
574 | QListIterator<FileSystem> it ( fileSystems ); | ||
575 | 585 | ||
576 | // b) | 586 | // b) |
577 | if( mediumCfg.readBoolEntry("global", true ) ){ | 587 | if( mediumCfg.readBoolEntry("global", true ) ){ |
578 | QString mime = configToMime(&mediumCfg).join(";"); | 588 | QString mime = configToMime(&mediumCfg).join(";"); |
579 | for( ; it.current(); ++it ){ | 589 | for( it.toFirst(); it.current(); ++it ){ |
580 | if( (*it)->isRemovable() ){ | 590 | if( (*it)->isRemovable() ){ |
581 | tmp = new DocLnkSet( (*it)->path(), mime ); | 591 | tmp = new DocLnkSet( (*it)->path(), mime ); |
582 | docsFolder->appendFrom( *tmp ); | 592 | docsFolder->appendFrom( *tmp ); |
583 | delete tmp; | 593 | delete tmp; |
584 | } | 594 | } |
585 | } // done | 595 | } // done |
586 | return; // save the else | 596 | return; // save the else |
587 | } | 597 | } |
588 | // c) zecke | 598 | // c) zecke |
589 | for ( ; it.current(); ++it ) { | 599 | for ( it.toFirst(); it.current(); ++it ) { |
590 | if ( (*it)->isRemovable() ) { // let's find out if we should search on it | 600 | if ( (*it)->isRemovable() ) { // let's find out if we should search on it |
591 | Config cfg( (*it)->path() + "/.opiestorage.cf", Config::File); | 601 | Config cfg( (*it)->path() + "/.opiestorage.cf", Config::File); |
592 | cfg.setGroup("main"); | 602 | cfg.setGroup("main"); |
593 | QString stamp = cfg.readEntry("timestamp", QDateTime::currentDateTime().toString() ); | 603 | QString stamp = cfg.readEntry("timestamp", QDateTime::currentDateTime().toString() ); |
594 | /** This medium is uptodate | 604 | /** This medium is uptodate |
595 | */ | 605 | */ |
596 | if( stamp == m_timeStamp ){ // ok we know this card | 606 | if( stamp == m_timeStamp ){ // ok we know this card |
597 | cfg.writeEntry("timestamp", newStamp ); //just write a new timestamp | 607 | cfg.writeEntry("timestamp", newStamp ); //just write a new timestamp |
598 | // we need to scan the list now. Hopefully the cache will be there | 608 | // we need to scan the list now. Hopefully the cache will be there |
599 | // read the mimetypes from the config and search for documents | 609 | // read the mimetypes from the config and search for documents |
600 | QStringList mimetypes = configToMime( &cfg); | 610 | QStringList mimetypes = configToMime( &cfg); |
601 | tmp = new DocLnkSet( (*it)->path(), mimetypes.join(";") ); | 611 | tmp = new DocLnkSet( (*it)->path(), mimetypes.join(";") ); |
602 | docsFolder->appendFrom( *tmp ); | 612 | docsFolder->appendFrom( *tmp ); |
603 | delete tmp; | 613 | delete tmp; |
604 | 614 | ||
605 | }else{ // come up with the gui cause this a new card | 615 | }else{ // come up with the gui cause this a new card |
606 | MediumMountGui medium(&cfg, (*it)->path() ); | 616 | MediumMountGui medium(&cfg, (*it)->path() ); |
607 | if( medium.check() ){ // we did not ask before or ask again is off | 617 | if( medium.check() ){ // we did not ask before or ask again is off |
608 | /** c2) */ | 618 | /** c2) */ |
609 | if( medium.exec() ){ // he clicked yes so search it | 619 | if( medium.exec() ){ // he clicked yes so search it |
610 | // speicher | 620 | // speicher |
611 | //cfg.read(); // cause of a race we need to reread - fixed | 621 | //cfg.read(); // cause of a race we need to reread - fixed |
612 | cfg.setGroup("main"); | 622 | cfg.setGroup("main"); |
613 | cfg.writeEntry("timestamp", newStamp ); | 623 | cfg.writeEntry("timestamp", newStamp ); |
614 | cfg.write(); | 624 | cfg.write(); |
615 | tmp = new DocLnkSet( (*it)->path(), medium.mimeTypes().join(";" ) ); | 625 | tmp = new DocLnkSet( (*it)->path(), medium.mimeTypes().join(";" ) ); |
616 | docsFolder->appendFrom( *tmp ); | 626 | docsFolder->appendFrom( *tmp ); |
617 | delete tmp; | 627 | delete tmp; |
618 | }// no else | 628 | }// no else |
619 | /** c1) */ | 629 | /** c1) */ |
620 | }else{ // we checked | 630 | }else{ // we checked |
621 | // do something different see what we need to do | 631 | // do something different see what we need to do |
@@ -798,74 +808,74 @@ void Launcher::systemMessage( const QCString &msg, const QByteArray &data) | |||
798 | } else if (modifier.compare("remove") == 0 ) { | 808 | } else if (modifier.compare("remove") == 0 ) { |
799 | // need to change for multiple entries | 809 | // need to change for multiple entries |
800 | // actually remove is right now simular to clear, but in future there | 810 | // actually remove is right now simular to clear, but in future there |
801 | // should be multiple apps in autostart possible. | 811 | // should be multiple apps in autostart possible. |
802 | QString checkName; | 812 | QString checkName; |
803 | checkName = cfg.readEntry("Apps", ""); | 813 | checkName = cfg.readEntry("Apps", ""); |
804 | if (checkName == appName) { | 814 | if (checkName == appName) { |
805 | cfg.writeEntry("Apps", ""); | 815 | cfg.writeEntry("Apps", ""); |
806 | } | 816 | } |
807 | } | 817 | } |
808 | // case the autostart feature should be delayed | 818 | // case the autostart feature should be delayed |
809 | } else if ( msg == "autoStart(QString,QString,QString)") { | 819 | } else if ( msg == "autoStart(QString,QString,QString)") { |
810 | QString modifier, appName, delay; | 820 | QString modifier, appName, delay; |
811 | stream >> modifier >> appName >> delay; | 821 | stream >> modifier >> appName >> delay; |
812 | Config cfg( "autostart" ); | 822 | Config cfg( "autostart" ); |
813 | cfg.setGroup( "AutoStart" ); | 823 | cfg.setGroup( "AutoStart" ); |
814 | if ( modifier.compare("add") == 0 ){ | 824 | if ( modifier.compare("add") == 0 ){ |
815 | // only add it appname is entered | 825 | // only add it appname is entered |
816 | if (!appName.isEmpty()) { | 826 | if (!appName.isEmpty()) { |
817 | cfg.writeEntry("Apps", appName); | 827 | cfg.writeEntry("Apps", appName); |
818 | cfg.writeEntry("Delay", delay); | 828 | cfg.writeEntry("Delay", delay); |
819 | } | 829 | } |
820 | } else { | 830 | } else { |
821 | } | 831 | } |
822 | } else if ( msg == "sendCardInfo()" ) { | 832 | } else if ( msg == "sendCardInfo()" ) { |
823 | QCopEnvelope e( "QPE/Desktop", "cardInfo(QString)" ); | 833 | QCopEnvelope e( "QPE/Desktop", "cardInfo(QString)" ); |
824 | const QList<FileSystem> &fs = storage->fileSystems(); | 834 | const QList<FileSystem> &fs = storage->fileSystems(); |
825 | QListIterator<FileSystem> it ( fs ); | 835 | QListIterator<FileSystem> it ( fs ); |
826 | QString s; | 836 | QString s; |
827 | QString homeDir = getenv("HOME"); | 837 | QString homeDir = getenv("HOME"); |
828 | QString hardDiskHome; | 838 | QString hardDiskHome; |
829 | for ( ; it.current(); ++it ) { | 839 | for ( ; it.current(); ++it ) { |
830 | if ( (*it)->isRemovable() ) | 840 | if ( (*it)->isRemovable() || (*it)->disk() == "/dev/mtdblock6" || (*it)->disk() == "tmpfs" ) |
831 | s += (*it)->name() + "=" + (*it)->path() + "/Documents " | 841 | s += (*it)->name() + "=" + (*it)->path() + "/Documents " |
832 | + QString::number( (*it)->availBlocks() * (*it)->blockSize() ) | 842 | + QString::number( (*it)->availBlocks() * (*it)->blockSize() ) |
833 | + " " + (*it)->options() + ";"; | 843 | + " " + (*it)->options() + ";"; |
834 | else if ( (*it)->disk() == "/dev/mtdblock1" || | 844 | else if ( (*it)->disk() == "/dev/mtdblock1" || |
835 | (*it)->disk() == "/dev/mtdblock/1" ) | 845 | (*it)->disk() == "/dev/mtdblock/1" ) |
836 | s += (*it)->name() + "=" + homeDir + "/Documents " | 846 | s += (*it)->name() + "=" + homeDir + "/Documents " |
837 | + QString::number( (*it)->availBlocks() * (*it)->blockSize() ) | 847 | + QString::number( (*it)->availBlocks() * (*it)->blockSize() ) |
838 | + " " + (*it)->options() + ";"; | 848 | + " " + (*it)->options() + ";"; |
839 | else if ( (*it)->name().contains( "Hard Disk") && | 849 | else if ( (*it)->name().contains( tr("Hard Disk") ) && |
840 | homeDir.contains( (*it)->path() ) && | 850 | homeDir.contains( (*it)->path() ) && |
841 | (*it)->path().length() > hardDiskHome.length() ) | 851 | (*it)->path().length() > hardDiskHome.length() ) |
842 | hardDiskHome = | 852 | hardDiskHome = |
843 | (*it)->name() + "=" + homeDir + "/Documents " | 853 | (*it)->name() + "=" + homeDir + "/Documents " |
844 | + QString::number( (*it)->availBlocks() * (*it)->blockSize() ) | 854 | + QString::number( (*it)->availBlocks() * (*it)->blockSize() ) |
845 | + " " + (*it)->options() + ";"; | 855 | + " " + (*it)->options() + ";"; |
846 | } | 856 | } |
847 | if ( !hardDiskHome.isEmpty() ) | 857 | if ( !hardDiskHome.isEmpty() ) |
848 | s += hardDiskHome; | 858 | s += hardDiskHome; |
849 | 859 | ||
850 | e << s; | 860 | e << s; |
851 | } else if ( msg == "sendSyncDate(QString)" ) { | 861 | } else if ( msg == "sendSyncDate(QString)" ) { |
852 | QString app; | 862 | QString app; |
853 | stream >> app; | 863 | stream >> app; |
854 | Config cfg( "qpe" ); | 864 | Config cfg( "qpe" ); |
855 | cfg.setGroup("SyncDate"); | 865 | cfg.setGroup("SyncDate"); |
856 | QCopEnvelope e( "QPE/Desktop", "syncDate(QString,QString)" ); | 866 | QCopEnvelope e( "QPE/Desktop", "syncDate(QString,QString)" ); |
857 | e << app << cfg.readEntry( app ); | 867 | e << app << cfg.readEntry( app ); |
858 | //qDebug("QPE/System sendSyncDate for %s: response %s", app.latin1(), | 868 | //qDebug("QPE/System sendSyncDate for %s: response %s", app.latin1(), |
859 | //cfg.readEntry( app ).latin1() ); | 869 | //cfg.readEntry( app ).latin1() ); |
860 | } else if ( msg == "setSyncDate(QString,QString)" ) { | 870 | } else if ( msg == "setSyncDate(QString,QString)" ) { |
861 | QString app, date; | 871 | QString app, date; |
862 | stream >> app >> date; | 872 | stream >> app >> date; |
863 | Config cfg( "qpe" ); | 873 | Config cfg( "qpe" ); |
864 | cfg.setGroup("SyncDate"); | 874 | cfg.setGroup("SyncDate"); |
865 | cfg.writeEntry( app, date ); | 875 | cfg.writeEntry( app, date ); |
866 | //qDebug("setSyncDate(QString,QString) %s %s", app.latin1(), date.latin1()); | 876 | //qDebug("setSyncDate(QString,QString) %s %s", app.latin1(), date.latin1()); |
867 | } else if ( msg == "startSync(QString)" ) { | 877 | } else if ( msg == "startSync(QString)" ) { |
868 | QString what; | 878 | QString what; |
869 | stream >> what; | 879 | stream >> what; |
870 | delete syncDialog; syncDialog = 0; | 880 | delete syncDialog; syncDialog = 0; |
871 | syncDialog = new SyncDialog( this, "syncProgress", FALSE, | 881 | syncDialog = new SyncDialog( this, "syncProgress", FALSE, |