lib
KoLanguageTab.cpp00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #include "KoLanguageTab.h"
00021 #include "KoGlobal.h"
00022
00023 #include <kcombobox.h>
00024 #include <kiconloader.h>
00025
00026 #include <qstringlist.h>
00027
00028 #include "KoLanguageTab.moc"
00029
00030
00031 KoLanguageTab::KoLanguageTab( KSpell2::Broker::Ptr broker, QWidget* parent, const char* name, WFlags fl )
00032 : KoLanguageTabBase( parent, name, fl )
00033 {
00034 const QStringList langNames = KoGlobal::listOfLanguages();
00035 const QStringList langTags = KoGlobal::listTagOfLanguages();
00036 QStringList spellCheckLanguages;
00037
00038 if ( broker )
00039 spellCheckLanguages = broker->languages();
00040
00041 QStringList::ConstIterator itName = langNames.begin();
00042 QStringList::ConstIterator itTag = langTags.begin();
00043 for ( ; itName != langNames.end() && itTag != langTags.end(); ++itName, ++itTag )
00044 {
00045 if ( spellCheckLanguages.find( *itTag ) != spellCheckLanguages.end() )
00046 languageKComboBox->insertItem( SmallIcon( "spellcheck" ), *itName );
00047 else
00048 languageKComboBox->insertItem( *itName );
00049 }
00050 connect( languageKComboBox, SIGNAL( activated( int ) ), this, SIGNAL( languageChanged( int ) ) );
00051 }
00052
00053 KoLanguageTab::~KoLanguageTab()
00054 {
00055 }
00056
00057 QString KoLanguageTab::getLanguage() const
00058 {
00059 return languageKComboBox->currentText();
00060 }
00061
00062 void KoLanguageTab::setLanguage( const QString &item )
00063 {
00064 languageKComboBox->setCurrentText( item );
00065 }
|