OSDN Git Service

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