-rw-r--r-- | core/apps/textedit/textedit.cpp | 23 | ||||
-rw-r--r-- | core/apps/textedit/textedit.h | 2 |
2 files changed, 23 insertions, 2 deletions
diff --git a/core/apps/textedit/textedit.cpp b/core/apps/textedit/textedit.cpp index 429c195..834971a 100644 --- a/core/apps/textedit/textedit.cpp +++ b/core/apps/textedit/textedit.cpp @@ -277,2 +277,6 @@ TextEdit::TextEdit( QWidget *parent, const char *name, WFlags f ) + a = new QAction( tr( "Save As" ), QPixmap(( const char** ) filesave_xpm ) , QString::null, 0, this, 0 ); + connect( a, SIGNAL( activated() ), this, SLOT( saveAs() ) ); + a->addTo( file ); + a = new QAction( tr( "Cut" ), Resource::loadPixmap( "cut" ), QString::null, 0, this, 0 ); @@ -416,3 +420,3 @@ TextEdit::~TextEdit() { - save(); + saveAs(); @@ -488,3 +492,3 @@ void TextEdit::fileNew() if( !bFromDocView ) { - save(); + saveAs(); } @@ -682,2 +686,17 @@ bool TextEdit::save() { + QString rt = editor->text(); + doc->setName( currentFileName); + FileManager fm; + if ( !fm.saveFile( *doc, rt ) ) { + return false; + } + delete doc; + doc = 0; + editor->setEdited( false ); + return true; + +} + +bool TextEdit::saveAs() +{ // case of nothing to save... diff --git a/core/apps/textedit/textedit.h b/core/apps/textedit/textedit.h index 4bfb260..f9eb241 100644 --- a/core/apps/textedit/textedit.h +++ b/core/apps/textedit/textedit.h @@ -63,2 +63,4 @@ private slots: bool save(); + bool saveAs(); + |