summaryrefslogtreecommitdiffstats
path: root/src/webenginewidgets
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/webenginewidgets
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/webenginewidgets')
-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
7 files changed, 6 insertions, 46 deletions
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
}