summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMichal Klocek <michal.klocek@theqtcompany.com>2016-04-11 15:31:36 +0200
committerMichael BrĂ¼ning <michael.bruning@theqtcompany.com>2016-04-18 13:10:09 +0000
commit7d172fcf39fa2a5d7d5202f20c599eb678f6cb58 (patch)
tree98ece282fa13332cc52352b65f941126f0fc88d5 /src
parentee2b1e71a80f88de90a03e10a89ba491ef99d308 (diff)
Update spellchecker APIs
* marks new properties in QQuickWebEngineProfile as FINAL * removes QT_NO_SPELLCHECK from API headers * renames spellCheckLanguages() to availableDictionaries() * removes "togle spellcheck" methods and actions * use WEBENGINE_CONFIG instead of CONFIG for disable the feature at compile time: WEBENGINE_CONFIG+=no_spellcheck Done-With: Peter Varga <pvarga@inf.u-szeged.hu> Task-number: QTBUG-52371 Change-Id: I8c8eff497b9e7afe0cec2edc97dec248151487f2 Reviewed-by: Michael BrĂ¼ning <michael.bruning@theqtcompany.com>
Diffstat (limited to 'src')
-rw-r--r--src/core/browser_context_adapter.cpp18
-rw-r--r--src/core/browser_context_adapter.h3
-rw-r--r--src/core/config/linux.pri3
-rw-r--r--src/core/config/mac_osx.pri3
-rw-r--r--src/core/config/windows.pri3
-rw-r--r--src/core/gyp_run.pro8
-rw-r--r--src/core/web_contents_adapter.cpp10
-rw-r--r--src/core/web_contents_adapter.h3
-rw-r--r--src/core/web_contents_adapter_client.h4
-rw-r--r--src/webengine/api/qquickwebenginecontextmenudata.cpp4
-rw-r--r--src/webengine/api/qquickwebenginecontextmenudata_p.h6
-rw-r--r--src/webengine/api/qquickwebengineprofile.cpp16
-rw-r--r--src/webengine/api/qquickwebengineprofile.h12
-rw-r--r--src/webengine/api/qquickwebengineview.cpp15
-rw-r--r--src/webengine/api/qquickwebengineview_p.h6
-rw-r--r--src/webengine/webengine.pro5
-rw-r--r--src/webenginewidgets/api/qwebenginecontextmenudata.cpp2
-rw-r--r--src/webenginewidgets/api/qwebenginecontextmenudata.h3
-rw-r--r--src/webenginewidgets/api/qwebenginepage.cpp23
-rw-r--r--src/webenginewidgets/api/qwebenginepage.h5
-rw-r--r--src/webenginewidgets/api/qwebengineprofile.cpp10
-rw-r--r--src/webenginewidgets/api/qwebengineprofile.h4
-rw-r--r--src/webenginewidgets/webenginewidgets.pro5
23 files changed, 46 insertions, 125 deletions
diff --git a/src/core/browser_context_adapter.cpp b/src/core/browser_context_adapter.cpp
index 9980bf110..193c49e34 100644
--- a/src/core/browser_context_adapter.cpp
+++ b/src/core/browser_context_adapter.cpp
@@ -441,31 +441,45 @@ void BrowserContextAdapter::clearHttpCache()
m_browserContext->url_request_getter_->clearHttpCache();
}
-#if defined(ENABLE_SPELLCHECK)
QStringList BrowserContextAdapter::spellCheckLanguages(const QStringList &acceptLanguages)
{
+#if defined(ENABLE_SPELLCHECK)
return m_browserContext->spellCheckLanguages(acceptLanguages);
+#else
+ return QStringList();
+#endif
}
void BrowserContextAdapter::setSpellCheckLanguage(const QString &language)
{
+#if defined(ENABLE_SPELLCHECK)
m_browserContext->setSpellCheckLanguage(language);
+#endif
}
QString BrowserContextAdapter::spellCheckLanguage() const
{
+#if defined(ENABLE_SPELLCHECK)
return m_browserContext->spellCheckLanguage();
+#else
+ return QString();
+#endif
}
void BrowserContextAdapter::setSpellCheckEnabled(bool enabled)
{
+#if defined(ENABLE_SPELLCHECK)
m_browserContext->setSpellCheckEnabled(enabled);
+#endif
}
bool BrowserContextAdapter::isSpellCheckEnabled() const
{
+#if defined(ENABLE_SPELLCHECK)
return m_browserContext->isSpellCheckEnabled();
-}
+#else
+ return false;
#endif
+}
} // namespace QtWebEngineCore
diff --git a/src/core/browser_context_adapter.h b/src/core/browser_context_adapter.h
index cbdc80dac..3e1e6389c 100644
--- a/src/core/browser_context_adapter.h
+++ b/src/core/browser_context_adapter.h
@@ -107,13 +107,12 @@ public:
QString httpUserAgent() const;
void setHttpUserAgent(const QString &userAgent);
-#if defined(ENABLE_SPELLCHECK)
QStringList spellCheckLanguages(const QStringList &acceptLanguages);
void setSpellCheckLanguage(const QString &language);
QString spellCheckLanguage() const;
void setSpellCheckEnabled(bool enabled);
bool isSpellCheckEnabled() const;
-#endif
+
// KEEP IN SYNC with API or add mapping layer
enum HttpCacheType {
MemoryHttpCache = 0,
diff --git a/src/core/config/linux.pri b/src/core/config/linux.pri
index 3245888ef..8854a4bdf 100644
--- a/src/core/config/linux.pri
+++ b/src/core/config/linux.pri
@@ -29,9 +29,6 @@ use?(nss) {
use_openssl_certs=1
}
-no_spellcheck: GYP_CONFIG += enable_spellcheck=0
-else: GYP_CONFIG += enable_spellcheck=1
-
contains(QT_CONFIG, system-zlib): use?(system_minizip): GYP_CONFIG += use_system_zlib=1
contains(QT_CONFIG, system-png): GYP_CONFIG += use_system_libpng=1
contains(QT_CONFIG, system-jpeg): GYP_CONFIG += use_system_libjpeg=1
diff --git a/src/core/config/mac_osx.pri b/src/core/config/mac_osx.pri
index 01c1ca977..83ddea233 100644
--- a/src/core/config/mac_osx.pri
+++ b/src/core/config/mac_osx.pri
@@ -26,8 +26,5 @@ GYP_CONFIG += \
clang_use_chrome_plugins=0 \
enable_widevine=1
-no_spellcheck: GYP_CONFIG += enable_spellcheck=0 use_browser_spellchecker=0
-else: GYP_CONFIG += enable_spellcheck=1 use_browser_spellchecker=1
-
QMAKE_MAC_SDK_PATH = "$$eval(QMAKE_MAC_SDK.$${QMAKE_MAC_SDK}.path)"
exists($$QMAKE_MAC_SDK_PATH): GYP_CONFIG += mac_sdk_path=\"$${QMAKE_MAC_SDK_PATH}\"
diff --git a/src/core/config/windows.pri b/src/core/config/windows.pri
index 72de7055c..a99bc5303 100644
--- a/src/core/config/windows.pri
+++ b/src/core/config/windows.pri
@@ -8,9 +8,6 @@ GYP_CONFIG += \
use_ash=0 \
enable_widevine=1
-no_spellcheck: GYP_CONFIG += enable_spellcheck=0
-else: GYP_CONFIG += enable_spellcheck=1
-
# Libvpx build needs additional search path on Windows.
GYP_ARGS += "-D qtwe_chromium_obj_dir=\"$$OUT_PWD/$$getConfigDir()/obj/$${getChromiumSrcDir()}\""
diff --git a/src/core/gyp_run.pro b/src/core/gyp_run.pro
index 50b6c5112..f7fca8fa8 100644
--- a/src/core/gyp_run.pro
+++ b/src/core/gyp_run.pro
@@ -106,6 +106,14 @@ contains(WEBENGINE_CONFIG, use_appstore_compliant_code): GYP_CONFIG += appstore_
# but the latter are necessary for useful debug binaries.
contains(WEBENGINE_CONFIG, reduce_binary_size): GYP_CONFIG += release_optimize=s debug_optimize=s release_unwind_tables=0
+contains(WEBENGINE_CONFIG, no_spellcheck): {
+ GYP_CONFIG += enable_spellcheck=0
+ osx: GYP_CONFIG += use_browser_spellchecker=0
+} else {
+ GYP_CONFIG += enable_spellcheck=1
+ osx: GYP_CONFIG += use_browser_spellchecker=1
+}
+
!contains(QT_CONFIG, qt_framework): contains(QT_CONFIG, private_tests) {
GYP_CONFIG += qt_install_data=\"$$[QT_INSTALL_DATA/get]\"
GYP_CONFIG += qt_install_translations=\"$$[QT_INSTALL_TRANSLATIONS/get]\"
diff --git a/src/core/web_contents_adapter.cpp b/src/core/web_contents_adapter.cpp
index 37ad73ffe..1d937b62d 100644
--- a/src/core/web_contents_adapter.cpp
+++ b/src/core/web_contents_adapter.cpp
@@ -1201,18 +1201,14 @@ void WebContentsAdapter::initUpdateDragCursorMessagePollingTimer()
});
}
-#if defined(ENABLE_SPELLCHECK)
+
void WebContentsAdapter::replaceMisspelling(const QString &word)
{
+#if defined(ENABLE_SPELLCHECK)
Q_D(WebContentsAdapter);
d->webContents->ReplaceMisspelling(toString16(word));
-}
-
-void WebContentsAdapter::toogleSpellCheckEnabled()
-{
- browserContext()->setSpellCheckEnabled(!browserContext()->isSpellCheckEnabled());
-}
#endif
+}
WebContentsAdapterClient::RenderProcessTerminationStatus
WebContentsAdapterClient::renderProcessExitStatus(int terminationStatus) {
diff --git a/src/core/web_contents_adapter.h b/src/core/web_contents_adapter.h
index 454215359..0de1fb1d5 100644
--- a/src/core/web_contents_adapter.h
+++ b/src/core/web_contents_adapter.h
@@ -176,10 +176,7 @@ public:
// meant to be used within WebEngineCore only
content::WebContents *webContents() const;
-#if defined(ENABLE_SPELLCHECK)
void replaceMisspelling(const QString &word);
- void toogleSpellCheckEnabled();
-#endif
private:
Q_DISABLE_COPY(WebContentsAdapter)
diff --git a/src/core/web_contents_adapter_client.h b/src/core/web_contents_adapter_client.h
index 93ba2fe3e..f99cedcad 100644
--- a/src/core/web_contents_adapter_client.h
+++ b/src/core/web_contents_adapter_client.h
@@ -80,9 +80,7 @@ public:
, hasImageContent(false)
, mediaFlags(0)
, isEditable(false)
-#if defined(ENABLE_SPELLCHECK)
, isSpellCheckerEnabled(false)
-#endif
{
}
@@ -129,11 +127,9 @@ public:
uint mediaFlags;
QString suggestedFileName;
bool isEditable;
-#if defined(ENABLE_SPELLCHECK)
bool isSpellCheckerEnabled;
QString misspelledWord;
QStringList spellCheckerSuggestions;
-#endif
// Some likely candidates for future additions as we add support for the related actions:
// bool isImageBlocked;
// <enum tbd> mediaType;
diff --git a/src/webengine/api/qquickwebenginecontextmenudata.cpp b/src/webengine/api/qquickwebenginecontextmenudata.cpp
index 9fec90525..221b42245 100644
--- a/src/webengine/api/qquickwebenginecontextmenudata.cpp
+++ b/src/webengine/api/qquickwebenginecontextmenudata.cpp
@@ -170,7 +170,6 @@ bool QQuickWebEngineContextMenuData::isContentEditable() const
return d ? d->isEditable : false;
}
-#if !defined(QT_NO_SPELLCHECK)
/*!
\qmlproperty QString WebEngineDownloadItem::misspelledWord
@@ -194,7 +193,6 @@ QStringList QQuickWebEngineContextMenuData::spellCheckerSuggestions() const
return d->spellCheckerSuggestions;
return QStringList();
}
-#endif
void QQuickWebEngineContextMenuData::update(const QtWebEngineCore::WebEngineContextMenuData &update)
{
@@ -225,13 +223,11 @@ void QQuickWebEngineContextMenuData::update(const QtWebEngineCore::WebEngineCont
if (isContentEditable() != old.isContentEditable())
Q_EMIT isContentEditableChanged();
-#if !defined(QT_NO_SPELLCHECK)
if (misspelledWord() != old.misspelledWord())
Q_EMIT misspelledWordChanged();
if (spellCheckerSuggestions() != old.spellCheckerSuggestions())
Q_EMIT spellCheckerSuggestionsChanged();
-#endif
}
QQuickWebEngineContextMenuData::QQuickWebEngineContextMenuData(const QQuickWebEngineContextMenuDataPrivate *p, QObject *parent)
diff --git a/src/webengine/api/qquickwebenginecontextmenudata_p.h b/src/webengine/api/qquickwebenginecontextmenudata_p.h
index 162c28662..0989eaa5a 100644
--- a/src/webengine/api/qquickwebenginecontextmenudata_p.h
+++ b/src/webengine/api/qquickwebenginecontextmenudata_p.h
@@ -92,10 +92,8 @@ public:
Q_PROPERTY(QUrl mediaUrl READ mediaUrl NOTIFY mediaUrlChanged)
Q_PROPERTY(MediaType mediaType READ mediaType NOTIFY mediaTypeChanged)
Q_PROPERTY(bool isContentEditable READ isContentEditable NOTIFY isContentEditableChanged)
-#if !defined(QT_NO_SPELLCHECK)
Q_PROPERTY(QString misspelledWord READ misspelledWord NOTIFY misspelledWordChanged)
Q_PROPERTY(QStringList spellCheckerSuggestions READ spellCheckerSuggestions NOTIFY spellCheckerSuggestionsChanged)
-#endif
bool isValid() const;
@@ -107,10 +105,8 @@ public:
MediaType mediaType() const;
bool isContentEditable() const;
-#if !defined(QT_NO_SPELLCHECK)
QString misspelledWord() const;
QStringList spellCheckerSuggestions() const;
-#endif
Q_SIGNALS:
void isValidChanged();
@@ -121,10 +117,8 @@ Q_SIGNALS:
void mediaUrlChanged();
void mediaTypeChanged();
void isContentEditableChanged();
-#if !defined(QT_NO_SPELLCHECK)
void misspelledWordChanged();
void spellCheckerSuggestionsChanged();
-#endif
private:
void update(const QtWebEngineCore::WebEngineContextMenuData &update);
diff --git a/src/webengine/api/qquickwebengineprofile.cpp b/src/webengine/api/qquickwebengineprofile.cpp
index 3873bc9c5..f38422966 100644
--- a/src/webengine/api/qquickwebengineprofile.cpp
+++ b/src/webengine/api/qquickwebengineprofile.cpp
@@ -612,30 +612,29 @@ QQuickWebEngineProfile *QQuickWebEngineProfile::defaultProfile()
return profile;
}
-#if !defined(QT_NO_SPELLCHECK)
/*!
- \qmlmethod void QQuickWebEngineProfile::spellCheckLanguages()
+ \qmlmethod void QQuickWebEngineProfile::availableDictionaries()
- Returns the subset of \a acceptLanguages supported by the spell checker.
+ Returns the subset of \a languages supported by the spell checker.
Checks whether the spell checker dictionary is installed for the specified
- language from the \a acceptLanguages list. If the dictionary file is missing
+ language from the \a languages list. If the dictionary file is missing
or corrupted, the language is removed from the returned list.
\since QtWebEngine 1.3
*/
/*!
- Returns the subset of \a acceptLanguages supported by the spell checker.
+ Returns the subset of \a languages supported by the spell checker.
Checks whether the spell checker dictionary is installed for the specified
- language from the \a acceptLanguages list. If the dictionary file is missing
+ language from the \a languages list. If the dictionary file is missing
or corrupted, the language is removed from the returned list.
\since QtWebEngine 1.3
*/
-QStringList QQuickWebEngineProfile::spellCheckLanguages(const QStringList &acceptLanguages)
+QStringList QQuickWebEngineProfile::availableDictionaries(const QStringList &languages)
{
const Q_D(QQuickWebEngineProfile);
- return d->browserContext()->spellCheckLanguages(acceptLanguages);
+ return d->browserContext()->spellCheckLanguages(languages);
}
/*!
@@ -700,7 +699,6 @@ bool QQuickWebEngineProfile::isSpellCheckEnabled() const
const Q_D(QQuickWebEngineProfile);
return d->browserContext()->isSpellCheckEnabled();
}
-#endif
/*!
diff --git a/src/webengine/api/qquickwebengineprofile.h b/src/webengine/api/qquickwebengineprofile.h
index cf4334126..8d120d10e 100644
--- a/src/webengine/api/qquickwebengineprofile.h
+++ b/src/webengine/api/qquickwebengineprofile.h
@@ -71,10 +71,8 @@ class Q_WEBENGINE_EXPORT QQuickWebEngineProfile : public QObject {
Q_PROPERTY(QString httpAcceptLanguage READ httpAcceptLanguage WRITE setHttpAcceptLanguage NOTIFY httpAcceptLanguageChanged FINAL REVISION 1)
Q_PROPERTY(PersistentCookiesPolicy persistentCookiesPolicy READ persistentCookiesPolicy WRITE setPersistentCookiesPolicy NOTIFY persistentCookiesPolicyChanged FINAL)
Q_PROPERTY(int httpCacheMaximumSize READ httpCacheMaximumSize WRITE setHttpCacheMaximumSize NOTIFY httpCacheMaximumSizeChanged FINAL)
-#if !defined(QT_NO_SPELLCHECK)
- Q_PROPERTY(QString spellCheckLanguage READ spellCheckLanguage WRITE setSpellCheckLanguage NOTIFY spellCheckLanguageChanged REVISION 2)
- Q_PROPERTY(bool spellCheckEnabled READ isSpellCheckEnabled WRITE setSpellCheckEnabled NOTIFY spellCheckEnabledChanged REVISION 2)
-# endif
+ Q_PROPERTY(QString spellCheckLanguage READ spellCheckLanguage WRITE setSpellCheckLanguage NOTIFY spellCheckLanguageChanged FINAL REVISION 2)
+ Q_PROPERTY(bool spellCheckEnabled READ isSpellCheckEnabled WRITE setSpellCheckEnabled NOTIFY spellCheckEnabledChanged FINAL REVISION 2)
public:
QQuickWebEngineProfile(QObject *parent = Q_NULLPTR);
@@ -133,13 +131,11 @@ public:
void clearHttpCache();
-#if !defined(QT_NO_SPELLCHECK)
- Q_REVISION(2) Q_INVOKABLE QStringList spellCheckLanguages(const QStringList &acceptLanguages);
+ Q_REVISION(2) Q_INVOKABLE QStringList availableDictionaries(const QStringList &languages);
Q_REVISION(2) void setSpellCheckLanguage(const QString &language);
Q_REVISION(2) QString spellCheckLanguage() const;
Q_REVISION(2) void setSpellCheckEnabled(bool enabled);
Q_REVISION(2) bool isSpellCheckEnabled() const;
-# endif
static QQuickWebEngineProfile *defaultProfile();
@@ -153,10 +149,8 @@ Q_SIGNALS:
void persistentCookiesPolicyChanged();
void httpCacheMaximumSizeChanged();
Q_REVISION(1) void httpAcceptLanguageChanged();
-#if !defined(QT_NO_SPELLCHECK)
Q_REVISION(2) void spellCheckLanguageChanged();
Q_REVISION(2) void spellCheckEnabledChanged();
-#endif
void downloadRequested(QQuickWebEngineDownloadItem *download);
void downloadFinished(QQuickWebEngineDownloadItem *download);
diff --git a/src/webengine/api/qquickwebengineview.cpp b/src/webengine/api/qquickwebengineview.cpp
index b33654788..9296cc4dd 100644
--- a/src/webengine/api/qquickwebengineview.cpp
+++ b/src/webengine/api/qquickwebengineview.cpp
@@ -199,7 +199,6 @@ bool QQuickWebEngineViewPrivate::contextMenuRequested(const WebEngineContextMenu
// Populate our menu
MenuItemHandler *item = 0;
-#if !defined(QT_NO_SPELLCHECK)
if (contextMenuData.isContentEditable() && !contextMenuData.spellCheckerSuggestions().isEmpty()) {
const QPointer<QQuickWebEngineView> qRef(q);
for (int i=0; i < contextMenuData.spellCheckerSuggestions().count() && i < 4; i++) {
@@ -210,7 +209,6 @@ bool QQuickWebEngineViewPrivate::contextMenuRequested(const WebEngineContextMenu
}
ui()->addMenuSeparator(menu);
}
-#endif
if (!data.linkText.isEmpty() && data.linkUrl.isValid()) {
item = new MenuItemHandler(menu);
QObject::connect(item, &MenuItemHandler::triggered, [q] { q->triggerWebAction(QQuickWebEngineView::OpenLinkInThisWindow); });
@@ -305,13 +303,7 @@ bool QQuickWebEngineViewPrivate::contextMenuRequested(const WebEngineContextMenu
QObject::connect(item, &MenuItemHandler::triggered, [q] { q->triggerWebAction(QQuickWebEngineView::ExitFullScreen); });
ui()->addMenuItem(item, QQuickWebEngineView::tr("Exit Full Screen Mode"));
}
-#if !defined(QT_NO_SPELLCHECK)
- if (data.isEditable) {
- item = new MenuItemHandler(menu);
- QObject::connect(item, &MenuItemHandler::triggered, [q] { q->triggerWebAction(QQuickWebEngineView::ToggleSpellcheck); });
- ui()->addMenuItem(item, QQuickWebEngineView::tr("Check Spelling"), QString(), true, true, data.isSpellCheckerEnabled);
- }
-#endif
+
// FIXME: expose the context menu data as an attached property to make this more useful
if (contextMenuExtraItems) {
ui()->addMenuSeparator(menu);
@@ -1584,11 +1576,6 @@ void QQuickWebEngineView::triggerWebAction(WebAction action)
case SavePage:
d->adapter->save();
break;
-#if !defined(QT_NO_SPELLCHECK)
- case ToggleSpellcheck:
- d->adapter->toogleSpellCheckEnabled();
- break;
-#endif
default:
Q_UNREACHABLE();
}
diff --git a/src/webengine/api/qquickwebengineview_p.h b/src/webengine/api/qquickwebengineview_p.h
index 2a4563d70..8015820b7 100644
--- a/src/webengine/api/qquickwebengineview_p.h
+++ b/src/webengine/api/qquickwebengineview_p.h
@@ -241,9 +241,6 @@ public:
RequestClose,
Unselect,
SavePage,
-#if !defined(QT_NO_SPELLCHECK)
- ToggleSpellcheck,
-#endif
WebActionCount
};
Q_ENUM(WebAction)
@@ -473,10 +470,7 @@ public Q_SLOTS:
Q_REVISION(2) void triggerWebAction(WebAction action);
Q_REVISION(3) void printToPdf(const QString &filePath, PrintedPageSizeId pageSizeId = PrintedPageSizeId::A4, PrintedPageOrientation orientation = PrintedPageOrientation::Portrait);
Q_REVISION(3) void printToPdf(const QJSValue &callback, PrintedPageSizeId pageSizeId = PrintedPageSizeId::A4, PrintedPageOrientation orientation = PrintedPageOrientation::Portrait);
-
-#if !defined(QT_NO_SPELLCHECK)
Q_REVISION(3) void replaceMisspelledWord(const QString &replacement);
-#endif
private Q_SLOTS:
void lazyInitialize();
diff --git a/src/webengine/webengine.pro b/src/webengine/webengine.pro
index 9ec0db5cb..e4b274a82 100644
--- a/src/webengine/webengine.pro
+++ b/src/webengine/webengine.pro
@@ -57,10 +57,7 @@ isQMLTestSupportApiEnabled() {
DEFINES += ENABLE_QML_TESTSUPPORT_API
}
-no_spellcheck {
- DEFINES += QT_NO_SPELLCHECK
- MODULE_DEFINES += QT_NO_SPELLCHECK
-} else {
+!contains(WEBENGINE_CONFIG, no_spellcheck) {
DEFINES += ENABLE_SPELLCHECK
}
diff --git a/src/webenginewidgets/api/qwebenginecontextmenudata.cpp b/src/webenginewidgets/api/qwebenginecontextmenudata.cpp
index ae24016f6..17a562ea1 100644
--- a/src/webenginewidgets/api/qwebenginecontextmenudata.cpp
+++ b/src/webenginewidgets/api/qwebenginecontextmenudata.cpp
@@ -186,7 +186,6 @@ bool QWebEngineContextMenuData::isContentEditable() const
return d ? d->isEditable : false;
}
-#if !defined(QT_NO_SPELLCHECK)
/*!
If the context is a word considered misspelled by the spell-checker, returns the misspelled word.
*/
@@ -206,7 +205,6 @@ QStringList QWebEngineContextMenuData::spellCheckerSuggestions() const
return d->spellCheckerSuggestions;
return QStringList();
}
-#endif
/*!
\internal
diff --git a/src/webenginewidgets/api/qwebenginecontextmenudata.h b/src/webenginewidgets/api/qwebenginecontextmenudata.h
index 44f1def94..fd1080eec 100644
--- a/src/webenginewidgets/api/qwebenginecontextmenudata.h
+++ b/src/webenginewidgets/api/qwebenginecontextmenudata.h
@@ -76,11 +76,8 @@ public:
QUrl mediaUrl() const;
MediaType mediaType() const;
bool isContentEditable() const;
-
-#if !defined(QT_NO_SPELLCHECK)
QString misspelledWord() const;
QStringList spellCheckerSuggestions() const;
-#endif
private:
void reset();
diff --git a/src/webenginewidgets/api/qwebenginepage.cpp b/src/webenginewidgets/api/qwebenginepage.cpp
index 00dffa3a2..8ba6c8770 100644
--- a/src/webenginewidgets/api/qwebenginepage.cpp
+++ b/src/webenginewidgets/api/qwebenginepage.cpp
@@ -896,11 +896,6 @@ QAction *QWebEnginePage::action(WebAction action) const
case SavePage:
text = tr("Save &Page");
break;
-#if !defined(QT_NO_SPELLCHECK)
- case ToggleSpellcheck:
- text = tr("Check Spelling");
- break;
-#endif
default:
break;
}
@@ -1089,17 +1084,11 @@ void QWebEnginePage::triggerAction(WebAction action, bool)
case SavePage:
d->adapter->save();
break;
-#if !defined(QT_NO_SPELLCHECK)
- case ToggleSpellcheck:
- d->adapter->toogleSpellCheckEnabled();
- break;
-#endif
default:
Q_UNREACHABLE();
}
}
-#if !defined(QT_NO_SPELLCHECK)
/*!
* \since 5.7
* Replace the current misspelled word with \a replacement.
@@ -1115,7 +1104,6 @@ void QWebEnginePage::replaceMisspelledWord(const QString &replacement)
Q_D(QWebEnginePage);
d->adapter->replaceMisspelling(replacement);
}
-#endif
void QWebEnginePage::findText(const QString &subString, FindFlags options, const QWebEngineCallback<bool> &resultCallback)
{
@@ -1298,7 +1286,6 @@ QMenu *QWebEnginePage::createStandardContextMenu()
QAction *action = 0;
const WebEngineContextMenuData &contextMenuData = *d->contextData.d;
-#if !defined(QT_NO_SPELLCHECK)
if (contextMenuData.isEditable && !contextMenuData.spellCheckerSuggestions.isEmpty()) {
QPointer<QWebEnginePage> thisRef(this);
for (int i=0; i < contextMenuData.spellCheckerSuggestions.count() && i < 4; i++) {
@@ -1310,7 +1297,6 @@ QMenu *QWebEnginePage::createStandardContextMenu()
}
menu->addSeparator();
}
-#endif
if (!contextMenuData.linkText.isEmpty() && contextMenuData.linkUrl.isValid()) {
action = QWebEnginePage::action(OpenLinkInThisWindow);
@@ -1374,15 +1360,6 @@ QMenu *QWebEnginePage::createStandardContextMenu()
if (d->isFullScreenMode())
menu->addAction(QWebEnginePage::action(ExitFullScreen));
-#if !defined(QT_NO_SPELLCHECK)
- if (contextMenuData.isEditable) {
- QAction* spellcheckAction(QWebEnginePage::action(ToggleSpellcheck));
- menu->addAction(spellcheckAction);
- spellcheckAction->setCheckable(true);
- spellcheckAction->setChecked(contextMenuData.isSpellCheckerEnabled);
- }
-#endif
-
return menu;
}
diff --git a/src/webenginewidgets/api/qwebenginepage.h b/src/webenginewidgets/api/qwebenginepage.h
index 66d634c77..7b99270c0 100644
--- a/src/webenginewidgets/api/qwebenginepage.h
+++ b/src/webenginewidgets/api/qwebenginepage.h
@@ -123,9 +123,6 @@ public:
Unselect,
SavePage,
OpenLinkInNewBackgroundTab,
-#if !defined(QT_NO_SPELLCHECK)
- ToggleSpellcheck,
-#endif
WebActionCount
};
@@ -209,9 +206,7 @@ public:
#endif
virtual void triggerAction(WebAction action, bool checked = false);
-#if !defined(QT_NO_SPELLCHECK)
void replaceMisspelledWord(const QString &replacement);
-#endif
virtual bool event(QEvent*);
#ifdef Q_QDOC
diff --git a/src/webenginewidgets/api/qwebengineprofile.cpp b/src/webenginewidgets/api/qwebengineprofile.cpp
index 22d4d088f..3a2254427 100644
--- a/src/webenginewidgets/api/qwebengineprofile.cpp
+++ b/src/webenginewidgets/api/qwebengineprofile.cpp
@@ -555,22 +555,21 @@ QWebEngineProfile *QWebEngineProfile::defaultProfile()
return profile;
}
-#if !defined(QT_NO_SPELLCHECK)
/*!
\since 5.7
- Returns the subset of \a acceptLanguages supported by the spell checker.
+ Returns the subset of \a languages supported by the spell checker.
Checks whether the spell checker dictionary is installed for the specified
- language from the \a acceptLanguages list. If the dictionary file is missing
+ language from the \a languages list. If the dictionary file is missing
or corrupted, the language is removed from the returned list.
\sa setSpellCheckLanguage()
*/
-QStringList QWebEngineProfile::spellCheckLanguages(const QStringList &acceptLanguages)
+QStringList QWebEngineProfile::availableDictionaries(const QStringList &languages)
{
const Q_D(QWebEngineProfile);
- return d->browserContext()->spellCheckLanguages(acceptLanguages);
+ return d->browserContext()->spellCheckLanguages(languages);
}
/*!
@@ -617,7 +616,6 @@ bool QWebEngineProfile::isSpellCheckEnabled() const
const Q_D(QWebEngineProfile);
return d->browserContext()->isSpellCheckEnabled();
}
-#endif
/*!
Returns the default settings for all pages in this profile.
diff --git a/src/webenginewidgets/api/qwebengineprofile.h b/src/webenginewidgets/api/qwebengineprofile.h
index 1a9bfe43a..9c473eee9 100644
--- a/src/webenginewidgets/api/qwebengineprofile.h
+++ b/src/webenginewidgets/api/qwebengineprofile.h
@@ -121,13 +121,11 @@ public:
void clearHttpCache();
-#if !defined(QT_NO_SPELLCHECK)
- QStringList spellCheckLanguages(const QStringList &acceptLanguages);
+ QStringList availableDictionaries(const QStringList &languages);
void setSpellCheckLanguage(const QString &language);
QString spellCheckLanguage() const;
void setSpellCheckEnabled(bool enabled);
bool isSpellCheckEnabled() const;
-#endif
static QWebEngineProfile *defaultProfile();
diff --git a/src/webenginewidgets/webenginewidgets.pro b/src/webenginewidgets/webenginewidgets.pro
index e3f02433c..cd9a2d10b 100644
--- a/src/webenginewidgets/webenginewidgets.pro
+++ b/src/webenginewidgets/webenginewidgets.pro
@@ -48,10 +48,7 @@ HEADERS = \
DEFINES += QT_UI_DELEGATES
}
-no_spellcheck {
- DEFINES += QT_NO_SPELLCHECK
- MODULE_DEFINES += QT_NO_SPELLCHECK
-} else {
+!contains(WEBENGINE_CONFIG, no_spellcheck) {
DEFINES += ENABLE_SPELLCHECK
}