From: Randy Baumgarte Date: Sun, 22 Aug 2010 11:15:14 +0000 (-0400) Subject: Alter sync logic to examine new notes as they arrive rather than doing a full reload... X-Git-Tag: version0.1.1~400 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=cb2b9e43c59e40558259d8179bb6c68a432d8a94;p=neighbornote%2FNeighborNote.git Alter sync logic to examine new notes as they arrive rather than doing a full reload after a sync completes. This should improve performance. --- diff --git a/src/cx/fbn/nevernote/NeverNote.java b/src/cx/fbn/nevernote/NeverNote.java index 6b8615c..279e92b 100644 --- a/src/cx/fbn/nevernote/NeverNote.java +++ b/src/cx/fbn/nevernote/NeverNote.java @@ -803,15 +803,14 @@ public class NeverNote extends QMainWindow{ syncRunner.noteIndexSignal.listChanged.connect(this, "noteIndexUpdated(boolean)"); syncRunner.noteSignal.quotaChanged.connect(this, "updateQuotaBar()"); -// syncRunner.syncSignal.setSequenceDate.connect(this,"setSequenceDate(long)"); syncRunner.syncSignal.saveUploadAmount.connect(this,"saveUploadAmount(long)"); -// syncRunner.syncSignal.setUpdateSequenceNumber.connect(this,"setUpdateSequenceNumber(int)"); syncRunner.syncSignal.saveUserInformation.connect(this,"saveUserInformation(User)"); syncRunner.syncSignal.saveEvernoteUpdateCount.connect(this,"saveEvernoteUpdateCount(int)"); syncRunner.noteSignal.guidChanged.connect(this, "noteGuidChanged(String, String)"); syncRunner.noteSignal.noteChanged.connect(this, "invalidateNoteCache(String, String)"); syncRunner.resourceSignal.resourceGuidChanged.connect(this, "noteResourceGuidChanged(String,String,String)"); + syncRunner.noteSignal.noteDownloaded.connect(listManager, "noteDownloaded(Note)"); syncRunner.syncSignal.refreshLists.connect(this, "refreshLists()"); } @@ -2908,8 +2907,9 @@ public class NeverNote extends QMainWindow{ return; } - // If tihs wasn't already marked as unsynchronized, then we need to update the table - listManager.getUnsynchronizedNotes().add(currentNoteGuid); + // If this wasn't already marked as unsynchronized, then we need to update the table + listManager.getNoteTableModel().updateNoteSyncStatus(currentNoteGuid, false); +/* listManager.getUnsynchronizedNotes().add(currentNoteGuid); for (int i=0; i()); + newNote.setTagNames(new ArrayList()); + // If new notes are to be created based upon the selected tags, then we need to assign the tags if (Global.newNoteWithSelectedTags()) { - newNote.setTagGuids(new ArrayList()); - newNote.setTagNames(new ArrayList()); List selections = tagTree.selectedItems(); QTreeWidgetItem currentSelection; for (int i=0; i noteAdded = new Signal1(); public Signal2 guidChanged = new Signal2(); public Signal1 titleColorChanged = new Signal1(); + public Signal2 noteDownloaded = new Signal2(); } diff --git a/src/cx/fbn/nevernote/threads/SyncRunner.java b/src/cx/fbn/nevernote/threads/SyncRunner.java index 5ed5137..9b21fc1 100644 --- a/src/cx/fbn/nevernote/threads/SyncRunner.java +++ b/src/cx/fbn/nevernote/threads/SyncRunner.java @@ -488,9 +488,6 @@ public class SyncRunner extends QObject implements Runnable { logger.log(logger.EXTREME, "Active dirty note found - non new"); if (enNote.getUpdateSequenceNum() > 0) { enNote = getNoteContent(enNote); - System.out.println("--------"); - System.out.println("Note:" +enNote); - System.out.println("--------"); logger.log(logger.MEDIUM, "Updating note : "+ enNote.getGuid() +" " +enNote.getTitle()+""); enNote = noteStore.updateNote(authToken, enNote); } else { @@ -1043,6 +1040,7 @@ public class SyncRunner extends QObject implements Runnable { logger.log(logger.EXTREME, "Saving Note"); conn.getNoteTable().syncNote(n, false); noteSignal.noteChanged.emit(n.getGuid(), null); // Signal to ivalidate note cache + noteSignal.noteDownloaded.emit(n, true); // Signal to add note to index logger.log(logger.EXTREME, "Note Saved"); if (fullSync && n.getResources() != null) { for (int q=0; q index = new ArrayList(); - List matches; if (enSearchChanged || getMasterNoteIndex() == null) matches = enSearch.matchWords(); @@ -820,65 +900,14 @@ public class ListManager { if (matches == null) matches = getMasterNoteIndex(); + setNoteIndex(new ArrayList()); for (int i=0; i