• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 #include <qgraphicssceneevent.h>
29 
30 #include "qwebpage.h"
31 #include "qwebhistory.h"
32 #include "qwebframe.h"
33 
34 #include "KURL.h"
35 #include "PlatformString.h"
36 
37 #include <wtf/RefPtr.h>
38 
39 namespace WebCore {
40     class ChromeClientQt;
41     class ContextMenuClientQt;
42     class ContextMenuItem;
43     class ContextMenu;
44     class EditorClientQt;
45     class Element;
46     class InspectorController;
47     class Node;
48     class Page;
49     class Frame;
50 }
51 
52 QT_BEGIN_NAMESPACE
53 class QUndoStack;
54 class QMenu;
55 class QBitArray;
56 QT_END_NAMESPACE
57 
58 class QWebInspector;
59 class QWebPageClient;
60 
61 class QWebPagePrivate {
62 public:
63     QWebPagePrivate(QWebPage*);
64     ~QWebPagePrivate();
65 
66     static WebCore::Page* core(QWebPage*);
67 
68     void createMainFrame();
69 #ifndef QT_NO_CONTEXTMENU
70     QMenu* createContextMenu(const WebCore::ContextMenu* webcoreMenu, const QList<WebCore::ContextMenuItem>* items, QBitArray* visitedWebActions);
71 #endif
72     void _q_onLoadProgressChanged(int);
73     void _q_webActionTriggered(bool checked);
74     void _q_cleanupLeakMessages();
75     void updateAction(QWebPage::WebAction action);
76     void updateNavigationActions();
77     void updateEditorActions();
78 
79     void timerEvent(QTimerEvent*);
80 
81     void mouseMoveEvent(QMouseEvent*);
82     void mouseMoveEvent(QGraphicsSceneMouseEvent*);
83     void mousePressEvent(QMouseEvent*);
84     void mousePressEvent(QGraphicsSceneMouseEvent*);
85     void mouseDoubleClickEvent(QMouseEvent*);
86     void mouseDoubleClickEvent(QGraphicsSceneMouseEvent*);
87     void mouseTripleClickEvent(QMouseEvent*);
88     void mouseTripleClickEvent(QGraphicsSceneMouseEvent*);
89     void mouseReleaseEvent(QMouseEvent*);
90     void mouseReleaseEvent(QGraphicsSceneMouseEvent*);
91 #ifndef QT_NO_CONTEXTMENU
92     void contextMenuEvent(const QPoint& globalPos);
93 #endif
94 #ifndef QT_NO_WHEELEVENT
95     void wheelEvent(QWheelEvent*);
96     void wheelEvent(QGraphicsSceneWheelEvent*);
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 dragEnterEvent(QGraphicsSceneDragDropEvent*);
105     void dragLeaveEvent(QDragLeaveEvent*);
106     void dragLeaveEvent(QGraphicsSceneDragDropEvent*);
107     void dragMoveEvent(QDragMoveEvent*);
108     void dragMoveEvent(QGraphicsSceneDragDropEvent*);
109     void dropEvent(QDropEvent*);
110     void dropEvent(QGraphicsSceneDragDropEvent*);
111 
112     void inputMethodEvent(QInputMethodEvent*);
113 
114     void shortcutOverrideEvent(QKeyEvent*);
115     void leaveEvent(QEvent*);
116     void handleClipboard(QEvent*, Qt::MouseButton);
117     void handleSoftwareInputPanel(Qt::MouseButton);
118     bool handleScrolling(QKeyEvent*, WebCore::Frame*);
119 
120 #if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0)
121     void touchEvent(QTouchEvent*);
122 #endif
123 
124     void setInspector(QWebInspector*);
125     QWebInspector* getOrCreateInspector();
126     WebCore::InspectorController* inspectorController();
127 
128 #ifndef QT_NO_SHORTCUT
129     static QWebPage::WebAction editorActionForKeyEvent(QKeyEvent* event);
130 #endif
131     static const char* editorCommandForWebActions(QWebPage::WebAction action);
132 
133     WebCore::ChromeClientQt *chromeClient;
134     WebCore::ContextMenuClientQt *contextMenuClient;
135     WebCore::EditorClientQt *editorClient;
136     WebCore::Page *page;
137 
138     QPointer<QWebFrame> mainFrame;
139 
140     QWebPage *q;
141     QWebPageClient* client;
142 #ifndef QT_NO_UNDOSTACK
143     QUndoStack *undoStack;
144 #endif
145 
146 #if QT_VERSION >= 0x040600
147     QWeakPointer<QWidget> view;
148 #else
149     QWidget* view;
150 #endif
151 
152     bool insideOpenCall;
153     quint64 m_totalBytes;
154     quint64 m_bytesReceived;
155 
156     QPoint tripleClick;
157     QBasicTimer tripleClickTimer;
158 
159     bool clickCausedFocus;
160 
161     bool acceptNavigationRequest(QWebFrame *frame, const QNetworkRequest &request, QWebPage::NavigationType type);
162     QNetworkAccessManager *networkManager;
163 
164     bool forwardUnsupportedContent;
165     QWebPage::LinkDelegationPolicy linkPolicy;
166 
167     QSize viewportSize;
168     QSize fixedLayoutSize;
169     QWebHistory history;
170     QWebHitTestResult hitTestResult;
171 #ifndef QT_NO_CONTEXTMENU
172     QPointer<QMenu> currentContextMenu;
173 #endif
174     QWebSettings *settings;
175     QPalette palette;
176     bool editable;
177     bool useFixedLayout;
178 
179     QAction *actions[QWebPage::WebActionCount];
180 
181     QWebPluginFactory *pluginFactory;
182 
183     QWidget* inspectorFrontend;
184     QWebInspector* inspector;
185     bool inspectorIsInternalOnly; // True if created through the Inspect context menu action
186     Qt::DropAction m_lastDropAction;
187 
188     static bool drtRun;
189 };
190 
191 #endif
192