Package cx.fbn.nevernote.xml

Examples of cx.fbn.nevernote.xml.NoteFormatter


  private void generateThumbnail() {
    QByteArray js = new QByteArray();
    logger.log(logger.HIGH, "Starting thumbnail for " +guid);
    ArrayList<QTemporaryFile> tempFiles = new ArrayList<QTemporaryFile>();
    Note currentNote = conn.getNoteTable().getNote(guid,true,true,false,true,false);
    NoteFormatter formatter = new NoteFormatter(logger, conn, tempFiles);
    currentNote = conn.getNoteTable().getNote(guid, true, true, false, true, false);
    formatter.setNote(currentNote, true);
    formatter.setHighlight(null);
    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 { max-width:100%; }</style>");
    js.append("<style type=\"text/css\">en-spell { text-decoration: none; border-bottom: dotted 1px #cc0000; }</style>");
    js.append("</head>");
    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'?>", "");
    int zoom = 1;
View Full Code Here


    }
    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))
View Full Code Here

  }
 
  public void setContent(Note currentNote) {
   
   
    NoteFormatter formatter = new NoteFormatter(logger, conn, tempFiles);
    formatter.setNote(currentNote, false);
    formatter.setHighlight(null);
    formatter.setNoteHistory(true);
   
    StringBuffer js = new StringBuffer();
   
    // 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-style:solid; border-color:blue; padding:1mm 1mm 1mm 1mm; }</style>");
    js.append("</head>");
    js.append(formatter.rebuildNoteHTML());
    js.append("</HTML>");
   
    browser.setNote(currentNote);
    browser.getBrowser().page().mainFrame().setHtml(js.toString());
  }
View Full Code Here

  }
 
 
  // Load the content of the note into the viewing window.
  public void setContent(Note currentNote) { 
    NoteFormatter formatter = new NoteFormatter(logger, conn, tempFiles);
    formatter.setNote(currentNote, false);
    formatter.setHighlight(null);
    formatter.setNoteHistory(true);
   
    StringBuffer js = new StringBuffer();
   
    // 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-style:solid; border-color:blue; padding:1mm 1mm 1mm 1mm; }</style>");
    js.append("</head>");
    js.append(formatter.rebuildNoteHTML());
    js.append("</HTML>");
   
    browser.setNote(currentNote);
    browser.setContent(new QByteArray(js.toString()));
  }
View Full Code Here

TOP

Related Classes of cx.fbn.nevernote.xml.NoteFormatter

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.