From kde-commits Sat Jan 31 23:40:43 2009 From: Roman Jarosz Date: Sat, 31 Jan 2009 23:40:43 +0000 To: kde-commits Subject: KDE/kdenetwork/kopete/libkopete Message-Id: <1233445243.547188.7306.nullmailer () svn ! kde ! org> X-MARC-Message: https://marc.info/?l=kde-commits&m=123344526714933 SVN commit 919432 by rjarosz: Remove ObjectReplacementCharacter character because if we call setHtml with it then the html will be empty. Fixes bug when empty messages were shown in chat and history window. BUG: 177442 CCBUG: 182114 M +9 -2 kopetemessage.cpp M +1 -1 kopetemessage.h --- trunk/KDE/kdenetwork/kopete/libkopete/kopetemessage.cpp #919431:919432 @@ -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 --- trunk/KDE/kdenetwork/kopete/libkopete/kopetemessage.h #919431:919432 @@ -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