OSDN Git Service

Correct problem where images may not be pasted properly due to ' character messing...
[neighbornote/NeighborNote.git] / src / cx / fbn / nevernote / gui / NoteTableModel.java
index 195d019..f901470 100644 (file)
@@ -2,6 +2,7 @@ package cx.fbn.nevernote.gui;
 \r
 import java.text.SimpleDateFormat;\r
 import java.util.ArrayList;\r
 \r
 import java.text.SimpleDateFormat;\r
 import java.util.ArrayList;\r
+import java.util.Collections;\r
 import java.util.HashMap;\r
 import java.util.List;\r
 \r
 import java.util.HashMap;\r
 import java.util.List;\r
 \r
@@ -236,6 +237,28 @@ public class NoteTableModel extends QAbstractTableModel {
                }\r
        }\r
        \r
                }\r
        }\r
        \r
+       // Update a note title\r
+       public void updateNoteTags(String guid, List<String> tags, List<String> names) {\r
+               for (int i=0; i<getMasterNoteIndex().size(); i++) {\r
+                       if (getMasterNoteIndex().get(i).getGuid().equals(guid)) {\r
+                               getMasterNoteIndex().get(i).setTagGuids(tags);\r
+                               getMasterNoteIndex().get(i).setTagNames(names);\r
+                               String display = new String("");\r
+                               Collections.sort(names);\r
+                               for (int j=0; j<names.size(); j++) {\r
+                                       display = display+names.get(j);\r
+                                       if (j+2<names.size()) {\r
+                                               display = display+Global.tagDelimeter+" ";\r
+                                       }\r
+                               }\r
+                               QModelIndex idx = createIndex(i, Global.noteTableTagPosition, nativePointer());\r
+                               setData(idx, display, Qt.ItemDataRole.EditRole); \r
+                               i = getMasterNoteIndex().size();\r
+                       }       \r
+               }\r
+       }\r
+\r
+       \r
        public void updateNoteCreatedDate(String guid, QDateTime date) {\r
                \r
                for (int i=0; i<getMasterNoteIndex().size(); i++) {\r
        public void updateNoteCreatedDate(String guid, QDateTime date) {\r
                \r
                for (int i=0; i<getMasterNoteIndex().size(); i++) {\r
@@ -436,5 +459,14 @@ public class NoteTableModel extends QAbstractTableModel {
                getTitleColors().put(guid, color);\r
                layoutChanged.emit();\r
        }\r
                getTitleColors().put(guid, color);\r
                layoutChanged.emit();\r
        }\r
+\r
+       @Override\r
+       public Qt.ItemFlags flags(QModelIndex index) {\r
+               Qt.ItemFlag flags[] = { Qt.ItemFlag.ItemIsEnabled, \r
+                                                               Qt.ItemFlag.ItemIsDragEnabled,\r
+                                                               Qt.ItemFlag.ItemIsSelectable };\r
+               \r
+               return new Qt.ItemFlags(flags);\r
+       }\r
        \r
 }\r
        \r
 }\r