<?xml version="1.0" encoding="UTF-8"?>
<kcfg xmlns="http://www.kde.org/standards/kcfg/1.0"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://www.kde.org/standards/kcfg/1.0
      http://www.kde.org/standards/kcfg/1.0/kcfg.xsd" >
<kcfgfile name="kturtlerc"/> 

  <group name="general"> 
    <entry name="CanvasWidth" type="Int"> 
      <label>The width of the canvas in pixels</label> 
      <default>300</default>
    </entry>
    <entry name="CanvasHeight" type="Int"> 
      <label>The height of the canvas in pixels</label> 
      <default>250</default>
    </entry>       
  </group>


  <group name="language">
    <entry name="LogoLanguageList" type="StringList">
      <label>The list of the available languages for the Logo commands</label> 
      <code>

          // This StringList (LogoLanguageList) is a list of all possible language codes all possible [en_US, fr, nl, etc.]. It is used to (1) find the LogoLanguage variable (that is defined later on), and (2) in the Settings dialog to fill the language ComboBox. Better not to dupe this code. The LogoLanguageList is made pretty in the slotSettings class of kturtle.cpp.

          // We assume keyword and highlight files come in pairs (if not there will be no highlight style)

          QStringList xmlFiles = KGlobal::dirs()->findAllResources("data", "kturtle/data/*.xml");
          QStringList LogoLanguageList;
          QString xmlTranslationFiles; // for debug purposes
          for ( QStringList::Iterator it = xmlFiles.begin(); it != xmlFiles.end(); ++it ) {
              QString xmlFile(*it);
              xmlTranslationFiles += xmlFile.section('.', -2, -2).append(", "); // for debug purposes
              // build list of language codes (en_US, nl, etc.)
              LogoLanguageList += xmlFile.section('.', -2, -2);
          }
          kdDebug(0) &lt;&lt; "Available translations of Logo: "&lt;&lt; xmlTranslationFiles &lt;&lt;endl;
          LogoLanguageList.sort();

      </code>
      <default code="true">LogoLanguageList</default> 
    </entry>


    <entry name="LogoLanguage" type="String">
      <label>The language of the Logo commands</label> 
      <code>

          // This is the String (LogoLanguage) that actually gets picked up by the app to know what XML files (for HLstyle and Logo language) to use. It is not directly changeable by the ComboBox but is translated from the Ints that ComboBox LogoLanguageList emits. It is better to have the logic that changes the Ints to Strings at the settings dept.

          // The KconfigXT framework makes shure the value that is saved in the kturtlerc file will be used in stead of the defaultLanguage that we find here.

          // Get the desktops language
          KConfigBase *globalConf = KGlobal::config();
          globalConf->setGroup("Locale");
          QString desktopLanguage = globalConf->readEntry("Language");
          kdDebug(0) &lt;&lt; "desktopLanguage: "&lt;&lt; desktopLanguage &lt;&lt;endl;

          QString defaultLanguage = "en_US";  // init to the fall back value
          int itemCount = 0;  // for the LanguageComboBox
          for (QStringList::Iterator it = LogoLanguageList.begin(); it != LogoLanguageList.end(); ++it ) {
              QString testLanguage(*it);
              if (testLanguage == desktopLanguage) { // exact match
                  defaultLanguage = testLanguage;
                  break;
              } else if ( testLanguage.left(2) == desktopLanguage.left(2) ) { // close match (different dialect)
                  // The default language must still be one of the kturtle languages.
                  // defaultLanguage = testLanguage.left(2);
                  defaultLanguage = testLanguage;
                  break;
              }
              itemCount++;
          }
          kdDebug(0) &lt;&lt; "Logo command language: "&lt;&lt; defaultLanguage &lt;&lt;endl;

      </code>
      <default code="true">defaultLanguage</default> 
    </entry>


    <entry name="LanguageComboBox" type="Int">
      <label>The value of the ComboBox</label>
      <code>

         // This is the parameter that actually gets changed (and emits the signal to the dialog to enable the Apply and Defaults buttons). This value is saved in the kturtlerc file but is never used.

      </code>
      <default code="true">itemCount</default>
    </entry>

  </group> 
</kcfg>
