2016-08-25 00:45:32 +02:00
|
|
|
#ifndef WEBPAGE_H
|
|
|
|
#define WEBPAGE_H
|
2017-04-23 18:27:31 +02:00
|
|
|
#ifndef SYNCTHINGWIDGETS_NO_WEBVIEW
|
2016-08-25 00:45:32 +02:00
|
|
|
|
2017-03-14 23:02:04 +01:00
|
|
|
#include "./webviewdefs.h"
|
|
|
|
#include "./webviewincludes.h"
|
2016-08-25 00:45:32 +02:00
|
|
|
|
2017-04-23 18:27:31 +02:00
|
|
|
#include "../global.h"
|
|
|
|
|
2016-08-25 00:45:32 +02:00
|
|
|
QT_FORWARD_DECLARE_CLASS(QAuthenticator)
|
|
|
|
QT_FORWARD_DECLARE_CLASS(QNetworkReply)
|
2017-01-01 18:14:44 +01:00
|
|
|
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;
|
|
|
|
|
2017-05-01 03:34:43 +02:00
|
|
|
class SYNCTHINGWIDGETS_EXPORT WebPage : public SYNCTHINGWIDGETS_WEB_PAGE {
|
2016-08-25 00:45:32 +02:00
|
|
|
Q_OBJECT
|
|
|
|
public:
|
2017-04-23 18:27:31 +02:00
|
|
|
WebPage(WebViewDialog *dlg = nullptr, SYNCTHINGWIDGETS_WEB_VIEW *view = nullptr);
|
2016-08-25 00:45:32 +02:00
|
|
|
|
2017-01-01 19:19:16 +01:00
|
|
|
static bool isSamePage(const QUrl &url1, const QUrl &url2);
|
|
|
|
|
2016-08-25 00:45:32 +02:00
|
|
|
protected:
|
2017-04-23 18:27:31 +02:00
|
|
|
SYNCTHINGWIDGETS_WEB_PAGE *createWindow(WebWindowType type);
|
|
|
|
#ifdef SYNCTHINGWIDGETS_USE_WEBENGINE
|
2016-09-01 16:34:30 +02:00
|
|
|
bool certificateError(const QWebEngineCertificateError &certificateError);
|
2017-01-01 18:14:44 +01:00
|
|
|
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:
|
2017-01-01 18:14:44 +01:00
|
|
|
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);
|
2017-04-23 18:27:31 +02:00
|
|
|
#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:
|
2017-01-01 19:19:16 +01:00
|
|
|
static bool handleNavigationRequest(const QUrl ¤tUrl, const QUrl &url);
|
2017-01-01 18:14:44 +01:00
|
|
|
|
2016-09-03 20:14:52 +02:00
|
|
|
WebViewDialog *m_dlg;
|
2017-04-23 18:27:31 +02:00
|
|
|
SYNCTHINGWIDGETS_WEB_VIEW *m_view;
|
2016-08-25 00:45:32 +02:00
|
|
|
};
|
2017-09-17 21:48:15 +02:00
|
|
|
} // namespace QtGui
|
2016-08-25 00:45:32 +02:00
|
|
|
|
2017-04-23 18:27:31 +02:00
|
|
|
#endif // SYNCTHINGWIDGETS_NO_WEBVIEW
|
2016-08-25 00:45:32 +02:00
|
|
|
#endif // WEBPAGE_H
|