OSDN Git Service

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