12011-08-03 Alexis Menard <alexis.menard@openbossa.org>
2
3 [Qt] Make navigation actions properly usable in QML.
4 https://bugs.webkit.org/show_bug.cgi?id=65624
5
6 Add a new class that is exposed in QML to control the navigation
7 like reload/stop/back/forward. Enums are not very QML friendly,
8 it not possible to use enums that are not declared in the same class
9 than the object exposed in QML, therefore it makes hard the sharing
10 between the desktop and the touch views. In addition namespaced enums are
11 even harder to support in QML. QWebNavigationController is
12 not really meant to be used in C++ but it is exported for convenience
13 reason (tests and MiniBrowser) so its API is not meant to be public but
14 exposed in QML through properties and convenience slots. The QML code to use
15 the navigation action in QML will look like "desktopView.navigation.reload();"
16 or "if (desktopView.navigation.reloadAction.enabled) ...".
17
18 Reviewed by NOBODY (OOPS!).
19
20 * UIProcess/API/qt/WKView.h: To get the forward header generated
21 * UIProcess/API/qt/qdesktopwebview.cpp:
22 (QDesktopWebViewPrivate::QDesktopWebViewPrivate):
23 (QDesktopWebView::navigationController):
24 * UIProcess/API/qt/qdesktopwebview.h:
25 * UIProcess/API/qt/qdesktopwebview_p.h:
26 * UIProcess/API/qt/qmlplugin/plugin.cpp:
27 (WebKit2QmlPlugin::registerTypes):
28 * UIProcess/API/qt/qtouchwebpage.cpp:
29 (QTouchWebPage::navigationController):
30 (QTouchWebPagePrivate::QTouchWebPagePrivate):
31 * UIProcess/API/qt/qtouchwebpage.h:
32 * UIProcess/API/qt/qtouchwebpage_p.h:
33 * UIProcess/API/qt/qwebnavigationcontroller.cpp: Added.
34 (QWebNavigationControllerPrivate::QWebNavigationControllerPrivate):
35 (QWebNavigationController::QWebNavigationController):
36 (QWebNavigationController::~QWebNavigationController):
37 (QWebNavigationController::backAction):
38 (QWebNavigationController::forwardAction):
39 (QWebNavigationController::stopAction):
40 (QWebNavigationController::reloadAction):
41 (QWebNavigationController::navigationAction):
42 (QWebNavigationController::back):
43 (QWebNavigationController::forward):
44 (QWebNavigationController::stop):
45 (QWebNavigationController::reload):
46 * UIProcess/API/qt/qwebnavigationcontroller.h: Added.
47 * UIProcess/API/qt/tests/commonviewtests/webviewabstraction.cpp:
48 (WebViewAbstraction::triggerNavigationAction):
49 * UIProcess/API/qt/tests/qdesktopwebview/tst_qdesktopwebview.cpp:
50 (tst_QDesktopWebView::navigationActionsStatusAtStartup):
51 (LoadStartedCatcher::onLoadStarted):
52 (tst_QDesktopWebView::stopActionEnabledAfterLoadStarted):
53 * UIProcess/API/qt/tests/qtouchwebview/tst_qtouchwebview.cpp:
54 (tst_QTouchWebView::navigationActionsStatusAtStartup):
55 * WebKit2API.pri:
56