summaryrefslogtreecommitdiffstats
path: root/src/webview.cpp
blob: aa9c650708d186b101776d551431137a72c14652 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#include "webview.h"
#include <QWebFrame>

void WebView::windowCloseRequested()
{
	// If we have an old URL stored on the stack, navigate back to it, otherwise we return and nothing happens
	if (_urls.empty())
		return;
	QUrl url = _urls.pop();
	page()->mainFrame()->load(url);
}

QWebView* WebView::createWindow(QWebPage::WebWindowType)
{
	// Remember current URL, then return the current Web View so no new window opens
	_urls.push(this->url());
	return this;
}