summaryrefslogtreecommitdiffstats
path: root/kcontrol/spellchecking/spellchecking.cpp
blob: a7ed79b469b6a5c7c30791e37f485037489972e0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
/*
  Copyright (c) 2001 Laurent Montel <lmontel@mandrakesoft.com>
  This program is free software; you can redistribute it and/or modify
  it under the terms of the GNU General Public License as published by
  the Free Software Foundation; either version 2 of the License, or
  (at your option) any later version.

  This program is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  GNU General Public License for more details.

  You should have received a copy of the GNU General Public License
  along with this program; if not, write to the Free Software
  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
*/

#include <tqlayout.h>
#include <tqvgroupbox.h>

#include <dcopclient.h>

#include <kapplication.h>
#include <kdialog.h>
#include <kgenericfactory.h>
#include <kspell.h>

#include "spellchecking.h"

typedef KGenericFactory<KSpellCheckingConfig, TQWidget > SpellFactory;
K_EXPORT_COMPONENT_FACTORY (kcm_spellchecking, SpellFactory("kcmspellchecking") )


KSpellCheckingConfig::KSpellCheckingConfig(TQWidget *parent, const char *name, const TQStringList &):
    KCModule(SpellFactory::instance(), parent, name)
{
  TQBoxLayout *layout = new TQVBoxLayout(this, 0, KDialog::spacingHint());
  TQGroupBox *box = new TQVGroupBox( i18n("Spell Checking Settings"), this );
  box->layout()->setSpacing( KDialog::spacingHint() );
  layout->addWidget(box);

  spellConfig = new KSpellConfig(box, 0L ,0L, false );
  layout->addStretch(1);
  connect(spellConfig,TQT_SIGNAL(configChanged()), TQT_SLOT( changed() ));

  setQuickHelp( i18n("<h1>Spell Checker</h1><p>This control module allows you to configure the KDE spell checking system. You can configure:<ul><li> which spell checking program to use<li> which types of spelling errors are identified<li> which dictionary is used by default.</ul><br>The KDE spell checking system (KSpell) provides support for two common spell checking utilities: ASpell and ISpell. This allows you to share dictionaries between KDE applications and non-KDE applications.</p>"));

}

void KSpellCheckingConfig::load()
{
    spellConfig->readGlobalSettings();
}

void KSpellCheckingConfig::save()
{
    spellConfig->writeGlobalSettings();
    TQByteArray data;
    if ( !kapp->dcopClient()->isAttached() )
        kapp->dcopClient()->attach();
    kapp->dcopClient()->send( "konqueror*", "KonquerorIface", "reparseConfiguration()", data );
}

void KSpellCheckingConfig::defaults()
{
    spellConfig->setNoRootAffix(0);
    spellConfig->setRunTogether(0);
    spellConfig->setDictionary("");
    spellConfig->setDictFromList(FALSE);
    spellConfig->setEncoding (KS_E_UTF8);
    spellConfig->setClient (KS_CLIENT_ISPELL);
}

#include "spellchecking.moc"