[Qt] Make navigation actions properly usable in QML.
authoralexis.menard@openbossa.org <alexis.menard@openbossa.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 4 Aug 2011 14:57:04 +0000 (14:57 +0000)
committeralexis.menard@openbossa.org <alexis.menard@openbossa.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 4 Aug 2011 14:57:04 +0000 (14:57 +0000)
commit6e435bc2f998292645e66914b6417ea2d5882500
treeba1736a9fe461bc8e245da3d68c7c00fe54b5b1d
parentad30484fce3cf77c5fa511006d780e5c3554f116
[Qt] Make navigation actions properly usable in QML.
https://bugs.webkit.org/show_bug.cgi?id=65624

Source/WebKit2:

Add a new class that is exposed in QML to control the navigation
like reload/stop/back/forward. Enums are not very QML friendly,
it not possible to use enums that are not declared in the same class
than the object exposed in QML, therefore it makes hard the sharing
between the desktop and the touch views. In addition namespaced enums are
even harder to support in QML. QWebNavigationController is
not really meant to be used in C++ but it is exported for convenience
reason (tests and MiniBrowser) so its API is not meant to be public but
exposed in QML through properties and convenience slots. The QML code to use
the navigation action in QML will look like "desktopView.navigation.reload();"
or "if (desktopView.navigation.reloadAction.enabled) ...".

Reviewed by Benjamin Poulain.

* UIProcess/API/qt/WKView.h: To get the forward header generated
* UIProcess/API/qt/qdesktopwebview.cpp:
(QDesktopWebViewPrivate::QDesktopWebViewPrivate):
(QDesktopWebView::navigationController):
* UIProcess/API/qt/qdesktopwebview.h:
* UIProcess/API/qt/qdesktopwebview_p.h:
* UIProcess/API/qt/qmlplugin/plugin.cpp:
(WebKit2QmlPlugin::registerTypes):
* UIProcess/API/qt/qtouchwebpage.cpp:
(QTouchWebPage::navigationController):
(QTouchWebPagePrivate::QTouchWebPagePrivate):
* UIProcess/API/qt/qtouchwebpage.h:
* UIProcess/API/qt/qtouchwebpage_p.h:
* UIProcess/API/qt/qwebnavigationcontroller.cpp: Added.
(QWebNavigationControllerPrivate::QWebNavigationControllerPrivate):
(QWebNavigationController::QWebNavigationController):
(QWebNavigationController::~QWebNavigationController):
(QWebNavigationController::backAction):
(QWebNavigationController::forwardAction):
(QWebNavigationController::stopAction):
(QWebNavigationController::reloadAction):
(QWebNavigationController::navigationAction):
(QWebNavigationController::back):
(QWebNavigationController::forward):
(QWebNavigationController::stop):
(QWebNavigationController::reload):
* UIProcess/API/qt/qwebnavigationcontroller.h: Added.
* UIProcess/API/qt/tests/commonviewtests/webviewabstraction.cpp:
(WebViewAbstraction::triggerNavigationAction):
* UIProcess/API/qt/tests/qdesktopwebview/tst_qdesktopwebview.cpp:
(tst_QDesktopWebView::navigationActionsStatusAtStartup):
(LoadStartedCatcher::onLoadStarted):
(tst_QDesktopWebView::stopActionEnabledAfterLoadStarted):
* UIProcess/API/qt/tests/qtouchwebview/tst_qtouchwebview.cpp:
(tst_QTouchWebView::navigationActionsStatusAtStartup):
* WebKit2API.pri:

Tools:

Fix compilation after the introduction of QWebNavigationController.

Reviewed by Benjamin Poulain.

* MiniBrowser/qt/BrowserView.cpp:
(BrowserView::navigationAction):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@92373 268f45cc-cd09-0410-ab3c-d52691b4dbfc
17 files changed:
Source/WebKit2/ChangeLog
Source/WebKit2/UIProcess/API/qt/WKView.h
Source/WebKit2/UIProcess/API/qt/qdesktopwebview.cpp
Source/WebKit2/UIProcess/API/qt/qdesktopwebview.h
Source/WebKit2/UIProcess/API/qt/qdesktopwebview_p.h
Source/WebKit2/UIProcess/API/qt/qmlplugin/plugin.cpp
Source/WebKit2/UIProcess/API/qt/qtouchwebpage.cpp
Source/WebKit2/UIProcess/API/qt/qtouchwebpage.h
Source/WebKit2/UIProcess/API/qt/qtouchwebpage_p.h
Source/WebKit2/UIProcess/API/qt/qwebnavigationcontroller.cpp [new file with mode: 0644]
Source/WebKit2/UIProcess/API/qt/qwebnavigationcontroller.h [new file with mode: 0644]
Source/WebKit2/UIProcess/API/qt/tests/commonviewtests/webviewabstraction.cpp
Source/WebKit2/UIProcess/API/qt/tests/qdesktopwebview/tst_qdesktopwebview.cpp
Source/WebKit2/UIProcess/API/qt/tests/qtouchwebview/tst_qtouchwebview.cpp
Source/WebKit2/WebKit2API.pri
Tools/ChangeLog
Tools/MiniBrowser/qt/BrowserView.cpp