Commit 9707b1a0 authored by diegohcg@webkit.org's avatar diegohcg@webkit.org

2010-07-13 Diego Gonzalez <diegohcg@webkit.org>

        Reviewed by Kenneth Rohde Christiansen.

        [Qt] [WebKit2] Hook up navigation actions
        https://bugs.webkit.org/show_bug.cgi?id=42183

        Make Back, Forward, Stop and Reload being enable/disabled according
        page loading.

        * UIProcess/API/qt/ClientImpl.cpp:
        (qt_wk_didStartProvisionalLoadForFrame):
        (qt_wk_didCommitLoadForFrame):
        (qt_wk_didFinishLoadForFrame):
        (qt_wk_didFailLoadWithErrorForFrame):
        * UIProcess/API/qt/qwkpage.cpp:
        (QWKPagePrivate::updateAction):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@63256 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 2d85c6d7
2010-07-13 Diego Gonzalez <diegohcg@webkit.org>
Reviewed by Kenneth Rohde Christiansen.
[Qt] [WebKit2] Hook up navigation actions
https://bugs.webkit.org/show_bug.cgi?id=42183
Make Back, Forward, Stop and Reload being enable/disabled according
page loading.
* UIProcess/API/qt/ClientImpl.cpp:
(qt_wk_didStartProvisionalLoadForFrame):
(qt_wk_didCommitLoadForFrame):
(qt_wk_didFinishLoadForFrame):
(qt_wk_didFailLoadWithErrorForFrame):
* UIProcess/API/qt/qwkpage.cpp:
(QWKPagePrivate::updateAction):
2010-07-13 John Sullivan <sullivan@apple.com>
Written by Simon Fraser, reviewed by me.
......
......@@ -41,6 +41,7 @@ void qt_wk_didStartProvisionalLoadForFrame(WKPageRef page, WKFrameRef frame, con
if (!WKFrameIsMainFrame(frame))
return;
emit toQWKPage(clientInfo)->loadStarted();
QWKPagePrivate::get(toQWKPage(clientInfo))->updateNavigationActions();
}
void qt_wk_didReceiveServerRedirectForProvisionalLoadForFrame(WKPageRef page, WKFrameRef frame, const void* clientInfo)
......@@ -59,6 +60,7 @@ void qt_wk_didCommitLoadForFrame(WKPageRef page, WKFrameRef frame, const void* c
QString urlStr(wkframe->url());
QUrl qUrl = urlStr;
emit toQWKPage(clientInfo)->urlChanged(qUrl);
QWKPagePrivate::get(toQWKPage(clientInfo))->updateNavigationActions();
}
void qt_wk_didFinishLoadForFrame(WKPageRef page, WKFrameRef frame, const void* clientInfo)
......@@ -66,6 +68,7 @@ void qt_wk_didFinishLoadForFrame(WKPageRef page, WKFrameRef frame, const void* c
if (!WKFrameIsMainFrame(frame))
return;
emit toQWKPage(clientInfo)->loadFinished(true);
QWKPagePrivate::get(toQWKPage(clientInfo))->updateNavigationActions();
}
void qt_wk_didFailLoadWithErrorForFrame(WKPageRef page, WKFrameRef frame, const void* clientInfo)
......@@ -73,6 +76,7 @@ void qt_wk_didFailLoadWithErrorForFrame(WKPageRef page, WKFrameRef frame, const
if (!WKFrameIsMainFrame(frame))
return;
emit toQWKPage(clientInfo)->loadFinished(false);
QWKPagePrivate::get(toQWKPage(clientInfo))->updateNavigationActions();
}
void qt_wk_didReceiveTitleForFrame(WKPageRef page, WKStringRef title, WKFrameRef frame, const void* clientInfo)
......
......@@ -144,21 +144,25 @@ void QWKPagePrivate::updateAction(QWKPage::WebAction action)
if (!a)
return;
RefPtr<WebKit::WebFrameProxy> mainFrame = page->mainFrame();
if (!mainFrame)
return;
bool enabled = a->isEnabled();
bool checked = a->isChecked();
switch (action) {
case QWKPage::Back:
page->canGoBack();
enabled = page->canGoBack();
break;
case QWKPage::Forward:
page->canGoForward();
enabled = page->canGoForward();
break;
case QWKPage::Stop:
// FIXME
enabled = !(WebFrameProxy::LoadStateFinished == mainFrame->loadState());
break;
case QWKPage::Reload:
// FIXME
enabled = (WebFrameProxy::LoadStateFinished == mainFrame->loadState());
break;
default:
break;
......@@ -171,7 +175,6 @@ void QWKPagePrivate::updateAction(QWKPage::WebAction action)
#endif // QT_NO_ACTION
}
// FIXME: hook up
void QWKPagePrivate::updateNavigationActions()
{
updateAction(QWKPage::Back);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment