}
loadNoteBrowserInformation(browserWindow, currentNoteGuid, currentNote);
}
private void loadNoteBrowserInformation(BrowserWindow browser, String guid, Note note) {
NoteFormatter formatter = new NoteFormatter(logger, conn, tempFiles);
formatter.setNote(note, Global.pdfPreview());
formatter.setHighlight(listManager.getEnSearch());
QByteArray js;
if (!noteCache.containsKey(guid)) {
js = new QByteArray();
// We need to prepend the note with <HEAD></HEAD> or encoded characters are ugly
js.append("<html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">");
js.append("<style type=\"text/css\">.en-crypt-temp { border-collapse:collapse; border-style:solid; border-color:blue; padding:0.0mm 0.0mm 0.0mm 0.0mm; }</style>");
js.append("<style type=\"text/css\">en-hilight { background-color: rgb(255,255,0) }</style>");
js.append("<style> img { height:auto; width:auto; max-height:auto; max-width:100%; }</style>");
if (Global.displayRightToLeft())
js.append("<style> body { direction:rtl; }</style>");
js.append("<style type=\"text/css\">en-spell { text-decoration: none; border-bottom: dotted 1px #cc0000; }</style>");
js.append("</head>");
formatter.setNote(note, Global.pdfPreview());
js.append(formatter.rebuildNoteHTML());
js.append("</HTML>");
js.replace("<!DOCTYPE en-note SYSTEM 'http://xml.evernote.com/pub/enml.dtd'>", "");
js.replace("<!DOCTYPE en-note SYSTEM 'http://xml.evernote.com/pub/enml2.dtd'>", "");
js.replace("<?xml version='1.0' encoding='UTF-8'?>", "");
// if (Global.enableHTMLEntitiesFix) {
// browser.getBrowser().setContent(new QByteArray(StringEscapeUtils.unescapeHtml(js.toString())));
// } else
browser.setContent(js);
noteCache.put(guid, js.toString());
if (formatter.resourceError)
resourceErrorMessage();
if (formatter.formatError) {
waitCursor(false);
QMessageBox.information(this, tr("Error"),
tr("NixNote had issues formatting this note." +
" To protect your data this note is being marked as read-only."));
waitCursor(true);
}
readOnly = formatter.readOnly;
inkNote = formatter.inkNote;
if (readOnly)
readOnlyCache.put(guid, true);
if (inkNote)
inkNoteCache.put(guid, true);
} else {
logger.log(logger.HIGH, "Note content is being pulled from the cache");
String cachedContent = formatter.modifyCachedTodoTags(noteCache.get(guid));
js = new QByteArray(cachedContent);
browser.setContent(js);
if (readOnlyCache.containsKey(guid))
readOnly = true;
if (inkNoteCache.containsKey(guid))