diff -r 72cc3873306a -r fad762341d2d texteditor.cpp --- a/texteditor.cpp Mon Sep 05 11:56:31 2005 +0000 +++ b/texteditor.cpp Tue Mar 14 14:27:08 2006 +0000 @@ -1,4 +1,3 @@ -/* emacs: -*- Mode: C; c-style: "bsd"; c-basic-offset: 4; c-recognize-knr-p: nil; -*- */ #include "texteditor.h" #include @@ -29,6 +28,9 @@ #include #include +#include "noteobj.h" +#include "version.h" + #include "icons/fileopen.xpm" #include "icons/filesave.xpm" #include "icons/fileprint.xpm" @@ -77,7 +79,7 @@ connect (e, SIGNAL( textChanged() ), this, SLOT( editorChanged() ) ); setCentralWidget( e ); statusBar()->message( "Ready", statusbarTime); - setCaption("VYM - Note Editor"); + setCaption(__VYM " - " +tr ("Note Editor")); // Toolbars setupFileActions(); @@ -469,7 +471,7 @@ { if (e->length()) { - QMessageBox mb( "VYM - Note Editor", + QMessageBox mb( __VYM " - " +tr("Note Editor"), "Loading will overwrite the existing note", QMessageBox::Warning, QMessageBox::Yes | QMessageBox::Default, @@ -519,9 +521,6 @@ void TextEditor::editorChanged() { - // received, when QTextEdit::text() has changed - EditorState oldstate=state; - if (isEmpty()) state=emptyEditor; else @@ -573,7 +572,7 @@ QFile file (fn); if (file.exists()) { - QMessageBox mb( "VYM", + QMessageBox mb( __VYM, tr("The file ") + fn + tr(" exists already. " "Do you want to overwrite it?"), @@ -696,38 +695,9 @@ e->setText(t); } -QString textConvertToASCII(const QString &t) -{ - QString r=t; - - // convert all "" to "\n" - QRegExp re(""); - re.setMinimal(true); - r.replace (re,"\n"); - - // convert all "

" to "\n" - re.setPattern ("

"); - r.replace (re,"\n"); - - // remove all remaining tags - re.setPattern ("<.*>"); - r.replace (re,""); - - // convert "&", "<" and ">" - re.setPattern (">"); - r.replace (re,">"); - re.setPattern ("<"); - r.replace (re,"<"); - re.setPattern ("&"); - r.replace (re,"&"); - re.setPattern ("""); - r.replace (re,"\""); - return r; -} - void TextEditor::textExportAsASCII() { - QString text = textConvertToASCII( e->text()); + QString text = NoteObj (e->text()).getNoteASCII(); QString fn,s; if (!filenameHint.isEmpty()) {