author | llornkcor <llornkcor> | 2004-09-18 09:14:31 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2004-09-18 09:14:31 (UTC) |
commit | f0e025a8e64f96390377c0aa66e8b5602494d7d0 (patch) (unidiff) | |
tree | 3c812aec7e4bec59cea71f2e16cd1f77230a79fd | |
parent | eaf09b9b6e1abbe36e814a8e4da315ac8d96bd63 (diff) | |
download | opie-f0e025a8e64f96390377c0aa66e8b5602494d7d0.zip opie-f0e025a8e64f96390377c0aa66e8b5602494d7d0.tar.gz opie-f0e025a8e64f96390377c0aa66e8b5602494d7d0.tar.bz2 |
fix #1399
-rw-r--r-- | core/apps/textedit/textedit.cpp | 36 |
1 files changed, 21 insertions, 15 deletions
diff --git a/core/apps/textedit/textedit.cpp b/core/apps/textedit/textedit.cpp index 086fdb6..1d0df6a 100644 --- a/core/apps/textedit/textedit.cpp +++ b/core/apps/textedit/textedit.cpp | |||
@@ -777,2 +777,3 @@ void TextEdit::showEditTools() { | |||
777 | bool TextEdit::save() { | 777 | bool TextEdit::save() { |
778 | QString name, file; | ||
778 | odebug << "saveAsFile " + currentFileName << oendl; | 779 | odebug << "saveAsFile " + currentFileName << oendl; |
@@ -782,7 +783,12 @@ bool TextEdit::save() { | |||
782 | } | 783 | } |
783 | 784 | name = currentFileName; | |
784 | QString file = doc->file(); | 785 | if(doc) { |
785 | odebug << "saver file "+file << oendl; | 786 | file = doc->file(); |
786 | QString name= doc->name(); | 787 | odebug << "saver file "+file << oendl; |
787 | odebug << "File named "+name << oendl; | 788 | name = doc->name(); |
789 | odebug << "File named "+name << oendl; | ||
790 | } else { | ||
791 | name = file = currentFileName; | ||
792 | } | ||
793 | |||
788 | QString rt = editor->text(); | 794 | QString rt = editor->text(); |
@@ -792,3 +798,3 @@ bool TextEdit::save() { | |||
792 | } else { | 798 | } else { |
793 | currentFileName= name ; | 799 | currentFileName = name; |
794 | odebug << "saveFile "+currentFileName << oendl; | 800 | odebug << "saveFile "+currentFileName << oendl; |
@@ -804,3 +810,3 @@ bool TextEdit::save() { | |||
804 | if ( !fm.saveFile( *doc, rt ) ) { | 810 | if ( !fm.saveFile( *doc, rt ) ) { |
805 | QMessageBox::message(tr("Text Edit"),tr("Save Failed")); | 811 | QMessageBox::message(tr("Text Edit"),tr("Save Failed")); |
806 | return false; | 812 | return false; |
@@ -810,9 +816,9 @@ bool TextEdit::save() { | |||
810 | QFile f(file); | 816 | QFile f(file); |
811 | if( f.open(IO_WriteOnly)) { | 817 | if( f.open(IO_WriteOnly)) { |
812 | QCString crt = rt.utf8(); | 818 | QCString crt = rt.utf8(); |
813 | f.writeBlock(crt,crt.length()); | 819 | f.writeBlock(crt,crt.length()); |
814 | } else { | 820 | } else { |
815 | QMessageBox::message(tr("Text Edit"),tr("Write Failed")); | 821 | QMessageBox::message(tr("Text Edit"),tr("Write Failed")); |
816 | return false; | 822 | return false; |
817 | } | 823 | } |
818 | 824 | ||
@@ -823,3 +829,3 @@ bool TextEdit::save() { | |||
823 | if(caption().left(1)=="*") | 829 | if(caption().left(1)=="*") |
824 | setCaption(caption().right(caption().length()-1)); | 830 | setCaption(caption().right(caption().length()-1)); |
825 | 831 | ||