lib

KoLanguageTab.cpp
1/* This file is part of the KDE project
2 Copyright (C) 2001, 2002 Montel Laurent <lmontel@mandrakesoft.com>
3
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public
6 License as published by the Free Software Foundation; either
7 version 2 of the License, or (at your option) any later version.
8
9 This library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Library General Public License for more details.
13
14 You should have received a copy of the GNU Library General Public License
15 along with this library; see the file COPYING.LIB. If not, write to
16 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301, USA.
18*/
19
20#include "KoLanguageTab.h"
21#include "KoGlobal.h"
22
23#include <kcombobox.h>
24#include <kiconloader.h>
25
26#include <tqstringlist.h>
27
28#include "KoLanguageTab.moc"
29
30
31KoLanguageTab::KoLanguageTab( KSpell2::Broker::Ptr broker, TQWidget* parent, const char* name, WFlags fl )
32 : KoLanguageTabBase( parent, name, fl )
33{
34 const TQStringList langNames = KoGlobal::listOfLanguages();
35 const TQStringList langTags = KoGlobal::listTagOfLanguages();
36 TQStringList spellCheckLanguages;
37
38 if ( broker )
39 spellCheckLanguages = broker->languages();
40
41 TQStringList::ConstIterator itName = langNames.begin();
42 TQStringList::ConstIterator itTag = langTags.begin();
43 for ( ; itName != langNames.end() && itTag != langTags.end(); ++itName, ++itTag )
44 {
45 if ( spellCheckLanguages.find( *itTag ) != spellCheckLanguages.end() )
46 languageKComboBox->insertItem( SmallIcon( "tools-check-spelling" ), *itName );
47 else
48 languageKComboBox->insertItem( *itName );
49 }
50 connect( languageKComboBox, TQ_SIGNAL( activated( int ) ), this, TQ_SIGNAL( languageChanged() ) );
51}
52
53KoLanguageTab::~KoLanguageTab()
54{
55}
56
57TQString KoLanguageTab::getLanguage() const
58{
59 return KoGlobal::tagOfLanguage( languageKComboBox->currentText() );
60}
61
62void KoLanguageTab::setLanguage( const TQString &item )
63{
64 languageKComboBox->setCurrentText( KoGlobal::languageFromTag( item ) );
65}
const char * name(StdAction id)