summaryrefslogtreecommitdiff
authorllornkcor <llornkcor>2004-09-18 09:14:31 (UTC)
committer llornkcor <llornkcor>2004-09-18 09:14:31 (UTC)
commitf0e025a8e64f96390377c0aa66e8b5602494d7d0 (patch) (side-by-side diff)
tree3c812aec7e4bec59cea71f2e16cd1f77230a79fd
parenteaf09b9b6e1abbe36e814a8e4da315ac8d96bd63 (diff)
downloadopie-f0e025a8e64f96390377c0aa66e8b5602494d7d0.zip
opie-f0e025a8e64f96390377c0aa66e8b5602494d7d0.tar.gz
opie-f0e025a8e64f96390377c0aa66e8b5602494d7d0.tar.bz2
fix #1399
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
@@ -776,4 +776,5 @@ void TextEdit::showEditTools() {
unprompted save */
bool TextEdit::save() {
+ QString name, file;
odebug << "saveAsFile " + currentFileName << oendl;
if(currentFileName.isEmpty()) {
@@ -781,9 +782,14 @@ bool TextEdit::save() {
return false;
}
-
- 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();
if( !rt.isEmpty() ) {
@@ -791,5 +797,5 @@ bool TextEdit::save() {
saveAs();
} else {
- currentFileName= name ;
+ currentFileName = name;
odebug << "saveFile "+currentFileName << oendl;
@@ -803,5 +809,5 @@ bool TextEdit::save() {
FileManager fm;
if ( !fm.saveFile( *doc, rt ) ) {
- QMessageBox::message(tr("Text Edit"),tr("Save Failed"));
+ QMessageBox::message(tr("Text Edit"),tr("Save Failed"));
return false;
}
@@ -809,11 +815,11 @@ bool TextEdit::save() {
odebug << "regular save file" << oendl;
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;
+ }
}
@@ -822,5 +828,5 @@ bool TextEdit::save() {
edited=false;
if(caption().left(1)=="*")
- setCaption(caption().right(caption().length()-1));
+ setCaption(caption().right(caption().length()-1));