lib Library API Documentation

koSconfig.h

00001 /* This file is part of the KDE libraries
00002    Copyright (C) 1997 David Sweet <dsweet@kde.org>
00003    Copyright (C) 2003 Laurent Montel <montel@kde.org>
00004    This library is free software; you can redistribute it and/or
00005    modify it under the terms of the GNU Library General Public
00006    License version 2 as published by the Free Software Foundation.
00007 
00008    This library is distributed in the hope that it will be useful,
00009    but WITHOUT ANY WARRANTY; without even the implied warranty of
00010    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00011    Library General Public License for more details.
00012 
00013    You should have received a copy of the GNU Library General Public License
00014    along with this library; see the file COPYING.LIB.  If not, write to
00015    the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
00016    Boston, MA 02111-1307, USA.
00017 */
00018 #ifndef __KOSCONFIG_H__
00019 #define __KOSCONFIG_H__
00020 
00021 #include <qwidget.h>
00022 #include <qstring.h>
00023 #include <qstringlist.h>
00024 
00025 class QCheckBox;
00026 class QComboBox;
00027 class QLabel;
00028 
00029 class KConfig;
00030 class KOSpellConfigPrivate;
00031 
00032 // Should be replaced by the charset strings
00033 // because the config file would be more stable
00034 // when inserting entries in the list
00035 enum OEncoding {
00036   KOS_E_ASCII=0,
00037   KOS_E_LATIN1=1,
00038   KOS_E_LATIN2=2,
00039   KOS_E_LATIN3=3,
00040   KOS_E_LATIN4=4,
00041   KOS_E_LATIN5=5,
00042   KOS_E_LATIN7=6,
00043   KOS_E_LATIN8=7,
00044   KOS_E_LATIN9=8,
00045   KOS_E_LATIN13=9,
00046   KOS_E_LATIN15=10,
00047   KOS_E_UTF8=11,
00048   KOS_E_KOI8R=12,
00049   KOS_E_KOI8U=13,
00050   KOS_E_CP1251=14
00051 };
00052 
00053 enum KOSpellClients {
00054   KOS_CLIENT_ISPELL=0,
00055   KOS_CLIENT_ASPELL=1,
00056   KOS_CLIENT_HSPELL=2,
00057   KOS_CLIENT_MYSPELL=3
00058 };
00059 
00080 class KOSpellConfig : public QWidget
00081 {
00082     Q_OBJECT
00083 
00084 public:
00096     KOSpellConfig( QWidget *parent=0, const char *name=0,
00097                    KOSpellConfig *spellConfig=0, bool addHelpButton = true );
00098 
00099     KOSpellConfig (const KOSpellConfig &);
00100 
00101     virtual ~KOSpellConfig ();
00102 
00103     void operator= (const KOSpellConfig &ksc);
00104 
00119     void setIgnoreList (QStringList _ignorelist);
00120 
00126     void setReplaceAllList (QStringList _replaceAllList);
00127 
00133     void setNoRootAffix (bool);
00134 
00140     void setRunTogether(bool);
00141 
00145     void setDictionary (const QString &qs);
00146     void setDictFromList (bool dfl);
00147 
00148     //Not present in old aspell/ispell lib
00149     void setIgnoreCase ( bool b );
00150     void setIgnoreAccent ( bool b );
00151     void setSpellWordWithNumber ( bool b );
00152 
00153     void setDontCheckTitleCase(bool _b);
00154     void setDontCheckUpperWord(bool _b);
00158     void setEncoding (int enctype);
00159     void setClient (int client);
00163     bool noRootAffix () const;
00164     bool runTogether() const;
00165     const QString dictionary () const;
00166     bool dictFromList () const;
00167     // not in old ispell/aspell
00168     bool ignoreCase () const;
00169     bool ignoreAccent () const;
00170     int encoding () const;
00171     bool spellWordWithNumber()const;
00172     QStringList ignoreList () const;
00173     QStringList replaceAllList () const;
00174 
00175     bool dontCheckTitleCase()const;
00176     bool dontCheckUpperWord()const;
00177 
00178 
00179     int client () const; //see enums at top of file
00185     bool writeGlobalSettings ();
00186 
00187 
00188     static QStringList listOfAspellLanguages();
00189     static QStringList listOfLanguageFileName();
00190     static QString fileNameFromLanguage( const QString & _lang);
00191     static QString languageFromFileName( const QString &_lang );
00192     static int indexFromLanguageFileName( const QString &name);
00193 
00194 protected:
00195     void fillInDialog();
00196     bool readGlobalSettings();
00197     QString getLanguage( int i );
00198 
00208     static bool interpret( QString &fname, QString &lname, QString &hname );
00209 
00210 
00211 public slots:
00220     void activateHelp( void );
00221 
00222 
00223 protected slots:
00224     void sHelp();
00225     void sNoAff(bool);
00226     void sRunTogether(bool);
00227     void sDictionary(bool);
00228     void sPathDictionary(bool);
00229     void sSetDictionary (int);
00230     void sChangeEncoding (int);
00231     void sChangeClient (int);
00232     //not present in old api
00233     void slotIgnoreCase(bool );
00234     void slotIgnoreAccent(bool);
00235     void slotSpellWordWithNumber(bool b);
00236     void slotDontSpellCheckUpperWord(bool);
00237     void slotDontCheckTitleCase(bool);
00238 
00239 protected:
00240     // The options
00241     int enc;            //1 ==> -Tlatin1
00242     bool bnorootaffix;      // -m
00243     bool bruntogether;      // -B
00244     bool dictfromlist;
00245     bool nodialog;
00246     bool m_bIgnoreCase;
00247     bool m_bIgnoreAccent;
00248     bool m_bSpellWordWithNumber;
00249     bool m_bDontCheckUpperWord;
00250     bool m_bDontCheckTitleCase;
00251     QString qsdict;     // -d [dict]
00252     QString qspdict;        // -p [dict]
00253     QStringList ignorelist;
00254     enum {rdictlist=3, rencoding=4, rhelp=6};
00255     KConfig *kc;
00256 int iclient;            // defaults to ispell, may be aspell, too
00257     QCheckBox *cb1, *cb2;
00258     QLabel *dictlist;
00259     QComboBox *dictcombo, *encodingcombo, *clientcombo;
00260     QCheckBox *cbIgnoreCase;
00261     QCheckBox *cbIgnoreAccent;
00262     QCheckBox *cbSpellWordWithNumber;
00263     QCheckBox *cbDontCheckUpperWord;
00264     QCheckBox *cbDontCheckTitleCase;
00265 
00266     //replace it !!!!!!!!!!!!!!!!!!!!!!!!!!!!
00267     QStringList langfnames;
00268 
00269     virtual void showEvent( QShowEvent* );
00270 
00271 signals:
00272     void configChanged();
00273 
00274 private:
00275     KOSpellConfigPrivate *d;
00276     void getAvailDictsIspell();
00277     void getAvailDictsAspell();
00278 
00279     static void createListOfLanguages();
00280     static QStringList s_aspellLanguageList;
00281     static QStringList s_aspellLanguageFileName;
00282 };
00283 
00284 #endif
00285 
00286 
00287 
00288 
00289 
KDE Logo
This file is part of the documentation for lib Library Version 1.3.5.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Wed Nov 17 13:19:25 2004 by doxygen 1.3.5 written by Dimitri van Heesch, © 1997-2003