Quote function on chat

select text --> right click --> Quote
This commit is contained in:
hunbernd 2015-12-06 21:43:55 +01:00
parent 0aa82c852b
commit 0b92c79eb0
3 changed files with 22 additions and 0 deletions

View File

@ -125,6 +125,7 @@ ChatWidget::ChatWidget(QWidget *parent) :
connect(ui->actionChooseFont, SIGNAL(triggered()), this, SLOT(chooseFont()));
connect(ui->actionChooseColor, SIGNAL(triggered()), this, SLOT(chooseColor()));
connect(ui->actionResetFont, SIGNAL(triggered()), this, SLOT(resetFont()));
connect(ui->actionQuote, SIGNAL(triggered()), this, SLOT(quote()));
connect(ui->hashBox, SIGNAL(fileHashingFinished(QList<HashedFile>)), this, SLOT(fileHashingFinished(QList<HashedFile>)));
@ -974,6 +975,7 @@ void ChatWidget::contextMenuTextBrowser(QPoint point)
contextMnu->addSeparator();
contextMnu->addAction(ui->actionClearChatHistory);
contextMnu->addAction(ui->actionQuote);
contextMnu->exec(ui->textBrowser->viewport()->mapToGlobal(point));
delete(contextMnu);
@ -1661,3 +1663,14 @@ bool ChatWidget::setStyle()
return false;
}
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>");
emit ui->chatTextEdit->append(QString(">") + text);
}
}

View File

@ -133,6 +133,7 @@ private slots:
void messageHistory();
void resetStatusBar() ;
void searchHistory();
void quote();
signals:

View File

@ -972,6 +972,14 @@ border-image: url(:/images/closepressed.png)
<string>Search Box</string>
</property>
</action>
<action name="actionQuote">
<property name="text">
<string>Quote</string>
</property>
<property name="toolTip">
<string>Quotes the selected text</string>
</property>
</action>
</widget>
<customwidgets>
<customwidget>