summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMichal Klocek <michal.klocek@theqtcompany.com>2016-04-28 19:20:33 +0200
committerMichal Klocek <michal.klocek@theqtcompany.com>2016-05-04 08:38:09 +0000
commit0bf8a13a4d0391339bae686e199fb922b64a1dcc (patch)
tree1a5e0f3a6009cd819510e7a7b11bb2bd34ad11bb /src
parent194c357aef23bf28befe1d51b343b5ac0683f728 (diff)
Remove availableDictionaries from spellcheck api
This method is broken, since SpellcheckerService is lazily initialized and dictionaries might be not loaded yet. Moreover there is a missing implementation on mac. Instead log warning when SpellcheckService can not load dictionary. Change-Id: Ifa2e769d83307543fa6cdf529475e9ab980022f0 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@theqtcompany.com>
Diffstat (limited to 'src')
-rw-r--r--src/core/browser_context_adapter.cpp9
-rw-r--r--src/core/browser_context_qt.cpp20
-rw-r--r--src/core/browser_context_qt.h2
-rw-r--r--src/webengine/api/qquickwebengineprofile.cpp25
-rw-r--r--src/webengine/api/qquickwebengineprofile.h1
-rw-r--r--src/webenginewidgets/api/qwebengineprofile.cpp17
-rw-r--r--src/webenginewidgets/api/qwebengineprofile.h1
7 files changed, 7 insertions, 68 deletions
diff --git a/src/core/browser_context_adapter.cpp b/src/core/browser_context_adapter.cpp
index e0f933562..fe667c570 100644
--- a/src/core/browser_context_adapter.cpp
+++ b/src/core/browser_context_adapter.cpp
@@ -466,15 +466,6 @@ void BrowserContextAdapter::clearHttpCache()
m_browserContext->url_request_getter_->clearHttpCache();
}
-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)
diff --git a/src/core/browser_context_qt.cpp b/src/core/browser_context_qt.cpp
index 5b3115530..e76222d48 100644
--- a/src/core/browser_context_qt.cpp
+++ b/src/core/browser_context_qt.cpp
@@ -47,6 +47,7 @@
#include "ssl_host_state_delegate_qt.h"
#include "type_conversion.h"
#include "url_request_context_getter_qt.h"
+#include "web_engine_library_info.h"
#include "base/time/time.h"
#include "content/public/browser/browser_thread.h"
@@ -54,6 +55,7 @@
#include "net/proxy/proxy_config_service.h"
#if defined(ENABLE_SPELLCHECK)
+#include "base/base_paths.h"
#include "base/prefs/pref_member.h"
#include "base/prefs/pref_service.h"
#include "base/prefs/testing_pref_store.h"
@@ -201,22 +203,12 @@ net::URLRequestContextGetter *BrowserContextQt::CreateRequestContext(content::Pr
return url_request_getter_.get();
}
-
#if defined(ENABLE_SPELLCHECK)
-QStringList BrowserContextQt::spellCheckLanguages(const QStringList& acceptedLanguages)
+void BrowserContextQt::failedToLoadDictionary(const std::string &language)
{
- QStringList result;
-#if !defined(OS_MACOSX) // no SpellcheckService::GetSpellCheckLanguages
- m_prefService->SetString(prefs::kAcceptLanguages,acceptedLanguages.join(",").toStdString());
-
- std::vector<std::string> vec;
- SpellcheckService::GetSpellCheckLanguages(this, &vec);
-
- for (std::vector<std::string>::iterator it = vec.begin(); it != vec.end(); ++it) {
- result << QString::fromStdString(*it);
- }
-#endif
- return result;
+ Q_ASSERT(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
+ qWarning() << "Could not load dictionary for:" << toQt(language) << endl
+ << "Make sure that correct bdic file is in:" << toQt(WebEngineLibraryInfo::getPath(base::DIR_APP_DICTIONARIES).value());
}
void BrowserContextQt::setSpellCheckLanguage(const QString &language)
diff --git a/src/core/browser_context_qt.h b/src/core/browser_context_qt.h
index 08ac05fd4..e2156f147 100644
--- a/src/core/browser_context_qt.h
+++ b/src/core/browser_context_qt.h
@@ -92,7 +92,7 @@ public:
BrowserContextAdapter *adapter() { return m_adapter; }
#if defined(ENABLE_SPELLCHECK)
- QStringList spellCheckLanguages(const QStringList &acceptLanguages);
+ void failedToLoadDictionary(const std::string& language) override;
void setSpellCheckLanguage(const QString &language);
QString spellCheckLanguage() const;
void setSpellCheckEnabled(bool enabled);
diff --git a/src/webengine/api/qquickwebengineprofile.cpp b/src/webengine/api/qquickwebengineprofile.cpp
index d7a84c106..cf9d7ab2f 100644
--- a/src/webengine/api/qquickwebengineprofile.cpp
+++ b/src/webengine/api/qquickwebengineprofile.cpp
@@ -613,31 +613,6 @@ QQuickWebEngineProfile *QQuickWebEngineProfile::defaultProfile()
}
/*!
- \qmlmethod void QQuickWebEngineProfile::availableDictionaries()
-
- 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 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 languages supported by the spell checker.
- Checks whether the spell checker dictionary is installed for the specified
- 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::availableDictionaries(const QStringList &languages)
-{
- const Q_D(QQuickWebEngineProfile);
- return d->browserContext()->spellCheckLanguages(languages);
-}
-
-/*!
\property QQuickWebEngineProfile::spellCheckLanguage
\brief the language used by the spell checker.
diff --git a/src/webengine/api/qquickwebengineprofile.h b/src/webengine/api/qquickwebengineprofile.h
index 8d120d10e..273375fc6 100644
--- a/src/webengine/api/qquickwebengineprofile.h
+++ b/src/webengine/api/qquickwebengineprofile.h
@@ -131,7 +131,6 @@ public:
void clearHttpCache();
- 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);
diff --git a/src/webenginewidgets/api/qwebengineprofile.cpp b/src/webenginewidgets/api/qwebengineprofile.cpp
index 2dab0aa08..1f5912667 100644
--- a/src/webenginewidgets/api/qwebengineprofile.cpp
+++ b/src/webenginewidgets/api/qwebengineprofile.cpp
@@ -558,23 +558,6 @@ QWebEngineProfile *QWebEngineProfile::defaultProfile()
/*!
\since 5.7
- 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 languages list. If the dictionary file is missing
- or corrupted, the language is removed from the returned list.
-
- \sa setSpellCheckLanguage()
-*/
-QStringList QWebEngineProfile::availableDictionaries(const QStringList &languages)
-{
- const Q_D(QWebEngineProfile);
- return d->browserContext()->spellCheckLanguages(languages);
-}
-
-/*!
- \since 5.7
-
Sets the current \a language for the spell checker.
*/
void QWebEngineProfile::setSpellCheckLanguage(const QString &language)
diff --git a/src/webenginewidgets/api/qwebengineprofile.h b/src/webenginewidgets/api/qwebengineprofile.h
index 9c473eee9..868b4b0f5 100644
--- a/src/webenginewidgets/api/qwebengineprofile.h
+++ b/src/webenginewidgets/api/qwebengineprofile.h
@@ -121,7 +121,6 @@ public:
void clearHttpCache();
- QStringList availableDictionaries(const QStringList &languages);
void setSpellCheckLanguage(const QString &language);
QString spellCheckLanguage() const;
void setSpellCheckEnabled(bool enabled);