1
mirror of https://invent.kde.org/network/falkon.git synced 2024-12-24 12:46:35 +01:00

SpellCheck: Fix loading dictionaries after user saves the spellcheck dialog

This commit is contained in:
David Rosca 2014-11-15 11:54:33 +01:00
parent 1e3556696c
commit d0aafd78c0

View File

@ -81,7 +81,7 @@ void Speller::initialize()
return; return;
} }
QString dictionary = m_dictionaryPath + m_language.code; QString dictionary = m_dictionaryPath + QLatin1Char('/') + m_language.code;
if (!dictionaryExists(dictionary)) { if (!dictionaryExists(dictionary)) {
qWarning() << "SpellCheck: Dictionaries for" << dictionary << "doesn't exists!"; qWarning() << "SpellCheck: Dictionaries for" << dictionary << "doesn't exists!";
@ -392,16 +392,12 @@ bool Speller::dictionaryExists(const QString &path) const
QString Speller::getDictionaryPath() const QString Speller::getDictionaryPath() const
{ {
#ifdef Q_OS_UNIX #ifdef Q_OS_UNIX
const QString defaultDicPath = "/usr/share/hunspell/"; const QString defaultDicPath = "/usr/share/hunspell";
#else #else
const QString defaultDicPath = DataPaths::path(DataPaths::AppData) + "/hunspell/"; const QString defaultDicPath = DataPaths::path(DataPaths::AppData) + "/hunspell";
#endif #endif
QString dicPath = QString::fromLocal8Bit(qgetenv("DICPATH")).trimmed(); const QString dicPath = QString::fromLocal8Bit(qgetenv("DICPATH")).trimmed();
if (!dicPath.isEmpty() && !dicPath.endsWith(QLatin1Char('/'))) {
dicPath.append(QLatin1Char('/'));
}
return dicPath.isEmpty() ? defaultDicPath : dicPath; return dicPath.isEmpty() ? defaultDicPath : dicPath;
} }