// saveTimer.setInterval(1000*10); // auto save every 20 seconds;
saveTimer.start();
}
+ listManager.saveRunner.noteSignals.noteSaveRunnerError.connect(this, "saveRunnerError(String, String)");
logger.log(logger.EXTREME, "Starting external file monitor timer");
externalFileSaveTimer = new QTimer();
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()");
}
browserWindow.noteSignal.noteChanged.connect(this, "invalidateNoteCache(String, String)");
browserWindow.noteSignal.noteChanged.connect(this, "setNoteDirty()");
browserWindow.noteSignal.titleChanged.connect(listManager, "updateNoteTitle(String, String)");
-// browserWindow.noteSignal.notebookChanged.connect(this, "updateNoteNotebook(String, String)");
+ browserWindow.noteSignal.notebookChanged.connect(this, "updateNoteNotebook(String, String)");
browserWindow.noteSignal.createdDateChanged.connect(listManager, "updateNoteCreatedDate(String, QDateTime)");
browserWindow.noteSignal.alteredDateChanged.connect(listManager, "updateNoteAlteredDate(String, QDateTime)");
browserWindow.noteSignal.subjectDateChanged.connect(listManager, "updateNoteSubjectDate(String, QDateTime)");
if (tagName == null)
return;
- for (int i=0; i<listManager.getNoteTableModel().rowCount(); i++) {
- QModelIndex modelIndex = listManager.getNoteTableModel().index(i, Global.noteTableGuidPosition);
- if (modelIndex != null) {
- SortedMap<Integer, Object> ix = listManager.getNoteTableModel().itemData(modelIndex);
- String titleGuid = (String)ix.values().toArray()[0];
- if (titleGuid.equals(noteGuid)) {
- String text = (String)listManager.getNoteTableModel().data(i, Global.noteTableTagPosition);
- if (!text.trim().equals(""))
- text = text + Global.tagDelimeter + " " +tagName;
- else
- text = tagName;
- listManager.getNoteTableModel().setData(i, Global.noteTableTagPosition, text);
- listManager.getNoteTableModel().setData(i, Global.noteTableSynchronizedPosition, "false");
- if (noteGuid.equals(currentNoteGuid))
- browserWindow.setTag(text);
- i=listManager.getNoteTableModel().rowCount();
+ for (int i=0; i<listManager.getMasterNoteIndex().size(); i++) {
+ if (listManager.getMasterNoteIndex().get(i).getGuid().equals(noteGuid)) {
+ List<String> tagNames = new ArrayList<String>();
+ tagNames.add(new String(tagName));
+ Note n = listManager.getMasterNoteIndex().get(i);
+ for (int j=0; j<n.getTagNames().size(); j++) {
+ tagNames.add(new String(n.getTagNames().get(j)));
+ }
+ listManager.getNoteTableModel().updateNoteTags(noteGuid, n.getTagGuids(), tagNames);
+ if (n.getGuid().equals(currentNoteGuid)) {
+ Collections.sort(tagNames);
+ String display = "";
+ for (int j=0; j<tagNames.size(); j++) {
+ display = display+tagNames.get(j);
+ if (j+2<tagNames.size())
+ display = display+Global.tagDelimeter+" ";
+ }
+ browserWindow.setTag(display);
}
+ i=listManager.getMasterNoteIndex().size();
}
}
+
+
+ listManager.getNoteTableModel().updateNoteSyncStatus(noteGuid, false);
}
private void clearTagFilter() {
tagTree.blockSignals(true);
}
private void updateListNoteNotebook(String guid, String notebook) {
logger.log(logger.HIGH, "Entering NeverNote.updateListNoteNotebook");
-
- for (int i=0; i<listManager.getNoteTableModel().rowCount(); i++) {
- //QModelIndex modelIndex = noteTableView.proxyModel.index(i, Global.noteTableGuidPosition);
- QModelIndex modelIndex = listManager.getNoteTableModel().index(i, Global.noteTableGuidPosition);
- if (modelIndex != null) {
-// SortedMap<Integer, Object> ix = noteTableView.proxyModel.itemData(modelIndex);
- SortedMap<Integer, Object> ix = listManager.getNoteTableModel().itemData(modelIndex);
- String tableGuid = (String)ix.values().toArray()[0];
- if (tableGuid.equals(guid)) {
- listManager.getNoteTableModel().setData(i, Global.noteTableNotebookPosition,notebook);
- listManager.getNoteTableModel().setData(i, Global.noteTableSynchronizedPosition, "false");
- return;
- }
- }
- }
+ listManager.getNoteTableModel().updateNoteSyncStatus(guid, false);
logger.log(logger.HIGH, "Leaving NeverNote.updateListNoteNotebook");
}
// Update a title for a specific note in the list
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<listManager.getNoteTableModel().rowCount(); i++) {
QModelIndex modelIndex = listManager.getNoteTableModel().index(i, Global.noteTableGuidPosition);
if (modelIndex != null) {
}
}
}
-
+ */
logger.log(logger.EXTREME, "Leaving NeverNote.setNoteDirty()");
}
private void saveNote() {
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()) {
- newNote.setTagGuids(new ArrayList<String>());
- newNote.setTagNames(new ArrayList<String>());
List<QTreeWidgetItem> selections = tagTree.selectedItems();
QTreeWidgetItem currentSelection;
for (int i=0; i<selections.size(); i++) {
conn.getNoteTable().addNote(newNote, true);
listManager.getUnsynchronizedNotes().add(newNote.getGuid());
listManager.addNote(newNote);
- noteTableView.insertRow(newNote, true, -1);
+// noteTableView.insertRow(newNote, true, -1);
currentNote = newNote;
currentNoteGuid = currentNote.getGuid();
if (!thumbnailViewer.isVisible())
thumbnailViewer.showFullScreen();
}
-
+ // An error happened while saving a note. Inform the user
+ @SuppressWarnings("unused")
+ private void saveRunnerError(String guid, String msg) {
+ if (msg == null) {
+ String title = "*Unknown*";
+ for (int i=0; i<listManager.getMasterNoteIndex().size(); i++) {
+ if (listManager.getMasterNoteIndex().get(i).getGuid().equals(guid)) {
+ title = listManager.getMasterNoteIndex().get(i).getTitle();
+ i=listManager.getMasterNoteIndex().size();
+ }
+ }
+ msg = "An error has happened saving the note \"" +title+
+ "\". \nThis is probably due to a document that is too complex for Nevernote to process. "+
+ "As a result, changes to the note may not be saved.\n\nPlease review the note for any potential problems.";
+
+ QMessageBox.information(this, tr("Error Saving Note"), tr(msg));
+ }
+ }
+
//**********************************************************
//**********************************************************
//* Online user actions
synchronizeAnimationTimer.stop();
synchronizeButton.setIcon(synchronizeAnimation.get(0));
saveNote();
+ if (currentNote == null) {
+ currentNote = conn.getNoteTable().getNote(currentNoteGuid, false, false, false, false, true);
+ }
listManager.setUnsynchronizedNotes(conn.getNoteTable().getUnsynchronizedGUIDs());
- listManager.reloadIndexes();
- noteIndexUpdated(true);
+ noteIndexUpdated(false);
noteTableView.selectionModel().blockSignals(true);
scrollToGuid(currentNoteGuid);
noteTableView.selectionModel().blockSignals(false);
refreshEvernoteNote(false);
scrollToGuid(currentNoteGuid);
+ waitCursor(false);
setMessage(tr("Synchronization Complete"));
logger.log(logger.MEDIUM, "Sync complete.");
}