2 * This file is part of NixNote/NeighborNote
3 * Copyright 2009 Randy Baumgarte
4 * Copyright 2013 Yuki Takahashi
6 * This file may be licensed under the terms of of the
7 * GNU General Public License Version 2 (the ``GPL'').
9 * Software distributed under the License is distributed
10 * on an ``AS IS'' basis, WITHOUT WARRANTY OF ANY KIND, either
11 * express or implied. See the GPL for the specific language
12 * governing rights and limitations.
14 * You should have received a copy of the GPL along with this
15 * program. If not, go to http://www.gnu.org/licenses/gpl.html
16 * or write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20 package cx.fbn.nevernote.gui;
22 import com.trolltech.qt.gui.QAction;
23 import com.trolltech.qt.gui.QMenu;
24 import com.trolltech.qt.gui.QMenuBar;
26 import cx.fbn.nevernote.Global;
27 import cx.fbn.nevernote.NeverNote;
29 public class MainMenuBar extends QMenuBar {
31 private final NeverNote parent;
32 public QAction printAction; // Action when a user selects Print from the file menu
33 public QAction connectAction; // Connect/Disconnect to Evernote
34 public QAction fullReindexAction; // Action when a user wants to reindex the entire database
35 public QAction synchronizeAction; // Synchronize data with Evernote
36 public QAction selectiveSyncAction; // Specify which notebooks or tags to ignore
37 public QAction settingsAction; // Show user config settings
38 public QAction emailAction; // Action when a user selects "email"
39 public QAction backupAction; // Backup the database
40 public QAction restoreAction; // Restore from a backup
41 public QAction emptyTrashAction; // Action when a user wants to clear the trash file
42 public QAction exitAction; // Action when user selects "exit"
43 public QAction aboutAction; // Action when a user selects "About"
44 public QAction checkForUpdates; // Check for newer versions
45 public QAction loggerAction; // Action when a user selects "Log"
46 public QAction releaseAction; // Release notes
48 public QAction noteAdd; // Add a note
49 public QAction noteAttributes; // Action when a user selects note attributes
50 public QAction noteTags; // Assign a note tags
51 public QAction noteDelete; // Delete the current note
52 public QAction noteRestoreAction; // Restore a note
53 public QAction noteReindex; // Action when a user wants to reindex a note
54 public QAction noteDuplicateAction; // Duplicate an existing note
55 public QAction noteMergeAction; // Merge notes
56 public QAction noteExportAction; // Export notes
57 public QAction noteImportAction; // Import notes
58 public QAction noteCopyAsUrlAction; // Copy the note as a URL
60 public QAction noteOpenNewTab; // 新しいタブで開く
61 public QAction noteAddNewTab; // 新しいタブでノート追加
63 public QAction editFind; // find text in the current note
64 public QAction editUndo; // Undo last change
65 public QAction editRedo; // Redo last change
66 public QAction editCut; // Cut selected text
67 public QAction editPaste; // Paste selected text
68 public QAction editPasteWithoutFormat; // Paste selected text
69 public QAction editCopy; // Copy selected text;
71 public QAction wideListView; // View with list on the top
72 public QAction narrowListView; // View with list on the side
73 public QAction thumbnailView; // view thumbnails
74 public QAction hideSavedSearches; // show/hide saved searches
75 public QAction hideZoom; // show/hide the zoom spinner
76 public QAction hideSearch; // Show/hide the search window
77 public QAction hideQuota; // show/hide the quota window
78 public QAction hideNotebooks; // show/hide notebooks
79 public QAction hideTags; // show/hide tags
80 public QAction hideAttributes; // show/hide note information
81 public QAction hideTrash; // show/hide trash tree
82 public QAction hideNoteList; // show/hide the list of notes
83 public QAction showEditorBar; // show/hide the editor button bar
84 public QAction hideLeftSide; // Hide the entire left side
85 public QAction viewSource; // View the source HTML of a note
87 public QAction formatBold; // Bold selected text
88 public QAction formatItalic; // Italics selected text
89 public QAction formatUnderline; // Underline selected text
90 public QAction formatStrikethrough; // Strikethrough selected text
91 public QAction formatSuperscript; // Superscript selected text
92 public QAction formatSubscript; // Subscript selected text
93 public QAction formatNumberList; // insert a numbered list
94 public QAction formatBulletList; // insert a bulleted list;
95 public QAction alignLeftAction; // Left justify text
96 public QAction alignRightAction; // Right justify text
97 public QAction alignCenterAction; // Center text
98 public QAction horizontalLineAction; // Insert a horizontal line
99 public QAction indentAction; // Indent
100 public QAction outdentAction; // outdent menu action
102 public QAction noteOnlineHistoryAction; // Pull note history from Evernote
104 public QAction accountAction; // Account dialog box action
105 public QAction disableIndexing; // put indexing on hold.
106 // public QAction compactAction; // free unused space in the database
107 public QAction databaseStatusAction; // Current database status
108 public QAction folderImportAction; // Automatically import files
109 public QAction spellCheckAction; // Spell checker
110 public QAction encryptDatabaseAction; // Encrypt the local database
112 public QAction notebookEditAction; // Edit the selected notebook
113 public QAction notebookAddAction; // Add a new notebook
114 public QAction notebookDeleteAction; // Delete a notebook
115 public QAction notebookPublishAction; // Publish a notebook
116 public QAction notebookShareAction; // Share a notebook with others
117 public QAction notebookCloseAction; // Close notebooks
118 public QAction notebookIconAction; // Change the icon
119 public QAction notebookStackAction; // Stack/Unstack the icon.
121 public QAction savedSearchAddAction; // Add a saved search
122 public QAction savedSearchEditAction; // Edit a saved search
123 public QAction savedSearchDeleteAction; // Delete a saved search
124 public QAction savedSearchIconAction; // Change a saved search icon
126 public QAction tagEditAction; // Edit a tag
127 public QAction tagAddAction; // Add a tag
128 public QAction tagDeleteAction; // Delete a tag
129 public QAction tagIconAction; // Change the icon
130 public QAction tagMergeAction; // Merge tags
132 //**************************************************************************
134 //**************************************************************************
136 private QMenu fileMenu; // File menu
137 private QMenu noteMenu; // Note menu
138 private QMenu notebookMenu; // Notebook menu
139 private QMenu tagMenu; // Tag menu
140 private QMenu savedSearchMenu; // Saved Searches
142 private QMenu editMenu; // Edit menu
144 private QMenu formatMenu; // Text format menu
145 private QMenu viewMenu; // show/hide stuff
146 private QMenu listMenu; // bullet or numbered list
147 private QMenu indentMenu; // indent or outdent menu
148 private QMenu alignMenu; // Left/Right/Center justify
150 // private QMenu onlineMenu; // View online stuff (if connected)
152 private QMenu toolsMenu; // Tools menu
154 private QMenu helpMenu;
157 private QMenu tableMenu;
158 private QMenu imageMenu;
159 private BrowserWindow prevBW;
161 public MainMenuBar(NeverNote p) {
165 prevBW = parent.browserWindow;
167 fullReindexAction = new QAction(tr("Reindex Database"), this);
168 fullReindexAction.setToolTip(tr("Reindex all notes"));
169 fullReindexAction.triggered.connect(parent, "fullReindex()");
170 setupShortcut(fullReindexAction, "Tools_Reindex_Database");
172 printAction = new QAction(tr("Print"), this);
173 printAction.setToolTip(tr("Print the current note"));
174 printAction.triggered.connect(parent, "printNote()");
175 setupShortcut(printAction, "File_Print");
177 emailAction = new QAction(tr("Email"), this);
178 emailAction.setToolTip(tr("Email the current note"));
179 emailAction.triggered.connect(parent, "emailNote()");
180 setupShortcut(emailAction, "File_Email");
182 backupAction = new QAction(tr("Backup Database"), this);
183 backupAction.setToolTip(tr("Backup the current database"));
184 backupAction.triggered.connect(parent, "databaseBackup()");
185 setupShortcut(backupAction, "File_Backup");
187 restoreAction = new QAction(tr("Restore Database"), this);
188 restoreAction.setToolTip(tr("Restore the database from a backup"));
189 restoreAction.triggered.connect(parent, "databaseRestore()");
190 setupShortcut(restoreAction, "File_Restore");
192 emptyTrashAction = new QAction(tr("Empty Trash"), this);
193 emptyTrashAction.setToolTip(tr("Empty the trash folder"));
194 emptyTrashAction.triggered.connect(parent, "emptyTrash()");
195 setupShortcut(emptyTrashAction, "File_Empty_Trash");
197 noteRestoreAction = new QAction(tr("Restore"), this);
198 noteRestoreAction.setToolTip(tr("Restore a deleted file from the trash"));
199 noteRestoreAction.triggered.connect(parent, "restoreNote()");
200 noteRestoreAction.setVisible(false);
201 setupShortcut(noteRestoreAction, "File_Note_Restore");
203 settingsAction = new QAction(tr("Preferences"), this);
204 settingsAction.setToolTip(tr("Program settings"));
205 settingsAction.triggered.connect(parent, "settings()");
206 setupShortcut(settingsAction, "Edit_Preferences");
208 exitAction = new QAction(tr("Exit"), this);
209 exitAction.setToolTip(tr("Close the program"));
210 exitAction.triggered.connect(parent, "closeNeverNote()");
211 exitAction.setShortcut("Ctrl+Q");
212 setupShortcut(exitAction, "File_Exit");
214 noteAttributes = new QAction(tr("Extended Information"), this);
215 noteAttributes.setToolTip(tr("Show/Hide extended note attributes"));
216 noteAttributes.triggered.connect(parent, "toggleNoteInformation()");
217 noteAttributes.setShortcut("F8");
218 setupShortcut(noteAttributes, "View_Extended_Information");
220 noteReindex = new QAction(tr("Reindex"), this);
221 noteReindex.setToolTip(tr("Reindex this note"));
222 noteReindex.triggered.connect(parent, "reindexNote()");
223 setupShortcut(noteReindex, "File_Note_Reindex");
225 noteDuplicateAction = new QAction(tr("Duplicate"), this);
226 noteDuplicateAction.setToolTip(tr("Duplicate this note"));
227 noteDuplicateAction.triggered.connect(parent, "duplicateNote()");
228 setupShortcut(noteReindex, "File_Note_Duplicate");
230 noteMergeAction = new QAction(tr("Merge Notes"), this);
231 noteMergeAction.setToolTip(tr("Merge Multiple notes"));
232 noteMergeAction.triggered.connect(parent, "mergeNotes()");
233 setupShortcut(noteMergeAction, "File_Note_Merge");
235 noteExportAction = new QAction(tr("Export Selected Notes"), this);
236 noteExportAction.setToolTip(tr("Export selected notes"));
237 noteExportAction.triggered.connect(parent, "exportNotes()");
238 setupShortcut(noteExportAction, "File_Note_Export");
240 noteCopyAsUrlAction = new QAction(tr("Copy as URL"), this);
241 noteCopyAsUrlAction.setToolTip(tr("Copy as URL"));
242 noteCopyAsUrlAction.triggered.connect(parent, "copyAsUrlClicked()");
243 setupShortcut(noteCopyAsUrlAction, "Note_Copy_As_Url");
245 noteImportAction = new QAction(tr("Import Notes"), this);
246 noteImportAction.setToolTip(tr("Import notes"));
247 noteImportAction.triggered.connect(parent, "importNotes()");
248 setupShortcut(noteImportAction, "File_Note_Import");
250 noteAdd = new QAction(tr("Add"), this);
251 noteAdd.setToolTip(tr("Add a new note"));
252 noteAdd.triggered.connect(parent, "addNote()");
253 setupShortcut(noteAdd, "File_Note_Add");
255 noteTags = new QAction(tr("Modify Tags"), this);
256 noteTags.setToolTip(tr("Change the tags assigned to this note"));
257 noteTags.triggered.connect(parent.browserWindow, "modifyTags()");
258 setupShortcut(noteTags, "File_Note_Modify_Tags");
260 noteDelete = new QAction(tr("Delete"), this);
261 noteDelete.setToolTip(tr("Delete this note"));
262 noteDelete.triggered.connect(parent, "deleteNote()");
263 setupShortcut(noteDelete, "File_Note_Delete");
265 // ICHANGED 新しいタブで開くアクション生成
266 noteOpenNewTab = new QAction(tr("Open in New Tab"), this);
267 noteOpenNewTab.setToolTip(tr("Open this note in new tab"));
268 noteOpenNewTab.triggered.connect(parent, "openNewTab()");
269 setupShortcut(noteOpenNewTab, "File_Note_Open_New_Tab");
271 // ICHANGED 新しいタブでノート追加アクション生成
272 noteAddNewTab = new QAction(tr("Add in New Tab"), this);
273 noteAddNewTab.setToolTip(tr("Add a new note in new tab"));
274 noteAddNewTab.triggered.connect(parent, "noteAddNewTab()");
275 setupShortcut(noteAddNewTab, "File_Note_Add_New_Tab");
277 editFind = new QAction(tr("Find In Note"), this);
278 editFind.setToolTip(tr("Find a string in the current note"));
279 editFind.triggered.connect(parent, "findText()");
280 setupShortcut(editFind, "Edit_Find_In_Note");
281 //editFind.setShortcut("Ctrl+F");
283 editUndo = new QAction(tr("Undo"), this);
284 editUndo.setToolTip(tr("Undo"));
285 editUndo.triggered.connect(parent.browserWindow, "undoClicked()");
286 setupShortcut(editUndo, "Edit_Undo");
287 //editUndo.setShortcut("Ctrl+Z");
289 editRedo = new QAction(tr("Redo"), this);
290 editRedo.setToolTip(tr("Redo"));
291 editRedo.triggered.connect(parent.browserWindow, "redoClicked()");
292 setupShortcut(editRedo, "Edit_Redo");
293 //editRedo.setShortcut("Ctrl+Y");
295 editCut = new QAction(tr("Cut"), this);
296 editCut.setToolTip(tr("Cut"));
297 editCut.triggered.connect(parent.browserWindow, "cutClicked()");
298 setupShortcut(editCut, "Edit_Cut");
299 //editCut.setShortcut("Ctrl+X");
301 editCopy = new QAction(tr("Copy"), this);
302 editCopy.setToolTip(tr("Copy"));
303 editCopy.triggered.connect(parent.browserWindow, "copyClicked()");
304 setupShortcut(editCopy, "Edit_Copy");
305 //editCopy.setShortcut("Ctrl+C");
308 editPaste = new QAction(tr("Paste"), this);
309 editPaste.setToolTip(tr("Paste"));
310 editPaste.triggered.connect(parent.browserWindow, "pasteClicked()");
311 setupShortcut(editPaste, "Edit_Paste");
313 editPasteWithoutFormat = new QAction(tr("Paste Without Formatting"), this);
314 editPasteWithoutFormat.setToolTip(tr("Paste Without Formatting"));
315 editPasteWithoutFormat.triggered.connect(parent.browserWindow, "pasteWithoutFormattingClicked()");
316 setupShortcut(editPasteWithoutFormat, "Edit_Paste_Without_Formatting");
318 hideNoteList = new QAction(tr("Show Note List"), this);
319 hideNoteList.setToolTip(tr("Show/Hide Note List"));
320 hideNoteList.triggered.connect(parent, "toggleNoteListWindow()");
321 hideNoteList.setCheckable(true);
322 hideNoteList.setChecked(true);
323 setupShortcut(hideNoteList, "View_Show_Note_List");
325 hideTags = new QAction(tr("Show Tags"), this);
326 hideTags.setToolTip(tr("Show/Hide Tags"));
327 hideTags.triggered.connect(parent, "toggleTagWindow()");
328 hideTags.setCheckable(true);
329 hideTags.setChecked(true);
330 setupShortcut(hideTags, "View_Show_Tags");
332 hideNotebooks = new QAction(tr("Show Notebooks"), this);
333 hideNotebooks.setToolTip(tr("Show/Hide Notebooks"));
334 hideNotebooks.triggered.connect(parent, "toggleNotebookWindow()");
335 hideNotebooks.setCheckable(true);
336 hideNotebooks.setChecked(true);
337 setupShortcut(hideNotebooks, "View_Show_Notebooks");
339 hideZoom = new QAction(tr("Show Zoom"), this);
340 hideZoom.setToolTip(tr("Show/Hide Zoom"));
341 hideZoom.triggered.connect(parent, "toggleZoomWindow()");
342 hideZoom.setCheckable(true);
343 hideZoom.setChecked(true);
344 setupShortcut(hideZoom, "View_Show_Zoom");
346 hideQuota = new QAction(tr("Show Quota Bar"), this);
347 hideQuota.setToolTip(tr("Show/Hide Quota"));
348 hideQuota.triggered.connect(parent, "toggleQuotaWindow()");
349 hideQuota.setCheckable(true);
350 hideQuota.setChecked(true);
351 setupShortcut(hideQuota, "View_Show_Quota");
353 hideSearch = new QAction(tr("Show Search Box"), this);
354 hideSearch.setToolTip(tr("Show/Hide Search Box"));
355 hideSearch.triggered.connect(parent, "toggleSearchWindow()");
356 hideSearch.setCheckable(true);
357 hideSearch.setChecked(true);
358 setupShortcut(hideSearch, "View_Show_Search");
360 wideListView = new QAction(tr("Wide List View"), this);
361 wideListView.setToolTip(tr("Wide List View"));
362 wideListView.setCheckable(true);
363 wideListView.changed.connect(parent, "wideListView()");
364 setupShortcut(wideListView, "View_Wide_List");
366 narrowListView = new QAction(tr("Narrow List View"), this);
367 narrowListView.setToolTip(tr("Narrow List View"));
368 narrowListView.setCheckable(true);
369 narrowListView.changed.connect(parent, "narrowListView()");
370 setupShortcut(narrowListView, "View_Narrow_List");
372 thumbnailView = new QAction(tr("Preview"), this);
373 thumbnailView.setToolTip(tr("Preview Notes"));
374 thumbnailView.triggered.connect(parent, "thumbnailView()");
375 setupShortcut(thumbnailView, "View_Thumbnail");
377 hideSavedSearches = new QAction(tr("Show Saved Searches"), this);
378 hideSavedSearches.setToolTip(tr("Show/Hide Saved Searches"));
379 hideSavedSearches.triggered.connect(parent, "toggleSavedSearchWindow()");
380 hideSavedSearches.setCheckable(true);
381 hideSavedSearches.setChecked(true);
382 setupShortcut(hideSavedSearches, "View_Show_SavedSearches");
384 hideAttributes = new QAction(tr("Show Attribute Searches"), this);
385 hideAttributes.setToolTip(tr("Show/Hide Attribute Searches"));
386 hideAttributes.triggered.connect(parent, "toggleAttributesWindow()");
387 hideAttributes.setCheckable(true);
388 hideAttributes.setChecked(true);
389 setupShortcut(hideAttributes, "View_Show_Attribute_Searches");
391 hideTrash = new QAction(tr("Show Trash"), this);
392 hideTrash.setToolTip(tr("Show/Hide Trash Tree"));
393 hideTrash.triggered.connect(parent, "toggleTrashWindow()");
394 hideTrash.setCheckable(true);
395 hideTrash.setChecked(true);
396 setupShortcut(hideTrash, "View_Show_Trash");
399 showEditorBar = new QAction(tr("Show Editor Button Bar"), this);
400 showEditorBar.setToolTip(tr("Show/Hide Editor Button Bar"));
401 showEditorBar.triggered.connect(parent, "toggleEditorButtonBar()");
402 showEditorBar.setCheckable(true);
403 showEditorBar.setChecked(true);
404 setupShortcut(showEditorBar, "View_Show_Editor_Button_Bar");
407 hideLeftSide = new QAction(tr("Hide Left Side Panels"), this);
408 hideLeftSide.setToolTip(tr("Hide The Entire Left Side"));
409 hideLeftSide.triggered.connect(parent, "toggleLeftSide()");
410 hideLeftSide.setCheckable(true);
411 hideLeftSide.setChecked(false);
412 setupShortcut(hideLeftSide, "View_Show_Left_Side");
413 //hideLeftSide.setShortcut("F11");
415 viewSource = new QAction(tr("View Source"), this);
416 viewSource.setToolTip(tr("View the source HTML for a note"));
417 viewSource.triggered.connect(parent, "viewSource()");
418 viewSource.setCheckable(true);
419 viewSource.setChecked(false);
420 setupShortcut(viewSource, "View_Source");
421 //hideLeftSide.setShortcut("F11");
423 alignLeftAction = new QAction(tr("Left"), this);
424 alignLeftAction.setToolTip(tr("Left Align"));
425 alignLeftAction.triggered.connect(parent.browserWindow, "justifyLeftClicked()");
426 setupShortcut(alignLeftAction, "Format_Alignment_Left");
427 //alignLeftAction.setShortcut("Ctrl+L");
429 alignRightAction = new QAction(tr("Right"), this);
430 alignRightAction.setToolTip(tr("Right Align"));
431 alignRightAction.triggered.connect(parent.browserWindow, "justifyRightClicked()");
432 setupShortcut(alignRightAction, "Format_Alignment_Right");
433 //alignRightAction.setShortcut("Ctrl+R");
435 alignCenterAction = new QAction(tr("Center"), this);
436 alignCenterAction.setToolTip(tr("Center Align"));
437 alignCenterAction.triggered.connect(parent.browserWindow, "justifyCenterClicked()");
438 setupShortcut(alignCenterAction, "Format_Alignment_Center");
439 //alignCenterAction.setShortcut("Ctrl+C");
441 formatBold = new QAction(tr("Bold"), this);
442 formatBold.setToolTip(tr("Bold"));
443 formatBold.triggered.connect(parent.browserWindow, "boldClicked()");
444 setupShortcut(formatBold, "Format_Bold");
445 //formatBold.setShortcut("Ctrl+B");
447 formatItalic = new QAction(tr("Italic"), this);
448 formatItalic.setToolTip(tr("Italic"));
449 formatItalic.triggered.connect(parent.browserWindow, "italicClicked()");
450 setupShortcut(formatItalic, "Format_Italic");
451 //formatItalic.setShortcut("Ctrl+I");
453 formatUnderline = new QAction(tr("Underline"), this);
454 formatUnderline.setToolTip(tr("Underline"));
455 formatUnderline.triggered.connect(parent.browserWindow, "underlineClicked()");
456 setupShortcut(formatUnderline, "Format_Underline");
457 // formatUnderline.setShortcut("Ctrl+U");
460 formatSuperscript = new QAction(tr("Superscript"), this);
461 formatSuperscript.setToolTip(tr("Superscript"));
462 formatSuperscript.triggered.connect(parent.browserWindow, "superscriptClicked()");
463 setupShortcut(formatSuperscript, "Format_Superscript");
466 formatSubscript = new QAction(tr("Subscript"), this);
467 formatSubscript.setToolTip(tr("Subscript"));
468 formatSubscript.triggered.connect(parent.browserWindow, "subscriptClicked()");
469 setupShortcut(formatSubscript, "Format_Subscript");
472 formatStrikethrough = new QAction(tr("Strikethrough"), this);
473 formatStrikethrough.setToolTip(tr("Strikethrough"));
474 formatStrikethrough.triggered.connect(parent.browserWindow, "strikethroughClicked()");
475 setupShortcut(formatStrikethrough, "Format_Strikethrough");
477 horizontalLineAction = new QAction(tr("Horizontal Line"), this);
478 horizontalLineAction.setToolTip(tr("Horizontal Line"));
479 horizontalLineAction.triggered.connect(parent.browserWindow, "hlineClicked()");
480 setupShortcut(horizontalLineAction, "Format_Horizontal_Line");
482 formatBulletList = new QAction(tr("Bulleted List"), this);
483 // formatBulletList.setText(tr("Numbered List"));
484 formatBulletList.triggered.connect(parent.browserWindow, "bulletListClicked()");
485 setupShortcut(formatBulletList, "Format_List_Bullet");
486 // formatBulletList.setShortcut("Ctrl+Shift+B");
488 formatNumberList = new QAction(tr("Numbered List"), this);
489 formatNumberList.setText(tr("Numbered list"));
490 formatNumberList.triggered.connect(parent.browserWindow, "numberListClicked()");
491 setupShortcut(formatNumberList, "Format_List_Numbered");
492 // formatNumberList.setShortcut("Ctrl+Shift+O");
494 indentAction = new QAction(tr(">> Increase"), this);
495 indentAction.setText(tr(">> Increase"));
496 indentAction.triggered.connect(parent.browserWindow, "indentClicked()");
497 setupShortcut(indentAction, "Format_Indent_Increase");
498 //indentAction.setShortcut("Ctrl+M");
500 outdentAction = new QAction(tr("<< Decrease"), this);
501 outdentAction.setText(tr("<< Decrease"));
502 outdentAction.triggered.connect(parent.browserWindow, "outdentClicked()");
503 setupShortcut(outdentAction, "Format_Indent_Decrease");
504 //outdentAction.setShortcut("Ctrl+Shift+M");
506 notebookAddAction = new QAction(tr("Add"), this);
507 notebookAddAction.triggered.connect(parent, "addNotebook()");
508 setupShortcut(notebookAddAction, "File_Notebook_Add");
510 notebookEditAction = new QAction(tr("Edit"), this);
511 notebookEditAction.setEnabled(false);
512 notebookEditAction.triggered.connect(parent, "editNotebook()");
513 setupShortcut(notebookEditAction, "File_Notebook_Edit");
515 notebookDeleteAction = new QAction(tr("Delete"), this);
516 notebookDeleteAction.setEnabled(false);
517 notebookDeleteAction.triggered.connect(parent, "deleteNotebook()");
518 setupShortcut(notebookDeleteAction, "File_Notebook_Delete");
520 notebookPublishAction = new QAction(tr("Share With The World"), this);
521 notebookPublishAction.setEnabled(false);
522 notebookPublishAction.setVisible(false);
523 notebookPublishAction.triggered.connect(parent, "publishNotebook()");
524 setupShortcut(notebookPublishAction, "File_Notebook_Publish");
526 notebookShareAction = new QAction(tr("Share With Individuals"), this);
527 notebookShareAction.setEnabled(false);
528 notebookShareAction.setVisible(false);
529 notebookShareAction.triggered.connect(parent, "shareNotebook()");
530 setupShortcut(notebookShareAction, "File_Notebook_Share");
533 notebookCloseAction = new QAction(tr("Open/Close Notebooks"), this);
534 notebookCloseAction.setEnabled(true);
535 notebookCloseAction.triggered.connect(parent, "closeNotebooks()");
536 setupShortcut(notebookCloseAction, "File_Notebook_Close");
538 notebookIconAction = new QAction(tr("Change Icon"), this);
539 notebookIconAction.setEnabled(false);
540 notebookIconAction.triggered.connect(parent, "setNotebookIcon()");
541 setupShortcut(notebookIconAction, "File_Notebook_Icon");
543 notebookStackAction = new QAction(tr("Set Stack"), this);
544 notebookStackAction.setEnabled(false);
545 notebookStackAction.triggered.connect(parent, "stackNotebook()");
546 setupShortcut(notebookStackAction, "File_Notebook_Stack");
548 tagAddAction = new QAction(tr("Add"),this);
549 tagAddAction.triggered.connect(parent, "addTag()");
550 setupShortcut(tagAddAction, "File_Tag_Add");
552 tagEditAction = new QAction(tr("Edit"), this);
553 tagEditAction.triggered.connect(parent, "editTag()");
554 tagEditAction.setEnabled(false);
555 setupShortcut(tagEditAction, "File_Tag_Edit");
557 tagDeleteAction = new QAction(tr("Delete"), this);
558 tagDeleteAction.triggered.connect(parent, "deleteTag()");
559 tagDeleteAction.setEnabled(false);
560 setupShortcut(tagDeleteAction, "File_Tag_Delete");
562 tagIconAction = new QAction(tr("Change Icon"), this);
563 tagIconAction.triggered.connect(parent, "setTagIcon()");
564 tagIconAction.setEnabled(false);
565 setupShortcut(tagIconAction, "File_Tag_Icon");
567 tagMergeAction = new QAction(tr("Merge Tags"), this);
568 tagMergeAction.triggered.connect(parent, "mergeTags()");
569 tagMergeAction.setEnabled(false);
570 setupShortcut(tagMergeAction, "File_Tag_Merge");
572 savedSearchAddAction = new QAction(tr("Add"),this);
573 savedSearchAddAction.triggered.connect(parent, "addSavedSearch()");
574 setupShortcut(savedSearchAddAction, "File_SavedSearch_Add");
576 savedSearchEditAction = new QAction(tr("Edit"), this);
577 savedSearchEditAction.triggered.connect(parent, "editSavedSearch()");
578 savedSearchEditAction.setEnabled(false);
579 setupShortcut(savedSearchEditAction, "File_SavedSearch_Edit");
581 savedSearchDeleteAction = new QAction(tr("Delete"), this);
582 savedSearchDeleteAction.triggered.connect(parent, "deleteSavedSearch()");
583 savedSearchDeleteAction.setEnabled(false);
584 setupShortcut(savedSearchDeleteAction, "File_SavedSearch_Delete");
586 savedSearchIconAction = new QAction(tr("Change Icon"), this);
587 savedSearchIconAction.triggered.connect(parent, "setSavedSearchIcon()");
588 savedSearchIconAction.setEnabled(false);
589 setupShortcut(savedSearchIconAction, "File_SavedSearch_Icon");
591 connectAction = new QAction(tr("Connect"), this);
592 connectAction.setToolTip("Connect to Evernote");
593 connectAction.triggered.connect(parent, "remoteConnect()");
594 setupShortcut(connectAction, "Tools_Connect");
596 synchronizeAction = new QAction(tr("Synchronize with Evernote"), this);
597 synchronizeAction.setToolTip("Delete all local data & get a fresh copy");
598 synchronizeAction.triggered.connect(parent, "evernoteSync()");
599 synchronizeAction.setEnabled(false);
600 setupShortcut(synchronizeAction, "Tools_Synchronize");
601 //synchronizeAction.setShortcut("F9");
603 noteOnlineHistoryAction = new QAction(tr("Note History"), this);
604 noteOnlineHistoryAction.triggered.connect(parent, "viewNoteHistory()");
605 noteOnlineHistoryAction.setEnabled(false);
606 setupShortcut(noteOnlineHistoryAction, "File_Note_History");
608 selectiveSyncAction = new QAction(tr("Selective Synchronize"), this);
609 selectiveSyncAction.setToolTip("Selectively ignore some notes");
610 selectiveSyncAction.triggered.connect(parent, "setupSelectiveSync()");
611 selectiveSyncAction.setEnabled(false);
612 setupShortcut(synchronizeAction, "File_Selective_Sync");
616 accountAction = new QAction(tr("Account Information"), this);
617 accountAction.setToolTip(tr("Account Information"));
618 accountAction.triggered.connect(parent, "accountInformation()");
619 setupShortcut(accountAction, "Tools_Account_Information");
621 // compactAction = new QAction(tr("Compact Database"), this);
622 // compactAction.setToolTip(tr("Free unused database space"));
623 // compactAction.triggered.connect(parent, "compactDatabase()");
624 // setupShortcut(compactAction, "Tools_Compact_Database");
626 databaseStatusAction = new QAction(tr("Database Status"), this);
627 databaseStatusAction.setToolTip(tr("Show current database information"));
628 databaseStatusAction.triggered.connect(parent, "databaseStatus()");
629 setupShortcut(databaseStatusAction, "Tools_Database_Status");
632 disableIndexing = new QAction(tr("Disable Note Indexing"), this);
633 disableIndexing.setToolTip(tr("Manually Stop Note Indexing"));
634 disableIndexing.triggered.connect(parent, "toggleNoteIndexing()");
635 disableIndexing.setCheckable(true);
636 disableIndexing.setChecked(false);
637 setupShortcut(disableIndexing, "Tools_Disable_Note_Indexing");
640 folderImportAction = new QAction(tr("Automatic Folder Importing"), this);
641 folderImportAction.setToolTip(tr("Import Files Automatically"));
642 folderImportAction.triggered.connect(parent, "folderImport()");
643 setupShortcut(folderImportAction, "Tools_Folder_Import");
645 spellCheckAction = new QAction(tr("Spell Check"), this);
646 spellCheckAction.setToolTip(tr("Check for spelling errors"));
647 spellCheckAction.triggered.connect(parent.browserWindow, "spellCheckClicked()");
648 setupShortcut(spellCheckAction, "Tools_Spell_Check");
650 encryptDatabaseAction = new QAction(tr("Encrypt Database"), this);
651 encryptDatabaseAction.setToolTip(tr("Encrypt the database upon shutdown"));
652 encryptDatabaseAction.triggered.connect(parent, "doDatabaseEncrypt()");
653 setupShortcut(encryptDatabaseAction, "Tools_Database_Encrypt");
654 if (Global.cipherPassword != null && Global.cipherPassword != "") {
655 encryptDatabaseAction.setText("Decrypt Database");
656 encryptDatabaseAction.setToolTip("Decrypt the database upon shutdown");
659 loggerAction = new QAction(tr("Logs"), this);
660 loggerAction.setToolTip(tr("Show the detailed application log"));
661 loggerAction.triggered.connect(parent, "logger()");
662 setupShortcut(loggerAction, "About_Log");
664 releaseAction = new QAction(tr("Release Notes"), this);
665 releaseAction.setToolTip(tr("Release notes"));
666 releaseAction.triggered.connect(parent, "releaseNotes()");
667 setupShortcut(releaseAction, "About_Release_Notes");
669 checkForUpdates = new QAction(tr("Check For Updates"), this);
670 checkForUpdates.setToolTip(tr("Check for newer versions"));
671 checkForUpdates.triggered.connect(parent, "checkForUpdates()");
672 setupShortcut(checkForUpdates, "Help_Check_For_Updates");
673 checkForUpdates.setEnabled(true);
675 aboutAction = new QAction(tr("About"), this);
676 aboutAction.setToolTip(tr("About NeighborNote"));
677 aboutAction.triggered.connect(parent, "about()");
678 setupShortcut(aboutAction, "About_About");
683 public void setupMenuBar() {
684 fileMenu = addMenu(tr("&File"));
686 noteMenu = fileMenu.addMenu(tr("&Note"));
687 notebookMenu = fileMenu.addMenu(tr("Notebook"));
688 tagMenu = fileMenu.addMenu(tr("Tag"));
689 savedSearchMenu = fileMenu.addMenu(tr("Saved Searches"));
690 fileMenu.addSeparator();
691 fileMenu.addAction(emailAction);
692 fileMenu.addAction(printAction);
693 fileMenu.addSeparator();
694 fileMenu.addAction(noteImportAction);
695 fileMenu.addAction(noteExportAction);
696 fileMenu.addAction(backupAction);
697 fileMenu.addAction(restoreAction);
698 fileMenu.addSeparator();
699 fileMenu.addAction(selectiveSyncAction);
700 //fileMenu.addAction(parent.browserWindow.browser.downloadAttachment);
701 fileMenu.addSeparator();
702 fileMenu.addAction(emptyTrashAction);
703 fileMenu.addAction(exitAction);
705 editMenu = addMenu(tr("&Edit"));
706 editMenu.addAction(editFind);
707 editMenu.addSeparator();
708 editMenu.addAction(editUndo);
709 editMenu.addAction(editRedo);
710 editMenu.addSeparator();
711 editMenu.addAction(editCut);
712 editMenu.addAction(editCopy);
713 editMenu.addAction(editPaste);
714 editMenu.addAction(editPasteWithoutFormat);
715 editMenu.addSeparator();
716 editMenu.addAction(settingsAction);
718 viewMenu = addMenu(tr("&View"));
719 viewMenu.addAction(noteAttributes);
720 viewMenu.addAction(viewSource);
721 viewMenu.addSeparator();
722 viewMenu.addAction(wideListView);
723 viewMenu.addAction(narrowListView);
724 viewMenu.addAction(thumbnailView);
725 viewMenu.addSeparator();
726 viewMenu.addAction(hideNoteList);
727 viewMenu.addAction(hideSearch);
728 viewMenu.addAction(hideQuota);
729 viewMenu.addAction(hideZoom);
730 viewMenu.addAction(hideNotebooks);
731 viewMenu.addAction(hideTags);
732 viewMenu.addAction(hideAttributes);
733 viewMenu.addAction(hideSavedSearches);
734 viewMenu.addAction(hideTrash);
735 viewMenu.addAction(showEditorBar);
736 viewMenu.addAction(hideLeftSide);
738 formatMenu = addMenu(tr("F&ormat"));
739 formatMenu.addAction(formatBold);
740 formatMenu.addAction(formatUnderline);
741 formatMenu.addAction(formatItalic);
742 formatMenu.addSeparator();
743 formatMenu.addAction(formatStrikethrough);
744 formatMenu.addAction(horizontalLineAction);
745 formatMenu.addSeparator();
746 formatMenu.addAction(formatSuperscript);
747 formatMenu.addAction(formatSubscript);
748 formatMenu.addSeparator();
749 //formatMenu.addAction(parent.browserWindow.browser.todoAction);
750 //formatMenu.addAction(parent.browserWindow.browser.encryptAction);
751 //formatMenu.addAction(parent.browserWindow.browser.insertLinkAction);
752 //formatMenu.addAction(parent.browserWindow.browser.insertQuickLinkAction);
753 //formatMenu.addAction(parent.browserWindow.browser.insertLatexAction);
754 formatMenu.addMenu(parent.browserWindow.browser.tableMenu);
755 formatMenu.addMenu(parent.browserWindow.browser.imageMenu);
756 formatMenu.addSeparator();
759 // ライブラリにremoveMenu()が存在しないので、removeAction()で消せるようにTable,Imageメニューをここで再定義
760 tableMenu = new QMenu();
761 tableMenu.setTitle(tr("Table"));
762 tableMenu.addAction(parent.browserWindow.browser.insertTableAction);
763 tableMenu.addAction(parent.browserWindow.browser.insertTableRowAction);
765 .addAction(parent.browserWindow.browser.insertTableColumnAction);
766 tableMenu.addAction(parent.browserWindow.browser.deleteTableRowAction);
768 .addAction(parent.browserWindow.browser.deleteTableColumnAction);
769 imageMenu = new QMenu();
770 imageMenu.setTitle(tr("Image"));
771 imageMenu.addAction(parent.browserWindow.browser.downloadImage);
772 imageMenu.addAction(parent.browserWindow.browser.rotateImageRight);
773 imageMenu.addAction(parent.browserWindow.browser.rotateImageLeft);
775 alignMenu = formatMenu.addMenu(tr("Alignment"));
776 alignMenu.addAction(alignLeftAction);
777 alignMenu.addAction(alignCenterAction);
778 alignMenu.addAction(alignRightAction);
780 listMenu = formatMenu.addMenu(tr("Lists"));
781 listMenu.addAction(formatBulletList);
782 listMenu.addAction(formatNumberList);
783 indentMenu = formatMenu.addMenu(tr("Indent"));
784 indentMenu.addAction(indentAction);
785 indentMenu.addAction(outdentAction);
787 noteAttributes.setCheckable(true);
789 noteMenu.addAction(noteOpenNewTab);
791 noteMenu.addAction(noteAdd);
793 noteMenu.addAction(noteAddNewTab);
795 noteMenu.addAction(noteDelete);
796 //noteMenu.addAction(noteCopyAsUrlAction);
797 noteMenu.addAction(noteReindex);
798 noteMenu.addSeparator();
799 noteMenu.addAction(noteTags);
800 noteMenu.addAction(noteRestoreAction);
801 noteMenu.addSeparator();
802 noteMenu.addAction(noteOnlineHistoryAction);
803 noteMenu.addAction(noteDuplicateAction);
804 noteMenu.addAction(noteMergeAction);
807 notebookMenu.addAction(notebookAddAction);
808 notebookMenu.addAction(notebookEditAction);
809 notebookMenu.addAction(notebookDeleteAction);
810 notebookMenu.addSeparator();
811 notebookMenu.addAction(notebookPublishAction);
812 notebookMenu.addAction(notebookShareAction);
813 notebookMenu.addSeparator();
814 notebookMenu.addAction(notebookStackAction);
815 notebookMenu.addAction(notebookCloseAction);
816 notebookMenu.addSeparator();
817 notebookMenu.addAction(notebookIconAction);
819 tagMenu.addAction(tagAddAction);
820 tagMenu.addAction(tagEditAction);
821 tagMenu.addAction(tagDeleteAction);
822 tagMenu.addAction(tagMergeAction);
823 tagMenu.addSeparator();
824 tagMenu.addAction(tagIconAction);
826 savedSearchMenu.addAction(savedSearchAddAction);
827 savedSearchMenu.addAction(savedSearchEditAction);
828 savedSearchMenu.addAction(savedSearchDeleteAction);
829 savedSearchMenu.addSeparator();
830 savedSearchMenu.addAction(savedSearchIconAction);
832 // onlineMenu = addMenu(tr("&Online"));
833 // onlineMenu.addAction(synchronizeAction);
834 // onlineMenu.addAction(connectAction);
835 // onlineMenu.addSeparator();
836 // onlineMenu.addAction(noteOnlineHistoryAction);
837 // onlineMenu.addAction(selectiveSyncAction);
839 toolsMenu = addMenu(tr("&Tools"));
840 toolsMenu.addAction(synchronizeAction);
841 toolsMenu.addAction(connectAction);
842 toolsMenu.addSeparator();
843 toolsMenu.addAction(spellCheckAction);
844 toolsMenu.addAction(accountAction);
845 toolsMenu.addAction(fullReindexAction);
846 toolsMenu.addAction(disableIndexing);
847 // toolsMenu.addAction(compactAction);
848 toolsMenu.addSeparator();
849 toolsMenu.addAction(encryptDatabaseAction);
850 toolsMenu.addAction(databaseStatusAction);
851 toolsMenu.addSeparator();
852 toolsMenu.addAction(folderImportAction);
854 helpMenu = addMenu(tr("&Help"));
855 helpMenu.addAction(releaseAction);
856 helpMenu.addAction(checkForUpdates);
857 helpMenu.addAction(loggerAction);
858 helpMenu.addSeparator();
859 helpMenu.addAction(aboutAction);
865 // addMenu(onlineMenu);
871 public void setupToolBarVisible() {
872 viewMenu.addAction(parent.toolBar.toggleViewAction());
873 setupShortcut(parent.toolBar.toggleViewAction(), "View_Toolbar");
876 private void setupShortcut(QAction action, String text) {
877 if (!Global.shortcutKeys.containsAction(text))
879 action.setShortcut(Global.shortcutKeys.getShortcut(text));
883 public void refreshTargetWindow() {
884 // 以前のブラウザウィンドウとの接続を切断
885 noteTags.triggered.disconnect(prevBW, "modifyTags()");
886 editUndo.triggered.disconnect(prevBW, "undoClicked()");
887 editRedo.triggered.disconnect(prevBW, "redoClicked()");
888 editCut.triggered.disconnect(prevBW, "cutClicked()");
889 editCopy.triggered.disconnect(prevBW, "copyClicked()");
890 editPaste.triggered.disconnect(prevBW, "pasteClicked()");
891 editPasteWithoutFormat.triggered.disconnect(prevBW,
892 "pasteWithoutFormattingClicked()");
894 alignLeftAction.triggered.disconnect(prevBW, "justifyLeftClicked()");
895 alignRightAction.triggered.disconnect(prevBW, "justifyRightClicked()");
896 alignCenterAction.triggered
897 .disconnect(prevBW, "justifyCenterClicked()");
898 formatBold.triggered.disconnect(prevBW, "boldClicked()");
899 formatItalic.triggered.disconnect(prevBW, "italicClicked()");
900 formatUnderline.triggered.disconnect(prevBW, "underlineClicked()");
901 formatSuperscript.triggered.disconnect(prevBW, "superscriptClicked()");
902 formatSubscript.triggered.disconnect(prevBW, "subscriptClicked()");
903 formatStrikethrough.triggered.disconnect(prevBW,
904 "strikethroughClicked()");
905 horizontalLineAction.triggered.disconnect(prevBW, "hlineClicked()");
906 formatBulletList.triggered.disconnect(prevBW, "bulletListClicked()");
907 formatNumberList.triggered.disconnect(prevBW, "numberListClicked()");
908 indentAction.triggered.disconnect(prevBW, "indentClicked()");
909 outdentAction.triggered.disconnect(prevBW, "outdentClicked()");
911 spellCheckAction.triggered.disconnect(prevBW, "spellCheckClicked()");
914 noteTags.triggered.connect(parent.browserWindow, "modifyTags()");
915 editUndo.triggered.connect(parent.browserWindow, "undoClicked()");
916 editRedo.triggered.connect(parent.browserWindow, "redoClicked()");
917 editCut.triggered.connect(parent.browserWindow, "cutClicked()");
918 editCopy.triggered.connect(parent.browserWindow, "copyClicked()");
919 editPaste.triggered.connect(parent.browserWindow, "pasteClicked()");
920 editPasteWithoutFormat.triggered.connect(parent.browserWindow,
921 "pasteWithoutFormattingClicked()");
923 alignLeftAction.triggered.connect(parent.browserWindow,
924 "justifyLeftClicked()");
925 alignRightAction.triggered.connect(parent.browserWindow,
926 "justifyRightClicked()");
927 alignCenterAction.triggered.connect(parent.browserWindow,
928 "justifyCenterClicked()");
929 formatBold.triggered.connect(parent.browserWindow, "boldClicked()");
930 formatItalic.triggered.connect(parent.browserWindow, "italicClicked()");
931 formatUnderline.triggered.connect(parent.browserWindow,
932 "underlineClicked()");
933 formatSuperscript.triggered.connect(parent.browserWindow,
934 "superscriptClicked()");
935 formatSubscript.triggered.connect(parent.browserWindow,
936 "subscriptClicked()");
937 formatStrikethrough.triggered.connect(parent.browserWindow,
938 "strikethroughClicked()");
939 horizontalLineAction.triggered.connect(parent.browserWindow,
941 formatBulletList.triggered.connect(parent.browserWindow,
942 "bulletListClicked()");
943 formatNumberList.triggered.connect(parent.browserWindow,
944 "numberListClicked()");
945 indentAction.triggered.connect(parent.browserWindow, "indentClicked()");
946 outdentAction.triggered.connect(parent.browserWindow,
949 spellCheckAction.triggered.connect(parent.browserWindow,
950 "spellCheckClicked()");
952 // メニューバーに新しいアクションを挿入
953 fileMenu.insertAction(prevBW.browser.downloadAttachment,
954 parent.browserWindow.browser.downloadAttachment);
956 formatMenu.insertAction(prevBW.browser.todoAction,
957 parent.browserWindow.browser.todoAction);
958 formatMenu.insertAction(prevBW.browser.encryptAction,
959 parent.browserWindow.browser.encryptAction);
960 formatMenu.insertAction(prevBW.browser.insertLinkAction,
961 parent.browserWindow.browser.insertLinkAction);
962 formatMenu.insertAction(prevBW.browser.insertQuickLinkAction,
963 parent.browserWindow.browser.insertQuickLinkAction);
964 formatMenu.insertAction(prevBW.browser.insertLatexAction,
965 parent.browserWindow.browser.insertLatexAction);
967 tableMenu.insertAction(prevBW.browser.insertTableAction,
968 parent.browserWindow.browser.insertTableAction);
969 tableMenu.insertAction(prevBW.browser.insertTableRowAction,
970 parent.browserWindow.browser.insertTableRowAction);
971 tableMenu.insertAction(prevBW.browser.insertTableColumnAction,
972 parent.browserWindow.browser.insertTableColumnAction);
973 tableMenu.insertAction(prevBW.browser.deleteTableRowAction,
974 parent.browserWindow.browser.deleteTableRowAction);
975 tableMenu.insertAction(prevBW.browser.deleteTableColumnAction,
976 parent.browserWindow.browser.deleteTableColumnAction);
978 imageMenu.insertAction(prevBW.browser.downloadImage,
979 parent.browserWindow.browser.downloadImage);
980 imageMenu.insertAction(prevBW.browser.rotateImageRight,
981 parent.browserWindow.browser.rotateImageRight);
982 imageMenu.insertAction(prevBW.browser.rotateImageLeft,
983 parent.browserWindow.browser.rotateImageLeft);
985 // メニューバーから古いアクションを削除
986 fileMenu.removeAction(prevBW.browser.downloadAttachment);
988 formatMenu.removeAction(prevBW.browser.todoAction);
989 formatMenu.removeAction(prevBW.browser.encryptAction);
990 formatMenu.removeAction(prevBW.browser.insertLinkAction);
991 formatMenu.removeAction(prevBW.browser.insertQuickLinkAction);
992 formatMenu.removeAction(prevBW.browser.insertLatexAction);
994 tableMenu.removeAction(prevBW.browser.insertTableAction);
995 tableMenu.removeAction(prevBW.browser.insertTableRowAction);
996 tableMenu.removeAction(prevBW.browser.insertTableColumnAction);
997 tableMenu.removeAction(prevBW.browser.deleteTableRowAction);
998 tableMenu.removeAction(prevBW.browser.deleteTableColumnAction);
1000 imageMenu.removeAction(prevBW.browser.downloadImage);
1001 imageMenu.removeAction(prevBW.browser.rotateImageRight);
1002 imageMenu.removeAction(prevBW.browser.rotateImageLeft);
1005 prevBW = parent.browserWindow;