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) {
|
2011-09-15 15:22:10 +00:00
|
|
|
connect(page, SIGNAL(pageFinished(bool)), this, SLOT(loadFinished(bool)));
|
2011-02-19 03:53:06 +00:00
|
|
|
}
|
|
|
|
|
2011-02-26 04:29:36 +00:00
|
|
|
void Visit::start(QStringList &arguments) {
|
2011-06-02 19:45:28 +00:00
|
|
|
QUrl requestedUrl = QUrl(arguments[0]);
|
2011-09-30 16:32:06 +00:00
|
|
|
page()->currentFrame()->load(QUrl(requestedUrl));
|
2011-02-19 03:53:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void Visit::loadFinished(bool success) {
|
2011-05-05 21:45:44 +00:00
|
|
|
QString message;
|
2011-03-09 05:08:30 +00:00
|
|
|
if (!success)
|
2011-05-05 21:45:44 +00:00
|
|
|
message = page()->failureString();
|
2011-03-09 05:08:30 +00:00
|
|
|
|
2011-09-28 19:48:50 +00:00
|
|
|
disconnect(page(), SIGNAL(pageFinished(bool)), this, SLOT(loadFinished(bool)));
|
2011-05-05 21:45:44 +00:00
|
|
|
emit finished(new Response(success, message));
|
2011-02-19 03:53:06 +00:00
|
|
|
}
|