• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • tdespell2
 

tdespell2

  • tdespell2
  • ui
configwidget.cpp
1/*
2 * configwidget.cpp
3 *
4 * Copyright (C) 2004 Zack Rusin <zack@kde.org>
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
19 * 02110-1301 USA
20 */
21#include "configwidget.h"
22#include "configui.h"
23
24#include "broker.h"
25#include "settings.h"
26
27#include <keditlistbox.h>
28#include <kcombobox.h>
29#include <tdelocale.h>
30
31#include <tqcheckbox.h>
32#include <tqlayout.h>
33
34using namespace KSpell2;
35
36class ConfigWidget::Private
37{
38public:
39 Broker::Ptr broker;
40 KSpell2ConfigUI *ui;
41};
42
43ConfigWidget::ConfigWidget( Broker *broker, TQWidget *parent, const char *name )
44 : TQWidget( parent, name )
45{
46 init( broker );
47}
48
49ConfigWidget::~ConfigWidget()
50{
51 delete d; d = 0;
52}
53
54void ConfigWidget::init( Broker *broker )
55{
56 d = new Private;
57 d->broker = broker;
58
59 TQVBoxLayout *layout = new TQVBoxLayout( this, 0, 0, "KSpell2ConfigUILayout");
60 d->ui = new KSpell2ConfigUI( this );
61
62 TQStringList langs = d->broker->languages();
63 //TQStringList clients = d->broker->clients();
64 d->ui->m_langCombo->insertStringList( langs );
65 setCorrectLanguage( langs );
66 //d->ui->m_clientCombo->insertStringList( clients );
67 d->ui->m_skipUpperCB->setChecked( !d->broker->settings()->checkUppercase() );
68 d->ui->m_skipRunTogetherCB->setChecked( d->broker->settings()->skipRunTogether() );
69 TQStringList ignoreList = d->broker->settings()->currentIgnoreList();
70 ignoreList.sort();
71 d->ui->m_ignoreListBox->insertStringList( ignoreList );
72 d->ui->m_bgSpellCB->setChecked( d->broker->settings()->backgroundCheckerEnabled() );
73 d->ui->m_bgSpellCB->hide();//hidden by default
74 connect( d->ui->m_ignoreListBox, TQ_SIGNAL(changed()), TQ_SLOT(slotChanged()) );
75
76 layout->addWidget( d->ui );
77}
78
79void KSpell2::ConfigWidget::save()
80{
81 setFromGUI();
82 d->broker->settings()->save();
83}
84
85void ConfigWidget::setFromGUI()
86{
87 d->broker->settings()->setDefaultLanguage(
88 d->ui->m_langCombo->currentText() );
89 d->broker->settings()->setCheckUppercase(
90 !d->ui->m_skipUpperCB->isChecked() );
91 d->broker->settings()->setSkipRunTogether(
92 d->ui->m_skipRunTogetherCB->isChecked() );
93 d->broker->settings()->setBackgroundCheckerEnabled(
94 d->ui->m_bgSpellCB->isChecked() );
95}
96
97void ConfigWidget::slotChanged()
98{
99 d->broker->settings()->setCurrentIgnoreList(
100 d->ui->m_ignoreListBox->items() );
101}
102
103void ConfigWidget::setCorrectLanguage( const TQStringList& langs)
104{
105 int idx = 0;
106 for ( TQStringList::const_iterator itr = langs.begin();
107 itr != langs.end(); ++itr, ++idx ) {
108 if ( *itr == d->broker->settings()->defaultLanguage() )
109 d->ui->m_langCombo->setCurrentItem( idx );
110 }
111}
112
113void ConfigWidget::setBackgroundCheckingButtonShown( bool b )
114{
115 d->ui->m_bgSpellCB->setShown( b );
116}
117
118bool ConfigWidget::backgroundCheckingButtonShown() const
119{
120 return d->ui->m_bgSpellCB->isShown();
121}
122
123void ConfigWidget::slotDefault()
124{
125 d->ui->m_skipUpperCB->setChecked( false );
126 d->ui->m_skipRunTogetherCB->setChecked( false );
127 d->ui->m_bgSpellCB->setChecked( true );
128 d->ui->m_ignoreListBox->clear();
129}
130
131#include "configwidget.moc"
KSpell2::Broker
Class used to deal with dictionaries.
Definition: broker.h:49
KSpell2
tdespell_hspellclient.h
Definition: backgroundchecker.h:29

tdespell2

Skip menu "tdespell2"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Class Members

tdespell2

Skip menu "tdespell2"
  • arts
  • dcop
  • dnssd
  • interfaces
  •   kspeech
  •     interface
  •     library
  •   tdetexteditor
  • kate
  • kded
  • kdoctools
  • kimgio
  • kjs
  • libtdemid
  • libtdescreensaver
  • tdeabc
  • tdecmshell
  • tdecore
  • tdefx
  • tdehtml
  • tdeinit
  • tdeio
  •   bookmarks
  •   httpfilter
  •   kpasswdserver
  •   kssl
  •   tdefile
  •   tdeio
  •   tdeioexec
  • tdeioslave
  •   http
  • tdemdi
  •   tdemdi
  • tdenewstuff
  • tdeparts
  • tdeprint
  • tderandr
  • tderesources
  • tdespell2
  • tdesu
  • tdeui
  • tdeunittest
  • tdeutils
  • tdewallet
Generated for tdespell2 by doxygen 1.9.4
This website is maintained by Timothy Pearson.