[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    branches/KDE/4.1/kdenetwork/kopete/libkopete
From:       Roman Jarosz <kedgedev () centrum ! cz>
Date:       2009-01-31 23:57:56
Message-ID: 1233446276.352578.8078.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 919437 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.1/kdenetwork/kopete/libkopete/kopetemessage.cpp #919436:919437
@@ -195,8 +195,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
@@ -309,7 +313,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.1/kdenetwork/kopete/libkopete/kopetemessage.h #919436:919437
@@ -447,7 +447,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
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic