2016-01-18 08:33:28 -06:00
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
|
|
|
// pgAdmin 4 - PostgreSQL Tools
|
|
|
|
//
|
2017-01-04 07:33:32 -06:00
|
|
|
// Copyright (C) 2013 - 2017, The pgAdmin Development Team
|
2016-01-18 08:33:28 -06:00
|
|
|
// This software is released under the PostgreSQL Licence
|
|
|
|
//
|
|
|
|
// WebViewWindow.cpp - Implementation of the custom web view widget
|
|
|
|
//
|
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#include "pgAdmin4.h"
|
|
|
|
|
|
|
|
// App headers
|
|
|
|
#include "WebViewWindow.h"
|
|
|
|
|
2016-11-08 04:54:34 -06:00
|
|
|
// Override QWebEnginePage to handle link delegation
|
2017-02-13 05:44:53 -06:00
|
|
|
#ifdef PGADMIN4_USE_WEBENGINE
|
2016-11-08 04:54:34 -06:00
|
|
|
bool WebEnginePage::acceptNavigationRequest(const QUrl & url, NavigationType type, bool isMainFrame)
|
|
|
|
{
|
|
|
|
Q_UNUSED(type);
|
|
|
|
Q_UNUSED(url);
|
|
|
|
Q_UNUSED(isMainFrame);
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
QWebEnginePage *WebEnginePage::createWindow(QWebEnginePage::WebWindowType type)
|
|
|
|
{
|
|
|
|
if (type == QWebEnginePage::WebBrowserTab)
|
|
|
|
{
|
|
|
|
QWebEnginePage *_page = NULL;
|
|
|
|
emit createTabWindow(_page);
|
|
|
|
return _page;
|
|
|
|
}
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2016-01-18 08:33:28 -06:00
|
|
|
WebViewWindow::WebViewWindow(QWidget *parent) :
|
2017-02-13 05:44:53 -06:00
|
|
|
#ifdef PGADMIN4_USE_WEBENGINE
|
2016-11-08 04:54:34 -06:00
|
|
|
QWebEngineView(parent)
|
|
|
|
#else
|
2016-01-18 08:33:28 -06:00
|
|
|
QWebView(parent)
|
2016-11-08 04:54:34 -06:00
|
|
|
#endif
|
2016-01-18 08:33:28 -06:00
|
|
|
{
|
|
|
|
m_url = QString("");
|
|
|
|
m_tabIndex = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
void WebViewWindow::setFirstLoadURL(const QString &url)
|
|
|
|
{
|
|
|
|
m_url = url;
|
|
|
|
}
|
|
|
|
|
|
|
|
QString WebViewWindow::getFirstLoadURL() const
|
|
|
|
{
|
|
|
|
return m_url;
|
|
|
|
}
|
|
|
|
|
|
|
|
void WebViewWindow::setTabIndex(const int &tabIndex)
|
|
|
|
{
|
|
|
|
m_tabIndex = tabIndex;
|
|
|
|
}
|
|
|
|
|
|
|
|
int WebViewWindow::getTabIndex() const
|
|
|
|
{
|
|
|
|
return m_tabIndex;
|
|
|
|
}
|