OSDN Git Service

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