2011-01-04 Benjamin Poulain <benjamin.poulain@nokia.com>

        Reviewed by Kenneth Rohde Christiansen.

        [Qt] [WK2] Add support for non-trivial context menu action
        https://bugs.webkit.org/show_bug.cgi?id=51902

        Fix the preprocessor guard for ContextMenuItemTagSelectAll in
        the implementation of ContextMenuController::contextMenuItemSelected(). The guard was
        inconsistent with what is defined in ContextMenuItem.h.

        * page/ContextMenuController.cpp:
        (WebCore::ContextMenuController::contextMenuItemSelected):
2011-01-04  Benjamin Poulain  <benjamin.poulain@nokia.com>

        Reviewed by Kenneth Rohde Christiansen.

        [Qt] [WK2] Add support for non-trivial context menu action
        https://bugs.webkit.org/show_bug.cgi?id=51902

        Implement a call back from the QAction triggered in the UIProcess to the
        action in WebProcess.

        A few basic actions have been implemented based on this feature.

        * UIProcess/API/qt/qwkpage.cpp:
        (contextMenuActionForWebAction):
        (QWKPage::triggerAction):
        (QWKPage::action):
        * UIProcess/API/qt/qwkpage.h:
        * UIProcess/qt/WebContextMenuProxyQt.cpp:
        (WebKit::webActionForContextMenuAction):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@75047 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 999eac1b
