1 package cx.fbn.nevernote.xml;
\r
4 import java.util.ArrayList;
\r
5 import java.util.List;
\r
7 import com.evernote.edam.type.Note;
\r
8 import com.evernote.edam.type.Resource;
\r
9 import com.trolltech.qt.core.QByteArray;
\r
10 import com.trolltech.qt.core.QDataStream;
\r
11 import com.trolltech.qt.core.QFile;
\r
12 import com.trolltech.qt.core.QIODevice;
\r
13 import com.trolltech.qt.core.QIODevice.OpenModeFlag;
\r
14 import com.trolltech.qt.core.QTemporaryFile;
\r
15 import com.trolltech.qt.core.QUrl;
\r
16 import com.trolltech.qt.core.Qt.BGMode;
\r
17 import com.trolltech.qt.gui.QColor;
\r
18 import com.trolltech.qt.gui.QPainter;
\r
19 import com.trolltech.qt.gui.QPixmap;
\r
20 import com.trolltech.qt.xml.QDomAttr;
\r
21 import com.trolltech.qt.xml.QDomDocument;
\r
22 import com.trolltech.qt.xml.QDomElement;
\r
23 import com.trolltech.qt.xml.QDomNodeList;
\r
25 import cx.fbn.nevernote.Global;
\r
26 import cx.fbn.nevernote.config.FileManager;
\r
27 import cx.fbn.nevernote.filters.EnSearch;
\r
28 import cx.fbn.nevernote.gui.PDFPreview;
\r
29 import cx.fbn.nevernote.sql.DatabaseConnection;
\r
30 import cx.fbn.nevernote.utilities.ApplicationLogger;
\r
32 public class NoteFormatter {
\r
34 private final ApplicationLogger logger;
\r
35 private final DatabaseConnection conn;
\r
36 public boolean resourceError = false;
\r
37 public boolean readOnly = false;
\r
38 public boolean addHighlight = true;
\r
39 private Note currentNote;
\r
40 private String currentNoteGuid;
\r
41 private boolean pdfPreview;
\r
42 ArrayList<QTemporaryFile> tempFiles;
\r
43 private EnSearch enSearch;
\r
44 private boolean noteHistory;
\r
46 public NoteFormatter(ApplicationLogger logger, DatabaseConnection conn, List<QTemporaryFile> tempFiles2) {
\r
47 this.logger = logger;
\r
49 noteHistory = false;
\r
53 public void setNote(Note note, boolean pdfPreview) {
\r
55 this.pdfPreview = pdfPreview;
\r
57 currentNoteGuid = note.getGuid();
\r
59 currentNoteGuid = null;
\r
61 resourceError = false;
\r
64 public void setHighlight(EnSearch search) {
\r
65 if (search==null || search.hilightWords == null ||search.hilightWords.size() == 0) {
\r
67 addHighlight = false;
\r
70 addHighlight = true;
\r
74 // Set if we are coming here through note histary. It triggers longer file names to avoid conflicts
\r
75 public void setNoteHistory(boolean value) {
\r
76 noteHistory = value;
\r
79 // Rebuild the note HTML to something usable
\r
80 public String rebuildNoteHTML() {
\r
81 if (currentNote == null)
\r
83 logger.log(logger.HIGH, "Entering NeverNote.rebuildNoteHTML");
\r
84 logger.log(logger.EXTREME, "Note guid: " +currentNoteGuid);
\r
85 logger.log(logger.EXTREME, "Note Text:" +currentNote);
\r
86 QDomDocument doc = new QDomDocument();
\r
87 QDomDocument.Result result = doc.setContent(currentNote.getContent());
\r
88 if (!result.success) {
\r
89 logger.log(logger.MEDIUM, "Parse error when rebuilding HTML");
\r
90 logger.log(logger.MEDIUM, "Note guid: " +currentNoteGuid);
\r
91 logger.log(logger.EXTREME, "Start of unmodified note HTML");
\r
92 logger.log(logger.EXTREME, currentNote.getContent());
\r
93 logger.log(logger.EXTREME, "End of unmodified note HTML");
\r
94 return currentNote.getContent();
\r
97 if (tempFiles == null)
\r
98 tempFiles = new ArrayList<QTemporaryFile>();
\r
101 doc = modifyTags(doc);
\r
103 doc = addHilight(doc);
\r
104 QDomElement docElem = doc.documentElement();
\r
105 docElem.setTagName("Body");
\r
106 // docElem.setAttribute("bgcolor", "green");
\r
107 logger.log(logger.EXTREME, "Rebuilt HTML:");
\r
108 logger.log(logger.EXTREME, doc.toString());
\r
109 logger.log(logger.HIGH, "Leaving NeverNote.rebuildNoteHTML");
\r
110 // Fix the stupid problem where inserting an <img> tag after an <a> tag (which is done
\r
111 // to get the <en-media> application tag to work properly) causes spaces to be inserted
\r
112 // between the <a> & <img>. This messes things up later. This is an ugly hack.
\r
113 StringBuffer html = new StringBuffer(doc.toString());
\r
114 for (int i=html.indexOf("<a en-tag=\"en-media\" ", 0); i>-1; i=html.indexOf("<a en-tag=\"en-media\" ", i)) {
\r
115 i=html.indexOf(">\n",i+1);
\r
116 int z = html.indexOf("<img",i);
\r
117 for (int j=z-1; j>i; j--)
\r
118 html.deleteCharAt(j);
\r
119 i=html.indexOf("/>", z+1);
\r
120 z = html.indexOf("</a>",i);
\r
121 for (int j=z-1; j>i+1; j--)
\r
122 html.deleteCharAt(j);
\r
124 return html.toString();
\r
127 private void addImageHilight(String resGuid, QFile f) {
\r
128 if (enSearch == null || enSearch.hilightWords == null || enSearch.hilightWords.size() == 0)
\r
131 // Get the recognition XML that tells where to hilight on the image
\r
132 Resource recoResource = conn.getNoteTable().noteResourceTable.getNoteResourceRecognition(resGuid);
\r
133 QByteArray recoData = new QByteArray(recoResource.getRecognition().getBody());
\r
134 String xml = recoData.toString();
\r
136 // Get a painter for the image. This is the background (the initial image).
\r
137 QPixmap pix = new QPixmap(f.fileName());
\r
138 QPixmap hilightedPix = new QPixmap(pix.size());
\r
139 QPainter p = new QPainter(hilightedPix);
\r
140 p.drawPixmap(0,0, pix);
\r
142 // Create a transparent pixmap. The only non-transparent
\r
143 // piece is the hilight that will be overlayed to hilight text no the background
\r
144 QPixmap overlayPix = new QPixmap(pix.size());
\r
145 QPainter p2 = new QPainter(overlayPix);
\r
146 p2.setBackgroundMode(BGMode.TransparentMode);
\r
147 p2.setBrush(QColor.yellow);
\r
149 // Get the recognition data from the note
\r
150 QDomDocument doc = new QDomDocument();
\r
151 doc.setContent(xml);
\r
153 // Go through all "item" nodes
\r
154 QDomNodeList anchors = doc.elementsByTagName("item");
\r
155 for (int i=0; i<anchors.length(); i++) {
\r
156 QDomElement element = anchors.at(i).toElement();
\r
157 int x = new Integer(element.attribute("x")); // x coordinate
\r
158 int y = new Integer(element.attribute("y")); // y coordinate
\r
159 int w = new Integer(element.attribute("w")); // width
\r
160 int h = new Integer(element.attribute("h")); // height
\r
161 QDomNodeList children = element.childNodes(); // all children ("t" nodes).
\r
163 // Go through the children ("t" nodes)
\r
164 for (int j=0; j<children.length(); j++) {
\r
165 QDomElement child = children.at(j).toElement();
\r
166 if (child.nodeName().equalsIgnoreCase("t")) {
\r
167 String text = child.text(); // recognition text
\r
168 int weight = new Integer(child.attribute("w")); // recognition weight
\r
169 if (weight >= Global.getRecognitionWeight()) { // Are we above the maximum?
\r
171 // Check to see if this word matches something we were searching for.
\r
172 for (int k=0; k<enSearch.hilightWords.size(); k++) {
\r
173 if (enSearch.hilightWords.get(k).equalsIgnoreCase(text))
\r
174 p2.drawRect(x,y,w,h);
\r
182 // Paint the hilight onto the background.
\r
183 p.setOpacity(0.40);
\r
184 p.drawPixmap(0,0, overlayPix);
\r
187 // Save over the initial pixmap.
\r
188 hilightedPix.save(f.fileName());
\r
191 // Modify the en-media tag into an image tag so it can be displayed.
\r
192 private void modifyImageTags(QDomElement docElem, QDomElement enmedia, QDomAttr hash) {
\r
193 logger.log(logger.HIGH, "Entering NeverNote.modifyImageTags");
\r
194 String type = enmedia.attribute("type");
\r
195 if (type.startsWith("image/"))
\r
196 type = "."+type.substring(6);
\r
200 String resGuid = conn.getNoteTable().noteResourceTable.getNoteResourceGuidByHashHex(currentNoteGuid, hash.value());
\r
201 QFile tfile = new QFile(Global.getFileManager().getResDirPath(resGuid + type));
\r
202 // if (!tfile.exists()) {
\r
204 if (resGuid != null)
\r
205 r = conn.getNoteTable().noteResourceTable.getNoteResource(resGuid,true);
\r
206 if (r==null || r.getData() == null || r.getData().getBody().length == 0)
\r
207 resourceError = true;;
\r
208 if (r!= null && r.getData() != null && r.getData().getBody().length > 0) {
\r
209 tfile.open(new QIODevice.OpenMode(QIODevice.OpenModeFlag.WriteOnly));
\r
210 QByteArray binData = new QByteArray(r.getData().getBody());
\r
211 tfile.write(binData);
\r
214 // If we have recognition text, outline it
\r
215 addImageHilight(r.getGuid(), tfile);
\r
217 enmedia.setAttribute("src", QUrl.fromLocalFile(tfile.fileName()).toString());
\r
218 enmedia.setAttribute("en-tag", "en-media");
\r
219 enmedia.setNodeValue("");
\r
220 enmedia.setAttribute("guid", r.getGuid());
\r
221 enmedia.setTagName("img");
\r
224 // Technically, we should do a file:// to have a proper url, but for some reason QWebPage hates
\r
225 // them and won't generate a thumbnail image properly if we use them.
\r
226 // enmedia.setAttribute("src", QUrl.fromLocalFile(tfile.fileName()).toString());
\r
227 enmedia.setAttribute("src", tfile.fileName().toString());
\r
228 enmedia.setAttribute("en-tag", "en-media");
\r
229 enmedia.setAttribute("onContextMenu", "window.jambi.imageContextMenu('" +tfile.fileName() +"');");
\r
230 enmedia.setNodeValue("");
\r
231 enmedia.setAttribute("guid", resGuid);
\r
232 enmedia.setTagName("img");
\r
234 logger.log(logger.HIGH, "Leaving NeverNote.modifyImageTags");
\r
238 // Modify tags from Evernote specific things to XHTML tags.
\r
239 private QDomDocument modifyTags(QDomDocument doc) {
\r
240 logger.log(logger.HIGH, "Entering NeverNote.modifyTags");
\r
241 if (tempFiles == null)
\r
242 tempFiles = new ArrayList<QTemporaryFile>();
\r
244 QDomElement docElem = doc.documentElement();
\r
246 // Modify en-media tags
\r
247 QDomNodeList anchors = docElem.elementsByTagName("en-media");
\r
248 int enMediaCount = anchors.length();
\r
249 for (int i=enMediaCount-1; i>=0; i--) {
\r
250 QDomElement enmedia = anchors.at(i).toElement();
\r
251 if (enmedia.hasAttribute("type")) {
\r
252 QDomAttr attr = enmedia.attributeNode("type");
\r
253 QDomAttr hash = enmedia.attributeNode("hash");
\r
254 String[] type = attr.nodeValue().split("/");
\r
255 String appl = type[1];
\r
257 if (type[0] != null) {
\r
258 if (type[0].equals("image")) {
\r
259 modifyImageTags(docElem, enmedia, hash);
\r
261 if (!type[0].equals("image")) {
\r
262 modifyApplicationTags(doc, docElem, enmedia, hash, appl);
\r
268 // Modify todo tags
\r
269 anchors = docElem.elementsByTagName("en-todo");
\r
270 int enTodoCount = anchors.length();
\r
271 for (int i=enTodoCount-1; i>=0; i--) {
\r
272 QDomElement enmedia = anchors.at(i).toElement();
\r
273 modifyTodoTags(enmedia);
\r
276 // Modify en-crypt tags
\r
277 anchors = docElem.elementsByTagName("en-crypt");
\r
278 int enCryptLen = anchors.length();
\r
279 for (int i=enCryptLen-1; i>=0; i--) {
\r
280 QDomElement enmedia = anchors.at(i).toElement();
\r
281 enmedia.setAttribute("contentEditable","false");
\r
282 enmedia.setAttribute("src", Global.getFileManager().getImageDirPath("encrypt.png"));
\r
283 enmedia.setAttribute("en-tag","en-crypt");
\r
284 enmedia.setAttribute("alt", enmedia.text());
\r
285 Global.cryptCounter++;
\r
286 enmedia.setAttribute("id", "crypt"+Global.cryptCounter.toString());
\r
287 String encryptedText = enmedia.text();
\r
289 // If the encryption string contains crlf at the end, remove them because they mess up the javascript.
\r
290 if (encryptedText.endsWith("\n"))
\r
291 encryptedText = encryptedText.substring(0,encryptedText.length()-1);
\r
292 if (encryptedText.endsWith("\r"))
\r
293 encryptedText = encryptedText.substring(0,encryptedText.length()-1);
\r
295 // Add the commands
\r
296 String hint = enmedia.attribute("hint");
\r
297 hint = hint.replace("'","'");
\r
298 enmedia.setAttribute("onClick", "window.jambi.decryptText('crypt"+Global.cryptCounter.toString()+"', '"+encryptedText+"', '"+hint+"');");
\r
299 enmedia.setAttribute("onMouseOver", "style.cursor='hand'");
\r
300 enmedia.setTagName("img");
\r
301 enmedia.removeChild(enmedia.firstChild()); // Remove the actual encrypted text
\r
305 // Modify link tags
\r
306 anchors = docElem.elementsByTagName("a");
\r
307 enCryptLen = anchors.length();
\r
308 for (int i=0; i<anchors.length(); i++) {
\r
309 QDomElement element = anchors.at(i).toElement();
\r
310 element.setAttribute("title", element.attribute("href"));
\r
313 logger.log(logger.HIGH, "Leaving NeverNote.modifyTags");
\r
318 // Get an ink note image. If an image doesn't exist then we fall back
\r
319 // to the old ugly icon
\r
320 private boolean buildInkNote(QDomDocument doc, QDomElement docElem, QDomElement enmedia, QDomAttr hash, String appl) {
\r
321 String resGuid = conn.getNoteTable().noteResourceTable.getNoteResourceGuidByHashHex(currentNote.getGuid(), hash.value());
\r
322 Resource r = conn.getNoteTable().noteResourceTable.getNoteResource(resGuid, false);
\r
324 // If we can't find the resource, then fall back to the old method. We'll return & show
\r
326 if (r == null || r.getData() == null)
\r
329 // If there isn't some type of error, continue on.
\r
330 if (!resourceError) {
\r
332 // Get a list of images in the database. We'll use these to bulid the page.
\r
333 List<QByteArray> data = conn.getInkImagesTable().getImage(r.getGuid());
\r
335 // If no pictures are found, go back to & just show the icon
\r
336 if (data.size() == 0)
\r
339 // We have pictures, so append them to the page. This really isn't proper since
\r
340 // we leave the en-media tag in place, but since we can't edit the page it doesn't
\r
342 for (int i=0; i<data.size(); i++) {
\r
343 QFile f = new QFile(Global.getFileManager().getResDirPath(resGuid + new Integer(i).toString()+".png"));
\r
344 f.open(OpenModeFlag.WriteOnly);
\r
345 f.write(data.get(i));
\r
347 QDomElement newImage = doc.createElement("img");
\r
348 newImage.setAttribute("src", QUrl.fromLocalFile(f.fileName()).toString());
\r
349 enmedia.appendChild(newImage);
\r
357 // Modify the en-media tag into an attachment
\r
358 private void modifyApplicationTags(QDomDocument doc, QDomElement docElem, QDomElement enmedia, QDomAttr hash, String appl) {
\r
359 logger.log(logger.HIGH, "Entering NeverNote.modifyApplicationTags");
\r
360 if (appl.equalsIgnoreCase("vnd.evernote.ink")) {
\r
362 if (buildInkNote(doc, docElem, enmedia, hash, appl))
\r
365 String resGuid = conn.getNoteTable().noteResourceTable.getNoteResourceGuidByHashHex(currentNote.getGuid(), hash.value());
\r
366 Resource r = conn.getNoteTable().noteResourceTable.getNoteResource(resGuid, false);
\r
367 if (r == null || r.getData() == null)
\r
368 resourceError = true;
\r
370 if (r.getData()!=null) {
\r
371 // Did we get a generic applicaiton? Then look at the file name to
\r
372 // try and find a good application type for the icon
\r
373 if (appl.equalsIgnoreCase("octet-stream")) {
\r
374 if (r.getAttributes() != null && r.getAttributes().getFileName() != null) {
\r
375 String fn = r.getAttributes().getFileName();
\r
376 int pos = fn.lastIndexOf(".");
\r
378 appl = fn.substring(pos+1);
\r
383 String fileDetails = null;
\r
384 if (r.getAttributes() != null && r.getAttributes().getFileName() != null && !r.getAttributes().getFileName().equals(""))
\r
385 fileDetails = r.getAttributes().getFileName();
\r
386 String contextFileName;
\r
387 FileManager fileManager = Global.getFileManager();
\r
388 if (fileDetails != null && !fileDetails.equals("")) {
\r
389 if (!noteHistory) {
\r
390 enmedia.setAttribute("href", "nnres://" +r.getGuid()
\r
391 +Global.attachmentNameDelimeter +fileDetails);
\r
392 contextFileName = fileManager.getResDirPath(r.getGuid()
\r
393 +Global.attachmentNameDelimeter + fileDetails);
\r
395 enmedia.setAttribute("href", "nnres://" +r.getGuid() + currentNote.getUpdateSequenceNum()
\r
396 +Global.attachmentNameDelimeter +fileDetails);
\r
397 contextFileName = fileManager.getResDirPath(r.getGuid() + currentNote.getUpdateSequenceNum()
\r
398 +Global.attachmentNameDelimeter + fileDetails);
\r
401 if (!noteHistory) {
\r
402 enmedia.setAttribute("href", "nnres://" +r.getGuid() +currentNote.getUpdateSequenceNum()
\r
403 +Global.attachmentNameDelimeter +appl);
\r
404 contextFileName = fileManager.getResDirPath(r.getGuid() +currentNote.getUpdateSequenceNum()
\r
405 +Global.attachmentNameDelimeter + appl);
\r
407 enmedia.setAttribute("href", "nnres://" +r.getGuid()
\r
408 +Global.attachmentNameDelimeter +appl);
\r
409 contextFileName = fileManager.getResDirPath(r.getGuid()
\r
410 +Global.attachmentNameDelimeter + appl);
\r
413 contextFileName = contextFileName.replace("\\", "/");
\r
414 enmedia.setAttribute("onContextMenu", "window.jambi.resourceContextMenu('" +contextFileName +"');");
\r
415 if (fileDetails == null || fileDetails.equals(""))
\r
417 enmedia.setAttribute("en-tag", "en-media");
\r
418 enmedia.setAttribute("guid", r.getGuid());
\r
419 enmedia.setTagName("a");
\r
420 QDomElement newText = doc.createElement("img");
\r
421 boolean goodPreview = false;
\r
422 String filePath = "";
\r
423 if (appl.equalsIgnoreCase("pdf") && pdfPreview) {
\r
425 Resource res = conn.getNoteTable().noteResourceTable.getNoteResource(r.getGuid(), true);
\r
426 if (res.getAttributes() != null &&
\r
427 res.getAttributes().getFileName() != null &&
\r
428 !res.getAttributes().getFileName().trim().equals(""))
\r
429 fileName = res.getGuid()+Global.attachmentNameDelimeter+res.getAttributes().getFileName();
\r
431 fileName = res.getGuid()+".pdf";
\r
432 QFile file = new QFile(fileManager.getResDirPath(fileName));
\r
433 QFile.OpenMode mode = new QFile.OpenMode();
\r
434 mode.set(QFile.OpenModeFlag.WriteOnly);
\r
436 QDataStream out = new QDataStream(file);
\r
437 Resource resBinary = conn.getNoteTable().noteResourceTable.getNoteResource(res.getGuid(), true);
\r
438 QByteArray binData = new QByteArray(resBinary.getData().getBody());
\r
440 out.writeBytes(binData.toByteArray());
\r
442 PDFPreview pdfPreview = new PDFPreview();
\r
443 goodPreview = pdfPreview.setupPreview(file.fileName(), appl,0);
\r
445 QDomElement span = doc.createElement("span");
\r
446 QDomElement table = doc.createElement("table");
\r
447 span.setAttribute("pdfNavigationTable", "true");
\r
448 QDomElement tr = doc.createElement("tr");
\r
449 QDomElement td = doc.createElement("td");
\r
450 QDomElement left = doc.createElement("img");
\r
451 left.setAttribute("onMouseDown", "window.jambi.nextPage('" +file.fileName() +"')");
\r
452 left.setAttribute("onMouseDown", "window.jambi.nextPage('" +file.fileName() +"')");
\r
453 left.setAttribute("onMouseOver", "style.cursor='hand'");
\r
454 QDomElement right = doc.createElement("img");
\r
455 right.setAttribute("onMouseDown", "window.jambi.nextPage('" +file.fileName() +"')");
\r
456 left.setAttribute("onMouseDown", "window.jambi.previousPage('" +file.fileName() +"')");
\r
457 // NFC TODO: should these be file:// URLs?
\r
458 left.setAttribute("src", Global.getFileManager().getImageDirPath("small_left.png"));
\r
459 right.setAttribute("src", Global.getFileManager().getImageDirPath("small_right.png"));
\r
460 right.setAttribute("onMouseOver", "style.cursor='hand'");
\r
462 table.appendChild(tr);
\r
463 tr.appendChild(td);
\r
464 td.appendChild(left);
\r
465 td.appendChild(right);
\r
466 span.appendChild(table);
\r
467 enmedia.parentNode().insertBefore(span, enmedia);
\r
469 filePath = fileName+".png";
\r
471 String icon = findIcon(appl);
\r
472 if (icon.equals("attachment.png"))
\r
473 icon = findIcon(fileDetails.substring(fileDetails.indexOf(".")+1));
\r
474 // NFC TODO: should this be a 'file://' URL?
\r
475 newText.setAttribute("src", Global.getFileManager().getImageDirPath(icon));
\r
477 // NFC TODO: should this be a 'file://' URL?
\r
478 newText.setAttribute("src", fileManager.getResDirPath(filePath));
\r
479 newText.setAttribute("style", "border-style:solid; border-color:green; padding:0.5mm 0.5mm 0.5mm 0.5mm;");
\r
481 newText.setAttribute("title", fileDetails);
\r
482 enmedia.removeChild(enmedia.firstChild());
\r
484 enmedia.appendChild(newText);
\r
487 logger.log(logger.HIGH, "Leaving NeverNote.modifyApplicationTags");
\r
489 // Modify the en-to tag into an input field
\r
490 private void modifyTodoTags(QDomElement todo) {
\r
491 logger.log(logger.HIGH, "Entering NeverNote.modifyTodoTags");
\r
492 todo.setAttribute("type", "checkbox");
\r
493 String checked = todo.attribute("checked");
\r
494 todo.removeAttribute("checked");
\r
495 if (checked.equalsIgnoreCase("true"))
\r
496 todo.setAttribute("checked", "");
\r
498 todo.setAttribute("unchecked","");
\r
499 todo.setAttribute("value", checked);
\r
500 todo.setAttribute("onClick", "value=checked;window.jambi.contentChanged(); ");
\r
501 todo.setTagName("input");
\r
502 logger.log(logger.HIGH, "Leaving NeverNote.modifyTodoTags");
\r
507 // Modify any cached todo tags that may have changed
\r
508 public String modifyCachedTodoTags(String note) {
\r
509 logger.log(logger.HIGH, "Entering NeverNote.modifyCachedTodoTags");
\r
510 StringBuffer html = new StringBuffer(note);
\r
511 for (int i=html.indexOf("<input", 0); i>-1; i=html.indexOf("<input", i)) {
\r
512 int endPos =html.indexOf(">",i+1);
\r
513 String input = html.substring(i,endPos);
\r
514 if (input.indexOf("value=\"true\"") > 0)
\r
515 input = input.replace(" unchecked=\"\"", " checked=\"\"");
\r
517 input = input.replace(" checked=\"\"", " unchecked=\"\"");
\r
518 html.replace(i, endPos, input);
\r
521 logger.log(logger.HIGH, "Leaving NeverNote.modifyCachedTodoTags");
\r
522 return html.toString();
\r
528 // Scan and do hilighting of words
\r
529 public QDomDocument addHilight(QDomDocument doc) {
\r
530 // EnSearch e = listManager.getEnSearch();
\r
531 if (enSearch.hilightWords == null || enSearch.hilightWords.size() == 0)
\r
533 XMLInsertHilight hilight = new XMLInsertHilight(doc, enSearch.hilightWords);
\r
534 return hilight.getDoc();
\r
538 // find the appropriate icon for an attachment
\r
539 private String findIcon(String appl) {
\r
540 logger.log(logger.HIGH, "Entering NeverNote.findIcon");
\r
541 appl = appl.toLowerCase();
\r
542 String relativePath = appl + ".png";
\r
543 File f = Global.getFileManager().getImageDirFile(relativePath);
\r
545 return relativePath;
\r
548 return appl+".png";
\r
549 logger.log(logger.HIGH, "Leaving NeverNote.findIcon");
\r
550 return "attachment.png";
\r