OSDN Git Service

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