00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #include <qcheckbox.h>
00022 #include <qcombobox.h>
00023 #include <qlabel.h>
00024 #include <qlayout.h>
00025
00026 #include <kapplication.h>
00027 #include <kconfig.h>
00028 #include <kdebug.h>
00029 #include <kdialog.h>
00030 #include <kfiledialog.h>
00031 #include <kglobal.h>
00032 #include <klineedit.h>
00033 #include <klocale.h>
00034 #include <kpushbutton.h>
00035 #include <kstdguiitem.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
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
00083 if( _ksc == 0 )
00084 {
00085 readGlobalSettings();
00086 }
00087 else
00088 {
00089 setNoRootAffix( _ksc->noRootAffix() );
00090 setRunTogether( _ksc->runTogether() );
00091 setDictionary( _ksc->dictionary() );
00092 setDictFromList( _ksc->dictFromList() );
00093
00094 setIgnoreList( _ksc->ignoreList() );
00095 setEncoding( _ksc->encoding() );
00096 setClient( _ksc->client() );
00097 }
00098
00099 QGridLayout *glay = new QGridLayout( this, 6, 3, 0, KDialog::spacingHint() );
00100 cb1 = new QCheckBox( i18n("Create root/affix combinations"
00101 " not in dictionary"), this, "NoRootAffix" );
00102 connect( cb1, SIGNAL(toggled(bool)), SLOT(sNoAff(bool)) );
00103 glay->addMultiCellWidget( cb1, 0, 0, 0, 2 );
00104
00105 cb2 = new QCheckBox( i18n("Consider run-together words"
00106 " as spelling errors"), this, "RunTogether" );
00107 connect( cb2, SIGNAL(toggled(bool)), SLOT(sRunTogether(bool)) );
00108 glay->addMultiCellWidget( cb2, 1, 1, 0, 2 );
00109
00110 dictcombo = new QComboBox( this, "DictFromList" );
00111 dictcombo->setInsertionPolicy( QComboBox::NoInsertion );
00112 connect( dictcombo, SIGNAL (activated(int)),
00113 this, SLOT (sSetDictionary(int)) );
00114 glay->addMultiCellWidget( dictcombo, 2, 2, 1, 2 );
00115
00116 dictlist = new QLabel( dictcombo, i18n("Dictionary:"), this );
00117 glay->addWidget( dictlist, 2 ,0 );
00118
00119 encodingcombo = new QComboBox( this, "Encoding" );
00120 encodingcombo->insertItem( "US-ASCII" );
00121 encodingcombo->insertItem( "ISO 8859-1" );
00122 encodingcombo->insertItem( "ISO 8859-2" );
00123 encodingcombo->insertItem( "ISO 8859-3" );
00124 encodingcombo->insertItem( "ISO 8859-4" );
00125 encodingcombo->insertItem( "ISO 8859-5" );
00126 encodingcombo->insertItem( "ISO 8859-7" );
00127 encodingcombo->insertItem( "ISO 8859-8" );
00128 encodingcombo->insertItem( "ISO 8859-9" );
00129 encodingcombo->insertItem( "ISO 8859-13" );
00130 encodingcombo->insertItem( "ISO 8859-15" );
00131 encodingcombo->insertItem( "UTF-8" );
00132 encodingcombo->insertItem( "KOI8-R" );
00133 encodingcombo->insertItem( "KOI8-U" );
00134 encodingcombo->insertItem( "CP1251" );
00135 encodingcombo->insertItem( "CP1255" );
00136
00137 connect( encodingcombo, SIGNAL(activated(int)), this,
00138 SLOT(sChangeEncoding(int)) );
00139 glay->addMultiCellWidget( encodingcombo, 3, 3, 1, 2 );
00140
00141 QLabel *tmpQLabel = new QLabel( encodingcombo, i18n("Encoding:"), this);
00142 glay->addWidget( tmpQLabel, 3, 0 );
00143
00144
00145 clientcombo = new QComboBox( this, "Client" );
00146 clientcombo->insertItem( i18n("International Ispell") );
00147 clientcombo->insertItem( i18n("Aspell") );
00148 clientcombo->insertItem( i18n("Hspell") );
00149 connect( clientcombo, SIGNAL (activated(int)), this,
00150 SLOT (sChangeClient(int)) );
00151 glay->addMultiCellWidget( clientcombo, 4, 4, 1, 2 );
00152
00153 tmpQLabel = new QLabel( clientcombo, i18n("Client:"), this );
00154 glay->addWidget( tmpQLabel, 4, 0 );
00155
00156 if( addHelpButton == true )
00157 {
00158 QPushButton *pushButton = new KPushButton( KStdGuiItem::help(), this );
00159 connect( pushButton, SIGNAL(clicked()), this, SLOT(sHelp()) );
00160 glay->addWidget(pushButton, 5, 2);
00161 }
00162
00163 fillInDialog();
00164 }
00165
00166 KSpellConfig::~KSpellConfig()
00167 {
00168 delete d;
00169 }
00170
00171
00172 bool
00173 KSpellConfig::dictFromList() const
00174 {
00175 return dictfromlist;
00176 }
00177
00178 bool
00179 KSpellConfig::readGlobalSettings()
00180 {
00181 KConfigGroupSaver cs( kc,"KSpell" );
00182
00183 setNoRootAffix ( kc->readNumEntry("KSpell_NoRootAffix", 0) );
00184 setRunTogether ( kc->readNumEntry("KSpell_RunTogether", 0) );
00185 setDictionary ( kc->readEntry("KSpell_Dictionary") );
00186 setDictFromList ( kc->readNumEntry("KSpell_DictFromList", false) );
00187 setEncoding ( kc->readNumEntry ("KSpell_Encoding", KS_E_ASCII) );
00188 setClient ( kc->readNumEntry ("KSpell_Client", KS_CLIENT_ISPELL) );
00189
00190 return true;
00191 }
00192
00193 bool
00194 KSpellConfig::writeGlobalSettings ()
00195 {
00196 KConfigGroupSaver cs( kc,"KSpell" );
00197
00198 kc->writeEntry ("KSpell_NoRootAffix",(int) noRootAffix(), true, true);
00199 kc->writeEntry ("KSpell_RunTogether", (int) runTogether(), true, true);
00200 kc->writeEntry ("KSpell_Dictionary", dictionary(), true, true);
00201 kc->writeEntry ("KSpell_DictFromList",(int) dictFromList(), true, true);
00202 kc->writeEntry ("KSpell_Encoding", (int) encoding(),
00203 true, true);
00204 kc->writeEntry ("KSpell_Client", client(),
00205 true, true);
00206 kc->sync();
00207
00208 return true;
00209 }
00210
00211 void
00212 KSpellConfig::sChangeEncoding( int i )
00213 {
00214 kdDebug(750) << "KSpellConfig::sChangeEncoding(" << i << ")" << endl;
00215 setEncoding( i );
00216 emit configChanged();
00217 }
00218
00219 void
00220 KSpellConfig::sChangeClient( int i )
00221 {
00222 setClient( i );
00223
00224
00225 if ( dictcombo ) {
00226 if ( iclient == KS_CLIENT_ISPELL )
00227 getAvailDictsIspell();
00228 else if ( iclient == KS_CLIENT_HSPELL )
00229 {
00230 langfnames.clear();
00231 dictcombo->clear();
00232 dictcombo->insertItem( i18n("Hebrew") );
00233 sChangeEncoding( KS_E_CP1255 );
00234 }
00235 else
00236 getAvailDictsAspell();
00237 }
00238 emit configChanged();
00239 }
00240
00241
00242 bool
00243 KSpellConfig::interpret( QString &fname, QString &lname,
00244 QString &hname )
00245
00246 {
00247
00248 kdDebug(750) << "KSpellConfig::interpret [" << fname << "]" << endl;
00249
00250 QString dname( fname );
00251
00252 if( dname.endsWith( "+" ) )
00253 dname.remove( dname.length()-1, 1 );
00254
00255 if( dname.endsWith("sml") || dname.endsWith("med") || dname.endsWith("lrg") ||
00256 dname.endsWith("xlg"))
00257 dname.remove(dname.length()-3,3);
00258
00259 QString extension;
00260
00261 int i = dname.find('-');
00262 if ( i != -1 )
00263 {
00264 extension = dname.mid(i+1);
00265 dname.truncate(i);
00266 }
00267
00268
00269 if ( dname.length() == 2 ) {
00270 lname = dname;
00271 hname = KGlobal::locale()->twoAlphaToLanguageName( lname );
00272 }
00273 else if ( (dname.length() == 5) && (dname[2] == '_') ) {
00274 lname = dname.left(2);
00275 hname = KGlobal::locale()->twoAlphaToLanguageName(lname);
00276 QString country = KGlobal::locale()->twoAlphaToCountryName( dname.right(2) );
00277 if ( extension.isEmpty() )
00278 extension = country;
00279 else
00280 extension = country + " - " + extension;
00281 }
00282
00283 else if ( dname=="english" || dname=="american" ||
00284 dname=="british" || dname=="canadian" ) {
00285 lname="en"; hname=i18n("English");
00286 }
00287 else if ( dname == "espa~nol" || dname == "espanol" ) {
00288 lname="es"; hname=i18n("Spanish");
00289 }
00290 else if (dname=="dansk") {
00291 lname="da"; hname=i18n("Danish");
00292 }
00293 else if (dname=="deutsch") {
00294 lname="de"; hname=i18n("German");
00295 }
00296 else if (dname=="german") {
00297 lname="de"; hname=i18n("German (new spelling)");
00298 }
00299 else if (dname=="portuguesb" || dname=="br") {
00300 lname="br"; hname=i18n("Brazilian Portuguese");
00301 }
00302 else if (dname=="portugues") {
00303 lname="pt"; hname=i18n("Portuguese");
00304 }
00305 else if (dname=="esperanto") {
00306 lname="eo"; hname=i18n("Esperanto");
00307 }
00308 else if (dname=="norsk") {
00309 lname="no"; hname=i18n("Norwegian");
00310 }
00311 else if (dname=="polish") {
00312 lname="pl"; hname=i18n("Polish"); sChangeEncoding(KS_E_LATIN2);
00313 }
00314 else if (dname=="russian") {
00315 lname="ru"; hname=i18n("Russian");
00316 }
00317 else if (dname=="slovensko") {
00318 lname="si"; hname=i18n("Slovenian"); sChangeEncoding(KS_E_LATIN2);
00319 }
00320 else if (dname=="slovak"){
00321 lname="sk"; hname=i18n("Slovak"); sChangeEncoding(KS_E_LATIN2);
00322 }
00323 else if (dname=="czech") {
00324 lname="cs"; hname=i18n("Czech"); sChangeEncoding(KS_E_LATIN2);
00325 }
00326 else if (dname=="svenska") {
00327 lname="sv"; hname=i18n("Swedish");
00328 }
00329 else if (dname=="swiss") {
00330 lname="de"; hname=i18n("Swiss German");
00331 }
00332 else if (dname=="ukrainian") {
00333 lname="uk"; hname=i18n("Ukrainian");
00334 }
00335 else if (dname=="lietuviu" || dname=="lithuanian") {
00336 lname="lt"; hname=i18n("Lithuanian");
00337 }
00338 else if (dname=="francais" || dname=="french") {
00339 lname="fr"; hname=i18n("French");
00340 }
00341 else if (dname=="belarusian") {
00342 lname="be"; hname=i18n("Belarusian");
00343 }
00344 else if( dname == "magyar" ) {
00345 lname="hu"; hname=i18n("Hungarian");
00346 sChangeEncoding(KS_E_LATIN2);
00347 }
00348 else {
00349 lname=""; hname=i18n("Unknown ispell dictionary", "Unknown");
00350 }
00351 if (!extension.isEmpty())
00352 {
00353 hname = hname + " (" + extension + ")";
00354 }
00355
00356
00357 if ( ( KGlobal::locale()->language() == QString::fromLatin1("C") &&
00358 lname==QString::fromLatin1("en") ) ||
00359 KGlobal::locale()->language() == lname )
00360 return true;
00361
00362 return false;
00363 }
00364
00365 void
00366 KSpellConfig::fillInDialog ()
00367 {
00368 if ( nodialog )
00369 return;
00370
00371 kdDebug(750) << "KSpellConfig::fillinDialog" << endl;
00372
00373 cb1->setChecked( noRootAffix() );
00374 cb2->setChecked( runTogether() );
00375 encodingcombo->setCurrentItem( encoding() );
00376 clientcombo->setCurrentItem( client() );
00377
00378
00379 if ( iclient == KS_CLIENT_ISPELL )
00380 getAvailDictsIspell();
00381 else if ( iclient == KS_CLIENT_HSPELL )
00382 {
00383 langfnames.clear();
00384 dictcombo->clear();
00385 langfnames.append("");
00386 dictcombo->insertItem( i18n("Hebrew") );
00387 }
00388 else
00389 getAvailDictsAspell();
00390
00391
00392 int whichelement=-1;
00393
00394 if ( dictFromList() )
00395 for (unsigned int i=0; i < langfnames.count(); i++)
00396 {
00397 if ( langfnames[i] == dictionary() )
00398 whichelement = i;
00399 }
00400
00401 dictcombo->setMinimumWidth (dictcombo->sizeHint().width());
00402
00403 if (dictionary().isEmpty() || whichelement!=-1)
00404 {
00405 setDictFromList (true);
00406 if (whichelement!=-1)
00407 dictcombo->setCurrentItem(whichelement);
00408 }
00409 else
00410
00411 if ( langfnames.count() >= 1 )
00412 {
00413 setDictFromList( true );
00414 dictcombo->setCurrentItem(0);
00415 }
00416 else
00417 setDictFromList( false );
00418
00419 sDictionary( dictFromList() );
00420 sPathDictionary( !dictFromList() );
00421
00422 }
00423
00424
00425 void KSpellConfig::getAvailDictsIspell () {
00426
00427 langfnames.clear();
00428 dictcombo->clear();
00429 langfnames.append("");
00430 dictcombo->insertItem( i18n("ISpell Default") );
00431
00432
00433 QFileInfo dir ("/usr/lib/ispell");
00434 if (!dir.exists() || !dir.isDir())
00435 dir.setFile ("/usr/local/lib/ispell");
00436 if (!dir.exists() || !dir.isDir())
00437 dir.setFile ("/usr/local/share/ispell");
00438 if (!dir.exists() || !dir.isDir())
00439 dir.setFile ("/usr/share/ispell");
00440
00441
00442
00443
00444
00445 if (!dir.exists() || !dir.isDir()) return;
00446
00447 kdDebug(750) << "KSpellConfig::getAvailDictsIspell "
00448 << dir.filePath() << " " << dir.dirPath() << endl;
00449
00450 QDir thedir (dir.filePath(),"*.hash");
00451
00452 kdDebug(750) << "KSpellConfig" << thedir.path() << "\n" << endl;
00453 kdDebug(750) << "entryList().count()="
00454 << thedir.entryList().count() << endl;
00455
00456 for (unsigned int i=0;i<thedir.entryList().count();i++)
00457 {
00458 QString fname, lname, hname;
00459 fname = thedir [i];
00460
00461
00462 if (fname.endsWith(".hash")) fname.remove (fname.length()-5,5);
00463
00464 if (interpret (fname, lname, hname) && langfnames[0].isEmpty())
00465 {
00466
00467
00468 langfnames.remove ( langfnames.begin() );
00469 langfnames.prepend ( fname );
00470
00471 hname=i18n("default spelling dictionary"
00472 ,"Default - %1 [%2]").arg(hname).arg(fname);
00473
00474 dictcombo->changeItem (hname,0);
00475 }
00476 else
00477 {
00478 langfnames.append (fname);
00479 hname=hname+" ["+fname+"]";
00480
00481 dictcombo->insertItem (hname);
00482 }
00483 }
00484 }
00485
00486 void KSpellConfig::getAvailDictsAspell () {
00487
00488 langfnames.clear();
00489 dictcombo->clear();
00490
00491 langfnames.append("");
00492 dictcombo->insertItem (i18n("ASpell Default"));
00493
00494
00495
00496 QFileInfo dir ("/usr/lib/aspell");
00497 if (!dir.exists() || !dir.isDir())
00498 dir.setFile ("/usr/local/lib/aspell");
00499 if (!dir.exists() || !dir.isDir())
00500 dir.setFile ("/usr/share/aspell");
00501 if (!dir.exists() || !dir.isDir())
00502 dir.setFile ("/usr/local/share/aspell");
00503 if (!dir.exists() || !dir.isDir()) return;
00504
00505 kdDebug(750) << "KSpellConfig::getAvailDictsAspell "
00506 << dir.filePath() << " " << dir.dirPath() << endl;
00507
00508 QDir thedir (dir.filePath(),"*");
00509
00510 kdDebug(750) << "KSpellConfig" << thedir.path() << "\n" << endl;
00511 kdDebug(750) << "entryList().count()="
00512 << thedir.entryList().count() << endl;
00513
00514 for (unsigned int i=0; i<thedir.entryList().count(); i++)
00515 {
00516 QString fname, lname, hname;
00517 fname = thedir [i];
00518
00519
00520
00521
00522 if (fname[0] != '.')
00523 {
00524
00525
00526 if (fname.endsWith(".multi")) fname.remove (fname.length()-6,6);
00527
00528 if (interpret (fname, lname, hname) && langfnames[0].isEmpty())
00529 {
00530
00531
00532 langfnames.remove ( langfnames.begin() );
00533 langfnames.prepend ( fname );
00534
00535 hname=i18n("default spelling dictionary"
00536 ,"Default - %1").arg(hname);
00537
00538 dictcombo->changeItem (hname,0);
00539 }
00540 else
00541 {
00542 langfnames.append (fname);
00543 dictcombo->insertItem (hname);
00544 }
00545 }
00546 }
00547 }
00548
00549 void
00550 KSpellConfig::fillDicts( QComboBox* box, QStringList* dictionaries )
00551 {
00552 langfnames.clear();
00553 if ( box ) {
00554 if ( iclient == KS_CLIENT_ISPELL ) {
00555 box->clear();
00556 langfnames.append("");
00557 box->insertItem( i18n("ISpell Default") );
00558
00559
00560 QFileInfo dir ("/usr/lib/ispell");
00561 if (!dir.exists() || !dir.isDir())
00562 dir.setFile ("/usr/local/lib/ispell");
00563 if (!dir.exists() || !dir.isDir())
00564 dir.setFile ("/usr/local/share/ispell");
00565 if (!dir.exists() || !dir.isDir())
00566 dir.setFile ("/usr/share/ispell");
00567
00568
00569
00570
00571
00572 if (!dir.exists() || !dir.isDir()) return;
00573
00574 kdDebug(750) << "KSpellConfig::getAvailDictsIspell "
00575 << dir.filePath() << " " << dir.dirPath() << endl;
00576
00577 QDir thedir (dir.filePath(),"*.hash");
00578
00579 kdDebug(750) << "KSpellConfig" << thedir.path() << "\n" << endl;
00580 kdDebug(750) << "entryList().count()="
00581 << thedir.entryList().count() << endl;
00582
00583 for (unsigned int i=0;i<thedir.entryList().count();i++)
00584 {
00585 QString fname, lname, hname;
00586 fname = thedir [i];
00587
00588
00589 if (fname.endsWith(".hash")) fname.remove (fname.length()-5,5);
00590
00591 if (interpret (fname, lname, hname) && langfnames[0].isEmpty())
00592 {
00593
00594
00595 langfnames.remove ( langfnames.begin() );
00596 langfnames.prepend ( fname );
00597
00598 hname=i18n("default spelling dictionary"
00599 ,"Default - %1 [%2]").arg(hname).arg(fname);
00600
00601 box->changeItem (hname,0);
00602 }
00603 else
00604 {
00605 langfnames.append (fname);
00606 hname=hname+" ["+fname+"]";
00607
00608 box->insertItem (hname);
00609 }
00610 }
00611 } else if ( iclient == KS_CLIENT_HSPELL ) {
00612 box->clear();
00613 box->insertItem( i18n("Hebrew") );
00614 langfnames.append("");
00615 sChangeEncoding( KS_E_CP1255 );
00616 }
00617 else {
00618 box->clear();
00619 langfnames.append("");
00620 box->insertItem (i18n("ASpell Default"));
00621
00622
00623
00624 QFileInfo dir ("/usr/lib/aspell");
00625 if (!dir.exists() || !dir.isDir())
00626 dir.setFile ("/usr/local/lib/aspell");
00627 if (!dir.exists() || !dir.isDir())
00628 dir.setFile ("/usr/share/aspell");
00629 if (!dir.exists() || !dir.isDir())
00630 dir.setFile ("/usr/local/share/aspell");
00631 if (!dir.exists() || !dir.isDir()) return;
00632
00633 kdDebug(750) << "KSpellConfig::getAvailDictsAspell "
00634 << dir.filePath() << " " << dir.dirPath() << endl;
00635
00636 QDir thedir (dir.filePath(),"*");
00637
00638 kdDebug(750) << "KSpellConfig" << thedir.path() << "\n" << endl;
00639 kdDebug(750) << "entryList().count()="
00640 << thedir.entryList().count() << endl;
00641
00642 for (unsigned int i=0; i<thedir.entryList().count(); i++)
00643 {
00644 QString fname, lname, hname;
00645 fname = thedir [i];
00646
00647
00648
00649
00650 if (fname[0] != '.')
00651 {
00652
00653
00654 if (fname.endsWith(".multi")) fname.remove (fname.length()-6,6);
00655
00656 if (interpret (fname, lname, hname) && langfnames[0].isEmpty())
00657 {
00658
00659
00660 langfnames.remove ( langfnames.begin() );
00661 langfnames.prepend ( fname );
00662
00663 hname=i18n("default spelling dictionary"
00664 ,"Default - %1").arg(hname);
00665
00666 box->changeItem (hname,0);
00667 }
00668 else
00669 {
00670 langfnames.append (fname);
00671 box->insertItem (hname);
00672 }
00673 }
00674 }
00675 }
00676 int whichelement = -1;
00677 for ( unsigned int i = 0; i < langfnames.count(); ++i ) {
00678 if ( langfnames[i] == qsdict )
00679 whichelement = i;
00680 }
00681 if ( whichelement >= 0 ) {
00682 box->setCurrentItem( whichelement );
00683 }
00684 if ( dictionaries )
00685 *dictionaries = langfnames;
00686 }
00687 }
00688
00689
00690
00691
00692
00693 void
00694 KSpellConfig::setClient (int c)
00695 {
00696 iclient = c;
00697
00698 if (clientcombo)
00699 clientcombo->setCurrentItem(c);
00700 }
00701
00702 void
00703 KSpellConfig::setNoRootAffix (bool b)
00704 {
00705 bnorootaffix=b;
00706
00707 if(cb1)
00708 cb1->setChecked(b);
00709 }
00710
00711 void
00712 KSpellConfig::setRunTogether(bool b)
00713 {
00714 bruntogether=b;
00715
00716 if(cb2)
00717 cb2->setChecked(b);
00718 }
00719
00720 void
00721 KSpellConfig::setDictionary (const QString s)
00722 {
00723 qsdict=s;
00724
00725 if (qsdict.length()>5)
00726 if ((signed)qsdict.find(".hash")==(signed)qsdict.length()-5)
00727 qsdict.remove (qsdict.length()-5,5);
00728
00729
00730 if(dictcombo)
00731 {
00732 int whichelement=-1;
00733 if (dictFromList())
00734 {
00735 for (unsigned int i=0;i<langfnames.count();i++)
00736 {
00737 if (langfnames[i] == s)
00738 whichelement=i;
00739 }
00740
00741 if(whichelement >= 0)
00742 {
00743 dictcombo->setCurrentItem(whichelement);
00744 }
00745 }
00746 }
00747
00748
00749 }
00750
00751 void
00752 KSpellConfig::setDictFromList (bool dfl)
00753 {
00754
00755 dictfromlist=dfl;
00756 }
00757
00758
00759
00760
00761
00762
00763
00764
00765 void
00766 KSpellConfig::setEncoding (int enctype)
00767 {
00768 enc=enctype;
00769
00770 if(encodingcombo)
00771 encodingcombo->setCurrentItem(enctype);
00772 }
00773
00774
00775
00776
00777 int
00778 KSpellConfig::client () const
00779 {
00780 return iclient;
00781 }
00782
00783
00784 bool
00785 KSpellConfig::noRootAffix () const
00786 {
00787 return bnorootaffix;
00788 }
00789
00790 bool
00791 KSpellConfig::runTogether() const
00792 {
00793 return bruntogether;
00794 }
00795
00796 const
00797 QString KSpellConfig::dictionary () const
00798 {
00799 return qsdict;
00800 }
00801
00802
00803
00804
00805
00806
00807
00808
00809 int
00810 KSpellConfig::encoding () const
00811 {
00812 return enc;
00813 }
00814
00815 void
00816 KSpellConfig::sRunTogether(bool)
00817 {
00818 setRunTogether (cb2->isChecked());
00819 emit configChanged();
00820 }
00821
00822 void
00823 KSpellConfig::sNoAff(bool)
00824 {
00825 setNoRootAffix (cb1->isChecked());
00826 emit configChanged();
00827 }
00828
00829
00830
00831
00832
00833
00834
00835
00836
00837
00838
00839
00840
00841
00842
00843
00844
00845
00846
00847
00848
00849
00850
00851
00852
00853
00854 void
00855 KSpellConfig::sSetDictionary (int i)
00856 {
00857 setDictionary (langfnames[i]);
00858 setDictFromList (true);
00859 emit configChanged();
00860 }
00861
00862 void
00863 KSpellConfig::sDictionary(bool on)
00864 {
00865 if (on)
00866 {
00867 dictcombo->setEnabled (true);
00868 setDictionary (langfnames[dictcombo->currentItem()] );
00869 setDictFromList (true);
00870 }
00871 else
00872 {
00873 dictcombo->setEnabled (false);
00874 }
00875 emit configChanged();
00876 }
00877
00878 void
00879 KSpellConfig::sPathDictionary(bool on)
00880 {
00881 return;
00882
00883
00884 if (on)
00885 {
00886
00887
00888
00889 setDictFromList (false);
00890 }
00891 else
00892 {
00893
00894
00895 }
00896 emit configChanged();
00897 }
00898
00899
00900 void KSpellConfig::activateHelp( void )
00901 {
00902 sHelp();
00903 }
00904
00905 void KSpellConfig::sHelp( void )
00906 {
00907 kapp->invokeHelp("configuration", "kspell");
00908 }
00909
00910
00911
00912
00913
00914
00915
00916
00917
00918
00919
00920
00921
00922 void
00923 KSpellConfig::operator= (const KSpellConfig &ksc)
00924 {
00925
00926
00927 setNoRootAffix (ksc.noRootAffix());
00928 setRunTogether (ksc.runTogether());
00929 setDictionary (ksc.dictionary());
00930 setDictFromList (ksc.dictFromList());
00931
00932 setEncoding (ksc.encoding());
00933 setClient (ksc.client());
00934
00935 fillInDialog();
00936 }
00937
00938
00939 void
00940 KSpellConfig::setIgnoreList (QStringList _ignorelist)
00941 {
00942 ignorelist=_ignorelist;
00943 }
00944
00945 QStringList
00946 KSpellConfig::ignoreList () const
00947 {
00948 return ignorelist;
00949 }
00950
00951
00952 void
00953 KSpellConfig::setReplaceAllList (QStringList _replacelist)
00954 {
00955 d->replacelist=_replacelist;
00956 }
00957
00958 QStringList
00959 KSpellConfig::replaceAllList() const
00960 {
00961 return d->replacelist;
00962 }
00963
00964 #include "ksconfig.moc"
00965
00966
00967