syncthingtray/widgets/webview/webpage.h

56 lines
1.6 KiB
C
Raw Normal View History

2016-08-25 00:45:32 +02:00
#ifndef WEBPAGE_H
#define WEBPAGE_H
#ifndef SYNCTHINGWIDGETS_NO_WEBVIEW
2016-08-25 00:45:32 +02:00
#include "./webviewdefs.h"
#include "./webviewincludes.h"
2016-08-25 00:45:32 +02:00
#include "../global.h"
2016-08-25 00:45:32 +02:00
QT_FORWARD_DECLARE_CLASS(QAuthenticator)
QT_FORWARD_DECLARE_CLASS(QNetworkReply)
QT_FORWARD_DECLARE_CLASS(QNetworkRequest)
2016-09-01 16:34:30 +02:00
QT_FORWARD_DECLARE_CLASS(QSslError)
2016-08-25 00:45:32 +02:00
namespace QtGui {
2016-09-03 20:14:52 +02:00
class WebViewDialog;
class SYNCTHINGWIDGETS_EXPORT WebPage : public SYNCTHINGWIDGETS_WEB_PAGE
2016-08-25 00:45:32 +02:00
{
Q_OBJECT
public:
WebPage(WebViewDialog *dlg = nullptr, SYNCTHINGWIDGETS_WEB_VIEW *view = nullptr);
2016-08-25 00:45:32 +02:00
static bool isSamePage(const QUrl &url1, const QUrl &url2);
2016-08-25 00:45:32 +02:00
protected:
SYNCTHINGWIDGETS_WEB_PAGE *createWindow(WebWindowType type);
#ifdef SYNCTHINGWIDGETS_USE_WEBENGINE
2016-09-01 16:34:30 +02:00
bool certificateError(const QWebEngineCertificateError &certificateError);
bool acceptNavigationRequest(const QUrl &url, NavigationType type, bool isMainFrame);
#else
bool acceptNavigationRequest(QWebFrame *frame, const QNetworkRequest &request, NavigationType type);
2016-09-01 16:34:30 +02:00
#endif
2016-08-25 00:45:32 +02:00
private slots:
void delegateNewWindowToExternalBrowser(const QUrl &url);
2016-08-25 00:45:32 +02:00
void supplyCredentials(const QUrl &requestUrl, QAuthenticator *authenticator);
void supplyCredentials(QNetworkReply *reply, QAuthenticator *authenticator);
void supplyCredentials(QAuthenticator *authenticator);
#ifdef SYNCTHINGWIDGETS_USE_WEBKIT
2016-09-01 16:34:30 +02:00
void handleSslErrors(QNetworkReply *, const QList<QSslError> &errors);
#endif
2016-08-25 00:45:32 +02:00
private:
static bool handleNavigationRequest(const QUrl &currentUrl, const QUrl &url);
2016-09-03 20:14:52 +02:00
WebViewDialog *m_dlg;
SYNCTHINGWIDGETS_WEB_VIEW *m_view;
2016-08-25 00:45:32 +02:00
};
}
#endif // SYNCTHINGWIDGETS_NO_WEBVIEW
2016-08-25 00:45:32 +02:00
#endif // WEBPAGE_H