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