From a6266fb220a61c4904e24ebf31eeefab34362e59 Mon Sep 17 00:00:00 2001 From: llornkcor Date: Mon, 18 Feb 2002 15:02:33 +0000 Subject: added Save As (prompt user) and moved save (no prompt) functions there --- (limited to 'core') 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 @@ -275,6 +275,10 @@ TextEdit::TextEdit( QWidget *parent, const char *name, WFlags f ) file->insertSeparator(); 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() ) ); a->addTo( editBar ); @@ -414,7 +418,7 @@ TextEdit::TextEdit( QWidget *parent, const char *name, WFlags f ) TextEdit::~TextEdit() { - save(); + saveAs(); Config cfg("TextEdit"); cfg.setGroup("View"); @@ -486,7 +490,7 @@ void TextEdit::setWordWrap(bool y) void TextEdit::fileNew() { if( !bFromDocView ) { - save(); + saveAs(); } newFile(DocLnk()); } @@ -680,6 +684,21 @@ 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) return true; 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 @@ -61,6 +61,8 @@ private slots: void fileOpen(); void newFileOpen(); bool save(); + bool saveAs(); + void editCut(); void editCopy(); -- cgit v0.9.0.2