F:/KPlato/koffice/libs/kotext/KoLanguageTab.cpp

Aller à la documentation de ce fichier.
00001 /* This file is part of the KDE project
00002    Copyright (C)  2001, 2002 Montel Laurent <lmontel@mandrakesoft.com>
00003 
00004    This library is free software; you can redistribute it and/or
00005    modify it under the terms of the GNU Library General Public
00006    License as published by the Free Software Foundation; either
00007    version 2 of the License, or (at your option) any later version.
00008 
00009    This library is distributed in the hope that it will be useful,
00010    but WITHOUT ANY WARRANTY; without even the implied warranty of
00011    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012    Library General Public License for more details.
00013 
00014    You should have received a copy of the GNU Library General Public License
00015    along with this library; see the file COPYING.LIB.  If not, write to
00016    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00017  * Boston, MA 02110-1301, USA.
00018 */
00019 
00020 #include "KoLanguageTab.h"
00021 #include "KoGlobal.h"
00022 
00023 #include <kcombobox.h>
00024 #include <kiconloader.h>
00025 
00026 #include <QStringList>
00027 
00028 #include "KoLanguageTab.moc"
00029 
00030 
00031 KoLanguageTab::KoLanguageTab( KSpell2::Loader::Ptr loader, QWidget* parent, const char* name, Qt::WFlags fl ) 
00032         : KoLanguageTabBase( parent )
00033 {
00034     //TODO use fl
00035     const QStringList langNames = KoGlobal::listOfLanguages();
00036     const QStringList langTags = KoGlobal::listTagOfLanguages();
00037     QStringList spellCheckLanguages;
00038 
00039     if ( loader )
00040         spellCheckLanguages = loader->languages();
00041 
00042     QStringList::ConstIterator itName = langNames.begin();
00043     QStringList::ConstIterator itTag = langTags.begin();
00044     for ( ; itName != langNames.end() && itTag != langTags.end(); ++itName, ++itTag )
00045     {
00046         if ( spellCheckLanguages.find( *itTag ) != spellCheckLanguages.end() )
00047             languageKComboBox->addItem( SmallIcon( "spellcheck" ), *itName );
00048         else
00049             languageKComboBox->addItem( *itName );
00050     }
00051     connect( languageKComboBox, SIGNAL( activated( int ) ), this, SIGNAL( languageChanged() ) );
00052 }
00053 
00054 KoLanguageTab::~KoLanguageTab()
00055 {
00056 }
00057 
00058 QString KoLanguageTab::getLanguage() const
00059 {
00060     return KoGlobal::tagOfLanguage( languageKComboBox->currentText() );
00061 }
00062 
00063 void KoLanguageTab::setLanguage( const QString &item )
00064 {
00065     languageKComboBox->setCurrentText( KoGlobal::languageFromTag( item ) );
00066 }

Généré le Wed Nov 22 23:41:08 2006 pour KPlato par  doxygen 1.5.1-p1