summaryrefslogtreecommitdiffstats
path: root/src/core
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@theqtcompany.com>2016-02-12 11:22:41 +0100
committerAllan Sandfeld Jensen <allan.jensen@theqtcompany.com>2016-03-30 12:35:46 +0000
commit6454b6b2d0f2fbb8d140fa2555af7867964748ce (patch)
treee2d209aa02aca0bbc93fd58379524acc69e8b544 /src/core
parent3e30c0a33e301bb993efc7a046a34c8cbc68ca58 (diff)
Add API for context menu data
For QWebEnginePage users to be able to make custom context menu or extend the default context menu, they need information about the context. This patch adds a QWebEngineContextMenuData class that contains contextual information when a context menu is being requested. This is also means we can finally generate a custom context-menu in the demobrowser the same way we did in QtWebKit. Task-number: QTBUG-51079 Change-Id: I695b8cbf648bdc7f119b0ed51ab685cf2f8de8e4 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@theqtcompany.com>
Diffstat (limited to 'src/core')
-rw-r--r--src/core/web_contents_adapter_client.h6
-rw-r--r--src/core/web_contents_view_qt.cpp4
2 files changed, 5 insertions, 5 deletions
diff --git a/src/core/web_contents_adapter_client.h b/src/core/web_contents_adapter_client.h
index 9d2054859..559898411 100644
--- a/src/core/web_contents_adapter_client.h
+++ b/src/core/web_contents_adapter_client.h
@@ -79,8 +79,8 @@ public:
: mediaType(MediaTypeNone)
, hasImageContent(false)
, mediaFlags(0)
-#if defined(ENABLE_SPELLCHECK)
, isEditable(false)
+#if defined(ENABLE_SPELLCHECK)
, isSpellCheckerEnabled(false)
#endif
{
@@ -128,8 +128,8 @@ public:
bool hasImageContent;
uint mediaFlags;
QString suggestedFileName;
-#if defined(ENABLE_SPELLCHECK)
bool isEditable;
+#if defined(ENABLE_SPELLCHECK)
bool isSpellCheckerEnabled;
QString misspelledWord;
QStringList spellCheckerSuggestions;
@@ -226,7 +226,7 @@ public:
virtual bool isBeingAdopted() = 0;
virtual void close() = 0;
virtual void windowCloseRejected() = 0;
- virtual bool contextMenuRequested(const WebEngineContextMenuData&) = 0;
+ virtual bool contextMenuRequested(const WebEngineContextMenuData &) = 0;
virtual void navigationRequested(int navigationType, const QUrl &url, int &navigationRequestAction, bool isMainFrame) = 0;
virtual void requestFullScreenMode(const QUrl &origin, bool fullscreen) = 0;
virtual bool isFullScreenMode() const = 0;
diff --git a/src/core/web_contents_view_qt.cpp b/src/core/web_contents_view_qt.cpp
index 370f1e78f..1d39d8af8 100644
--- a/src/core/web_contents_view_qt.cpp
+++ b/src/core/web_contents_view_qt.cpp
@@ -150,7 +150,7 @@ ASSERT_ENUMS_MATCH(WebEngineContextMenuData::MediaControls, blink::WebContextMen
ASSERT_ENUMS_MATCH(WebEngineContextMenuData::MediaCanPrint, blink::WebContextMenuData::MediaCanPrint)
ASSERT_ENUMS_MATCH(WebEngineContextMenuData::MediaCanRotate, blink::WebContextMenuData::MediaCanRotate)
-static WebEngineContextMenuData fromParams(const content::ContextMenuParams &params)
+static inline WebEngineContextMenuData fromParams(const content::ContextMenuParams &params)
{
WebEngineContextMenuData ret;
ret.pos = QPoint(params.x, params.y);
@@ -162,8 +162,8 @@ static WebEngineContextMenuData fromParams(const content::ContextMenuParams &par
ret.hasImageContent = params.has_image_contents;
ret.mediaFlags = params.media_flags;
ret.suggestedFileName = toQt(params.suggested_filename.data());
-#if defined(ENABLE_SPELLCHECK)
ret.isEditable = params.is_editable;
+#if defined(ENABLE_SPELLCHECK)
ret.misspelledWord = toQt(params.misspelled_word);
ret.spellCheckerSuggestions = fromVector(params.dictionary_suggestions);
#endif