gui: do not show the quote section of context menu in chat if

no text selected
This commit is contained in:
chelovechishko 2018-07-04 23:18:21 +09:00
parent b3fb7abf99
commit 74075fdded

View File

@ -1103,11 +1103,8 @@ void ChatWidget::contextMenuTextBrowser(QPoint point)
contextMnu->addSeparator();
contextMnu->addAction(ui->actionClearChatHistory);
if (ui->textBrowser->textCursor().selection().toPlainText().length())
contextMnu->addAction(ui->actionQuote);
if (ui->textBrowser->textCursor().selection().toPlainText().length() == 0)
ui->actionQuote->setEnabled(false);
else
ui->actionQuote->setEnabled(true);
contextMnu->addAction(ui->actionDropPlacemark);
if(ui->textBrowser->checkImage(point))
@ -1829,14 +1826,11 @@ bool ChatWidget::setStyle()
void ChatWidget::quote()
{
QString text = ui->textBrowser->textCursor().selection().toPlainText();
if(text.length() > 0)
{
QStringList sl = text.split(QRegExp("[\r\n]"), QString::SkipEmptyParts);
text = sl.join("\n> ");
text.replace(QChar(-4), " "); // Char used when image on text.
emit ui->chatTextEdit->append(QString("> ") + text);
}
}
void ChatWidget::dropPlacemark()
{