/*
- * This file is part of NeverNote
+ * This file is part of NixNote
* Copyright 2009 Randy Baumgarte
*
* This file may be licensed under the terms of of the
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;
conn = dbConn;
if (conn.getConnection() == null) {
String msg = new String(tr("Unable to connect to the database.\n\nThe most probable reason is that some other process\n" +
- "is accessing the database or NeverNote is already running.\n\n" +
- "Please end any other process or shutdown the other NeverNote before starting.\n\nExiting program."));
+ "is accessing the database or NixNote is already running.\n\n" +
+ "Please end any other process or shutdown the other NixNote before starting.\n\nExiting program."));
QMessageBox.critical(null, tr("Database Connection Error") ,msg);
System.exit(16);
QApplication.setStyle(Global.getStyle());
if (Global.useStandardPalette())
QApplication.setPalette(QApplication.style().standardPalette());
- setWindowTitle(tr("NeverNote"));
+ setWindowTitle(tr("NixNote"));
mainLeftRightSplitter = new QSplitter();
setCentralWidget(mainLeftRightSplitter);
tagTree = new TagTreeWidget(conn);
savedSearchTree = new SavedSearchTreeWidget();
trashTree = new TrashTreeWidget();
- noteTableView = new TableView(logger, listManager);
-
+ noteTableView = new TableView(logger, listManager);
searchField = new QComboBox();
searchField.setObjectName("searchField");
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()");
trayIcon = new QSystemTrayIcon(this);
- trayIcon.setToolTip(tr("NeverNote"));
+ trayIcon.setToolTip(tr("NixNote"));
trayIcon.setContextMenu(trayMenu);
trayIcon.activated.connect(this, "trayActivated(com.trolltech.qt.gui.QSystemTrayIcon$ActivationReason)");
int sortCol = Global.getSortColumn();
int sortOrder = Global.getSortOrder();
+ noteTableView.proxyModel.blocked = true;
noteTableView.sortByColumn(sortCol, SortOrder.resolve(sortOrder));
+ noteTableView.proxyModel.blocked = false;
+ noteTableView.proxyModel.sortChanged.connect(this, "tableSortOrderChanged(Integer,Integer)");
+
if (Global.checkVersionUpgrade())
checkForUpdates();
}
ApplicationLogger logger = new ApplicationLogger("nevernote-database.log");
File f = Global.getFileManager().getDbDirFile(Global.databaseName + ".h2.db");
- boolean dbExists = f.exists();
- if (!dbExists)
+ File fr = Global.getFileManager().getDbDirFile(Global.resourceDatabaseName + ".h2.db");
+ File fi = Global.getFileManager().getDbDirFile(Global.resourceDatabaseName + ".h2.db");
+ if (!f.exists())
Global.setDatabaseUrl("");
+ if (!fr.exists())
+ Global.setResourceDatabaseUrl("");
+ if (!fi.exists())
+ Global.setIndexDatabaseUrl("");
if (Global.getDatabaseUrl().toUpperCase().indexOf("CIPHER=") > -1) {
boolean goodCheck = false;
// Encrypt the database upon shutdown
private void encryptOnShutdown() {
String dbPath= Global.getFileManager().getDbDirPath("");
- String dbName = "NeverNote";
try {
+
Statement st = conn.getConnection().createStatement();
st.execute("shutdown");
+ st = conn.getResourceConnection().createStatement();
+ st.execute("shutdown");
+ st = conn.getIndexConnection().createStatement();
+ st.execute("shutdown");
if (QMessageBox.question(this, tr("Are you sure"),
tr("Are you sure you wish to encrypt the database?"),
QMessageBox.StandardButton.Yes,
QMessageBox.StandardButton.No) == StandardButton.Yes.value()) {
- ChangeFileEncryption.execute(dbPath, dbName, encryptCipher, null, Global.cipherPassword.toCharArray(), true);
+ ChangeFileEncryption.execute(dbPath, "NeverNote", encryptCipher, null, Global.cipherPassword.toCharArray(), true);
+ ChangeFileEncryption.execute(dbPath, "Resources", encryptCipher, null, Global.cipherPassword.toCharArray(), true);
+ ChangeFileEncryption.execute(dbPath, "Index", encryptCipher, null, Global.cipherPassword.toCharArray(), true);
Global.setDatabaseUrl(Global.getDatabaseUrl() + ";CIPHER="+encryptCipher);
+ Global.setResourceDatabaseUrl(Global.getResourceDatabaseUrl() + ";CIPHER="+encryptCipher);
+ Global.setIndexDatabaseUrl(Global.getIndexDatabaseUrl() + ";CIPHER="+encryptCipher);
+
QMessageBox.information(this, tr("Encryption Complete"), tr("Encryption is complete"));
}
} catch (SQLException e) {
ChangeFileEncryption.execute(dbPath, dbName, encryptCipher, Global.cipherPassword.toCharArray(), null, true);
Global.setDatabaseUrl("");
+ Global.setResourceDatabaseUrl("");
+ Global.setIndexDatabaseUrl("");
QMessageBox.information(this, tr("Decryption Complete"), tr("Decryption is complete"));
}
} catch (SQLException e) {
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
// Listener when a notebook is selected
private void notebookTreeSelection() {
logger.log(logger.HIGH, "Entering NeverNote.notebookTreeSelection");
-
+ noteTableView.proxyModel.blocked = true;
+
clearTrashFilter();
clearAttributeFilter();
clearSavedSearchFilter();
refreshEvernoteNote(true);
listManager.refreshCounters = true;
listManager.refreshCounters();
+ if (selectedNotebookGUIDs.size() == 1) {
+ int col = conn.getNotebookTable().getSortColumn(selectedNotebookGUIDs.get(0));
+ int order = conn.getNotebookTable().getSortOrder(selectedNotebookGUIDs.get(0));
+ if (col != -1) {
+ noteTableView.proxyModel.blocked = true;
+ if (order == 1)
+ noteTableView.sortByColumn(col, Qt.SortOrder.DescendingOrder);
+ else
+ noteTableView.sortByColumn(col, Qt.SortOrder.AscendingOrder);
+ }
+ }
+ noteTableView.proxyModel.blocked = false;
logger.log(logger.HIGH, "Leaving NeverNote.notebookTreeSelection");
}
if (tagTree.selectedItems().size() > 0)
filter = true;
tagTree.showAllTags(!filter);
+ tagIndexUpdated(false);
logger.log(logger.HIGH, "Leaving NeverNote.reloadTagTree");
}
// Edit an existing tag
logger.log(logger.HIGH, "Entering NeverNote.compactDatabase");
if (QMessageBox.question(this, tr("Confirmation"), tr("This will free unused space in the database, "+
"but please be aware that depending upon the size of your database this can be time consuming " +
- "and NeverNote will be unresponsive until it is complete. Do you wish to continue?"),
+ "and NixNote will be unresponsive until it is complete. Do you wish to continue?"),
QMessageBox.StandardButton.Yes,
QMessageBox.StandardButton.No)==StandardButton.No.value() && Global.verifyDelete() == true) {
return;
private void about() {
logger.log(logger.HIGH, "Entering NeverNote.about");
QMessageBox.about(this,
- tr("About NeverNote"),
- tr("<h4><center><b>NeverNote</b></center></h4><hr><center>Version ")
+ tr("About NixNote"),
+ tr("<h4><center><b>NixNote</b></center></h4><hr><center>Version ")
+Global.version
+tr("<hr></center>Evernote"
+"An Open Source Evernote Client.<br><br>"
}
// Synchronize with Evernote
- @SuppressWarnings("unused")
+
private void evernoteSync() {
logger.log(logger.HIGH, "Entering NeverNote.evernoteSync");
if (!Global.isConnected)
// 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() {
sortCol = Global.getSortColumn();
sortOrder = Global.getSortOrder();
+ noteTableView.proxyModel.blocked = true;
noteTableView.sortByColumn(sortCol, SortOrder.resolve(sortOrder));
+ noteTableView.proxyModel.blocked = false;
+
showColumns();
noteTableView.load(false);
sortCol = Global.getSortColumn();
sortOrder = Global.getSortOrder();
+ noteTableView.proxyModel.blocked = true;
noteTableView.sortByColumn(sortCol, SortOrder.resolve(sortOrder));
-
+ noteTableView.proxyModel.blocked = false;
+
showColumns();
noteTableView.load(false);
scrollToCurrentGuid();
}
-
+ // Sort order for the notebook has changed
+ public void tableSortOrderChanged(Integer column, Integer order) {
+
+ // Find what notebook (if any) is selected. We ignore stacks & the "All Notebooks".
+ List<QTreeWidgetItem> selectedNotebook = notebookTree.selectedItems();
+ if (selectedNotebook.size() > 0 && !selectedNotebook.get(0).text(0).equalsIgnoreCase("All Notebooks") && !selectedNotebook.get(0).text(2).equalsIgnoreCase("STACK")) {
+ QTreeWidgetItem currentSelectedNotebook = selectedNotebook.get(0);
+ String notebook;
+ notebook = currentSelectedNotebook.text(2);
+ conn.getNotebookTable().setSortOrder(notebook, column, order);
+ }
+ }
//***************************************************************
@SuppressWarnings("unused")
private void externalWindowClosing(String guid) {
externalWindows.remove(guid);
}
-
+
//***************************************************************
QTextCodec codec = QTextCodec.codecForName("UTF-8");
QByteArray unicode = codec.fromUnicode(browserWindow.getContent());
ExternalBrowse window = externalWindows.get(currentNoteGuid);
- window.getBrowserWindow().getBrowser().setContent(unicode);
+ window.getBrowserWindow().setContent(unicode);
}
// If the note is dirty, then it is unsynchronized by default.
// 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")
noteCache.put(guid, unicode.toString());
if (guid.equals(currentNoteGuid)) {
noteDirty = true;
- browserWindow.getBrowser().setContent(unicode);
+ browserWindow.setContent(unicode);
}
if (save) {
thumbnailRunner.addWork("GENERATE "+ guid);
// if (Global.enableHTMLEntitiesFix) {
// browser.getBrowser().setContent(new QByteArray(StringEscapeUtils.unescapeHtml(js.toString())));
// } else
- browser.getBrowser().setContent(js);
+ browser.setContent(js);
noteCache.put(guid, js.toString());
if (formatter.resourceError)
if (formatter.formatError) {
waitCursor(false);
QMessageBox.information(this, tr("Error"),
- tr("NeverNote had issues formatting this note." +
+ tr("NixNote had issues formatting this note." +
" To protect your data this note is being marked as read-only."));
waitCursor(true);
}
logger.log(logger.HIGH, "Note content is being pulled from the cache");
String cachedContent = formatter.modifyCachedTodoTags(noteCache.get(guid));
js = new QByteArray(cachedContent);
- browser.getBrowser().setContent(js);
+ browser.setContent(js);
if (readOnlyCache.containsKey(guid))
readOnly = true;
if (inkNoteCache.containsKey(guid))
String notebook = null;
listManager.getNotebookIndex().get(0).getGuid();
List<QTreeWidgetItem> selectedNotebook = notebookTree.selectedItems();
- if (selectedNotebook.size() > 0 && !selectedNotebook.get(0).text(0).equalsIgnoreCase("All Notebooks")) {
+ if (selectedNotebook.size() > 0 && !selectedNotebook.get(0).text(0).equalsIgnoreCase("All Notebooks") && !selectedNotebook.get(0).text(2).equalsIgnoreCase("STACK")) {
QTreeWidgetItem currentSelectedNotebook = selectedNotebook.get(0);
notebook = currentSelectedNotebook.text(2);
} else {
}
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);
}
}
Note oldNote = conn.getNoteTable().getNote(guid, true, false,false,false,true);
List<Resource> resList = conn.getNoteTable().noteResourceTable.getNoteResources(guid, true);
- oldNote.setContent(conn.getNoteTable().getNoteContentBinary(guid));
+ oldNote.setContent(conn.getNoteTable().getNoteContentNoUTFConversion(guid));
oldNote.setResources(resList);
duplicateNote(oldNote);
}
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);
}
}
msg = tr("An error has happened while saving the note \"") +title+
- tr("\".\n\nThis is probably due to a document that is too complex for Nevernote to process. "+
+ tr("\".\n\nThis is probably due to a document that is too complex for NixNote to process. "+
"As a result, changes to the note may not be saved properly in the database."+
"\n\nA cached copy is being preserved so you can recover any data, but data may" +
"\nbe lost. Please review the note to recover any critical data before restarting.");
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;
}
thumbnailRunner.interrupt = true;
indexRunner.addWork("SCAN");
}
- logger.log(logger.EXTREME, "Leaving neverNote index timer");
+ logger.log(logger.EXTREME, "Leaving NixNote index timer");
}
@SuppressWarnings("unused")
if (!alive) {
tagDeadCount++;
if (tagDeadCount > MAX && !disableTagThreadCheck) {
- QMessageBox.information(this, tr("A thread his died."), tr("It appears as the tag counter thread has died. I recommend "+
- "checking stopping NeverNote, saving the logs for later viewing, and restarting. Sorry."));
+ QMessageBox.information(this, tr("A thread has died."), tr("It appears as the tag counter thread has died. I recommend "+
+ "checking stopping NixNote, saving the logs for later viewing, and restarting. Sorry."));
disableTagThreadCheck = true;
}
} else
if (!alive) {
notebookThreadDeadCount++;
if (notebookThreadDeadCount > MAX && !disableNotebookThreadCheck) {
- QMessageBox.information(this, tr("A thread his died."), tr("It appears as the notebook counter thread has died. I recommend "+
- "checking stopping NeverNote, saving the logs for later viewing, and restarting. Sorry."));
+ QMessageBox.information(this, tr("A thread has died."), tr("It appears as the notebook counter thread has died. I recommend "+
+ "checking stopping NixNote, saving the logs for later viewing, and restarting. Sorry."));
disableNotebookThreadCheck=true;
}
} else
if (!alive) {
trashDeadCount++;
if (trashDeadCount > MAX && !disableTrashThreadCheck) {
- QMessageBox.information(this, tr("A thread his died."), ("It appears as the trash counter thread has died. I recommend "+
- "checking stopping NeverNote, saving the logs for later viewing, and restarting. Sorry."));
+ QMessageBox.information(this, tr("A thread has died."), ("It appears as the trash counter thread has died. I recommend "+
+ "checking stopping NixNote, saving the logs for later viewing, and restarting. Sorry."));
disableTrashThreadCheck = true;
}
} else
if (!alive) {
saveThreadDeadCount++;
if (saveThreadDeadCount > MAX && !disableSaveThreadCheck) {
- QMessageBox.information(this, tr("A thread his died."), tr("It appears as the note saver thread has died. I recommend "+
- "checking stopping NeverNote, saving the logs for later viewing, and restarting. Sorry."));
+ QMessageBox.information(this, tr("A thread has died."), tr("It appears as the note saver thread has died. I recommend "+
+ "checking stopping NixNote, saving the logs for later viewing, and restarting. Sorry."));
disableSaveThreadCheck = true;
}
} else
if (!syncThread.isAlive()) {
syncThreadDeadCount++;
if (syncThreadDeadCount > MAX && !disableSyncThreadCheck) {
- QMessageBox.information(this, tr("A thread his died."), tr("It appears as the synchronization thread has died. I recommend "+
- "checking stopping NeverNote, saving the logs for later viewing, and restarting. Sorry."));
+ QMessageBox.information(this, tr("A thread has died."), tr("It appears as the synchronization thread has died. I recommend "+
+ "checking stopping NixNote, saving the logs for later viewing, and restarting. Sorry."));
disableSyncThreadCheck = true;
}
} else
if (!indexThread.isAlive()) {
indexThreadDeadCount++;
if (indexThreadDeadCount > MAX && !disableIndexThreadCheck) {
- QMessageBox.information(this, tr("A thread his died."), tr("It appears as the index thread has died. I recommend "+
- "checking stopping NeverNote, saving the logs for later viewing, and restarting. Sorry."));
+ QMessageBox.information(this, tr("A thread has died."), tr("It appears as the index thread has died. I recommend "+
+ "checking stopping NixNote, saving the logs for later viewing, and restarting. Sorry."));
disableIndexThreadCheck = true;
}
} else
fd.setFileMode(FileMode.AnyFile);
fd.setConfirmOverwrite(true);
fd.setWindowTitle(tr("Backup Database"));
- fd.setFilter(tr("NeverNote Export (*.nnex);;All Files (*.*)"));
+ fd.setFilter(tr("NixNote Export (*.nnex);;All Files (*.*)"));
fd.setAcceptMode(AcceptMode.AcceptSave);
if (saveLastPath == null || saveLastPath.equals(""))
fd.setDirectory(System.getProperty("user.home"));
fd.setFileMode(FileMode.ExistingFile);
fd.setConfirmOverwrite(true);
fd.setWindowTitle(tr("Restore Database"));
- fd.setFilter(tr("NeverNote Export (*.nnex);;All Files (*.*)"));
+ fd.setFilter(tr("NixNote Export (*.nnex);;All Files (*.*)"));
fd.setAcceptMode(AcceptMode.AcceptOpen);
if (saveLastPath == null || saveLastPath.equals(""))
fd.setDirectory(System.getProperty("user.home"));
fd.setFileMode(FileMode.AnyFile);
fd.setConfirmOverwrite(true);
fd.setWindowTitle(tr("Backup Database"));
- fd.setFilter(tr("NeverNote Export (*.nnex);;All Files (*.*)"));
+ fd.setFilter(tr("NixNote Export (*.nnex);;All Files (*.*)"));
fd.setAcceptMode(AcceptMode.AcceptSave);
fd.setDirectory(System.getProperty("user.home"));
if (fd.exec() == 0 || fd.selectedFiles().size() == 0) {
fd.setFileMode(FileMode.ExistingFile);
fd.setConfirmOverwrite(true);
fd.setWindowTitle(tr("Import Notes"));
- fd.setFilter(tr("NeverNote Export (*.nnex);;All Files (*.*)"));
+ fd.setFilter(tr("NixNote Export (*.nnex);;All Files (*.*)"));
fd.setAcceptMode(AcceptMode.AcceptOpen);
if (saveLastPath == null || saveLastPath.equals(""))
fd.setDirectory(System.getProperty("user.home"));
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));
String content = browser.getContent().substring(0,position) +
newSegment +
browser.getContent().substring(endPos);
- browser.getBrowser().setContent(new QByteArray(content));;
+ browser.setContent(new QByteArray(content));;
}
position = browser.getContent().indexOf("en-tag=\"en-media\" guid=\""+guid+"\" type=", position+1);
return true;
}
-
+ //*************************************************
+ //* View / Hide source HTML for a note
+ //*************************************************
+ public void viewSource() {
+ browserWindow.showSource(menuBar.viewSource.isChecked());
+ }
//*************************************************
// Block the program. This is used for things
// like async web calls.