OSDN Git Service

Changed synchronized from true/false to a dot to match Evernote's interface.
authorRandy Baumgarte <randy@fbn.cx>
Thu, 16 Dec 2010 09:16:03 +0000 (04:16 -0500)
committerRandy Baumgarte <randy@fbn.cx>
Sun, 19 Dec 2010 04:00:40 +0000 (23:00 -0500)
src/cx/fbn/nevernote/filters/NoteSortFilterProxyModel.java
src/cx/fbn/nevernote/gui/NoteTableModel.java
src/cx/fbn/nevernote/icons/dot.png [new file with mode: 0644]

index 4510ffd..18e4314 100644 (file)
@@ -26,6 +26,7 @@ import com.trolltech.qt.core.QAbstractItemModel;
 import com.trolltech.qt.core.QModelIndex;\r
 import com.trolltech.qt.core.QObject;\r
 import com.trolltech.qt.core.Qt;\r
+import com.trolltech.qt.gui.QIcon;\r
 import com.trolltech.qt.gui.QImage;\r
 import com.trolltech.qt.gui.QSortFilterProxyModel;\r
 \r
@@ -76,6 +77,10 @@ public class NoteSortFilterProxyModel extends QSortFilterProxyModel {
                Object leftData = sourceModel().data(left);\r
                Object rightData = sourceModel().data(right);\r
                \r
+               if (rightData == null)\r
+                       return true;\r
+               if (leftData instanceof QIcon)\r
+                       return true;\r
                if (leftData instanceof QImage && rightData instanceof QImage)\r
                        return true;\r
                if (leftData instanceof Long && rightData instanceof Long) {\r
index a72ac2d..95c84ea 100644 (file)
@@ -13,6 +13,7 @@ import com.trolltech.qt.core.Qt.AspectRatioMode;
 import com.trolltech.qt.core.Qt.TransformationMode;\r
 import com.trolltech.qt.gui.QAbstractTableModel;\r
 import com.trolltech.qt.gui.QColor;\r
+import com.trolltech.qt.gui.QIcon;\r
 import com.trolltech.qt.gui.QImage;\r
 import com.trolltech.qt.gui.QPixmap;\r
 \r
@@ -80,7 +81,8 @@ public class NoteTableModel extends QAbstractTableModel {
             return valueAt(index.row(), index.column());\r
         }\r
         case Qt.ItemDataRole.DecorationRole: {\r
-               if (index.column() == Global.noteTableThumbnailPosition)\r
+               if (index.column() == Global.noteTableThumbnailPosition ||\r
+                       index.column() == Global.noteTableSynchronizedPosition)\r
                        return valueAt(index.row(), index.column());\r
                else\r
                        return null;\r
@@ -143,12 +145,14 @@ public class NoteTableModel extends QAbstractTableModel {
                if (col == Global.noteTableSourceUrlPosition)\r
                        return note.getAttributes().getSourceURL();\r
                if (col == Global.noteTableSynchronizedPosition) {\r
+                       String iconPath = new String("classpath:cx/fbn/nevernote/icons/");\r
+                       QIcon dotIcon = new QIcon(iconPath+"dot.png");\r
                        String guid = note.getGuid();\r
                        for (int i=0; i<unsynchronizedNotes.size(); i++) {\r
                                if (unsynchronizedNotes.get(i).equalsIgnoreCase(guid)) \r
-                                       return "false";\r
+                                       return dotIcon;\r
                        }\r
-                       return "true";\r
+                       return null;\r
                }\r
                if (col == Global.noteTableTagPosition) {\r
                        String tags = new String();\r
diff --git a/src/cx/fbn/nevernote/icons/dot.png b/src/cx/fbn/nevernote/icons/dot.png
new file mode 100644 (file)
index 0000000..b876344
Binary files /dev/null and b/src/cx/fbn/nevernote/icons/dot.png differ