kspell Library API Documentation

ksconfig.cpp

00001 /* This file is part of the KDE libraries
00002    Copyright (C) 1997 David Sweet <dsweet@kde.org>
00003    Copyright (C) 2000-2001 Wolfram Diestel <wolfram@steloj.de>
00004 
00005    This library is free software; you can redistribute it and/or
00006    modify it under the terms of the GNU Library General Public
00007    License version 2 as published by the Free Software Foundation.
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., 59 Temple Place - Suite 330,
00017    Boston, MA 02111-1307, USA.
00018 */
00019 
00020 // $Id: ksconfig.cpp,v 1.70 2002/10/27 10:11:24 nanulo Exp $
00021 
00022 #include <qcheckbox.h>
00023 #include <qcombobox.h>
00024 #include <qlabel.h>
00025 #include <qlayout.h>
00026 #include <qpushbutton.h>
00027 
00028 #include <kapplication.h>
00029 #include <kconfig.h>
00030 #include <kdebug.h>
00031 #include <kdialog.h>
00032 #include <kfiledialog.h>
00033 #include <kglobal.h>
00034 #include <klineedit.h>
00035 #include <klocale.h>
00036 
00037 #include "ksconfig.h"
00038 
00039 class KSpellConfigPrivate
00040 {
00041 public:
00042     QStringList replacelist;
00043 };
00044 
00045 
00046 KSpellConfig::KSpellConfig (const KSpellConfig &_ksc)
00047   : QWidget(0, 0), nodialog(true)
00048   , kc(0)
00049   , cb1(0)
00050   , cb2(0)
00051   , dictlist(0)
00052   , dictcombo(0)
00053   , encodingcombo(0)
00054   , clientcombo(0)
00055 {
00056     d= new KSpellConfigPrivate;
00057     setReplaceAllList( _ksc.replaceAllList ());
00058   setNoRootAffix (_ksc.noRootAffix());
00059   setRunTogether (_ksc.runTogether());
00060   setDictionary  (_ksc.dictionary());
00061   setDictFromList (_ksc.dictFromList());
00062   //  setPersonalDict (_ksc.personalDict());
00063   setIgnoreList (_ksc.ignoreList());
00064   setEncoding (_ksc.encoding());
00065   setClient (_ksc.client());
00066 }
00067 
00068 
00069 KSpellConfig::KSpellConfig( QWidget *parent, const char *name,
00070                 KSpellConfig *_ksc, bool addHelpButton )
00071   : QWidget (parent, name), nodialog(false)
00072   , kc(0)
00073   , cb1(0)
00074   , cb2(0)
00075   , dictlist(0)
00076   , dictcombo(0)
00077   , encodingcombo(0)
00078   , clientcombo(0)
00079 {
00080     d= new KSpellConfigPrivate;
00081     kc = KGlobal::config();
00082   if( _ksc == 0 )
00083   {
00084     readGlobalSettings();
00085   }
00086   else
00087   {
00088     setNoRootAffix (_ksc->noRootAffix());
00089     setRunTogether (_ksc->runTogether());
00090     setDictionary  (_ksc->dictionary());
00091     setDictFromList (_ksc->dictFromList());
00092     //setPersonalDict (_ksc->personalDict());
00093     setIgnoreList (_ksc->ignoreList());
00094     setEncoding (_ksc->encoding());
00095     setClient (_ksc->client());
00096   }
00097 
00098   QGridLayout *glay = new QGridLayout (this, 6, 3, 0, KDialog::spacingHint() );
00099   cb1 = new QCheckBox(i18n("Create root/affix combinations"
00100                " not in dictionary"), this );
00101   connect( cb1, SIGNAL(toggled(bool)), SLOT(sNoAff(bool)) );
00102   glay->addMultiCellWidget( cb1, 0, 0, 0, 2 );
00103 
00104   cb2 = new QCheckBox( i18n("Consider run-together words"
00105                 " as spelling errors"), this );
00106   connect( cb2, SIGNAL(toggled(bool)), SLOT(sRunTogether(bool)) );
00107   glay->addMultiCellWidget( cb2, 1, 1, 0, 2 );
00108 
00109   dictcombo = new QComboBox( this );
00110   dictcombo->setInsertionPolicy (QComboBox::NoInsertion);
00111   connect (dictcombo, SIGNAL (activated (int)),
00112        this, SLOT (sSetDictionary (int)));
00113   glay->addMultiCellWidget( dictcombo, 2, 2, 1, 2 );
00114 
00115   dictlist = new QLabel (dictcombo, i18n("Dictionary:"), this);
00116   glay->addWidget( dictlist, 2 ,0 );
00117 
00118   encodingcombo = new QComboBox( this );
00119   encodingcombo->insertItem ("US-ASCII");
00120   encodingcombo->insertItem ("ISO 8859-1");
00121   encodingcombo->insertItem ("ISO 8859-2");
00122   encodingcombo->insertItem ("ISO 8859-3");
00123   encodingcombo->insertItem ("ISO 8859-4");
00124   encodingcombo->insertItem ("ISO 8859-5");
00125   encodingcombo->insertItem ("ISO 8859-7");
00126   encodingcombo->insertItem ("ISO 8859-8");
00127   encodingcombo->insertItem ("ISO 8859-9");
00128   encodingcombo->insertItem ("ISO 8859-13");
00129   encodingcombo->insertItem ("ISO 8859-15");
00130   encodingcombo->insertItem ("UTF-8");
00131   encodingcombo->insertItem ("KOI8-R");
00132   encodingcombo->insertItem ("KOI8-U");
00133   encodingcombo->insertItem ("CP1251");
00134 
00135   connect (encodingcombo, SIGNAL (activated(int)), this,
00136        SLOT (sChangeEncoding(int)));
00137   glay->addMultiCellWidget (encodingcombo, 3, 3, 1, 2);
00138 
00139   QLabel *tmpQLabel = new QLabel( encodingcombo, i18n("Encoding:"), this);
00140   glay->addWidget( tmpQLabel, 3, 0 );
00141 
00142 
00143   clientcombo = new QComboBox( this );
00144   clientcombo->insertItem (i18n("International Ispell"));
00145   clientcombo->insertItem (i18n("Aspell"));
00146   connect (clientcombo, SIGNAL (activated(int)), this,
00147        SLOT (sChangeClient(int)));
00148   glay->addMultiCellWidget( clientcombo, 4, 4, 1, 2 );
00149 
00150   tmpQLabel = new QLabel( clientcombo, i18n("Client:"), this );
00151   glay->addWidget( tmpQLabel, 4, 0 );
00152 
00153   if( addHelpButton == true )
00154   {
00155     QPushButton *pushButton = new QPushButton( i18n("&Help"), this );
00156     connect( pushButton, SIGNAL(clicked()), this, SLOT(sHelp()) );
00157     glay->addWidget(pushButton, 5, 2);
00158   }
00159 
00160   fillInDialog();
00161 }
00162 
00163 KSpellConfig::~KSpellConfig ()
00164 {
00165     delete d;
00166 }
00167 
00168 
00169 bool
00170 KSpellConfig::dictFromList () const
00171 {
00172   return dictfromlist;
00173 }
00174 
00175 bool
00176 KSpellConfig::readGlobalSettings ()
00177 {
00178   KConfigGroupSaver cs(kc,"KSpell");
00179 
00180   setNoRootAffix   (kc->readNumEntry ("KSpell_NoRootAffix", 0));
00181   setRunTogether   (kc->readNumEntry ("KSpell_RunTogether", 0));
00182   setDictionary    (kc->readEntry ("KSpell_Dictionary", ""));
00183   setDictFromList  (kc->readNumEntry ("KSpell_DictFromList", FALSE));
00184   setEncoding (kc->readNumEntry ("KSpell_Encoding", KS_E_ASCII));
00185   setClient (kc->readNumEntry ("KSpell_Client", KS_CLIENT_ISPELL));
00186 
00187   return TRUE;
00188 }
00189 
00190 bool
00191 KSpellConfig::writeGlobalSettings ()
00192 {
00193   KConfigGroupSaver cs(kc,"KSpell");
00194   kc->writeEntry ("KSpell_NoRootAffix",(int) noRootAffix (), TRUE, TRUE);
00195   kc->writeEntry ("KSpell_RunTogether", (int) runTogether (), TRUE, TRUE);
00196   kc->writeEntry ("KSpell_Dictionary", dictionary (), TRUE, TRUE);
00197   kc->writeEntry ("KSpell_DictFromList",(int) dictFromList(), TRUE, TRUE);
00198   kc->writeEntry ("KSpell_Encoding", (int) encoding(),
00199           TRUE, TRUE);
00200   kc->writeEntry ("KSpell_Client", client(),
00201           TRUE, TRUE);
00202   kc->sync();
00203   return TRUE;
00204 }
00205 
00206 void
00207 KSpellConfig::sChangeEncoding(int i)
00208 {
00209     kdDebug(750) << "KSpellConfig::sChangeEncoding(" << i << ")" << endl;
00210   setEncoding (i);
00211   emit configChanged();
00212 }
00213 
00214 void
00215 KSpellConfig::sChangeClient (int i)
00216 {
00217   setClient (i);
00218 
00219   // read in new dict list
00220   if (dictcombo) {
00221     if (iclient == KS_CLIENT_ISPELL)
00222       getAvailDictsIspell();
00223     else
00224       getAvailDictsAspell();
00225   }
00226   emit configChanged();
00227 }
00228 
00229 bool
00230 KSpellConfig::interpret (QString &fname, QString &lname,
00231                   QString &hname)
00232 
00233 {
00234 
00235   kdDebug(750) << "KSpellConfig::interpret [" << fname << "]" << endl;
00236 
00237   QString dname(fname);
00238 
00239   if(dname.right(1)=="+")
00240     dname.remove(dname.length()-1, 1);
00241 
00242   if(dname.right(3)=="sml" || dname.right(3)=="med" || dname.right(3)=="lrg" || dname.right(3)=="xlg")
00243      dname.remove(dname.length()-3,3);
00244 
00245   QString extension;
00246   
00247   int i = dname.find('-');
00248   if (i != -1)
00249   {
00250     extension = dname.mid(i+1);
00251     dname.truncate(i);
00252   }
00253 
00254   // Aspell uses 2 alpha language codes or 2 alpha language + 2 alpha country
00255   if (dname.length() == 2) {
00256     lname = dname;
00257     hname = KGlobal::locale()->twoAlphaToLanguageName(lname);
00258   }
00259   else if ((dname.length() == 5) && (dname[2] == '_')) {
00260     lname = dname.left(2);
00261     hname = KGlobal::locale()->twoAlphaToLanguageName(lname);
00262     QString country = KGlobal::locale()->twoAlphaToCountryName(dname.right(2));
00263     if (extension.isEmpty())
00264       extension = country;
00265     else
00266       extension = country + " - " + extension;
00267   }
00268   //These are mostly the ispell-langpack defaults
00269   else if (dname=="english" || dname=="american" ||
00270       dname=="british" || dname=="canadian") {
00271     lname="en"; hname=i18n("English");
00272   }
00273   else if (dname=="espa~nol" || dname=="espanol") {
00274     lname="es"; hname=i18n("Spanish");
00275   }
00276   else if (dname=="dansk") {
00277     lname="da"; hname=i18n("Danish");
00278   }
00279   else if (dname=="deutsch") {
00280     lname="de"; hname=i18n("German");
00281   }
00282   else if (dname=="german") {
00283     lname="de"; hname=i18n("German (new spelling)");
00284   }
00285   else if (dname=="portuguesb" || dname=="br") {
00286     lname="br"; hname=i18n("Brazilian Portuguese");
00287   }
00288   else if (dname=="portugues") {
00289     lname="pt"; hname=i18n("Portuguese");
00290   }
00291   else if (dname=="esperanto") {
00292     lname="eo"; hname=i18n("Esperanto");
00293   }
00294   else if (dname=="norsk") {
00295     lname="no"; hname=i18n("Norwegian");
00296   }
00297   else if (dname=="polish") {
00298     lname="pl"; hname=i18n("Polish"); sChangeEncoding(KS_E_LATIN2);
00299   }
00300   else if (dname=="russian") {
00301     lname="ru"; hname=i18n("Russian");
00302   }
00303   else if (dname=="slovensko") {
00304     lname="si"; hname=i18n("Slovenian"); sChangeEncoding(KS_E_LATIN2);
00305   }
00306   else if (dname=="slovak"){
00307     lname="sk"; hname=i18n("Slovak"); sChangeEncoding(KS_E_LATIN2);
00308   }
00309   else if (dname=="czech") {
00310     lname="cs"; hname=i18n("Czech"); sChangeEncoding(KS_E_LATIN2);
00311   }
00312   else if (dname=="svenska") {
00313     lname="sv"; hname=i18n("Swedish");
00314   }
00315   else if (dname=="swiss") {
00316     lname="de"; hname=i18n("Swiss German");
00317   }
00318   else if (dname=="ukrainian") {
00319     lname="uk"; hname=i18n("Ukrainian");
00320   }
00321   else if (dname=="lietuviu" || dname=="lithuanian") {
00322      lname="lt"; hname=i18n("Lithuanian");
00323   }
00324   else if (dname=="francais" || dname=="french") {
00325     lname="fr"; hname=i18n("French");
00326   }
00327   else if (dname=="belarusian") {  // waiting for post 2.2 to not dissapoint translators
00328     lname="be"; hname=i18n("Belarusian");
00329   }
00330   else if( dname == "magyar" ) {
00331     lname="hu"; hname=i18n("Hungarian");
00332     sChangeEncoding(KS_E_LATIN2);
00333   }
00334   else {
00335     lname=""; hname=i18n("Unknown ispell dictionary", "Unknown");
00336   }
00337   if (!extension.isEmpty())
00338   {
00339     hname = hname + " (" + extension + ")";
00340   }
00341 
00342   //We have explicitly chosen English as the default here.
00343   if ( (KGlobal::locale()->language()==QString::fromLatin1("C") &&
00344     lname==QString::fromLatin1("en")) ||
00345        KGlobal::locale()->language()==lname)
00346     return TRUE;
00347 
00348   return FALSE;
00349 }
00350 
00351 void
00352 KSpellConfig::fillInDialog ()
00353 {
00354   if (nodialog)
00355     return;
00356 
00357     kdDebug(750) << "KSpellConfig::fillinDialog" << endl;
00358 
00359   cb1->setChecked (noRootAffix());
00360   cb2->setChecked (runTogether());
00361   encodingcombo->setCurrentItem (encoding());
00362   clientcombo->setCurrentItem (client());
00363 
00364   // get list of available dictionaries
00365   if (iclient == KS_CLIENT_ISPELL)
00366     getAvailDictsIspell();
00367   else
00368     getAvailDictsAspell();
00369 
00370   // select the used dictionary in the list
00371   int whichelement=-1;
00372 
00373   if (dictFromList())
00374     for (unsigned int i=0; i<langfnames.count(); i++)
00375       {
00376     if (langfnames[i] == dictionary())
00377       whichelement=i;
00378       }
00379 
00380   dictcombo->setMinimumWidth (dictcombo->sizeHint().width());
00381 
00382   if (dictionary().isEmpty() ||  whichelement!=-1)
00383     {
00384       setDictFromList (TRUE);
00385       if (whichelement!=-1)
00386     dictcombo->setCurrentItem(whichelement);
00387     }
00388   else
00389     setDictFromList (FALSE);
00390 
00391   sDictionary (dictFromList());
00392   sPathDictionary (!dictFromList());
00393 
00394 }
00395 
00396 
00397 void KSpellConfig::getAvailDictsIspell () {
00398 
00399   langfnames.clear();
00400   dictcombo->clear();
00401   langfnames.append(""); // Default
00402   dictcombo->insertItem (i18n("ISpell Default"));
00403 
00404   // dictionary path
00405   QFileInfo dir ("/usr/lib/ispell");
00406   if (!dir.exists() || !dir.isDir())
00407     dir.setFile ("/usr/local/lib/ispell");
00408   if (!dir.exists() || !dir.isDir())
00409     dir.setFile ("/usr/local/share/ispell");
00410   if (!dir.exists() || !dir.isDir())
00411     dir.setFile ("/usr/share/ispell");
00412   /* TODO get them all instead of just one of them.
00413    * If /usr/local/lib exists, it skips the rest
00414   if (!dir.exists() || !dir.isDir())
00415     dir.setFile ("/usr/local/lib");
00416   */
00417   if (!dir.exists() || !dir.isDir()) return;
00418 
00419   kdDebug(750) << "KSpellConfig::getAvailDictsIspell "
00420            << dir.filePath() << " " << dir.dirPath() << endl;
00421 
00422   QDir thedir (dir.filePath(),"*.hash");
00423 
00424   kdDebug(750) << "KSpellConfig" << thedir.path() << "\n" << endl;
00425   kdDebug(750) << "entryList().count()="
00426            << thedir.entryList().count() << endl;
00427 
00428   for (unsigned int i=0;i<thedir.entryList().count();i++)
00429     {
00430       QString fname, lname, hname;
00431       fname = thedir [i];
00432 
00433       // remove .hash
00434       if (fname.right(5) == ".hash") fname.remove (fname.length()-5,5);
00435 
00436       if (interpret (fname, lname, hname) && langfnames[0].isEmpty())
00437     { // This one is the KDE default language
00438       // so place it first in the lists (overwrite "Default")
00439 
00440       langfnames.remove ( langfnames.begin() );
00441       langfnames.prepend ( fname );
00442 
00443       hname=i18n("default spelling dictionary"
00444              ,"Default - %1 [%2]").arg(hname).arg(fname);
00445 
00446       dictcombo->changeItem (hname,0);
00447     }
00448       else
00449     {
00450       langfnames.append (fname);
00451       hname=hname+" ["+fname+"]";
00452 
00453       dictcombo->insertItem (hname);
00454     }
00455     }
00456 }
00457 
00458 void KSpellConfig::getAvailDictsAspell () {
00459 
00460   langfnames.clear();
00461   dictcombo->clear();
00462 
00463   langfnames.append(""); // Default
00464   dictcombo->insertItem (i18n("ASpell Default"));
00465 
00466   // dictionary path
00467   // FIXME: use "aspell dump config" to find out the dict-dir
00468   QFileInfo dir ("/usr/lib/aspell");
00469   if (!dir.exists() || !dir.isDir())
00470     dir.setFile ("/usr/local/lib/aspell");
00471   if (!dir.exists() || !dir.isDir())
00472     dir.setFile ("/usr/share/aspell");
00473   if (!dir.exists() || !dir.isDir())
00474     dir.setFile ("/usr/local/share/aspell");
00475   if (!dir.exists() || !dir.isDir()) return;
00476 
00477   kdDebug(750) << "KSpellConfig::getAvailDictsAspell "
00478            << dir.filePath() << " " << dir.dirPath() << endl;
00479 
00480   QDir thedir (dir.filePath(),"*");
00481 
00482   kdDebug(750) << "KSpellConfig" << thedir.path() << "\n" << endl;
00483   kdDebug(750) << "entryList().count()="
00484            << thedir.entryList().count() << endl;
00485 
00486   for (unsigned int i=0; i<thedir.entryList().count(); i++)
00487     {
00488       QString fname, lname, hname;
00489       fname = thedir [i];
00490 
00491       // consider only simple dicts without '-' in the name
00492       // FIXME: may be this is wrong an the list should contain
00493       // all *.multi files too, to allow using special dictionaries
00494       if (fname[0] != '.')
00495     {
00496 
00497       // remove .multi
00498       if (fname.right(6) == ".multi") fname.remove (fname.length()-6,6);
00499 
00500       if (interpret (fname, lname, hname) && langfnames[0].isEmpty())
00501         { // This one is the KDE default language
00502           // so place it first in the lists (overwrite "Default")
00503 
00504           langfnames.remove ( langfnames.begin() );
00505           langfnames.prepend ( fname );
00506 
00507           hname=i18n("default spelling dictionary"
00508              ,"Default - %1").arg(hname);
00509 
00510           dictcombo->changeItem (hname,0);
00511         }
00512       else
00513         {
00514           langfnames.append (fname);
00515           dictcombo->insertItem (hname);
00516         }
00517     }
00518     }
00519 }
00520 
00521 /*
00522  * Options setting routines.
00523  */
00524 
00525 void
00526 KSpellConfig::setClient (int c)
00527 {
00528   iclient = c;
00529 
00530   if (clientcombo)
00531       clientcombo->setCurrentItem(c);
00532 }
00533 
00534 void
00535 KSpellConfig::setNoRootAffix (bool b)
00536 {
00537   bnorootaffix=b;
00538 
00539   if(cb1)
00540       cb1->setChecked(b);
00541 }
00542 
00543 void
00544 KSpellConfig::setRunTogether(bool b)
00545 {
00546   bruntogether=b;
00547 
00548   if(cb2)
00549       cb2->setChecked(b);
00550 }
00551 
00552 void
00553 KSpellConfig::setDictionary (const QString s)
00554 {
00555   qsdict=s; //.copy();
00556 
00557   if (qsdict.length()>5)
00558     if ((signed)qsdict.find(".hash")==(signed)qsdict.length()-5)
00559       qsdict.remove (qsdict.length()-5,5);
00560 
00561 
00562   if(dictcombo)
00563   {
00564     int whichelement=-1;
00565     if (dictFromList())
00566     {
00567       for (unsigned int i=0;i<langfnames.count();i++)
00568       {
00569          if (langfnames[i] == s)
00570            whichelement=i;
00571       }
00572 
00573       if(whichelement >= 0)
00574       {
00575         dictcombo->setCurrentItem(whichelement);
00576       }
00577     }
00578   }
00579 
00580 
00581 }
00582 
00583 void
00584 KSpellConfig::setDictFromList (bool dfl)
00585 {
00586   //  kdebug (KDEBUG_INFO, 750, "sdfl = %d", dfl);
00587   dictfromlist=dfl;
00588 }
00589 
00590 /*
00591 void KSpellConfig::setPersonalDict (const char *s)
00592 {
00593   qspdict=s;
00594 }
00595 */
00596 
00597 void
00598 KSpellConfig::setEncoding (int enctype)
00599 {
00600   enc=enctype;
00601 
00602   if(encodingcombo)
00603     encodingcombo->setCurrentItem(enctype);
00604 }
00605 
00606 /*
00607   Options reading routines.
00608  */
00609 int
00610 KSpellConfig::client () const
00611 {
00612   return iclient;
00613 }
00614 
00615 
00616 bool
00617 KSpellConfig::noRootAffix () const
00618 {
00619   return bnorootaffix;
00620 }
00621 
00622 bool
00623 KSpellConfig::runTogether() const
00624 {
00625   return bruntogether;
00626 }
00627 
00628 const
00629 QString KSpellConfig::dictionary () const
00630 {
00631   return qsdict;
00632 }
00633 
00634 /*
00635 const QString KSpellConfig::personalDict () const
00636 {
00637   return qspdict;
00638 }
00639 */
00640 
00641 int
00642 KSpellConfig::encoding () const
00643 {
00644   return enc;
00645 }
00646 
00647 void
00648 KSpellConfig::sRunTogether(bool)
00649 {
00650   setRunTogether (cb2->isChecked());
00651   emit configChanged();
00652 }
00653 
00654 void
00655 KSpellConfig::sNoAff(bool)
00656 {
00657   setNoRootAffix (cb1->isChecked());
00658   emit configChanged();
00659 }
00660 
00661 /*
00662 void
00663 KSpellConfig::sBrowseDict()
00664 {
00665   return;
00666 
00667   QString qs( KFileDialog::getOpenFileName ("/usr/local/lib","*.hash") );
00668   if ( !qs.isNull() )
00669     kle1->setText (qs);
00670 
00671 }
00672 */
00673 
00674 /*
00675 void KSpellConfig::sBrowsePDict()
00676 {
00677   //how do I find home directory path??
00678   QString qs( KFileDialog::getOpenFileName ("",".ispell_*") );
00679   if ( !qs.isNull() )
00680       kle2->setText (qs);
00681 
00682 
00683 }
00684 */
00685 
00686 void
00687 KSpellConfig::sSetDictionary (int i)
00688 {
00689   setDictionary (langfnames[i]);
00690   setDictFromList (TRUE);
00691   emit configChanged();
00692 }
00693 
00694 void
00695 KSpellConfig::sDictionary(bool on)
00696 {
00697   if (on)
00698     {
00699       dictcombo->setEnabled (TRUE);
00700       setDictionary (langfnames[dictcombo->currentItem()] );
00701       setDictFromList (TRUE);
00702     }
00703   else
00704     {
00705       dictcombo->setEnabled (FALSE);
00706     }
00707   emit configChanged();
00708 }
00709 
00710 void
00711 KSpellConfig::sPathDictionary(bool on)
00712 {
00713   return; //enough for now
00714 
00715 
00716   if (on)
00717     {
00718       //kle1->setEnabled (TRUE);
00719       //      browsebutton1->setEnabled (TRUE);
00720       //setDictionary (kle1->text());
00721       setDictFromList (FALSE);
00722     }
00723   else
00724     {
00725       //kle1->setEnabled (FALSE);
00726       //browsebutton1->setEnabled (FALSE);
00727     }
00728   emit configChanged();
00729 }
00730 
00731 
00732 void KSpellConfig::activateHelp( void )
00733 {
00734   sHelp();
00735 }
00736 
00737 void KSpellConfig::sHelp( void )
00738 {
00739   kapp->invokeHelp("configuration", "kspell");
00740 }
00741 
00742 /*
00743 void KSpellConfig::textChanged1 (const char *s)
00744 {
00745   setDictionary (s);
00746 }
00747 
00748 void KSpellConfig::textChanged2 (const char *)
00749 {
00750   //  setPersonalDict (s);
00751 }
00752 */
00753 
00754 void
00755 KSpellConfig::operator= (const KSpellConfig &ksc)
00756 {
00757   //We want to copy the data members, but not the
00758   //pointers to the child widgets
00759   setNoRootAffix (ksc.noRootAffix());
00760   setRunTogether (ksc.runTogether());
00761   setDictionary (ksc.dictionary());
00762   setDictFromList (ksc.dictFromList());
00763   //  setPersonalDict (ksc.personalDict());
00764   setEncoding (ksc.encoding());
00765   setClient (ksc.client());
00766 
00767   fillInDialog();
00768 }
00769 
00770 void
00771 KSpellConfig::setIgnoreList (QStringList _ignorelist)
00772 {
00773   ignorelist=_ignorelist;
00774 }
00775 
00776 QStringList
00777 KSpellConfig::ignoreList () const
00778 {
00779   return ignorelist;
00780 }
00781 
00782 void
00783 KSpellConfig::setReplaceAllList (QStringList _replacelist)
00784 {
00785   d->replacelist=_replacelist;
00786 }
00787 
00788 QStringList
00789 KSpellConfig::replaceAllList () const
00790 {
00791   return d->replacelist;
00792 }
00793 
00794 #include "ksconfig.moc"
00795 
00796 
00797 
KDE Logo
This file is part of the documentation for kdelibs Version 3.1.0.
Documentation copyright © 1996-2002 the KDE developers.
Generated on Wed Oct 8 12:21:50 2003 by doxygen 1.2.18 written by Dimitri van Heesch, © 1997-2001