1
0
mirror of https://github.com/qTox/qTox.git synced 2024-03-22 14:00:36 +08:00

copy/paste changed format (issue #11)

This commit is contained in:
krepa098 2015-02-11 16:37:02 +01:00
parent 5f31921cf4
commit 788d57c815

View File

@ -496,22 +496,16 @@ QString ChatLog::getSelectedText() const
// build a nicely formatted message
QString out;
QString lastSender;
for(int i=selFirstRow; i<=selLastRow; ++i)
{
if(lines[i]->content[1]->getText().isEmpty())
continue;
if(lastSender != lines[i]->content[0]->getText() && !lines[i]->content[0]->getText().isEmpty())
{
//author changed
QString timestamp = lines[i]->content[2]->getText().isEmpty() ? tr("pending") : lines[i]->content[2]->getText();
QString msg = lines[i]->content[0]->getText();
out += QString(out.isEmpty() ? "[%2] %1:\n" : "\n[%2] %1:\n").arg(msg, timestamp);
lastSender = lines[i]->content[0]->getText();
}
QString timestamp = lines[i]->content[2]->getText().isEmpty() ? tr("pending") : lines[i]->content[2]->getText();
QString author = lines[i]->content[0]->getText();
QString msg = lines[i]->content[1]->getText();
out += lines[i]->content[1]->getText();
out += QString(out.isEmpty() ? "[%2] %1:\n%3" : "\n[%2] %1:\n%3").arg(author, timestamp, msg);
if(i != selLastRow)
out += "\n";