diff options
Diffstat (limited to 'src/webpage.cpp')
-rw-r--r-- | src/webpage.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
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())); } |