summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrea Diamantini <adjam7@gmail.com>2010-02-24 11:18:23 +0100
committerAndrea Diamantini <adjam7@gmail.com>2010-02-24 11:18:23 +0100
commit05fab24ea7ee71fa286dbe6ca5ea08dcbbb68e6d (patch)
tree6edf28afbd6f9045c2a9751b727702a27e4fea4d
parentFixes 217521 bug and let us save also some memory (diff)
parentremove duplicate links (diff)
downloadrekonq-05fab24ea7ee71fa286dbe6ca5ea08dcbbb68e6d.tar.xz
Merge commit 'refs/merge-requests/94' of git://gitorious.org/rekonq/mainline into m94
-rw-r--r--src/tests/link_test.html7
-rw-r--r--src/webpage.cpp12
2 files changed, 15 insertions, 4 deletions
diff --git a/src/tests/link_test.html b/src/tests/link_test.html
index 7dd1470d..5ca3cd41 100644
--- a/src/tests/link_test.html
+++ b/src/tests/link_test.html
@@ -135,6 +135,13 @@
<td><a href="http://ads.cnn.com/" target="_blank">link</a></td>
</tr>
+
+<tr>
+<td>http://ja.wikipedia.org/wiki/特別:最近の更新</td>
+<td>KGet import links with particular encoding</td>
+<td><a href="http://ja.wikipedia.org/wiki/特別:最近の更新">link</a></td>
+</tr>
+
<tr>
<td></td>
<td></td>
diff --git a/src/webpage.cpp b/src/webpage.cpp
index 9abc1a0b..3143f296 100644
--- a/src/webpage.cpp
+++ b/src/webpage.cpp
@@ -336,18 +336,22 @@ void WebPage::downloadRequest(const QNetworkRequest &request)
void WebPage::downloadAllContentsWithKGet()
{
- QList<QString> contentList;
+ QSet<QString> contents;
+ KUrl baseUrl(m_requestedUrl);
+ KUrl relativeUrl;
QWebElementCollection images = mainFrame()->documentElement().findAll("img");
foreach(QWebElement img, images)
{
- contentList.append(img.attribute("src"));
+ relativeUrl.setEncodedUrl(img.attribute("src").toUtf8(),KUrl::TolerantMode);
+ contents << baseUrl.resolved(relativeUrl).toString();
}
QWebElementCollection links = mainFrame()->documentElement().findAll("a");
foreach(QWebElement link, links)
{
- contentList.append(link.attribute("href"));
+ relativeUrl.setEncodedUrl(link.attribute("href").toUtf8(),KUrl::TolerantMode);
+ contents << baseUrl.resolved(relativeUrl).toString();
}
if(!QDBusConnection::sessionBus().interface()->isServiceRegistered("org.kde.kget"))
@@ -355,5 +359,5 @@ void WebPage::downloadAllContentsWithKGet()
KToolInvocation::kdeinitExecWait("kget");
}
QDBusInterface kget("org.kde.kget", "/KGet", "org.kde.kget.main");
- kget.call("importLinks", QVariant(contentList));
+ kget.call("importLinks", QVariant(contents.toList()));
}