Remove Qt 4.7 compatibility code from CurrentUrl

This commit is contained in:
Matthew Horan 2012-11-22 01:38:29 -05:00
parent 2ceab4e525
commit c3eb16b87e
3 changed files with 0 additions and 22 deletions

View File

@ -6,24 +6,9 @@ CurrentUrl::CurrentUrl(WebPageManager *manager, QStringList &arguments, QObject
}
void CurrentUrl::start() {
#if QT_VERSION >= QT_VERSION_CHECK(4, 8, 0)
QStringList arguments;
QVariant result = page()->invokeCapybaraFunction("currentUrl", arguments);
QString url = result.toString();
emit finished(new Response(true, url));
#else
QUrl humanUrl = wasRedirectedAndNotModifiedByJavascript() ?
page()->currentFrame()->url() : page()->currentFrame()->requestedUrl();
QByteArray encodedBytes = humanUrl.toEncoded();
emit finished(new Response(true, encodedBytes));
}
bool CurrentUrl::wasRegularLoad() {
return page()->currentFrame()->url() == page()->currentFrame()->requestedUrl();
}
bool CurrentUrl::wasRedirectedAndNotModifiedByJavascript() {
return !wasRegularLoad() && page()->currentFrame()->url() == page()->history()->currentItem().url();
#endif
}

View File

@ -6,11 +6,5 @@ class CurrentUrl : public SocketCommand {
public:
CurrentUrl(WebPageManager *, QStringList &arguments, QObject *parent = 0);
virtual void start();
#if QT_VERSION < QT_VERSION_CHECK(4, 8, 0)
private:
bool wasRegularLoad();
bool wasRedirectedAndNotModifiedByJavascript();
#endif
};

View File

@ -34,7 +34,6 @@ WebPage::WebPage(WebPageManager *manager, QObject *parent) : QWebPage(parent) {
resetWindowSize();
settings()->setAttribute(QWebSettings::JavascriptCanOpenWindows, true);
currentFrame()->setUrl(QUrl("about:blank"));
}
void WebPage::resetWindowSize() {