Summary: | TabsEngine should add pre-html-tag when displaying tabs from ultimate-guitar.com | ||
---|---|---|---|
Product: | [Applications] amarok | Reporter: | Martin <ich> |
Component: | Context View/Tabs | Assignee: | Amarok Developers <amarok-bugs-dist> |
Status: | RESOLVED FIXED | ||
Severity: | minor | CC: | rainer.sigle |
Priority: | NOR | ||
Version: | 2.4-GIT | ||
Target Milestone: | 2.4.1 | ||
Platform: | Compiled Sources | ||
OS: | Linux | ||
Latest Commit: | Version Fixed In: | 2.4.1 | |
Sentry Crash Report: | |||
Attachments: | Adds the <pre> tag. |
Description
Martin
2011-02-12 23:23:50 UTC
Created attachment 57196 [details]
Adds the <pre> tag.
Thank you for the patch. Please submit it to http://git.reviewboard.kde.org, you need to get an identity at http://identity.kde.org first. commit 43c3d86dd856a43aa82d567c365c0c4610989673 Author: Rainer Sigle <rainer.sigle@web.de> Date: Sat Feb 19 13:25:28 2011 +0100 Do not remove HTML <pre> and </pre>-tags from tabs-data. Fix for bug 266171. Thanks to Martin Kunkel for pointing this out! diff --git a/src/context/engines/tabs/TabsEngine.cpp b/src/context/engines/tabs/TabsEngine.cpp index 7c893c6..24507c0 100644 --- a/src/context/engines/tabs/TabsEngine.cpp +++ b/src/context/engines/tabs/TabsEngine.cpp @@ -326,8 +326,12 @@ TabsEngine::resultUltimateGuitarTab( const KUrl &url, QByteArray data, NetworkAc else result = QString( data ); + // extract tab title and data const QString title = subStringBetween( result, "<strong>", "</strong>"); - QString tabs = subStringBetween( result, "<pre>", "</pre>" ); + QRegExp regex = QRegExp( "<pre>.*</pre>", Qt::CaseInsensitive ); + if( regex.indexIn( result ) == -1 ) + return; + QString tabs = regex.cap(); tabs.remove( "<span>", Qt::CaseInsensitive ); tabs.remove( "</span>", Qt::CaseInsensitive ); @@ -441,8 +445,12 @@ TabsEngine::resultFretplayTab( const KUrl &url, QByteArray data, NetworkAccessMa else result = QString( data ); + // extract tab title and data QString title = subStringBetween( result, "title\" content=\"", ". Accurate and free" ); - QString tabs = subStringBetween( result, "<pre>", "</pre>" ); + QRegExp regex = QRegExp( "<pre>.*</pre>", Qt::CaseInsensitive ); + if( regex.indexIn( result ) == -1 ) + return; + QString tabs = regex.cap(); tabs.remove( "<span>", Qt::CaseInsensitive ); tabs.remove( "</span>", Qt::CaseInsensitive ); Rainer, to close bugs automatically, please add a new line below your git comment that says BUG: 266171 else we have to close it manually. |