OSDN Git Service

Fix translations directory to match source and fix note title sql problem.
[neighbornote/NeighborNote.git] / src / cx / fbn / nevernote / sql / NoteTable.java
index 945e7e3..0269fdb 100644 (file)
@@ -499,17 +499,6 @@ public class NoteTable {
                }\r
        }\r
 \r
-       \r
-       // Check a note to see if it passes the attribute selection criteria\r
-       public boolean checkAttributeSelection(Note n) {\r
-               if (Global.createdSinceFilter.check(n) &&\r
-                       Global.createdBeforeFilter.check(n) && \r
-                       Global.changedSinceFilter.check(n) &&\r
-                       Global.changedBeforeFilter.check(n) )\r
-                               return true;\r
-               \r
-               return false;\r
-       }\r
        // Delete a note\r
        public void deleteNote(String guid) {\r
         NSqlQuery query = new NSqlQuery(db.getConnection());\r
@@ -690,9 +679,11 @@ public class NoteTable {
        // Update a note\r
        public void updateNote(Note n, boolean isNew) {\r
                boolean isExpunged = isNoteExpunged(n.getGuid());\r
-               \r
+               int titleColor = getNoteTitleColor(n.getGuid());\r
                expungeNote(n.getGuid(), !isExpunged, false);\r
                addNote(n, false);\r
+               if (titleColor != -1)\r
+                       setNoteTitleColor(n.getGuid(), titleColor);\r
        }\r
        // Does a note exist?\r
        public boolean exists(String guid) {\r
@@ -1013,12 +1004,9 @@ public class NoteTable {
                        returnValue.add(pair); \r
                }       \r
 \r
-               \r
-               \r
                return returnValue;\r
        }\r
        // Set a title color\r
-       // Reset the dirty bit\r
        public void  setNoteTitleColor(String guid, int color) {\r
                NSqlQuery query = new NSqlQuery(db.getConnection());\r
                \r
@@ -1028,7 +1016,32 @@ public class NoteTable {
                if (!query.exec())\r
                        logger.log(logger.EXTREME, "Error updating title color.");\r
        }\r
+       // Get in individual note's title color\r
+       // Get the title color of all notes\r
+       public Integer getNoteTitleColor(String guid) {\r
+               List<Pair<String,Integer>> returnValue = new ArrayList<Pair<String,Integer>>();\r
+        NSqlQuery query = new NSqlQuery(db.getConnection());\r
+               \r
+        query.prepare("Select titleColor from Note where titleColor != -1 and guid=:guid");\r
+        query.bindValue(":guid", guid);\r
+               if (!query.exec())\r
+                       logger.log(logger.EXTREME, "Note SQL retrieve has failed on getNoteTitleColor(guid).");\r
 \r
+               Integer color = -1;\r
+               \r
+               // Get a list of the notes\r
+               while (query.next()) {\r
+                       Pair<String, Integer> pair = new Pair<String,Integer>();\r
+                       guid = query.valueString(0);\r
+                       color = query.valueInteger(1);\r
+                       pair.setFirst(guid);\r
+                       pair.setSecond(color);\r
+                       returnValue.add(pair); \r
+               }       \r
+\r
+               \r
+               return color;\r
+       }\r
        \r
        \r
        //**********************************************************************************\r