noteobj.cpp
changeset 477 a9ac5dea9561
parent 185 6691000c3262
child 551 2913f96fd233
     1.1 --- a/noteobj.cpp	Tue Jan 24 15:09:48 2006 +0000
     1.2 +++ b/noteobj.cpp	Wed Apr 25 16:02:54 2007 +0000
     1.3 @@ -149,35 +149,28 @@
     1.4  	// in "Lucida B&H". This is invalid in XML and thus would crash
     1.5  	// the XML parser
     1.6  	uint pos=0;
     1.7 -	uint pos2;
     1.8  	bool inbracket=false;
     1.9  	bool inquot=false;
    1.10 -	while (pos<note.length())
    1.11 +	QString n=note;
    1.12 +	while (pos<n.length())
    1.13  	{
    1.14 -		if (note.mid(pos,1)=="<") inbracket=true;
    1.15 -		if (note.mid(pos,1)==">") inbracket=false;
    1.16 -		if (note.mid(pos,1)=="\"" && inbracket)
    1.17 +		if (n.mid(pos,1)=="<") inbracket=true;
    1.18 +		if (n.mid(pos,1)==">") inbracket=false;
    1.19 +		if (n.mid(pos,1)=="\"" && inbracket)
    1.20  		{
    1.21  			if (!inquot)
    1.22  				inquot=true;
    1.23  			else
    1.24  				inquot=false;
    1.25  		}
    1.26 -		if (note.mid(pos,1)=="&" && inquot)
    1.27 +		if (n.mid(pos,1)=="&" && inquot)
    1.28  		{
    1.29  			// Now we are inside  <  "  "  >
    1.30 -			// look for ending "
    1.31 -			pos2=pos+1;
    1.32 -			while (note.mid(pos2,1)!=";" && note.mid(pos2,1)!="\"")
    1.33 -				pos2++;
    1.34 -			if (note.mid(pos2,1)=="\"")
    1.35 -			{
    1.36 -				note.replace(pos,1,"&amp;");
    1.37 -				pos=pos2;
    1.38 -			}
    1.39 +			n.replace(pos,1,"&amp;");
    1.40 +			pos=pos+3;
    1.41  		}
    1.42  		pos++;
    1.43  	}
    1.44 -	return beginElement ("htmlnote",attribut("fonthint",fonthint)) + "\n"+ note+ "\n" +endElement ("htmlnote");
    1.45 +	return beginElement ("htmlnote",attribut("fonthint",fonthint)) + "\n"+ n+ "\n" +endElement ("htmlnote");
    1.46  }
    1.47