List<QPixmap> syncIcons; // Array of icons used in sync animation
private boolean closeAction = false; // Used to say when to close or when to minimize
private static Logger log = Logger.getLogger(NeverNote.class);
+ private String saveLastPath; // last path we used
String iconPath = new String("classpath:cx/fbn/nevernote/icons/");
if (!stackSelected && !allNotebookSelected) {
icon = conn.getNotebookTable().getIcon(guid);
if (icon == null) {
- dialog = new SetIcon(currentIcon);
+ dialog = new SetIcon(currentIcon, saveLastPath);
dialog.setUseDefaultIcon(true);
} else {
- dialog = new SetIcon(icon);
+ dialog = new SetIcon(icon, saveLastPath);
dialog.setUseDefaultIcon(false);
}
} else {
icon = conn.getSystemIconTable().getIcon(currentSelection.text(0), "ALLNOTEBOOK");
}
if (icon == null) {
- dialog = new SetIcon(currentIcon);
+ dialog = new SetIcon(currentIcon, saveLastPath);
dialog.setUseDefaultIcon(true);
} else {
- dialog = new SetIcon(icon);
+ dialog = new SetIcon(icon, saveLastPath);
dialog.setUseDefaultIcon(false);
}
}
dialog.exec();
if (dialog.okPressed()) {
+ saveLastPath = dialog.getPath();
+
QIcon newIcon = dialog.getIcon();
if (stackSelected) {
conn.getSystemIconTable().setIcon(currentSelection.text(0), "STACK", newIcon, dialog.getFileType());
QIcon icon = conn.getTagTable().getIcon(guid);
SetIcon dialog;
if (icon == null) {
- dialog = new SetIcon(currentIcon);
+ dialog = new SetIcon(currentIcon, saveLastPath);
dialog.setUseDefaultIcon(true);
} else {
- dialog = new SetIcon(icon);
+ dialog = new SetIcon(icon, saveLastPath);
dialog.setUseDefaultIcon(false);
}
dialog.exec();
if (dialog.okPressed()) {
+ saveLastPath = dialog.getPath();
QIcon newIcon = dialog.getIcon();
conn.getTagTable().setIcon(guid, newIcon, dialog.getFileType());
if (newIcon == null)
QIcon icon = conn.getSavedSearchTable().getIcon(guid);
SetIcon dialog;
if (icon == null) {
- dialog = new SetIcon(currentIcon);
+ dialog = new SetIcon(currentIcon, saveLastPath);
dialog.setUseDefaultIcon(true);
} else {
- dialog = new SetIcon(icon);
+ dialog = new SetIcon(icon, saveLastPath);
dialog.setUseDefaultIcon(false);
}
dialog.exec();
if (dialog.okPressed()) {
+ saveLastPath = dialog.getPath();
QIcon newIcon = dialog.getIcon();
conn.getSavedSearchTable().setIcon(guid, newIcon, dialog.getFileType());
if (newIcon == null)
version = osxVersion;
if (System.getProperty("os.name").toLowerCase().contains("Linux")) {
if (System.getProperty("os.arch").contains("amd64") ||
- System.getProperty("os.arch").contains("x86_64") ||
- System.getProperty("os.arch").contains("i686"))
+ System.getProperty("os.arch").contains("x86_64"))
version = linux64Version;
else
version = linuxVersion;
refreshEvernoteNoteList();
logger.log(logger.HIGH, "Calling note table reload in NeverNote.noteIndexUpdated() - "+reload);
noteTableView.load(reload);
+ if (currentNoteGuid == null || currentNoteGuid.equals("")) {
+ int pos;
+ if (noteTableView.proxyModel.sortOrder() == SortOrder.AscendingOrder)
+ pos = noteTableView.proxyModel.rowCount();
+ else
+ pos = 1;
+ if (noteTableView.proxyModel.rowCount() == 0)
+ pos = 0;
+ if (pos>0) {
+ QModelIndex i = noteTableView.proxyModel.index(pos-1, Global.noteTableGuidPosition);
+ if (i!=null) {
+ currentNoteGuid = (String)i.data();
+ noteTableView.selectRow(pos-1);
+ }
+ }
+ }
scrollToGuid(currentNoteGuid);
logger.log(logger.HIGH, "Leaving NeverNote.noteIndexUpdated");
}
browserWindow.setDisabled(true);
}
- if (saveCurrentNoteGuid.equals("") && listManager.getNoteIndex().size() > 0) {
- currentNote = listManager.getNoteIndex().get(listManager.getNoteIndex().size()-1);
- currentNoteGuid = currentNote.getGuid();
- refreshEvernoteNote(true);
- } else {
- //we can reload if note not dirty
-// refreshEvernoteNote(!noteDirty);
+ if (!saveCurrentNoteGuid.equals("")) {
refreshEvernoteNote(false);
+ } else {
+ currentNoteGuid = "";
}
reloadTagTree(false);
// Get a list of valid notebooks
List<Notebook> notebooks = null;
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);
} catch (EDAMUserException e) {
setMessage("EDAMUserException: " +e.getMessage());
return;
} catch (TException e) {
setMessage("EDAMTransactionException: " +e.getMessage());
return;
+ } catch (EDAMNotFoundException e) {
+ setMessage("EDAMNotFoundException: " +e.getMessage());
+ return;
}
// Split up notebooks into synchronized & non-synchronized
}
}
- IgnoreSync ignore = new IgnoreSync(notebooks, ignoredBooks, tags, ignoredTags);
+ // split up linked notebooks into synchronized & non-synchronized
+ List<LinkedNotebook> ignoredLinkedNotebooks = new ArrayList<LinkedNotebook>();
+ List<String> dbIgnoredLinkedNotebooks = conn.getSyncTable().getIgnoreRecords("LINKEDNOTEBOOK");
+ for (int i=linkedNotebooks.size()-1; i>=0; i--) {
+ String notebookGuid = linkedNotebooks.get(i).getGuid();
+ for (int j=0; j<dbIgnoredLinkedNotebooks.size(); j++) {
+ if (notebookGuid.equalsIgnoreCase(dbIgnoredLinkedNotebooks.get(j))) {
+ ignoredLinkedNotebooks.add(linkedNotebooks.get(i));
+ j=dbIgnoredLinkedNotebooks.size();
+ }
+ }
+ }
+
+ IgnoreSync ignore = new IgnoreSync(notebooks, ignoredBooks, tags, ignoredTags, linkedNotebooks, ignoredLinkedNotebooks);
ignore.exec();
if (!ignore.okClicked())
return;
}
}
- conn.getNoteTable().expungeIgnoreSynchronizedNotes(newNotebooks, newTags);
+ // Clear out old tags & add new ones
+ List<String> oldIgnoreLinkedNotebooks = conn.getSyncTable().getIgnoreRecords("LINKEDNOTEBOOK");
+ for (int i=0; i<oldIgnoreLinkedNotebooks.size(); i++) {
+ conn.getSyncTable().deleteRecord("IGNORELINKEDNOTEBOOK-"+oldIgnoreLinkedNotebooks.get(i));
+ }
+
+ List<String> newLinked = new ArrayList<String>();
+ for (int i=ignore.getIgnoredLinkedNotebookList().count()-1; i>=0; i--) {
+ String text = ignore.getIgnoredLinkedNotebookList().takeItem(i).text();
+ for (int j=0; j<linkedNotebooks.size(); j++) {
+ if (linkedNotebooks.get(j).getShareName().equalsIgnoreCase(text)) {
+ LinkedNotebook t = linkedNotebooks.get(j);
+ conn.getSyncTable().addRecord("IGNORELINKEDNOTEBOOK-"+t.getGuid(), t.getGuid());
+ newLinked.add(t.getGuid());
+ j=linkedNotebooks.size();
+ }
+ }
+ }
+
+ conn.getNoteTable().expungeIgnoreSynchronizedNotes(newNotebooks, newTags, newLinked);
waitCursor(false);
refreshLists();
}
fd.setWindowTitle(tr("Backup Database"));
fd.setFilter(tr("NeverNote Export (*.nnex);;All Files (*.*)"));
fd.setAcceptMode(AcceptMode.AcceptSave);
- fd.setDirectory(System.getProperty("user.home"));
+ if (saveLastPath == null || saveLastPath.equals(""))
+ fd.setDirectory(System.getProperty("user.home"));
+ else
+ fd.setDirectory(saveLastPath);
if (fd.exec() == 0 || fd.selectedFiles().size() == 0) {
return;
}
waitCursor(true);
+ saveLastPath = fd.selectedFiles().get(0);
+ saveLastPath = saveLastPath.substring(0,saveLastPath.lastIndexOf("/"));
setMessage(tr("Backing up database"));
saveNote();
// conn.backupDatabase(Global.getUpdateSequenceNumber(), Global.getSequenceDate());
fd.setWindowTitle(tr("Restore Database"));
fd.setFilter(tr("NeverNote Export (*.nnex);;All Files (*.*)"));
fd.setAcceptMode(AcceptMode.AcceptOpen);
- fd.setDirectory(System.getProperty("user.home"));
+ if (saveLastPath == null || saveLastPath.equals(""))
+ fd.setDirectory(System.getProperty("user.home"));
+ else
+ fd.setDirectory(saveLastPath);
if (fd.exec() == 0 || fd.selectedFiles().size() == 0) {
return;
}
waitCursor(true);
+ saveLastPath = fd.selectedFiles().get(0);
+ saveLastPath = saveLastPath.substring(0,saveLastPath.lastIndexOf("/"));
+
setMessage(tr("Restoring database"));
ImportData noteReader = new ImportData(conn, true);
noteReader.importData(fd.selectedFiles().get(0));
fd.setWindowTitle(tr("Import Notes"));
fd.setFilter(tr("NeverNote Export (*.nnex);;All Files (*.*)"));
fd.setAcceptMode(AcceptMode.AcceptOpen);
- fd.setDirectory(System.getProperty("user.home"));
+ if (saveLastPath == null || saveLastPath.equals(""))
+ fd.setDirectory(System.getProperty("user.home"));
+ else
+ fd.setDirectory(saveLastPath);
if (fd.exec() == 0 || fd.selectedFiles().size() == 0) {
return;
}
ImportData noteReader = new ImportData(conn, false);
String fileName = fd.selectedFiles().get(0);
+ saveLastPath.substring(0,fileName.lastIndexOf("/"));
if (!fileName.endsWith(".nnex"))
fileName = fileName +".nnex";