OSDN Git Service

Correct problem with tag tree reloading incorrectly after a sync.
authorRandy Baumgarte <randy@fbn.cx>
Fri, 26 Aug 2011 20:55:40 +0000 (16:55 -0400)
committerRandy Baumgarte <randy@fbn.cx>
Fri, 26 Aug 2011 20:55:40 +0000 (16:55 -0400)
src/cx/fbn/nevernote/NeverNote.java
src/cx/fbn/nevernote/gui/BrowserWindow.java
src/cx/fbn/nevernote/gui/TagTreeWidget.java

index ce68e97..ee88115 100644 (file)
@@ -2057,6 +2057,7 @@ public class NeverNote extends QMainWindow{
                if (tagTree.selectedItems().size() > 0)
                        filter = true;
                tagTree.showAllTags(!filter);
+               tagIndexUpdated(false);
                logger.log(logger.HIGH, "Leaving NeverNote.reloadTagTree");
        }
        // Edit an existing tag
@@ -5503,7 +5504,7 @@ public class NeverNote extends QMainWindow{
                        currentNote = conn.getNoteTable().getNote(currentNoteGuid, false, false, false, false, true);
                }
                listManager.refreshNoteMetadata();
-               noteIndexUpdated(false);
+               noteIndexUpdated(true);
                noteTableView.selectionModel().blockSignals(true);
                scrollToGuid(currentNoteGuid);
                noteTableView.selectionModel().blockSignals(false);
@@ -5530,16 +5531,6 @@ public class NeverNote extends QMainWindow{
                                        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;
                        }
index 23264d8..5b033ae 100644 (file)
@@ -2112,8 +2112,8 @@ public class BrowserWindow extends QWidget {
                                        titleLabel.blockSignals(false);\r
                                }\r
                        }\r
-                       noteSignal.titleChanged.emit(currentNote.getGuid(), titleLabel\r
-                                       .text());\r
+                       if (currentNote != null && titleLabel != null)\r
+                               noteSignal.titleChanged.emit(currentNote.getGuid(), titleLabel.text());\r
                }\r
        }\r
 \r
@@ -3394,7 +3394,8 @@ public class BrowserWindow extends QWidget {
                QByteArray data = new QByteArray(sourceEditHeader+content+"</body></html>");\r
                getBrowser().setContent(data);\r
                checkNoteTitle();\r
-               noteSignal.noteChanged.emit(currentNote.getGuid(), sourceEdit.toPlainText()); \r
+               if (currentNote != null && sourceEdit != null)\r
+                       noteSignal.noteChanged.emit(currentNote.getGuid(), sourceEdit.toPlainText()); \r
        }\r
        \r
        private void setSource(String text) {\r
index 9ca9c34..0633557 100644 (file)
@@ -66,6 +66,7 @@ public class TagTreeWidget extends QTreeWidget {
        public Signal0 selectionSignal;\r
        public String selectedTag;\r
        private boolean rightButtonClicked;\r
+       private List<TagCounter> lastCount;\r
        \r
        \r
        public TagTreeWidget(DatabaseConnection d) {\r
@@ -244,23 +245,18 @@ public class TagTreeWidget extends QTreeWidget {
        sortItems(0, SortOrder.AscendingOrder);\r
        \r
        expandTags(invisibleRootItem(), expandedTags);\r
+       if (lastCount != null)\r
+               updateCounts(lastCount);\r
        }\r
        // Show (unhide) all tags\r
        public void showAllTags(boolean value) {\r
                showAllTags = value;\r
        }\r
-       public void unhideAllTags() {\r
-               MatchFlags flags = new MatchFlags();\r
-               flags.set(MatchFlag.MatchWildcard);\r
-               flags.set(MatchFlag.MatchRecursive);\r
-               List <QTreeWidgetItem>  children = findItems("*", flags);\r
-               for (int i=0; i<children.size(); i++) {\r
-                       children.get(i).setHidden(false);\r
-               }\r
-       }\r
+\r
        // update the display with the current number of notes\r
        public void updateCounts(List<TagCounter> counts) {\r
                                \r
+               lastCount = counts;\r
                MatchFlags flags = new MatchFlags();\r
                flags.set(MatchFlag.MatchWildcard);\r
                flags.set(MatchFlag.MatchRecursive);\r