cutAction = new QAction(tr("Cut"), this);
cutAction.triggered.connect(parent, "cutClicked()");
contextMenu.addAction(cutAction);
contextMenu.insertSeparator(cutAction);
setupShortcut(cutAction, "Edit_Cut");
cutShortcut = new QShortcut(this);
cutShortcut.activated.connect(parent, "cutClicked()");
setupShortcut(cutShortcut, "Edit_Cut");
copyAction = new QAction(tr("Copy"), this);
copyAction.triggered.connect(parent, "copyClicked()");
contextMenu.addAction(copyAction);
setupShortcut(copyAction, "Edit_Copy");
copyShortcut = new QShortcut(this);
copyShortcut.activated.connect(parent, "copyClicked()");
setupShortcut(copyShortcut, "Edit_Copy");
pasteAction = pageAction(QWebPage.WebAction.Paste);
pasteAction.disconnect();
pasteAction.triggered.connect(parent, "pasteClicked()");
contextMenu.addAction(pasteAction);
setupShortcut(pasteAction, "Edit_Paste");
pasteShortcut = new QShortcut(this);
pasteShortcut.activated.connect(parent, "pasteClicked()");
setupShortcut(pasteShortcut, "Edit_Paste");
pasteWithoutFormatAction = new QAction(tr("Paste Without Formatting"), this);
pasteWithoutFormatAction.triggered.connect(parent, "pasteWithoutFormattingClicked()");
contextMenu.addAction(pasteWithoutFormatAction);
setupShortcut(pasteWithoutFormatAction, "Edit_Paste_Without_Formatting");
// pasteWithoutFormatShortcut = new QShortcut(this);
// pasteWithoutFormatShortcut.activated.connect(parent, "pasteWithoutFormattingClicked()");
// setupShortcut(pasteWithoutFormatShortcut, "Edit_Paste_Without_Formatting");
contextMenu.addSeparator();
QMenu colorMenu = new QMenu(tr("Background Color"));
contextMenu.addMenu(colorMenu);
colorMenu.addAction(setupColorMenuOption("White"));
colorMenu.addAction(setupColorMenuOption("Red"));
colorMenu.addAction(setupColorMenuOption("Blue"));
colorMenu.addAction(setupColorMenuOption("Green"));
colorMenu.addAction(setupColorMenuOption("Yellow"));
colorMenu.addAction(setupColorMenuOption("Black"));
colorMenu.addAction(setupColorMenuOption("Grey"));
colorMenu.addAction(setupColorMenuOption("Purple"));
colorMenu.addAction(setupColorMenuOption("Brown"));
colorMenu.addAction(setupColorMenuOption("Orange"));
colorMenu.addAction(setupColorMenuOption("Powder Blue"));
contextMenu.addSeparator();
todoAction = new QAction(tr("To-do"), this);
todoAction.triggered.connect(parent, "todoClicked()");
contextMenu.addAction(todoAction);
setupShortcut(todoAction, "Edit_Insert_Todo");
contextMenu.insertSeparator(todoAction);
todoShortcut = new QShortcut(this);
todoShortcut.activated.connect(parent, "todoClicked()");
setupShortcut(todoShortcut, "Edit_Insert_Todo");
encryptAction = new QAction(tr("Encrypt Selected Text"), this);
encryptAction.triggered.connect(parent, "encryptText()");
contextMenu.addAction(encryptAction);
contextMenu.insertSeparator(encryptAction);
setupShortcut(encryptAction, "Edit_Encrypt_Text");
encryptAction.setEnabled(false);
encryptShortcut = new QShortcut(this);
encryptShortcut.activated.connect(parent, "encryptText()");
setupShortcut(encryptShortcut, "Edit_Encrypt_Text");
insertLinkAction = new QAction(tr("Insert Hyperlink"), this);
insertLinkAction.triggered.connect(parent, "insertLink()");
setupShortcut(insertLinkAction, "Edit_Insert_Hyperlink");
contextMenu.addAction(insertLinkAction);
insertLinkAction.setEnabled(false);
insertLinkShortcut = new QShortcut(this);
setupShortcut(insertLinkShortcut, "Edit_Insert_Hyperlink");
insertLinkShortcut.activated.connect(parent, "insertLink()");
insertQuickLinkAction = new QAction(tr("Quick Link"), this);
insertQuickLinkAction.triggered.connect(parent, "insertQuickLink()");
setupShortcut(insertQuickLinkAction, "Edit_Insert_QuickLink");
contextMenu.addAction(insertQuickLinkAction);
insertQuickLinkAction.setEnabled(false);
insertQuickLinkShortcut = new QShortcut(this);
setupShortcut(insertQuickLinkShortcut, "Edit_Insert_Quicklink");
insertQuickLinkShortcut.activated.connect(parent, "insertQuickLink()");
insertLatexAction = new QAction(tr("Insert LaTeX Formula"), this);
insertLatexAction.triggered.connect(parent, "insertLatex()");
setupShortcut(insertLatexAction, "Edit_Insert_Latex");
contextMenu.addAction(insertLatexAction);
insertLatexShortcut = new QShortcut(this);
setupShortcut(insertLatexShortcut, "Edit_Insert_Latex");
insertLatexShortcut.activated.connect(parent, "insertLatex()");
contextMenu.addMenu(tableMenu);
tableMenu.setTitle("Table");
insertTableAction = new QAction(tr("Insert Table"), this);
insertTableAction.triggered.connect(parent, "insertTable()");
setupShortcut(insertTableAction, "Edit_Insert_Table");
tableMenu.addAction(insertTableAction);
insertTableShortcut = new QShortcut(this);
setupShortcut(insertTableShortcut, "Edit_Insert_Table");
insertTableShortcut.activated.connect(parent, "insertTable()");
insertTableRowAction = new QAction(tr("Insert Row"), this);
insertTableRowAction.triggered.connect(parent, "insertTableRow()");
setupShortcut(insertTableRowAction, "Edit_Insert_Table_Row");
tableMenu.addAction(insertTableRowAction);
insertTableRowShortcut = new QShortcut(this);
setupShortcut(insertTableRowShortcut, "Edit_Insert_Table_Row");
insertTableRowShortcut.activated.connect(parent, "insertTableRow()");
insertTableColumnAction = new QAction(tr("Insert Column"), this);
insertTableColumnAction.triggered.connect(parent, "insertTableColumn()");
setupShortcut(insertTableColumnAction, "Edit_Insert_Table_Column");
tableMenu.addAction(insertTableColumnAction);
insertTableColumnShortcut = new QShortcut(this);
setupShortcut(insertTableColumnShortcut, "Edit_Insert_Table_Column");
insertTableColumnShortcut.activated.connect(parent, "insertTableColumn()");
deleteTableRowAction = new QAction(tr("Delete Row"), this);
deleteTableRowAction.triggered.connect(parent, "deleteTableRow()");
setupShortcut(deleteTableRowAction, "Edit_Delete_Table_Row");
tableMenu.addAction(deleteTableRowAction);
deleteTableRowShortcut = new QShortcut(this);
setupShortcut(deleteTableRowShortcut, "Edit_Delete_Table_Row");
deleteTableRowShortcut.activated.connect(parent, "deleteTableRow()");
deleteTableColumnAction = new QAction(tr("Delete Column"), this);
deleteTableColumnAction.triggered.connect(parent, "deleteTableColumn()");
setupShortcut(deleteTableColumnAction, "Edit_Delete_Table_Column");
tableMenu.addAction(deleteTableColumnAction);
deleteTableColumnShortcut = new QShortcut(this);
setupShortcut(deleteTableColumnShortcut, "Edit_Delete_Table_Column");
deleteTableColumnShortcut.activated.connect(parent, "deleteTableColumn()");
insertDateTimeShortcut = new QShortcut(this);
insertDateTimeShortcut.activated.connect(parent, "insertDateTime()");
setupShortcut(insertDateTimeShortcut, "Insert_DateTime");
imageMenu = new QMenu();
imageMenu.setTitle(tr("Image"));
contextMenu.addMenu(imageMenu);
downloadImage = pageAction(QWebPage.WebAction.DownloadImageToDisk);
downloadImage.setText(tr("Save Image"));
imageMenu.addAction(downloadImage);
// contextMenu.insertSeparator(downloadImage);
// page().downloadRequested.connect(this, "downloadImage(QNetworkRequest)");
downloadImageRequested = new Signal1<QNetworkRequest>();
rotateImageRight = new QAction(tr("Rotate Right"), this);
imageMenu.addAction(rotateImageRight);
rotateImageRight.triggered.connect(parent, "rotateImageRight()");
rotateImageRightShortcut = new QShortcut(this);
setupShortcut(rotateImageRightShortcut, "Edit_Image_Rotate_Right");
rotateImageRightShortcut.activated.connect(parent, "rotateImageRight()");
rotateImageLeft = new QAction(tr("Rotate Left"), this);
imageMenu.addAction(rotateImageLeft);
rotateImageLeft.triggered.connect(parent, "rotateImageLeft()");
rotateImageLeftShortcut = new QShortcut(this);
setupShortcut(rotateImageLeftShortcut, "Edit_Image_Rotate_Left");
rotateImageLeftShortcut.activated.connect(parent, "rotateImageLeft()");
downloadAttachment = pageAction(QWebPage.WebAction.DownloadLinkToDisk);
downloadAttachment.setText(tr("Save Attachment"));