OSDN Git Service

Add ability to customize tag icons
[neighbornote/NeighborNote.git] / src / cx / fbn / nevernote / gui / MainMenuBar.java
1 /*\r
2  * This file is part of NeverNote \r
3  * Copyright 2009 Randy Baumgarte\r
4  * \r
5  * This file may be licensed under the terms of of the\r
6  * GNU General Public License Version 2 (the ``GPL'').\r
7  *\r
8  * Software distributed under the License is distributed\r
9  * on an ``AS IS'' basis, WITHOUT WARRANTY OF ANY KIND, either\r
10  * express or implied. See the GPL for the specific language\r
11  * governing rights and limitations.\r
12  *\r
13  * You should have received a copy of the GPL along with this\r
14  * program. If not, go to http://www.gnu.org/licenses/gpl.html\r
15  * or write to the Free Software Foundation, Inc.,\r
16  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.\r
17  *\r
18 */\r
19 package cx.fbn.nevernote.gui;\r
20 \r
21 import com.trolltech.qt.gui.QAction;\r
22 import com.trolltech.qt.gui.QMenu;\r
23 import com.trolltech.qt.gui.QMenuBar;\r
24 \r
25 import cx.fbn.nevernote.Global;\r
26 import cx.fbn.nevernote.NeverNote;\r
27 \r
28 public class MainMenuBar extends QMenuBar {\r
29 \r
30         private final NeverNote                 parent;\r
31         public QAction                  printAction;                            // Action when a user selects Print from the file menu\r
32         public QAction                  connectAction;                          // Connect/Disconnect to Evernote\r
33         public QAction                  fullReindexAction;                      // Action when a user wants to reindex the entire database\r
34         public QAction                  synchronizeAction;                      // Synchronize data with Evernote                                       \r
35         public QAction                  settingsAction;                         // Show user config settings\r
36         public QAction                  emailAction;                            // Action when a user selects "email"\r
37         public QAction                  backupAction;                           // Backup the database\r
38         public QAction                  restoreAction;                          // Restore from a backup\r
39         public QAction                  emptyTrashAction;                       // Action when a user wants to clear the trash file\r
40         public QAction                  exitAction;                                     // Action when user selects "exit"\r
41         public QAction                  aboutAction;                            // Action when a user selects "About"\r
42         public QAction                  loggerAction;                           // Action when a user selects "Log"\r
43         public QAction                  releaseAction;                          // Release notes\r
44 \r
45         public QAction                  noteAdd;                                        // Add a note\r
46         public QAction                  noteAttributes;                         // Action when a user selects note attributes\r
47         public QAction                  noteTags;                                       // Assign a note tags\r
48         public QAction                  noteDelete;                                     // Delete the current note\r
49         public QAction                  noteRestoreAction;                      // Restore a note\r
50         public QAction                  noteReindex;                            // Action when a user wants to reindex a note\r
51         public QAction                  noteDuplicateAction;            // Duplicate an existing note\r
52         public QAction                  noteMergeAction;                        // Merge notes\r
53         public QAction                  noteExportAction;                       // Export notes\r
54         public QAction                  noteImportAction;                       // Import notes\r
55         \r
56         public QAction                  editFind;                                       // find text in the current note\r
57         public QAction                  editUndo;                                       // Undo last change\r
58         public QAction                  editRedo;                                       // Redo last change\r
59         public QAction                  editCut;                                        // Cut selected text\r
60         public QAction                  editPaste;                                      // Paste selected text\r
61         public QAction                  editPasteWithoutFormat;         // Paste selected text\r
62         public QAction                  editCopy;                                       // Copy selected text;\r
63         \r
64         public QAction                  wideListView;                           // View with list on the top\r
65         public QAction                  narrowListView;                         // View with list on the side\r
66         public QAction                  thumbnailView;                          // view thumbnails\r
67         public QAction                  hideSavedSearches;                      // show/hide saved searches\r
68         public QAction                  hideNotebooks;                          // show/hide notebooks\r
69         public QAction                  hideTags;                                       // show/hide tags\r
70         public QAction                  hideAttributes;                         // show/hide note information\r
71         public QAction                  hideTrash;                                      // show/hide trash tree\r
72         public QAction                  hideNoteList;                           // show/hide the list of notes\r
73         public QAction                  showEditorBar;                          // show/hide the editor button bar\r
74         public QAction                  hideLeftSide;                           // Hide the entire left side\r
75         \r
76         public QAction                  formatBold;                                     // Bold selected text\r
77         public QAction                  formatItalic;                           // Italics selected text\r
78         public QAction                  formatUnderline;                        // Underline selected text\r
79         public QAction                  formatStrikethrough;            // Strikethrough selected text\r
80         public QAction                  formatSuperscript;                      // Superscript selected text\r
81         public QAction                  formatSubscript;                        // Subscript selected text\r
82         public QAction                  formatNumberList;                       // insert a numbered list\r
83         public QAction                  formatBulletList;                       // insert a bulleted list;\r
84         public QAction                  alignLeftAction;                        // Left justify text\r
85         public QAction                  alignRightAction;                       // Right justify text\r
86         public QAction                  alignCenterAction;                      // Center text\r
87         public QAction                  horizontalLineAction;           // Insert a horizontal line\r
88         public QAction                  indentAction;                           // Indent\r
89         public QAction                  outdentAction;                          // outdent menu action\r
90         \r
91         public QAction                  noteOnlineHistoryAction;        // Pull note history from Evernote\r
92         \r
93         public QAction                  accountAction;                          // Account dialog box action\r
94         public QAction                  disableIndexing;                        // put indexing on hold.\r
95 //      public QAction                  compactAction;                          // free unused space in the database\r
96         public QAction                  databaseStatusAction;           // Current database status\r
97         public QAction                  folderImportAction;                     // Automatically import files \r
98         public QAction                  spellCheckAction;                       // Spell checker\r
99         public QAction                  encryptDatabaseAction;          // Encrypt the local database\r
100         \r
101         public QAction                  notebookEditAction;                     // Edit the selected notebook\r
102         public QAction                  notebookAddAction;                      // Add a new notebook\r
103         public QAction                  notebookDeleteAction;           // Delete a notebook\r
104         public QAction                  notebookCloseAction;            // Close notebooks\r
105         public QAction                  notebookIconAction;                     // Change the icon\r
106         \r
107         public QAction                  savedSearchAddAction;           // Add a saved search\r
108         public QAction                  savedSearchEditAction;          // Edit a saved search\r
109         public QAction                  savedSearchDeleteAction;        // Delete a saved search\r
110         \r
111         public QAction                  tagEditAction;                          // Edit a tag\r
112         public QAction                  tagAddAction;                           // Add a tag\r
113         public QAction                  tagDeleteAction;                        // Delete a tag\r
114         public QAction                  tagIconAction;                          // Change the icon\r
115         \r
116         //**************************************************************************\r
117         //* Menu Bar Titles\r
118         //**************************************************************************\r
119         \r
120         private QMenu                   fileMenu;                                       // File menu\r
121         private QMenu                   noteMenu;                                       // Note menu \r
122         private QMenu                   notebookMenu;                           // Notebook menu\r
123         private QMenu                   tagMenu;                                        // Tag menu\r
124         private QMenu                   savedSearchMenu;                        // Saved Searches               \r
125 \r
126         private QMenu                   editMenu;                                       // Edit menu\r
127 \r
128         private QMenu                   formatMenu;                                     // Text format menu\r
129         private QMenu                   viewMenu;                                       // show/hide stuff\r
130         private QMenu                   listMenu;                                       // bullet or numbered list\r
131         private QMenu                   indentMenu;                                     // indent or outdent menu\r
132         private QMenu                   alignMenu;                                      // Left/Right/Center justify\r
133         \r
134         private QMenu                   onlineMenu;                                     // View online stuff (if connected)\r
135         \r
136         private QMenu                   toolsMenu;                                      // Tools menu\r
137         \r
138         private QMenu                   helpMenu;       \r
139         \r
140         public MainMenuBar(NeverNote p) {\r
141                 parent = p;\r
142                 \r
143                 \r
144                 fullReindexAction = new QAction(tr("Reindex Database"), this);\r
145                 fullReindexAction.setToolTip("Reindex all notes");\r
146                 fullReindexAction.triggered.connect(parent, "fullReindex()");\r
147                 setupShortcut(fullReindexAction, "Tools_Reindex_Database");\r
148                                 \r
149                 printAction = new QAction(tr("Print"), this);\r
150                 printAction.setToolTip("Print the current note");\r
151                 printAction.triggered.connect(parent, "printNote()");\r
152                 setupShortcut(printAction, "File_Print");\r
153                 \r
154                 emailAction = new QAction(tr("Email"), this);\r
155                 emailAction.setToolTip("Email the current note");\r
156                 emailAction.triggered.connect(parent, "emailNote()");\r
157                 setupShortcut(emailAction, "File_Email");\r
158                 \r
159                 backupAction = new QAction(tr("Backup Database"), this);\r
160                 backupAction.setToolTip("Backup the current database");\r
161                 backupAction.triggered.connect(parent, "databaseBackup()");\r
162                 setupShortcut(backupAction, "File_Backup");\r
163 \r
164                 restoreAction = new QAction(tr("Restore Database"), this);\r
165                 restoreAction.setToolTip("Restore the database from a backup");\r
166                 restoreAction.triggered.connect(parent, "databaseRestore()");\r
167                 setupShortcut(restoreAction, "File_Restore");\r
168                         \r
169                 emptyTrashAction = new QAction(tr("Empty Trash"), this);\r
170                 emptyTrashAction.setToolTip("Empty the trash folder");\r
171                 emptyTrashAction.triggered.connect(parent, "emptyTrash()");\r
172                 setupShortcut(emptyTrashAction, "File_Empty_Trash");\r
173                 \r
174                 noteRestoreAction = new QAction(tr("Restore"), this);\r
175                 noteRestoreAction.setToolTip("Restore a deleted file from the trash");\r
176                 noteRestoreAction.triggered.connect(parent, "restoreNote()");\r
177                 noteRestoreAction.setVisible(false);\r
178                 setupShortcut(noteRestoreAction, "File_Note_Restore");\r
179                                 \r
180                 settingsAction = new QAction(tr("Preferences"), this);\r
181                 settingsAction.setToolTip("Program settings");\r
182                 settingsAction.triggered.connect(parent, "settings()");\r
183                 setupShortcut(settingsAction, "Edit_Preferences");\r
184                 \r
185                 exitAction = new QAction(tr("Exit"), this);\r
186                 exitAction.setToolTip("Close the program");\r
187                 exitAction.triggered.connect(parent, "close()");\r
188                 exitAction.setShortcut("Ctrl+Q");\r
189                 setupShortcut(exitAction, "File_Exit");\r
190                 \r
191                 noteAttributes = new QAction(tr("Extended Information"), this);\r
192                 noteAttributes.setToolTip("Show/Hide extended note attributes");\r
193                 noteAttributes.triggered.connect(parent, "toggleNoteInformation()");\r
194                 noteAttributes.setShortcut("F8");\r
195                 setupShortcut(noteAttributes, "View_Extended_Information");\r
196                 \r
197                 noteReindex = new QAction(tr("Reindex"), this);\r
198                 noteReindex.setToolTip(tr("Reindex this note"));\r
199                 noteReindex.triggered.connect(parent, "reindexNote()");\r
200                 setupShortcut(noteReindex, "File_Note_Reindex");\r
201                 \r
202                 noteDuplicateAction = new QAction(tr("Duplicate"), this);\r
203                 noteDuplicateAction.setToolTip(tr("Duplicate this note"));\r
204                 noteDuplicateAction.triggered.connect(parent, "duplicateNote()");\r
205                 setupShortcut(noteReindex, "File_Note_Duplicate");\r
206                 \r
207                 noteMergeAction = new QAction(tr("Merge Notes"), this);\r
208                 noteMergeAction.setToolTip(tr("Merge Multiple notes"));\r
209                 noteMergeAction.triggered.connect(parent, "mergeNotes()");\r
210                 setupShortcut(noteMergeAction, "File_Note_Merge");\r
211                 \r
212                 noteExportAction = new QAction(tr("Export Selected Notes"), this);\r
213                 noteExportAction.setToolTip(tr("Export selected notes"));\r
214                 noteExportAction.triggered.connect(parent, "exportNotes()");\r
215                 setupShortcut(noteExportAction, "File_Note_Export");\r
216                 \r
217                 noteImportAction = new QAction(tr("Import Notes"), this);\r
218                 noteImportAction.setToolTip(tr("Import notes"));\r
219                 noteImportAction.triggered.connect(parent, "importNotes()");\r
220                 setupShortcut(noteImportAction, "File_Note_Import");\r
221                 \r
222                 noteAdd = new QAction(tr("Add"), this);\r
223                 noteAdd.setToolTip(tr("Add a new note"));\r
224                 noteAdd.triggered.connect(parent, "addNote()");\r
225                 setupShortcut(noteAdd, "File_Note_Add");\r
226                 //noteAdd.setShortcut("Ctrl+N");\r
227                 \r
228                 noteTags = new QAction(tr("Modify Tags"), this);\r
229                 noteTags.setToolTip(tr("Change the tags assigned to this note"));\r
230                 noteTags.triggered.connect(parent.browserWindow, "modifyTags()");\r
231                 setupShortcut(noteTags, "File_Note_Modify_Tags");\r
232                 \r
233                 noteDelete = new QAction(tr("Delete"), this);\r
234                 noteDelete.setToolTip(tr("Delete this note"));\r
235                 noteDelete.triggered.connect(parent, "deleteNote()");\r
236                 setupShortcut(noteDelete, "File_Note_Delete");\r
237         \r
238                 editFind = new QAction(tr("Find In Note"), this);\r
239                 editFind.setToolTip(tr("Find a string in the current note"));\r
240                 editFind.triggered.connect(parent, "findText()");\r
241                 setupShortcut(editFind, "Edit_Find_In_Note");\r
242                 //editFind.setShortcut("Ctrl+F");\r
243                 \r
244                 editUndo = new QAction(tr("Undo"), this);\r
245                 editUndo.setToolTip(tr("Undo"));\r
246                 editUndo.triggered.connect(parent.browserWindow, "undoClicked()");      \r
247                 setupShortcut(editUndo, "Edit_Undo");\r
248                 //editUndo.setShortcut("Ctrl+Z");\r
249                 \r
250                 editRedo = new QAction(tr("Redo"), this);\r
251                 editRedo.setToolTip(tr("Redo"));\r
252                 editRedo.triggered.connect(parent.browserWindow, "redoClicked()");\r
253                 setupShortcut(editRedo, "Edit_Redo");\r
254                 //editRedo.setShortcut("Ctrl+Y");\r
255         \r
256                 editCut = new QAction(tr("Cut"), this);\r
257                 editCut.setToolTip(tr("Cut"));\r
258                 editCut.triggered.connect(parent.browserWindow, "cutClicked()");\r
259                 setupShortcut(editCut, "Edit_Cut");\r
260                 //editCut.setShortcut("Ctrl+X");\r
261                 \r
262                 editCopy = new QAction(tr("Copy"), this);\r
263                 editCopy.setToolTip(tr("Copy"));\r
264                 editCopy.triggered.connect(parent.browserWindow, "copyClicked()");\r
265                 setupShortcut(editCopy, "Edit_Copy");\r
266                 //editCopy.setShortcut("Ctrl+C");\r
267                 \r
268                 editPaste = new QAction(tr("Paste"), this);\r
269                 editPaste.setToolTip(tr("Paste"));\r
270                 editPaste.triggered.connect(parent.browserWindow, "pasteClicked()");\r
271                 setupShortcut(editPaste, "Edit_Paste");\r
272 \r
273                 editPasteWithoutFormat = new QAction(tr("Paste Without Formatting"), this);\r
274                 editPasteWithoutFormat.setToolTip(tr("Paste Without Formatting"));\r
275                 editPasteWithoutFormat.triggered.connect(parent.browserWindow, "pasteWithoutFormattingClicked()");\r
276                 setupShortcut(editPasteWithoutFormat, "Edit_Paste_Without_Formatting");\r
277                 \r
278                 hideNoteList = new QAction(tr("Show Note List"), this);\r
279                 hideNoteList.setToolTip("Show/Hide Note List");\r
280                 hideNoteList.triggered.connect(parent, "toggleNoteListWindow()");\r
281                 hideNoteList.setCheckable(true);\r
282                 hideNoteList.setChecked(true);\r
283                 setupShortcut(hideNoteList, "View_Show_Note_List");\r
284                 \r
285                 hideTags = new QAction(tr("Show Tags"), this);\r
286                 hideTags.setToolTip("Show/Hide Tags");\r
287                 hideTags.triggered.connect(parent, "toggleTagWindow()");\r
288                 hideTags.setCheckable(true);\r
289                 hideTags.setChecked(true);\r
290                 setupShortcut(hideTags, "View_Show_Tags");\r
291                         \r
292                 hideNotebooks = new QAction(tr("Show Notebooks"), this);\r
293                 hideNotebooks.setToolTip("Show/Hide Notebooks");\r
294                 hideNotebooks.triggered.connect(parent, "toggleNotebookWindow()");\r
295                 hideNotebooks.setCheckable(true);\r
296                 hideNotebooks.setChecked(true);\r
297                 setupShortcut(hideNotebooks, "View_Show_Notebooks");\r
298 \r
299                 wideListView = new QAction(tr("Wide List View"), this);\r
300                 wideListView.setToolTip("Wide List Viwe");\r
301                 wideListView.setCheckable(true);\r
302                 wideListView.changed.connect(parent, "wideListView()");\r
303                 setupShortcut(wideListView, "View_Wide_List");\r
304                 \r
305                 narrowListView = new QAction(tr("Narrow List View"), this);\r
306                 narrowListView.setToolTip("Narrow List View");\r
307                 narrowListView.setCheckable(true);\r
308                 narrowListView.changed.connect(parent, "narrowListView()");\r
309                 setupShortcut(narrowListView, "View_Narrow_List");\r
310                 \r
311                 thumbnailView = new QAction(tr("Preview"), this);\r
312                 thumbnailView.setToolTip("Preview Notes");\r
313                 thumbnailView.triggered.connect(parent, "thumbnailView()");\r
314                 setupShortcut(thumbnailView, "View_Thumbnail");\r
315                 \r
316                 hideSavedSearches = new QAction(tr("Show Saved Searches"), this);\r
317                 hideSavedSearches.setToolTip("Show/Hide Saved Searches");\r
318                 hideSavedSearches.triggered.connect(parent, "toggleSavedSearchWindow()");\r
319                 hideSavedSearches.setCheckable(true);\r
320                 hideSavedSearches.setChecked(true);\r
321                 setupShortcut(hideSavedSearches, "View_Show_SavedSearches");\r
322                 \r
323                 hideAttributes = new QAction(tr("Show Attribute Searches"), this);\r
324                 hideAttributes.setToolTip("Show/Hide Attribute Searches");\r
325                 hideAttributes.triggered.connect(parent, "toggleAttributesWindow()");\r
326                 hideAttributes.setCheckable(true);\r
327                 hideAttributes.setChecked(true);\r
328                 setupShortcut(hideAttributes, "View_Show_Attribute_Searches");\r
329 \r
330                 hideTrash = new QAction(tr("Show Trash"), this);\r
331                 hideTrash.setToolTip("Show/Hide Trash Tree");\r
332                 hideTrash.triggered.connect(parent, "toggleTrashWindow()");\r
333                 hideTrash.setCheckable(true);\r
334                 hideTrash.setChecked(true);\r
335                 setupShortcut(hideTrash, "View_Show_Trash");\r
336                 \r
337 \r
338                 showEditorBar = new QAction(tr("Show Editor Button Bar"), this);\r
339                 showEditorBar.setToolTip("Show/Hide Editor Button Bar");\r
340                 showEditorBar.triggered.connect(parent, "toggleEditorButtonBar()");\r
341                 showEditorBar.setCheckable(true);\r
342                 showEditorBar.setChecked(true);\r
343                 setupShortcut(showEditorBar, "View_Show_Editor_Button_Bar");\r
344                 \r
345 \r
346                 hideLeftSide = new QAction(tr("Hide Left Side Panels"), this);\r
347                 hideLeftSide.setToolTip("Hide The Entire Left Side");\r
348                 hideLeftSide.triggered.connect(parent, "toggleLeftSide()");\r
349                 hideLeftSide.setCheckable(true);\r
350                 hideLeftSide.setChecked(false);\r
351                 setupShortcut(hideLeftSide, "View_Show_Left_Side");\r
352                 //hideLeftSide.setShortcut("F11");\r
353 \r
354                 alignLeftAction = new QAction(tr("Left"), this);\r
355                 alignLeftAction.setToolTip(tr("Left Align"));\r
356                 alignLeftAction.triggered.connect(parent.browserWindow, "justifyLeftClicked()");\r
357                 setupShortcut(alignLeftAction, "Format_Alignment_Left");\r
358                 //alignLeftAction.setShortcut("Ctrl+L");\r
359                 \r
360                 alignRightAction = new QAction(tr("Right"), this);\r
361                 alignRightAction.setToolTip(tr("Right Align"));\r
362                 alignRightAction.triggered.connect(parent.browserWindow, "justifyRightClicked()");\r
363                 setupShortcut(alignRightAction, "Format_Alignment_Right");\r
364                 //alignRightAction.setShortcut("Ctrl+R");\r
365                 \r
366                 alignCenterAction = new QAction(tr("Center"), this);\r
367                 alignCenterAction.setToolTip(tr("Center Align"));\r
368                 alignCenterAction.triggered.connect(parent.browserWindow, "justifyCenterClicked()");\r
369                 setupShortcut(alignCenterAction, "Format_Alignment_Center");\r
370                 //alignCenterAction.setShortcut("Ctrl+C");\r
371                 \r
372                 formatBold = new QAction(tr("Bold"), this);\r
373                 formatBold.setToolTip(tr("Bold"));\r
374                 formatBold.triggered.connect(parent.browserWindow, "boldClicked()");\r
375                 setupShortcut(formatBold, "Format_Bold");\r
376                 //formatBold.setShortcut("Ctrl+B");\r
377                 \r
378                 formatItalic = new QAction(tr("Italic"), this);\r
379                 formatItalic.setToolTip(tr("Italic"));\r
380                 formatItalic.triggered.connect(parent.browserWindow, "italicClicked()");\r
381                 setupShortcut(formatItalic, "Format_Italic");\r
382                 //formatItalic.setShortcut("Ctrl+I");\r
383                 \r
384                 formatUnderline = new QAction(tr("Underline"), this);\r
385                 formatUnderline.setToolTip(tr("Underline"));\r
386                 formatUnderline.triggered.connect(parent.browserWindow, "underlineClicked()");\r
387                 setupShortcut(formatUnderline, "Format_Underline");\r
388 //              formatUnderline.setShortcut("Ctrl+U");\r
389 \r
390                 \r
391                 formatSuperscript = new QAction(tr("Superscript"), this);\r
392                 formatSuperscript.setToolTip(tr("Superscript"));\r
393                 formatSuperscript.triggered.connect(parent.browserWindow, "superscriptClicked()");\r
394                 setupShortcut(formatSuperscript, "Format_Superscript");\r
395 \r
396 \r
397                 formatSubscript = new QAction(tr("Subscript"), this);\r
398                 formatSubscript.setToolTip(tr("Subscript"));\r
399                 formatSubscript.triggered.connect(parent.browserWindow, "subscriptClicked()");\r
400                 setupShortcut(formatSubscript, "Format_Subscript");\r
401 \r
402                 \r
403                 formatStrikethrough = new QAction(tr("Strikethrough"), this);\r
404                 formatStrikethrough.setToolTip(tr("Strikethrough"));\r
405                 formatStrikethrough.triggered.connect(parent.browserWindow, "strikethroughClicked()");\r
406                 setupShortcut(formatStrikethrough, "Format_Strikethrough");\r
407 \r
408                 horizontalLineAction = new QAction(tr("Horizontal Line"), this);\r
409                 horizontalLineAction.setToolTip(tr("Horizontal Line"));\r
410                 horizontalLineAction.triggered.connect(parent.browserWindow, "hlineClicked()");\r
411                 setupShortcut(horizontalLineAction, "Format_Horizontal_Line");\r
412                 \r
413                 formatBulletList = new QAction(tr("Bulleted List"), this);\r
414 //              formatBulletList.setText(tr("Numbered List"));\r
415                 formatBulletList.triggered.connect(parent.browserWindow, "bulletListClicked()");\r
416                 setupShortcut(formatBulletList, "Format_List_Bullet");\r
417 //              formatBulletList.setShortcut("Ctrl+Shift+B");\r
418                 \r
419                 formatNumberList = new QAction(tr("Numbered List"), this);\r
420                 formatNumberList.setText(tr("Numbered list"));\r
421                 formatNumberList.triggered.connect(parent.browserWindow, "numberListClicked()");\r
422                 setupShortcut(formatNumberList, "Format_List_Numbered");\r
423 //              formatNumberList.setShortcut("Ctrl+Shift+O");\r
424 \r
425                 indentAction = new QAction(tr(">> Increase"), this);\r
426                 indentAction.setText(tr(">> Increase"));\r
427                 indentAction.triggered.connect(parent.browserWindow, "indentClicked()");\r
428                 setupShortcut(indentAction, "Format_Indent_Increase");\r
429                 //indentAction.setShortcut("Ctrl+M");\r
430 \r
431                 outdentAction = new QAction(tr("<< Decrease"), this);\r
432                 outdentAction.setText(tr("<< Decrease"));\r
433                 outdentAction.triggered.connect(parent.browserWindow, "outdentClicked()");\r
434                 setupShortcut(outdentAction, "Format_Indent_Decrease");\r
435                 //outdentAction.setShortcut("Ctrl+Shift+M");\r
436                 \r
437                 notebookAddAction = new QAction(tr("Add"), this);\r
438                 notebookAddAction.triggered.connect(parent, "addNotebook()");\r
439                 setupShortcut(notebookAddAction, "File_Notebook_Add");\r
440                 \r
441                 notebookEditAction = new QAction(tr("Edit"), this);\r
442                 notebookEditAction.setEnabled(false);\r
443                 notebookEditAction.triggered.connect(parent, "editNotebook()");\r
444                 setupShortcut(notebookEditAction, "File_Notebook_Edit");\r
445                 \r
446                 notebookDeleteAction = new QAction(tr("Delete"), this);\r
447                 notebookDeleteAction.setEnabled(false);\r
448                 notebookDeleteAction.triggered.connect(parent, "deleteNotebook()");\r
449                 setupShortcut(notebookDeleteAction, "File_Notebook_Delete");\r
450                 \r
451                 notebookCloseAction = new QAction(tr("Open/Close Notebooks"), this);\r
452                 notebookCloseAction.setEnabled(true);\r
453                 notebookCloseAction.triggered.connect(parent, "closeNotebooks()");\r
454                 setupShortcut(notebookCloseAction, "File_Notebook_Close");\r
455 \r
456                 notebookIconAction = new QAction(tr("Change Icon"), this);\r
457                 notebookIconAction.setEnabled(false);\r
458                 notebookIconAction.triggered.connect(parent, "setNotebookIcon()");\r
459                 setupShortcut(notebookIconAction, "File_Notebook_Icon");\r
460                 \r
461                 tagAddAction = new QAction(tr("Add"),this);\r
462                 tagAddAction.triggered.connect(parent, "addTag()");\r
463                 //tagAddAction.setShortcut("Ctrl+Shift+T");\r
464                 setupShortcut(tagAddAction, "File_Tag_Add");\r
465                 \r
466                 tagEditAction = new QAction(tr("Edit"), this);\r
467                 tagEditAction.triggered.connect(parent, "editTag()");\r
468                 tagEditAction.setEnabled(false);\r
469                 setupShortcut(tagEditAction, "File_Tag_Edit");\r
470                 \r
471                 tagDeleteAction = new QAction(tr("Delete"), this);\r
472                 tagDeleteAction.triggered.connect(parent, "deleteTag()");\r
473                 tagDeleteAction.setEnabled(false);              \r
474                 setupShortcut(tagDeleteAction, "File_Tag_Delete");\r
475                                 \r
476                 tagIconAction = new QAction(tr("Change Icon"), this);\r
477                 tagIconAction.triggered.connect(parent, "setTagIcon()");\r
478                 tagIconAction.setEnabled(false);                \r
479                 setupShortcut(tagIconAction, "File_Tag_Icon");\r
480                                 \r
481                 savedSearchAddAction = new QAction(tr("Add"),this);\r
482                 savedSearchAddAction.triggered.connect(parent, "addSavedSearch()");\r
483                 setupShortcut(savedSearchAddAction, "File_SavedSearch_Add");\r
484                 \r
485                 savedSearchEditAction = new QAction(tr("Edit"), this);\r
486                 savedSearchEditAction.triggered.connect(parent, "editSavedSearch()");\r
487                 savedSearchEditAction.setEnabled(false);\r
488                 setupShortcut(savedSearchEditAction, "File_SavedSearch_Edit");\r
489                 \r
490                 savedSearchDeleteAction = new QAction(tr("Delete"), this);\r
491                 savedSearchDeleteAction.triggered.connect(parent, "deleteSavedSearch()");\r
492                 savedSearchDeleteAction.setEnabled(false);              \r
493                 setupShortcut(savedSearchDeleteAction, "File_SavedSearch_Delete");\r
494                                 \r
495                         \r
496                 connectAction = new QAction(tr("Connect"), this);\r
497                 connectAction.setToolTip("Connect to Evernote");\r
498                 connectAction.triggered.connect(parent, "remoteConnect()");\r
499                 setupShortcut(connectAction, "Online_Connect");\r
500                 \r
501                 synchronizeAction = new QAction(tr("Synchronize with Evernote"), this);\r
502                 synchronizeAction.setToolTip("Delete all local data & get a fresh copy");\r
503                 synchronizeAction.triggered.connect(parent, "evernoteSync()");\r
504                 synchronizeAction.setEnabled(false);\r
505                 setupShortcut(synchronizeAction, "Online_Synchronize");\r
506                 //synchronizeAction.setShortcut("F9");\r
507                 \r
508                 noteOnlineHistoryAction = new QAction(tr("Note History"), this);\r
509                 noteOnlineHistoryAction.triggered.connect(parent, "viewNoteHistory()");\r
510                 noteOnlineHistoryAction.setEnabled(false);\r
511                 setupShortcut(noteOnlineHistoryAction, "Online_Note_History");\r
512                 \r
513                 \r
514                 \r
515                 \r
516                 \r
517                 accountAction = new QAction(tr("Account Information"), this);\r
518                 accountAction.setToolTip(tr("Account Information"));\r
519                 accountAction.triggered.connect(parent, "accountInformation()");\r
520                 setupShortcut(accountAction, "Tools_Account_Information");\r
521                 \r
522 //              compactAction = new QAction(tr("Compact Database"), this);\r
523 //              compactAction.setToolTip(tr("Free unused database space"));\r
524 //              compactAction.triggered.connect(parent, "compactDatabase()");\r
525 //              setupShortcut(compactAction, "Tools_Compact_Database");\r
526 \r
527                 databaseStatusAction = new QAction(tr("Database Status"), this);\r
528                 databaseStatusAction.setToolTip(tr("Show current database information"));\r
529                 databaseStatusAction.triggered.connect(parent, "databaseStatus()");\r
530                 setupShortcut(databaseStatusAction, "Tools_Database_Status");\r
531                 \r
532                 \r
533                 disableIndexing = new QAction(tr("Disable Note Indexing"), this);\r
534                 disableIndexing.setToolTip("Manually Stop Note Indexing");\r
535                 disableIndexing.triggered.connect(parent, "toggleNoteIndexing()");\r
536                 disableIndexing.setCheckable(true);\r
537                 disableIndexing.setChecked(false);\r
538                 setupShortcut(disableIndexing, "Tools_Disable_Note_Indexing");\r
539                 \r
540                 \r
541                 folderImportAction = new QAction(tr("Automatic Folder Importing"), this);\r
542                 folderImportAction.setToolTip("Import Files Automatically");\r
543                 folderImportAction.triggered.connect(parent, "folderImport()");\r
544                 setupShortcut(folderImportAction, "Tools_Folder_Import");\r
545                 \r
546                 spellCheckAction = new QAction(tr("Spell Check"), this);\r
547                 spellCheckAction.setToolTip("Check for spelling errors");\r
548                 spellCheckAction.triggered.connect(parent.browserWindow, "spellCheckClicked()");\r
549                 setupShortcut(spellCheckAction, "Tools_Spell_Check");\r
550 \r
551                 encryptDatabaseAction = new QAction(tr("Encrypt Database"), this);\r
552                 encryptDatabaseAction.setToolTip("Encrypt the database upon shutdown");\r
553                 encryptDatabaseAction.triggered.connect(parent, "doDatabaseEncrypt()");\r
554                 setupShortcut(encryptDatabaseAction, "Tools_Database_Encrypt");\r
555                 if (Global.cipherPassword != null && Global.cipherPassword != "") {\r
556                         encryptDatabaseAction.setText("Decrypt Database");\r
557                         encryptDatabaseAction.setToolTip("Decrypt the database upon shutdown");\r
558                 }\r
559                 \r
560                 loggerAction = new QAction(tr("Log"), this);\r
561                 loggerAction.setToolTip("Show the detailed application log");\r
562                 loggerAction.triggered.connect(parent, "logger()");\r
563                 setupShortcut(loggerAction, "About_Log");\r
564                                 \r
565                 releaseAction = new QAction(tr("Release Notes"), this);\r
566                 releaseAction.setToolTip("Release notes");\r
567                 releaseAction.triggered.connect(parent, "releaseNotes()");      \r
568                 setupShortcut(releaseAction, "About_Release_Notes");\r
569                 \r
570                 aboutAction = new QAction(tr("About"), this);\r
571                 aboutAction.setToolTip("About NeverNote");\r
572                 aboutAction.triggered.connect(parent, "about()"); \r
573                 setupShortcut(aboutAction, "About_About");\r
574                 \r
575                 setupMenuBar();\r
576         }\r
577         \r
578         public void setupMenuBar() {\r
579                 fileMenu = addMenu(tr("&File"));\r
580                 \r
581                 noteMenu = fileMenu.addMenu(tr("&Note"));\r
582                 notebookMenu = fileMenu.addMenu(tr("Notebook"));\r
583                 tagMenu = fileMenu.addMenu(tr("Tag"));\r
584                 savedSearchMenu = fileMenu.addMenu(tr("Saved Searches"));\r
585                 fileMenu.addSeparator();\r
586                 fileMenu.addAction(emailAction);\r
587                 fileMenu.addAction(printAction);\r
588                 fileMenu.addSeparator();\r
589                 fileMenu.addAction(noteImportAction);\r
590                 fileMenu.addAction(noteExportAction);\r
591                 fileMenu.addAction(backupAction);\r
592                 fileMenu.addAction(restoreAction);\r
593                 fileMenu.addSeparator();\r
594                 fileMenu.addAction(emptyTrashAction);\r
595                 fileMenu.addAction(exitAction);\r
596 \r
597                 editMenu = addMenu(tr("&Edit"));\r
598                 editMenu.addAction(editFind);\r
599                 editMenu.addSeparator();\r
600                 editMenu.addAction(editUndo);\r
601                 editMenu.addAction(editRedo);\r
602                 editMenu.addSeparator();\r
603                 editMenu.addAction(editCut);\r
604                 editMenu.addAction(editCopy);\r
605                 editMenu.addAction(editPaste);\r
606                 editMenu.addAction(editPasteWithoutFormat);\r
607                 editMenu.addSeparator();\r
608                 editMenu.addAction(settingsAction);\r
609                 \r
610                 viewMenu = addMenu(tr("&View"));\r
611                 viewMenu.addAction(noteAttributes);\r
612                 viewMenu.addSeparator();\r
613                 viewMenu.addAction(wideListView);\r
614                 viewMenu.addAction(narrowListView);\r
615                 viewMenu.addAction(thumbnailView);\r
616                 viewMenu.addSeparator();\r
617                 viewMenu.addAction(hideNoteList);\r
618                 viewMenu.addAction(hideNotebooks);\r
619                 viewMenu.addAction(hideTags);\r
620                 viewMenu.addAction(hideAttributes);\r
621                 viewMenu.addAction(hideSavedSearches);\r
622                 viewMenu.addAction(hideTrash);\r
623                 viewMenu.addAction(showEditorBar);\r
624                 viewMenu.addAction(hideLeftSide);\r
625                 \r
626                 formatMenu = addMenu(tr("&Format"));\r
627                 formatMenu.addAction(formatBold);\r
628                 formatMenu.addAction(formatUnderline);\r
629                 formatMenu.addAction(formatItalic);\r
630                 formatMenu.addSeparator();\r
631                 formatMenu.addAction(formatStrikethrough);\r
632                 formatMenu.addAction(horizontalLineAction);\r
633                 formatMenu.addSeparator();\r
634                 formatMenu.addAction(formatSuperscript);\r
635                 formatMenu.addAction(formatSubscript);\r
636                 formatMenu.addSeparator();\r
637 \r
638                 alignMenu = formatMenu.addMenu(tr("Alignment"));\r
639                 alignMenu.addAction(alignLeftAction);\r
640                 alignMenu.addAction(alignCenterAction);\r
641                 alignMenu.addAction(alignRightAction);\r
642                 \r
643                 listMenu = formatMenu.addMenu(tr("Lists"));\r
644                 listMenu.addAction(formatBulletList);\r
645                 listMenu.addAction(formatNumberList);\r
646                 indentMenu = formatMenu.addMenu(tr("Indent"));\r
647                 indentMenu.addAction(indentAction);\r
648                 indentMenu.addAction(outdentAction);\r
649                 \r
650                 noteAttributes.setCheckable(true);\r
651                 noteMenu.addAction(noteAdd);\r
652                 noteMenu.addAction(noteDelete);\r
653                 noteMenu.addAction(noteReindex);\r
654                 noteMenu.addSeparator();\r
655                 noteMenu.addAction(noteTags);\r
656                 noteMenu.addAction(noteRestoreAction);\r
657                 noteMenu.addSeparator();\r
658                 noteMenu.addAction(noteDuplicateAction);\r
659                 noteMenu.addAction(noteMergeAction);\r
660 \r
661                                 \r
662                 notebookMenu.addAction(notebookAddAction);\r
663                 notebookMenu.addAction(notebookEditAction);\r
664                 notebookMenu.addAction(notebookDeleteAction);\r
665                 notebookMenu.addSeparator();\r
666                 notebookMenu.addAction(notebookCloseAction);\r
667                 notebookMenu.addSeparator();\r
668                 notebookMenu.addAction(notebookIconAction);\r
669                 \r
670                 tagMenu.addAction(tagAddAction);\r
671                 tagMenu.addAction(tagEditAction);\r
672                 tagMenu.addAction(tagDeleteAction);\r
673                 tagMenu.addSeparator();\r
674                 tagMenu.addAction(tagIconAction);\r
675                 \r
676                 savedSearchMenu.addAction(savedSearchAddAction);\r
677                 savedSearchMenu.addAction(savedSearchEditAction);\r
678                 savedSearchMenu.addAction(savedSearchDeleteAction);\r
679                 \r
680                 onlineMenu = addMenu(tr("&Online"));\r
681                 onlineMenu.addAction(synchronizeAction);\r
682                 onlineMenu.addAction(connectAction);\r
683                 onlineMenu.addSeparator();\r
684                 onlineMenu.addAction(noteOnlineHistoryAction);\r
685                 \r
686                 toolsMenu = addMenu(tr("&Tools"));\r
687                 toolsMenu.addAction(spellCheckAction);\r
688                 toolsMenu.addAction(accountAction);\r
689                 toolsMenu.addAction(fullReindexAction);\r
690                 toolsMenu.addAction(disableIndexing);\r
691 //              toolsMenu.addAction(compactAction);\r
692                 toolsMenu.addSeparator();\r
693                 toolsMenu.addAction(encryptDatabaseAction);\r
694                 toolsMenu.addAction(databaseStatusAction);\r
695                 toolsMenu.addSeparator();\r
696                 toolsMenu.addAction(folderImportAction);\r
697 \r
698                 helpMenu = addMenu(tr("&Help"));\r
699                 helpMenu.addAction(releaseAction);\r
700                 helpMenu.addAction(loggerAction);\r
701                 helpMenu.addSeparator();\r
702                 helpMenu.addAction(aboutAction);\r
703                 \r
704                 addMenu(fileMenu);\r
705                 addMenu(editMenu);\r
706                 addMenu(viewMenu);\r
707                 addMenu(formatMenu);\r
708                 addMenu(onlineMenu);\r
709                 addMenu(toolsMenu);\r
710                 addMenu(helpMenu);\r
711 \r
712         }\r
713 \r
714         public void setupToolBarVisible() {\r
715                 viewMenu.addAction(parent.toolBar.toggleViewAction());\r
716                 setupShortcut(parent.toolBar.toggleViewAction(), "View_Toolbar");\r
717         }\r
718         \r
719         private void setupShortcut(QAction action, String text) {\r
720                 if (!Global.shortcutKeys.containsAction(text))\r
721                         return;\r
722                 action.setShortcut(Global.shortcutKeys.getShortcut(text));\r
723         }\r
724 \r
725 }\r