Binary files pys60_1_3_18_src_UNTOUCHED/Doc/lib/figuresuiq/editor.PNG and pyuiq_CLEAN/Doc/lib/figuresuiq/editor.PNG differ
Binary files pys60_1_3_18_src_UNTOUCHED/Doc/lib/figuresuiq/explorer.PNG and pyuiq_CLEAN/Doc/lib/figuresuiq/explorer.PNG differ
Binary files pys60_1_3_18_src_UNTOUCHED/Doc/lib/figuresuiq/filemanager.PNG and pyuiq_CLEAN/Doc/lib/figuresuiq/filemanager.PNG differ
Binary files pys60_1_3_18_src_UNTOUCHED/Doc/lib/figuresuiq/imageviewer.png and pyuiq_CLEAN/Doc/lib/figuresuiq/imageviewer.png differ
Binary files pys60_1_3_18_src_UNTOUCHED/Doc/lib/figuresuiq/interactive.png and pyuiq_CLEAN/Doc/lib/figuresuiq/interactive.png differ
Binary files pys60_1_3_18_src_UNTOUCHED/Doc/lib/figuresuiq/output.png and pyuiq_CLEAN/Doc/lib/figuresuiq/output.png differ
Binary files pys60_1_3_18_src_UNTOUCHED/Doc/lib/figuresuiq/runscript.png and pyuiq_CLEAN/Doc/lib/figuresuiq/runscript.png differ
Binary files pys60_1_3_18_src_UNTOUCHED/Doc/lib/figuresuiq/scriptlist.png and pyuiq_CLEAN/Doc/lib/figuresuiq/scriptlist.png differ
Binary files pys60_1_3_18_src_UNTOUCHED/Doc/lib/figuresuiq/standalone.png and pyuiq_CLEAN/Doc/lib/figuresuiq/standalone.png differ
diff -urNp pys60_1_3_18_src_UNTOUCHED/Doc/lib/lib.tex pyuiq_CLEAN/Doc/lib/lib.tex
--- pys60_1_3_18_src_UNTOUCHED/Doc/lib/lib.tex	Thu Dec 21 13:27:32 2006
+++ pyuiq_CLEAN/Doc/lib/lib.tex	Mon May 14 15:52:07 2007
@@ -5,7 +5,7 @@
 % manual are actually printed.  It is easy to customize your manual
 % by commenting out sections that you're not interested in.
 
-\title{PyS60 Library Reference}
+\title{PyUIQ Getting Started}
 
 \input{boilerplate}
 
@@ -24,7 +24,7 @@
 
 \usepackage{longtable}
 
-\graphicspath{{./}{figures/}}
+\graphicspath{{./}{figuresuiq/}}
 
 \begin{document}
 
@@ -46,68 +46,28 @@
 
 \tableofcontents
 
-                                % Chapter title:
+\chapter{Introduction \label{changes}}
 
-\input{libintro}                % Introduction
+\input{libchangesuiq}
 
-\input{libsummary}              % API summary
+\chapter{Installation \label{inst}}
 
-\input{libselected}             % Selected issues
+\input{libinstallationuiq}
 
-\chapter{Operating System Services and Information \label{s60os}}
+\chapter{Usage \label{usage}}
 
-\input{libe32}
-\input{libsysinfo}
+\input{libusageuiq}
 
-\chapter{User Interface and Graphics \label{s60graph}}
+\chapter{Miscellaneous \label{s60ac}}
 
-\input{libappuifw}
-\input{libgraphics}
-\input{libcamera}
-\input{libkeycapture}
-\input{libtopwindow}
-\input{libgles}
-\input{libglcanvas}
+\input{libmiscuiq}
 
-\chapter{Audio and Communication Services \label{s60ac}}
-
-\input{libaudio}
-\input{libtelephone}
-\input{libmessaging}
-\input{libinbox}
-\input{liblocation}
-
-\chapter{Data Management \label{s60data}}
-
-\input{libcontacts}
-\input{libcalendar}
-\input{libcalendareka2}
-\input{libe32db}
-\input{libe32dbm}
-
-\chapter{Standard Library Support and Extensions \label{s60lib}}
-
-\input{standardlibrary}
-\input{libextensions}
-
-\chapter{Extending and Embedding \label{s60ext}}
-
-\input{capiextensions}
-\input{extending}
-
-\input{libabbreviations}
+%\input{libabbreviations}
 \input{libreferences}
 
-\appendix
-
-\chapter{Reporting Bugs}
-\input{reportingbugs}
-
-
 %  The ugly "%begin{latexonly}" pseudo-environments are really just to
 %  keep LaTeX2HTML quiet during the \renewcommand{} macros; they're
 %  not really valuable.
-
 
 %begin{latexonly}
 \renewcommand{\indexname}{Module Index}
