Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 202627
Collapse All | Expand All

(-)kdeui/ksconfig.cpp.old (-117 / +6 lines)
Lines 145-154 Link Here
145
145
146
146
147
  clientcombo = new QComboBox( this, "Client" );
147
  clientcombo = new QComboBox( this, "Client" );
148
  clientcombo->insertItem( i18n("International Ispell") );
149
  clientcombo->insertItem( i18n("Aspell") );
148
  clientcombo->insertItem( i18n("Aspell") );
150
  clientcombo->insertItem( i18n("Hspell") );
151
  clientcombo->insertItem( i18n("Zemberek") );
152
  connect( clientcombo, SIGNAL (activated(int)), this,
149
  connect( clientcombo, SIGNAL (activated(int)), this,
153
	   SLOT (sChangeClient(int)) );
150
	   SLOT (sChangeClient(int)) );
154
  glay->addMultiCellWidget( clientcombo, 4, 4, 1, 2 );
151
  glay->addMultiCellWidget( clientcombo, 4, 4, 1, 2 );
Lines 188-194 Link Here
188
  setDictionary    ( kc->readEntry("KSpell_Dictionary") );
185
  setDictionary    ( kc->readEntry("KSpell_Dictionary") );
189
  setDictFromList  ( kc->readNumEntry("KSpell_DictFromList", false) );
186
  setDictFromList  ( kc->readNumEntry("KSpell_DictFromList", false) );
190
  setEncoding ( kc->readNumEntry ("KSpell_Encoding", KS_E_ASCII) );
187
  setEncoding ( kc->readNumEntry ("KSpell_Encoding", KS_E_ASCII) );
191
  setClient ( kc->readNumEntry ("KSpell_Client", KS_CLIENT_ISPELL) );
188
  setClient ( kc->readNumEntry ("KSpell_Client", KS_CLIENT_ASPELL) );
192
189
193
  return true;
190
  return true;
194
}
191
}
Lines 222-248 Link Here
222
void
219
void
223
KSpellConfig::sChangeClient( int i )
220
KSpellConfig::sChangeClient( int i )
224
{
221
{
225
  setClient( i );
222
  setClient( 1 );
223
224
  getAvailDictsAspell();
226
225
227
  // read in new dict list
228
  if ( dictcombo ) {
229
    if ( iclient == KS_CLIENT_ISPELL )
230
      getAvailDictsIspell();
231
    else if ( iclient == KS_CLIENT_HSPELL )
232
    {
233
      langfnames.clear();
234
      dictcombo->clear();
235
      dictcombo->insertItem( i18n("Hebrew") );
236
      sChangeEncoding( KS_E_CP1255 );
237
    } else if ( iclient == KS_CLIENT_ZEMBEREK ) {
238
      langfnames.clear();
239
      dictcombo->clear();
240
      dictcombo->insertItem( i18n("Turkish") );
241
      sChangeEncoding( KS_E_UTF8 );
242
    }
243
    else
244
      getAvailDictsAspell();
245
  }
246
  emit configChanged();
226
  emit configChanged();
247
}
227
}
248
228
Lines 384-406 Link Here
384
  encodingcombo->setCurrentItem( encoding() );
364
  encodingcombo->setCurrentItem( encoding() );
385
  clientcombo->setCurrentItem( client() );
365
  clientcombo->setCurrentItem( client() );
386
366
387
  // get list of available dictionaries
367
  getAvailDictsAspell();
388
  if ( iclient == KS_CLIENT_ISPELL )
389
    getAvailDictsIspell();
390
  else if ( iclient == KS_CLIENT_HSPELL )
391
  {
392
    langfnames.clear();
393
    dictcombo->clear();
394
    langfnames.append(""); // Default
395
    dictcombo->insertItem( i18n("Hebrew") );
396
  } else if ( iclient == KS_CLIENT_ZEMBEREK ) {
397
    langfnames.clear();
398
    dictcombo->clear();
399
    langfnames.append("");
400
    dictcombo->insertItem( i18n("Turkish") );
401
  }
402
  else
403
    getAvailDictsAspell();
404
368
405
  // select the used dictionary in the list
