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