Summary: | Insert tag from Files tree does not respect attribute quotation setting | ||
---|---|---|---|
Product: | [Unmaintained] quanta | Reporter: | Dennis Hansen <dennis> |
Component: | general | Assignee: | András Manţia <amantia> |
Status: | RESOLVED FIXED | ||
Severity: | normal | ||
Priority: | NOR | ||
Version: | unspecified | ||
Target Milestone: | --- | ||
Platform: | unspecified | ||
OS: | Linux | ||
Latest Commit: | Version Fixed In: | ||
Sentry Crash Report: | |||
Attachments: | quote-tag-attribute.patch |
Description
Dennis Hansen
2004-03-03 17:20:36 UTC
Attached is a patch that fixes this. Should be good untill someone complains about it not respecting the tag case - uppercase/lowercase :-) This patch take cares of the quote attribute for <a> and <img> tags they both had the same problem. Created an attachment (id=5003) quote-tag-attribute.patch I'm on my way to create a patch that takes care also of tag/attribute case. ;-) It's compiling right now here. Sounds good ! Next time I won't bug report before I got the fix made myself if I can - you're so quick :-) CVS commit by amantia: Use the correct quotation and case when inserting a link to a file from the treeviews [#76663] Don't you want to subscribe to our devel list? See https://mail.kde.org/mailman/listinfo/quanta-devel. CCMAIL: 76663-done@bugs.kde.org M +1 -0 ChangeLog 1.238 M +18 -4 src/quanta.cpp 1.437 M +8 -0 utility/quantacommon.cpp 1.80 M +3 -0 utility/quantacommon.h 1.64 --- kdewebdev/quanta/ChangeLog #1.237:1.238 @@ -44,4 +44,5 @@ - background parsing: allow user input while parsing [#63000 and its duplicates] - load DTEPs only on demand: improves startup performance, uses less memory + - use the correct quotation and case when inserting a link to a file from the treeviews [#76663] - behavioral changes: - new features: --- kdewebdev/quanta/src/quanta.cpp #1.436:1.437 @@ -762,7 +762,17 @@ void QuantaApp::slotInsertTag(const KURL { QString width,height; - width.setNum( img.width () ); - height.setNum( img.height() ); - w->insertTag("<img src=\""+urlStr+"\" width=\""+width+"\" height=\""+height+"\" border=\"0\">"); + width.setNum(img.width()); + height.setNum(img.height()); + QString imgTag = QuantaCommon::tagCase("<img "); + imgTag += QuantaCommon::attrCase("src="); + imgTag += QuantaCommon::quoteAttributeValue(urlStr); + imgTag += QuantaCommon::attrCase(" width="); + imgTag += QuantaCommon::quoteAttributeValue(width); + imgTag += QuantaCommon::attrCase(" height="); + imgTag += QuantaCommon::quoteAttributeValue(height); + imgTag += QuantaCommon::attrCase(" border="); + imgTag += QuantaCommon::quoteAttributeValue(QString("%1").arg(0)); + imgTag += ">"; + w->insertTag(imgTag); isImage = true; } @@ -770,5 +780,9 @@ void QuantaApp::slotInsertTag(const KURL if (!isImage) { - w->insertTag( "<a href=\""+urlStr+"\">","</a>"); + QString tag = QuantaCommon::tagCase("<a "); + tag += QuantaCommon::attrCase("href="); + tag += QuantaCommon::quoteAttributeValue(urlStr); + tag += ">"; + w->insertTag(tag, QuantaCommon::tagCase("</a>")); } } --- kdewebdev/quanta/utility/quantacommon.cpp #1.79:1.80 @@ -101,4 +101,12 @@ QString QuantaCommon::attrCase( const QS } +/** returns the attribute value in quoted form, by taking care of the +quotation setting*/ +QString QuantaCommon::quoteAttributeValue(const QString& value) +{ + QString quote = qConfig.attrValueQuotation; + return quote + value + quote; +} + /** Set's up the url correctly from urlString. */ void QuantaCommon::setUrl(KURL &url, const QString& urlString) --- kdewebdev/quanta/utility/quantacommon.h #1.63:1.64 @@ -127,4 +127,7 @@ public: /** convert tag to upper or lower case */ static QString attrCase( const QString& attr); +/** returns the attribute value in quoted form, by taking care of the +quotation setting*/ + static QString quoteAttributeValue(const QString& value); /** Set's up the url correctly from urlString. */ static void setUrl(KURL &url, const QString& urlString); |