font.setPointSize(10);
sourceEdit.setFont(font);
syntaxHighlighter = new Highlighter(sourceEdit.document());
sourceEdit.textChanged.connect(this, "sourceEdited()");
QVBoxLayout v = new QVBoxLayout();
QFormLayout notebookLayout = new QFormLayout();
QGridLayout dateLayout = new QGridLayout();
titleLabel.setReadOnly(false);
titleLabel.editingFinished.connect(this, "titleEdited()");
browser.page().contentsChanged.connect(this, "contentChanged()");
browser.page().selectionChanged.connect(this, "selectionChanged()");
browser.page().mainFrame().javaScriptWindowObjectCleared.connect(this,
"exposeToJavascript()");
notebookBox.activated.connect(this, "notebookChanged()");
resourceSignal = new NoteResourceSignal();
QHBoxLayout tagLayout = new QHBoxLayout();
v.addWidget(titleLabel, 0);
notebookLayout.addRow(notebookLabel, notebookBox);
tagLayout.addLayout(notebookLayout, 0);
tagLayout.stretch(4);
tagLayout.addWidget(tagLabel, 0);
tagLayout.addWidget(tagEdit, 1);
v.addLayout(tagLayout);
QHBoxLayout urlLayout = new QHBoxLayout();
urlLayout.addWidget(urlLabel, 0);
urlLayout.addWidget(urlText, 0);
v.addLayout(urlLayout);
QHBoxLayout authorLayout = new QHBoxLayout();
authorLayout.addWidget(authorLabel, 0);
authorLayout.addWidget(authorText, 0);
authorLayout.addWidget(geoBox);
v.addLayout(authorLayout);
dateLayout.addWidget(createdLabel, 0, 0);
dateLayout.addWidget(createdDate, 0, 1);
dateLayout.addWidget(createdTime, 0, 2);
dateLayout.setColumnStretch(9, 100);
dateLayout.addWidget(alteredLabel, 0, 3);
dateLayout.addWidget(alteredDate, 0, 4);
dateLayout.addWidget(alteredTime, 0, 5);
dateLayout.addWidget(subjectLabel, 0, 6);
dateLayout.addWidget(subjectDate, 0, 7);
dateLayout.addWidget(subjectTime, 0, 8);
v.addLayout(dateLayout, 0);
undoButton = newEditorButton("undo", tr("Undo Change"));
redoButton = newEditorButton("redo", tr("Redo Change"));
cutButton = newEditorButton("cut", tr("Cut"));
copyButton = newEditorButton("copy", tr("Copy"));
pasteButton = newEditorButton("paste", tr("Paste"));
boldButton = newEditorButton("bold", tr("Bold"));
underlineButton = newEditorButton("underline", tr("Underline"));
italicButton = newEditorButton("italic", tr("Italic"));
rightAlignButton = newEditorButton("justifyRight", tr("Right Align"));
leftAlignButton = newEditorButton("justifyLeft", tr("Left Align"));
centerAlignButton = newEditorButton("justifyCenter", tr("Center Align"));
strikethroughButton = newEditorButton("strikethrough", tr("Strikethrough"));
hlineButton = newEditorButton("hline", tr("Insert Horizontal Line"));
indentButton = newEditorButton("indent", tr("Shift Right"));
outdentButton = newEditorButton("outdent", tr("Shift Left"));
bulletListButton = newEditorButton("bulletList", tr("Bullet List"));
numberListButton = newEditorButton("numberList", tr("Number List"));
spellCheckButton = newEditorButton("spellCheck", tr("Spell Check"));
todoButton = newEditorButton("todo", tr("To-do"));
buttonLayout = new EditorButtonBar();
v.addWidget(buttonLayout);
undoAction = buttonLayout.addWidget(undoButton);
buttonLayout.toggleUndoVisible.triggered.connect(this, "toggleUndoVisible(Boolean)");
redoAction = buttonLayout.addWidget(redoButton);
buttonLayout.toggleRedoVisible.triggered.connect(this, "toggleRedoVisible(Boolean)");
buttonLayout.addWidget(newSeparator());
cutAction = buttonLayout.addWidget(cutButton);
buttonLayout.toggleCutVisible.triggered.connect(this, "toggleCutVisible(Boolean)");
copyAction = buttonLayout.addWidget(copyButton);
buttonLayout.toggleCopyVisible.triggered.connect(this, "toggleCopyVisible(Boolean)");
pasteAction = buttonLayout.addWidget(pasteButton);
buttonLayout.togglePasteVisible.triggered.connect(this, "togglePasteVisible(Boolean)");
buttonLayout.addWidget(newSeparator());
boldAction = buttonLayout.addWidget(boldButton);
buttonLayout.toggleBoldVisible.triggered.connect(this, "toggleBoldVisible(Boolean)");
italicAction = buttonLayout.addWidget(italicButton);
buttonLayout.toggleItalicVisible.triggered.connect(this, "toggleItalicVisible(Boolean)");
underlineAction = buttonLayout.addWidget(underlineButton);
buttonLayout.toggleUnderlineVisible.triggered.connect(this, "toggleUnderlineVisible(Boolean)");
strikethroughAction = buttonLayout.addWidget(strikethroughButton);
buttonLayout.toggleStrikethroughVisible.triggered.connect(this, "toggleStrikethroughVisible(Boolean)");
buttonLayout.addWidget(newSeparator());
leftAlignAction = buttonLayout.addWidget(leftAlignButton);
buttonLayout.toggleLeftAlignVisible.triggered.connect(this, "toggleLeftAlignVisible(Boolean)");
centerAlignAction = buttonLayout.addWidget(centerAlignButton);
buttonLayout.toggleCenterAlignVisible.triggered.connect(this, "toggleCenterAlignVisible(Boolean)");
rightAlignAction = buttonLayout.addWidget(rightAlignButton);
buttonLayout.toggleRightAlignVisible.triggered.connect(this, "toggleRightAlignVisible(Boolean)");
buttonLayout.addWidget(newSeparator());
hlineAction = buttonLayout.addWidget(hlineButton);
buttonLayout.toggleHLineVisible.triggered.connect(this, "toggleHLineVisible(Boolean)");
indentAction = buttonLayout.addWidget(indentButton);
buttonLayout.toggleIndentVisible.triggered.connect(this, "toggleIndentVisible(Boolean)");
outdentAction = buttonLayout.addWidget(outdentButton);
buttonLayout.toggleOutdentVisible.triggered.connect(this, "toggleOutdentVisible(Boolean)");
bulletListAction = buttonLayout.addWidget(bulletListButton);
buttonLayout.toggleBulletListVisible.triggered.connect(this, "toggleBulletListVisible(Boolean)");
numberListAction = buttonLayout.addWidget(numberListButton);
buttonLayout.toggleNumberListVisible.triggered.connect(this, "toggleNumberListVisible(Boolean)");
// Setup the font & font size combo boxes
buttonLayout.addWidget(newSeparator());
fontList = new QComboBox();
fontSize = new QComboBox();
fontList.setToolTip("Font");
fontSize.setToolTip("Font Size");
fontList.activated.connect(this, "fontChanged(String)");
fontSize.activated.connect(this, "fontSizeChanged(String)");
fontListAction = buttonLayout.addWidget(fontList);
buttonLayout.toggleFontVisible.triggered.connect(this, "toggleFontListVisible(Boolean)");
fontSizeAction = buttonLayout.addWidget(fontSize);
buttonLayout.toggleFontSizeVisible.triggered.connect(this, "toggleFontSizeVisible(Boolean)");
QFontDatabase fonts = new QFontDatabase();
List<String> fontFamilies = fonts.families();
for (int i = 0; i < fontFamilies.size(); i++) {
fontList.addItem(fontFamilies.get(i));
if (i == 0) {
loadFontSize(fontFamilies.get(i));
}
}
// buttonLayout.addWidget(newSeparator(), 0);
fontColor = newToolButton("fontColor", tr("Font Color"));
fontColorMenu = new ColorMenu(this);
fontColor.setMenu(fontColorMenu.getMenu());
fontColor.setPopupMode(ToolButtonPopupMode.MenuButtonPopup);
fontColor.setAutoRaise(false);
fontColorMenu.getMenu().triggered.connect(this, "fontColorClicked()");
fontColorAction = buttonLayout.addWidget(fontColor);
buttonLayout.toggleFontColorVisible.triggered.connect(this, "toggleFontColorVisible(Boolean)");
fontHilight = newToolButton("fontHilight", tr("Font Hilight Color"));
fontHilight.setPopupMode(ToolButtonPopupMode.MenuButtonPopup);
fontHilight.setAutoRaise(false);
fontHilightColorMenu = new ColorMenu(this);
fontHilightColorMenu.setDefault(QColor.yellow);
fontHilight.setMenu(fontHilightColorMenu.getMenu());
fontHilightColorMenu.getMenu().triggered.connect(this, "fontHilightClicked()");
fontHilightAction = buttonLayout.addWidget(fontHilight);
fontHilightColorMenu.setDefault(QColor.yellow);
buttonLayout.toggleFontHilight.triggered.connect(this, "toggleFontHilightVisible(Boolean)");
spellCheckAction = buttonLayout.addWidget(spellCheckButton);
buttonLayout.toggleNumberListVisible.triggered.connect(this, "spellCheckClicked()");
buttonLayout.toggleSpellCheck.triggered.connect(this, "toggleSpellCheckVisible(Boolean)");
todoAction = buttonLayout.addWidget(todoButton);
buttonLayout.toggleNumberListVisible.triggered.connect(this, "todoClicked()");
buttonLayout.toggleTodo.triggered.connect(this, "toggleTodoVisible(Boolean)");
// Setup the source browser);
// buttonLayout.addWidget(new QLabel(), 1);
QSplitter editSplitter = new QSplitter(this);
editSplitter.addWidget(browser);
editSplitter.setOrientation(Qt.Orientation.Vertical);
editSplitter.addWidget(sourceEdit);
// v.addWidget(browser, 1);
// v.addWidget(sourceEdit);
v.addWidget(editSplitter);
setLayout(v);
browser.downloadAttachmentRequested.connect(this,
"downloadAttachment(QNetworkRequest)");
browser.downloadImageRequested.connect(this,