// Do the local deletes\r
logger.log(logger.EXTREME, "Doing local deletes");\r
List<String> guid = chunk.getExpungedNotes();\r
- if (guid != null) \r
+ if (guid != null) {\r
for (int i=0; i<guid.size() && keepRunning; i++) {\r
- logger.log(logger.EXTREME, "Expunging local note from database");\r
- conn.getNoteTable().expungeNote(guid.get(i), true, false);\r
+ String notebookGuid = "";\r
+ Note localNote = conn.getNoteTable().getNote(guid.get(i), false, false, false, false, false);\r
+ if (localNote != null) {\r
+ conn.getNoteTable().updateNoteSequence(guid.get(i), 0);\r
+ notebookGuid = localNote.getNotebookGuid();\r
+ }\r
+ if (!conn.getNotebookTable().isNotebookLocal(notebookGuid)) {\r
+ logger.log(logger.EXTREME, "Expunging local note from database");\r
+ conn.getNoteTable().expungeNote(guid.get(i), true, false);\r
+ }\r
}\r
+ }\r
guid = chunk.getExpungedNotebooks();\r
if (guid != null)\r
for (int i=0; i<guid.size() && keepRunning; i++) {\r