QThreadPool.globalInstance().setMaxThreadCount(indexRunnerCount+5); // increase max thread count
logger.log(logger.EXTREME, "Building list manager");
- listManager = new ListManager(conn, logger, Global.mainThreadId);
+ listManager = new ListManager(conn, logger);
logger.log(logger.EXTREME, "Building index runners & timers");
indexRunner = new IndexRunner("indexRunner.log", Global.getDatabaseUrl(), Global.getDatabaseUserid(), Global.getDatabaseUserPassword(), Global.cipherPassword);
saveTimer.start();
}
-// Global.trace();
logger.log(logger.EXTREME, "Starting external file monitor timer");
externalFileSaveTimer = new QTimer();
externalFileSaveTimer.timeout.connect(this, "externalFileEditedSaver()");
tagTree = new TagTreeWidget(conn);
savedSearchTree = new SavedSearchTreeWidget();
trashTree = new TrashTreeWidget();
- noteTableView = new TableView(logger);
+ noteTableView = new TableView(logger, listManager);
QGridLayout leftGrid = new QGridLayout();
leftSplitter1.setLayout(leftGrid);
browserWindow.noteSignal.noteChanged.connect(this, "invalidateNoteCache(String, String)");
browserWindow.noteSignal.noteChanged.connect(this, "setNoteDirty()");
browserWindow.noteSignal.titleChanged.connect(listManager, "updateNoteTitle(String, String)");
- browserWindow.noteSignal.titleChanged.connect(this, "updateListTitle(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.createdDateChanged.connect(this, "updateListDateCreated(String, QDateTime)");
browserWindow.noteSignal.alteredDateChanged.connect(listManager, "updateNoteAlteredDate(String, QDateTime)");
- browserWindow.noteSignal.alteredDateChanged.connect(this, "updateListDateChanged(String, QDateTime)");
browserWindow.noteSignal.subjectDateChanged.connect(listManager, "updateNoteSubjectDate(String, QDateTime)");
- browserWindow.noteSignal.subjectDateChanged.connect(this, "updateListDateSubject(String, QDateTime)");
browserWindow.noteSignal.authorChanged.connect(listManager, "updateNoteAuthor(String, String)");
browserWindow.noteSignal.geoChanged.connect(listManager, "updateNoteGeoTag(String, Double,Double,Double)");
- browserWindow.noteSignal.authorChanged.connect(this, "updateListAuthor(String, String)");
browserWindow.noteSignal.geoChanged.connect(this, "setNoteDirty()");
browserWindow.noteSignal.sourceUrlChanged.connect(listManager, "updateNoteSourceUrl(String, String)");
- browserWindow.noteSignal.sourceUrlChanged.connect(this, "updateListSourceUrl(String, String)");
browserWindow.focusLost.connect(this, "saveNote()");
browserWindow.resourceSignal.contentChanged.connect(this, "externalFileEdited(String)");
-// browserWindow.resourceSignal.externalFileEdit.connect(this, "saveResourceLater(String, String)");
}
clearTagFilter();
searchField.clear();
}
-
menuBar.noteRestoreAction.setVisible(false);
menuBar.notebookEditAction.setEnabled(true);
menuBar.notebookDeleteAction.setEnabled(true);
if (tagName == null)
return;
- for (int i=0; i<noteTableView.model.rowCount(); i++) {
- QModelIndex modelIndex = noteTableView.model.index(i, Global.noteTableGuidPosition);
+ for (int i=0; i<listManager.getNoteTableModel().rowCount(); i++) {
+ QModelIndex modelIndex = listManager.getNoteTableModel().index(i, Global.noteTableGuidPosition);
if (modelIndex != null) {
- SortedMap<Integer, Object> ix = noteTableView.model.itemData(modelIndex);
+ SortedMap<Integer, Object> ix = listManager.getNoteTableModel().itemData(modelIndex);
String titleGuid = (String)ix.values().toArray()[0];
if (titleGuid.equals(noteGuid)) {
- String text = (String)noteTableView.model.data(i, Global.noteTableTagPosition);
+ String text = (String)listManager.getNoteTableModel().data(i, Global.noteTableTagPosition);
if (!text.trim().equals(""))
text = text + Global.tagDelimeter + " " +tagName;
else
text = tagName;
- noteTableView.model.setData(i, Global.noteTableTagPosition, text);
- noteTableView.model.setData(i, Global.noteTableSynchronizedPosition, "false");
+ listManager.getNoteTableModel().setData(i, Global.noteTableTagPosition, text);
+ listManager.getNoteTableModel().setData(i, Global.noteTableSynchronizedPosition, "false");
if (noteGuid.equals(currentNoteGuid))
browserWindow.setTag(text);
- i=noteTableView.model.rowCount();
+ i=listManager.getNoteTableModel().rowCount();
}
}
}
upButton.setEnabled(false);
else
upButton.setEnabled(true);
- if (row < noteTableView.model.rowCount()-1)
+ if (row < listManager.getNoteTableModel().rowCount()-1)
downButton.setEnabled(true);
else
downButton.setEnabled(false);
// Trigger a refresh when the note db has been updated
private void noteIndexUpdated(boolean reload) {
logger.log(logger.HIGH, "Entering NeverNote.noteIndexUpdated");
- Global.traceReset();
saveNote();
refreshEvernoteNoteList();
logger.log(logger.HIGH, "Calling note table reload in NeverNote.noteIndexUpdated() - "+reload);
- noteTableView.load(listManager, reload);
+ noteTableView.load(reload);
scrollToGuid(currentNoteGuid);
logger.log(logger.HIGH, "Leaving NeverNote.noteIndexUpdated");
}
private void downAction() {
List<QModelIndex> selections = noteTableView.selectionModel().selectedRows();
int row = selections.get(0).row();
- int max = noteTableView.model.rowCount();
+ int max = listManager.getNoteTableModel().rowCount();
if (row < max-1) {
noteTableView.selectRow(row+1);
}
tagBuffer.append(", ");
}
- for (int i=0; i<noteTableView.model.rowCount(); i++) {
- QModelIndex modelIndex = noteTableView.model.index(i, Global.noteTableGuidPosition);
+ for (int i=0; i<listManager.getNoteTableModel().rowCount(); i++) {
+ QModelIndex modelIndex = listManager.getNoteTableModel().index(i, Global.noteTableGuidPosition);
if (modelIndex != null) {
- SortedMap<Integer, Object> ix = noteTableView.model.itemData(modelIndex);
+ SortedMap<Integer, Object> ix = listManager.getNoteTableModel().itemData(modelIndex);
String tableGuid = (String)ix.values().toArray()[0];
if (tableGuid.equals(guid)) {
- noteTableView.model.setData(i, Global.noteTableTagPosition,tagBuffer.toString());
- noteTableView.model.setData(i, Global.noteTableSynchronizedPosition, "false");
+ listManager.getNoteTableModel().setData(i, Global.noteTableTagPosition,tagBuffer.toString());
+ listManager.getNoteTableModel().setData(i, Global.noteTableSynchronizedPosition, "false");
return;
}
}
}
// Update a title for a specific note in the list
@SuppressWarnings("unused")
- private void updateListTitle(String guid, String title) {
- logger.log(logger.HIGH, "Entering NeverNote.updateListTitle");
-
- for (int i=0; i<noteTableView.model.rowCount(); i++) {
- //QModelIndex modelIndex = noteTableView.proxyModel.index(i, Global.noteTableGuidPosition);
- QModelIndex modelIndex = noteTableView.model.index(i, Global.noteTableGuidPosition);
- if (modelIndex != null) {
-// SortedMap<Integer, Object> ix = noteTableView.proxyModel.itemData(modelIndex);
- SortedMap<Integer, Object> ix = noteTableView.model.itemData(modelIndex);
- String tableGuid = (String)ix.values().toArray()[0];
- if (tableGuid.equals(guid)) {
- noteTableView.model.setData(i, Global.noteTableTitlePosition,title);
- noteTableView.model.setData(i, Global.noteTableSynchronizedPosition, "false");
- return;
- }
- }
- }
- logger.log(logger.HIGH, "Leaving NeverNote.updateListTitle");
- }
- // Update a title for a specific note in the list
- @SuppressWarnings("unused")
private void updateListAuthor(String guid, String author) {
logger.log(logger.HIGH, "Entering NeverNote.updateListAuthor");
- for (int i=0; i<noteTableView.model.rowCount(); i++) {
+ for (int i=0; i<listManager.getNoteTableModel().rowCount(); i++) {
//QModelIndex modelIndex = noteTableView.proxyModel.index(i, Global.noteTableGuidPosition);
- QModelIndex modelIndex = noteTableView.model.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 = noteTableView.model.itemData(modelIndex);
+ SortedMap<Integer, Object> ix = listManager.getNoteTableModel().itemData(modelIndex);
String tableGuid = (String)ix.values().toArray()[0];
if (tableGuid.equals(guid)) {
- noteTableView.model.setData(i, Global.noteTableAuthorPosition,author);
- noteTableView.model.setData(i, Global.noteTableSynchronizedPosition, "false");
+ listManager.getNoteTableModel().setData(i, Global.noteTableAuthorPosition,author);
+ listManager.getNoteTableModel().setData(i, Global.noteTableSynchronizedPosition, "false");
return;
}
}
private void updateListNoteNotebook(String guid, String notebook) {
logger.log(logger.HIGH, "Entering NeverNote.updateListNoteNotebook");
- for (int i=0; i<noteTableView.model.rowCount(); i++) {
+ for (int i=0; i<listManager.getNoteTableModel().rowCount(); i++) {
//QModelIndex modelIndex = noteTableView.proxyModel.index(i, Global.noteTableGuidPosition);
- QModelIndex modelIndex = noteTableView.model.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 = noteTableView.model.itemData(modelIndex);
+ SortedMap<Integer, Object> ix = listManager.getNoteTableModel().itemData(modelIndex);
String tableGuid = (String)ix.values().toArray()[0];
if (tableGuid.equals(guid)) {
- noteTableView.model.setData(i, Global.noteTableNotebookPosition,notebook);
- noteTableView.model.setData(i, Global.noteTableSynchronizedPosition, "false");
+ listManager.getNoteTableModel().setData(i, Global.noteTableNotebookPosition,notebook);
+ listManager.getNoteTableModel().setData(i, Global.noteTableSynchronizedPosition, "false");
return;
}
}
private void updateListSourceUrl(String guid, String url) {
logger.log(logger.HIGH, "Entering NeverNote.updateListAuthor");
- for (int i=0; i<noteTableView.model.rowCount(); i++) {
+ for (int i=0; i<listManager.getNoteTableModel().rowCount(); i++) {
//QModelIndex modelIndex = noteTableView.proxyModel.index(i, Global.noteTableGuidPosition);
- QModelIndex modelIndex = noteTableView.model.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 = noteTableView.model.itemData(modelIndex);
+ SortedMap<Integer, Object> ix = listManager.getNoteTableModel().itemData(modelIndex);
String tableGuid = (String)ix.values().toArray()[0];
if (tableGuid.equals(guid)) {
- noteTableView.model.setData(i, Global.noteTableSynchronizedPosition, "false");
- noteTableView.model.setData(i, Global.noteTableSourceUrlPosition,url);
+ listManager.getNoteTableModel().setData(i, Global.noteTableSynchronizedPosition, "false");
+ listManager.getNoteTableModel().setData(i, Global.noteTableSourceUrlPosition,url);
return;
}
}
private void updateListGuid(String oldGuid, String newGuid) {
logger.log(logger.HIGH, "Entering NeverNote.updateListTitle");
- for (int i=0; i<noteTableView.model.rowCount(); i++) {
- QModelIndex modelIndex = noteTableView.model.index(i, Global.noteTableGuidPosition);
+ for (int i=0; i<listManager.getNoteTableModel().rowCount(); i++) {
+ QModelIndex modelIndex = listManager.getNoteTableModel().index(i, Global.noteTableGuidPosition);
if (modelIndex != null) {
- SortedMap<Integer, Object> ix = noteTableView.model.itemData(modelIndex);
+ SortedMap<Integer, Object> ix = listManager.getNoteTableModel().itemData(modelIndex);
String tableGuid = (String)ix.values().toArray()[0];
if (tableGuid.equals(oldGuid)) {
- noteTableView.model.setData(i, Global.noteTableGuidPosition,newGuid);
- //noteTableView.model.setData(i, Global.noteTableSynchronizedPosition, "false");
+ listManager.getNoteTableModel().setData(i, Global.noteTableGuidPosition,newGuid);
+ //listManager.getNoteTableModel().setData(i, Global.noteTableSynchronizedPosition, "false");
return;
}
}
if (listManager.getNoteIndex().get(j).getTagGuids().contains(guid)) {
String newName = listManager.getTagNamesForNote(listManager.getNoteIndex().get(j));
- for (int i=0; i<noteTableView.model.rowCount(); i++) {
- QModelIndex modelIndex = noteTableView.model.index(i, Global.noteTableGuidPosition);
+ for (int i=0; i<listManager.getNoteTableModel().rowCount(); i++) {
+ QModelIndex modelIndex = listManager.getNoteTableModel().index(i, Global.noteTableGuidPosition);
if (modelIndex != null) {
- SortedMap<Integer, Object> ix = noteTableView.model.itemData(modelIndex);
+ SortedMap<Integer, Object> ix = listManager.getNoteTableModel().itemData(modelIndex);
String noteGuid = (String)ix.values().toArray()[0];
if (noteGuid.equalsIgnoreCase(listManager.getNoteIndex().get(j).getGuid())) {
- noteTableView.model.setData(i, Global.noteTableTagPosition, newName);
- //noteTableView.model.setData(i, Global.noteTableSynchronizedPosition, "false");
- i=noteTableView.model.rowCount();
+ listManager.getNoteTableModel().setData(i, Global.noteTableTagPosition, newName);
+ //listManager.getNoteTableModel().setData(i, Global.noteTableSynchronizedPosition, "false");
+ i=listManager.getNoteTableModel().rowCount();
}
}
}
}
String newName = listManager.getTagNamesForNote(listManager.getNoteIndex().get(j));
- for (int i=0; i<noteTableView.model.rowCount(); i++) {
- QModelIndex modelIndex = noteTableView.model.index(i, Global.noteTableGuidPosition);
+ for (int i=0; i<listManager.getNoteTableModel().rowCount(); i++) {
+ QModelIndex modelIndex = listManager.getNoteTableModel().index(i, Global.noteTableGuidPosition);
if (modelIndex != null) {
- SortedMap<Integer, Object> ix = noteTableView.model.itemData(modelIndex);
+ SortedMap<Integer, Object> ix = listManager.getNoteTableModel().itemData(modelIndex);
String noteGuid = (String)ix.values().toArray()[0];
if (noteGuid.equalsIgnoreCase(listManager.getNoteIndex().get(j).getGuid())) {
- noteTableView.model.setData(i, Global.noteTableTagPosition, newName);
-// noteTableView.model.setData(i, Global.noteTableSynchronizedPosition, "false");
- i=noteTableView.model.rowCount();
+ listManager.getNoteTableModel().setData(i, Global.noteTableTagPosition, newName);
+// listManager.getNoteTableModel().setData(i, Global.noteTableSynchronizedPosition, "false");
+ i=listManager.getNoteTableModel().rowCount();
}
}
}
private void updateListNotebookName(String oldName, String newName) {
logger.log(logger.HIGH, "Entering NeverNote.updateListNotebookName");
- for (int i=0; i<noteTableView.model.rowCount(); i++) {
- QModelIndex modelIndex = noteTableView.model.index(i, Global.noteTableNotebookPosition);
+ for (int i=0; i<listManager.getNoteTableModel().rowCount(); i++) {
+ QModelIndex modelIndex = listManager.getNoteTableModel().index(i, Global.noteTableNotebookPosition);
if (modelIndex != null) {
- SortedMap<Integer, Object> ix = noteTableView.model.itemData(modelIndex);
+ SortedMap<Integer, Object> ix = listManager.getNoteTableModel().itemData(modelIndex);
String tableName = (String)ix.values().toArray()[0];
if (tableName.equalsIgnoreCase(oldName)) {
-// noteTableView.model.setData(i, Global.noteTableSynchronizedPosition, "false");
- noteTableView.model.setData(i, Global.noteTableNotebookPosition, newName);
+// listManager.getNoteTableModel().setData(i, Global.noteTableSynchronizedPosition, "false");
+ listManager.getNoteTableModel().setData(i, Global.noteTableNotebookPosition, newName);
}
}
}
private void updateListDateCreated(String guid, QDateTime date) {
logger.log(logger.HIGH, "Entering NeverNote.updateListDateCreated");
- for (int i=0; i<noteTableView.model.rowCount(); i++) {
- QModelIndex modelIndex = noteTableView.model.index(i, Global.noteTableGuidPosition);
+ for (int i=0; i<listManager.getNoteTableModel().rowCount(); i++) {
+ QModelIndex modelIndex = listManager.getNoteTableModel().index(i, Global.noteTableGuidPosition);
if (modelIndex != null) {
- SortedMap<Integer, Object> ix = noteTableView.model.itemData(modelIndex);
+ SortedMap<Integer, Object> ix = listManager.getNoteTableModel().itemData(modelIndex);
String tableGuid = (String)ix.values().toArray()[0];
if (tableGuid.equals(guid)) {
- noteTableView.model.setData(i, Global.noteTableCreationPosition, date.toString(Global.getDateFormat()+" " +Global.getTimeFormat()));
+ listManager.getNoteTableModel().setData(i, Global.noteTableCreationPosition, date.toString(Global.getDateFormat()+" " +Global.getTimeFormat()));
return;
}
}
private void updateListDateSubject(String guid, QDateTime date) {
logger.log(logger.HIGH, "Entering NeverNote.updateListDateSubject");
- for (int i=0; i<noteTableView.model.rowCount(); i++) {
- QModelIndex modelIndex = noteTableView.model.index(i, Global.noteTableGuidPosition);
+ for (int i=0; i<listManager.getNoteTableModel().rowCount(); i++) {
+ QModelIndex modelIndex = listManager.getNoteTableModel().index(i, Global.noteTableGuidPosition);
if (modelIndex != null) {
- SortedMap<Integer, Object> ix = noteTableView.model.itemData(modelIndex);
+ SortedMap<Integer, Object> ix = listManager.getNoteTableModel().itemData(modelIndex);
String tableGuid = (String)ix.values().toArray()[0];
if (tableGuid.equals(guid)) {
- noteTableView.model.setData(i, Global.noteTableSynchronizedPosition, "false");
- noteTableView.model.setData(i, Global.noteTableSubjectDatePosition, date.toString(Global.getDateFormat()+" " +Global.getTimeFormat()));
+ listManager.getNoteTableModel().setData(i, Global.noteTableSynchronizedPosition, "false");
+ listManager.getNoteTableModel().setData(i, Global.noteTableSubjectDatePosition, date.toString(Global.getDateFormat()+" " +Global.getTimeFormat()));
return;
}
}
private void updateListDateChanged(String guid, QDateTime date) {
logger.log(logger.HIGH, "Entering NeverNote.updateListDateChanged");
- for (int i=0; i<noteTableView.model.rowCount(); i++) {
- QModelIndex modelIndex = noteTableView.model.index(i, Global.noteTableGuidPosition);
+ for (int i=0; i<listManager.getNoteTableModel().rowCount(); i++) {
+ QModelIndex modelIndex = listManager.getNoteTableModel().index(i, Global.noteTableGuidPosition);
if (modelIndex != null) {
- SortedMap<Integer, Object> ix = noteTableView.model.itemData(modelIndex);
+ SortedMap<Integer, Object> ix = listManager.getNoteTableModel().itemData(modelIndex);
String tableGuid = (String)ix.values().toArray()[0];
if (tableGuid.equals(guid)) {
- noteTableView.model.setData(i, Global.noteTableSynchronizedPosition, "false");
- noteTableView.model.setData(i, Global.noteTableChangedPosition, date.toString(Global.getDateFormat()+" " +Global.getTimeFormat()));
+ listManager.getNoteTableModel().setData(i, Global.noteTableSynchronizedPosition, "false");
+ listManager.getNoteTableModel().setData(i, Global.noteTableChangedPosition, date.toString(Global.getDateFormat()+" " +Global.getTimeFormat()));
return;
}
}
private void updateListDateChanged() {
logger.log(logger.HIGH, "Entering NeverNote.updateListDateChanged");
QDateTime date = new QDateTime(QDateTime.currentDateTime());
- for (int i=0; i<noteTableView.model.rowCount(); i++) {
- QModelIndex modelIndex = noteTableView.model.index(i, Global.noteTableGuidPosition);
+ for (int i=0; i<listManager.getNoteTableModel().rowCount(); i++) {
+ QModelIndex modelIndex = listManager.getNoteTableModel().index(i, Global.noteTableGuidPosition);
if (modelIndex != null) {
- SortedMap<Integer, Object> ix = noteTableView.model.itemData(modelIndex);
+ SortedMap<Integer, Object> ix = listManager.getNoteTableModel().itemData(modelIndex);
String tableGuid = (String)ix.values().toArray()[0];
if (tableGuid.equals(currentNoteGuid)) {
- noteTableView.model.setData(i, Global.noteTableSynchronizedPosition, "false");
- noteTableView.model.setData(i, Global.noteTableChangedPosition, date.toString(Global.getDateFormat()+" " +Global.getTimeFormat()));
+ listManager.getNoteTableModel().setData(i, Global.noteTableSynchronizedPosition, "false");
+ listManager.getNoteTableModel().setData(i, Global.noteTableChangedPosition, date.toString(Global.getDateFormat()+" " +Global.getTimeFormat()));
return;
}
}
// noteTableView.setCurrentIndex(index);
noteTableView.selectRow(i);
noteTableView.scrollTo(index, ScrollHint.EnsureVisible); // This should work, but it doesn't
- i=noteTableView.model.rowCount();
+ i=listManager.getNoteTableModel().rowCount();
}
}
}
selectedNoteGUIDs.add(currentNoteGuid);
for (int j=0; j<selectedNoteGUIDs.size(); j++) {
- for (int i=0; i<noteTableView.model.rowCount(); i++) {
- QModelIndex modelIndex = noteTableView.model.index(i, Global.noteTableGuidPosition);
+ for (int i=0; i<listManager.getNoteTableModel().rowCount(); i++) {
+ QModelIndex modelIndex = listManager.getNoteTableModel().index(i, Global.noteTableGuidPosition);
if (modelIndex != null) {
- SortedMap<Integer, Object> ix = noteTableView.model.itemData(modelIndex);
+ SortedMap<Integer, Object> ix = listManager.getNoteTableModel().itemData(modelIndex);
String tableGuid = (String)ix.values().toArray()[0];
if (tableGuid.equals(selectedNoteGUIDs.get(j))) {
for (int k=0; k<Global.noteTableColumnCount; k++) {
- noteTableView.model.setData(i, k, backgroundColor, Qt.ItemDataRole.BackgroundRole);
- noteTableView.model.setData(i, k, foregroundColor, Qt.ItemDataRole.ForegroundRole);
+ listManager.getNoteTableModel().setData(i, k, backgroundColor, Qt.ItemDataRole.BackgroundRole);
+ listManager.getNoteTableModel().setData(i, k, foregroundColor, Qt.ItemDataRole.ForegroundRole);
listManager.updateNoteTitleColor(selectedNoteGUIDs.get(j), backgroundColor.rgb());
}
- i=noteTableView.model.rowCount();
+ i=listManager.getNoteTableModel().rowCount();
}
}
}
@SuppressWarnings("unused")
private void setNoteDirty() {
logger.log(logger.EXTREME, "Entering NeverNote.setNoteDirty()");
- noteDirty = true;
-
+
+ // If the note is dirty, then it is unsynchronized by default.
+ if (noteDirty)
+ return;
+
+ // Set the note as dirty and check if its status is synchronized in the display table
+ noteDirty = true;
+ for (int i=0; i<listManager.getUnsynchronizedNotes().size(); i++) {
+ if (listManager.getUnsynchronizedNotes().get(i).equals(currentNoteGuid))
+ return;
+ }
+
+ // If tihs wasn't already marked as unsynchronized, then we need to update the table
listManager.getUnsynchronizedNotes().add(currentNoteGuid);
- for (int i=0; i<noteTableView.model.rowCount(); i++) {
- QModelIndex modelIndex = noteTableView.model.index(i, Global.noteTableGuidPosition);
+ for (int i=0; i<listManager.getNoteTableModel().rowCount(); i++) {
+ QModelIndex modelIndex = listManager.getNoteTableModel().index(i, Global.noteTableGuidPosition);
if (modelIndex != null) {
- SortedMap<Integer, Object> ix = noteTableView.model.itemData(modelIndex);
+ SortedMap<Integer, Object> ix = listManager.getNoteTableModel().itemData(modelIndex);
String tableGuid = (String)ix.values().toArray()[0];
if (tableGuid.equals(currentNoteGuid)) {
- noteTableView.model.setData(i, Global.noteTableSynchronizedPosition, "false");
+ listManager.getNoteTableModel().setData(i, Global.noteTableSynchronizedPosition, "false");
return;
}
}
}
+
logger.log(logger.EXTREME, "Leaving NeverNote.setNoteDirty()");
}
private void saveNote() {
if (selectedNoteGUIDs.size() == 0 && !currentNoteGuid.equals(""))
selectedNoteGUIDs.add(currentNoteGuid);
for (int i=selectedNoteGUIDs.size()-1; i>=0; i--) {
- for (int j=noteTableView.model.rowCount()-1; j>=0; j--) {
- QModelIndex modelIndex = noteTableView.model.index(j, Global.noteTableGuidPosition);
+ for (int j=listManager.getNoteTableModel().rowCount()-1; j>=0; j--) {
+ QModelIndex modelIndex = listManager.getNoteTableModel().index(j, Global.noteTableGuidPosition);
if (modelIndex != null) {
- SortedMap<Integer, Object> ix = noteTableView.model.itemData(modelIndex);
+ SortedMap<Integer, Object> ix = listManager.getNoteTableModel().itemData(modelIndex);
String tableGuid = (String)ix.values().toArray()[0];
if (tableGuid.equals(selectedNoteGUIDs.get(i))) {
- noteTableView.model.removeRow(j);
+ listManager.getNoteTableModel().removeRow(j);
j=-1;
}
}
newNote.setAttributes(new NoteAttributes());
conn.getNoteTable().addNote(newNote, true);
listManager.getUnsynchronizedNotes().add(newNote.getGuid());
- noteTableView.insertRow(listManager, newNote, true, -1);
+ listManager.addNote(newNote);
+ noteTableView.insertRow(newNote, true, -1);
currentNote = newNote;
currentNoteGuid = currentNote.getGuid();
- listManager.addNote(newNote);
refreshEvernoteNote(true);
listManager.countNotebookResults(listManager.getNoteIndex());
browserWindow.titleLabel.setFocus();
listManager.addNote(newNote);
conn.getNoteTable().addNote(newNote, true);
listManager.getUnsynchronizedNotes().add(newNote.getGuid());
- noteTableView.insertRow(listManager, newNote, true, -1);
+ noteTableView.insertRow(newNote, true, -1);
listManager.countNotebookResults(listManager.getNoteIndex());
waitCursor(false);
}
syncRunning = false;
syncRunner.syncNeeded = false;
synchronizeAnimationTimer.stop();
- noteIndexUpdated(true);
synchronizeButton.setIcon(synchronizeAnimation.get(0));
saveNote();
-// noteTableView.selectionModel().selectionChanged.disconnect(this, "noteTableSelection()");
+ listManager.setUnsynchronizedNotes(conn.getNoteTable().getUnsynchronizedGUIDs());
+ listManager.reloadIndexes();
+ noteIndexUpdated(true);
noteTableView.selectionModel().blockSignals(true);
scrollToGuid(currentNoteGuid);
noteTableView.selectionModel().blockSignals(false);
-// noteTableView.selectionModel().selectionChanged.connect(this, "noteTableSelection()");
-// indexRunner.setKeepRunning(Global.keepRunning);
-
- listManager.setUnsynchronizedNotes(conn.getNoteTable().getUnsynchronizedGUIDs());
- for (int i=0; i<noteTableView.model.rowCount(); i++) {
- QModelIndex modelIndex = noteTableView.model.index(i, Global.noteTableGuidPosition);
- if (modelIndex != null) {
- SortedMap<Integer, Object> ix = noteTableView.model.itemData(modelIndex);
- String tableGuid = (String)ix.values().toArray()[0];
- String synch = "true";
- for (int j=0; j<listManager.getUnsynchronizedNotes().size(); j++) {
- if (listManager.getUnsynchronizedNotes().get(j).equalsIgnoreCase(tableGuid)) {
- synch = "false";
- j = listManager.getUnsynchronizedNotes().size();
- }
- }
- noteTableView.model.setData(i, Global.noteTableSynchronizedPosition, synch);
- }
- }
refreshEvernoteNote(false);
scrollToGuid(currentNoteGuid);
setMessage(tr("Synchronization Complete"));
logger.log(logger.MEDIUM, "Sync complete.");
}
-// public void setSequenceDate(long t) {
-// Global.setSequenceDate(t);
-// }
public void saveUploadAmount(long t) {
Global.saveUploadAmount(t);
}
-// public void setUpdateSequenceNumber(int t) {
-// Global.setUpdateSequenceNumber(t);
-// }
public void saveUserInformation(User user) {
Global.saveUserInformation(user);
}
listManager.addNote(newNote);
conn.getNoteTable().addNote(newNote, true);
listManager.getUnsynchronizedNotes().add(newNote.getGuid());
- noteTableView.insertRow(listManager, newNote, true, -1);
+ noteTableView.insertRow(newNote, true, -1);
listManager.updateNoteContent(newNote.getGuid(), importer.getNoteContent());
listManager.countNotebookResults(listManager.getNoteIndex());
importedFiles.add(list.get(i).absoluteFilePath());
listManager.addNote(newNote);
conn.getNoteTable().addNote(newNote, true);
listManager.getUnsynchronizedNotes().add(newNote.getGuid());
- noteTableView.insertRow(listManager, newNote, true, -1);
+ noteTableView.insertRow(newNote, true, -1);
listManager.updateNoteContent(newNote.getGuid(), importer.getNoteContent());
listManager.countNotebookResults(listManager.getNoteIndex());
dir.remove(dir.at(i));