1 /* 2 Copyright (C) 2008, 2009 Nokia Corporation and/or its subsidiary(-ies) 3 Copyright (C) 2008 Holger Hans Peter Freyther 4 5 This library is free software; you can redistribute it and/or 6 modify it under the terms of the GNU Library General Public 7 License as published by the Free Software Foundation; either 8 version 2 of the License, or (at your option) any later version. 9 10 This library is distributed in the hope that it will be useful, 11 but WITHOUT ANY WARRANTY; without even the implied warranty of 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 Library General Public License for more details. 14 15 You should have received a copy of the GNU Library General Public License 16 along with this library; see the file COPYING.LIB. If not, write to 17 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 18 Boston, MA 02110-1301, USA. 19 */ 20 21 #ifndef QWEBPAGE_P_H 22 #define QWEBPAGE_P_H 23 24 #include <qbasictimer.h> 25 #include <qnetworkproxy.h> 26 #include <qpointer.h> 27 #include <qevent.h> 28 29 #include "qwebpage.h" 30 #include "qwebhistory.h" 31 #include "qwebframe.h" 32 33 #include "KURL.h" 34 #include "PlatformString.h" 35 36 #include <wtf/RefPtr.h> 37 38 namespace WebCore { 39 class ChromeClientQt; 40 class ContextMenuClientQt; 41 class ContextMenuItem; 42 class ContextMenu; 43 class EditorClientQt; 44 class Element; 45 class Node; 46 class Page; 47 class Frame; 48 49 #ifndef QT_NO_CURSOR 50 class SetCursorEvent : public QEvent { 51 public: 52 static const int EventType = 724; 53 SetCursorEvent(const QCursor&); 54 55 QCursor cursor() const; 56 private: 57 QCursor m_cursor; 58 }; 59 #endif 60 } 61 62 QT_BEGIN_NAMESPACE 63 class QUndoStack; 64 class QMenu; 65 class QBitArray; 66 QT_END_NAMESPACE 67 68 class QWebPagePrivate { 69 public: 70 QWebPagePrivate(QWebPage*); 71 ~QWebPagePrivate(); 72 void createMainFrame(); 73 #ifndef QT_NO_CONTEXTMENU 74 QMenu* createContextMenu(const WebCore::ContextMenu* webcoreMenu, const QList<WebCore::ContextMenuItem>* items, QBitArray* visitedWebActions); 75 #endif 76 void _q_onLoadProgressChanged(int); 77 void _q_webActionTriggered(bool checked); 78 #ifndef NDEBUG 79 void _q_cleanupLeakMessages(); 80 #endif 81 void updateAction(QWebPage::WebAction action); 82 void updateNavigationActions(); 83 void updateEditorActions(); 84 85 void timerEvent(QTimerEvent*); 86 87 void mouseMoveEvent(QMouseEvent*); 88 void mousePressEvent(QMouseEvent*); 89 void mouseDoubleClickEvent(QMouseEvent*); 90 void mouseTripleClickEvent(QMouseEvent*); 91 void mouseReleaseEvent(QMouseEvent*); 92 #ifndef QT_NO_CONTEXTMENU 93 void contextMenuEvent(QContextMenuEvent*); 94 #endif 95 #ifndef QT_NO_WHEELEVENT 96 void wheelEvent(QWheelEvent*); 97 #endif 98 void keyPressEvent(QKeyEvent*); 99 void keyReleaseEvent(QKeyEvent*); 100 void focusInEvent(QFocusEvent*); 101 void focusOutEvent(QFocusEvent*); 102 103 void dragEnterEvent(QDragEnterEvent *); 104 void dragLeaveEvent(QDragLeaveEvent *); 105 void dragMoveEvent(QDragMoveEvent *); 106 void dropEvent(QDropEvent *); 107 108 void inputMethodEvent(QInputMethodEvent*); 109 110 void shortcutOverrideEvent(QKeyEvent*); 111 void leaveEvent(QEvent *); 112 bool handleScrolling(QKeyEvent*, WebCore::Frame*); 113 114 #ifndef QT_NO_SHORTCUT 115 static QWebPage::WebAction editorActionForKeyEvent(QKeyEvent* event); 116 #endif 117 static const char* editorCommandForWebActions(QWebPage::WebAction action); 118 119 WebCore::ChromeClientQt *chromeClient; 120 WebCore::ContextMenuClientQt *contextMenuClient; 121 WebCore::EditorClientQt *editorClient; 122 WebCore::Page *page; 123 124 QPointer<QWebFrame> mainFrame; 125 126 QWebPage *q; 127 #ifndef QT_NO_UNDOSTACK 128 QUndoStack *undoStack; 129 #endif 130 QWidget *view; 131 132 bool insideOpenCall; 133 quint64 m_totalBytes; 134 quint64 m_bytesReceived; 135 136 QPoint tripleClick; 137 QBasicTimer tripleClickTimer; 138 139 #if QT_VERSION < 0x040400 140 bool acceptNavigationRequest(QWebFrame *frame, const QWebNetworkRequest &request, QWebPage::NavigationType type); 141 142 QWebNetworkInterface *networkInterface; 143 #ifndef QT_NO_NETWORKPROXY 144 QNetworkProxy networkProxy; 145 #endif 146 147 #else 148 bool acceptNavigationRequest(QWebFrame *frame, const QNetworkRequest &request, QWebPage::NavigationType type); 149 QNetworkAccessManager *networkManager; 150 #endif 151 152 bool forwardUnsupportedContent; 153 QWebPage::LinkDelegationPolicy linkPolicy; 154 155 QSize viewportSize; 156 QSize fixedLayoutSize; 157 QWebHistory history; 158 QWebHitTestResult hitTestResult; 159 #ifndef QT_NO_CONTEXTMENU 160 QPointer<QMenu> currentContextMenu; 161 #endif 162 QWebSettings *settings; 163 QPalette palette; 164 bool editable; 165 bool useFixedLayout; 166 167 QAction *actions[QWebPage::WebActionCount]; 168 169 QWebPluginFactory *pluginFactory; 170 171 static bool drtRun; 172 }; 173 174 #endif 175