OSDN Git Service

- Add bulid packages, update install.txt, and re-commit BrowserWindow & TableViewHeah...
[neighbornote/NeighborNote.git] / src / cx / fbn / nevernote / gui / TableViewHeader.java
1 package cx.fbn.nevernote.gui;\r
2 \r
3 import com.trolltech.qt.core.Qt.Orientation;\r
4 import com.trolltech.qt.gui.QAction;\r
5 import com.trolltech.qt.gui.QContextMenuEvent;\r
6 import com.trolltech.qt.gui.QHeaderView;\r
7 import com.trolltech.qt.gui.QMenu;\r
8 import com.trolltech.qt.gui.QWidget;\r
9 \r
10 import cx.fbn.nevernote.Global;\r
11 \r
12 public class TableViewHeader extends QHeaderView {\r
13         public QMenu contextMenu;\r
14         public QAction createdDateAction;\r
15         public QAction changedDateAction;\r
16         public QAction subjectDateAction;\r
17         public QAction tagsAction;\r
18         public QAction notebookAction;\r
19         public QAction synchronizedAction;\r
20         public QAction authorAction;\r
21         public QAction urlAction;\r
22         \r
23 \r
24         public TableViewHeader(Orientation orientation, QWidget parent) {\r
25                 super(orientation, parent);\r
26                 \r
27                 setSortIndicatorShown(true);\r
28                 setClickable(true);\r
29                 \r
30                 contextMenu = new QMenu();\r
31 \r
32                 createdDateAction = new QAction(this);\r
33                 createdDateAction.setText(tr("Date Created"));\r
34                 createdDateAction.setCheckable(true);\r
35                 createdDateAction.setChecked(Global.isColumnVisible("dateCreated"));\r
36                 contextMenu.addAction(createdDateAction);\r
37                 \r
38                 changedDateAction = new QAction(this);\r
39                 changedDateAction.setText(tr("Date Changed"));\r
40                 changedDateAction.setCheckable(true);\r
41                 changedDateAction.setChecked(Global.isColumnVisible("dateChanged"));\r
42                 contextMenu.addAction(changedDateAction);\r
43                 \r
44                 subjectDateAction = new QAction(this);\r
45                 subjectDateAction.setText(tr("Subject Date"));\r
46                 subjectDateAction.setCheckable(true);\r
47                 subjectDateAction.setChecked(Global.isColumnVisible("dateSubject"));\r
48                 contextMenu.addAction(subjectDateAction);\r
49                 \r
50                 tagsAction = new QAction(this);\r
51                 tagsAction.setText(tr("Tags"));\r
52                 tagsAction.setCheckable(true);\r
53                 tagsAction.setChecked(Global.isColumnVisible("tags"));\r
54                 contextMenu.addAction(tagsAction);\r
55                 \r
56                 notebookAction = new QAction(this);\r
57                 notebookAction.setText(tr("Notebook"));\r
58                 notebookAction.setCheckable(true);\r
59                 notebookAction.setChecked(Global.isColumnVisible("notebook"));\r
60                 contextMenu.addAction(notebookAction);\r
61                 \r
62                 synchronizedAction = new QAction(this);\r
63                 synchronizedAction.setText(tr("Synchronized"));\r
64                 synchronizedAction.setCheckable(true);\r
65                 synchronizedAction.setChecked(Global.isColumnVisible("synchronized"));\r
66                 contextMenu.addAction(synchronizedAction);\r
67                 \r
68                 authorAction = new QAction(this);\r
69                 authorAction.setText(tr("Author"));\r
70                 authorAction.setCheckable(true);\r
71                 authorAction.setChecked(Global.isColumnVisible("author"));\r
72                 contextMenu.addAction(authorAction);\r
73                 \r
74                 urlAction = new QAction(this);\r
75                 urlAction.setText(tr("Source URL"));\r
76                 urlAction.setCheckable(true);\r
77                 urlAction.setChecked(Global.isColumnVisible("sourceUrl"));\r
78                 contextMenu.addAction(urlAction);\r
79                 \r
80         }\r
81         \r
82         @Override\r
83         public void contextMenuEvent(QContextMenuEvent event) {\r
84                 contextMenu.exec(event.globalPos());\r
85         }\r
86 }\r