Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

38 lines (29 sloc) 0.879 kB
#include "WindowFocus.h"
#include "Command.h"
#include "WebPage.h"
#include "CommandFactory.h"
#include "WebPageManager.h"
WindowFocus::WindowFocus(WebPage *page, QStringList &arguments, QObject *parent) : Command(page, arguments, parent) {
}
void WindowFocus::start() {
focusWindow(arguments()[0]);
}
void WindowFocus::windowNotFound() {
emit finished(new Response(false, QString("Unable to locate window. ")));
}
void WindowFocus::success(WebPage *page) {
emit windowChanged(page);
emit finished(new Response(true));
}
void WindowFocus::focusWindow(QString selector) {
QListIterator<WebPage *> pageIterator =
((CommandFactory *) parent())->m_manager->iterator();
while (pageIterator.hasNext()) {
WebPage *page = pageIterator.next();
if (page->matchesWindowSelector(selector)) {
success(page);
return;
}
}
windowNotFound();
}
Jump to Line
Something went wrong with that request. Please try again.