Changeset View
Changeset View
Standalone View
Standalone View
src/plugins/aspell/aspelldict.cpp
Show All 17 Lines | |||||
18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA | 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA | ||
19 | * 02110-1301 USA | 19 | * 02110-1301 USA | ||
20 | */ | 20 | */ | ||
21 | #include "aspelldict.h" | 21 | #include "aspelldict.h" | ||
22 | 22 | | |||
23 | #include "aspell_debug.h" | 23 | #include "aspell_debug.h" | ||
24 | 24 | | |||
25 | #include <QtCore/QTextCodec> | 25 | #include <QtCore/QTextCodec> | ||
26 | #ifdef Q_OS_WIN | ||||
27 | #include <QCoreApplication> | ||||
28 | #endif | ||||
26 | 29 | | |||
27 | using namespace Sonnet; | 30 | using namespace Sonnet; | ||
28 | 31 | | |||
29 | ASpellDict::ASpellDict(const QString &lang) | 32 | ASpellDict::ASpellDict(const QString &lang) | ||
30 | : SpellerPlugin(lang) | 33 | : SpellerPlugin(lang) | ||
31 | { | 34 | { | ||
32 | m_config = new_aspell_config(); | 35 | m_config = new_aspell_config(); | ||
33 | aspell_config_replace(m_config, "lang", lang.toLatin1().constData()); | 36 | aspell_config_replace(m_config, "lang", lang.toLatin1().constData()); | ||
34 | /* All communication with Aspell is done in UTF-8 */ | 37 | /* All communication with Aspell is done in UTF-8 */ | ||
35 | /* For reference, please look at BR#87250 */ | 38 | /* For reference, please look at BR#87250 */ | ||
36 | aspell_config_replace(m_config, "encoding", "utf-8"); | 39 | aspell_config_replace(m_config, "encoding", "utf-8"); | ||
37 | 40 | | |||
41 | #ifdef Q_OS_WIN | ||||
42 | aspell_config_replace(m_config, "data-dir", QString::fromLatin1("%1/data/aspell").arg(QCoreApplication::applicationDirPath()).toLatin1().constData()); | ||||
43 | aspell_config_replace(m_config, "dict-dir", QString::fromLatin1("%1/data/aspell").arg(QCoreApplication::applicationDirPath()).toLatin1().constData()); | ||||
44 | #endif | ||||
45 | | ||||
38 | AspellCanHaveError *possible_err = new_aspell_speller(m_config); | 46 | AspellCanHaveError *possible_err = new_aspell_speller(m_config); | ||
39 | 47 | | |||
40 | if (aspell_error_number(possible_err) != 0) { | 48 | if (aspell_error_number(possible_err) != 0) { | ||
41 | qCWarning(SONNET_LOG_ASPELL) << "aspell error: " << aspell_error_message(possible_err); | 49 | qCWarning(SONNET_LOG_ASPELL) << "aspell error: " << aspell_error_message(possible_err); | ||
42 | } else { | 50 | } else { | ||
43 | m_speller = to_aspell_speller(possible_err); | 51 | m_speller = to_aspell_speller(possible_err); | ||
44 | } | 52 | } | ||
45 | } | 53 | } | ||
▲ Show 20 Lines • Show All 86 Lines • Show Last 20 Lines |