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

List:       kde-commits
Subject:    kdeedu/klettres/klettres
From:       Anne-Marie Mahfouf <annma () kde ! org>
Date:       2005-03-15 2:00:20
Message-ID: 20050315020020.9BC001487F () office ! kde ! org
[Download RAW message or body]

CVS commit by annma: 

enable special characters toolbar
add spanish contributor name


  M +34 -2     klettres.cpp   1.98
  M +4 -0      klettres.h   1.53
  M +2 -0      main.cpp   1.41


--- kdeedu/klettres/klettres/klettres.cpp  #1.97:1.98
@@ -263,5 +263,5 @@ void KLettres::loadSettings()
     langString.replace("&", QString::null);
     m_langLabel->setText(i18n("Current language is %1").arg(langString));
-    // loadLangToolBar();
+    loadLangToolBar();
     // load default level
     kdDebug() << "Level ---- : " << Prefs::level() << endl;
@@ -351,5 +351,5 @@ void KLettres::slotChangeLanguage(int ne
     langString.replace("&", QString::null);
     m_langLabel->setText(i18n("Current language is %1").arg(langString));
-    // loadLangToolBar();
+    loadLangToolBar();
     // Change language effectively
     kdDebug() << "In change language " << Prefs::language() << endl;
@@ -428,4 +428,36 @@ void KLettres::slotModeKid()
 }
 
+void KLettres::loadLangToolBar()
+{
+    m_secondToolbar->clear();
+    if (m_languages[selectedLanguage]== "cs" || m_languages[selectedLanguage]== "da" \
|| m_languages[selectedLanguage]== "sk" || m_languages[selectedLanguage]== \
"es")//Dutch, English, French and Italian have no special characters +    {
+        allData.clear();
+        QString myString=QString("klettres/%1.txt").arg(m_languages[selectedLanguage]);
 +        QFile myFile;
+        myFile.setName(locate("data",myString));
+        if (!myFile.exists())
+        {
+            QString mString=i18n("File $KDEDIR/share/apps/klettres/%1.txt not \
found;\n" +                                    "please check your \
installation.").arg(m_languages[selectedLanguage]); +            KMessageBox::sorry( \
this, mString, +                                    i18n("Error") );
+            kapp->quit();
+        }
+        update();
+        //we open the file and store info into the stream...
+        QFile openFileStream(myFile.name());
+        openFileStream.open(IO_ReadOnly);
+        QTextStream readFileStr(&openFileStream);
+        readFileStr.setEncoding(QTextStream::UnicodeUTF8);
+        //allData contains all the words from the file
+        allData = QStringList::split("\n", readFileStr.read(), true);
+        openFileStream.close();
+        for (int i=0; i<(int) allData.count(); i++) {
+            m_secondToolbar->insertButton (charIcon(allData[i].at(0)), i, SIGNAL( \
clicked() ), this, SLOT( slotPasteChar()), true,  i18n("Inserts the character \
%1").arg(allData[i]), i+1 ); +        }
+    }
+}
+
 QString KLettres::charIcon(const QChar & c)
 {

--- kdeedu/klettres/klettres/klettres.h  #1.52:1.53
@@ -121,4 +121,8 @@ protected:
     ///Create a KNewStuff instance
     KLNewStuff *mNewStuff;
+    ///Set the correct buttons on the second toolbar according to the language
+    void loadLangToolBar();
+    ///All the special characters from a language file, these characters will be as \
buttons on the Special Characters Toolbar +    QStringList allData;
 
     protected slots:

--- kdeedu/klettres/klettres/main.cpp  #1.40:1.41
@@ -61,4 +61,6 @@ int main(int argc, char **argv)
     about.addCredit("Pietro Pasotti",
                     I18N_NOOP("Italian sounds"), "pietro@itopen.it");
+    about.addCredit("Ana Belén Caballero and Juan Pedro Paredes",
+                    I18N_NOOP("Spanish sounds"), "neneta @iquis.com");
     about.addCredit("Primoz Anzur",
                     I18N_NOOP("Icons"), "zerokode@yahoo.com");


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

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