texteditor.cpp
changeset 189 ca30b203fb73
parent 160 72cc3873306a
child 269 4c3e9fa0093b
     1.1 --- a/texteditor.cpp	Tue Jan 24 15:09:48 2006 +0000
     1.2 +++ b/texteditor.cpp	Tue Jan 24 15:09:48 2006 +0000
     1.3 @@ -1,4 +1,3 @@
     1.4 -/* emacs: -*- Mode: C; c-style: "bsd"; c-basic-offset: 4; c-recognize-knr-p: nil; -*- */
     1.5  #include "texteditor.h"
     1.6  
     1.7  #include <qcanvas.h>
     1.8 @@ -29,6 +28,9 @@
     1.9  #include <cstdlib>
    1.10  #include <typeinfo>
    1.11  
    1.12 +#include "noteobj.h"
    1.13 +#include "version.h"
    1.14 +
    1.15  #include "icons/fileopen.xpm"
    1.16  #include "icons/filesave.xpm"
    1.17  #include "icons/fileprint.xpm"
    1.18 @@ -77,7 +79,7 @@
    1.19  	connect (e, SIGNAL( textChanged() ), this, SLOT( editorChanged() ) );
    1.20      setCentralWidget( e );
    1.21      statusBar()->message( "Ready", statusbarTime);
    1.22 -	setCaption("VYM - Note Editor");
    1.23 +	setCaption(__VYM " - " +tr ("Note Editor"));
    1.24  
    1.25  	// Toolbars
    1.26  	setupFileActions();
    1.27 @@ -469,7 +471,7 @@
    1.28  	{
    1.29  		if (e->length()) 
    1.30  		{
    1.31 -			QMessageBox mb( "VYM - Note Editor",
    1.32 +			QMessageBox mb( __VYM " - " +tr("Note Editor"),
    1.33  				"Loading will overwrite the existing note",
    1.34  				QMessageBox::Warning,
    1.35  				QMessageBox::Yes | QMessageBox::Default,
    1.36 @@ -519,9 +521,6 @@
    1.37  
    1.38  void TextEditor::editorChanged()
    1.39  {
    1.40 -	// received, when QTextEdit::text() has changed
    1.41 -	EditorState	oldstate=state;
    1.42 -
    1.43  	if (isEmpty())
    1.44  		state=emptyEditor;
    1.45  	else
    1.46 @@ -573,7 +572,7 @@
    1.47  		QFile file (fn);
    1.48  		if (file.exists())
    1.49  		{
    1.50 -			QMessageBox mb( "VYM",
    1.51 +			QMessageBox mb( __VYM,
    1.52  				tr("The file ") + fn + 
    1.53  				tr(" exists already. "
    1.54  				"Do you want to overwrite it?"),
    1.55 @@ -696,38 +695,9 @@
    1.56  		e->setText(t);
    1.57  }
    1.58  
    1.59 -QString textConvertToASCII(const QString &t)
    1.60 -{
    1.61 -	QString r=t;
    1.62 -
    1.63 -	// convert all "<br*>" to "\n"
    1.64 -	QRegExp re("<br.*>");
    1.65 -	re.setMinimal(true);
    1.66 -	r.replace (re,"\n");
    1.67 -
    1.68 -	// convert all "<p>" to "\n"
    1.69 -	re.setPattern ("<p>");
    1.70 -	r.replace (re,"\n");
    1.71 -	
    1.72 -	// remove all remaining tags 
    1.73 -	re.setPattern ("<.*>");
    1.74 -	r.replace (re,"");
    1.75 -
    1.76 -	// convert "&", "<" and ">"
    1.77 -	re.setPattern ("&gt;");
    1.78 -	r.replace (re,">");
    1.79 -	re.setPattern ("&lt;");
    1.80 -	r.replace (re,"<");
    1.81 -	re.setPattern ("&amp;");
    1.82 -	r.replace (re,"&");
    1.83 -	re.setPattern ("&quot;");
    1.84 -	r.replace (re,"\"");
    1.85 -	return r;
    1.86 -}
    1.87 -
    1.88  void TextEditor::textExportAsASCII()
    1.89  {
    1.90 -	QString text = textConvertToASCII( e->text());
    1.91 +	QString text = NoteObj (e->text()).getNoteASCII();
    1.92  	QString fn,s;
    1.93  	if (!filenameHint.isEmpty())
    1.94  	{