capybara-webkit/src/Visit.cpp

22 lines
603 B
C++
Raw Normal View History

2011-02-19 03:53:06 +00:00
#include "Visit.h"
#include "Command.h"
#include "WebPage.h"
Visit::Visit(WebPage *page, QObject *parent) : Command(page, parent) {
connect(page, SIGNAL(pageFinished(bool)), this, SLOT(loadFinished(bool)));
2011-02-19 03:53:06 +00:00
}
void Visit::start(QStringList &arguments) {
QUrl requestedUrl = QUrl(arguments[0]);
page()->currentFrame()->load(QUrl(requestedUrl));
2011-02-19 03:53:06 +00:00
}
void Visit::loadFinished(bool success) {
QString message;
if (!success)
message = page()->failureString();
2011-09-28 19:48:50 +00:00
disconnect(page(), SIGNAL(pageFinished(bool)), this, SLOT(loadFinished(bool)));
emit finished(new Response(success, message));
2011-02-19 03:53:06 +00:00
}