1
mirror of https://invent.kde.org/network/falkon.git synced 2024-12-19 18:26:34 +01:00

Look for dictionaries at QTWEBENGINE_DICTIONARIES_PATH env var

BUG: 465094
FIXED-IN: 23.04.0

Signed-off-by: Juraj Oravec <jurajoravec@mailo.com>
This commit is contained in:
Juraj Oravec 2023-02-03 00:40:12 +01:00
parent 624b227ec0
commit 2b9e94a97d

View File

@ -429,15 +429,20 @@ Preferences::Preferences(BrowserWindow* window)
updateSpellCheckEnabled();
connect(ui->spellcheckEnabled, &QCheckBox::toggled, this, updateSpellCheckEnabled);
QStringList dictionariesDirs = {
QStringList dictionariesDirs = {};
const QByteArray qtWeDictionariesDirs = qgetenv("QTWEBENGINE_DICTIONARIES_PATH");
if (!qtWeDictionariesDirs.isNull()) {
dictionariesDirs.append(QDir::cleanPath(QString::fromLocal8Bit(qtWeDictionariesDirs)));
}
else {
#ifdef Q_OS_OSX
QDir::cleanPath(QCoreApplication::applicationDirPath() + QL1S("/../Resources/qtwebengine_dictionaries")),
QDir::cleanPath(QCoreApplication::applicationDirPath() + QL1S("/../Frameworks/QtWebEngineCore.framework/Resources/qtwebengine_dictionaries"))
dictionariesDirs.append(QDir::cleanPath(QCoreApplication::applicationDirPath() + QL1S("/../Resources/qtwebengine_dictionaries")));
dictionariesDirs.append(QDir::cleanPath(QCoreApplication::applicationDirPath() + QL1S("/../Frameworks/QtWebEngineCore.framework/Resources/qtwebengine_dictionaries")));
#else
QDir::cleanPath(QCoreApplication::applicationDirPath() + QL1S("/qtwebengine_dictionaries")),
QDir::cleanPath(QLibraryInfo::location(QLibraryInfo::DataPath) + QL1S("/qtwebengine_dictionaries"))
dictionariesDirs.append(QDir::cleanPath(QCoreApplication::applicationDirPath() + QL1S("/qtwebengine_dictionaries")));
dictionariesDirs.append(QDir::cleanPath(QLibraryInfo::location(QLibraryInfo::DataPath) + QL1S("/qtwebengine_dictionaries")));
#endif
};
}
dictionariesDirs.removeDuplicates();
ui->spellcheckDirectories->setText(dictionariesDirs.join(QL1C('\n')));