From 8db99a6497e4517f8d0455553f68ab6ff10f4820 Mon Sep 17 00:00:00 2001 From: yuki Date: Fri, 22 Mar 2013 00:04:19 +0900 Subject: [PATCH] =?utf8?q?readOnly=E5=A4=89=E6=95=B0=E3=82=92=E3=82=BF?= =?utf8?q?=E3=83=96=E3=83=96=E3=83=A9=E3=82=A6=E3=82=B6=E3=81=AB=E5=AF=BE?= =?utf8?q?=E5=BF=9C=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- src/cx/fbn/nevernote/NeverNote.java | 38 ++++++++++++++++++++++--------------- 1 file changed, 23 insertions(+), 15 deletions(-) diff --git a/src/cx/fbn/nevernote/NeverNote.java b/src/cx/fbn/nevernote/NeverNote.java index 36e7123..7a3e172 100644 --- a/src/cx/fbn/nevernote/NeverNote.java +++ b/src/cx/fbn/nevernote/NeverNote.java @@ -251,7 +251,7 @@ public class NeverNote extends QMainWindow{ // ICHANGED HashMap noteDirty; // Has the note been changed? HashMap inkNote; // if this is an ink note, it is read only - boolean readOnly; // Is this note read-only? + HashMap readOnly; // Is this note read-only? ListManager listManager; // DB runnable task @@ -609,6 +609,7 @@ public class NeverNote extends QMainWindow{ noteDirty.put(index, false); inkNote = new HashMap(); + readOnly = new HashMap(); // ICHANGED // 履歴記録のハッシュマップを初期化 @@ -5083,12 +5084,13 @@ public class NeverNote extends QMainWindow{ } // ICHANGED inkNote.put(tabBrowser.currentIndex(), false); + readOnly.put(tabBrowser.currentIndex(), false); - readOnly = false; - if (Global.showDeleted || currentNoteGuid == null || currentNoteGuid.equals("")) - readOnly = true; + if (Global.showDeleted || currentNoteGuid == null || currentNoteGuid.equals("")) { + readOnly.put(tabBrowser.currentIndex(), true); + } Global.cryptCounter =0; - if (readOnly) { + if (readOnly.get(tabBrowser.currentIndex())) { browserWindow.setReadOnly(true); } @@ -5158,14 +5160,15 @@ public class NeverNote extends QMainWindow{ " To protect your data this note is being marked as read-only.")); waitCursor(true); } - readOnly = formatter.readOnly; if (tabIndex >= 0) { + readOnly.put(tabIndex, formatter.readOnly); inkNote.put(tabIndex, formatter.inkNote); } - if (readOnly) + if (tabIndex >= 0 && readOnly.get(tabIndex)) { readOnlyCache.put(guid, true); + } if (tabIndex >= 0 && inkNote.get(tabIndex)) { inkNoteCache.put(guid, true); } @@ -5175,8 +5178,11 @@ public class NeverNote extends QMainWindow{ String cachedContent = formatter.modifyCachedTodoTags(noteCache.get(guid)); js = new QByteArray(cachedContent); browser.setContent(js); - if (readOnlyCache.containsKey(guid)) - readOnly = true; + if (readOnlyCache.containsKey(guid) && tabIndex >= 0) { + readOnly.put(tabIndex, true); + } else { + readOnly.put(tabIndex, false); + } if (inkNoteCache.containsKey(guid) && tabIndex >= 0) { inkNote.put(tabIndex, true); } else { @@ -5186,16 +5192,18 @@ public class NeverNote extends QMainWindow{ if (conn.getNoteTable().isThumbnailNeeded(guid)) { thumbnailHTMLReady(guid, js, Global.calculateThumbnailZoom(js.toString())); } - if (tabIndex >= 0 && (readOnly || inkNote.get(tabIndex) || + if (tabIndex >= 0 && (readOnly.get(tabIndex) || 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); - browser.setReadOnly(readOnly); - deleteButton.setEnabled(!readOnly); - tagButton.setEnabled(!readOnly); - menuBar.noteDelete.setEnabled(!readOnly); - menuBar.noteTags.setEnabled(!readOnly); + if (tabIndex >= 0) { + browser.setReadOnly(readOnly.get(tabIndex)); + deleteButton.setEnabled(!readOnly.get(tabIndex)); + tagButton.setEnabled(!readOnly.get(tabIndex)); + menuBar.noteDelete.setEnabled(!readOnly.get(tabIndex)); + menuBar.noteTags.setEnabled(!readOnly.get(tabIndex)); + } browser.setNote(note); if (note != null && note.getNotebookGuid() != null && -- 2.11.0