mirror of
https://bitbucket.org/smil3y/kde-extraapps.git
synced 2025-02-23 10:22:52 +00:00
kdeplasma-addons: start with new query match object for each word in spellchecker runner
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
eee781dc85
commit
760ba3b708
1 changed files with 5 additions and 5 deletions
|
@ -75,9 +75,6 @@ void SpellCheckRunner::match(Plasma::RunnerContext &context)
|
|||
terms.removeFirst();
|
||||
}
|
||||
|
||||
Plasma::QueryMatch match(this);
|
||||
match.setType(Plasma::QueryMatch::InformationalMatch);
|
||||
|
||||
QString spellerdictionary;
|
||||
if (terms.size() > 1 && m_speller->dictionaries().contains(terms.at(0))) {
|
||||
spellerdictionary = terms.at(0);
|
||||
|
@ -86,6 +83,8 @@ void SpellCheckRunner::match(Plasma::RunnerContext &context)
|
|||
spellerdictionary = KSpeller::defaultLanguage();
|
||||
}
|
||||
if (!m_speller->setDictionary(spellerdictionary)) {
|
||||
Plasma::QueryMatch match(this);
|
||||
match.setType(Plasma::QueryMatch::InformationalMatch);
|
||||
match.setIcon(KIcon(QLatin1String("task-attention")));
|
||||
match.setText(i18n("Could not find a dictionary."));
|
||||
context.addMatch(term, match);
|
||||
|
@ -94,6 +93,8 @@ void SpellCheckRunner::match(Plasma::RunnerContext &context)
|
|||
|
||||
|
||||
foreach (const QString &word, terms) {
|
||||
Plasma::QueryMatch match(this);
|
||||
match.setType(Plasma::QueryMatch::InformationalMatch);
|
||||
const bool correct = m_speller->check(word);
|
||||
if (correct) {
|
||||
match.setIcon(KIcon(QLatin1String("checkbox")));
|
||||
|
@ -109,9 +110,8 @@ void SpellCheckRunner::match(Plasma::RunnerContext &context)
|
|||
match.setData(suggestions);
|
||||
}
|
||||
}
|
||||
context.addMatch(term, match);
|
||||
}
|
||||
|
||||
context.addMatch(term, match);
|
||||
}
|
||||
|
||||
void SpellCheckRunner::run(const Plasma::RunnerContext &context, const Plasma::QueryMatch &match)
|
||||
|
|
Loading…
Add table
Reference in a new issue