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

List:       kde-commits
Subject:    Re: KDE/kdeedu/ktouch
From:       Håvard_Frøiland <haavard () solveien ! net>
Date:       2007-06-10 14:06:46
Message-ID: 200706101606.46862.haavard () solveien ! net
[Download RAW message or body]

I was just sitting down to look at it.. and I couldn't get any keyboard to 
display. And you just fixed it.. looks great.

H

On Sunday 10 June 2007 15:24:04 Andreas Nicolai wrote:
> SVN commit 673530 by ghorwin:
>
> Build file update. Keyboard list in main menu switched to xml keyboards.
>
>
>  M  +1 -0      keyboards/CMakeLists.txt
>  M  +5 -4      keyboards/de.keyboard.xml
>  M  +0 -1      src/CMakeLists.txt
>  M  +44 -13    src/ktouch.cpp
>
>
> --- trunk/KDE/kdeedu/ktouch/keyboards/CMakeLists.txt #673529:673530
> @@ -5,6 +5,7 @@
>  ########### install files ###############
>
>  install( FILES
> +  de.keyboard.xml
>    be.keyboard
>    bg.keyboard
>    cz.keyboard
> --- trunk/KDE/kdeedu/ktouch/keyboards/de.keyboard.xml #673529:673530
> @@ -1,6 +1,7 @@
>  <KTouchKeyboard>
> - <Title>de.keyboard</Title>
> - <Language>de (German)</Language>
> + <Title>German</Title>
> + <FontSuggestions>Sans Serif,9,-1,5,50,0,0,0,0,0</FontSuggestions>
> + <Language>de</Language>
>   <Keys>
>    <Key Width="80" X="180" Y="200" Height="80" Type="FINGER" >
>     <Char Unicode="65" Position="TopLeft" >A</Char>
> @@ -29,11 +30,11 @@
>    <Key Width="130" X="0" Y="100" Height="80" Type="TAB" />
>    <Key Width="100" X="1380" Y="100" Height="180" Type="ENTER" />
>    <Key Width="250" X="1230" Y="300" Height="80" Type="SHIFT" />
> -  <Key Width="130" X="1200" KeyText="Alt Gr" Y="400" Height="80"
> Type="OTHER" /> +  <Key Width="180" X="1150" KeyText="Alt Gr" Y="400"
> Height="80" Type="OTHER" /> <Key Width="130" X="1350" KeyText="Strg"
> Y="400" Height="80" Type="OTHER" /> <Key Width="130" X="150" KeyText="Alt"
> Y="400" Height="80" Type="OTHER" /> <Key Width="130" X="0" KeyText="Strg"
> Y="400" Height="80" Type="OTHER" /> -  <Key Width="880" X="300" Y="400"
> Height="80" Type="SPACE" />
> +  <Key Width="830" X="300" Y="400" Height="80" Type="SPACE" />
>    <Key Width="110" X="0" Y="300" Height="80" Type="SHIFT" />
>    <Key Width="160" X="0" Y="200" Height="80" Type="CAPSLOCK" />
>    <Key Width="180" X="1300" Y="0" Height="80" Type="BACKSPACE" />
> --- trunk/KDE/kdeedu/ktouch/src/CMakeLists.txt #673529:673530
> @@ -32,7 +32,6 @@
>     ktouchkeyboardwidget.cpp
>     ktouchkeyconnector.cpp
>     ktouchkey.cpp
> -   ktouchkeys.cpp
>     ktouchlecture.cpp
>     ktouchleveldata.cpp
>     ktouchtextlinewidget.cpp
> --- trunk/KDE/kdeedu/ktouch/src/ktouch.cpp #673529:673530
> @@ -13,6 +13,9 @@
>  #include "ktouch.h"
>  #include "ktouch.moc"
>
> +// Qt Header
> +#include <QtXml>
> +
>  // KDE Header
>  #include <kselectaction.h>
>  #include <kactioncollection.h>
> @@ -732,24 +735,50 @@
>  // This function populates the file lists with the installed training,
> keyboard and // examination files.
>  void KTouch::updateFileLists() {
> +    // first search for all installed new format keyboard files
>      KStandardDirs *dirs = KGlobal::dirs();
> +    m_keyboardFiles =
> dirs->findAllResources("data","ktouch/*.keyboard.xml");
>
> -    // first search for all installed keyboard files
> -	// TODO : search in i18n() directories
> -    m_keyboardFiles = dirs->findAllResources("data","ktouch/*.keyboard");
> -
> -    // remove the number layout, since this is the necessary default
> layout and will be -    // added anyway
> -    int index = m_keyboardFiles.indexOf("number.keyboard");
> -	if (index != -1)	m_keyboardFiles.removeAt(index);
> -
> +	// extract titles from keyboard files and store them in the
> +	// m_keyboardTitles string list
>      m_keyboardTitles.clear();
>      for (QStringList::const_iterator cit = m_keyboardFiles.constBegin();
>          cit != m_keyboardFiles.constEnd(); ++cit)
>      {
> -        // extract titles from keyboard files and store them in the
> -        // m_keyboardTitles string list
> +		KUrl url = (*cit);
> +		kDebug() << url << endl;
> +    	QString target;
> +		// try to read language code and keyboard name from file
> +		if (!KIO::NetAccess::download(url, target, this)) continue;
> +		// Ok, that was successful, store the lectureURL and read the file
> +		QFile infile(target);
> +		if ( !infile.open( QIODevice::ReadOnly ) ) 	continue;
> +		QDomDocument doc;
> +		doc.setContent( &infile );
> +		QDomElement root = doc.documentElement();
> +		if (root.isNull() || root.tagName() != "KTouchKeyboard")  continue;
> +
> +		// get the title
> +		QString title;
> +		QDomElement e = root.firstChildElement("Title");
> +		if (!e.isNull())	title = e.firstChild().nodeValue();
> +		else				title = i18n("untitled keyboard layout");
> +		QString langid;
> +		// retrieve the language id
> +		e = root.firstChildElement("Language");
> +		if (!e.isNull())	langid = e.firstChild().nodeValue();
> +		// compose title for main menu
> +		if (!langid.isEmpty())
> +			title = QString("%1 (%2)").arg(title).arg(langid);
> +        m_keyboardTitles.append( title );
> +        kDebug() << m_keyboardTitles.back() << endl;
> +    }
>
> +/*
> +    for (QStringList::const_iterator cit = m_keyboardFiles.constBegin();
> +        cit != m_keyboardFiles.constEnd(); ++cit)
> +    {
> +
>          // get the filename alone
>          QString fname = KUrl(*cit).fileName();
>          // get the filename without the .keyboard
> @@ -768,13 +797,15 @@
>          m_keyboardTitles.append( lang_name );
>  //        kDebug() << m_keyboardTitles.back() << endl;
>      }
> +*/
>
>      // now sort the files and titles accordingly
>      sort_lists(m_keyboardTitles, m_keyboardFiles);
>      // and add the number keypad to the front
> -    m_keyboardFiles.push_front("number.keyboard");
> -    m_keyboardTitles.push_front(i18n("Keypad/Number block"));
> +//    m_keyboardFiles.push_front("number.keyboard");
> +//    m_keyboardTitles.push_front(i18n("Keypad/Number block"));
>
> +
>      // Now lets find the lecture files.
>  	// TODO : search in i18n() directories
>      QStringList lectureFiles =
> dirs->findAllResources("data","ktouch/*.ktouch.xml");



-- 
<------------------>

Håvard Frøiland
Schouterrassen 2
0573 Oslo
+47 98269322
+47 21682721
haavard@solveien.net

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

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