author | llornkcor <llornkcor> | 2002-04-24 01:00:52 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2002-04-24 01:00:52 (UTC) |
commit | 29e4dd18cbbe6d5967561b428a9632629cff3fde (patch) (unidiff) | |
tree | 4e3f6daaabd72937b2d1222f22d5797bb4c80b96 | |
parent | 23f73a3a483a4daf3a26d0e83fd947d4f4118013 (diff) | |
download | opie-29e4dd18cbbe6d5967561b428a9632629cff3fde.zip opie-29e4dd18cbbe6d5967561b428a9632629cff3fde.tar.gz opie-29e4dd18cbbe6d5967561b428a9632629cff3fde.tar.bz2 |
changed way of saving files, so a file opened through the file dialog, which is not a DocLnk, gets saved without a DocLnk. I got tired of hearing, 'I edited /etc/so-and-so and it saved it to Documents.' Will make this an option later. :)
-rw-r--r-- | core/apps/textedit/textedit.cpp | 28 | ||||
-rw-r--r-- | core/apps/textedit/textedit.h | 2 |
2 files changed, 27 insertions, 3 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 | |||
@@ -352,2 +352,4 @@ TextEdit::TextEdit( QWidget *parent, const char *name, WFlags f ) | |||
352 | nStart->addTo( font ); | 352 | nStart->addTo( font ); |
353 | font->insertSeparator(); | ||
354 | font->insertItem(tr("About"), this, SLOT( doAbout()) ); | ||
353 | 355 | ||
@@ -414,2 +416,3 @@ TextEdit::TextEdit( QWidget *parent, const char *name, WFlags f ) | |||
414 | } | 416 | } |
417 | |||
415 | viewSelection = cfg.readNumEntry( "FileView", 0 ); | 418 | viewSelection = cfg.readNumEntry( "FileView", 0 ); |
@@ -532,3 +535,3 @@ void TextEdit::fileOpen() | |||
532 | qDebug("please open "+currentFileName); | 535 | qDebug("please open "+currentFileName); |
533 | openFile(str ); | 536 | openFile(currentFileName ); |
534 | } | 537 | } |
@@ -665,4 +668,6 @@ void TextEdit::openFile( const QString &f ) | |||
665 | } | 668 | } |
666 | } else | 669 | } else { |
667 | filer = f; | 670 | filer = f; |
671 | fileIs = TRUE; | ||
672 | } | ||
668 | 673 | ||
@@ -744,3 +749,3 @@ bool TextEdit::save() | |||
744 | mode = buf.st_mode; | 749 | mode = buf.st_mode; |
745 | 750 | if(!fileIs) { | |
746 | doc->setName( name); | 751 | doc->setName( name); |
@@ -750,2 +755,13 @@ bool TextEdit::save() | |||
750 | } | 755 | } |
756 | } else { | ||
757 | qDebug("regular save file"); | ||
758 | QFile f(file); | ||
759 | if( f.open(IO_WriteOnly)) { | ||
760 | f.writeBlock(rt,rt.length()); | ||
761 | } else { | ||
762 | QMessageBox::message("Text Edit","Write Failed"); | ||
763 | return false; | ||
764 | } | ||
765 | |||
766 | } | ||
751 | editor->setEdited( FALSE); | 767 | editor->setEdited( FALSE); |
@@ -971 +987,7 @@ void TextEdit::receive(const QCString&msg, const QByteArray&) { | |||
971 | } | 987 | } |
988 | void TextEdit::doAbout() { | ||
989 | QMessageBox::about(0,"Text Edit","Text Edit is copyright\n" | ||
990 | "2000 Trolltech AS, and\n" | ||
991 | "2002 by L.J.Potter \nljp@llornkcor.com\n" | ||
992 | "and is licensed under the GPL"); | ||
993 | } | ||
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 | |||
@@ -67,2 +67,3 @@ void receive(const QCString&, const QByteArray&); | |||
67 | protected: | 67 | protected: |
68 | bool fileIs; | ||
68 | void closeEvent( QCloseEvent *e ); | 69 | void closeEvent( QCloseEvent *e ); |
@@ -70,2 +71,3 @@ protected: | |||
70 | private slots: | 71 | private slots: |
72 | void doAbout(); | ||
71 | void setDocument(const QString&); | 73 | void setDocument(const QString&); |