OSDN Git Service

Improved performance in the editor by not forcing a search through the note table...
authorRandy Baumgarte <randy@fbn.cx>
Wed, 18 Aug 2010 17:12:11 +0000 (13:12 -0400)
committerRandy Baumgarte <randy@fbn.cx>
Sun, 22 Aug 2010 22:48:15 +0000 (18:48 -0400)
src/cx/fbn/nevernote/NeverNote.java
src/cx/fbn/nevernote/gui/BrowserWindow.java
src/cx/fbn/nevernote/gui/TableView.java

index 4e01def..afdaba5 100644 (file)
@@ -2900,8 +2900,19 @@ public class NeverNote extends QMainWindow{
     @SuppressWarnings("unused")
        private void setNoteDirty() {
                logger.log(logger.EXTREME, "Entering NeverNote.setNoteDirty()");
-       noteDirty = true;
-
+               
+               // If the note is dirty, then it is unsynchronized by default.
+               if (noteDirty) 
+                       return;
+               
+               // Set the note as dirty and check if its status is synchronized in the display table
+               noteDirty = true;
+               for (int i=0; i<listManager.getUnsynchronizedNotes().size(); i++) {
+                       if (listManager.getUnsynchronizedNotes().get(i).equals(currentNoteGuid))
+                               return;
+               }
+               
+               // If tihs wasn't already marked as unsynchronized, then we need to update the table
        listManager.getUnsynchronizedNotes().add(currentNoteGuid);
        for (int i=0; i<listManager.getNoteTableModel().rowCount(); i++) {
                QModelIndex modelIndex =  listManager.getNoteTableModel().index(i, Global.noteTableGuidPosition);
@@ -2914,6 +2925,7 @@ public class NeverNote extends QMainWindow{
                        }
                }
        }
+       
                logger.log(logger.EXTREME, "Leaving NeverNote.setNoteDirty()");
     }
     private void saveNote() {
index 91eb7d8..8a429d5 100644 (file)
@@ -1425,9 +1425,6 @@ public class BrowserWindow extends QWidget {
                String content = getContent();\r
                checkNoteTitle();\r
                noteSignal.noteChanged.emit(currentNote.getGuid(), content); \r
-               \r
-               \r
-//        noteSignal.noteChanged.emit(currentNote.getGuid(), unicode);\r
        }\r
 \r
        // The notebook selection has changed\r
@@ -2059,7 +2056,6 @@ public class BrowserWindow extends QWidget {
        //* MicroFocus changed\r
        //****************************************************************\r
        private void microFocusChanged() {\r
-               \r
                boldButton.setDown(false);\r
                italicButton.setDown(false);\r
                underlineButton.setDown(false);\r
index 2a88ad0..f95a844 100644 (file)
@@ -152,6 +152,7 @@ public class TableView extends QTableView {
                if (!reload) {\r
                        logger.log(logger.EXTREME, "TableView.load() reload starting.");\r
                        proxyModel.filter();\r
+                       setSortingEnabled(true);\r
                        logger.log(logger.EXTREME, "TableView.load() leaving reload.");\r
                        return;\r
                }\r