-rw-r--r-- | core/launcher/launcher.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/core/launcher/launcher.cpp b/core/launcher/launcher.cpp index 3eb561a..bcc2495 100644 --- a/core/launcher/launcher.cpp +++ b/core/launcher/launcher.cpp | |||
@@ -675,287 +675,287 @@ Launcher::~Launcher() | |||
675 | } | 675 | } |
676 | 676 | ||
677 | static bool isVisibleWindow(int wid) | 677 | static bool isVisibleWindow(int wid) |
678 | { | 678 | { |
679 | #ifdef QWS | 679 | #ifdef QWS |
680 | const QList<QWSWindow> &list = qwsServer->clientWindows(); | 680 | const QList<QWSWindow> &list = qwsServer->clientWindows(); |
681 | QWSWindow* w; | 681 | QWSWindow* w; |
682 | for (QListIterator<QWSWindow> it(list); (w=it.current()); ++it) { | 682 | for (QListIterator<QWSWindow> it(list); (w=it.current()); ++it) { |
683 | if ( w->winId() == wid ) | 683 | if ( w->winId() == wid ) |
684 | return !w->isFullyObscured(); | 684 | return !w->isFullyObscured(); |
685 | } | 685 | } |
686 | #endif | 686 | #endif |
687 | return FALSE; | 687 | return FALSE; |
688 | } | 688 | } |
689 | 689 | ||
690 | void Launcher::showMaximized() | 690 | void Launcher::showMaximized() |
691 | { | 691 | { |
692 | if ( isVisibleWindow( winId() ) ) | 692 | if ( isVisibleWindow( winId() ) ) |
693 | doMaximize(); | 693 | doMaximize(); |
694 | else | 694 | else |
695 | QTimer::singleShot( 20, this, SLOT(doMaximize()) ); | 695 | QTimer::singleShot( 20, this, SLOT(doMaximize()) ); |
696 | } | 696 | } |
697 | 697 | ||
698 | void Launcher::doMaximize() | 698 | void Launcher::doMaximize() |
699 | { | 699 | { |
700 | QMainWindow::showMaximized(); | 700 | QMainWindow::showMaximized(); |
701 | tabs->setMaximumWidth( qApp->desktop()->width() ); | 701 | tabs->setMaximumWidth( qApp->desktop()->width() ); |
702 | } | 702 | } |
703 | 703 | ||
704 | void Launcher::updateMimeTypes() | 704 | void Launcher::updateMimeTypes() |
705 | { | 705 | { |
706 | MimeType::clear(); | 706 | MimeType::clear(); |
707 | updateMimeTypes(rootFolder); | 707 | updateMimeTypes(rootFolder); |
708 | } | 708 | } |
709 | 709 | ||
710 | void Launcher::updateMimeTypes(AppLnkSet* folder) | 710 | void Launcher::updateMimeTypes(AppLnkSet* folder) |
711 | { | 711 | { |
712 | for ( QListIterator<AppLnk> it( folder->children() ); it.current(); ++it ) { | 712 | for ( QListIterator<AppLnk> it( folder->children() ); it.current(); ++it ) { |
713 | AppLnk *app = it.current(); | 713 | AppLnk *app = it.current(); |
714 | if ( app->type() == "Folder" ) // No tr | 714 | if ( app->type() == "Folder" ) // No tr |
715 | updateMimeTypes((AppLnkSet *)app); | 715 | updateMimeTypes((AppLnkSet *)app); |
716 | else { | 716 | else { |
717 | MimeType::registerApp(*app); | 717 | MimeType::registerApp(*app); |
718 | } | 718 | } |
719 | } | 719 | } |
720 | } | 720 | } |
721 | 721 | ||
722 | /** This is a HACK.... | 722 | /** This is a HACK.... |
723 | * Reason: scanning huge mediums, microdirvers for examples | 723 | * Reason: scanning huge mediums, microdirvers for examples |
724 | * consomes time. To avoid that we invented the MediumMountCheck | 724 | * consomes time. To avoid that we invented the MediumMountCheck |
725 | * | 725 | * |
726 | * a) the user globally disabled medium checking. We can ignore | 726 | * a) the user globally disabled medium checking. We can ignore |
727 | * all removable medium | 727 | * all removable medium |
728 | * 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 |
729 | * c) the user enabled medium checking on a per medium bases | 729 | * c) the user enabled medium checking on a per medium bases |
730 | * c1) we already checked and its not ask again turns | 730 | * c1) we already checked and its not ask again turns |
731 | * c2) we need to ask and then apply the mimefilter | 731 | * c2) we need to ask and then apply the mimefilter |
732 | */ | 732 | */ |
733 | void Launcher::loadDocs() // ok here comes a hack belonging to Global:: | 733 | void Launcher::loadDocs() // ok here comes a hack belonging to Global:: |
734 | { | 734 | { |
735 | 735 | ||
736 | OWait *owait = new OWait(); | 736 | OWait *owait = new OWait(); |
737 | Global::statusMessage( tr( "Finding documents" ) ); | 737 | Global::statusMessage( tr( "Finding documents" ) ); |
738 | 738 | ||
739 | owait->show(); | 739 | owait->show(); |
740 | qApp->processEvents(); | 740 | qApp->processEvents(); |
741 | 741 | ||
742 | delete docsFolder; | 742 | delete docsFolder; |
743 | docsFolder = new DocLnkSet; | 743 | docsFolder = new DocLnkSet; |
744 | 744 | ||
745 | DocLnkSet *tmp = 0; | 745 | DocLnkSet *tmp = 0; |
746 | QString home = QString(getenv("HOME")) + "/Documents"; | 746 | QString home = QString(getenv("HOME")) + "/Documents"; |
747 | tmp = new DocLnkSet( home , QString::null); | 747 | tmp = new DocLnkSet( home , QString::null); |
748 | docsFolder->appendFrom( *tmp ); | 748 | docsFolder->appendFrom( *tmp ); |
749 | delete tmp; | 749 | delete tmp; |
750 | 750 | ||
751 | // RAM documents | 751 | // RAM documents |
752 | StorageInfo storage; | 752 | StorageInfo storage; |
753 | const QList<FileSystem> &fileSystems = storage.fileSystems(); | 753 | const QList<FileSystem> &fileSystems = storage.fileSystems(); |
754 | QListIterator<FileSystem> it ( fileSystems ); | 754 | QListIterator<FileSystem> it ( fileSystems ); |
755 | 755 | ||
756 | for ( ; it.current(); ++it ) { | 756 | for ( ; it.current(); ++it ) { |
757 | if ( (*it)->disk() == "/dev/mtdblock6" || (*it)->disk() == "tmpfs" ) { | 757 | if ( (*it)->disk() == "/dev/mtdblock6" || (*it)->disk() == "tmpfs" ) { |
758 | tmp = new DocLnkSet( (*it)->path(), QString::null ); | 758 | tmp = new DocLnkSet( (*it)->path(), QString::null ); |
759 | docsFolder->appendFrom( *tmp ); | 759 | docsFolder->appendFrom( *tmp ); |
760 | delete tmp; | 760 | delete tmp; |
761 | } | 761 | } |
762 | } | 762 | } |
763 | 763 | ||
764 | Config mediumCfg( "medium"); | 764 | Config mediumCfg( "medium"); |
765 | mediumCfg.setGroup("main"); | 765 | mediumCfg.setGroup("main"); |
766 | // a) -zecke we don't want to check | 766 | // a) -zecke we don't want to check |
767 | if(!mediumCfg.readBoolEntry("use", true ) ) | 767 | if(!mediumCfg.readBoolEntry("use", true ) ) |
768 | return; | 768 | return; |
769 | 769 | ||
770 | // find out wich filesystems are new in this round | 770 | // find out wich filesystems are new in this round |
771 | // We will do this by having a timestamp inside each mountpoint | 771 | // We will do this by having a timestamp inside each mountpoint |
772 | // if the current timestamp doesn't match this is a new file system and | 772 | // if the current timestamp doesn't match this is a new file system and |
773 | // come up with our MediumMountGui :) let the hacking begin | 773 | // come up with our MediumMountGui :) let the hacking begin |
774 | int stamp = uidgen.generate(); | 774 | int stamp = uidgen.generate(); |
775 | 775 | ||
776 | QString newStamp = QString::number( stamp ); // generates newtime Stamp | 776 | QString newStamp = QString::number( stamp ); // generates newtime Stamp |
777 | 777 | ||
778 | // b) | 778 | // b) |
779 | if( mediumCfg.readBoolEntry("global", true ) ){ | 779 | if( mediumCfg.readBoolEntry("global", true ) ){ |
780 | QString mime = configToMime(&mediumCfg).join(";"); | 780 | QString mime = configToMime(&mediumCfg).join(";"); |
781 | for( it.toFirst(); it.current(); ++it ){ | 781 | for( it.toFirst(); it.current(); ++it ){ |
782 | if( (*it)->isRemovable() ){ | 782 | if( (*it)->isRemovable() ){ |
783 | tmp = new DocLnkSet( (*it)->path(), mime ); | 783 | tmp = new DocLnkSet( (*it)->path(), mime ); |
784 | docsFolder->appendFrom( *tmp ); | 784 | docsFolder->appendFrom( *tmp ); |
785 | delete tmp; | 785 | delete tmp; |
786 | } | 786 | } |
787 | } // done | 787 | } // done |
788 | return; // save the else | 788 | return; // save the else |
789 | } | 789 | } |
790 | // c) zecke | 790 | // c) zecke |
791 | for ( it.toFirst(); it.current(); ++it ) { | 791 | for ( it.toFirst(); it.current(); ++it ) { |
792 | if ( (*it)->isRemovable() ) { // let's find out if we should search on it | 792 | if ( (*it)->isRemovable() ) { // let's find out if we should search on it |
793 | Config cfg( (*it)->path() + "/.opiestorage.cf", Config::File); | 793 | Config cfg( (*it)->path() + "/.opiestorage.cf", Config::File); |
794 | cfg.setGroup("main"); | 794 | cfg.setGroup("main"); |
795 | QString stamp = cfg.readEntry("timestamp", QDateTime::currentDateTime().toString() ); | 795 | QString stamp = cfg.readEntry("timestamp", QDateTime::currentDateTime().toString() ); |
796 | /** This medium is uptodate | 796 | /** This medium is uptodate |
797 | */ | 797 | */ |
798 | if( stamp == m_timeStamp ){ // ok we know this card | 798 | if( stamp == m_timeStamp ){ // ok we know this card |
799 | cfg.writeEntry("timestamp", newStamp ); //just write a new timestamp | 799 | cfg.writeEntry("timestamp", newStamp ); //just write a new timestamp |
800 | // 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 |
801 | // read the mimetypes from the config and search for documents | 801 | // read the mimetypes from the config and search for documents |
802 | QStringList mimetypes = configToMime( &cfg); | 802 | QStringList mimetypes = configToMime( &cfg); |
803 | qApp->processEvents(); | 803 | //qApp->processEvents(); |
804 | Global::statusMessage( tr( "Searching documents" ) ); | 804 | Global::statusMessage( tr( "Searching documents" ) ); |
805 | tmp = new DocLnkSet( (*it)->path(), mimetypes.join(";") ); | 805 | tmp = new DocLnkSet( (*it)->path(), mimetypes.join(";") ); |
806 | docsFolder->appendFrom( *tmp ); | 806 | docsFolder->appendFrom( *tmp ); |
807 | delete tmp; | 807 | delete tmp; |
808 | 808 | ||
809 | }else{ // come up with the gui cause this a new card | 809 | }else{ // come up with the gui cause this a new card |
810 | MediumMountGui medium(&cfg, (*it)->path() ); | 810 | MediumMountGui medium(&cfg, (*it)->path() ); |
811 | 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 |
812 | /** c2) */ | 812 | /** c2) */ |
813 | if( medium.exec() ){ // he clicked yes so search it | 813 | if( medium.exec() ){ // he clicked yes so search it |
814 | // speicher | 814 | // speicher |
815 | //cfg.read(); // cause of a race we need to reread - fixed | 815 | //cfg.read(); // cause of a race we need to reread - fixed |
816 | cfg.setGroup("main"); | 816 | cfg.setGroup("main"); |
817 | cfg.writeEntry("timestamp", newStamp ); | 817 | cfg.writeEntry("timestamp", newStamp ); |
818 | cfg.write(); | 818 | cfg.write(); |
819 | 819 | ||
820 | qApp->processEvents(); | 820 | //qApp->processEvents(); |
821 | tmp = new DocLnkSet( (*it)->path(), medium.mimeTypes().join(";" ) ); | 821 | tmp = new DocLnkSet( (*it)->path(), medium.mimeTypes().join(";" ) ); |
822 | docsFolder->appendFrom( *tmp ); | 822 | docsFolder->appendFrom( *tmp ); |
823 | delete tmp; | 823 | delete tmp; |
824 | }// no else | 824 | }// no else |
825 | /** c1) */ | 825 | /** c1) */ |
826 | }else{ // we checked | 826 | }else{ // we checked |
827 | // do something different see what we need to do | 827 | // do something different see what we need to do |
828 | // let's see if we should check the device | 828 | // let's see if we should check the device |
829 | cfg.setGroup("main" ); | 829 | cfg.setGroup("main" ); |
830 | bool check = cfg.readBoolEntry("autocheck", true ); | 830 | bool check = cfg.readBoolEntry("autocheck", true ); |
831 | if( check ){ // find the documents | 831 | if( check ){ // find the documents |
832 | 832 | ||
833 | qApp->processEvents(); | 833 | //qApp->processEvents(); |
834 | Global::statusMessage( tr( "Searching documents" ) ); | 834 | Global::statusMessage( tr( "Searching documents" ) ); |
835 | tmp = new DocLnkSet( (*it)->path(), configToMime(&cfg ).join(";") ); | 835 | tmp = new DocLnkSet( (*it)->path(), configToMime(&cfg ).join(";") ); |
836 | docsFolder->appendFrom( *tmp ); | 836 | docsFolder->appendFrom( *tmp ); |
837 | delete tmp; | 837 | delete tmp; |
838 | } | 838 | } |
839 | } | 839 | } |
840 | } | 840 | } |
841 | } | 841 | } |
842 | } | 842 | } |
843 | m_timeStamp = newStamp; | 843 | m_timeStamp = newStamp; |
844 | owait->hide(); | 844 | owait->hide(); |
845 | delete owait; | 845 | delete owait; |
846 | } | 846 | } |
847 | 847 | ||
848 | void Launcher::updateTabs() | 848 | void Launcher::updateTabs() |
849 | { | 849 | { |
850 | MimeType::updateApplications(); // ### reads all applnks twice | 850 | MimeType::updateApplications(); // ### reads all applnks twice |
851 | 851 | ||
852 | delete rootFolder; | 852 | delete rootFolder; |
853 | rootFolder = new AppLnkSet( MimeType::appsFolderName() ); | 853 | rootFolder = new AppLnkSet( MimeType::appsFolderName() ); |
854 | 854 | ||
855 | loadDocs(); | 855 | loadDocs(); |
856 | 856 | ||
857 | tabs->initializeCategories(rootFolder, docsFolder, storage->fileSystems()); | 857 | tabs->initializeCategories(rootFolder, docsFolder, storage->fileSystems()); |
858 | } | 858 | } |
859 | 859 | ||
860 | void Launcher::updateDocs() | 860 | void Launcher::updateDocs() |
861 | { | 861 | { |
862 | loadDocs(); | 862 | loadDocs(); |
863 | tabs->updateDocs(docsFolder,storage->fileSystems()); | 863 | tabs->updateDocs(docsFolder,storage->fileSystems()); |
864 | } | 864 | } |
865 | 865 | ||
866 | void Launcher::viewSelected(const QString& s) | 866 | void Launcher::viewSelected(const QString& s) |
867 | { | 867 | { |
868 | setCaption( s + tr(" - Launcher") ); | 868 | setCaption( s + tr(" - Launcher") ); |
869 | } | 869 | } |
870 | 870 | ||
871 | void Launcher::nextView() | 871 | void Launcher::nextView() |
872 | { | 872 | { |
873 | tabs->nextTab(); | 873 | tabs->nextTab(); |
874 | } | 874 | } |
875 | 875 | ||
876 | void Launcher::showTab(const QString& id) | 876 | void Launcher::showTab(const QString& id) |
877 | { | 877 | { |
878 | tabs->showTab(id); | 878 | tabs->showTab(id); |
879 | raise(); | 879 | raise(); |
880 | } | 880 | } |
881 | 881 | ||
882 | void Launcher::select( const AppLnk *appLnk ) | 882 | void Launcher::select( const AppLnk *appLnk ) |
883 | { | 883 | { |
884 | if ( appLnk->type() == "Folder" ) { // No tr | 884 | if ( appLnk->type() == "Folder" ) { // No tr |
885 | // Not supported: flat is simpler for the user | 885 | // Not supported: flat is simpler for the user |
886 | } else { | 886 | } else { |
887 | if ( appLnk->exec().isNull() ) { | 887 | if ( appLnk->exec().isNull() ) { |
888 | QMessageBox::information(this,tr("No application"), | 888 | QMessageBox::information(this,tr("No application"), |
889 | tr("<p>No application is defined for this document." | 889 | tr("<p>No application is defined for this document." |
890 | "<p>Type is %1.").arg(appLnk->type())); | 890 | "<p>Type is %1.").arg(appLnk->type())); |
891 | return; | 891 | return; |
892 | } | 892 | } |
893 | tabs->setBusy(TRUE); | 893 | tabs->setBusy(TRUE); |
894 | emit executing( appLnk ); | 894 | emit executing( appLnk ); |
895 | appLnk->execute(); | 895 | appLnk->execute(); |
896 | } | 896 | } |
897 | } | 897 | } |
898 | 898 | ||
899 | void Launcher::externalSelected(const AppLnk *appLnk) | 899 | void Launcher::externalSelected(const AppLnk *appLnk) |
900 | { | 900 | { |
901 | tabs->setBusy(TRUE); | 901 | tabs->setBusy(TRUE); |
902 | emit executing( appLnk ); | 902 | emit executing( appLnk ); |
903 | } | 903 | } |
904 | 904 | ||
905 | void Launcher::properties( AppLnk *appLnk ) | 905 | void Launcher::properties( AppLnk *appLnk ) |
906 | { | 906 | { |
907 | if ( appLnk->type() == "Folder" ) { // No tr | 907 | if ( appLnk->type() == "Folder" ) { // No tr |
908 | // Not supported: flat is simpler for the user | 908 | // Not supported: flat is simpler for the user |
909 | } else { | 909 | } else { |
910 | in_lnk_props = TRUE; | 910 | in_lnk_props = TRUE; |
911 | got_lnk_change = FALSE; | 911 | got_lnk_change = FALSE; |
912 | LnkProperties prop(appLnk); | 912 | LnkProperties prop(appLnk); |
913 | connect(&prop, SIGNAL(select(const AppLnk *)), this, SLOT(externalSelected(const AppLnk *))); | 913 | connect(&prop, SIGNAL(select(const AppLnk *)), this, SLOT(externalSelected(const AppLnk *))); |
914 | prop.showMaximized(); | 914 | prop.showMaximized(); |
915 | prop.exec(); | 915 | prop.exec(); |
916 | in_lnk_props = FALSE; | 916 | in_lnk_props = FALSE; |
917 | if ( got_lnk_change ) { | 917 | if ( got_lnk_change ) { |
918 | updateLink(lnk_change); | 918 | updateLink(lnk_change); |
919 | } | 919 | } |
920 | } | 920 | } |
921 | } | 921 | } |
922 | 922 | ||
923 | void Launcher::updateLink(const QString& link) | 923 | void Launcher::updateLink(const QString& link) |
924 | { | 924 | { |
925 | bool notify_sm = false; | 925 | bool notify_sm = false; |
926 | 926 | ||
927 | if (link.isNull()) { | 927 | if (link.isNull()) { |
928 | updateTabs(); | 928 | updateTabs(); |
929 | notify_sm = true; | 929 | notify_sm = true; |
930 | } | 930 | } |
931 | else if (link.isEmpty()) { | 931 | else if (link.isEmpty()) { |
932 | updateDocs(); | 932 | updateDocs(); |
933 | } | 933 | } |
934 | else { | 934 | else { |
935 | tabs->updateLink(link); | 935 | tabs->updateLink(link); |
936 | notify_sm = true; | 936 | notify_sm = true; |
937 | } | 937 | } |
938 | 938 | ||
939 | if ( notify_sm ) | 939 | if ( notify_sm ) |
940 | QCopEnvelope e ( "QPE/TaskBar", "reloadApps()" ); | 940 | QCopEnvelope e ( "QPE/TaskBar", "reloadApps()" ); |
941 | } | 941 | } |
942 | 942 | ||
943 | void Launcher::systemMessage( const QCString &msg, const QByteArray &data) | 943 | void Launcher::systemMessage( const QCString &msg, const QByteArray &data) |
944 | { | 944 | { |
945 | QDataStream stream( data, IO_ReadOnly ); | 945 | QDataStream stream( data, IO_ReadOnly ); |
946 | if ( msg == "linkChanged(QString)" ) { | 946 | if ( msg == "linkChanged(QString)" ) { |
947 | QString link; | 947 | QString link; |
948 | stream >> link; | 948 | stream >> link; |
949 | if ( in_lnk_props ) { | 949 | if ( in_lnk_props ) { |
950 | got_lnk_change = TRUE; | 950 | got_lnk_change = TRUE; |
951 | lnk_change = link; | 951 | lnk_change = link; |
952 | } else { | 952 | } else { |
953 | updateLink(link); | 953 | updateLink(link); |
954 | } | 954 | } |
955 | } else if ( msg == "busy()" ) { | 955 | } else if ( msg == "busy()" ) { |
956 | emit busy(); | 956 | emit busy(); |
957 | } else if ( msg == "notBusy(QString)" ) { | 957 | } else if ( msg == "notBusy(QString)" ) { |
958 | QString app; | 958 | QString app; |
959 | stream >> app; | 959 | stream >> app; |
960 | tabs->setBusy(FALSE); | 960 | tabs->setBusy(FALSE); |
961 | emit notBusy(app); | 961 | emit notBusy(app); |