ogbrowser/src/ogwebpage.cpp

43 lines
1.2 KiB
C++

#include "ogwebpage.h"
#include <QWebEnginePage>
#include <QDebug>
#include "ogcommandline.h"
#include "mainwindow.h"
#include <QWidget>
bool OGWebPage::acceptNavigationRequest(const QUrl &url, QWebEnginePage::NavigationType type, bool isMainFrame) {
qInfo() << "Link clicked: URL = " << url << "; type = " << type << "; isMainFrame = " << isMainFrame;
if ( type == QWebEnginePage::NavigationType::NavigationTypeLinkClicked) {
}
return true;
}
QWebEnginePage *OGWebPage::createWindow(QWebEnginePage::WebWindowType type) {
qInfo() << "Create new window: " << type;
OGCommandLineOptions &options = OGCommandLineOptions::getInstance();
switch(options.getNewTabBehavior()) {
case OGCommandLineOptions::NewTabBehavior::NewTab:
qWarning() << "Unimplemented";
return this;
case OGCommandLineOptions::NewTabBehavior::ReplacePage:
qInfo() << "Replacing page";
return this;
case OGCommandLineOptions::NewTabBehavior::Ignore:
qInfo() << "Ignoring attempt to open new tab";
return nullptr;
}
qCritical() << "Unknown new tab behavior, this should be unreachable";
return this;
}