OSDN Git Service

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