2011-01-04 Benjamin Poulain <benjamin.poulain@nokia.com>
Reviewed by Kenneth Rohde Christiansen.
[Qt] [WK2] Add support for non-trivial context menu action
https://bugs.webkit.org/show_bug.cgi?id=51902
Fix the preprocessor guard for ContextMenuItemTagSelectAll in
the implementation of ContextMenuController::contextMenuItemSelected(). The guard was
inconsistent with what is defined in ContextMenuItem.h.
* page/ContextMenuController.cpp:
(WebCore::ContextMenuController::contextMenuItemSelected):
2011-01-04 Tony Gentilcore <tonyg@chromium.org>
Reviewed by Ryosuke Niwa.
......
......@@ -262,6 +262,8 @@ void ContextMenuController::contextMenuItemSelected(ContextMenuItem* item)
case ContextMenuItemTagDelete:
frame->editor()->performDelete();
break;
#endif
#if PLATFORM(GTK) || PLATFORM(QT)
case ContextMenuItemTagSelectAll:
frame->editor()->command("SelectAll").execute();
break;
......
2011-01-04 Benjamin Poulain <benjamin.poulain@nokia.com>
Reviewed by Kenneth Rohde Christiansen.
[Qt] [WK2] Add support for non-trivial context menu action
https://bugs.webkit.org/show_bug.cgi?id=51902
Implement a call back from the QAction triggered in the UIProcess to the
action in WebProcess.
A few basic actions have been implemented based on this feature.
* UIProcess/API/qt/qwkpage.cpp:
(contextMenuActionForWebAction):
(QWKPage::triggerAction):
(QWKPage::action):
* UIProcess/API/qt/qwkpage.h:
* UIProcess/qt/WebContextMenuProxyQt.cpp:
(WebKit::webActionForContextMenuAction):
2011-01-04 Siddharth Mathur <siddharth.mathur@nokia.com>
Reviewed by Laszlo Gombos.
......@@ -53,6 +53,32 @@
using namespace WebKit;
using namespace WebCore;
static WebCore::ContextMenuAction contextMenuActionForWebAction(QWKPage::WebAction action)
{
switch (action) {
case QWKPage::OpenLink:
return WebCore::ContextMenuItemTagOpenLink;
case QWKPage::OpenLinkInNewWindow:
return WebCore::ContextMenuItemTagOpenLinkInNewWindow;
case QWKPage::CopyLinkToClipboard:
return WebCore::ContextMenuItemTagCopyLinkToClipboard;
case QWKPage::OpenImageInNewWindow:
return WebCore::ContextMenuItemTagOpenImageInNewWindow;
case QWKPage::Cut:
return WebCore::ContextMenuItemTagCut;
case QWKPage::Copy:
return WebCore::ContextMenuItemTagCopy;
case QWKPage::Paste:
return WebCore::ContextMenuItemTagPaste;
case QWKPage::SelectAll:
return WebCore::ContextMenuItemTagSelectAll;
default:
ASSERT(false);
break;
}
return WebCore::ContextMenuItemTagNoAction;
}
QWKPagePrivate::QWKPagePrivate(QWKPage* qq, QWKContext* c)
: q(qq)
, context(c)
......@@ -556,24 +582,28 @@ void QWKPage::setResizesToContentsUsingLayoutSize(const QSize& targetLayoutSize)
}
#ifndef QT_NO_ACTION
void QWKPage::triggerAction(WebAction action, bool)
void QWKPage::triggerAction(WebAction webAction, bool)
{
switch (action) {
switch (webAction) {
case Back:
d->page->goBack();
break;
return;
case Forward:
d->page->goForward();
break;
return;
case Stop:
d->page->stopLoading();
break;
return;
case Reload:
d->page->reload(/* reloadFromOrigin */ true);
break;
return;
default:
break;
}
QAction* qtAction = action(webAction);
WebKit::WebContextMenuItemData menuItemData(ActionType, contextMenuActionForWebAction(webAction), qtAction->text(), qtAction->isEnabled(), qtAction->isChecked());
d->page->contextMenuItemSelected(menuItemData);
}
#endif // QT_NO_ACTION
......@@ -592,6 +622,18 @@ QAction* QWKPage::action(WebAction action) const
bool checkable = false;
switch (action) {
case OpenLink:
text = contextMenuItemTagOpenLink();
break;
case OpenLinkInNewWindow:
text = contextMenuItemTagOpenLinkInNewWindow();
break;
case CopyLinkToClipboard:
text = contextMenuItemTagCopyLinkToClipboard();
break;
case OpenImageInNewWindow:
text = contextMenuItemTagOpenImageInNewWindow();
break;
case Back:
text = contextMenuItemTagGoBack();
icon = style->standardIcon(QStyle::SP_ArrowBack);
......@@ -608,6 +650,18 @@ QAction* QWKPage::action(WebAction action) const
text = contextMenuItemTagReload();
icon = style->standardIcon(QStyle::SP_BrowserReload);
break;
case Cut:
text = contextMenuItemTagCut();
break;
case Copy:
text = contextMenuItemTagCopy();
break;
case Paste:
text = contextMenuItemTagPaste();
break;
case SelectAll:
text = contextMenuItemTagSelectAll();
break;
default:
return 0;
break;
......
......@@ -28,11 +28,21 @@ public:
enum WebAction {
NoWebAction = - 1,
OpenLink,
OpenLinkInNewWindow,
CopyLinkToClipboard,
OpenImageInNewWindow,
Back,
Forward,
Stop,
Reload,
Cut,
Copy,
Paste,
SelectAll,
WebActionCount
};
......
......@@ -38,6 +38,14 @@ namespace WebKit {
static QWKPage::WebAction webActionForContextMenuAction(WebCore::ContextMenuAction action)
{
switch (action) {
case WebCore::ContextMenuItemTagOpenLink:
return QWKPage::OpenLink;
case WebCore::ContextMenuItemTagOpenLinkInNewWindow:
return QWKPage::OpenLinkInNewWindow;
case WebCore::ContextMenuItemTagCopyLinkToClipboard:
return QWKPage::CopyLinkToClipboard;
case WebCore::ContextMenuItemTagOpenImageInNewWindow:
return QWKPage::OpenImageInNewWindow;
case WebCore::ContextMenuItemTagGoBack:
return QWKPage::Back;
case WebCore::ContextMenuItemTagGoForward:
......@@ -46,6 +54,14 @@ static QWKPage::WebAction webActionForContextMenuAction(WebCore::ContextMenuActi
return QWKPage::Stop;
case WebCore::ContextMenuItemTagReload:
return QWKPage::Reload;
case WebCore::ContextMenuItemTagCut:
return QWKPage::Cut;
case WebCore::ContextMenuItemTagCopy:
return QWKPage::Copy;
case WebCore::ContextMenuItemTagPaste:
return QWKPage::Paste;
case WebCore::ContextMenuItemTagSelectAll:
return QWKPage::SelectAll;
default:
break;
}
......
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