-rw-r--r-- | core/apps/textedit/textedit.cpp | 40 | ||||
-rw-r--r-- | core/apps/textedit/textedit.h | 2 |
2 files changed, 33 insertions, 9 deletions
diff --git a/core/apps/textedit/textedit.cpp b/core/apps/textedit/textedit.cpp index 84888c1..19449cb 100644 --- a/core/apps/textedit/textedit.cpp +++ b/core/apps/textedit/textedit.cpp @@ -351,4 +351,6 @@ TextEdit::TextEdit( QWidget *parent, const char *name, WFlags f ) nStart->setToggleAction(TRUE); nStart->addTo( font ); + font->insertSeparator(); + font->insertItem(tr("About"), this, SLOT( doAbout()) ); mb->insertItem( tr( "File" ), file ); @@ -413,4 +415,5 @@ TextEdit::TextEdit( QWidget *parent, const char *name, WFlags f ) fileOpen(); } + viewSelection = cfg.readNumEntry( "FileView", 0 ); } @@ -505,5 +508,5 @@ void TextEdit::fileOpen() cfg.setGroup("View"); bool b=FALSE; - if(cfg.readEntry("useOldFileDialog") == "TRUE") + if(cfg.readEntry("useOldFileDialog") == "TRUE") b=TRUE; if(!b) { @@ -531,9 +534,9 @@ void TextEdit::fileOpen() currentFileName = fileName; qDebug("please open "+currentFileName); - openFile(str ); + openFile(currentFileName ); } } viewSelection = browseForFiles->SelectionCombo->currentItem(); - } + } delete browseForFiles; editor->setEdited( FALSE); @@ -664,6 +667,8 @@ void TextEdit::openFile( const QString &f ) break; } - } else + } else { filer = f; + fileIs = TRUE; + } DocLnk nf; @@ -743,9 +748,20 @@ bool TextEdit::save() stat(file.latin1(), &buf); mode = buf.st_mode; - - doc->setName( name); - FileManager fm; - if ( !fm.saveFile( *doc, rt ) ) { - return false; + if(!fileIs) { + doc->setName( name); + FileManager fm; + if ( !fm.saveFile( *doc, rt ) ) { + return false; + } + } else { + qDebug("regular save file"); + QFile f(file); + if( f.open(IO_WriteOnly)) { + f.writeBlock(rt,rt.length()); + } else { + QMessageBox::message("Text Edit","Write Failed"); + return false; + } + } editor->setEdited( FALSE); @@ -970,2 +986,8 @@ void TextEdit::receive(const QCString&msg, const QByteArray&) { } +void TextEdit::doAbout() { + QMessageBox::about(0,"Text Edit","Text Edit is copyright\n" + "2000 Trolltech AS, and\n" + "2002 by L.J.Potter \nljp@llornkcor.com\n" + "and is licensed under the GPL"); +} diff --git a/core/apps/textedit/textedit.h b/core/apps/textedit/textedit.h index edc6fe3..9d27ab0 100644 --- a/core/apps/textedit/textedit.h +++ b/core/apps/textedit/textedit.h @@ -66,7 +66,9 @@ public slots: void receive(const QCString&, const QByteArray&); protected: + bool fileIs; void closeEvent( QCloseEvent *e ); void doSearchBar(); private slots: + void doAbout(); void setDocument(const QString&); void changeFont(); |