Note currentNote; // The currently viewed note
// ICHANGED
HashMap<Integer, Boolean> noteDirty; // Has the note been changed?
- boolean inkNote; // if this is an ink note, it is read only
+ HashMap<Integer, Boolean> inkNote; // if this is an ink note, it is read only
boolean readOnly; // Is this note read-only?
noteDirty = new HashMap<Integer, Boolean>();
noteDirty.put(index, false);
+
+ inkNote = new HashMap<Integer, Boolean>();
// ICHANGED
// 履歴記録のハッシュマップを初期化
TabBrowse newBrowser = new TabBrowse(conn, tabBrowser, cbObserver);
showEditorButtons(newBrowser.getBrowserWindow());
+ String noteTitle = note.getTitle();
+ int index = tabBrowser.addNewTab(newBrowser, noteTitle);
+ tabWindows.put(index, newBrowser);
+ noteDirty.put(index, false);
+
// noteTableViewの選択を変更するとselectionChangedが発生してしまうので一度切断
noteTableView.selectionModel().selectionChanged.disconnect(this, "noteTableSelection()");
loadNoteBrowserInformation(newBrowser.getBrowserWindow(), guid, note);
setupBrowserWindowListeners(newBrowser.getBrowserWindow(), false);
- String noteTitle = note.getTitle();
- int index = tabBrowser.addNewTab(newBrowser, noteTitle);
- tabWindows.put(index, newBrowser);
- noteDirty.put(index, false);
-
// ExtendedInformationを必要があれば表示する
toggleNoteInformation();
// Sourceを必要があれば表示する
browserWindow.setEnabled(false);
return;
}
- inkNote = false;
+ // ICHANGED
+ inkNote.put(tabBrowser.currentIndex(), false);
+
readOnly = false;
if (Global.showDeleted || currentNoteGuid == null || currentNoteGuid.equals(""))
readOnly = true;
loadNoteBrowserInformation(browserWindow, currentNoteGuid, currentNote);
}
+ // ICHANGED
private void loadNoteBrowserInformation(BrowserWindow browser, String guid, Note note) {
NoteFormatter formatter = new NoteFormatter(logger, conn, tempFiles);
formatter.setNote(note, Global.pdfPreview());
formatter.setHighlight(listManager.getEnSearch());
QByteArray js;
+ int tabIndex = -1;
+
+ // 対象のタブインデックスを取得
+ for (TabBrowse tab: tabWindows.values()) {
+ if (tab.getBrowserWindow() == browser) {
+ tabIndex = tabBrowser.indexOf(tab);
+ break;
+ }
+ }
+
if (!noteCache.containsKey(guid)) {
js = new QByteArray();
// We need to prepend the note with <HEAD></HEAD> or encoded characters are ugly
noteCache.put(guid, js.toString());
if (formatter.resourceError)
- resourceErrorMessage();
+ resourceErrorMessage(tabIndex);
if (formatter.formatError) {
waitCursor(false);
QMessageBox.information(this, tr("Error"),
waitCursor(true);
}
readOnly = formatter.readOnly;
- inkNote = formatter.inkNote;
+
+ if (tabIndex >= 0) {
+ inkNote.put(tabIndex, formatter.inkNote);
+ }
+
if (readOnly)
readOnlyCache.put(guid, true);
- if (inkNote)
+ if (tabIndex >= 0 && inkNote.get(tabIndex)) {
inkNoteCache.put(guid, true);
+ }
+
} else {
logger.log(logger.HIGH, "Note content is being pulled from the cache");
String cachedContent = formatter.modifyCachedTodoTags(noteCache.get(guid));
browser.setContent(js);
if (readOnlyCache.containsKey(guid))
readOnly = true;
- if (inkNoteCache.containsKey(guid))
- inkNote = true;
+ if (inkNoteCache.containsKey(guid) && tabIndex >= 0) {
+ inkNote.put(tabIndex, true);
+ } else {
+ inkNote.put(tabIndex, false);
+ }
}
if (conn.getNoteTable().isThumbnailNeeded(guid)) {
thumbnailHTMLReady(guid, js, Global.calculateThumbnailZoom(js.toString()));
}
- if (readOnly || inkNote ||
- (note.getAttributes() != null && note.getAttributes().getContentClass() != null && note.getAttributes().getContentClass() != ""))
+ if (tabIndex >= 0 && (readOnly || inkNote.get(tabIndex) ||
+ (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);
//**********************************************************
//**********************************************************
// An error has happended fetching a resource. let the user know
- private void resourceErrorMessage() {
- if (inkNote)
+ // ICHANGED
+ private void resourceErrorMessage(int tabIndex) {
+ if (tabIndex < 0) {
+ return;
+ }
+ if (inkNote.get(tabIndex))
return;
waitCursor(false);
QMessageBox.information(this, tr("DOUGH!!!"), tr("Well, this is embarrassing."+
"Don't get angry. I'm doing it to prevent you from messing up\n"+
"this note on the Evernote servers. Sorry."+
"\n\nP.S. You might want to re-synchronize to see if it corrects this problem.\nWho knows, you might get lucky."));
- inkNote = true;
+ inkNote.put(tabIndex, true);
browserWindow.setReadOnly(true);
waitCursor(true);
}