CVS commit by ogoffart: RangeImpl::toHTML is implemented in KDE CVS, no need to work around anymore M +14 -11 chatmessagepart.cpp 1.11 --- kdenetwork/kopete/kopete/chatwindow/chatmessagepart.cpp #1.10:1.11 @@ -2,9 +2,9 @@ chatmessagepart.cpp - Chat Message KPart - Copyright (c) 2002-2004 by Olivier Goffart + Copyright (c) 2002-2005 by Olivier Goffart Copyright (c) 2002-2003 by Martijn Klingens Copyright (c) 2004 by Richard Smith - Kopete (c) 2002-2004 by the Kopete developers + Kopete (c) 2002-2005 by the Kopete developers ************************************************************************* @@ -59,4 +59,5 @@ #define TRANSFORM_ALL_MESSAGES +#if !(KDE_IS_VERSION(3,3,90)) //From kdelibs/khtml/misc/htmltags.h // used in ChatMessagePart::copy() @@ -84,4 +85,5 @@ #define ID_TT 97 #define ID_UL 99 +#endif @@ -616,14 +618,14 @@ void ChatMessagePart::copy() * The objective of this function is to keep the text of emoticons (of or latex image) when copying. * see Bug 61676 - * It could be done in a single line if RangeImpl::toHTML was implemented (see the #if 0 bellow) - * But since it doesn't work, i have to handle it myself with KHTML some internals. - * I copied a big part of the code bellow from KHTMLPart::selectedText. only a bit modified to add the img's title + * RangeImpl::toHTML was not implemented before KDE 3.4 */ QString text; - #if 0 //This doesn't work because RangeImpl::toHTML is not yet implemented - text=Kopete::Message::unescape( selection().toHTML().string() ); - #endif +#if KDE_IS_VERSION(3,3,90) + text=Kopete::Message::unescape( selection().toHTML().string() ).stripWhiteSpace(); + // Message::unsescape will replace image by his title attribute + // stripWhiteSpace is for removing the newline added by the and other xml things of RangeImpl::toHTML +#else DOM::Node startNode, endNode; @@ -734,4 +736,5 @@ void ChatMessagePart::copy() //END: copied from KHTMLPart::selectedText +#endif QApplication::clipboard()->setText( text, QClipboard::Clipboard );