Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

33 lines (26 sloc) 0.735 kB
#include "WindowFocus.h"
#include "SocketCommand.h"
#include "WebPage.h"
#include "CommandFactory.h"
#include "WebPageManager.h"
WindowFocus::WindowFocus(WebPageManager *manager, QStringList &arguments, QObject *parent) : SocketCommand(manager, arguments, parent) {
}
void WindowFocus::start() {
focusWindow(arguments()[0]);
}
void WindowFocus::windowNotFound() {
emitFinished(false, QString("Unable to locate window. "));
}
void WindowFocus::success(WebPage *page) {
page->setFocus();
emitFinished(true);
}
void WindowFocus::focusWindow(QString selector) {
foreach(WebPage *page, manager()->pages()) {
if (page->matchesWindowSelector(selector)) {
success(page);
return;
}
}
windowNotFound();
}
Jump to Line
Something went wrong with that request. Please try again.