noteobj.cpp
changeset 708 02f683ded030
parent 693 07fead1e540b
child 711 d6376f767d27
     1.1 --- a/noteobj.cpp	Tue May 20 12:53:49 2008 +0000
     1.2 +++ b/noteobj.cpp	Tue Jun 03 08:33:03 2008 +0000
     1.3 @@ -165,6 +165,13 @@
     1.4  
     1.5  QString NoteObj::saveToDir ()
     1.6  {
     1.7 +	QString n=note;
     1.8 +
     1.9 +	// Remove the doctype, which will confuse parsing 
    1.10 +	// with XmlReader in Qt >= 4.4
    1.11 +	QRegExp rx("<!DOCTYPE.*>");
    1.12 +	n.replace (rx,"");
    1.13 +	
    1.14  	// QTextEdit may generate fontnames with unquoted &, like
    1.15  	// in "Lucida B&H". This is invalid in XML and thus would crash
    1.16  	// the XML parser
    1.17 @@ -175,7 +182,6 @@
    1.18  	bool inbracket=false;
    1.19  	int begin_bracket=0;
    1.20  	bool inquot=false;
    1.21 -	QString n=note;
    1.22  	while (pos<n.length())
    1.23  	{
    1.24  		if (n.mid(pos,1)=="<") 
    1.25 @@ -190,7 +196,7 @@
    1.26  			int sl=s.length();
    1.27  			if (s.count("style=\"")>1)
    1.28  			{
    1.29 -				QRegExp rx("style=\\s*\"(.*)\"\\s*style=\\s*\"(.*)\"");
    1.30 +				rx.setPattern("style=\\s*\"(.*)\"\\s*style=\\s*\"(.*)\"");
    1.31  				rx.setMinimal (true);
    1.32  				s.replace(rx,"style=\"\\1 \\2\"");
    1.33  				n.replace (begin_bracket,sl,s);
    1.34 @@ -212,6 +218,8 @@
    1.35  		}
    1.36  		pos++;
    1.37  	}
    1.38 +
    1.39 +	
    1.40  	return beginElement ("htmlnote",attribut("fonthint",fonthint)) + "\n"+ n+ "\n" +endElement ("htmlnote");
    1.41  }
    1.42