Package com.evernote.edam.type

Examples of com.evernote.edam.type.Note


      clearSavedSearchFilter();
     
      String tempGuid = currentNoteGuid;
     
//      currentNoteGuid = "";
      currentNote = new Note();
      selectedNoteGUIDs.clear();
      listManager.getSelectedNotebooks().clear();
      listManager.getSelectedTags().clear();
      listManager.setSelectedSavedSearch("");
      browserWindow.clear();
View Full Code Here


     
      if (externalWindows.containsKey(guid)) {
        externalWindows.get(guid).raise();
        return;
      }
      Note note = conn.getNoteTable().getNote(guid, true, true, false, true, true);
      // We have a new external editor to create
      QIcon appIcon = new QIcon(iconPath+"nevernote.png");
      ExternalBrowse newBrowser = new ExternalBrowse(conn);
      newBrowser.setWindowIcon(appIcon);
      externalWindows.put(guid, newBrowser);
View Full Code Here

    
          if (notebook==null)
            notebook = listManager.getNotebookIndex().get(0).getGuid();       
      }
     
      Note newNote = new Note();
      newNote.setUpdateSequenceNum(0);
      newNote.setGuid(randint);
      newNote.setNotebookGuid(notebook);
      newNote.setTitle("Untitled Note");
      newNote.setContent(noteString.toString());
      newNote.setDeleted(0);
      newNote.setCreated(System.currentTimeMillis());
      newNote.setUpdated(System.currentTimeMillis());
      newNote.setActive(true);
      NoteAttributes na = new NoteAttributes();
      na.setLatitude(0.0);
      na.setLongitude(0.0);
      na.setAltitude(0.0);
      newNote.setAttributes(new NoteAttributes());
    newNote.setTagGuids(new ArrayList<String>());
    newNote.setTagNames(new ArrayList<String>());
     
      // If new notes are to be created based upon the selected tags, then we need to assign the tags
      if (Global.newNoteWithSelectedTags()) { 
        List<QTreeWidgetItem> selections = tagTree.selectedItems();
          QTreeWidgetItem currentSelection;
          for (int i=0; i<selections.size(); i++) {
            currentSelection = selections.get(i);
            newNote.getTagGuids().add(currentSelection.text(2));
            newNote.getTagNames().add(currentSelection.text(0));
          }
      }
     
      conn.getNoteTable().addNote(newNote, true);
      NoteMetadata metadata = new NoteMetadata();
      metadata.setGuid(newNote.getGuid());
      metadata.setDirty(true);
      listManager.addNote(newNote, metadata);
//      noteTableView.insertRow(newNote, true, -1);
     
      currentNote = newNote;
View Full Code Here

       browser.spellCheckAction.setVisible(Global.isEditorButtonVisible("spellCheck"));
       browser.todoAction.setVisible(Global.isEditorButtonVisible("todo"));
    }
    private void duplicateNote(String guid) {
   
    Note oldNote = conn.getNoteTable().getNote(guid, true, false,false,false,true);
    List<Resource> resList = conn.getNoteTable().noteResourceTable.getNoteResources(guid, true);
    oldNote.setContent(conn.getNoteTable().getNoteContentNoUTFConversion(guid));
    oldNote.setResources(resList);
    duplicateNote(oldNote);
  }
View Full Code Here

    Calendar currentTime = new GregorianCalendar();
    Long l = new Long(currentTime.getTimeInMillis());
    String newGuid = new String(Long.toString(l));
         
//    Note newNote = oldNote.deepCopy();
    Note newNote = (Note)Global.deepCopy(oldNote);
    newNote.setUpdateSequenceNum(0);
    newNote.setGuid(newGuid);
    newNote.setDeleted(0);
    newNote.setActive(true);
   
    /*
    List<String> tagNames = new ArrayList<String>();
    List<String> tagGuids = new ArrayList<String>();;
    for (int i=0; i<oldNote.getTagGuidsSize(); i++) {
      tagNames.add(oldNote.getTagNames().get(i));
      tagGuids.add(oldNote.getTagGuids().get(i));
    }

    // Sort note Tags to make them look nice
    for (int i=0; i<tagNames.size()-1; i++) {
      if (tagNames.get(i).compareTo(tagNames.get(i+1))<0) {
        String n1 = tagNames.get(i);
        String n2 = tagNames.get(i+1);
        tagNames.set(i, n2);
        tagNames.set(i+1, n1);
      }
    }
    newNote.setTagGuids(tagGuids);
    newNote.setTagNames(tagNames);
   
    // Add tag guids to note
    */
   
    // Duplicate resources
    List<Resource> resList = oldNote.getResources();
    if (resList == null)
      resList = new ArrayList<Resource>();
    long prevGuid = 0;
    for (int i=0; i<resList.size(); i++) {
      l = prevGuid;
      while (l == prevGuid) {
        currentTime = new GregorianCalendar();
        l = new Long(currentTime.getTimeInMillis());
      }
      prevGuid = l;
      String newResGuid = new String(Long.toString(l));
      resList.get(i).setNoteGuid(newGuid);
      resList.get(i).setGuid(newResGuid);
      resList.get(i).setUpdateSequenceNum(0);
      resList.get(i).setActive(true);
      conn.getNoteTable().noteResourceTable.saveNoteResource(
          (Resource)Global.deepCopy(resList.get(i)), true);
    }
    newNote.setResources(resList);
   
    // Add note to the database
    conn.getNoteTable().addNote(newNote, true);
    NoteMetadata metaData = new NoteMetadata();
    NoteMetadata oldMeta = listManager.getNoteMetadata().get(oldNote.getGuid());
    metaData.copy(oldMeta);
    metaData.setGuid(newNote.getGuid());
    listManager.addNote(newNote, metaData);
    noteTableView.insertRow(newNote, metaData, true, -1);
    currentNoteGuid = newNote.getGuid();
    currentNote = newNote;
    refreshEvernoteNote(true);
    listManager.countNotebookResults(listManager.getNoteIndex());
    waitCursor(false);
  }
