diff options
author | Simon Rettberg | 2021-08-05 10:51:39 +0200 |
---|---|---|
committer | Simon Rettberg | 2021-08-05 10:51:39 +0200 |
commit | ccd88b7fa33fc27e3d71b57f59dea55ed7430d6e (patch) | |
tree | 35edaff0695b7ed47a3f648f8295ea944935f0a0 /src/webview.h | |
parent | Prefix usernames that start with a digit with _x_ (diff) | |
download | slxgreeter-ccd88b7fa33fc27e3d71b57f59dea55ed7430d6e.tar.gz slxgreeter-ccd88b7fa33fc27e3d71b57f59dea55ed7430d6e.tar.xz slxgreeter-ccd88b7fa33fc27e3d71b57f59dea55ed7430d6e.zip |
Add shibboleth login via browser
Diffstat (limited to 'src/webview.h')
-rw-r--r-- | src/webview.h | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/src/webview.h b/src/webview.h new file mode 100644 index 0000000..79b4a64 --- /dev/null +++ b/src/webview.h @@ -0,0 +1,44 @@ +#ifndef WEBVIEW_H_ +#define WEBVIEW_H_ + +#include <QStack> +#include <QWebView> +#include <QNetworkRequest> + +class QNetworkReply; +class QTimer; + +/** + * Make sure pages that want to load in a new tab are actually loaded in the same page, + * and remember the previous URL in case the "new tab" requests to be closed. + */ +class WebView : public QWebView +{ +Q_OBJECT +public: + WebView(QWidget* parent = NULL); + void reset(const QString baseUrl); + +protected: + QWebView *createWindow(QWebPage::WebWindowType); + +signals: + void triggerReset(const QString &message); + void startAuthentication(const QString &user, const QString &pass); + +protected slots: + void windowCloseRequested(); + void unsupportedContent(QNetworkReply*); + void downloadRequest(QNetworkRequest); + void downloadDeniedMessage(); + void onLoadFinished(bool ok); + +private: + QStack<QUrl> _urls; + QTimer *_timerAbortMessage; + bool _abortedDownload; + QString _token; + QTimer *_timerReset; +}; + +#endif |