summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/launcher/launcher.cpp16
1 files changed, 13 insertions, 3 deletions
diff --git a/core/launcher/launcher.cpp b/core/launcher/launcher.cpp
index 6764338..fc944e1 100644
--- a/core/launcher/launcher.cpp
+++ b/core/launcher/launcher.cpp
@@ -783,198 +783,208 @@ void Launcher::loadDocs() // ok here comes a hack belonging to Global::
783 cfg.writeEntry("timestamp", newStamp ); 783 cfg.writeEntry("timestamp", newStamp );
784 cfg.write(); 784 cfg.write();
785 tmp = new DocLnkSet( (*it)->path(), medium.mimeTypes().join(";" ) ); 785 tmp = new DocLnkSet( (*it)->path(), medium.mimeTypes().join(";" ) );
786 docsFolder->appendFrom( *tmp ); 786 docsFolder->appendFrom( *tmp );
787 delete tmp; 787 delete tmp;
788 }// no else 788 }// no else
789 /** c1) */ 789 /** c1) */
790 }else{ // we checked 790 }else{ // we checked
791 // do something different see what we need to do 791 // do something different see what we need to do
792 // let's see if we should check the device 792 // let's see if we should check the device
793 cfg.setGroup("main" ); 793 cfg.setGroup("main" );
794 bool check = cfg.readBoolEntry("autocheck", true ); 794 bool check = cfg.readBoolEntry("autocheck", true );
795 if( check ){ // find the documents 795 if( check ){ // find the documents
796 tmp = new DocLnkSet( (*it)->path(), configToMime(&cfg ).join(";") ); 796 tmp = new DocLnkSet( (*it)->path(), configToMime(&cfg ).join(";") );
797 docsFolder->appendFrom( *tmp ); 797 docsFolder->appendFrom( *tmp );
798 delete tmp; 798 delete tmp;
799 } 799 }
800 } 800 }
801 } 801 }
802 } 802 }
803 } 803 }
804 m_timeStamp = newStamp; 804 m_timeStamp = newStamp;
805} 805}
806 806
807void Launcher::updateTabs() 807void Launcher::updateTabs()
808{ 808{
809 MimeType::updateApplications(); // ### reads all applnks twice 809 MimeType::updateApplications(); // ### reads all applnks twice
810 810
811 delete rootFolder; 811 delete rootFolder;
812 rootFolder = new AppLnkSet( MimeType::appsFolderName() ); 812 rootFolder = new AppLnkSet( MimeType::appsFolderName() );
813 813
814 loadDocs(); 814 loadDocs();
815 815
816 tabs->initializeCategories(rootFolder, docsFolder, storage->fileSystems()); 816 tabs->initializeCategories(rootFolder, docsFolder, storage->fileSystems());
817} 817}
818 818
819void Launcher::updateDocs() 819void Launcher::updateDocs()
820{ 820{
821 loadDocs(); 821 loadDocs();
822 tabs->updateDocs(docsFolder,storage->fileSystems()); 822 tabs->updateDocs(docsFolder,storage->fileSystems());
823} 823}
824 824
825void Launcher::viewSelected(const QString& s) 825void Launcher::viewSelected(const QString& s)
826{ 826{
827 setCaption( s + tr(" - Launcher") ); 827 setCaption( s + tr(" - Launcher") );
828} 828}
829 829
830void Launcher::nextView() 830void Launcher::nextView()
831{ 831{
832 tabs->nextTab(); 832 tabs->nextTab();
833} 833}
834 834
835 835
836void Launcher::select( const AppLnk *appLnk ) 836void Launcher::select( const AppLnk *appLnk )
837{ 837{
838 if ( appLnk->type() == "Folder" ) { // No tr 838 if ( appLnk->type() == "Folder" ) { // No tr
839 // Not supported: flat is simpler for the user 839 // Not supported: flat is simpler for the user
840 } else { 840 } else {
841 if ( appLnk->exec().isNull() ) { 841 if ( appLnk->exec().isNull() ) {
842 QMessageBox::information(this,tr("No application"), 842 QMessageBox::information(this,tr("No application"),
843 tr("<p>No application is defined for this document." 843 tr("<p>No application is defined for this document."
844 "<p>Type is %1.").arg(appLnk->type())); 844 "<p>Type is %1.").arg(appLnk->type()));
845 return; 845 return;
846 } 846 }
847 tabs->setBusy(TRUE); 847 tabs->setBusy(TRUE);
848 emit executing( appLnk ); 848 emit executing( appLnk );
849 appLnk->execute(); 849 appLnk->execute();
850 } 850 }
851} 851}
852 852
853void Launcher::externalSelected(const AppLnk *appLnk) 853void Launcher::externalSelected(const AppLnk *appLnk)
854{ 854{
855 tabs->setBusy(TRUE); 855 tabs->setBusy(TRUE);
856 emit executing( appLnk ); 856 emit executing( appLnk );
857} 857}
858 858
859void Launcher::properties( AppLnk *appLnk ) 859void Launcher::properties( AppLnk *appLnk )
860{ 860{
861 if ( appLnk->type() == "Folder" ) { // No tr 861 if ( appLnk->type() == "Folder" ) { // No tr
862 // Not supported: flat is simpler for the user 862 // Not supported: flat is simpler for the user
863 } else { 863 } else {
864 in_lnk_props = TRUE; 864 in_lnk_props = TRUE;
865 got_lnk_change = FALSE; 865 got_lnk_change = FALSE;
866 LnkProperties prop(appLnk); 866 LnkProperties prop(appLnk);
867 connect(&prop, SIGNAL(select(const AppLnk *)), this, SLOT(externalSelected(const AppLnk *))); 867 connect(&prop, SIGNAL(select(const AppLnk *)), this, SLOT(externalSelected(const AppLnk *)));
868 prop.showMaximized(); 868 prop.showMaximized();
869 prop.exec(); 869 prop.exec();
870 in_lnk_props = FALSE; 870 in_lnk_props = FALSE;
871 if ( got_lnk_change ) { 871 if ( got_lnk_change ) {
872 updateLink(lnk_change); 872 updateLink(lnk_change);
873 } 873 }
874 } 874 }
875} 875}
876 876
877void Launcher::updateLink(const QString& link) 877void Launcher::updateLink(const QString& link)
878{ 878{
879 if (link.isNull()) 879 bool notify_sm = false;
880
881 if (link.isNull()) {
880 updateTabs(); 882 updateTabs();
881 else if (link.isEmpty()) 883 notify_sm = true;
884 }
885 else if (link.isEmpty()) {
882 updateDocs(); 886 updateDocs();
883 else 887 }
888 else {
884 tabs->updateLink(link); 889 tabs->updateLink(link);
890 notify_sm = true;
891 }
892
893 if ( notify_sm )
894 QCopEnvelope e ( "QPE/TaskBar", "reloadApps()" );
885} 895}
886 896
887void Launcher::systemMessage( const QCString &msg, const QByteArray &data) 897void Launcher::systemMessage( const QCString &msg, const QByteArray &data)
888{ 898{
889 QDataStream stream( data, IO_ReadOnly ); 899 QDataStream stream( data, IO_ReadOnly );
890 if ( msg == "linkChanged(QString)" ) { 900 if ( msg == "linkChanged(QString)" ) {
891 QString link; 901 QString link;
892 stream >> link; 902 stream >> link;
893 if ( in_lnk_props ) { 903 if ( in_lnk_props ) {
894 got_lnk_change = TRUE; 904 got_lnk_change = TRUE;
895 lnk_change = link; 905 lnk_change = link;
896 } else { 906 } else {
897 updateLink(link); 907 updateLink(link);
898 } 908 }
899 } else if ( msg == "busy()" ) { 909 } else if ( msg == "busy()" ) {
900 emit busy(); 910 emit busy();
901 } else if ( msg == "notBusy(QString)" ) { 911 } else if ( msg == "notBusy(QString)" ) {
902 QString app; 912 QString app;
903 stream >> app; 913 stream >> app;
904 tabs->setBusy(FALSE); 914 tabs->setBusy(FALSE);
905 emit notBusy(app); 915 emit notBusy(app);
906 } else if ( msg == "mkdir(QString)" ) { 916 } else if ( msg == "mkdir(QString)" ) {
907 QString dir; 917 QString dir;
908 stream >> dir; 918 stream >> dir;
909 if ( !dir.isEmpty() ) 919 if ( !dir.isEmpty() )
910 mkdir( dir ); 920 mkdir( dir );
911 } else if ( msg == "rdiffGenSig(QString,QString)" ) { 921 } else if ( msg == "rdiffGenSig(QString,QString)" ) {
912 QString baseFile, sigFile; 922 QString baseFile, sigFile;
913 stream >> baseFile >> sigFile; 923 stream >> baseFile >> sigFile;
914 QRsync::generateSignature( baseFile, sigFile ); 924 QRsync::generateSignature( baseFile, sigFile );
915 } else if ( msg == "rdiffGenDiff(QString,QString,QString)" ) { 925 } else if ( msg == "rdiffGenDiff(QString,QString,QString)" ) {
916 QString baseFile, sigFile, deltaFile; 926 QString baseFile, sigFile, deltaFile;
917 stream >> baseFile >> sigFile >> deltaFile; 927 stream >> baseFile >> sigFile >> deltaFile;
918 QRsync::generateDiff( baseFile, sigFile, deltaFile ); 928 QRsync::generateDiff( baseFile, sigFile, deltaFile );
919 } else if ( msg == "rdiffApplyPatch(QString,QString)" ) { 929 } else if ( msg == "rdiffApplyPatch(QString,QString)" ) {
920 QString baseFile, deltaFile; 930 QString baseFile, deltaFile;
921 stream >> baseFile >> deltaFile; 931 stream >> baseFile >> deltaFile;
922 if ( !QFile::exists( baseFile ) ) { 932 if ( !QFile::exists( baseFile ) ) {
923 QFile f( baseFile ); 933 QFile f( baseFile );
924 f.open( IO_WriteOnly ); 934 f.open( IO_WriteOnly );
925 f.close(); 935 f.close();
926 } 936 }
927 QRsync::applyDiff( baseFile, deltaFile ); 937 QRsync::applyDiff( baseFile, deltaFile );
928#ifndef QT_NO_COP 938#ifndef QT_NO_COP
929 QCopEnvelope e( "QPE/Desktop", "patchApplied(QString)" ); 939 QCopEnvelope e( "QPE/Desktop", "patchApplied(QString)" );
930 e << baseFile; 940 e << baseFile;
931#endif 941#endif
932 } else if ( msg == "rdiffCleanup()" ) { 942 } else if ( msg == "rdiffCleanup()" ) {
933 mkdir( "/tmp/rdiff" ); 943 mkdir( "/tmp/rdiff" );
934 QDir dir; 944 QDir dir;
935 dir.setPath( "/tmp/rdiff" ); 945 dir.setPath( "/tmp/rdiff" );
936 QStringList entries = dir.entryList(); 946 QStringList entries = dir.entryList();
937 for ( QStringList::Iterator it = entries.begin(); it != entries.end(); ++it ) 947 for ( QStringList::Iterator it = entries.begin(); it != entries.end(); ++it )
938 dir.remove( *it ); 948 dir.remove( *it );
939 } else if ( msg == "sendHandshakeInfo()" ) { 949 } else if ( msg == "sendHandshakeInfo()" ) {
940 QString home = getenv( "HOME" ); 950 QString home = getenv( "HOME" );
941#ifndef QT_NO_COP 951#ifndef QT_NO_COP
942 QCopEnvelope e( "QPE/Desktop", "handshakeInfo(QString,bool)" ); 952 QCopEnvelope e( "QPE/Desktop", "handshakeInfo(QString,bool)" );
943 e << home; 953 e << home;
944 int locked = (int) Desktop::screenLocked(); 954 int locked = (int) Desktop::screenLocked();
945 e << locked; 955 e << locked;
946#endif 956#endif
947 } else if ( msg == "autoStart(QString)" ) { 957 } else if ( msg == "autoStart(QString)" ) {
948 QString appName; 958 QString appName;
949 stream >> appName; 959 stream >> appName;
950 Config cfg( "autostart" ); 960 Config cfg( "autostart" );
951 cfg.setGroup( "AutoStart" ); 961 cfg.setGroup( "AutoStart" );
952 if ( appName.compare("clear") == 0){ 962 if ( appName.compare("clear") == 0){
953 cfg.writeEntry("Apps", ""); 963 cfg.writeEntry("Apps", "");
954 } 964 }
955 } else if ( msg == "autoStart(QString,QString)" ) { 965 } else if ( msg == "autoStart(QString,QString)" ) {
956 QString modifier, appName; 966 QString modifier, appName;
957 stream >> modifier >> appName; 967 stream >> modifier >> appName;
958 Config cfg( "autostart" ); 968 Config cfg( "autostart" );
959 cfg.setGroup( "AutoStart" ); 969 cfg.setGroup( "AutoStart" );
960 if ( modifier.compare("add") == 0 ){ 970 if ( modifier.compare("add") == 0 ){
961 // only add if appname is entered 971 // only add if appname is entered
962 if (!appName.isEmpty()) { 972 if (!appName.isEmpty()) {
963 cfg.writeEntry("Apps", appName); 973 cfg.writeEntry("Apps", appName);
964 } 974 }
965 } else if (modifier.compare("remove") == 0 ) { 975 } else if (modifier.compare("remove") == 0 ) {
966 // need to change for multiple entries 976 // need to change for multiple entries
967 // actually remove is right now simular to clear, but in future there 977 // actually remove is right now simular to clear, but in future there
968 // should be multiple apps in autostart possible. 978 // should be multiple apps in autostart possible.
969 QString checkName; 979 QString checkName;
970 checkName = cfg.readEntry("Apps", ""); 980 checkName = cfg.readEntry("Apps", "");
971 if (checkName == appName) { 981 if (checkName == appName) {
972 cfg.writeEntry("Apps", ""); 982 cfg.writeEntry("Apps", "");
973 } 983 }
974 } 984 }
975 // case the autostart feature should be delayed 985 // case the autostart feature should be delayed
976 } else if ( msg == "autoStart(QString,QString,QString)") { 986 } else if ( msg == "autoStart(QString,QString,QString)") {
977 QString modifier, appName, delay; 987 QString modifier, appName, delay;
978 stream >> modifier >> appName >> delay; 988 stream >> modifier >> appName >> delay;
979 Config cfg( "autostart" ); 989 Config cfg( "autostart" );
980 cfg.setGroup( "AutoStart" ); 990 cfg.setGroup( "AutoStart" );