s.notify("ShowStyleButtons", this, SLOT(setShowStyleButtons(QVariant)));
setShowStyleButtons(s.value("ShowStyleButtons", true));
+ s.notify("EnablePerChatHistory", this, SLOT(setEnablePerChatHistory(QVariant)));
+ setEnablePerChatHistory(s.value("EnablePerChatHistory", true));
+
s.notify("MaxNumLines", this, SLOT(setMaxLines(QVariant)));
setMaxLines(s.value("MaxNumLines", 5));
ui.showStyleButton->setVisible(v.toBool());
}
+void InputWidget::setEnablePerChatHistory(const QVariant &v) {
+ _perChatHistory = v.toBool();
+}
+
void InputWidget::setMaxLines(const QVariant &v) {
ui.inputEdit->setMaxHeight(v.toInt());
}
}
void InputWidget::currentChanged(const QModelIndex ¤t, const QModelIndex &previous) {
- Q_UNUSED(previous)
+ BufferId currentBufferId = current.data(NetworkModel::BufferIdRole).value<BufferId>();
+ BufferId previousBufferId = previous.data(NetworkModel::BufferIdRole).value<BufferId>();
+
+ if (_perChatHistory) {
+ //backup
+ historyMap[previousBufferId].history = inputLine()->history();
+ historyMap[previousBufferId].tempHistory = inputLine()->tempHistory();
+ historyMap[previousBufferId].idx = inputLine()->idx();
+ historyMap[previousBufferId].inputLine = inputLine()->html();
+
+ //restore
+ inputLine()->setHistory(historyMap[currentBufferId].history);
+ inputLine()->setTempHistory(historyMap[currentBufferId].tempHistory);
+ inputLine()->setIdx(historyMap[currentBufferId].idx);
+ inputLine()->setHtml(historyMap[currentBufferId].inputLine);
+ inputLine()->moveCursor(QTextCursor::End,QTextCursor::MoveAnchor);
+ }
+
NetworkId networkId = current.data(NetworkModel::NetworkIdRole).value<NetworkId>();
if(networkId == _networkId)
return;
Client::userInput(BufferInfo::fakeStatusBuffer(net->networkId()), QString("/NICK %1").arg(newNick));
}
-void InputWidget::on_inputEdit_textEntered(const QString &text) const {
+void InputWidget::on_inputEdit_textEntered(const QString &text) {
Client::userInput(currentBufferInfo(), text);
ui.boldButton->setChecked(false);
ui.underlineButton->setChecked(false);
fmt.clearForeground();
fmt.clearBackground();
inputLine()->setCurrentCharFormat(fmt);
+
+#ifdef HAVE_KDE
+ // Set highlighter back to active in case it was deactivated by too many errors.
+ if(ui.inputEdit->highlighter())
+ ui.inputEdit->highlighter()->setActive(true);
+#endif
}
void InputWidget::mergeFormatOnSelection(const QTextCharFormat &format) {