boolean encryptOnShutdown; // should I encrypt when I close?
boolean decryptOnShutdown; // should I decrypt on shutdown;
String encryptCipher; // What cipher should I use?
- Signal0 minimizeToTray;
+ //Signal0 minimizeToTray;
boolean windowMaximized = false; // Keep track of the window state for restores
List<String> pdfReadyQueue; // Queue of PDFs that are ready to be rendered.
List<QPixmap> syncIcons; // Array of icons used in sync animation
tagTree.showAllTags(true);
QIcon appIcon = new QIcon(iconPath+"nevernote.png");
- setWindowIcon(appIcon);
- trayIcon.setIcon(appIcon);
- if (Global.showTrayIcon())
- trayIcon.show();
- else
- trayIcon.hide();
+ if (QSystemTrayIcon.isSystemTrayAvailable()) {
+ setWindowIcon(appIcon);
+ trayIcon.setIcon(appIcon);
+ if (Global.showTrayIcon() || Global.minimizeOnClose())
+ trayIcon.show();
+ else
+ trayIcon.hide();
+ }
scrollToGuid(currentNoteGuid);
if (Global.automaticLogin()) {
noteTableView.proxyModel.blocked = false;
noteTableView.proxyModel.sortChanged.connect(this, "tableSortOrderChanged(Integer,Integer)");
+ // Set the startup notebook
+ String defaultNotebook = Global.getStartupNotebook();
+ if (!defaultNotebook.equals("AllNotebooks") && !defaultNotebook.equals("")) {
+ for (int k=0; k<listManager.getNotebookIndex().size(); k++) {
+ if (listManager.getNotebookIndex().get(k).isDefaultNotebook()) {
+ notebookTree.clearSelection();
+ notebookTree.selectGuid(listManager.getNotebookIndex().get(k).getGuid());
+ notebookTree.selectionSignal.emit();
+ }
+ }
+ }
+
if (Global.checkVersionUpgrade())
checkForUpdates();
}
}
NeverNote application = new NeverNote(dbConn);
+ if (Global.syncOnly) {
+ System.out.println("Performing synchronization only.");
+ application.remoteConnect();
+ if (Global.isConnected) {
+ application.syncRunner.syncNeeded = true;
+ application.syncRunner.addWork("SYNC");
+ application.syncRunner.addWork("STOP");
+ while(!application.syncRunner.isIdle());
+ application.closeNeverNote();
+ }
+ return;
+ }
application.setAttribute(WidgetAttribute.WA_DeleteOnClose, true);
if (Global.startMinimized())
startupConfig.setHomeDirPath(arg.substring(arg.indexOf('=') + 1));
if (lower.startsWith("--disable-viewing"))
startupConfig.setDisableViewing(true);
+ if (lower.startsWith("--sync-only=true"))
+ startupConfig.setSyncOnly(true);
}
Global.setup(startupConfig);
+
}
// Exit point
@Override
public void closeEvent(QCloseEvent event) {
- if (Global.minimizeOnClose() && !closeAction && Global.showTrayIcon()) {
+ if (Global.minimizeOnClose() && !closeAction) {
event.ignore();
hide();
return;
waitCursor(true);
if (currentNote!= null & browserWindow!=null) {
- if (!currentNote.getTitle().equals(browserWindow.getTitle()))
+ if (currentNote.getTitle() != null && browserWindow != null
+ && !currentNote.getTitle().equals(browserWindow.getTitle()))
conn.getNoteTable().updateNoteTitle(currentNote.getGuid(), browserWindow.getTitle());
}
saveNote();
indexRunner.indexNoteTitle = Global.indexNoteTitle();
indexRunner.specialIndexCharacters = Global.getSpecialIndexCharacters();
indexRunner.indexImageRecognition = Global.indexImageRecognition();
- if (Global.showTrayIcon())
+ if (Global.showTrayIcon() || Global.minimizeOnClose())
trayIcon.show();
else
trayIcon.hide();
QTextEdit textBox = new QTextEdit();
layout.addWidget(textBox);
textBox.setReadOnly(true);
- QFile file = new QFile(Global.getFileManager().getHomeDirPath("release.txt"));
+ QFile file = new QFile(Global.getFileManager().getProgramDirPath("release.txt"));
if (!file.open(new QIODevice.OpenMode(QIODevice.OpenModeFlag.ReadOnly,
QIODevice.OpenModeFlag.Text)))
return;
QMessageBox.about(this,
tr("About NixNote"),
tr("<h4><center><b>NixNote</b></center></h4><hr><center>Version ")
- +Global.version
+ //+Global.version
+ +"1.2.120404"
+tr("<hr>"
+"Open Source Evernote Client.<br><br>"
+"Licensed under GPL v2. <br><hr><br>"
- +"</center>Evernote is copyright 2001-2010 by Evernote Corporation<br>"
+ +"</center>Evernote is copyright 2001-2012 by Evernote Corporation<br>"
+"Jambi and QT are the licensed trademark of Nokia Corporation<br>"
+"PDFRenderer is licened under the LGPL<br>"
+"JTidy is copyrighted under the World Wide Web Consortium<br>"
listManager.setEnSearch(text.trim());
listManager.loadNotesIndex();
noteIndexUpdated(false);
+
refreshEvernoteNote(true);
searchPerformed = true;
+ waitCursor(false);
logger.log(logger.HIGH, "Leaving NeverNote.searchFieldChanged");
}
menuBar.noteRestoreAction.setVisible(false);
}
else {
+ trashNoteGuid = tempGuid;
currentNoteGuid = trashNoteGuid;
- trashNoteGuid = tempGuid;
menuBar.noteRestoreAction.setEnabled(true);
menuBar.noteRestoreAction.setVisible(true);
Global.showDeleted = true;
browserWindow.setDisabled(true);
}
+ if (Global.showDeleted && listManager.getNotebookIndex().size() > 0 && saveCurrentNoteGuid.equals("")) {
+ currentNoteGuid = listManager.getNoteIndex().get(0).getGuid();
+ saveCurrentNoteGuid = currentNoteGuid;
+ refreshEvernoteNote(true);
+ }
+
if (!saveCurrentNoteGuid.equals("")) {
refreshEvernoteNote(false);
} else {
- currentNoteGuid = "";
+ currentNoteGuid = "";
}
reloadTagTree(false);
Global.cryptCounter =0;
if (readOnly) {
browserWindow.setReadOnly(true);
- return;
}
if (!reload)
if (conn.getNoteTable().isThumbnailNeeded(guid)) {
thumbnailHTMLReady(guid, js, Global.calculateThumbnailZoom(js.toString()));
}
- if (readOnly || inkNote)
+ if (readOnly || inkNote ||
+ (note.getAttributes() != null && note.getAttributes().getContentClass() != null && note.getAttributes().getContentClass() != ""))
browser.getBrowser().page().setContentEditable(false); // We don't allow editing of ink notes
else
browser.getBrowser().page().setContentEditable(true);
@SuppressWarnings("unused")
private void updateNoteTitle(String guid, String title) {
listManager.setNoteSynchronized(guid, false);
+
+ // We do this manually because if we've edited the note in an
+ // external window we run into the possibility of signal recursion
+ // looping.
+ if (guid.equals(currentNoteGuid)) {
+ browserWindow.titleLabel.blockSignals(true);
+ browserWindow.titleLabel.setText(title);
+ browserWindow.titleLabel.blockSignals(false);
+ }
}
// Signal received that note content has changed. Normally we just need the guid to remove
// it from the cache.
else
noteReader.setNotebookGuid(listManager.getNotebookIndex().get(0).getGuid());
+ waitCursor(false);
+ if (QMessageBox.question(this, tr("Confirmation"),
+ tr("Create new tags from import?"),
+ QMessageBox.StandardButton.Yes,
+ QMessageBox.StandardButton.No) == StandardButton.Yes.value()) {
+ noteReader.createNewTags = true;
+ } else
+ noteReader.createNewTags = false;
+ waitCursor(true);
noteReader.importData(fileName);
if (noteReader.lastError != 0) {
@Override
public void changeEvent(QEvent e) {
if (e.type() == QEvent.Type.WindowStateChange) {
- if (isMinimized() && Global.showTrayIcon()) {
- e.accept();
- QTimer.singleShot(10, this, "hide()");
- return;
+ if (QSystemTrayIcon.isSystemTrayAvailable()) {
+ if (isMinimized() && (Global.showTrayIcon() || Global.showTrayIcon())) {
+ e.accept();
+ QTimer.singleShot(10, this, "hide()");
+ return;
+ }
+ if (isMaximized())
+ windowMaximized = true;
+ else
+ windowMaximized = false;
}
- if (isMaximized())
- windowMaximized = true;
- else
- windowMaximized = false;
}
}