[Kde-accessibility] Changes to kttsd

Gunnar Schmi Dt gunnar at schmi-dt.de
Thu May 1 20:45:24 CEST 2003


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hello Pupeno,

The hadifax plug is now in a stable enough state to be included into kttsd. 
Also I have developed a patch that enables kttsd to automatically detect the 
name for a given language code.

I would like to check in both the patch and the plug in into CVS. However, I 
thought it might be better to inform you first. So, I will wait two days 
before performing the check in.

Gunnar Schmi Dt
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.7 (GNU/Linux)

iD8DBQE+sV0+sxZ93p+gHn4RAt3zAKDPqmDCTefFGWSoW18O6fykP3EfYQCfTQ7D
ML+kPCwyZP+u9ijyww/nHcg=
=D4IA
-----END PGP SIGNATURE-----
-------------- next part --------------
Index: kcmkttsd/kcmkttsd.cpp
===================================================================
RCS file: /home/kde/kdenonbeta/kttsd/kcmkttsd/kcmkttsd.cpp,v
retrieving revision 1.8
diff -u -p -r1.8 kcmkttsd.cpp
--- kcmkttsd/kcmkttsd.cpp	28 Feb 2003 21:09:34 -0000	1.8
+++ kcmkttsd/kcmkttsd.cpp	1 May 2003 16:46:26 -0000
@@ -34,6 +34,8 @@
 #include <kapplication.h>
 #include <kprocess.h>
 #include <kgenericfactory.h>
+#include <ksimpleconfig.h>
+#include <kstandarddirs.h>
  
 #include <pluginconf.h>
  
@@ -100,10 +102,6 @@ KCMKTTSD::KCMKTTSD(QWidget *parent, cons
     QMap<QString, bool> languagesToBeAdded;
 
     // Initializate the list of codes
-    languagesMap["cy"] = i18n("Welsh");
-    languagesMap["es"] = i18n("Spanish");
-    languagesMap["en_GB"] = i18n("English (British)");
-    languagesMap["en_US"] = i18n("English (American)");
     languagesMap["other"] = i18n("Other");
     for( QMap<QString, QString>::Iterator it = languagesMap.begin(); it != languagesMap.end(); ++it ){
         reverseLanguagesMap[it.data()] = it.key();
@@ -129,6 +127,7 @@ KCMKTTSD::KCMKTTSD(QWidget *parent, cons
 
         for( QStringList::Iterator it = languages.begin(); it != languages.end(); ++it ) {
             languagesToBeAdded[*it] = true;
+            initLanguageCode (*it);
         }
     }
 
@@ -455,8 +454,7 @@ void KCMKTTSD::addLanguage(const QString
 
    // If the language is not in the map, let's add it.
    if(!languagesMap.contains(language)){
-      languagesMap[language] = language;
-      reverseLanguagesMap[language] = language;
+      initLanguageCode (language);
    }
 
    // This object will contain pointers to all the objects related to a single language/plug in pair.
@@ -493,6 +491,31 @@ void KCMKTTSD::addLanguage(const QString
       kdDebug() << "Done" <<endl;
    } else {
       KMessageBox::error(0, i18n("Speech syntheziser plug in library not found or corrupted"), i18n("Plug in not found"));
+   }
+}
+
+/**
+  * Initializes the language with the given language code by determining
+  * its name.
+ */
+void KCMKTTSD::initLanguageCode (const QString &code) {
+   if(!languagesMap.contains(code)) {
+      QString name = QString::null;
+
+      QString file = locate("locale", QString::fromLatin1("%1/entry.desktop").arg(code));
+      if (!file.isNull() && !file.isEmpty()) {
+         KSimpleConfig entry(file);
+         entry.setGroup("KCM Locale");
+         name = entry.readEntry("Name", QString::null);
+      }
+
+      if (name.isNull() || name.isEmpty())
+         name = code;
+      else
+         name = name + QString::fromLatin1(" (%1)").arg(code);
+
+      languagesMap[code] = name;
+      reverseLanguagesMap[name] = code;
    }
 }
 
Index: kcmkttsd/kcmkttsd.h
===================================================================
RCS file: /home/kde/kdenonbeta/kttsd/kcmkttsd/kcmkttsd.h,v
retrieving revision 1.3
diff -u -p -r1.3 kcmkttsd.h
--- kcmkttsd/kcmkttsd.h	28 Feb 2003 20:38:35 -0000	1.3
+++ kcmkttsd/kcmkttsd.h	1 May 2003 16:46:26 -0000
@@ -123,6 +123,12 @@ class KCMKTTSD : public KCModule{
       void addLanguage(const QString &language, const QString &plugInName);
 
       /**
+       * Initializes the language with the given language code by determining
+       * its name.
+       */
+      void initLanguageCode(const QString &code);
+
+      /**
        * Remove a language named lang
        */
       void removeLanguage(const QString &language);
Index: plugins/festival/festival.desktop
===================================================================
RCS file: /home/kde/kdenonbeta/kttsd/plugins/festival/festival.desktop,v
retrieving revision 1.1
diff -u -p -r1.1 festival.desktop
--- plugins/festival/festival.desktop	7 Feb 2003 23:54:10 -0000	1.1
+++ plugins/festival/festival.desktop	1 May 2003 16:46:26 -0000
@@ -16,4 +16,4 @@ Comment[zu]=Umakhi wenkulumo yefestivali
 Type=Service
 ServiceTypes=KTTSD/SynthPlugin
 X-KDE-Library=libfestivalplugin
-X-KDE-Languages=en_US,en_GB,es,cy
+X-KDE-Languages=en,en_GB,es,cy
Index: plugins/festivalcs/festivalcs.desktop
===================================================================
RCS file: /home/kde/kdenonbeta/kttsd/plugins/festivalcs/festivalcs.desktop,v
retrieving revision 1.1
diff -u -p -r1.1 festivalcs.desktop
--- plugins/festivalcs/festivalcs.desktop	7 Feb 2003 23:54:10 -0000	1.1
+++ plugins/festivalcs/festivalcs.desktop	1 May 2003 16:46:26 -0000
@@ -17,4 +17,4 @@ Comment[zu]=Umxhasi/Umlekeleli womakhi w
 Type=Service
 ServiceTypes=Proklam/SynthPlugin
 X-KDE-Library=libfestivalcsplugin
-X-KDE-Languages=en_US,en_GB,es,cy
+X-KDE-Languages=en,en_GB,es,cy
-------------- next part --------------
A non-text attachment was scrubbed...
Name: hadifaxplugin.tar.gz
Type: application/x-tgz
Size: 13459 bytes
Desc: not available
Url : http://mail.kde.org/pipermail/kde-accessibility/attachments/20030501/574ae07c/hadifaxplugin.tar.bin


More information about the kde-accessibility mailing list