From 10d17d8a691082e95109484b417fd622d53eb1fe Mon Sep 17 00:00:00 2001 From: yuki Date: Tue, 5 Nov 2013 17:36:41 +0900 Subject: [PATCH] =?utf8?q?=E9=80=A3=E6=83=B3=E3=83=8E=E3=83=BC=E3=83=88?= =?utf8?q?=E3=83=AA=E3=82=B9=E3=83=88=E3=81=AB=E3=80=81=E3=83=AD=E3=83=BC?= =?utf8?q?=E3=82=AB=E3=83=AB=E3=81=AB=E5=AD=98=E5=9C=A8=E3=81=97=E3=81=AA?= =?utf8?q?=E3=81=84=E3=83=8E=E3=83=BC=E3=83=88=E3=81=A8=E3=82=A2=E3=82=AF?= =?utf8?q?=E3=83=86=E3=82=A3=E3=83=96=E3=81=A7=E3=81=AA=E3=81=84=E3=83=8E?= =?utf8?q?=E3=83=BC=E3=83=88=E3=81=8C=E5=90=AB=E3=81=BE=E3=82=8C=E3=81=A6?= =?utf8?q?=E3=81=84=E3=81=9F=E5=95=8F=E9=A1=8C=E3=82=92=E4=BF=AE=E6=AD=A3?= =?utf8?q?=E3=81=97=E3=81=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- src/cx/fbn/nevernote/gui/RensoNoteList.java | 29 ++++++++++++++++++++++------- 1 file changed, 22 insertions(+), 7 deletions(-) diff --git a/src/cx/fbn/nevernote/gui/RensoNoteList.java b/src/cx/fbn/nevernote/gui/RensoNoteList.java index 2704a73..c3f829b 100644 --- a/src/cx/fbn/nevernote/gui/RensoNoteList.java +++ b/src/cx/fbn/nevernote/gui/RensoNoteList.java @@ -160,32 +160,32 @@ public class RensoNoteList extends QListWidget { // browseHistory HashMap browseHistory = conn.getHistoryTable().getBehaviorHistory("browse", guid); addWeight(browseHistory, Global.getBrowseWeight()); - mergedHistory = mergeHistory(browseHistory, mergedHistory); + mergedHistory = mergeHistory(filterHistory(browseHistory), mergedHistory); // copy&pasteHistory HashMap copyAndPasteHistory = conn.getHistoryTable().getBehaviorHistory("copy & paste", guid); addWeight(copyAndPasteHistory, Global.getCopyPasteWeight()); - mergedHistory = mergeHistory(copyAndPasteHistory, mergedHistory); + mergedHistory = mergeHistory(filterHistory(copyAndPasteHistory), mergedHistory); // addNewNoteHistory HashMap addNewNoteHistory = conn.getHistoryTable().getBehaviorHistory("addNewNote", guid); addWeight(addNewNoteHistory, Global.getAddNewNoteWeight()); - mergedHistory = mergeHistory(addNewNoteHistory, mergedHistory); + mergedHistory = mergeHistory(filterHistory(addNewNoteHistory), mergedHistory); // rensoItemClickHistory HashMap rensoItemClickHistory = conn.getHistoryTable().getBehaviorHistory("rensoItemClick", guid); addWeight(rensoItemClickHistory, Global.getRensoItemClickWeight()); - mergedHistory = mergeHistory(rensoItemClickHistory, mergedHistory); + mergedHistory = mergeHistory(filterHistory(rensoItemClickHistory), mergedHistory); // sameTagHistory HashMap sameTagHistory = conn.getHistoryTable().getBehaviorHistory("sameTag", guid); addWeight(sameTagHistory, Global.getSameTagWeight()); - mergedHistory = mergeHistory(sameTagHistory, mergedHistory); + mergedHistory = mergeHistory(filterHistory(sameTagHistory), mergedHistory); // sameNotebookNoteHistory HashMap sameNotebookHistory = conn.getHistoryTable().getBehaviorHistory("sameNotebook", guid); addWeight(sameNotebookHistory, Global.getSameNotebookWeight()); - mergedHistory = mergeHistory(sameNotebookHistory, mergedHistory); + mergedHistory = mergeHistory(filterHistory(sameNotebookHistory), mergedHistory); logger.log(logger.EXTREME, "Leaving RensoNoteList.calculateHistory"); } @@ -436,7 +436,7 @@ public class RensoNoteList extends QListWidget { enRelatedNotes.put(relatedGuid, Global.getENRelatedNotesWeight()); } - mergedHistory = mergeHistory(enRelatedNotes, mergedHistory); + mergedHistory = mergeHistory(filterHistory(enRelatedNotes), mergedHistory); logger.log(logger.EXTREME, "Leaving RensoNoteList.addENRelatedNotes"); } @@ -460,4 +460,19 @@ public class RensoNoteList extends QListWidget { public String getGuid() { return guid; } + + // ローカルに存在していて、かつアクティブなノートだけを返す + private HashMap filterHistory(HashMap sourceHistory) { + HashMap dstHistory = new HashMap(); + + for (String guid : sourceHistory.keySet()) { + if (conn.getNoteTable().exists(guid)) { + if (conn.getNoteTable().getNote(guid, false, false, false, false, false).isActive()) { + dstHistory.put(guid, sourceHistory.get(guid)); + } + } + } + + return dstHistory; + } } -- 2.11.0