diff options
Diffstat (limited to 'src/webview.h')
-rw-r--r-- | src/webview.h | 75 |
1 files changed, 19 insertions, 56 deletions
diff --git a/src/webview.h b/src/webview.h index eba02505..2ac018d7 100644 --- a/src/webview.h +++ b/src/webview.h @@ -27,8 +27,12 @@ // KDE Includes #include <KUrl> +#include <kdewebkit/kwebpage.h> +#include <kdewebkit/kwebview.h> + // Qt Includes #include <QWebPage> +#include <QWebView> // Forward Declarations class MainWindow; @@ -41,62 +45,22 @@ class QAuthenticator; class QMouseEvent; class QNetworkProxy; class QNetworkReply; -class QSslError; +class WebPage; -class WebPage : public QWebPage +class WebView : public KWebView { Q_OBJECT -signals: - void loadingUrl(const QUrl &url); // WARNING has to be QUrl!! - public: - WebPage(QObject *parent = 0); - ~WebPage(); - -protected: - bool acceptNavigationRequest(QWebFrame *frame, - const QNetworkRequest &request, - NavigationType type); - - QWebPage *createWindow(QWebPage::WebWindowType type); - QObject *createPlugin(const QString &classId, - const QUrl &url, - const QStringList ¶mNames, - const QStringList ¶mValues); - -private slots: - void handleUnsupportedContent(QNetworkReply *reply); - -private: - friend class WebView; - - // set the webview mousepressedevent - Qt::KeyboardModifiers m_keyboardModifiers; - Qt::MouseButtons m_pressedButtons; - KUrl m_loadingUrl; -}; + explicit WebView(QWidget *parent = 0); + KUrl url() const; + QString lastStatusBarText() const; + int progress() const; -// ---------------------------------------------------------------------------------------------------- - -// Qt Includes -#include <QWebView> - - -class WebView : public QWebView -{ - Q_OBJECT - -public: - WebView(QWidget *parent = 0); - - // inline - WebPage *webPage() const { return m_page; } - KUrl url() const { return KUrl(QWebView::url()); } - QString lastStatusBarText() const { return m_statusBarText; } - int progress() const { return m_progress; } +public Q_SLOTS: + void load(const KUrl &url); signals: // switching tabs @@ -104,10 +68,7 @@ signals: void shiftCtrlTabPressed(); protected: - void mousePressEvent(QMouseEvent *event); - void mouseReleaseEvent(QMouseEvent *event); void contextMenuEvent(QContextMenuEvent *event); - void wheelEvent(QWheelEvent *event); /** * Filters (SHIFT + ) CTRL + TAB events and emit (shift)ctrlTabPressed() @@ -115,12 +76,15 @@ protected: */ void keyPressEvent(QKeyEvent *event); + // to reimplement from KWebView + virtual void setNewPage(); + private slots: - void setProgress(int progress) { m_progress = progress; } + void setProgress(int progress); void loadFinished(); - void setStatusBarText(const QString &string) { m_statusBarText = string; } - void downloadRequested(const QNetworkRequest &request); - void openLinkInNewTab(); + void setStatusBarText(const QString &string); + + void openLinkInNewTab(const KUrl &); private: WebPage *m_page; @@ -130,4 +94,3 @@ private: }; #endif - |