diff options
author | Andrea Diamantini <adjam7@gmail.com> | 2009-10-29 02:49:44 +0100 |
---|---|---|
committer | Andrea Diamantini <adjam7@gmail.com> | 2009-10-29 02:49:44 +0100 |
commit | 448a306b7db866a8aa2fa6e81fc2c3f37392d490 (patch) | |
tree | 5ef56685e4dd30d08a9e03eb9b5bef0928bc6750 /src/webpage.cpp | |
parent | icefox hints on webpage usage.. :D (diff) | |
download | rekonq-448a306b7db866a8aa2fa6e81fc2c3f37392d490.tar.xz |
imported userAgentFromUrl method from KWebKit
Diffstat (limited to 'src/webpage.cpp')
-rw-r--r-- | src/webpage.cpp | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/webpage.cpp b/src/webpage.cpp index b8662f14..01e98dfd 100644 --- a/src/webpage.cpp +++ b/src/webpage.cpp @@ -49,12 +49,12 @@ #include <KUrl> #include <KDebug> #include <KToolInvocation> +#include <KProtocolManager> #include <KDE/KParts/BrowserRun> #include <KDE/KMimeTypeTrader> #include <KDE/KRun> #include <KDE/KFileDialog> -#include <KDE/KInputDialog> #include <KDE/KMessageBox> #include <KDE/KJobUiDelegate> @@ -275,3 +275,15 @@ void WebPage::slotDownloadRequested(const QNetworkRequest &request) job->addMetaData("cache", "cache"); // Use entry from cache if available. job->uiDelegate()->setAutoErrorHandlingEnabled(true); } + + +QString WebPage::userAgentForUrl(const QUrl& _url) const +{ + const KUrl url(_url); + QString userAgent = KProtocolManager::userAgentForHost((url.isLocalFile() ? "localhost" : url.host())); + + if (userAgent == KProtocolManager::defaultUserAgent()) + return QWebPage::userAgentForUrl(_url); + + return userAgent; +} |