Version: 0.11.1 (using KDE KDE 3.5.2) Installed from: SuSE RPMs I have attached 1 screenshot. Below is the text that was in the channel at the time.. this was saved using the right->click -> Save As option in kopete. As you can see, the display is incorrect. Tx.
Created attachment 16206 [details] Screenshot of bug Herewith the screenshot of the relevant display bug.
Hm. Looks like richtext. To be sure: Could you try to disable rtf by unchecking the green pencil button in the main toolbar?
Yes, can you attach the html of it. try also kopete 0.12. Can you tell us how to reproduce?
Is probably fixed in kopete 0.12
Created attachment 16725 [details] Updated screenshot Screenshot
Created attachment 16726 [details] HTML Dump The HTML dump from the chatroom.
Attached HTML dump and screenshot for bug. Please test on your side. Look for the text in the html file where the time is the same as that on the screenshot when the error occurs.
SVN commit 553398 by ogoffart: Remove the addNickLinks function, it was completelly wrong and bugged (i don't want to insult his author of course) add the link at the source instead. BUG: 127780 BUG: 127016 M +22 -48 chatmessagepart.cpp M +1 -3 chatmessagepart.h --- branches/kopete/0.12/kopete/kopete/chatwindow/chatmessagepart.cpp #553397:553398 @@ -34,6 +34,7 @@ #include <qregexp.h> #include <qvaluelist.h> #include <qtimer.h> +#include <qstylesheet.h> // KHTML::DOM includes #include <dom/dom_doc.h> @@ -547,40 +548,6 @@ #endif } -const QString ChatMessagePart::addNickLinks( const QString &html ) const -{ - QString retVal = html; - - Kopete::ContactPtrList members = d->manager->members(); - for ( QPtrListIterator<Kopete::Contact> it( members ); it.current(); ++it ) - { - QString nick = (*it)->property( Kopete::Global::Properties::self()->nickName().key() ).value().toString(); - //FIXME: this is really slow in channels with lots of contacts - QString parsed_nick = Kopete::Emoticons::parseEmoticons( nick ); - - if ( nick != parsed_nick ) - { - retVal.replace( QRegExp( QString::fromLatin1("([\\s&;>])%1([\\s&;<:])") - .arg( QRegExp::escape( parsed_nick ) ) ), QString::fromLatin1("\\1%1\\2").arg( nick ) ); - } - if ( nick.length() > 0 && ( retVal.find( nick ) > -1 ) && d->manager->protocol() ) - { - retVal.replace( - QRegExp( QString::fromLatin1("([\\s&;>])(%1)([\\s&;<:])") - .arg( QRegExp::escape( nick ) ) ), - QString::fromLatin1("\\1<a href=\"kopetemessage://%1/?protocolId=%2&accountId=%3\" class=\"KopeteDisplayName\">\\2</a>\\3") - .arg( (*it)->contactId(), d->manager->protocol()->pluginId(), d->manager->account()->accountId() ) - ); - } - } -#if 0 //disabled because it causes crash on exit - Olivier 2006-03-31 - QString nick = d->manager->myself()->property( Kopete::Global::Properties::self()->nickName().key() ).value().toString(); - retVal.replace( QRegExp( QString::fromLatin1("([\\s&;>])%1([\\s&;<:])") - .arg( QRegExp::escape( Kopete::Emoticons::parseEmoticons( nick ) ) ) ), QString::fromLatin1("\\1%1\\2").arg( nick ) ); -#endif - return retVal; -} - void ChatMessagePart::slotRefreshView() { DOM::HTMLElement kopeteNode = document().getElementById( QString::fromUtf8("KopeteStyle") ); @@ -954,10 +921,11 @@ } // Style formatting for messages(incoming, outgoing, status) -QString ChatMessagePart::formatStyleKeywords( const QString &sourceHTML, Kopete::Message &message ) +QString ChatMessagePart::formatStyleKeywords( const QString &sourceHTML, const Kopete::Message &_message ) { + Kopete::Message message=_message; //we will eventually need to modify it before showing it. QString resultHTML = sourceHTML; - QString nick, contactId, service, protocolIcon; + QString nick, contactId, service, protocolIcon, nickLink; if( message.from() ) { @@ -988,18 +956,28 @@ } protocolIcon = KGlobal::iconLoader()->iconPath( iconName, KIcon::Small ); + + nickLink=QString::fromLatin1("<a href=\"kopetemessage://%1/?protocolId=%2&accountId=%3\" class=\"KopeteDisplayName\">") + .arg( QStyleSheet::escape(message.from()->contactId()).replace('"',"""), + QStyleSheet::escape(message.from()->protocol()->pluginId()).replace('"',"""), + QStyleSheet::escape(message.from()->account()->accountId() ).replace('"',""")); } + else + { + nickLink="<a>"; + } + // Replace sender (contact nick) - resultHTML = resultHTML.replace( QString::fromUtf8("%sender%"), nick ); + resultHTML = resultHTML.replace( QString::fromUtf8("%sender%"), nickLink+nick+"</a>" ); // Replace time, by default display only time and display seconds(that was true means). resultHTML = resultHTML.replace( QString::fromUtf8("%time%"), KGlobal::locale()->formatTime(message.timestamp().time(), true) ); // Replace %screenName% (contact ID) - resultHTML = resultHTML.replace( QString::fromUtf8("%senderScreenName%"), contactId ); + resultHTML = resultHTML.replace( QString::fromUtf8("%senderScreenName%"), nickLink+QStyleSheet::escape(contactId)+"</a>" ); // Replace service name (protocol name) - resultHTML = resultHTML.replace( QString::fromUtf8("%service%"), service ); + resultHTML = resultHTML.replace( QString::fromUtf8("%service%"), QStyleSheet::escape(service) ); // Replace protocolIcon (sender statusIcon) - resultHTML = resultHTML.replace( QString::fromUtf8("%senderStatusIcon%"), protocolIcon ); + resultHTML = resultHTML.replace( QString::fromUtf8("%senderStatusIcon%"), QStyleSheet::escape(protocolIcon).replace('"',""") ); // Look for %time{X}% QRegExp timeRegExp("%time\\{([^}]*)\\}%"); @@ -1062,13 +1040,9 @@ { kdDebug(14000) << k_funcinfo << "Map Action message to Status template. " << endl; - QString boldNick = QString::fromUtf8("<b>%1</b> ").arg(nick); - // Don't set the body twice. - if( !message.parsedBody().contains(boldNick) ) - { - QString newBody = boldNick + message.parsedBody(); - message.setBody(newBody, Kopete::Message::ParsedHTML ); - } + QString boldNick = QString::fromUtf8("%1<b>%2</b></a> ").arg(nickLink,nick); + QString newBody = boldNick + message.parsedBody(); + message.setBody(newBody, Kopete::Message::ParsedHTML ); } // Set message direction("rtl"(Right-To-Left) or "ltr"(Left-to-right)) @@ -1109,7 +1083,7 @@ resultHTML = resultHTML.replace( QString::fromUtf8("%message%"), formatMessageBody(message) ); // TODO: %status - resultHTML = addNickLinks( resultHTML ); +// resultHTML = addNickLinks( resultHTML ); return resultHTML; } --- branches/kopete/0.12/kopete/kopete/chatwindow/chatmessagepart.h #553397:553398 @@ -171,8 +171,6 @@ const QString styleHTML() const; - const QString addNickLinks( const QString &html ) const; - Kopete::Contact *contactFromNode( const DOM::Node &n ) const; /** @@ -194,7 +192,7 @@ * * @return the resulting HTML with replaced keywords. */ - QString formatStyleKeywords( const QString &sourceHTML, Kopete::Message &message ); + QString formatStyleKeywords( const QString &sourceHTML, const Kopete::Message &message ); /** * Format(replace) style keywords for header and footers. * For messages, use formatStyleKeywords(const QString &sourceHTML, Kopete::Message &message) instead.
*** Bug 129486 has been marked as a duplicate of this bug. ***