summaryrefslogtreecommitdiff
path: root/src/webpage.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/webpage.cpp')
-rw-r--r--src/webpage.cpp14
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;
+}