369
  // select the used dictionary in the list
406
  int whichelement=-1;
370
  int whichelement=-1;
Lines 588-668 Link Here
588
{
552
{
589
  langfnames.clear();
553
  langfnames.clear();
590
  if ( box ) {
554
  if ( box ) {
591
    if ( iclient == KS_CLIENT_ISPELL ) {
592
      box->clear();
593
      langfnames.append(""); // Default
594
      box->insertItem( i18n("ISpell Default") );
595
596
      // dictionary path
597
      QFileInfo dir ("/usr/lib/ispell");
598
      if (!dir.exists() || !dir.isDir())
599
        dir.setFile ("/usr/local/lib/ispell");
600
      if (!dir.exists() || !dir.isDir())
601
        dir.setFile ("/usr/local/share/ispell");
602
      if (!dir.exists() || !dir.isDir())
603
        dir.setFile ("/usr/share/ispell");
604
      if (!dir.exists() || !dir.isDir())
605
        dir.setFile ("/usr/pkg/lib");
606
      /* TODO get them all instead of just one of them.
607
       * If /usr/local/lib exists, it skips the rest
608
       if (!dir.exists() || !dir.isDir())
609
       dir.setFile ("/usr/local/lib");
610
      */
611
      if (!dir.exists() || !dir.isDir()) return;
612
613
      kdDebug(750) << "KSpellConfig::getAvailDictsIspell "
614
                   << dir.filePath() << " " << dir.dirPath() << endl;
615
616
      const QDir thedir (dir.filePath(),"*.hash");
617
      const QStringList entryList = thedir.entryList();
618
619
      kdDebug(750) << "KSpellConfig" << thedir.path() << "\n" << endl;
620
      kdDebug(750) << "entryList().count()="
621
                   << entryList.count() << endl;
622
623
      QStringList::const_iterator entryListItr = entryList.constBegin();
624
      const QStringList::const_iterator entryListEnd = entryList.constEnd();
625
626
      for ( ; entryListItr != entryListEnd; ++entryListItr)
627
      {
628
        QString fname, lname, hname;
629
        fname = *entryListItr;
630
631
        // remove .hash
632
        if (fname.endsWith(".hash")) fname.remove (fname.length()-5,5);
633
634
        if (interpret (fname, lname, hname) && langfnames.first().isEmpty())
635
        { // This one is the KDE default language
636
          // so place it first in the lists (overwrite "Default")
637
638
          langfnames.remove ( langfnames.begin() );
639
          langfnames.prepend ( fname );
640
641
          hname=i18n("default spelling dictionary"
642
                     ,"Default - %1 [%2]").arg(hname).arg(fname);
643
644
          box->changeItem (hname,0);
645
        }
646
        else
647
        {
648
          langfnames.append (fname);
649
          hname=hname+" ["+fname+"]";
650
651
          box->insertItem (hname);
652
        }
653
      }
654
    } else if ( iclient == KS_CLIENT_HSPELL ) {
655
      box->clear();
656
      box->insertItem( i18n("Hebrew") );
657
      langfnames.append(""); // Default
658
      sChangeEncoding( KS_E_CP1255 );
659
    } else if ( iclient == KS_CLIENT_ZEMBEREK ) {
660
      box->clear();
661
      box->insertItem( i18n("Turkish") );
662
      langfnames.append("");
663
      sChangeEncoding( KS_E_UTF8 );
664
    }
665
    else {
666
      box->clear();
555
      box->clear();
667
      langfnames.append(""); // Default
556
      langfnames.append(""); // Default
668
      box->insertItem (i18n("ASpell Default"));
557
      box->insertItem (i18n("ASpell Default"));
Lines 741-747 Link Here
741
          }
630
          }
742
        }
631
        }
743
      }
632
      }
744
    }
633
745
    int whichelement = langfnames.findIndex(qsdict);
634
    int whichelement = langfnames.findIndex(qsdict);
746
    if ( whichelement >= 0 ) {
635
    if ( whichelement >= 0 ) {
747
      box->setCurrentItem( whichelement );
636
      box->setCurrentItem( whichelement );

Return to bug 202627