OSDN Git Service

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