summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/apps/textedit/textedit.cpp23
-rw-r--r--core/apps/textedit/textedit.h2
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
@@ -274,8 +274,12 @@ TextEdit::TextEdit( QWidget *parent, const char *name, WFlags f )
// a->addTo( bar );
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 );
a->addTo( edit );
@@ -413,9 +417,9 @@ TextEdit::TextEdit( QWidget *parent, const char *name, WFlags f )
}
TextEdit::~TextEdit()
{
- save();
+ saveAs();
Config cfg("TextEdit");
cfg.setGroup("View");
QFont f = editor->font();
@@ -485,9 +489,9 @@ void TextEdit::setWordWrap(bool y)
void TextEdit::fileNew()
{
if( !bFromDocView ) {
- save();
+ saveAs();
}
newFile(DocLnk());
}
@@ -679,8 +683,23 @@ 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;
if ( !editor->edited() ) {
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
@@ -60,8 +60,10 @@ private slots:
void fileRevert();
void fileOpen();
void newFileOpen();
bool save();
+ bool saveAs();
+
void editCut();
void editCopy();
void editPaste();