[aKregator-devel] [Bug 84095] akregator article view doesn't display <pre> passages correctly
Brought to you by:
lippel
From: Stanislav K. <be...@up...> - 2004-07-17 15:23:18
|
------- You are receiving this mail because: ------- You are on the CC list for the bug, or are watching someone who is. http://bugs.kde.org/show_bug.cgi?id=84095 berk upnet ru changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |FIXED ------- Additional Comments From berk upnet ru 2004-07-17 17:23 ------- CVS commit by karchebny: * Fix formatting of <pre> contents. CCMAIL: 84095-done bugs kde org M +18 -3 loader.cpp 1.7 --- kdenonbeta/akregator/src/librss/loader.cpp #1.6:1.7 @ -258,4 +258,6 @ const KURL &Loader::discoveredFeedURL() } +#include <kdebug.h> + void Loader::slotRetrieverDone(const QByteArray &data, bool success) { @ -284,6 +286,20 @ void Loader::slotRetrieverDone(const QBy } - QByteArray tmpData; - tmpData.setRawData(charData, len); + QCString tmpData(charData, len); + + // hack: support formatting inside <pre> tags + QRegExp pres("<pre>(.+)</pre>", false); + pres.setMinimal(TRUE); + int pos = 0; + while( (pos = pres.search(tmpData, pos)) != -1 ) + { + int len = pres.matchedLength(); + + QCString str = tmpData.mid(pos, len); + str.replace("\n", "<br/>"); + + tmpData.replace(pos, len, str); + pos += len; + } if (doc.setContent(tmpData)) @ -302,5 +318,4 @ void Loader::slotRetrieverDone(const QBy } - tmpData.resetRawData(charData, len); } else status = RetrieveError; |