summaryrefslogtreecommitdiffstats
path: root/src/core/web_engine_library_info.cpp
diff options
context:
space:
mode:
authorFlorian Bruhin <git@the-compiler.org>2017-08-01 16:52:02 +0200
committerSimon Hausmann <simon.hausmann@qt.io>2017-08-04 05:55:40 +0000
commitff4b006a565f2a945903a131f46d637d8b77188e (patch)
tree55ad0167b84d175de478392f6256b0e8cb814335 /src/core/web_engine_library_info.cpp
parent6aef365a55bb4fed0c156ebc852e90ca1086c091 (diff)
Add a QTWEBENGINE_DICTIONARIES_PATH environment variable
On a Linux system with an installed application, the only places dictionaries are searched currently are /usr/bin/qtwebengine_dictionaries and /usr/share/qt/qtwebengine_dictionaries (or similar, depending on the distribution). This adds an environment variable which makes it possible to customize the location dictionaries are in (e.g. to something user-writable). Documentation is added in the next commit, as it was duplicated in four different locations and I cleaned it up a bit. [ChangeLog] New QTWEBENGINE_DICTIONARIES_PATH environment variable to customize the location for spell checking dictionaries. Task-number: QTBUG-62236 Change-Id: Iefc90451c537656025abb785291fe55f6a82d50c Reviewed-by: Kai Koehne <kai.koehne@qt.io> Reviewed-by: Michal Klocek <michal.klocek@qt.io> Reviewed-by: Viktor Engelmann <viktor.engelmann@qt.io>
Diffstat (limited to 'src/core/web_engine_library_info.cpp')
-rw-r--r--src/core/web_engine_library_info.cpp34
1 files changed, 20 insertions, 14 deletions
diff --git a/src/core/web_engine_library_info.cpp b/src/core/web_engine_library_info.cpp
index f46f8f425..35b139602 100644
--- a/src/core/web_engine_library_info.cpp
+++ b/src/core/web_engine_library_info.cpp
@@ -216,26 +216,32 @@ QString dictionariesPath()
if (!initialized) {
initialized = true;
- // First try to find dictionaries near the application.
+ const QByteArray fromEnv = qgetenv("QTWEBENGINE_DICTIONARIES_PATH");
+ if (!fromEnv.isEmpty()) {
+ // Only search in QTWEBENGINE_DICTIONARIES_PATH if set
+ candidatePaths << QString::fromLocal8Bit(fromEnv);
+ } else {
+ // First try to find dictionaries near the application.
#ifdef OS_MACOSX
- QString resourcesDictionariesPath = getMainApplicationResourcesPath()
- % QDir::separator() % QLatin1String("qtwebengine_dictionaries");
- candidatePaths << resourcesDictionariesPath;
+ QString resourcesDictionariesPath = getMainApplicationResourcesPath()
+ % QDir::separator() % QLatin1String("qtwebengine_dictionaries");
+ candidatePaths << resourcesDictionariesPath;
#endif
- QString applicationDictionariesPath = QCoreApplication::applicationDirPath()
- % QDir::separator() % QLatin1String("qtwebengine_dictionaries");
- candidatePaths << applicationDictionariesPath;
+ QString applicationDictionariesPath = QCoreApplication::applicationDirPath()
+ % QDir::separator() % QLatin1String("qtwebengine_dictionaries");
+ candidatePaths << applicationDictionariesPath;
- // Then try to find dictionaries near the installed library.
+ // Then try to find dictionaries near the installed library.
#if defined(OS_MACOSX) && defined(QT_MAC_FRAMEWORK_BUILD)
- QString frameworkDictionariesPath = getResourcesPath(frameworkBundle())
- % QLatin1String("/qtwebengine_dictionaries");
- candidatePaths << frameworkDictionariesPath;
+ QString frameworkDictionariesPath = getResourcesPath(frameworkBundle())
+ % QLatin1String("/qtwebengine_dictionaries");
+ candidatePaths << frameworkDictionariesPath;
#endif
- QString libraryDictionariesPath = QLibraryInfo::location(QLibraryInfo::DataPath)
- % QDir::separator() % QLatin1String("qtwebengine_dictionaries");
- candidatePaths << libraryDictionariesPath;
+ QString libraryDictionariesPath = QLibraryInfo::location(QLibraryInfo::DataPath)
+ % QDir::separator() % QLatin1String("qtwebengine_dictionaries");
+ candidatePaths << libraryDictionariesPath;
+ }
Q_FOREACH (const QString &candidate, candidatePaths) {
if (QFileInfo::exists(candidate)) {