OSDN Git Service

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