OSDN Git Service

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