void SpellPlugin::check(const QString &word) { for (list<Speller*>::iterator it = m_spellers.begin(); it != m_spellers.end(); ++it){ if ((*it)->check(word.utf8()) == 1) return; } emit misspelling(word); }
TEST_FIXTURE(EnchantDictionaryStoreReplacement_TestFixture, EnchantDictStoreReplacment_OnBrokerPwl) { std::string misspelling("helo"); std::string correction("hello"); enchant_dict_store_replacement(_pwl, misspelling.c_str(), -1, correction.c_str(), -1); }
///////////////////////////////////////////////////////////////////////////// // Test Normal Operation TEST_FIXTURE(EnchantDictionaryStoreReplacement_TestFixture, EnchantDictStoreReplacment_ExplicitWordLength) { std::string misspelling("helo"); std::string correction("hello"); enchant_dict_store_replacement(_dict, misspelling.c_str(), misspelling.size(), correction.c_str(), correction.size()); CHECK(storeReplacementCalled); CHECK_EQUAL(EnchantDictionaryStoreReplacement_TestFixture::misspelling, misspelling); CHECK_EQUAL(EnchantDictionaryStoreReplacement_TestFixture::correction, correction); }
TEST_FIXTURE(EnchantDictionaryStoreReplacement_TestFixture, EnchantDictStoreReplacment_ExplicitWordLengthDoesNotCoincideWithNulTerminator) { std::string misspelling("helo1"); std::string correction("hello1"); enchant_dict_store_replacement(_dict, misspelling.c_str(), misspelling.size()-1, correction.c_str(), correction.size()-1); misspelling.resize(misspelling.size()-1); correction.resize(correction.size()-1); CHECK(storeReplacementCalled); CHECK_EQUAL(EnchantDictionaryStoreReplacement_TestFixture::misspelling, misspelling); CHECK_EQUAL(EnchantDictionaryStoreReplacement_TestFixture::correction, correction); }
void Dialog::slotMisspelling(const QString& word, int start) { setGuiEnabled(true); setProgressDialogVisible(false); emit misspelling(word, start); //NOTE this is HACK I had to introduce because BackgroundChecker lacks 'virtual' marks on methods //this dramatically reduces spellchecking time in Lokalize //as this doesn't fetch suggestions for words that are present in msgid if (!updatesEnabled()) return; kDebug()<<"Dialog misspelling!!"; d->currentWord = Word( word, start ); if ( d->replaceAllMap.contains( word ) ) { d->ui.m_replacement->setText( d->replaceAllMap[ word ] ); slotReplaceWord(); } else { updateDialog( word ); } KDialog::show(); }
void EditSpell::spell_check(KSpell *spell) { #if QT_VERSION < 300 connect(spell, SIGNAL(misspelling(QString, QStringList*, unsigned)), this, SLOT(misspelling(QString, QStringList*, unsigned))); connect(spell, SIGNAL(corrected(QString, QString, unsigned)), this, SLOT(corrected_old(QString, QString, unsigned))); #else connect(spell, SIGNAL(misspelling(const QString&, const QStringList&, unsigned int)), this, SLOT(misspelling(const QString&, const QStringList&, unsigned int))); connect(spell, SIGNAL(corrected(const QString&, const QString&, unsigned int)), this, SLOT(corrected(const QString&, const QString&, unsigned int))); #endif connect(spell, SIGNAL(done(const QString&)), this, SLOT(spell_done(const QString&))); #else void EditSpell::spell_check(KSpell*) { #endif } void EditSpell::misspelling(QString original, QStringList *suggestion, unsigned pos) { misspelling(original, *suggestion, pos); }