-rw-r--r-- | core/launcher/launcher.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/core/launcher/launcher.cpp b/core/launcher/launcher.cpp index 59b38e3..e9e17f7 100644 --- a/core/launcher/launcher.cpp +++ b/core/launcher/launcher.cpp | |||
@@ -713,193 +713,193 @@ void Launcher::updateLink(const QString& link) | |||
713 | else | 713 | else |
714 | tabs->updateLink(link); | 714 | tabs->updateLink(link); |
715 | } | 715 | } |
716 | 716 | ||
717 | void Launcher::systemMessage( const QCString &msg, const QByteArray &data) | 717 | void Launcher::systemMessage( const QCString &msg, const QByteArray &data) |
718 | { | 718 | { |
719 | QDataStream stream( data, IO_ReadOnly ); | 719 | QDataStream stream( data, IO_ReadOnly ); |
720 | if ( msg == "closing(QString)" ){ | 720 | if ( msg == "closing(QString)" ){ |
721 | QString app; | 721 | QString app; |
722 | stream >> app; | 722 | stream >> app; |
723 | qWarning("app closed %s", app.latin1() ); | 723 | qWarning("app closed %s", app.latin1() ); |
724 | MRUList::removeTask( app ); | 724 | MRUList::removeTask( app ); |
725 | }else if ( msg == "linkChanged(QString)" ) { | 725 | }else if ( msg == "linkChanged(QString)" ) { |
726 | QString link; | 726 | QString link; |
727 | stream >> link; | 727 | stream >> link; |
728 | if ( in_lnk_props ) { | 728 | if ( in_lnk_props ) { |
729 | got_lnk_change = TRUE; | 729 | got_lnk_change = TRUE; |
730 | lnk_change = link; | 730 | lnk_change = link; |
731 | } else { | 731 | } else { |
732 | updateLink(link); | 732 | updateLink(link); |
733 | } | 733 | } |
734 | } else if ( msg == "busy()" ) { | 734 | } else if ( msg == "busy()" ) { |
735 | emit busy(); | 735 | emit busy(); |
736 | } else if ( msg == "notBusy(QString)" ) { | 736 | } else if ( msg == "notBusy(QString)" ) { |
737 | QString app; | 737 | QString app; |
738 | stream >> app; | 738 | stream >> app; |
739 | tabs->setBusy(FALSE); | 739 | tabs->setBusy(FALSE); |
740 | emit notBusy(app); | 740 | emit notBusy(app); |
741 | } else if ( msg == "mkdir(QString)" ) { | 741 | } else if ( msg == "mkdir(QString)" ) { |
742 | QString dir; | 742 | QString dir; |
743 | stream >> dir; | 743 | stream >> dir; |
744 | if ( !dir.isEmpty() ) | 744 | if ( !dir.isEmpty() ) |
745 | mkdir( dir ); | 745 | mkdir( dir ); |
746 | } else if ( msg == "rdiffGenSig(QString,QString)" ) { | 746 | } else if ( msg == "rdiffGenSig(QString,QString)" ) { |
747 | QString baseFile, sigFile; | 747 | QString baseFile, sigFile; |
748 | stream >> baseFile >> sigFile; | 748 | stream >> baseFile >> sigFile; |
749 | QRsync::generateSignature( baseFile, sigFile ); | 749 | QRsync::generateSignature( baseFile, sigFile ); |
750 | } else if ( msg == "rdiffGenDiff(QString,QString,QString)" ) { | 750 | } else if ( msg == "rdiffGenDiff(QString,QString,QString)" ) { |
751 | QString baseFile, sigFile, deltaFile; | 751 | QString baseFile, sigFile, deltaFile; |
752 | stream >> baseFile >> sigFile >> deltaFile; | 752 | stream >> baseFile >> sigFile >> deltaFile; |
753 | QRsync::generateDiff( baseFile, sigFile, deltaFile ); | 753 | QRsync::generateDiff( baseFile, sigFile, deltaFile ); |
754 | } else if ( msg == "rdiffApplyPatch(QString,QString)" ) { | 754 | } else if ( msg == "rdiffApplyPatch(QString,QString)" ) { |
755 | QString baseFile, deltaFile; | 755 | QString baseFile, deltaFile; |
756 | stream >> baseFile >> deltaFile; | 756 | stream >> baseFile >> deltaFile; |
757 | if ( !QFile::exists( baseFile ) ) { | 757 | if ( !QFile::exists( baseFile ) ) { |
758 | QFile f( baseFile ); | 758 | QFile f( baseFile ); |
759 | f.open( IO_WriteOnly ); | 759 | f.open( IO_WriteOnly ); |
760 | f.close(); | 760 | f.close(); |
761 | } | 761 | } |
762 | QRsync::applyDiff( baseFile, deltaFile ); | 762 | QRsync::applyDiff( baseFile, deltaFile ); |
763 | QCopEnvelope e( "QPE/Desktop", "patchApplied(QString)" ); | 763 | QCopEnvelope e( "QPE/Desktop", "patchApplied(QString)" ); |
764 | e << baseFile; | 764 | e << baseFile; |
765 | } else if ( msg == "rdiffCleanup()" ) { | 765 | } else if ( msg == "rdiffCleanup()" ) { |
766 | mkdir( "/tmp/rdiff" ); | 766 | mkdir( "/tmp/rdiff" ); |
767 | QDir dir; | 767 | QDir dir; |
768 | dir.setPath( "/tmp/rdiff" ); | 768 | dir.setPath( "/tmp/rdiff" ); |
769 | QStringList entries = dir.entryList(); | 769 | QStringList entries = dir.entryList(); |
770 | for ( QStringList::Iterator it = entries.begin(); it != entries.end(); ++it ) | 770 | for ( QStringList::Iterator it = entries.begin(); it != entries.end(); ++it ) |
771 | dir.remove( *it ); | 771 | dir.remove( *it ); |
772 | } else if ( msg == "sendHandshakeInfo()" ) { | 772 | } else if ( msg == "sendHandshakeInfo()" ) { |
773 | QString home = getenv( "HOME" ); | 773 | QString home = getenv( "HOME" ); |
774 | QCopEnvelope e( "QPE/Desktop", "handshakeInfo(QString,bool)" ); | 774 | QCopEnvelope e( "QPE/Desktop", "handshakeInfo(QString,bool)" ); |
775 | e << home; | 775 | e << home; |
776 | int locked = (int) Desktop::screenLocked(); | 776 | int locked = (int) Desktop::screenLocked(); |
777 | e << locked; | 777 | e << locked; |
778 | // register an app for autostart | 778 | // register an app for autostart |
779 | // if clear is send the list is cleared. | 779 | // if clear is send the list is cleared. |
780 | } else if ( msg == "autoStart(QString)" ) { | 780 | } else if ( msg == "autoStart(QString)" ) { |
781 | QString appName; | 781 | QString appName; |
782 | stream >> appName; | 782 | stream >> appName; |
783 | Config cfg( "autostart" ); | 783 | Config cfg( "autostart" ); |
784 | cfg.setGroup( "AutoStart" ); | 784 | cfg.setGroup( "AutoStart" ); |
785 | if ( appName.compare("clear") == 0){ | 785 | if ( appName.compare("clear") == 0){ |
786 | cfg.writeEntry("Apps", ""); | 786 | cfg.writeEntry("Apps", ""); |
787 | } | 787 | } |
788 | } else if ( msg == "autoStart(QString,QString)" ) { | 788 | } else if ( msg == "autoStart(QString,QString)" ) { |
789 | QString modifier, appName; | 789 | QString modifier, appName; |
790 | stream >> modifier >> appName; | 790 | stream >> modifier >> appName; |
791 | Config cfg( "autostart" ); | 791 | Config cfg( "autostart" ); |
792 | cfg.setGroup( "AutoStart" ); | 792 | cfg.setGroup( "AutoStart" ); |
793 | if ( modifier.compare("add") == 0 ){ | 793 | if ( modifier.compare("add") == 0 ){ |
794 | // only add if appname is entered | 794 | // only add if appname is entered |
795 | if (!appName.isEmpty()) { | 795 | if (!appName.isEmpty()) { |
796 | cfg.writeEntry("Apps", appName); | 796 | cfg.writeEntry("Apps", appName); |
797 | } | 797 | } |
798 | } else if (modifier.compare("remove") == 0 ) { | 798 | } else if (modifier.compare("remove") == 0 ) { |
799 | // need to change for multiple entries | 799 | // need to change for multiple entries |
800 | // actually remove is right now simular to clear, but in future there | 800 | // actually remove is right now simular to clear, but in future there |
801 | // should be multiple apps in autostart possible. | 801 | // should be multiple apps in autostart possible. |
802 | QString checkName; | 802 | QString checkName; |
803 | checkName = cfg.readEntry("Apps", ""); | 803 | checkName = cfg.readEntry("Apps", ""); |
804 | if (checkName == appName) { | 804 | if (checkName == appName) { |
805 | cfg.writeEntry("Apps", ""); | 805 | cfg.writeEntry("Apps", ""); |
806 | } | 806 | } |
807 | } | 807 | } |
808 | // case the autostart feature should be delayed | 808 | // case the autostart feature should be delayed |
809 | } else if ( msg == "autoStart(QString, QString, QString)") { | 809 | } else if ( msg == "autoStart(QString,QString,QString)") { |
810 | QString modifier, appName, delay; | 810 | QString modifier, appName, delay; |
811 | stream >> modifier >> appName >> delay; | 811 | stream >> modifier >> appName >> delay; |
812 | Config cfg( "autostart" ); | 812 | Config cfg( "autostart" ); |
813 | cfg.setGroup( "AutoStart" ); | 813 | cfg.setGroup( "AutoStart" ); |
814 | if ( modifier.compare("add") == 0 ){ | 814 | if ( modifier.compare("add") == 0 ){ |
815 | // only add it appname is entered | 815 | // only add it appname is entered |
816 | if (!appName.isEmpty()) { | 816 | if (!appName.isEmpty()) { |
817 | cfg.writeEntry("Apps", appName); | 817 | cfg.writeEntry("Apps", appName); |
818 | cfg.writeEntry("Delay", delay); | 818 | cfg.writeEntry("Delay", delay); |
819 | } | 819 | } |
820 | } else { | 820 | } else { |
821 | } | 821 | } |
822 | } else if ( msg == "sendCardInfo()" ) { | 822 | } else if ( msg == "sendCardInfo()" ) { |
823 | QCopEnvelope e( "QPE/Desktop", "cardInfo(QString)" ); | 823 | QCopEnvelope e( "QPE/Desktop", "cardInfo(QString)" ); |
824 | const QList<FileSystem> &fs = storage->fileSystems(); | 824 | const QList<FileSystem> &fs = storage->fileSystems(); |
825 | QListIterator<FileSystem> it ( fs ); | 825 | QListIterator<FileSystem> it ( fs ); |
826 | QString s; | 826 | QString s; |
827 | QString homeDir = getenv("HOME"); | 827 | QString homeDir = getenv("HOME"); |
828 | QString hardDiskHome; | 828 | QString hardDiskHome; |
829 | for ( ; it.current(); ++it ) { | 829 | for ( ; it.current(); ++it ) { |
830 | if ( (*it)->isRemovable() ) | 830 | if ( (*it)->isRemovable() ) |
831 | s += (*it)->name() + "=" + (*it)->path() + "/Documents " | 831 | s += (*it)->name() + "=" + (*it)->path() + "/Documents " |
832 | + QString::number( (*it)->availBlocks() * (*it)->blockSize() ) | 832 | + QString::number( (*it)->availBlocks() * (*it)->blockSize() ) |
833 | + " " + (*it)->options() + ";"; | 833 | + " " + (*it)->options() + ";"; |
834 | else if ( (*it)->disk() == "/dev/mtdblock1" || | 834 | else if ( (*it)->disk() == "/dev/mtdblock1" || |
835 | (*it)->disk() == "/dev/mtdblock/1" ) | 835 | (*it)->disk() == "/dev/mtdblock/1" ) |
836 | s += (*it)->name() + "=" + homeDir + "/Documents " | 836 | s += (*it)->name() + "=" + homeDir + "/Documents " |
837 | + QString::number( (*it)->availBlocks() * (*it)->blockSize() ) | 837 | + QString::number( (*it)->availBlocks() * (*it)->blockSize() ) |
838 | + " " + (*it)->options() + ";"; | 838 | + " " + (*it)->options() + ";"; |
839 | else if ( (*it)->name().contains( "Hard Disk") && | 839 | else if ( (*it)->name().contains( "Hard Disk") && |
840 | homeDir.contains( (*it)->path() ) && | 840 | homeDir.contains( (*it)->path() ) && |
841 | (*it)->path().length() > hardDiskHome.length() ) | 841 | (*it)->path().length() > hardDiskHome.length() ) |
842 | hardDiskHome = | 842 | hardDiskHome = |
843 | (*it)->name() + "=" + homeDir + "/Documents " | 843 | (*it)->name() + "=" + homeDir + "/Documents " |
844 | + QString::number( (*it)->availBlocks() * (*it)->blockSize() ) | 844 | + QString::number( (*it)->availBlocks() * (*it)->blockSize() ) |
845 | + " " + (*it)->options() + ";"; | 845 | + " " + (*it)->options() + ";"; |
846 | } | 846 | } |
847 | if ( !hardDiskHome.isEmpty() ) | 847 | if ( !hardDiskHome.isEmpty() ) |
848 | s += hardDiskHome; | 848 | s += hardDiskHome; |
849 | 849 | ||
850 | e << s; | 850 | e << s; |
851 | } else if ( msg == "sendSyncDate(QString)" ) { | 851 | } else if ( msg == "sendSyncDate(QString)" ) { |
852 | QString app; | 852 | QString app; |
853 | stream >> app; | 853 | stream >> app; |
854 | Config cfg( "qpe" ); | 854 | Config cfg( "qpe" ); |
855 | cfg.setGroup("SyncDate"); | 855 | cfg.setGroup("SyncDate"); |
856 | QCopEnvelope e( "QPE/Desktop", "syncDate(QString,QString)" ); | 856 | QCopEnvelope e( "QPE/Desktop", "syncDate(QString,QString)" ); |
857 | e << app << cfg.readEntry( app ); | 857 | e << app << cfg.readEntry( app ); |
858 | //qDebug("QPE/System sendSyncDate for %s: response %s", app.latin1(), | 858 | //qDebug("QPE/System sendSyncDate for %s: response %s", app.latin1(), |
859 | //cfg.readEntry( app ).latin1() ); | 859 | //cfg.readEntry( app ).latin1() ); |
860 | } else if ( msg == "setSyncDate(QString,QString)" ) { | 860 | } else if ( msg == "setSyncDate(QString,QString)" ) { |
861 | QString app, date; | 861 | QString app, date; |
862 | stream >> app >> date; | 862 | stream >> app >> date; |
863 | Config cfg( "qpe" ); | 863 | Config cfg( "qpe" ); |
864 | cfg.setGroup("SyncDate"); | 864 | cfg.setGroup("SyncDate"); |
865 | cfg.writeEntry( app, date ); | 865 | cfg.writeEntry( app, date ); |
866 | //qDebug("setSyncDate(QString,QString) %s %s", app.latin1(), date.latin1()); | 866 | //qDebug("setSyncDate(QString,QString) %s %s", app.latin1(), date.latin1()); |
867 | } else if ( msg == "startSync(QString)" ) { | 867 | } else if ( msg == "startSync(QString)" ) { |
868 | QString what; | 868 | QString what; |
869 | stream >> what; | 869 | stream >> what; |
870 | delete syncDialog; syncDialog = 0; | 870 | delete syncDialog; syncDialog = 0; |
871 | syncDialog = new SyncDialog( this, "syncProgress", FALSE, | 871 | syncDialog = new SyncDialog( this, "syncProgress", FALSE, |
872 | WStyle_Tool | WStyle_Customize | | 872 | WStyle_Tool | WStyle_Customize | |
873 | Qt::WStyle_StaysOnTop ); | 873 | Qt::WStyle_StaysOnTop ); |
874 | syncDialog->showMaximized(); | 874 | syncDialog->showMaximized(); |
875 | syncDialog->whatLabel->setText( "<b>" + what + "</b>" ); | 875 | syncDialog->whatLabel->setText( "<b>" + what + "</b>" ); |
876 | connect( syncDialog->buttonCancel, SIGNAL( clicked() ), | 876 | connect( syncDialog->buttonCancel, SIGNAL( clicked() ), |
877 | SLOT( cancelSync() ) ); | 877 | SLOT( cancelSync() ) ); |
878 | } else if ( msg == "stopSync()") { | 878 | } else if ( msg == "stopSync()") { |
879 | delete syncDialog; syncDialog = 0; | 879 | delete syncDialog; syncDialog = 0; |
880 | } else if ( msg == "getAllDocLinks()" ) { | 880 | } else if ( msg == "getAllDocLinks()" ) { |
881 | loadDocs(); | 881 | loadDocs(); |
882 | 882 | ||
883 | QString contents; | 883 | QString contents; |
884 | 884 | ||
885 | for ( QListIterator<DocLnk> it( docsFolder->children() ); it.current(); ++it ) { | 885 | for ( QListIterator<DocLnk> it( docsFolder->children() ); it.current(); ++it ) { |
886 | DocLnk *doc = it.current(); | 886 | DocLnk *doc = it.current(); |
887 | QFileInfo fi( doc->file() ); | 887 | QFileInfo fi( doc->file() ); |
888 | if ( !fi.exists() ) | 888 | if ( !fi.exists() ) |
889 | continue; | 889 | continue; |
890 | 890 | ||
891 | bool fake = !doc->linkFileKnown(); | 891 | bool fake = !doc->linkFileKnown(); |
892 | if ( !fake ) { | 892 | if ( !fake ) { |
893 | QFile f( doc->linkFile() ); | 893 | QFile f( doc->linkFile() ); |
894 | if ( f.open( IO_ReadOnly ) ) { | 894 | if ( f.open( IO_ReadOnly ) ) { |
895 | QTextStream ts( &f ); | 895 | QTextStream ts( &f ); |
896 | ts.setEncoding( QTextStream::UnicodeUTF8 ); | 896 | ts.setEncoding( QTextStream::UnicodeUTF8 ); |
897 | contents += ts.read(); | 897 | contents += ts.read(); |
898 | f.close(); | 898 | f.close(); |
899 | } else | 899 | } else |
900 | fake = TRUE; | 900 | fake = TRUE; |
901 | } | 901 | } |
902 | if (fake) { | 902 | if (fake) { |
903 | contents += "[Desktop Entry]\n"; | 903 | contents += "[Desktop Entry]\n"; |
904 | contents += "Categories = " + Qtopia::Record::idsToString( doc->categories() ) + "\n"; | 904 | contents += "Categories = " + Qtopia::Record::idsToString( doc->categories() ) + "\n"; |
905 | contents += "File = "+doc->file()+"\n"; | 905 | contents += "File = "+doc->file()+"\n"; |