summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/apps/textedit/textedit.cpp36
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() {
bool TextEdit::save() {
+ QString name, file;
odebug << "saveAsFile " + currentFileName << oendl;
@@ -782,7 +783,12 @@ bool TextEdit::save() {
}
-
- QString file = doc->file();
- odebug << "saver file "+file << oendl;
- QString name= doc->name();
- odebug << "File named "+name << oendl;
+ name = currentFileName;
+ if(doc) {
+ file = doc->file();
+ odebug << "saver file "+file << oendl;
+ name = doc->name();
+ odebug << "File named "+name << oendl;
+ } else {
+ name = file = currentFileName;
+ }
+
QString rt = editor->text();
@@ -792,3 +798,3 @@ bool TextEdit::save() {
} else {
- currentFileName= name ;
+ currentFileName = name;
odebug << "saveFile "+currentFileName << oendl;
@@ -804,3 +810,3 @@ bool TextEdit::save() {
if ( !fm.saveFile( *doc, rt ) ) {
- QMessageBox::message(tr("Text Edit"),tr("Save Failed"));
+ QMessageBox::message(tr("Text Edit"),tr("Save Failed"));
return false;
@@ -810,9 +816,9 @@ bool TextEdit::save() {
QFile f(file);
- if( f.open(IO_WriteOnly)) {
- QCString crt = rt.utf8();
- f.writeBlock(crt,crt.length());
- } else {
- QMessageBox::message(tr("Text Edit"),tr("Write Failed"));
- return false;
- }
+ if( f.open(IO_WriteOnly)) {
+ QCString crt = rt.utf8();
+ f.writeBlock(crt,crt.length());
+ } else {
+ QMessageBox::message(tr("Text Edit"),tr("Write Failed"));
+ return false;
+ }
@@ -823,3 +829,3 @@ bool TextEdit::save() {
if(caption().left(1)=="*")
- setCaption(caption().right(caption().length()-1));
+ setCaption(caption().right(caption().length()-1));