noteobj.cpp
changeset 721 12958f987bcf
parent 711 d6376f767d27
child 746 ee6b0f3a4c2f
     1.1 --- a/noteobj.cpp	Wed Jul 16 10:44:44 2008 +0000
     1.2 +++ b/noteobj.cpp	Wed Jul 16 10:46:14 2008 +0000
     1.3 @@ -51,6 +51,7 @@
     1.4  
     1.5  QString NoteObj::getNoteASCII(const QString &indent, const int &width)
     1.6  {
     1.7 +	// FIXME make use of width
     1.8  	QString r=note;
     1.9  
    1.10  	// Remove all <style...> ...</style>
    1.11 @@ -167,12 +168,13 @@
    1.12  {
    1.13  	QString n=note;
    1.14  
    1.15 -	// Remove the doctype, which will confuse parsing 
    1.16 +	// Remove the doctype, which will confuse parsing
    1.17  	// with XmlReader in Qt >= 4.4
    1.18  	QRegExp rx("<!DOCTYPE.*>");
    1.19  	rx.setMinimal(true);
    1.20  	n.replace (rx,"");
    1.21 -	
    1.22 +
    1.23 +
    1.24  	// QTextEdit may generate fontnames with unquoted &, like
    1.25  	// in "Lucida B&H". This is invalid in XML and thus would crash
    1.26  	// the XML parser
    1.27 @@ -183,6 +185,7 @@
    1.28  	bool inbracket=false;
    1.29  	int begin_bracket=0;
    1.30  	bool inquot=false;
    1.31 +
    1.32  	while (pos<n.length())
    1.33  	{
    1.34  		if (n.mid(pos,1)=="<") 
    1.35 @@ -197,7 +200,7 @@
    1.36  			int sl=s.length();
    1.37  			if (s.count("style=\"")>1)
    1.38  			{
    1.39 -				rx.setPattern("style=\\s*\"(.*)\"\\s*style=\\s*\"(.*)\"");
    1.40 +				rx.setPattern ("style=\\s*\"(.*)\"\\s*style=\\s*\"(.*)\"");
    1.41  				s.replace(rx,"style=\"\\1 \\2\"");
    1.42  				n.replace (begin_bracket,sl,s);
    1.43  				pos=pos-(sl-s.length());
    1.44 @@ -218,8 +221,6 @@
    1.45  		}
    1.46  		pos++;
    1.47  	}
    1.48 -
    1.49 -	
    1.50  	return beginElement ("htmlnote",attribut("fonthint",fonthint)) + "\n"+ n+ "\n" +endElement ("htmlnote");
    1.51  }
    1.52