import com.trolltech.qt.gui.QHBoxLayout;
import com.trolltech.qt.gui.QIcon;
import com.trolltech.qt.gui.QImage;
+import com.trolltech.qt.gui.QKeySequence;
import com.trolltech.qt.gui.QLabel;
import com.trolltech.qt.gui.QMainWindow;
import com.trolltech.qt.gui.QMenu;
import com.trolltech.qt.gui.QPixmap;
import com.trolltech.qt.gui.QPrintDialog;
import com.trolltech.qt.gui.QPrinter;
+import com.trolltech.qt.gui.QShortcut;
import com.trolltech.qt.gui.QSizePolicy;
import com.trolltech.qt.gui.QSizePolicy.Policy;
import com.trolltech.qt.gui.QSpinBox;
public BrowserWindow browserWindow; // Window containing browser & labels
public QToolBar toolBar; // The tool bar under the menu
QComboBox searchField; // search filter bar on the toolbar;
+ QShortcut searchShortcut; // Shortcut to search bar
boolean searchPerformed = false; // Search was done?
QuotaProgressBar quotaBar; // The current quota usage
searchField.activatedIndex.connect(this, "searchFieldChanged()");
searchField.setDuplicatesEnabled(false);
searchField.editTextChanged.connect(this,"searchFieldTextChanged(String)");
+ searchShortcut = new QShortcut(this);
+ setupShortcut(searchShortcut, "Focus_Search");
+ searchShortcut.activated.connect(this, "focusSearch()");
quotaBar = new QuotaProgressBar();
browser.resourceSignal.contentChanged.connect(this, "externalFileEdited(String)");
}
+ //**************************************************
+ //* Setup shortcuts
+ //**************************************************
+ private void setupShortcut(QShortcut action, String text) {
+ if (!Global.shortcutKeys.containsAction(text))
+ return;
+ action.setKey(new QKeySequence(Global.shortcutKeys.getShortcut(text)));
+ }
+
//***************************************************************
//***************************************************************
//* Settings and look & feel
//***************************************************************
//** These functions deal with the Toolbar
//***************************************************************
- //***************************************************************
+ //***************************************************************
+ @SuppressWarnings("unused")
+ private void focusSearch() {
+ searchField.setFocus();
+ }
+
// Text in the search bar has been cleared
private void searchFieldCleared() {
saveNote();
menuBar.noteTags.setEnabled(!readOnly);
browser.setNote(currentNote);
- if (conn.getNotebookTable().isLinked(currentNote.getNotebookGuid())) {
+ if (currentNote != null && currentNote.getNotebookGuid() != null &&
+ conn.getNotebookTable().isLinked(currentNote.getNotebookGuid())) {
deleteButton.setEnabled(false);
menuBar.notebookDeleteAction.setEnabled(false);
} else {
versions = null;
try {
if (Global.isPremium())
- versions = syncRunner.noteStore.listNoteVersions(syncRunner.authToken, currentNoteGuid);
+ versions = syncRunner.localNoteStore.listNoteVersions(syncRunner.authToken, currentNoteGuid);
else
versions = new ArrayList<NoteVersionId>();
- currentOnlineNote = syncRunner.noteStore.getNote(syncRunner.authToken, currentNoteGuid, true, true, false, false);
+ currentOnlineNote = syncRunner.localNoteStore.getNote(syncRunner.authToken, currentNoteGuid, true, true, false, false);
} catch (EDAMUserException e) {
setMessage("EDAMUserException: " +e.getMessage());
return;
try {
if (index > -1) {
usn = versions.get(index).getUpdateSequenceNum();
- historyNote = syncRunner.noteStore.getNoteVersion(syncRunner.authToken, currentNoteGuid, usn, true, true, true);
+ historyNote = syncRunner.localNoteStore.getNoteVersion(syncRunner.authToken, currentNoteGuid, usn, true, true, true);
} else
- historyNote = syncRunner.noteStore.getNote(syncRunner.authToken, currentNoteGuid, true,true,true,true);
+ historyNote = syncRunner.localNoteStore.getNote(syncRunner.authToken, currentNoteGuid, true,true,true,true);
} catch (EDAMUserException e) {
setMessage("EDAMUserException: " +e.getMessage());
waitCursor(false);
List<Tag> tags = null;
List<LinkedNotebook> linkedNotebooks = null;
try {
- notebooks = syncRunner.noteStore.listNotebooks(syncRunner.authToken);
- tags = syncRunner.noteStore.listTags(syncRunner.authToken);
- linkedNotebooks = syncRunner.noteStore.listLinkedNotebooks(syncRunner.authToken);
+ notebooks = syncRunner.localNoteStore.listNotebooks(syncRunner.authToken);
+ tags = syncRunner.localNoteStore.listTags(syncRunner.authToken);
+ linkedNotebooks = syncRunner.localNoteStore.listLinkedNotebooks(syncRunner.authToken);
} catch (EDAMUserException e) {
setMessage("EDAMUserException: " +e.getMessage());
return;
import com.evernote.edam.error.EDAMSystemException;\r
import com.evernote.edam.error.EDAMUserException;\r
import com.evernote.edam.notestore.NoteStore;\r
+import com.evernote.edam.notestore.NoteStore.Client;\r
import com.evernote.edam.notestore.SyncChunk;\r
import com.evernote.edam.notestore.SyncState;\r
import com.evernote.edam.type.Data;\r
+"/"+System.getProperty("java.vendor") + "/"\r
+ System.getProperty("java.version") +";";\r
\r
- public volatile NoteStore.Client noteStore;\r
+ public volatile NoteStore.Client localNoteStore;\r
private UserStore.Client userStore;\r
\r
public volatile StatusSignal status;\r
updateSequenceNumber = conn.getSyncTable().getUpdateSequenceNumber();\r
try {\r
logger.log(logger.EXTREME, "Beginning sync");\r
- evernoteSync();\r
+ evernoteSync(localNoteStore);\r
logger.log(logger.EXTREME, "Sync finished");\r
} catch (UnknownHostException e) {\r
status.message.emit(e.getMessage());\r
}\r
public void setNoteStore(NoteStore.Client c) {\r
logger.log(logger.EXTREME, "Setting NoteStore in sync thread");\r
- noteStore = c;\r
+ localNoteStore = c;\r
}\r
public void setUserStore(UserStore.Client c) {\r
logger.log(logger.EXTREME, "Setting UserStore in sync thread");\r
//***************************************************************\r
// Synchronize changes with Evernote\r
@SuppressWarnings("unused")\r
- private void evernoteSync() throws java.net.UnknownHostException {\r
+ private void evernoteSync(Client noteStore) throws java.net.UnknownHostException {\r
logger.log(logger.HIGH, "Entering SyncRunner.evernoteSync");\r
\r
// Rebuild list of tags & notebooks to ignore\r
String syncNotebooks = conn.getSyncTable().getRecord("FullNotebookSync");\r
String syncInkNoteImages = conn.getSyncTable().getRecord("FullInkNoteImageSync");\r
if (syncLinked != null) {\r
- downloadAllLinkedNotebooks();\r
+ downloadAllLinkedNotebooks(localNoteStore);\r
}\r
if (syncShared != null) {\r
- downloadAllSharedNotebooks();\r
+ downloadAllSharedNotebooks(localNoteStore);\r
}\r
if (syncNotebooks != null) {\r
- downloadAllNotebooks();\r
+ downloadAllNotebooks(localNoteStore);\r
}\r
\r
if (syncInkNoteImages != null) {\r
logger.log(logger.EXTREME, "Refresh needed is true");\r
refreshNeeded = true;\r
logger.log(logger.EXTREME, "Downloading changes");\r
- syncRemoteToLocal();\r
+ syncRemoteToLocal(localNoteStore);\r
}\r
\r
//*****************************************\r
logger.log(logger.EXTREME, "Uploading changes");\r
// Synchronize remote changes\r
if (!error)\r
- syncExpunged();\r
+ syncExpunged(localNoteStore);\r
if (!error)\r
- syncLocalTags();\r
+ syncLocalTags(localNoteStore);\r
if (!error)\r
- syncLocalNotebooks();\r
+ syncLocalNotebooks(localNoteStore);\r
if (!error)\r
- syncLocalLinkedNotebooks();\r
+ syncLocalLinkedNotebooks(localNoteStore);\r
if (!error) \r
- syncDeletedNotes();\r
+ syncDeletedNotes(localNoteStore);\r
if (!error)\r
syncLocalNotes();\r
if (!error)\r
- syncLocalSavedSearches();\r
+ syncLocalSavedSearches(localNoteStore);\r
}\r
\r
status.message.emit(tr("Cleaning up"));\r
}\r
\r
// Sync deleted items with Evernote\r
- private void syncExpunged() {\r
+ private void syncExpunged(Client noteStore) {\r
logger.log(logger.HIGH, "Entering SyncRunner.syncExpunged");\r
\r
List<DeletedItemRecord> expunged = conn.getDeletedTable().getAllDeleted();\r
boolean error = false;\r
for (int i=0; i<expunged.size() && keepRunning; i++) {\r
- \r
+\r
if (authRefreshNeeded)\r
if (!refreshConnection())\r
return;\r
if (expunged.get(i).type.equalsIgnoreCase("NOTE")) {\r
logger.log(logger.EXTREME, "Note expunged");\r
updateSequenceNumber = noteStore.deleteNote(authToken, expunged.get(i).guid);\r
+ refreshNeeded = true;\r
conn.getSyncTable().setUpdateSequenceNumber(updateSequenceNumber);\r
}\r
if (expunged.get(i).type.equalsIgnoreCase("SAVEDSEARCH")) {\r
logger.log(logger.HIGH, "Leaving SyncRunner.syncExpunged");\r
\r
}\r
- private void syncDeletedNotes() {\r
+ private void syncDeletedNotes(Client noteStore) {\r
if (syncDeletedContent)\r
return;\r
logger.log(logger.HIGH, "Entering SyncRunner.syncDeletedNotes");\r
List<Note> notes = conn.getNoteTable().getDirty();\r
// Sync the local notebooks with Evernote's\r
for (int i=0; i<notes.size() && keepRunning; i++) {\r
- syncLocalNote(notes.get(i), authToken);\r
+ syncLocalNote(localNoteStore, notes.get(i), authToken);\r
}\r
logger.log(logger.HIGH, "Entering SyncRunner.syncNotes");\r
\r
}\r
// Sync notes with Evernote\r
- private void syncLocalNote(Note enNote, String token) {\r
+ private void syncLocalNote(Client noteStore, Note enNote, String token) {\r
logger.log(logger.HIGH, "Entering SyncRunner.syncNotes");\r
status.message.emit(tr("Sending local notes."));\r
\r
}\r
\r
// Sync Notebooks with Evernote\r
- private void syncLocalNotebooks() {\r
+ private void syncLocalNotebooks(Client noteStore) {\r
logger.log(logger.HIGH, "Entering SyncRunner.syncLocalNotebooks");\r
\r
status.message.emit(tr("Sending local notebooks."));\r
\r
}\r
// Sync Tags with Evernote\r
- private void syncLocalTags() {\r
+ private void syncLocalTags(Client noteStore) {\r
logger.log(logger.HIGH, "Entering SyncRunner.syncLocalTags");\r
List<Tag> remoteList = new ArrayList<Tag>();\r
status.message.emit(tr("Sending local tags."));\r
}\r
logger.log(logger.HIGH, "Leaving SyncRunner.syncLocalTags");\r
}\r
- private void syncLocalLinkedNotebooks() {\r
+ private void syncLocalLinkedNotebooks(Client noteStore) {\r
logger.log(logger.HIGH, "Entering SyncRunner.syncLocalLinkedNotebooks");\r
\r
List<String> list = conn.getLinkedNotebookTable().getDirtyGuids();\r
logger.log(logger.HIGH, "Leaving SyncRunner.syncLocalLinkedNotebooks");\r
}\r
// Sync Saved Searches with Evernote\r
- private void syncLocalSavedSearches() {\r
+ private void syncLocalSavedSearches(Client noteStore) {\r
logger.log(logger.HIGH, "Entering SyncRunner.syncLocalSavedSearches");\r
List<SavedSearch> remoteList = new ArrayList<SavedSearch>();\r
status.message.emit(tr("Sending saved searches."));\r
} \r
\r
// Sync evernote changes with local database\r
- private void syncRemoteToLocal() {\r
+ private void syncRemoteToLocal(Client noteStore) {\r
logger.log(logger.HIGH, "Entering SyncRunner.syncRemoteToLocal");\r
\r
List<Note> dirtyNotes = conn.getNoteTable().getDirty();\r
syncRemoteTags(chunk.getTags());\r
syncRemoteSavedSearches(chunk.getSearches());\r
syncRemoteNotebooks(chunk.getNotebooks());\r
- syncRemoteNotes(chunk.getNotes(), fullSync, authToken);\r
- syncRemoteResources(chunk.getResources());\r
+ syncRemoteNotes(noteStore, chunk.getNotes(), fullSync, authToken);\r
+ syncRemoteResources(noteStore, chunk.getResources());\r
syncRemoteLinkedNotebooks(chunk.getLinkedNotebooks());\r
+ \r
+ // Signal about any updated notes to invalidate the cache\r
+ for (int i=0; i<chunk.getNotesSize(); i++) \r
+ noteSignal.noteChanged.emit(chunk.getNotes().get(i).getGuid(), null); \r
syncExpungedNotes(chunk);\r
\r
\r
// List<SharedNotebook> books = noteStore.getSharedNotebookByAuth(authToken);\r
// }\r
// Sync remote Resources\r
- private void syncRemoteResources(List<Resource> resource) {\r
+ private void syncRemoteResources(Client noteStore, List<Resource> resource) {\r
logger.log(logger.EXTREME, "Entering SyncRunner.syncRemoteResources");\r
if (resource != null) {\r
for (int i=0; i<resource.size() && keepRunning; i++) {\r
- syncRemoteResource(resource.get(i), authToken);\r
+ syncRemoteResource(noteStore, resource.get(i), authToken);\r
}\r
}\r
logger.log(logger.EXTREME, "Leaving SyncRunner.syncRemoteResources");\r
}\r
// Sync remote resource\r
- private void syncRemoteResource(Resource resource, String authToken) {\r
+ private void syncRemoteResource(Client noteStore, Resource resource, String authToken) {\r
// This is how the logic for this works.\r
// 1.) If the resource is not in the local database, we add it.\r
// 2.) If a copy of the resource is in the local database and the note isn't dirty, we update the local copy\r
// is a conflict. The note conflict should get a copy of the resource at that time.\r
\r
boolean saveNeeded = false;\r
- /* #1 */ Resource r = getEvernoteResource(resource.getGuid(), true,true,true, authToken);\r
+ /* #1 */ Resource r = getEvernoteResource(noteStore, resource.getGuid(), true,true,true, authToken);\r
Resource l = conn.getNoteTable().noteResourceTable.getNoteResource(r.getGuid(), false);\r
if (l == null) {\r
saveNeeded = true;\r
\r
}\r
// Sync remote notes\r
- private void syncRemoteNotes(List<Note> note, boolean fullSync, String token) {\r
+ private void syncRemoteNotes(Client noteStore, List<Note> note, boolean fullSync, String token) {\r
logger.log(logger.EXTREME, "Entering SyncRunner.syncRemoteNotes");\r
if (note != null) {\r
for (int i=0; i<note.size() && keepRunning; i++) {\r
- Note n = getEvernoteNote(note.get(i).getGuid(), true, fullSync, true,true, token);\r
+ Note n = getEvernoteNote(noteStore, note.get(i).getGuid(), true, fullSync, true,true, token);\r
syncRemoteNote(n, fullSync, token);\r
}\r
}\r
if ((conflictingNote || fullSync) && !ignoreNote) {\r
logger.log(logger.EXTREME, "Saving Note");\r
conn.getNoteTable().syncNote(n, false);\r
- noteSignal.noteChanged.emit(n.getGuid(), null); // Signal to ivalidate note cache\r
+ // The following was commented out because it caused a race condition on the database where resources \r
+ // may be lost. We do the same thing elsewhere;.\r
+// noteSignal.noteChanged.emit(n.getGuid(), null); // Signal to ivalidate note cache \r
noteSignal.noteDownloaded.emit(n, true); // Signal to add note to index\r
logger.log(logger.EXTREME, "Note Saved");\r
if (fullSync && n.getResources() != null) {\r
}\r
}\r
}\r
- private Note getEvernoteNote(String guid, boolean withContent, boolean withResourceData, boolean withResourceRecognition, boolean withResourceAlternateData, String token) { \r
+ private Note getEvernoteNote(Client noteStore, String guid, boolean withContent, boolean withResourceData, boolean withResourceRecognition, boolean withResourceAlternateData, String token) { \r
Note n = null;\r
try {\r
logger.log(logger.EXTREME, "Retrieving note " +guid);\r
}\r
return n;\r
}\r
- private Resource getEvernoteResource(String guid, boolean withData, boolean withRecognition, boolean withAttributes, String token) { \r
+ private Resource getEvernoteResource(Client noteStore, String guid, boolean withData, boolean withRecognition, boolean withAttributes, String token) { \r
Resource n = null;\r
try {\r
logger.log(logger.EXTREME, "Retrieving resource " +guid);\r
authToken = authResult.getAuthenticationToken(); \r
noteStoreUrl = noteStoreUrlBase + user.getShardId();\r
syncSignal.saveAuthToken.emit(authToken);\r
- syncSignal.saveNoteStore.emit(noteStore);\r
+ syncSignal.saveNoteStore.emit(localNoteStore);\r
\r
\r
try {\r
isConnected = false;\r
} \r
noteStoreProt = new TBinaryProtocol(noteStoreTrans);\r
- noteStore = \r
+ localNoteStore = \r
new NoteStore.Client(noteStoreProt, noteStoreProt); \r
isConnected = true;\r
authTimeRemaining = authResult.getExpiration() - authResult.getCurrentTime();\r
//*********************************************************\r
//* Special download instructions. Used for DB upgrades\r
//*********************************************************\r
- private void downloadAllSharedNotebooks() {\r
+ private void downloadAllSharedNotebooks(Client noteStore) {\r
try {\r
List<SharedNotebook> books = noteStore.listSharedNotebooks(authToken);\r
logger.log(logger.LOW, "Shared notebooks found = " +books.size());\r
logger.log(logger.LOW, e1.getMessage());\r
}\r
}\r
- private void downloadAllNotebooks() {\r
+ private void downloadAllNotebooks(Client noteStore) {\r
try {\r
List<Notebook> books = noteStore.listNotebooks(authToken);\r
logger.log(logger.LOW, "Shared notebooks found = " +books.size());\r
return;\r
}\r
}\r
- private void downloadAllLinkedNotebooks() {\r
+ private void downloadAllLinkedNotebooks(Client noteStore) {\r
try {\r
List<LinkedNotebook> books = noteStore.listLinkedNotebooks(authToken);\r
logger.log(logger.LOW, "Linked notebooks found = " +books.size());\r
try {\r
post.setEntity(new UrlEncodedFormEntity(nvps, HTTP.UTF_8));\r
} catch (UnsupportedEncodingException e1) {\r
- // TODO Auto-generated catch block\r
e1.printStackTrace();\r
}\r
try {\r
try {\r
long lastSyncDate = conn.getLinkedNotebookTable().getLastSequenceDate(books.get(i).getGuid());\r
int lastSequenceNumber = conn.getLinkedNotebookTable().getLastSequenceNumber(books.get(i).getGuid());\r
- linkedAuthResult = noteStore.authenticateToSharedNotebook(books.get(i).getShareKey(), authToken);\r
+\r
+ // Authenticate to the owner's shard\r
+ String linkedNoteStoreUrl = noteStoreUrlBase + books.get(i).getShardId();\r
+ THttpClient linkedNoteStoreTrans = new THttpClient(linkedNoteStoreUrl);\r
+ TBinaryProtocol linkedNoteStoreProt = new TBinaryProtocol(linkedNoteStoreTrans);\r
+ Client linkedNoteStore = new NoteStore.Client(linkedNoteStoreProt, linkedNoteStoreProt); \r
+ \r
+ linkedAuthResult = linkedNoteStore.authenticateToSharedNotebook(books.get(i).getShareKey(), authToken);\r
SyncState linkedSyncState = \r
- noteStore.getLinkedNotebookSyncState(linkedAuthResult.getAuthenticationToken(), books.get(i));\r
+ linkedNoteStore.getLinkedNotebookSyncState(linkedAuthResult.getAuthenticationToken(), books.get(i));\r
if (linkedSyncState.getUpdateCount() > lastSequenceNumber) {\r
if (lastSyncDate < linkedSyncState.getFullSyncBefore()) {\r
lastSequenceNumber = 0;\r
} \r
- syncLinkedNotebook(books.get(i), lastSequenceNumber, linkedSyncState.getUpdateCount());\r
+ syncLinkedNotebook(linkedNoteStore, books.get(i), lastSequenceNumber, linkedSyncState.getUpdateCount());\r
}\r
\r
// Synchronize local changes\r
- syncLocalLinkedNoteChanges(books.get(i));\r
+ syncLocalLinkedNoteChanges(linkedNoteStore, books.get(i));\r
\r
} catch (EDAMUserException e) {\r
- // TODO Auto-generated catch block\r
e.printStackTrace();\r
} catch (EDAMNotFoundException e) {\r
status.message.emit(tr("Error synchronizing \" " +\r
"Key: "+books.get(i).getShareKey() +" Error:" +e.getMessage());\r
e.printStackTrace();\r
} catch (TException e) {\r
- // TODO Auto-generated catch block\r
e.printStackTrace();\r
}\r
}\r
//**************************************************************\r
//* Linked notebook contents (from someone else's account)\r
//*************************************************************\r
- private void syncLinkedNotebook(LinkedNotebook book, int usn, int highSequence) {\r
- \r
+ private void syncLinkedNotebook(Client linkedNoteStore, LinkedNotebook book, int usn, int highSequence) {\r
+ if (ignoreLinkedNotebooks.contains(book.getGuid()))\r
+ return;\r
List<Note> dirtyNotes = conn.getNoteTable().getDirtyLinkedNotes();\r
if (dirtyNoteGuids == null) \r
dirtyNoteGuids = new Vector<String>();\r
if (usn == 0)\r
fullSync = true;\r
while (usn < highSequence) {\r
+ refreshNeeded = true;\r
try {\r
SyncChunk chunk = \r
- noteStore.getLinkedNotebookSyncChunk(authToken, book, usn, 10, fullSync);\r
+ linkedNoteStore.getLinkedNotebookSyncChunk(authToken, book, usn, 10, fullSync);\r
+ \r
+ // Expunge notes\r
+ syncExpungedNotes(chunk);\r
\r
- if (!ignoreLinkedNotebooks.contains(book.getGuid()))\r
- syncRemoteNotes(chunk.getNotes(), fullSync, linkedAuthResult.getAuthenticationToken());\r
- findNewLinkedTags(chunk.getNotes(), linkedAuthResult.getAuthenticationToken());\r
+ syncRemoteNotes(linkedNoteStore, chunk.getNotes(), fullSync, linkedAuthResult.getAuthenticationToken());\r
+ findNewLinkedTags(linkedNoteStore, chunk.getNotes(), linkedAuthResult.getAuthenticationToken());\r
+ // Sync resources\r
for (int i=0; i<chunk.getResourcesSize(); i++) {\r
- syncRemoteResource(chunk.getResources().get(i), linkedAuthResult.getAuthenticationToken());\r
+ syncRemoteResource(linkedNoteStore, chunk.getResources().get(i), linkedAuthResult.getAuthenticationToken());\r
}\r
- syncRemoteLinkedNotebooks(chunk.getNotebooks(), false, book);\r
- SharedNotebook s = noteStore.getSharedNotebookByAuth(linkedAuthResult.getAuthenticationToken());\r
+ syncRemoteLinkedNotebooks(linkedNoteStore, chunk.getNotebooks(), false, book);\r
+ SharedNotebook s = linkedNoteStore.getSharedNotebookByAuth(linkedAuthResult.getAuthenticationToken());\r
syncLinkedTags(chunk.getTags(), s.getNotebookGuid());\r
\r
- \r
- // Expunge records\r
+ // Go through & signal any notes that have changed so we can refresh the user's view\r
+ for (int i=0; i<chunk.getNotesSize(); i++) \r
+ noteSignal.noteChanged.emit(chunk.getNotes().get(i).getGuid(), null);\r
+\r
+ // Expunge Notebook records\r
for (int i=0; i<chunk.getExpungedLinkedNotebooksSize(); i++) {\r
conn.getLinkedNotebookTable().expungeNotebook(chunk.getExpungedLinkedNotebooks().get(i), false);\r
}\r
+ \r
usn = chunk.getChunkHighUSN();\r
conn.getLinkedNotebookTable().setLastSequenceDate(book.getGuid(),chunk.getCurrentTime());\r
conn.getLinkedNotebookTable().setLastSequenceNumber(book.getGuid(),chunk.getChunkHighUSN());\r
} catch (EDAMUserException e) {\r
- // TODO Auto-generated catch block\r
e.printStackTrace();\r
} catch (EDAMSystemException e) {\r
- // TODO Auto-generated catch block\r
e.printStackTrace();\r
} catch (EDAMNotFoundException e) {\r
- // TODO Auto-generated catch block\r
e.printStackTrace();\r
} catch (TException e) {\r
- // TODO Auto-generated catch block\r
e.printStackTrace();\r
}\r
}\r
}\r
\r
// Sync notebooks from a linked notebook\r
- private void syncRemoteLinkedNotebooks(List<Notebook> notebooks, boolean readOnly, LinkedNotebook linked) {\r
+ private void syncRemoteLinkedNotebooks(Client noteStore, List<Notebook> notebooks, boolean readOnly, LinkedNotebook linked) {\r
logger.log(logger.EXTREME, "Entering SyncRunner.syncRemoteNotebooks");\r
if (notebooks != null) {\r
for (int i=0; i<notebooks.size() && keepRunning; i++) {\r
logger.log(logger.EXTREME, "Leaving SyncRunner.syncRemoteNotebooks");\r
}\r
\r
- private void findNewLinkedTags(List<Note> newNotes, String token) {\r
+ private void findNewLinkedTags(Client noteStore, List<Note> newNotes, String token) {\r
if (newNotes == null)\r
return;\r
for (int i=0; i<newNotes.size(); i++) {\r
newTag = noteStore.getTag(token, tag);\r
conn.getTagTable().addTag(newTag, false);\r
} catch (EDAMUserException e) {\r
- // TODO Auto-generated catch block\r
e.printStackTrace();\r
} catch (EDAMSystemException e) {\r
- // TODO Auto-generated catch block\r
e.printStackTrace();\r
} catch (EDAMNotFoundException e) {\r
- // TODO Auto-generated catch block\r
e.printStackTrace();\r
} catch (TException e) {\r
- // TODO Auto-generated catch block\r
e.printStackTrace();\r
}\r
\r
}\r
\r
// Synchronize changes locally done to linked notes\r
- private void syncLocalLinkedNoteChanges(LinkedNotebook book) {\r
+ private void syncLocalLinkedNoteChanges(Client noteStore, LinkedNotebook book) {\r
String notebookGuid = conn.getLinkedNotebookTable().getNotebookGuid(book.getGuid());\r
List<Note> notes = conn.getNoteTable().getDirtyLinked(notebookGuid);\r
for (int i=0; i<notes.size(); i++) {\r
- syncLocalNote(notes.get(i), linkedAuthResult.getAuthenticationToken());\r
+ syncLocalNote(noteStore, notes.get(i), linkedAuthResult.getAuthenticationToken());\r
}\r
}\r
\r