mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-25 07:29:33 -05:00
Merge pull request #1889 from PhenomRetroShare/Add_DateAndNameInCopyFromHistory
Add Date and Name in copied text from Chat History Browser.
This commit is contained in:
commit
0a2f2a1466
@ -418,16 +418,23 @@ void ImHistoryBrowser::customContextMenuRequested(QPoint /*pos*/)
|
|||||||
|
|
||||||
void ImHistoryBrowser::copyMessage()
|
void ImHistoryBrowser::copyMessage()
|
||||||
{
|
{
|
||||||
QListWidgetItem *currentItem = ui.listWidget->currentItem();
|
QListWidgetItem *currentItem = ui.listWidget->currentItem();
|
||||||
if (currentItem) {
|
if (currentItem) {
|
||||||
uint32_t msgId = currentItem->data(ROLE_MSGID).toString().toInt();
|
uint32_t msgId = currentItem->data(ROLE_MSGID).toString().toInt();
|
||||||
HistoryMsg msg;
|
HistoryMsg msg;
|
||||||
if (rsHistory->getMessage(msgId, msg)) {
|
if (rsHistory->getMessage(msgId, msg)) {
|
||||||
QTextDocument doc;
|
RsIdentityDetails details;
|
||||||
doc.setHtml(QString::fromUtf8(msg.message.c_str()));
|
QString name = (rsIdentity->getIdDetails(RsGxsId(msg.peerName), details))
|
||||||
QApplication::clipboard()->setText(doc.toPlainText());
|
? QString::fromUtf8(details.mNickname.c_str())
|
||||||
}
|
: QString::fromUtf8(msg.peerName.c_str());
|
||||||
}
|
QDateTime date = msg.incoming
|
||||||
|
? QDateTime::fromTime_t(msg.sendTime)
|
||||||
|
: QDateTime::fromTime_t(msg.recvTime);
|
||||||
|
QTextDocument doc;
|
||||||
|
doc.setHtml(QString::fromUtf8(msg.message.c_str()));
|
||||||
|
QApplication::clipboard()->setText("> " + date.toString() + " " + name + ":" + doc.toPlainText());
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ImHistoryBrowser::removeMessages()
|
void ImHistoryBrowser::removeMessages()
|
||||||
|
Loading…
Reference in New Issue
Block a user