OSDN Git Service

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