OSDN Git Service

Correct problem parsing notes where carriage returns did not separate some XML lines...
[neighbornote/NeighborNote.git] / src / cx / fbn / nevernote / gui / NoteTableDateDelegate.java
1 package cx.fbn.nevernote.gui;\r
2 \r
3 import java.text.SimpleDateFormat;\r
4 \r
5 import com.trolltech.qt.core.QDateTime;\r
6 import com.trolltech.qt.core.QLocale;\r
7 import com.trolltech.qt.gui.QStyledItemDelegate;\r
8 \r
9 import cx.fbn.nevernote.Global;\r
10 \r
11 public class NoteTableDateDelegate extends QStyledItemDelegate {\r
12 \r
13         \r
14         @Override\r
15         public String displayText(Object value, QLocale locale ) {\r
16                 \r
17                 String fmt = Global.getDateFormat() + " " + Global.getTimeFormat();\r
18                 String dateTimeFormat = new String(fmt);\r
19                 SimpleDateFormat simple = new SimpleDateFormat(dateTimeFormat);\r
20                 \r
21                 StringBuilder date = new StringBuilder(simple.format(value));\r
22                 QDateTime created = QDateTime.fromString(date.toString(), fmt);\r
23                 return created.toString(fmt);\r
24          }\r
25 \r
26 }\r