diff -urNp pys60_1_3_18_src_UNTOUCHED/Doc/lib/libchangesuiq.tex.in pyuiq_CLEAN/Doc/lib/libchangesuiq.tex.in
--- pys60_1_3_18_src_UNTOUCHED/Doc/lib/libchangesuiq.tex.in	Thu Jan 01 02:00:00 1970
+++ pyuiq_CLEAN/Doc/lib/libchangesuiq.tex.in	Tue May 15 13:30:37 2007
@@ -0,0 +1,97 @@
+\newlength{\screenwidth}
+\setlength{\screenwidth}{0.3\textwidth}
+
+This document shortly outlines the current features available in Python for UIQ 
+version ${{PYS60_VERSION}}. For more information on running Python in Symbian 
+devices, please refer to \cite{PyS60Start} and \cite{PyS60Prog}. The Nokia 
+discussion board offers also valuable information \cite{PyS60DiBo}.
+
+General information on Python can be found from \cite{PyLibRef} and 
+\cite{PyExtEmb}. The official Python website is located at:
+
+\url{http://www.python.org/}
+
+\section{Supported Features}
+
+\begin{notice}[note]
+No formal testing has been done for this release, the below list acts 
+therefore only as a guideline.
+\end{notice}
+
+For an overview of the supported features, please see the screenshots 
+illustrating the current funtionality in \figurename~\ref{fig:overview} and 
+\figurename~\ref{fig:runscript}\footnote{The screenshots in this document are 
+taken in a Sony Ericsson M600i -- a UIQ 3 device.}.
+
+\begin{figure}
+\centering
+\includegraphics[width=\screenwidth]{interactive}
+\includegraphics[width=\screenwidth]{imageviewer}
+\caption{Interactive prompt on left, image handling example on right}
+\label{fig:overview}
+\end{figure}
+
+The following native extensions are supported:
+
+\begin{itemize}
+\item calendar  (does not show the entries in agenda application)
+\item e32db
+\item graphics  ("Image.open" is not supported in UIQ21)
+\item inbox
+\item audio     (not supported currently in UIQ21)
+\item socket
+\item telephone (not supported e.g. in Sony Ericsson p910i)
+\item zlib
+\end{itemize}
+
+The Python standard library support is as in Python for S60 1.3.18 version, 
+refer to "API_Reference_for_Python" available from:
+
+\url{http://sourceforge.net/project/showfiles.php?group_id=154155}
+
+The following extensions are not currently supported:
+
+\begin{itemize}
+\item contacts
+\item location
+\item messaging
+\item sysinfo
+\item camera
+\end{itemize}
+
+In UIQ2.1, native UI widgets, except \code{appuifw.Text} and the application 
+menu, are not supported.
+
+In UIQ3, the following native UI widgets are supported:
+
+\begin{itemize}
+  \item  \code{appuifw.Text}
+  \item  the application menu (\code{appuifw.app.menu})
+  \item  \code{selection_list}
+\end{itemize}
+
+\section{Changes}
+\label{sec:changes}
+
+\subsection{Changes in version 0.2 from 0.1}
+
+\begin{itemize}
+
+  \item Tool \code{py2sis} supports making standalone SIS packages for UIQ3.x.
+
+  \item \code{selection_list} support added to \code{appuifw} (see 
+  "CONTRIBUTORS") in UIQ3.x.
+
+  \item font support added in "graphics" for UIQ3.x
+
+  \item Module \code{graphics}, added \code{Image.open} in UIQ3.x.
+
+  \item Added M600i locations to the script shell load path - This change enables 
+  scripts to be easily added to the shell with drag-n-dropping with PC Suite.
+
+  \item \code{imgviewer.py} - Added M600i locations for pictures to script defaults.
+
+  \item The import fix from PyS60 1.3.19 "[ 1638475 ] Failing import gives an 
+  incorrect error message" is included.
+
+\end{itemize}
\ No newline at end of file
diff -urNp pys60_1_3_18_src_UNTOUCHED/Doc/lib/libinstallationuiq.tex pyuiq_CLEAN/Doc/lib/libinstallationuiq.tex
--- pys60_1_3_18_src_UNTOUCHED/Doc/lib/libinstallationuiq.tex	Thu Jan 01 02:00:00 1970
+++ pyuiq_CLEAN/Doc/lib/libinstallationuiq.tex	Mon May 07 15:39:15 2007
@@ -0,0 +1,35 @@
+
+\section{Installation}
+\label{sec:inst}
+
+\subsection{Installation to a device - UIQ 2.x}
+
+Install the following SIS-packages:
+\begin{verbatim}
+PythonForUIQ21.SIS 
+PythonScriptUIQ21.SIS  
+\end{verbatim}
+
+\subsection{Installation to a device - UIQ3.x}
+
+Install the self-signed versions:
+\begin{verbatim}
+PythonForUIQ3_selfsigned.SIS
+PythonScriptUIQ3_selfsigned.SIS
+\end{verbatim}
+
+For added functionality, sign the following developer certificate versions with 
+the correct developer certificate for your device:
+\begin{verbatim}
+PythonForUIQ3_unsigned_freedevcert.SIS
+PythonScriptUIQ3_unsigned_freedevcert.SIS
+\end{verbatim}
+
+More information about obtaining a developer certificate is available from:
+
+\url{https://www.symbiansigned.com/}
+
+\subsection{Installation to emulator}
+
+Unzip the \code{sdk_files.zip} to your UIQ \code{<UIQ_ROOT>$\backslash$epoc} root folder, 
+make sure that the folders align with your SDK installation.
diff -urNp pys60_1_3_18_src_UNTOUCHED/Doc/lib/libmiscuiq.tex pyuiq_CLEAN/Doc/lib/libmiscuiq.tex
--- pys60_1_3_18_src_UNTOUCHED/Doc/lib/libmiscuiq.tex	Thu Jan 01 02:00:00 1970
+++ pyuiq_CLEAN/Doc/lib/libmiscuiq.tex	Mon May 14 16:21:07 2007
@@ -0,0 +1,58 @@
+\label{sec:misc}
+
+\section{py2sis support}
+
+\begin{notice}[note]
+Only available for UIQ3.x.
+\end{notice}
+
+The tool \code{py2sis} supports building standalone SIS packages installable on 
+UIQ3.x. By using this tool, a developer can wrap any Python script to appear in 
+the device main menu (\figurename~\ref{fig:standalone}).
+
+The package \code{PythonForUIQ3_x.SIS} has to be installed in the device for the 
+standalone package generated by \code{py2sis} to work.
+
+Tip:
+\begin{itemize}
+
+ \item You can change the icons for the packages (shown e.g. in the device main 
+  menu) by replacing files 
+  \code{src$\backslash$py2sis$\backslash$templates_eka2$\backslash$Python_*.bmp} 
+  with your own icons and masks.
+
+\end{itemize}
+
+\begin{figure}
+\centering
+\includegraphics[width=\screenwidth]{standalone}
+\caption{Two standalone Python scripts in the device main menu (script imgviewer.py selected)}
+\label{fig:standalone}
+\end{figure}
+
+\section{Building}
+
+Download the Python for S60 source code version 1.3.18 from:
+
+\url{http://sourceforge.net/project/showfiles.php?group_id=154155}
+
+Apply the \code{PyS60_UIQ.patch} to the PyS60 source code downloaded.
+
+For building Python for UIQ 3 invoke:
+
+\begin{verbatim}
+  N:\PyUIQ>python setup.py obb UIQ30
+\end{verbatim}  
+  
+For building Python for UIQ 2.1 invoke:
+
+\begin{verbatim}  
+  N:\PyUIQ>python setup.py obb UIQ21
+\end{verbatim}
+
+\section{Supported devices}
+
+The current port has been tested in SonyEricsson p910i and SonyEricsson M600i 
+but it should support other devices also based on UIQ 2.1 and UIQ3.x (e.g. 
+Motorola A1000 and Benq P30 - please see \url{http://www.uiq.com/uiqphones.html} 
+for more information).
diff -urNp pys60_1_3_18_src_UNTOUCHED/Doc/lib/libreferences.tex pyuiq_CLEAN/Doc/lib/libreferences.tex
--- pys60_1_3_18_src_UNTOUCHED/Doc/lib/libreferences.tex	Wed Jan 18 17:06:24 2006
+++ pyuiq_CLEAN/Doc/lib/libreferences.tex	Tue May 15 12:50:05 2007
@@ -15,12 +15,7 @@
 \begin{thebibliography}{99}
 \bibitem{PyLibRef} G. van Rossum, and F.L. Drake, Jr., editor. [Python] Library Reference. Available at \url{http://www.python.org/doc}
 \bibitem{PyExtEmb} G. van Rossum, and F.L. Drake, Jr., editor. Extending and Embedding [the Python Interpreter]. Available at \url{http://www.python.org/doc}
-\bibitem{PyCAPI} G. van Rossum, and F.L. Drake, Jr., editor. Python/C API [Reference Manual]. Available at \url{http://www.python.org/doc}
-\bibitem{S60Doc} S60 SDK documentation, available at \url{http://www.forum.nokia.com/}
-\bibitem{PyS60Start} Getting Started with Python for S60 Platform, available at \url{http://www.forum.nokia.com/}
-\bibitem{PyS60Prog} Programming with Python for S60 Platform,  available at \url{http://www.forum.nokia.com/}
-\bibitem{S60AudioVideo} Audio {\&} Video section on the \textit{Forum Nokia} Web site (for Nokia devices), \url{http://www.forum.nokia.com/audiovideo}
-\bibitem{S60Developers} Developers section on the \textit{S60 Platform} Web site (for all S60 devices), \url{http://www.s60.com/}
+\bibitem{PyS60Start} Getting Started with Python for S60 Platform, available at \url{http://wiki.opensource.nokia.com/projects/PyS60_documentation}
+\bibitem{PyS60Prog} Programming with Python for S60 Platform,  available at \url{http://wiki.opensource.nokia.com/projects/PyS60_documentation}
 \bibitem{PyS60DiBo} Python for S60 developer discussion board \url{http://discussion.forum.nokia.com/}
-\bibitem{SVGSpec} Scalable Vector Graphics (SVG) 1.1 Specification \url{http://www.w3.org/TR/SVG/}
 \end{thebibliography}
diff -urNp pys60_1_3_18_src_UNTOUCHED/Doc/lib/libusageuiq.tex pyuiq_CLEAN/Doc/lib/libusageuiq.tex
--- pys60_1_3_18_src_UNTOUCHED/Doc/lib/libusageuiq.tex	Thu Jan 01 02:00:00 1970
+++ pyuiq_CLEAN/Doc/lib/libusageuiq.tex	Mon May 14 16:19:59 2007
@@ -0,0 +1,66 @@
+
+\section{Usage}
+\label{sec:usage}
+
+\subsection{Usage in device}
+
+Using of PyUIQ in UIQ3.x terminal for testing Python scripts is simple:
+
+\begin{enumerate}
+ \item Edit the script in your favorite text editor (any editor will do) (\figurename~\ref{fig:editor})
+ \item Start the PC Suite (\figurename~\ref{fig:pcsuite})
+
+ \item Select the Filemanager and copy the script developed to 
+ folder \code{Python} under folder \code{Sony Ericsson File Manager$\backslash$M600$\backslash$Phone memory$\backslash$OTHER} 
+ (you may need to create this folder) - this folder has been added to the script search path (\figurename~\ref{fig:explorer})
+
+ \item Launch the scripts by selecting \code{Extension - Run script} in Python 
+ script shell (\figurename~\ref{fig:runscript})
+ 
+ \item The script is executed (\figurename~\ref{fig:runscript})
+\end{enumerate}
+
+\begin{figure}
+\centering
+\includegraphics[width=0.7\textwidth]{editor}
+\caption{Python script editing in desktop side}
+\label{fig:editor}
+\end{figure}
+
+\begin{figure}
+\centering
+\includegraphics[width=0.7\textwidth]{filemanager}
+\caption{PC Suite}
+\label{fig:pcsuite}
+\end{figure}
+
+
+\begin{figure}
+\centering
+\includegraphics[width=0.7\textwidth]{explorer}
+\caption{File manager in SE PC Suite}
+\label{fig:explorer}
+\end{figure}
+
+\begin{figure}
+\centering
+\includegraphics[width=\screenwidth]{runscript}
+\includegraphics[width=\screenwidth]{scriptlist}
+\includegraphics[width=\screenwidth]{output}
+\caption{Running script, scripts listed and output of the developed script}
+\label{fig:runscript}
+\end{figure}
+
+\subsection{Usage in emulator}
+
+Start the "Python" application from the emulator menu. This launches the script 
+\code{default.py} found from:
+
+\begin{itemize}
+\item \code{<UIQ_ROOT>$\backslash$epoc32$\backslash$release$\backslash$wins$\backslash$udeb$\backslash$z$\backslash$system$\backslash$apps$\backslash$PYTHON} (in UIQ2.x)
+\item \code{<UIQ_ROOT>$\backslash$epoc32$\backslash$winscw$\backslash$c$\backslash$Private$\backslash$F0201515 (in UIQ3.x)}
+\end{itemize}
+
+For testing other features and functionalities, replace \code{default.py} with 
+your own script, rename it as \code{default.py} as the script search path is 
+hard coded.
diff -urNp pys60_1_3_18_src_UNTOUCHED/Doc/lib/preamble.tex.in pyuiq_CLEAN/Doc/lib/preamble.tex.in
--- pys60_1_3_18_src_UNTOUCHED/Doc/lib/preamble.tex.in	Thu Dec 21 13:30:26 2006
+++ pyuiq_CLEAN/Doc/lib/preamble.tex.in	Tue May 15 13:17:38 2007
@@ -1,5 +1,6 @@
 % Copyright (c) 2006 Nokia Corporation
 
-The Python for S60 Platform (Python for S60) simplifies application development 
-and provides a scripting solution for the Symbian C++ APIs. This document is for 
-Python for S60 version ${{PYS60_VERSION}} that is based on Python 2.2.2.
+The Python for UIQ (PyUIQ) is a scripting language solution for UIQ2.x and 
+UIQ3.x devices. This preliminary port is based on Python for S60 (PyS60) port 
+created by Nokia Corporation which is based on Python 2.2.2. This document 
+highlights the recent changes, installation and usage of PyUIQ.
diff -urNp pys60_1_3_18_src_UNTOUCHED/Doc/texinputs/boilerplate.tex.in pyuiq_CLEAN/Doc/texinputs/boilerplate.tex.in
--- pys60_1_3_18_src_UNTOUCHED/Doc/texinputs/boilerplate.tex.in	Mon Feb 12 10:10:32 2007
+++ pyuiq_CLEAN/Doc/texinputs/boilerplate.tex.in	Tue May 15 13:27:50 2007
@@ -1,11 +1,11 @@
 % Portions Copyright (c) 2006 - 2007 Nokia Corporation
 \author{}
 \authoraddress{
-	\strong{Nokia}\\
+	\strong{TE}\\
 %	Email: \email{python-docs@nokia.com} % not in use currently
 }
 
-\date{12 February 2007}
+\date{15 April 2007}
 
 ${{! 
 def latexquote(s): return s.replace('_','\\textunderscore ')
diff -urNp pys60_1_3_18_src_UNTOUCHED/Doc/texinputs/copyright.tex.in pyuiq_CLEAN/Doc/texinputs/copyright.tex.in
--- pys60_1_3_18_src_UNTOUCHED/Doc/texinputs/copyright.tex.in	Mon Feb 12 17:11:12 2007
+++ pyuiq_CLEAN/Doc/texinputs/copyright.tex.in	Mon May 07 15:29:16 2007
@@ -1,11 +1,16 @@
-Copyright {\copyright} 2004-2007 Nokia Corporation. 
+Copyright (c) 2007 TietoEnator Telecom \& Media Oy. This is Python for UIQ 
+created by TietoEnator Telecom \& Media Oy based on Python for S60. Files added 
+or modified by TietoEnator Telecom \& Media Oy are licensed under Apache License 
+Version 2.0. 
 
-This is Python for S60 version ${{PYS60_VERSION}} created by Nokia
-Corporation. Files added by Nokia Corporation are licensed under
-Apache License Version 2.0. The original software, including
-modifications of Nokia Corporation therein, is licensed under the
-applicable license(s) for Python 2.2.2, unless specifically indicated
-otherwise in the relevant source code file.
+The licensing information of the original software Python for S60 is as follows:
+
+Copyright (c) 2005-2006 Nokia Corporation. This is Python for S60
+created by Nokia Corporation. Files added by Nokia Corporation are
+licensed under Apache License Version 2.0. The original software,
+including modifications of Nokia Corporation therein, is licensed
+under the applicable license(s) for Python 2.2.2, unless specifically
+indicated otherwise in the relevant source code file.
 
 See \verb|http://www.apache.org/licenses/LICENSE-2.0|
 and \verb|http://www.python.org/2.2.2/license.html|
diff -urNp pys60_1_3_18_src_UNTOUCHED/PythonForS60.pkg.in pyuiq_CLEAN/PythonForS60.pkg.in
--- pys60_1_3_18_src_UNTOUCHED/PythonForS60.pkg.in	Tue Jan 23 09:58:44 2007
+++ pyuiq_CLEAN/PythonForS60.pkg.in	Wed May 16 15:24:14 2007
@@ -66,9 +66,13 @@ ${{if S60_VERSION<30 
 "${{SRC_DIR}}\core\lib\weakref.py"                  -"!:\system\libs\weakref.py"
 "${{SRC_DIR}}\core\lib\UserDict.py"                 -"!:\system\libs\UserDict.py"
 "${{SRC_DIR}}\ext\graphics\graphics.py"        -"!:\system\libs\graphics.py"
+${{if WITH_CONTACTS_MODULE
 "${{SRC_DIR}}\ext\contacts\old\contacts.py"        -"!:\system\libs\contacts.py"
+}}
 "${{SRC_DIR}}\ext\telephone\telephone.py"	-"!:\system\libs\telephone.py"
+${{if WITH_AUDIO_MODULE
 "${{SRC_DIR}}\ext\recorder\audio.py"		-"!:\system\libs\audio.py"
+}}
 "${{SRC_DIR}}\ext\keycapture\keycapture.py"		-"!:\system\libs\keycapture.py"
 "${{SRC_DIR}}\ext\topwindow\topwindow.py"		-"!:\system\libs\topwindow.py"
 ${{if S60_VERSION>=26 
@@ -87,7 +91,9 @@ $else
 "${{SRC_DIR}}\ext\graphics\graphics.py"               -"c:\resource\graphics.py"
 "${{SRC_DIR}}\ext\contacts\eka2\contacts.py"          -"c:\resource\contacts.py"
 "${{SRC_DIR}}\ext\telephone\telephone.py"	            -"c:\resource\telephone.py"
+${{if WITH_AUDIO_MODULE
 "${{SRC_DIR}}\ext\recorder\audio.py"		              -"c:\resource\audio.py"
+}}
 "${{SRC_DIR}}\ext\keycapture\keycapture.py"		        -"c:\resource\keycapture.py"
 "${{SRC_DIR}}\ext\topwindow\topwindow.py"		          -"c:\resource\topwindow.py"
 "${{SRC_DIR}}\ext\gles\gles_utils.py"		            -"c:\resource\gles_utils.py"
@@ -102,20 +108,26 @@ ${{if WITH_MESSAGING_MODULE
 ${{if S60_VERSION==12
 ; Camera not supported
 $elif S60_VERSION<30
+${{if WITH_CAMERA_MODULE
   "${{SRC_DIR}}\ext\camera\camera.py"		-"!:\system\libs\camera.py"
+}}
 $else
+${{if WITH_CAMERA_MODULE
   "${{SRC_DIR}}\ext\camera\camera.py"		-"c:\resource\camera.py"
 }}
+}}
 
 ${{if S60_VERSION<30 
 "${{SRC_DIR}}\ext\sysinfo\sysinfo.py"		-"!:\system\libs\sysinfo.py"
 "${{SRC_DIR}}\ext\calendar\old\calendar.py"	-"!:\system\libs\calendar.py"
 "${{SRC_DIR}}\ext\socket\socket.py"		-"!:\system\libs\socket.py"
+"${{SRC_DIR}}\ext\socket\e32socket.py"		  -"!:\system\libs\e32socket.py"
 "${{SRC_DIR}}\ext\socket\select.py"		-"!:\system\libs\select.py"
 $else
 "${{SRC_DIR}}\ext\sysinfo\sysinfo.py"		-"c:\resource\sysinfo.py"
 "${{SRC_DIR}}\ext\calendar\eka2\calendar.py"	-"c:\resource\calendar.py"
 "${{SRC_DIR}}\ext\socket\socket.py"		  -"c:\resource\socket.py"
+"${{SRC_DIR}}\ext\socket\e32socket.py"		  -"c:\resource\e32socket.py"
 "${{SRC_DIR}}\ext\socket\select.py"		  -"c:\resource\select.py"
 }}
 
@@ -133,22 +145,30 @@ $else
 ;
 ${{if S60_VERSION<30 
 "\Epoc32\release\${{DEVICE_PLATFORM}}\${{DEVICE_BUILD}}\e32db.pyd"           -"!:\system\libs\e32db.pyd"
-"\Epoc32\release\${{DEVICE_PLATFORM}}\${{DEVICE_BUILD}}\e32socket.pyd"       -"!:\system\libs\e32socket.pyd"
+"\Epoc32\release\${{DEVICE_PLATFORM}}\${{DEVICE_BUILD}}\_e32socket.pyd"       -"!:\system\libs\_e32socket.pyd"
 ${{if WITH_MESSAGING_MODULE
 "\Epoc32\release\${{DEVICE_PLATFORM}}\${{DEVICE_BUILD}}\_messaging.pyd"       -"!:\system\libs\_messaging.pyd"
 }}
 ${{if WITH_LOCATION_MODULE
 "\Epoc32\release\${{DEVICE_PLATFORM}}\${{DEVICE_BUILD}}\_location.pyd"        -"!:\system\libs\_location.pyd"
 }}
+${{if WITH_CONTACTS_MODULE
 "\Epoc32\release\${{DEVICE_PLATFORM}}\${{DEVICE_BUILD}}\_contacts.pyd"       -"!:\system\libs\_contacts.pyd"
+}}
+${{if WITH_SYSINFO_MODULE
 "\Epoc32\release\${{DEVICE_PLATFORM}}\${{DEVICE_BUILD}}\_sysinfo.pyd"        -"!:\system\libs\_sysinfo.pyd"
+}}
 "\Epoc32\release\${{DEVICE_PLATFORM}}\${{DEVICE_BUILD}}\zlib.pyd"       	-"!:\system\libs\zlib.pyd"
 ${{if S60_VERSION>12
+${{if WITH_CAMERA_MODULE
   "\Epoc32\release\${{DEVICE_PLATFORM}}\${{DEVICE_BUILD}}\_camera.pyd"       	-"!:\system\libs\_camera.pyd"
 }}
+}}
 "\Epoc32\release\${{DEVICE_PLATFORM}}\${{DEVICE_BUILD}}\_graphics.pyd"       -"!:\system\libs\_graphics.pyd"
 "\Epoc32\release\${{DEVICE_PLATFORM}}\${{DEVICE_BUILD}}\_telephone.pyd"      -"!:\system\libs\_telephone.pyd"
+${{if WITH_AUDIO_MODULE
 "\Epoc32\release\${{DEVICE_PLATFORM}}\${{DEVICE_BUILD}}\_recorder.pyd"      	-"!:\system\libs\_recorder.pyd"
+}}
 "\Epoc32\release\${{DEVICE_PLATFORM}}\${{DEVICE_BUILD}}\_calendar.pyd"      	-"!:\system\libs\_calendar.pyd"
 "\Epoc32\release\${{DEVICE_PLATFORM}}\${{DEVICE_BUILD}}\inbox.pyd"      	-"!:\system\libs\inbox.pyd"
 "\Epoc32\release\${{DEVICE_PLATFORM}}\${{DEVICE_BUILD}}\_keycapture.pyd"      	-"!:\system\libs\_keycapture.pyd"
@@ -159,22 +179,30 @@ ${{if S60_VERSION>=26
 }}
 $else
 "\Epoc32\release\${{DEVICE_PLATFORM}}\${{DEVICE_BUILD}}\e32db.pyd"           -"c:\sys\bin\e32db.pyd"
-"\Epoc32\release\${{DEVICE_PLATFORM}}\${{DEVICE_BUILD}}\e32socket.pyd"       -"c:\sys\bin\e32socket.pyd"
+"\Epoc32\release\${{DEVICE_PLATFORM}}\${{DEVICE_BUILD}}\_e32socket.pyd"       -"c:\sys\bin\_e32socket.pyd"
 ${{if WITH_MESSAGING_MODULE
 "\Epoc32\release\${{DEVICE_PLATFORM}}\${{DEVICE_BUILD}}\_messaging.pyd"       -"c:\sys\bin\_messaging.pyd"
 }}
 ${{if WITH_LOCATION_MODULE
 "\Epoc32\release\${{DEVICE_PLATFORM}}\${{DEVICE_BUILD}}\_location.pyd"        -"c:\sys\bin\_location.pyd"
 }}
+${{if WITH_CONTACTS_MODULE
 "\Epoc32\release\${{DEVICE_PLATFORM}}\${{DEVICE_BUILD}}\_contacts.pyd"       -"c:\sys\bin\_contacts.pyd"
+}}
+${{if WITH_SYSINFO_MODULE
 "\Epoc32\release\${{DEVICE_PLATFORM}}\${{DEVICE_BUILD}}\_sysinfo.pyd"        -"c:\sys\bin\_sysinfo.pyd"
+}}
 "\Epoc32\release\${{DEVICE_PLATFORM}}\${{DEVICE_BUILD}}\zlib.pyd"       	-"c:\sys\bin\zlib.pyd"
 ${{if S60_VERSION>12
+${{if WITH_CAMERA_MODULE
   "\Epoc32\release\${{DEVICE_PLATFORM}}\${{DEVICE_BUILD}}\_camera.pyd"       	-"c:\sys\bin\_camera.pyd"
 }}
+}}
 "\Epoc32\release\${{DEVICE_PLATFORM}}\${{DEVICE_BUILD}}\_graphics.pyd"       -"c:\sys\bin\_graphics.pyd"
 "\Epoc32\release\${{DEVICE_PLATFORM}}\${{DEVICE_BUILD}}\_telephone.pyd"      -"c:\sys\bin\_telephone.pyd"
+${{if WITH_AUDIO_MODULE
 "\Epoc32\release\${{DEVICE_PLATFORM}}\${{DEVICE_BUILD}}\_recorder.pyd"      	-"c:\sys\bin\_recorder.pyd"
+}}
 "\Epoc32\release\${{DEVICE_PLATFORM}}\${{DEVICE_BUILD}}\_calendar.pyd"      	-"c:\sys\bin\_calendar.pyd"
 "\Epoc32\release\${{DEVICE_PLATFORM}}\${{DEVICE_BUILD}}\_keycapture.pyd"      -"c:\sys\bin\_keycapture.pyd"
 "\Epoc32\release\${{DEVICE_PLATFORM}}\${{DEVICE_BUILD}}\_topwindow.pyd"      	-"c:\sys\bin\_topwindow.pyd"
diff -urNp pys60_1_3_18_src_UNTOUCHED/PythonScriptShell.pkg.in pyuiq_CLEAN/PythonScriptShell.pkg.in
--- pys60_1_3_18_src_UNTOUCHED/PythonScriptShell.pkg.in	Thu Nov 16 15:52:24 2006
+++ pyuiq_CLEAN/PythonScriptShell.pkg.in	Tue May 15 12:22:46 2007
@@ -61,7 +61,11 @@ $elif S60_VERSION<30
   "\Epoc32\data\z\system\apps\python\Python_aif.mif"   -"!:\system\apps\Python\Python_aif.mif"
 $else
   "\Epoc32\data\z\PRIVATE\10003A3F\APPS\python_reg.rsc"-"!:\Private\10003a3f\import\apps\python_reg.rsc"
+${{if WITH_SVG_LOGO
   "\Epoc32\data\z\resource\apps\Python_aif.mif"   -"!:\resource\apps\Python_aif.mif"
+$else
+  "\Epoc32\data\z\resource\apps\PythonIcon.mbm"   -"!:\resource\apps\PythonIcon.mbm"
+}}
 }}
 
 ; Scripts
@@ -74,7 +78,7 @@ ${{if S60_VERSION<30 
 "${{SRC_DIR}}\app\interactive_console.py"       -"!:\system\libs\interactive_console.py"
 $else
 "${{SRC_DIR}}\app\default.py"                   -"c:\private\${{PYS60_UID_SCRIPTSHELL[2:]}}\default.py"
-"${{SRC_DIR}}\app\filebrowser.py"               -"c:\Python\filebrowser.py"
+"${{SRC_DIR}}\app\filebrowser.py"               -"c:\Media Files\Other\Python\filebrowser.py"
 "${{SRC_DIR}}\app\dir_iter.py"                  -"c:\resource\dir_iter.py"
 "${{SRC_DIR}}\app\series60_console.py"          -"c:\resource\series60_console.py"
 "${{SRC_DIR}}\app\interactive_console.py"       -"c:\resource\interactive_console.py"
@@ -95,11 +99,12 @@ ${{if S60_VERSION>=26 
 "${{SRC_DIR}}\extras\gles_demo.py"     -"!:\system\apps\Python\gles_demo.py"
 }}
 $else
-"${{SRC_DIR}}\extras\snake.py"       -"c:\Python\snake.py"
-"${{SRC_DIR}}\extras\imgviewer.py"     -"c:\Python\imgviewer.py"
-"${{SRC_DIR}}\extras\ball.py"     -"c:\Python\ball.py"
-"${{SRC_DIR}}\extras\gles_demo.py"     -"c:\Python\gles_demo.py"
-"${{SRC_DIR}}\extras\simplecube.py"     -"c:\Python\simplecube.py"
+; Path for SE M600i - seems that e.g. "c:\Python" folder is cleaned during device boot
+"${{SRC_DIR}}\extras\snake.py"       -"c:\Media Files\Other\Python\snake.py"
+"${{SRC_DIR}}\extras\imgviewer.py"     -"c:\Media Files\Other\Python\imgviewer.py"
+"${{SRC_DIR}}\extras\ball.py"     -"c:\Media Files\Other\Python\ball.py"
+"${{SRC_DIR}}\extras\gles_demo.py"     -"c:\Media Files\Other\Python\gles_demo.py"
+"${{SRC_DIR}}\extras\simplecube.py"     -"c:\Media Files\Other\Python\simplecube.py"
 }}
 
 ${{if S60_VERSION==12
diff -urNp pys60_1_3_18_src_UNTOUCHED/README_UIQ.txt pyuiq_CLEAN/README_UIQ.txt
--- pys60_1_3_18_src_UNTOUCHED/README_UIQ.txt	Thu Jan 01 02:00:00 1970
+++ pyuiq_CLEAN/README_UIQ.txt	Tue May 15 12:43:25 2007
@@ -0,0 +1,92 @@
+==================================
+Python for UIQ (PyUIQ), 15.05.2007
+==================================
+
+This is Python for UIQ 2.1 and UIQ 3 v0.2 (hereafter PyUIQ). This preliminary 
+port is based on Python for S60 (hereafter PyS60) port created by Nokia 
+Corporation which is based on Python 2.2.2.
+
+TRADEMARKS
+----------
+
+Python and the Python logo are registered trademarks of the Python
+Software Foundation.
+
+LICENSING
+---------
+
+Copyright (c) 2007 TietoEnator Telecom & Media Oy. This is Python for UIQ 
+created by TietoEnator Telecom & Media Oy based on Python for S60. Files added 
+or modified by TietoEnator Telecom & Media Oy are licensed under Apache License 
+Version 2.0. 
+
+The licensing information of the original software Python for S60 is as follows:
+
+Copyright (c) 2005-2006 Nokia Corporation. This is Python for S60
+created by Nokia Corporation. Files added by Nokia Corporation are
+licensed under Apache License Version 2.0. The original software,
+including modifications of Nokia Corporation therein, is licensed
+under the applicable license(s) for Python 2.2.2, unless specifically
+indicated otherwise in the relevant source code file.
+
+See http://www.apache.org/licenses/LICENSE-2.0
+and http://www.python.org/2.2.2/license.html
+
+CHANGES TO PYS60
+----------------
+
+Please see "changes_UIQ.txt".
+
+Recent Changes
+--------------
+
+  Changes in version 0.2 from 0.1:
+  --------------------------------
+
+  * Tool "py2sis" supports making standalone SIS packages for UIQ3.x.
+
+  * "selection_list" support added to "appuifw" (see "CONTRIBUTORS") in UIQ3.x.
+
+  * font support added in "graphics" for UIQ3.x
+
+  * Module "graphics", added "Image.open" in UIQ3.x.
+
+  * Added M600i locations to the script shell load path ('c:\Media 
+  Files\Other\Python') - This change enables scripts to be easily added to the 
+  shell with drag-n-dropping with PC Suite. The example scripts in UIQ3.x are 
+  also relocated here.
+
+  * "imgviewer.py" - Added M600i locations for pictures to script defaults.
+
+  * The import fix from PyS60 1.3.19 "[ 1638475 ] Failing import gives an 
+  incorrect error message" is included.
+
+Supported devices
+-----------------
+
+The current port has been tested in SonyEricsson p910i and SonyEricsson M600i 
+but it should support other devices also based on UIQ 2.1 and UIQ3.x (e.g. 
+Motorola A1000 and Benq P30 - please see http://www.uiq.com/uiqphones.html for 
+more information).
+
+Detailed versions
+-----------------
+
+This port is otherwise based on PyS60 version 1.3.18, except "socket" which is 
+based on PyS60 version 1.3.14 and "appui" which is based on PyS60 version 
+1.3.11.
+
+The import fix from PyS60 1.3.19 "[ 1638475 ] Failing import gives an incorrect 
+error message" is included.
+
+CONTRIBUTORS
+------------
+
+* 1693826 selection_lists for UIQ3 contributed by jtoivola (jtoivola at 
+users.sourceforge.net)
+
+* 1690489 2 font drawing patches for graphics by jtoivola (jtoivola at 
+users.sourceforge.net)
+
+The above tracking number refers to PyUIQ SourceForge site - the patches 
+section.
diff -urNp pys60_1_3_18_src_UNTOUCHED/app/Python.cpp.in pyuiq_CLEAN/app/Python.cpp.in
--- pys60_1_3_18_src_UNTOUCHED/app/Python.cpp.in	Wed May 31 14:40:50 2006
+++ pyuiq_CLEAN/app/Python.cpp.in	Tue Mar 06 15:27:02 2007
@@ -31,7 +31,15 @@ IMPORT_C CEikAppUi* CreateAmarettoAppUi(
 
 const TUid KUidPythonApp = {${{PYS60_UID_SCRIPTSHELL}}};
 
+${{if PLATFORM=='UIQ'
+${{if SDK_NAME=='UIQ 30'
+CPythonDocument::CPythonDocument(CQikApplication& aApp) : CQikDocument(aApp)
+$else
+CPythonDocument::CPythonDocument(CEikApplication& aApp) : CEikDocument(aApp)
+}}
+$else
 CPythonDocument::CPythonDocument(CEikApplication& aApp) : CAknDocument(aApp) 
+}}
 {
 }
 
diff -urNp pys60_1_3_18_src_UNTOUCHED/app/Python.rss pyuiq_CLEAN/app/Python.rss
--- pys60_1_3_18_src_UNTOUCHED/app/Python.rss	Tue Feb 07 13:51:06 2006
+++ pyuiq_CLEAN/app/Python.rss	Tue Mar 06 12:47:02 2007
@@ -16,8 +16,14 @@ NAME PYTH
 
 #include <eikon.rh>
 #include <eikon.rsg>
+#include "sdkversion.h"
+#ifdef UIQ
+
+
+#else
 #include <avkon.rh>
 #include <avkon.rsg>
+#endif
 
 #include "sdkversion.h"
 #if SERIES60_VERSION>=28
@@ -32,7 +38,9 @@ RESOURCE TBUF { buf=""; }
 RESOURCE EIK_APP_INFO
 {
   menubar=r_python_app_menubar;
+#ifndef UIQ
   cba = R_AVKON_SOFTKEYS_OPTIONS_EXIT;
+#endif
 }
 
 RESOURCE MENU_BAR r_python_app_menubar
@@ -283,8 +291,13 @@ RESOURCE LOCALISABLE_APP_INFO r_python_l
     CAPTION_AND_ICON_INFO
         {
         caption = "Python";
+#ifndef UIQ
         number_of_icons = 1;
         icon_file = "\\resource\\apps\\PYTHON_AIF.mif";
+#else
+        number_of_icons = 3;
+        icon_file = "\\resource\\apps\\PythonIcon.mbm";
+#endif
         };
     }
 #endif  /* SERIES60_VERSION */
Binary files pys60_1_3_18_src_UNTOUCHED/app/Python_Large.bmp and pyuiq_CLEAN/app/Python_Large.bmp differ
Binary files pys60_1_3_18_src_UNTOUCHED/app/Python_Large_mask.bmp and pyuiq_CLEAN/app/Python_Large_mask.bmp differ
Binary files pys60_1_3_18_src_UNTOUCHED/app/Python_Small.bmp and pyuiq_CLEAN/app/Python_Small.bmp differ
Binary files pys60_1_3_18_src_UNTOUCHED/app/Python_Small_mask.bmp and pyuiq_CLEAN/app/Python_Small_mask.bmp differ
diff -urNp pys60_1_3_18_src_UNTOUCHED/app/Python_app.h pyuiq_CLEAN/app/Python_app.h
--- pys60_1_3_18_src_UNTOUCHED/app/Python_app.h	Wed Dec 07 15:41:00 2005
+++ pyuiq_CLEAN/app/Python_app.h	Tue Mar 06 15:24:02 2007
@@ -19,19 +19,54 @@
 #ifndef __PYTHON_APP_H
 #define __PYTHON_APP_H
 
+#include "sdkversion.h"
+
+#ifndef UIQ
 #include <aknapp.h>
 #include <AknDoc.h>
+#else
+#include <eikapp.h>
+#include <eikdoc.h>
+#ifdef UIQ30
+#include <QikApplication.h>
+#include <QikDocument.h>
+#endif
+#endif
 
+#ifndef UIQ
 class CPythonDocument : public CAknDocument
+#else
+#ifdef UIQ30
+class CPythonDocument : public CQikDocument
+#else
+class CPythonDocument : public CEikDocument
+#endif
+#endif
 {
  public:
+#ifndef UIQ
+  CPythonDocument(CEikApplication& aApp);
+#else
+#ifdef UIQ30
+  CPythonDocument(CQikApplication& aApp);
+#else
   CPythonDocument(CEikApplication& aApp);
+#endif
+#endif
   
  private:
   CEikAppUi* CreateAppUiL();
 };
 
+#ifndef UIQ
 class CPythonApplication : public CAknApplication 
+#else
+#ifdef UIQ30
+class CPythonApplication : public CQikApplication
+#else
+class CPythonApplication : public CEikApplication
+#endif
+#endif
 {
  private:
   CApaDocument* CreateDocumentL();
Binary files pys60_1_3_18_src_UNTOUCHED/app/Python_xLarge.bmp and pyuiq_CLEAN/app/Python_xLarge.bmp differ
Binary files pys60_1_3_18_src_UNTOUCHED/app/Python_xLarge_mask.bmp and pyuiq_CLEAN/app/Python_xLarge_mask.bmp differ
diff -urNp pys60_1_3_18_src_UNTOUCHED/app/app.mmp.in pyuiq_CLEAN/app/app.mmp.in
--- pys60_1_3_18_src_UNTOUCHED/app/app.mmp.in	Wed May 31 14:40:36 2006
+++ pyuiq_CLEAN/app/app.mmp.in	Tue Mar 06 15:19:08 2007
@@ -26,7 +26,20 @@ SYSTEMINCLUDE	\epoc32\include \epoc32\in
 
 LIBRARY Python_appui.lib
 LIBRARY euser.lib apparc.lib
+${{if PLATFORM=='UIQ'
+LIBRARY eikcore.lib
+${{if SDK_NAME=='UIQ 30'
+LIBRARY qikcore.lib 
+}}
+$else
 LIBRARY eikcore.lib avkon.lib
+}}
+
+${{if SDK_NAME=='UIQ 30'
+// XXX UIQ Could be added to core also?
+STATICLIBRARY	qikalloc.lib
+LIBRARY			qikallocdll.lib
+}}
 
 ${{if S60_VERSION<28
 AIF Python.aif . Pythonaif.rss c16 final44x44.bmp final44x44mask.bmp final29x29.bmp final29x29mask.bmp
@@ -46,6 +59,20 @@ HEADER
 TARGETPATH      resource\apps
 //LANG  SC //only needed for localized application
 END
+
+${{if PLATFORM=='UIQ'
+START BITMAP	PythonIcon.mbm
+HEADER
+TARGETPATH		\Resource\Apps
+SOURCEPATH		.
+SOURCE	c24		Python_Small.bmp
+SOURCE	8		Python_Small_mask.bmp
+SOURCE	c24		Python_Large.bmp
+SOURCE	8		Python_Large_mask.bmp
+SOURCE	c24		Python_xLarge.bmp
+SOURCE	8		Python_xLarge_mask.bmp
+END
+}}
 
 START RESOURCE Python_reg.rss
 TARGETPATH \private\10003a3f\apps
diff -urNp pys60_1_3_18_src_UNTOUCHED/app/bld.inf.in pyuiq_CLEAN/app/bld.inf.in
--- pys60_1_3_18_src_UNTOUCHED/app/bld.inf.in	Tue Feb 21 11:47:22 2006
+++ pyuiq_CLEAN/app/bld.inf.in	Wed Feb 28 15:32:28 2007
@@ -1,7 +1,9 @@
 PRJ_PLATFORMS
 
 PRJ_MMPFILES
+${{if PLATFORM=='S60'
 ${{if S60_VERSION>=28
 gnumakefile icons_aif.mk 
+}}
 }}
 app.mmp
diff -urNp pys60_1_3_18_src_UNTOUCHED/app/default.py pyuiq_CLEAN/app/default.py
--- pys60_1_3_18_src_UNTOUCHED/app/default.py	Tue Feb 13 13:15:34 2007
+++ pyuiq_CLEAN/app/default.py	Wed May 16 13:50:13 2007
@@ -28,20 +28,25 @@ import series60_console
 import e32
 
 def query_and_exec():
-    
-    def is_py(x):
-        ext=os.path.splitext(x)[1].lower()
-        return ext == '.py' or ext == '.pyc' or ext == '.pyo'
-    script_list = []
-    for nickname,path in script_dirs:
-        if os.path.exists(path):
-            script_list += map(lambda x: (nickname+x,path+'\\'+x),\
-                               map(lambda x: unicode(x,'utf-8'),
-                                   filter(is_py, os.listdir(path))))
-           
-    index = appuifw.selection_list(map(lambda x: unicode(x[0]), script_list))
-    if index >= 0:
-        execfile(script_list[index][1].encode('utf-8'), globals())
+    if(e32.s60_version_info>=(3,0)):
+        def is_py(x):
+            ext=os.path.splitext(x)[1].lower()
+            return ext == '.py' or ext == '.pyc' or ext == '.pyo'
+        script_list = []
+        for nickname,path in script_dirs:
+            if os.path.exists(path):
+                script_list += map(lambda x: (nickname+x,path+'\\'+x),\
+                                   map(lambda x: unicode(x,'utf-8'),
+                                       filter(is_py, os.listdir(path))))
+               
+        try:
+            index = appuifw.selection_list(map(lambda x: unicode(x[0]), script_list))
+        except:
+            pass
+        if index >= 0:
+            execfile(script_list[index][1].encode('utf-8'), globals())
+    else:
+        print "Not supported in UIQ2.x" # No selection list in UIQ2.1
 
 def exec_interactive():
     import interactive_console
@@ -51,6 +56,9 @@ def exec_btconsole():
     import btconsole
     btconsole.main()
 
+def about():
+    print u"See www.python.org for more information."
+
 def menu_action(f):
     appuifw.app.menu = []
     saved_exit_key_handler = appuifw.app.exit_key_handler
@@ -77,10 +85,13 @@ def init_options_menu():
                         (u"Bluetooth console",\
                          lambda: menu_action(exec_btconsole)),\
                         (u"About Python",\
-                         lambda: appuifw.note(u"See www.python.org for more information.", "info"))]
+                         lambda: menu_action(about)),\
+                        (u"Exit", \
+                         lambda: appuifw.app.set_exit())]
 if(e32.s60_version_info>=(3,0)):
     script_dirs = [(u'c:','c:\\python'),
-                   (u'e:','e:\\python')]
+                   (u'e:','e:\\python'),
+                   (u'c:','c:\\Media Files\\Other\\Python')] # SE M600i PC Suite does not allow folders in root level
     for path in ('c:\\python\\lib','e:\\python\\lib'):
         if os.path.exists(path):
             sys.path.append(path)
@@ -95,3 +106,4 @@ from e32 import _stdo
 _stdo(u'c:\\python_error.log')         # low-level error output
 init_options_menu()
 print str(copyright)+"\nVersion "+e32.pys60_version
+
diff -urNp pys60_1_3_18_src_UNTOUCHED/app/interactive_console.py pyuiq_CLEAN/app/interactive_console.py
--- pys60_1_3_18_src_UNTOUCHED/app/interactive_console.py	Wed Dec 07 15:40:54 2005
+++ pyuiq_CLEAN/app/interactive_console.py	Fri Apr 20 10:24:30 2007
@@ -58,6 +58,7 @@ class Py_console:
     def interactive_loop(self, scope = locals()):
         import code
         appuifw.app.menu.append((u"Previous command", self.previous_input))
+        appuifw.app.menu.append((u"Exit", lambda: appuifw.app.set_exit()))
         self.co.clear()
         code.interact(None, self.readfunc, scope)
         self.co.control.bind(EKeyDevice3, None)
diff -urNp pys60_1_3_18_src_UNTOUCHED/appmgr/AppMgr.h pyuiq_CLEAN/appmgr/AppMgr.h
--- pys60_1_3_18_src_UNTOUCHED/appmgr/AppMgr.h	Wed Dec 07 15:41:06 2005
+++ pyuiq_CLEAN/appmgr/AppMgr.h	Tue Mar 06 15:47:58 2007
@@ -19,19 +19,38 @@
 #ifndef __APPMGR_H
 #define __APPMGR_H
 
+#include "sdkversion.h"
+
+#ifndef UIQ
 #include <aknapp.h>
 #include <AknDoc.h>
+#else
+#include <eikapp.h>
+#include <eikdoc.h>
+#endif
 
+#ifndef UIQ
 class CAppMgrDocument : public CAknDocument
+#else
+class CAppMgrDocument : public CEikDocument
+#endif
 {
  public:
+#ifndef UIQ
   CAppMgrDocument(CEikApplication& aApp):CAknDocument(aApp) {;}
+#else
+  CAppMgrDocument(CEikApplication& aApp):CEikDocument(aApp) {;}
+#endif
   CFileStore* OpenFileL(TBool aDoOpen,const TDesC& aFilename,RFs& aFs);
  private: // from CEikDocument
   CEikAppUi* CreateAppUiL();
 };
 
+#ifndef UIQ
 class CAppMgrApplication : public CAknApplication 
+#else
+class CAppMgrApplication : public CEikApplication
+#endif
 {
  private: // from CApaApplication
   CApaDocument* CreateDocumentL();
diff -urNp pys60_1_3_18_src_UNTOUCHED/appmgr/AppMgr.mmp.in pyuiq_CLEAN/appmgr/AppMgr.mmp.in
--- pys60_1_3_18_src_UNTOUCHED/appmgr/AppMgr.mmp.in	Thu Nov 16 13:50:14 2006
+++ pyuiq_CLEAN/appmgr/AppMgr.mmp.in	Tue Mar 06 15:49:42 2007
@@ -40,7 +40,11 @@ SYSTEMINCLUDE	\epoc32\include \epoc32\in
 
 LIBRARY Python_appui.lib
 LIBRARY euser.lib apparc.lib cone.lib
+${{if PLATFORM=='UIQ'
+LIBRARY eikcore.lib efsrv.lib
+$else
 LIBRARY eikcore.lib avkon.lib efsrv.lib
+}}
 
 ${{if S60_VERSION<30
 RESOURCE	AppMgr.rss
diff -urNp pys60_1_3_18_src_UNTOUCHED/appmgr/AppMgr.rss pyuiq_CLEAN/appmgr/AppMgr.rss
--- pys60_1_3_18_src_UNTOUCHED/appmgr/AppMgr.rss	Wed May 17 16:33:42 2006
+++ pyuiq_CLEAN/appmgr/AppMgr.rss	Tue Mar 06 15:41:55 2007
@@ -17,10 +17,12 @@ NAME PYAM
 
 #include <eikon.rh>
 #include <eikon.rsg>
+#include "sdkversion.h"
+#ifndef UIQ
 #include <avkon.rh>
 #include <avkon.rsg>
+#endif
 
-#include "sdkversion.h"
 #if SERIES60_VERSION>=30
 #include <appinfo.rh>
 #endif  /* SERIES60_VERSION */
@@ -32,7 +34,9 @@ RESOURCE TBUF { buf=""; }
 RESOURCE EIK_APP_INFO
 {
   menubar=r_appmgr_app_menubar;
+#ifndef UIQ
   cba = R_AVKON_SOFTKEYS_OPTIONS_EXIT;
+#endif
 }
 
 RESOURCE MENU_BAR r_appmgr_app_menubar
diff -urNp pys60_1_3_18_src_UNTOUCHED/appui/Container.cpp pyuiq_CLEAN/appui/Container.cpp
--- pys60_1_3_18_src_UNTOUCHED/appui/Container.cpp	Fri Oct 27 15:41:28 2006
+++ pyuiq_CLEAN/appui/Container.cpp	Tue Mar 06 11:30:38 2007
@@ -41,12 +41,15 @@ void CAmarettoContainer::ConstructL(cons
 
 CAmarettoContainer::~CAmarettoContainer()
 {
+#ifndef UIQ
   if (iDecoratedTabGroup) {
     GetNaviPane()->Pop(iDecoratedTabGroup);
     delete iDecoratedTabGroup;
   }
+#endif
 }
 
+#ifndef UIQ
 CAknNavigationControlContainer* CAmarettoContainer::GetNaviPane() const
 {
   CEikStatusPane* sp = 
@@ -54,10 +57,11 @@ CAknNavigationControlContainer* CAmarett
   return (STATIC_CAST(CAknNavigationControlContainer*,
                       sp->ControlL(TUid::Uid(EEikStatusPaneUidNavi))));
 }
-
+#endif
 void CAmarettoContainer::EnableTabsL(const CDesCArray* aTabTexts,
                                      CAmarettoCallback* aFunc)
 {
+#ifndef UIQ
   if (iDecoratedTabGroup) {
     GetNaviPane()->Pop(iDecoratedTabGroup);
     delete iDecoratedTabGroup;
@@ -87,12 +91,15 @@ void CAmarettoContainer::EnableTabsL(con
     if (iTop)
       iTop->SetFocus(ETrue);
   }
+#endif
 }
 
 void CAmarettoContainer::SetActiveTab(TInt aIndex)
 {
+#ifndef UIQ
   if (iTabGroup && (aIndex >= 0) && (aIndex < iTabGroup->TabCount()))
     iTabGroup->SetActiveTabByIndex(aIndex);
+#endif
 }
 
 TInt CAmarettoContainer::SetComponentL(CCoeControl* aComponent,
@@ -105,7 +112,11 @@ TInt CAmarettoContainer::SetComponentL(C
     iTop->MakeVisible(ETrue);
   iEventCallback = aEventHandler;
 
+#ifndef UIQ
   if (aComponent && !iTabGroup)
+#else
+  if (aComponent)
+#endif
     aComponent->SetFocus(ETrue);
 
   Refresh();
@@ -125,6 +136,7 @@ void CAmarettoContainer::Draw(const TRec
 TKeyResponse
 CAmarettoContainer::OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType)
 {
+#ifndef UIQ
   if (iTabGroup && ((aKeyEvent.iCode == EKeyLeftArrow) ||
                     (aKeyEvent.iCode == EKeyRightArrow))) {
     
@@ -145,7 +157,7 @@ CAmarettoContainer::OfferKeyEventL(const
     
     return EKeyWasConsumed;
   } 
-  
+#endif /* UIQ */  
   if (iTop) {
     if ((aType == EEventKey) && iEventCallback) {
       SAmarettoEventInfo event_info;
diff -urNp pys60_1_3_18_src_UNTOUCHED/appui/Container.h pyuiq_CLEAN/appui/Container.h
--- pys60_1_3_18_src_UNTOUCHED/appui/Container.h	Fri Oct 27 15:41:16 2006
+++ pyuiq_CLEAN/appui/Container.h	Tue Mar 06 11:31:00 2007
@@ -27,9 +27,12 @@
 #include <eikdef.h>
 #include <eiklbx.h>
 #include <eiklbo.h>
+#include "sdkversion.h"
+#ifndef UIQ
 #include <aknnavi.h>
 #include <aknnavide.h>
 #include <akntabgrp.h>
+#endif
 #include "Python_appui.h"
 
 #ifndef EKA2
@@ -60,9 +63,11 @@ private:
   void HandleControlEventL(CCoeControl*, TCoeEvent) {;}
   
 private:
+#ifndef UIQ
   CAknNavigationControlContainer* GetNaviPane() const;
   CAknNavigationDecorator* iDecoratedTabGroup;
   CAknTabGroup* iTabGroup;
+#endif
   CCoeControl* iTop;
   CAmarettoCallback* iTabCallback;
   CAmarettoCallback* iEventCallback;
diff -urNp pys60_1_3_18_src_UNTOUCHED/appui/Python_appui.cpp pyuiq_CLEAN/appui/Python_appui.cpp
--- pys60_1_3_18_src_UNTOUCHED/appui/Python_appui.cpp	Wed Nov 15 13:26:12 2006
+++ pyuiq_CLEAN/appui/Python_appui.cpp	Tue Mar 06 11:31:43 2007
@@ -75,7 +75,7 @@ void CAmarettoAppUi::RefreshHostedContro
 
 void CAmarettoAppUi::ConstructL() 
 {
-#if SERIES60_VERSION>=20
+#ifndef UIQ // && SERIES60_VERSION>=20 // XXX UIQ
   BaseConstructL(EAknEnableSkin);
 #else
   BaseConstructL();
@@ -86,11 +86,14 @@ void CAmarettoAppUi::ConstructL() 
 
   iInterpreter = CSPyInterpreter::NewInterpreterL();
   iInterpreterExitPending = EFalse;
-  
+#ifndef UIQ  
   SetKeyBlockMode(ENoKeyBlock);
+#endif
 #if SERIES60_VERSION>=28
+#ifndef UIQ
   SetOrientationL(EAppUiOrientationAutomatic);
 #endif
+#endif
 
   initappuifw();
 }
@@ -111,6 +114,7 @@ CAmarettoAppUi::~CAmarettoAppUi() 
 void CAmarettoAppUi::HandleCommandL(TInt aCommand) 
 {
   switch (aCommand) {
+#ifndef UIQ
   case EAknSoftkeyExit:
     if (iExitFunc) {
       iExitFunc->Call();
@@ -118,6 +122,7 @@ void CAmarettoAppUi::HandleCommandL(TInt
     }
   case EAknSoftkeyBack:
   case EAknCmdExit:
+#endif
   case EEikCmdExit: 
     DoExit();
     break;
@@ -131,11 +136,13 @@ void CAmarettoAppUi::HandleCommandL(TInt
 
 void CAmarettoAppUi::HandleForegroundEventL(TBool aForeground)
 {
+#ifndef UIQ
   if (iFocusFunc) {
     iFocusFunc->Call((void*)aForeground);
   }
 
   CAknAppUi::HandleForegroundEventL(aForeground);
+#endif
 }
 
 void CAmarettoAppUi::ReturnFromInterpreter(TInt aError)
@@ -145,21 +152,16 @@ void CAmarettoAppUi::ReturnFromInterpret
   
   if (iInterpreterExitPending) {
     if (iDoorObserver)
+#ifndef UIQ
       ProcessCommandL(EAknCmdExit);
+#else
+	ProcessCommandL(EEikCmdExit);
+#endif
     else
       DoExit();
   }
 }
 
-void CAmarettoAppUi::HandleResourceChangeL(TInt aType)
-{
-  CAknAppUi::HandleResourceChangeL(aType);
-  if ( aType == KEikDynamicLayoutVariantSwitch ) {		
-      SetScreenmode(iScreenMode);
-  }
-
-}
-
 void CAmarettoAppUi::DoRunScriptL()
 {
   char *argv[] = {NULL, NULL};
@@ -207,32 +209,6 @@ void CAmarettoAppUi::CleanSubMenuArray()
     subMenuIndex[i] = 0;
 }
 
-void CAmarettoAppUi::SetScreenmode(TInt aMode)
-{
-  if (aMode == EFull) {
-    iScreenMode = EFull;
-    iContainer->SetRect( ApplicationRect() );
-  }
-  else if (aMode == ELarge) {
-    CEikStatusPane* statusPane = (CEikonEnv::Static())->AppUiFactory()->StatusPane();
-    TRAPD(error, (statusPane->SwitchLayoutL(R_AVKON_STATUS_PANE_LAYOUT_EMPTY) ));
-    if (error != KErrNone) {
-      SPyErr_SetFromSymbianOSErr(error);
-	         }
-    iScreenMode = ELarge;
-    iContainer->SetRect( ClientRect() );
-  }
-  else {
-    CEikStatusPane* statusPane = (CEikonEnv::Static())->AppUiFactory()->StatusPane();
-	  TRAPD(error, (statusPane->SwitchLayoutL(R_AVKON_STATUS_PANE_LAYOUT_USUAL) ));
-    if (error != KErrNone) {
-	     SPyErr_SetFromSymbianOSErr(error);
-    }  
-  
-    iScreenMode = ENormal;
-    iContainer->SetRect( ClientRect() );
-  }  
-}
 
 TInt AsyncRunCallbackL(TAny* aArg)
 {
diff -urNp pys60_1_3_18_src_UNTOUCHED/appui/Python_appui.h pyuiq_CLEAN/appui/Python_appui.h
--- pys60_1_3_18_src_UNTOUCHED/appui/Python_appui.h	Wed Nov 15 13:38:22 2006
+++ pyuiq_CLEAN/appui/Python_appui.h	Tue Mar 06 15:11:28 2007
@@ -1,3 +1,4 @@
+
 /*
  * ====================================================================
  *  Python_appui.h
@@ -23,9 +24,18 @@
 
 #include <coecntrl.h>
 #include <eiklbo.h>
+#include "sdkversion.h"
+#ifndef UIQ
 #include <aknenv.h>
 #include <aknappui.h>
 #include <aknapp.h>
+#else
+#include <eikenv.h>
+#include <apparc.h>
+#include <eikapp.h>
+#include <eikappui.h>
+#include <QikAppUi.h> 
+#endif
 #include "CSPyInterpreter.h"
 #include <Python.rsg>
 #include "sdkversion.h"
@@ -37,11 +47,6 @@ class CAmarettoAppUi;
 NONSHARABLE_CLASS(CAmarettoAppUi);
 #endif
 
-enum ScreenMode {
-    ENormal = 0,
-    ELarge,
-    EFull};
-
 class CAmarettoCallback : public CBase {
  public:
   CAmarettoCallback(CAmarettoAppUi* aAppUi):iAppUi(aAppUi) {;}
@@ -68,9 +73,17 @@ struct SAmarettoEventInfo
 #define EPythonMenuExtensionBase 0x6008
 
 #ifndef EKA2
+#ifndef UIQ
 class CAmarettoAppUi : public CAknAppUi
 #else
+class CAmarettoAppUi : public CEikAppUi
+#endif /* UIQ */
+#else
+#ifndef UIQ
 NONSHARABLE_CLASS(CAmarettoAppUi) : public CAknAppUi
+#else
+NONSHARABLE_CLASS(CAmarettoAppUi) : public CQikAppUi
+#endif /* UIQ */
 #endif
 {
  public:
@@ -103,7 +116,6 @@ NONSHARABLE_CLASS(CAmarettoAppUi) : publ
 
   TInt subMenuIndex[KMaxPythonMenuExtensions];
   void CleanSubMenuArray(); 
-  void SetScreenmode(TInt aMode);
 
   CCoeControl* iContainer;
   CEikMenuPane* aSubPane;
@@ -111,7 +123,6 @@ NONSHARABLE_CLASS(CAmarettoAppUi) : publ
  private:
   void HandleCommandL(TInt aCommand);
   void HandleForegroundEventL(TBool aForeground);
-  void HandleResourceChangeL( TInt aType);
 
   void DynInitMenuPaneL(TInt aMenuId, CEikMenuPane* aMenuPane);
 
@@ -128,7 +139,6 @@ NONSHARABLE_CLASS(CAmarettoAppUi) : publ
   CAsyncCallBack* iAsyncCallback;
   TBuf<KMaxFileName> iScriptName;
   TBuf8<KMaxFileName> iEmbFileName;
-  TInt iScreenMode;
 };
 
 IMPORT_C CEikAppUi* CreateAmarettoAppUi(TInt);
diff -urNp pys60_1_3_18_src_UNTOUCHED/appui/appui.mmp.in pyuiq_CLEAN/appui/appui.mmp.in
--- pys60_1_3_18_src_UNTOUCHED/appui/appui.mmp.in	Thu Nov 30 09:55:58 2006
+++ pyuiq_CLEAN/appui/appui.mmp.in	Mon May 07 10:10:32 2007
@@ -31,15 +31,35 @@ SYSTEMINCLUDE	\epoc32\include \epoc32\in
 
 LIBRARY         python222.lib euser.lib estlib.lib
 LIBRARY         cone.lib eikcore.lib eikcoctl.lib eikctl.lib eikdlg.lib
+${{if PLATFORM=='UIQ'
+LIBRARY         bafl.lib efsrv.lib apmime.lib charconv.lib
+$else
 LIBRARY         avkon.lib bafl.lib efsrv.lib commonui.lib apmime.lib charconv.lib
+}}
 LIBRARY         estor.lib etext.lib gdi.lib fbscli.lib form.lib
+${{if PLATFORM=='S60'
 LIBRARY         aknnotify.lib
+}}
 ${{if S60_VERSION >= 28
+${{if PLATFORM=='UIQ'
+LIBRARY egul.lib
+LIBRARY qikcore.lib
+LIBRARY qiklbx.lib 
+$else
 LIBRARY aknicon.lib egul.lib
 }}
+}}
 ${{if S60_VERSION >= 30
 LIBRARY uiklaf.lib 
 }}
 
 SOURCE		Python_appui.cpp Container.cpp
 SOURCE          appuifw\appuifwmodule.cpp  appuifw\CAppuifwEventBindingArray.cpp
+
+${{if PLATFORM=='UIQ'
+${{if S60_VERSION >= 30
+SOURCE		appuifw\CSelectionListBox.cpp
+$else
+// XXX UIQ2.1 version
+}}
+}}
diff -urNp pys60_1_3_18_src_UNTOUCHED/appui/appuifw/CSelectionListBox.cpp pyuiq_CLEAN/appui/appuifw/CSelectionListBox.cpp
--- pys60_1_3_18_src_UNTOUCHED/appui/appuifw/CSelectionListBox.cpp	Thu Jan 01 02:00:00 1970
+++ pyuiq_CLEAN/appui/appuifw/CSelectionListBox.cpp	Mon May 14 14:38:26 2007
@@ -0,0 +1,53 @@
+#include "CSelectionListBox.h"
+
+CSelectionListBox* CSelectionListBox::NewL(CDesCArray* aItems)
+{
+  CSelectionListBox* lb = new (ELeave) CSelectionListBox(aItems);
+  CleanupStack::PushL(lb);
+  lb->ConstructL();
+  CleanupStack::Pop();
+  return lb;
+}
+
+void CSelectionListBox::ViewConstructL()
+{
+  ViewConstructFromResourceL(R_PYUIQ_LISTBOX_UI_CONFIGURATIONS);
+  iListBox = LocateControlByUniqueHandle<CQikListBox>(EPyUIQListBoxCtrl);
+  iListBox->SetListBoxObserver(this);
+  SetItemsL();
+}
+
+void CSelectionListBox::SetItemsL()
+{
+  MQikListBoxModel& model(iListBox->Model());
+
+  model.ModelBeginUpdateLC();
+  TInt items = iItems->Count();
+  for(TInt count = 0; count < items; count++) {
+    MQikListBoxData* listBoxData = model.NewDataLC(MQikListBoxModel::EDataNormal);
+    listBoxData->AddTextL((*iItems)[count], EQikListBoxSlotText1);
+    CleanupStack::PopAndDestroy(listBoxData);
+    }
+  model.ModelEndUpdateL();
+}
+
+void CSelectionListBox::HandleListBoxEventL(CQikListBox* /*aListBox*/, 
+                                            TQikListBoxEvent aEventType,
+                                            TInt aItemIndex, 
+                                            TInt /*aSlotId*/) 
+{
+  switch(aEventType) {
+    case EEventItemConfirmed:
+    case EEventItemTapped: {
+      CloseDialog(aItemIndex);
+      break;
+    }
+    default:
+      break;
+  }
+}
+
+void CSelectionListBox::HandleCommandL(CQikCommand& aCommand)
+{
+  CQikViewDialog::HandleCommandL(aCommand);
+}
diff -urNp pys60_1_3_18_src_UNTOUCHED/appui/appuifw/CSelectionListBox.h pyuiq_CLEAN/appui/appuifw/CSelectionListBox.h
--- pys60_1_3_18_src_UNTOUCHED/appui/appuifw/CSelectionListBox.h	Thu Jan 01 02:00:00 1970
+++ pyuiq_CLEAN/appui/appuifw/CSelectionListBox.h	Mon May 14 14:38:22 2007
@@ -0,0 +1,45 @@
+
+// The implementation is inspired by the UIQ SDK 3 Listbox guide 
+
+#ifndef __CSELECTIONLISTBOX_H__
+#define __CSELECTIONLISTBOX_H__
+
+#include <QikViewDialog.h> 
+#include <QikListBox.h>
+#include <MQikListBoxModel.h>
+#include <MQikListBoxData.h>
+#include <MQikListBoxObserver.h>
+#include <appuifwmodule.rsg>
+#include "appuifwmodule.hrh"
+
+class CSelectionListBox:
+      public CQikViewDialog,
+      public MQikListBoxObserver
+{
+  public:
+    static CSelectionListBox* NewL(CDesCArray*);
+    void ConstructL(){};
+    ~CSelectionListBox(){};
+
+    void SetItemsL();
+
+    // MQikListBoxObserver 
+    void HandleListBoxEventL(CQikListBox* aListBox, TQikListBoxEvent aEventType,
+                             TInt aItemIndex, TInt aSlotId);
+    // CQikViewDialog
+    void HandleCommandL(CQikCommand&);
+    CQikCommand* DynInitOrDeleteCommandL(CQikCommand* aCommand,
+                                        const CCoeControl& /*aControlAddingCommands*/)
+                                        {return aCommand;};
+  private:
+      CSelectionListBox(CDesCArray* aItems): iItems(aItems) {};
+
+  protected:
+    void ViewConstructL();
+    
+  private:
+    CDesCArray* iItems;
+    CQikListBox* iListBox;
+};
+
+#endif
diff -urNp pys60_1_3_18_src_UNTOUCHED/appui/appuifw/appuifw.py pyuiq_CLEAN/appui/appuifw/appuifw.py
--- pys60_1_3_18_src_UNTOUCHED/appui/appuifw/appuifw.py	Tue Dec 19 14:47:56 2006
+++ pyuiq_CLEAN/appui/appuifw/appuifw.py	Mon May 14 15:07:03 2007
@@ -15,32 +15,24 @@ import _appuifw
 from _appuifw import *
 
 class Canvas(object):
-    def __init__(self,redraw_callback=None,event_callback=None, resize_callback=None):
-        c=_appuifw.Canvas(redraw_callback,event_callback, resize_callback)
+    def __init__(self,redraw_callback=None,event_callback=None):
+        c=_appuifw.Canvas(redraw_callback,event_callback)
         self._canvas=c
         self._uicontrolapi=c._uicontrolapi
         self._drawapi=c._drawapi
         from graphics import _graphics
         self._draw=_graphics.Draw(self)
         self.bind=c.bind
+        import _graphics
         for k in _graphics._draw_methods:
             setattr(self,k,getattr(self._draw,k))
     size=property(lambda self: self._canvas.size)
 
 # public API
 __all__= ('Canvas',
-          'Form',
-          'Listbox',
           'Text',
-          'Icon',
-          'Content_handler',
           'app',
-          'multi_query',
-          'note',
-          'popup_menu',
-          'query',
           'selection_list',
-          'multi_selection_list',
           'available_fonts',
           'EEventKeyUp',
           'EEventKeyDown',
@@ -58,29 +50,3 @@ __all__= ('Canvas',
           'HIGHLIGHT_ROUNDED',
           'HIGHLIGHT_SHADOW')
 
-import e32
-if e32.s60_version_info>=(2,8):
-    __all__ += ('EScreen',
-              'EApplicationWindow',
-              'EStatusPane',
-              'EMainPane',
-              'EControlPane',
-              'ESignalPane',
-              'EContextPane',
-              'ETitlePane',
-              'EBatteryPane',
-              'EUniversalIndicatorPane',
-              'ENaviPane',
-              'EFindPane',
-              'EWallpaperPane',
-              'EIndicatorPane',
-              'EAColumn',
-              'EBColumn',
-              'ECColumn',
-              'EDColumn',
-              'EStaconTop',
-              'EStaconBottom',
-              'EStatusPaneBottom',
-              'EControlPaneBottom',
-              'EControlPaneTop',
-              'EStatusPaneTop')
diff -urNp pys60_1_3_18_src_UNTOUCHED/appui/appuifw/appuifwmodule.cpp pyuiq_CLEAN/appui/appuifw/appuifwmodule.cpp
--- pys60_1_3_18_src_UNTOUCHED/appui/appuifw/appuifwmodule.cpp	Tue Feb 13 13:39:20 2007
+++ pyuiq_CLEAN/appui/appuifw/appuifwmodule.cpp	Mon May 14 15:35:16 2007
@@ -17,7 +17,6 @@
 *    unicode title
 *    mode screen
 *    callable(focus) focus
-*    layout(int)
 *
 *  Listbox
 *    Listbox(list<unicode OR tuple<unicode, unicode>>, callable)
@@ -88,7 +87,7 @@
 *  list<unicode> available_fonts()
 *
 *
-* Copyright (c) 2005-2007 Nokia Corporation
+* Copyright (c) 2005 Nokia Corporation
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
@@ -108,8 +107,21 @@
 #include "appuifw_callbacks.h"
 #include "colorspec.cpp"
 
+#ifdef UIQ
+// selection_list
+#if SERIES60_VERSION>=30
+#include "CSelectionListBox.h"
+#else
+// XXX UIQ2.1 version
+#endif /* SERIES60_VERSION */
+
+#endif /* UIQ */
+
 #if SERIES60_VERSION>=28
+#ifndef UIQ
 #include "akniconutils.h"
+#endif /* UIQ */
+
 #include "GULICON.H"
 #define SCALABLE_UI
 #endif /* SERIES60_VERSION */
@@ -159,32 +171,19 @@ static Application_object* get_app()
                                                    "app");
 }
 
-/* A function that is used with CAsyncCallBack.
- * It is called to destroy the object after
- * UI processing is done.
- */
-
-TInt decrefObject(TAny* aObj)
-{
-  PyEval_RestoreThread(PYTHON_TLS->thread_state);
-  Py_DECREF((PyObject*)aObj);
-  PyEval_SaveThread();
-  return 1;
-}
-
 /*
  * A helper function for the implementation of callbacks
  * from C/C++ code to Python callables
  */
 
-TInt app_callback_handler(TAny* func)
+TInt app_callback_handler(void* func)
 {
   // Strictly speaking this violates the Python/C API spec.
   // We should pass an empty tuple instead of NULL.
   return app_callback_handler(func, NULL);
 }
 
-TInt app_callback_handler(TAny* func, TAny* arg)
+TInt app_callback_handler(void* func, void* arg)
 {
   TInt error = KErrNone;
   
@@ -272,6 +271,7 @@ SPy_S60app_New()          
 
   TInt error;
   const TDesC* title;
+#ifndef UIQ
   TRAP(error,
        (title =
         ((CAknTitlePane*)
@@ -283,9 +283,11 @@ SPy_S60app_New()          
     application_dealloc(op);
     return SPyErr_SetFromSymbianOSErr(error);
   }
-
-  if (!(op->ob_title =
-        PyUnicode_FromUnicode(title->Ptr(), title->Length())) ||
+#endif /* UIQ */
+  if (
+#ifndef UIQ
+		!(op->ob_title = PyUnicode_FromUnicode(title->Ptr(), title->Length())) ||
+#endif /* UIQ */
       (!(op->ob_data = new Application_data(appui, op))) ||
       (!(op->ob_menu = PyList_New(0)))) {
     application_dealloc(op);
@@ -393,33 +395,6 @@ app_activate_tab(Application_object *sel
   return Py_None;
 }
 
-#if SERIES60_VERSION>=28
-extern "C" PyObject *
-app_layout(Application_object *self, PyObject *args)
-{
-  TInt layout = 0;
-  TRect rect; 
-  TBool available = EFalse;
-  
-  if (!PyArg_ParseTuple(args, "i", &layout))
-    return NULL;
-  
-  available = AknLayoutUtils::LayoutMetricsRect((AknLayoutUtils::TAknLayoutMetrics)layout, rect);
-  
-  if(available) {
-    // size, position:
-    return Py_BuildValue("((ii),(ii))", rect.Width(), 
-                                        rect.Height(),
-                                        rect.iTl.iX,
-                                        rect.iTl.iY
-                                        );
-  } else {
-    PyErr_SetString(PyExc_ValueError, "unknown layout");
-    return NULL;
-  }
-}
-#endif /* SERIES60_VERSION */
-
 extern "C" PyObject *
 app_set_exit(Application_object *self, PyObject* /*args*/)
 {
@@ -450,9 +425,6 @@ extern "C" {
     {"uid", (PyCFunction)app_uid, METH_NOARGS},
     {"set_tabs", (PyCFunction)app_set_tabs, METH_VARARGS},
     {"activate_tab", (PyCFunction)app_activate_tab, METH_VARARGS},
-#if SERIES60_VERSION>=28
-    {"layout", (PyCFunction)app_layout, METH_VARARGS},
-#endif /* SERIES60_VERSION */
     {NULL,              NULL}           /* sentinel */
   };
 
@@ -514,6 +486,7 @@ extern "C" {
       TPtr buf(PyUnicode_AsUnicode(v), PyUnicode_GetSize(v),
                PyUnicode_GetSize(v));
 
+#ifndef UIQ
       TRAPD(error, {
         CAknTitlePane* tp = (CAknTitlePane*)
           (((CEikonEnv::Static())->AppUiFactory()->StatusPane())
@@ -531,6 +504,7 @@ extern "C" {
         SPyErr_SetFromSymbianOSErr(error);
         return -1;
       }
+#endif
     }
 
     /*
@@ -636,6 +610,7 @@ extern "C" {
      * screen mode
      */
 
+#ifndef UIQ
     if (!strcmp(name, "screen")) {
       if (!PyString_Check(v)) {
         PyErr_SetString(PyExc_TypeError, "invalid screen setting: string expected");
@@ -643,21 +618,34 @@ extern "C" {
       }
       char *screen_mode=PyString_AsString(v);
       if (!strcmp(screen_mode,"normal")) { // normal screen mode
-        op->ob_data->appui->SetScreenmode(ENormal);    
+	CEikStatusPane* statusPane = (CEikonEnv::Static())->AppUiFactory()->StatusPane();
+	TRAPD(error, (statusPane->SwitchLayoutL(R_AVKON_STATUS_PANE_LAYOUT_USUAL) ));
+	if (error != KErrNone) {
+	  SPyErr_SetFromSymbianOSErr(error);
+	  return -1;
+	}
+	op->ob_data->appui->iContainer->SetRect(op->ob_data->appui->ClientRect());    
       } else if (!strcmp(screen_mode,"large")) { // fullscreen with soft_keys
-	         op->ob_data->appui->SetScreenmode(ELarge);
+	CEikStatusPane* statusPane = (CEikonEnv::Static())->AppUiFactory()->StatusPane();
+	TRAPD(error, (statusPane->SwitchLayoutL(R_AVKON_STATUS_PANE_LAYOUT_EMPTY) ));
+	if (error != KErrNone) {
+	  SPyErr_SetFromSymbianOSErr(error);
+	  return -1;
+	}
+	op->ob_data->appui->iContainer->SetRect(op->ob_data->appui->ClientRect());
       } else if (!strcmp(screen_mode,"full")) { // full screen
-        op->ob_data->appui->SetScreenmode(EFull);
+	op->ob_data->appui->iContainer->SetExtentToWholeScreen();
       } else {
-        PyErr_SetString(PyExc_TypeError, "invalid screen mode: must be one of normal, large, full");
-        return -1;
+	PyErr_SetString(PyExc_TypeError, "invalid screen mode: must be one of normal, large, full");
+	return -1;
       }
       Py_DECREF(op->ob_screen);
       Py_INCREF(v);
       op->ob_screen=v;
       return 0;
     }
-    
+#endif    
+
     /*
      * exit_key_handler
      */
@@ -719,6 +707,7 @@ extern "C" {
 extern "C" PyObject *
 selection_list(PyObject* /*self*/, PyObject* args,  PyObject *kwds)
 {
+#if SERIES60_VERSION>=30 // XXX not supported in UIQ2.1
   TInt error = KErrNone;
   TInt resp = 0;
   PyObject* list;
@@ -756,6 +745,7 @@ selection_list(PyObject* /*self*/, PyObj
       break;
   }
 
+#ifndef UIQ
   TInt index = (-1);
   CAknSelectionListDialog *dlg = NULL;
 
@@ -778,6 +768,30 @@ selection_list(PyObject* /*self*/, PyObj
     return Py_BuildValue("i", index);
   else
     RETURN_ERROR_OR_PYNONE(error);
+
+#else
+    CSelectionListBox *dlg = NULL;
+    if (error == KErrNone) {
+        Py_BEGIN_ALLOW_THREADS;
+        TRAP(error, {
+          dlg = CSelectionListBox::NewL(items_list);
+          resp = dlg->ExecuteLD();
+        });
+        Py_END_ALLOW_THREADS;
+    }
+
+    delete items_list;
+
+    if ((error == KErrNone) && resp >= 0)
+        return Py_BuildValue("i", resp);
+    else
+        RETURN_ERROR_OR_PYNONE(error);
+#endif // UIQ
+
+#else
+  Py_INCREF(Py_None);
+  return Py_None;
+#endif /* SERIES60_VERSION */
 }
 
 /*
@@ -785,6 +799,7 @@ selection_list(PyObject* /*self*/, PyObj
  * Implementation of appuifw.multi_selection_list()
  *
  */
+
 #if SERIES60_VERSION==28
 _LIT(KIconsFile, "Z:\\system\\data\\avkon2.mif");
 #elif SERIES60_VERSION>28
@@ -793,6 +808,7 @@ _LIT(KIconsFile, "Z:\\resource\\apps\\av
 _LIT(KIconsFile, "Z:\\system\\data\\avkon.mbm");
 #endif /* SERIES60_VERSION */
 
+#ifndef UIQ
 extern "C" PyObject *
 multi_selection_list(PyObject* /*self*/, PyObject *args, PyObject *kwds)
 {
@@ -848,12 +864,7 @@ multi_selection_list(PyObject* /*self*/,
     if (!PyUnicode_Check(s))
       error = KErrArgument;
     else {
-      if (isChkbx) {
-        temp.Copy(_L("1\t"));
-      }
-      else {
-        temp.Copy(_L("\t"));
-      }
+      temp.Copy(_L("1\t"));
       temp.Append(PyUnicode_AsUnicode(s),
 		  Min(PyUnicode_GetSize(s), KMaxFileName));
       TRAP(error, items_list->AppendL(temp));
@@ -879,6 +890,18 @@ multi_selection_list(PyObject* /*self*/,
 
   if (isChkbx) {
 #if SERIES60_VERSION>=28
+	/*
+	* The following constants are not present in SDK 2.8:
+	* 
+	* EMbmAvkonQgn_prop_checkbox_on = 16442;
+	* EMbmAvkonQgn_prop_checkbox_on_mask = 16443;
+	* EMbmAvkonQgn_prop_checkbox_off = 16444;
+	* EMbmAvkonQgn_prop_checkbox_off_mask = 16445;
+	* EMbmAvkonQgn_indi_marked_add = 16424;
+	* EMbmAvkonQgn_indi_marked_add_mask = 16425;
+	*
+	* XXX: Modify these when they come with the SDK
+	*/
 	TRAP(error, 
     {
     CFbsBitmap* bitMapOn = NULL;
@@ -886,8 +909,8 @@ multi_selection_list(PyObject* /*self*/,
 	  AknIconUtils::CreateIconL(bitMapOn, 
 	                            maskOn, 
 	                            KIconsFile, 
-	                            EMbmAvkonQgn_prop_checkbox_on, 
-	                            EMbmAvkonQgn_prop_checkbox_on_mask);
+	                            /*EMbmAvkonQgn_prop_checkbox_on*/16442, 
+	                            /*EMbmAvkonQgn_prop_checkbox_on_mask*/16443);
 	  icons->AppendL(CGulIcon::NewL(bitMapOn, maskOn)); 
     
     CFbsBitmap* bitMapOff = NULL;
@@ -895,8 +918,8 @@ multi_selection_list(PyObject* /*self*/,
 	  AknIconUtils::CreateIconL(bitMapOff, 
 	                            maskOff, 
 	                            KIconsFile, 
-	                            EMbmAvkonQgn_prop_checkbox_off, 
-	                            EMbmAvkonQgn_prop_checkbox_off_mask);
+	                            /*EMbmAvkonQgn_prop_checkbox_off*/16444, 
+	                            /*EMbmAvkonQgn_prop_checkbox_off_mask*/16445);
 	  icons->AppendL(CGulIcon::NewL(bitMapOff, maskOff)); 	  
 	  });
   } else 
@@ -907,8 +930,8 @@ multi_selection_list(PyObject* /*self*/,
 	    AknIconUtils::CreateIconL(bitMap, 
 	                            mask, 
 	                            KIconsFile, 
-	                            EMbmAvkonQgn_indi_marked_add, 
-	                            EMbmAvkonQgn_indi_marked_add_mask);
+	                            /*EMbmAvkonQgn_indi_marked_add*/16424, 
+	                            /*EMbmAvkonQgn_indi_marked_add_mask*/16425);
 	    icons->AppendL(CGulIcon::NewL(bitMap, mask));
       });
 #else
@@ -981,12 +1004,14 @@ multi_selection_list(PyObject* /*self*/,
   else
     RETURN_ERROR_OR_PYNONE(error);
 }
+#endif /* UIQ */
 
 /*
  *
  * Implementation of appuifw.query()
  *
  */
+#ifndef UIQ
 
 
 static TReal epoch_local_as_TReal()
@@ -1179,14 +1204,14 @@ query(PyObject* /*self*/, PyObject *args
     return retval;
   }
 }
-
+#endif
 
 /*
  *
  * Implementation of appuifw.Icon
  *
  */
-
+#ifndef UIQ
 struct icon_data {
   TBuf<KMaxFileName> ob_file;
   int ob_bmpId;
@@ -1229,7 +1254,7 @@ new_Icon_object(PyObject* /*self*/, PyOb
     return NULL;
   }
 
-  if (bitmapId <0 || maskId < 0 || bitmapId > 0x4000 || maskId > 0x4000) {
+  if (bitmapId <0 || maskId <0) {
     PyErr_SetString(PyExc_TypeError, 
 		    "expected valid icon and icon mask indexes");
     return NULL;
@@ -1305,7 +1330,7 @@ extern "C" {
     0,                                         /*tp_hash*/
   };
 }       // extern "C"
-
+#endif /* UIQ */
 
 
 /*
@@ -1314,46 +1339,26 @@ extern "C" {
  *
  */
 
+#ifndef UIQ
 class CListBoxCallback : public CBase, public MEikListBoxObserver {
 public:
-  CListBoxCallback(PyObject *aCallback, PyObject *aListBox) {
-    iListBox=aListBox;
+  CListBoxCallback(PyObject *aCallback) {
     iCallback=aCallback;
     Py_XINCREF(iCallback);
   }
   virtual ~CListBoxCallback() {
     Py_XDECREF(iCallback);
-    delete iAsyncCallback;
   }
-  virtual void HandleListBoxEventL(CEikListBox*  aListBox, TListBoxEvent aEventType) {
+  virtual void HandleListBoxEventL(CEikListBox* /* aListBox */, TListBoxEvent aEventType) {
     if (iCallback && (aEventType == EEventEnterKeyPressed || 
 		      aEventType == EEventItemDoubleClicked)) {
       PyEval_RestoreThread(PYTHON_TLS->thread_state);
-      /*Increment of reference count of iListbox. It is used not to delete iListBox 
-        prematurely. Possibly, iCallback is such a 
-        function (i.e. function from Python script that would change app.body from
-        current listbox to something else) that would
-        cause deletion of iListBox object. 
-        Asynchronous callback is later used to call decrefObject() which would 
-        decrease the reference to iListBox once when HandleListBoxEventL() returns, and
-        UI processing is done. This fixes bug 1481966*/
-      Py_INCREF(iListBox);
       app_callback_handler(iCallback);
-      if (iListBox->ob_refcnt == 1){
-        TCallBack cb(&decrefObject, iListBox);
-        iAsyncCallback = new (ELeave) CAsyncCallBack(cb, CActive::EPriorityHigh);
-        iAsyncCallback->CallBack();    
-      }
-      else {
-        Py_DECREF(iListBox);  
-      }
       PyEval_SaveThread();
     }
   }
 private:
   PyObject *iCallback;
-  PyObject *iListBox;
-  CAsyncCallBack *iAsyncCallback;
 };
 
 
@@ -1363,7 +1368,7 @@ struct Listbox_object {
   CAppuifwEventBindingArray* ob_event_bindings; 
   ListboxType ob_lb_type;
   CListBoxCallback *ob_listbox_callback;
-  CArrayPtrFlat<CGulIcon>* ob_icons;
+  CArrayPtr<CGulIcon>* ob_icons;
 };
 
 /* An internal helper function */
@@ -1572,9 +1577,6 @@ new_Listbox_object(PyObject* /*self*/, P
   Listbox_object *op = PyObject_New(Listbox_object, &Listbox_type);
   if (op == NULL)
     return PyErr_NoMemory();
-  op->ob_listbox_callback = NULL; 
-  op->ob_event_bindings = NULL;
-  op->ob_control = NULL;
 
   if (!(op->ob_event_bindings = new CAppuifwEventBindingArray())) {
     PyObject_Del(op);
@@ -1670,35 +1672,31 @@ new_Listbox_object(PyObject* /*self*/, P
           Model()->SetItemTextArray(items_list);
     else
       if (op->ob_lb_type == ESingleGraphicListbox) {
-	      if (op->ob_icons != NULL) 
-	        ((CAknColumnListBox*)op->ob_control)->ItemDrawer()->ColumnData()->SetIconArray(op->ob_icons);	
-	      ((CAknSingleGraphicStyleListBox*)op->ob_control)->Model()->SetItemTextArray(items_list);
+	if (op->ob_icons != NULL) 
+	  ((CAknColumnListBox*)op->ob_control)->ItemDrawer()->ColumnData()->SetIconArray(op->ob_icons);	
+        ((CAknSingleGraphicStyleListBox*)op->ob_control)->Model()->SetItemTextArray(items_list);
       }
     else
       if (op->ob_lb_type == EDoubleGraphicListbox) {
-	      if (op->ob_icons != NULL) 
-	        ((CEikFormattedCellListBox*)op->ob_control)->ItemDrawer()->
-	        ColumnData()->SetIconArray(op->ob_icons);
+	if (op->ob_icons != NULL) 
+	  ((CEikFormattedCellListBox*)op->ob_control)->ItemDrawer()->ColumnData()->SetIconArray(op->ob_icons);
         ((CAknDoubleLargeStyleListBox*)op->ob_control)->Model()->SetItemTextArray(items_list);
       }
 
-    TRAP(error, op->ob_listbox_callback = new (ELeave) CListBoxCallback(cb, (PyObject *)op));
-    if (error != KErrNone) {
-    	if (op->ob_listbox_callback != NULL) 
-    		delete op->ob_listbox_callback;
-      if (op->ob_event_bindings != NULL)
-      	delete op->ob_event_bindings;
-      if (op->ob_control != NULL)
-      	delete op->ob_control;
-      PyObject_Del(op);
-      op = NULL;
-      return SPyErr_SetFromSymbianOSErr(error);
-    }
-    else {
-	    ((CEikListBox*)op->ob_control)->SetListBoxObserver(op->ob_listbox_callback);
-      return (PyObject *) op;    	
-    }
+    TRAP(error, op->ob_listbox_callback = new (ELeave) CListBoxCallback(cb));
+    ((CEikListBox*)op->ob_control)->SetListBoxObserver(op->ob_listbox_callback);
+  }
+  
+  if (error != KErrNone) {
+    delete op->ob_listbox_callback;
+    delete op->ob_event_bindings;
+    delete op->ob_control;
+    PyObject_Del(op);
+    op = NULL;
+    return SPyErr_SetFromSymbianOSErr(error);
   }
+  else
+    return (PyObject *) op;
 }
 
 extern "C" PyObject*
@@ -1771,17 +1769,9 @@ Listbox_set_list(Listbox_object *self, P
 	}
 	else
 	  if (self->ob_lb_type == EDoubleGraphicListbox) {
-  	  CTextListBoxModel* model;
-  		model = ((CAknDoubleLargeStyleListBox*)self->ob_control)->Model();
-  		TInt noOfItems = (model->NumberOfItems());
-  		MDesCArray* textArray = ((CAknDoubleLargeStyleListBox*)self->ob_control)->Model()->ItemTextArray();
-  		CDesCArray* itemList = static_cast<CDesCArray*>(textArray);
-  		itemList->Delete(0, noOfItems);		  		     
-        ((CEikFormattedCellListBox*)self->ob_control)->ItemDrawer()->ColumnData()->IconArray()->ResetAndDestroy();
-        delete ((CEikFormattedCellListBox*)self->ob_control)->ItemDrawer()->ColumnData()->IconArray(); 
-  		((CAknDoubleLargeStyleListBox*)self->ob_control)->Model()->SetItemTextArray(items_list);
-  		if (self->ob_icons != NULL) 
-  			 	((CEikFormattedCellListBox*)self->ob_control)->ItemDrawer()->ColumnData()->SetIconArray(self->ob_icons);   
+	    if (self->ob_icons != NULL) 
+	      ((CAknColumnListBox*)self->ob_control)->ItemDrawer()->ColumnData()->SetIconArray(self->ob_icons);    
+	    ((CAknDoubleLargeStyleListBox*)self->ob_control)->Model()->SetItemTextArray(items_list);    
 	  }
 
     self->ob_control->Reset();
@@ -1882,6 +1872,7 @@ extern "C" {
     0,                                         /*tp_hash*/
   };
 }       // extern "C"
+#endif /* UIQ */
 
 /*
  *
@@ -1889,6 +1880,7 @@ extern "C" {
  *
  */
 
+#ifndef UIQ
 #ifndef EKA2
 class Content_handler_data;
 #else
@@ -2192,6 +2184,7 @@ extern "C" {
     0,                                         /*tp_hash*/
   };
 }       // extern "C"
+#endif /* UIQ */
 
 /*
  *
@@ -2199,6 +2192,7 @@ extern "C" {
  *
  */
 
+#ifndef UIQ
 extern "C" PyObject *
 note(PyObject* /*self*/, PyObject *args)
 {
@@ -2275,6 +2269,7 @@ note(PyObject* /*self*/, PyObject *args)
   
   RETURN_ERROR_OR_PYNONE(error);
 }
+#endif /* UIQ */
 
 /*
  *
@@ -2282,6 +2277,7 @@ note(PyObject* /*self*/, PyObject *args)
  *
  */
 
+#ifndef UIQ
 extern "C" PyObject *
 Multi_line_data_query_dialog(PyObject* /*self*/, PyObject *args)
 {
@@ -2323,6 +2319,7 @@ Multi_line_data_query_dialog(PyObject* /
     }
   }
 }
+#endif /* UIQ */
 
 /*
  *
@@ -2330,6 +2327,7 @@ Multi_line_data_query_dialog(PyObject* /
  *
  */
 
+#ifndef UIQ
 extern "C" PyObject *
 popup_menu(PyObject* /*self*/, PyObject *args)
 {
@@ -2400,7 +2398,7 @@ popup_menu(PyObject* /*self*/, PyObject 
   if (retval == Py_None) Py_INCREF(Py_None);
   return retval;
 }
-
+#endif /* UIQ */
 
 /*
  *
@@ -2408,6 +2406,7 @@ popup_menu(PyObject* /*self*/, PyObject 
  *
  */
 
+
 extern "C" PyObject *
 available_fonts(PyObject* /*self*/)
 {
@@ -2514,7 +2513,39 @@ public:
   void SetFont(TDesC&);
   TFontSpec Font() { return *aFontSpec; };
   const CFont* SystemFont(TPtrC8&);
-  
+
+#ifdef UIQ
+#if S60_VERSION>=30
+  /* This is needed in UIQ to behave correctly */
+  virtual TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent, 
+				      TEventCode aType) {
+    PyObject *arg=NULL, *ret=NULL;
+    CEikRichTextEditor::OfferKeyEventL(aKeyEvent,aType);
+    return EKeyWasNotConsumed;
+    /*if (!iEventCallback) 
+      return EKeyWasNotConsumed;
+    PyEval_RestoreThread(PYTHON_TLS->thread_state);
+    arg=Py_BuildValue("({s:i,s:i,s:i,s:i})",
+		      "type",aType,
+		      "keycode",aKeyEvent.iCode,
+		      "scancode", aKeyEvent.iScanCode, 
+		      "modifiers", aKeyEvent.iModifiers);
+    if (!arg) 
+      goto error;
+    ret=PyEval_CallObject(iEventCallback,arg);
+    Py_DECREF(arg);
+    if (!ret) 
+      goto error;
+    Py_DECREF(ret);
+    PyEval_SaveThread();
+    return EKeyWasNotConsumed;
+  error:
+    PyErr_Print();
+    PyEval_SaveThread();
+    return EKeyWasNotConsumed;*/
+  }
+#endif
+#endif
 private:
   void HandleChangeL(TInt aNewCursorPos) { 
     // TODO: Use SetAmountToFormat to improve performance?
@@ -2531,7 +2562,7 @@ private:
     //  pyappui->RefreshHostedControl();
     //}
   }
-  
+
   TCharFormatMask   	iCharFormatMask;
   TCharFormat 	    	iCharFormat;
   TInt 			iCurrentStyle;
@@ -2561,18 +2592,44 @@ CAppuifwText::~CAppuifwText()
 void CAppuifwText::ConstructL(const TRect& aRect,
                               const CCoeControl* aParent)
 {
+#ifdef UIQ
+
+#if S60_VERSION>=30
+    TInt edwinFlags = EEikEdwinInclusiveSizeFixed |
+				 EEikEdwinNoAutoSelection|
+                      EEikEdwinAlwaysShowSelection;
+    // Crash on UIQ3 emulator without CEikRichTextEditor::EDisplayModeView
+    // Seems like a bug of UIQ3, since that value should be default anyway.
+    CEikRichTextEditor::ConstructL( 10, 1000, edwinFlags, 0, 0, CEikRichTextEditor::EDisplayModeView );
+
+  SetContainerWindowL(*aParent);
+    SetRect(aRect);
+  SetParent(const_cast < CCoeControl* >(aParent));
+  //CreateScrollBarFrameL();
+  //ScrollBarFrame()->SetScrollBarVisibilityL(CEikScrollBarFrame::EAuto,
+  //                                          CEikScrollBarFrame::EAuto);
+#else
   CEikRichTextEditor::ConstructL(aParent, 0, 0,
 				 EEikEdwinInclusiveSizeFixed|
 				 EEikEdwinNoAutoSelection|
 				 EEikEdwinAlwaysShowSelection, 0, 0);
+  SetRect(aRect);
+  CreateScrollBarFrameL();
+  ScrollBarFrame()->SetScrollBarVisibilityL(CEikScrollBarFrame::EAuto, 
+                                            CEikScrollBarFrame::EAuto);
+#endif /* S60_VERSION */
 
-// If scrollbar is wanted to be used with the editor
-// the scrollbar functionality must be linked to texteditor content.
-/*
+#else /* UIQ */
+  CEikRichTextEditor::ConstructL(aParent, 0, 0,
+				 EEikEdwinInclusiveSizeFixed|
+				 EEikEdwinNoAutoSelection|
+				 EEikEdwinAlwaysShowSelection, 0, 0);
+  SetRect(aRect);
   CreateScrollBarFrameL();
   ScrollBarFrame()->SetScrollBarVisibilityL(CEikScrollBarFrame::EAuto, 
-                                         CEikScrollBarFrame::EAuto);
-*/
+                                            CEikScrollBarFrame::EAuto);
+
+#endif /* UIQ */
   ActivateL();
   iCurrentStyle = KNORMAL;
   iCoeEnv = NULL;
@@ -2796,13 +2853,13 @@ const CFont* CAppuifwText::SystemFont(TP
   return systemFont;
 }
 
+
 struct Text_object {
   PyObject_VAR_HEAD
   CAppuifwText* ob_control;
   CAppuifwEventBindingArray* ob_event_bindings; 
 };
 
-
 extern "C" PyObject *
 new_Text_object(PyObject* /*self*/, PyObject* args)
 {
@@ -3195,10 +3252,9 @@ NONSHARABLE_CLASS(CAppuifwCanvas) : publ
 {
 public:
   CAppuifwCanvas(PyObject *aDrawCallback,
-		 PyObject *aEventCallback, PyObject* aResizeCallback):
+		 PyObject *aEventCallback):
     iDrawCallback(aDrawCallback),
-    iEventCallback(aEventCallback),
-    iResizeCallback(aResizeCallback)
+    iEventCallback(aEventCallback)
   {}
   virtual ~CAppuifwCanvas() {;}
   virtual void ConstructL(const TRect& aRect,
@@ -3235,7 +3291,7 @@ private:
     PyEval_SaveThread();
     return EKeyWasNotConsumed;
   }
-  PyObject *iDrawCallback, *iEventCallback, *iResizeCallback;
+  PyObject *iDrawCallback, *iEventCallback;
 };
 
 void CAppuifwCanvas::ConstructL(const TRect& aRect,
@@ -3246,7 +3302,7 @@ void CAppuifwCanvas::ConstructL(const TR
   /*  if (aParent) 
       SetContainerWindowL(*aParent);
       else */
-  __ASSERT_DEBUG(aParent, User::Panic(_L("CAppuifwCanvas"), 2)); // This control must have a parent.
+//  __ASSERT_DEBUG(aParent, User::Panic(_L("CAppuifwCanvas"), 2)); // This control must have a parent. // XXX UIQ
   CreateWindowL(aParent);
   SetRect(aRect);
   ActivateL();
@@ -3283,20 +3339,10 @@ CAppuifwCanvas::Draw(const TRect& aRect)
 void 
 CAppuifwCanvas::SizeChanged()
 { 
-  PyObject *arg=NULL, *ret=NULL;
-  if (iResizeCallback) {
-    int in_interpreter=(_PyThreadState_Current == PYTHON_TLS->thread_state);
-    if (!in_interpreter) {
-      PyEval_RestoreThread(PYTHON_TLS->thread_state);
-    }
-    PyObject *pyrectsize=Py_BuildValue("((ii))", Rect().Width(), Rect().Height());
-    app_callback_handler( iResizeCallback, pyrectsize);
-  	if (!in_interpreter) {
-        PyEval_SaveThread();
-    }
-  }
+
 }
 
+
 void
 pyprintf(const char *format, ...)
 {
@@ -3321,7 +3367,6 @@ struct Canvas_object {
   // NOTE: fields above this line must match struct _control_object!
   PyObject *ob_drawcallback;
   PyObject *ob_eventcallback;
-  PyObject *ob_resizecallback;
 };
 
 #define FAILMEM(phase) do { ret=PyErr_NoMemory(); goto fail##phase; } while(0)
@@ -3332,14 +3377,13 @@ new_Canvas_object(PyObject* /*self*/, Py
 {
   PyObject *ret;
 
-  PyObject *draw_cb=NULL, *event_cb=NULL, *resize_cb=NULL;
+  PyObject *draw_cb=NULL, *event_cb=NULL;
 
-  if (!PyArg_ParseTuple(args, "OOO", &draw_cb, &event_cb, &resize_cb)) {
+  if (!PyArg_ParseTuple(args, "OO", &draw_cb, &event_cb)) {
     return NULL;
   }
   if ((draw_cb && !PyCallable_Check(draw_cb) && draw_cb != Py_None) ||
-      (event_cb && !PyCallable_Check(event_cb) && event_cb != Py_None) ||
-      (resize_cb && !PyCallable_Check(resize_cb) && resize_cb != Py_None)) {
+      (event_cb && !PyCallable_Check(event_cb) && event_cb != Py_None)) {
     PyErr_SetString(PyExc_TypeError, "callable or None expected");
     return NULL;
   }
@@ -3347,8 +3391,6 @@ new_Canvas_object(PyObject* /*self*/, Py
     draw_cb=NULL;
   if (event_cb == Py_None)
     event_cb=NULL;  
-  if (resize_cb == Py_None)
-    resize_cb=NULL;
 
   CAmarettoAppUi* appui = MY_APPUI;
   Application_object* app = get_app();
@@ -3357,17 +3399,14 @@ new_Canvas_object(PyObject* /*self*/, Py
   if (!op) FAILMEM(1);
   op->ob_drawcallback=draw_cb;
   op->ob_eventcallback=event_cb;
-  op->ob_resizecallback=resize_cb;
   op->ob_event_bindings = NULL;
   if (!(op->ob_control = new CAppuifwCanvas(op->ob_drawcallback, 
-					    op->ob_eventcallback, op->ob_resizecallback))) FAILMEM(3);
-
+					    op->ob_eventcallback))) FAILMEM(2);
   TRAPD(error, op->ob_control->ConstructL(appui->ClientRect(), appui->iContainer));
   if (error != KErrNone) 
     FAILSYMBIAN(3);
   Py_XINCREF(op->ob_drawcallback);
   Py_XINCREF(op->ob_eventcallback);
-  Py_XINCREF(op->ob_resizecallback);
   return (PyObject *) op;
   
  fail3:delete op->ob_control;
@@ -3431,8 +3470,6 @@ extern "C" {
   static void
   Canvas_dealloc(Canvas_object *op)
   {
-    Py_XDECREF(op->ob_resizecallback);
-    op->ob_resizecallback=NULL;
     Py_XDECREF(op->ob_eventcallback);
     op->ob_eventcallback=NULL;
     Py_XDECREF(op->ob_drawcallback);
@@ -3514,6 +3551,7 @@ extern "C" {
  * Combo/Popup -field data content in Symbian OS data types
  */
 
+#ifndef UIQ
 class TComboFieldData {
 public:
   TComboFieldData():iOptions(NULL),iCurrent(0),iArrayOwned(EFalse) {;}
@@ -4017,11 +4055,6 @@ public:
   void ClearSyncUi() {
     iSyncUi = EFalse;
   }
-  void SetInitialCurrentLine()
-  {
-    ActivateFirstPageL();
-    TryChangeFocusToL( 1 );
-  }
 
 protected:
   TBool SaveFormDataL(); 
@@ -4785,7 +4818,7 @@ extern "C" {
     (struct PyMemberDef *)Form_memberlist,     /*tp_members*/
   };
 }       // extern "C"
-
+#endif /* UIQ */
 
 /*
  * Module level implementation of module "appuifw". Notice that
@@ -4799,18 +4832,25 @@ extern "C" {
   static const PyMethodDef appuifw_methods[] = {
     /*    {"Application", (PyCFunction)new_application_object, METH_NOARGS, NULL}, */
     {"selection_list", (PyCFunction)selection_list, METH_VARARGS|METH_KEYWORDS, NULL},
+#ifndef UIQ
     {"multi_selection_list", (PyCFunction)multi_selection_list, METH_VARARGS|METH_KEYWORDS, NULL},
+#endif
+    {"available_fonts", (PyCFunction)available_fonts, METH_NOARGS, NULL},
+#ifndef UIQ
     {"query", (PyCFunction)query, METH_VARARGS, NULL},
     {"Listbox", (PyCFunction)new_Listbox_object, METH_VARARGS, NULL},
     {"Content_handler", (PyCFunction)new_Content_handler_object, METH_VARARGS, NULL},
     {"note", (PyCFunction)note, METH_VARARGS, NULL},
     {"multi_query", (PyCFunction)Multi_line_data_query_dialog, METH_VARARGS, NULL},
     {"popup_menu", (PyCFunction)popup_menu, METH_VARARGS, NULL},
-    {"available_fonts", (PyCFunction)available_fonts, METH_NOARGS, NULL},
+
     {"Form", (PyCFunction)new_Form_object, METH_VARARGS|METH_KEYWORDS, NULL},
+#endif
     {"Text", (PyCFunction)new_Text_object, METH_VARARGS, NULL},
     {"Canvas", (PyCFunction)new_Canvas_object, METH_VARARGS, NULL},
+#ifndef UIQ
     {"Icon", (PyCFunction)new_Icon_object, METH_VARARGS, NULL},
+#endif
     {NULL,              NULL}           /* sentinel */
   };
 
@@ -4824,33 +4864,35 @@ void initappuifw(void)
 
   Application_type = c_Application_type;
   Application_type.ob_type = &PyType_Type;
-
+#ifndef UIQ
   Listbox_type = c_Listbox_type;
   Listbox_type.ob_type = &PyType_Type;
-
+#endif
   Text_type = c_Text_type;
   Text_type.ob_type = &PyType_Type;
-
+#ifndef UIQ
   Form_type = c_Form_type;
   Form_type.ob_type = &PyType_Type;
 
   Content_handler_type = c_Content_handler_type;
   Content_handler_type.ob_type = &PyType_Type;
-
+#endif
   Canvas_type = c_Canvas_type;
   Canvas_type.ob_type = &PyType_Type;
-
+#ifndef UIQ
   Icon_type = c_Icon_type;
   Icon_type.ob_type = &PyType_Type;
-
+#endif
   m = Py_InitModule("_appuifw", (PyMethodDef*)appuifw_methods);
   d = PyModule_GetDict(m);
 
+#ifndef UIQ
   PyDict_SetItemString(d, "FFormEditModeOnly", PyInt_FromLong(KFormEditModeOnly));
   PyDict_SetItemString(d, "FFormViewModeOnly", PyInt_FromLong(KFormViewModeOnly));
   PyDict_SetItemString(d, "FFormAutoLabelEdit", PyInt_FromLong(KFormAutoLabelEdit));
   PyDict_SetItemString(d, "FFormAutoFormEdit", PyInt_FromLong(KFormAutoFormEdit));
   PyDict_SetItemString(d, "FFormDoubleSpaced", PyInt_FromLong(KFormDoubleSpaced));
+#endif
   /* text style flags */
   PyDict_SetItemString(d, "STYLE_BOLD", PyInt_FromLong(KBOLD));
   PyDict_SetItemString(d, "STYLE_UNDERLINE", PyInt_FromLong(KUNDERLINE));
@@ -4864,33 +4906,6 @@ void initappuifw(void)
   PyDict_SetItemString(d, "EEventKey", PyInt_FromLong(EEventKey));
   PyDict_SetItemString(d, "EEventKeyDown", PyInt_FromLong(EEventKeyDown));
   PyDict_SetItemString(d, "EEventKeyUp", PyInt_FromLong(EEventKeyUp));
-#if SERIES60_VERSION>=28
-  /* layout codes */
-  PyDict_SetItemString(d, "EScreen", PyInt_FromLong(AknLayoutUtils::EScreen));
-  PyDict_SetItemString(d, "EApplicationWindow", PyInt_FromLong(AknLayoutUtils::EApplicationWindow));
-  PyDict_SetItemString(d, "EStatusPane", PyInt_FromLong(AknLayoutUtils::EStatusPane));
-  PyDict_SetItemString(d, "EMainPane", PyInt_FromLong(AknLayoutUtils::EMainPane));
-  PyDict_SetItemString(d, "EControlPane", PyInt_FromLong(AknLayoutUtils::EControlPane));
-  PyDict_SetItemString(d, "ESignalPane", PyInt_FromLong(AknLayoutUtils::ESignalPane));
-  PyDict_SetItemString(d, "EContextPane", PyInt_FromLong(AknLayoutUtils::EContextPane));
-  PyDict_SetItemString(d, "ETitlePane", PyInt_FromLong(AknLayoutUtils::ETitlePane));
-  PyDict_SetItemString(d, "EBatteryPane", PyInt_FromLong(AknLayoutUtils::EBatteryPane));
-  PyDict_SetItemString(d, "EUniversalIndicatorPane", PyInt_FromLong(AknLayoutUtils::EUniversalIndicatorPane));
-  PyDict_SetItemString(d, "ENaviPane", PyInt_FromLong(AknLayoutUtils::ENaviPane));
-  PyDict_SetItemString(d, "EFindPane", PyInt_FromLong(AknLayoutUtils::EFindPane));
-  PyDict_SetItemString(d, "EWallpaperPane", PyInt_FromLong(AknLayoutUtils::EWallpaperPane));
-  PyDict_SetItemString(d, "EIndicatorPane", PyInt_FromLong(AknLayoutUtils::EIndicatorPane));
-  PyDict_SetItemString(d, "EAColumn", PyInt_FromLong(AknLayoutUtils::EAColunm));
-  PyDict_SetItemString(d, "EBColumn", PyInt_FromLong(AknLayoutUtils::EBColunm));
-  PyDict_SetItemString(d, "ECColumn", PyInt_FromLong(AknLayoutUtils::ECColunm));
-  PyDict_SetItemString(d, "EDColumn", PyInt_FromLong(AknLayoutUtils::EDColunm));
-  PyDict_SetItemString(d, "EStaconTop", PyInt_FromLong(AknLayoutUtils::EStaconTop));
-  PyDict_SetItemString(d, "EStaconBottom", PyInt_FromLong(AknLayoutUtils::EStaconBottom ));
-  PyDict_SetItemString(d, "EStatusPaneBottom", PyInt_FromLong(AknLayoutUtils::EStatusPaneBottom));
-  PyDict_SetItemString(d, "EControlPaneBottom", PyInt_FromLong(AknLayoutUtils::EControlPaneBottom));
-  PyDict_SetItemString(d, "EControlPaneTop", PyInt_FromLong(AknLayoutUtils::EControlPaneTop));
-  PyDict_SetItemString(d, "EStatusPaneTop", PyInt_FromLong(AknLayoutUtils::EStatusPaneTop));
-#endif /* SERIES60_VERSION */
 
   PyObject* app = SPy_S60app_New();
   if (app)
@@ -4919,4 +4934,3 @@ void finalizeappuifw(void)
 
   PyEval_SaveThread();
 }
-
diff -urNp pys60_1_3_18_src_UNTOUCHED/appui/appuifw/appuifwmodule.h pyuiq_CLEAN/appui/appuifw/appuifwmodule.h
--- pys60_1_3_18_src_UNTOUCHED/appui/appuifw/appuifwmodule.h	Tue Dec 19 14:38:48 2006
+++ pyuiq_CLEAN/appui/appuifw/appuifwmodule.h	Tue Mar 06 13:08:52 2007
@@ -23,20 +23,26 @@
 #ifndef __APPUIFWMODULE_H
 #define __APPUIFWMODULE_H
 
+#include "sdkversion.h"
+#ifndef UIQ
 #include "popup_field_hack.h" // Form
-
+#endif
 #include <eikenv.h>
 #include <f32file.h>
 #include <s32mem.h>
 #include <apmstd.h>
 #include <apparc.h>
+#ifndef UIQ
 #include <aknenv.h>
 #include <aknappui.h>
 #include <aknapp.h>
+#endif
 #include <eikon.hrh>          // Form
+#ifndef UIQ
 #include <avkon.hrh>
 #include <avkon.rsg>
 #include <avkon.mbg>	      // multiselectionlist
+#endif
 #include <barsread.h>
 #include <eikedwin.h>         // Form
 #include <eikcapc.h>          // Form
@@ -46,6 +52,7 @@
 #include <eikrted.h>	      // RText
 #include <txtrich.h>
 #include <gdi.h>	      // RText
+#ifndef UIQ
 #include <aknlists.h>
 #include <aknselectionlist.h>
 #include <aknquerydialog.h>
@@ -56,12 +63,8 @@
 #include <aknglobalnote.h>  // for global note
 #include <aknnotifystd.h>
 #include <documenthandler.h>
-#if SERIES60_VERSION>=28
-#include <aknutils.h>  // for main pane etc. sizes and positions
-#endif /* SERIES60_VERSION */
-#ifdef EKA2
 #include <aknserverapp.h>
-#endif /*EKA2*/
+#endif /* UIQ */
 #include <appuifwmodule.rsg>
 #include <Python.rsg>	      //for submenus
 #include "Python.h"
@@ -72,6 +75,12 @@
 #include "CAppuifwEventBindingArray.h"
 #include "eikclbd.h"	      // for icons in Listbox
 
+#ifdef UIQ
+#include <eikmenup.h> 
+#include <eikapp.h>
+#include <eikspane.h>
+_LIT(KUIQTitle, "UIQ");
+#endif /* UIQ */
 _LIT(KSeparatorTab, "\t");
 _LIT(KEmptyString, "");
 #ifdef EKA2
@@ -117,13 +126,18 @@ enum ListboxType {ESingleListbox, EDoubl
  */
 
 #define Application_type ((PYTHON_GLOBALS->tobj).t_Application)
+#ifndef UIQ
 #define Listbox_type ((PYTHON_GLOBALS->tobj).t_Listbox)
 #define Content_handler_type ((PYTHON_GLOBALS->tobj).t_Content_handler)
+#endif
 #define Text_type ((PYTHON_GLOBALS->tobj).t_Text)
+#ifndef UIQ
 #define Form_type ((PYTHON_GLOBALS->tobj).t_Form)
+#endif
 #define Canvas_type (PYTHON_GLOBALS->t_Canvas)
+#ifndef UIQ
 #define Icon_type (PYTHON_GLOBALS->t_Icon)
-
+#endif
 /*
  * Structure of Python objects that represent UI controls and
  * a check for control objects (hardcoded types -- bad)
diff -urNp pys60_1_3_18_src_UNTOUCHED/appui/appuifw/appuifwmodule.hrh pyuiq_CLEAN/appui/appuifw/appuifwmodule.hrh
--- pys60_1_3_18_src_UNTOUCHED/appui/appuifw/appuifwmodule.hrh	Wed Dec 07 15:41:18 2005
+++ pyuiq_CLEAN/appui/appuifw/appuifwmodule.hrh	Mon May 14 13:51:30 2007
@@ -20,4 +20,9 @@
 #define KFormMaxMenuItems 15
 #define KFormMaxFields 20
 
+enum TAppuifwControls {
+	EPyUIQListBox,
+	EPyUIQListBoxCtrl,
+	EPyUIQListBoxDoneCmd
+};
 #endif /* __APPUIFW_HRH__ */
diff -urNp pys60_1_3_18_src_UNTOUCHED/appui/appuifw/appuifwmodule.rss pyuiq_CLEAN/appui/appuifw/appuifwmodule.rss
--- pys60_1_3_18_src_UNTOUCHED/appui/appuifw/appuifwmodule.rss	Wed Dec 07 15:41:20 2005
+++ pyuiq_CLEAN/appui/appuifw/appuifwmodule.rss	Thu Jan 01 02:00:00 1970
@@ -1,464 +0,0 @@
-/* Copyright (c) 2005 Nokia Corporation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-//
-// appuifwmodule.rss
-//
-// made independent from app's resource file
-//
-
-NAME AUFW
-
-#include <eikon.rh>
-#include <eikon.rsg>
-#include <avkon.hrh>
-
-#include <avkon.rh>
-#include <avkon.rsg>
-#include "appuifwmodule.hrh"
-
-RESOURCE RSS_SIGNATURE { }
-
-RESOURCE DIALOG r_appuifw_sel_list
-{
-  flags = EAknDialogSelectionList;
-  buttons = R_AVKON_SOFTKEYS_OK_CANCEL;
-  items =
-  {
-    DLG_LINE
-    {
-      type = EAknCtSingleListBox;
-      id = ESelectionListControl;
-      control = LISTBOX
-      {
-	flags = EAknListBoxSelectionList;
-	//	array_id = r_list_box_array;
-      };
-    }
-  };
-}
-
-RESOURCE DIALOG r_appuifw_sel_list_query
-{
-  flags = EAknDialogSelectionList;
-  buttons = R_AVKON_SOFTKEYS_OK_CANCEL;
-  items =
-  {
-    DLG_LINE
-    {
-      type = EAknCtSingleListBox;
-      id = ESelectionListControl;
-      control = LISTBOX
-      {
-	flags = EAknListBoxSelectionList;
-	//	array_id = r_list_box_array;
-      };
-    }, 
-    DLG_LINE 
-    {
-      itemflags = EEikDlgItemNonFocusing;
-      id = EFindControl;
-      type = EAknCtSelectionListFixedFind; 
-    }
-  };
-}
-
-
-RESOURCE DIALOG r_appuifw_multi_sel_list 
-{
- flags = EAknListBoxMultiselectionList | EAknListBoxLoopScrolling;
-// buttons = R_AVKON_SOFTKEYS_OPTIONS_BACK; 
- buttons = R_AVKON_SOFTKEYS_OK_CANCEL; 
- items = 
- {
-  DLG_LINE 
-  {
-    type = EAknCtSingleGraphicListBox; 
-    id = ESelectionListControl;
-    control = LISTBOX
-    {
-      flags = EAknListBoxMultiselectionList;
-    };
-   }
- };
-}
-
-RESOURCE DIALOG r_appuifw_multi_sel_list_query 
-{
- flags = EAknListBoxMultiselectionList | EAknListBoxLoopScrolling;
- buttons = R_AVKON_SOFTKEYS_OK_CANCEL;
- items = 
- {
-  DLG_LINE 
-  {
-    type = EAknCtSingleGraphicListBox; 
-    id = ESelectionListControl;
-    control = LISTBOX
-    {
-      flags = EAknListBoxMultiselectionList;
-    };
-  }, 
-  DLG_LINE 
-  {
-     itemflags = EEikDlgItemNonFocusing;
-     id = EFindControl;
-     type = EAknCtSelectionListFixedFind; 
-  } 
- };
-}
-
-RESOURCE DIALOG r_appuifw_markable_sel_list 
-{
- flags = EAknDialogMarkableList | EAknListBoxLoopScrolling; //works with left select
- buttons = R_AVKON_SOFTKEYS_OK_CANCEL;
- items = 
- {
-  DLG_LINE 
-  {
-    type = EAknCtSingleListBox;
-    id = ESelectionListControl;
-    control = LISTBOX
-    {
-      flags = EAknListBoxMarkableList;
-    };
-   }
- };
-}
-
-RESOURCE DIALOG r_appuifw_markable_sel_list_query 
-{
- flags = EAknDialogMarkableList | EAknListBoxLoopScrolling; 
- buttons = R_AVKON_SOFTKEYS_OK_CANCEL;
- items = 
- {
-  DLG_LINE 
-  {
-    type = EAknCtSingleListBox;
-    id = ESelectionListControl;
-    control = LISTBOX
-    {
-      flags = EAknListBoxMarkableList;
-    };
-  }, 
-  DLG_LINE 
-  {
-     itemflags = EEikDlgItemNonFocusing;
-     id = EFindControl;
-     type = EAknCtSelectionListFixedFind; 
-  } 
- };
-}
-
-
-RESOURCE DIALOG r_appuifw_data_query
-{
-  flags = EGeneralQueryFlags;
-  buttons = R_AVKON_SOFTKEYS_OK_CANCEL;
-  items =
-  {
-    DLG_LINE
-    {
-      type = EAknCtQuery;
-      id = EGeneralQuery;
-      control = AVKON_DATA_QUERY
-      {
-	layout = EDataLayout;
-	label = "Enter text:";
-	control = EDWIN
-	{
-	  flags = EEikEdwinNoHorizScrolling | EEikEdwinResizable;
-	  width = 5;
-	  maxlength = 128;
-	  // added to limit expanding in forms. 
-	  // If you want full screen use 6 here
-	  max_view_height_in_lines = 5; 
-	  // if you have the line above, you must have this. 
-	  // It's calculable from LAF
-	  base_line_delta = 21; 
-	};
-      };
-    }
-  }; 
-}
-
-#define APPUIFW_NUMBER_EDITOR_MIN 0
-#define APPUIFW_NUMBER_EDITOR_MAX 0x7fffffff
-
-RESOURCE DIALOG r_appuifw_number_query
-{
-  flags = EGeneralQueryFlags;
-  buttons = R_AVKON_SOFTKEYS_OK_CANCEL;
-  items =
-  {
-    DLG_LINE
-    {
-      type = EAknCtQuery;
-      id = EGeneralQuery;
-      control= AVKON_DATA_QUERY
-      {
-        layout = ENumberLayout;
-        control = AVKON_INTEGER_EDWIN
-	      {
-	        min = APPUIFW_NUMBER_EDITOR_MIN;
-	        max = APPUIFW_NUMBER_EDITOR_MAX;
-	      };
-      };
-    }
-  };
-}
-
-RESOURCE DIALOG r_appuifw_float_query
-{
-  flags = EGeneralQueryFlags;
-  buttons = R_AVKON_SOFTKEYS_OK_CANCEL;
-  items =
-  {
-    DLG_LINE
-    {
-      type = EAknCtQuery;
-      id = EGeneralQuery;
-      control= AVKON_DATA_QUERY
-      {
-        layout = EFloatingPointLayout;
-        control = FLPTED
-	      {
-	        min = -9.9e99;
-	        max = 9.9e99;
-	        //default = 1; //not needed?
-        };
-      };
-    }
-  };
-}
-
-#define APPUIFW_SECRETED_NUM_LETTERS 8
-
-RESOURCE DIALOG r_appuifw_code_query
-{
-  flags = EGeneralQueryFlags;
-  buttons = R_AVKON_SOFTKEYS_OK_CANCEL;
-  items =
-  {
-    DLG_LINE
-    {
-      type = EAknCtQuery;
-      id = EGeneralQuery;
-      control = AVKON_DATA_QUERY
-      {
-	layout = ECodeLayout;
-	//	label = "Enter text:";
-	control = SECRETED
-	{
-	  num_letters = APPUIFW_SECRETED_NUM_LETTERS;
-	};
-      };
-    }
-  };
-}
-
-#define APPUIFW_TIME_EDITOR_MIN_SECOND 0
-#define APPUIFW_TIME_EDITOR_MIN_MINUTE 0
-#define APPUIFW_TIME_EDITOR_MIN_HOUR 0
-#define APPUIFW_TIME_EDITOR_MAX_SECOND 59
-#define APPUIFW_TIME_EDITOR_MAX_MINUTE 59
-#define APPUIFW_TIME_EDITOR_MAX_HOUR 23
-
-RESOURCE DIALOG r_appuifw_time_query
-{
-  flags = EGeneralQueryFlags;
-  buttons = R_AVKON_SOFTKEYS_OK_CANCEL;
-  items =
-  {
-    DLG_LINE
-    {
-      type = EAknCtQuery;
-      id = EGeneralQuery;
-      control= AVKON_DATA_QUERY
-      {
-	layout = ETimeLayout;
-	control = TIME_EDITOR
-	{
-	  minTime = TIME
-	  {
-	    second = APPUIFW_TIME_EDITOR_MIN_SECOND;
-	    minute = APPUIFW_TIME_EDITOR_MIN_MINUTE;
-	    hour = APPUIFW_TIME_EDITOR_MIN_HOUR;
-	  };
-	  maxTime = TIME
-	  {
-	    second = APPUIFW_TIME_EDITOR_MAX_SECOND;
-	    minute = APPUIFW_TIME_EDITOR_MAX_MINUTE;
-	    hour = APPUIFW_TIME_EDITOR_MAX_HOUR;
-	  };
-	  flags = EEikTimeWithoutSecondsField | EEikTimeForce24HourFormat;
-	};
-      };
-    }
-  };
-}
-
-#define APPUIFW_DATE_EDITOR_MIN_DATE 1900
-#define APPUIFW_DATE_EDITOR_MAX_DATE 2990
-#define APPUIFW_DATE_EDITOR_FLAGS 0
-
-RESOURCE DIALOG r_appuifw_date_query
-{
-  flags = EGeneralQueryFlags;
-  buttons = R_AVKON_SOFTKEYS_OK_CANCEL;
-  items =
-  {
-    DLG_LINE
-    {
-      type = EAknCtQuery;
-      id = EGeneralQuery;
-      control = AVKON_DATA_QUERY
-      {
-	layout = EDateLayout;
-	control = DATE_EDITOR
-	{
-	  minDate = DATE
-	  {
-	    year = APPUIFW_DATE_EDITOR_MIN_DATE;
-	  };
-	  maxDate = DATE
-	  {
-	    year = APPUIFW_DATE_EDITOR_MAX_DATE;
-	  };
-	  flags = APPUIFW_DATE_EDITOR_FLAGS;
-	};
-      };
-    }
-  };
-}
-
-RESOURCE DIALOG r_appuifw_confirmation_query	
-{	
-  flags = EGeneralQueryFlags;
-  buttons = R_AVKON_SOFTKEYS_OK_CANCEL;
-  items =
-  {
-    DLG_LINE
-    {
-      type = EAknCtQuery;
-      id = EGeneralQuery;
-      control =	AVKON_CONFIRMATION_QUERY
-      {
-	layout = EConfirmationQueryLayout;  //EDataLayout;
-      };
-    }
-  };
-}
-
-#define APPUIFW_EDWIN_WIDTH 5
-#define APPUIFW_EDWIN_LINES 5
-#define APPUIFW_EDWIN_MAXLENGTH KAppuifwMaxTextField
-
-RESOURCE DIALOG r_appuifw_multi_line_data
-{
-  flags = EGeneralQueryFlags;
-  buttons = R_AVKON_SOFTKEYS_OK_CANCEL;
-  items =
-  {
-    DLG_LINE
-    {
-      type = EAknCtMultilineQuery;
-      id = EMultilineFirstLine;
-      control = AVKON_DATA_QUERY
-      {
-	layout = EMultiDataFirstEdwin;
-	control = EDWIN
-	{
-	  flags = EEikEdwinNoHorizScrolling | EEikEdwinResizable;
-	  width = APPUIFW_EDWIN_WIDTH;
-	  lines = APPUIFW_EDWIN_LINES;
-	  maxlength = APPUIFW_EDWIN_MAXLENGTH;
-	};
-      };
-    },
-    DLG_LINE
-    {
-      type = EAknCtMultilineQuery;
-      id = EMultilineSecondLine;
-      control = AVKON_DATA_QUERY
-      {
-	layout = EMultiDataSecondEdwin;
-	control = EDWIN
-	{
-	  flags = EEikEdwinNoHorizScrolling | EEikEdwinResizable;
-	  width = APPUIFW_EDWIN_WIDTH;
-	  lines = APPUIFW_EDWIN_LINES;
-	  maxlength = APPUIFW_EDWIN_MAXLENGTH;
-	};
-      };
-    }
-  };
-}
-
-RESOURCE FORM r_appuifw_form_single_form
-{
-  flags = 0;
-}	
-
-RESOURCE FORM r_appuifw_form_single_edit_form
-{
-  flags = EEikFormEditModeOnly;
-}	
-
-RESOURCE FORM r_appuifw_form_double_form
-{
-  //  flags = EEikFormShowBitmaps | EEikFormUseDoubleSpacedFormat;
-  flags = EEikFormUseDoubleSpacedFormat;
-}	
-
-RESOURCE FORM r_appuifw_form_double_edit_form
-{
-  //  flags = EEikFormShowBitmaps | EEikFormUseDoubleSpacedFormat;
-  flags = EEikFormUseDoubleSpacedFormat | EEikFormEditModeOnly;
-}	
-
-RESOURCE DIALOG r_appuifw_form_single_dialog
-{
-  flags = EEikDialogFlagNoDrag | EEikDialogFlagNoTitleBar | 
-    EEikDialogFlagFillAppClientRect | EEikDialogFlagCbaButtons | 
-    EEikDialogFlagWait;
-  buttons = R_AVKON_SOFTKEYS_OPTIONS_BACK;
-  form = r_appuifw_form_single_form;
-}
-
-RESOURCE DIALOG r_appuifw_form_single_edit_dialog
-{
-  flags = EEikDialogFlagNoDrag | EEikDialogFlagNoTitleBar | 
-    EEikDialogFlagFillAppClientRect | EEikDialogFlagCbaButtons | 
-    EEikDialogFlagWait;
-  buttons = R_AVKON_SOFTKEYS_OPTIONS_BACK;
-  form = r_appuifw_form_single_edit_form;
-}
-
-RESOURCE DIALOG r_appuifw_form_double_dialog
-{
-  flags = EEikDialogFlagNoDrag | EEikDialogFlagNoTitleBar | 
-    EEikDialogFlagFillAppClientRect | EEikDialogFlagCbaButtons | 
-    EEikDialogFlagWait;
-  buttons = R_AVKON_SOFTKEYS_OPTIONS_BACK;
-  form = r_appuifw_form_double_form;
-}
-
-RESOURCE DIALOG r_appuifw_form_double_edit_dialog
-{
-  flags = EEikDialogFlagNoDrag | EEikDialogFlagNoTitleBar | 
-    EEikDialogFlagFillAppClientRect | EEikDialogFlagCbaButtons | 
-    EEikDialogFlagWait;
-  buttons = R_AVKON_SOFTKEYS_OPTIONS_BACK;
-  form = r_appuifw_form_double_edit_form;
-}
diff -urNp pys60_1_3_18_src_UNTOUCHED/appui/appuifw/appuifwmodule.rss.in pyuiq_CLEAN/appui/appuifw/appuifwmodule.rss.in
--- pys60_1_3_18_src_UNTOUCHED/appui/appuifw/appuifwmodule.rss.in	Thu Jan 01 02:00:00 1970
+++ pyuiq_CLEAN/appui/appuifw/appuifwmodule.rss.in	Mon May 14 15:39:36 2007
@@ -0,0 +1,569 @@
+/* Copyright (c) 2005 Nokia Corporation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+//
+// appuifwmodule.rss
+//
+// made independent from app's resource file
+//
+
+NAME AUFW
+
+#include <eikon.rh>
+#include <eikon.rsg>
+${{if PLATFORM=='S60'
+#include <avkon.hrh>
+
+#include <avkon.rh>
+#include <avkon.rsg>
+}}
+
+${{if PLATFORM=='UIQ'
+${{if S60_VERSION>=30
+#include <QikCommand.rh>
+#include <QikListBox.rh>
+#include <QikListBoxStandardLayouts.hrh>
+#include <QikStockControls.hrh>
+#include <qikon.rh>
+$else
+// XXX UIQ2.1
+}}
+}}
+
+#include "appuifwmodule.hrh"
+
+RESOURCE RSS_SIGNATURE { }
+
+${{if PLATFORM=='S60'
+RESOURCE DIALOG r_appuifw_sel_list
+{
+  flags = EAknDialogSelectionList;
+  buttons = R_AVKON_SOFTKEYS_OK_CANCEL;
+  items =
+  {
+    DLG_LINE
+    {
+      type = EAknCtSingleListBox;
+      id = ESelectionListControl;
+      control = LISTBOX
+      {
+	flags = EAknListBoxSelectionList;
+	//	array_id = r_list_box_array;
+      };
+    }
+  };
+}
+
+RESOURCE DIALOG r_appuifw_sel_list_query
+{
+  flags = EAknDialogSelectionList;
+  buttons = R_AVKON_SOFTKEYS_OK_CANCEL;
+  items =
+  {
+    DLG_LINE
+    {
+      type = EAknCtSingleListBox;
+      id = ESelectionListControl;
+      control = LISTBOX
+      {
+	flags = EAknListBoxSelectionList;
+	//	array_id = r_list_box_array;
+      };
+    }, 
+    DLG_LINE 
+    {
+      itemflags = EEikDlgItemNonFocusing;
+      id = EFindControl;
+      type = EAknCtSelectionListFixedFind; 
+    }
+  };
+}
+
+
+RESOURCE DIALOG r_appuifw_multi_sel_list 
+{
+ flags = EAknListBoxMultiselectionList | EAknListBoxLoopScrolling;
+// buttons = R_AVKON_SOFTKEYS_OPTIONS_BACK; 
+ buttons = R_AVKON_SOFTKEYS_OK_CANCEL; 
+ items = 
+ {
+  DLG_LINE 
+  {
+    type = EAknCtSingleGraphicListBox; 
+    id = ESelectionListControl;
+    control = LISTBOX
+    {
+      flags = EAknListBoxMultiselectionList;
+    };
+   }
+ };
+}
+
+RESOURCE DIALOG r_appuifw_multi_sel_list_query 
+{
+ flags = EAknListBoxMultiselectionList | EAknListBoxLoopScrolling;
+ buttons = R_AVKON_SOFTKEYS_OK_CANCEL;
+ items = 
+ {
+  DLG_LINE 
+  {
+    type = EAknCtSingleGraphicListBox; 
+    id = ESelectionListControl;
+    control = LISTBOX
+    {
+      flags = EAknListBoxMultiselectionList;
+    };
+  }, 
+  DLG_LINE 
+  {
+     itemflags = EEikDlgItemNonFocusing;
+     id = EFindControl;
+     type = EAknCtSelectionListFixedFind; 
+  } 
+ };
+}
+
+RESOURCE DIALOG r_appuifw_markable_sel_list 
+{
+ flags = EAknDialogMarkableList | EAknListBoxLoopScrolling; //works with left select
+ buttons = R_AVKON_SOFTKEYS_OK_CANCEL;
+ items = 
+ {
+  DLG_LINE 
+  {
+    type = EAknCtSingleListBox;
+    id = ESelectionListControl;
+    control = LISTBOX
+    {
+      flags = EAknListBoxMarkableList;
+    };
+   }
+ };
+}
+
+RESOURCE DIALOG r_appuifw_markable_sel_list_query 
+{
+ flags = EAknDialogMarkableList | EAknListBoxLoopScrolling; 
+ buttons = R_AVKON_SOFTKEYS_OK_CANCEL;
+ items = 
+ {
+  DLG_LINE 
+  {
+    type = EAknCtSingleListBox;
+    id = ESelectionListControl;
+    control = LISTBOX
+    {
+      flags = EAknListBoxMarkableList;
+    };
+  }, 
+  DLG_LINE 
+  {
+     itemflags = EEikDlgItemNonFocusing;
+     id = EFindControl;
+     type = EAknCtSelectionListFixedFind; 
+  } 
+ };
+}
+
+
+RESOURCE DIALOG r_appuifw_data_query
+{
+  flags = EGeneralQueryFlags;
+  buttons = R_AVKON_SOFTKEYS_OK_CANCEL;
+  items =
+  {
+    DLG_LINE
+    {
+      type = EAknCtQuery;
+      id = EGeneralQuery;
+      control = AVKON_DATA_QUERY
+      {
+	layout = EDataLayout;
+	label = "Enter text:";
+	control = EDWIN
+	{
+	  flags = EEikEdwinNoHorizScrolling | EEikEdwinResizable;
+	  width = 5;
+	  maxlength = 128;
+	  // added to limit expanding in forms. 
+	  // If you want full screen use 6 here
+	  max_view_height_in_lines = 5; 
+	  // if you have the line above, you must have this. 
+	  // It's calculable from LAF
+	  base_line_delta = 21; 
+	};
+      };
+    }
+  }; 
+}
+
+#define APPUIFW_NUMBER_EDITOR_MIN 0
+#define APPUIFW_NUMBER_EDITOR_MAX 0x7fffffff
+
+RESOURCE DIALOG r_appuifw_number_query
+{
+  flags = EGeneralQueryFlags;
+  buttons = R_AVKON_SOFTKEYS_OK_CANCEL;
+  items =
+  {
+    DLG_LINE
+    {
+      type = EAknCtQuery;
+      id = EGeneralQuery;
+      control= AVKON_DATA_QUERY
+      {
+        layout = ENumberLayout;
+        control = AVKON_INTEGER_EDWIN
+	      {
+	        min = APPUIFW_NUMBER_EDITOR_MIN;
+	        max = APPUIFW_NUMBER_EDITOR_MAX;
+	      };
+      };
+    }
+  };
+}
+
+RESOURCE DIALOG r_appuifw_float_query
+{
+  flags = EGeneralQueryFlags;
+  buttons = R_AVKON_SOFTKEYS_OK_CANCEL;
+  items =
+  {
+    DLG_LINE
+    {
+      type = EAknCtQuery;
+      id = EGeneralQuery;
+      control= AVKON_DATA_QUERY
+      {
+        layout = EFloatingPointLayout;
+        control = FLPTED
+	      {
+	        min = -9.9e99;
+	        max = 9.9e99;
+	        //default = 1; //not needed?
+        };
+      };
+    }
+  };
+}
+
+#define APPUIFW_SECRETED_NUM_LETTERS 8
+
+RESOURCE DIALOG r_appuifw_code_query
+{
+  flags = EGeneralQueryFlags;
+  buttons = R_AVKON_SOFTKEYS_OK_CANCEL;
+  items =
+  {
+    DLG_LINE
+    {
+      type = EAknCtQuery;
+      id = EGeneralQuery;
+      control = AVKON_DATA_QUERY
+      {
+	layout = ECodeLayout;
+	//	label = "Enter text:";
+	control = SECRETED
+	{
+	  num_letters = APPUIFW_SECRETED_NUM_LETTERS;
+	};
+      };
+    }
+  };
+}
+
+#define APPUIFW_TIME_EDITOR_MIN_SECOND 0
+#define APPUIFW_TIME_EDITOR_MIN_MINUTE 0
+#define APPUIFW_TIME_EDITOR_MIN_HOUR 0
+#define APPUIFW_TIME_EDITOR_MAX_SECOND 59
+#define APPUIFW_TIME_EDITOR_MAX_MINUTE 59
+#define APPUIFW_TIME_EDITOR_MAX_HOUR 23
+
+RESOURCE DIALOG r_appuifw_time_query
+{
+  flags = EGeneralQueryFlags;
+  buttons = R_AVKON_SOFTKEYS_OK_CANCEL;
+  items =
+  {
+    DLG_LINE
+    {
+      type = EAknCtQuery;
+      id = EGeneralQuery;
+      control= AVKON_DATA_QUERY
+      {
+	layout = ETimeLayout;
+	control = TIME_EDITOR
+	{
+	  minTime = TIME
+	  {
+	    second = APPUIFW_TIME_EDITOR_MIN_SECOND;
+	    minute = APPUIFW_TIME_EDITOR_MIN_MINUTE;
+	    hour = APPUIFW_TIME_EDITOR_MIN_HOUR;
+	  };
+	  maxTime = TIME
+	  {
+	    second = APPUIFW_TIME_EDITOR_MAX_SECOND;
+	    minute = APPUIFW_TIME_EDITOR_MAX_MINUTE;
+	    hour = APPUIFW_TIME_EDITOR_MAX_HOUR;
+	  };
+	  flags = EEikTimeWithoutSecondsField | EEikTimeForce24HourFormat;
+	};
+      };
+    }
+  };
+}
+
+#define APPUIFW_DATE_EDITOR_MIN_DATE 1900
+#define APPUIFW_DATE_EDITOR_MAX_DATE 2990
+#define APPUIFW_DATE_EDITOR_FLAGS 0
+
+RESOURCE DIALOG r_appuifw_date_query
+{
+  flags = EGeneralQueryFlags;
+  buttons = R_AVKON_SOFTKEYS_OK_CANCEL;
+  items =
+  {
+    DLG_LINE
+    {
+      type = EAknCtQuery;
+      id = EGeneralQuery;
+      control = AVKON_DATA_QUERY
+      {
+	layout = EDateLayout;
+	control = DATE_EDITOR
+	{
+	  minDate = DATE
+	  {
+	    year = APPUIFW_DATE_EDITOR_MIN_DATE;
+	  };
+	  maxDate = DATE
+	  {
+	    year = APPUIFW_DATE_EDITOR_MAX_DATE;
+	  };
+	  flags = APPUIFW_DATE_EDITOR_FLAGS;
+	};
+      };
+    }
+  };
+}
+
+RESOURCE DIALOG r_appuifw_confirmation_query	
+{	
+  flags = EGeneralQueryFlags;
+  buttons = R_AVKON_SOFTKEYS_OK_CANCEL;
+  items =
+  {
+    DLG_LINE
+    {
+      type = EAknCtQuery;
+      id = EGeneralQuery;
+      control =	AVKON_CONFIRMATION_QUERY
+      {
+	layout = EConfirmationQueryLayout;  //EDataLayout;
+      };
+    }
+  };
+}
+
+#define APPUIFW_EDWIN_WIDTH 5
+#define APPUIFW_EDWIN_LINES 5
+#define APPUIFW_EDWIN_MAXLENGTH KAppuifwMaxTextField
+
+RESOURCE DIALOG r_appuifw_multi_line_data
+{
+  flags = EGeneralQueryFlags;
+  buttons = R_AVKON_SOFTKEYS_OK_CANCEL;
+  items =
+  {
+    DLG_LINE
+    {
+      type = EAknCtMultilineQuery;
+      id = EMultilineFirstLine;
+      control = AVKON_DATA_QUERY
+      {
+	layout = EMultiDataFirstEdwin;
+	control = EDWIN
+	{
+	  flags = EEikEdwinNoHorizScrolling | EEikEdwinResizable;
+	  width = APPUIFW_EDWIN_WIDTH;
+	  lines = APPUIFW_EDWIN_LINES;
+	  maxlength = APPUIFW_EDWIN_MAXLENGTH;
+	};
+      };
+    },
+    DLG_LINE
+    {
+      type = EAknCtMultilineQuery;
+      id = EMultilineSecondLine;
+      control = AVKON_DATA_QUERY
+      {
+	layout = EMultiDataSecondEdwin;
+	control = EDWIN
+	{
+	  flags = EEikEdwinNoHorizScrolling | EEikEdwinResizable;
+	  width = APPUIFW_EDWIN_WIDTH;
+	  lines = APPUIFW_EDWIN_LINES;
+	  maxlength = APPUIFW_EDWIN_MAXLENGTH;
+	};
+      };
+    }
+  };
+}
+
+RESOURCE FORM r_appuifw_form_single_form
+{
+  flags = 0;
+}	
+
+RESOURCE FORM r_appuifw_form_single_edit_form
+{
+  flags = EEikFormEditModeOnly;
+}	
+
+RESOURCE FORM r_appuifw_form_double_form
+{
+  //  flags = EEikFormShowBitmaps | EEikFormUseDoubleSpacedFormat;
+  flags = EEikFormUseDoubleSpacedFormat;
+}	
+
+RESOURCE FORM r_appuifw_form_double_edit_form
+{
+  //  flags = EEikFormShowBitmaps | EEikFormUseDoubleSpacedFormat;
+  flags = EEikFormUseDoubleSpacedFormat | EEikFormEditModeOnly;
+}	
+
+RESOURCE DIALOG r_appuifw_form_single_dialog
+{
+  flags = EEikDialogFlagNoDrag | EEikDialogFlagNoTitleBar | 
+    EEikDialogFlagFillAppClientRect | EEikDialogFlagCbaButtons | 
+    EEikDialogFlagWait;
+  buttons = R_AVKON_SOFTKEYS_OPTIONS_BACK;
+  form = r_appuifw_form_single_form;
+}
+
+RESOURCE DIALOG r_appuifw_form_single_edit_dialog
+{
+  flags = EEikDialogFlagNoDrag | EEikDialogFlagNoTitleBar | 
+    EEikDialogFlagFillAppClientRect | EEikDialogFlagCbaButtons | 
+    EEikDialogFlagWait;
+  buttons = R_AVKON_SOFTKEYS_OPTIONS_BACK;
+  form = r_appuifw_form_single_edit_form;
+}
+
+RESOURCE DIALOG r_appuifw_form_double_dialog
+{
+  flags = EEikDialogFlagNoDrag | EEikDialogFlagNoTitleBar | 
+    EEikDialogFlagFillAppClientRect | EEikDialogFlagCbaButtons | 
+    EEikDialogFlagWait;
+  buttons = R_AVKON_SOFTKEYS_OPTIONS_BACK;
+  form = r_appuifw_form_double_form;
+}
+
+RESOURCE DIALOG r_appuifw_form_double_edit_dialog
+{
+  flags = EEikDialogFlagNoDrag | EEikDialogFlagNoTitleBar | 
+    EEikDialogFlagFillAppClientRect | EEikDialogFlagCbaButtons | 
+    EEikDialogFlagWait;
+  buttons = R_AVKON_SOFTKEYS_OPTIONS_BACK;
+  form = r_appuifw_form_double_edit_form;
+}
+}}
+
+${{if PLATFORM=='UIQ'
+${{if S60_VERSION>=30
+RESOURCE QIK_VIEW_CONFIGURATIONS r_pyuiq_listbox_ui_configurations
+    {
+     configurations =
+        {
+        QIK_VIEW_CONFIGURATION
+            {
+            ui_config_mode = KQikPenStyleTouchPortrait;
+            command_list = r_pyuiq_listbox_commands;
+            view = r_pyuiq_listbox_layout;
+            }
+        };
+    }
+
+RESOURCE QIK_VIEW r_pyuiq_listbox_layout
+    {
+    pages = r_pyuiq_listbox_layout_pages;
+    }
+
+RESOURCE QIK_VIEW_PAGES r_pyuiq_listbox_layout_pages
+    {
+    pages = 
+        {
+        QIK_VIEW_PAGE
+            {
+            page_id = EPyUIQListBox;
+            page_content = r_pyuiq_listbox_page_control;
+            }
+        };
+    }
+
+RESOURCE QIK_CONTAINER_SETTINGS r_pyuiq_listbox_page_control
+    {
+    // Manager is needed since we want to fill the whole screen,
+    // otherwise it could be omitted
+    layout_manager_type = EQikRowLayoutManager;
+    layout_manager = r_row_layout_default;
+    controls = 
+        {
+        QIK_CONTAINER_ITEM_CI_LI
+            { 
+            unique_handle = EPyUIQListBoxCtrl;
+            type = EQikCtListBox; 
+            control = r_pyuiq_listbox_listbox;
+            layout_data = r_row_layout_data_fill;
+            }
+        };
+    }
+
+RESOURCE QIK_LISTBOX r_pyuiq_listbox_listbox
+    {
+    layouts = {r_pyuiq_listbox_normal_layout_pair};
+    }
+
+RESOURCE QIK_LISTBOX_LAYOUT_PAIR r_pyuiq_listbox_normal_layout_pair
+    {
+    standard_normal_layout = EQikListBoxLine;
+    }
+
+RESOURCE QIK_COMMAND_LIST r_pyuiq_listbox_commands
+    {
+    items =
+        {
+        QIK_COMMAND
+            {
+            id      = EPyUIQListBoxDoneCmd;
+            type    = EQikCommandTypeDone;
+            text    = "Done";
+            }
+        };
+    }
+
+RESOURCE QIK_ROW_LAYOUT_MANAGER r_row_layout_default
+    {
+    default_layout_data = QIK_ROW_LAYOUT_DATA{};
+    }
+    
+RESOURCE QIK_ROW_LAYOUT_DATA r_row_layout_data_fill
+    {
+    vertical_alignment = EQikLayoutVAlignFill;
+    vertical_excess_grab_weight = 1;
+    }
+$else
+// XXX UIQ2.1
+}}
+}}
diff -urNp pys60_1_3_18_src_UNTOUCHED/bld.inf.in pyuiq_CLEAN/bld.inf.in
--- pys60_1_3_18_src_UNTOUCHED/bld.inf.in	Thu Nov 16 15:52:02 2006
+++ pyuiq_CLEAN/bld.inf.in	Tue Mar 06 17:55:44 2007
@@ -6,11 +6,15 @@ ${{if S60_VERSION>=30
 core\core.mmp
 app\app.mmp
 appui\appui.mmp
+${{if WITH_SVG_LOGO
 gnumakefile app\icons_aif.mk
+}}
 exe\python_launcher.mmp
 ext\calendar\calendar.mmp
 ext\camera\camera.mmp
+${{if WITH_CONTACTS_MODULE
 ext\contacts\contacts.mmp
+}}
 ext\e32db\e32db.mmp
 ext\graphics\graphics.mmp
 ext\inbox\inbox.mmp
@@ -25,7 +29,9 @@ ext\messaging\messaging.mmp
 }}
 ext\recorder\recorder.mmp
 ext\socket\e32socket.mmp
+${{if WITH_SYSINFO_MODULE
 ext\sysinfo\sysinfo.mmp
+}}
 ext\telephone\telephone.mmp
 ext\topwindow\topwindow.mmp
 ext\zlib\zlibmodule.mmp
@@ -42,9 +48,13 @@ appmgr\appmgr.mmp
 exe\python_launcher.mmp
 ext\calendar\calendar.mmp
 ${{if S60_VERSION>12
+${{if WITH_CAMERA_MODULE
 ext\camera\camera.mmp
 }}
+}}
+${{if WITH_CONTACTS_MODULE
 ext\contacts\contacts.mmp
+}}
 ext\e32db\e32db.mmp
 ext\graphics\graphics.mmp
 ext\inbox\inbox.mmp
@@ -55,9 +65,13 @@ ext\location\location.mmp
 ${{if WITH_MESSAGING_MODULE
 ext\messaging\messaging.mmp
 }}
+${{if WITH_AUDIO_MODULE
 ext\recorder\recorder.mmp
+}}
 ext\socket\e32socket.mmp
+${{if WITH_SYSINFO_MODULE
 ext\sysinfo\sysinfo.mmp
+}}
 ext\telephone\telephone.mmp
 ext\topwindow\topwindow.mmp
 ext\zlib\zlibmodule.mmp
diff -urNp pys60_1_3_18_src_UNTOUCHED/changes_UIQ.txt pyuiq_CLEAN/changes_UIQ.txt
--- pys60_1_3_18_src_UNTOUCHED/changes_UIQ.txt	Thu Jan 01 02:00:00 1970
+++ pyuiq_CLEAN/changes_UIQ.txt	Wed Mar 07 15:06:32 2007
@@ -0,0 +1,10 @@
+A brief summary of changes made to Python for S60 are as follows:
+
+- Adding more options to the "setup.py" build script
+
+- Taking away S60 specific functionality (e.g. access point selection in socket, 
+hence returning to previous version of socket)
+
+- Changing the S60 apparc classes to the ones used in UIQ (CQik*), folder 
+"appui" for UIQ3 - The UIQ21 uses the CEik* derived classes
+
diff -urNp pys60_1_3_18_src_UNTOUCHED/core/Lib/site.py pyuiq_CLEAN/core/Lib/site.py
--- pys60_1_3_18_src_UNTOUCHED/core/Lib/site.py	Thu Dec 28 15:42:48 2006
+++ pyuiq_CLEAN/core/Lib/site.py	Fri Apr 20 10:02:00 2007
@@ -84,23 +84,34 @@ if __name__ == '__main__':
     _test()
 
 # Set a special import hook for loading native code if running under
-# S60 3rd edition.
+# S60 3rd edition. Seems like the only way to test for the existence
+# of a .pyd in 3rd ed is to try to load it.
 import e32
 if e32.s60_version_info>=(3,0):
     import imp
     _original_import=__builtin__.__import__
     def platsec_import(name, globals=None, locals=None, fromlist=None):
+        name=str(name)
         try:
+            # First try importing the given module as Python code.
             return _original_import(name, globals, locals, fromlist)
-        except ImportError:
-            # can't import with normal methods, try importing as native code
+        except ImportError, e:
+            # Couldn't import the module. Check that it was really the
+            # top level import that failed and not a nested import.
+            error_message=e.args[0]
+            if error_message != 'No module named '+name:            
+                raise # The top level module was found - this ImportError
+                      # is from a nested import. Pass the exception
+                      # through.
+            # Couldn't find a Python module with that name. Try importing
+            # as native code.
             try:
                 return imp.load_dynamic(name, name+'.pyd')
             except SymbianError, e:
-                if e[0]==-1:
-                    # Convert only KErrNotFound into this form, pass others through
-                    # to make sure developer sees any other errors.
-                    raise ImportError("No module named "+name+" found.")
-                else:
-                    raise
+                if e[0]==-1: # KErrNotFound
+                    raise ImportError("No module named "+name)
+                if e[0]==-46: # KErrPermissionDenied
+                    raise ImportError("Permission denied (error -46). Possible cause: Check that %s.pyd is compiled to have at least the same capabilities as this Python interpreter process."%name)
+                # Pass other exceptions through.
+                raise
     __builtin__.__import__=platsec_import
diff -urNp pys60_1_3_18_src_UNTOUCHED/core/Symbian/sdkversion.h.in pyuiq_CLEAN/core/Symbian/sdkversion.h.in
--- pys60_1_3_18_src_UNTOUCHED/core/Symbian/sdkversion.h.in	Wed Feb 08 09:09:00 2006
+++ pyuiq_CLEAN/core/Symbian/sdkversion.h.in	Tue Feb 27 12:40:15 2007
@@ -23,5 +23,12 @@
 #define PYS60_VERSION_SERIAL ${{PYS60_VERSION_SERIAL}}
 #define SERIES60_VERSION ${{S60_VERSION}}
 #define S60_VERSION ${{S60_VERSION}}
-
+${{if SDK_NAME=='UIQ 21'
+#define UIQ
+#define UIQ21
+}}
+${{if SDK_NAME=='UIQ 30'
+#define UIQ
+#define UIQ30
+}}
 #endif /* __SDKVERSION_H */
diff -urNp pys60_1_3_18_src_UNTOUCHED/ext/bld.inf.in pyuiq_CLEAN/ext/bld.inf.in
--- pys60_1_3_18_src_UNTOUCHED/ext/bld.inf.in	Thu Nov 16 16:09:48 2006
+++ pyuiq_CLEAN/ext/bld.inf.in	Tue Mar 06 17:56:01 2007
@@ -1,10 +1,14 @@
 #include "socket\bld.inf"
 #include "graphics\bld.inf"
 ${{if S60_VERSION>12
+${{if WITH_CAMERA_MODULE
 #include "camera\bld.inf"
 }}
+}}
 #include "calendar\bld.inf"
+${{if WITH_CONTACTS_MODULE
 #include "contacts\bld.inf"
+}}
 #include "e32db\bld.inf"
 #include "inbox\bld.inf"
 #include "keycapture\bld.inf"
@@ -15,8 +19,12 @@ ${{if WITH_LOCATION_MODULE
 ${{if WITH_MESSAGING_MODULE
 #include "messaging\bld.inf"
 }}
+${{if WITH_AUDIO_MODULE
 #include "recorder\bld.inf"
+}}
+${{if WITH_SYSINFO_MODULE
 #include "sysinfo\bld.inf"
+}}
 #include "telephone\bld.inf"
 #include "zlib\bld.inf"
 ${{if S60_VERSION>=26
diff -urNp pys60_1_3_18_src_UNTOUCHED/ext/glcanvas/glcanvas.h pyuiq_CLEAN/ext/glcanvas/glcanvas.h
--- pys60_1_3_18_src_UNTOUCHED/ext/glcanvas/glcanvas.h	Wed Aug 30 13:37:28 2006
+++ pyuiq_CLEAN/ext/glcanvas/glcanvas.h	Tue Mar 06 12:06:31 2007
@@ -27,7 +27,9 @@
 #include <GLES/gl.h>
 #include <GLES/egl.h>
 #include "coecntrl.h"
+#ifndef UIQ
 #include <aknappui.h> 
+#endif
 #include "CAppuifwEventBindingArray.h"
 #include "Python_appui.h"
 
diff -urNp pys60_1_3_18_src_UNTOUCHED/ext/glcanvas/glcanvas.mmp.in pyuiq_CLEAN/ext/glcanvas/glcanvas.mmp.in
--- pys60_1_3_18_src_UNTOUCHED/ext/glcanvas/glcanvas.mmp.in	Mon Jan 22 16:20:00 2007
+++ pyuiq_CLEAN/ext/glcanvas/glcanvas.mmp.in	Tue Mar 06 12:07:46 2007
@@ -43,8 +43,10 @@ LIBRARY eikcore.lib
 LIBRARY cone.lib
 LIBRARY etext.lib
 LIBRARY msgs.lib
+${{if PLATFORM=='S60'
 ${{if S60_VERSION>12
 LIBRARY platformenv.lib
+}}
 }}
 LIBRARY estlib.lib
 LIBRARY libgles_cm.lib
diff -urNp pys60_1_3_18_src_UNTOUCHED/ext/gles/bld.inf pyuiq_CLEAN/ext/gles/bld.inf
--- pys60_1_3_18_src_UNTOUCHED/ext/gles/bld.inf	Wed Aug 30 13:37:28 2006
+++ pyuiq_CLEAN/ext/gles/bld.inf	Wed Mar 07 11:32:02 2007
@@ -1,4 +1,4 @@
 PRJ_PLATFORMS 
-DEFAULT -ARM4 -THUMB
+
 PRJ_MMPFILES 
 gles.mmp 
diff -urNp pys60_1_3_18_src_UNTOUCHED/ext/gles/gles.mmp.in pyuiq_CLEAN/ext/gles/gles.mmp.in
--- pys60_1_3_18_src_UNTOUCHED/ext/gles/gles.mmp.in	Mon Jan 22 16:20:18 2007
+++ pyuiq_CLEAN/ext/gles/gles.mmp.in	Tue Mar 06 12:08:45 2007
@@ -38,8 +38,10 @@ LIBRARY eikcore.lib
 LIBRARY cone.lib
 LIBRARY etext.lib
 LIBRARY msgs.lib
+${{if PLATFORM=='S60'
 ${{if S60_VERSION>12
 LIBRARY platformenv.lib
+}}
 }}
 LIBRARY fbscli.lib
 LIBRARY estlib.lib
diff -urNp pys60_1_3_18_src_UNTOUCHED/ext/graphics/graphics.mmp.in pyuiq_CLEAN/ext/graphics/graphics.mmp.in
--- pys60_1_3_18_src_UNTOUCHED/ext/graphics/graphics.mmp.in	Thu Oct 05 18:26:12 2006
+++ pyuiq_CLEAN/ext/graphics/graphics.mmp.in	Mon May 07 13:59:52 2007
@@ -22,12 +22,16 @@ CAPABILITY ${{DLL_CAPABILITIES}}
 
 NOSTRICTDEF
 DEFFILE		graphics.frz
+
 ${{if S60_VERSION>12
 MACRO 	HAVE_ACTIVESCHEDULERWAIT
+${{if SDK_NAME=='UIQ 30'
 OPTION 	CW -w nounusedarg
 LIBRARY ImageConversion.lib
 LIBRARY bitmaptransforms.lib
 }}
+LIBRARY egul.lib
+}}
 
 systeminclude \epoc32\include
 systeminclude \epoc32\include\libc
@@ -49,7 +53,9 @@ LIBRARY estlib.lib
 LIBRARY eikcore.lib
 LIBRARY ws32.lib
 #ifdef EKA2
+${{if PLATFORM=='S60'
 LIBRARY aknicon.lib 
+}}
 #endif
 
 SOURCE		graphicsmodule.cpp
diff -urNp pys60_1_3_18_src_UNTOUCHED/ext/graphics/graphicsmodule.cpp pyuiq_CLEAN/ext/graphics/graphicsmodule.cpp
--- pys60_1_3_18_src_UNTOUCHED/ext/graphics/graphicsmodule.cpp	Thu Oct 05 18:25:42 2006
+++ pyuiq_CLEAN/ext/graphics/graphicsmodule.cpp	Mon May 07 10:22:48 2007
@@ -20,10 +20,11 @@
 #include "Python.h"
 #include "symbian_python_ext_util.h"
 
+#ifdef UIQ30
 #if SERIES60_VERSION > 12
 #define ICL_SUPPORT
 #endif
-
+#endif /* UIQ30 */
 #include <e32std.h>
 #include <w32std.h>
 
@@ -32,12 +33,14 @@
 #include <s32mem.h>
 #include <apmstd.h>
 #include <apparc.h>
+#ifndef UIQ
 #include <aknenv.h>
 #include <aknappui.h>
 #include <aknapp.h>
 #include <eikon.hrh>          // Form
 #include <avkon.hrh>
 #include <avkon.rsg>
+#endif /* UIQ */
 #include <eikedwin.h>         // Form
 #include <eikcapc.h>          // Form
 #include <txtfrmat.h>         // Text
@@ -46,6 +49,7 @@
 #include <eikrted.h>	      // RText
 #include <txtrich.h>
 #include <gdi.h>	      // RText
+#ifndef UIQ
 #include <aknlists.h>
 #include <aknselectionlist.h>
 #include <aknquerydialog.h>
@@ -54,6 +58,7 @@
 #include <aknPopup.h>
 #include <AknForm.h>
 #include <documenthandler.h>
+#endif
 
 
 #ifdef ICL_SUPPORT
@@ -64,11 +69,11 @@
 #include "colorspec.cpp"
 
 //#include <ImageCodecData.h>
-
+#ifndef UIQ
 #ifdef EKA2
 #include <akniconutils.h> 
 #endif
-
+#endif
 
 #define PY_RETURN_NONE do {			\
     Py_INCREF(Py_None);				\
@@ -615,7 +620,7 @@ graphics_ImageFromCFbsBitmap(PyObject* /
   return (PyObject*)obj;
 }
 
-
+#ifndef UIQ
 #ifdef EKA2
 /* Create an ImageObject from an Icon file. */
 extern "C" PyObject *
@@ -658,6 +663,7 @@ graphics_ImageFromIcon(PyObject* /*self*
   return (PyObject*)obj;  
 }
 #endif
+#endif /* UIQ */
 
 
 extern "C" PyObject *
@@ -1512,7 +1518,8 @@ Draw_clear(Draw_object *self, PyObject *
 #define FAILSYMBIAN(phase) do { ret=SPyErr_SetFromSymbianOSErr(error); goto fail##phase; } while(0)
 #define FAILSYMBIAN_IFERROR(phase) do { if (error != KErrNone) FAILSYMBIAN(phase); } while (0)
 
-_LIT(KDefaultFont,"LatinBold12");
+//_LIT(KDefaultFont,"LatinBold12");
+_LIT(KDefaultFont,"normal");
 
 extern "C" PyObject*
 Draw_text(Draw_object *self, PyObject *args, PyObject *keywds)
@@ -1521,106 +1528,305 @@ Draw_text(Draw_object *self, PyObject *a
   int length,i;
   char* buf;
   CBitmapContext *gc=self->gc;
-  CBitmapDevice *device=STATIC_CAST(CBitmapDevice *,self->gc->Device());  
 
   PyObject *fill_obj=NULL;
   TRgb fill_color(0,0,0);
+
   PyObject *coordseq_obj=NULL;
   PyObject *new_font_name_obj=NULL;
-  int n_coords;
   
-  static const char *const kwlist[] = {"coords", "text", "fill", "font", NULL};
-  if (!PyArg_ParseTupleAndKeywords(args, keywds, "Ou#|OO", (char**)kwlist,
+    int n_coords;
+    int heightInPixels = -1;
+    int isbold         = -1;// False
+    int isitalic       = -1;// False
+    int do_getwidth    = 0; // False. If True, returns the width of the given text in pixels
+    int dodraw         = 1; // True. If False, does not draw the text. 
+                            // Usable with do_getwidth if one wants to measure width before drawing.
+    float zoom         = 1.0;
+    int bitmaptype     = -1;
+    int twips          = -1;
+    int maxwidth       = 0; // If > 0, return amount of remaining characters after 
+                            // the maximum width of the given text. 
+                            // do_getwidth is used if both are given.
+                            
+    static const char *const kwlist[] = {"coords", "text", "fill", "font", 
+                                         "size", "bold", "italic", "zoom", 
+                                         "bitmaptype", "twips", "getwidth", 
+                                         "dodraw", "maxwidth", NULL};
+    if (!PyArg_ParseTupleAndKeywords(args, keywds, "Ou#|OOiiifiiiii", (char**)kwlist,
 				   &coordseq_obj,
 				   &buf,&length,
 				   &fill_obj,
-				   &new_font_name_obj) ||
+           &new_font_name_obj,
+           &heightInPixels ,
+           &isbold,
+           &isitalic,
+           &zoom,
+           &bitmaptype,
+           &twips,
+           &do_getwidth,
+           &dodraw,
+           &maxwidth)     ||
       !PyCoordSeq_Length(coordseq_obj, &n_coords) ||
       (fill_obj && !ColorSpec_AsRgb(fill_obj,&fill_color))) 
+    {
+        return NULL;
+    }
+
+    if( zoom < 0.0 )
+    {
+        PyErr_SetString(PyExc_ValueError, "Error: zoom must be x >= 0.0");
     return NULL;
+    }
 
-  //const CFont *font=device->GetNearestFontInPixels(
-  //   TPoint loc(x,y);
-  //   gc->SetPenColor(TRgb(r,g,b));
-  //   gc->SetPenStyle(CGraphicsContext::ESolidPen);
-  //   TFontSpec fontSpec(KtxtRoman,10);
-  //   CFont *font=NULL;
-  //   error=device->GetNearestFontInPixels(font,fontSpec);
+    if( twips != -1 )
+    {
+        if( twips < 0 )
+        {
+            PyErr_SetString(PyExc_ValueError, "Error: twips must be x >= 0");
+            return NULL;
+        }
+    }
+
+    if( bitmaptype    != -1
+        && bitmaptype != EDefaultGlyphBitmap        //0
+        && bitmaptype != EMonochromeGlyphBitmap     //1
+        && bitmaptype != EAntiAliasedGlyphBitmap)   //2
+    {
+        PyErr_SetString(PyExc_ValueError, "Error: Bitmap value must be 0 - 2");
+        return NULL;
+    }
   
   if (new_font_name_obj == Py_None) 
     new_font_name_obj=NULL;
 
-  if (self->font_set && 
-      ((!self->font_name && !new_font_name_obj)|| 
-       (self->font_name && new_font_name_obj && 
-	0 == PyObject_Compare(self->font_name, new_font_name_obj)))) {
-    /* If font has been set before, and either old font name and new font name are NULL's or
-       they are both non-NULL and the same, do nothing. */
-  } else {
-    if (new_font_name_obj == NULL || PyUnicode_Check(new_font_name_obj)) { 
+    TFontSpec fontSpec;
       CFont *font=NULL;
+
+	// REMOVED 'they are both non-NULL and the same do nothing'
+    // The name can be the same but other settings may differ
+    if ( self->font_set && ( !self->font_name && !new_font_name_obj ) )
+    {
+        /* If font has been set before, and either old font name and new font name are NULL's do nothing. */
+    }
+    else
+    {
+        // Name of the font given
+        if (new_font_name_obj == NULL || PyUnicode_Check(new_font_name_obj))
+        {
       TPtrC new_font_name_descr(KDefaultFont);
-      if (new_font_name_obj) {  
+            if (new_font_name_obj)
+                {
 	new_font_name_descr.Set((TUint16*)PyUnicode_AsUnicode(new_font_name_obj), 
 		      PyUnicode_GetSize(new_font_name_obj));
       }
-      TFontSpec fontSpec=TFontSpec(new_font_name_descr, 0); 
-      error=device->GetNearestFontInPixels(font,fontSpec);
-      if (error != KErrNone) 
-	goto invalid_font_spec;
-      gc->UseFont(font);  
-    } else if (PyString_Check(new_font_name_obj)) {
-      const CFont *font=NULL;
+
+            // Get default height
+#if !defined EKA2 || defined UIQ
+            const CFont* logicalFont = CEikonEnv::Static()->NormalFont();
+#else
+            const CFont* logicalFont = AknLayoutUtils::FontFromId( EAknLogicalFontPrimaryFont);
+#endif
+            TFontSpec defaultSpec    = logicalFont->FontSpecInTwips();
+
+            // Get new fontspec
+            fontSpec    = TFontSpec(new_font_name_descr, defaultSpec.iHeight);
+
+        }
+        // Using default styles
+        else if (PyString_Check(new_font_name_obj))
+        {
+            const CFont *logicalFont = NULL;
       CEikonEnv *env=CEikonEnv::Static();
-      if (!env) {
+
+            if (!env)
+            {
 	PyErr_SetString(PyExc_ValueError, 
 			"Sorry, but UI font labels ('normal', 'title'...) are not available in background processes."
 			"You need to specify the exact Unicode font name.");
 	return NULL;
       }  
+
       char *new_font_name_str=PyString_AsString(new_font_name_obj);
       if      (!strcmp(new_font_name_str,"normal"))
-	font = env->NormalFont();
+            {
+#if !defined EKA2 || defined UIQ
+                logicalFont = env->NormalFont();
+#else
+                
+                logicalFont = AknLayoutUtils::FontFromId( EAknLogicalFontPrimaryFont, NULL );
+#endif
+            }
       else if (!strcmp(new_font_name_str,"annotation"))
-	font = env->AnnotationFont();
+            {
+#if !defined EKA2 || defined UIQ
+                logicalFont = env->AnnotationFont();
+#else
+                logicalFont = AknLayoutUtils::FontFromId( EAknLogicalFontSecondaryFont, NULL );
+#endif
+            }
       else if (!strcmp(new_font_name_str,"title"))
-	font = env->TitleFont();
+                {
+#if !defined EKA2 || defined UIQ
+                logicalFont = env->TitleFont();
+#else
+                logicalFont = AknLayoutUtils::FontFromId( EAknLogicalFontTitleFont, NULL );
+#endif
+                }
+
       else if (!strcmp(new_font_name_str,"legend"))
-	font = env->LegendFont();
+            {
+#if !defined EKA2 || defined UIQ
+                logicalFont = env->LegendFont();
+#else
+                logicalFont = AknLayoutUtils::FontFromId( EAknLogicalFontPrimarySmallFont, NULL );
+#endif
+            }
       else if (!strcmp(new_font_name_str,"symbol"))
-	font = env->SymbolFont();
+            {
+                logicalFont = env->SymbolFont();
+            }
       else if (!strcmp(new_font_name_str,"dense"))
-	font = env->DenseFont();
+            {
+#if !defined EKA2 || defined UIQ
+                logicalFont = env->DenseFont();
+#else
+                logicalFont = AknLayoutUtils::FontFromId( EAknHighestLogicalFont, NULL );
+#endif
+            }
       else 
-	goto invalid_font_spec;
-      TBuf<KMaxTypefaceNameLength> new_font_name_descr = (font->FontSpecInTwips()).iTypeface.iName;
-      TFontSpec fontSpec=TFontSpec(new_font_name_descr, 0); 
-      CFont *myfont=NULL;
-      error=device->GetNearestFontInPixels(myfont,fontSpec);
+            {
+                PyErr_SetString(PyExc_ValueError, "invalid font specification");
+                return NULL;
+            }
+
+            fontSpec = logicalFont->FontSpecInTwips();
+        }
+        else
+        {
+            PyErr_SetString(PyExc_ValueError, "invalid font specification");
+            return NULL;
+        }
+
+        if ( twips != -1 )
+        {
+          fontSpec.iHeight = twips;
+        }
+        else if ( heightInPixels != -1 )
+        {
+            fontSpec.iHeight = FontUtils::TwipsFromPoints( TInt( heightInPixels) );
+        }
+
+        // Don't modify default if not given
+        if( isbold != -1)
+        {
+          if( isbold == 1)
+              fontSpec.iFontStyle.SetStrokeWeight( EStrokeWeightBold );
+          else
+              fontSpec.iFontStyle.SetStrokeWeight( EStrokeWeightNormal);
+        }
+        // Don't modify default if not given
+        if( isitalic != -1)
+        {
+            if ( isitalic == 1)
+                fontSpec.iFontStyle.SetPosture( EPostureItalic );
+            else
+                fontSpec.iFontStyle.SetPosture( EPostureUpright);
+        }
+
+        if ( bitmaptype != 1)
+        {
+            fontSpec.iFontStyle.SetBitmapType( (TGlyphBitmapType)bitmaptype );
+        }
+
+        // Create zoom factor object
+        TZoomFactor devicemap( self->gc->Device() );
+        // Set zoom factor at 1 to 1
+        devicemap.SetZoomFactor(TZoomFactor::EZoomOneToOne);
+        // Set zoom factor
+        devicemap.SetZoomFactor( TInt(TZoomFactor::EZoomOneToOne * zoom) );
+
+        error = devicemap.GetNearestFontInTwips( ( CFont*& )font, fontSpec );
+
       if (error != KErrNone) 
-	goto invalid_font_spec;
-      gc->UseFont(myfont);  
-    } else  
-      goto invalid_font_spec;
+        {
+            PyErr_SetString(PyExc_ValueError, "invalid font specification");
+            return NULL;
+        }
+
+        gc->UseFont(font);
+
+        if( new_font_name_obj )
+        {
     self->font_set=1;
     Py_XDECREF(self->font_name);
     self->font_name=new_font_name_obj;
     Py_XINCREF(self->font_name);
   }
+    }
+
   gc->SetPenColor(fill_color);
-  for (i=0; i<n_coords; i++) {
+
+    //CWsScreenDevice* screenDev = CEikonEnv::Static()->ScreenDevice();
+    // Using CWsScreenDevice causes CTypeFaceStore -1 panic with object from Image.new().
+    // No documentation for that =(
+
+    CGraphicsDevice* dev = gc->Device();
+
+    TInt fitting_chars = -1;
+    if ( maxwidth > 0 )
+    {
+        fitting_chars = font->TextCount( TPtrC((TUint16 *)buf,length), maxwidth );
+    }
+    
+    // Draw if enabled
+    if( dodraw )
+    {
+        for (i=0; i<n_coords; i++)
+        {
     TPoint loc;
-    if (!PyCoordSeq_GetItem(coordseq_obj,i,&loc.iX,&loc.iY)) {
-      //gc->DiscardFont();
+            if (!PyCoordSeq_GetItem(coordseq_obj,i,&loc.iX,&loc.iY))
+                {
+                    gc->DiscardFont();
+                    if(dev) dev->ReleaseFont(font);
       return NULL;
     }
+            if ( fitting_chars == -1)
+            {
     gc->DrawText(TPtrC((TUint16 *)buf,length), loc);
   }
-  //gc->DiscardFont();
+            else
+            {
+                gc->DrawText(TPtrC((TUint16 *)buf, fitting_chars), loc);
+            }   
+        }
+    }
+    
+
+    TInt width = 0;
+    if( do_getwidth == 1)
+    {
+        width = font->TextWidthInPixels( TPtrC((TUint16 *)buf,length) );
+    }
+    
+    gc->DiscardFont();
+    if(dev) dev->ReleaseFont(font);
+
+    // Return characters
+    if ( maxwidth > 0 )
+    {
+        PyObject *obj_fitting_chars = Py_BuildValue( "i", fitting_chars );
+        return obj_fitting_chars;
+    }
+    
+    // Return text width
+    if( do_getwidth == 1)
+    {
+        PyObject *obj_width = Py_BuildValue( "i", width );
+        return obj_width;
+    }
+    
   PY_RETURN_NONE;
- invalid_font_spec:
-  PyErr_SetString(PyExc_ValueError, "invalid font specification");
-  return NULL;
 }
 
 extern "C" PyObject *
@@ -1663,6 +1869,7 @@ extern "C" {
   {
     if (obj->font_set)
       obj->gc->DiscardFont();
+
     Py_DECREF(obj->drawapi_cobject);
     Py_XDECREF(obj->font_name);
     obj->font_name=NULL;
@@ -1771,8 +1978,10 @@ extern "C" {
   static const PyMethodDef graphics_methods[] = {
     {"ImageNew", (PyCFunction)graphics_ImageNew, METH_VARARGS, NULL},
     {"ImageFromCFbsBitmap", (PyCFunction)graphics_ImageFromCFbsBitmap, METH_VARARGS, NULL},
+#ifndef UIQ
 #ifdef EKA2
     {"ImageFromIcon", (PyCFunction)graphics_ImageFromIcon, METH_VARARGS, NULL},
+#endif
 #endif
 #ifdef ICL_SUPPORT
     {"ImageOpen", (PyCFunction)graphics_ImageOpen, METH_VARARGS, NULL},
diff -urNp pys60_1_3_18_src_UNTOUCHED/ext/recorder/recordadapter.cpp pyuiq_CLEAN/ext/recorder/recordadapter.cpp
--- pys60_1_3_18_src_UNTOUCHED/ext/recorder/recordadapter.cpp	Wed Nov 08 11:04:34 2006
+++ pyuiq_CLEAN/ext/recorder/recordadapter.cpp	Tue Mar 06 12:16:15 2007
@@ -159,7 +159,11 @@ void CRecorderAdapter::SetVolume(TInt aV
 #if SERIES60_VERSION>12
 TInt CRecorderAdapter::GetCurrentVolume(TInt &aVolume)
   {
+#ifndef UIQ
   return iMdaAudioRecorderUtility->GetVolume(aVolume);
+#else
+  return KErrNone;
+#endif
   }
 #endif /* SERIES60_VERSION */
 
diff -urNp pys60_1_3_18_src_UNTOUCHED/ext/socket/apselection.cpp pyuiq_CLEAN/ext/socket/apselection.cpp
--- pys60_1_3_18_src_UNTOUCHED/ext/socket/apselection.cpp	Mon Jan 29 17:17:30 2007
+++ pyuiq_CLEAN/ext/socket/apselection.cpp	Thu Jan 01 02:00:00 1970
@@ -1,93 +0,0 @@
-/*
-* ====================================================================
-*  apselection.cpp
-*  
-* Copyright (c) 2006 - 2007 Nokia Corporation
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-*     http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-* ====================================================================
-*/
-
-
-
-// ***************************************************************
-// NOTE: this file has been added because there is a conflict between
-// types defined in <apsettingshandlerui.h> and <OBEX.h>.
-// ***************************************************************
-
-
-
-// Accesspoint selection
-#include <e32base.h>
-#include <apsettingshandlerui.h>
-#include "Python.h"
-#include "symbian_python_ext_util.h"
-#include "apselection.h"
-#include <aputils.h>
-
-
-
-extern "C" PyObject *
-ap_select_ap()
-{
-    TInt error=KErrNone;
-    TInt ret = 0;
-    CCommsDatabase* db = NULL;
-    CApSettingsHandler* settingsHandler = NULL;
-    CApUtils *aputil = NULL;
-    
-    TRAP(error, {
-      db=CCommsDatabase::NewL(EDatabaseTypeIAP);
-      settingsHandler = CApSettingsHandler::NewLC(
-          ETrue, 
-          EApSettingsSelListIsPopUp, 
-          EApSettingsSelMenuSelectOnly,
-          KEApIspTypeAll, 
-          EApBearerTypeAll, 
-          KEApSortNameAscending
-          );
-      aputil = CApUtils::NewLC(*db);
-      CleanupStack::Pop(2);    
-    });
-    if (error != KErrNone) {
-      delete aputil;
-      delete settingsHandler;
-      delete db;
-      return SPyErr_SetFromSymbianOSErr(error);
-    }
-    TUint32 originallyFocused(0);
-    TUint32 aSelectedIap(0);
-
-    // Show the dialog
-    TRAP(error, ret = settingsHandler->RunSettingsL(originallyFocused, aSelectedIap));
-    delete settingsHandler;
-    if (error != KErrNone) {
-      delete aputil;
-      delete db;
-      return SPyErr_SetFromSymbianOSErr(error);
-    }
-     
-    if(ret & KApUiEventSelected){
-      // user has made a selection.
-      
-      TInt iapid = aputil->IapIdFromWapIdL(aSelectedIap);
-      delete aputil;
-      delete db; 
-      return Py_BuildValue("i", iapid);      
-    }
-    delete aputil;
-    delete db; 
-    Py_INCREF(Py_None);
-    return Py_None;
-}
-
diff -urNp pys60_1_3_18_src_UNTOUCHED/ext/socket/apselection.h pyuiq_CLEAN/ext/socket/apselection.h
--- pys60_1_3_18_src_UNTOUCHED/ext/socket/apselection.h	Wed Jan 10 14:48:08 2007
+++ pyuiq_CLEAN/ext/socket/apselection.h	Thu Jan 01 02:00:00 1970
@@ -1,32 +0,0 @@
-/*
-* ====================================================================
-*  apselection.h.cpp
-*  
-* Copyright (c) 2006 - 2007 Nokia Corporation
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-*     http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-* ====================================================================
-*/
-
-
-
-// ***************************************************************
-// NOTE: this file has been added because there is a conflict between
-// types defined in <apsettingshandlerui.h> and <OBEX.h>.
-// ***************************************************************
-
-
-
-extern "C" PyObject *
-ap_select_ap();
-
diff -urNp pys60_1_3_18_src_UNTOUCHED/ext/socket/e32socket.mmp.in pyuiq_CLEAN/ext/socket/e32socket.mmp.in
--- pys60_1_3_18_src_UNTOUCHED/ext/socket/e32socket.mmp.in	Tue Jan 30 11:14:42 2007
+++ pyuiq_CLEAN/ext/socket/e32socket.mmp.in	Tue May 16 16:57:40 2006
@@ -1,4 +1,4 @@
-/* Copyright (c) 2005-2006 Nokia Corporation
+/* Copyright (c) 2005 Nokia Corporation
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -13,7 +13,7 @@
  * limitations under the License.
  */
 targettype 	dll
-TARGET		e32socket.pyd
+TARGET		_e32socket.pyd
 TARGETPATH	\system\libs
 
 #ifdef EKA2
@@ -38,20 +38,15 @@ userinclude 	..\..\core\Include
 userinclude   	..\..\core\Python
 userinclude  	..\..\core\Symbian 
 
-LIBRARY	      python222.lib
-LIBRARY	      euser.lib estlib.lib
-LIBRARY	      esock.lib
-LIBRARY	      insock.lib
-LIBRARY	      bluetooth.lib
-LIBRARY	      btmanclient.lib
-LIBRARY       btextnotifiers.lib
-LIBRARY       sdpagent.lib
-LIBRARY       sdpdatabase.lib
-LIBRARY	      irobex.lib
-
-LIBRARY       commdb.lib
-LIBRARY       apengine.lib
-LIBRARY       apsettingshandlerui.lib
+LIBRARY 	python222.lib
+LIBRARY 	euser.lib estlib.lib
+LIBRARY		esock.lib
+LIBRARY	    	insock.lib
+LIBRARY	    	bluetooth.lib
+LIBRARY	    	btmanclient.lib
+LIBRARY     	btextnotifiers.lib
+LIBRARY     	sdpagent.lib
+LIBRARY     	sdpdatabase.lib
+LIBRARY	    	irobex.lib
 
 source	    	e32Socketmodule.cpp
-source        apselection.cpp
diff -urNp pys60_1_3_18_src_UNTOUCHED/ext/socket/e32socket.py pyuiq_CLEAN/ext/socket/e32socket.py
--- pys60_1_3_18_src_UNTOUCHED/ext/socket/e32socket.py	Thu Jan 01 02:00:00 1970
+++ pyuiq_CLEAN/ext/socket/e32socket.py	Wed Apr 05 14:40:46 2006
@@ -0,0 +1,27 @@
+#
+# e32socket.py
+#
+# Copyright (c) 2005 Nokia Corporation
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+import e32
+
+if e32.s60_version_info>=(3,0):
+    import imp
+    _e32socket=imp.load_dynamic('_e32socket', 'c:\\sys\\bin\\_e32socket.pyd')
+else:
+    import _e32socket
+
+from _e32socket import *
diff -urNp pys60_1_3_18_src_UNTOUCHED/ext/socket/e32socketmodule.cpp pyuiq_CLEAN/ext/socket/e32socketmodule.cpp
--- pys60_1_3_18_src_UNTOUCHED/ext/socket/e32socketmodule.cpp	Tue Feb 13 13:33:10 2007
+++ pyuiq_CLEAN/ext/socket/e32socketmodule.cpp	Wed May 31 12:22:02 2006
@@ -2,7 +2,7 @@
 * ====================================================================
 *  e32socketmodule.cpp
 *  
-* Copyright (c) 2005 - 2007 Nokia Corporation
+* Copyright (c) 2005 Nokia Corporation
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
@@ -23,6 +23,8 @@
 #include "symbian_python_ext_util.h"
 
 
+
+
 #if SERIES60_VERSION>=26
 #define __BC70s__
 #endif
@@ -41,18 +43,6 @@
 #include <SecureSocket.h>
 #endif
 
-
-#include <CommDbConnPref.h>
-
-// If building for 2.8. These headers must be copied from 2.6 SDk
-#include <aplistitemlist.h> 
-#include <aputils.h> 
-
-#include <apselect.h>
-#include <COMMDB.H>
-
-#include "apselection.h"
-
 #ifdef PRESDK20
 #define KProtocolUnknown 0xdead
 #endif
@@ -1390,71 +1380,14 @@ struct BTDevice_data {
  *
  */
 
-
-#define AP_type ((PyTypeObject*)SPyGetGlobalString("APType"))
-
-struct AP_object {
-  PyObject_VAR_HEAD
-  RConnection* connection;
-  TInt apId;
-  TBool started;
-};
-
-
 class TStaticData {
 public:
   RSocketServ rss;
-  AP_object *apo;
+  TInt count;
 };
 
-
-extern "C"
-void socket_mod_cleanup();
-
-extern "C" PyObject *
-ap_start(AP_object *self, PyObject* /*args*/);
-
-extern "C" PyObject *
-ap_stop(AP_object *self, PyObject* /*args*/);
-
-
-TStaticData* GetServer()
-{
-  if (Dll::Tls())
-  {
-      return static_cast<TStaticData*>(Dll::Tls());
-  }
-  else 
-  {
-      TInt error = KErrNone;
-      TStaticData* sd = NULL;
-      TRAP(error, {
-        sd = new (ELeave) TStaticData;
-      });
-      if(error!=KErrNone){
-        return (TStaticData*) SPyErr_SetFromSymbianOSErr(error);
-      }
-      
-      // Nullify the content.
-      sd->apo=NULL;
-       
-      error = sd->rss.Connect(KESockDefaultMessageSlots*2); 
-      if (error != KErrNone){
-        delete sd;
-        return (TStaticData*) SPyErr_SetFromSymbianOSErr(error);
-      }
-      error = Dll::SetTls(sd);
-      if(error!=KErrNone){
-        sd->rss.Close();
-        delete sd;
-        return (TStaticData*) SPyErr_SetFromSymbianOSErr(error);
-      }    
-      
-      PyThread_AtExit(socket_mod_cleanup);
-      return static_cast<TStaticData*>(Dll::Tls()); 
-  }   
-}
-
+inline TStaticData* GetServer()
+{return static_cast<TStaticData*>(Dll::Tls());}
 
 /*
  * CSocketEngine
@@ -1516,7 +1449,6 @@ private:
 void CSocketAo::RunL()
 {
   iState = EIdle;
-  iXLen = iDataBuf.Length();
   if (!iPyCallback) {
 #ifdef HAVE_ACTIVESCHEDULERWAIT
     iWait.AsyncStop();
@@ -1607,21 +1539,11 @@ extern "C" {
     PyObject_Del(so);
   }
 
-  void socket_mod_cleanup()
+  static void socket_mod_cleanup()
   {
-    TStaticData* sd = NULL;
-    sd = GetServer();
-    
-    if(sd!=NULL){
-      if(sd->apo!=NULL){
-        ap_stop(sd->apo,NULL);
-        Py_DECREF(sd->apo);
-        sd->apo = NULL;  
-      }
-      sd->rss.Close();
-      delete Dll::Tls();
-      Dll::SetTls(NULL);
-    }
+    GetServer()->rss.Close();
+    delete Dll::Tls();
+    Dll::SetTls(NULL);
   }
 }
 
@@ -1666,10 +1588,26 @@ static void set_symbian_bt_addr(TBTSockA
 
 static PyObject* create_socket_object()
 {
+  if (!GetServer()) {
+    TStaticData* sd = new TStaticData;
+    if (!sd) 
+      return PyErr_NoMemory();
+    else {
+      Dll::SetTls(sd);    
+      TInt error = GetServer()->rss.Connect(KESockDefaultMessageSlots*2); 
+      if (error != KErrNone) {
+        delete Dll::Tls();
+        Dll::SetTls(NULL);
+        return SPyErr_SetFromSymbianOSErr(error);
+      }
+      PyThread_AtExit(socket_mod_cleanup);
+    } 
+  }   
+  
   Socket_object *so = PyObject_New(Socket_object, Socket_type);
   if (so == NULL) 
     return PyErr_NoMemory();
-    
+  
   so->SE = new CSocketEngine();
   if (so->SE == NULL) {
     PyObject_Del(so);
@@ -1846,20 +1784,14 @@ if (!(c)) return PySocket_Err("Bad proto
 
 extern "C" PyObject *
 new_Socket_object(PyObject* /*self*/, PyObject *args)
-{  
+{
   int family;
   int type;
-  int protocol = -1;
-  AP_object *apo = NULL;
-  TStaticData* sd = NULL;
+  int protocol = 0;
 
-  sd = GetServer();
-  if(sd==NULL){
-    return NULL;
-  } 
-  if (!PyArg_ParseTuple(args, "iiiO", &family, &type, &protocol, &apo)) {
+  if (!PyArg_ParseTuple(args, "ii|i", &family, &type, &protocol)) 
       return NULL;
-  }
+
   if (family == KAfInet) {
     if (type == KSockStream) {
       if (protocol && (protocol != KProtocolInetTcp))
@@ -1895,52 +1827,19 @@ new_Socket_object(PyObject* /*self*/, Py
 
   socket->ob_proto = protocol;
 
-  TInt errorRConn = KErrNone;
   TInt error = KErrNone;
   if (family == KAfInet)
-  {
-
-  if (apo != NULL && (PyObject*)apo != Py_None)
-  {
-    if (!ap_start(apo,NULL)) {
-      Socket_dealloc(socket);
-      PyErr_SetString(PyExc_RuntimeError, "Couldn't start RConnection");
-      return NULL; 
-    }
-    else {
-      error = socket->SE->iSocket.Open(sd->rss, family, type, protocol, *apo->connection);
-    } 
-  }
-
-  else if (sd->apo != NULL && (PyObject*)sd->apo!=Py_None)
-  {
- 
-    if (!ap_start(sd->apo,NULL)) {
-      Socket_dealloc(socket);
-      PyErr_SetString(PyExc_RuntimeError, "Couldn't start RConnection");
-      return NULL; 
-    }
-    else {
-      error = socket->SE->iSocket.Open(sd->rss, family, type, protocol, *sd->apo->connection);
-    } 
-  }
-  else {
-    error = socket->SE->iSocket.Open(sd->rss, family, type, protocol);
-    }
-  }
-  
+    error = socket->SE->iSocket.Open(GetServer()->rss, family, type, protocol);
   else if (family == KAfBT)
-    error = socket->SE->iSocket.Open(sd->rss, KServerTransportName);
+    error = socket->SE->iSocket.Open(GetServer()->rss, KServerTransportName);
   
   if (error != KErrNone) {
-    if (apo != NULL && (PyObject*)apo != Py_None) {
-      ap_stop(apo, NULL);
-      delete apo;
-    }
     Socket_dealloc(socket);
     return PySocket_Err(error);
   }
   return (PyObject*) socket;
+  
+  
 }
 
 
@@ -1955,7 +1854,6 @@ socket_accept(Socket_object* self, PyObj
 	       (self->ob_proto == KProtocolInetTcp));
   
   PyObject* c = NULL;
-  TStaticData* sd = NULL;
 
   if (!PyArg_ParseTuple(args, "|O", &c))
     return NULL;
@@ -1971,12 +1869,7 @@ socket_accept(Socket_object* self, PyObj
   if (!new_SE)
     return PyErr_NoMemory();
 
-  sd = GetServer();
-  if(sd==NULL){
-    return NULL;
-  }
-
-  TInt error = new_SE->iSocket.Open(sd->rss);
+  TInt error = new_SE->iSocket.Open(GetServer()->rss);
   if (error != KErrNone) {
     delete new_SE;
     return PySocket_Err(error);
@@ -2209,18 +2102,13 @@ socket_recv(Socket_object *self, PyObjec
 {
   CHECK_NOTCLOSED_NOTREADBUSY(self);
 
-  int request = -1;
+  int request;
   int flag = 0;
   PyObject* c = NULL;
 
   if (!PyArg_ParseTuple(args, "i|iO", &request, &flag, &c))
     return NULL;
 
-  if (request < 0) {
-    PyErr_SetString(PyExc_ValueError, "negative buffersize in recv");
-    return NULL;
-  }
-
   if (flag && 
       (flag != KWaitAll) && 
       (flag != KSockReadPeek) && 
@@ -2244,11 +2132,9 @@ socket_recv(Socket_object *self, PyObjec
   ao->iCallback = &socket_recv_return;
   ao->iPyCallback = c;
   ao->iDataBuf.Set((TUint8*)(PyString_AsString(my_str)),0,request);
-  
-  if (self->ob_proto == KProtocolInetUdp){
-    ao->iData[1] = (TAny*)1;
+
+  if (self->ob_proto == KProtocolInetUdp)  // BUG! iXLen doesn't get set!
     self->SE->iSocket.Recv(ao->iDataBuf, (flag & KSockReadPeek), ao->iStatus);
-  }
   else if (flag & KWaitAll)
     self->SE->iSocket.Recv(ao->iDataBuf, (flag & KSockReadPeek), ao->iStatus);
   else {
@@ -2269,7 +2155,7 @@ socket_recv_return(TInt aError, CSocketA
   }
 
   if (aOp->iData[1] && (aOp->iXLen() != PyString_Size(my_str)))
-    if (_PyString_Resize(&my_str, aOp->iXLen()) == -1)
+    if (_PyString_Resize(&my_str, aOp->iXLen()))
       return NULL;
   
   return my_str;
@@ -2502,97 +2388,6 @@ socket_shutdown(Socket_object *self, PyO
   User::WaitForRequest(st);
   RETURN_SOCKET_ERROR_OR_PYNONE(st.Int());
 }
-extern "C" PyObject *
-socket_list_aps()
-{
-  TInt error = KErrNone;
-  CCommsDatabase* db = NULL;
-  CApListItemList* apListItemList = NULL;
-  CApSelect* apSelect = NULL;
-  CApUtils *aputil = NULL;
-
-  PyObject *py_aplist = NULL;
-  TInt listPosition=0;
-  TInt itemsInList=0;
-  
-  TRAP(error, {
-    db=CCommsDatabase::NewL(EDatabaseTypeIAP);
-    apListItemList = new (ELeave) CApListItemList();
-    
-    apSelect = CApSelect::NewLC(*db,
-                                KEApIspTypeAll,
-                                EApBearerTypeAll,
-                                KEApSortNameAscending);
-    aputil = CApUtils::NewLC(*db);
-    CleanupStack::Pop(2);
-  });
-  if (error != KErrNone) 
-  {
-    delete aputil;
-    delete apSelect;
-    delete apListItemList;
-    delete db;
-    return SPyErr_SetFromSymbianOSErr(error);
-  }                          
-   
-  py_aplist = PyList_New(apSelect->Count());
-  if(py_aplist==NULL){
-    delete aputil;
-    delete apSelect;
-    delete apListItemList;
-    delete db;
-    return PyErr_NoMemory();
-  }
-  
-  TRAP(error, itemsInList = apSelect->AllListItemDataL(*apListItemList))
-  if (error != KErrNone)
-  {
-    Py_DECREF(py_aplist);
-    delete aputil;
-    delete apSelect;
-    delete apListItemList;
-    delete db;
-    return SPyErr_SetFromSymbianOSErr(error);                             
-  } 
-  
-  if (itemsInList>0)
-  {  
-    if (apSelect->MoveToFirst())
-    {
-      do
-      {
-        TUint32 uid = apSelect->Uid();
-        TInt iapid = aputil->IapIdFromWapIdL(uid);
-        PyObject *apValue = NULL;
-        apValue = Py_BuildValue("{s:i,s:u#}", "iapid",
-                                               iapid, 
-                                               "name",
-                                               apSelect->Name().Ptr(), apSelect->Name().Length()); 
-       
-        if((apValue == NULL) || (PyList_SetItem(py_aplist,listPosition,apValue)!=0)){
-          Py_XDECREF(apValue);
-          Py_DECREF(py_aplist);
-          delete aputil;
-          delete apSelect;
-          delete apListItemList;
-          delete db;
-          return NULL;
-        }
-        listPosition++;
-      }
-      while(apSelect->MoveNext());
-    }
-  }
-  
-
-  delete aputil;
-  delete apSelect;
-  delete apListItemList;
-  delete db;
-
-  return py_aplist;
-}
-
 
 extern "C" {
 
@@ -2665,7 +2460,7 @@ NONSHARABLE_CLASS(SSLEngine): public CAc
   SSLEngine();
   ~SSLEngine();
 
-  TInt Connect(CSocketEngine &aSE, TPtrC8  &host);
+  TInt Connect(CSocketEngine &aSE);
 
   TInt SSLSend(TPtrC8 &, TSockXfrLength &);
   TInt SSLRecv(TPtr8&);
@@ -2696,7 +2491,7 @@ SSLEngine::SSLEngine():
   CActiveScheduler::Add(this);
 }
 
-TInt SSLEngine::Connect(CSocketEngine &aSE, TPtrC8 &host)
+TInt SSLEngine::Connect(CSocketEngine &aSE)
 { 
   /*  if (protocol == KProtocol_TLS)
     SecSocket = CSecureSocket::NewL(aSE.iSocket, _L("TLS1.0"));
@@ -2708,13 +2503,6 @@ TInt SSLEngine::Connect(CSocketEngine &a
   
   Py_BEGIN_ALLOW_THREADS
   SecSocket->FlushSessionCache();
-
-  #if SERIES60_VERSION>=30
-    if (host.Length() > 0) {
-      error = SecSocket->SetOpt(KSoSSLDomainName, KSolInetSSL, host);
-    }
-  #endif
-
   SecSocket->StartClientHandshake(iStatus);
   runState = EBusy;
   SetActive();
@@ -2861,10 +2649,8 @@ new_ssl_object(PyObject* /*self*/, PyObj
   Socket_object *so = NULL;
   char *key_file = NULL;
   char *cert_file = NULL;
-  char *hostName = NULL;
-  TPtrC8 host;
- 
-  if ( !PyArg_ParseTuple(args, "O!|zzz", Socket_type, &so, &key_file, &cert_file, &hostName) )
+
+  if ( !PyArg_ParseTuple(args, "O!|zz", Socket_type, &so, &key_file, &cert_file) )
     return NULL;
 
   if ((key_file != NULL) || (cert_file != NULL))
@@ -2875,11 +2661,7 @@ new_ssl_object(PyObject* /*self*/, PyObj
 
   if (!so->ob_is_connected) 
     return PySocket_Err("TCP Socket must be connected");
- 
-  if (hostName != NULL) {
-    host.Set((unsigned char *)hostName);
-  }
- 
+
   SSL_object *sslo = PyObject_New(SSL_object, SSL_type);
   if (sslo == NULL)
     return PyErr_NoMemory();
@@ -2890,14 +2672,8 @@ new_ssl_object(PyObject* /*self*/, PyObj
     return PyErr_NoMemory();
   }
 
-  int err=sslo->SSLE->Connect(*(so->SE), host);
+  int err=sslo->SSLE->Connect(*(so->SE));
   if (err != KErrNone) {
-    delete key_file;
-    key_file=NULL;
-    delete cert_file;
-    cert_file=NULL;
-    delete hostName;
-    hostName=NULL;
     return SPyErr_SetFromSymbianOSErr(err);
   }
   return (PyObject*) sslo;
@@ -3030,215 +2806,6 @@ extern "C" {
 #endif //HAVE_SSL
 
 
-extern "C" PyObject *
-ap_start(AP_object *self, PyObject* /*args*/)
-{
-  if (self->started==EFalse)
-  {
-    TInt error = KErrNone;
-    TStaticData* sd = NULL;
-    sd = GetServer();
-    if(sd==NULL){
-      return NULL;
-    }
-    error = self->connection->Open(sd->rss);
-
-    if (error != KErrNone)
-    {
-      return SPyErr_SetFromSymbianOSErr(error);
-    }
-    
-
-    TCommDbConnPref prefs;
-    
-    prefs.SetDialogPreference(ECommDbDialogPrefDoNotPrompt);
-    prefs.SetDirection(ECommDbConnectionDirectionOutgoing);
-    prefs.SetIapId(self->apId);   
-    error = self->connection->Start(prefs);
-    if(error!=KErrNone){
-      return SPyErr_SetFromSymbianOSErr(error);
-    }
-    self->started=ETrue;
-  }
-  Py_INCREF(Py_None);
-  return Py_None;
-}
-
-
-extern "C" PyObject *
-ap_stop(AP_object *self, PyObject* /*args*/)
-{
-  if (self->connection != NULL) 
-  {
-    self->connection->Close();
-    self->started=EFalse;
-  }
-  Py_INCREF(Py_None);
-  return Py_None;
-}
-
-
-/*
- * Deallocate ap.
- */
-extern "C" {
-  static void ap_dealloc(AP_object *apo)
-  {
-    if (apo->connection) {
-      apo->connection->Close();
-      delete apo->connection;
-      apo->connection = NULL;
-    }
-    apo->apId = 0;
-    PyObject_Del(apo);
-  }
-}
-
-
-/*
- * Allocate ap.
- */
-extern "C" PyObject *
-new_ap_object(TInt accessPointId)
-{
-  TInt error = KErrNone;
-  
-  AP_object *apo = PyObject_New(AP_object, AP_type);
-  if (apo == NULL)
-  {
-    return PyErr_NoMemory();
-  }
-  
-  apo->connection = NULL;
-  apo->apId = accessPointId;
-  apo->started = EFalse;
-
-  TRAP(error, {
-    apo->connection = new (ELeave) RConnection();
-  });
-  if(error!=KErrNone){
-    ap_dealloc(apo);
-    return SPyErr_SetFromSymbianOSErr(error);
-  }
-
-  TStaticData* sd = NULL;
-  sd = GetServer();
-  if(sd==NULL){
-    return NULL;
-  }
-  return (PyObject*) apo;
-}
-
-
-/*
- * Return Access point object.
- */
-extern "C" PyObject *
-access_point(PyObject* /*self*/, PyObject* args)
-{
-  TInt accessPointId = -1;
-  if (!PyArg_ParseTuple(args, "i", &accessPointId)){ 
-    return NULL;
-  }
-  if(accessPointId <= 0){
-    PyErr_SetString(PyExc_ValueError, "illegal access point id");
-    return NULL;
-  }
-  return new_ap_object(accessPointId);
-}
-
-
-/*
- * set default access point 
- */  
-extern "C" PyObject *
-set_default_ap(PyObject* /*self*/, PyObject* args)
-{
-  AP_object *defaultAP = NULL;
-  TStaticData* sd = NULL;
-
-  sd = GetServer();
-  if(sd==NULL){
-    return NULL;
-  } 
-  
-  if (!PyArg_ParseTuple(args, "O", &defaultAP)){
-    return NULL;
-  }
-  
-  if(PyObject_TypeCheck(defaultAP, AP_type)){
-
-    Py_XDECREF(sd->apo);  
-    Py_INCREF(defaultAP);
-    sd->apo = defaultAP;
-      
-    Py_INCREF(Py_None);
-    return Py_None;
-  
-  }
-  else if ((PyObject*)defaultAP == Py_None){
-    if(sd->apo!=NULL){
-      sd->apo->apId = 0;
-      sd->apo->started = EFalse;
-      Py_DECREF(sd->apo);
-      sd->apo = NULL;
-    }
-    Py_INCREF(Py_None);
-    return Py_None;
-  }
-  else {
-    PyErr_SetString(PyExc_ValueError, 
-                    "Parameter must be access point object or None");
-    return NULL;
-  }
-}
-
-
-extern "C" PyObject *
-select_ap(PyObject* /*self*/, PyObject* /*args*/)
-{  
-  return ap_select_ap();
-}
-
-
-extern "C" {
-  
-  const static PyMethodDef ap_methods[] = {
-    {"start", (PyCFunction)ap_start, METH_NOARGS},
-    {"stop", (PyCFunction)ap_stop, METH_NOARGS},
-    {NULL, NULL}  
-  };
-
-  static PyObject*
-  ap_getattr(AP_object *apo, char *name)
-
-  {
-    return Py_FindMethod((PyMethodDef*)ap_methods, (PyObject*) apo, name);
-  }
-
-  static const PyTypeObject c_ap_type = {
-    PyObject_HEAD_INIT(NULL)
-    0,
-    "_ap.AP",
-    sizeof(AP_object),                       /*tp_basicsize*/
-    0,                                        /*tp_itemsize*/
-    /* methods */
-    (destructor)ap_dealloc,                  /*tp_dealloc*/
-    0,                                        /*tp_print*/
-    (getattrfunc)ap_getattr,                 /*tp_getattr*/
-    0,                                        /*tp_setattr*/
-    0,                                        /*tp_compare*/
-    0,                                        /*tp_repr*/
-    0,                                        /*tp_as_number*/
-    0,                                        /*tp_as_sequence*/
-    0,                                        /*tp_as_mapping*/
-    0,                                        /*tp_hash*/
-  };
-  
-
-} //extern C
-
-
 /*
  *
  * Implementation of socket.HostResolver services
@@ -3258,6 +2825,7 @@ NONSHARABLE_CLASS(HREngine): public CAct
   ~HREngine();
   TInt ResolveHbyN(TPtrC&, TNameEntry&);
 
+  RSocketServ     rss;
   RHostResolver   hr;
 
  private:
@@ -3278,24 +2846,16 @@ HREngine::HREngine():
   error(KErrNone),
   iState(EIdle)
 {
-  if(GetServer()==NULL){
-    PySocket_Err("Could not open socket server");
+  if( (error = rss.Connect(KESockDefaultMessageSlots)) != KErrNone) {
+    PySocket_Err(error);
     return;
-  } 
-  if (GetServer()->apo != NULL) {
-    ap_start(GetServer()->apo,NULL);
-    error = hr.Open(GetServer()->rss, KAfInet, KProtocolInetTcp, *GetServer()->apo->connection);
-  }
-  else {
-    error = hr.Open(GetServer()->rss, KAfInet, KProtocolInetTcp);
   }
-  if (error != KErrNone) {
-    if (GetServer()->apo != NULL) {
-      ap_stop(GetServer()->apo,NULL);
-    }
+
+  if ( (error = hr.Open(rss, KAfInet, KProtocolInetTcp)) != KErrNone) {
     PySocket_Err(error);
-    return;  
-  }  
+    return;
+  }
+ 
   CActiveScheduler::Add(this);
 }
 
@@ -3303,6 +2863,7 @@ HREngine::~HREngine()
 {
   StopL();
   hr.Close();
+  rss.Close();
 }
 
 TInt HREngine::ResolveHbyN(TPtrC &name, TNameEntry &result)
@@ -3744,9 +3305,9 @@ bt_advertise_service(PyObject* /*self*/,
           return PySocket_Err("Service name or flag missing or invalid");
 
   TPtrC serviceName((TUint16*)service, serviceL);
-  if (!so->SE->iAdvertiser){
-    so->SE->iAdvertiser = CObjectExchangeServiceAdvertiser::NewL(serviceName);
-  }
+
+  so->SE->iAdvertiser = CObjectExchangeServiceAdvertiser::NewL(serviceName);
+
   so->SE->iAdvertiser->SetServiceType(type);       //type can be RfcommService || ObexService
 
   channel = so->SE->iPort;
@@ -3937,10 +3498,8 @@ extern "C" {
     {"set_security", (PyCFunction)set_security, METH_VARARGS, NULL},
     {"bt_obex_send_file", (PyCFunction)bt_obex_send_file, METH_VARARGS, NULL},
     {"bt_obex_receive", (PyCFunction)bt_obex_receive, METH_VARARGS, NULL},
-    {"access_point", (PyCFunction)access_point, METH_VARARGS, NULL},
-    {"set_default_access_point", (PyCFunction)set_default_ap, METH_VARARGS, NULL},
-    {"select_access_point", (PyCFunction)select_ap, METH_NOARGS},
-    {"access_points", (PyCFunction)socket_list_aps, METH_NOARGS},
+
+
     {NULL, NULL}           /* sentinel */
   };
 
@@ -3961,14 +3520,8 @@ extern "C" {
 #endif
 
 
-    PyTypeObject* ap_type = PyObject_New(PyTypeObject, &PyType_Type);
-    *ap_type = c_ap_type;
-    ap_type->ob_type = &PyType_Type;
-    SPyAddGlobalString("APType", (PyObject*)ap_type);
-
-
     PyObject *m, *d;
-    m = Py_InitModule("e32socket", (PyMethodDef*)socket_methods);
+    m = Py_InitModule("_e32socket", (PyMethodDef*)socket_methods);
     d = PyModule_GetDict(m);
     
     PyObject *PySocket_Error, *PyGAI_Error;
@@ -4004,6 +3557,9 @@ extern "C" {
     PyDict_SetItemString(d, "AUTHOR", PyInt_FromLong(KAUTHOR));
     //PyDict_SetItemString(d, "TLS", PyInt_FromLong(KProtocol_TLS));
     //PyDict_SetItemString(d, "SSL", PyInt_FromLong(KProtocol_SSL));
+
+
+        
     return;
   }
 } /* extern "C" */
diff -urNp pys60_1_3_18_src_UNTOUCHED/ext/socket/socket.py pyuiq_CLEAN/ext/socket/socket.py
--- pys60_1_3_18_src_UNTOUCHED/ext/socket/socket.py	Mon Jan 22 16:14:46 2007
+++ pyuiq_CLEAN/ext/socket/socket.py	Wed Apr 05 14:40:12 2006
@@ -1,4 +1,4 @@
-# Copyright (c) 2005 - 2007 Nokia Corporation
+# Copyright (c) 2005 Nokia Corporation
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
@@ -20,8 +20,6 @@ from e32socket import *
 import os
 import e32
 
-_default_access_point = None
-
 __all__ = ["getfqdn","getservbyname","getaddrinfo","gethostname"]
 import e32socket
 __all__.extend(os._get_exports_list(e32socket))
@@ -54,28 +52,18 @@ def gethostbyaddr(addr):
 
 _realsocketcall = e32socket.socket
 
-def socket(family, type, proto=0, apo=None):
-    return _socketobject(_realsocketcall(family, type, proto, apo), family)
+def socket(family, type, proto=0):
+    return _socketobject(_realsocketcall(family, type, proto), family)
 
 try:
     _realsslcall = e32socket.ssl
 except AttributeError:
     pass # No ssl
 else:
-    def ssl(sock, keyfile=None, certfile=None, hostname=None):
-        realsock=getattr(sock, "_sock", sock)
-        if e32.s60_version_info>=(3,0):
-            # On S60 3rd Ed secure sockets must be given the expected
-            # hostname before connecting or error -7547 occurs. This
-            # is not needed on 2nd edition. See known issue KIS000322.
-            if hostname is None:
-                # To make things convenient, if a hostname was given
-                # to .connect it is stored in the socket object.
-                if hasattr(sock, "_getconnectname"):
-                    hostname=sock._getconnectname()
-                if hostname is None:
-                    raise RuntimeError("Expected hostname must be given either to socket .connect() or as 4th parameter of ssl() call. See S60 known issue KIS000322.")
-        return _realsslcall(realsock, keyfile, certfile, hostname)
+    def ssl(sock, keyfile=None, certfile=None):
+        if hasattr(sock, "_sock"):
+            sock = sock._sock
+        return _realsslcall(sock, keyfile, certfile)
     # Note: this is just a stopgap hack while waiting for proper SSL error handling.
     # Until that time, SSL operations _will not_ raise sslerror properly as they should.
     SSL_ERROR_NONE=0
@@ -250,10 +238,10 @@ def getfqdn(name=''):
     return name
 
 _socketmethods = (
-        'bind', 'connect_ex', 'fileno', 'listen',
-        'getpeername', 'getsockname', 'getsockopt', 'setsockopt',
-        'sendall', 'sendto', 'shutdown')
-    
+    'bind', 'connect_ex', 'fileno', 'listen',
+    'getpeername', 'getsockname', 'getsockopt', 'setsockopt',
+    'sendall', 'sendto', 'shutdown')
+
 def raise_error(*args,**kwargs):
     raise error(9, 'Bad file descriptor')
 
@@ -293,7 +281,6 @@ class _internalsocketobject:
         self._recvlock=e32.Ao_lock()
         self._family=family
         self._error=None
-        self._connectname=None
         
     def close(self):
         self._sock = self.__class__._closedsocket()
@@ -312,12 +299,7 @@ class _internalsocketobject:
         if not self._family == AF_INET or _isnumericipaddr(addr[0]):
             return self._sock.connect(addr, cb)
         else:
-            # Store hostname so that it can be given to ssl().
-            self._connectname=addr[0] 
             return self._sock.connect((gethostbyname(addr[0]), addr[1]), cb)
-
-    def _getconnectname(self):
-        return self._connectname
 
     def dup(self):
         return _socketobject(self._sock, self._family)
diff -urNp pys60_1_3_18_src_UNTOUCHED/extras/imgviewer.py pyuiq_CLEAN/extras/imgviewer.py
--- pys60_1_3_18_src_UNTOUCHED/extras/imgviewer.py	Wed Dec 07 15:40:28 2005
+++ pyuiq_CLEAN/extras/imgviewer.py	Thu May 03 16:33:15 2007
@@ -33,7 +33,7 @@ textloc=(screensize[0]*0.3,screensize[1]
 if e32.in_emulator():
     imagedir=u'c:\\images'
 else:
-    imagedir=u'e:\\images'
+    imagedir=u'c:\\Media Files\\Picture' # hard coded path for SE M600i
 files=map(unicode,os.listdir(imagedir))
 
 index=appuifw.selection_list(files)
diff -urNp pys60_1_3_18_src_UNTOUCHED/extras/snake.py pyuiq_CLEAN/extras/snake.py
--- pys60_1_3_18_src_UNTOUCHED/extras/snake.py	Fri Oct 20 14:49:44 2006
+++ pyuiq_CLEAN/extras/snake.py	Fri Apr 20 13:10:11 2007
@@ -113,4 +113,4 @@ playing=1
 while playing:
     game=SnakeGame()
     game.run()
-    playing=appuifw.query(u'Final score: %d - Play again?'%game.score,'query')    
+    playing=0   
diff -urNp pys60_1_3_18_src_UNTOUCHED/py2sis/sismaker/utils.py pyuiq_CLEAN/py2sis/sismaker/utils.py
--- pys60_1_3_18_src_UNTOUCHED/py2sis/sismaker/utils.py	Tue Dec 19 09:02:10 2006
+++ pyuiq_CLEAN/py2sis/sismaker/utils.py	Thu May 03 13:12:36 2007
@@ -17,6 +17,8 @@ from shutil import copyfile, rmtree, cop
 import template_engine
 import fileutil
 
+# XXX harcoded UIQ3.x option:
+UIQ=True
 
 # for 1.x-2.x SDKs
 UID_OFFSET_IN_APP = "0x3a4"
@@ -181,7 +183,10 @@ def make_app_sdk30(appname, uid, tempdir
 
     #copy compiled files to temp folder to correct places:
     copy((SDK30_EXE_LOC + appname_uid + ".exe"), (os.path.join(sys_bin, (appname_uid + ".exe"))))
-    copy((SDK30_RSC_LOC + appname_uid + '_' + "AIF" + ".mif"), (os.path.join(resource_apps, (appname_uid + '_' + "AIF" + ".mif"))))
+    if UIQ:
+        copy((SDK30_RSC_LOC + "PyTestIcon.mbm"), (os.path.join(resource_apps, ("PyTestIcon.mbm"))))
+    else:        
+        copy((SDK30_RSC_LOC + appname_uid + '_' + "AIF" + ".mif"), (os.path.join(resource_apps, (appname_uid + '_' + "AIF" + ".mif"))))
     copy((SDK30_RSC_LOC + "PyTest.RSC"), os.path.join(resource_apps, (appname_uid + ".rsc")))
     copy((SDK30_REG_LOC + "PyTest_reg.rsc"), os.path.join(reg_private, (appname_uid + "_reg.rsc")))
 
diff -urNp pys60_1_3_18_src_UNTOUCHED/py2sis/templates_eka2/PyTest.cpp.template pyuiq_CLEAN/py2sis/templates_eka2/PyTest.cpp.template
--- pys60_1_3_18_src_UNTOUCHED/py2sis/templates_eka2/PyTest.cpp.template	Tue Apr 25 15:30:14 2006
+++ pyuiq_CLEAN/py2sis/templates_eka2/PyTest.cpp.template	Thu May 03 12:58:02 2007
@@ -29,7 +29,7 @@ IMPORT_C CEikAppUi* CreateAmarettoAppUi(
 
 const TUid KUidPythonApp = {${{PY2SIS_UID}}};
 
-CPythonDocument::CPythonDocument(CEikApplication& aApp) : CAknDocument(aApp) 
+CPythonDocument::CPythonDocument(CQikApplication& aApp) : CQikDocument(aApp) 
 {
 }
 
diff -urNp pys60_1_3_18_src_UNTOUCHED/py2sis/templates_eka2/PyTest.rss.template pyuiq_CLEAN/py2sis/templates_eka2/PyTest.rss.template
--- pys60_1_3_18_src_UNTOUCHED/py2sis/templates_eka2/PyTest.rss.template	Thu Oct 05 18:25:02 2006
+++ pyuiq_CLEAN/py2sis/templates_eka2/PyTest.rss.template	Thu May 03 12:10:58 2007
@@ -16,8 +16,6 @@ NAME PYTH //XXX
 
 #include <eikon.rh>
 #include <eikon.rsg>
-#include <avkon.rh>
-#include <avkon.rsg>
 
 #include <appinfo.rh>
 #include "PyTest.hrh"
@@ -29,7 +27,6 @@ RESOURCE TBUF { buf=""; }
 RESOURCE EIK_APP_INFO
 {
   menubar=r_python_app_menubar;
-  cba = R_AVKON_SOFTKEYS_OPTIONS_EXIT;
 }
 
 RESOURCE MENU_BAR r_python_app_menubar
@@ -266,8 +263,8 @@ RESOURCE LOCALISABLE_APP_INFO r_python_l
     CAPTION_AND_ICON_INFO
         {
         caption = "${{PY2SIS_APPNAME}}";
-        number_of_icons = 1;
-        icon_file = "\\resource\\apps\\${{PY2SIS_APPNAME}}_${{PY2SIS_UID}}_AIF.mif";
+        number_of_icons = 3;
+        icon_file = "\\resource\\apps\\PyTestIcon.mbm";
         };
     }
 
diff -urNp pys60_1_3_18_src_UNTOUCHED/py2sis/templates_eka2/PyTest_app.h pyuiq_CLEAN/py2sis/templates_eka2/PyTest_app.h
--- pys60_1_3_18_src_UNTOUCHED/py2sis/templates_eka2/PyTest_app.h	Mon Apr 24 15:14:58 2006
+++ pyuiq_CLEAN/py2sis/templates_eka2/PyTest_app.h	Thu May 03 12:56:02 2007
@@ -19,19 +19,21 @@
 #ifndef __PYTEST_APP_H
 #define __PYTEST_APP_H
 
-#include <aknapp.h>
-#include <AknDoc.h>
+#include <eikapp.h>
+#include <eikdoc.h>
+#include <QikApplication.h>
+#include <QikDocument.h>
 
-class CPythonDocument : public CAknDocument
+class CPythonDocument : public CQikDocument
 {
  public:
-  CPythonDocument(CEikApplication& aApp);
+  CPythonDocument(CQikApplication& aApp);
   
  private:
   CEikAppUi* CreateAppUiL();
 };
 
-class CPythonApplication : public CAknApplication 
+class CPythonApplication : public CQikApplication 
 {
  private:
   CApaDocument* CreateDocumentL();
Binary files pys60_1_3_18_src_UNTOUCHED/py2sis/templates_eka2/Python_Large.bmp and pyuiq_CLEAN/py2sis/templates_eka2/Python_Large.bmp differ
Binary files pys60_1_3_18_src_UNTOUCHED/py2sis/templates_eka2/Python_Large_mask.bmp and pyuiq_CLEAN/py2sis/templates_eka2/Python_Large_mask.bmp differ
Binary files pys60_1_3_18_src_UNTOUCHED/py2sis/templates_eka2/Python_Small.bmp and pyuiq_CLEAN/py2sis/templates_eka2/Python_Small.bmp differ
Binary files pys60_1_3_18_src_UNTOUCHED/py2sis/templates_eka2/Python_Small_mask.bmp and pyuiq_CLEAN/py2sis/templates_eka2/Python_Small_mask.bmp differ
Binary files pys60_1_3_18_src_UNTOUCHED/py2sis/templates_eka2/Python_xLarge.bmp and pyuiq_CLEAN/py2sis/templates_eka2/Python_xLarge.bmp differ
Binary files pys60_1_3_18_src_UNTOUCHED/py2sis/templates_eka2/Python_xLarge_mask.bmp and pyuiq_CLEAN/py2sis/templates_eka2/Python_xLarge_mask.bmp differ
diff -urNp pys60_1_3_18_src_UNTOUCHED/py2sis/templates_eka2/app.mmp.template pyuiq_CLEAN/py2sis/templates_eka2/app.mmp.template
--- pys60_1_3_18_src_UNTOUCHED/py2sis/templates_eka2/app.mmp.template	Wed May 03 12:50:28 2006
+++ pyuiq_CLEAN/py2sis/templates_eka2/app.mmp.template	Thu May 03 11:58:28 2007
@@ -14,12 +14,25 @@ SYSTEMINCLUDE	\epoc32\include \epoc32\in
 
 LIBRARY Python_appui.lib
 LIBRARY euser.lib apparc.lib
-LIBRARY eikcore.lib avkon.lib
+LIBRARY eikcore.lib
+LIBRARY qikcore.lib
 
 START RESOURCE PyTest.rss //XXX
 HEADER
 TARGETPATH      resource\apps
 //LANG  SC //only needed for localized application
+END
+
+START BITMAP	PyTestIcon.mbm
+HEADER
+TARGETPATH		\Resource\Apps
+SOURCEPATH		.
+SOURCE	c24		Python_Small.bmp
+SOURCE	8		Python_Small_mask.bmp
+SOURCE	c24		Python_Large.bmp
+SOURCE	8		Python_Large_mask.bmp
+SOURCE	c24		Python_xLarge.bmp
+SOURCE	8		Python_xLarge_mask.bmp
 END
 
 START RESOURCE PyTest_reg.rss
diff -urNp pys60_1_3_18_src_UNTOUCHED/py2sis/templates_eka2/bld.inf pyuiq_CLEAN/py2sis/templates_eka2/bld.inf
--- pys60_1_3_18_src_UNTOUCHED/py2sis/templates_eka2/bld.inf	Mon Apr 24 15:14:36 2006
+++ pyuiq_CLEAN/py2sis/templates_eka2/bld.inf	Thu May 03 11:59:46 2007
@@ -1,6 +1,4 @@
 PRJ_PLATFORMS
 
 PRJ_MMPFILES
-gnumakefile icons_aif.mk 
-
 app.mmp
diff -urNp pys60_1_3_18_src_UNTOUCHED/py2sis/templates_eka2/pypkg_template_SDK30.tmp pyuiq_CLEAN/py2sis/templates_eka2/pypkg_template_SDK30.tmp
--- pys60_1_3_18_src_UNTOUCHED/py2sis/templates_eka2/pypkg_template_SDK30.tmp	Wed May 03 09:52:38 2006
+++ pyuiq_CLEAN/py2sis/templates_eka2/pypkg_template_SDK30.tmp	Thu May 03 12:02:56 2007
@@ -1,5 +1,5 @@
 ;
-; Standalone Python for S60 app
+; Standalone Python for UIQ app
 ;
 ;Languages
 &EN
@@ -10,9 +10,9 @@
 ;Localised Vendor name
 %%{"Vendor-EN"}
 ;
-;Supports S60 v 3.0
+;Supports UIQ v 3.x
 ;
-(0x101F7961), 0, 0, 0, {"Series60ProductID"}
+(0x101F6300), 0, 0, 0, {"UIQ30ProductID"}
 ;
 ; Files to install:
 
diff -urNp pys60_1_3_18_src_UNTOUCHED/setup.py pyuiq_CLEAN/setup.py
--- pys60_1_3_18_src_UNTOUCHED/setup.py	Thu Feb 08 15:13:46 2007
+++ pyuiq_CLEAN/setup.py	Tue Mar 06 17:57:27 2007
@@ -53,6 +53,12 @@ buildconfig_defaults={'PYS60_VERSION_MAJ
                       'EXTRA_SYSTEMINCLUDE_DIRS': [],
                       'WITH_MESSAGING_MODULE': 1,
                       'WITH_LOCATION_MODULE': 1,
+                      'WITH_CONTACTS_MODULE': 1, # UIQ specific
+                      'WITH_SVG_LOGO': 1,
+                      'WITH_SYSINFO_MODULE': 1,
+                      'WITH_CAMERA_MODULE': 1,
+                      'WITH_AUDIO_MODULE': 1,
+                      'PLATFORM': 'S60',
                       # UIDs 10201510 to 10201519 inclusive allocated for PyS60.
                       'PYS60_UID_S60': '0x10201510',
                       'PYS60_UID_CORE': '0x10201511',
@@ -67,6 +73,53 @@ buildconfig_defaults={'PYS60_VERSION_MAJ
                       'LAUNCHER_CAPABILITIES': 'NONE'}
 
 buildconfig_sdks={
+    'UIQ30': {'S60_VERSION': 30,
+           'DEVICE_PLATFORM': 'gcce', # others are fine with armi
+           'EMU_PLATFORM': 'winscw',
+           'SDK_NAME': 'UIQ 30',
+           'SDK_MARKETING_VERSION_SHORT': 'UIQ30',
+           'S60_REQUIRED_PLATFORM_UID':'0x101F6300',
+           'PYS60_UID_S60': '0xF0201510',
+           'PYS60_UID_CORE': '0xF0201511',
+           'PYS60_UID_APPMGR': '0xF0201512',
+           'PYS60_UID_RECOG': '0xF0201513',
+           'PYS60_UID_APPMGR_WRAPPER': '0xF0201514',
+           'PYS60_UID_SCRIPTSHELL': '0xF0201515',
+           'PYS60_UID_LAUNCHER': '0xF0201516',
+           'PYS60_UID_PYREPL': '0xF0201519',
+           'WITH_MESSAGING_MODULE': 0,
+           'WITH_LOCATION_MODULE': 0,
+           'WITH_CONTACTS_MODULE': 0,
+           'WITH_SVG_LOGO': 0,
+           'WITH_SYSINFO_MODULE': 0,
+           'PLATFORM': 'UIQ',
+           'SCRIPTSHELL_CAPABILITIES':
+           ( 'NetworkServices LocalServices ReadUserData WriteUserData Location '+
+             'UserEnvironment PowerMgmt ProtServ SwEvent SurroundingsDD'
+             # Can't get these with the free devcert.
+             +' ReadDeviceData WriteDeviceData TrustedUI'
+             ),
+           'DLL_CAPABILITIES':
+           ( 'NetworkServices LocalServices ReadUserData WriteUserData Location '+
+             'UserEnvironment PowerMgmt ProtServ SwEvent SurroundingsDD'
+             # Can't get these with the free devcert.
+             +' ReadDeviceData WriteDeviceData TrustedUI' #
+             ),
+           'LAUNCHER_CAPABILITIES': 'NONE'
+           },
+    'UIQ21': {'S60_VERSION': 20,
+           'EMU_PLATFORM': 'wins',
+           'SDK_NAME': 'UIQ 21',
+           'PLATFORM': 'UIQ',
+           'WITH_MESSAGING_MODULE': 0,
+           'WITH_LOCATION_MODULE': 0,
+           'WITH_CAMERA_MODULE': 0,
+           'WITH_CONTACTS_MODULE': 0,
+           'WITH_SYSINFO_MODULE': 0,
+           'WITH_AUDIO_MODULE': 0,
+           'WITH_SVG_LOGO': 0,
+           'SDK_MARKETING_VERSION_SHORT': 'UIQ20',
+           'S60_REQUIRED_PLATFORM_UID': '0x101F617B'},
     '12': {'S60_VERSION': 12,
            'EMU_PLATFORM': 'wins',
            'SDK_NAME': 'S60 1st Ed. FP1 SDK',
diff -urNp pys60_1_3_18_src_UNTOUCHED/tools/sdk_files.py pyuiq_CLEAN/tools/sdk_files.py
--- pys60_1_3_18_src_UNTOUCHED/tools/sdk_files.py	Mon Jan 22 16:29:06 2007
+++ pyuiq_CLEAN/tools/sdk_files.py	Tue May 15 16:07:10 2007
@@ -66,7 +66,7 @@ for entry in (
      'files': IF(S60_VERSION>=28,('python_reg.rsc',))},
     {'from': EMU_RELEASE_FROM+PYTHON_RESOURCE_IN_EMU,
      'to': EMU_RELEASE_TO+PYTHON_RESOURCE_IN_EMU,
-     'files': ('appuifwmodule.rsc',)},
+     'files': ('appuifwmodule.rsc','PythonIcon.mbm',)},
     {'from': '/epoc32/data/z/resource/apps',
      'to': EMU_RELEASE_TO+PYTHON_RESOURCE_IN_EMU,
      'files': ('python.rsc',)},
@@ -76,7 +76,7 @@ for entry in (
     {'from': IF(S60_VERSION>=30, EMU_RELEASE_FROM, EMU_RELEASE_FROM+'/z/system/libs'),
      'to': IF(S60_VERSION>=30, 'epoc32/winscw/c/sys/bin', EMU_RELEASE_TO+'/z/system/libs'),
      'files': (   'e32db.pyd',
-                  'e32socket.pyd')+
+                  '_e32socket.pyd')+
      IF(WITH_LOCATION_MODULE,('_location.pyd',))+
      IF(WITH_MESSAGING_MODULE,('_messaging.pyd',))+
      #               '_testcapi.pyd',
