[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-core-devel
Subject:    Re: [PATCH] Support for multiple languages in
From:       Ingo =?iso-8859-1?q?Kl=F6cker?= <kloecker () kde ! org>
Date:       2003-10-25 11:46:33
[Download RAW message or body]

[Attachment #2 (multipart/mixed)]


Hi,

it seems everyone is okay with the changes. Good. I have another change 
for KSpellConfig::fillDicts.

On Sunday 19 October 2003 23:23, Ingo Klöcker wrote:
> ksconfig.diff:
> KSpellConfig::fillDicts( QComboBox *box ) fills a combo box with the
> available dictionaries. But it doesn't set the currently used
> dictionary as current item of the combo box. This patch fixes this
> bug. It's a bug because there is no other way to set the correct
> current item because the user of KSpellConfig only knows about the
> human readable dictionary names but not about the internal dictionary
> names. Without this fix fillDicts is completely useless.

On top of this the attached patch makes fillDicts not only fill a combo 
box with the human readable, translated dictionary names, but, 
optionally, it also fills a given QStringList with the internal 
dictionary names. This is necessary for storing the dictionary the user 
selected in a config file and to set it later again with setDictionary.

Regards,
Ingo

> P.S.: If the signature on this message is broken then it's most
> likely mailmans fault.

["ksconfig.diff" (text/x-diff)]

Index: ksconfig.h
===================================================================
RCS file: /home/kde/kdelibs/kdeui/ksconfig.h,v
retrieving revision 1.44
diff -u -3 -p -r1.44 ksconfig.h
--- ksconfig.h	30 Sep 2003 01:37:33 -0000	1.44
+++ ksconfig.h	25 Oct 2003 11:31:11 -0000
@@ -107,7 +107,25 @@ class KSpellConfig : public QWidget
 
     void operator=( const KSpellConfig &ksc );
 
-    void fillDicts( QComboBox* box );
+    /**
+     *
+     * @short Get the translated dictionary names and, optionally, the 
+     * corresponding internal dictionary names.
+     *
+     * Fills @p box with the human readable, translated dictionary names and
+     * selects the currently used dictionary (this will be the global 
+     * dictionary if you call @ref fillDicts directly after the constructor).
+     * If @p dictionaries isn't 0 then @p dictionaries will be filled with the
+     * corresponding internal dictionary names that are necessary to set the
+     * dictionary with @ref setDictionary.
+     *
+     * @param box Will be filled with the translated dictionary names.
+     * @param dictionaries Will be filled with the internal dictionary names.
+     *
+     * @since 3.2
+     *
+     */
+    void fillDicts( QComboBox* box, QStringList* dictionaries = 0 );
 
     /**
      * @sect Options setting routines.
Index: ksconfig.cpp
===================================================================
RCS file: /home/kde/kdelibs/kdeui/ksconfig.cpp,v
retrieving revision 1.80
diff -u -3 -p -r1.80 ksconfig.cpp
--- ksconfig.cpp	30 Sep 2003 01:37:33 -0000	1.80
+++ ksconfig.cpp	25 Oct 2003 11:31:11 -0000
@@ -546,7 +546,7 @@ void KSpellConfig::getAvailDictsAspell (
 }
 
 void
-KSpellConfig::fillDicts( QComboBox* box )
+KSpellConfig::fillDicts( QComboBox* box, QStringList* dictionaries )
 {
   langfnames.clear();
   if ( box ) {
@@ -671,6 +671,16 @@ KSpellConfig::fillDicts( QComboBox* box 
         }
       }
     }
+    int whichelement = -1;
+    for ( unsigned int i = 0; i < langfnames.count(); ++i ) {
+      if ( langfnames[i] == qsdict )
+        whichelement = i;
+    }
+    if ( whichelement >= 0 ) {
+      box->setCurrentItem( whichelement );
+    }
+    if ( dictionaries )
+      *dictionaries = langfnames;
   }
 }
 

[Attachment #6 (application/pgp-signature)]

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic