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.2.3 2003/09/05 10:46:36 livne 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   encodingcombo->insertItem ("CP1255");
00135 
00136   connect (encodingcombo, SIGNAL (activated(int)), this,
00137        SLOT (sChangeEncoding(int)));
00138   glay->addMultiCellWidget (encodingcombo, 3, 3, 1, 2);
00139 
00140   QLabel *tmpQLabel = new QLabel( encodingcombo, i18n("Encoding:"), this);
00141   glay->addWidget( tmpQLabel, 3, 0 );
00142 
00143 
00144   clientcombo = new QComboBox( this );
00145   clientcombo->insertItem (i18n("International Ispell"));
00146   clientcombo->insertItem (i18n("Aspell"));
00147   clientcombo->insertItem (i18n("Hspell"));
00148   connect (clientcombo, SIGNAL (activated(int)), this,
00149        SLOT (sChangeClient(int)));
00150   glay->addMultiCellWidget( clientcombo, 4, 4, 1, 2 );
00151 
00152   tmpQLabel = new QLabel( clientcombo, i18n("Client:"), this );
00153   glay->addWidget( tmpQLabel, 4, 0 );
00154 
00155   if( addHelpButton == true )
00156   {
00157     QPushButton *pushButton = new QPushButton( i18n("&Help"), this );
00158     connect( pushButton, SIGNAL(clicked()), this, SLOT(sHelp()) );
00159     glay->addWidget(pushButton, 5, 2);
00160   }
00161 
00162   fillInDialog();
00163 }
00164 
00165 KSpellConfig::~KSpellConfig ()
00166 {
00167     delete d;
00168 }
00169 
00170 
00171 bool
00172 KSpellConfig::dictFromList () const
00173 {
00174   return dictfromlist;
00175 }
00176 
00177 bool
00178 KSpellConfig::readGlobalSettings ()
00179 {
00180   KConfigGroupSaver cs(kc,"KSpell");
00181 
00182   setNoRootAffix   (kc->readNumEntry ("KSpell_NoRootAffix", 0));
00183   setRunTogether   (kc->readNumEntry ("KSpell_RunTogether", 0));
00184   setDictionary    (kc->readEntry ("KSpell_Dictionary", ""));
00185   setDictFromList  (kc->readNumEntry ("KSpell_DictFromList", FALSE));
00186   setEncoding (kc->readNumEntry ("KSpell_Encoding", KS_E_ASCII));
00187   setClient (kc->readNumEntry ("KSpell_Client", KS_CLIENT_ASPELL));
00188 
00189   return TRUE;
00190 }
00191 
00192 bool
00193 KSpellConfig::writeGlobalSettings ()
00194 {
00195   KConfigGroupSaver cs(kc,"KSpell");
00196   kc->writeEntry ("KSpell_NoRootAffix",(int) noRootAffix (), TRUE, TRUE);
00197   kc->writeEntry ("KSpell_RunTogether", (int) runTogether (), TRUE, TRUE);
00198   kc->writeEntry ("KSpell_Dictionary", dictionary (), TRUE, TRUE);
00199   kc->writeEntry ("KSpell_DictFromList",(int) dictFromList(), TRUE, TRUE);
00200   kc->writeEntry ("KSpell_Encoding", (int) encoding(),
00201           TRUE, TRUE);
00202   kc->writeEntry ("KSpell_Client", client(),
00203           TRUE, TRUE);
00204   kc->sync();
00205   return TRUE;
00206 }
00207 
00208 void
00209 KSpellConfig::sChangeEncoding(int i)
00210 {
00211     kdDebug(750) << "KSpellConfig::sChangeEncoding(" << i << ")" << endl;
00212   setEncoding (i);
00213   emit configChanged();
00214 }
00215 
00216 void
00217 KSpellConfig::sChangeClient (int i)
00218 {
00219   setClient (i);
00220 
00221   // read in new dict list
00222   if (dictcombo) {
00223     if (iclient == KS_CLIENT_ISPELL)
00224       getAvailDictsIspell();
00225     else if (iclient == KS_CLIENT_HSPELL)
00226     {
00227       langfnames.clear();
00228       dictcombo->clear();
00229       dictcombo->insertItem(i18n("Hebrew"));
00230       sChangeEncoding(KS_E_CP1255);
00231     }
00232     else
00233       getAvailDictsAspell();
00234   }
00235   emit configChanged();
00236 }
00237 
00238 bool
00239 KSpellConfig::interpret (QString &fname, QString &lname,
00240                   QString &hname)
00241 
00242 {
00243 
00244   kdDebug(750) << "KSpellConfig::interpret [" << fname << "]" << endl;
00245 
00246   QString dname(fname);
00247 
00248   if(dname.right(1)=="+")
00249     dname.remove(dname.length()-1, 1);
00250 
00251   if(dname.right(3)=="sml" || dname.right(3)=="med" || dname.right(3)=="lrg" || dname.right(3)=="xlg")
00252      dname.remove(dname.length()-3,3);
00253 
00254   QString extension;
00255 
00256   int i = dname.find('-');
00257   if (i != -1)
00258   {
00259     extension = dname.mid(i+1);
00260     dname.truncate(i);
00261   }
00262 
00263   // Aspell uses 2 alpha language codes or 2 alpha language + 2 alpha country
00264   if (dname.length() == 2) {
00265     lname = dname;
00266     hname = KGlobal::locale()->twoAlphaToLanguageName(lname);
00267   }
00268   else if ((dname.length() == 5) && (dname[2] == '_')) {
00269     lname = dname.left(2);
00270     hname = KGlobal::locale()->twoAlphaToLanguageName(lname);
00271     QString country = KGlobal::locale()->twoAlphaToCountryName(dname.right(2));
00272     if (extension.isEmpty())
00273       extension = country;
00274     else
00275       extension = country + " - " + extension;
00276   }
00277   //These are mostly the ispell-langpack defaults
00278   else if (dname=="english" || dname=="american" ||
00279       dname=="british" || dname=="canadian") {
00280     lname="en"; hname=i18n("English");
00281   }
00282   else if (dname=="espa~nol" || dname=="espanol") {
00283     lname="es"; hname=i18n("Spanish");
00284   }
00285   else if (dname=="dansk") {
00286     lname="da"; hname=i18n("Danish");
00287   }
00288   else if (dname=="deutsch") {
00289     lname="de"; hname=i18n("German");
00290   }
00291   else if (dname=="german") {
00292     lname="de"; hname=i18n("German (new spelling)");
00293   }
00294   else if (dname=="portuguesb" || dname=="br") {
00295     lname="br"; hname=i18n("Brazilian Portuguese");
00296   }
00297   else if (dname=="portugues") {
00298     lname="pt"; hname=i18n("Portuguese");
00299   }
00300   else if (dname=="esperanto") {
00301     lname="eo"; hname=i18n("Esperanto");
00302   }
00303   else if (dname=="norsk") {
00304     lname="no"; hname=i18n("Norwegian");
00305   }
00306   else if (dname=="polish") {
00307     lname="pl"; hname=i18n("Polish"); sChangeEncoding(KS_E_LATIN2);
00308   }
00309   else if (dname=="russian") {
00310     lname="ru"; hname=i18n("Russian");
00311   }
00312   else if (fname=="russianw") {
00313     lname="ru"; hname=i18n("Russian Win");
00314   }
00315   else if (dname=="slovensko") {
00316     lname="si"; hname=i18n("Slovenian"); sChangeEncoding(KS_E_LATIN2);
00317   }
00318   else if (dname=="slovak"){
00319     lname="sk"; hname=i18n("Slovak"); sChangeEncoding(KS_E_LATIN2);
00320   }
00321   else if (dname=="czech") {
00322     lname="cs"; hname=i18n("Czech"); sChangeEncoding(KS_E_LATIN2);
00323   }
00324   else if (dname=="svenska") {
00325     lname="sv"; hname=i18n("Swedish");
00326   }
00327   else if (dname=="swiss") {
00328     lname="de"; hname=i18n("Swiss German");
00329   }
00330   else if (dname=="ukrainian") {
00331     lname="uk"; hname=i18n("Ukrainian");
00332   }
00333   else if (dname=="lietuviu" || dname=="lithuanian") {
00334      lname="lt"; hname=i18n("Lithuanian");
00335   }
00336   else if (dname=="francais" || dname=="french") {
00337     lname="fr"; hname=i18n("French");
00338   }
00339   else if (dname=="belarusian") {  // waiting for post 2.2 to not dissapoint translators
00340     lname="be"; hname=i18n("Belarusian");
00341   }
00342   else if( dname == "magyar" ) {
00343     lname="hu"; hname=i18n("Hungarian");
00344     sChangeEncoding(KS_E_LATIN2);
00345   }
00346   else {
00347     lname=""; hname=i18n("Unknown ispell dictionary", "Unknown");
00348   }
00349   if (!extension.isEmpty())
00350   {
00351     hname = hname + " (" + extension + ")";
00352   }
00353 
00354   //We have explicitly chosen English as the default here.
00355   if ( (KGlobal::locale()->language()==QString::fromLatin1("C") &&
00356     lname==QString::fromLatin1("en")) ||
00357        KGlobal::locale()->language()==lname)
00358     return TRUE;
00359 
00360   return FALSE;
00361 }
00362 
00363 void
00364 KSpellConfig::fillInDialog ()
00365 {
00366   if (nodialog)
00367     return;
00368 
00369     kdDebug(750) << "KSpellConfig::fillinDialog" << endl;
00370 
00371   cb1->setChecked (noRootAffix());
00372   cb2->setChecked (runTogether());
00373   encodingcombo->setCurrentItem (encoding());
00374   clientcombo->setCurrentItem (client());
00375 
00376   // get list of available dictionaries
00377   if (iclient == KS_CLIENT_ISPELL)
00378     getAvailDictsIspell();
00379   else if (iclient == KS_CLIENT_HSPELL)
00380   {
00381     langfnames.clear();
00382     dictcombo->clear();
00383     dictcombo->insertItem(i18n("Hebrew"));
00384   }
00385   else
00386     getAvailDictsAspell();
00387 
00388   // select the used dictionary in the list
00389   int whichelement=-1;
00390 
00391   if (dictFromList())
00392     for (unsigned int i=0; i<langfnames.count(); i++)
00393       {
00394     if (langfnames[i] == dictionary())
00395       whichelement=i;
00396       }
00397 
00398   dictcombo->setMinimumWidth (dictcombo->sizeHint().width());
00399 
00400   if (dictionary().isEmpty() ||  whichelement!=-1)
00401     {
00402       setDictFromList (TRUE);
00403       if (whichelement!=-1)
00404     dictcombo->setCurrentItem(whichelement);
00405     }
00406   else
00407     // Current dictionary vanished, present the user with a default if possible.
00408     if (langfnames.count()>=1)
00409     {
00410       setDictFromList (TRUE);
00411       dictcombo->setCurrentItem(0);
00412     }
00413     else
00414       setDictFromList (FALSE);
00415 
00416   sDictionary (dictFromList());
00417   sPathDictionary (!dictFromList());
00418 
00419 }
00420 
00421 
00422 void KSpellConfig::getAvailDictsIspell () {
00423 
00424   langfnames.clear();
00425   dictcombo->clear();
00426   langfnames.append(""); // Default
00427   dictcombo->insertItem (i18n("ISpell Default"));
00428 
00429   // dictionary path
00430   QFileInfo dir ("/usr/lib/ispell");
00431   if (!dir.exists() || !dir.isDir())
00432     dir.setFile ("/usr/local/lib/ispell");
00433   if (!dir.exists() || !dir.isDir())
00434     dir.setFile ("/usr/local/share/ispell");
00435   if (!dir.exists() || !dir.isDir())
00436     dir.setFile ("/usr/share/ispell");
00437   /* TODO get them all instead of just one of them.
00438    * If /usr/local/lib exists, it skips the rest
00439   if (!dir.exists() || !dir.isDir())
00440     dir.setFile ("/usr/local/lib");
00441   */
00442   if (!dir.exists() || !dir.isDir()) return;
00443 
00444   kdDebug(750) << "KSpellConfig::getAvailDictsIspell "
00445            << dir.filePath() << " " << dir.dirPath() << endl;
00446 
00447   QDir thedir (dir.filePath(),"*.hash");
00448 
00449   kdDebug(750) << "KSpellConfig" << thedir.path() << "\n" << endl;
00450   kdDebug(750) << "entryList().count()="
00451            << thedir.entryList().count() << endl;
00452 
00453   for (unsigned int i=0;i<thedir.entryList().count();i++)
00454     {
00455       QString fname, lname, hname;
00456       fname = thedir [i];
00457 
00458       // remove .hash
00459       if (fname.right(5) == ".hash") fname.remove (fname.length()-5,5);
00460 
00461       if (interpret (fname, lname, hname) && langfnames[0].isEmpty())
00462     { // This one is the KDE default language
00463       // so place it first in the lists (overwrite "Default")
00464 
00465       langfnames.remove ( langfnames.begin() );
00466       langfnames.prepend ( fname );
00467 
00468       hname=i18n("default spelling dictionary"
00469              ,"Default - %1 [%2]").arg(hname).arg(fname);
00470 
00471       dictcombo->changeItem (hname,0);
00472     }
00473       else
00474     {
00475       langfnames.append (fname);
00476       hname=hname+" ["+fname+"]";
00477 
00478       dictcombo->insertItem (hname);
00479     }
00480     }
00481 }
00482 
00483 void KSpellConfig::getAvailDictsAspell () {
00484 
00485   langfnames.clear();
00486   dictcombo->clear();
00487 
00488   langfnames.append(""); // Default
00489   dictcombo->insertItem (i18n("ASpell Default"));
00490 
00491   // dictionary path
00492   // FIXME: use "aspell dump config" to find out the dict-dir
00493   QFileInfo dir ("/usr/lib/aspell");
00494   if (!dir.exists() || !dir.isDir())
00495     dir.setFile ("/usr/local/lib/aspell");
00496   if (!dir.exists() || !dir.isDir())
00497     dir.setFile ("/usr/share/aspell");
00498   if (!dir.exists() || !dir.isDir())
00499     dir.setFile ("/usr/local/share/aspell");
00500   if (!dir.exists() || !dir.isDir()) return;
00501 
00502   kdDebug(750) << "KSpellConfig::getAvailDictsAspell "
00503            << dir.filePath() << " " << dir.dirPath() << endl;
00504 
00505   QDir thedir (dir.filePath(),"*");
00506 
00507   kdDebug(750) << "KSpellConfig" << thedir.path() << "\n" << endl;
00508   kdDebug(750) << "entryList().count()="
00509            << thedir.entryList().count() << endl;
00510 
00511   for (unsigned int i=0; i<thedir.entryList().count(); i++)
00512     {
00513       QString fname, lname, hname;
00514       fname = thedir [i];
00515 
00516       // consider only simple dicts without '-' in the name
00517       // FIXME: may be this is wrong an the list should contain
00518       // all *.multi files too, to allow using special dictionaries
00519       if (fname[0] != '.')
00520     {
00521 
00522       // remove .multi
00523       if (fname.right(6) == ".multi") fname.remove (fname.length()-6,6);
00524 
00525       if (interpret (fname, lname, hname) && langfnames[0].isEmpty())
00526         { // This one is the KDE default language
00527           // so place it first in the lists (overwrite "Default")
00528 
00529           langfnames.remove ( langfnames.begin() );
00530           langfnames.prepend ( fname );
00531 
00532           hname=i18n("default spelling dictionary"
00533              ,"Default - %1").arg(hname);
00534 
00535           dictcombo->changeItem (hname,0);
00536         }
00537       else
00538         {
00539           langfnames.append (fname);
00540           dictcombo->insertItem (hname);
00541         }
00542     }
00543     }
00544 }
00545 
00546 /*
00547  * Options setting routines.
00548  */
00549 
00550 void
00551 KSpellConfig::setClient (int c)
00552 {
00553   iclient = c;
00554 
00555   if (clientcombo)
00556       clientcombo->setCurrentItem(c);
00557 }
00558 
00559 void
00560 KSpellConfig::setNoRootAffix (bool b)
00561 {
00562   bnorootaffix=b;
00563 
00564   if(cb1)
00565       cb1->setChecked(b);
00566 }
00567 
00568 void
00569 KSpellConfig::setRunTogether(bool b)
00570 {
00571   bruntogether=b;
00572 
00573   if(cb2)
00574       cb2->setChecked(b);
00575 }
00576 
00577 void
00578 KSpellConfig::setDictionary (const QString s)
00579 {
00580   qsdict=s; //.copy();
00581 
00582   if (qsdict.length()>5)
00583     if ((signed)qsdict.find(".hash")==(signed)qsdict.length()-5)
00584       qsdict.remove (qsdict.length()-5,5);
00585 
00586 
00587   if(dictcombo)
00588   {
00589     int whichelement=-1;
00590     if (dictFromList())
00591     {
00592       for (unsigned int i=0;i<langfnames.count();i++)
00593       {
00594          if (langfnames[i] == s)
00595            whichelement=i;
00596       }
00597 
00598       if(whichelement >= 0)
00599       {
00600         dictcombo->setCurrentItem(whichelement);
00601       }
00602     }
00603   }
00604 
00605 
00606 }
00607 
00608 void
00609 KSpellConfig::setDictFromList (bool dfl)
00610 {
00611   //  kdebug (KDEBUG_INFO, 750, "sdfl = %d", dfl);
00612   dictfromlist=dfl;
00613 }
00614 
00615 /*
00616 void KSpellConfig::setPersonalDict (const char *s)
00617 {
00618   qspdict=s;
00619 }
00620 */
00621 
00622 void
00623 KSpellConfig::setEncoding (int enctype)
00624 {
00625   enc=enctype;
00626 
00627   if(encodingcombo)
00628     encodingcombo->setCurrentItem(enctype);
00629 }
00630 
00631 /*
00632   Options reading routines.
00633  */
00634 int
00635 KSpellConfig::client () const
00636 {
00637   return iclient;
00638 }
00639 
00640 
00641 bool
00642 KSpellConfig::noRootAffix () const
00643 {
00644   return bnorootaffix;
00645 }
00646 
00647 bool
00648 KSpellConfig::runTogether() const
00649 {
00650   return bruntogether;
00651 }
00652 
00653 const
00654 QString KSpellConfig::dictionary () const
00655 {
00656   return qsdict;
00657 }
00658 
00659 /*
00660 const QString KSpellConfig::personalDict () const
00661 {
00662   return qspdict;
00663 }
00664 */
00665 
00666 int
00667 KSpellConfig::encoding () const
00668 {
00669   return enc;
00670 }
00671 
00672 void
00673 KSpellConfig::sRunTogether(bool)
00674 {
00675   setRunTogether (cb2->isChecked());
00676   emit configChanged();
00677 }
00678 
00679 void
00680 KSpellConfig::sNoAff(bool)
00681 {
00682   setNoRootAffix (cb1->isChecked());
00683   emit configChanged();
00684 }
00685 
00686 /*
00687 void
00688 KSpellConfig::sBrowseDict()
00689 {
00690   return;
00691 
00692   QString qs( KFileDialog::getOpenFileName ("/usr/local/lib","*.hash") );
00693   if ( !qs.isNull() )
00694     kle1->setText (qs);
00695 
00696 }
00697 */
00698 
00699 /*
00700 void KSpellConfig::sBrowsePDict()
00701 {
00702   //how do I find home directory path??
00703   QString qs( KFileDialog::getOpenFileName ("",".ispell_*") );
00704   if ( !qs.isNull() )
00705       kle2->setText (qs);
00706 
00707 
00708 }
00709 */
00710 
00711 void
00712 KSpellConfig::sSetDictionary (int i)
00713 {
00714   setDictionary (langfnames[i]);
00715   setDictFromList (TRUE);
00716   emit configChanged();
00717 }
00718 
00719 void
00720 KSpellConfig::sDictionary(bool on)
00721 {
00722   if (on)
00723     {
00724       dictcombo->setEnabled (TRUE);
00725       setDictionary (langfnames[dictcombo->currentItem()] );
00726       setDictFromList (TRUE);
00727     }
00728   else
00729     {
00730       dictcombo->setEnabled (FALSE);
00731     }
00732   emit configChanged();
00733 }
00734 
00735 void
00736 KSpellConfig::sPathDictionary(bool on)
00737 {
00738   return; //enough for now
00739 
00740 
00741   if (on)
00742     {
00743       //kle1->setEnabled (TRUE);
00744       //      browsebutton1->setEnabled (TRUE);
00745       //setDictionary (kle1->text());
00746       setDictFromList (FALSE);
00747     }
00748   else
00749     {
00750       //kle1->setEnabled (FALSE);
00751       //browsebutton1->setEnabled (FALSE);
00752     }
00753   emit configChanged();
00754 }
00755 
00756 
00757 void KSpellConfig::activateHelp( void )
00758 {
00759   sHelp();
00760 }
00761 
00762 void KSpellConfig::sHelp( void )
00763 {
00764   kapp->invokeHelp("configuration", "kspell");
00765 }
00766 
00767 /*
00768 void KSpellConfig::textChanged1 (const char *s)
00769 {
00770   setDictionary (s);
00771 }
00772 
00773 void KSpellConfig::textChanged2 (const char *)
00774 {
00775   //  setPersonalDict (s);
00776 }
00777 */
00778 
00779 void
00780 KSpellConfig::operator= (const KSpellConfig &ksc)
00781 {
00782   //We want to copy the data members, but not the
00783   //pointers to the child widgets
00784   setNoRootAffix (ksc.noRootAffix());
00785   setRunTogether (ksc.runTogether());
00786   setDictionary (ksc.dictionary());
00787   setDictFromList (ksc.dictFromList());
00788   //  setPersonalDict (ksc.personalDict());
00789   setEncoding (ksc.encoding());
00790   setClient (ksc.client());
00791 
00792   fillInDialog();
00793 }
00794 
00795 void
00796 KSpellConfig::setIgnoreList (QStringList _ignorelist)
00797 {
00798   ignorelist=_ignorelist;
00799 }
00800 
00801 QStringList
00802 KSpellConfig::ignoreList () const
00803 {
00804   return ignorelist;
00805 }
00806 
00807 void
00808 KSpellConfig::setReplaceAllList (QStringList _replacelist)
00809 {
00810   d->replacelist=_replacelist;
00811 }
00812 
00813 QStringList
00814 KSpellConfig::replaceAllList () const
00815 {
00816   return d->replacelist;
00817 }
00818 
00819 #include "ksconfig.moc"
00820 
00821 
00822 
KDE Logo
This file is part of the documentation for kdelibs Version 3.1.4.
Documentation copyright © 1996-2002 the KDE developers.
Generated on Wed Mar 16 18:44:43 2005 by doxygen 1.3.3 written by Dimitri van Heesch, © 1997-2001