SVN commit 919436 by rjarosz: Backport commit 919432. Fixes bug when empty messages were shown in chat and history window. CCBUG: 177442 CCBUG: 182114 M +9 -2 kopetemessage.cpp M +1 -1 kopetemessage.h --- branches/KDE/4.2/kdenetwork/kopete/libkopete/kopetemessage.cpp #919435:919436 @@ -243,8 +243,12 @@ doSetBody (body, Qt::RichText); } -void Message::doSetBody (const QString &body, Qt::TextFormat f) +void Message::doSetBody (QString body, Qt::TextFormat f) { + // Remove ObjectReplacementCharacter because otherwise html text will be empty + if ( body.contains( QChar( QChar::ObjectReplacementCharacter ) ) ) + body.replace( QChar( QChar::ObjectReplacementCharacter ), QChar( ' ' ) ); + if (f == Qt::PlainText) d->body->setPlainText(body); else @@ -357,7 +361,10 @@ QString Message::plainBody() const { - return d->body->toPlainText(); + // Remove ObjectReplacementCharacter which can be there if html text contains img tag. + QString plainText = d->body->toPlainText(); + plainText.replace( QChar( QChar::ObjectReplacementCharacter ), QChar( ' ' ) ); + return plainText; } QString Message::escapedBody() const --- branches/KDE/4.2/kdenetwork/kopete/libkopete/kopetemessage.h #919435:919436 @@ -545,7 +545,7 @@ * Basically @ref setBody() without detach * @internal */ - void doSetBody( const QString &body, Qt::TextFormat format = Qt::PlainText ); + void doSetBody( QString body, Qt::TextFormat format = Qt::PlainText ); /** * Called internally by @ref setBody() and the constructor