-rw-r--r-- | core/apps/textedit/textedit.cpp | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/core/apps/textedit/textedit.cpp b/core/apps/textedit/textedit.cpp index 1d0df6a..571df27 100644 --- a/core/apps/textedit/textedit.cpp +++ b/core/apps/textedit/textedit.cpp | |||
@@ -908,96 +908,97 @@ bool TextEdit::saveAs() { | |||
908 | } else | 908 | } else |
909 | str=currentFileName; | 909 | str=currentFileName; |
910 | 910 | ||
911 | if(!str.isEmpty()) { | 911 | if(!str.isEmpty()) { |
912 | QString fileNm=str; | 912 | QString fileNm=str; |
913 | 913 | ||
914 | odebug << "saving filename "+fileNm << oendl; | 914 | odebug << "saving filename "+fileNm << oendl; |
915 | QFileInfo fi(fileNm); | 915 | QFileInfo fi(fileNm); |
916 | currentFileName=fi.fileName(); | 916 | currentFileName=fi.fileName(); |
917 | if(doc) | 917 | if(doc) |
918 | // QString file = doc->file(); | 918 | // QString file = doc->file(); |
919 | // doc->removeFiles(); | 919 | // doc->removeFiles(); |
920 | delete doc; | 920 | delete doc; |
921 | DocLnk nf; | 921 | DocLnk nf; |
922 | nf.setType("text/plain"); | 922 | nf.setType("text/plain"); |
923 | nf.setFile( fileNm); | 923 | nf.setFile( fileNm); |
924 | doc = new DocLnk(nf); | 924 | doc = new DocLnk(nf); |
925 | // editor->setText(rt); | 925 | // editor->setText(rt); |
926 | odebug << "Saving file as "+currentFileName << oendl; | 926 | odebug << "Saving file as "+currentFileName << oendl; |
927 | doc->setName( currentFileName); | 927 | doc->setName( currentFileName); |
928 | updateCaption( currentFileName); | 928 | updateCaption( currentFileName); |
929 | 929 | ||
930 | FileManager fm; | 930 | FileManager fm; |
931 | if ( !fm.saveFile( *doc, rt ) ) { | 931 | if ( !fm.saveFile( *doc, rt ) ) { |
932 | QMessageBox::message(tr("Text Edit"),tr("Save Failed")); | 932 | QMessageBox::message(tr("Text Edit"),tr("Save Failed")); |
933 | return false; | 933 | return false; |
934 | } | 934 | } |
935 | 935 | ||
936 | if( filePerms ) { | 936 | if( filePerms ) { |
937 | filePermissions *filePerm; | 937 | filePermissions *filePerm; |
938 | filePerm = new filePermissions(this, | 938 | filePerm = new filePermissions(this, |
939 | tr("Permissions"),true, | 939 | tr("Permissions"),true, |
940 | 0,(const QString &)fileNm); | 940 | 0,(const QString &)fileNm); |
941 | QPEApplication::execDialog( filePerm ); | 941 | QPEApplication::execDialog( filePerm ); |
942 | 942 | ||
943 | if( filePerm) | 943 | if( filePerm) |
944 | delete filePerm; | 944 | delete filePerm; |
945 | } | 945 | } |
946 | // } | 946 | // } |
947 | editor->setEdited( false); | 947 | editor->setEdited( false); |
948 | edited1 = false; | 948 | edited1 = false; |
949 | edited = false; | 949 | edited = false; |
950 | if(caption().left(1)=="*") | 950 | if(caption().left(1)=="*") |
951 | setCaption(caption().right(caption().length()-1)); | 951 | setCaption(caption().right(caption().length()-1)); |
952 | 952 | ||
953 | return true; | 953 | return true; |
954 | } | 954 | } |
955 | odebug << "returning false" << oendl; | 955 | odebug << "returning false" << oendl; |
956 | currentFileName = ""; | ||
956 | return false; | 957 | return false; |
957 | } //end saveAs | 958 | } //end saveAs |
958 | 959 | ||
959 | void TextEdit::clear() { | 960 | void TextEdit::clear() { |
960 | delete doc; | 961 | delete doc; |
961 | doc = 0; | 962 | doc = 0; |
962 | editor->clear(); | 963 | editor->clear(); |
963 | } | 964 | } |
964 | 965 | ||
965 | void TextEdit::updateCaption( const QString &name ) { | 966 | void TextEdit::updateCaption( const QString &name ) { |
966 | 967 | ||
967 | if ( name.isEmpty() ) | 968 | if ( name.isEmpty() ) |
968 | setCaption( tr("Text Editor") ); | 969 | setCaption( tr("Text Editor") ); |
969 | else { | 970 | else { |
970 | QString s = name; | 971 | QString s = name; |
971 | if ( s.isNull() ) | 972 | if ( s.isNull() ) |
972 | s = doc->name(); | 973 | s = doc->name(); |
973 | if ( s.isEmpty() ) { | 974 | if ( s.isEmpty() ) { |
974 | s = tr( "Unnamed" ); | 975 | s = tr( "Unnamed" ); |
975 | currentFileName=s; | 976 | currentFileName=s; |
976 | } | 977 | } |
977 | // if(s.left(1) == "/") | 978 | // if(s.left(1) == "/") |
978 | // s = s.right(s.length()-1); | 979 | // s = s.right(s.length()-1); |
979 | setCaption( tr("%1 - Text Editor").arg( s ) ); | 980 | setCaption( tr("%1 - Text Editor").arg( s ) ); |
980 | } | 981 | } |
981 | } | 982 | } |
982 | 983 | ||
983 | void TextEdit::setDocument(const QString& fileref) { | 984 | void TextEdit::setDocument(const QString& fileref) { |
984 | if(fileref != "Unnamed") { | 985 | if(fileref != "Unnamed") { |
985 | currentFileName=fileref; | 986 | currentFileName=fileref; |
986 | odebug << "setDocument" << oendl; | 987 | odebug << "setDocument" << oendl; |
987 | QFileInfo fi(currentFileName); | 988 | QFileInfo fi(currentFileName); |
988 | odebug << "basename:"+fi.baseName()+": current filenmame "+currentFileName << oendl; | 989 | odebug << "basename:"+fi.baseName()+": current filenmame "+currentFileName << oendl; |
989 | if( (fi.baseName().left(1)).isEmpty() ) { | 990 | if( (fi.baseName().left(1)).isEmpty() ) { |
990 | openDotFile(currentFileName); | 991 | openDotFile(currentFileName); |
991 | 992 | ||
992 | } else { | 993 | } else { |
993 | odebug << "setDoc open" << oendl; | 994 | odebug << "setDoc open" << oendl; |
994 | bFromDocView = true; | 995 | bFromDocView = true; |
995 | openFile(fileref); | 996 | openFile(fileref); |
996 | editor->setEdited(true); | 997 | editor->setEdited(true); |
997 | edited1=false; | 998 | edited1=false; |
998 | edited=true; | 999 | edited=true; |
999 | // fromSetDocument=false; | 1000 | // fromSetDocument=false; |
1000 | // doSearchBar(); | 1001 | // doSearchBar(); |
1001 | } | 1002 | } |
1002 | } | 1003 | } |
1003 | updateCaption( currentFileName); | 1004 | updateCaption( currentFileName); |