OSDN Git Service

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