Bug 130629 - insert special characters with toolbar does not work properly
Summary: insert special characters with toolbar does not work properly
Status: RESOLVED FIXED
Alias: None
Product: klettres
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: Compiled Sources Linux
: NOR normal (vote)
Target Milestone: ---
Assignee: Anne-Marie Mahfouf
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-07-11 17:37 UTC by Burkhard Lück
Modified: 2006-07-12 22:19 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments
file de.txt in utf8 (11 bytes, patch)
2006-07-11 17:40 UTC, Burkhard Lück
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Burkhard Lück 2006-07-11 17:37:48 UTC
Version:            (using KDE KDE 3.5.3)
Installed from:    Compiled From Sources

1. Inserting special characters of a language via the characters toolbar deletes the whole content of the entry field, so it is impossible to add a character this way to already entered characters.

Change m_view->m_letterEdit->setText(allData[charBut->id()]); to m_view->m_letterEdit->insert(allData[charBut->id()]); in klettres.cpp solves this problem (patch attached)

2. I tried to add german sounds and to use the characters toolbar, this did not work without a change in the code (patch attached).
kdestable@rebutia:~/svn$ svn diff kdeedu/klettres/
Index: kdeedu/klettres/klettres/data/langs/de.txt
===================================================================
--- kdeedu/klettres/klettres/data/langs/de.txt  (revision 0)
+++ kdeedu/klettres/klettres/data/langs/de.txt  (revision 0)
@@ -0,0 +1,4 @@
+Ã
+Ã
+Ã
+Ã
\ No newline at end of file
Index: kdeedu/klettres/klettres/data/langs/Makefile.am
===================================================================
--- kdeedu/klettres/klettres/data/langs/Makefile.am     (revision 558327)
+++ kdeedu/klettres/klettres/data/langs/Makefile.am     (working copy)
@@ -1,2 +1,2 @@
-txt_DATA=cs.txt da.txt sk.txt es.txt
+txt_DATA=cs.txt da.txt sk.txt es.txt de.txt
 txtdir=$(kde_datadir)/klettres
\ No newline at end of file
Index: kdeedu/klettres/klettres/klettres.cpp
===================================================================
--- kdeedu/klettres/klettres/klettres.cpp       (revision 558327)
+++ kdeedu/klettres/klettres/klettres.cpp       (working copy)
@@ -447,7 +447,7 @@
 void KLettres::loadLangToolBar()
 {
     m_secondToolbar->clear();
-    if (m_languages[Prefs::languageNumber()]== "cs" || m_languages[Prefs::languageNumber()]== "da" || m_languages[Prefs::languageNumber()]== "sk" || m_languages[Prefs::languageNumber()]== "es")//Dutch, English, French and Italian have no special characters
+    if (m_languages[Prefs::languageNumber()]== "cs" || m_languages[Prefs::languageNumber()]== "da" || m_languages[Prefs::languageNumber()]== "sk" || m_languages[Prefs::languageNumber()]== "es" || m_languages[Prefs::languageNumber()]== "de")//Dutch, English, French and Italian have no special characters
     {
         allData.clear();
         QString myString=QString("klettres/%1.txt").arg(m_languages[Prefs::languageNumber()]);
@@ -481,7 +481,7 @@
 void KLettres::slotPasteChar()
 {
         KToolBarButton *charBut = (KToolBarButton* ) sender();
-        m_view->m_letterEdit->setText(allData[charBut->id()]);
+        m_view->m_letterEdit->insert(allData[charBut->id()]);
 }

 QString KLettres::charIcon(const QChar & c)

A better way, which allows the user to add language sounds to klettres just by moving the ogg files, the LANG.txt and the sounds.xml e.g. to the dir .kde/share/apps/klettres/LANG :

In KLettres::slotChangeLanguage search file LANG.txt (with the special characters of the choosen language) in $KDEDIR/share/apps/klettres/ or .kde/share/apps/klettres/.
If not found:
   disable the menu item "Show/Hide characters toolbar"
   hide the characters toolbar (if visible)
else:
   read characters from this file
   enable the menu item "Show/Hide characters toolbar"
   display the characters toolbar (if visible) with the special
   characters of the language
Comment 1 Burkhard Lück 2006-07-11 17:40:19 UTC
Created attachment 16958 [details]
file de.txt in utf8
Comment 2 Albert Astals Cid 2006-07-12 22:19:05 UTC
SVN commit 561644 by aacid:

Add german support
The paste special char adds instead of setting the text
FEATURE: 130629
CCMAIL: lueck@hube-lueck.de
CCMAIL: annma@kde.org


 M  +2 -2      data/langs/Makefile.am  
 A             data/langs/de.txt  
 M  +2 -2      klettres.cpp  


--- branches/KDE/3.5/kdeedu/klettres/klettres/data/langs/Makefile.am #561643:561644
@@ -1,2 +1,2 @@
-txt_DATA=cs.txt da.txt sk.txt es.txt
-txtdir=$(kde_datadir)/klettres
\ No newline at end of file
+txt_DATA=cs.txt da.txt sk.txt es.txt de.txt
+txtdir=$(kde_datadir)/klettres
--- branches/KDE/3.5/kdeedu/klettres/klettres/klettres.cpp #561643:561644
@@ -447,7 +447,7 @@
 void KLettres::loadLangToolBar()
 {
     m_secondToolbar->clear();
-    if (m_languages[Prefs::languageNumber()]== "cs" || m_languages[Prefs::languageNumber()]== "da" || m_languages[Prefs::languageNumber()]== "sk" || m_languages[Prefs::languageNumber()]== "es")//Dutch, English, French and Italian have no special characters
+    if (m_languages[Prefs::languageNumber()]== "cs" || m_languages[Prefs::languageNumber()]== "da" || m_languages[Prefs::languageNumber()]== "sk" || m_languages[Prefs::languageNumber()]== "es" || m_languages[Prefs::languageNumber()]== "de")//Dutch, English, French and Italian have no special characters
     {
         allData.clear();
         QString myString=QString("klettres/%1.txt").arg(m_languages[Prefs::languageNumber()]);
@@ -481,7 +481,7 @@
 void KLettres::slotPasteChar()
 {
         KToolBarButton *charBut = (KToolBarButton* ) sender();
-        m_view->m_letterEdit->setText(allData[charBut->id()]);
+        m_view->m_letterEdit->insert(allData[charBut->id()]);
 }
 
 QString KLettres::charIcon(const QChar & c)