summaryrefslogtreecommitdiff
authorllornkcor <llornkcor>2002-02-18 15:02:33 (UTC)
committer llornkcor <llornkcor>2002-02-18 15:02:33 (UTC)
commita6266fb220a61c4904e24ebf31eeefab34362e59 (patch) (unidiff)
treeab1da9da25c4b5118935bc981fca62a8c72b6810
parent00f89d28e669140eb50f1f220c389f88fba1105c (diff)
downloadopie-a6266fb220a61c4904e24ebf31eeefab34362e59.zip
opie-a6266fb220a61c4904e24ebf31eeefab34362e59.tar.gz
opie-a6266fb220a61c4904e24ebf31eeefab34362e59.tar.bz2
added Save As (prompt user) and moved save (no prompt) functions there
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
@@ -275,6 +275,10 @@ TextEdit::TextEdit( QWidget *parent, const char *name, WFlags f )
275 file->insertSeparator(); 275 file->insertSeparator();
276 a->addTo( file ); 276 a->addTo( file );
277 277
278 a = new QAction( tr( "Save As" ), QPixmap(( const char** ) filesave_xpm ) , QString::null, 0, this, 0 );
279 connect( a, SIGNAL( activated() ), this, SLOT( saveAs() ) );
280 a->addTo( file );
281
278 a = new QAction( tr( "Cut" ), Resource::loadPixmap( "cut" ), QString::null, 0, this, 0 ); 282 a = new QAction( tr( "Cut" ), Resource::loadPixmap( "cut" ), QString::null, 0, this, 0 );
279 connect( a, SIGNAL( activated() ), this, SLOT( editCut() ) ); 283 connect( a, SIGNAL( activated() ), this, SLOT( editCut() ) );
280 a->addTo( editBar ); 284 a->addTo( editBar );
@@ -414,7 +418,7 @@ TextEdit::TextEdit( QWidget *parent, const char *name, WFlags f )
414 418
415TextEdit::~TextEdit() 419TextEdit::~TextEdit()
416{ 420{
417 save(); 421 saveAs();
418 422
419 Config cfg("TextEdit"); 423 Config cfg("TextEdit");
420 cfg.setGroup("View"); 424 cfg.setGroup("View");
@@ -486,7 +490,7 @@ void TextEdit::setWordWrap(bool y)
486void TextEdit::fileNew() 490void TextEdit::fileNew()
487{ 491{
488 if( !bFromDocView ) { 492 if( !bFromDocView ) {
489 save(); 493 saveAs();
490 } 494 }
491 newFile(DocLnk()); 495 newFile(DocLnk());
492} 496}
@@ -680,6 +684,21 @@ void TextEdit::showEditTools()
680 684
681bool TextEdit::save() 685bool TextEdit::save()
682{ 686{
687 QString rt = editor->text();
688 doc->setName( currentFileName);
689 FileManager fm;
690 if ( !fm.saveFile( *doc, rt ) ) {
691 return false;
692 }
693 delete doc;
694 doc = 0;
695 editor->setEdited( false );
696 return true;
697
698}
699
700bool TextEdit::saveAs()
701{
683 // case of nothing to save... 702 // case of nothing to save...
684 if ( !doc || !bFromDocView) 703 if ( !doc || !bFromDocView)
685 return true; 704 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:
61 void fileOpen(); 61 void fileOpen();
62 void newFileOpen(); 62 void newFileOpen();
63 bool save(); 63 bool save();
64 bool saveAs();
65
64 66
65 void editCut(); 67 void editCut();
66 void editCopy(); 68 void editCopy();