");
insilmaril@185: re.setMinimal(true);
insilmaril@185: r.replace (re,"");
insilmaril@185:
insilmaril@185: // convert all ""
insilmaril@185: re.setPattern ("
");
insilmaril@185: r.replace (re,"");
insilmaril@185:
insilmaril@185: // Remove all other tags, e.g. paragraphs will be added in
insilmaril@185: // templates used during export
insilmaril@185: re.setPattern ("?html.*>");
insilmaril@185: r.replace (re,"");
insilmaril@185: re.setPattern ("?head.*>");
insilmaril@185: r.replace (re,"");
insilmaril@185: re.setPattern ("?body.*>");
insilmaril@185: r.replace (re,"");
insilmaril@185: re.setPattern ("?meta.*>");
insilmaril@185: r.replace (re,"");
insilmaril@185: re.setPattern ("?span.*>");
insilmaril@185: r.replace (re,"");
insilmaril@185: re.setPattern ("?p.*>");
insilmaril@185: r.replace (re,"");
insilmaril@185:
insilmaril@185: r=""+r+"";
insilmaril@185: return r;
insilmaril@185: }
insilmaril@185:
insilmaril@0: void NoteObj::setFontHint (const QString &s)
insilmaril@0: {
insilmaril@0: // only for backward compatibility (pre 1.5 )
insilmaril@0: fonthint=s;
insilmaril@0: }
insilmaril@0:
insilmaril@0: QString NoteObj::getFontHint()
insilmaril@0: {
insilmaril@0: // only for backward compatibility (pre 1.5 )
insilmaril@0: return fonthint;
insilmaril@0: }
insilmaril@0:
insilmaril@0: void NoteObj::setFilenameHint (const QString &s)
insilmaril@0: {
insilmaril@0: filenamehint=s;
insilmaril@0: }
insilmaril@0:
insilmaril@0: QString NoteObj::getFilenameHint()
insilmaril@0: {
insilmaril@0: return filenamehint;
insilmaril@0: }
insilmaril@0:
insilmaril@0: bool NoteObj::isEmpty ()
insilmaril@0: {
insilmaril@0: return note.isEmpty();
insilmaril@0: }
insilmaril@0:
insilmaril@0: QString NoteObj::saveToDir ()
insilmaril@0: {
insilmaril@0: // QTextEdit may generate fontnames with unquoted &, like
insilmaril@0: // in "Lucida B&H". This is invalid in XML and thus would crash
insilmaril@0: // the XML parser
insilmaril@0: uint pos=0;
insilmaril@0: uint pos2;
insilmaril@0: bool inbracket=false;
insilmaril@0: bool inquot=false;
insilmaril@0: while (pos") inbracket=false;
insilmaril@0: if (note.mid(pos,1)=="\"" && inbracket)
insilmaril@0: {
insilmaril@0: if (!inquot)
insilmaril@0: inquot=true;
insilmaril@0: else
insilmaril@0: inquot=false;
insilmaril@0: }
insilmaril@0: if (note.mid(pos,1)=="&" && inquot)
insilmaril@0: {
insilmaril@0: // Now we are inside < " " >
insilmaril@0: // look for ending "
insilmaril@0: pos2=pos+1;
insilmaril@0: while (note.mid(pos2,1)!=";" && note.mid(pos2,1)!="\"")
insilmaril@0: pos2++;
insilmaril@0: if (note.mid(pos2,1)=="\"")
insilmaril@0: {
insilmaril@0: note.replace(pos,1,"&");
insilmaril@0: pos=pos2;
insilmaril@0: }
insilmaril@0: }
insilmaril@0: pos++;
insilmaril@0: }
insilmaril@0: return beginElement ("htmlnote",attribut("fonthint",fonthint)) + "\n"+ note+ "\n" +endElement ("htmlnote");
insilmaril@0: }
insilmaril@0: