* Sat Jan 19 2008 Kevin Kofler <Kevin@tigcc.ticalc.org> 4.0.0-2
- patch K3Spell for hunspell support on F9+ (FeatureDictionary, kde#154561)
This commit is contained in:
parent
215a50fabd
commit
c2b7e8075d
|
@ -0,0 +1,305 @@
|
|||
diff -ur kdelibs-4.0.0/kde3support/kdeui/k3sconfig.cpp kdelibs-4.0.0-k3spell-hunspell/kde3support/kdeui/k3sconfig.cpp
|
||||
--- kdelibs-4.0.0/kde3support/kdeui/k3sconfig.cpp 2008-01-05 00:59:41.000000000 +0100
|
||||
+++ kdelibs-4.0.0-k3spell-hunspell/kde3support/kdeui/k3sconfig.cpp 2008-01-19 16:47:04.000000000 +0100
|
||||
@@ -1,6 +1,7 @@
|
||||
/* This file is part of the KDE libraries
|
||||
Copyright (C) 1997 David Sweet <dsweet@kde.org>
|
||||
Copyright (C) 2000-2001 Wolfram Diestel <wolfram@steloj.de>
|
||||
+ Copyright (C) 2007-2008 Kevin Kofler <Kevin@tigcc.ticalc.org>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
@@ -167,6 +168,7 @@
|
||||
clientcombo->addItem( i18nc("@item:inlistbox Spell checker", "<application>Aspell</application>") );
|
||||
clientcombo->addItem( i18nc("@item:inlistbox Spell checker", "<application>Hspell</application>") );
|
||||
clientcombo->addItem( i18nc("@item:inlistbox Spell checker", "<application>Zemberek</application>") );
|
||||
+ clientcombo->addItem( i18nc("@item:inlistbox Spell checker", "<application>Hunspell</application>") );
|
||||
connect( clientcombo, SIGNAL (activated(int)), this,
|
||||
SLOT (sChangeClient(int)) );
|
||||
glay->addWidget( clientcombo, 5, 1, 1, 2 );
|
||||
@@ -261,8 +263,10 @@
|
||||
dictcombo->addItem( i18nc("@item Spelling dictionary", "Turkish") );
|
||||
sChangeEncoding( KS_E_UTF8 );
|
||||
}
|
||||
- else
|
||||
+ else if ( iclient == KS_CLIENT_ASPELL )
|
||||
getAvailDictsAspell();
|
||||
+ else
|
||||
+ getAvailDictsHunspell();
|
||||
}
|
||||
emit configChanged();
|
||||
}
|
||||
@@ -420,8 +424,10 @@
|
||||
langfnames.append("");
|
||||
dictcombo->addItem( i18nc("@item Spelling dictionary", "Turkish") );
|
||||
}
|
||||
- else
|
||||
+ else if ( iclient == KS_CLIENT_ASPELL )
|
||||
getAvailDictsAspell();
|
||||
+ else
|
||||
+ getAvailDictsHunspell();
|
||||
|
||||
// select the used dictionary in the list
|
||||
int whichelement=-1;
|
||||
@@ -606,6 +612,63 @@
|
||||
}
|
||||
}
|
||||
|
||||
+void K3SpellConfig::getAvailDictsHunspell () {
|
||||
+
|
||||
+ langfnames.clear();
|
||||
+ dictcombo->clear();
|
||||
+ langfnames.append(""); // Default
|
||||
+ dictcombo->addItem( i18nc("@item Spelling dictionary",
|
||||
+ "<application>Hunspell</application> Default") );
|
||||
+
|
||||
+ // dictionary path
|
||||
+ QFileInfo dir ("/usr/share/myspell");
|
||||
+ if (!dir.exists() || !dir.isDir())
|
||||
+ dir.setFile ("/usr/share/hunspell");
|
||||
+ if (!dir.exists() || !dir.isDir()) return;
|
||||
+
|
||||
+ kDebug(750) << "K3SpellConfig::getAvailDictsHunspell "
|
||||
+ << dir.filePath() << " " << dir.path() << endl;
|
||||
+
|
||||
+ const QDir thedir (dir.filePath(),"*.dic");
|
||||
+ const QStringList entryList = thedir.entryList();
|
||||
+
|
||||
+ kDebug(750) << "K3SpellConfig" << thedir.path() << "\n";
|
||||
+ kDebug(750) << "entryList().count()="
|
||||
+ << entryList.count() << endl;
|
||||
+
|
||||
+ QStringList::const_iterator entryListItr = entryList.constBegin();
|
||||
+ const QStringList::const_iterator entryListEnd = entryList.constEnd();
|
||||
+
|
||||
+ for ( ; entryListItr != entryListEnd; ++entryListItr)
|
||||
+ {
|
||||
+ QString fname, lname, hname;
|
||||
+ fname = *entryListItr;
|
||||
+
|
||||
+ // remove .dic
|
||||
+ if (fname.endsWith(".dic")) fname.remove (fname.length()-4,4);
|
||||
+
|
||||
+ if (interpret (fname, lname, hname) && langfnames.first().isEmpty())
|
||||
+ { // This one is the KDE default language
|
||||
+ // so place it first in the lists (overwrite "Default")
|
||||
+
|
||||
+ langfnames.removeFirst();
|
||||
+ langfnames.prepend ( fname );
|
||||
+
|
||||
+ hname=i18nc("@item Spelling dictionary: %1 dictionary name, %2 file name",
|
||||
+ "Default - %1 [%2]", hname, fname);
|
||||
+
|
||||
+ dictcombo->setItemText (0,hname);
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ langfnames.append (fname);
|
||||
+ hname=hname+" ["+fname+']';
|
||||
+
|
||||
+ dictcombo->addItem (hname);
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
void
|
||||
K3SpellConfig::fillDicts( QComboBox* box, QStringList* dictionaries )
|
||||
{
|
||||
@@ -685,8 +748,7 @@
|
||||
box->addItem( i18nc("@item Spelling dictionary", "Turkish") );
|
||||
langfnames.append("");
|
||||
sChangeEncoding( KS_E_UTF8 );
|
||||
- }
|
||||
- else {
|
||||
+ } else if ( iclient == KS_CLIENT_ASPELL ) {
|
||||
box->clear();
|
||||
langfnames.append(""); // Default
|
||||
box->addItem (i18nc("@item Spelling dictionary",
|
||||
@@ -766,6 +828,59 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
+ } else {
|
||||
+ box->clear();
|
||||
+ langfnames.append(""); // Default
|
||||
+ box->addItem( i18nc("@item Spelling dictionary",
|
||||
+ "<application>Hunspell</application> Default") );
|
||||
+
|
||||
+ // dictionary path
|
||||
+ QFileInfo dir ("/usr/share/myspell");
|
||||
+ if (!dir.exists() || !dir.isDir())
|
||||
+ dir.setFile ("/usr/share/hunspell");
|
||||
+ if (!dir.exists() || !dir.isDir()) return;
|
||||
+
|
||||
+ kDebug(750) << "K3SpellConfig::getAvailDictsHunspell "
|
||||
+ << dir.filePath() << " " << dir.path() << endl;
|
||||
+
|
||||
+ const QDir thedir (dir.filePath(),"*.dic");
|
||||
+ const QStringList entryList = thedir.entryList();
|
||||
+
|
||||
+ kDebug(750) << "K3SpellConfig" << thedir.path() << "\n";
|
||||
+ kDebug(750) << "entryList().count()="
|
||||
+ << entryList.count() << endl;
|
||||
+
|
||||
+ QStringList::const_iterator entryListItr = entryList.constBegin();
|
||||
+ const QStringList::const_iterator entryListEnd = entryList.constEnd();
|
||||
+
|
||||
+ for ( ; entryListItr != entryListEnd; ++entryListItr)
|
||||
+ {
|
||||
+ QString fname, lname, hname;
|
||||
+ fname = *entryListItr;
|
||||
+
|
||||
+ // remove .dic
|
||||
+ if (fname.endsWith(".dic")) fname.remove (fname.length()-4,4);
|
||||
+
|
||||
+ if (interpret (fname, lname, hname) && langfnames.first().isEmpty())
|
||||
+ { // This one is the KDE default language
|
||||
+ // so place it first in the lists (overwrite "Default")
|
||||
+
|
||||
+ langfnames.erase ( langfnames.begin() );
|
||||
+ langfnames.prepend ( fname );
|
||||
+
|
||||
+ hname=i18nc("@item Spelling dictionary: %1 dictionary name, %2 file name",
|
||||
+ "Default - %1 [%2]", hname, fname);
|
||||
+
|
||||
+ box->setItemText (0,hname);
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ langfnames.append (fname);
|
||||
+ hname=hname+" ["+fname+']';
|
||||
+
|
||||
+ box->addItem (hname);
|
||||
+ }
|
||||
+ }
|
||||
}
|
||||
int whichelement = langfnames.indexOf(qsdict);
|
||||
if ( whichelement >= 0 ) {
|
||||
diff -ur kdelibs-4.0.0/kde3support/kdeui/k3sconfig.h kdelibs-4.0.0-k3spell-hunspell/kde3support/kdeui/k3sconfig.h
|
||||
--- kdelibs-4.0.0/kde3support/kdeui/k3sconfig.h 2008-01-05 00:59:41.000000000 +0100
|
||||
+++ kdelibs-4.0.0-k3spell-hunspell/kde3support/kdeui/k3sconfig.h 2008-01-19 16:25:43.000000000 +0100
|
||||
@@ -1,5 +1,6 @@
|
||||
/* This file is part of the KDE libraries
|
||||
Copyright (C) 1997 David Sweet <dsweet@kde.org>
|
||||
+ Copyright (C) 2007-2008 Kevin Kofler <Kevin@tigcc.ticalc.org>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
@@ -60,7 +61,8 @@
|
||||
KS_CLIENT_ISPELL=0,
|
||||
KS_CLIENT_ASPELL=1,
|
||||
KS_CLIENT_HSPELL=2,
|
||||
- KS_CLIENT_ZEMBEREK=3
|
||||
+ KS_CLIENT_ZEMBEREK=3,
|
||||
+ KS_CLIENT_HUNSPELL=4
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -287,6 +289,7 @@
|
||||
K3SpellConfigPrivate *const d;
|
||||
void getAvailDictsIspell();
|
||||
void getAvailDictsAspell();
|
||||
+ void getAvailDictsHunspell();
|
||||
};
|
||||
|
||||
#endif // KDELIBS_KSCONFIG_H
|
||||
diff -ur kdelibs-4.0.0/kde3support/kdeui/k3spell.cpp kdelibs-4.0.0-k3spell-hunspell/kde3support/kdeui/k3spell.cpp
|
||||
--- kdelibs-4.0.0/kde3support/kdeui/k3spell.cpp 2008-01-05 00:59:41.000000000 +0100
|
||||
+++ kdelibs-4.0.0-k3spell-hunspell/kde3support/kdeui/k3spell.cpp 2008-01-19 16:44:00.000000000 +0100
|
||||
@@ -2,6 +2,7 @@
|
||||
Copyright (C) 1997 David Sweet <dsweet@kde.org>
|
||||
Copyright (C) 2000-2001 Wolfram Diestel <wolfram@steloj.de>
|
||||
Copyright (C) 2003 Zack Rusin <zack@kde.org>
|
||||
+ Copyright (C) 2007-2008 Kevin Kofler <Kevin@tigcc.ticalc.org>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
@@ -218,9 +219,14 @@
|
||||
*proc << "zpspell";
|
||||
kDebug(750) << "Using zemberek(zpspell)";
|
||||
break;
|
||||
+ case KS_CLIENT_HUNSPELL:
|
||||
+ *proc << "hunspell";
|
||||
+ kDebug(750) << "Using hunspell";
|
||||
+ break;
|
||||
}
|
||||
|
||||
- if ( ksconfig->client() == KS_CLIENT_ISPELL || ksconfig->client() == KS_CLIENT_ASPELL )
|
||||
+ // Hunspell doesn't need all of these options, but it'll ignore those it doesn't understand.
|
||||
+ if ( ksconfig->client() == KS_CLIENT_ISPELL || ksconfig->client() == KS_CLIENT_ASPELL || ksconfig->client() == KS_CLIENT_HUNSPELL )
|
||||
{
|
||||
*proc << "-a" << "-S";
|
||||
|
||||
@@ -238,8 +244,8 @@
|
||||
*proc << "-t";
|
||||
break;
|
||||
case Nroff:
|
||||
- //only ispell supports
|
||||
- if ( ksconfig->client() == KS_CLIENT_ISPELL )
|
||||
+ //only ispell and hunspell support
|
||||
+ if ( ksconfig->client() == KS_CLIENT_ISPELL || ksconfig->client() == KS_CLIENT_HUNSPELL )
|
||||
*proc << "-n";
|
||||
break;
|
||||
case Text:
|
||||
@@ -276,7 +282,60 @@
|
||||
// option, so k3spell tries again without it. That's why as 'ps -ax'
|
||||
// shows "ispell -a -S ..." withou the "-Tlatin2" option.
|
||||
|
||||
- if ( trystart<1 ) {
|
||||
+ if ( ksconfig->client() == KS_CLIENT_HUNSPELL && trystart<1 ) {
|
||||
+ // Note: This sets I/O encoding. Hunspell correctly handles dictionary encoding != I/O encoding.
|
||||
+ // It will be faster if the I/O encoding matches the dictionary encoding, but using UTF-8 is always safe.
|
||||
+ switch ( ksconfig->encoding() )
|
||||
+ {
|
||||
+ case KS_E_LATIN1:
|
||||
+ *proc << "-i" << "ISO-8859-1";
|
||||
+ break;
|
||||
+ case KS_E_LATIN2:
|
||||
+ *proc << "-i" << "ISO-8859-2";
|
||||
+ break;
|
||||
+ case KS_E_LATIN3:
|
||||
+ *proc << "-i" << "ISO-8859-3";
|
||||
+ break;
|
||||
+ case KS_E_LATIN4:
|
||||
+ *proc << "-i" << "ISO-8859-4";
|
||||
+ break;
|
||||
+ case KS_E_LATIN5:
|
||||
+ *proc << "-i" << "ISO-8859-5";
|
||||
+ break;
|
||||
+ case KS_E_LATIN7:
|
||||
+ *proc << "-i" << "ISO-8859-7";
|
||||
+ break;
|
||||
+ case KS_E_LATIN8:
|
||||
+ *proc << "-i" << "ISO-8859-8";
|
||||
+ break;
|
||||
+ case KS_E_LATIN9:
|
||||
+ *proc << "-i" << "ISO-8859-9";
|
||||
+ break;
|
||||
+ case KS_E_LATIN13:
|
||||
+ *proc << "-i" << "ISO-8859-13";
|
||||
+ break;
|
||||
+ case KS_E_LATIN15:
|
||||
+ *proc << "-i" << "ISO-8859-15";
|
||||
+ break;
|
||||
+ case KS_E_UTF8:
|
||||
+ *proc << "-i" << "UTF-8";
|
||||
+ break;
|
||||
+ case KS_E_KOI8R:
|
||||
+ *proc << "-i" << "KOI8-R";
|
||||
+ break;
|
||||
+ case KS_E_KOI8U:
|
||||
+ *proc << "-i" << "KOI8-U";
|
||||
+ break;
|
||||
+ case KS_E_CP1251:
|
||||
+ *proc << "-i" << "CP1251";
|
||||
+ break;
|
||||
+ case KS_E_CP1255:
|
||||
+ *proc << "-i" << "CP1255";
|
||||
+ break;
|
||||
+ default:
|
||||
+ break;
|
||||
+ }
|
||||
+ } else if ( trystart<1 ) {
|
||||
switch ( ksconfig->encoding() )
|
||||
{
|
||||
case KS_E_LATIN1:
|
15
kdelibs.spec
15
kdelibs.spec
|
@ -4,7 +4,7 @@
|
|||
|
||||
Summary: K Desktop Environment 4 - Libraries
|
||||
Version: 4.0.0
|
||||
Release: 1%{?dist}
|
||||
Release: 2%{?dist}
|
||||
|
||||
%if 0%{?fedora} > 8
|
||||
Name: kdelibs
|
||||
|
@ -38,6 +38,9 @@ Requires: shared-mime-info
|
|||
%if "%{name}" == "kdelibs"
|
||||
Requires: kdelibs-common
|
||||
%endif
|
||||
%if 0%{?fedora} >= 9
|
||||
Requires: hunspell
|
||||
%endif
|
||||
|
||||
Source1: kde4.sh
|
||||
Source2: kde4.csh
|
||||
|
@ -54,6 +57,10 @@ Patch3: kdelibs-3.97.0-flac113.patch
|
|||
# Force Phonon to use the ALSA default device by default
|
||||
# This should make it work better with PulseAudio.
|
||||
Patch4: kdelibs-3.97.0-alsa-default-device.patch
|
||||
# Hunspell support for K3Spell
|
||||
# http://fedoraproject.org/wiki/Releases/FeatureDictionary
|
||||
# http://bugs.kde.org/show_bug.cgi?id=154561
|
||||
Patch5: kdelibs-4.0.0-k3spell-hunspell.patch
|
||||
|
||||
BuildRequires: qt4-devel >= 4.3.0
|
||||
Requires: qt4 >= %{_qt4_version}
|
||||
|
@ -133,6 +140,9 @@ applications for KDE 4.
|
|||
%patch2 -p1 -b .kde149705
|
||||
%patch3 -p1 -b .flac113
|
||||
%patch4 -p1 -b .alsa-default
|
||||
%if 0%{?fedora} >= 9
|
||||
%patch5 -p1 -b .k3spell-hunspell
|
||||
%endif
|
||||
|
||||
|
||||
%build
|
||||
|
@ -261,6 +271,9 @@ rm -rf %{buildroot}
|
|||
|
||||
|
||||
%changelog
|
||||
* Sat Jan 19 2008 Kevin Kofler <Kevin@tigcc.ticalc.org> 4.0.0-2
|
||||
- patch K3Spell for hunspell support on F9+ (FeatureDictionary, kde#154561)
|
||||
|
||||
* Mon Jan 07 2008 Than Ngo <than@redhat.com> 4.0.0-1
|
||||
- 4.0.0
|
||||
|
||||
|
|
Loading…
Reference in New Issue