'hidden' contacts
[dyskinesia.git] / src / k8webview.h
blobb8b3995e6f82ce26e320ee9057856d86183ad74c
1 /* coded by Ketmar // Vampire Avalon (psyc://ketmar.no-ip.org/~Ketmar)
2 * Understanding is not required. Only obedience.
4 * This program is free software. It comes without any warranty, to
5 * the extent permitted by applicable law. You can redistribute it
6 * and/or modify it under the terms of the Do What The Fuck You Want
7 * To Public License, Version 2, as published by Sam Hocevar. See
8 * http://sam.zoy.org/wtfpl/COPYING for more details.
9 */
10 #ifndef KWEBVIEW_H
11 #define KWEBVIEW_H
13 #include <QContextMenuEvent>
14 #include <QWidget>
15 #include <QWebView>
18 class K8WebPage : public QWebPage {
19 Q_OBJECT
21 public:
22 K8WebPage (QObject *parent = 0);
24 protected:
25 QObject *createPlugin (const QString &classId, const QUrl &url, const QStringList &paramNames, const QStringList &paramValues);
27 bool acceptNavigationRequest (QWebFrame *frame, const QNetworkRequest &request, NavigationType type);
28 QWebPage *createWindow (QWebPage::WebWindowType type);
30 void javaScriptConsoleMessage (const QString &message, int lineNumber, const QString &sourceID);
32 void javaScriptAlert (QWebFrame *frame, const QString &msg);
33 bool javaScriptConfirm (QWebFrame *frame, const QString &msg);
34 bool javaScriptPrompt (QWebFrame *frame, const QString &msg, const QString &defaultValue, QString *result);
39 class K8WebView : public QWebView {
40 Q_OBJECT
42 public:
43 K8WebView (QWidget *parent = 0);
44 ~K8WebView ();
46 K8WebPage *webPage () const { return mPage; }
48 inline bool allowContextMenu () { return mAllowContextMenu; }
49 inline void setAllowContextMenu (bool v) { mAllowContextMenu = v; }
51 signals:
52 void webContextMenu (const QWebHitTestResult &hitRes, const QPoint &pos);
54 protected slots:
55 void onDownloadRequested (const QNetworkRequest &request);
57 protected:
58 void contextMenuEvent (QContextMenuEvent *event);
60 QWebView *createWindow (QWebPage::WebWindowType type);
62 private:
63 K8WebPage *mPage;
64 bool mAllowContextMenu;
68 #endif