UiSettings s("InputWidget");
-#ifdef HAVE_KDE4
- s.notify("EnableSpellCheck", this, SLOT(setEnableSpellCheck(QVariant)));
- setEnableSpellCheck(s.value("EnableSpellCheck", false));
-#endif
-
s.notify("EnableEmacsMode", this, SLOT(setEnableEmacsMode(QVariant)));
setEnableEmacsMode(s.value("EnableEmacsMode", false));
}
-void InputWidget::setEnableSpellCheck(const QVariant &v)
-{
- ui.inputEdit->setSpellCheckEnabled(v.toBool());
-}
-
-
void InputWidget::setEnableEmacsMode(const QVariant &v)
{
ui.inputEdit->setEmacsMode(v.toBool());
void InputWidget::onTextEntered(const QString &text)
{
Client::userInput(currentBufferInfo(), text);
- ui.boldButton->setChecked(false);
- ui.underlineButton->setChecked(false);
- ui.italicButton->setChecked(false);
+ // Remove formatting from entered text
+ // TODO: Offer a way to convert pasted text to mIRC formatting codes
setFormatClear(true);
}
void InputWidget::setFormatClear(const bool global)
{
+ // Apply formatting
QTextCharFormat fmt;
fmt.setFontWeight(QFont::Normal);
fmt.setFontUnderline(false);
} else {
setFormatOnSelection(fmt);
}
+
+ // Make sure UI state follows
+ ui.boldButton->setChecked(false);
+ ui.italicButton->setChecked(false);
+ ui.underlineButton->setChecked(false);
}
void InputWidget::setFormatBold(const bool bold)
{
+ // Apply formatting
QTextCharFormat fmt;
fmt.setFontWeight(bold ? QFont::Bold : QFont::Normal);
mergeFormatOnSelection(fmt);
+ // Make sure UI state follows
+ ui.boldButton->setChecked(bold);
}
void InputWidget::setFormatItalic(const bool italic)
{
+ // Apply formatting
QTextCharFormat fmt;
fmt.setFontItalic(italic);
mergeFormatOnSelection(fmt);
+ // Make sure UI state follows
+ ui.italicButton->setChecked(italic);
}
void InputWidget::setFormatUnderline(const bool underline)
{
+ // Apply formatting
QTextCharFormat fmt;
fmt.setFontUnderline(underline);
mergeFormatOnSelection(fmt);
+ // Make sure UI state follows
+ ui.underlineButton->setChecked(underline);
}