webkitchatcontainer: enable context-menu for copy/paste.
Remove the restriction on the context-menu event for the webview to
allow users to copy/paste text from the chatview.
Change-Id: I52cab8eccb018662877818d37d0387b5c54acb70
diff --git a/src/webkitchatcontainer.cpp b/src/webkitchatcontainer.cpp
index 6aa92e9..4ede3b1 100644
--- a/src/webkitchatcontainer.cpp
+++ b/src/webkitchatcontainer.cpp
@@ -120,10 +120,27 @@
}
static gboolean
-webview_chat_context_menu(WebKitChatContainer *self)
+webview_chat_context_menu(WebKitChatContainer *self,
+ WebKitContextMenu *menu,
+ GdkEvent *event,
+ WebKitHitTestResult *hit_test_result,
+ gpointer user_data)
{
- WebKitChatContainerPrivate *priv = WEBKIT_CHAT_CONTAINER_GET_PRIVATE(self);
- return !priv->chatview_debug;
+ GList *items, *nextList;
+ for (items = webkit_context_menu_get_items(menu) ; items ; items = nextList) {
+ WebKitContextMenuAction action;
+ nextList = items->next;
+ auto item = (WebKitContextMenuItem*)items->data;
+ action = webkit_context_menu_item_get_stock_action(item);
+
+ if (action == WEBKIT_CONTEXT_MENU_ACTION_RELOAD ||
+ action == WEBKIT_CONTEXT_MENU_ACTION_GO_FORWARD ||
+ action == WEBKIT_CONTEXT_MENU_ACTION_GO_BACK ||
+ action == WEBKIT_CONTEXT_MENU_ACTION_STOP) {
+ webkit_context_menu_remove(menu, item);
+ }
+ }
+ return false;
}
QString