Workaround for unreadable file with Qt 4.4
authorinsilmaril
Tue Jun 03 08:33:03 2008 +0000 (2008-06-03)
changeset 70802f683ded030
parent 707 16ff14c745cc
child 709 25eec6d77740
Workaround for unreadable file with Qt 4.4
noteobj.cpp
version.h
     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  
     2.1 --- a/version.h	Tue May 20 12:53:49 2008 +0000
     2.2 +++ b/version.h	Tue Jun 03 08:33:03 2008 +0000
     2.3 @@ -7,7 +7,7 @@
     2.4  #define __VYM_VERSION "1.12.0"
     2.5  #define __VYM_CODENAME "Codename: RC-2"
     2.6  //#define __VYM_CODENAME "Codename: development version"
     2.7 -#define __VYM_BUILD_DATE "2008-05-14"
     2.8 +#define __VYM_BUILD_DATE "2008-06-02"
     2.9  
    2.10  
    2.11  bool checkVersion(const QString &);