View Full Code Here

    noteIndexUpdated(false);
    refreshEvernoteNote(true);
    waitCursor(false);
  }
  private void mergeNoteContents(String targetGuid, List<String> sources) {
    Note target = conn.getNoteTable().getNote(targetGuid, true, false, false, false, false);
    String newContent = target.getContent();
    newContent = newContent.replace("</en-note>", "<br></br>");
   
    for (int i=0; i<sources.size(); i++) {
      Note source = conn.getNoteTable().getNote(sources.get(i), true, true, false, false, false);
      if (source.isSetTitle()) {
        newContent = newContent +("<table bgcolor=\"lightgrey\"><tr><td><font size=\"6\"><b>" +source.getTitle() +"</b></font></td></tr></table>");
      }
      String sourceContent = source.getContent();
      logger.log(logger.EXTREME, "Merging contents into note");
      logger.log(logger.EXTREME, sourceContent);
      logger.log(logger.EXTREME, "End of content");
      int startOfNote = sourceContent.indexOf("<en-note>");
      sourceContent = sourceContent.substring(startOfNote+9);
      int endOfNote = sourceContent.indexOf("</en-note>");
      sourceContent = sourceContent.substring(0,endOfNote);
      newContent = newContent + sourceContent;
      logger.log(logger.EXTREME, "New note content");
      logger.log(logger.EXTREME, newContent);
      logger.log(logger.EXTREME, "End of content");
      for (int j=0; j<source.getResourcesSize(); j++) {
        logger.log(logger.EXTREME, "Reassigning resource: "+source.getResources().get(j).getGuid());
        Resource r = source.getResources().get(j);
        Resource newRes = conn.getNoteTable().noteResourceTable.getNoteResource(r.getGuid(), true);
       
        Calendar currentTime = new GregorianCalendar();
        Long l = new Long(currentTime.getTimeInMillis());
             
View Full Code Here

      l=currentTime.getTimeInMillis();
    }
   
    String randint = new String(Long.toString(l));
   
      newNote = new Note();
      newNote.setUpdateSequenceNum(0);
      newNote.setGuid(randint);
      newNote.setTitle(fileName);
      newNote.setContent(baseNote);
      newNote.setDeleted(0);
View Full Code Here

 
  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;
    if (currentNote != null && currentNote.getContent() != null) {
      String content = currentNote.getContent();
      zoom = Global.calculateThumbnailZoom(content);
    }
    logger.log(logger.HIGH, "Thumbnail file ready");
    noteSignal.thumbnailPageReady.emit(guid, js, zoom);
  }
View Full Code Here

     
      QByteArray d = data.data("application/x-nevernote-note");
      String s = d.toString();
      String noteGuidArray[] = s.split(" ");
      for (String element : noteGuidArray) {
        Note n = db.getNoteTable().getNote(element.trim(), false, false, false, false, true);
       
        // We  need to be sure that...
        // 1.) We are not dropping onto the "All Notebooks" stack
        // 2.) We are not dropping onto a stack
        // 3.) We are actually dropping onto a different notebook.
        if (!parent.text(2).equalsIgnoreCase("") &&
            !parent.text(2).equalsIgnoreCase(tr("STACK")) &&
            !(n.getNotebookGuid().equalsIgnoreCase(parent.text(2))
          )) {
          noteSignal.notebookChanged.emit(element.trim(), parent.text(2));
          if (db.getNotebookTable().isLinked(parent.text(2))) {
            noteSignal.tagsChanged.emit(element.trim(), new ArrayList<String>());
          }
View Full Code Here

      return;
      }
     
      setMessage(tr("Getting Note History"));
      waitCursor(true);
      Note currentOnlineNote = null;
      versions = null;
      try {
        if (Global.isPremium())
          versions = syncRunner.localNoteStore.listNoteVersions(syncRunner.authToken, currentNoteGuid);
        else
          versions = new ArrayList<NoteVersionId>();
        currentOnlineNote = syncRunner.localNoteStore.getNote(syncRunner.authToken, currentNoteGuid, true, true, false, false);
    } catch (EDAMUserException e) {
      setMessage("EDAMUserException: " +e.getMessage());
      return;
    } catch (EDAMSystemException e) {
      setMessage("EDAMSystemException: " +e.getMessage());
      return;
    } catch (EDAMNotFoundException e) {
      setMessage(tr("Note not found on server."));
      QMessageBox.information(this, tr("Error"), tr("This note could not be found on Evernote's servers."));
      return;
    } catch (TException e) {
      setMessage("EDAMTransactionException: " +e.getMessage());
      return;
    }
   
    // If we've gotten this far, we have a good note.
    if (historyWindow == null) {
      historyWindow = new OnlineNoteHistory(logger, conn);
      historyWindow.historyCombo.activated.connect(this, "reloadHistoryWindow(String)");
      historyWindow.restoreAsNew.clicked.connect(this, "restoreHistoryNoteAsNew()");
      historyWindow.restore.clicked.connect(this, "restoreHistoryNote()");
    } else {
      historyWindow.historyCombo.clear();
    }
    boolean isDirty = conn.getNoteTable().isNoteDirty(currentNoteGuid);
    if (currentNote.getUpdateSequenceNum() != currentOnlineNote.getUpdateSequenceNum())
      isDirty = true;
    historyWindow.setCurrent(isDirty);
   
    loadHistoryWindowContent(currentOnlineNote);
    historyWindow.load(versions);
View Full Code Here

TOP

Related Classes of com.evernote.edam.type.Note

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.