OSDN Git Service

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