author | llornkcor <llornkcor> | 2002-02-18 15:02:33 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2002-02-18 15:02:33 (UTC) |
commit | a6266fb220a61c4904e24ebf31eeefab34362e59 (patch) (side-by-side diff) | |
tree | ab1da9da25c4b5118935bc981fca62a8c72b6810 | |
parent | 00f89d28e669140eb50f1f220c389f88fba1105c (diff) | |
download | opie-a6266fb220a61c4904e24ebf31eeefab34362e59.zip opie-a6266fb220a61c4904e24ebf31eeefab34362e59.tar.gz opie-a6266fb220a61c4904e24ebf31eeefab34362e59.tar.bz2 |
added Save As (prompt user) and moved save (no prompt) functions there
-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 @@ -276,4 +276,8 @@ TextEdit::TextEdit( QWidget *parent, const char *name, WFlags f ) a->addTo( file ); + 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 ); connect( a, SIGNAL( activated() ), this, SLOT( editCut() ) ); @@ -415,5 +419,5 @@ TextEdit::TextEdit( QWidget *parent, const char *name, WFlags f ) TextEdit::~TextEdit() { - save(); + saveAs(); Config cfg("TextEdit"); @@ -487,5 +491,5 @@ void TextEdit::fileNew() { if( !bFromDocView ) { - save(); + saveAs(); } newFile(DocLnk()); @@ -681,4 +685,19 @@ void TextEdit::showEditTools() 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... if ( !doc || !bFromDocView) 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 @@ -62,4 +62,6 @@ private slots: void newFileOpen(); bool save(); + bool saveAs(); + void editCut(); |