[SCM] ktp-text-ui packaging branch, master, updated. debian/15.12.1-1-1918-gdf4b0ec
Maximiliano Curia
maxy at moszumanska.debian.org
Sat May 28 00:22:01 UTC 2016
Gitweb-URL: http://git.debian.org/?p=pkg-kde/applications/ktp-text-ui.git;a=commitdiff;h=4a60297
The following commit has been merged in the master branch:
commit 4a60297135b60d5ff9c350ee4ab430f4caf442af
Author: Lasath Fernando <kde at lasath.org>
Date: Sat Jun 23 14:55:31 2012 +1000
Make embedded image clickable
Sticks the img in an <a> tag. Ironically, this happened
so the alt text can be useful.
---
filters/images/images-filter.cpp | 13 ++++++++-----
tests/message-processor-basic-tests.cpp | 14 +++++++++++---
2 files changed, 19 insertions(+), 8 deletions(-)
diff --git a/filters/images/images-filter.cpp b/filters/images/images-filter.cpp
index 442bbab..4da7912 100644
--- a/filters/images/images-filter.cpp
+++ b/filters/images/images-filter.cpp
@@ -36,7 +36,7 @@ ImagesFilter::ImagesFilter (QObject* parent, const QVariantList&) :
{
QString imagePattern = QLatin1String("\.(?:");
Q_FOREACH (const QByteArray &format, QImageReader::supportedImageFormats()) {
- imagePattern += QString::fromAscii(format) + QLatin1String("|");
+ imagePattern = imagePattern % QString::fromAscii(format) % QLatin1String("|");
}
imagePattern.chop(1);
imagePattern += QLatin1String(")$");
@@ -47,15 +47,18 @@ ImagesFilter::ImagesFilter (QObject* parent, const QVariantList&) :
void ImagesFilter::filterMessage (Message& message)
{
kDebug() << message.property("Urls").toList().size();
- Q_FOREACH (QVariant var, message.property("Urls").toList()) {
+ Q_FOREACH (const QVariant var, message.property("Urls").toList()) {
KUrl url = qvariant_cast<KUrl>(var);
QString fileName = url.fileName();
if (!fileName.isNull() && fileName.contains(d->imageRegex)) {
+ QString href = QString::fromAscii(url.toEncoded());
message.appendMessagePart(
- QLatin1String("<img src='") %
- QString::fromAscii(url.toEncoded()) %
- QLatin1String("' style='max-width:100%;' alt='Link is of an Image' />")
+ QLatin1Literal("<a href='") % href % QLatin1Literal("'>") %
+ QLatin1Literal("<img src='") %
+ href %
+ QLatin1Literal("' style='max-width:100%;' alt='Click to view in browser' />") %
+ QLatin1Literal("</a>")
);
}
}
diff --git a/tests/message-processor-basic-tests.cpp b/tests/message-processor-basic-tests.cpp
index 4670649..bbd6c83 100644
--- a/tests/message-processor-basic-tests.cpp
+++ b/tests/message-processor-basic-tests.cpp
@@ -144,9 +144,17 @@ void MessageProcessorBasicTests::testStrikethrough()
void MessageProcessorBasicTests::testImageEmbedGIF()
{
const char* message = "http://kde.org/images/teaser/jointhegame.gif";
- QString imgTag = QLatin1String("<img src='http://kde.org/images/teaser/jointhegame.gif' style='max-width:100%;' alt='Link is of an Image' />");
-
- QVERIFY(s.getProcessedMessage(message).contains(imgTag));
+ const char* imgTag =
+ "<a href='http://kde.org/images/teaser/jointhegame.gif'>"
+ "http://kde.org/images/teaser/jointhegame.gif"
+ "</a>
"
+ "<a href='http://kde.org/images/teaser/jointhegame.gif'>"
+ "<img src='http://kde.org/images/teaser/jointhegame.gif'"
+ " style='max-width:100%;'"
+ " alt='Click to view in browser' />"
+ "</a>";
+
+ compare(message, imgTag);
}
QTEST_MAIN(MessageProcessorBasicTests);
--
ktp-text-ui packaging
More information about the pkg-kde-commits
mailing list