import cx.fbn.nevernote.dialog.ThumbnailViewer;
import cx.fbn.nevernote.dialog.UpgradeAvailableDialog;
import cx.fbn.nevernote.dialog.WatchFolder;
+import cx.fbn.nevernote.evernote.NoteMetadata;
import cx.fbn.nevernote.filters.FilterEditorNotebooks;
import cx.fbn.nevernote.filters.FilterEditorTags;
import cx.fbn.nevernote.gui.AttributeTreeWidget;
noteTableView.setNoteDuplicateAction(menuBar.noteDuplicateAction);
noteTableView.setNoteHistoryAction(menuBar.noteOnlineHistoryAction);
noteTableView.noteSignal.titleColorChanged.connect(this, "titleColorChanged(Integer)");
+ noteTableView.noteSignal.notePinned.connect(this, "notePinned()");
noteTableView.setMergeNotesAction(menuBar.noteMergeAction);
noteTableView.setCopyAsUrlAction(menuBar.noteCopyAsUrlAction);
noteTableView.doubleClicked.connect(this, "listDoubleClick()");
Global.setColumnPosition("noteTableGuidPosition", position);
position = noteTableView.header.visualIndex(Global.noteTableThumbnailPosition);
Global.setColumnPosition("noteTableThumbnailPosition", position);
+ position = noteTableView.header.visualIndex(Global.noteTablePinnedPosition);
+ Global.setColumnPosition("noteTablePinnedPosition", position);
}
// Save column widths for the next time
if (tagTree.selectedItems().size() > 0)
filter = true;
tagTree.showAllTags(!filter);
+ tagIndexUpdated(false);
logger.log(logger.HIGH, "Leaving NeverNote.reloadTagTree");
}
// Edit an existing tag
// Title color has changed
@SuppressWarnings("unused")
private void titleColorChanged(Integer color) {
- logger.log(logger.HIGH, "Entering NeverNote.updateListAuthor");
+ logger.log(logger.HIGH, "Entering NeverNote.titleColorChanged");
QColor backgroundColor = new QColor();
QColor foregroundColor = new QColor(QColor.black);
}
}
}
- logger.log(logger.HIGH, "Leaving NeverNote.updateListAuthor");
+ logger.log(logger.HIGH, "Leaving NeverNote.titleColorChanged");
+ }
+ // A note has been pinned or unpinned
+ @SuppressWarnings("unused")
+ private void notePinned() {
+ logger.log(logger.EXTREME, "Entering NeverNote.notePinned()");
+
+ for (int j=0; j<selectedNoteGUIDs.size(); j++) {
+ NoteMetadata meta = listManager.getNoteMetadata().get(selectedNoteGUIDs.get(j));
+ boolean pinned = !meta.isPinned();
+ meta.setPinned(pinned); // Toggle the pinned/unpinned
+
+ // Update the list & table
+ listManager.updateNoteMetadata(meta);
+ noteTableView.proxyModel.addGuid(selectedNoteGUIDs.get(j), meta);
+ }
+
+ logger.log(logger.EXTREME, "Leaving NeverNote.setNoteDirty()");
}
// Wide list was chosen
public void narrowListView() {
// 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))
+ if (listManager.getNoteMetadata().containsKey(currentNoteGuid) &&
+ listManager.getNoteMetadata().get(currentNoteGuid).isDirty()) {
return;
}
// If this wasn't already marked as unsynchronized, then we need to update the table
listManager.getNoteTableModel().updateNoteSyncStatus(currentNoteGuid, false);
-/* listManager.getUnsynchronizedNotes().add(currentNoteGuid);
+// listManager.getUnsynchronizedNotes().add(currentNoteGuid);
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 tableGuid = (String)ix.values().toArray()[0];
if (tableGuid.equals(currentNoteGuid)) {
- listManager.getNoteTableModel().setData(i, Global.noteTableSynchronizedPosition, "false");
+ listManager.getNoteTableModel().proxyModel.setData(i, Global.noteTableSynchronizedPosition, "false");
return;
}
}
}
- */
+
logger.log(logger.EXTREME, "Leaving NeverNote.setNoteDirty()");
}
@SuppressWarnings("unused")
}
conn.getNoteTable().addNote(newNote, true);
- listManager.getUnsynchronizedNotes().add(newNote.getGuid());
- listManager.addNote(newNote);
+ NoteMetadata metadata = new NoteMetadata();
+ metadata.setGuid(newNote.getGuid());
+ metadata.setDirty(true);
+ listManager.addNote(newNote, metadata);
// noteTableView.insertRow(newNote, true, -1);
currentNote = newNote;
for (int i=0; i<listManager.getNoteIndex().size(); i++) {
if (listManager.getNoteIndex().get(i).getGuid().equals(newGuid)) {
- noteTableView.proxyModel.addGuid(newGuid);
+ noteTableView.proxyModel.addGuid(newGuid, listManager.getNoteMetadata().get(newGuid));
i=listManager.getNoteIndex().size();
}
}
- if (listManager.getNoteTableModel().titleColors.containsKey(oldGuid)) {
- int color = listManager.getNoteTableModel().titleColors.get(oldGuid);
- listManager.getNoteTableModel().titleColors.put(newGuid, color);
- listManager.getNoteTableModel().titleColors.remove(oldGuid);
+ if (listManager.getNoteTableModel().metaData.containsKey(oldGuid)) {
+ NoteMetadata meta = listManager.getNoteTableModel().metaData.get(oldGuid);
+ listManager.getNoteTableModel().metaData.put(newGuid, meta);
+ listManager.getNoteTableModel().metaData.remove(oldGuid);
}
}
newNote.setResources(resList);
// Add note to the database
- listManager.addNote(newNote);
conn.getNoteTable().addNote(newNote, true);
- listManager.getUnsynchronizedNotes().add(newNote.getGuid());
- noteTableView.insertRow(newNote, true, -1);
+ NoteMetadata metaData = new NoteMetadata();
+ NoteMetadata oldMeta = listManager.getNoteMetadata().get(oldNote.getGuid());
+ metaData.copy(oldMeta);
+ metaData.setGuid(newNote.getGuid());
+ listManager.addNote(newNote, metaData);
+ noteTableView.insertRow(newNote, metaData, true, -1);
currentNoteGuid = newNote.getGuid();
currentNote = newNote;
refreshEvernoteNote(true);
n.getResources().get(i).setActive(true);
conn.getNoteTable().noteResourceTable.saveNoteResource(n.getResources().get(i), true);
}
- listManager.addNote(n);
+ NoteMetadata metadata = new NoteMetadata();
+ metadata.setGuid(n.getGuid());
+ listManager.addNote(n, metadata);
conn.getNoteTable().addNote(n, true);
refreshEvernoteNote(true);
setMessage(tr("Note has been restored."));
if (currentNote == null) {
currentNote = conn.getNoteTable().getNote(currentNoteGuid, false, false, false, false, true);
}
- listManager.setUnsynchronizedNotes(conn.getNoteTable().getUnsynchronizedGUIDs());
- noteIndexUpdated(false);
+ listManager.refreshNoteMetadata();
+ noteIndexUpdated(true);
noteTableView.selectionModel().blockSignals(true);
scrollToGuid(currentNoteGuid);
noteTableView.selectionModel().blockSignals(false);
conn.getLinkedNotebookTable().expungeNotebook(guid, false);
evernoteSync();
}
-/* if (syncDialog.convertToLocal.isChecked()) {
- conn.getNotebookTable().convertFromSharedNotebook(notebookGuid, true);
- conn.getLinkedNotebookTable().expungeNotebook(guid, false);
- evernoteSync();
- }
- if (syncDialog.convertToShared.isChecked()) {
- conn.getLinkedNotebookTable().expungeNotebook(guid, false);
- conn.getNotebookTable().convertFromSharedNotebook(notebookGuid, false);
- evernoteSync();
- } */
refreshLists();
return;
}
Note newNote = importer.getNote();
newNote.setNotebookGuid(notebook);
newNote.setTitle(dir.at(i));
- listManager.addNote(newNote);
+ NoteMetadata metadata = new NoteMetadata();
+ metadata.setDirty(true);
+ metadata.setGuid(newNote.getGuid());
+ listManager.addNote(newNote, metadata);
conn.getNoteTable().addNote(newNote, true);
- listManager.getUnsynchronizedNotes().add(newNote.getGuid());
- noteTableView.insertRow(newNote, true, -1);
+ noteTableView.insertRow(newNote, metadata, true, -1);
listManager.updateNoteContent(newNote.getGuid(), importer.getNoteContent());
listManager.countNotebookResults(listManager.getNoteIndex());
importedFiles.add(list.get(i).absoluteFilePath());
Note newNote = importer.getNote();
newNote.setNotebookGuid(notebook);
newNote.setTitle(dir.at(i));
- listManager.addNote(newNote);
+ NoteMetadata metadata = new NoteMetadata();
+ metadata.setDirty(true);
+ metadata.setGuid(newNote.getGuid());
+ listManager.addNote(newNote, metadata);
conn.getNoteTable().addNote(newNote, true);
- listManager.getUnsynchronizedNotes().add(newNote.getGuid());
- noteTableView.insertRow(newNote, true, -1);
+ noteTableView.insertRow(newNote, metadata, true, -1);
listManager.updateNoteContent(newNote.getGuid(), importer.getNoteContent());
listManager.countNotebookResults(listManager.getNoteIndex());
dir.remove(dir.at(i));