OSDN Git Service

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