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

List:       kde-edu-devel
Subject:    Re: [kde-edu-devel] patch for KLettres bug
From:       Klas Kalass <klas.kalass () gmx ! de>
Date:       2002-11-16 8:00:45
[Download RAW message or body]

Hi ,

The patch looks OK (did not test it, though).
But one thing: Why do you still read language (the translated one) from the 
config file? I think you should read only langLoc and do 
language=i18n(langLoc), because you do not save language to the config file 
any more.

Am Freitag, 15. November 2002 22:57 schrieb Mahfouf Anne-Marie:
> Hi,
>
> I was not sure about the procedure so I post to this list before committing
> a patch to my app KLettres in the kdeedu module.
> I had a bug report today about KLettres and I think I must fix it before
> 3.1 The patch does not introduce any i18n() string, in fact the new QString
> must not be i18n() as it was a i18n() that was causing the bug. The bug fix
> concerns only KLettres and has no repercussion in other KDE code.
> Diff follows, I am waiting for approval before committing, thank you
>
> Anne-Marie Mahfouf
> annemahfouf@hotmail.com
>
> [kde3@laptop klettres]$ cvs diff 1.22 klettres/klettres.cpp
> cvs server: I know nothing about 1.22
> Index: klettres/klettres.cpp
> ===================================================================
> RCS file: /home/kde/kdeedu/klettres/klettres/klettres.cpp,v
> retrieving revision 1.22
> diff -u -r1.22 klettres.cpp
> --- klettres/klettres.cpp       2002/09/09 01:41:06     1.22
> +++ klettres/klettres.cpp       2002/11/15 21:10:57
> @@ -154,6 +154,7 @@
>         {
>                config->setGroup("Language");
>                 language=config->readEntry("MyLanguage");
> +               langLoc=config->readEntry("MyLanguage");
>                 config->setGroup(langString);
>                 l1 =config->readNumEntry("Alphabet");
>                 l2 =config->readNumEntry("Syllables");
> @@ -227,8 +228,8 @@
>                 line1->setMaximumSize( QSize( 140, 160 ) );
>                 srand((unsigned int)time((time_t *)NULL));
>                 n=rand()%l1;     //choose a random number
> -
> dataString=QString("klettres/%1/data/level1.txt").arg(language);
> //dataString holds the data file name
> -
> string2=QString("klettres/%1/alpha/a-%2.mp3").arg(language).arg(n);
> +
> dataString=QString("klettres/%1/data/level1.txt").arg(langLoc);
> //dataString holds the data file name
> +
> string2=QString("klettres/%1/alpha/a-%2.mp3").arg(langLoc).arg(n);
>                  play();
>
>                 QObject::connect(line1, SIGNAL(textChanged(const
> @@ -247,8 +248,8 @@
>         {
>                 srand((unsigned int)time((time_t *)NULL));
>                 n=rand()%l2;
> -
> dataString=QString("klettres/%1/data/level3.txt").arg(language);
> //dataString holds the data file name
> -
> string2=QString("klettres/%1/syllab/ad-%2.mp3").arg(language).arg(n);
> +
> dataString=QString("klettres/%1/data/level3.txt").arg(langLoc);
> //dataString holds the data file name
> +
> string2=QString("klettres/%1/syllab/ad-%2.mp3").arg(langLoc).arg(n);
>         play();
>                 if (length==2)
>                 {
> @@ -301,8 +302,8 @@
>         {
>                 srand((unsigned int)time((time_t *)NULL));
>                 n=rand()%l1;
> -
> dataString=QString("klettres/%1/data/level1.txt").arg(language);
> -
> string2=QString("klettres/%1/alpha/a-%2.mp3").arg(language).arg(n);
> +
> dataString=QString("klettres/%1/data/level1.txt").arg(langLoc);
> +
> string2=QString("klettres/%1/alpha/a-%2.mp3").arg(langLoc).arg(n);
>                 play();
>         }
>         else
> @@ -310,7 +311,7 @@
>                 if (niveau==2)
>                 button1->show(); //show letter after first miss
>
> -
> string2=QString("klettres/%1/alpha/a-%2.mp3").arg(language).arg(n);
> //replay sound
> +
> string2=QString("klettres/%1/alpha/a-%2.mp3").arg(langLoc).arg(n);
> //replay sound
>                 string1=locate("data",string2);                //of letter
>                 KAudioPlayer::play(string1);
>         }
> @@ -376,7 +377,7 @@
>                 line1->backspace();  //delete the char to the left  and
> position curseur accordingly
>                 line1->setFocus();
>                 //play sound again
> -
> string2=QString("klettres/%1/syllab/ad-%2.mp3").arg(language).arg(n);
> +
> string2=QString("klettres/%1/syllab/ad-%2.mp3").arg(langLoc).arg(n);
>                 string1=locate("data",string2);
>                 KAudioPlayer::play(string1);
>
> @@ -483,7 +484,8 @@
>
> /** Set language to French */
> void KLettres::slotFrench()
> -{
> +{
> +       langLoc="French"; // please no i18n() around that
>         language=i18n("French");
>         num=2;
>         config->setGroup("Language");
> @@ -504,6 +506,7 @@
> /** Set Language to Dutch */
> void KLettres::slotDutch()
> {
> +       langLoc="Dutch";//please no i18n() around that
>         language=i18n("Dutch");
>         num=1;
>          langLabel->setText(i18n("Current language is %1").arg(language));
> @@ -529,6 +532,7 @@
> /** Set Language to Danish*/
> void KLettres::slotDanish()
> {
> +       langLoc="Danish";
>         language=i18n("Danish");
>         num=0;
>          langLabel->setText(i18n("Current language is %1").arg(language));
> @@ -556,7 +560,7 @@
> {
>         //write current config
>         config->setGroup("Language");
> -       config->writeEntry("MyLanguage", language);
> +       config->writeEntry("MyLanguage", langLoc);
>         config->writeEntry("Number",num);
>         config->writeEntry("myStyle", style);
>         kdDebug() << style << endl;
> [kde3@laptop klettres]$
>
> [kde3@laptop klettres]$ cvs diff 1.13 klettres/klettres.h
> cvs server: I know nothing about 1.13
> Index: klettres/klettres.h
> ===================================================================
> RCS file: /home/kde/kdeedu/klettres/klettres/klettres.h,v
> retrieving revision 1.13
> diff -u -r1.13 klettres.h
> --- klettres/klettres.h 2002/05/15 22:14:02     1.13
> +++ klettres/klettres.h 2002/11/15 21:24:03
> @@ -72,7 +72,7 @@
>      ~KLettres();
>         void play();
>         QString string1, string2, dataString;
> -       QString language, langString, style;
> +       QString language, langString, style, langLoc;
>         QFile lev1File;
>         int l1, l2, length, input, num, numRead;
>
> [kde3@laptop klettres]$
>
>
>
> _________________________________________________________________
> MSN 8 helps eliminate e-mail viruses. Get 2 months FREE*.
> http://join.msn.com/?page=features/virus
>
> _______________________________________________
> kde-edu-devel mailing list
> kde-edu-devel@mail.kde.org
> http://mail.kde.org/mailman/listinfo/kde-edu-devel

_______________________________________________
kde-edu-devel mailing list
kde-edu-devel@mail.kde.org
http://mail.kde.org/mailman/listinfo/kde-edu-devel
[prev in list] [next in list] [prev in thread] [next in thread] 

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