예제 #1
0
void DictionaryComboBox::reloadCombo()
{
    clear();
    Sonnet::Speller* speller = new Sonnet::Speller();
    QMap<QString, QString> dictionaries = speller->availableDictionaries();
    QMapIterator<QString, QString> i( dictionaries );
    while ( i.hasNext() ) {
        i.next();
        kDebug() << "Populate combo:" << i.key() << ":" << i.value();
        addItem( i.key(), i.value() );
    }
    delete speller;
}
void TextEdit::setupSpeller()
{
    BehaviorSettings::self()->readConfig();
    d->curLang = BehaviorSettings::spellerLanguage();
    Sonnet::Speller s;
    if(d->curLang.isEmpty()){
        d->curLang = s.defaultLanguage();
    }
    kDebug()<<"Current LANG: "<<d->curLang;
    QMap<QString, QString> list = s.availableDictionaries();
    QMap<QString, QString>::const_iterator it = list.constBegin(), endIt = list.constEnd();
    for(; it!=endIt; ++it){
        QAction *act = new QAction(it.key(), d->langActions);
        act->setData(it.value());
        act->setCheckable(true);
        if(d->curLang == it.value())
            act->setChecked(true);
        connect(act, SIGNAL(triggered(bool)), SLOT(slotChangeSpellerLanguage()));
        d->langActions->addAction(act);
        d->langActionMap.insert(it.value(), act);
    }
}