Remove Qt 4.7 compatibility code from CurrentUrl
This commit is contained in:
parent
2ceab4e525
commit
c3eb16b87e
|
@ -6,24 +6,9 @@ CurrentUrl::CurrentUrl(WebPageManager *manager, QStringList &arguments, QObject
|
||||||
}
|
}
|
||||||
|
|
||||||
void CurrentUrl::start() {
|
void CurrentUrl::start() {
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(4, 8, 0)
|
|
||||||
QStringList arguments;
|
QStringList arguments;
|
||||||
QVariant result = page()->invokeCapybaraFunction("currentUrl", arguments);
|
QVariant result = page()->invokeCapybaraFunction("currentUrl", arguments);
|
||||||
QString url = result.toString();
|
QString url = result.toString();
|
||||||
emit finished(new Response(true, url));
|
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
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,11 +6,5 @@ class CurrentUrl : public SocketCommand {
|
||||||
public:
|
public:
|
||||||
CurrentUrl(WebPageManager *, QStringList &arguments, QObject *parent = 0);
|
CurrentUrl(WebPageManager *, QStringList &arguments, QObject *parent = 0);
|
||||||
virtual void start();
|
virtual void start();
|
||||||
#if QT_VERSION < QT_VERSION_CHECK(4, 8, 0)
|
|
||||||
|
|
||||||
private:
|
|
||||||
bool wasRegularLoad();
|
|
||||||
bool wasRedirectedAndNotModifiedByJavascript();
|
|
||||||
#endif
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -34,7 +34,6 @@ WebPage::WebPage(WebPageManager *manager, QObject *parent) : QWebPage(parent) {
|
||||||
resetWindowSize();
|
resetWindowSize();
|
||||||
|
|
||||||
settings()->setAttribute(QWebSettings::JavascriptCanOpenWindows, true);
|
settings()->setAttribute(QWebSettings::JavascriptCanOpenWindows, true);
|
||||||
currentFrame()->setUrl(QUrl("about:blank"));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void WebPage::resetWindowSize() {
|
void WebPage::resetWindowSize() {
|
||||||
|
|
Loading…
Reference in New Issue