Revision: v2.2.9
authorDremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Wed, 18 Aug 2010 09:43:15 +0300
changeset 61 bf7ee68962da
parent 48 e0d6e9bd3ca7
child 62 9d831841012d
child 69 773449708c84
Revision: v2.2.9 Kit: 201033
build/Makefile.comp
build/Makefile.defs
build/buildutils/svnchangeids.py
build/loc/resources.jar
build/loc/resources_qt.jar
build/makefile
build/makefile.javaversion
build/nativejava.flm
build/properties.xml
build/sis/java_2_0.pkg
build/sis/java_3_1.pkg
build/templates/10.1.layers.sysdef.xml
build/templates/9.2.layers.sysdef.xml
inc/build_defines.hrh
inc/java.txt
javacommons/comms/build/comms.pro
javacommons/comms/build/javacomms.pro
javacommons/comms/comms.pro
javacommons/comms/src/commsendpoint.cpp
javacommons/connectionmanager/src.s60/connectionmanager.cpp
javacommons/fileutils/build/fileutils.pro
javacommons/fileutils/build/javafileutils.pro
javacommons/fileutils/javasrc/com/nokia/mj/impl/fileutils/FileURL.java
javacommons/gcfprotocols/file/javasrc/com/nokia/mj/impl/file/FileConnectionImpl.java
javacommons/gcfprotocols/http/build/javahttp.pro
javacommons/gcfprotocols/http/inc.s60/javauseragent.h
javacommons/gcfprotocols/http/src.s60/javauseragent.cpp
javacommons/gcfprotocols/http/src.s60/nativehttptraansaction.cpp
javacommons/gcfprotocols/http/src.s60/nativetransaction.cpp
javacommons/gcfprotocols/socket/socket/build/build.xml
javacommons/gcfprotocols/socket/socket/inc/socketlocalhostinfo.h
javacommons/gcfprotocols/socket/socket/javasrc/com/nokia/mj/impl/properties/socket/SocketDynamicPropertyHandler.java
javacommons/gcfprotocols/socket/socket/src.s60/socketlocalhostinfo.cpp
javacommons/gcfprotocols/socket/socket/src/socketconnectionjni.cpp
javacommons/javacommons.pro
javacommons/javaenv/src.s60/javaenvinfo.cpp
javacommons/security/build/build.xml
javacommons/security/data/att_operator.txt
javacommons/security/data/att_trustedthirdparty.txt
javacommons/security/data/att_untrusted.txt
javacommons/security/javasrc/com/nokia/mj/impl/security/midp/common/NetworkRestrictionsAttribute.java
javacommons/security/javasrc/com/nokia/mj/impl/security/midp/storage/SecurityStorage.java
javacommons/security/javasrc/com/nokia/mj/impl/security/utils/SecurityDetailedErrorMessage.java
javacommons/security/javasrc/com/nokia/mj/impl/security/utils/SecurityErrorMessage.java
javacommons/security/javaunicertstoreplugin/src.s60/javacertstoreimpl.cpp
javacommons/security/legacysupport/midp2securitypolicyv2/plugins/securitypolicyV2/src/BlanketPermissionPolicy.cpp
javacommons/security/legacysupport/midp2securitypolicyv2/plugins/securitypolicyV2/src/BlanketPermissionPolicy.h
javacommons/security/legacysupport/midp2securitypolicyv2/plugins/securitypolicyV2/src/SimpleMapping.cpp
javacommons/security/legacysupport/midp2securitypolicyv2/plugins/securitypolicyV2/src/XPFParser.cpp
javacommons/security/src.s60/fileutils.cpp
javacommons/security/src.s60/telutils.cpp
javacommons/security/src.s60/telutils.h
javacommons/security/src/midpauthenticationmoduleimpl.cpp
javacommons/security/tsrc/javasrc/com/nokia/mj/impl/security/midp/authentication/AuthenticationModuleTests.java
javacommons/utils/build/bwins/javautilsu.def
javacommons/utils/build/eabi/javautilsu.def
javacommons/utils/inc/javacommonutils.h
javacommons/utils/inc/logger.h
javacommons/utils/javasrc/com/nokia/mj/impl/utils/ErrorMessageBase.java
javacommons/utils/javasrc/com/nokia/mj/impl/utils/Formatter.java
javacommons/utils/javasrc/com/nokia/mj/impl/utils/InstallerDetailedErrorMessage.java
javacommons/utils/javasrc/com/nokia/mj/impl/utils/InstallerErrorMessage.java
javacommons/utils/javasrc/com/nokia/mj/impl/utils/Logger.java
javacommons/utils/src/javacommonutils.cpp
javaextensions/bluetooth/bluetoothcommons/bluetoothplatformcontrol/src.s60/s60btdialog.cpp
javaextensions/bluetooth/bluetoothcommons/bluetoothplatformcontrol/src.s60/s60btdialog.h
javaextensions/bluetooth/bluetoothcommons/build/javabluetoothcommons.pro
javaextensions/bluetooth/bluetoothcommons/src.s60/bluetoothnamelookup.cpp
javaextensions/bluetooth/bluetoothplugins/btl2cappushplugin/src.s60/btl2capserverconnection.cpp
javaextensions/bluetooth/bluetoothplugins/btl2cappushplugin/src/btl2cappushserverconnection.cpp
javaextensions/bluetooth/bluetoothplugins/btspppushplugin/src.s60/btrfcommserverconnection.cpp
javaextensions/bluetooth/omjbluetooth/javasrc/com/nokia/mj/impl/properties/bluetooth/BtDynamicPropertyHandler.java
javaextensions/javaextensions.pro
javaextensions/location/landmarks/src/landmark.cpp
javaextensions/mobinfo/build/javamobinfo.pro
javaextensions/mobinfo/build/mobinfo.pro
javaextensions/mobinfo/javasrc.s60/com/nokia/mj/impl/properties/mobinfo/MobileInfoProperties.java
javaextensions/mobinfo/src.s60/javamobinfo.cpp
javaextensions/satsa/build/javasatsa.pro
javaextensions/satsa/pki/src.s60/cstscredentialmanager.cpp
javaextensions/satsa/pki/src.s60/cstscredentialmanager.h
javaextensions/satsa/pki/src.s60/cstsseprompt.cpp
javaextensions/satsa/pki/src.s60/cstsseprompt.h
javaextensions/satsa/pki/src.s60/cstssignatureservice.cpp
javaextensions/satsa/pki/src.s60/cstssignatureservice.h
javaextensions/sensor/src.s60/cacceleratorsensorrawdata.cpp
javaextensions/sensor/src.s60/csensorbase.cpp
javaextensions/wma/sms_cbs/javasrc/com/nokia/mj/impl/smscbs/utils/WmaUrl.java
javaextensions/wma/sms_cbs/pushplugin/cbs/src.s60/cbsserverconnection.cpp
javamanager/javaappscheme/build/javaappscheme.pro
javamanager/javaappscheme/build/service_conf.xml
javamanager/javaappscheme/src.s60/main.cpp
javamanager/javaappscheme/src.s60/serviceapp.cpp
javamanager/javaappscheme/src.s60/serviceapp.h
javamanager/javaappschemeplugin/build/bld.inf
javamanager/javaappschemeplugin/build/javaappschemeplugin.mmp
javamanager/javaappschemeplugin/data/2002875F.rss
javamanager/javaappschemeplugin/inc/javaapphandler.h
javamanager/javaappschemeplugin/src/javaapphandler.cpp
javamanager/javaappschemeplugin/src/proxy.cpp
javamanager/javacaptain/extensionplugins/javacertstore/src.s60/smartcardcryptotokenreader.cpp
javamanager/javacaptain/extensionplugins/javacertstore/src.s60/smartcardcryptotokenreader.h
javamanager/javacaptain/extensionplugins/preinstallerstarter/inc/preinstallerstarter.h
javamanager/javacaptain/extensionplugins/preinstallerstarter/src.s60/preinstallerstarter.cpp
javamanager/javacaptain/extensionplugins/settingslistener/build/exports.inf
javamanager/javacaptain/extensionplugins/settingslistener/build/javacaptain_ext_settingslistener.pro
javamanager/javacaptain/extensionplugins/settingslistener/inc/settingschangeeventsprovidermessages.h
javamanager/javacaptain/extensionplugins/settingslistener/inc/settingslistenerextension.h
javamanager/javacaptain/extensionplugins/settingslistener/inc/settingslistenerinterface.h
javamanager/javacaptain/extensionplugins/settingslistener/src.s60/cenreplistener.cpp
javamanager/javacaptain/extensionplugins/settingslistener/src.s60/cenreplistener.h
javamanager/javacaptain/extensionplugins/settingslistener/src.s60/settingslistenerimpl.cpp
javamanager/javacaptain/extensionplugins/settingslistener/src.s60/settingslistenerimpl.h
javamanager/javacaptain/extensionplugins/settingslistener/src/settingslistenerextension.cpp
javamanager/javacaptain/inc.s60/tickerprovider.h
javamanager/javacaptain/inc/settingschangeeventsprovidermessages.h
javamanager/javacaptain/src.s60/tickerprovider.cpp
javamanager/javacaptain/src/tickerproviderinterface.h
javamanager/javacaptain/systemams/src/certificatesmanager.cpp
javamanager/javainstaller/appinstuiplugin/src/javainstalllauncher.cpp
javamanager/javainstaller/iconsizenotifplugin/build/bld.inf
javamanager/javainstaller/iconsizenotifplugin/build/javaiconsizenotifplugin.mmp
javamanager/javainstaller/iconsizenotifplugin/data/javaiconsizenotifplugin.rss
javamanager/javainstaller/iconsizenotifplugin/inc/iconsizenotifier.h
javamanager/javainstaller/iconsizenotifplugin/inc/iconsizeutils.h
javamanager/javainstaller/iconsizenotifplugin/src/iconsizenotifier.cpp
javamanager/javainstaller/installcopier/build/javainstallcopier.pro
javamanager/javainstaller/installcopier/src/javainstallcopier.cpp
javamanager/javainstaller/installer/build/build.xml
javamanager/javainstaller/installer/build/javainstaller.pro
javamanager/javainstaller/installer/javasrc.s60/com/nokia/mj/impl/installer/applicationregistrator/ApplicationRegistrator.java
javamanager/javainstaller/installer/javasrc.s60/com/nokia/mj/impl/installer/applicationregistrator/SifRegistrator.java
javamanager/javainstaller/installer/javasrc.s60/com/nokia/mj/impl/installer/utils/FileRoots.java
javamanager/javainstaller/installer/javasrc.s60/com/nokia/mj/impl/installer/utils/PropertyProvider.java
javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/Installer.java
javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/InstallerResultMessage.java
javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/midp2/install/steps/CheckJarPackages.java
javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/midp2/install/steps/ConvertIcons.java
javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/midp2/install/steps/FinalizeInstallation.java
javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/midp2/install/steps/PrepareInstallation.java
javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/midp2/install/steps/PrepareSplashScreen.java
javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/midp2/uninstall/steps/ConfirmUninstallation.java
javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/midp2/uninstall/steps/FinalizeUninstallation.java
javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/utils/PropertyListener.java
javamanager/javainstaller/installer/src.s60/applicationregistrator/applicationregistrator.cpp
javamanager/javainstaller/installer/src.s60/iconconverter/iconconverter.cpp
javamanager/javainstaller/installer/src.s60/iconconverter/iconconverter.h
javamanager/javainstaller/installer/src.s60/jadjarmatcher/jadjarmatcher.cpp
javamanager/javainstaller/installer/src.s60/jadjarmatcher/jadjarmatcherscanfrominbox.cpp
javamanager/javainstaller/installer/src.s60/utils/propertylistener.cpp
javamanager/javainstaller/installer/src.s60/utils/propertylistener.h
javamanager/javainstaller/installer/src.s60/utils/propertyprovider.cpp
javamanager/javainstaller/installer/tsrc/javasrc/com/nokia/mj/impl/installer/InstallerEngineTest.java
javamanager/javainstaller/installer/tsrc/javasrc/com/nokia/mj/impl/installer/utils/SysUtilTest.java
javamanager/javainstaller/installerui/data/javaapplicationinstaller.css
javamanager/javainstaller/installerui/javasrc/com/nokia/mj/impl/installer/ui/eswt/InstallConfirmationView.java
javamanager/javainstaller/installerui/javasrc/com/nokia/mj/impl/installer/ui/eswt/InstallerUiEswt.java
javamanager/javainstaller/installerui/javasrc/com/nokia/mj/impl/installer/ui/eswt/ViewBase.java
javamanager/javainstaller/installerui/javasrc/com/nokia/mj/impl/installer/ui/eswt2/InstallerUiEswt.java
javamanager/javainstaller/installerui/javasrc/com/nokia/mj/impl/installer/ui/eswt2/InstallerUiTexts.java
javamanager/javainstaller/installerui/javasrc/com/nokia/mj/impl/installer/ui/eswt2/UsernamePasswordView.java
javamanager/javainstaller/installerui/javasrc/com/nokia/mj/impl/installer/ui/eswt2/ViewBase.java
javamanager/javainstaller/javainstaller.pro
javamanager/javainstaller/javasifplugin/build/javasifplugin.mmp
javamanager/javainstaller/javasifplugin/inc/asyncwaitcallback.h
javamanager/javainstaller/javasifplugin/inc/javasifplugin.h
javamanager/javainstaller/javasifplugin/src/asyncwaitcallback.cpp
javamanager/javainstaller/javasifplugin/src/javasifplugin.cpp
javamanager/javainstaller/javasifplugin/tsrc/src.s60/main.cpp
javamanager/javainstaller/subsystem.mk
javamanager/javamanager.pro
javamanager/javaqtrequest/build/javaqtrequest.pro
javamanager/javaqtrequest/src.s60/main.cpp
javamanager/javaqtrequest/src.s60/requestapp.cpp
javamanager/javaqtrequest/src.s60/requestapp.h
javamanager/javarecognizer/src/recjar.cpp
javamanager/javaregistry/client/src/writeablejavaregistry.cpp
javamanager/javaregistry/client/src/writeablejavaregistryentry.cpp
javamanager/javaregistry/legacy/server/src/javaregstore.cpp
javamanager/javasettings/appsettingsview_qt/build/javaapplicationsettingsview.pro
javamanager/javasettings/appsettingsview_qt/inc/applicationsettingsview.h
javamanager/javasettings/appsettingsview_qt/src/javaapplicationsettings.cpp
javamanager/javasettings/appsettingsview_qt/src/javaapplicationsettings.h
javamanager/javasettings/appsettingsview_qt/src/javaapplicationsettingsview.cpp
javamanager/javasettings/appsettingsview_qt/src/javaapplicationsettingsview.h
javamanager/javasettings/appsettingsview_qt/src/javaapplicationsettingsview_p.cpp
javamanager/javasettings/appsettingsview_qt/src/javaapplicationsettingsview_p.h
javamanager/javasettings/javasettings.pro
javamanager/javasettings/subsystem.mk
javamanager/javasettings_qt/build/javaapplicationsettingsview.pro
javamanager/javasettings_qt/src/applicationsettingsview.h
javamanager/javasettings_qt/src/javaapplicationsettings.cpp
javamanager/javasettings_qt/src/javaapplicationsettings.h
javamanager/javasettings_qt/src/javaapplicationsettingsview.cpp
javamanager/javasettings_qt/src/javaapplicationsettingsview.h
javamanager/javasettings_qt/src/javaapplicationsettingsview_p.cpp
javamanager/javasettings_qt/src/javaapplicationsettingsview_p.h
javamanager/preinstaller/src.s60/silentmidletinstall.cpp
javamanager/subsystem.mk
javaruntimes/installer/starterdll/src/main.cpp
javaruntimes/javaruntimes.pro
javaruntimes/midp/runtime/build/build.xml
javaruntimes/midp/runtime/javasrc/com/nokia/mj/impl/rt/midp/StorageAccessor.java
javaruntimes/midp/runtime/src.s60/platformrequesthandler.cpp
javaruntimes/midp/runtimestarter/src/midpruntimestarter.cpp
javaruntimes/starter/build/javamidp.pro
javaruntimes/starterutils/build/exports.inf
javaruntimes/starterutils/inc/jvmstarter.h
javaruntimes/starterutils/src.s60/j9starters60.cpp
javaruntimes/starterutils/src.s60/j9starters60.h
javaruntimes/subsystem.mk
javatools/tckrunner/starter/src/main.cpp
javauis/amms_qt/build/build.xml
javauis/amms_qt/src_tuner/javasrc/com/nokia/amms/control/tuner/TunerControlImpl.java
javauis/amms_qt/src_tuner/javasrc/com/nokia/microedition/media/protocol/capture/radio/Protocol.java
javauis/amms_qt/src_tuner/native/external_include/fmradioenginecrkeys.h
javauis/amms_qt/src_tuner/native/external_include/tuner.h
javauis/amms_qt/src_tuner/native/external_include/tuner.inl
javauis/amms_qt/src_tuner/native/inc/ammstunerfactory.h
javauis/amms_qt/src_tuner/native/inc/cammstunercontrol.h
javauis/amms_qt/src_tuner/native/inc/cammstunerplayer.h
javauis/amms_qt/src_tuner/native/inc/cammstunerpresetshandler.h
javauis/amms_qt/src_tuner/native/inc/cammstunervolumecontrol.h
javauis/amms_qt/src_tuner/native/inc/tammstunerpreset.h
javauis/amms_qt/src_tuner/native/src/ammstunerfactory.cpp
javauis/amms_qt/src_tuner/native/src/cammstunercontrol.cpp
javauis/amms_qt/src_tuner/native/src/cammstunerplayer.cpp
javauis/amms_qt/src_tuner/native/src/cammstunerpresetshandler.cpp
javauis/amms_qt/src_tuner/native/src/cammstunervolumecontrol.cpp
javauis/amms_qt/src_tuner/native/src/protocol.cpp
javauis/amms_qt/src_tuner/native/src/tammstunerpreset.cpp
javauis/amms_qt/src_tuner/native/src/tunercontrol.cpp
javauis/eswt_qt/build/eswtqt/build.xml
javauis/eswt_qt/com.nokia.swt.extensions/extensions/org/eclipse/swt/internal/extension/ImageUtil.java
javauis/eswt_qt/com.nokia.swt.extensions/extensions/org/eclipse/swt/internal/extension/LabelExtension.java
javauis/eswt_qt/org.eclipse.swt/Eclipse SWT/qt/org/eclipse/swt/graphics/Image.java
javauis/eswt_qt/org.eclipse.swt/Eclipse SWT/qt/org/eclipse/swt/widgets/Composite.java
javauis/eswt_qt/org.eclipse.swt/Eclipse SWT/qt/org/eclipse/swt/widgets/Control.java
javauis/eswt_qt/org.eclipse.swt/Eclipse SWT/qt/org/eclipse/swt/widgets/Decorations.java
javauis/eswt_qt/org.eclipse.swt/Eclipse SWT/qt/org/eclipse/swt/widgets/Display.java
javauis/eswt_qt/org.eclipse.swt/Eclipse SWT/qt/org/eclipse/swt/widgets/Label.java
javauis/eswt_qt/org.eclipse.swt/Eclipse SWT/qt/org/eclipse/swt/widgets/Scrollable.java
javauis/eswt_qt/org.eclipse.swt/Eclipse SWT/qt/org/eclipse/swt/widgets/Widget.java
javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/library/eswt_widgets.pri
javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/library/graphics/gfxos.cpp
javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/library/graphics/graphics.h
javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/library/graphics/graphicsfactory.cpp
javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/library/graphics/qt/pixmap.cpp
javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/library/graphics/qt/pixmap.h
javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/library/os.cpp
javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/library/swtmobiledevice.cpp
javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/library/swtmobiledevice.h
javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/library/swts60.cpp
javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/org/eclipse/swt/graphics/Internal_GfxPackageSupport.java
javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/org/eclipse/swt/internal/qt/CommandArranger.java
javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/org/eclipse/swt/internal/qt/OS.java
javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/org/eclipse/swt/internal/qt/graphics/GraphicsContext.java
javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/org/eclipse/swt/internal/qt/graphics/Image.java
javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/org/eclipse/swt/internal/qt/graphics/ImageLoader.java
javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/org/eclipse/swt/internal/qt/graphics/JavaCommandBuffer.java
javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/org/eclipse/swt/internal/qt/graphics/OS.java
javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/org/eclipse/swt/widgets/Internal_PackageSupport.java
javauis/javalegacyutils/javasrc/com/nokia/mj/impl/rt/legacy/ToolkitInvoker.java
javauis/javalegacyutils/javasrc/com/nokia/mj/impl/rt/legacy/ToolkitObserverNGAExtension.java
javauis/javauis.pro
javauis/lcdui_qt/build/build.xml
javauis/lcdui_qt/src/javax/microedition/lcdui/Canvas.java
javauis/lcdui_qt/src/javax/microedition/lcdui/CanvasKeypad.java
javauis/lcdui_qt/src/javax/microedition/lcdui/ChoiceGroup.java
javauis/lcdui_qt/src/javax/microedition/lcdui/ChoiceGroupLayouter.java
javauis/lcdui_qt/src/javax/microedition/lcdui/ChoiceImpl.java
javauis/lcdui_qt/src/javax/microedition/lcdui/Command.java
javauis/lcdui_qt/src/javax/microedition/lcdui/CustomItem.java
javauis/lcdui_qt/src/javax/microedition/lcdui/CustomItemBufferLinux.java
javauis/lcdui_qt/src/javax/microedition/lcdui/CustomItemBufferSymbian.java
javauis/lcdui_qt/src/javax/microedition/lcdui/CustomItemLayouter.java
javauis/lcdui_qt/src/javax/microedition/lcdui/DateField.java
javauis/lcdui_qt/src/javax/microedition/lcdui/DateFieldLayouter.java
javauis/lcdui_qt/src/javax/microedition/lcdui/DefaultFormInteraction.java
javauis/lcdui_qt/src/javax/microedition/lcdui/DefaultFormLayoutPolicy.java
javauis/lcdui_qt/src/javax/microedition/lcdui/Display.java
javauis/lcdui_qt/src/javax/microedition/lcdui/Displayable.java
javauis/lcdui_qt/src/javax/microedition/lcdui/ESWTUIThreadRunner.java
javauis/lcdui_qt/src/javax/microedition/lcdui/Form.java
javauis/lcdui_qt/src/javax/microedition/lcdui/FormLayoutPolicy.java
javauis/lcdui_qt/src/javax/microedition/lcdui/FormLayouter.java
javauis/lcdui_qt/src/javax/microedition/lcdui/Gauge.java
javauis/lcdui_qt/src/javax/microedition/lcdui/GaugeLayouter.java
javauis/lcdui_qt/src/javax/microedition/lcdui/Graphics.java
javauis/lcdui_qt/src/javax/microedition/lcdui/ImageItem.java
javauis/lcdui_qt/src/javax/microedition/lcdui/ImageItemLayouter.java
javauis/lcdui_qt/src/javax/microedition/lcdui/Item.java
javauis/lcdui_qt/src/javax/microedition/lcdui/ItemLayouter.java
javauis/lcdui_qt/src/javax/microedition/lcdui/KeyTable.java
javauis/lcdui_qt/src/javax/microedition/lcdui/LCDUIInvokerImpl.java
javauis/lcdui_qt/src/javax/microedition/lcdui/LayoutObject.java
javauis/lcdui_qt/src/javax/microedition/lcdui/List.java
javauis/lcdui_qt/src/javax/microedition/lcdui/Row.java
javauis/lcdui_qt/src/javax/microedition/lcdui/Spacer.java
javauis/lcdui_qt/src/javax/microedition/lcdui/SpacerLayouter.java
javauis/lcdui_qt/src/javax/microedition/lcdui/StringItem.java
javauis/lcdui_qt/src/javax/microedition/lcdui/StringItemLayouter.java
javauis/lcdui_qt/src/javax/microedition/lcdui/TextBox.java
javauis/lcdui_qt/src/javax/microedition/lcdui/TextField.java
javauis/lcdui_qt/src/javax/microedition/lcdui/TextFieldLayouter.java
javauis/lcdui_qt/tsrc/src/com/nokia/openlcdui/mt/AllTests.java
javauis/lcdui_qt/tsrc/src/com/nokia/openlcdui/mt/graphics/CommandBufferingTest.java
javauis/m3g_qt/build/build.xml
javauis/mmapi_qt/animated_gif_notUsed/inc/cmmaanimationframepositioningcontrol.h
javauis/mmapi_qt/animated_gif_notUsed/inc/cmmaanimationplayer.h
javauis/mmapi_qt/animated_gif_notUsed/inc/cmmaanimationplayerfactory.h
javauis/mmapi_qt/animated_gif_notUsed/inc/cmmaanimationratecontrol.h
javauis/mmapi_qt/animated_gif_notUsed/inc/cmmaanimationstoptimecontrol.h
javauis/mmapi_qt/animated_gif_notUsed/inc/cmmaanimationwindow.h
javauis/mmapi_qt/animated_gif_notUsed/src/cmmaanimationframepositioningcontrol.cpp
javauis/mmapi_qt/animated_gif_notUsed/src/cmmaanimationplayer.cpp
javauis/mmapi_qt/animated_gif_notUsed/src/cmmaanimationplayerfactory.cpp
javauis/mmapi_qt/animated_gif_notUsed/src/cmmaanimationratecontrol.cpp
javauis/mmapi_qt/animated_gif_notUsed/src/cmmaanimationstoptimecontrol.cpp
javauis/mmapi_qt/animated_gif_notUsed/src/cmmaanimationwindow.cpp
javauis/mmapi_qt/baseline/inc.nga/cmmasurfacewindow.h
javauis/mmapi_qt/baseline/inc/mmmadisplaywindow.h
javauis/mmapi_qt/baseline/javasrc.emc/com/nokia/microedition/media/ManagerImpl.java
javauis/mmapi_qt/baseline/javasrc/com/nokia/microedition/media/animation/AnimationPlayer.java
javauis/mmapi_qt/baseline/javasrc/com/nokia/microedition/media/animation/AnimationPlayerFactory.java
javauis/mmapi_qt/baseline/javasrc/com/nokia/microedition/media/animation/VideoControl.java
javauis/mmapi_qt/baseline/javasrc/com/nokia/microedition/media/control/BaseDisplay.java
javauis/mmapi_qt/baseline/javasrc/com/nokia/microedition/media/control/ItemDisplay.java
javauis/mmapi_qt/baseline/javasrc/com/nokia/microedition/media/control/MMAeSWTDisplay.java
javauis/mmapi_qt/baseline/javasrc/com/nokia/microedition/media/control/VideoControl.java
javauis/mmapi_qt/baseline/src.nga/cmmasurfacewindow.cpp
javauis/mmapi_qt/baseline/src/cmmacamerawindow.cpp
javauis/mmapi_qt/baseline/src/cmmacanvasdisplay.cpp
javauis/mmapi_qt/baseline/src/cmmadisplay.cpp
javauis/mmapi_qt/baseline/src/cmmavideocontrol.cpp
javauis/mmapi_qt/baseline/src/itemdisplayjni.cpp
javauis/mmapi_qt/baseline/src/outputstreamwriter.cpp
javauis/mmapi_qt/build/build.xml
javauis/nokiauiapi_qt/.classpath
javauis/nokiauiapi_qt/.project
javauis/nokiauiapi_qt/build/build.xml
javauis/nokiauiapi_qt/build/javanokiaui.pro
javauis/nokiauiapi_qt/build/nokiauiapiqt.pro
javauis/tsrc/fute/lcdui/Midp_StringItem_01/build.xml
javauis/tsrc/fute/lcdui/Midp_StringItem_01/src/FormStringItemTests.java
layers.sysdef.xml
rom/java_2_2.iby
rom/java_3_1.iby
--- a/build/Makefile.comp	Tue Jul 06 14:10:26 2010 +0300
+++ b/build/Makefile.comp	Wed Aug 18 09:43:15 2010 +0300
@@ -151,11 +151,11 @@
 	echo #include "exports.inf" >> bld.inf
 endif
 
+# Quick java releasables target
+RELEASABLE_PATH = $(EPOCROOT)epoc32/release/$(PLATFORM)/$(CFG)/z/resource/java/jvm/lib/jrt
 javareleasables:
 ifneq ($(ANT_FILE),)
-	$(ANT) -q -Dtarget.platform=$(PLATFORM) -Dtarget.cfg=$(VARIANT) $(ANT_PROJECT_DEFINES) releasables > $(DEVNULL)
-	$(call CATCOMMAND,java_releasables_$(PLATFORM)_$(VARIANT).tmp)
-	$(call RMFILE,java_releasables_$(PLATFORM)_$(VARIANT).tmp)
+	echo $(RELEASABLE_PATH)/$(BASENAME).odc
 endif
 
 # Remove all generated build files
--- a/build/Makefile.defs	Tue Jul 06 14:10:26 2010 +0300
+++ b/build/Makefile.defs	Wed Aug 18 09:43:15 2010 +0300
@@ -262,10 +262,9 @@
 endif
 
 generatereleasefile:
-ifeq ($(origin RD_JAVA_S60_RELEASE),command line)
 	@echo Writing $(RD_JAVA_S60_RELEASE_FILE) ... \
+	$(shell $(call CATCOMMAND,$(JAVA_SRC_ROOT)/build/templates/generated_header_hash.txt) > $(RD_JAVA_S60_RELEASE_FILE)) \
 	$(shell echo RD_JAVA_S60_RELEASE=$(RD_JAVA_S60_RELEASE)>$(RD_JAVA_S60_RELEASE_FILE))
-endif
 
 # Clean file on clean_generated
 clean_configure: clean_conffiles
--- a/build/buildutils/svnchangeids.py	Tue Jul 06 14:10:26 2010 +0300
+++ b/build/buildutils/svnchangeids.py	Wed Aug 18 09:43:15 2010 +0300
@@ -59,6 +59,7 @@
     re_change_id = re.compile("(\w+\#\d+)\s*,?", re.I | re.M)
     re_change_id_keyword = re.compile(change_id_keyword + "[:=]?\s*(\w+\#\d+)",
                                       re.I | re.M)
+    re_change_id_keyword_only = re.compile(change_id_keyword, re.I | re.M)
     svn_change_ids = {}
     cmd = "svn log -r " + rev_2 + ":" + rev_1 + " " + url
     #print cmd
@@ -67,6 +68,11 @@
         if rev:
             current_rev = rev[0]
         change_ids = re_change_id_keyword.findall(line)
+        change_id_keywords = re_change_id_keyword_only.findall(line)
+        if len(change_id_keywords) > len(change_ids):
+            print "WARNING: Rev " + current_rev + \
+                " has more matching changeid keywords" + \
+                " than matching change ids."
         while change_ids:
             for change_id in change_ids:
                 if change_id in svn_change_ids:
Binary file build/loc/resources.jar has changed
Binary file build/loc/resources_qt.jar has changed
--- a/build/makefile	Tue Jul 06 14:10:26 2010 +0300
+++ b/build/makefile	Wed Aug 18 09:43:15 2010 +0300
@@ -61,6 +61,9 @@
 	javatools \
 	javaextensions
 
+# Set order explicitly to get Java building as first
+SUBTARGETS = $(COMPONENTS) $(NONQTSUBSYSTEMS) $(SUBSYSTEMS)
+
 # -------------------------------------------------------
 
 include ${JAVA_SRC_ROOT}/build/Makefile.subsystem
--- a/build/makefile.javaversion	Tue Jul 06 14:10:26 2010 +0300
+++ b/build/makefile.javaversion	Wed Aug 18 09:43:15 2010 +0300
@@ -1,2 +1,2 @@
 # Set Java version (must be dot separated, without spaces)
-JAVA_VERSION = 2.2.3
+JAVA_VERSION = 2.2.9
--- a/build/nativejava.flm	Tue Jul 06 14:10:26 2010 +0300
+++ b/build/nativejava.flm	Wed Aug 18 09:43:15 2010 +0300
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+# Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
 # All rights reserved.
 # This component and the accompanying materials are made available
 # under the terms of "Eclipse Public License v1.0"
@@ -23,23 +23,67 @@
 #  therefore the jrt-directory is found from finding first directory having
 #  subsystem.mk, going up to max. three directory levels)
 
-JAVABUILDDIR = $(dir $(firstword $(wildcard $(TO_BLDINF)/subsystem.mk $(TO_BLDINF)/../subsystem.mk $(TO_BLDINF)/../../subsystem.mk)))
+JAVABUILDDIR:= $(dir $(firstword $(wildcard $(TO_BLDINF)/subsystem.mk $(TO_BLDINF)/../subsystem.mk $(TO_BLDINF)/../../subsystem.mk)))
 
-JAVABUILDCMD = make -C $(JAVABUILDDIR) -f subsystem.mk EPOCROOT=$(EPOCROOT)/ \
+# General Java makefile command
+JAVACMD:= make -C $(JAVABUILDDIR) -f subsystem.mk EPOCROOT=$(EPOCROOT)/ \
                PLATFORM=$(PLATFORM) CFG=$(CFG) BLD_INF_JAVA=1
 
-define java_build
-RESOURCE::
+# General build command, targetting armv5 urel files
+JAVABUILDCMD:= make -C $(JAVABUILDDIR) -f subsystem.mk EPOCROOT=$(EPOCROOT)/ \
+               PLATFORM=armv5 CFG=urel BLD_INF_JAVA=1 java finalactions
+
+# Marker file to prevent multiple Java compilations of the
+# same platform/cfg, when building e.g. device variants.
+NATIVEJAVAMARKER := $(EPOCBLD)/nativejavamarker_$(PLATFORM)_$(CFG).done
+
+# Java build artifact file source and target
+JAVABUILD_ARTIFACT_SRC := $(EPOCROOT)/epoc32/release/armv5/urel
+JAVABUILD_ARTIFACT_DST := $(EPOCROOT)/epoc32/release/$(PLATFORM)/$(CFG)
+
+define compilenativejava
+
+# This is the general Java compilation, done once for the component
+ifeq ($(GUARD_nativejavatarget),)
+GUARD_nativejavatarget:=1
+.PHONY:: nativejavatarget
+nativejavatarget:
 	$(call startrule,compilenativejava,,javasources) \
-	$(JAVABUILDCMD) java finalactions\
+	$(JAVABUILDCMD) \
 	$(call endrule,compilenativejava)
+endif 
+
+# Actual resource target, one for each platform/cfg variant
+ifeq ($(GUARD_$(call sanitise,$(NATIVEJAVAMARKER))),)
+GUARD_$(call sanitise,$(NATIVEJAVAMARKER)):=1
+
+RESOURCE:: $(NATIVEJAVAMARKER)
+
+# Copy the build artifacts to target
+$(NATIVEJAVAMARKER): nativejavatarget
+ifeq ($(filter armv5_urel ARMV5_urel ARMV5_UREL,$(PLATFORM)_$(CFG)),)
+	$(call makepath,$(JAVABUILD_ARTIFACT_DST)/z/resource/java/jvm/lib/jrt)
+	$(call makepath,$(JAVABUILD_ARTIFACT_DST)/z/resource/java/security)
+	$(call startrule,copynativejavaresults) \
+	$(foreach f,java_impl_cdc.jar java_impl_cldc.jar java_platform_api.jar java_public_api.jar java_signature_test.jar, $(GNUCP) -v $(JAVABUILD_ARTIFACT_SRC)/$f $(JAVABUILD_ARTIFACT_DST) &&) \
+	$(GNUCP) -Rv $(JAVABUILD_ARTIFACT_SRC)/z/resource/java/jvm/lib/jrt $(JAVABUILD_ARTIFACT_DST)/z/resource/java/jvm/lib && \
+	$(GNUCP) -Rv $(JAVABUILD_ARTIFACT_SRC)/z/resource/java/security $(JAVABUILD_ARTIFACT_DST)/z/resource/java \
+	$(call endrule,copynativejavaresults)
+endif
+endif
+
+# Use normal clean for all variants
 CLEAN::
 	$(call startrule,cleannativejava,,javasources) \
-	$(JAVABUILDCMD) clean_java \
+	$(JAVACMD) clean_java \
 	$(call endrule,cleannativejava)
 endef
 
-$(eval $(java_build))
+$(eval $(compilenativejava))
 
-RELEASABLES = $(shell $(JAVABUILDCMD) -s javareleasables)
+RELEASABLES:= $(shell $(JAVACMD) -s javareleasables)
 $(eval $(call whatmacro,$(RELEASABLES),WHATRESOURCES))
+
+$(eval $(call GenerateStandardCleanTarget,$(NATIVEJAVAMARKER)))
+
+
--- a/build/properties.xml	Tue Jul 06 14:10:26 2010 +0300
+++ b/build/properties.xml	Wed Aug 18 09:43:15 2010 +0300
@@ -41,12 +41,23 @@
       for reason why this property is defined"/> -->
   <property name="platform.utilities.xml.file" value="utilities.fake.xml"/>
 
-  <!--The cldc/cdc class file locations -->
-  <property name="bootclasspath.cldc" location="${java.src.root}/inc/classes.cldc.zip"/>
-  <property name="bootclasspath.cdc"  location="${java.src.root}/inc/classes.cdc.zip"/>
-  <property name="bootclasspath.fp"   location="${java.src.root}/inc/classes.fp.zip"/>
-  
-  
+  <!-- Set internal epoc root -->
+  <condition property="epocroot" value="${env.EPOCROOT}" else="">
+    <isset property="env.EPOCROOT"/>
+  </condition>
+
+  <!--The cldc/cdc class file locations, within the sources -->
+  <available file="${java.src.root}/inc/classes.cldc.zip" property="bootclasspath.cldc"
+             value="${java.src.root}/inc/classes.cldc.zip" />
+  <available file="${java.src.root}/inc/classes.cdc.zip" property="bootclasspath.cdc"
+             value="${java.src.root}/inc/classes.cdc.zip" />
+  <available file="${java.src.root}/inc/classes.fp.zip" property="bootclasspath.fp"
+             value="${java.src.root}/inc/classes.fp.zip" />
+
+  <!--The cldc/cdc class file locations, external if not found in default places -->
+  <property name="bootclasspath.cldc" location="${epocroot}epoc32/jrt/classes.cldc.zip"/>
+  <property name="bootclasspath.cdc"  location="${epocroot}epoc32/jrt/classes.cdc.zip"/>
+  <property name="bootclasspath.fp"   location="${epocroot}epoc32/jrt/classes.fp.zip"/>
   
   <!--NOTE!!! Properties defined below can be used only inside a target-->
 
@@ -60,13 +71,6 @@
       <equals arg1="${target.cfg}" arg2="debug"/>
 	</condition>
 
-    <!-- Set internal epoc root -->
-	<condition property="epocroot"
-               value="${env.EPOCROOT}"
-               else="">
-      <isset property="env.EPOCROOT"/>
-	</condition>
-
     <!--Location of eswt.jar. This is not needed in S60 Avkon, 
         but needed in S60 Qt. -->
     <property name="eswt.jar" value=":${java.src.root}/javauis/bin/eswt.jar"/>
--- a/build/sis/java_2_0.pkg	Tue Jul 06 14:10:26 2010 +0300
+++ b/build/sis/java_2_0.pkg	Wed Aug 18 09:43:15 2010 +0300
@@ -488,6 +488,7 @@
 "\epoc32\release\armv5\urel\jvmnativeport.dll"-"c:\sys\bin\jvmnativeport.dll"
 "\epoc32\release\armv5\urel\midp2backupplugin.dll"-"c:\sys\bin\midp2backupplugin.dll"
 "\epoc32\release\armv5\urel\javadebugapi.dll"-"c:\sys\bin\javadebugapi.dll"
+"\epoc32\release\armv5\urel\javastarter.dll"-"c:\sys\bin\javastarter.dll"
 
 #ifdef RD_JAVA_S60_RELEASE_5_0_IAD
 "\epoc32\release\armv5\urel\midp2cenrep.dll"-"c:\sys\bin\midp2cenrep.dll"
@@ -826,3 +827,9 @@
 ; javaappbackconverter is ran after uninstallation
 "\epoc32\release\armv5\urel\javaappbackconverter.exe"-"c:\sys\bin\javaappbackconverter.exe", FR, RR, RW
 #endif // RD_JAVA_S60_RELEASE_5_0_IAD
+
+
+#ifndef RD_JAVA_S60_RELEASE_5_0_IAD
+"\epoc32\release\armv5\urel\javaiconsizenotifplugin.dll"-"c:\sys\bin\javaiconsizenotifplugin.dll"
+"\epoc32\data\z\resource\plugins\javaiconsizenotifplugin.rsc"-"c:\resource\plugins\javaiconsizenotifplugin.rsc"
+#endif // RD_JAVA_S60_RELEASE_5_0_IAD
--- a/build/sis/java_3_1.pkg	Tue Jul 06 14:10:26 2010 +0300
+++ b/build/sis/java_3_1.pkg	Wed Aug 18 09:43:15 2010 +0300
@@ -50,6 +50,8 @@
 "\epoc32\release\armv5\urel\javabackup.exe"-"c:\sys\bin\javabackup.exe"
 "\epoc32\release\armv5\urel\javacaptain.exe"-"c:\sys\bin\javacaptain.exe"
 "\epoc32\release\armv5\urel\javalauncher.exe"-"c:\sys\bin\javalauncher.exe"
+"\epoc32\release\armv5\urel\javaappscheme.exe"-"c:\sys\bin\javaappscheme.exe"
+"\epoc32\release\armv5\urel\javaqtrequest.exe"-"c:\sys\bin\javaqtrequest.exe"
 "\epoc32\release\armv5\urel\javaupgradeapp.exe"-"c:\sys\bin\javaupgradeapp.exe"
 
 ;Odc file lists
@@ -165,7 +167,6 @@
 
 ; Misc dlls
 
-"\epoc32\release\armv5\urel\javaappschemeplugin.dll"-"c:\sys\bin\javaappschemeplugin.dll"
 "\epoc32\release\armv5\urel\javabtl2capscplugin.dll"-"c:\sys\bin\javabtl2capscplugin.dll"
 "\epoc32\release\armv5\urel\javabtsppscplugin.dll"-"c:\sys\bin\javabtsppscplugin.dll"
 "\epoc32\release\armv5\urel\javabtgoepscplugin.dll"-"c:\sys\bin\javabtgoepscplugin.dll"
@@ -190,7 +191,9 @@
 "\epoc32\release\armv5\urel\javadebugapi.dll"-"c:\sys\bin\javadebugapi.dll"
 #ifdef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK
 "\epoc32\release\armv5\urel\javasifplugin.dll"-"c:\sys\bin\javasifplugin.dll"
+"\epoc32\release\armv5\urel\javainstallcopier.exe"-"c:\sys\bin\javainstallcopier.exe"
 #endif
+"\epoc32\release\armv5\urel\javastarter.dll"-"c:\sys\bin\javastarter.dll"
 
 ; to enable JVM argument modifier - comment 1st line below and uncomment 2nd line below
 "\epoc32\release\armv5\urel\javajvmargsmodifier.dll"-"c:\sys\bin\javajvmargsmodifier.dll"
@@ -215,7 +218,6 @@
 #endif
 
 ; resources
-"\epoc32\data\z\resource\plugins\javaappschemeplugin.rsc"     -"c:\resource\plugins\javaappschemeplugin.rsc"
 "\epoc32\winscw\c\private\102033E6\installer\inst_plugins.cfg"-"c:\private\102033E6\installer\inst_plugins.cfg"
 "\epoc32\data\Z\Resource\versions\java.txt"-"c:\resource\versions\java.txt"
 "\epoc32\data\z\resource\java\java_app_92.mif"-"c:\resource\java\java_app.mif"
@@ -350,3 +352,5 @@
 "\epoc32\release\armv5\urel\z\resource\java\jvm\lib\jrt\openlcdui.odc"-"c:\resource\java\jvm\lib\jrt\openlcdui.odc"
 "\epoc32\release\armv5\urel\z\resource\java\jvm\lib\jrt\javanokiaui.odc"-"c:\resource\java\jvm\lib\jrt\javanokiaui.odc"
 
+"\epoc32\release\armv5\urel\javaapplicationsettingsview.dll"-"c:\sys\bin\javaapplicationsettingsview.dll"
+"\epoc32\data\z\resource\qt\plugins\appsettings\javaapplicationsettingsview.qtplugin"-"c:\resource\qt\plugins\appsettings\javaapplicationsettingsview.qtplugin"
--- a/build/templates/10.1.layers.sysdef.xml	Tue Jul 06 14:10:26 2010 +0300
+++ b/build/templates/10.1.layers.sysdef.xml	Wed Aug 18 09:43:15 2010 +0300
@@ -12,26 +12,12 @@
               qmakeArgs="-r"
               filter="!sf_build" />
       </module>
-      
-<!--  When releasing to SF, change the sf_build to this.
       <module name="jrt_sf">
         <unit name="jrt_sf" unitID="jrt.jrt_sf" mrp=""
               bldFile="&layer_real_source_path;" proFile="jrt.pro"
               qmakeArgs="-r RD_JAVA_SF_BUILD=1"
               filter="sf_build" />
       </module>
--->
-      <module name="jrt">
-        <unit name="jrt_jrt_plat" unitID="jrt.jrt.jrt_plat" mrp=""
-              bldFile="&layer_real_source_path;/jrt_plat/group"
-              filter="sf_build"  />
-      </module>
-      <module name="jrt">
-        <unit name="jrt_jrt_stubs" unitID="jrt.jrt.java_stubs" mrp=""
-              bldFile="&layer_real_source_path;/java_stubs/group"
-              filter="sf_build" />
-      </module>
-      
     </layer>
   </systemModel>
 </SystemDefinition>
--- a/build/templates/9.2.layers.sysdef.xml	Tue Jul 06 14:10:26 2010 +0300
+++ b/build/templates/9.2.layers.sysdef.xml	Wed Aug 18 09:43:15 2010 +0300
@@ -10,22 +10,10 @@
         <unit unitID="jrt.jrt" mrp="" bldFile="&layer_real_source_path;/group"
         filter="!sf_build" name="jrt" />
       </module>      
-
-<!--  When releasing to SF, change the sf_build to this.      
       <module name="jrt_sf">
         <unit unitID="jrt.jrt_sf" mrp="" bldFile="&layer_real_source_path;/group/sf"
         filter="sf_build" name="jrt_sf" />
       </module>
--->
-      <module name="jrt">
-        <unit unitID="jrt.jrt.jrt_plat" mrp="" bldFile="&layer_real_source_path;/jrt_plat/group"
-        filter="sf_build" name="jrt_jrt_plat" />
-      </module>
-      <module name="jrt">
-        <unit unitID="jrt.jrt.java_stubs" mrp="" bldFile="&layer_real_source_path;/java_stubs/group"
-        filter="sf_build" name="jrt_jrt_stubs" />
-      </module>
-      
     </layer>
   </systemModel>
 </SystemDefinition>
--- a/inc/build_defines.hrh	Tue Jul 06 14:10:26 2010 +0300
+++ b/inc/build_defines.hrh	Wed Aug 18 09:43:15 2010 +0300
@@ -15,7 +15,7 @@
 *
 */
 
-#define RD_JAVA_VERSION 2,2,2 
+#define RD_JAVA_VERSION 2,2,9 
 #define RD_JAVA_SYMBIAN_TARGET 
 #define RD_JAVA_S60_RELEASE_10_1 
 #define RD_JAVA_S60_RELEASE_10_1_ONWARDS 
--- a/inc/java.txt	Tue Jul 06 14:10:26 2010 +0300
+++ b/inc/java.txt	Wed Aug 18 09:43:15 2010 +0300
@@ -1,1 +1,1 @@
-2.2.3
+2.2.9
--- a/javacommons/comms/build/comms.pro	Tue Jul 06 14:10:26 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,24 +0,0 @@
-#
-# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-# All rights reserved.
-# This component and the accompanying materials are made available
-# under the terms of "Eclipse Public License v1.0"
-# which accompanies this distribution, and is available
-# at the URL "http://www.eclipse.org/legal/epl-v10.html".
-#
-# Initial Contributors:
-# Nokia Corporation - initial contribution.
-#
-# Contributors:
-#
-# Description: 
-#
-
-TEMPLATE=lib
-TARGET=javacomms
-CONFIG += omj java staticdata stl
-CONFIG -= qt
-LIBS += -ljavaipc
-
-
-include(../../../build/omj.pri)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javacommons/comms/build/javacomms.pro	Wed Aug 18 09:43:15 2010 +0300
@@ -0,0 +1,24 @@
+#
+# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+#
+# Contributors:
+#
+# Description: 
+#
+
+TEMPLATE=lib
+TARGET=javacomms
+CONFIG += omj java staticdata stl
+CONFIG -= qt
+LIBS += -ljavaipc
+
+
+include(../../../build/omj.pri)
--- a/javacommons/comms/comms.pro	Tue Jul 06 14:10:26 2010 +0300
+++ b/javacommons/comms/comms.pro	Wed Aug 18 09:43:15 2010 +0300
@@ -15,6 +15,6 @@
 #
 TEMPLATE = subdirs
 SUBDIRS += ipclib/clientserver/build/ipc.pro 
-SUBDIRS += build/comms.pro 
+SUBDIRS += build/javacomms.pro 
 BLD_INF_RULES.prj_extensions += "$${LITERAL_HASH}include \"ipclib/build/bld.inf\""  
 BLD_INF_RULES.prj_extensions += "prj_extensions" 
--- a/javacommons/comms/src/commsendpoint.cpp	Tue Jul 06 14:10:26 2010 +0300
+++ b/javacommons/comms/src/commsendpoint.cpp	Wed Aug 18 09:43:15 2010 +0300
@@ -295,12 +295,13 @@
             break;
 
         case ETIMEDOUT:
+        default:
             mSendReceiveListeners.erase(messageRef);
             done = 1;
-            break;
-
-        default:
-            ELOG2(EJavaComms, "pthread_cond_timedwait failed %d - %s", rc, strerror(rc));
+            if (rc != ETIMEDOUT)
+            {
+                ELOG2(EJavaComms, "pthread_cond_timedwait failed %d - %s", rc, strerror(rc));
+            }
             break;
         }
     }
--- a/javacommons/connectionmanager/src.s60/connectionmanager.cpp	Tue Jul 06 14:10:26 2010 +0300
+++ b/javacommons/connectionmanager/src.s60/connectionmanager.cpp	Wed Aug 18 09:43:15 2010 +0300
@@ -93,7 +93,7 @@
         mgr->ReadDefConnL(obj);
         id = obj.iId;
         type = obj.iType;
-        if ((type ==ECmDefConnConnectionMethod) && (type == aMatchIapId))
+        if ((type ==ECmDefConnConnectionMethod) && (id == aMatchIapId))
         {
             return true;
         }
--- a/javacommons/fileutils/build/fileutils.pro	Tue Jul 06 14:10:26 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,26 +0,0 @@
-#
-# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-# All rights reserved.
-# This component and the accompanying materials are made available
-# under the terms of "Eclipse Public License v1.0"
-# which accompanies this distribution, and is available
-# at the URL "http://www.eclipse.org/legal/epl-v10.html".
-#
-# Initial Contributors:
-# Nokia Corporation - initial contribution.
-#
-# Contributors:
-#
-# Description: 
-#
-
-TARGET=javafileutils
-TEMPLATE=lib
-CONFIG += omj java staticdata stl
-CONFIG -= qt
-
-symbian : LIBS += -lefsrv -lPlatformEnv -lcaf
-
-LIBS+= -ljavautils -ljavacomms
-
-include(../../../build/omj.pri)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javacommons/fileutils/build/javafileutils.pro	Wed Aug 18 09:43:15 2010 +0300
@@ -0,0 +1,26 @@
+#
+# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+#
+# Contributors:
+#
+# Description: 
+#
+
+TARGET=javafileutils
+TEMPLATE=lib
+CONFIG += omj java staticdata stl
+CONFIG -= qt
+
+symbian : LIBS += -lefsrv -lPlatformEnv -lcaf
+
+LIBS+= -ljavautils -ljavacomms
+
+include(../../../build/omj.pri)
--- a/javacommons/fileutils/javasrc/com/nokia/mj/impl/fileutils/FileURL.java	Tue Jul 06 14:10:26 2010 +0300
+++ b/javacommons/fileutils/javasrc/com/nokia/mj/impl/fileutils/FileURL.java	Wed Aug 18 09:43:15 2010 +0300
@@ -23,7 +23,7 @@
  * differences between URL and Absolute path and make it transparent to use
  * from.
  */
-final class FileURL
+public final class FileURL
 {
     private static String FILE_PREFIX = "file://";
 
--- a/javacommons/gcfprotocols/file/javasrc/com/nokia/mj/impl/file/FileConnectionImpl.java	Tue Jul 06 14:10:26 2010 +0300
+++ b/javacommons/gcfprotocols/file/javasrc/com/nokia/mj/impl/file/FileConnectionImpl.java	Wed Aug 18 09:43:15 2010 +0300
@@ -254,7 +254,7 @@
             curUrl = curUrl.substring(0, curUrl.length() - 1);
         }
         String newUrl = curUrl.substring(0, curUrl.lastIndexOf('/') + 1);
-        newUrl += iFileUtility.getName();
+        newUrl += FileUTF8Handler.encode(iFileUtility.getName());
 
         iFileConnectionUrl = new FileConnectionURL(newUrl);
     }
@@ -409,10 +409,6 @@
         checkConnection();
         checkConnectionMode(Connector.WRITE);
 
-        if (Connector.READ == iMode)
-        {
-            return false;
-        }
         return iFileUtility.canWrite();
     }
 
--- a/javacommons/gcfprotocols/http/build/javahttp.pro	Tue Jul 06 14:10:26 2010 +0300
+++ b/javacommons/gcfprotocols/http/build/javahttp.pro	Wed Aug 18 09:43:15 2010 +0300
@@ -21,16 +21,7 @@
 
 symbian {
 
-    LIBS += -leuser -lhttp -lecom -lbafl -linetprotutil -lhttpfiltercommon -lx509 -lx500 -lcrypto -lesock -lcommdb -lcentralrepository
-
-    contains(PROJECT_DEFINES,RD_JAVA_S60_RELEASE_10_1_ONWARDS) {
-        QT += webkit
-        QT -= gui
-        LIBS += -lQtWebKit -lplatformEnv -ljavaenvinfo
-    }
-    else {
-        LIBS += -lwebutils
-    }
+    LIBS += -leuser -lhttp -lecom -lbafl -linetprotutil -lhttpfiltercommon -lx509 -lx500 -lcrypto -lesock -lcommdb -lcentralrepository -lwebutils
 
     contains(PROJECT_DEFINES,RD_JAVA_S60_RELEASE_5_0) {
         LIBS += -lcommdb
--- a/javacommons/gcfprotocols/http/inc.s60/javauseragent.h	Tue Jul 06 14:10:26 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,31 +0,0 @@
-/*
-* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-#ifndef GETUSERAGENT_H
-#define GETUSERAGENT_H
-
-#include <e32base.h>
-
-class JavaUserAgent
-{
-
-public:
-    static HBufC*  GetUserAgentL();
-
-};
-
-#endif /* GETUSERAGENT_H */
--- a/javacommons/gcfprotocols/http/src.s60/javauseragent.cpp	Tue Jul 06 14:10:26 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,74 +0,0 @@
-/*
-* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-#include "javauseragent.h"
-#ifdef RD_JAVA_S60_RELEASE_10_1_ONWARDS
-#include <QWebpage.h>
-#include "javaenvinfo.h"
-#else
-#include <cuseragent.h>
-#endif
-
-#ifdef RD_JAVA_S60_RELEASE_10_1_ONWARDS
-class Page: public QWebPage
-{
-public:
-    QString  userAgentForUrl ( const QUrl & url ) const;
-
-};
-
-QString  Page::userAgentForUrl ( const QUrl & url ) const
-{
-    return url.toString();
-}
-#endif
-
-HBufC*  JavaUserAgent::GetUserAgentL()
-{
-#ifdef RD_JAVA_S60_RELEASE_10_1_ONWARDS
-    /*QApplication app();
-    QUrl uri;
-    Page page;
-    QString webUserAgent = page.userAgentForUrl(uri);
-    HBufC* agent = HBufC::NewMaxLC(webUserAgent.length());
-    agent->Des().Copy(webUserAgent.utf16());
-    agent->Des().Append(*(Java::JavaEnvInfo::GetUserAgentHeaderL()));
-    return agent;
-    */
-    _LIT(KString,"null");
-    HBufC* agent = HBufC::NewLC(5);
-    *agent = KString;
-    CleanupStack::Pop(agent);
-    return agent;
-
-#else
-
-    CUserAgent* userAgent = CUserAgent::NewL();
-    CleanupStack::PushL(userAgent);
-
-    HBufC8* agent8 = userAgent->UserAgentL();
-    CleanupStack::PushL(agent8);
-
-    HBufC* agent = HBufC::NewMaxLC(agent8->Length());
-    agent->Des().Copy(*agent8);
-
-    CleanupStack::Pop(agent);
-    CleanupStack::PopAndDestroy(agent8);
-    CleanupStack::PopAndDestroy(userAgent);
-   	return agent;
-#endif
-}
--- a/javacommons/gcfprotocols/http/src.s60/nativehttptraansaction.cpp	Tue Jul 06 14:10:26 2010 +0300
+++ b/javacommons/gcfprotocols/http/src.s60/nativehttptraansaction.cpp	Wed Aug 18 09:43:15 2010 +0300
@@ -135,7 +135,7 @@
                     narrowBuffer = HBufC8::NewLC(length);
                     TPtr8 narrowPtr = narrowBuffer->Des();
                     narrowPtr.Copy(rawHeader);
-                    rawHeaderArray.Append(narrowBuffer);
+                    rawHeaderArray.AppendL(narrowBuffer);
                     CleanupStack::Pop(narrowBuffer);
                 }
                 aJni->DeleteLocalRef(jniString);
--- a/javacommons/gcfprotocols/http/src.s60/nativetransaction.cpp	Tue Jul 06 14:10:26 2010 +0300
+++ b/javacommons/gcfprotocols/http/src.s60/nativetransaction.cpp	Wed Aug 18 09:43:15 2010 +0300
@@ -19,13 +19,18 @@
 #include <e32def.h>
 #include <centralrepository.h>
 
+#ifdef RD_JAVA_S60_RELEASE_10_1_ONWARDS
+#include <cuseragent.h>
+#else
+#include <cuseragent.h>
+#endif
+
 #include "com_nokia_mj_impl_http_HttpConnectionNative.h"
 #include "nativehttptransaction.h"
 #include "nativehttpsession.h"
 #include "monitor.h"
 #include "logger.h"
 #include "s60commonutils.h"
-#include "javauseragent.h"
 
 using namespace java::util;
 
@@ -215,14 +220,23 @@
 
 jstring GetUserAgentL(JNIEnv *aJni, jboolean aMidpRuntime)
 {
-    LOG(ESOCKET,EInfo,"GetUserAgentL() +");
     jstring header = NULL;
 
     if (aMidpRuntime == false)
     {
-        HBufC* stringBufPtr  = JavaUserAgent::GetUserAgentL();
-        header = S60CommonUtils::NativeToJavaString(*aJni,stringBufPtr->Des());
-        delete stringBufPtr;
+        CUserAgent* userAgent = CUserAgent::NewL();
+        CleanupStack::PushL(userAgent);
+
+        HBufC8* agent8 = userAgent->UserAgentL();
+        CleanupStack::PushL(agent8);
+        HBufC* agent = HBufC::NewMaxLC(agent8->Length());
+        agent->Des().Copy(*agent8);
+        header = S60CommonUtils::NativeToJavaString(*aJni, agent->Des());
+
+        CleanupStack::PopAndDestroy(agent);
+        CleanupStack::PopAndDestroy(agent8);
+        CleanupStack::PopAndDestroy(userAgent);
+
         return header;
     }
 
@@ -242,9 +256,18 @@
             {
             case KHTTPUserAgentBrowserHeader:
             {
-                HBufC* stringBufPtr = (JavaUserAgent::GetUserAgentL());
-                header = S60CommonUtils::NativeToJavaString(*aJni, stringBufPtr->Des());
-                delete stringBufPtr;
+                CUserAgent* userAgent = CUserAgent::NewL();
+                CleanupStack::PushL(userAgent);
+
+                HBufC8* agent8 = userAgent->UserAgentL();
+                CleanupStack::PushL(agent8);
+                HBufC* agent = HBufC::NewMaxLC(agent8->Length());
+                agent->Des().Copy(*agent8);
+                header = S60CommonUtils::NativeToJavaString(*aJni, agent->Des());
+
+                CleanupStack::PopAndDestroy(agent);
+                CleanupStack::PopAndDestroy(agent8);
+                CleanupStack::PopAndDestroy(userAgent);
             }
             break;
 
--- a/javacommons/gcfprotocols/socket/socket/build/build.xml	Tue Jul 06 14:10:26 2010 +0300
+++ b/javacommons/gcfprotocols/socket/socket/build/build.xml	Wed Aug 18 09:43:15 2010 +0300
@@ -41,7 +41,8 @@
 
   <property name="javah.classnames" 
             value="com.nokia.mj.impl.socket.SocketConnectionImpl,
-                   com.nokia.mj.impl.socket.ServerSocketConnectionImpl"/>
+                   com.nokia.mj.impl.socket.ServerSocketConnectionImpl,
+                   com.nokia.mj.impl.properties.socket.SocketDynamicPropertyHandler"/>
 
   <target name="create.internal.api.jar">
   	<omj.internal.apis includes="com/nokia/mj/impl/gcf/protocol/socket/Protocol.class,
@@ -54,6 +55,12 @@
   	<omj.public.apis includes="javax/microedition/io/SocketConnection.class,
   														 javax/microedition/io/ServerSocketConnection.class"/>
   </target>
+  <target name="system.properties">
+    <properties>
+    		java.src.paths=${java.src.paths}
+        microedition.hostname=:socket.SocketDynamicPropertyHandler
+    </properties>
+  </target>
   
 </project>
 
--- a/javacommons/gcfprotocols/socket/socket/inc/socketlocalhostinfo.h	Tue Jul 06 14:10:26 2010 +0300
+++ b/javacommons/gcfprotocols/socket/socket/inc/socketlocalhostinfo.h	Wed Aug 18 09:43:15 2010 +0300
@@ -27,7 +27,7 @@
 public:
 
     OS_IMPORT static int getLocalAddress(int aSd, char *aLocalAddr, int aMidletIapId, int aApType);
-
+    static char* getLocalHostName();
 
 };
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javacommons/gcfprotocols/socket/socket/javasrc/com/nokia/mj/impl/properties/socket/SocketDynamicPropertyHandler.java	Wed Aug 18 09:43:15 2010 +0300
@@ -0,0 +1,83 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+package com.nokia.mj.impl.properties.socket;
+
+import java.util.Hashtable;
+import java.io.IOException;
+import com.nokia.mj.impl.rt.support.Jvm;
+import com.nokia.mj.impl.rt.support.SystemPropertyProvider;
+import com.nokia.mj.impl.utils.Logger;
+
+public final class SocketDynamicPropertyHandler implements SystemPropertyProvider
+{
+    static
+    {
+        try
+        {
+            Jvm.loadSystemLibrary("javasocket");
+        }
+        catch (Exception e)
+        {
+            Logger.ELOG(Logger.ESOCKET, e.toString());
+        }
+    }
+
+    private static String SOCKET_LOCALHOST_NAME = "microedition.hostname";
+
+    private static final int LOCALHOST_NAME = 1;
+
+    private static Hashtable iPropertyKeys;
+
+    static
+    {
+        iPropertyKeys = new Hashtable();
+        iPropertyKeys.put(SOCKET_LOCALHOST_NAME, new Integer(
+                              LOCALHOST_NAME));
+
+    }
+
+    /**
+     * Retrieves socket localhost system property.
+     *
+     * @param aKey
+     *            The property to retrieve as defined in this class.
+     * @return The value of the property specified; null if the property is not
+     *         defined
+     */
+    public String getProperty(String aKey)
+    {
+        String propertyValue = null;
+        String propertyName = aKey;
+
+        Object property = iPropertyKeys.get(propertyName);
+        if (null == property)
+        {
+            return "localhost";
+        }
+        propertyValue = _getLocalhostname();
+
+        return propertyValue;
+    }
+
+    public boolean isStatic(String aKey)
+    {
+        return true;
+    }
+
+    private static native String _getLocalhostname();
+}
--- a/javacommons/gcfprotocols/socket/socket/src.s60/socketlocalhostinfo.cpp	Tue Jul 06 14:10:26 2010 +0300
+++ b/javacommons/gcfprotocols/socket/socket/src.s60/socketlocalhostinfo.cpp	Wed Aug 18 09:43:15 2010 +0300
@@ -22,7 +22,24 @@
 #include "logger.h"
 #include "connectionmanager.h"
 
+#define localhost_len   20
 int GetlocalIPAdressL(char *localaddr, int aMidletIapId, int aApType);
+char* GetlocalHostNameL();
+
+char* SocketLocalHostInfo::getLocalHostName()
+{
+    char* localhostname =NULL;
+    TRAPD(err,localhostname = GetlocalHostNameL());
+    ILOG1(ESOCKET, "err %d ", err);
+    if (err != KErrNone)
+    {
+        localhostname = new char[localhost_len];
+        strcpy(localhostname,"localhost");
+        return localhostname;
+    }
+    else
+        return localhostname;
+}
 
 OS_EXPORT int SocketLocalHostInfo::getLocalAddress(int /* aSd */, char *aLocalAddr,
         int aMidletIapId, int aApType)
@@ -190,3 +207,41 @@
 
 
 }
+
+char* GetlocalHostNameL()
+{
+    TUint32 activeIapId = 0;
+
+    TConnectionInfoBuf connectionInfo;
+    TUint count = 0;
+    RSocketServ socketServ;
+    RSocket sock;
+    RConnection conn;
+
+    User::LeaveIfError(socketServ.Connect());
+    User::LeaveIfError(sock.Open(socketServ, KAfInet, KSockStream,
+                                 KProtocolInetTcp));
+    User::LeaveIfError(conn.Open(socketServ));
+    User::LeaveIfError(conn.EnumerateConnections(count));
+
+    char* localhost = new char[localhost_len];
+
+    if (count <= 0)
+    {
+        strcpy(localhost,"localhost");
+    }
+    else
+    {
+
+        User::LeaveIfError(conn.GetConnectionInfo(1, connectionInfo));
+        activeIapId = connectionInfo().iIapId;
+        getIPAddressL(activeIapId,localhost);
+    }
+
+    conn.Close();
+    sock.Close();
+    socketServ.Close();
+
+    return localhost;
+}
+
--- a/javacommons/gcfprotocols/socket/socket/src/socketconnectionjni.cpp	Tue Jul 06 14:10:26 2010 +0300
+++ b/javacommons/gcfprotocols/socket/socket/src/socketconnectionjni.cpp	Wed Aug 18 09:43:15 2010 +0300
@@ -17,8 +17,10 @@
 
 
 #include "com_nokia_mj_impl_socket_SocketConnectionImpl.h"
+#include "com_nokia_mj_impl_properties_socket_SocketDynamicPropertyHandler.h"
 #include "nativesocketconnection.h"
-
+#include "socketlocalhostinfo.h"
+#include "logger.h"
 
 using namespace java;
 
@@ -141,3 +143,13 @@
     NativeSocketConnection* nativeConn = reinterpret_cast<NativeSocketConnection* >(aNativePeerHandle);
     delete nativeConn;
 }
+
+JNIEXPORT jstring JNICALL Java_com_nokia_mj_impl_properties_socket_SocketDynamicPropertyHandler__1getLocalhostname
+(JNIEnv *aJni, jclass)
+{
+    char* addr;
+    addr = SocketLocalHostInfo::getLocalHostName();
+    jstring jnistring = aJni->NewStringUTF(addr);
+    delete[] addr;
+    return jnistring;
+}
--- a/javacommons/javacommons.pro	Tue Jul 06 14:10:26 2010 +0300
+++ b/javacommons/javacommons.pro	Wed Aug 18 09:43:15 2010 +0300
@@ -18,7 +18,7 @@
 SUBDIRS += utils/build/javautils.pro 
 SUBDIRS += comms 
 SUBDIRS += javastorage 
-SUBDIRS += fileutils/build/fileutils.pro 
+SUBDIRS += fileutils/build/javafileutils.pro 
 SUBDIRS += security 
 SUBDIRS += gcfbase/build/javagcf.pro 
 SUBDIRS += connectionmanager/build/javaconnectionmanager.pro 
--- a/javacommons/javaenv/src.s60/javaenvinfo.cpp	Tue Jul 06 14:10:26 2010 +0300
+++ b/javacommons/javaenv/src.s60/javaenvinfo.cpp	Wed Aug 18 09:43:15 2010 +0300
@@ -113,7 +113,7 @@
 {
     JELOG2(EUtils);
 
-    TInt size;
+    TInt size = 0;
 
     RFs rfs;
     User::LeaveIfError(rfs.Connect());
--- a/javacommons/security/build/build.xml	Tue Jul 06 14:10:26 2010 +0300
+++ b/javacommons/security/build/build.xml	Wed Aug 18 09:43:15 2010 +0300
@@ -9,9 +9,9 @@
     disclosed to others without the prior written consent of Nokia.
 -->
 
-<project name="javasecurity" default="deploy.generate.policies.and.certs" basedir=".">
+<project name="javasecurity" default="deploy.generate.policies" basedir=".">
   <description>
-        Builds OMJ security, generates the policy files in their internal format and copies the certificates and the metadata into right locations
+        Builds OMJ security and generates the policy files in their internal format
   </description>
 
   <import file="../../../build/utilities.xml"/>
@@ -32,7 +32,6 @@
   <target name="init" depends="init.properties">
     <property name="internal.policies.dir" location="${java.res.root}/security/policies"/>
     <mkdir dir="${internal.policies.dir}"/>
-    <property name="security_res_dir" location="${java.captain.datacage}/security/trustroots/device/certificates"/>
   </target>
   
   <target name="deliver.classes.to.external.tool">
@@ -48,7 +47,7 @@
     </jar>
   </target>
   
-  <target name="deploy.generate.policies.and.certs" depends="init, deploy.dual, deliver.classes.to.external.tool, set.linux.certs">
+  <target name="deploy.generate.policies" depends="init, deploy.dual, deliver.classes.to.external.tool">
     <java classname="com.nokia.mj.tools.security.midp.PolicyEditor"
          failonerror="true">
          <sysproperty key="emma.properties" value="${emma.properties}"/>
@@ -62,20 +61,10 @@
     </java>
   </target>
 
-  <target name="set.linux.certs" if="target.linux">
-    <copy todir="${security_res_dir}/">
-        <fileset dir="../../../javatools/testcerts/" includes="*.der"/>
-    </copy>
-    <copy todir="${security_res_dir}/">
-        <fileset dir="../../../javatools/testcerts/" includes="*.metadata"/>
-    </copy>
-  </target>
-
   <target name="clean" depends="init">
     <ant antfile="../../../build/utilities.xml" target="clean"/>  
     <delete dir="${internal.policies.dir}"/>
     <delete file="${external.policy.editor.tool.lib}"/>
-    <delete dir="${security_res_dir}"/>
   </target>
   
   
--- a/javacommons/security/data/att_operator.txt	Tue Jul 06 14:10:26 2010 +0300
+++ b/javacommons/security/data/att_operator.txt	Wed Aug 18 09:43:15 2010 +0300
@@ -35,8 +35,12 @@
 }
 
 grant user "Messaging" blanket,session,oneshot,no {
-    permission javax.microedition.io.Connector.sms "sms://*" "send";
-    permission javax.microedition.io.Connector.mms "mms://*" "send";
+    permission javax.microedition.io.Connector.sms "sms://*" "open,send,receive";
+    permission javax.microedition.io.Connector.mms "mms://*" "open,send,receive";
+}
+
+grant user "Restricted Messaging" blanket,no {
+    permission javax.microedition.io.Connector.cbs "cbs://*" "open,receive";
 }
 
 grant user "Multimedia Recording" blanket,session,oneshot,no {
@@ -52,12 +56,6 @@
     permission javax.microedition.midlet.CmdLineArgsPermission;
 }
 
-grant allowed {
-    permission javax.microedition.io.Connector.sms "sms://*" "open,receive";
-    permission javax.microedition.io.Connector.mms "mms://*" "open,receive";
-    permission javax.microedition.io.Connector.cbs "cbs://*" "open,receive";
-}
-
 grant assigned {
     permission javax.microedition.midlet.AutoStartPermission;
 }
--- a/javacommons/security/data/att_trustedthirdparty.txt	Tue Jul 06 14:10:26 2010 +0300
+++ b/javacommons/security/data/att_trustedthirdparty.txt	Wed Aug 18 09:43:15 2010 +0300
@@ -13,8 +13,8 @@
 }
 
 grant user "Messaging" session,oneshot,no {
-    permission javax.microedition.io.Connector.sms "sms://*" "send";
-    permission javax.microedition.io.Connector.mms "mms://*" "send";
+    permission javax.microedition.io.Connector.sms "sms://*" "open,send,receive";
+    permission javax.microedition.io.Connector.mms "mms://*" "open,send,receive";
 }
 
 grant user "Multimedia Recording" session,oneshot,no {
@@ -25,8 +25,3 @@
 grant user "Application Auto Invocation" session,oneshot,no {
     permission javax.microedition.io.PushRegistryPermission "*" "staticregistration,dynamicregistration,autoinvocation";
 }
-
-grant allowed {
-    permission javax.microedition.io.Connector.sms "sms://*" "open,receive";
-    permission javax.microedition.io.Connector.mms "mms://*" "open,receive";
-}
--- a/javacommons/security/data/att_untrusted.txt	Tue Jul 06 14:10:26 2010 +0300
+++ b/javacommons/security/data/att_untrusted.txt	Wed Aug 18 09:43:15 2010 +0300
@@ -2,4 +2,5 @@
 grant user "Net Access" oneshot,no {
     permission javax.microedition.io.HttpProtocolPermission "http://*";
     permission javax.microedition.io.HttpsProtocolPermission "https://*";
+    permission javax.microedition.io.Connector.rtsp "*";
 }
--- a/javacommons/security/javasrc/com/nokia/mj/impl/security/midp/common/NetworkRestrictionsAttribute.java	Tue Jul 06 14:10:26 2010 +0300
+++ b/javacommons/security/javasrc/com/nokia/mj/impl/security/midp/common/NetworkRestrictionsAttribute.java	Wed Aug 18 09:43:15 2010 +0300
@@ -25,9 +25,8 @@
 
 /**
  * Specifies the allowed MCC (3 digits) and MNC (2 or 3 digits) tuples,
- * separated by a hyphen (Unicode U+002D), to limit the execution to certain
- * networks for any MIDlets within a MIDlet suite bound to the Operator
- * Protection Domain
+ * separated by a space. The tuples are used to limit the execution of 
+ * Operator signed MIDlets
  */
 public class NetworkRestrictionsAttribute
 {
@@ -35,7 +34,7 @@
      * The JAR attribute holding the network restriction info
      */
     public static final String ATTRIBUTE_NAME
-    = "MIDlet-Operator-Allowed";
+    = "Nokia-MIDlet-Operator-Allowed";
 
     /* The network restrictions contained in the attribute */
     private NetworkRestriction[] restrictions;
--- a/javacommons/security/javasrc/com/nokia/mj/impl/security/midp/storage/SecurityStorage.java	Tue Jul 06 14:10:26 2010 +0300
+++ b/javacommons/security/javasrc/com/nokia/mj/impl/security/midp/storage/SecurityStorage.java	Wed Aug 18 09:43:15 2010 +0300
@@ -1156,7 +1156,7 @@
                                appUID.getStringValue()));
         query.addAttribute(new StorageAttribute(
                                StorageNames.NAME,
-                               "MIDlet-Operator-Allowed"));
+                               "Nokia-MIDlet-Operator-Allowed"));
         query.addAttribute(new StorageAttribute(
                                StorageNames.VALUE,
                                ""));
--- a/javacommons/security/javasrc/com/nokia/mj/impl/security/utils/SecurityDetailedErrorMessage.java	Tue Jul 06 14:10:26 2010 +0300
+++ b/javacommons/security/javasrc/com/nokia/mj/impl/security/utils/SecurityDetailedErrorMessage.java	Wed Aug 18 09:43:15 2010 +0300
@@ -57,16 +57,32 @@
             return iMessageTable;
         }
         Hashtable messageTable = new Hashtable();
-        messageTable.put(new Integer(JAR_TAMPERED), "jar_tampered_details");
-        messageTable.put(new Integer(CERT_DISABLED), "cert_disabled");
-        messageTable.put(new Integer(CERT_DELETED), "cert_deleted");
-        messageTable.put(new Integer(SIM_CHANGED), "sim_changed");
-        messageTable.put(new Integer(UNIDENTIFIED_APPLICATION), "unidentified_application");
-        messageTable.put(new Integer(NETWORK_RESTRICTION_VIOLATION), "net_restr_violation_details");
-        messageTable.put(new Integer(OCSP_GENERAL_ERR), "ocsp_general_details");
-        messageTable.put(new Integer(OCSP_SETTINGS_ERR), "ocsp_settings");
-        messageTable.put(new Integer(OCSP_REVOKED_ERR), "ocsp_revoked");
-        messageTable.put(new Integer(JAR_NOT_FOUND), "jar_not_found_details");
+        if (getLocaleIdQt() == null)
+        {
+            messageTable.put(new Integer(JAR_TAMPERED), "jar_tampered_details");
+            messageTable.put(new Integer(CERT_DISABLED), "cert_disabled");
+            messageTable.put(new Integer(CERT_DELETED), "cert_deleted");
+            messageTable.put(new Integer(SIM_CHANGED), "sim_changed");
+            messageTable.put(new Integer(UNIDENTIFIED_APPLICATION), "unidentified_application");
+            messageTable.put(new Integer(NETWORK_RESTRICTION_VIOLATION), "net_restr_violation_details");
+            messageTable.put(new Integer(OCSP_GENERAL_ERR), "ocsp_general_details");
+            messageTable.put(new Integer(OCSP_SETTINGS_ERR), "ocsp_settings");
+            messageTable.put(new Integer(OCSP_REVOKED_ERR), "ocsp_revoked");
+            messageTable.put(new Integer(JAR_NOT_FOUND), "jar_not_found_details");
+        }
+        else
+        {
+            messageTable.put(new Integer(JAR_TAMPERED), "jar_tampered_details");
+            messageTable.put(new Integer(CERT_DISABLED), "cert_disabled");
+            messageTable.put(new Integer(CERT_DELETED), "cert_deleted");
+            messageTable.put(new Integer(SIM_CHANGED), "sim_changed");
+            messageTable.put(new Integer(UNIDENTIFIED_APPLICATION), "unidentified_application");
+            messageTable.put(new Integer(NETWORK_RESTRICTION_VIOLATION), "net_restr_violation_details");
+            messageTable.put(new Integer(OCSP_GENERAL_ERR), "error_ocsp_general_details");
+            messageTable.put(new Integer(OCSP_SETTINGS_ERR), "error_ocsp_settings");
+            messageTable.put(new Integer(OCSP_REVOKED_ERR), "error_ocsp_revoked");
+            messageTable.put(new Integer(JAR_NOT_FOUND), "jar_not_found_details");
+        }
         iMessageTable = messageTable;
         return iMessageTable;
     }
@@ -80,11 +96,37 @@
     {
         if (iRes == null)
         {
-            iRes = ResourceLoader.getInstance("javausermessages", "qtn_java_secur_error_");
+            if (getLocaleIdQt() == null)
+            {
+                iRes = ResourceLoader.getInstance(
+                    "javausermessages", "qtn_java_secur_error_");
+            }
         }
         return iRes;
     }
 
+    /**
+     * Method for retrieving the ResourceLoader instance that is used
+     * to localise error message for specified error code.
+     *
+     * @param errorCode error code for which ResourceLoader is returned
+     */
+    protected ResourceLoader getResourceLoader(int errorCode)
+    {
+        String resFilename = "javaapplicationsecuritymessages";
+        String resPrefix = "txt_java_secur_info_";
+        switch (errorCode)
+        {
+        case OCSP_GENERAL_ERR:
+        case OCSP_SETTINGS_ERR:
+        case OCSP_REVOKED_ERR:
+            resFilename = "javaapplicationinstaller";
+            resPrefix = "txt_java_secur_info_";
+            break;
+        }
+        return getResourceLoader(resFilename, resPrefix);
+    }
+
     /*** ----------------------------- PACKAGE ---------------------------- */
     /*** ----------------------------- PRIVATE ---------------------------- */
     /*** ----------------------------- NATIVE ----------------------------- */
--- a/javacommons/security/javasrc/com/nokia/mj/impl/security/utils/SecurityErrorMessage.java	Tue Jul 06 14:10:26 2010 +0300
+++ b/javacommons/security/javasrc/com/nokia/mj/impl/security/utils/SecurityErrorMessage.java	Wed Aug 18 09:43:15 2010 +0300
@@ -49,12 +49,24 @@
             return iMessageTable;
         }
         Hashtable messageTable = new Hashtable();
-        messageTable.put(new Integer(JAR_TAMPERED), "jar_tampered");
-        messageTable.put(new Integer(CERT_NOT_AVAILABLE), "cert_not_available");
-        messageTable.put(new Integer(UNEXPECTED_ERR), "unexpected_err");
-        messageTable.put(new Integer(NETWORK_RESTRICTION_VIOLATION), "net_restr_violation");
-        messageTable.put(new Integer(OCSP_GENERAL_ERR), "ocsp_general");
-        messageTable.put(new Integer(JAR_NOT_FOUND), "jar_not_found");
+        if (getLocaleIdQt() == null)
+        {
+            messageTable.put(new Integer(JAR_TAMPERED), "jar_tampered");
+            messageTable.put(new Integer(CERT_NOT_AVAILABLE), "cert_not_available");
+            messageTable.put(new Integer(UNEXPECTED_ERR), "unexpected_err");
+            messageTable.put(new Integer(NETWORK_RESTRICTION_VIOLATION), "net_restr_violation");
+            messageTable.put(new Integer(OCSP_GENERAL_ERR), "ocsp_general");
+            messageTable.put(new Integer(JAR_NOT_FOUND), "jar_not_found");
+        }
+        else
+        {
+            messageTable.put(new Integer(JAR_TAMPERED), "jar_tampered");
+            messageTable.put(new Integer(CERT_NOT_AVAILABLE), "cert_not_available");
+            messageTable.put(new Integer(UNEXPECTED_ERR), "unexpected_error");
+            messageTable.put(new Integer(NETWORK_RESTRICTION_VIOLATION), "net_restr_violation");
+            messageTable.put(new Integer(OCSP_GENERAL_ERR), "there_is_a_security_issue_with_this");
+            messageTable.put(new Integer(JAR_NOT_FOUND), "error_jar_not_found");
+        }
         iMessageTable = messageTable;
         return iMessageTable;
     }
@@ -68,11 +80,39 @@
     {
         if (iRes == null)
         {
-            iRes = ResourceLoader.getInstance("javausermessages", "qtn_java_secur_error_");
+            // This method returns ResourceLoader only when Qt
+            // localisation is not in use. When Qt localisation
+            // is in use this method returns null and
+            // ResourceLoader is obtained with getResourceLoader(int)
+            // method variant.
+            if (getLocaleIdQt() == null)
+            {
+                iRes = ResourceLoader.getInstance("javausermessages", "qtn_java_secur_error_");
+            }
         }
         return iRes;
     }
 
+    /**
+     * Method for retrieving the ResourceLoader instance that is used
+     * to localise error message for specified error code.
+     *
+     * @param errorCode error code for which ResourceLoader is returned
+     */
+    protected ResourceLoader getResourceLoader(int errorCode)
+    {
+        String resFilename = "javaapplicationsecuritymessages";
+        String resPrefix = "txt_java_secur_info_";
+        switch (errorCode)
+        {
+        case OCSP_GENERAL_ERR:
+            resFilename = "common_errors";
+            resPrefix = "txt_error_info_";
+            break;
+        }
+        return getResourceLoader(resFilename, resPrefix);
+    }
+
     /*** ----------------------------- PACKAGE ---------------------------- */
     /*** ----------------------------- PRIVATE ---------------------------- */
     /*** ----------------------------- NATIVE ----------------------------- */
--- a/javacommons/security/javaunicertstoreplugin/src.s60/javacertstoreimpl.cpp	Tue Jul 06 14:10:26 2010 +0300
+++ b/javacommons/security/javaunicertstoreplugin/src.s60/javacertstoreimpl.cpp	Wed Aug 18 09:43:15 2010 +0300
@@ -175,7 +175,7 @@
     case EPreDeleting:
         SendDeleteMsg(status);
         return;
-        
+
     default:
         //Do nothing.
         break;
@@ -250,7 +250,7 @@
         User::RequestComplete(pRequestStatus,KErrArgument);
         return;
     }
-    
+
     mState = EPreDeleting;
     mTempCertData = certData;
     HandleDeleteDisableQuery(aStatus, false /* disableCertQuery */);
@@ -489,12 +489,13 @@
         return;
     }
 
+    TInt err = KErrNone;
     if (!certData->mIsDisabled)
     {
-        aApplications.Append(KMidletInstallApplicabilityUid);
+        err = aApplications.Append(KMidletInstallApplicabilityUid);
     }
 
-    User::RequestComplete(pRequestStatus,KErrNone);
+    User::RequestComplete(pRequestStatus, err);
 }
 
 /**
@@ -835,7 +836,7 @@
         User::RequestComplete(aRequestStatus,KErrCommsBreak);
         return EFalse;
     }
-    
+
     return ETrue;
 }
 
@@ -971,7 +972,7 @@
         //operation in the error situation.
         return;
     }
-    aCertDataObj.mDeleted = ETrue;    
+    aCertDataObj.mDeleted = ETrue;
 
     User::RequestComplete(aRequestStatus,KErrNone);
 }
--- a/javacommons/security/legacysupport/midp2securitypolicyv2/plugins/securitypolicyV2/src/BlanketPermissionPolicy.cpp	Tue Jul 06 14:10:26 2010 +0300
+++ b/javacommons/security/legacysupport/midp2securitypolicyv2/plugins/securitypolicyV2/src/BlanketPermissionPolicy.cpp	Wed Aug 18 09:43:15 2010 +0300
@@ -61,9 +61,9 @@
 
 }
 
-void CBlanketPermissionPolicy::Add(const CBlanketPermissionPolicyElement *aElement)
+void CBlanketPermissionPolicy::AddL(const CBlanketPermissionPolicyElement *aElement)
 {
-    iPolicyElements.Append(aElement);
+    iPolicyElements.AppendL(aElement);
 }
 
 
--- a/javacommons/security/legacysupport/midp2securitypolicyv2/plugins/securitypolicyV2/src/BlanketPermissionPolicy.h	Tue Jul 06 14:10:26 2010 +0300
+++ b/javacommons/security/legacysupport/midp2securitypolicyv2/plugins/securitypolicyV2/src/BlanketPermissionPolicy.h	Wed Aug 18 09:43:15 2010 +0300
@@ -49,7 +49,7 @@
     static CBlanketPermissionPolicy* NewL();
 
 
-    void Add(const CBlanketPermissionPolicyElement *);
+    void AddL(const CBlanketPermissionPolicyElement *);
 
     // MBlanketPermissionPolicy
     virtual TInt GetPolicyElementCount() const ;
--- a/javacommons/security/legacysupport/midp2securitypolicyv2/plugins/securitypolicyV2/src/SimpleMapping.cpp	Tue Jul 06 14:10:26 2010 +0300
+++ b/javacommons/security/legacysupport/midp2securitypolicyv2/plugins/securitypolicyV2/src/SimpleMapping.cpp	Wed Aug 18 09:43:15 2010 +0300
@@ -61,7 +61,7 @@
 
     for (TInt i = 0; i < count; i++)
     {
-        iMapping.Append(aMapping[i]);
+        iMapping.AppendL(aMapping[i]);
     }
 }
 
--- a/javacommons/security/legacysupport/midp2securitypolicyv2/plugins/securitypolicyV2/src/XPFParser.cpp	Tue Jul 06 14:10:26 2010 +0300
+++ b/javacommons/security/legacysupport/midp2securitypolicyv2/plugins/securitypolicyV2/src/XPFParser.cpp	Wed Aug 18 09:43:15 2010 +0300
@@ -385,8 +385,8 @@
 
     //Add the sets and permission downgrade policy to the
     //CBlanketPermissionPolicy object for this domain
+    aBlanketPermissionPolicy->AddL(pe);
     CleanupStack::Pop(pe);
-    aBlanketPermissionPolicy->Add(pe);
     DEBUG("CXPFParser::ExclusionSetL() - Exit");
 }
 
--- a/javacommons/security/src.s60/fileutils.cpp	Tue Jul 06 14:10:26 2010 +0300
+++ b/javacommons/security/src.s60/fileutils.cpp	Wed Aug 18 09:43:15 2010 +0300
@@ -65,7 +65,7 @@
         if (err == KErrNone)
         {
             // figure out the size of the file
-            TInt size;
+            TInt size = 0;
             if (drmContent)
             {
                 TRAP(err, cafData->DataSizeL(size));
--- a/javacommons/security/src.s60/telutils.cpp	Tue Jul 06 14:10:26 2010 +0300
+++ b/javacommons/security/src.s60/telutils.cpp	Wed Aug 18 09:43:15 2010 +0300
@@ -76,6 +76,19 @@
     return sec.Int();
 }
 
+/**
+ * Return 0 if secure time has not been set
+ */
+int TelUtils::isSecureTimeSet()
+{
+    TTime t;
+    if (KErrNoSecureTime == t.UniversalTimeSecure())
+    {
+        return 0;
+    }
+    return 1;
+}
+
 void TelUtils::ConstructL()
 {
     RMobilePhone::TMobilePhoneIdentityV1        phoneId;
--- a/javacommons/security/src.s60/telutils.h	Tue Jul 06 14:10:26 2010 +0300
+++ b/javacommons/security/src.s60/telutils.h	Wed Aug 18 09:43:15 2010 +0300
@@ -36,6 +36,7 @@
     void getNetworkCodes(std::string& mnc, std::string& mcc);
     void getImei(std::string& imei);
     static signed int getSecureTime();
+    static int isSecureTimeSet();
     virtual ~TelUtils();
 
 private: //Methods
--- a/javacommons/security/src/midpauthenticationmoduleimpl.cpp	Tue Jul 06 14:10:26 2010 +0300
+++ b/javacommons/security/src/midpauthenticationmoduleimpl.cpp	Wed Aug 18 09:43:15 2010 +0300
@@ -15,7 +15,7 @@
 *
 */
 
-
+#include "javacommonutils.h"
 #include "javajniutils.h"
 #include "com_nokia_mj_impl_security_midp_authentication_AuthenticationModule.h"
 #include "midpauthenticationmodule.h"
@@ -472,7 +472,22 @@
         if (X509_verify_cert(x509_ctx) != 1)
         {
             ret_code = getErrCode(X509_STORE_CTX_get_error(x509_ctx));
-            break;
+            // If the secure time of the device has not yet been set
+            // to correct value (This can happen some times during
+            // the first device boot),
+            // allow installing with not yet valid certificates
+            if (KCertNotYetValidFailure == ret_code)
+            {
+                if (JavaCommonUtils::isFirstBoot())
+                {
+                    ret_code = KCertAndSignatureOk;
+                }
+            }
+
+            if (KCertAndSignatureOk != ret_code)
+            {
+                break;
+            }
         }
         // verify the extended key usage: it must point to id-kp-codeSigning (RFC3280 code signing)
         // or 1.3.6.1.4.1.94.1.49.1.2.2.3 (Nokia Java Code Signing Extension)
--- a/javacommons/security/tsrc/javasrc/com/nokia/mj/impl/security/midp/authentication/AuthenticationModuleTests.java	Tue Jul 06 14:10:26 2010 +0300
+++ b/javacommons/security/tsrc/javasrc/com/nokia/mj/impl/security/midp/authentication/AuthenticationModuleTests.java	Wed Aug 18 09:43:15 2010 +0300
@@ -1046,8 +1046,8 @@
         }
         catch (RuntimeSecurityException e)
         {
-            assertTrue(e.getShortMessage().equals(securityErrorMessage.get(SecurityErrorMessage.JAR_TAMPERED, null))
-                       && e.getDetailedMessage().equals(securityDetailedErrorMessage.get(SecurityDetailedErrorMessage.JAR_TAMPERED, null)));
+            assertTrue(e.getShortMessage().equals(securityErrorMessage.get(SecurityErrorMessage.JAR_NOT_FOUND, null))
+                       && e.getDetailedMessage().equals(securityDetailedErrorMessage.get(SecurityDetailedErrorMessage.JAR_NOT_FOUND, null)));
         }
         // root not enabled
         try
@@ -1105,7 +1105,7 @@
                                appUID.getStringValue()));
         entry.addAttribute(new StorageAttribute(
                                StorageNames.NAME,
-                               "MIDlet-Operator-Allowed"));
+                               "Nokia-MIDlet-Operator-Allowed"));
         entry.addAttribute(new StorageAttribute(
                                StorageNames.VALUE,
                                "123-45 456-789 000-000"));
@@ -1126,7 +1126,7 @@
                                appUID.getStringValue()));
         entry.addAttribute(new StorageAttribute(
                                StorageNames.NAME,
-                               "MIDlet-Operator-Allowed"));
+                               "Nokia-MIDlet-Operator-Allowed"));
         entry.addAttribute(new StorageAttribute(
                                StorageNames.VALUE,
                                "123-45"));
@@ -1147,7 +1147,7 @@
                                appUID.getStringValue()));
         entry.addAttribute(new StorageAttribute(
                                StorageNames.NAME,
-                               "MIDlet-Operator-Allowed"));
+                               "Nokia-MIDlet-Operator-Allowed"));
         entry.addAttribute(new StorageAttribute(
                                StorageNames.VALUE,
                                "123-45"));
--- a/javacommons/utils/build/bwins/javautilsu.def	Tue Jul 06 14:10:26 2010 +0300
+++ b/javacommons/utils/build/bwins/javautilsu.def	Wed Aug 18 09:43:15 2010 +0300
@@ -129,4 +129,6 @@
 	??1RuntimeException@runtime@java@@UAE@XZ @ 128 NONAME ; java::runtime::RuntimeException::~RuntimeException(void)
 	?toString@RuntimeException@runtime@java@@UBE?AV?$basic_string@DV?$char_traits@D@std@@V?$allocator@D@2@@std@@XZ @ 129 NONAME ; class std::basic_string<char, class std::char_traits<char>, class std::allocator<char> > java::runtime::RuntimeException::toString(void) const
 	?wbase64encode@JavaCommonUtils@util@java@@SA?AV?$basic_string@_WV?$char_traits@_W@std@@V?$allocator@_W@2@@std@@ABV45@@Z @ 130 NONAME ; class std::basic_string<wchar_t, class std::char_traits<wchar_t>, class std::allocator<wchar_t> > java::util::JavaCommonUtils::wbase64encode(class std::basic_string<wchar_t, class std::char_traits<wchar_t>, class std::allocator<wchar_t> > const &)
+	?isFirstBoot@JavaCommonUtils@util@java@@SA_NXZ @ 131 NONAME ; bool java::util::JavaCommonUtils::isFirstBoot(void)
+	?initIsFirstBoot@JavaCommonUtils@util@java@@SAHXZ @ 132 NONAME ; int java::util::JavaCommonUtils::initIsFirstBoot(void)
 
--- a/javacommons/utils/build/eabi/javautilsu.def	Tue Jul 06 14:10:26 2010 +0300
+++ b/javacommons/utils/build/eabi/javautilsu.def	Wed Aug 18 09:43:15 2010 +0300
@@ -179,4 +179,6 @@
 	_ZTIN4java7runtime16RuntimeExceptionE @ 178 NONAME
 	_ZTVN4java7runtime16RuntimeExceptionE @ 179 NONAME
 	_ZN4java4util15JavaCommonUtils13wbase64encodeERKSbIwSt11char_traitsIwESaIwEE @ 180 NONAME
+	_ZN4java4util15JavaCommonUtils11isFirstBootEv @ 181 NONAME
+	_ZN4java4util15JavaCommonUtils15initIsFirstBootEv @ 182 NONAME
 
--- a/javacommons/utils/inc/javacommonutils.h	Tue Jul 06 14:10:26 2010 +0300
+++ b/javacommons/utils/inc/javacommonutils.h	Wed Aug 18 09:43:15 2010 +0300
@@ -122,6 +122,33 @@
      */
     OS_IMPORT static std::wstring percentDecode(const std::wstring& str);
 
+    /**
+     * This function checks whether is it called during the first device boot
+     * and stores the information to static data so that isFirstBoot() can
+     * return it.
+     *
+     * Call this function always when the process is starting.
+     *
+     * This function creates a flag file to the private data cage / work directory
+     * of the process.
+     *
+     * In Symbian this method can be called only from Java Installer or
+     * Java MIDP processes.
+     *
+     * Return 0 if check was made successfully. Otherwise it returns errno
+     * defined in STDLIBS errno.h
+     */
+    OS_IMPORT static int initIsFirstBoot();
+
+    /**
+     * This function returns true if it called during the first boot.
+     * Otherwise it returns false.
+     *
+     * initIsFirstBoot() must be called before this function can be called.
+     */
+    OS_IMPORT static bool isFirstBoot();
+
+
 public:
     /**
      * Decodes one %<X><Y> sequence.
@@ -131,6 +158,10 @@
      * @throws ExceptionBase if <X> and <Y> are not hexadecimal characters
      */
     static char decodeOnePercentSeq(wchar_t first, wchar_t sec);
+
+private:
+    static bool mFirstBoot;
+
 };
 
 // A simple class for storing char array that is deleted automatically
--- a/javacommons/utils/inc/logger.h	Tue Jul 06 14:10:26 2010 +0300
+++ b/javacommons/utils/inc/logger.h	Wed Aug 18 09:43:15 2010 +0300
@@ -115,7 +115,9 @@
     EDebugApi,          //  =34
     EJavaAppMngrPlugin, //  =35
     EJavaBroadcast,     //  =36
-    EJavaAMMS,					//  =37
+    EJavaAMMS,          //  =37
+    EJavaSettings,      //  =38
+    EJavaQtServiceApp,  //  =39
     // add id of new components here
 };
 
@@ -172,7 +174,9 @@
     {"JavaDebugApi.log",     "[JavaDebugApi]"},       // EDebugApi
     {"JavaAppMngrPlugin.log","[JavaAppMngrPlugin]"},  // EJavaAppMngrPlugin
     {"JavaBroadcast.log",    "[JavaBroadcast]"},      // EJavaBroadcast
-    {"JavaMMAPI.log",         "[ MMAPPI ]"},					// EJavaAMMS
+    {"JavaMMAPI.log",         "[ MMAPPI ]"},          // EJavaAMMS
+    {"JavaSettings.log",     "[ JavaSettings ]"},     // EJavaSettings
+    {"JavaQtServiceApp.log", "[ QtServiceApp ]"},     // EJavaQtServiceApp
     // add new component file name and nickname here
 };
 
--- a/javacommons/utils/javasrc/com/nokia/mj/impl/utils/ErrorMessageBase.java	Tue Jul 06 14:10:26 2010 +0300
+++ b/javacommons/utils/javasrc/com/nokia/mj/impl/utils/ErrorMessageBase.java	Wed Aug 18 09:43:15 2010 +0300
@@ -62,7 +62,12 @@
         {
             return this.getClass().getName() + ": No message found for error " + errorCode;
         }
-        return getResourceLoader().format(msgId, errorMessageParameters);
+        ResourceLoader rl = getResourceLoader();
+        if (rl == null)
+        {
+            rl = getResourceLoader(errorCode);
+        }
+        return rl.format(msgId, errorMessageParameters);
     }
 
     /*** ---------------------------- PROTECTED --------------------------- */
@@ -76,11 +81,64 @@
 
     /**
      * Method for retrieving the ResourceLoader instance that is used
-     * to localise error messages.
+     * to localise error messages. If this method returns null,
+     * the ResourceLoader is obtained with getResourceLoader(int)
+     * method variant which then must not return null.
+     *
      * This method must be overriden in inheriting class.
      */
     abstract protected ResourceLoader getResourceLoader();
 
+    /**
+     * Method for retrieving the ResourceLoader instance that is used
+     * to localise error message for specified error code.
+     * This method must be overriden in inheriting class if
+     * the getResourceLoader() method variant returns null.
+     *
+     * @param errorCode error code for which ResourceLoader is returned
+     */
+    protected ResourceLoader getResourceLoader(int errorCode)
+    {
+        return null;
+    }
+
+    /**
+     * Method for retrieving the ResourceLoader instance.
+     * This method is called from inheriting class
+     * getResourceLoader(int) method variant.
+     *
+     * @param textFilename name for text file
+     * @param textPrefix prefix for text ids
+     */
+    private static Hashtable iResourceLoaderTable = null;
+    protected static ResourceLoader getResourceLoader(String textFilename, String textPrefix)
+    {
+        String key = textFilename + "::" + textPrefix;
+        if (iResourceLoaderTable == null)
+        {
+            iResourceLoaderTable = new Hashtable();
+        }
+        ResourceLoader rl = (ResourceLoader)iResourceLoaderTable.get(key);
+        if (rl == null)
+        {
+            rl = ResourceLoader.getInstance(textFilename, textPrefix);
+            iResourceLoaderTable.put(key, rl);
+        }
+        return rl;
+    }
+
+    /**
+     * Gets the Qt locale ID currently being used on the phone.
+     *
+     * @return Qt locale ID as provided by the platform
+     */
+    protected static String getLocaleIdQt()
+    {
+        // Change this after Qt localisation files are taken into use.
+        //return ResourceLoader.getLocaleIdQt();
+        return null;
+    }
+
     /*** ----------------------------- PACKAGE ---------------------------- */
     /*** ----------------------------- PRIVATE ---------------------------- */
     /*** ----------------------------- NATIVE ----------------------------- */
--- a/javacommons/utils/javasrc/com/nokia/mj/impl/utils/Formatter.java	Tue Jul 06 14:10:26 2010 +0300
+++ b/javacommons/utils/javasrc/com/nokia/mj/impl/utils/Formatter.java	Wed Aug 18 09:43:15 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies).
 * All rights reserved.
 * This component and the accompanying materials are made available
 * under the terms of "Eclipse Public License v1.0"
@@ -28,6 +28,7 @@
  * <UL>
  * <LI>%nU - String in position n
  * <LI>%U - Next string
+ * <LI>%Ln - Integer in position n
  * <LI>%nN - Integer in position n
  * <LI>%N - Next integer
  * <LI>%nC - Character in position n
@@ -60,7 +61,7 @@
     private String replaced;
 
     /** Next replacement index */
-    private int nextIndex = 0;
+    private int nextIndex = (ResourceLoader.getLocaleIdQt() == null? 0: 1);
 
     /*** ----------------------------- PUBLIC ------------------------------ */
 
@@ -69,7 +70,7 @@
      *
      * @param pattern formatter pattern
      */
-    public Formatter(String aPattern)
+    Formatter(String aPattern)
     {
         pattern = aPattern;
         replaced = aPattern;
@@ -90,11 +91,12 @@
                 replace("%U", string))
         {
             nextIndex++;
-
         }
         else
         {
-            Logger.WLOG(Logger.EUtils, "String replacement failed");
+            Logger.WLOG(Logger.EUtils,
+                        "String replacement failed on parameter " +
+                        nextIndex + ": " + pattern);
         }
         return this;
     }
@@ -110,8 +112,9 @@
     {
         String localisedNumber = _formatInteger(number);
 
-        // Try to replace with patterns %nN, %n, %N
-        if (replace("%" + nextIndex + "N", localisedNumber) ||
+        // Try to replace with patterns %Ln, %nN, %n, %N
+        if (replace("%" + "L" + nextIndex, localisedNumber) ||
+                replace("%" + nextIndex + "N", localisedNumber) ||
                 replace("%" + nextIndex, localisedNumber) ||
                 replace("%N", localisedNumber))
         {
@@ -120,7 +123,9 @@
         }
         else
         {
-            Logger.WLOG(Logger.EUtils, "Integer replacement failed");
+            Logger.WLOG(Logger.EUtils,
+                        "Integer replacement failed on parameter " +
+                        nextIndex + ": " + pattern);
         }
         return this;
     }
@@ -146,7 +151,9 @@
         }
         else
         {
-            Logger.WLOG(Logger.EUtils, "Character replacement failed");
+            Logger.WLOG(Logger.EUtils,
+                        "Character replacement failed on parameter " +
+                        nextIndex + ": " + pattern);
         }
         return this;
     }
@@ -208,7 +215,7 @@
 
         // Reset for next usage
         replaced = pattern;
-        nextIndex = 0;
+        nextIndex = (ResourceLoader.getLocaleIdQt() == null? 0: 1);
 
         return result;
     }
--- a/javacommons/utils/javasrc/com/nokia/mj/impl/utils/InstallerDetailedErrorMessage.java	Tue Jul 06 14:10:26 2010 +0300
+++ b/javacommons/utils/javasrc/com/nokia/mj/impl/utils/InstallerDetailedErrorMessage.java	Wed Aug 18 09:43:15 2010 +0300
@@ -57,9 +57,7 @@
             return iMessageTable;
         }
         Hashtable messageTable = new Hashtable();
-        // Change this after Qt localisation files are in place.
-        //if (ResourceLoader.getLocaleIdQt() == null)
-        if (true)
+        if (getLocaleIdQt() == null)
         {
             messageTable.put(new Integer(NO_MEM), "no_mem_detail");
             messageTable.put(new Integer(NO_MEM_MB), "no_mem_detail_mb");
@@ -108,9 +106,7 @@
     {
         if (iRes == null)
         {
-            // Change this after Qt localisation files are in place.
-            //if (ResourceLoader.getLocaleIdQt() == null)
-            if (true)
+            if (getLocaleIdQt() == null)
             {
                 iRes = ResourceLoader.getInstance("javainstallation", "qtn_java_inst_error_");
             }
--- a/javacommons/utils/javasrc/com/nokia/mj/impl/utils/InstallerErrorMessage.java	Tue Jul 06 14:10:26 2010 +0300
+++ b/javacommons/utils/javasrc/com/nokia/mj/impl/utils/InstallerErrorMessage.java	Wed Aug 18 09:43:15 2010 +0300
@@ -63,9 +63,7 @@
             return iMessageTable;
         }
         Hashtable messageTable = new Hashtable();
-        // Change this after Qt localisation files are in place.
-        //if (ResourceLoader.getLocaleIdQt() == null)
-        if (true)
+        if (getLocaleIdQt() == null)
         {
             messageTable.put(new Integer(INST_NO_MEM), "no_mem");
             messageTable.put(new Integer(INST_NO_NET), "no_net");
@@ -110,9 +108,7 @@
     {
         if (iRes == null)
         {
-            // Change this after Qt localisation files are in place.
-            //if (ResourceLoader.getLocaleIdQt() == null)
-            if (true)
+            if (getLocaleIdQt() == null)
             {
                 iRes = ResourceLoader.getInstance("javainstallation", "qtn_java_inst_error_");
             }
--- a/javacommons/utils/javasrc/com/nokia/mj/impl/utils/Logger.java	Tue Jul 06 14:10:26 2010 +0300
+++ b/javacommons/utils/javasrc/com/nokia/mj/impl/utils/Logger.java	Wed Aug 18 09:43:15 2010 +0300
@@ -81,6 +81,7 @@
     public static final int EJavaAppMngrPlugin  = 35;
     public static final int EJavaBroadcast      = 36;
     public static final int EJavaAMMS	          = 37;
+    public static final int EJavaSettings       = 38;
     // add name of new components here
 
 
@@ -138,6 +139,7 @@
         false,  //EJavaAppMngrPlugin = 35;
         false,  //EJavaBroadcast     = 36;
         false,  //EJavaAMMS					 = 37;
+        false,  //EJavaSettings 		 = 38;
         // add  new components here
     };
 
--- a/javacommons/utils/src/javacommonutils.cpp	Tue Jul 06 14:10:26 2010 +0300
+++ b/javacommons/utils/src/javacommonutils.cpp	Wed Aug 18 09:43:15 2010 +0300
@@ -15,9 +15,11 @@
 *
 */
 
-
+#include <errno.h>
+#include <fcntl.h>
 #include <iostream>
 #include <sstream>
+#include <unistd.h>
 #include <vector>
 
 #include <string.h>
@@ -33,6 +35,16 @@
 
 using namespace java::util;
 
+// In Symbian working directory should be initalized to C:\private\<UID> by OpenC
+// But for some reason this does not seem to work if process binary is in rom.
+#ifdef __SYMBIAN32__
+const char* const FIRST_BOOT_FILE = "c:\\private\\102033E6\\first_boot_done.dat";
+#else
+const char* const FIRST_BOOT_FILE = "first_boot_done.dat";
+#endif /* __SYMBIAN32__ */
+
+bool JavaCommonUtils::mFirstBoot = false;
+
 OS_EXPORT int JavaCommonUtils::stringToInt(const std::string& str)
 {
 //    JELOG2(EUtils);
@@ -372,6 +384,40 @@
 }
 
 
+OS_EXPORT int JavaCommonUtils::initIsFirstBoot()
+{
+    struct stat fileStatBuf;
+    if (stat(FIRST_BOOT_FILE, &fileStatBuf) == 0)
+    {
+        mFirstBoot = false;
+    }
+    else
+    {
+        mFirstBoot = true;
+
+        // Create flag file so that next time we detect that first boot 
+        // has already been done
+        int fd = open(FIRST_BOOT_FILE, O_RDWR | O_CREAT, S_IRUSR | S_IWUSR);
+        if (fd < 0)
+        {
+            return errno;
+        }
+        else
+        {
+            close(fd);
+        }
+    }
+    
+    return 0;
+}
+
+
+OS_EXPORT bool JavaCommonUtils::isFirstBoot()
+{
+    return mFirstBoot;
+}
+
+
 char JavaCommonUtils::decodeOnePercentSeq(wchar_t first, wchar_t sec)
 {
     // Handle one encoded %XY
--- a/javaextensions/bluetooth/bluetoothcommons/bluetoothplatformcontrol/src.s60/s60btdialog.cpp	Tue Jul 06 14:10:26 2010 +0300
+++ b/javaextensions/bluetooth/bluetoothcommons/bluetoothplatformcontrol/src.s60/s60btdialog.cpp	Wed Aug 18 09:43:15 2010 +0300
@@ -23,6 +23,13 @@
 #include "s60btdialog.h"
 #include "logger.h"
 
+#ifdef RD_JAVA_S60_RELEASE_10_1_ONWARDS
+#include <hbdevicemessageboxsymbian.h>
+#include <hbpopup.h>
+#include <QtCore\qvariant.h>
+
+#define QUERY_BUF_LEN 512
+#endif
 
 using namespace java::bluetooth;
 
@@ -44,7 +51,9 @@
 void CS60BTDialog::ConstructL()
 {
     LOG(EJavaBluetooth, EInfo, "+ CS60BTDialog::ConstructL()");
+#ifndef RD_JAVA_S60_RELEASE_10_1_ONWARDS
     User::LeaveIfError(mNotifier.Connect());
+#endif
     LOG(EJavaBluetooth, EInfo, "- CS60BTDialog::ConstructL()");
 }
 
@@ -57,7 +66,9 @@
 {
     CS60BTDialog* self = new(ELeave) CS60BTDialog;
     CleanupStack::PushL(self);
+#ifndef RD_JAVA_S60_RELEASE_10_1_ONWARDS
     self->ConstructL();
+#endif
     return self;
 }
 
@@ -70,8 +81,11 @@
 {
     JELOG2(EJavaBluetooth);
     LOG(EJavaBluetooth, EInfo, "+ CS60BTDialog::~CS60BTDialog()");
+
+#ifndef RD_JAVA_S60_RELEASE_10_1_ONWARDS
     DoCancel();
     mNotifier.Close();
+#endif
     LOG(EJavaBluetooth, EInfo, "- CS60BTDialog::~CS60BTDialog()");
 }
 
@@ -87,13 +101,41 @@
     JELOG2(EJavaBluetooth);
     LOG1(EJavaBluetooth, EInfo,"+ CS60BTDialog::ShowBTQueryDialog(): aQueryType = %d", aQueryType);
 
+
+#ifndef RD_JAVA_S60_RELEASE_10_1_ONWARDS
     mQueryParamsPckg().iMessageType = aQueryType;
     mQueryParamsPckg().iNameExists = ETrue;
     mQueryParamsPckg().iName.Copy(aAppName);
     mNotifier.StartNotifierAndGetResponse(mStatus, KBTGenericQueryNotifierUid,
                                           mQueryParamsPckg, mQueryResult);
+    User::WaitForRequest(mStatus);
 
-    User::WaitForRequest(mStatus);
+#else
+    _LIT(KAppInfo,"Application %S cannot  be used when  Bluetooth is off Activate Bluetooth ?");
+    _LIT(KAppInfomsg,"Change 'My phone's visibility' setting to 'Show to all'? Application '%S' cannot be used when the visibility is set as 'Hidden'.");
+
+    TBuf<QUERY_BUF_LEN> queryBuf;
+    TInt err = KErrNone;
+    TBool userOpt;
+
+    queryBuf.Zero();
+    if (aQueryType == EBTIsOffJavaQuery)
+    {
+        queryBuf.Format(KAppInfo,&aAppName);
+    }
+    else if (aQueryType == EBTIsNotShownQuery)
+    {
+        queryBuf.Format(KAppInfomsg,&aAppName);
+    }
+
+    TRAP(err, userOpt = ShowBTQueryHbDialogL(queryBuf));
+    LOG1(EJavaBluetooth, EInfo,"  CS60BTDialog::ShowBTQueryDialog(): mQueryResult = %d", err);
+
+    if (err != KErrNone )
+        mQueryResult = EFalse;
+    else
+        mQueryResult = userOpt;
+#endif
 
     LOG1(EJavaBluetooth, EInfo,"- CS60BTDialog::ShowBTQueryDialog(): mQueryResult = %d", mQueryResult());
     return mQueryResult();
@@ -109,6 +151,42 @@
 void CS60BTDialog::DoCancel()
 {
     LOG(EJavaBluetooth, EInfo, "+ CS60BTDialog::DoCancel()");
+#ifndef RD_JAVA_S60_RELEASE_10_1_ONWARDS
     mNotifier.CancelNotifier(KBTGenericQueryNotifierUid);
+#endif
     LOG(EJavaBluetooth, EInfo, "- CS60BTDialog::DoCancel()");
 }
+
+#ifdef RD_JAVA_S60_RELEASE_10_1_ONWARDS
+
+TBool CS60BTDialog::ShowBTQueryHbDialogL(const TDesC& aBufData)
+{
+    TBool result = EFalse;
+
+    CHbDeviceMessageBoxSymbian* messageBox
+    = CHbDeviceMessageBoxSymbian::NewL(CHbDeviceMessageBoxSymbian::EQuestion);
+    CleanupStack::PushL(messageBox);
+
+    messageBox->SetTextL(aBufData);
+    messageBox->SetTimeout(HbPopup::NoTimeout);
+
+    // Read localised versions instead of hard coded values.
+    _LIT(KAllowButtonText, "Yes");
+    _LIT(KDenyButtonText, "No");
+
+    messageBox->SetButtonTextL(CHbDeviceMessageBoxSymbian::EAcceptButton, KAllowButtonText);
+    messageBox->SetButton(CHbDeviceMessageBoxSymbian::EAcceptButton, ETrue);
+    messageBox->SetButtonTextL(CHbDeviceMessageBoxSymbian::ERejectButton, KDenyButtonText);
+    messageBox->SetButton(CHbDeviceMessageBoxSymbian::ERejectButton, ETrue);
+
+    if (messageBox->ExecL() == CHbDeviceMessageBoxSymbian::EAcceptButton)
+        result = ETrue;
+    else
+        result = EFalse;
+
+    messageBox->Close();
+    CleanupStack::PopAndDestroy(messageBox);
+
+    return result;
+}
+#endif
--- a/javaextensions/bluetooth/bluetoothcommons/bluetoothplatformcontrol/src.s60/s60btdialog.h	Tue Jul 06 14:10:26 2010 +0300
+++ b/javaextensions/bluetooth/bluetoothcommons/bluetoothplatformcontrol/src.s60/s60btdialog.h	Wed Aug 18 09:43:15 2010 +0300
@@ -57,6 +57,11 @@
     TBool ShowBTQueryDialog(const TDesC& aAppName, const TBool aInstalling,
                             TBTGenericQueryNoteType aQueryType);
 
+#ifdef RD_JAVA_S60_RELEASE_10_1_ONWARDS
+    TBool ShowBTQueryHbDialogL(const TDesC& aBufData);
+#endif
+
+
     /**
      * Cancels the asynchronous request to the query list dialog.
      *
@@ -72,7 +77,9 @@
 
 private: // data
     TRequestStatus mStatus;
+#ifndef RD_JAVA_S60_RELEASE_10_1_ONWARDS
     RNotifier mNotifier;
+#endif
     TBTGenericQueryNotiferParamsPckg mQueryParamsPckg;
     TPckgBuf<TBool> mQueryResult;
 };
--- a/javaextensions/bluetooth/bluetoothcommons/build/javabluetoothcommons.pro	Tue Jul 06 14:10:26 2010 +0300
+++ b/javaextensions/bluetooth/bluetoothcommons/build/javabluetoothcommons.pro	Wed Aug 18 09:43:15 2010 +0300
@@ -14,20 +14,33 @@
 # Description: 
 #
 
+include(../../../../inc/build_defines.pri)
+
 TEMPLATE=lib
 TARGET=javabluetoothcommons
 CONFIG += omj java stl
-CONFIG -= qt
 
-symbian {
+contains(PROJECT_DEFINES,RD_JAVA_S60_RELEASE_5_0) {
+    CONFIG -= qt
+}
+contains(PROJECT_DEFINES,RD_JAVA_S60_RELEASE_9_2) {
+    CONFIG -= qt
+}
+contains(PROJECT_DEFINES,RD_JAVA_S60_RELEASE_10_1_ONWARDS) {
+    CONFIG += hb
+}
+
+
+symbian {	
     SOURCES += ../src/*.cpp 
     SOURCES += ../src.s60/*.cpp
     SOURCES += ../bluetoothplatformcontrol/src/*.cpp 
-    SOURCES += ../bluetoothplatformcontrol/src.s60/*.cpp
+    SOURCES += ../bluetoothplatformcontrol/src.s60/*.cpp   
 }
 
 LIBS +=  -lsdpdatabase -lbtengsettings -lbluetooth -lbtmanclient \
          -lbtdevice -ljavacomms -ljavafileutils -lesock
 
+include(../../../../build/omj.pri)
 
-include(../../../../build/omj.pri)
+
--- a/javaextensions/bluetooth/bluetoothcommons/src.s60/bluetoothnamelookup.cpp	Tue Jul 06 14:10:26 2010 +0300
+++ b/javaextensions/bluetooth/bluetoothcommons/src.s60/bluetoothnamelookup.cpp	Wed Aug 18 09:43:15 2010 +0300
@@ -63,9 +63,8 @@
         mLookupMonitor = new CActiveSchedulerWait();
     }
     LOG1(EJavaBluetooth, EInfo,
-         "+ BluetoothNameLookup::doDeviceNameLookupL DeviceAddress:%x",
+         "+ BluetoothNameLookup::doDeviceNameLookupL DeviceAddress:%llx",
          aDevAddr);
-
     TProtocolDesc pdesc;
     User::LeaveIfError(mSocketServ.FindProtocol(KBTLinkManagerTxt(), pdesc));
 
--- a/javaextensions/bluetooth/bluetoothplugins/btl2cappushplugin/src.s60/btl2capserverconnection.cpp	Tue Jul 06 14:10:26 2010 +0300
+++ b/javaextensions/bluetooth/bluetoothplugins/btl2cappushplugin/src.s60/btl2capserverconnection.cpp	Wed Aug 18 09:43:15 2010 +0300
@@ -489,7 +489,21 @@
     if (KErrNone == err)
     {
         mAcceptedSocket->RemoteName(btRemoteAddr);
-        if (mAsyncAccept && (!mAvoidFilter) && (false == isConnectionAllowed(btRemoteAddr)))
+        TBuf<20> addr;
+        TInt64 longBtAddr = 0;
+        TBTDevAddr btDeviceAddress = btRemoteAddr.BTAddr();
+        LOG4(EJavaBluetooth,EInfo,"TBTDevAddr Address is %x %x %x %x ",
+                                   btDeviceAddress[0],btDeviceAddress[1], 
+                                   btDeviceAddress[2],btDeviceAddress[3]);
+        LOG2(EJavaBluetooth,EInfo,"%x %x",btDeviceAddress[4], 
+                                          btDeviceAddress[5]);
+        btDeviceAddress.GetReadable(addr);
+        LOG1(EJavaBluetooth,EInfo,"BT: Readable address is %S",&addr);
+        TLex16 toParse(addr);
+        toParse.Val(longBtAddr, EHex);
+        LOG1(EJavaBluetooth, EInfo,
+             "L2CAPServerConnection::HandleAcceptCompleteL: Address: %llx", longBtAddr);
+        if ((longBtAddr == 0) ||(mAsyncAccept && (!mAvoidFilter) && (false == isConnectionAllowed(btRemoteAddr))))
         {
             mAcceptedSocket->CancelAll();
             mAcceptedSocket->Shutdown(RSocket::EImmediate);
@@ -500,14 +514,7 @@
             AcceptL();
             return;
         }
-        TBuf<20> addr;
-        TInt64 longBtAddr = 0;
-        TBTDevAddr btDeviceAddress = btRemoteAddr.BTAddr();
-        btDeviceAddress.GetReadable(addr);
-        TLex16 toParse(addr);
-        toParse.Val(longBtAddr, EHex);
-        LOG1(EJavaBluetooth, EInfo,
-             "L2CAPServerConnection::HandleAcceptCompleteL: Address: %ld", longBtAddr);
+        
         mBtClientConn = new BluetoothClientConnection(mAcceptedSocket, mServer);
         mAcceptedSocket->GetOpt(KL2CAPInboundMTU, KSolBtL2CAP, negotiatedReceiveMtu);
         mAcceptedSocket->GetOpt(KL2CAPNegotiatedOutboundMTU, KSolBtL2CAP, negotiatedTransmitMtu);
--- a/javaextensions/bluetooth/bluetoothplugins/btl2cappushplugin/src/btl2cappushserverconnection.cpp	Tue Jul 06 14:10:26 2010 +0300
+++ b/javaextensions/bluetooth/bluetoothplugins/btl2cappushplugin/src/btl2cappushserverconnection.cpp	Wed Aug 18 09:43:15 2010 +0300
@@ -199,7 +199,9 @@
     BluetoothNameLookup * nameLookup = NULL;
 
     long long remoteDevAddr = aClientConnection->getRemoteAddress();
-
+    ELOG1(EJavaBluetooth,
+      "+ L2CapPushServerConnection::handleConnectionRequest DeviceAddress:%llx",
+         remoteDevAddr);
     TRAPD(lookupErr,
     {
         nameLookup = BluetoothNameLookup::NewL();
--- a/javaextensions/bluetooth/bluetoothplugins/btspppushplugin/src.s60/btrfcommserverconnection.cpp	Tue Jul 06 14:10:26 2010 +0300
+++ b/javaextensions/bluetooth/bluetoothplugins/btspppushplugin/src.s60/btrfcommserverconnection.cpp	Wed Aug 18 09:43:15 2010 +0300
@@ -437,7 +437,21 @@
     if (KErrNone == err)
     {
         mAcceptedSocket->RemoteName(btRemoteAddr);
-        if (mAsyncAccept && (!mAvoidFilter) && (false == isConnectionAllowed(btRemoteAddr)))
+        TBuf<20> addr;
+        TInt64 longBtAddr = 0;
+        TBTDevAddr btDeviceAddress = btRemoteAddr.BTAddr();
+        LOG4(EJavaBluetooth,EInfo,"TBTDevAddr Address is %x %x %x %x ",
+                                   btDeviceAddress[0],btDeviceAddress[1], 
+                                   btDeviceAddress[2],btDeviceAddress[3]);
+        LOG2(EJavaBluetooth,EInfo,"%x %x",btDeviceAddress[4], 
+                                          btDeviceAddress[5]);
+        btDeviceAddress.GetReadable(addr);
+        LOG1(EJavaBluetooth,EInfo,"BT: Readable address is %S",&addr);
+        TLex16 toParse(addr);
+        toParse.Val(longBtAddr, EHex);
+        LOG1(EJavaBluetooth, EInfo,
+             "L2CAPServerConnection::HandleAcceptCompleteL: Address: %llx", longBtAddr);
+        if ((longBtAddr == 0) ||(mAsyncAccept && (!mAvoidFilter) && (false == isConnectionAllowed(btRemoteAddr))))
         {
             mAcceptedSocket->CancelAll();
             mAcceptedSocket->Shutdown(RSocket::EImmediate);
@@ -448,13 +462,7 @@
             AcceptL();
             return;
         }
-        TBuf<20> addr;
-        TInt64 longBtAddr = 0;
-        TBTDevAddr btDeviceAddress = btRemoteAddr.BTAddr();
-        btDeviceAddress.GetReadable(addr);
-        TLex16 toParse(addr);
-        toParse.Val(longBtAddr, EHex);
-        LOG1(EJavaBluetooth, EInfo, "RFCOMMServerConnection::HandleAcceptCompleteL: Address: %ld", longBtAddr);
+        
         mBtClientConn = new BluetoothClientConnection(mAcceptedSocket, mServer);
         mBtClientConn->initialize(PROTOCOL_RFCOMM, longBtAddr, 0, 0);
         if (mAsyncAccept)
--- a/javaextensions/bluetooth/omjbluetooth/javasrc/com/nokia/mj/impl/properties/bluetooth/BtDynamicPropertyHandler.java	Tue Jul 06 14:10:26 2010 +0300
+++ b/javaextensions/bluetooth/omjbluetooth/javasrc/com/nokia/mj/impl/properties/bluetooth/BtDynamicPropertyHandler.java	Wed Aug 18 09:43:15 2010 +0300
@@ -65,7 +65,7 @@
 
     private static final int MASTER_SWITCH = 7;
 
-    private static final int SD_TRANS_MAX = 8;
+    private static final int SD_TRANS_MAX = 1;
 
     private static final int SD_ATTR_RETRIEVE_MAX = 9;
 
--- a/javaextensions/javaextensions.pro	Tue Jul 06 14:10:26 2010 +0300
+++ b/javaextensions/javaextensions.pro	Wed Aug 18 09:43:15 2010 +0300
@@ -15,7 +15,7 @@
 #
 TEMPLATE = subdirs
 SUBDIRS += iapinfo/build/javaiapinfo.pro 
-SUBDIRS += mobinfo/build/mobinfo.pro 
+SUBDIRS += mobinfo/build/javamobinfo.pro 
 SUBDIRS += comm/build/javacomm.pro 
 SUBDIRS += globalindicators/build/javaglobalindicators.pro 
 SUBDIRS += webservices/build/javawebservices.pro 
--- a/javaextensions/location/landmarks/src/landmark.cpp	Tue Jul 06 14:10:26 2010 +0300
+++ b/javaextensions/location/landmarks/src/landmark.cpp	Wed Aug 18 09:43:15 2010 +0300
@@ -457,6 +457,11 @@
     return error;
 }
 
+LOCAL_C void dispose(CBase* aLandmark)
+{
+    delete aLandmark;
+}
+
 /*
  * Class:     javax_microedition_location_Landmark
  * Method:    _dispose
@@ -466,14 +471,15 @@
 JNICALL Java_javax_microedition_location_Landmark__1dispose(
     JNIEnv* /*aJniEnv*/,
     jobject /*aPeer*/,
-    jint /*aEventSourceHandle*/,
+    jint aEventSourceHandle,
     jint aLandmarkHandle)
 {
     JELOG2(EJavaLocation);
-
+    LocationFunctionServer* eventSource =
+        reinterpret_cast< LocationFunctionServer*>(aEventSourceHandle);
+    
     CBase* object = reinterpret_cast< CBase*>(aLandmarkHandle);
-
-    delete object;
+    eventSource->ExecuteTrap(dispose,object);
 }
 
 // End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javaextensions/mobinfo/build/javamobinfo.pro	Wed Aug 18 09:43:15 2010 +0300
@@ -0,0 +1,26 @@
+#
+# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+#
+# Contributors:
+#
+# Description: 
+#
+
+TARGET=javamobinfo
+TEMPLATE=lib
+CONFIG += omj java stl
+CONFIG -= qt
+
+symbian {
+    LIBS += -leuser -letel -letelmm -lesock -lconnmon -lcommdb -lcommsdat -lcmmanager -ljavaconnectionmanager  
+}
+
+include(../../../build/omj.pri)
--- a/javaextensions/mobinfo/build/mobinfo.pro	Tue Jul 06 14:10:26 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,26 +0,0 @@
-#
-# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-# All rights reserved.
-# This component and the accompanying materials are made available
-# under the terms of "Eclipse Public License v1.0"
-# which accompanies this distribution, and is available
-# at the URL "http://www.eclipse.org/legal/epl-v10.html".
-#
-# Initial Contributors:
-# Nokia Corporation - initial contribution.
-#
-# Contributors:
-#
-# Description: 
-#
-
-TARGET=javamobinfo
-TEMPLATE=lib
-CONFIG += omj java stl
-CONFIG -= qt
-
-symbian {
-    LIBS += -leuser -letel -letelmm -lesock -lconnmon -lcommdb -lcommsdat -lcmmanager    
-}
-
-include(../../../build/omj.pri)
--- a/javaextensions/mobinfo/javasrc.s60/com/nokia/mj/impl/properties/mobinfo/MobileInfoProperties.java	Tue Jul 06 14:10:26 2010 +0300
+++ b/javaextensions/mobinfo/javasrc.s60/com/nokia/mj/impl/properties/mobinfo/MobileInfoProperties.java	Wed Aug 18 09:43:15 2010 +0300
@@ -140,6 +140,9 @@
 
         int value = ((Integer)iPropertyKeys.get(aKey)).intValue();
         Uid appSuiteUid;
+        int apId = APP_DEFAULT_APN_NOT_SPECIFIED;        // access point id
+        int apType = APP_DEFAULT_APN_NOT_SPECIFIED;      // MIDlet access point type, can be SNAP or IAP
+
         ConnectionManager CmInstance = null;
         String result = null;
         // Only network access seems to have another way to handle it.
@@ -160,29 +163,25 @@
                     AccessPoint apn = CmInstance.getApplicationDefault(appSuiteUid);
                     if (apn != null)
                     {
-                        if (apn.getType() == AccessPoint.NAP_IAP) // IAP ID
+                        apId = apn.getNapId();
+                        apType = apn.getType();
+
+
+                        if ((apType!=AccessPoint.NAP_SNAP) && (apType!=AccessPoint.NAP_IAP))
                         {
-                            result = _getPropertyApn(NETWORK_ACCESS_V, apn.getNapId());
+                            apType = APP_DEFAULT_APN_NOT_SPECIFIED;
+                            apId = APP_DEFAULT_APN_NOT_SPECIFIED;
                         }
-                        else
-                        {
-                            result = _getPropertyApn(NETWORK_ACCESS_V, APP_DEFAULT_APN_NOT_SPECIFIED);
-                        }
+
                     }
-                    else
-                    {
-                        result = _getPropertyApn(NETWORK_ACCESS_V, APP_DEFAULT_APN_NOT_SPECIFIED);
-                    }
+
                 }
-                else
-                {
-                    result = _getPropertyApn(NETWORK_ACCESS_V, APP_DEFAULT_APN_NOT_SPECIFIED);
-                }
+                result = _getPropertyApn(NETWORK_ACCESS_V, apId,apType);
             }
             catch (Exception e)
             {
                 Logger.LOG(Logger.ESOCKET, Logger.EInfo,"MobilInfoProperties :: getSuiteUid exception ");
-                result = _getPropertyApn(NETWORK_ACCESS_V, APP_DEFAULT_APN_NOT_SPECIFIED);
+                result = _getPropertyApn(NETWORK_ACCESS_V, apId,apType);
             }
             return result;
         }
@@ -202,6 +201,6 @@
     }
 
     private native String _getProperty(int value);
-    private static native String _getPropertyApn(int property, int aAppDefaultApn);
+    private static native String _getPropertyApn(int property, int aAppDefaultApn, int apType);
 
 }
\ No newline at end of file
--- a/javaextensions/mobinfo/src.s60/javamobinfo.cpp	Tue Jul 06 14:10:26 2010 +0300
+++ b/javaextensions/mobinfo/src.s60/javamobinfo.cpp	Wed Aug 18 09:43:15 2010 +0300
@@ -29,6 +29,8 @@
 #include <cmpluginpacketdatadef.h>
 #include <cmpluginwlandef.h>
 #include <cmpluginhscsddef.h>
+#include "connectionmanager.h"
+
 using namespace CMManager;
 
 #ifndef SYMBIAN_ENABLE_SPLIT_HEADERS
@@ -75,14 +77,15 @@
 // ---------------------------------------------------------------------------
 //    forward declarations
 // ---------------------------------------------------------------------------
-HBufC* GetProperty(const TInt aProperty, const TUint32 aAppDefaultApn);
+HBufC* GetProperty(const TInt aProperty, const TUint32 aAppDefaultApn, const TUint32 aAppDefaultApType);
 HBufC* GetTelephonyPropertyL(const TInt aProperty);
 HBufC* GetDateTimePropertyL(const TInt aProperty);
-HBufC* GetNetworkAccessL(const TUint32 aAppDefaultApn);
+HBufC* GetNetworkAccessL(const TUint32 aAppDefaultApn, const TUint32 aAppDefaultApType);
 TUint32     GetUsedIapL();
 HBufC*      GetBearerTypeL(TUint32 aIapId);
+HBufC*      GetIapBearerTypeL(const TUint32 aAppDefaultApn, const TUint32 aAppDefaultApType);
 HBufC*      TranslateBearerInfoToNetworkAccessL(TConnMonBearerInfo aBearerInfo);
-HBufC*      GetDefIapBearerTypeL(TUint32 aMidSuiteId);
+HBufC*      GetAppDefIapBearerTypeL(const TUint32 aAppDefaultApn);
 
 /*
  * Class:     com_nokia_mj_impl_properties_mobinfo_MobileInfoProperties
@@ -95,16 +98,18 @@
 //    Each mobinfo java property implementation calls the getPropertyMsid()
 //    function of the MobileInfoProperties class.
 //    @param aProperty name of the actual property
+//    @param aAppDefaultApn application default access point id
+//    @param aAppDefaultApType application default access point type ( SNAP, IAP)
 //    @param aAppDefaultApn Application default apn
 // -----------------------------------------------------------------------------
 JNIEXPORT jstring JNICALL
 Java_com_nokia_mj_impl_properties_mobinfo_MobileInfoProperties__1getPropertyApn
-(JNIEnv* aJni, jclass, jint aProperty, jint aAppDefaultApn)
+(JNIEnv* aJni, jclass, jint aProperty, jint aAppDefaultApn, jint aAppDefaultApType)
 {
     LOG1(ESOCKET, EInfo, "MOBINFO + getPropertyMsid(), msid: %D", aAppDefaultApn);
     HBufC* property = NULL;
     jstring str = NULL;
-    property = GetProperty(aProperty, aAppDefaultApn);
+    property = GetProperty(aProperty, aAppDefaultApn,aAppDefaultApType);
     if (NULL != property)
     {
         LOG(ESOCKET,EInfo,"_getPropertyApn, property is not null");
@@ -124,7 +129,7 @@
     HBufC* property = NULL;
     jstring str = NULL;
 
-    property = GetProperty(aKey,NULL);
+    property = GetProperty(aKey,NULL,0);
     if (NULL != property)
     {
         TPtrC data(property->Des());
@@ -134,7 +139,7 @@
     return str;
 }
 
-HBufC* GetProperty(const TInt aProperty, const TUint32 aAppDefaultApn)
+HBufC* GetProperty(const TInt aProperty, const TUint32 aAppDefaultApn, const TUint32 aAppDefaultApType)
 {
     JELOG2(ESOCKET);
     LOG(ESOCKET, EInfo, "MOBINFO + GetProperty()");
@@ -148,7 +153,7 @@
         TRAP(err, property = GetDateTimePropertyL(aProperty));
         break;
     case NETWORK_ACCESS:
-        TRAP(err, property = GetNetworkAccessL(aAppDefaultApn));
+        TRAP(err, property = GetNetworkAccessL(aAppDefaultApn,aAppDefaultApType));
         LOG(ESOCKET, EInfo,"after GetNetworkAccessL");
         break;
 
@@ -785,21 +790,178 @@
 // Get type network access of currently used active connection
 // @return network access, ownership hand over
 // ---------------------------------------------------------------------------
-HBufC* GetNetworkAccessL(TUint32 aAppDefaultApn)
+HBufC* GetNetworkAccessL(TUint32 aAppDefaultApn, const TUint32 aAppDefaultApType)
 {
     LOG(ESOCKET, EInfo, "MOBINFO + GetNetworkAccessL");
     HBufC* bearerType = NULL;
     TUint32 iapId = GetUsedIapL();
-    if (iapId == 0)
+    if (iapId != 0)
+    {
+        // active connection present, opened by MIDlet.
+        bearerType = GetBearerTypeL(iapId);
+
+    }
+    else
     {
-        bearerType = GetDefIapBearerTypeL(aAppDefaultApn);
+        // if there is no active connection by the application, return the app default bearer type.
+        if (aAppDefaultApType == 3)
+        {
+            // app default is IAP
+            bearerType = GetAppDefIapBearerTypeL(aAppDefaultApn);
+
+        }
+        else
+        {
+            bearerType = GetIapBearerTypeL(aAppDefaultApn,aAppDefaultApType);
+        }
+
+    }
+    LOG(ESOCKET, EInfo, "MOBINFO - GetNetworkAccessL");
+    return bearerType;
+}
+
+
+//// ---------------------------------------------------------------------------
+//// Check if device default is set (SNAP or IAP)
+//// @return true if device default defined, else false
+//// ---------------------------------------------------------------------------
+
+bool isDeviceDefaultPresentL()
+{
+    TCmDefConnType type;
+    RCmManager * mgr = new(ELeave) RCmManager();
+    mgr->OpenL();
+
+    TCmDefConnValue obj;
+    mgr->ReadDefConnL(obj);
+    type = obj.iType;
+
+    if ((type!=ECmDefConnConnectionMethod) && (type!=ECmDefConnDestination))
+    {
+        // device default is other than SNAP or IAP
+        return false;
     }
     else
     {
-        bearerType = GetBearerTypeL(iapId);
+        return true;
+
     }
-    LOG(ESOCKET, EInfo, "MOBINFO - GetNetworkAccessL");
+
+
+
+}
+
+//// ---------------------------------------------------------------------------
+//// Get bearer type of Access point ID
+//// @return bearer type Acess point ID
+//// ---------------------------------------------------------------------------
+
+HBufC* GetIapBearerTypeL(const TUint32 aAppDefaultApn, const TUint32 aAppDefaultApType)
+{
+
+    LOG(ESOCKET, EInfo, "MOBINFO + GetIapBearerTypeL()");
+    RConnectionMonitor      monitor;
+    TUint                   connectionCount(0);
+    TUint                   iapId(0);
+    TRequestStatus          status(KErrNone);
+    HBufC*                  bearerType(NULL);
+    TUint                   connectionId(0);
+    TUint                   subConnectionCount(0);
+    TConnMonBearerInfo      bearerInfo(EBearerInfoUnknown);
+    bool                    flag = false;
+    TUint                   connIdx = 1;
+
+    User::LeaveIfError(monitor.ConnectL());
+    CleanupClosePushL(monitor);
+
+    status = KRequestPending;
+    monitor.GetConnectionCount(connectionCount, status);
+    User::WaitForRequest(status);
+    User::LeaveIfError(status.Int());
+    LOG1(ESOCKET, EInfo, "MOBINFO: GetIapBearerTypeL: Count of active connections: %D", connectionCount);
+
+    // Go through all connections
+    for (connIdx = 1; connIdx <= connectionCount;  ++connIdx)
+    {
+
+        connectionId = 0;
+        subConnectionCount = 0;
+        flag = false;
+
+        // Get connection ID
+        monitor.GetConnectionInfo(connIdx, connectionId, subConnectionCount);
+        User::LeaveIfError(connectionId);
+        // Get connection IAP ID
+        status = KRequestPending;
+        monitor.GetUintAttribute(connectionId, 0, KIAPId, iapId, status);
+        User::WaitForRequest(status);
+        User::LeaveIfError(status.Int());
+        LOG1(ESOCKET, EInfo, "MOBINFO: GetIapBearerTypeL Connection 's IAP ID found: %D", iapId);
+        if (aAppDefaultApType == 2)
+        {
+            LOG(ESOCKET, EInfo, "MOBINFO: Matching MIDlet defined SNAP to active IAP ID ");
+            // Midlet has a SNAP defined, so check if the active IAP is under this SNAP.
+            flag = ConnectionManager::isIapDefault(iapId, aAppDefaultApn,false);
+            if (!flag)
+            {
+                continue;  // active access point doesn't belong to MIDlet SNAP, check the next active access point.
+            }
+            else
+            {
+                break;
+            }
+        }
+        else
+        {
+            // No SNAP defined for the MIDlet, check for system default SNAP/IAP.
+            if (isDeviceDefaultPresentL())
+            {
+                LOG(ESOCKET, EInfo, "MOBINFO: Matching device default to active IAP ID ");
+                flag = ConnectionManager::isIapDefault(iapId, 0, true);
+                if (!flag)
+                {
+                    continue;  // active access point doesn't belong to MIDlet SNAP, check the next active access point.
+                }
+                else
+                {
+                    break;
+                }
+            }
+            else
+            {
+                LOG(ESOCKET, EInfo, "MOBINFO: Returning the bearer type of first active IAP ");
+                flag = true;
+                break; // no MIDlet SNAP, no device default, select this access point and return the bearer type
+
+            }
+        }
+
+    } // end of for loop
+
+    if (flag)
+    {
+        // we did not reach end of active connections, one of the conditions matched , find the bearer type
+        status = KRequestPending;
+        monitor.GetIntAttribute(connectionId,
+                                0,
+                                KBearerInfo,
+                                (TInt&)bearerInfo,
+                                status);
+        User::WaitForRequest(status);
+        User::LeaveIfError(status.Int());
+
+        // Translate bearer type to type of network access
+        bearerType = TranslateBearerInfoToNetworkAccessL(bearerInfo);
+    }
+    CleanupStack::PopAndDestroy(&monitor);
+    if (bearerType == NULL)
+    {
+        // No active connection (or) active IAP didn't match the conditions
+        bearerType = KNetworkAccessNa().AllocL();
+    }
     return bearerType;
+
+
 }
 
 //// ---------------------------------------------------------------------------
@@ -1047,26 +1209,24 @@
 
 // --------------------------------------------------------------------
 // Get network access type of default access point set in MIDlet settings
-// @param aAppDefaultApn MIDlet suite ID
+// @param aAppDefaultApn MIDlet default IAP
 // @return network access type, ownership hand over
-HBufC* GetDefIapBearerTypeL(TUint32 aAppDefaultApn)
+HBufC* GetAppDefIapBearerTypeL(const TUint32 aAppDefaultApn)
 {
-    LOG(ESOCKET, EInfo, "MOBINFO + GetDefIapBearerTypeL");
-    ELOG1(ESOCKET,  "GetDefIapBearerTypeL %d", aAppDefaultApn);
+    LOG1(ESOCKET, EInfo, "MOBINFO + GetAppDefIapBearerTypeL aId = %d ", aAppDefaultApn);
     HBufC* bearerType(NULL);
-    // MAPNSettings* apnTable = GetAPNSettingsLC(KAPNSettingsVersion);
-    //TUint32 apn = apnTable->GetAPNIdL( aMidSuiteId );
-    //CleanupStack::PopAndDestroy(); //apnTable
-    LOG1(ESOCKET, EInfo, "MIDlet specific IAP ID gotten: %D", aAppDefaultApn);
+
     if (aAppDefaultApn == 0 || aAppDefaultApn == (TUint32)-1)
     {
         bearerType = KNetworkAccessNa().AllocL();
     }
     else
     {
+
         RCmManager localCmManager;
         localCmManager.OpenL();
-        TUint32 tmpval = localCmManager.GetConnectionMethodInfoIntL(aAppDefaultApn,ECmBearerType);
+        TUint32 iap = aAppDefaultApn;
+        TUint32 tmpval = localCmManager.GetConnectionMethodInfoIntL(iap,ECmBearerType);
         ELOG1(ESOCKET,  "GetConnectionMethodInfoIntL: %d", tmpval);
         switch (tmpval)
         {
@@ -1084,11 +1244,8 @@
         default :
             bearerType = KNetworkAccessNa().AllocL();
             break;
-
-
         }
-
     }
-    LOG(ESOCKET, EInfo, "MOBINFO - GetDefIapBearerTypeL");
+    LOG(ESOCKET, EInfo, "MOBINFO - GetAppDefIapBearerTypeL");
     return bearerType;
 }
--- a/javaextensions/satsa/build/javasatsa.pro	Tue Jul 06 14:10:26 2010 +0300
+++ b/javaextensions/satsa/build/javasatsa.pro	Wed Aug 18 09:43:15 2010 +0300
@@ -11,33 +11,47 @@
 #
 # Contributors:
 #
-# Description: 
+# Description:
 #
 
+include(../../../inc/build_defines.pri)
+
 TARGET=javasatsa
 TEMPLATE=lib
-CONFIG += omj java  stl
-CONFIG -= qt
+CONFIG += omj java stl
+
+contains(PROJECT_DEFINES,RD_JAVA_S60_RELEASE_5_0) {
+    CONFIG -= qt
+}
+contains(PROJECT_DEFINES,RD_JAVA_S60_RELEASE_9_2) {
+    CONFIG -= qt
+}
+contains(PROJECT_DEFINES,RD_JAVA_S60_RELEASE_10_1_ONWARDS) {
+    CONFIG += hb
+}
 
 symbian {
+
+
  			INCLUDEPATH +=  ../framework/inc	\
                             ../pki/inc	\
                             ../apdu/inc	\
  							../../inc	\
  							../../../inc \
-                   	 
- 										  			
+
+
+
  			SOURCES +=  ../pki/src.s60/*.cpp \
                         ../crypto/src/*.cpp \
                         ../apdu/src/*.cpp	\
                         ../apdu/src.s60/*.cpp   \
                         ../framework/src/satsajnitools.cpp \
-                 							  								 
- 								  			
+
+
  			LIBS +=    -ljavastorage	\
  								 -lCommonUI \
  								 -lrandom \
-								 -lx509	\
+ 								 -lx509	\
 								 -lx500	\
 								 -llibcrypto \
 								 -lasn1	\
@@ -51,7 +65,7 @@
 								 -laknnotify \
 								 -leiksrv \
 								 -lctframework \
-								 -lctsecdlgs \ 
+								 -lctsecdlgs \
 								 -lcustomapi \
 								 -lefsrv \
 								 -letel \
@@ -61,9 +75,9 @@
 								 -lhash \
 								 -lWimClient	\
 								 -lestlib	\
-								 -lcryptography \		
-								   
- 
+								 -lcryptography \
+
+
  }
 
 include(../../../build/omj.pri)
--- a/javaextensions/satsa/pki/src.s60/cstscredentialmanager.cpp	Tue Jul 06 14:10:26 2010 +0300
+++ b/javaextensions/satsa/pki/src.s60/cstscredentialmanager.cpp	Wed Aug 18 09:43:15 2010 +0300
@@ -36,7 +36,6 @@
 #include <securityerr.h>
 
 
-
 // CONSTANTS
 _LIT(KSTSSymbianKeyStoreLabel, "Software key store");
 _LIT(KSTSSymbianCertificateStoreLabel, "Software certificate store");
@@ -67,10 +66,7 @@
 {
     delete iEncodedCert;
     delete iIssuerAndSerialNumber;
-    if (iPKIDialog)
-    {
-        iPKIDialog->Release();
-    }
+    
     delete iDistinguishedName;
     delete iDisplayName;
     delete iRequestEncoded;
@@ -533,8 +529,7 @@
 //
 void CSTSCredentialManager::ConstructL()
 {
-    iPKIDialog = PKIDialogFactory::CreateNoteL();
-
+    
     User::LeaveIfError(iFileServer.Connect());
     iWait = new(ELeave) CActiveSchedulerWait;
     iStore = CUnifiedCertStore::NewL(iFileServer, ETrue);
@@ -619,8 +614,7 @@
     {
         // not found, ok to add
         iState = EAddDialog;
-        iPKIDialog->SaveCertificate(EX509Certificate, EUserCertificate,
-                                    iSubject, iStatus);
+                        
         SetActive();
         return;
     }
@@ -720,7 +714,8 @@
     CCTCertInfo* certInfo = (*iCertInfoArray)[ 0 ];
     iState = ERemoveDialog;
     iHandle = certInfo->Handle();
-    iPKIDialog->DeleteCertificate(iHandle, iStatus);
+    
+    
     SetActive();
 }
 
@@ -783,7 +778,7 @@
     iState = ECSRDialog;
     iHandle = iKeyInfo->Handle();
 
-    iPKIDialog->CreateCSR(*iDisplayName, iHandle, iStatus);
+   
     SetActive();
 
 }
--- a/javaextensions/satsa/pki/src.s60/cstscredentialmanager.h	Tue Jul 06 14:10:26 2010 +0300
+++ b/javaextensions/satsa/pki/src.s60/cstscredentialmanager.h	Wed Aug 18 09:43:15 2010 +0300
@@ -31,7 +31,7 @@
 
 // FORWARD DECLARATIONS
 class CCTKeyInfo;
-class MPKIDialog;
+
 class CUnifiedCertStore;
 class CUnifiedKeyStore;
 class CX500DistinguishedName;
@@ -349,8 +349,6 @@
     // internal error variable
     TInt iError;
 
-    // PKI Dialog, owned
-    MPKIDialog* iPKIDialog;
 
     // The actual store, owned
     CUnifiedCertStore* iStore;
--- a/javaextensions/satsa/pki/src.s60/cstsseprompt.cpp	Tue Jul 06 14:10:26 2010 +0300
+++ b/javaextensions/satsa/pki/src.s60/cstsseprompt.cpp	Wed Aug 18 09:43:15 2010 +0300
@@ -18,11 +18,24 @@
 
 
 // INCLUDE FILES
+
+
+
 #include "cstsseprompt.h"
+
+#ifdef RD_JAVA_S60_RELEASE_10_1_ONWARDS
+
+#include <hbdevicedialog.h>
+#include <QtCore\qvariant.h>
+const QString KMessageTextKey = "text";
+
+#else 
+
 #include <AknGlobalNote.h>
 #include <avkon.rsg>
 #include <caosynchronizer.h>
 
+#endif 
 
 
 // ============================ MEMBER FUNCTIONS ===============================
@@ -43,8 +56,10 @@
 // Destructor
 CSTSSEPrompt::~CSTSSEPrompt()
 {
+#ifndef RD_JAVA_S60_RELEASE_10_1_ONWARDS
     delete iGlobalNote;
     delete iSynchronizer;
+#endif
 }
 
 // -----------------------------------------------------------------------------
@@ -54,11 +69,26 @@
 //
 void CSTSSEPrompt::DisplayPromptL(const TDesC& aPrompt)
 {
+    #ifdef RD_JAVA_S60_RELEASE_10_1_ONWARDS
+            HbDeviceDialog* dialog;
+            dialog = new(ELeave) HbDeviceDialog();
+            
+            QVariantMap parameters;
+            QString qString((QChar*)aPrompt.Ptr(),aPrompt.Length());
+            parameters[QString(KMessageTextKey)] = qString;
+            
+            dialog->show("com.nokia.hb.devicemessagebox/1.0", parameters);
+            
+            delete dialog;
+    #else
+            
     iGlobalNote->ShowNoteL(
         iSynchronizer->iStatus,
-        EAknGlobalConfirmationNote,
+        EAknGlobalConfirmationNote, 
         aPrompt);
     iSynchronizer->ExecuteL((TTimeIntervalMicroSeconds32) 0);
+            
+    #endif
 }
 
 // -----------------------------------------------------------------------------
@@ -77,9 +107,11 @@
 // -----------------------------------------------------------------------------
 void CSTSSEPrompt::ConstructL()
 {
+    #ifndef RD_JAVA_S60_RELEASE_10_1_ONWARDS
     iGlobalNote = CAknGlobalNote::NewL();
     iGlobalNote->SetSoftkeys(R_AVKON_SOFTKEYS_OK_EMPTY);
     iSynchronizer = CAOSynchronizer::NewL();
+    #endif
 }
 
 
--- a/javaextensions/satsa/pki/src.s60/cstsseprompt.h	Tue Jul 06 14:10:26 2010 +0300
+++ b/javaextensions/satsa/pki/src.s60/cstsseprompt.h	Wed Aug 18 09:43:15 2010 +0300
@@ -22,13 +22,13 @@
 // INCLUDE
 #include <e32base.h>
 
-
-
+// FORWARD DECLARATIONS
+#ifndef RD_JAVA_S60_RELEASE_10_1_ONWARDS
 
-// FORWARD DECLARATIONS
+class CAOSynchronizer;
 class CAknGlobalNote;
-class CAOSynchronizer;
 
+#endif
 // CLASS DECLARATION
 
 /**
@@ -71,11 +71,14 @@
 
 
 private: // data
-
+    #ifndef RD_JAVA_S60_RELEASE_10_1_ONWARDS
     // displays the prompt asynchronously, owned
     CAknGlobalNote* iGlobalNote;
     // waits for the prompt to finish, owned
     CAOSynchronizer* iSynchronizer;
+    
+    #endif
+    
 
 };
 
--- a/javaextensions/satsa/pki/src.s60/cstssignatureservice.cpp	Tue Jul 06 14:10:26 2010 +0300
+++ b/javaextensions/satsa/pki/src.s60/cstssignatureservice.cpp	Wed Aug 18 09:43:15 2010 +0300
@@ -15,8 +15,6 @@
  *
 */
 
-
-// INCLUDE FILES
 #include "cstssignatureservice.h"
 #include "tstsdistinguishednameconverter.h"
 #include "secdlg.h"
@@ -32,7 +30,11 @@
 #include <CCMSSignerInfo.h>
 #include <CCMSEncapsulatedContentInfo.h>
 #include <CCMSSignedData.h>
+
+#ifndef RD_JAVA_S60_RELEASE_10_1_ONWARDS
 #include <PKIDlg.h>
+#endif
+
 #include "cstsseprompt.h"
 
 #include <hash.h>
@@ -42,7 +44,7 @@
 #include "logger.h"
 #include "jstringutils.h"
 
-// CONSTANTS
+
 const TInt KDefaultGranularity = 1;
 
 const TInt KOptionIncludeContent = 1;
@@ -80,10 +82,12 @@
     {
         iDialog->Release(); // Release deletes the object
     }
+#ifndef RD_JAVA_S60_RELEASE_10_1_ONWARDS	
     if (iPKIDialog)
     {
         iPKIDialog->Release();
     }
+#endif	
     iCertificateArray.Close();
     iCertInfos.Close();
     delete iFilter;
@@ -126,14 +130,12 @@
         TInt aOptions, const CDesCArray& aCaNames,
         const TDesC& asecurityElementPrompt, TBool aShowData)
 {
-    LOG(ESATSA, EInfo, "+ CSTSSignatureService::AuthenticateL");
     if (iState != EReady)
     {
         ELOG(ESATSA, "CSTSSignatureService::AuthenticateL: Not Ready");
         User::Leave(KErrNotReady);
     }
 
-    LOG(ESATSA, EInfo, "CSTSSignatureService::AuthenticateL:After convertions");
     // First we need to convert the data to unicode, if we have to display it
     HBufC* textToDisplay = NULL;
     if (aShowData)
@@ -155,14 +157,9 @@
     iOptions = aOptions;
 
     iShowNotes = EFalse;
-
-    LOG(ESATSA, EInfo, "CSTSSignatureService::AuthenticateL:Going to call CreateSignatureL");
     // get handles to applicable certificates
     HBufC8* retVal = CreateSignatureL(aCaNames, EX509UsageDigitalSignature,
                                       asecurityElementPrompt);
-    LOG(ESATSA, EInfo, "CSTSSignatureService::AuthenticateL:After call to CreateSignatureL");
-
-    LOG(ESATSA, EInfo, "-- CSTSSignatureService::AuthenticateL");
     return retVal;
 }
 
@@ -171,7 +168,6 @@
         jint aOptions, jobjectArray aCaNames, jstring aSecurityElementPrompt,
         jboolean aShowData, HBufC8** aRetVal)
 {
-    LOG(ESATSA, EInfo, "+ CSTSSignatureService::StaticAuthenticateL");
     const TInt byteArrayLength = aJniEnv->GetArrayLength(
                                      aByteArrayToAuthenticate);
     jbyte* bytesToAuthenticate = aJniEnv->GetByteArrayElements(
@@ -189,20 +185,15 @@
     CDesCArrayFlat* nativeCaNames = STSCreateNativeStringArrayL(aJniEnv,
                                     aCaNames);
 
-    LOG(ESATSA, EInfo,  "CSTSSignatureService::StaticAuthenticateL: prepare se prompt");
     const JStringUtils securityElementPrompt(*aJniEnv, aSecurityElementPrompt);
 
-    LOG(ESATSA, EInfo,  "CSTSSignatureService::StaticAuthenticateL: start convertions to TInt");
     TBool ShowData = static_cast<TBool>(aShowData);
     const TDesC* sec = static_cast<const TDesC*>(&securityElementPrompt);
 
-    LOG(ESATSA, EInfo, "CSTSSignatureService::StaticAuthenticateL: After convertions,going to call CallMethodL");
     TRAPD(err, CallMethodL(*aRetVal, service,
                            &CSTSSignatureService::AuthenticateL, desToAuthenticate, aOptions,
                            *nativeCaNames, *sec, ShowData, service));
 
-    LOG(ESATSA, EInfo, "+ CSTSSignatureService::StaticAuthenticateL:After CallmethodL");
-    LOG(ESATSA, EInfo, "-- return CSTSSignatureService::StaticAuthenticateL");
     return err;
 
 }
@@ -216,15 +207,12 @@
 HBufC8* CSTSSignatureService::SignL(const TDesC8& aBytesToSign, TInt aOptions,
                                     const CDesCArray& aCaNames, const TDesC& aSecurityElementPrompt)
 {
-    LOG(ESATSA, EInfo, "+ CSTSSignatureService::SignL");
     if (iState != EReady)
     {
         ELOG(ESATSA, "CSTSSignatureService::SignL: Not Ready");
         User::Leave(KErrNotReady);
     }
 
-    LOG(ESATSA, EInfo, "CSTSSignatureService::SignL: start convertions!");
-    LOG(ESATSA, EInfo, "CSTSSignatureService::SignL: After convertions");
     // convert text from UTF8
     HBufC* textToDisplay = ConvertUTF8ToUnicodeL(aBytesToSign);
     delete iTextToDisplay;
@@ -238,12 +226,10 @@
 
     iShowNotes = ETrue;
 
-    LOG(ESATSA, EInfo, "CSTSSignatureService::SignL: Before call to CreateSignatureL");
     // get handles to applicable certificates
     HBufC8* retVal = CreateSignatureL(aCaNames, EX509UsageNonRepudiation,
                                       aSecurityElementPrompt);
 
-    LOG(ESATSA, EInfo, "-- return CSTSSignatureService::SignL");
     return retVal;
 }
 
@@ -256,13 +242,12 @@
                                        CSTSSignatureService* service, jbyteArray aBytesToSign, jint aOptions,
                                        jobjectArray aCaNames, jstring aSecurityElementPrompt, HBufC8** aRetVal)
 {
-    LOG(ESATSA, EInfo, "+ CSTSSignatureService::StaticSignL");
     const TInt byteArrayLength = aJniEnv->GetArrayLength(aBytesToSign);
     jbyte* bytesToSign = aJniEnv->GetByteArrayElements(aBytesToSign, NULL);
 
     if (!bytesToSign)
     {
-        LOG(ESATSA, EInfo, "CSTSSignatureService::StaticSignL: No memory");
+        ELOG(ESATSA, "CSTSSignatureService::StaticSignL: No memory");
         return NULL;
     }
 
@@ -273,15 +258,12 @@
 
     const JStringUtils securityElementPrompt(*aJniEnv, aSecurityElementPrompt);
 
-    LOG(ESATSA, EInfo, "CSTSSignatureService::StaticSignL: Start convertions");
-    LOG(ESATSA, EInfo, "CSTSSignatureService::StaticSignL: Before callmethodl");
-
+    
     const TDesC* sec = static_cast<const TDesC*>(&securityElementPrompt);
 
     TRAPD(err, CallMethodL(*aRetVal, service, &CSTSSignatureService::SignL,
                            desToSign, aOptions, *nativeCaNames, *sec, service));
 
-    LOG(ESATSA, EInfo, "-- ret CSTSSignatureService::StaticSignL");
     return err;
 }
 
@@ -292,28 +274,25 @@
 //
 void CSTSSignatureService::RunL()
 {
-    LOG(ESATSA, EInfo, "+ CSTSSignatureService::RunL");
     if (iStatus == KErrCancel)
     {
-        LOG(ESATSA, EInfo, "CSTSSignatureService::RunL: KErrCancel");
         if (iShowNotes)
         {
-            LOG(ESATSA, EInfo, "CSTSSignatureService::RunL: ShowNote");
             iState = EFinalNote;
             iStatus = KErrNone;
+#ifndef RD_JAVA_S60_RELEASE_10_1_ONWARDS			
             iPKIDialog->Note(MPKIDialog::ESigningCancelled, iStatus);
+#endif			
             SetActive();
-            LOG(ESATSA, EInfo, "CSTSSignatureService::RunL: Done ShowNote");
-        }
+         }
         else
         {
-            LOG(ESATSA, EInfo, "CSTSSignatureService::RunL: Complete");
-            Complete(KErrNone);
+             Complete(KErrNone);
         }
     }
     else if (iStatus != KErrNone)
     {
-        LOG(ESATSA, EInfo, "CSTSSignatureService::RunL: Error occured");
+        ELOG(ESATSA, "CSTSSignatureService::RunL: Error occured");
         // Error has occured; inform java
         Complete(iStatus.Int());
     }
@@ -323,29 +302,23 @@
         {
         case EInitialising:
         {
-            LOG(ESATSA, EInfo, "CSTSSignatureService::RunL: case EInitialising");
             iState = EKeyStoreInit;
             iKeyStore->Initialize(iStatus);
             SetActive();
-            LOG(ESATSA, EInfo, "CSTSSignatureService::RunL: over case EInitialising");
             break;
         }
         case EKeyStoreInit:
         {
-            LOG(ESATSA, EInfo, "CSTSSignatureService::RunL: case EKeyStoreInit");
             Complete(KErrNone);
             break;
         }
         case EListing:
         {
-            LOG(ESATSA, EInfo, "CSTSSignatureService::RunL: case EListing");
             HandlesFromCertInfosL();
-            LOG(ESATSA, EInfo, "CSTSSignatureService::RunL: over case EListing");
             break;
         }
         case EDialog:
         {
-            LOG(ESATSA, EInfo, "CSTSSignatureService::RunL: case EDialog");
             iState = EGetCert;
             if (iCertificate)
             {
@@ -360,12 +333,10 @@
 
             iCertStore->GetCert(iCertificate, iCertificateHandle, iStatus);
             SetActive();
-            LOG(ESATSA, EInfo, "CSTSSignatureService::RunL: over case EDialog");
             break;
         }
         case EGetCert:
         {
-            LOG(ESATSA, EInfo, "CSTSSignatureService::RunL: case EGetCert");
             if (iX509Certificate)
             {
                 delete iX509Certificate;
@@ -374,44 +345,35 @@
             iState = ERetrieveCert;
             iCertStore->Retrieve(*iCertificate, iX509Certificate, iStatus);
             SetActive();
-            LOG(ESATSA, EInfo, "CSTSSignatureService::RunL: over case EGetCert");
             break;
         }
         case ERetrieveCert:
         {
-            LOG(ESATSA, EInfo, "CSTSSignatureService::RunL: case ERetrieveCert");
             FindKeyL();
             break;
         }
         case EFindKey:
         {
-            LOG(ESATSA, EInfo, "CSTSSignatureService::RunL: case EFindKey");
             OpenSignerL();
             break;
         }
         case EOpenSigner:
         {
-            LOG(ESATSA, EInfo, "CSTSSignatureService::RunL: case EOpenSigner");
             SignL();
             break;
         }
         case ESign:
         {
-            LOG(ESATSA, EInfo, "CSTSSignatureService::RunL: case ESign");
             CreateSignedDataL();
-            LOG(ESATSA, EInfo, "CSTSSignatureService::RunL: over case ESign");
             break;
         }
         case EFinalNote:
         {
-            LOG(ESATSA, EInfo, "CSTSSignatureService::RunL: case EFinalNote");
             Complete(KErrNone);
-            LOG(ESATSA, EInfo, "CSTSSignatureService::RunL: over case EFinalNote");
             break;
         }
         default:
         {
-            LOG(ESATSA, EInfo, "CSTSSignatureService::RunL: case default");
             Complete(KErrGeneral);
         }
         }
@@ -425,7 +387,6 @@
 //
 TInt CSTSSignatureService::RunError(TInt aError)
 {
-    LOG(ESATSA, EInfo, "+ CSTSSignatureService::RunError");
     Complete(aError);
     return KErrNone;
 }
@@ -524,8 +485,9 @@
 {
     User::LeaveIfError(iFileServer.Connect());
     iDialog = SecurityDialogFactory::CreateL();
+#ifndef RD_JAVA_S60_RELEASE_10_1_ONWARDS	
     iPKIDialog = PKIDialogFactory::CreateNoteL();
-
+#endif
     iFilter = CCertAttributeFilter::NewL();
 
     iWait = new(ELeave) CActiveSchedulerWait;
@@ -542,7 +504,6 @@
 //
 void CSTSSignatureService::Complete(TInt aError)
 {
-    LOG(ESATSA, EInfo, "+ CSTSSignatureService::Complete");
     if (KErrNone == aError)
     {
         iState = EReady;
@@ -553,7 +514,7 @@
         iError = aError;
     }
     iWait->AsyncStop();
-    LOG(ESATSA, EInfo, "-- ret CSTSSignatureService::Complete");
+    
 }
 
 // -----------------------------------------------------------------------------
@@ -563,17 +524,14 @@
 //
 void CSTSSignatureService::WaitForCompletionL()
 {
-    LOG(ESATSA, EInfo, "+ CSTSSignatureService::WaitForCompletionL");
     SetActive();
     iWait->Start();
     if (iState != EReady)
     {
         // we need to be ready for the next request
         iState = EReady;
-
         User::Leave(iError);
     }
-    LOG(ESATSA, EInfo, "- ret CSTSSignatureService::WaitForCompletionL");
 }
 
 // -----------------------------------------------------------------------------
@@ -584,7 +542,6 @@
 HBufC8* CSTSSignatureService::CreateSignatureL(const CDesCArray& aCaNames,
         const TKeyUsageX509 aUsage, const TDesC& aSecurityElementPrompt)
 {
-    LOG(ESATSA, EInfo, "+ CSTSSignatureService::CreateSignatureL");
     HBufC* sePrompt = NULL;
     if (aSecurityElementPrompt != KNullDesC())
     {
@@ -592,14 +549,10 @@
     }
     delete iSecurityElementPrompt;
     iSecurityElementPrompt = sePrompt;
-    LOG(ESATSA, EInfo, "CSTSSignatureService::CreateSignatureL: call findcertificates");
     FindCertificatesL(aCaNames, aUsage);
-    LOG(ESATSA, EInfo, "CSTSSignatureService::CreateSignatureL: After call to findcertificates");
     WaitForCompletionL();
-    LOG(ESATSA, EInfo, "CSTSSignatureService::CreateSignatureL: call WaitForCompletion");
     HBufC8* retVal = iSignature;
     iSignature = NULL;
-    LOG(ESATSA, EInfo, "-- ret CSTSSignatureService::CreateSignatureL");
     return retVal;
 }
 // -----------------------------------------------------------------------------
@@ -611,7 +564,6 @@
         const TKeyUsageX509 aUsage)
 {
 
-    LOG(ESATSA, EInfo, "+ CSTSSignatureService::FindCertificatesL");
     iFilter->SetKeyUsage(aUsage);
     iFilter->SetOwnerType(EUserCertificate);
     iFilter->SetFormat(EX509Certificate);
@@ -654,7 +606,7 @@
         iState = EListing;
         iCertStore->List(iCertInfos, *iFilter, iDERNames, iStatus);
     }
-    LOG(ESATSA, EInfo, "-- ret CSTSSignatureService::FindCertificatesL");
+    
 }
 
 // -----------------------------------------------------------------------------
@@ -664,7 +616,6 @@
 //
 void CSTSSignatureService::HandlesFromCertInfosL()
 {
-    LOG(ESATSA, EInfo, "+ CSTSSignatureService::HandlesFromCertInfosL");
     TInt certificateCount = iCertInfos.Count();
     if (certificateCount == 0)
     {
@@ -675,7 +626,6 @@
     iCertificateArray.Reset();
     for (TInt i = 0; i < certificateCount; i++)
     {
-        LOG(ESATSA, EInfo, "+ CSTSSignatureService::HandlesFromCertInfosL: No Certificates");
         User::LeaveIfError(iCertificateArray.Append(iCertInfos[i]->Handle()));
     }
 
@@ -684,18 +634,18 @@
     {
     case EAuthWithoutText:
     {
-        LOG(ESATSA, EInfo, "CSTSSignatureService::HandlesFromCertInfosL: case EAuthWithoutText");
+#ifndef RD_JAVA_S60_RELEASE_10_1_ONWARDS        
         iPKIDialog->UserAuthentication(iCertificateArray, iCertificateHandle,
                                        iStatus);
-        LOG(ESATSA, EInfo, "CSTSSignatureService::HandlesFromCertInfosL: over case EAuthWithoutText");
+#endif 
         break;
     }
     case EAuthWithText:
     {
-        LOG(ESATSA, EInfo, "CSTSSignatureService::HandlesFromCertInfosL: case EAuthWithText");
+#ifndef RD_JAVA_S60_RELEASE_10_1_ONWARDS
         iPKIDialog->UserAuthenticationText(*iTextToDisplay, iCertificateArray,
                                            iCertificateHandle, iStatus);
-        LOG(ESATSA, EInfo, "CSTSSignatureService::HandlesFromCertInfosL: over case EAuthWithText");
+#endif
         break;
     }
     case ESignWithText:
@@ -721,7 +671,6 @@
 //
 void CSTSSignatureService::FindKeyL()
 {
-    LOG(ESATSA, EInfo, "+ CSTSSignatureService::FindKeyL");
     iKeyFilter.iKeyAlgorithm = CKeyInfoBase::EInvalidAlgorithm;
     iKeyFilter.iKeyId = iCertificate->SubjectKeyId();
 
@@ -740,7 +689,6 @@
 //
 void CSTSSignatureService::OpenSignerL()
 {
-    LOG(ESATSA, EInfo, "+ CSTSSignatureService::OpenSignerL");
     // if key is not found, display security element prompt and search again
     if (iKeys.Count() == 0)
     {
@@ -803,8 +751,6 @@
 //
 void CSTSSignatureService::SignL()
 {
-    LOG(ESATSA, EInfo, "+ CSTSSignatureService::SignL");
-
     // first we create a digest of the message
 
     CSHA1* sha = CSHA1::NewL();
@@ -892,7 +838,6 @@
 //
 void CSTSSignatureService::CreateSignedDataL()
 {
-    LOG(ESATSA, EInfo, "+ CSTSSignatureService::CreateSignedDataL");
     CCTKeyInfo* keyInfo = iKeys[0];
 
     HBufC8* signature = NULL;
@@ -987,14 +932,16 @@
     if (iShowNotes)
     {
         iState = EFinalNote;
+#ifndef RD_JAVA_S60_RELEASE_10_1_ONWARDS		
         iPKIDialog->Note(MPKIDialog::ESignatureDone, iStatus);
+#endif		
         SetActive();
     }
     else
     {
         Complete(KErrNone);
     }
-    LOG(ESATSA, EInfo, "-- ret CSTSSignatureService::CreateSignedDataL");
+
 }
 
 // -----------------------------------------------------------------------------
--- a/javaextensions/satsa/pki/src.s60/cstssignatureservice.h	Tue Jul 06 14:10:26 2010 +0300
+++ b/javaextensions/satsa/pki/src.s60/cstssignatureservice.h	Wed Aug 18 09:43:15 2010 +0300
@@ -19,19 +19,18 @@
 #ifndef CSTSSIGNATURESERVICE_H
 #define CSTSSIGNATURESERVICE_H
 
-//  INCLUDES
+
+
 #include <e32base.h>
 #include <badesca.h>
 #include <mctkeystore.h>
 #include "functionserver.h"
 
-// CONSTANTS
-
-
-
 // FORWARD DECLARATIONS
 class MSecurityDialog;
+#ifndef RD_JAVA_S60_RELEASE_10_1_ONWARDS 
 class MPKIDialog;
+#endif
 class CUnifiedCertStore;
 class CUnifiedKeyStore;
 class CCTCertInfo;
@@ -266,8 +265,10 @@
     // security dialog, owned
     MSecurityDialog* iDialog;
 
+#ifndef RD_JAVA_S60_RELEASE_10_1_ONWARDS
     // PKI Dialog, owned
     MPKIDialog* iPKIDialog;
+#endif	
 
     // certificate store, owned
     CUnifiedCertStore* iCertStore;
--- a/javaextensions/sensor/src.s60/cacceleratorsensorrawdata.cpp	Tue Jul 06 14:10:26 2010 +0300
+++ b/javaextensions/sensor/src.s60/cacceleratorsensorrawdata.cpp	Wed Aug 18 09:43:15 2010 +0300
@@ -97,6 +97,18 @@
     TSensrvProperty property;
     TInt intValue(0);
     GetProperty(aList, KSensrvPropIdScaledRange,KSensrvItemIndexNone, property);
+
+    if ((property.GetArrayIndex() == ESensrvArrayPropertyInfo)&&
+            (property.PropertyType() == ESensrvIntProperty))
+    {
+        // Read index
+        TInt rangeIndex = 0;
+
+        // Read actual property data from array
+        GetProperty(aList, KSensrvPropIdScaledRange,
+                    KSensrvItemIndexNone, rangeIndex, property);
+    }
+
     if (property.PropertyType() == ESensrvIntProperty)
     {
         aPtr->Append(KMeasureRangeCount);
--- a/javaextensions/sensor/src.s60/csensorbase.cpp	Tue Jul 06 14:10:26 2010 +0300
+++ b/javaextensions/sensor/src.s60/csensorbase.cpp	Wed Aug 18 09:43:15 2010 +0300
@@ -139,7 +139,14 @@
 void CSensorBase::AsyncCallback(TMethod aMethod)
 {
     JELOG2(ESensor);
-    iMethodArray.Append(aMethod);
+    TInt err = iMethodArray.Append(aMethod);
+    // if there was error when adding the method to array then just return
+    if ( err  )
+    {
+        ELOG2(ESensor, "CSensorBase::AsyncCallback - Error (code = %d) when "
+              "adding method (type = %d) to method buffer.", err, aMethod.iMethodType);
+        return;
+    }
 
     // If there is old request ongoing, wait it for completion
     if (iMethodArray.Count() > 1)
--- a/javaextensions/wma/sms_cbs/javasrc/com/nokia/mj/impl/smscbs/utils/WmaUrl.java	Tue Jul 06 14:10:26 2010 +0300
+++ b/javaextensions/wma/sms_cbs/javasrc/com/nokia/mj/impl/smscbs/utils/WmaUrl.java	Wed Aug 18 09:43:15 2010 +0300
@@ -95,7 +95,7 @@
         int index = iAbsoluteUri.indexOf("://");
         int nameLength = iAbsoluteUri.length();
         if ((index == -1) || (index != iAbsoluteUri.indexOf(':'))
-                || ((index + 3) > nameLength))
+                || ((index + 3) >= nameLength))
         {
             throw new IllegalArgumentException(INVALID_URL.concat(iAbsoluteUri));
         }
--- a/javaextensions/wma/sms_cbs/pushplugin/cbs/src.s60/cbsserverconnection.cpp	Tue Jul 06 14:10:26 2010 +0300
+++ b/javaextensions/wma/sms_cbs/pushplugin/cbs/src.s60/cbsserverconnection.cpp	Wed Aug 18 09:43:15 2010 +0300
@@ -524,7 +524,7 @@
         }
         // Store the received page number, such that the message can
         // be reconstructed in the correct order later
-        mCbsMessagePagesRef.Append(currentPage);
+        mCbsMessagePagesRef.AppendL(currentPage);
 
         // Store the actual content of the message
         mCbsMessagePagesData->AppendL(messageData);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javamanager/javaappscheme/build/javaappscheme.pro	Wed Aug 18 09:43:15 2010 +0300
@@ -0,0 +1,35 @@
+#
+# Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+#
+# Contributors:
+#
+# Description: QT Service application the implements support for
+#               starting Java applications using "javaapp:" QUrl
+#
+
+TEMPLATE=app
+TARGET=javaappscheme
+CONFIG += omj no_icon stl service
+CONFIG -= gui
+
+symbian {
+    TARGET.UID3       = 0x200315F0
+    TARGET.CAPABILITY = CAP_APPLICATION
+    LIBS += -lxqservice -lxqserviceutil
+}
+
+SERVICE.FILE = service_conf.xml
+SERVICE.OPTIONS = embeddable
+SERVICE.OPTIONS += hidden
+
+HEADERS=../src.s60/serviceapp.h 
+
+include(../../../build/omj.pri)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javamanager/javaappscheme/build/service_conf.xml	Wed Aug 18 09:43:15 2010 +0300
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<service>
+  <name>javaappscheme</name>
+  <filepath>No path</filepath>
+  <description>Launch Java app service</description>
+  <interface>
+     <name>com.nokia.symbian.IUriView</name>
+     <version>1.0</version>
+     <description>Interface for showing URIs</description>
+     <customproperty key="schemes">javaapp</customproperty>
+     <customproperty key="deprecatedsn">com.nokia.services.serviceapp</customproperty>
+  </interface>
+</service>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javamanager/javaappscheme/src.s60/main.cpp	Wed Aug 18 09:43:15 2010 +0300
@@ -0,0 +1,44 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  QT Service application the implements support for
+*               starting Java applications using "javaapp:" QUrl
+*
+*/
+
+#include <QTimer>
+
+#include "logger.h"
+#include "serviceapp.h"
+
+
+int main(int argc, char **argv)
+{
+    LOG1(EJavaQtServiceApp, EInfo, "javaappscheme main() called with %d args", argc);
+    for (int nInd = 0; nInd < argc; nInd++)
+    {
+        LOG2(EJavaQtServiceApp, EInfo, "javaappscheme main() arg %d is %s", nInd, *(argv + nInd)); 
+    }
+    
+    ServiceApp app(argc, argv);
+   
+    // Close this service app after 14 seconds if no one has called us
+    QTimer::singleShot(14 * 1000, &app, SLOT(quit()));
+
+    int ret = app.exec();
+    
+    LOG1(EJavaQtServiceApp, EInfo, "javaappscheme main() exiting with value %d", ret);
+
+    return ret;
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javamanager/javaappscheme/src.s60/serviceapp.cpp	Wed Aug 18 09:43:15 2010 +0300
@@ -0,0 +1,152 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  QT Service application the implements support for
+*               starting Java applications using "javaapp:" QUrl
+*
+*/
+
+#include <QUrl>
+
+#include "logger.h"
+
+#include "serviceapp.h"
+#include <xqserviceutil.h>
+
+
+ServiceApp::ServiceApp(int &argc, char **argv)
+    : QApplication(argc, argv), mUriService(NULL)
+{
+    LOG(EJavaQtServiceApp, EInfo, "ServiceApp (QApplication) constructor called");
+    bool isService = XQServiceUtil::isService();
+    if (isService)
+    {
+        mUriService = new UriService(this);
+    }
+
+    QString interface = XQServiceUtil::interfaceName();
+    QString operation = XQServiceUtil::operationName();
+
+    QString t = "SERVICEAPP:\n";
+    t = t + (isService ?  "    Service launch\n" : "    Normal launch\n");
+    t = t + (XQServiceUtil::isEmbedded() ? "    Embedded\n" : "    Not embedded\n");
+    t = t + ("    Interface=" + interface + "\n");
+    t = t + ("    Operation=" + operation + "\n");
+
+    std::string callType = t.toStdString();
+    LOG1(EJavaQtServiceApp, EInfo, "ServiceApp called as %s", callType.c_str());
+}
+
+ServiceApp::~ServiceApp()
+{
+    LOG(EJavaQtServiceApp, EInfo, "ServiceApp destructor called");
+    delete mUriService;
+}
+
+void ServiceApp::quit()
+{
+    LOG(EJavaQtServiceApp, EInfo, "ServiceApp quit() called");
+}
+
+
+// ----------UriService---------------
+
+// The service string param given to XQServiceProvider must contain first
+// the name of the name of the service and then the name of the interface
+// (from service_conf.xml)
+UriService::UriService(ServiceApp* parent)
+: XQServiceProvider(QLatin1String("javaappscheme.com.nokia.symbian.IUriView"),parent),
+    mServiceApp(parent)
+{
+    LOG(EJavaQtServiceApp, EInfo, "UriService::UriService called");
+    publishAll();
+}
+
+UriService::~UriService()
+{
+    LOG(EJavaQtServiceApp, EInfo, "UriService::~UriService called");
+}
+
+bool UriService::view(const QString& uri)
+{
+    LOG(EJavaQtServiceApp, EInfo, "UriService::view(uri) called");
+    return view(uri, true);
+}
+
+bool UriService::view(const QString& uri, bool retValue)
+{
+    LOG(EJavaQtServiceApp, EInfo, "UriService::view(uri, retValue) called");
+    std::wstring stdWStrUri = uri.toStdWString();
+    LOG1(EJavaQtServiceApp, EInfo, "url is %S", stdWStrUri.c_str());
+    if (retValue)
+    {
+        LOG(EJavaQtServiceApp, EInfo, "UriService::view retValue parameter is true");
+    }
+
+    XQRequestInfo info = requestInfo();
+    bool asyncAnswer = !info.isSynchronous();
+
+    // Start javalauncher.exe and pass the Url to it
+    _LIT(KJavaLauncherExe, "javalauncher.exe");
+    RProcess rProcess;
+    retValue = true;
+
+    // start
+    HBufC* bufUri = HBufC::New(stdWStrUri.size());
+    if (0 == bufUri)
+    {
+        return false;
+    }
+    TPtr16 ptrUri(bufUri->Des());
+    ptrUri.Append((const TUint16*)stdWStrUri.c_str(), stdWStrUri.size());
+
+    TInt err = rProcess.Create(KJavaLauncherExe, ptrUri);
+    if (KErrNone == err)
+    {
+        // This call will wait until javalauncher exits (or panics)
+        TRequestStatus status;
+        rProcess.Logon(status);
+        rProcess.Resume();
+
+        // now wait until javalauncher exits
+        User::WaitForRequest(status);
+        err = status.Int();
+        if (err != KErrNone)
+        {
+            ELOG1(EJavaQtServiceApp,
+                "UriService::view javalauncher exited with error %d", err);
+            retValue = false;
+        }
+    }
+    else
+    {
+        ELOG1(EJavaQtServiceApp,
+            "UriService::view Cannot create javalauncher process, error %d", err);
+        retValue = false;
+    }
+
+    // free resources before returning
+    rProcess.Close();
+    delete bufUri;
+
+    if (KErrNone != err)
+    {
+#ifndef _DEBUG
+        // Make sure Url is logged always if an error has happened
+        ELOG1(EJavaQtServiceApp, "UriService::view url was %S", stdWStrUri.c_str());
+#endif
+        retValue = false;
+    }
+
+    return retValue;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javamanager/javaappscheme/src.s60/serviceapp.h	Wed Aug 18 09:43:15 2010 +0300
@@ -0,0 +1,63 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  QT Service application the implements support for
+*               starting Java applications using "javaapp:" QUrl
+*
+*/
+
+#ifndef JAVAQTSERVICEAPP_H
+#define JAVAQTSERVICEAPP_H
+
+
+// #include <QCoreApplication>
+#include <QApplication>
+#include <xqserviceprovider.h>
+
+
+class UriService;
+
+class ServiceApp : public QApplication // public QCoreApplication
+{
+    Q_OBJECT
+
+public:
+    ServiceApp(int &argc, char **argv);
+    ~ServiceApp();
+
+// TEMP TEST
+public slots:    
+    static void quit();
+
+private:
+    UriService* mUriService;
+};
+
+
+class UriService : public XQServiceProvider
+{
+    Q_OBJECT
+    public:
+        UriService( ServiceApp *parent = 0 );
+        ~UriService();
+
+    public slots:
+        bool view(const QString& uri);
+        bool view(const QString& uri, bool returnValue);
+
+    private:
+        ServiceApp* mServiceApp;
+};
+
+
+#endif  // JAVAQTSERVICEAPP_H
--- a/javamanager/javaappschemeplugin/build/bld.inf	Tue Jul 06 14:10:26 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,30 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*   Build information for the Java 2.x javaapp: scheme handler plugin
-*
-*/
-
-#include <platform_paths.hrh>
-
-PRJ_PLATFORMS
-DEFAULT
-
-PRJ_EXPORTS
-
-PRJ_MMPFILES
-javaappschemeplugin.mmp
-
-
-
--- a/javamanager/javaappschemeplugin/build/javaappschemeplugin.mmp	Tue Jul 06 14:10:26 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,54 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:  This is an ECOM plugin for Scheme Handler that handles
-*   "javaapp:" URI scheme
-*/
-
-#include <platform_paths.hrh>
-#include <../../../inc/project_defines.hrh>
-#include <../../../inc/build_defines.hrh>
-
-TARGET      javaappschemeplugin.dll
-TARGETTYPE  plugin
-UID         0x10009D8D 0x2002875F
-
-// Use bytepair compression to enable code paging
-PAGED
-
-APP_LAYER_SYSTEMINCLUDE
-
-#ifndef RD_JAVA_S60_RELEASE_9_2
-SYSTEMINCLUDE   /epoc32/include/ecom    // Due to SchemeHandler.inl in 5.0 2009w18 and 10.1 builds
-#endif
-
-SOURCEPATH  ../src
-
-SOURCE  javaapphandler.cpp
-SOURCE  proxy.cpp
-
-START RESOURCE  ../data/2002875F.rss
-TARGET javaappschemeplugin.rsc
-END
-
-USERINCLUDE     ../inc
-
-
-LIBRARY     euser.lib
-LIBRARY     ecom.lib
-LIBRARY     efsrv.lib
-LIBRARY     apparc.lib
-LIBRARY     flogger.lib
-
-CAPABILITY CAP_ECOM_PLUGIN
-VENDORID   VID_DEFAULT
--- a/javamanager/javaappschemeplugin/data/2002875F.rss	Tue Jul 06 14:10:26 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,54 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:  ECOM resource definition for Java javaapp:
-*   scheme handler plugin. Implements CSchemeHandler interface
-*
-*/
-
-//  INCLUDES
-#include <ecom/registryinfov2.rh>
-
-//  RESOURCE DEFINITIONS
-
-RESOURCE REGISTRY_INFO theInfo
-    {
-    resource_format_version = RESOURCE_FORMAT_VERSION_2;
-
-    // UID for the DLL, KJavaAppHandlerDllUid
-    dll_uid = 0x2002875F;
-
-    // Interface info array
-    interfaces =
-        {
-        INTERFACE_INFO
-            {
-            // UID of the implemented interface
-            interface_uid = 0x101f8534;
-
-            implementations =
-                {
-                IMPLEMENTATION_INFO
-                    {
-                    // KJavaLocalAppHandlerEcomImplUid
-                    implementation_uid = 0x20028767;
-                    version_no   = 1;
-                    display_name = "URL handler for javaapp scheme";
-                    default_data = "javaapp";
-                    opaque_data  = "";
-                    rom_only     =  0;
-                    }
-                };
-            }
-        };
-    }
--- a/javamanager/javaappschemeplugin/inc/javaapphandler.h	Tue Jul 06 14:10:26 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,104 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:  Declaration of Scheme handler interface implementation for
-*   "javaapp:" URI scheme
-*
-*/
-
-#ifndef JAVAAPPHANDLER_H
-#define JAVAAPPHANDLER_H
-
-// INCLUDES
-
-#ifdef RD_JAVA_S60_RELEASE_10_1_ONWARDS
-#include <SchemeHandler.h>
-#else
-#include <schemehandler.h>
-#endif
-
-#include <e32base.h>
-
-
-namespace java
-{
-
-namespace javaapphandler
-{
-
-/**
-*  Scheme Handler IF implementation class for javaapp: uri scheme
-*
-*/
-NONSHARABLE_CLASS(CJavaAppHandler) : public CSchemeHandler
-{
-
-public:     // Constructors and destructor
-
-    /**
-    * Two phased constructor. Leaves on failure.
-    * @param - aUrl
-    * @return The created object.
-    */
-    static CJavaAppHandler* NewL(const TDesC& aUrl);
-
-    /**
-     * Destructor.
-     */
-    virtual ~CJavaAppHandler();
-
-private: // Constructors
-
-    /**
-    * Constructor.
-    */
-    CJavaAppHandler();
-
-    /**
-    * Second phase constructor. Leaves on failure.
-    * @param - aUrl
-    */
-    void ConstructL(const TDesC& aUrl);
-
-public:
-
-    /**
-    * Url Handler with embedding.
-    * All applications are always started standalone.
-    * @param -
-    */
-    void HandleUrlEmbeddedL();
-
-    /**
-    * Url Handler without embedding
-    * @param -
-    */
-    void HandleUrlStandaloneL();
-
-    /**
-    * Observer is not supported. Does nothing.
-    * @param - aSchemeDoc
-    */
-    void Observer(MAknServerAppExitObserver* aSchemeDoc);
-
-protected: // Data
-
-    // Results of parsing
-    HBufC* mParsedUrl; ///< Owned.
-};
-
-} // javaapphandler
-
-} // java
-
-#endif // JAVAAPPHANDLER_H
--- a/javamanager/javaappschemeplugin/src/javaapphandler.cpp	Tue Jul 06 14:10:26 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,165 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:  Implementation of Scheme handler interface implementation
-*      for localapp://jam/launch scheme
-*
-*/
-
-
-// INCLUDE FILES
-#include <e32base.h>
-#include <escapeutils.h>
-#include <apgcli.h>
-#include <eikproc.h>
-#include <apacmdln.h>
-#include <e32const.h>
-#include <flogger.h>
-
-#include "javaapphandler.h"
-
-using namespace java;
-
-namespace java
-{
-
-namespace javaapphandler
-{
-
-// ================= CONSTANTS =======================
-
-_LIT(KJavaLogDir, "java\\full");
-_LIT(KJavaLogFile, "JavaUtils.log");
-
-// ================= MACROS =======================
-
-// Define logging macros here to remove dependencies to Java 2.0 libraries.
-#define LOG(str)  { TBuf8<1024> f((const TUint8 *)str); RFileLogger::Write(KJavaLogDir, KJavaLogFile, EFileLoggingModeAppend, f); }
-#define LOG1(str, a)  { TBuf8<1024> f((const TUint8 *)str); RFileLogger::WriteFormat(KJavaLogDir, KJavaLogFile, EFileLoggingModeAppend, f, a); }
-#define LOG1WSTR(str, wstr) { TBuf8<1024> f((const TUint8 *)str); RFileLogger::Write(KJavaLogDir, KJavaLogFile, EFileLoggingModeAppend, f); TBuf16<KLogBufferSize> w((const TUint16 *)wstr); RFileLogger::Write(KJavaLogDir, KJavaLogFile, EFileLoggingModeAppend, w); }
-
-// ================= MEMBER FUNCTIONS =======================
-
-
-// ---------------------------------------------------------
-// CJavaAppHandler::CJavaAppHandler()
-// ---------------------------------------------------------
-//
-CJavaAppHandler::CJavaAppHandler()
-        : CSchemeHandler()
-{
-}
-
-// ---------------------------------------------------------
-// CJavaAppHandler::ConstructL()
-// ---------------------------------------------------------
-//
-void CJavaAppHandler::ConstructL(const TDesC& aUrl)
-{
-    mParsedUrl = aUrl.AllocL();
-}
-
-// ---------------------------------------------------------
-// CJavaAppHandler::Observer()
-// ---------------------------------------------------------
-//
-
-void CJavaAppHandler::Observer(MAknServerAppExitObserver* /* aSchemeDoc */)
-{
-    // do nothing
-}
-
-// ================= MEMBER FUNCTIONS =======================
-
-// ---------------------------------------------------------
-// CJavaAppHandler::NewL()
-// ---------------------------------------------------------
-//
-CJavaAppHandler* CJavaAppHandler::NewL(const TDesC& aUrl)
-{
-    CJavaAppHandler* self=new(ELeave) CJavaAppHandler();
-    CleanupStack::PushL(self);
-    self->ConstructL(aUrl);
-    CleanupStack::Pop(self);
-
-    return self;
-}
-
-// ---------------------------------------------------------
-// CJavaAppHandler::~CJavaAppHandler()
-// ---------------------------------------------------------
-//
-CJavaAppHandler::~CJavaAppHandler()
-{
-    delete mParsedUrl;
-}
-
-// ---------------------------------------------------------
-// CJavaAppHandler::HandleUrlEmbeddedL()
-// ---------------------------------------------------------
-//
-void CJavaAppHandler::HandleUrlEmbeddedL()
-{
-    HandleUrlStandaloneL();
-}
-
-// ---------------------------------------------------------
-// CJavaAppHandler::HandleUrlStandaloneL()
-// ---------------------------------------------------------
-//
-void CJavaAppHandler::HandleUrlStandaloneL()
-{
-
-
-    // Start javalauncher.exe and pass the Url to it
-    _LIT(KJavaLauncherExe, "javalauncher.exe");
-    RProcess rProcess;
-
-    // start
-    TInt err = rProcess.Create(KJavaLauncherExe, *mParsedUrl);
-    if (KErrNone == err)
-    {
-        // This call will wait until javalauncher exits (or panics)
-        TRequestStatus status;
-        rProcess.Logon(status);
-        rProcess.Resume();
-
-        // now wait until javalauncher exits
-        User::WaitForRequest(status);
-        err = status.Int();
-        if (err != KErrNone)
-        {
-            LOG1("javaapphandler: javalauncher exited with error %d", err);
-        }
-    }
-    else
-    {
-        LOG1("javaapphandler: Cannot create javalauncher process, error %d", err);
-    }
-
-    // free resources before returning
-    rProcess.Close();
-
-    if (KErrNone != err)
-    {
-#ifndef _DEBUG
-        // Make sure Url is logged always if an error has happened
-        TBuf<255> logBuf = mParsedUrl->Left(250);
-        LOG1WSTR("javaapphandler: command line starts with : %s", (TUint16 *)(logBuf.PtrZ()));
-#endif
-        User::Leave(err);
-    }
-}
-
-} // namespace javaapphandler
-} // namespace java
--- a/javamanager/javaappschemeplugin/src/proxy.cpp	Tue Jul 06 14:10:26 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,42 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:  Implements interface that exports ECOM implementation
-*               factories within this .dll
-*/
-
-
-#include <e32std.h>
-#include <ecom/implementationproxy.h>
-
-#include "javaapphandler.h"
-
-// CONSTANTS
-const TImplementationProxy KImplementationTable[] =
-    { IMPLEMENTATION_PROXY_ENTRY(0x20028767,
-                                 java::javaapphandler::CJavaAppHandler::NewL)
-    };
-
-// -----------------------------------------------------------------------------
-// ImplementationGroupProxy
-// Returns the implementations in this DLL
-// Returns: The ECOM implementations in this DLL
-// -----------------------------------------------------------------------------
-//
-EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount)
-{
-    aTableCount = sizeof(KImplementationTable) / sizeof(TImplementationProxy);
-    return KImplementationTable;
-}
-
-//  End of File
--- a/javamanager/javacaptain/extensionplugins/javacertstore/src.s60/smartcardcryptotokenreader.cpp	Tue Jul 06 14:10:26 2010 +0300
+++ b/javamanager/javacaptain/extensionplugins/javacertstore/src.s60/smartcardcryptotokenreader.cpp	Wed Aug 18 09:43:15 2010 +0300
@@ -59,7 +59,7 @@
         NextState(Initialize());
         break;
     case EListTokenTypes:
-        NextState(ListTokenTypes());
+        NextState(ListTokenTypesL());
         break;
     case EOpenTokenType:
         NextState(OpenTokenType());
@@ -132,11 +132,11 @@
     return true;
 }
 
-bool SmartCardCryptoTokenReader::ListTokenTypes()
+bool SmartCardCryptoTokenReader::ListTokenTypesL()
 {
     TCTTokenTypeAttribute att = { KCTRemovable , 1 };
-    iSmartCardTokensAttributes.Append(att);
-    iSmartCardTokensInterfaces.Append(TUid::Uid(KInterfaceCertStore));
+    iSmartCardTokensAttributes.AppendL(att);
+    iSmartCardTokensInterfaces.AppendL(TUid::Uid(KInterfaceCertStore));
     TCTFindTokenTypesByInterfaceAndAttribute findByIAndA(
         iSmartCardTokensInterfaces.Array(), iSmartCardTokensAttributes.Array());
     CCTTokenTypeInfo::ListL(iSmartCardTokenTypes, findByIAndA);
--- a/javamanager/javacaptain/extensionplugins/javacertstore/src.s60/smartcardcryptotokenreader.h	Tue Jul 06 14:10:26 2010 +0300
+++ b/javamanager/javacaptain/extensionplugins/javacertstore/src.s60/smartcardcryptotokenreader.h	Wed Aug 18 09:43:15 2010 +0300
@@ -61,7 +61,7 @@
     SmartCardCryptoTokenReader();
     void ConstructL();
     bool Initialize();
-    bool ListTokenTypes();
+    bool ListTokenTypesL();
     bool OpenTokenType();
     bool OpenToken();
     bool GetTokenInterface();
--- a/javamanager/javacaptain/extensionplugins/preinstallerstarter/inc/preinstallerstarter.h	Tue Jul 06 14:10:26 2010 +0300
+++ b/javamanager/javacaptain/extensionplugins/preinstallerstarter/inc/preinstallerstarter.h	Wed Aug 18 09:43:15 2010 +0300
@@ -59,7 +59,9 @@
 
 private:
     void startPreinstaller(TBool aIadBoot);
+#ifndef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK
     void registerMidletApplicationTypeHandler();
+#endif
 
     CoreInterface* mCore;
     RProcess*      mPreinstaller;
--- a/javamanager/javacaptain/extensionplugins/preinstallerstarter/src.s60/preinstallerstarter.cpp	Tue Jul 06 14:10:26 2010 +0300
+++ b/javamanager/javacaptain/extensionplugins/preinstallerstarter/src.s60/preinstallerstarter.cpp	Wed Aug 18 09:43:15 2010 +0300
@@ -19,7 +19,9 @@
 
 
 #include <e32base.h>
+#ifndef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK
 #include <apgcli.h> // for RApaLsSession
+#endif
 #include <hal_data.h>
 #include <hal.h>
 #include <sysutil.h>
@@ -320,6 +322,7 @@
  * Register 'javalauncher.exe' as the midlet application type handler
  * in AppArc. If necessary unregister old handler first.
  */
+#ifndef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK
 void PreinstallerStarter::registerMidletApplicationTypeHandler()
 {
     _LIT(KMidpAppArcPlugin, "javalauncher.exe");
@@ -381,6 +384,7 @@
               err);
     }
 }
+#endif
 
 void PreinstallerStarter::RunL()
 {
--- a/javamanager/javacaptain/extensionplugins/settingslistener/build/exports.inf	Tue Jul 06 14:10:26 2010 +0300
+++ b/javamanager/javacaptain/extensionplugins/settingslistener/build/exports.inf	Wed Aug 18 09:43:15 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
 * All rights reserved.
 * This component and the accompanying materials are made available
 * under the terms of "Eclipse Public License v1.0"
@@ -16,4 +16,4 @@
 */
 
 PRJ_EXPORTS
-../inc/settingschangeeventsprovidermessages.h                          |../../../inc/settingschangeeventsprovidermessages.h
+../inc/settingschangeeventsprovidermessages.h |../../../inc/settingschangeeventsprovidermessages.h
--- a/javamanager/javacaptain/extensionplugins/settingslistener/build/javacaptain_ext_settingslistener.pro	Tue Jul 06 14:10:26 2010 +0300
+++ b/javamanager/javacaptain/extensionplugins/settingslistener/build/javacaptain_ext_settingslistener.pro	Wed Aug 18 09:43:15 2010 +0300
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+# Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
 # All rights reserved.
 # This component and the accompanying materials are made available
 # under the terms of "Eclipse Public License v1.0"
@@ -20,16 +20,10 @@
 CONFIG -= qt
 
 symbian {
-    SOURCES += ../src/*.cpp ../src.s60/*.cpp
     LIBS += -lcommonengine \
             -lcentralrepository \
             -lcenrepnotifhandler \
             -ljavacomms
 }
 
-!symbian {
-    SOURCES += ../src/*.cpp ../src.linux/*.cpp
-}
-
-
 include(../../../../../build/omj.pri)
--- a/javamanager/javacaptain/extensionplugins/settingslistener/inc/settingschangeeventsprovidermessages.h	Tue Jul 06 14:10:26 2010 +0300
+++ b/javamanager/javacaptain/extensionplugins/settingslistener/inc/settingschangeeventsprovidermessages.h	Wed Aug 18 09:43:15 2010 +0300
@@ -11,7 +11,8 @@
 *
 * Contributors:
 *
-* Description:  BootEventProviderMessages
+* Description:  Definition of comms messages used for reporting chages in system
+*                    settings.
 *
 */
 
@@ -35,21 +36,21 @@
 
 typedef enum
 {
-    UNDEFINED_CHANGE          = 0x00,
-    MIDP_CLASS_PATH_CHANGE          = 0x01,
+    UNDEFINED_CHANGE  = 0x00,
+    MIDP_CLASS_PATH_CHANGE = 0x01,
 
 } SettingsChangeEventType_t;
 
 
 inline void setSettingsChangeEventMessageParams(CommsMessage& aMessage,
-                                                      const int& aChangeEventType)
+        const int& aChangeEventType)
 {
     aMessage.setMessageId(SETTINGS_CHANGE_EVENT_MESSAGE_ID_C);
     aMessage << aChangeEventType;
 }
 
 inline void getSettingsChangeEventMessageParams(CommsMessage& aMessage,
-                                                      int& aChangeEventType)
+        int& aChangeEventType)
 {
     if (aMessage.getMessageId() == SETTINGS_CHANGE_EVENT_MESSAGE_ID_C)
     {
@@ -59,7 +60,7 @@
     {
         ELOG2(EJavaCaptain, "Received Settings Change Event with  wrong MessageId!: %d should be %d",
               aMessage.getMessageId(), SETTINGS_CHANGE_EVENT_MESSAGE_ID_C);
-        aChangeEventType = 0;
+        aChangeEventType = UNDEFINED_CHANGE;
     }
 }
 
--- a/javamanager/javacaptain/extensionplugins/settingslistener/inc/settingslistenerextension.h	Tue Jul 06 14:10:26 2010 +0300
+++ b/javamanager/javacaptain/extensionplugins/settingslistener/inc/settingslistenerextension.h	Wed Aug 18 09:43:15 2010 +0300
@@ -11,7 +11,8 @@
 *
 * Contributors:
 *
-* Description:  Sample
+* Description:  Extension plugin which is used for monitoring changes in various
+*                     system settings.
 *
 */
 
@@ -23,8 +24,6 @@
 #include "extensionplugininterface.h"
 #include "settingslistenerinterface.h"
 
-using namespace java::comms;
-
 namespace java
 {
 namespace captain
--- a/javamanager/javacaptain/extensionplugins/settingslistener/inc/settingslistenerinterface.h	Tue Jul 06 14:10:26 2010 +0300
+++ b/javamanager/javacaptain/extensionplugins/settingslistener/inc/settingslistenerinterface.h	Wed Aug 18 09:43:15 2010 +0300
@@ -11,7 +11,8 @@
 *
 * Contributors:
 *
-* Description:  ExtensionPluginInterface
+* Description:  Definition of interface, which is used for listening changes in
+*                     in system settings.
 *
 */
 
@@ -24,15 +25,13 @@
 namespace captain
 {
 
-class CoreInterface;
-
 class SettingsListenerInterface
 {
 public:
     virtual ~SettingsListenerInterface() {}
 
-    virtual void StartListening() = 0;
-    virtual void StopListening() = 0;
+    virtual void startListening() = 0;
+    virtual void stopListening() = 0;
 
 };
 
--- a/javamanager/javacaptain/extensionplugins/settingslistener/src.s60/cenreplistener.cpp	Tue Jul 06 14:10:26 2010 +0300
+++ b/javamanager/javacaptain/extensionplugins/settingslistener/src.s60/cenreplistener.cpp	Wed Aug 18 09:43:15 2010 +0300
@@ -15,6 +15,9 @@
 *
 */
 
+#include <e32base.h>
+#include <centralrepository.h>
+
 #include "coreinterface.h"
 #include "eventconsumerinterface.h"
 
@@ -22,160 +25,91 @@
 #include "cenreplistener.h"
 #include "settingschangeeventsprovidermessages.h"
 
-#include <e32base.h>
-#include <centralrepository.h>
-
 namespace java
 {
 namespace captain
 {
 
-    // General listener used as a base value indicating that whole repository is being
-    // listened instead of individual key.
-    CenRepListener::CenRepListener() : mKeyType(CenRepListener::GENERAL_LISTENER)
-    {
-        JELOG2(EJavaCaptain);
-    }
+// General listener used as a base value indicating that whole repository is being
+// listened instead of individual key.
+CenRepListener::CenRepListener() : mKeyType(CenRepListener::GENERAL_LISTENER)
+{
+}
 
-    CenRepListener::~CenRepListener()
-    {
-        JELOG2(EJavaCaptain);
-        Close();
-    }
+CenRepListener::~CenRepListener()
+{
+    close();
+}
 
-    void CenRepListener::Close()
+void CenRepListener::close()
+{
+    if (mNotifyHandler)
     {
-        JELOG2(EJavaCaptain);
-        if (mNotifyHandler ) {
-            mNotifyHandler->StopListening();
-            delete mNotifyHandler;
-            mNotifyHandler = 0;
-        }
-        if ( mCenRepSession ) {
-            delete mCenRepSession;
-            mCenRepSession = 0;
-        }
+        mNotifyHandler->StopListening();
+        delete mNotifyHandler;
+        mNotifyHandler = 0;
     }
-
-    CenRepListener* CenRepListener::NewLC(CoreInterface* aCore, TUid aRepoId, TUint32 aKeyId,
-        CCenRepNotifyHandler::TCenRepKeyType aKeyType)
+    if (mCenRepSession)
     {
-        JELOG2(EJavaCaptain);
-        CenRepListener* crListener = new (ELeave) CenRepListener();
-        CleanupStack::PushL(crListener);
-        crListener->ConstructL(aCore, aRepoId, aKeyId, aKeyType);
-        return (crListener);
-    }
-
-    CenRepListener* CenRepListener::NewL(CoreInterface* aCore, TUid aRepoId, TUint32 aKeyId,
-        CCenRepNotifyHandler::TCenRepKeyType aKeyType)
-    {
-        JELOG2(EJavaCaptain);
-        CenRepListener* crListener = CenRepListener::NewLC(aCore, aRepoId, aKeyId, aKeyType);
-        CleanupStack::Pop(crListener);
-        return (crListener);
+        delete mCenRepSession;
+        mCenRepSession = 0;
     }
+}
 
-    CenRepListener* CenRepListener::NewLC(CoreInterface* aCore, TUid aRepoId)
-    {
-        JELOG2(EJavaCaptain);
-        CenRepListener* crListener = new (ELeave) CenRepListener();
-        CleanupStack::PushL(crListener);
-        crListener->ConstructL(aCore, aRepoId);
-        return (crListener);
-    }
+CenRepListener* CenRepListener::NewL(CoreInterface* aCore, TUid aRepoId, TUint32 aKeyId,
+                                     CCenRepNotifyHandler::TCenRepKeyType aKeyType)
+{
+    CenRepListener* crListener = new(ELeave)  CenRepListener();
+    CleanupStack::PushL(crListener);
+    crListener->ConstructL(aCore, aRepoId, aKeyId, aKeyType);
+    CleanupStack::Pop(crListener);
+    return (crListener);
+}
 
-    CenRepListener* CenRepListener::NewL(CoreInterface* aCore, TUid aRepoId)
-    {
-        JELOG2(EJavaCaptain);
-        CenRepListener* crListener = CenRepListener::NewLC(aCore, aRepoId);
-        CleanupStack::Pop(crListener);
-        return (crListener);
-    }
+void CenRepListener::ConstructL(CoreInterface* aCore, TUid aRepoId, TUint32 aKeyId,
+                                CCenRepNotifyHandler::TCenRepKeyType aKeyType)
+{
+    mCore = aCore;
+    mRepoId = aRepoId;
+    mKeyType = aKeyType;
+    mCenRepSession = CRepository::NewL(mRepoId);
+    mNotifyHandler = CCenRepNotifyHandler::NewL(*this, *mCenRepSession,
+                     aKeyType, aKeyId);
+    mNotifyHandler->StartListeningL();
+}
 
-    void CenRepListener::ConstructL(CoreInterface* aCore, TUid aRepoId, TUint32 aKeyId,
-        CCenRepNotifyHandler::TCenRepKeyType aKeyType)
+void CenRepListener::HandleNotifyString(TUint32 aKeyId, const TDesC16& /*aNewValue*/)
+{
+    if (KCRUidJavaRuntime == mRepoId && KJavaRuntimeMIDPClasspath == aKeyId)
     {
-        JELOG2(EJavaCaptain);
-        mCore = aCore;
-        mRepoId = aRepoId;
-        mKeyType = aKeyType;
-        mCenRepSession = CRepository::NewL(mRepoId);
-        mNotifyHandler = CCenRepNotifyHandler::NewL(*this, *mCenRepSession,
-                                                    aKeyType, aKeyId);
-        mNotifyHandler->StartListeningL();
+        ILOG(EJavaCaptain, "CenRepListener::HandleNotifyString: change notified "
+             "in key KJavaRuntimeMIDPClasspath");
+        dispatchEvent(SETTINGS_CHANGE_EVENT_PROVIDER,
+                      MIDP_CLASS_PATH_CHANGE);
     }
-
-    void CenRepListener::ConstructL(CoreInterface* aCore, TUid aRepoId)
+    else
     {
-        JELOG2(EJavaCaptain);
-        mCore = aCore;
-        mRepoId = aRepoId;
-        mCenRepSession = CRepository::NewL(mRepoId);
-        mNotifyHandler = CCenRepNotifyHandler::NewL(*this, *mCenRepSession);
-        mNotifyHandler->StartListeningL();
-    }
-
-    void CenRepListener::HandleNotifyInt(TUint32 aKeyId, TInt /*aNewValue*/)
-    {
-        JELOG2(EJavaCaptain);
-        WLOG1(EJavaCaptain, "Change in Unrecognised cenrep TInt key noticed! "
+        WLOG1(EJavaCaptain, "Change in Unrecognised cenrep string key noticed! "
               "CR Key= %0x", aKeyId);
     }
-
-    void CenRepListener::HandleNotifyReal( TUint32 aKeyId, TReal /*aNewValue*/ )
-    {
-        JELOG2(EJavaCaptain);
-        WLOG1(EJavaCaptain, "Change in Unrecognised cenrep TReal key noticed! "
-              "CR Key= %0x", aKeyId);
-    }
+}
 
-    void CenRepListener::HandleNotifyBinary( TUint32 aKeyId, const TDesC8& /*aNewValue*/ )
-    {
-        JELOG2(EJavaCaptain);
-        WLOG1(EJavaCaptain, "Change in Unrecognised cenrep Binary key noticed! "
-              "CR Key= %0x", aKeyId);
-    }
-
-    void CenRepListener::HandleNotifyGeneric(TUint32 aKeyId)
-    {
-        JELOG2(EJavaCaptain);
-        WLOG1(EJavaCaptain, "Change in Unrecognised cenrep key noticed! "
-              "CR Key= %0x", aKeyId);
-    }
+void CenRepListener::HandleNotifyError(TUint32 aKeyId, TInt aError, CCenRepNotifyHandler* /* aHandler */)
+{
+    ELOG2(EJavaCaptain, "Error (code: %d) occured when listening changes on "
+          "Cenrep key (Key ID: %0x). Listening stopped!", aError, aKeyId);
+    close();
+}
 
-    void CenRepListener::HandleNotifyString( TUint32 aKeyId, const TDesC16& /*aNewValue*/ )
-    {
-        JELOG2(EJavaCaptain);
-        if ( KCRUidJavaRuntime == mRepoId && KJavaRuntimeMIDPClasspath == aKeyId ) {
-            ILOG(EJavaCaptain, "CenRepListener::HandleNotifyString: change notified "
-                 "in key KJavaRuntimeMIDPClasspath");
-            dispatchEvent(SETTINGS_CHANGE_EVENT_PROVIDER,
-                                        MIDP_CLASS_PATH_CHANGE);
-        } else {
-            WLOG1(EJavaCaptain, "Change in Unrecognised cenrep string key noticed! "
-                  "CR Key= %0x", aKeyId);
-        }
-    }
-
-    void CenRepListener::HandleNotifyError(TUint32 aKeyId, TInt error, CCenRepNotifyHandler* /* aHandler */)
-    {
-        JELOG2(EJavaCaptain);
-        ELOG2(EJavaCaptain, "Error (code: %d) occured when listening changes on "
-              "Cenrep key (Key ID: %0x). Listening stopped!", error, aKeyId);
-        Close();
-    }
-
-    void CenRepListener::dispatchEvent(const std::string& aEvent,
-                                       const SettingsChangeEventType_t& aType) const
-    {
-        JELOG2(EJavaCaptain);
-        ILOG2(EJavaCaptain, "CenRepListener::dispatchEvent: dispatching event=%s "
-              "type=%d", aEvent.c_str(), aType);
-        CommsMessage eventMsg;
-        setSettingsChangeEventMessageParams(eventMsg, aType);
-        mCore->getEventDispatcher()->event(aEvent, eventMsg);
-    }
+void CenRepListener::dispatchEvent(const std::string& aEvent,
+                                   const SettingsChangeEventType_t& aType) const
+{
+    ILOG2(EJavaCaptain, "CenRepListener::dispatchEvent: dispatching event=%s "
+          "type=%d", aEvent.c_str(), aType);
+    CommsMessage eventMsg;
+    setSettingsChangeEventMessageParams(eventMsg, aType);
+    mCore->getEventDispatcher()->event(aEvent, eventMsg);
+}
 
 } // namespace captain
 } // namespace java
--- a/javamanager/javacaptain/extensionplugins/settingslistener/src.s60/cenreplistener.h	Tue Jul 06 14:10:26 2010 +0300
+++ b/javamanager/javacaptain/extensionplugins/settingslistener/src.s60/cenreplistener.h	Wed Aug 18 09:43:15 2010 +0300
@@ -16,58 +16,39 @@
 *
 */
 
-#ifndef CENREP_LISTENER_H
-#define CENREP_LISTENER_H
+#ifndef CENREPLISTENER_H
+#define CENREPLISTENER_H
+
+#include <e32std.h>
+#include <cenrepnotifyhandler.h>
 
 #include "javaosheaders.h"
 #include "settingschangeeventsprovidermessages.h"
-
-#include <e32std.h>
-#include <cenrepnotifyhandler.h>
+#include "javaruntimeprivatecrkeys.h"
 
 namespace java
 {
 namespace captain
 {
 
-/**
- * Java Runtime environment Central Repository UID
- */
-const TUid    KCRUidJavaRuntime             = { 0x10282DFD };
-
-/**
- * Indicates classpath for MIDP runtimes. This key value is generated
- * from the values defined by extension libraries.
- */
-const TUint32 KJavaRuntimeMIDPClasspath     = 0x00000001;
-
-
 class CoreInterface;
 
 OS_NONSHARABLE_CLASS(CenRepListener) :
-public CBase, public MCenRepNotifyHandlerCallback
+        public CBase, public MCenRepNotifyHandlerCallback
 {
 public:
     enum TListenerType {GENERAL_LISTENER = -1};
 
-    static CenRepListener* NewLC(CoreInterface* aCore, TUid aRepoId, TUint32 aKeyId,
-                                 CCenRepNotifyHandler::TCenRepKeyType aKeyType);
     static CenRepListener* NewL(CoreInterface* aCore, TUid aRepoId, TUint32 aKeyId,
-                                  CCenRepNotifyHandler::TCenRepKeyType aKeyType);
-    static CenRepListener* NewLC(CoreInterface* aCore, TUid aRepoId);
-    static CenRepListener* NewL(CoreInterface* aCore, TUid aRepoId);
+                                CCenRepNotifyHandler::TCenRepKeyType aKeyType);
 
     virtual ~CenRepListener();
 
-    // MCenRepNotifyHandlerCallback
+    // MCenRepNotifyHandlerCallback (only partial implementation needed here for now)
     // These handler methods must know what to do in each case, i.e
     // how to handle the change in each particular key.
-    virtual void HandleNotifyString( TUint32 aKeyId, const TDesC16& aNewValue );
-    virtual void HandleNotifyInt(TUint32 aKeyId, TInt aNewValue);
-    virtual void HandleNotifyReal( TUint32 aId, TReal aNewValue );
-    virtual void HandleNotifyBinary( TUint32 aId, const TDesC8& aNewValue );
-    virtual void HandleNotifyGeneric(TUint32 aKeyId);
-    virtual void HandleNotifyError(TUint32 aKeyId, TInt error,
+    virtual void HandleNotifyString(TUint32 aKeyId, const TDesC16& aNewValue);
+    virtual void HandleNotifyError(TUint32 aKeyId, TInt aError,
                                    CCenRepNotifyHandler* aHandler);
 protected:
     CenRepListener();
@@ -76,10 +57,9 @@
                        const SettingsChangeEventType_t& aType) const;
 
 private:
-    void ConstructL(CoreInterface* aCore, TUid aRepoId);
     void ConstructL(CoreInterface* aCore, TUid aRepoId, TUint32 aKeyId,
                     CCenRepNotifyHandler::TCenRepKeyType aKeyType);
-    void Close();
+    void close();
     TInt mKeyType;
     CoreInterface* mCore;
     TUid mRepoId;
@@ -90,5 +70,5 @@
 } // namespace captain
 } // namespace java
 
-#endif // CENREP_LISTENER_H
+#endif // CENREPLISTENER_H
 
--- a/javamanager/javacaptain/extensionplugins/settingslistener/src.s60/settingslistenerimpl.cpp	Tue Jul 06 14:10:26 2010 +0300
+++ b/javamanager/javacaptain/extensionplugins/settingslistener/src.s60/settingslistenerimpl.cpp	Wed Aug 18 09:43:15 2010 +0300
@@ -24,74 +24,62 @@
 namespace captain
 {
 
-    SettingsListenerImpl::SettingsListenerImpl(CoreInterface* aCore) :
+SettingsListenerImpl::SettingsListenerImpl(CoreInterface* aCore) :
         mCore(aCore)
-    {
-        JELOG2(EJavaCaptain);
-
-    }
-
-    SettingsListenerImpl::~SettingsListenerImpl()
-    {
-        JELOG2(EJavaCaptain);
-        cleanUp();
-    }
+{
+}
 
-    void SettingsListenerImpl::StartListening()
-    {
-        JELOG2(EJavaCaptain);
-        // All "listeners" must be created&started here.
+SettingsListenerImpl::~SettingsListenerImpl()
+{
+    cleanUp();
+}
 
-        // Currently there is just this one CenRep key to be listened
-        std::auto_ptr<CenRepListener> cRMidpClassPathChangeListener;
-        int error = createCenRepKeyListener(KCRUidJavaRuntime, KJavaRuntimeMIDPClasspath,
-                                         CCenRepNotifyHandler::EStringKey,
-                                         cRMidpClassPathChangeListener);
-        if ( KErrNone == error ) {
-            mCenRepListeners.push_back(cRMidpClassPathChangeListener.release());
-        } else {
-            ELOG4(EJavaCaptain, "Error (code: %d) occured when starting "
-                  "CenRepListener (repo=%0x, key=%0x, keytype=%d)",
-                  error, KCRUidJavaRuntime.iUid, KJavaRuntimeMIDPClasspath,
-                  CCenRepNotifyHandler::EStringKey);
-        }
-    }
+void SettingsListenerImpl::startListening()
+{
+    // All "listeners" must be created&started here.
 
-    void SettingsListenerImpl::StopListening()
+    // Currently there is just this one CenRep key to be listened
+    TInt error = KErrNone;
+    CenRepListener* crMidpClassPathChangeListener =
+        createCenRepKeyListener(KCRUidJavaRuntime, KJavaRuntimeMIDPClasspath,
+                                CCenRepNotifyHandler::EStringKey, error);
+    if (crMidpClassPathChangeListener)
     {
-        JELOG2(EJavaCaptain);
-        cleanUp();
+        mCenRepListeners.push_back(crMidpClassPathChangeListener);
     }
-
-    int SettingsListenerImpl::createCenRepKeyListener(TUid aRepoId, TUint32 aKeyId,
-                                                  CCenRepNotifyHandler::TCenRepKeyType aKeyType,
-                                                std::auto_ptr<CenRepListener>& aListener)
-    {
-        JELOG2(EJavaCaptain);
-        TRAPD( error, aListener.reset(CenRepListener::NewL(mCore, aRepoId, aKeyId, aKeyType)) );
-        return error;
-    }
-
-    int SettingsListenerImpl::createCenRepListener(TUid aRepoId, CenRepListener*& aListener)
+    else
     {
-        JELOG2(EJavaCaptain);
-        TRAPD( error, aListener = CenRepListener::NewL(mCore, aRepoId));
-        return error;
+        ELOG4(EJavaCaptain, "Error (code: %d) occured when starting "
+              "CenRepListener (repo=%0x, key=%0x, keytype=%d)",
+              error, KCRUidJavaRuntime.iUid, KJavaRuntimeMIDPClasspath,
+              CCenRepNotifyHandler::EStringKey);
     }
+}
 
-    // Clean up owned resources
-    void SettingsListenerImpl::cleanUp()
+void SettingsListenerImpl::stopListening()
+{
+    cleanUp();
+}
+
+CenRepListener* SettingsListenerImpl::createCenRepKeyListener(TUid aRepoId, TUint32 aKeyId,
+        CCenRepNotifyHandler::TCenRepKeyType aKeyType, TInt& aErrorCode)
+{
+    CenRepListener* listener = NULL;
+    TRAP(aErrorCode, listener = CenRepListener::NewL(mCore, aRepoId, aKeyId, aKeyType));
+    return listener; // Possible error propagated as a function parameter
+}
+
+// Clean up owned resources
+void SettingsListenerImpl::cleanUp()
+{
+    for (crListeners_t::iterator listenersIter = mCenRepListeners.begin();
+            listenersIter != mCenRepListeners.end();  ++listenersIter)
     {
-        JELOG2(EJavaCaptain);
-
-        for  ( crListeners_t::iterator listenersIter = mCenRepListeners.begin();
-               listenersIter != mCenRepListeners.end();  ++listenersIter )
-        {
-            delete *listenersIter;
-            *listenersIter = 0;
-        }
-        mCenRepListeners.clear();
+        delete *listenersIter;
+        *listenersIter = 0;
     }
+    mCenRepListeners.clear();
+}
 
 } // namespace captain
 } // namespace java
--- a/javamanager/javacaptain/extensionplugins/settingslistener/src.s60/settingslistenerimpl.h	Tue Jul 06 14:10:26 2010 +0300
+++ b/javamanager/javacaptain/extensionplugins/settingslistener/src.s60/settingslistenerimpl.h	Wed Aug 18 09:43:15 2010 +0300
@@ -20,14 +20,13 @@
 #ifndef SETTINGSLISTENERIMPL_H
 #define SETTINGSLISTENERIMPL_H
 
-#include "javaosheaders.h"
-
-#include "settingslistenerinterface.h"
-
 #include <vector>
 #include <memory>
 #include <cenrepnotifyhandler.h>
 
+#include "javaosheaders.h"
+#include "settingslistenerinterface.h"
+
 namespace java
 {
 namespace captain
@@ -43,15 +42,14 @@
     virtual ~SettingsListenerImpl();
 
     // SystemSettingsChangeListenerInterface
-    virtual void StartListening();
-    virtual void StopListening();
+    virtual void startListening();
+    virtual void stopListening();
 
 private:
     void cleanUp();
-    int createCenRepKeyListener(TUid aRepoId, TUint32 aKeyId,
-                            CCenRepNotifyHandler::TCenRepKeyType aKeyType,
-                            std::auto_ptr<CenRepListener>& aListener);
-    int createCenRepListener(TUid aRepoId, CenRepListener*& aListener);
+    CenRepListener* createCenRepKeyListener(TUid aRepoId, TUint32 aKeyId,
+                                            CCenRepNotifyHandler::TCenRepKeyType aKeyType,
+                                            TInt& aErrorCode);
 
     CoreInterface* mCore;  // resource not owned
     typedef std::vector<CenRepListener*> crListeners_t;
--- a/javamanager/javacaptain/extensionplugins/settingslistener/src/settingslistenerextension.cpp	Tue Jul 06 14:10:26 2010 +0300
+++ b/javamanager/javacaptain/extensionplugins/settingslistener/src/settingslistenerextension.cpp	Wed Aug 18 09:43:15 2010 +0300
@@ -11,12 +11,11 @@
 *
 * Contributors:
 *
-* Description:  Sample
+* Description:  Implementation for creating system settings listener plugin
 *
 */
 
 #include "logger.h"
-
 #include "settingslistenerextension.h"
 #include "settingslistenerimpl.h"
 
@@ -35,40 +34,32 @@
 namespace captain
 {
 
-    SettingsListenerExtension::SettingsListenerExtension() : mCore(0), mSettingsListenerImpl(0)
+SettingsListenerExtension::SettingsListenerExtension() : mCore(0), mSettingsListenerImpl(0)
 {
-    JELOG2(EJavaCaptain);
-    ILOG(EJavaCaptain, "SettingsListenerExtension::SettingsListenerExtension()");
 }
 
 SettingsListenerExtension::~SettingsListenerExtension()
 {
-    JELOG2(EJavaCaptain);
-    ILOG(EJavaCaptain, "SettingsListenerExtension::~SettingsListenerExtension()");
 }
 
 void SettingsListenerExtension::startPlugin(CoreInterface* core)
 {
-    JELOG2(EJavaCaptain);
-    ILOG(EJavaCaptain, "SettingsListenerExtension::startPlugin()");
-    if ( mSettingsListenerImpl || mCore )
+    if (mSettingsListenerImpl || mCore)
     {
         WLOG(EJavaCaptain, "Settingslistener plugin already running, terminating previous instance first!");
         stopPlugin();
     }
     mCore = core;
     mSettingsListenerImpl = new SettingsListenerImpl(mCore);
-    mSettingsListenerImpl->StartListening();
+    mSettingsListenerImpl->startListening();
 }
 
 void SettingsListenerExtension::stopPlugin()
 {
-    JELOG2(EJavaCaptain);
-    ILOG(EJavaCaptain, "SettingsListenerExtension::stopPlugin()");
     mCore = 0;
-    if ( mSettingsListenerImpl )
+    if (mSettingsListenerImpl)
     {
-        mSettingsListenerImpl->StopListening();
+        mSettingsListenerImpl->stopListening();
         delete mSettingsListenerImpl;
         mSettingsListenerImpl = 0;
     }
--- a/javamanager/javacaptain/inc.s60/tickerprovider.h	Tue Jul 06 14:10:26 2010 +0300
+++ b/javamanager/javacaptain/inc.s60/tickerprovider.h	Wed Aug 18 09:43:15 2010 +0300
@@ -43,7 +43,7 @@
     virtual void cancel();
 
     // Helpers
-//    virtual long long getCurrentJavaTime();
+    virtual long long getPlatformCurrentJavaTime();
 
 protected:
     // CActive
--- a/javamanager/javacaptain/inc/settingschangeeventsprovidermessages.h	Tue Jul 06 14:10:26 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,69 +0,0 @@
-/*
-* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:  BootEventProviderMessages
-*
-*/
-
-#ifndef SETTINGSCHANGEEVENTSPROVIDERMESSAGES_H
-#define SETTINGSCHANGEEVENTSPROVIDERMESSAGES_H
-
-#include "commsmessage.h"
-#include "logger.h"
-
-namespace java
-{
-namespace captain
-{
-
-using namespace java::util;
-using namespace java::comms;
-
-const int SETTINGS_CHANGE_EVENT_MESSAGE_ID_C = 1;
-
-const char* const SETTINGS_CHANGE_EVENT_PROVIDER = "settingslistener";
-
-typedef enum
-{
-    UNDEFINED_CHANGE          = 0x00,
-    MIDP_CLASS_PATH_CHANGE          = 0x01,
-
-} SettingsChangeEventType_t;
-
-
-inline void setSettingsChangeEventMessageParams(CommsMessage& aMessage,
-                                                      const int& aChangeEventType)
-{
-    aMessage.setMessageId(SETTINGS_CHANGE_EVENT_MESSAGE_ID_C);
-    aMessage << aChangeEventType;
-}
-
-inline void getSettingsChangeEventMessageParams(CommsMessage& aMessage,
-                                                      int& aChangeEventType)
-{
-    if (aMessage.getMessageId() == SETTINGS_CHANGE_EVENT_MESSAGE_ID_C)
-    {
-        aMessage >> aChangeEventType;
-    }
-    else
-    {
-        ELOG2(EJavaCaptain, "Received Settings Change Event with  wrong MessageId!: %d should be %d",
-              aMessage.getMessageId(), SETTINGS_CHANGE_EVENT_MESSAGE_ID_C);
-        aChangeEventType = 0;
-    }
-}
-
-} // namespace captain
-} // namespace java
-
-#endif // SETTINGSCHANGEEVENTSPROVIDERMESSAGES_H
--- a/javamanager/javacaptain/src.s60/tickerprovider.cpp	Tue Jul 06 14:10:26 2010 +0300
+++ b/javamanager/javacaptain/src.s60/tickerprovider.cpp	Wed Aug 18 09:43:15 2010 +0300
@@ -91,8 +91,8 @@
     }
     mNextTickAt = 0LL;
 }
-/*
-long long TickerProvider::getCurrentJavaTime()
+
+long long TickerProvider::getPlatformCurrentJavaTime()
 {
     JELOG2(EJavaCaptain);
     TTime currentTime;
@@ -101,7 +101,7 @@
     // Current time - javaEpoc && uSeconds -> mSeconds
     return (currentTime.Int64()- TTime(TDateTime(1970,EJanuary,0,0,0,0,0)).Int64()) / 1000LL;
 }
-*/
+
 void TickerProvider::RunL()
 {
     JELOG2(EJavaCaptain);
--- a/javamanager/javacaptain/src/tickerproviderinterface.h	Tue Jul 06 14:10:26 2010 +0300
+++ b/javamanager/javacaptain/src/tickerproviderinterface.h	Wed Aug 18 09:43:15 2010 +0300
@@ -64,6 +64,19 @@
     // Helpers
     /**
     * Returns milliseconds from EPOCH.
+    * This can be overridden with the platform specific implementation. Use case for
+    * overriding is that in some platforms gettimeofday implementation can't handle
+    * correctly times after 2038.
+    * @param[in]  -
+    * @return - milliseconds from EPOCH in success, -1 if fails
+    */
+    virtual long long getPlatformCurrentJavaTime()
+    {
+        return -1LL;
+    }
+
+    /**
+    * Returns milliseconds from EPOCH.
     * @param[in]  -
     * @return - milliseconds from EPOCH in success, -1 if fails
     */
@@ -73,7 +86,8 @@
         int err = gettimeofday(&tim, NULL);
         if (-1 == err)
         {
-            return -1LL;
+            WLOG(EJavaCaptain, "getCurrentJavaTime: gettimeofday returned -1");
+            return getPlatformCurrentJavaTime();
         }
 
         return (tim.tv_sec * 1000LL) +
--- a/javamanager/javacaptain/systemams/src/certificatesmanager.cpp	Tue Jul 06 14:10:26 2010 +0300
+++ b/javamanager/javacaptain/systemams/src/certificatesmanager.cpp	Wed Aug 18 09:43:15 2010 +0300
@@ -231,7 +231,7 @@
     LazyInit();
     iCurrentCertInfo = getTrustRootL(aId);
     RArray<TUid> applications;
-    applications.Append(KMidletInstallApplicabilityUid);
+    applications.AppendL(KMidletInstallApplicabilityUid);
     iCertStore->SetApplicability(*iCurrentCertInfo, applications, iStatus);
     User::WaitForRequest(iStatus);
     if (iStatus.Int() == KErrNone)
--- a/javamanager/javainstaller/appinstuiplugin/src/javainstalllauncher.cpp	Tue Jul 06 14:10:26 2010 +0300
+++ b/javamanager/javainstaller/appinstuiplugin/src/javainstalllauncher.cpp	Wed Aug 18 09:43:15 2010 +0300
@@ -228,7 +228,7 @@
 
     // Do NOT close rJavaInstaller now -> the caller gets notification when the
     // process actually closes.
-    iHandlesToClose.Append(rJavaInstaller);
+    iHandlesToClose.AppendL(rJavaInstaller);
 }
 
 void CJavaInstallLauncher::SilentInstallL(RFile& aFile,
@@ -410,7 +410,7 @@
 
     // Do NOT close rJavaInstaller now -> the caller gets notification when the
     // process actually closes.
-    iHandlesToClose.Append(rJavaInstaller);
+    iHandlesToClose.AppendL(rJavaInstaller);
 }
 
 void CJavaInstallLauncher::UninstallL(const TUid& aUid, const TDesC8&, /*aMIME*/
@@ -451,7 +451,7 @@
 
     // Do NOT close rJavaInstaller now -> the caller gets notification when the
     // process actually closes.
-    iHandlesToClose.Append(rJavaInstaller);
+    iHandlesToClose.AppendL(rJavaInstaller);
 }
 
 void CJavaInstallLauncher::SilentUninstallL(const TUid& aUid, const TDesC8&, /*aMIME*/
@@ -539,7 +539,7 @@
 
     // Do NOT close rJavaInstaller now -> the caller gets notification when the
     // process actually closes.
-    iHandlesToClose.Append(rJavaInstaller);
+    iHandlesToClose.AppendL(rJavaInstaller);
 }
 
 TBool CJavaInstallLauncher::IsAppShellUpdate()
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javamanager/javainstaller/iconsizenotifplugin/build/bld.inf	Wed Aug 18 09:43:15 2010 +0300
@@ -0,0 +1,19 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Build information file for Java Icon Size Notifier Plugin
+*
+*/
+
+PRJ_MMPFILES
+javaiconsizenotifplugin.mmp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javamanager/javainstaller/iconsizenotifplugin/build/javaiconsizenotifplugin.mmp	Wed Aug 18 09:43:15 2010 +0300
@@ -0,0 +1,50 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Java notifier ecom plugin used to access the UI env 
+*               from non UI context.
+*/
+
+
+#include <platform_paths.hrh>
+
+
+TARGET          javaiconsizenotifplugin.dll
+TARGETTYPE      PLUGIN
+UID             0x10009D8D 0x101FD689
+
+CAPABILITY      CAP_ECOM_PLUGIN
+VENDORID        VID_DEFAULT
+
+PAGED
+
+APP_LAYER_SYSTEMINCLUDE
+
+START RESOURCE  ../data/javaiconsizenotifplugin.rss
+TARGET          javaiconsizenotifplugin.rsc
+END
+
+SOURCEPATH      ../src
+SOURCE          iconsizenotifier.cpp
+
+USERINCLUDE     .
+USERINCLUDE     ../inc
+USERINCLUDE     ../../../../inc
+
+LIBRARY         euser.lib
+LIBRARY         eiksrv.lib              // MEikSrvNotifierBase2
+LIBRARY         cdlengine.lib           // AknLayoutScalable_Avkon
+LIBRARY         aknlayout2scalable.lib  // TAknWindowComponentLayout
+LIBRARY         avkon.lib               // TAknLayoutRect
+LIBRARY         eikcore.lib             // TAknLayoutRect
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javamanager/javainstaller/iconsizenotifplugin/data/javaiconsizenotifplugin.rss	Wed Aug 18 09:43:15 2010 +0300
@@ -0,0 +1,46 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  ECOM resource definition
+*
+*/
+
+#include <ecom/registryinfov2.rh>
+#include <uikon.hrh>
+
+RESOURCE REGISTRY_INFO r_registry
+	{
+    resource_format_version = RESOURCE_FORMAT_VERSION_2;
+	dll_uid = 0x101FD689;
+	interfaces =
+		{
+		INTERFACE_INFO
+			{
+			interface_uid = KUikonUidPluginInterfaceNotifiers;
+			implementations =
+				{
+				IMPLEMENTATION_INFO
+					{
+					implementation_uid = 0x101FD68A;
+					version_no = 1;
+					display_name = "JavaIconSizeNotifPlugin";
+					default_data = "";
+					opaque_data = "0";
+					rom_only = 0; // This is not a ROM only plugin
+					}
+				};
+			}
+		};
+	}
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javamanager/javainstaller/iconsizenotifplugin/inc/iconsizenotifier.h	Wed Aug 18 09:43:15 2010 +0300
@@ -0,0 +1,55 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+#ifndef ICONSIZENOTIFIER_H
+#define ICONSIZENOTIFIER_H
+
+
+#include <eiknotapi.h> // MEikSrvNotifierBase2
+
+
+const TInt KIdIconSizeNotifPlugin = 0x101FD68B;
+const TUid KUidIconSizeNotifPlugin = {KIdIconSizeNotifPlugin};
+
+
+class CIconSizeNotifier : public CBase, public MEikSrvNotifierBase2
+{
+public:
+    static CIconSizeNotifier* NewLC();
+    ~CIconSizeNotifier();
+
+private:
+    CIconSizeNotifier();
+    void ConstructL();
+
+// From MEikSrvNotifierBase2
+public:
+    void Release();
+    TNotifierInfo RegisterL();
+    TNotifierInfo Info() const;
+    void StartL(const TDesC8& aBuffer, TInt aReplySlot, const RMessagePtr2& aMessage);
+    TPtrC8 StartL(const TDesC8& aBuffer);
+    void Cancel();
+    TPtrC8 UpdateL(const TDesC8& aBuffer);
+    void UpdateL(const TDesC8& aBuffer, TInt aReplySlot, const RMessagePtr2& aMessage);
+    TInt NotifierCapabilites();
+private:
+    TNotifierInfo iInfo;
+};
+
+#endif // ICONSIZENOTIFIER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javamanager/javainstaller/iconsizenotifplugin/inc/iconsizeutils.h	Wed Aug 18 09:43:15 2010 +0300
@@ -0,0 +1,85 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef ICONSIZEUTILS_H
+#define ICONSIZEUTILS_H
+
+#include <aknlayoutscalable_avkon.cdl.h>
+#include <AknUtils.h>
+
+/**
+ * Fallback value of expected size of raster icons in Menu & Home Screen.
+ * Copy of KJavaIconWidth in Menu's mcsmenuiconutility.cpp.
+ */
+const TInt KIconInMenuFallbackSize = 88;
+
+/**
+ * Fallback value of expected size of raster icons in App Mgr.
+ */
+const TInt KIconInAppMgrFallbackSize = 46;
+
+/**
+ * Utility class packing all Java icon sizes needed troughout the system.
+ */
+class TIconSizes
+{
+public:
+    TSize iMenuIconSize;
+    TSize iAppMgrIconSize;
+};
+
+/**
+ * Utility class dealing with Java icon sizes.
+ */
+class IconSizeUtils
+{
+public:
+    /**
+     * Helper for getting the ideal sizes for Java raster icons.
+     * Accesses Akn layouts, therefore a Ui context is required
+     * (CEikonEnv present in the calling thread).
+     * This function has been inlined so that the Java App Mgr plugin
+     * does not have to statically link against the ecom plugin dll.
+     */
+    static TIconSizes GetIconSizes()
+    {
+        TIconSizes res;
+
+        // Menu & Home Screen icons size.
+        // No api to get it so just use the fallback value for now.
+        res.iMenuIconSize = TSize(KIconInMenuFallbackSize, KIconInMenuFallbackSize);
+
+        // App manager icon size.
+        // list_double_large_graphic_pane_vc_g1 = the icon of the app mgr list in landscape
+        TAknLayoutRect layoutRect;
+        layoutRect.LayoutRect(TRect(), 
+            AknLayoutScalable_Avkon::list_double_large_graphic_pane_vc_g1(0).LayoutLine());
+        TRect rect(layoutRect.Rect());
+        TInt w(rect.Width());
+        TInt h(rect.Height());
+        if (w < 0 || h < 0)
+        {
+            w = KIconInAppMgrFallbackSize;
+            h = KIconInAppMgrFallbackSize;
+        }
+        res.iAppMgrIconSize = TSize(w, h);
+
+        return res;
+    }
+};
+
+#endif // ICONSIZEUTILS_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javamanager/javainstaller/iconsizenotifplugin/src/iconsizenotifier.cpp	Wed Aug 18 09:43:15 2010 +0300
@@ -0,0 +1,135 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#include <e32cmn.h>
+#include <eikenv.h>
+#include <bautils.h>
+#include <ecom/implementationproxy.h>
+
+#include "iconsizenotifier.h"
+#include "iconsizeutils.h"
+
+const TUid KUidScreenOutput = { 0x10009D48 };
+
+CIconSizeNotifier* CIconSizeNotifier::NewLC()
+{
+    CIconSizeNotifier* self = new(ELeave) CIconSizeNotifier();
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    return self;
+}
+
+CIconSizeNotifier::~CIconSizeNotifier()
+{
+}
+
+CIconSizeNotifier::CIconSizeNotifier()
+{
+}
+
+void CIconSizeNotifier::ConstructL()
+{
+}
+
+void CIconSizeNotifier::Release()
+{
+    delete this;
+}
+
+CIconSizeNotifier::TNotifierInfo CIconSizeNotifier::RegisterL()
+{
+    iInfo.iUid = KUidIconSizeNotifPlugin;
+    iInfo.iChannel = KUidScreenOutput;
+    iInfo.iPriority = ENotifierPriorityHigh;
+    return iInfo;
+}
+
+CIconSizeNotifier::TNotifierInfo CIconSizeNotifier::Info() const
+{
+    return iInfo;
+}
+
+void CIconSizeNotifier::StartL(const TDesC8& /*aBuffer*/, TInt aReplySlot, const RMessagePtr2& aMessage)
+{
+    TPckgBuf<TIconSizes> res(IconSizeUtils::GetIconSizes());
+    aMessage.WriteL(aReplySlot, res);
+    aMessage.Complete(KErrNone);
+}
+
+TPtrC8 CIconSizeNotifier::StartL(const TDesC8& /*aBuffer*/)
+{
+    return KNullDesC8();
+}
+
+void CIconSizeNotifier::Cancel()
+{
+}
+
+TPtrC8 CIconSizeNotifier::UpdateL(const TDesC8& /*aBuffer*/)
+{
+    return KNullDesC8();
+}
+
+void CIconSizeNotifier::UpdateL(const TDesC8& /*aBuffer*/, TInt /*aReplySlot*/, const RMessagePtr2& aMessage)
+{
+    aMessage.Complete(KErrNotSupported);
+}
+
+void CreateNotifiersL(CArrayPtrFlat<MEikSrvNotifierBase2>& aNotifiers)
+{
+    CIconSizeNotifier* notifier1 = CIconSizeNotifier::NewLC();
+    aNotifiers.AppendL(notifier1);
+    CleanupStack::Pop(notifier1);
+}
+
+CArrayPtr<MEikSrvNotifierBase2>* NotifierArray()
+{
+    CArrayPtrFlat<MEikSrvNotifierBase2>* notifiers = new CArrayPtrFlat<MEikSrvNotifierBase2>(1);
+    if (notifiers)
+    {
+        TRAPD(err, CreateNotifiersL(*notifiers));
+        if (err)
+        {
+            TInt count = notifiers->Count();
+            while (count--)
+            {
+                (*notifiers)[count]->Release();
+            }
+            delete notifiers;
+            notifiers = NULL;
+        }
+    }
+    return notifiers;
+}
+
+TInt CIconSizeNotifier::NotifierCapabilites()
+{
+    return ENoSpecialCapabilities;
+}
+
+// ECom plugin entry point
+const TImplementationProxy ImplementationTable[] =
+{
+    IMPLEMENTATION_PROXY_ENTRY(0x101FD68A, NotifierArray)
+};
+
+EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount)
+{
+    aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy);
+    return ImplementationTable;
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javamanager/javainstaller/installcopier/build/javainstallcopier.pro	Wed Aug 18 09:43:15 2010 +0300
@@ -0,0 +1,31 @@
+#
+# Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+#
+# Contributors:
+#
+# Description:
+#
+
+TEMPLATE=app
+TARGET=javainstallcopier
+CONFIG += omj no_icon stl
+CONFIG -= qt
+
+symbian {
+    TARGET.UID2 = 0x20031612
+    TARGET.UID3 = 0x20031612
+
+    TARGET.CAPABILITY = AllFiles
+
+    LIBS += -lefsrv -lcharconv
+}
+
+include(../../../../build/omj.pri)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javamanager/javainstaller/installcopier/src/javainstallcopier.cpp	Wed Aug 18 09:43:15 2010 +0300
@@ -0,0 +1,153 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* JavaInstallCopier.exe is a utility for copying Java installation
+* files from other processes private data cages to JavaInstaller's
+* private data cage. JavaSifPlugin calls JavaInstallCopier if
+* installation is started from a file which resides in a private
+* data cage which JavaInstaller cannot access.
+*
+*/
+
+
+#ifdef __SYMBIAN32__
+#include <f32file.h>
+#include <utf.h>
+#endif // __SYMBIAN32__
+
+#include "exceptionbase.h"
+#include "javaoslayer.h"
+#include "logger.h"
+#include "runtimeexception.h"
+
+using namespace java::runtime;
+using namespace java::util;
+
+int isCopyAllowed()
+{
+    int result = 0;
+#ifdef __SYMBIAN32__
+    // Only SifServer (0x10285BCB) is allowed to launch JavaInstallCopier.
+    TSecureId creatorSecId(User::CreatorSecureId());
+    if (0x10285BCB != creatorSecId.iId)
+    {
+        ELOG1(EJavaInstaller,
+              "INSTALLCOPIER: Process 0x%x is not allowed to "
+              "launch JavaInstallCopier", creatorSecId.iId);
+        result = KErrPermissionDenied;
+    }
+#endif // __SYMBIAN32__
+    return result;
+}
+
+int copyToInstallerDir(int argc, char *argv[])
+{
+    int result = 0;
+
+#ifdef __SYMBIAN32__
+    RFs rfs;
+    result = rfs.Connect();
+    if (KErrNone != result)
+    {
+        ELOG1(EJavaInstaller,
+              "INSTALLCOPIER: Connecting to RFs failed, err=%d", result);
+        return result;
+    }
+
+    CFileMan* fm = NULL;
+    TRAP(result, fm = CFileMan::NewL(rfs));
+    if (KErrNone != result)
+    {
+        ELOG1(EJavaInstaller,
+              "INSTALLCOPIER: Creating CFileMan failed, err=%d", result);
+        return result;
+    }
+
+    _LIT(KJavaInstallerTmp, "\\private\\102033E6\\installer\\tmp\\");
+    for (int i = 1; i < argc && KErrNone == result; i++)
+    {
+        TPtrC8 srcPtr((const TText8*)argv[i]);
+        TFileName srcPath;
+        CnvUtfConverter::ConvertToUnicodeFromUtf8(srcPath, srcPtr);
+        // Get the drive from the srcPath...
+        TParse fp;
+        rfs.Parse(srcPath, fp);
+        // ...and prefix it to KJavaInstallerTmp path.
+        TFileName dstPath = fp.Drive();
+        dstPath.Append(KJavaInstallerTmp);
+
+        result = fm->Copy(srcPath, dstPath, CFileMan::ERecurse|CFileMan::EOverWrite);
+
+        std::wstring srcWs((wchar_t*)srcPath.Ptr(), srcPath.Length());
+        std::wstring dstWs((wchar_t*)dstPath.Ptr(), dstPath.Length());
+        if (KErrNone == result)
+        {
+            ILOG2(EJavaInstaller, "INSTALLCOPIER: Copied %S to %S",
+                  srcWs.c_str(), dstWs.c_str());
+        }
+        else
+        {
+            ELOG3(EJavaInstaller,
+                  "INSTALLCOPIER: Copying %S to %S failed, err=%d",
+                  srcWs.c_str(), dstWs.c_str(), result);
+        }
+    }
+
+    delete fm;
+    fm = NULL;
+    rfs.Close();
+#else // __SYMBIAN32__
+    for (int i = 1; i < argc && result == 0; i++)
+    {
+        WLOG1(EJavaInstaller, "INSTALLCOPIER: Ignored %s", argv[i]);
+    }
+#endif // __SYMBIAN32__
+
+    return result;
+}
+
+int main(int argc, char *argv[])
+{
+    //ILOG(EJavaInstaller, "INSTALLCOPIER main()");
+    JavaOsLayer::startUpTrace("INSTALLCOPIER main() start", -1, -1);
+
+    int result = 0;
+    try
+    {
+        result = isCopyAllowed();
+        if (0 == result)
+        {
+            result = copyToInstallerDir(argc, argv);
+        }
+    }
+    catch (RuntimeException& e)
+    {
+        ELOG1(EJavaInstaller, "INSTALLCOPIER main() RuntimeException caught: %s",
+              e.toString().c_str());
+    }
+    catch (ExceptionBase& e)
+    {
+        ELOG1(EJavaInstaller, "INSTALLCOPIER main() ExceptionBase caught: %s",
+              e.toString().c_str());
+    }
+    catch (std::exception& e)
+    {
+        ELOG1(EJavaInstaller, "INSTALLCOPIER main() Exception %s caught", e.what());
+    }
+
+    //ILOG1(EJavaInstaller, "INSTALLCOPIER main() exit %d", result);
+    JavaOsLayer::startUpTrace("INSTALLCOPIER main() end", -1, -1);
+    return result;
+}
--- a/javamanager/javainstaller/installer/build/build.xml	Tue Jul 06 14:10:26 2010 +0300
+++ b/javamanager/javainstaller/installer/build/build.xml	Wed Aug 18 09:43:15 2010 +0300
@@ -74,6 +74,7 @@
     value="com.nokia.mj.impl.installer.utils.SysUtil,
            com.nokia.mj.impl.installer.utils.FileRoots,
            com.nokia.mj.impl.installer.utils.FileWriter,
+           com.nokia.mj.impl.installer.utils.PropertyProvider,
            com.nokia.mj.impl.installer.jadjarmatcher.JadJarMatcher,
            com.nokia.mj.impl.installer.applicationregistrator.ApplicationRegistrator,
            com.nokia.mj.impl.installer.applicationregistrator.SifNotifier,
--- a/javamanager/javainstaller/installer/build/javainstaller.pro	Tue Jul 06 14:10:26 2010 +0300
+++ b/javamanager/javainstaller/installer/build/javainstaller.pro	Wed Aug 18 09:43:15 2010 +0300
@@ -37,7 +37,8 @@
     INCLUDEPATH += ../src.s60/applicationregistrator \
                    ../src.s60/iconconverter \
                    ../src.s60/jadjarmatcher \
-                   ../src.s60/utils
+                   ../src.s60/utils \
+                   ../../iconsizenotifplugin/inc
 
     SOURCES += ../src.s60/applicationregistrator/applicationregistrator.cpp \
                ../src.s60/applicationregistrator/sifnotifier.cpp \
@@ -48,12 +49,14 @@
                ../src.s60/jadjarmatcher/jadjarmatcherscanfrominbox.cpp \
                ../src.s60/utils/filewriter.cpp \
                ../src.s60/utils/fileroots.cpp \
+               ../src.s60/utils/propertylistener.cpp \
+               ../src.s60/utils/propertyprovider.cpp \
                ../src.s60/utils/sysutil.cpp
 
     LIBS += -lapgrfx -lbafl -lcentralrepository -lcharconv -lefsrv -lestor \
                -lezip -lfbscli -limageconversion -lmsgs  \
                -lsysutil -lplatformenv -lws32 -lapparc -lcentralrepository \
-               -lhal -lcaf -lcafutils
+               -lhal -lcaf -lcafutils -lbitmaptransforms
 
     contains(PROJECT_DEFINES,RD_JAVA_S60_50_REL2) {
         LIBS += -lmcsmenu
@@ -68,6 +71,9 @@
     "$${LITERAL_HASH}include <bldvariant.hrh>" \
     "$${LITERAL_HASH}ifdef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK" \
     "LIBRARY scrclient.lib" \
+    "$${LITERAL_HASH}else" \
+    "LIBRARY ecom.lib" \
+    "LIBRARY SWInstTaskManager.lib" \
     "$${LITERAL_HASH}endif"
 } else {
     CONFIG += omj java javaonly stl
--- a/javamanager/javainstaller/installer/javasrc.s60/com/nokia/mj/impl/installer/applicationregistrator/ApplicationRegistrator.java	Tue Jul 06 14:10:26 2010 +0300
+++ b/javamanager/javainstaller/installer/javasrc.s60/com/nokia/mj/impl/installer/applicationregistrator/ApplicationRegistrator.java	Wed Aug 18 09:43:15 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies).
 * All rights reserved.
 * This component and the accompanying materials are made available
 * under the terms of "Eclipse Public License v1.0"
@@ -18,6 +18,7 @@
 
 package com.nokia.mj.impl.installer.applicationregistrator;
 
+import com.nokia.mj.impl.installer.storagehandler.SuiteInfo;
 import com.nokia.mj.impl.installer.utils.InstallerException;
 import com.nokia.mj.impl.installer.utils.FileRoots;
 import com.nokia.mj.impl.installer.utils.FileUtils;
@@ -355,6 +356,8 @@
         String aJarFilename,
         StringBuffer aIconSuffix)
     {
+        Log.log("ApplicationRegistrator.convertIcon: " + aInputIconFilename +
+                " --> " + aOutputIconFilename + ", from jar " + aJarFilename);
         return _convertIcon(aInputIconFilename, aOutputIconFilename,
                             aJarFilename, aIconSuffix);
     }
@@ -437,8 +440,50 @@
         return;
     }
 
+    /**
+     * Adds an entry to platform installation log.
+     *
+     * @param aSuite application suite information
+     * @param aAction 0 - installation, 1 - uninstallation
+     */
+    public static void addInstallLogEntry(SuiteInfo aSuite, int aAction)
+    {
+        // In S60 the version number is restricted to limited range.
+        // If version number is outside of this range, use version
+        // number 0 instead.
+        int result = _addInstallLogEntry(
+            aAction, PlatformUid.getIntValue(aSuite.getUid()),
+            aSuite.getName(), aSuite.getVendor(),
+            getVersion(aSuite.getVersion().getMajor(), 0, 127),
+            getVersion(aSuite.getVersion().getMinor(), 0, 99),
+            getVersion(aSuite.getVersion().getMicro(), 0, 32767));
+        if (result < 0)
+        {
+            Log.logError("Adding installation log entry failed, err=" + result);
+        }
+        else
+        {
+            Log.log("Added installation log entry");
+        }
+    }
+
     /*** ----------------------------- PACKAGE ---------------------------- */
     /*** ----------------------------- PRIVATE ---------------------------- */
+
+    /**
+     * Checks that given version number is between specified minimum and
+     * maximum value range (inclusive) and if it is returns version number.
+     * If version number is out of given range, returns 0.
+     */
+    private static int getVersion(int aVersion, int aMin, int aMax)
+    {
+        if (aVersion >= aMin && aVersion <= aMax)
+        {
+            return aVersion;
+        }
+        return 0;
+    }
+
     /*** ----------------------------- NATIVE ----------------------------- */
 
     /**
@@ -579,4 +624,20 @@
      * @return true if Symbian 9.2 emulator environment
      */
     private static native boolean _runningIn92Emulator();
+
+    /**
+     * Adds an entry to platform installation log.
+     *
+     * @param aAction 0 - installation, 1 - uninstallation
+     * @param aUid application suite uid
+     * @param aName application suite name
+     * @param aVendor application suite vendor
+     * @param aMajorVersion application suite major version
+     * @param aMinorVersion application suite minor version
+     * @param aMicroVersion application suite micro version
+     * @return Symbian error code (negative number) if fails, otherwise 0
+     */
+    private static native int _addInstallLogEntry(
+        int aAction, int aUid, String aName, String aVendor,
+        int aMajorVersion, int aMinorVersion, int aMicroVersion);
 }
--- a/javamanager/javainstaller/installer/javasrc.s60/com/nokia/mj/impl/installer/applicationregistrator/SifRegistrator.java	Tue Jul 06 14:10:26 2010 +0300
+++ b/javamanager/javainstaller/installer/javasrc.s60/com/nokia/mj/impl/installer/applicationregistrator/SifRegistrator.java	Wed Aug 18 09:43:15 2010 +0300
@@ -649,7 +649,7 @@
                 " failed with code " + err + " (" + nonlocalizedAttrValue + ")");
         }
         LocalizedName[] localizedAttrValues =
-            getLocalizedNames(aSuite, attrName + "-");
+            getLocalizedNames(aSuite, "Nokia-" + attrName + "-");
         for (int i = 0; i < localizedAttrValues.length; i++)
         {
             err = _setLocalizedComponentProperty(
--- a/javamanager/javainstaller/installer/javasrc.s60/com/nokia/mj/impl/installer/utils/FileRoots.java	Tue Jul 06 14:10:26 2010 +0300
+++ b/javamanager/javainstaller/installer/javasrc.s60/com/nokia/mj/impl/installer/utils/FileRoots.java	Wed Aug 18 09:43:15 2010 +0300
@@ -62,7 +62,16 @@
      */
     public static String getRegisteredIconDir(int aDrive)
     {
-        return FileUtils.getDriveName(aDrive) + ":\\data\\java\\";
+        String result = getAppsRoot();
+        result = FileUtils.setDrive(result, aDrive);
+        String replace = "\\private\\";
+        int i = result.indexOf(replace);
+        if (i == -1)
+        {
+            return FileUtils.getDriveName(aDrive) + ":\\data\\java\\";
+        }
+        return result.substring(0, i) + "\\public\\" +
+            result.substring(i + replace.length());
     }
 
     /**
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javamanager/javainstaller/installer/javasrc.s60/com/nokia/mj/impl/installer/utils/PropertyProvider.java	Wed Aug 18 09:43:15 2010 +0300
@@ -0,0 +1,179 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+package com.nokia.mj.impl.installer.utils;
+
+/**
+ * Provides notifications whenever the subscribed property value changes.
+ * <br>
+ * One PropertyProvider instance can be used to subscribe events
+ * for only one property. If events for more properties are needed
+ * use separate PropertyProvider instance for each property.
+ *
+ * @see PropertyListener
+ */
+public class PropertyProvider
+{
+    /** Property category. */
+    private int iCategory = 0;
+    /** Property key. */
+    private int iKey = 0;
+    /** Property listener. */
+    private PropertyListener iListener = null;
+    /** Handle to native object. */
+    private int iHandle = 0;
+
+    /**
+     * Constructor.
+     */
+    public PropertyProvider()
+    {
+    }
+
+    /**
+     * Subscribe to listen changes of specified property value.
+     * One PropertyListener can subscribe to only one property
+     * value at a time.
+     *
+     * @param aCategory property category
+     * @param aKey property key
+     * @param aListener listener to be notified.
+     */
+    public void subscribe(int aCategory, int aKey, PropertyListener aListener)
+    {
+        if (iHandle != 0)
+        {
+            InstallerException.internalError("PropertyProvider already in use.");
+        }
+        iCategory = aCategory;
+        iKey = aKey;
+        iListener = aListener;
+        // Start a new thread which blocks until unsubscribe is called.
+        final PropertyProvider provider = this;
+        new Thread(new Runnable()
+        {
+            public void run()
+            {
+                synchronized (provider)
+                {
+                    iHandle = _subscribe(iCategory, iKey);
+                    // Notify subscribe method after subscription
+                    // result is available.
+                    provider.notify();
+                }
+                if (iHandle > 0)
+                {
+                    // Subscription succeeded, start to process events.
+                    _processEvents(iHandle, provider);
+                }
+            }
+        }, "PropertyProviderThread").start();
+        synchronized (this)
+        {
+            try
+            {
+                if (iHandle == 0)
+                {
+                    // Wait until subscription has been completed.
+                    wait();
+                }
+            }
+            catch (InterruptedException ie)
+            {
+            }
+        }
+        // Check if subscription failed.
+        if (iHandle < 0)
+        {
+            Log.logError("PropertyProvider.subscribe failed with code " + iHandle);
+            iHandle = 0;
+        }
+    }
+
+    /**
+     * Unubscribe from listening changes.
+     */
+    public void unsubscribe()
+    {
+        final PropertyProvider provider = this;
+        new Thread(new Runnable()
+        {
+            public void run()
+            {
+                synchronized (provider)
+                {
+                    if (iHandle <= 0)
+                    {
+                        Log.logWarning(
+                            "PropertyProvider.unsubscribe: no subscription.");
+                        return;
+                    }
+                    int err = _unsubscribe(iHandle);
+                    if (err < 0)
+                    {
+                        Log.logError(
+                            "PropertyProvider.unsubscribe failed with code " +
+                            err);
+                    }
+                    else
+                    {
+                        iHandle = 0;
+                    }
+                }
+            }
+        }, "PropertyProviderUnsubscribeThread").start();
+    }
+
+    /**
+     * Called from native when value for the subscribed property changes.
+     */
+    private void valueChanged(int aValue)
+    {
+        if (iListener != null)
+        {
+            iListener.valueChanged(iCategory, iKey, aValue);
+        }
+    }
+
+    /**
+     * Subscribe to listen changes of specified property value.
+     *
+     * @param aCategory property category
+     * @param aKey property key
+     * @return handle to native side object or Symbian error
+     * code (negative number)
+     */
+    private static native int _subscribe(int aCategory, int aKey);
+
+    /**
+     * Starts to process events. This call blocks until unsubscribe is called.
+     *
+     * @param aHandle handle to native side object
+     * @param aProvider PropertyProvider class instance to be notified
+     * @return 0 or Symbian error code (negative number)
+     */
+    private static native int _processEvents(int aHandle, PropertyProvider aProvider);
+
+    /**
+     * Unubscribe from listening changes.
+     *
+     * @param aHandle handle to native side object
+     * @return 0 or Symbian error code (negative number)
+     */
+    private static native int _unsubscribe(int aHandle);
+}
--- a/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/Installer.java	Tue Jul 06 14:10:26 2010 +0300
+++ b/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/Installer.java	Wed Aug 18 09:43:15 2010 +0300
@@ -328,7 +328,7 @@
         }
 
         StartUpTrace.doTrace("Installer.mainWithResult " + aArgs[0] + " begins");
-        StringBuffer buf = new StringBuffer("Java install process started with command: ");
+        StringBuffer buf = new StringBuffer("Java install process started with command:");
         for (int i = 0; i < aArgs.length; i++)
         {
             buf.append(" ").append(aArgs[i]);
--- a/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/InstallerResultMessage.java	Tue Jul 06 14:10:26 2010 +0300
+++ b/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/InstallerResultMessage.java	Wed Aug 18 09:43:15 2010 +0300
@@ -444,7 +444,7 @@
             addValue(NAME_ERROR_CATEGORY,
                      SifRegistrator.getErrorCategory(aEb.getShortMessageId()));
             addValue(NAME_ERROR_CODE,
-                     aEb.getShortMessageId() + aEb.getDetailedMessageId());
+                     aEb.getShortMessageId()*1000 + aEb.getDetailedMessageId());
         }
         else if (aEb.getShortMessageId() >= ErrorMessageBase.SECURITY_RANGE_START &&
                  aEb.getShortMessageId() <= ErrorMessageBase.SECURITY_RANGE_END)
@@ -453,7 +453,7 @@
                      SifRegistrator.getErrorCategory(
                          InstallerErrorMessage.INST_AUTHORIZATION_ERR));
             addValue(NAME_ERROR_CODE,
-                     aEb.getShortMessageId() + aEb.getDetailedMessageId());
+                     aEb.getShortMessageId()*1000 + aEb.getDetailedMessageId());
         }
         else
         {
--- a/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/midp2/install/steps/CheckJarPackages.java	Tue Jul 06 14:10:26 2010 +0300
+++ b/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/midp2/install/steps/CheckJarPackages.java	Wed Aug 18 09:43:15 2010 +0300
@@ -73,7 +73,8 @@
         // Application touch support detection is not needed
         // if Nokia-MIDlet-On-Screen-Keypad has been defined.
         boolean touchDetection = true;
-        if (ball.iSuite.getOnScreenKeypad() != SuiteInfo.OSK_UNDEFINED)
+        if (ball.getAttributeValue("Nokia-MIDlet-On-Screen-Keypad") != null &&
+            ball.iSuite.getOnScreenKeypad() != SuiteInfo.OSK_UNDEFINED)
         {
             touchDetection = false;
         }
--- a/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/midp2/install/steps/ConvertIcons.java	Tue Jul 06 14:10:26 2010 +0300
+++ b/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/midp2/install/steps/ConvertIcons.java	Wed Aug 18 09:43:15 2010 +0300
@@ -258,10 +258,11 @@
                     // the attribute MIDlet-<N>
                     iconName = newApp.getIconPath();
                 }
-                if (iconName.length() == 0)
+                if (iconName.length() == 0 || iconName.equals(suiteIconName))
                 {
-                    // No MIDlet icon defined, use already converted suite
-                    // icon if it exists
+                    // No MIDlet icon defined or MIDlet icon defined to be
+                    // the same as suite icon, use already converted suite
+                    // icon if it exists.
                     if (suiteIconFile.length() > 0)
                     {
                         // Must make separate copy of the suite icon for each
--- a/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/midp2/install/steps/FinalizeInstallation.java	Tue Jul 06 14:10:26 2010 +0300
+++ b/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/midp2/install/steps/FinalizeInstallation.java	Wed Aug 18 09:43:15 2010 +0300
@@ -150,6 +150,9 @@
             Log.log("JavaCaptain notified");
         }
 
+        // Add an entry to platform installation log.
+        ball.iApplicationRegistrator.addInstallLogEntry(ball.iSuite, 0);
+
         String midletName = ball.getAttributeValue("MIDlet-Name");
         ball.log("Application " + midletName + " successfully installed.");
         ball.log(ball.iSuite.toShortString());
--- a/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/midp2/install/steps/PrepareInstallation.java	Tue Jul 06 14:10:26 2010 +0300
+++ b/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/midp2/install/steps/PrepareInstallation.java	Wed Aug 18 09:43:15 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies).
 * All rights reserved.
 * This component and the accompanying materials are made available
 * under the terms of "Eclipse Public License v1.0"
@@ -29,6 +29,7 @@
 import com.nokia.mj.impl.installer.jsrpluginnotifier.JsrPluginNotifier;
 import com.nokia.mj.impl.installer.storagehandler.StorageHandler;
 import com.nokia.mj.impl.installer.utils.Args;
+import com.nokia.mj.impl.installer.utils.DriveInfo;
 import com.nokia.mj.impl.installer.utils.FileRoots;
 import com.nokia.mj.impl.installer.utils.FileUtils;
 import com.nokia.mj.impl.installer.utils.InstallerException;
@@ -37,8 +38,11 @@
 import com.nokia.mj.impl.installer.utils.SysUtil;
 import com.nokia.mj.impl.security.midp.authentication.AuthenticationModule;
 import com.nokia.mj.impl.security.midp.authentication.OcspSettings;
+import com.nokia.mj.impl.fileutils.FileURL;
 import com.nokia.mj.impl.utils.Uid;
 
+import java.util.Vector;
+
 public class PrepareInstallation extends ExeStep
 {
 
@@ -170,6 +174,11 @@
             {
                 aBall.iJarUrl = jarArg;
             }
+            else if (isFileUrl(jarArg))
+            {
+                aBall.iJarFilename = getFileFromUrl(jarArg);
+                Log.log("Jar " + aBall.iJarFilename + " from URL " + jarArg);
+            }
             else
             {
                 aBall.iJarFilename = jarArg;
@@ -181,6 +190,11 @@
             {
                 aBall.iJadUrl = jadArg;
             }
+            else if (isFileUrl(jadArg))
+            {
+                aBall.iJadFilename = getFileFromUrl(jadArg);
+                Log.log("Jad " + aBall.iJadFilename + " from URL " + jadArg);
+            }
             else
             {
                 aBall.iJadFilename = jadArg;
@@ -266,6 +280,7 @@
         if (arg != null)
         {
             aBall.iInstallationDrive = args.parseDrive(arg);
+            checkInstallationDrive(aBall.iInstallationDrive);
         }
     }
 
@@ -346,4 +361,60 @@
         Log.log("ocspSettings: " + ocspSettings);
         return ocspSettings;
     }
+
+    /**
+     * Returns true if given URL is a file URL, false otherwise.
+     */
+    private static boolean isFileUrl(String aUrl)
+    {
+        if (aUrl == null || aUrl.length() == 0)
+        {
+            return false;
+        }
+        return aUrl.toLowerCase().startsWith("file://");
+    }
+
+    /**
+     * Returns a file path from file URL.
+     *
+     * @throws InstallerException if URL is invalid.
+     */
+    private static String getFileFromUrl(String aUrl)
+    {
+        String filePath = null;
+        try
+        {
+            FileURL fileUrl = new FileURL(aUrl);
+            filePath = fileUrl.getFullPath();
+        }
+        catch (Throwable t)
+        {
+            InstallerException.internalError("Invalid file URL: " + aUrl, t);
+        }
+        return filePath;
+    }
+
+    /**
+     * Checks that given installation drive is a valid one.
+     *
+     * @param aDrive installation drive
+     * @throws InstallerException if installation drive is not valid
+     */
+    private static void checkInstallationDrive(int aDrive)
+    {
+        Vector drives = new Vector();
+        SysUtil.getUserVisibleDrives(drives);
+        for (int i = 0; i < drives.size(); i++)
+        {
+            DriveInfo driveInfo = (DriveInfo)drives.elementAt(i);
+            if (driveInfo.getNumber() == aDrive)
+            {
+                // Installation drive found from user visible drives.
+                return;
+            }
+        }
+        InstallerException.internalError(
+            "Invalid installation drive: " + aDrive +
+            " (" + (char)('A' + aDrive) + ")");
+    }
 }
--- a/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/midp2/install/steps/PrepareSplashScreen.java	Tue Jul 06 14:10:26 2010 +0300
+++ b/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/midp2/install/steps/PrepareSplashScreen.java	Wed Aug 18 09:43:15 2010 +0300
@@ -35,10 +35,11 @@
 import org.eclipse.swt.graphics.ImageData;
 import org.eclipse.swt.graphics.ImageLoader;
 import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.internal.extension.ImageUtil;
 
 /**
  * Installation step PrepareSplashScreen prepares splash
- * screen images from MIDlet-Splash-Screen-Image attribute.
+ * screen images from Nokia-MIDlet-Splash-Screen-Image attribute.
  */
 public class PrepareSplashScreen extends ExeStep
 {
@@ -70,7 +71,7 @@
             return;
         }
 
-        String attrName = "MIDlet-Splash-Screen-Image";
+        String attrName = "Nokia-MIDlet-Splash-Screen-Image";
         String attrValue = ball.getAttributeValue(attrName);
         if (attrValue != null && attrValue.length() > 0)
         {
@@ -106,15 +107,21 @@
             for (int i = 0; i < tokens.length; i++)
             {
                 tokens[i] = tokens[i].trim();
-                currentImage = loadImage(tokens[i], ball.iJarFilename);
-                if (currentImage == null)
+                imageSizes[i] = getImageSize(tokens[i], ball.iJarFilename);
+                if (imageSizes[i] == null)
                 {
-                    // Image loading failed, proceed to the next image.
-                    imageSizes[i] = new Point(0, 0);
-                    continue;
+                    // Couldn't get image size, try to get it by loading
+                    // the image.
+                    currentImage = loadImage(tokens[i], ball.iJarFilename);
+                    if (currentImage == null)
+                    {
+                        // Image loading failed, proceed to the next image.
+                        imageSizes[i] = new Point(0, 0);
+                        continue;
+                    }
+                    imageSizes[i] = new Point(
+                        currentImage[0].width, currentImage[0].height);
                 }
-                imageSizes[i] = new Point(
-                    currentImage[0].width, currentImage[0].height);
             }
             // Choose the images which best fill the portrait and
             // landscape screens.
@@ -237,6 +244,74 @@
     }
 
     /**
+     * Gets image size for specified image from given jar file.
+     *
+     * @param aResource image file name
+     * @param aJar jar file name
+     * @return image size, or null if getting image size fails
+     */
+    private static Point getImageSize(String aResource, String aJar)
+    {
+        Point result = null;
+        JarFile jarFile = null;
+        InputStream is = null;
+        try
+        {
+            // Open jar file and input stream.
+            jarFile = new JarFile(aJar);
+            is = jarFile.getInputStream(
+                new JarEntry(FileUtils.trimJarEntry(aResource)));
+            if (is != null)
+            {
+                result = ImageUtil.getImageSize(is);
+                if (result != null)
+                {
+                    Log.log("Image size for " + aResource + " from " +
+                            aJar + ": " + result);
+                }
+            }
+            else
+            {
+                Log.logWarning("Image " + aResource + " not found from " + aJar);
+            }
+        }
+        catch (Throwable t)
+        {
+            Log.logWarning("Loading image " + aResource + " from " +
+                           aJar + " failed", t);
+        }
+        finally
+        {
+            // Close streams and jar file.
+            if (is != null)
+            {
+                try
+                {
+                    is.close();
+                    is = null;
+                }
+                catch (IOException ioe)
+                {
+                    Log.logWarning("Closing InputStream failed", ioe);
+                }
+            }
+            if (jarFile != null)
+            {
+                try
+                {
+                    jarFile.close();
+                    jarFile = null;
+                }
+                catch (IOException ioe)
+                {
+                    Log.logWarning("Closing " + aJar + " failed", ioe);
+                }
+            }
+        }
+        return result;
+    }
+
+    /**
      * Loads image from specified resource from given jar file.
      *
      * @param aResource resource file name
@@ -252,8 +327,8 @@
         {
             // Open jar file and input stream.
             jarFile = new JarFile(aJar);
-            is = jarFile.getInputStream
-                 (new JarEntry(FileUtils.trimJarEntry(aResource)));
+            is = jarFile.getInputStream(
+                new JarEntry(FileUtils.trimJarEntry(aResource)));
             if (is != null)
             {
                 result = (new ImageLoader()).load(is);
@@ -319,8 +394,8 @@
         {
             // Open jar file and input and output streams.
             jarFile = new JarFile(aJar);
-            is = jarFile.getInputStream
-                 (new JarEntry(FileUtils.trimJarEntry(aResource)));
+            is = jarFile.getInputStream(
+                new JarEntry(FileUtils.trimJarEntry(aResource)));
             os = FileUtils.getOutputStream(imageFilename);
             // Copy the image data from InputStream to OutputStream.
             byte[] buf = new byte[16384];
--- a/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/midp2/uninstall/steps/ConfirmUninstallation.java	Tue Jul 06 14:10:26 2010 +0300
+++ b/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/midp2/uninstall/steps/ConfirmUninstallation.java	Wed Aug 18 09:43:15 2010 +0300
@@ -76,8 +76,9 @@
             int idxMinus = -1;
             do
             {
-                attrValue = ball.iSuite.getAttributeValue(attrName + "-" + locale);
-                Log.log(attrName + "-" + locale + ": " + attrValue);
+                String localizedAttrName = "Nokia-" + attrName + "-" + locale;
+                attrValue = ball.iSuite.getAttributeValue(localizedAttrName);
+                Log.log(localizedAttrName + ": " + attrValue);
                 idxMinus = locale.lastIndexOf('-');
                 // If attribute is not found using full locale, e.g. 'en-GB',
                 // strip the most specific part of the locale out
--- a/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/midp2/uninstall/steps/FinalizeUninstallation.java	Tue Jul 06 14:10:26 2010 +0300
+++ b/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/midp2/uninstall/steps/FinalizeUninstallation.java	Wed Aug 18 09:43:15 2010 +0300
@@ -102,6 +102,10 @@
                 ball.log("Application with uid " + appUids[i] + " uninstalled");
             }
         }
+
+        // Add an entry to platform installation log.
+        ball.iApplicationRegistrator.addInstallLogEntry(ball.iSuite, 1);
+
         ball.log("Application suite with uid " + ball.iSuite.getUid() +
                  " successfully uninstalled.");
     }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/utils/PropertyListener.java	Wed Aug 18 09:43:15 2010 +0300
@@ -0,0 +1,37 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+package com.nokia.mj.impl.installer.utils;
+
+/**
+ * Interface for listening property value changes.
+ *
+ * @see PropertyProvider
+ */
+public interface PropertyListener
+{
+    /**
+     * Called when property value is changed.
+     * This method must return quickly.
+     *
+     * @param aCategory property category
+     * @param aKey property key
+     * @param aValue property value
+     */
+    public void valueChanged(int aCategory, int aKey, int aValue);
+}
--- a/javamanager/javainstaller/installer/src.s60/applicationregistrator/applicationregistrator.cpp	Tue Jul 06 14:10:26 2010 +0300
+++ b/javamanager/javainstaller/installer/src.s60/applicationregistrator/applicationregistrator.cpp	Wed Aug 18 09:43:15 2010 +0300
@@ -30,6 +30,12 @@
 #include <AknUtils.h>
 #include <hal.h>
 
+#ifndef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK
+#include <SWInstLogTaskParam.h>
+#include <SWInstTask.h>
+#include <SWInstTaskManager.h>
+#endif // !SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK
+
 #ifndef SYMBIAN_ENABLE_SPLIT_HEADERS
 #include <apgicnfl.h>
 #else
@@ -50,6 +56,11 @@
 
 // NAMESPACE DECLARATION
 using namespace java;
+#ifndef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK
+using namespace SwiUI;
+#endif // !SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK
+
+IMPORT_C HBufC* CreateHBufCFromJavaStringLC(JNIEnv* aEnv, jstring aString);
 
 #ifndef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK
 /**
@@ -67,6 +78,13 @@
  */
 _LIT(KAppPostfix, ".fakeapp");
 
+
+#ifdef RD_JAVA_S60_RELEASE_9_2
+const TInt KAppIconCount = 2;
+#else
+const TInt KAppIconCount = 1;
+#endif
+
 // ------------------------
 
 /**
@@ -360,7 +378,7 @@
     RFile       appArcIcon;
     TUid        midletUid;
     TInt        err;
-    TInt        numberOfIcons = 1; // Conversion results always one icon in mbm.
+    TInt        numberOfIcons = KAppIconCount; // number of icons stored in MBM
     // Also default mbm has one icon.
 
     midletUid.iUid = aUid;
@@ -973,3 +991,74 @@
     }
 }
 #endif // !SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK
+
+/**
+ * See JNI method __1logComponent.
+ * This method makes calls that may leave.
+ */
+#ifdef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK
+void AddInstallLogEntryL(
+    JNIEnv */*aEnv*/, jint /*aAction*/, jint /*aUid*/,
+    jstring /*aName*/, jstring /*aVendor*/,
+    jint /*aMajorVersion*/, jint /*aMinorVersion*/, jint /*aMicroVersion*/)
+{
+}
+#else
+void AddInstallLogEntryL(
+    JNIEnv *aEnv, jint aAction, jint aUid, jstring aName, jstring aVendor,
+    jint aMajorVersion, jint aMinorVersion, jint aMicroVersion)
+{
+    TUid uid = TUid::Uid(aUid);
+    HBufC *name = CreateHBufCFromJavaStringLC(aEnv, aName);
+    HBufC *vendor = CreateHBufCFromJavaStringLC(aEnv, aVendor);
+    TVersion version(aMajorVersion, aMinorVersion, aMicroVersion);
+
+    // Create log task object.
+    CTask* task = CTask::NewL(KLogTaskImplUid, EFalse);
+    CleanupStack::PushL(task);
+
+    // Initalize log task parameters.
+    TLogTaskParam params;
+    params.iName.Copy(name->Left(KMaxLogNameLength));
+    params.iVendor.Copy(vendor->Left(KMaxLogVendorLength));
+    params.iVersion = version;
+    params.iUid = uid;
+    // Time must be universal time.
+    TTime time;
+    time.UniversalTime();
+    params.iTime = time;
+    params.iAction = (TLogTaskAction)aAction;
+    params.iIsStartup = EFalse; // Startup list was not modified.
+
+    TLogTaskParamPckg pckg(params);
+    task->SetParameterL(pckg, 0);
+
+    // Create log task manager.
+    CTaskManager* taskManager = CTaskManager::NewL();
+    CleanupStack::PushL(taskManager);
+
+    // Add the log task to the task list.
+    taskManager->AddTaskL(task);
+    taskManager->ExecutePendingTasksL();
+
+    // Cleanup.
+    CleanupStack::PopAndDestroy(taskManager);
+    CleanupStack::Pop(task);
+
+    CleanupStack::PopAndDestroy(vendor);
+    CleanupStack::PopAndDestroy(name);
+}
+#endif // SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK
+
+/**
+ * Adds an entry to platform installation log.
+ */
+JNIEXPORT jint JNICALL Java_com_nokia_mj_impl_installer_applicationregistrator_ApplicationRegistrator__1addInstallLogEntry
+(JNIEnv *aEnv, jclass, jint aAction, jint aUid, jstring aName, jstring aVendor,
+ jint aMajorVersion, jint aMinorVersion, jint aMicroVersion)
+{
+    TRAPD(err, AddInstallLogEntryL(
+              aEnv, aAction, aUid, aName, aVendor,
+              aMajorVersion, aMinorVersion, aMicroVersion));
+    return err;
+}
--- a/javamanager/javainstaller/installer/src.s60/iconconverter/iconconverter.cpp	Tue Jul 06 14:10:26 2010 +0300
+++ b/javamanager/javainstaller/installer/src.s60/iconconverter/iconconverter.cpp	Wed Aug 18 09:43:15 2010 +0300
@@ -20,11 +20,14 @@
 
 #include <zipfile.h>
 #include <time.h>
+#include <bitmaptransforms.h>
 
 #include "javacommonutils.h"
 #include "logger.h"
 #include "mifconverter.h"
 #include "iconconverter.h"
+#include "iconsizeutils.h"      // TIconSizes 
+#include "iconsizenotifier.h"   // KUidIconSizeNotifPlugin
 
 namespace java
 {
@@ -32,12 +35,13 @@
 /**
  * The icon in S60 temporary drive
  */
-_LIT(KTempIconName, "D:\\micon.mbm");
+_LIT(KTempIconName1, "D:\\micon1.mbm");
+_LIT(KTempMaskName1, "D:\\mmask1.mbm");
 
-/**
- * The mask in S60 temporary drive
- */
-_LIT(KTempMaskName, "D:\\mmask.mbm");
+#ifdef RD_JAVA_S60_RELEASE_9_2
+_LIT(KTempIconName2, "D:\\micon2.mbm");
+_LIT(KTempMaskName2, "D:\\mmask2.mbm");
+#endif // RD_JAVA_S60_RELEASE_9_2
 
 
 // MIF file constants
@@ -51,13 +55,11 @@
 const TInt KMifIconHeaderAnimated = 0;
 
 
-
 CIconConverter* CIconConverter::NewL(RFs& aRFs)
 {
     return new(ELeave) CIconConverter(aRFs);
 }
 
-
 CIconConverter::CIconConverter(RFs &aRFs)
 {
     iRFs = aRFs;
@@ -79,6 +81,8 @@
     // Do NOT close file server session
     delete iBitmapMask;
     delete iBitmap;
+    delete iBitmapMaskScaledCopy;
+    delete iBitmapScaledCopy;
     delete iImageDecoder;
 
     RFbsSession::Disconnect();
@@ -246,34 +250,77 @@
                            *iBitmapMask);
 
     CActiveScheduler::Start();
-    err = iActiveListener->iStatus.Int();
+    User::LeaveIfError(iActiveListener->iStatus.Int());
+
+    // Scale icons
+    TIconSizes sizes(GetIdealIconSizes());
+    CBitmapScaler* scaler = CBitmapScaler::NewL();
+    CleanupStack::PushL(scaler);
+    scaler->SetQualityAlgorithm(CBitmapScaler::EMaximumQuality);
+
+    // Scale for Menu
+    ILOG2(EJavaInstaller, "Scaling Menu icon to (%d, %d)", 
+        sizes.iMenuIconSize.iWidth, sizes.iMenuIconSize.iHeight);
+    iBitmapScaledCopy = new(ELeave) CFbsBitmap;
+    iBitmapMaskScaledCopy = new(ELeave) CFbsBitmap;
+    ScaleL(*scaler, sizes.iMenuIconSize);
+    User::LeaveIfError(iBitmapScaledCopy->Save(KTempIconName1));
+    User::LeaveIfError(iBitmapMaskScaledCopy->Save(KTempMaskName1));
+    iBitmapScaledCopy->Reset();
+    iBitmapMaskScaledCopy->Reset();
+
+#ifdef RD_JAVA_S60_RELEASE_9_2
+    // Scale for App Manager
+    ILOG2(EJavaInstaller, "Scaling App Mgr icon to (%d, %d)", 
+        sizes.iMenuIconSize.iWidth, sizes.iMenuIconSize.iHeight);
+    ScaleL(*scaler, sizes.iAppMgrIconSize);
+    User::LeaveIfError(iBitmapScaledCopy->Save(KTempIconName2));
+    User::LeaveIfError(iBitmapMaskScaledCopy->Save(KTempMaskName2));
+    iBitmapScaledCopy->Reset();
+    iBitmapMaskScaledCopy->Reset();
+#endif // RD_JAVA_S60_RELEASE_9_2
+
+    CleanupStack::PopAndDestroy(scaler);
     delete iActiveListener;
     iActiveListener = NULL;
-    if (err != KErrNone)
-    {
-        User::Leave(err);
-    }
 
-    // store bitmap to two temp files
-    User::LeaveIfError(iBitmap->Save(KTempIconName));
-    User::LeaveIfError(iBitmapMask->Save(KTempMaskName));
-
-    // construct multi bitmap file from bitmap and mask files (2 files)
+    // Construct multi bitmap file from bitmap and mask files (2 files)
+#ifdef RD_JAVA_S60_RELEASE_9_2
+    const TInt KBmpCount = 4;
+    TInt32 sourceIds[] = {0, 0, 0, 0};
+#else
+    const TInt KBmpCount = 2;
     TInt32 sourceIds[] = {0, 0};
-    TFileName** filenames = new(ELeave) TFileName*[2];
+#endif // RD_JAVA_S60_RELEASE_9_2
+    
+    TFileName** filenames = new(ELeave) TFileName*[KBmpCount];
     CleanupStack::PushL(filenames);
-    filenames[0] = new(ELeave) TFileName(KTempIconName);
+    filenames[0] = new(ELeave) TFileName(KTempIconName1);
     CleanupStack::PushL(filenames[0]);
-    filenames[1] = new(ELeave) TFileName(KTempMaskName);
+    filenames[1] = new(ELeave) TFileName(KTempMaskName1);
     CleanupStack::PushL(filenames[1]);
-
-    CFbsBitmap::StoreL(aOutputFile, 2, (const TDesC**)filenames, sourceIds);
+    
+#ifdef RD_JAVA_S60_RELEASE_9_2
+    filenames[2] = new(ELeave) TFileName(KTempIconName2);
+    CleanupStack::PushL(filenames[2]);
+    filenames[3] = new(ELeave) TFileName(KTempMaskName2);
+    CleanupStack::PushL(filenames[3]);
+#endif // RD_JAVA_S60_RELEASE_9_2
+    
+    CFbsBitmap::StoreL(aOutputFile, KBmpCount, (const TDesC**)filenames, sourceIds);
 
     // Now try to delete the temp icon and mask files,
     // ignore possible errors
-    (void)iRFs.Delete(KTempIconName);
-    (void)iRFs.Delete(KTempMaskName);
-
+    (void)iRFs.Delete(KTempIconName1);
+    (void)iRFs.Delete(KTempMaskName1);
+    
+#ifdef RD_JAVA_S60_RELEASE_9_2
+    (void)iRFs.Delete(KTempIconName2);
+    (void)iRFs.Delete(KTempMaskName2);
+    CleanupStack::PopAndDestroy(filenames[3]);
+    CleanupStack::PopAndDestroy(filenames[2]);
+#endif // RD_JAVA_S60_RELEASE_9_2
+    
     CleanupStack::PopAndDestroy(filenames[1]);
     CleanupStack::PopAndDestroy(filenames[0]);
     CleanupStack::PopAndDestroy(filenames);
@@ -371,4 +418,64 @@
     mimeTypes.ResetAndDestroy();
 }
 
+void CIconConverter::ScaleL(CBitmapScaler& aScaler, const TSize aSize)
+{
+    ASSERT(iBitmapScaledCopy);
+    ASSERT(iBitmapMaskScaledCopy);
+
+    User::LeaveIfError(iBitmapScaledCopy->Create(aSize, EColor16M));
+    User::LeaveIfError(iBitmapMaskScaledCopy->Create(aSize, EGray256));
+
+    iActiveListener->InitialiseActiveListener();
+    aScaler.Scale(&iActiveListener->iStatus, *iBitmap, *iBitmapScaledCopy, ETrue);
+    CActiveScheduler::Start();
+    User::LeaveIfError(iActiveListener->iStatus.Int());
+
+    iActiveListener->InitialiseActiveListener();
+    aScaler.Scale(&iActiveListener->iStatus, *iBitmapMask, *iBitmapMaskScaledCopy, ETrue);
+    CActiveScheduler::Start();
+    User::LeaveIfError(iActiveListener->iStatus.Int());
+}
+
+TIconSizes CIconConverter::GetIdealIconSizes()
+{
+    TIconSizes fallbackSizes;
+    fallbackSizes.iMenuIconSize = TSize(KIconInMenuFallbackSize, KIconInMenuFallbackSize);
+    fallbackSizes.iAppMgrIconSize = TSize(KIconInAppMgrFallbackSize, KIconInAppMgrFallbackSize);
+    
+#ifdef RD_JAVA_S60_RELEASE_9_2
+    RNotifier notifier;
+    TInt err = notifier.Connect();
+    if (KErrNone != err)
+    {
+        ELOG1(EJavaInstaller, "CIconConverter::GetIdealIconSizes #1 err = %d", err);
+        return fallbackSizes;
+    }
+    
+    CleanupClosePushL(notifier);
+
+    TPckgBuf<TIconSizes> des;
+    iActiveListener->InitialiseActiveListener();
+    notifier.StartNotifierAndGetResponse(iActiveListener->iStatus,
+                                         KUidIconSizeNotifPlugin, des, des);
+    CActiveScheduler::Start();
+    notifier.CancelNotifier(KUidIconSizeNotifPlugin);
+    err = iActiveListener->iStatus.Int();
+    
+    CleanupStack::PopAndDestroy(&notifier);
+    
+    if (KErrNone != err)
+    {
+        ELOG1(EJavaInstaller, "CIconConverter::GetIdealIconSizes #2 err = %d", err);
+        return fallbackSizes;
+    }
+    else
+    {
+        return des();
+    }
+#else
+    return fallbackSizes;
+#endif
+}
+
 } // namespace java
--- a/javamanager/javainstaller/installer/src.s60/iconconverter/iconconverter.h	Tue Jul 06 14:10:26 2010 +0300
+++ b/javamanager/javainstaller/installer/src.s60/iconconverter/iconconverter.h	Wed Aug 18 09:43:15 2010 +0300
@@ -26,6 +26,10 @@
 #include <imageconversion.h>
 
 
+class CBitmapScaler;
+class TIconSizes;
+
+
 namespace java
 {
 
@@ -161,6 +165,15 @@
         HBufC8*      apIconBuf,
         const TDesC &aOutputFile);
 
+    /**
+     * Scale the original icon into the current temporary icon.
+     */
+    void ScaleL(CBitmapScaler& aScaler, const TSize aSize);
+
+    /**
+     * Get the ideal icon sizes from UI, trough the ecom plugin notifier.
+     */
+    TIconSizes GetIdealIconSizes();
 
 private:
     /**
@@ -176,16 +189,25 @@
     CBufferedImageDecoder* iImageDecoder;
 
     /**
-     * Pointer to bitmap generated from the icon
+     * Pointer to bitmap generated from the icon.
      */
     CFbsBitmap* iBitmap;
 
     /**
      * Pointer to the bitmap mask generated from the icon.
-     * May be NULL if the original icon not not have mask.
      */
     CFbsBitmap* iBitmapMask;
 
+    /**
+     * Scaled copy of the original icon bitmap.
+     */
+    CFbsBitmap* iBitmapScaledCopy;
+
+    /**
+     * Scaled copy of the original icon mask.
+     */
+    CFbsBitmap* iBitmapMaskScaledCopy;
+
     CActiveListener *iActiveListener;
 
 };
--- a/javamanager/javainstaller/installer/src.s60/jadjarmatcher/jadjarmatcher.cpp	Tue Jul 06 14:10:26 2010 +0300
+++ b/javamanager/javainstaller/installer/src.s60/jadjarmatcher/jadjarmatcher.cpp	Wed Aug 18 09:43:15 2010 +0300
@@ -83,7 +83,7 @@
                                                 classHandles, "addElement", "(Ljava/lang/Object;)V");
         jclass classTimestamps = aEnv->GetObjectClass(aTimestamps);
         jmethodID methodTimestampsAddElement = aEnv->GetMethodID(
-                                                   classHandles, "addElement", "(Ljava/lang/Object;)V");
+                                                   classTimestamps, "addElement", "(Ljava/lang/Object;)V");
         jclass integerClass = aEnv->FindClass("java/lang/Integer");
         jmethodID integerConstructor = aEnv->GetMethodID(
                                            integerClass, "<init>", "(I)V");
--- a/javamanager/javainstaller/installer/src.s60/jadjarmatcher/jadjarmatcherscanfrominbox.cpp	Tue Jul 06 14:10:26 2010 +0300
+++ b/javamanager/javainstaller/installer/src.s60/jadjarmatcher/jadjarmatcherscanfrominbox.cpp	Wed Aug 18 09:43:15 2010 +0300
@@ -143,7 +143,7 @@
                             TRAP(err, atta = iAttaMan->GetAttachmentFileL(attaInfo->Id()));
                             if (KErrNone == err)
                             {
-                                aResultArray.Insert(atta, 0);
+                                aResultArray.InsertL(atta, 0);
                             }
                         }
                     }
@@ -206,7 +206,7 @@
             TMsvEntry index = (*entry)[loop];
             if (KUidMsgTypePOP3 == index.iMtm || KUidMsgTypeIMAP4 == index.iMtm)
             {
-                aRootEntryArray.Insert((*entry)[loop].Id(), 0);
+                aRootEntryArray.InsertL((*entry)[loop].Id(), 0);
             }
         }
     }
@@ -245,7 +245,7 @@
                 if (index.Visible() && index.Complete() &&
                         !index.InPreparation() && !index.Deleted())
                 {
-                    aEntryArray.Insert(aId, 0);
+                    aEntryArray.InsertL(aId, 0);
                 }
             }
         }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javamanager/javainstaller/installer/src.s60/utils/propertylistener.cpp	Wed Aug 18 09:43:15 2010 +0300
@@ -0,0 +1,122 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* This class implements general wait object for calling
+* a callback function after subscribed P&S key value changes.
+*
+*/
+
+#include "propertylistener.h"
+#include "logger.h"
+
+using namespace java::installer;
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+CPropertyListener* CPropertyListener::NewL(TUid aUid, TUint aKey)
+{
+    CPropertyListener* self = new(ELeave) CPropertyListener(aUid, aKey);
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    CleanupStack::Pop(self);
+    return self;
+}
+
+CPropertyListener::CPropertyListener(TUid aUid, TUint aKey)
+    : CActive(CActive::EPriorityStandard), iUid(aUid), iKey(aKey)
+{
+}
+
+void CPropertyListener::ConstructL()
+{
+    User::LeaveIfError(iProperty.Attach(iUid, iKey));
+    // PropertyListener is always created from a thread which does
+    // not have ActiveScheduler, so create ActiveScheduler now.
+    iActiveScheduler = new(ELeave) CActiveScheduler;
+    CActiveScheduler::Install(iActiveScheduler);
+    // Add this object to the ActiveScheduler.
+    CActiveScheduler::Add(this);
+}
+
+CPropertyListener::~CPropertyListener()
+{
+    Cancel();
+    iProperty.Close();
+    if (iActiveScheduler)
+    {
+        delete iActiveScheduler;
+        iActiveScheduler = 0;
+    }
+}
+
+void CPropertyListener::ProcessEventsL(JNIEnv *aEnv, jobject aProvider)
+{
+    // Get the java side callback method.
+    jclass clazz = aEnv->GetObjectClass(aProvider);
+    jmethodID method = aEnv->GetMethodID(clazz, "valueChanged", "(I)V");
+
+    iEnv = aEnv;
+    iProvider = aProvider;
+    iMethod = method;
+
+    // Run propertyListener once so that the current property value
+    // gets delivered and property value changes are subscribed.
+    RunL();
+
+    // Start ActiveScheduler.
+    CActiveScheduler::Start();
+}
+
+void CPropertyListener::RunL()
+{
+    if (iCancelled)
+    {
+        CActiveScheduler::Stop();
+        return;
+    }
+
+    // Resubscribe before handling the new value to prevent missing updates.
+    iProperty.Subscribe(iStatus);
+    SetActive();
+
+    TInt value;
+    TInt err = iProperty.Get(value);
+    if (KErrNone == err)
+    {
+        //ILOG3(EJavaInstaller,
+        //      "CPropertyListener::RunL: property value changed"
+        //      ", uid: 0x%x, key: 0x%x, value: %d", iUid.iUid, iKey, value);
+        // Use callback method to deliver the changed property value to
+        // Java side object.
+        iEnv->CallVoidMethod(iProvider, iMethod, value);
+    }
+    else if (KErrNotFound == err)
+    {
+        // Property deleted, no actions needed.
+    }
+    else
+    {
+        // Error while reading property value.
+        ELOG3(EJavaInstaller,
+              "CPropertyListener::RunL: getting property value failed"
+              ", uid: 0x%x, key: 0x%x, err=%d", iUid.iUid, iKey, err);
+    }
+}
+
+void CPropertyListener::DoCancel()
+{
+    iCancelled = ETrue;
+    iProperty.Cancel();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javamanager/javainstaller/installer/src.s60/utils/propertylistener.h	Wed Aug 18 09:43:15 2010 +0300
@@ -0,0 +1,82 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+* This class implements general wait object for calling
+* a callback function after subscribed P&S key value changes.
+*
+*/
+
+#ifndef PROPERTYLISTENER_H
+#define PROPERTYLISTENER_H
+
+#include <e32base.h>
+#include <e32property.h>
+#include <jni.h>
+
+namespace java
+{
+namespace installer
+{
+
+/**
+ * This class implements wait object for calling a callback
+ * function after subscribed P&S key value changes.
+ */
+NONSHARABLE_CLASS(CPropertyListener) : public CActive
+{
+public:  // Constructor and destructor
+
+    static CPropertyListener* NewL(TUid aUid, TUint aKey);
+
+    // Destructor.
+    virtual ~CPropertyListener();
+
+private:
+
+    // Constructor.
+    CPropertyListener(TUid aUid, TUint aKey);
+
+    // 2nd phase constructor.
+    void ConstructL();
+
+    // from base class CActive
+
+    void RunL();
+
+    void DoCancel();
+
+public: // Methods
+
+    void ProcessEventsL(JNIEnv *aEnv, jobject aProvider);
+
+private: // Data
+
+    CActiveScheduler* iActiveScheduler; // Owned
+
+    RProperty iProperty; // Property to listen
+    TUid iUid; // Property UID
+    TUint iKey; // Property key
+
+    JNIEnv *iEnv; // JNI environment, not owned
+    jobject iProvider; // Callback object
+    jmethodID iMethod; // Callback method
+
+    TBool iCancelled;
+};
+
+} // installer
+} // java
+
+#endif // PROPERTYLISTENER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javamanager/javainstaller/installer/src.s60/utils/propertyprovider.cpp	Wed Aug 18 09:43:15 2010 +0300
@@ -0,0 +1,91 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  The JNI code for Java Installer class FileWriter.
+*
+*/
+
+#include "com_nokia_mj_impl_installer_utils_PropertyProvider.h"
+#include "logger.h"
+#include "propertylistener.h"
+
+// NAMESPACE DECLARATION
+using namespace java::installer;
+using namespace java::util;
+
+/*
+ * Class:     com_nokia_mj_impl_installer_utils_PropertyProvider
+ * Method:    _subscribe
+ * Signature: (II)I
+ */
+JNIEXPORT jint JNICALL Java_com_nokia_mj_impl_installer_utils_PropertyProvider__1subscribe
+(JNIEnv */*aEnv*/, jclass, jint aCategory, jint aKey)
+{
+    TUid uid = TUid::Uid(aCategory);
+    TUint key = (TUint)aKey;
+    // Construct PropertyListener.
+    CPropertyListener* propertyListener = 0;
+    TRAPD(err, propertyListener = CPropertyListener::NewL(uid, key));
+    if (KErrNone != err)
+    {
+        ELOG3(EJavaInstaller,
+              "PropertyProvider__1subscribe: creating property listener "
+              "failed, uid: 0x%x, key: 0x%x, err=%d", uid.iUid, key, err);
+        return err;
+    }
+
+    // Return handle to session. Utilize the fact that in Symbian
+    // all pointer addresses are MOD 4 so the last 2 bits are 0
+    // and can be shifted out. This way the returned handle is
+    // always positive whereas Symbian error codes are always negative.
+    return reinterpret_cast<TUint>(propertyListener)>>2;
+}
+
+/*
+ * Class:     com_nokia_mj_impl_installer_utils_PropertyProvider
+ * Method:    _processEvents
+ * Signature: (ILcom/nokia/mj/impl/installer/utils/PropertyProvider;)I
+ */
+JNIEXPORT jint JNICALL Java_com_nokia_mj_impl_installer_utils_PropertyProvider__1processEvents
+  (JNIEnv *aEnv, jclass, jint aHandle, jobject aProvider)
+{
+    CPropertyListener* propertyListener =
+        reinterpret_cast<CPropertyListener*>(aHandle<<2);
+    // Start propertyListener for event sending.
+    TRAPD(err, propertyListener->ProcessEventsL(aEnv, aProvider));
+    if (KErrNone != err)
+    {
+        ELOG1(EJavaInstaller,
+              "PropertyProvider__1processEvents: initializing "
+              "propertyListener failed, err=%d", err);
+    }
+    return err;
+}
+
+/*
+ * Class:     com_nokia_mj_impl_installer_utils_PropertyProvider
+ * Method:    _unsubscribe
+ * Signature: (I)I
+ */
+JNIEXPORT jint JNICALL Java_com_nokia_mj_impl_installer_utils_PropertyProvider__1unsubscribe
+  (JNIEnv *, jclass, jint aHandle)
+{
+    CPropertyListener* propertyListener =
+        reinterpret_cast<CPropertyListener*>(aHandle<<2);
+
+    // Delete PropertyListener.
+    delete propertyListener;
+    propertyListener = 0;
+
+    return KErrNone;
+}
--- a/javamanager/javainstaller/installer/tsrc/javasrc/com/nokia/mj/impl/installer/InstallerEngineTest.java	Tue Jul 06 14:10:26 2010 +0300
+++ b/javamanager/javainstaller/installer/tsrc/javasrc/com/nokia/mj/impl/installer/InstallerEngineTest.java	Wed Aug 18 09:43:15 2010 +0300
@@ -649,7 +649,7 @@
                    iItu.isExceptionReason
                    (Installer.getExecuteException(),
                     InstallerErrorMessage.INST_CANCEL,
-                    InstallerDetailedErrorMessage.NO_MSG,
+                    InstallerDetailedErrorMessage.INST_CANCEL,
                     OtaStatusCode.USER_CANCELLED));
         assertTrue("installed app uid should not exist", Installer.iInstalledApps.length == 0);
     }
@@ -717,7 +717,7 @@
                    iItu.isExceptionReason
                    (Installer.getExecuteException(),
                     InstallerErrorMessage.INST_CANCEL,
-                    InstallerDetailedErrorMessage.NO_MSG,
+                    InstallerDetailedErrorMessage.INST_CANCEL,
                     OtaStatusCode.USER_CANCELLED));
         assertTrue("installed app uid should not exist", Installer.iInstalledApps.length == 0);
         Log.log("InstallerEngineTest.testDownloadJadCancel: end");
--- a/javamanager/javainstaller/installer/tsrc/javasrc/com/nokia/mj/impl/installer/utils/SysUtilTest.java	Tue Jul 06 14:10:26 2010 +0300
+++ b/javamanager/javainstaller/installer/tsrc/javasrc/com/nokia/mj/impl/installer/utils/SysUtilTest.java	Wed Aug 18 09:43:15 2010 +0300
@@ -33,6 +33,8 @@
  */
 public class SysUtilTest extends TestCase implements InstallerMain
 {
+    private int iPropertyValue = 0; // Used in testPropertyListener test case.
+
     // Begin j2meunit test framework setup
 
     public void installerMain(String[] args)
@@ -169,6 +171,14 @@
 
         if (Platform.isS60())
         {
+        suite.addTest(new SysUtilTest("testPropertyListener", new TestMethod()
+        {
+            public void run(TestCase tc)
+            {
+                ((SysUtilTest)tc).testPropertyListener();
+            }
+        }));
+
         suite.addTest(new SysUtilTest("testGetProcessState", new TestMethod()
         {
             public void run(TestCase tc)
@@ -266,13 +276,12 @@
     {
         try
         {
-            // Test PS keys defined in ScreensaverInternalPSKeys.h
-            Uid uid = PlatformUid.createUid("0x101F8771");  // KPSUidScreenSaver
-            int key = 0x00000001; // KScreenSaverPreviewMode
-            // Set screensaver preview mode on (stays on for 10 secs).
+            Uid uid = SysUtil.PROP_CATEGORY_SYSTEM;
+            long key = SysUtil.PROP_KEY_JAVA_LATEST_INSTALLATION_PROGRESS;
             SysUtil.setPropertyValue(uid, key, 1);
             int value = SysUtil.getPropertyValue(uid, key);
-            assertTrue("KScreenSaverPreviewMode(!=1): " + value, value == 1);
+            assertTrue("PROP_KEY_JAVA_LATEST_INSTALLATION_PROGRESS(!=1): " +
+                       value, value == 1);
         }
         catch (InstallerException ie)
         {
@@ -285,9 +294,8 @@
     {
         try
         {
-            // Test PS keys defined in ScreensaverInternalPSKeys.h
-            Uid uid = PlatformUid.createUid("0x101F8771");  // KPSUidScreenSaver
-            int key = 0x00000010; // Undefined key
+            Uid uid = SysUtil.PROP_CATEGORY_SYSTEM;
+            int key = 0x00000100; // Undefined key
             SysUtil.setPropertyValue(uid, key, 1);
             assertTrue("Setting undefined property value did not fail", false);
         }
@@ -374,11 +382,12 @@
     {
         try
         {
-            // Test CenRep keys defined in ScreensaverInternalCRKeys.h
-            Uid uid = PlatformUid.createUid("0x101F8770"); // KCRUidScreenSaver
-            long key = 0x00000004; // KScreenSaverInvertedColors
+            // Test CenRep keys defined in Java security.
+            Uid uid = PlatformUid.createUid("0x2001B289"); // KJavaSecurity
+            long key = 0x00000004; // KJavaSecurity/KWarningsMode
             int value = SysUtil.getRepositoryValue(uid, key);
-            assertTrue("KScreenSaverInvertedColors(!=0): " + value, value == 0);
+            assertTrue("KJavaSecurity/KWarningsMode(!=2): " + value,
+                       value == 2);
         }
         catch (InstallerException ie)
         {
@@ -609,6 +618,81 @@
         }
     }
 
+    public void testPropertyListener()
+    {
+        final int category = 0x101f75b6;
+        final int key = 0x20019546;
+        final int value = 15;
+        final Object synchObject = this;
+        PropertyListener listener = new PropertyListener()
+        {
+            public void valueChanged(int aCategory, int aKey, int aValue)
+            {
+                try
+                {
+                    if (aValue == 0)
+                    {
+                        // Ignore the first event which is sent when
+                        // subscription is made.
+                        return;
+                    }
+                    synchronized (synchObject)
+                    {
+                        iPropertyValue = aValue;
+                        Log.log("PropertyListener.valueChanged: " + aValue +
+                                " (" + aCategory + ", " + aKey + ")");
+                        if (aCategory != category)
+                        {
+                            Log.logError("PropertyListener.valueChanged: " +
+                                         "invalid category " + aCategory);
+                        }
+                        if (aKey != key)
+                        {
+                            Log.logError("PropertyListener.valueChanged: " +
+                                         "invalid key " + aKey);
+                        }
+                        synchObject.notify();
+                    }
+                }
+                catch (Throwable t)
+                {
+                    Log.logError("PropertyListener.valueChanged exception", t);
+                }
+            }
+        };
+        try
+        {
+            iPropertyValue = 0;
+            SysUtil.setPropertyValue(
+                PlatformUid.createUid(category), key, iPropertyValue);
+            PropertyProvider provider = new PropertyProvider();
+            provider.subscribe(category, key, listener);
+            SysUtil.setPropertyValue(
+                PlatformUid.createUid(category), key, value);
+            try
+            {
+                synchronized (synchObject)
+                {
+                    if (iPropertyValue == 0)
+                    {
+                        synchObject.wait(2000);
+                    }
+                }
+            }
+            catch (InterruptedException ie)
+            {
+            }
+            provider.unsubscribe();
+            assertTrue("Unexpected property value after test: " +
+                       iPropertyValue, iPropertyValue == value);
+        }
+        catch (Throwable t)
+        {
+            Log.logError("testPropertyListener exception", t);
+            assertTrue("Unexpected exception " + t, false);
+        }
+    }
+
     public void testGetProcessState()
     {
         int state = SysUtil.getProcessState(PlatformUid.createUid("[102033e6]"));
--- a/javamanager/javainstaller/installerui/data/javaapplicationinstaller.css	Tue Jul 06 14:10:26 2010 +0300
+++ b/javamanager/javainstaller/installerui/data/javaapplicationinstaller.css	Wed Aug 18 09:43:15 2010 +0300
@@ -88,6 +88,15 @@
 	font-size: 23.45px; /*hb-param-text-height-secondary; /*3.5un*/
 }
 
+QLabel#urlLabel{
+	/* Text in authentication dialog (UsernamePasswordView) */
+	/* Note that this dialog is always in portrait */
+	font-size: 23.45px; /*hb-param-text-height-secondary; /*3.5un*/
+	margin-top: 13.4px; /*hb-param-margin-gene-popup; /*2un*/
+	margin-left: 13.4px; /*hb-param-margin-gene-popup; /*2un*/
+	margin-right: 13.4px; /*hb-param-margin-gene-popup; /*2un*/
+}
+
 QLabel#authLabel{
 	/* Text in authentication dialog (UsernamePasswordView) */
 	/* Note that this dialog is always in portrait */
--- a/javamanager/javainstaller/installerui/javasrc/com/nokia/mj/impl/installer/ui/eswt/InstallConfirmationView.java	Tue Jul 06 14:10:26 2010 +0300
+++ b/javamanager/javainstaller/installerui/javasrc/com/nokia/mj/impl/installer/ui/eswt/InstallConfirmationView.java	Wed Aug 18 09:43:15 2010 +0300
@@ -23,18 +23,13 @@
 import java.io.InputStream;
 
 import org.eclipse.swt.SWT;
-import org.eclipse.swt.SWTException;
 import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.graphics.Point;
 import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.widgets.Combo;
 import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Button;
 import org.eclipse.swt.widgets.Event;
 import org.eclipse.swt.widgets.Label;
 import org.eclipse.swt.widgets.Link;
 import org.eclipse.swt.widgets.Listener;
-import org.eclipse.swt.widgets.Shell;
 
 /**
  * InstallConfirmationView asks installation confirmation
--- a/javamanager/javainstaller/installerui/javasrc/com/nokia/mj/impl/installer/ui/eswt/InstallerUiEswt.java	Tue Jul 06 14:10:26 2010 +0300
+++ b/javamanager/javainstaller/installerui/javasrc/com/nokia/mj/impl/installer/ui/eswt/InstallerUiEswt.java	Wed Aug 18 09:43:15 2010 +0300
@@ -35,6 +35,7 @@
 
 import java.io.InputStream;
 import java.io.IOException;
+import java.util.Enumeration;
 import java.util.Hashtable;
 
 import org.eclipse.ercp.swt.midp.UIThreadSupport;
@@ -48,6 +49,8 @@
 import org.eclipse.swt.graphics.ImageLoader;
 import org.eclipse.swt.graphics.Point;
 import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.internal.extension.DisplayExtension;
+import org.eclipse.swt.internal.extension.ImageUtil;
 import org.eclipse.swt.widgets.Display;
 import org.eclipse.swt.widgets.Event;
 import org.eclipse.swt.widgets.Composite;
@@ -201,10 +204,7 @@
                     display.sleep();
                 }
             }
-            if (iBoldFont != null && !iBoldFont.isDisposed())
-            {
-                iBoldFont.dispose();
-            }
+            disposeResources();
             display.dispose();
             log("uiMain: display disposed");
             synchronized (iExitWaitObject)
@@ -1047,17 +1047,21 @@
         {
             return iSecurityIcon;
         }
-        String iconFilename = ResourceUtil.UNTRUSTED_ICON_NAME;
+        int id = ImageUtil.THEME_IMAGE_SECURITY_UNTRUSTED;
         if (aIdentified)
         {
-            iconFilename = ResourceUtil.TRUSTED_ICON_NAME;
+            id = ImageUtil.THEME_IMAGE_SECURITY_TRUSTED;
         }
-        String resourceDir = ResourceUtil.getResourceDir(0);
-        for (int i = 1; iSecurityIcon == null && resourceDir != null; i++)
+        
+        try 
         {
-            iSecurityIcon = loadImage(aDisplay, resourceDir + iconFilename, false);
-            resourceDir = ResourceUtil.getResourceDir(i);
+            iSecurityIcon = ImageUtil.createImageFromTheme(aDisplay, id);
         }
+        catch (Throwable t)
+        {
+            log("Can not load security icon: " + t);
+        }
+        
         return iSecurityIcon;
     }
 
@@ -1147,22 +1151,26 @@
         try
         {
             long startTime = System.currentTimeMillis();
-            ImageData[] imageDatas = new ImageLoader().load(aInputStream);
-            ImageData imageData = imageDatas[0];
+            
+            Image image = new Image(aDisplay, aInputStream);
             if (aScaleImage)
             {
-                Point bestSize = getBestImageSize(
-                                     imageData.width, imageData.height);
-                if (bestSize.x != imageData.width ||
-                        bestSize.y != imageData.height)
+                int maxWidth = DisplayExtension.getBestImageWidth(DisplayExtension.LIST_ELEMENT);
+                int maxHeight = DisplayExtension.getBestImageHeight(DisplayExtension.LIST_ELEMENT);
+                Rectangle rect = image.getBounds();
+                if (maxWidth != rect.width || maxHeight != rect.height)
                 {
-                    imageData = imageData.scaledTo(bestSize.x, bestSize.y);
-                    log("Image " + aImageName + " scaled from " +
-                        imageDatas[0].width + "x" + imageDatas[0].height +
-                        " to " + bestSize.x + "x" + bestSize.y);
+                    // Copy and scale natively preserving the aspect ratio
+                    result = ImageUtil.scaleImage(aDisplay, image, new Point(maxWidth, maxHeight), true);
+                    image.dispose();
+                    image = null;
                 }
             }
-            result = new Image(aDisplay, imageData);
+            if (result == null)
+            {
+                result = image;
+            }
+            
             long endTime = System.currentTimeMillis();
             log("Loaded image " + aImageName + " (load time " +
                 (endTime - startTime) + " ms)");
@@ -1176,33 +1184,6 @@
         return result;
     }
 
-    /**
-     * Determines the best image size for the image of given size.
-     */
-    private static Point getBestImageSize(int aWidth, int aHeight)
-    {
-        // Actually maximum image width and height should be obtained with
-        // org.eclipse.swt.internal.extension.DisplayExtension
-        // getBestImageWidth() and getBestImageHeight().
-        final int MAX_WIDTH = 50; // max width in pixels
-        final int MAX_HEIGHT = 50; // max height in pixels
-        Point result = new Point(aWidth, aHeight);
-        if (result.x > MAX_WIDTH || result.y > MAX_HEIGHT)
-        {
-            if (result.x >= MAX_WIDTH)
-            {
-                result.x = MAX_WIDTH;
-                result.y = MAX_WIDTH * aHeight / aWidth;
-            }
-            if (result.y >= MAX_HEIGHT)
-            {
-                result.x = MAX_HEIGHT * aWidth / aHeight;
-                result.y = MAX_HEIGHT;
-            }
-        }
-        return result;
-    }
-
     /** Returns true if UI has been created and can be used. */
     protected boolean isUiReady()
     {
@@ -1298,6 +1279,13 @@
         }
         return iBoldFont;
     }
+    
+    int iconLabelTopMargin()
+    {
+        // Aproximating the space at the top of a Label.
+        // eSWT's Label adds extra space around texts but not around images.
+        return getBoldFont().getFontData()[0].getHeight();
+    }
 
     void setActiveView(ViewBase aView)
     {
@@ -1313,4 +1301,24 @@
     {
         return iActiveView;
     }
+    
+    private void disposeResources() {
+        if (iBoldFont != null && !iBoldFont.isDisposed())
+        {
+            iBoldFont.dispose();
+        }
+        if (iSecurityIcon != null && !iSecurityIcon.isDisposed())
+        {
+            iSecurityIcon.dispose();
+        }
+        Enumeration e = iImageTable.elements();
+        while (e.hasMoreElements())
+        {
+            Image img = (Image)e.nextElement();
+            if (img != null && !img.isDisposed())
+            {
+                img.dispose();
+            }
+        }
+    }
 }
--- a/javamanager/javainstaller/installerui/javasrc/com/nokia/mj/impl/installer/ui/eswt/ViewBase.java	Tue Jul 06 14:10:26 2010 +0300
+++ b/javamanager/javainstaller/installerui/javasrc/com/nokia/mj/impl/installer/ui/eswt/ViewBase.java	Wed Aug 18 09:43:15 2010 +0300
@@ -412,7 +412,11 @@
         gridData.horizontalSpan = aColumns;
         gridData.horizontalAlignment = SWT.CENTER;
         gridData.verticalAlignment = SWT.TOP;
+        // This is to lower the image at the same level with the texts.
+        // eSWT's Label adds extra space around texts but not around images.
+        gridData.verticalIndent = iInstallerUi.iconLabelTopMargin();
         label.setLayoutData(gridData);
+        label.setFont(iInstallerUi.getBoldFont());
         return label;
     }
 
--- a/javamanager/javainstaller/installerui/javasrc/com/nokia/mj/impl/installer/ui/eswt2/InstallerUiEswt.java	Tue Jul 06 14:10:26 2010 +0300
+++ b/javamanager/javainstaller/installerui/javasrc/com/nokia/mj/impl/installer/ui/eswt2/InstallerUiEswt.java	Wed Aug 18 09:43:15 2010 +0300
@@ -36,6 +36,7 @@
 
 import java.io.InputStream;
 import java.io.IOException;
+import java.util.Enumeration;
 import java.util.Hashtable;
 
 import org.eclipse.ercp.swt.midp.UIThreadSupport;
@@ -219,10 +220,7 @@
                     display.sleep();
                 }
             }
-            if (iBoldFont != null && !iBoldFont.isDisposed())
-            {
-                iBoldFont.dispose();
-            }
+            disposeResources();
             display.dispose();
             log("uiMain: display disposed");
             synchronized (iExitWaitObject)
@@ -674,9 +672,10 @@
                 {
                     public void run()
                     {
-                        iOcspProgressView = new ProgressView(self, iDialog,
-                                                             InstallerUiTexts.get(InstallerUiTexts.OCSP_CHECK_PROGRESS),
-                                                             true);
+                        iOcspProgressView = new ProgressView(
+                            self, iDialog,
+                            InstallerUiTexts.get(InstallerUiTexts.OCSP_CHECK_PROGRESS),
+                            true);
                     }
                 });
                 iOcspProgressView.addCancelCommand();
@@ -805,45 +804,6 @@
     }
 
     /**
-     * Notify user that an error has occurred using RuntimeUI.
-     *
-     * @param aInstallerException exception indicating the error reason
-     */
-    /*
-    private void showRuntimeUiError(InstallerExceptionBase aInstallerException)
-    {
-        boolean identified = false;
-        if (iInstallInfo != null)
-        {
-            if (iInstallInfo.getCertificates() != null)
-            {
-                identified = true;
-            }
-        }
-        else if (iUninstallInfo != null)
-        {
-            if (iUninstallInfo.getCertificates() != null)
-            {
-                identified = true;
-            }
-        }
-        String tmpTitle = InstallerUiTexts.get(InstallerUiTexts.INSTALL_FAILED);
-
-        // Ensure that no confirmations are being displayed.
-        cancelConfirmations();
-        // Hide progress view before displaying error message.
-        if (iProgressView != null)
-        {
-            iProgressView.setVisible(false);
-        }
-        // Use RuntimeUi to display uninstallation error message.
-        RuntimeUi runtimeUi = RuntimeUiFactory.getRuntimeUi(identified);
-        runtimeUi.error(tmpTitle, aInstallerException);
-        runtimeUi.destroy();
-    }
-    */
-
-    /**
      * Seeks confirmation from the user.
      *
      * @param aAppName     the name of the application on behalf of which the
@@ -1032,20 +992,23 @@
      */
     protected String getTitle()
     {
-        String result = null;
-        if (iMode == MODE_INSTALL)
-        {
-            result = InstallerUiTexts.get(InstallerUiTexts.INSTALLING);
-        }
-        else if (iMode == MODE_UNINSTALL)
+        String result = super.getTitle();
+        if (isUiReady())
         {
-            result = InstallerUiTexts.get("Uninstalling");
-        }
-        else if (iMode == MODE_APP_CONVERSION)
-        {
-            result = InstallerUiTexts.get(
-                "Converting data for application " +
-                iAppConversionCurrent + "/" + iAppConversionTotal);
+            if (iMode == MODE_INSTALL)
+            {
+                result = InstallerUiTexts.get(InstallerUiTexts.INSTALLING);
+            }
+            else if (iMode == MODE_UNINSTALL)
+            {
+                result = InstallerUiTexts.get("Uninstalling");
+            }
+            else if (iMode == MODE_APP_CONVERSION)
+            {
+                result = InstallerUiTexts.get(
+                    "Converting data for application " +
+                    iAppConversionCurrent + "/" + iAppConversionTotal);
+            }
         }
         return result;
     }
@@ -1070,11 +1033,19 @@
         {
             iconFilename = "java_3_trusted.png";
         }
-        String resourceDir = ResourceUtil.getResourceDir(0);
-        for (int i = 1; iSecurityIcon == null && resourceDir != null; i++)
+        try
         {
-            iSecurityIcon = loadImage(aDisplay, resourceDir + iconFilename, false);
-            resourceDir = ResourceUtil.getResourceDir(i);
+            String resourceDir = ResourceUtil.getResourceDir(0);
+            for (int i = 1; iSecurityIcon == null && resourceDir != null; i++)
+            {
+                iSecurityIcon = loadImage(
+                    aDisplay, resourceDir + iconFilename, false);
+                resourceDir = ResourceUtil.getResourceDir(i);
+            }
+        }
+        catch (Throwable t)
+        {
+            log("Can not load security icon: " + t);
         }
         return iSecurityIcon;
     }
@@ -1363,4 +1334,24 @@
             logError("Loading CSS from " + cssPath + " failed", t);
         }
     }
+
+    private void disposeResources() {
+        if (iBoldFont != null && !iBoldFont.isDisposed())
+        {
+            iBoldFont.dispose();
+        }
+        if (iSecurityIcon != null && !iSecurityIcon.isDisposed())
+        {
+            iSecurityIcon.dispose();
+        }
+        Enumeration e = iImageTable.elements();
+        while (e.hasMoreElements())
+        {
+            Image img = (Image)e.nextElement();
+            if (img != null && !img.isDisposed())
+            {
+                img.dispose();
+            }
+        }
+    }
 }
--- a/javamanager/javainstaller/installerui/javasrc/com/nokia/mj/impl/installer/ui/eswt2/InstallerUiTexts.java	Tue Jul 06 14:10:26 2010 +0300
+++ b/javamanager/javainstaller/installerui/javasrc/com/nokia/mj/impl/installer/ui/eswt2/InstallerUiTexts.java	Wed Aug 18 09:43:15 2010 +0300
@@ -30,73 +30,6 @@
     /*** ----------------------------- PUBLIC ------------------------------ */
 
     // Define constants for localised text ids.
-    public static final String OK = "Ok";
-    public static final String CANCEL = "Cancel";
-    public static final String BACK = "Ok";
-    public static final String HIDE = "Hide";
-    public static final String SHOW = "Show";
-    public static final String CLOSE = "Close";
-    public static final String INSTALL_QUERY = "Install?";
-    public static final String UPDATE_QUERY = "Update?";
-    public static final String OCSP_CHECK_PROGRESS = "Checking certificate validity";
-    public static final String INSTALLING = "Installing";
-    public static final String INSTALL_FAILED = "Installation failed";
-    public static final String INSTALLATION_COMPLETE = "Installed";
-    public static final String DOWNLOADING = "Downloading";
-    public static final String CONNECT_TO = "Connect to";
-    public static final String DOWNLOAD_APPLICATION = "To download %U you need to authenticate yourself";
-    public static final String USERNAME = "Username:";
-    public static final String PASSWORD = "Password:";
-    public static final String SUITE_NAME = "%U (%U)";
-    public static final String SUITE_VENDOR = "%U";
-    public static final String SUITE_VERSION = "%U";
-    public static final String APP_NAME = "%U";
-    public static final String SIZE_KB = "%U kB";
-    public static final String SIZE_MB = "%U MB";
-    public static final String RETAIN_USER_DATA = "Retain application data";
-    // Certificate info texts.
-    public static final String NOT_CERTIFIED_TITLE = "Application is not certified.";
-    public static final String NOT_CERTIFIED_INFO = "Application %U is from an unknown source.";
-    public static final String CERTIFICATE_TITLE = "Application is certified.";
-    public static final String DOMAIN = "Domain: %U";
-    public static final String DOMAIN_MANU = "Manufacturer";
-    public static final String DOMAIN_OPER = "Operator";
-    public static final String DOMAIN_ITP = "Trusted 3rd party";
-    public static final String DOMAIN_UTP = "Untrusted 3rd party";
-    public static final String ISSUER = "Issuer: %U";
-    public static final String SUBJECT = "Subject: %U";
-    public static final String ORGANIZATION = "Organization: %U";
-    public static final String VALID_FROM = "Valid from: %U";
-    public static final String VALID_UNTIL = "Valid until: %U";
-    public static final String SERIAL_NUMBER = "Serial number: %U";
-    public static final String FINGERPRINT = "Fingerprint: %U";
-    // Texts for installation drive selection.
-    public static final String DRIVE_TYPE_UNKNOWN = "%U: Unknown";
-    public static final String DRIVE_TYPE_UNKNOWN_KB = "%U: Unknown (%N kB)";
-    public static final String DRIVE_TYPE_UNKNOWN_MB = "%U: Unknown (%N MB)";
-    public static final String DRIVE_TYPE_UNKNOWN_GB = "%U: Unknown (%N GB)";
-    public static final String DRIVE_TYPE_PHONE_MEMORY = "%U: Phone memory";
-    public static final String DRIVE_TYPE_PHONE_MEMORY_KB = "%U: Phone memory (%N kB)";
-    public static final String DRIVE_TYPE_PHONE_MEMORY_MB = "%U: Phone memory (%N MB)";
-    public static final String DRIVE_TYPE_PHONE_MEMORY_GB = "%U: Phone memory (%N GB)";
-    public static final String DRIVE_TYPE_MEMORY_CARD = "%U: Memory card";
-    public static final String DRIVE_TYPE_MEMORY_CARD_KB = "%U: Memory card (%N kB)";
-    public static final String DRIVE_TYPE_MEMORY_CARD_MB = "%U: Memory card (%N MB)";
-    public static final String DRIVE_TYPE_MEMORY_CARD_GB = "%U: Memory card (%N GB)";
-    public static final String DRIVE_TYPE_INTERNAL_MASS_STORAGE = "%U: Internal Mass Storage";
-    public static final String DRIVE_TYPE_INTERNAL_MASS_STORAGE_KB = "%U: Internal Mass Storage (%N kB)";
-    public static final String DRIVE_TYPE_INTERNAL_MASS_STORAGE_MB = "%U: Internal Mass Storage (%N MB)";
-    public static final String DRIVE_TYPE_INTERNAL_MASS_STORAGE_GB = "%U: Internal Mass Storage (%N GB)";
-    // Texts for permission confirmation view.
-    public static final String PERM_QUERY = "Access for protected functionality needed.";
-    public static final String PERM_VIEW_DETAILS = "Details";
-    public static final String PERM_ALLOW_ALWAYS = "Allow always";
-    public static final String PERM_ASK_ME_LATER = "Ask me later";
-    public static final String PERM_CANCEL = "Cancel installing";
-    public static final String PERM_VIEW_DETAILS_TITLE = "Application asks permissions for:";
-
-    /*
-    // Define constants for localised text ids.
     public static final String OK = "button_ok";
     public static final String CANCEL = "button_cancel";
     public static final String BACK = "button_back_ok";
@@ -114,9 +47,8 @@
     public static final String DOWNLOAD_APPLICATION = "info_auth_yourself";
     public static final String USERNAME = "dialog_username";
     public static final String PASSWORD = "dialog_password";
-    public static final String SUITE_NAME = "info_app_suite_name";
+    public static final String SUITE_NAME_VERSION = "info_app_suite_name_version";
     public static final String SUITE_VENDOR = "info_vendor";
-    public static final String SUITE_VERSION = "info_version";
     public static final String APP_NAME = "info_app_name";
     public static final String SIZE_KB = "info_size_kb";
     public static final String SIZE_MB = "info_size_mb";
@@ -161,7 +93,6 @@
     public static final String PERM_ASK_ME_LATER = "button_perm_ask_me_later";
     public static final String PERM_CANCEL = "button_perm_cancel_installing";
     public static final String PERM_VIEW_DETAILS_TITLE = "title_perm_view_details";
-    */
 
     /**
      * Method for retrieving a text string with given id and no parameters.
@@ -183,12 +114,12 @@
      */
     public static String get(String aTextId, Object[] aTextParameters)
     {
-        return new com.nokia.mj.impl.utils.Formatter(aTextId).format(aTextParameters);
-        //if (iRes == null)
-        //{
-        //    iRes = ResourceLoader.getInstance("javaapplicationinstaller", "txt_java_inst_");
-        //}
-        //return iRes.format(aTextId, aTextParameters);
+        if (iRes == null)
+        {
+            iRes = ResourceLoader.getInstance(
+                null, null, "javaapplicationinstaller", "txt_java_inst_");
+        }
+        return iRes.format(aTextId, aTextParameters);
     }
 
     /*** ---------------------------- PROTECTED --------------------------- */
--- a/javamanager/javainstaller/installerui/javasrc/com/nokia/mj/impl/installer/ui/eswt2/UsernamePasswordView.java	Tue Jul 06 14:10:26 2010 +0300
+++ b/javamanager/javainstaller/installerui/javasrc/com/nokia/mj/impl/installer/ui/eswt2/UsernamePasswordView.java	Wed Aug 18 09:43:15 2010 +0300
@@ -108,20 +108,20 @@
 
         int labelStyle = SWT.WRAP;
 
-        Label titleLabel = createLabel
-                           (InstallerUiTexts.get(InstallerUiTexts.CONNECT_TO), labelStyle);
+        Label titleLabel = createLabel(
+            InstallerUiTexts.get(InstallerUiTexts.CONNECT_TO), labelStyle);
         setCssId(titleLabel, "heading");
 
-        Label urlLabel = createLabel(iUrl, labelStyle);
+        Label urlLabel = createLabel(getServer(iUrl), labelStyle);
+        setCssId(urlLabel, "urlLabel");
 
-        Label authLabel = createLabel
-                          (InstallerUiTexts.get
-                           (InstallerUiTexts.DOWNLOAD_APPLICATION, new String[] { iAppName }),
-                           labelStyle);
+        Label authLabel = createLabel(
+            InstallerUiTexts.get(InstallerUiTexts.DOWNLOAD_APPLICATION,
+                                 new String[] { iAppName }), labelStyle);
         setCssId(authLabel, "authLabel");
 
-        Label usernameLabel = createLabel
-                              (InstallerUiTexts.get(InstallerUiTexts.USERNAME), labelStyle);
+        Label usernameLabel = createLabel(
+            InstallerUiTexts.get(InstallerUiTexts.USERNAME), labelStyle);
         setCssId(usernameLabel, "usernamePasswordLabel");
 
         iUsernameText = new Text(getComposite(), SWT.BORDER);
@@ -129,8 +129,8 @@
         iUsernameText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
         addSoftKeyListenerFor(iUsernameText);
 
-        Label passwordLabel = createLabel
-                              (InstallerUiTexts.get(InstallerUiTexts.PASSWORD), labelStyle);
+        Label passwordLabel = createLabel(
+            InstallerUiTexts.get(InstallerUiTexts.PASSWORD), labelStyle);
         setCssId(passwordLabel, "usernamePasswordLabel");
 
         iPasswordText = new Text(getComposite(), SWT.PASSWORD | SWT.BORDER);
@@ -156,4 +156,31 @@
     {
         return SWT.V_SCROLL;
     }
+
+    /**
+     * Returns server part from HTTP URL.
+     */
+    private String getServer(String aUrl)
+    {
+        String server = aUrl;
+        int i = server.indexOf("://");
+        if (i != -1)
+        {
+            server = server.substring(i + 3);
+            i = server.indexOf(":");
+            if (i != -1)
+            {
+                server = server.substring(0, i);
+            }
+            else
+            {
+                i = server.indexOf("/");
+                if (i != -1)
+                {
+                    server = server.substring(0, i);
+                }
+            }
+        }
+        return server;
+    }
 }
--- a/javamanager/javainstaller/installerui/javasrc/com/nokia/mj/impl/installer/ui/eswt2/ViewBase.java	Tue Jul 06 14:10:26 2010 +0300
+++ b/javamanager/javainstaller/installerui/javasrc/com/nokia/mj/impl/installer/ui/eswt2/ViewBase.java	Wed Aug 18 09:43:15 2010 +0300
@@ -221,7 +221,7 @@
     /** Set title for this view. */
     public void setTitle(String aTitle)
     {
-        // Dialog shells have no title anymore
+        // Dialog shells have no title.
     }
 
     /** Disposes this view. */
@@ -549,7 +549,7 @@
         // Add suite name and version.
         createAppInfoLabel(
             InstallerUiTexts.get(
-                InstallerUiTexts.SUITE_NAME,
+                InstallerUiTexts.SUITE_NAME_VERSION,
                 new String[] { aInstallInfo.getName(),
                                aInstallInfo.getVersion() }));
         if (aFull)
@@ -577,14 +577,14 @@
                 createAppInfoLabel(
                     InstallerUiTexts.get(
                         InstallerUiTexts.SIZE_MB,
-                        new String[] { Long.toString(1 + size/(1024*1024)) }));
+                        new Object[] { new Integer((int)(1 + size/(1024*1024))) }));
             }
             else
             {
                 createAppInfoLabel(
                     InstallerUiTexts.get(
                         InstallerUiTexts.SIZE_KB,
-                        new String[] { Long.toString(1 + size/1024) }));
+                        new Object[] { new Integer((int)(1 + size/1024)) }));
             }
         }
         if (aFull)
--- a/javamanager/javainstaller/javainstaller.pro	Tue Jul 06 14:10:26 2010 +0300
+++ b/javamanager/javainstaller/javainstaller.pro	Wed Aug 18 09:43:15 2010 +0300
@@ -16,5 +16,6 @@
 TEMPLATE = subdirs
 SUBDIRS += installerui/build/javainstallerui.pro 
 SUBDIRS += installer/build/javainstaller.pro 
+SUBDIRS += installcopier/build/javainstallcopier.pro 
 BLD_INF_RULES.prj_extensions += "$${LITERAL_HASH}include \"javasifplugin/build/bld.inf\""  
 BLD_INF_RULES.prj_extensions += "prj_extensions" 
--- a/javamanager/javainstaller/javasifplugin/build/javasifplugin.mmp	Tue Jul 06 14:10:26 2010 +0300
+++ b/javamanager/javainstaller/javasifplugin/build/javasifplugin.mmp	Wed Aug 18 09:43:15 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
 * All rights reserved.
 * This component and the accompanying materials are made available
 * under the terms of "Eclipse Public License v1.0"
@@ -42,6 +42,7 @@
 
 // Sources
 SOURCEPATH      ../src
+SOURCE          asyncwaitcallback.cpp
 SOURCE          javasifplugin.cpp
 SOURCE          proxy.cpp
 SOURCE          resultsserver.cpp
@@ -52,11 +53,14 @@
 USERINCLUDE     ../inc
 USERINCLUDE     ../../../../inc
 
+SYSTEMINCLUDE   /epoc32/include/mw/hb/hbwidgets
+
 // Libraries
 LIBRARY         apgrfx.lib
 LIBRARY         apmime.lib
 LIBRARY         ecom.lib
 LIBRARY         efsrv.lib
+LIBRARY         hbwidgets.lib
 LIBRARY         sif.lib
 LIBRARY         javacomms.lib
-LIBRARY         javaruntimestarterutils.lib
\ No newline at end of file
+LIBRARY         javaruntimestarterutils.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javamanager/javainstaller/javasifplugin/inc/asyncwaitcallback.h	Wed Aug 18 09:43:15 2010 +0300
@@ -0,0 +1,78 @@
+/*
+* Copyright (c) 2005-2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  This class implements general wait object for calling a desired
+*                callback function after asynchronous notification
+*
+*/
+
+#ifndef ASYNCWAITCALLBACK_H
+#define ASYNCWAITCALLBACK_H
+
+#include <e32base.h>
+
+namespace java
+{
+namespace installer
+{
+
+/**
+ * This class implements wait object for calling a desired
+ * callback function after rendezvous returns specified
+ * reason code from the process that this object is listening to.
+ */
+NONSHARABLE_CLASS(CAsyncWaitCallBack) : public CActive
+{
+public:  // Constructors and destructor
+
+    static CAsyncWaitCallBack* NewL(TCallBack aCallBack);
+
+    // Destructor.
+    virtual ~CAsyncWaitCallBack();
+
+public:  // From base classes
+
+    // from base class CActive
+
+    void RunL();
+
+    void DoCancel();
+
+public:
+
+    void Wait(RProcess aProcessToListen, TInt aActivatingReasonCode);
+
+private:
+
+    // Constructor.
+    CAsyncWaitCallBack();
+
+    // 2nd phase constructor.
+    void ConstructL(TCallBack aCallBack);
+
+private: //  Data
+
+    // Callback member
+    TCallBack   iCallBack;
+
+    // When request completes with this status code,
+    // callback is called.
+    TInt iActivatingReasonCode;
+
+    RProcess iProcessToListen;
+};
+
+} // installer
+} // java
+
+#endif // ASYNCWAITCALLBACK_H
--- a/javamanager/javainstaller/javasifplugin/inc/javasifplugin.h	Tue Jul 06 14:10:26 2010 +0300
+++ b/javamanager/javainstaller/javasifplugin/inc/javasifplugin.h	Wed Aug 18 09:43:15 2010 +0300
@@ -22,8 +22,10 @@
 #define JAVASIFPLUGIN_H
 
 #include <e32base.h>
+#include <hbdevicenotificationdialogsymbian.h>
 #include <usif/sif/sifplugin.h>
 
+#include "asyncwaitcallback.h"
 #include "f32file.h"
 
 class ResultsServer;
@@ -196,6 +198,11 @@
     virtual void CancelOperation();
 
 
+    /**
+     * Hides 'preparing installation' dialog.
+     */
+    void HidePrepInstDialogL();
+
 private:
 
     /**
@@ -296,6 +303,11 @@
         COpaqueNamedParams& aResults,
         TRequestStatus& aStatus);
 
+    /**
+     * Creates 'preparing installation' dialog.
+     */
+    void CreatePrepInstDialogL();
+
 private: //  Data
 
     RFs mRFs;
@@ -304,6 +316,9 @@
 
     COpaqueNamedParams* mDummyResults;
     CComponentInfo*     mDummyInfo;
+
+    CHbDeviceNotificationDialogSymbian* mPrepInstDialog;
+    CAsyncWaitCallBack* mWaitToHideDialog;
 };
 
 } // Installer
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javamanager/javainstaller/javasifplugin/src/asyncwaitcallback.cpp	Wed Aug 18 09:43:15 2010 +0300
@@ -0,0 +1,84 @@
+/*
+* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  This class implements general wait object for calling a desired
+ *                callback function after asynchronous notification
+ *
+*/
+
+#include "asyncwaitcallback.h"
+#include "logger.h"
+
+using namespace java::installer;
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+CAsyncWaitCallBack* CAsyncWaitCallBack::NewL(TCallBack aCallBack)
+{
+    CAsyncWaitCallBack* self = new(ELeave) CAsyncWaitCallBack();
+    CleanupStack::PushL(self);
+    self->ConstructL(aCallBack);
+    CleanupStack::Pop(self);
+    return self;
+}
+
+CAsyncWaitCallBack::CAsyncWaitCallBack():
+        CActive(CActive::EPriorityStandard), iActivatingReasonCode(0)
+{
+}
+
+CAsyncWaitCallBack::~CAsyncWaitCallBack()
+{
+}
+
+void CAsyncWaitCallBack::ConstructL(TCallBack aCallBack)
+{
+    iCallBack = aCallBack;
+    CActiveScheduler::Add(this);
+}
+
+void CAsyncWaitCallBack::RunL()
+{
+    // Execute callback only if the request completed with correct
+    // status code
+    if (iStatus == iActivatingReasonCode)
+    {
+        ILOG1(EJavaInstaller,
+              "CAsyncWaitCallBack called with notif code %d",
+              iStatus.Int());
+        iCallBack.CallBack();
+    }
+    else
+    {
+        WLOG1(EJavaInstaller,
+              "CAsyncWaitCallBack was called with unexpected notif code %d, reactivate",
+              iStatus.Int());
+        // Reactivate wait
+        iProcessToListen.Rendezvous(iStatus);
+        SetActive();
+    }
+}
+
+void CAsyncWaitCallBack::DoCancel()
+{
+    iProcessToListen.RendezvousCancel(iStatus);
+}
+
+void CAsyncWaitCallBack::Wait(RProcess aProcessToListen, TInt aActivatingReasonCode)
+{
+    iActivatingReasonCode = aActivatingReasonCode;
+    iProcessToListen = aProcessToListen;
+    iProcessToListen.Rendezvous(iStatus);
+    SetActive();
+}
+
--- a/javamanager/javainstaller/javasifplugin/src/javasifplugin.cpp	Tue Jul 06 14:10:26 2010 +0300
+++ b/javamanager/javainstaller/javasifplugin/src/javasifplugin.cpp	Wed Aug 18 09:43:15 2010 +0300
@@ -49,6 +49,7 @@
 _LIT(KPrivateDataCage, "\\private\\");
 _LIT(KInboxDataCage, "\\private\\1000484b\\");
 _LIT(KJavaInstallerProcess, "Installer*");
+_LIT(KJavaInstallCopierProcess, "javainstallcopier.exe");
 _LIT(KJavaInstallerDataCage, "\\private\\102033e6\\");
 _LIT(KJavaInstallerTmp, "\\private\\102033E6\\installer\\tmp\\");
 _LIT(KAnyExtension, ".*");
@@ -93,7 +94,18 @@
 // Java Installer is executed with same Uid as Java Runtime
 _LIT_SECURE_ID(KJavaInstallerSecureID, KJavaMidpSecureId);
 
-
+/**
+ * This function is called to hide the 'Preparing Installation' dialog.
+ */
+LOCAL_C TInt HidePrepInstDialog(TAny* aPlugin)
+{
+    CJavaSifPlugin *pPlugin = (CJavaSifPlugin *)aPlugin;
+    if (NULL != pPlugin)
+    {
+        TRAP_IGNORE(pPlugin->HidePrepInstDialogL());
+    }
+    return KErrNone;
+}
 
 // ============================ MEMBER FUNCTIONS ===============================
 
@@ -126,6 +138,15 @@
 
     delete mDummyInfo;
     mDummyInfo = NULL;
+
+    delete mPrepInstDialog;
+    mPrepInstDialog = NULL;
+
+    if (mWaitToHideDialog)
+    {
+        delete mWaitToHideDialog;
+        mWaitToHideDialog = NULL;
+    }
 }
 
 CJavaSifPlugin::CJavaSifPlugin()
@@ -139,6 +160,7 @@
     mResultsServer = NULL;
     mDummyResults = COpaqueNamedParams::NewL(); // codescanner::forgottoputptroncleanupstack
     mDummyInfo = CComponentInfo::NewL();
+    mWaitToHideDialog = NULL;
 }
 
 void CJavaSifPlugin::GetComponentInfo(
@@ -277,7 +299,16 @@
 
     // Do NOT close rJavaInstaller now -> the caller gets notification when the
     // process actually closes.
-    mHandlesToClose.Append(rJavaInstaller);
+    err = mHandlesToClose.Append(rJavaInstaller);
+    if ( err )
+    {
+        rJavaInstaller.Close();
+        ELOG1(EJavaInstaller, "CJavaSifPlugin::GetComponentInfo  mHandles"
+              "ToClose.Append failed with error %d", err);
+        TRequestStatus *statusPtr(&aStatus);
+        User::RequestComplete(statusPtr, err);
+        return;
+    }
 }
 
 void CJavaSifPlugin::Install(
@@ -352,6 +383,17 @@
 
         commandLine.Append(KSilent);
     }
+    else
+    {
+        // Uncomment this to enable 'preparing installation' dialog.
+        //TRAP(err, CreatePrepInstDialogL());
+        //if (KErrNone != err)
+        //{
+        //    WLOG1(EJavaInstaller,
+        //          "CJavaSifPlugin::Install Creating preparing installation dialog failed, err=%d",
+        //          err);
+        //}
+    }
 
     BuildInstallCommandLine(commandLine, aArguments);
 
@@ -440,11 +482,41 @@
         return;
     }
 
+    if (!silentInstall)
+    {
+        TRAP(err, mWaitToHideDialog =
+             CAsyncWaitCallBack::NewL(TCallBack(HidePrepInstDialog, this)));
+        if (KErrNone == err)
+        {
+            // The active object will wait until JavaInstaller process calls Rendezvous.
+            // If JavaInstaller specifies reason code EJavaInstaller, then
+            // the active object will call callback function that will hide the
+            // 'Preparing installation' dialog. If reason code is not EJavaInstaller,
+            // the wait object will automatically wait for the next rendezvous.
+            mWaitToHideDialog->Wait( rJavaInstaller, EJavaInstaller );
+        }
+        else
+        {
+            ELOG1(EJavaInstaller, "CJavaSifPlugin::Install: Creating "
+                  "mWaitToHideDialog failed, err %d", err);
+        }
+    }
     rJavaInstaller.Resume();
 
     // Do NOT close rJavaInstaller now -> the caller gets notification when the
     // process actually closes.
-    mHandlesToClose.Append(rJavaInstaller);
+    err = mHandlesToClose.Append(rJavaInstaller);
+    if ( err )
+    {
+        rJavaInstaller.Close();
+        ELOG1(EJavaInstaller, "CJavaSifPlugin::Install  mHandles"
+              "ToClose.Append failed with error %d", err);
+        TRAP_IGNORE(aResults.AddIntL(KSifOutParam_ErrCategory, ELowMemory));
+        TRequestStatus *statusPtr(&aStatus);
+        User::RequestComplete(statusPtr, err);
+        return;
+    }
+
 }
 
 void CJavaSifPlugin::Uninstall(
@@ -539,7 +611,17 @@
 
     // Do NOT close rJavaInstaller now -> the caller gets notification when the
     // process actually closes.
-    mHandlesToClose.Append(rJavaInstaller);
+    err = mHandlesToClose.Append(rJavaInstaller);
+    if ( err )
+    {
+        rJavaInstaller.Close();
+        ELOG1(EJavaInstaller, "CJavaSifPlugin::Uninstall  mHandles"
+              "ToClose.Append failed with error %d", err);
+        TRAP_IGNORE(aResults.AddIntL(KSifOutParam_ErrCategory, ELowMemory));
+        TRequestStatus *statusPtr(&aStatus);
+        User::RequestComplete(statusPtr, err);
+        return;
+    }
 }
 
 void CJavaSifPlugin::Activate(
@@ -659,18 +741,36 @@
         // to Java Installer tmp dir.)
         TParse fp;
         mRFs.Parse(aFileName, fp);
-
-        CFileMan* fm = CFileMan::NewL(mRFs);
         TFileName filesToCopy = fp.DriveAndPath();
         filesToCopy.Append(fp.Name());
         filesToCopy.Append(KAnyExtension);
-        TInt err = fm->Copy(filesToCopy, KJavaInstallerTmp, CFileMan::ERecurse);
-        delete fm;
-        if (KErrNone != err)
+
+        // Use JavaInstallCopier.exe to copy the files.
+        RProcess rJavaInstallCopier;
+        TInt err = rJavaInstallCopier.Create(
+            KJavaInstallCopierProcess, filesToCopy);
+        if (KErrNone == err)
         {
+            TRequestStatus status;
+            rJavaInstallCopier.Logon(status);
+            rJavaInstallCopier.Resume();
+            User::WaitForRequest(status); // codescanner::userWaitForRequest
+            err = rJavaInstallCopier.ExitReason();
+            rJavaInstallCopier.Close();
+            if (KErrNone != err)
+            {
+                ELOG1(EJavaInstaller,
+                      "CJavaSifPlugin::CopyFilesIfNeededL: copying files "
+                      "to JavaInstaller data cage failed, err=%d", err);
+                User::Leave(err);
+            }
+        }
+        else
+        {
+            rJavaInstallCopier.Close();
             ELOG1(EJavaInstaller,
-                  "CJavaSifPlugin::CopyFilesIfNeededL: copying files "
-                  "to Java Installer data cage failed, err=%d", err);
+                  "CJavaSifPlugin::CopyFilesIfNeededL: starting "
+                  "JavaInstallCopier failed, err=%d", err);
             User::Leave(err);
         }
 
@@ -803,13 +903,8 @@
     }
     // AskUser is not supported
 
-
-
-    // TODO: activate this code block when KSifInParam_UpgradeData has been
-    // defined in sifcommon.h
-/*
-    // KSifInParam_UpgradeData Yes/No/AskUser -> -upgrade_data=yes|no
-    intValue = GetPositiveIntParam(KSifInParam_UpgradeData, aArguments);
+    // KSifInParam_AllowUpgradeData Yes/No/AskUser -> -upgrade_data=yes|no
+    intValue = GetPositiveIntParam(KSifInParam_AllowUpgradeData, aArguments);
     if (intValue == 0) // Yes
     {
         aCommandLine.Append(KUpgradeData);
@@ -821,7 +916,6 @@
         aCommandLine.Append(KNo);
     }
     // AskUser is not supported
-*/
 
     // KSifInParam_AllowUntrusted Yes/No/AskUser -> -untrusted=yes|no
     intValue = GetPositiveIntParam(KSifInParam_AllowUntrusted, aArguments);
@@ -1101,5 +1195,34 @@
     return EFalse;
 }
 
+/**
+ * Creates 'preparing installation' dialog.
+ */
+void CJavaSifPlugin::CreatePrepInstDialogL()
+{
+    ILOG(EJavaInstaller, "CJavaSifPlugin::CreatePrepInstDialogL creating dialog");
+    mPrepInstDialog = CHbDeviceNotificationDialogSymbian::NewL();
+    _LIT(KPrepInstText, "Preparing installation...");
+    mPrepInstDialog->SetTitleL(KPrepInstText);
+    mPrepInstDialog->SetTimeout(20*1000); // ms
+    mPrepInstDialog->ShowL();
+    ILOG(EJavaInstaller, "CJavaSifPlugin::CreatePrepInstDialogL dialog created");
+}
+
+void CJavaSifPlugin::HidePrepInstDialogL()
+{
+    ILOG(EJavaInstaller, "CJavaSifPlugin::HidePrepInstDialogL hiding dialog");
+    // Stop further timed calls
+    if (mWaitToHideDialog)
+    {
+        mWaitToHideDialog->Cancel();
+    }
+    // Close wait dialog.
+    if (mPrepInstDialog)
+    {
+        mPrepInstDialog->Close();
+    }
+    ILOG(EJavaInstaller, "CJavaSifPlugin::HidePrepInstDialogL dialog hidden");
+}
 
 //  End of File
--- a/javamanager/javainstaller/javasifplugin/tsrc/src.s60/main.cpp	Tue Jul 06 14:10:26 2010 +0300
+++ b/javamanager/javainstaller/javasifplugin/tsrc/src.s60/main.cpp	Wed Aug 18 09:43:15 2010 +0300
@@ -591,7 +591,13 @@
     // TEMP TEST
     // This thread does not have active scheduler,
     // create and install it
-    CActiveScheduler* as = new(ELeave) CActiveScheduler();   
+    CActiveScheduler* as = new CActiveScheduler();
+    if (NULL == as)
+    {
+        ELOG(EJavaConverters,
+            "testsifapi: cancelFunction: Cannot create active scheduler");
+            return 1;
+    }
     CActiveScheduler::Install(as);
 
     // Wait for 6 seconds so that the operation to be cancelled
--- a/javamanager/javainstaller/subsystem.mk	Tue Jul 06 14:10:26 2010 +0300
+++ b/javamanager/javainstaller/subsystem.mk	Wed Aug 18 09:43:15 2010 +0300
@@ -23,9 +23,14 @@
 ifdef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK
     NONQTSUBSYSTEMS = javasifplugin/build
     SYMBIAN_ONLY = javasifplugin/build
+    COMPONENTS += installcopier/build
 else
     NONQTSUBSYSTEMS = appinstuiplugin/build
     SYMBIAN_ONLY = appinstuiplugin/build
+ifndef RD_JAVA_S60_RELEASE_5_0_IAD
+    NONQTSUBSYSTEMS += iconsizenotifplugin/build
+    SYMBIAN_ONLY += iconsizenotifplugin/build
+endif
 endif
 
 LINUX_ONLY =
--- a/javamanager/javamanager.pro	Tue Jul 06 14:10:26 2010 +0300
+++ b/javamanager/javamanager.pro	Wed Aug 18 09:43:15 2010 +0300
@@ -18,11 +18,13 @@
 SUBDIRS += debugapi/build/debugapi.pro 
 SUBDIRS += javalauncher/build/javalauncher.pro 
 SUBDIRS += javaupgradeapp/build/javaupgradeapp.pro 
+SUBDIRS += javaappscheme/build/javaappscheme.pro 
+SUBDIRS += javaqtrequest/build/javaqtrequest.pro 
+SUBDIRS += javasettings_qt/build/javaapplicationsettingsview.pro 
 SUBDIRS += javacaptain 
 SUBDIRS += javainstaller 
 SUBDIRS += javaregistry 
 SUBDIRS += javabackup 
 SUBDIRS += javasettings 
 BLD_INF_RULES.prj_extensions += "$${LITERAL_HASH}include \"javarecognizer/build/bld.inf\""  
-BLD_INF_RULES.prj_extensions += "$${LITERAL_HASH}include \"javaappschemeplugin/build/bld.inf\""  
 BLD_INF_RULES.prj_extensions += "prj_extensions" 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javamanager/javaqtrequest/build/javaqtrequest.pro	Wed Aug 18 09:43:15 2010 +0300
@@ -0,0 +1,31 @@
+#
+# Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+#
+# Contributors:
+#
+# Description: QT Service application the makes Qt Highway API
+#              request based on the command line of the application
+#
+
+TEMPLATE=app
+TARGET=javaqtrequest
+CONFIG += omj no_icon stl
+CONFIG -= gui
+
+symbian {
+    TARGET.UID3       = 0x20031D30
+    TARGET.CAPABILITY = CAP_APPLICATION
+    LIBS += -lxqservice -lxqserviceutil
+}
+
+HEADERS=../src.s60/requestapp.h
+
+include(../../../build/omj.pri)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javamanager/javaqtrequest/src.s60/main.cpp	Wed Aug 18 09:43:15 2010 +0300
@@ -0,0 +1,43 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  QT Service application the makes Qt Highway API
+*               request based on the command line of the application
+*
+*/
+
+#include <QTimer>
+
+#include "logger.h"
+#include "requestapp.h"
+
+
+int main(int argc, char **argv)
+{
+    LOG1(EJavaQtServiceApp, EInfo, "javaqtrequest main() called with %d args", argc);
+    for (int nInd = 0; nInd < argc; nInd++)
+    {
+        LOG2(EJavaQtServiceApp, EInfo, "javaqtrequest main() arg %d is %s", nInd, *(argv + nInd));
+    }
+
+    RequestApp app(argc, argv);
+
+    QTimer::singleShot(0, &app, SLOT(sendRequest()));
+
+    int ret = app.exec();
+
+    LOG1(EJavaQtServiceApp, EInfo, "javaqtrequest main() exiting with value %d", ret);
+
+    return ret;
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javamanager/javaqtrequest/src.s60/requestapp.cpp	Wed Aug 18 09:43:15 2010 +0300
@@ -0,0 +1,78 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  QT Service application the implements support for
+*               starting Java applications using "javaapp:" QUrl
+*
+*/
+
+#include <QList>
+#include <QUrl>
+#include <xqappmgr.h>
+#include <xqaiwrequest.h>
+
+#include "logger.h"
+#include "requestapp.h"
+
+
+RequestApp::RequestApp(int &argc, char **argv) : QApplication(argc, argv)
+{
+    LOG(EJavaQtServiceApp, EInfo, "RequestApp (QApplication) constructor called");
+}
+
+void RequestApp::sendRequest()
+{
+    QString uriString = arguments().at(1);
+    std::wstring stdWStrUri = uriString.toStdWString();
+    LOG1(EJavaQtServiceApp, EInfo,
+        "SLOT RequestApp::sendRequest called with Uri %S", stdWStrUri.c_str());
+
+    QUrl uri(uriString);
+    XQApplicationManager appMgr;
+    XQAiwRequest *request = appMgr.create(uri);
+    if (!request)
+    {
+        // No handlers for the URI
+        ELOG1(EJavaQtServiceApp,
+            "RequestApp::sendRequest No QtHighway service found for URI: %S",
+            stdWStrUri.c_str());
+        exit(KErrNotFound);
+        return;
+    }
+
+    // Set function parameters
+    QList<QVariant> args;
+    args << uri.toString();
+    request->setArguments(args);
+
+    // Send the request
+    if  (!request->send())
+    {
+        // Request failed.
+        int error = request->lastError();
+        ELOG2(EJavaQtServiceApp,
+            "RequestApp::sendRequest QtHighway request failed "
+            "with err %d, URI was %S",
+            error, stdWStrUri.c_str());
+        delete request;
+        exit(KErrCompletion);
+        return;
+    }
+
+    delete request;
+
+    exit(KErrNone); // Exit with OK status
+}
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javamanager/javaqtrequest/src.s60/requestapp.h	Wed Aug 18 09:43:15 2010 +0300
@@ -0,0 +1,36 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  QT Service application the makes Qt Highway API
+*               request based on the command line of the application
+*
+*/
+
+#ifndef REQUESTAPP_H
+#define REQUESTAPP_H
+
+#include <QApplication>
+
+class RequestApp : public QApplication
+{
+    Q_OBJECT
+
+public:
+    RequestApp(int &argc, char **argv);
+
+public slots:
+    void sendRequest();
+};
+
+
+#endif  // REQUESTAPP_H
--- a/javamanager/javarecognizer/src/recjar.cpp	Tue Jul 06 14:10:26 2010 +0300
+++ b/javamanager/javarecognizer/src/recjar.cpp	Wed Aug 18 09:43:15 2010 +0300
@@ -100,7 +100,7 @@
                     weOwnFileHandle = ETrue;
                 }
 
-                TInt fileRemaining;
+                TInt fileRemaining = 0;
                 User::LeaveIfError(file->Size(fileRemaining));
                 if (fileRemaining > aBuffer.Length())
                 {
--- a/javamanager/javaregistry/client/src/writeablejavaregistry.cpp	Tue Jul 06 14:10:26 2010 +0300
+++ b/javamanager/javaregistry/client/src/writeablejavaregistry.cpp	Wed Aug 18 09:43:15 2010 +0300
@@ -363,9 +363,17 @@
 
                 if (KErrNotFound == err)
                 {
+                    // reset the error flag
+                    err = KErrNone;
                     if (IsPresent((*iter)))
                     {
-                        aUids.Append(uid);
+                        err = aUids.Append(uid);
+                    }
+                    if (err)
+                    {
+                        ELOG1(EJavaStorage, "Failed to add Uid to container. "
+                              "( error code = %d )", err);
+
                     }
                 }
             }
--- a/javamanager/javaregistry/client/src/writeablejavaregistryentry.cpp	Tue Jul 06 14:10:26 2010 +0300
+++ b/javamanager/javaregistry/client/src/writeablejavaregistryentry.cpp	Wed Aug 18 09:43:15 2010 +0300
@@ -379,7 +379,7 @@
                 regAttr = CJavaAttribute::NewL(
                               nameBuf->Des(), valueBuf->Des(), trusted);
 
-                iAttributes.Append(regAttr);
+                iAttributes.AppendL(regAttr);
 
                 nameBuf.reset(0);
                 valueBuf.reset(0);
--- a/javamanager/javaregistry/legacy/server/src/javaregstore.cpp	Tue Jul 06 14:10:26 2010 +0300
+++ b/javamanager/javaregistry/legacy/server/src/javaregstore.cpp	Wed Aug 18 09:43:15 2010 +0300
@@ -543,7 +543,7 @@
                 {
                     if (IsPresentL((*iter)))
                     {
-                        aUids.Append(uid);
+                        aUids.AppendL(uid);
                     }
                 }
             }
@@ -765,7 +765,7 @@
                         TInt err = uidToTUid(appUid, converted);
                         if (KErrNone == err)
                         {
-                            uids.Append(converted);
+                            uids.AppendL(converted);
                         }
                         else
                         {
--- a/javamanager/javasettings/appsettingsview_qt/build/javaapplicationsettingsview.pro	Tue Jul 06 14:10:26 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,43 +0,0 @@
-#
-# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-# All rights reserved.
-# This component and the accompanying materials are made available
-# under the terms of "Eclipse Public License v1.0"
-# which accompanies this distribution, and is available
-# at the URL "http://www.eclipse.org/legal/epl-v10.html".
-#
-# Initial Contributors:
-# Nokia Corporation - initial contribution.
-#
-# Contributors:
-#
-# Description: 
-#
-TEMPLATE = lib
-TARGET = javaapplicationsettingsview
-CONFIG += qt hb stl plugin mobility
-MOBILITY += bearer
-LIBS += -ljavastorage -lcmapplsettingsui -ljavaconnectionmanager -ljavautils
-TRANSLATIONS = javaruntimeapplicationsettings.ts          
-
-INCLUDEPATH += ../inc ../../../../inc
-SOURCES += ..\src\javaapplicationsettingsview.cpp ..\src\javaapplicationsettingsview_p.cpp ..\src\javaapplicationsettings.cpp
-HEADERS += ..\src\javaapplicationsettingsview.h ..\src\javaapplicationsettingsview_p.h ..\src\javaapplicationsettings.h
-
-symbian : plugin {
-    TARGET.EPOCALLOWDLLDATA = 1
-    TARGET.CAPABILITY = ALL -TCB
-    PLUGIN_STUB_PATH = /resource/qt/plugins/appsettings
-    pluginstub.sources = $${TARGET}.dll
-    pluginstub.path = $$PLUGIN_STUB_PATH
-    DEPLOYMENT += pluginstub
-    qtplugins.path = $$PLUGIN_STUB_PATH
-    qtplugins.sources += qmakepluginstubs/$${TARGET}.qtplugin
-    for(qtplugin, qtplugins.sources):BLD_INF_RULES.prj_exports += "./$$qtplugin  z:$$qtplugins.path/$$basename(qtplugin)"    
-
-    include(../../../../build/symbian_uids.pri)
-    
-}
-
-# Workaround for RVCT 4.0 QT/Symbian incmpatibility
-MMP_RULES -= $$MMP_RULES_DONT_EXPORT_ALL_CLASS_IMPEDIMENTA
--- a/javamanager/javasettings/appsettingsview_qt/inc/applicationsettingsview.h	Tue Jul 06 14:10:26 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,51 +0,0 @@
-/*
-* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-#ifndef APPLICATIONSETTINGSVIEW_H
-#define APPLICATIONSETTINGSVIEW_H
-
-#include <hbview.h>
-#include <QtPlugin>
-
-class ApplicationSettingsView: public HbView
-{
-public:
-
-    /*
-     * Base constructor
-     */
-    explicit ApplicationSettingsView() : HbView() {}
-
-    /*
-     * Destructor
-     */
-    virtual ~ApplicationSettingsView() {}
-
-public slots:
-    /*
-     * Initializas the view with application specific info
-     *
-     * @param aAppUid Identifier for the application
-     *
-     */
-    void initialize(const QString& aAppUid);
-
-};
-
-Q_DECLARE_INTERFACE(ApplicationSettingsView,
-                    "com.nokia.ApplicationLibrary.ApplicationSettingsView/1.0");
-
-#endif // APPLICATIONSETTINGSVIEW_H
--- a/javamanager/javasettings/appsettingsview_qt/src/javaapplicationsettings.cpp	Tue Jul 06 14:10:26 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,212 +0,0 @@
-/*
-* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-#include "javaapplicationsettings.h"
-
-JavaApplicationSettings::JavaApplicationSettings():
-    iName(QString("")), 
-    iValues(QStringList()), 
-    iId(0), iCurrentValue(0), 
-    iColumnName(L""), 
-    iTableName(""), 
-    iStorageValuesFilter(L""), 
-    iValuesColumnName(L""), 
-    iFilterColumnName(L""), 
-    iFilterColumnValue(L""), 
-    connectedToUi(false)
-{
-}
-
-JavaApplicationSettings::JavaApplicationSettings(const QString& aName, const QStringList& aValues):
-        iName(aName), 
-        iValues(aValues),
-        iId(0), 
-        iCurrentValue(0), 
-        iColumnName(L""), 
-        iTableName(""), 
-        iStorageValuesFilter(L""), 
-        iValuesColumnName(L""), 
-        iFilterColumnName(L""), 
-        iFilterColumnValue(L""), 
-        connectedToUi(false)
-{
-}
-
-JavaApplicationSettings::JavaApplicationSettings(const QString& aName, const QStringList& aValues, const std::wstring& aColumnName, const std::string& aTableName, const std::vector<std::wstring>& aStorageValues):
-        iName(aName), 
-        iValues(aValues), 
-        iId(0), 
-        iCurrentValue(0), 
-        iColumnName(aColumnName), 
-        iTableName(aTableName), 
-        iStorageValues(aStorageValues), 
-        iStorageValuesFilter(L""), 
-        iValuesColumnName(L""), 
-        iFilterColumnName(L""), 
-        iFilterColumnValue(L""), 
-        connectedToUi(false)
-{
-}
-
-JavaApplicationSettings::JavaApplicationSettings(const QString& aName, const QStringList& aValues, const std::wstring& aColumnName, const std::string& aTableName, const std::vector<std::wstring>& aStorageValues, const std::wstring& aFilterColumnName, const std::wstring& aFilterColumnValue,  const std::wstring& aValuesColumnName):
-        iName(aName), 
-        iValues(aValues), 
-        iId(0), 
-        iCurrentValue(0), 
-        iColumnName(aColumnName), 
-        iTableName(aTableName), 
-        iStorageValues(aStorageValues), 
-        iStorageValuesFilter(L""), 
-        iValuesColumnName(aValuesColumnName), 
-        iFilterColumnName(aFilterColumnName), 
-        iFilterColumnValue(aFilterColumnValue), 
-        connectedToUi(false)
-{
-}
-
-void JavaApplicationSettings::setCurrentValue(int aCurrentValue)
-{
-    iCurrentValue = aCurrentValue;
-}
-
-void JavaApplicationSettings::connectToUi()
-{
-    connectedToUi = true;
-}
-
-void JavaApplicationSettings::disconnectFromUi()
-{
-    connectedToUi = false;
-}
-
-bool JavaApplicationSettings::isConnectedToUi()
-{
-    return connectedToUi;
-}
-
-int JavaApplicationSettings::getCurrentValue()
-{
-    return iCurrentValue;
-}
-
-const QString& JavaApplicationSettings::getValue(int aValueIndex)
-{
-    static const QString null;
-    if (aValueIndex >= 0 && aValueIndex < iValues.size())
-        return iValues[aValueIndex];
-    return null;
-}
-
-void JavaApplicationSettings::removeValue(int aValueIndex)
-{
-    if (aValueIndex >= 0 && aValueIndex < iStorageValues.size())
-        iStorageValues.erase(iStorageValues.begin() + aValueIndex);
-    if (aValueIndex >= 0 && aValueIndex < iValues.size())
-        iValues.erase(iValues.begin() + aValueIndex);
-}
-
-int JavaApplicationSettings::getValue(const QString& aValue)
-{
-    int value = -1;
-    for (int i = 0; i < iValues.size(); i++)
-    {
-        if (iValues[i] == aValue)
-        {
-            return i;
-        }
-    }
-    return value;
-}
-
-void JavaApplicationSettings::setId(HbDataFormModelItem * aId)
-{
-    iId = aId;
-}
-
-HbDataFormModelItem * JavaApplicationSettings::getId()
-{
-    return iId;
-}
-
-const QString& JavaApplicationSettings::getName() const
-{
-    return iName;
-}
-
-const QStringList& JavaApplicationSettings::getValues() const
-{
-    return iValues;
-}
-
-const QList<JavaApplicationSettings*>& JavaApplicationSettings::getHighRiskList() const
-{
-    return iHighRiskList;
-}
-
-void JavaApplicationSettings::setHighRiskList(const QList<JavaApplicationSettings*>& aHighRiskList)
-{
-    iHighRiskList = aHighRiskList;
-}
-
-const QList<JavaApplicationSettings*>& JavaApplicationSettings::getMutuallyExclusiveList() const
-{
-    return iMutuallyExclusiveList;
-}
-
-void JavaApplicationSettings::setMutuallyExclusiveList(const QList<JavaApplicationSettings*>& aMutuallyExclusiveList)
-{
-    iMutuallyExclusiveList = aMutuallyExclusiveList;
-}
-
-const std::wstring& JavaApplicationSettings::getColumnName()
-{
-    return iColumnName;
-}
-
-const std::wstring& JavaApplicationSettings::getValuesColumnName()
-{
-    return iValuesColumnName;
-}
-    
-const std::string& JavaApplicationSettings::getTableName()
-{
-    return iTableName;
-}
-
-const std::vector<std::wstring>& JavaApplicationSettings::getStorageValues()
-{
-    return iStorageValues;
-}
-
-void JavaApplicationSettings::setStorageValuesFilter(const std::wstring& aStorageValuesFilter)
-{
-    iStorageValuesFilter = aStorageValuesFilter;
-}
-
-const std::wstring& JavaApplicationSettings::getStorageValuesFilter()
-{
-    return iStorageValuesFilter;
-}
-
-const std::wstring& JavaApplicationSettings::getFilterColumnName()
-{
-    return iFilterColumnName;
-}
-
-const std::wstring& JavaApplicationSettings::getFilterColumnValue()
-{
-    return iFilterColumnValue;
-}
--- a/javamanager/javasettings/appsettingsview_qt/src/javaapplicationsettings.h	Tue Jul 06 14:10:26 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,97 +0,0 @@
-/*
-* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-#ifndef JAVAAPPLICATIONSETTINGS_H
-#define JAVAAPPLICATIONSETTINGS_H
-
-#include <string>
-#include <vector>
-#include <QString>
-#include <QStringList>
-#include <hbdataformmodelitem.h>
-#include <cmapplsettingsui.h>
-
-class JavaApplicationSettings
-{
-public:
-    
-    struct NetworkConnection
-        {
-        QString name;
-        uint id;
-        CmApplSettingsUi::SelectionType type;
-        };
-        
-    JavaApplicationSettings(const QString&,
-                            const QStringList&);
-    JavaApplicationSettings(const QString&,
-                            const QStringList&,
-                            const std::wstring&,
-                            const std::string&,
-                            const std::vector<std::wstring>&);
-    JavaApplicationSettings(const QString&,
-                            const QStringList&,
-                            const std::wstring&,
-                            const std::string&,
-                            const std::vector<std::wstring>&,
-                            const std::wstring&,
-                            const std::wstring&,
-                            const std::wstring&);
-    JavaApplicationSettings();
-
-    const QString& getName() const;
-    const QStringList& getValues() const;
-    void setCurrentValue(int);
-    int getCurrentValue();
-    const QString& getValue(int);
-    int getValue(const QString&);
-    void removeValue(int);
-    void setId(HbDataFormModelItem *);
-    HbDataFormModelItem * getId();
-    const QList<JavaApplicationSettings*>& getHighRiskList() const;
-    void setHighRiskList(const QList<JavaApplicationSettings*>&);
-    const QList<JavaApplicationSettings*>& getMutuallyExclusiveList() const;
-    void setMutuallyExclusiveList(const QList<JavaApplicationSettings*>&);
-    const std::wstring& getColumnName();
-    const std::string& getTableName();
-    const std::wstring& getValuesColumnName();
-    const std::wstring& getFilterColumnName();
-    const std::wstring& getFilterColumnValue();
-    const std::vector<std::wstring>& getStorageValues();
-    void setStorageValuesFilter(const std::wstring&);
-    const std::wstring& getStorageValuesFilter();
-    void connectToUi();
-    void disconnectFromUi();
-    bool isConnectedToUi();
-        
-private:
-    QString iName;
-    QStringList iValues;
-    HbDataFormModelItem * iId;
-    QList<JavaApplicationSettings*> iHighRiskList;
-    QList<JavaApplicationSettings*> iMutuallyExclusiveList;
-    int iCurrentValue;
-    std::wstring iColumnName;
-    std::string iTableName;
-    std::vector<std::wstring> iStorageValues;
-    std::wstring iStorageValuesFilter;
-    std::wstring iValuesColumnName;
-    std::wstring iFilterColumnName;
-    std::wstring iFilterColumnValue;
-    bool connectedToUi;
-};
-
-#endif // JAVAAPPLICATIONSETTINGS_H
--- a/javamanager/javasettings/appsettingsview_qt/src/javaapplicationsettingsview.cpp	Tue Jul 06 14:10:26 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,36 +0,0 @@
-/*
-* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-#include "javaapplicationsettingsview.h"
-#include "javaapplicationsettingsview_p.h"
-
-JavaApplicationSettingsView::JavaApplicationSettingsView() :
-        ApplicationSettingsView()
-{
-}
-
-void JavaApplicationSettingsView::initialize(const QString& aApplication)
-{
-    d_ptr = new JavaApplicationSettingsViewPrivate(aApplication);
-    d_ptr->init(this);
-}
-
-JavaApplicationSettingsView::~JavaApplicationSettingsView()
-{
-    delete d_ptr;
-}
-
-Q_EXPORT_PLUGIN2(javaapplicationsettingsview, JavaApplicationSettingsView);
--- a/javamanager/javasettings/appsettingsview_qt/src/javaapplicationsettingsview.h	Tue Jul 06 14:10:26 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,51 +0,0 @@
-/*
-* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-#ifndef JAVAAPPLICATIONSETTINGSVIEW_H
-#define JAVAAPPLICATIONSETTINGSVIEW_H
-
-#include "applicationsettingsview.h"
-
-class JavaApplicationSettingsViewPrivate;
-
-class JavaApplicationSettingsView: public ApplicationSettingsView
-{
-    Q_OBJECT
-    Q_INTERFACES(ApplicationSettingsView)
-
-public:
-    explicit JavaApplicationSettingsView();
-    virtual ~JavaApplicationSettingsView();
-
-public slots:
-    void initialize(const QString&);
-
-signals:
-    void aboutToClose();
-
-private:
-    Q_DISABLE_COPY(JavaApplicationSettingsView)
-    Q_DECLARE_PRIVATE_D(d_ptr, JavaApplicationSettingsView)
-    Q_PRIVATE_SLOT(d_func(), void _q_settingsChanged(const QString &newValue))
-    Q_PRIVATE_SLOT(d_func(), void _q_settingsChanged(bool))
-    Q_PRIVATE_SLOT(d_func(), void _q_dataItemDisplayed(const QModelIndex))
-
-private:
-    JavaApplicationSettingsViewPrivate * d_ptr;
-};
-
-
-#endif // JAVAAPPLICATIONSETTINGSVIEW_H
--- a/javamanager/javasettings/appsettingsview_qt/src/javaapplicationsettingsview_p.cpp	Tue Jul 06 14:10:26 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1104 +0,0 @@
-/*
-* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-#include <hbmessagebox.h>
-#include <hbdataformviewitem.h>
-#include <hbcombobox.h>
-#include <hbpushbutton.h>
-#include <hbdataform.h>
-#include <hbdataformmodel.h>
-#include <hbdataformmodelitem.h>
-#include <hblabel.h>
-#include <hbaction.h>
-#include <QApplication>
-#include <QTranslator>
-#include <qnetworkconfigmanager.h>
-#include <qnetworkconfiguration.h>
-#include <algorithm>
-
-#include "javaapplicationsettings.h"
-#include "javaapplicationsettingsview.h"
-#include "javaapplicationsettingsview_p.h"
-#include "connectionmanager.h"
-#include "javacommonutils.h"
-
-#include "securitystoragedatadefs.h"
-#include "javastoragenames.h"
-
-QTM_USE_NAMESPACE
-
-using namespace java::storage;
-using namespace java::util;
-using namespace std;
-
-const wchar_t ON_SCREEN_KEYPAD_VALUE_NO[] = L"0";
-const wchar_t ON_SCREEN_KEYPAD_VALUE_GAMEACTIONS[] = L"1";
-const wchar_t ON_SCREEN_KEYPAD_VALUE_NAVIGATION[] = L"2";
-
-JavaApplicationSettingsViewPrivate::JavaApplicationSettingsViewPrivate(const QString& aJavaAppUid):
-        mainForm(0), model(0), generalSettingsGroup(0), securitySettingsGroup(0), netConnSettingsUi(0), asyncToSyncCallEventLoop(0), secWarningAccepted(false), defaultConnId(0)
-{
-    // init storage
-    iStorage.reset(JavaStorage::createInstance());
-    try
-    {
-        iStorage->open();
-    }
-    catch (JavaStorageException& aJse) {}
-    
-    QTranslator translator;
-    // load the correct translation of the localized strings for the cmmanager. 
-    // Load this one first since it contains the smallest amount of strings 
-    // (so it's ok to be searched last)
-    installTranslator("cmapplsettingsui");
-    installTranslator("cmmanager");
-    // load the correct translation of the localized strings for the java settings
-    // Current solution reads it from Z only (this does not work with IAD)
-    // -> check if translator can handle path without drive letter (e.g. the resource
-    // is loaded from the same drive where the DLL is loaded)
-    installTranslator("javaruntimeapplicationsettings");
-    // init strings
-    BLANKET = QString(hbTrId("txt_java_sett_setlabel_permission_val_blanket"));
-    SESSION = QString(hbTrId("txt_java_sett_setlabel_permission_val_session"));
-    ONESHOT = QString(hbTrId("txt_java_sett_setlabel_permission_val_oneshot"));
-    DENIED = QString(hbTrId("txt_java_sett_setlabel_permission_val_no"));
-    SECURITY_LEVEL = QString(hbTrId("txt_java_sett_setlabel_security_level"));
-    USER_DEFINED = QString(hbTrId("txt_java_sett_setlabel_security_level_val_user_defined"));
-    SENSITIVE_SETTINGS = QString(hbTrId("txt_java_sett_info_query_perm_sec"));
-    SENSITIVE_SETTINGS_NET_USAGE = QString(hbTrId("txt_java_sett_info_query_perm_net"));
-    MUTUALLY_EXCLUSIVE_SETTINGS = QString(hbTrId("txt_java_sett_info_query_perm_warn"));
-    OK = QString(hbTrId("txt_java_sett_button_settings_ok"));
-    CANCEL = QString(hbTrId("txt_java_sett_button_settings_cancel"));
-    SECURITY_WARNING_TITLE = QString(hbTrId("txt_java_sett_title_note_security_warn"));
-    NET_ACCESS = QString(hbTrId("txt_java_sett_setlabel_net_access"));
-    LOW_LEVEL_NET_ACCESS = QString(hbTrId("txt_java_sett_setlabel_low_level_net_access"));
-    NETWORK_CONNECTION = QString(hbTrId("txt_occ_title_network_connection"));
-    SETTINGS_TITLE = QString(hbTrId("txt_java_sett_title_settings"));
-    SETTINGS_NOT_AVAILABLE = QString(hbTrId("txt_java_sett_info_settings_not_available"));
-
-    // init the suite UID from the application UID
-    readSuiteUid(aJavaAppUid);
-    if (iSuiteUid.size() <= 0)
-    {
-        return;
-    }
-    
-    // init access point settings ui
-    netConnSettingsUi = new CmApplSettingsUi(this);
-    asyncToSyncCallEventLoop = new QEventLoop();
-    
-    // read all settings
-    readAllSettings();
-
-    // init form
-    mainForm = new HbDataForm();
-    mainForm->setHeading(QString::fromStdWString(readFromStorage(PACKAGE_NAME, L"", L"", APPLICATION_PACKAGE_TABLE)));
-    model = new HbDataFormModel();
-
-    // init settings
-    generalSettingsGroup = model->appendDataFormGroup(
-        QString(hbTrId("txt_java_sett_subtitle_general")), model->invisibleRootItem());
-    initSettings(generalSettings, generalSettingsGroup);
-    // append the security settings only if there are any user settings
-    if (extraSettings.size() > 0)
-    {
-        securitySettingsGroup = model->appendDataFormGroup(
-            QString(hbTrId("txt_java_sett_subtitle_security")), model->invisibleRootItem());
-        initSettings(securitySettings, securitySettingsGroup);
-
-        // if security warnings is user defined -> add the extra settings, expand
-        if (securitySettings[0].getCurrentValue() == 1)
-        {
-            securityWarningsChanged(USER_DEFINED);
-        }
-    }
-
-    // link form and model
-    mainForm->setModel(model);
-    mainForm->setExpanded(model->indexFromItem(generalSettingsGroup), true);
-    if (extraSettings.size() > 0)
-    {
-        mainForm->setExpanded(model->indexFromItem(securitySettingsGroup), (securitySettings[0].getCurrentValue() == 1));
-    }
-}
-
-void JavaApplicationSettingsViewPrivate::init(JavaApplicationSettingsView* aPublicView)
-{
-    iPublicView = aPublicView;
-
-    if (mainForm)
-    {        
-        // do the connect for the main form
-        iPublicView->connect(mainForm, SIGNAL(itemShown(const QModelIndex)),
-                             iPublicView, SLOT(_q_dataItemDisplayed(const QModelIndex)));
-    
-        // set the form as view's widget
-        iPublicView->setWidget(mainForm);
-    }
-    else
-    {
-        // no settings available
-        HbLabel* label = new HbLabel(SETTINGS_NOT_AVAILABLE, iPublicView);
-        label->setAlignment(Qt::AlignVCenter);
-    }        
-
-    // set title
-    iPublicView->setTitle(SETTINGS_TITLE);
-}
-
-JavaApplicationSettingsViewPrivate::~JavaApplicationSettingsViewPrivate()
-{
-    delete mainForm;
-    delete model;
-    delete netConnSettingsUi;
-    delete asyncToSyncCallEventLoop;
-    foreach (QTranslator *translator, translators) {
-        qApp->removeTranslator(translator);
-    }    
-    qDeleteAll(translators);
-    translators.clear();
-}
-
-void JavaApplicationSettingsViewPrivate::readAllSettings()
-{
-    // general settings
-    QStringList settingsValues;
-    vector<wstring> storageValues;
-    if (!findFromStorage(VALUE, NAME, L"Nokia-MIDlet-On-Screen-Keypad", APPLICATION_PACKAGE_ATTRIBUTES_TABLE))
-    {
-        // if the on screen keypad is predefined, it should not be changable by user
-        // -> right now it is not added to settings list. It should be changed so that
-        // the setting should not be editable by user
-        settingsValues<<QString(hbTrId("txt_java_sett_setlabel_osk_val_no"))<<QString(hbTrId("txt_java_sett_setlabel_osk_val_game"))<<QString(hbTrId("txt_java_sett_setlabel_osk_val_navigation"));
-        storageValues.push_back(ON_SCREEN_KEYPAD_VALUE_NO);
-        storageValues.push_back(ON_SCREEN_KEYPAD_VALUE_GAMEACTIONS);
-        storageValues.push_back(ON_SCREEN_KEYPAD_VALUE_NAVIGATION);
-        generalSettings.append(JavaApplicationSettings(QString(hbTrId("txt_java_sett_setlabel_osk")), settingsValues, ON_SCREEN_KEYPAD, MIDP_PACKAGE_TABLE, storageValues));
-        readFromStorage(generalSettings[0]);
-    }
-    settingsValues = QStringList();
-    initNetworkConnection();
-    settingsValues<<netConn.name;
-    generalSettings.append(JavaApplicationSettings(NETWORK_CONNECTION, settingsValues));
-    netSettIndex = generalSettings.size() - 1;
-
-    // security settings
-    settingsValues = QStringList();
-    storageValues.clear();
-    settingsValues<<QString(hbTrId("txt_java_sett_setlabel_security_level_val_default"))<<USER_DEFINED;
-    storageValues.push_back(SECURITY_WARNINGS_DEFAULT_MODE);
-    storageValues.push_back(SECURITY_WARNINGS_USER_DEFINED_MODE);
-    securitySettings.append(JavaApplicationSettings(SECURITY_LEVEL, settingsValues, SECURITY_WARNINGS, MIDP_PACKAGE_TABLE, storageValues));
-    readFromStorage(securitySettings[0]);
-
-    // extra settings
-    settingsValues = QStringList();
-    storageValues.clear();
-    settingsValues<<ONESHOT<<SESSION<<BLANKET<<DENIED;
-    storageValues.push_back(ONESHOT_INTERACTION_MODE);
-    storageValues.push_back(SESSION_INTERACTION_MODE);
-    storageValues.push_back(BLANKET_INTERACTION_MODE);
-    storageValues.push_back(DENIED_INTERACTION_MODE);
-    // init the known localized settings names
-    QHash<QString, QString> localizedSettingsNames;
-    localizedSettingsNames[QString::fromStdWString(NET_ACCESS_SETTINGS)] = NET_ACCESS; 
-    localizedSettingsNames[QString::fromStdWString(LOW_LEVEL_NET_ACCESS_SETTINGS)] = LOW_LEVEL_NET_ACCESS;
-    localizedSettingsNames[QString::fromStdWString(MESSAGING_SETTINGS)] = QString(hbTrId("txt_java_sett_setlabel_messaging"));
-    localizedSettingsNames[QString::fromStdWString(RESTRICTED_MESSAGING_SETTINGS)] = QString(hbTrId("txt_java_sett_setlabel_restricted_messaging"));
-    localizedSettingsNames[QString::fromStdWString(CALL_CONTROL_SETTINGS)] = QString(hbTrId("txt_java_sett_setlabel_call_control"));
-    localizedSettingsNames[QString::fromStdWString(LOCAL_CONNECTIVITY_SETTINGS)] = QString(hbTrId("txt_java_sett_setlabel_local_conn"));
-    localizedSettingsNames[QString::fromStdWString(MULTIMEDIA_RECORDING_SETTINGS)] = QString(hbTrId("txt_java_sett_setlabel_mm_record"));
-    localizedSettingsNames[QString::fromStdWString(WRITE_USER_DATA_ACCESS_SETTINGS)] = QString(hbTrId("txt_java_sett_setlabel_write_data"));
-    localizedSettingsNames[QString::fromStdWString(READ_USER_DATA_ACCESS_SETTINGS)] = QString(hbTrId("txt_java_sett_setlabel_read_data"));
-    localizedSettingsNames[QString::fromStdWString(LOCATION_SETTINGS)] = QString(hbTrId("txt_java_sett_setlabel_location"));
-    localizedSettingsNames[QString::fromStdWString(LANDMARK_SETTINGS)] = QString(hbTrId("txt_java_sett_setlabel_landmarks"));
-    localizedSettingsNames[QString::fromStdWString(AUTHENTICATION_SETTINGS)] = QString(hbTrId("txt_java_sett_setlabel_auth"));
-    localizedSettingsNames[QString::fromStdWString(SMART_CARD_COMMUNICATION_SETTINGS)] = QString(hbTrId("txt_java_sett_setlabel_smartcard"));
-    localizedSettingsNames[QString::fromStdWString(APPLICATION_AUTO_INVOCATION_SETTINGS)] = QString(hbTrId("txt_java_sett_setlabel_app_auto_invoc"));
-    localizedSettingsNames[QString::fromStdWString(BROADCAST_SETTINGS)] = QString(hbTrId("txt_java_sett_setlabel_broadcast"));
-    localizedSettingsNames[QString::fromStdWString(NFC_WRITE_ACCESS_SETTINGS)] = QString(hbTrId("txt_java_sett_setlabel_nfc_write_access"));
-    localizedSettingsNames[QString::fromStdWString(URL_START_SETTINGS)] = QString(hbTrId("txt_java_sett_setlabel_url_start"));
-    vector<IndexedSettingsName> allSecuritySettings = readFromStorage(FUNCTION_GROUP, MIDP_FUNC_GRP_SETTINGS_TABLE, MIDP_PERMISSIONS_TABLE);
-    // sort the security settings according to how they should be displayed
-    std::sort(allSecuritySettings.begin(), allSecuritySettings.end(), AscendingSort());
-    QHash<QString, int> settingsIndexes;
-    for(int i=0; i<allSecuritySettings.size(); i++)
-    {
-        QString rawSettingsName = QString::fromStdWString(allSecuritySettings[i].name);
-        QString localizedSettingsName = rawSettingsName;
-        if (localizedSettingsNames.contains(rawSettingsName))
-            localizedSettingsName = localizedSettingsNames.value(rawSettingsName);
-        extraSettings.append(JavaApplicationSettings(
-            localizedSettingsName, settingsValues, CURRENT_SETTING, 
-            MIDP_FUNC_GRP_SETTINGS_TABLE, storageValues, FUNCTION_GROUP, 
-            allSecuritySettings[i].name, ALLOWED_SETTINGS));
-        readFromStorage(extraSettings[i]);
-        settingsIndexes[rawSettingsName] = i;
-    }
-
-    // configure the high risk lists
-    QList<JavaApplicationSettings*> highRiskList;
-    QStringList highRiskSettingsNames;
-    highRiskSettingsNames
-        <<QString::fromStdWString(MULTIMEDIA_RECORDING_SETTINGS)
-        <<QString::fromStdWString(READ_USER_DATA_ACCESS_SETTINGS);
-    configureList(highRiskList, highRiskSettingsNames, settingsIndexes);
-    // net access with multimedia and read user data
-    attachList(QString::fromStdWString(NET_ACCESS_SETTINGS),highRiskList, settingsIndexes);
-    // low level net access with multimedia and read user data
-    attachList(QString::fromStdWString(LOW_LEVEL_NET_ACCESS_SETTINGS),highRiskList, settingsIndexes);
-    // messaging with multimedia and read user data
-    attachList(QString::fromStdWString(MESSAGING_SETTINGS),highRiskList, settingsIndexes);
-    // restricted messaging with multimedia and read user data
-    attachList(QString::fromStdWString(RESTRICTED_MESSAGING_SETTINGS),highRiskList, settingsIndexes);
-    // call control with multimedia and read user data
-    attachList(QString::fromStdWString(CALL_CONTROL_SETTINGS),highRiskList, settingsIndexes);
-    // local connectivity with multimedia and read user data
-    attachList(QString::fromStdWString(LOCAL_CONNECTIVITY_SETTINGS),highRiskList, settingsIndexes);
-    // multimedia with net access, low level net access, messaging,
-    // restricted messaging, call control and local connectivity
-    highRiskList.clear();
-    highRiskSettingsNames.clear();
-    highRiskSettingsNames
-        <<QString::fromStdWString(NET_ACCESS_SETTINGS)
-        <<QString::fromStdWString(LOW_LEVEL_NET_ACCESS_SETTINGS)
-        <<QString::fromStdWString(MESSAGING_SETTINGS)
-        <<QString::fromStdWString(RESTRICTED_MESSAGING_SETTINGS)
-        <<QString::fromStdWString(CALL_CONTROL_SETTINGS)
-        <<QString::fromStdWString(LOCAL_CONNECTIVITY_SETTINGS)
-        <<QString::fromStdWString(MULTIMEDIA_RECORDING_SETTINGS);
-    configureList(highRiskList, highRiskSettingsNames, settingsIndexes);
-    attachList(QString::fromStdWString(MULTIMEDIA_RECORDING_SETTINGS),highRiskList, settingsIndexes);
-    // read user data with net access, low level net access, messaging,
-    // restricted messaging, call control and local connectivity
-    attachList(QString::fromStdWString(READ_USER_DATA_ACCESS_SETTINGS),highRiskList, settingsIndexes);
-
-    // configure the mutually exclusive list
-    QList<JavaApplicationSettings*> mutuallyExclusiveList;
-    QStringList mutuallyExclusiveSettingsNames;
-    mutuallyExclusiveSettingsNames
-        <<QString::fromStdWString(APPLICATION_AUTO_INVOCATION_SETTINGS);
-    configureList(mutuallyExclusiveList, mutuallyExclusiveSettingsNames, settingsIndexes);
-    //net access with application auto invocation
-    attachList(QString::fromStdWString(NET_ACCESS_SETTINGS),mutuallyExclusiveList, settingsIndexes, false /* is high risk list */);
-    //low level net access with application auto invocation
-    attachList(QString::fromStdWString(LOW_LEVEL_NET_ACCESS_SETTINGS),mutuallyExclusiveList, settingsIndexes, false /* is high risk list */);
-    //application auto invocation with net access and low level net access
-    mutuallyExclusiveList.clear();
-    mutuallyExclusiveSettingsNames.clear();
-    mutuallyExclusiveSettingsNames
-        <<QString::fromStdWString(NET_ACCESS_SETTINGS)
-        <<QString::fromStdWString(LOW_LEVEL_NET_ACCESS_SETTINGS);
-    configureList(mutuallyExclusiveList, mutuallyExclusiveSettingsNames, settingsIndexes);
-    attachList(QString::fromStdWString(APPLICATION_AUTO_INVOCATION_SETTINGS),mutuallyExclusiveList, settingsIndexes, false /* is high risk list */);
-}
-
-void JavaApplicationSettingsViewPrivate::initSettings(QVector<JavaApplicationSettings>& settings, HbDataFormModelItem * parent)
-{
-    for (int i=0; i<settings.size(); i++)
-    {
-        HbDataFormModelItem * appSettings = NULL;
-        int currentValue = 0;  
-        switch(settings[i].getValues().size())
-        {
-            case 1:
-                appSettings  = model->appendDataFormItem(
-                        HbDataFormModelItem::ToggleValueItem,
-                        settings[i].getName(), parent);
-                appSettings->setContentWidgetData(QString("text"), settings[i].getValues()[0]);
-                appSettings->setContentWidgetData(QString("additionalText"), settings[i].getValues()[0]);
-                break;
-            case 2:
-                appSettings  = model->appendDataFormItem(
-                        HbDataFormModelItem::ToggleValueItem,
-                        settings[i].getName(), parent);
-                currentValue = settings[i].getCurrentValue();
-                if (currentValue < 0)
-                {
-                    currentValue = 0;
-                }
-                // make it a toogle button (-> get rid of the "pressed" ui effect)
-                appSettings->setContentWidgetData(QString("text"), settings[i].getValues()[currentValue]);
-                appSettings->setContentWidgetData(QString("additionalText"),settings[i].getValues()[1 - currentValue]);
-                break;
-            default:
-                appSettings  = model->appendDataFormItem(
-                        HbDataFormModelItem::ComboBoxItem,
-                        settings[i].getName(), parent);
-                appSettings->setContentWidgetData(QString("items"), settings[i].getValues());
-                appSettings->setContentWidgetData(QString("currentIndex"),settings[i].getCurrentValue());
-        }
-        settings[i].setId(appSettings);
-    }
-}
-
-void JavaApplicationSettingsViewPrivate::writeSettings(JavaApplicationSettings& settings, const QString &aNewValue)
-{
-    QStringList values = settings.getValues();
-    int currentValue = settings.getCurrentValue();
-    int newValue = settings.getValue(aNewValue);
-    if (newValue != -1 && currentValue != newValue)
-    {
-        // handle blanket settings
-        if (aNewValue == BLANKET)
-        {
-            // check blanket settings
-            if (!blanketAllowed(settings))
-            {
-                // change back to the old value
-                HbComboBox * settingsCombo = static_cast<HbComboBox*>(itemToWidget(settings.getId()));
-                settingsCombo->setCurrentIndex(currentValue);
-                return;
-            }
-        }
-        settings.setCurrentValue(newValue);
-        writeToStorage(settings);
-    }
-}
-
-bool JavaApplicationSettingsViewPrivate::blanketAllowed(const JavaApplicationSettings &settings)
-{
-    // handle the high risk items
-    QList<JavaApplicationSettings*> highRiskList = settings.getHighRiskList();
-    if (highRiskList.size() > 0)
-    {
-        // go through the list and see if any of the setings are in blanket
-        for (int i=0; i<highRiskList.size(); i++)
-        {
-            if (highRiskList[i]->getValue(highRiskList[i]->getCurrentValue())
-                    == BLANKET)
-            {
-                QString secWarning = SENSITIVE_SETTINGS;
-                QString LOCAL_CONNECTIVITY = QString(hbTrId("txt_java_sett_setlabel_local_conn"));
-                if (settings.getName() != LOCAL_CONNECTIVITY
-                    && highRiskList[i]->getName() != LOCAL_CONNECTIVITY)
-                {
-                    secWarning = SENSITIVE_SETTINGS_NET_USAGE;
-                }
-                if (!securityWarningAccepted(
-                    secWarning,OK,CANCEL ,SECURITY_WARNING_TITLE))
-                {
-                    return false;
-                }
-                break;
-            }
-        }
-    }
-    // handle the mutually exclusive rules
-    QList<JavaApplicationSettings*> mutuallyExclusiveList = settings
-            .getMutuallyExclusiveList();
-    if (mutuallyExclusiveList.size() > 0)
-    {
-        // go through the list and see if any of the setings are in blanket
-        for (int i=0; i<mutuallyExclusiveList.size(); i++)
-        {
-            if (mutuallyExclusiveList[i]->getValue(
-                        mutuallyExclusiveList[i]->getCurrentValue()) == BLANKET)
-            {
-                bool isBlanketAllowed = securityWarningAccepted(
-                    MUTUALLY_EXCLUSIVE_SETTINGS, OK, CANCEL, SECURITY_WARNING_TITLE);
-                if (isBlanketAllowed)
-                {
-                    // change  the current value to the maximum allowed
-                    bool isBlanket = true;
-                    do
-                    {
-                        if (isBlanket)
-                        {
-                            QStringList allowedValues = mutuallyExclusiveList[i]->getValues();
-                            int selectedValue = mutuallyExclusiveList[i]->getCurrentValue();
-                            // select the maximum allowed value
-                            for (int j=0; j<allowedValues.size(); j++)
-                            {
-                                if (allowedValues[j] == SESSION)
-                                {
-                                    selectedValue = j;
-                                    break;
-                                }
-                                if (allowedValues[j] == ONESHOT)
-                                {
-                                    selectedValue = j;
-                                }
-                                else if (allowedValues[j] == DENIED
-                                         && allowedValues[selectedValue] == BLANKET)
-                                {
-                                    selectedValue = j;
-                                }
-                            }
-                            // set the maximum allowed value
-                            mutuallyExclusiveList[i]->setCurrentValue(selectedValue);
-                            HbComboBox * settingsCombo = static_cast<HbComboBox*>(itemToWidget(
-                                                             mutuallyExclusiveList[i]->getId()));
-                            settingsCombo->setCurrentIndex(selectedValue);
-                            writeToStorage(*mutuallyExclusiveList[i]);
-                        }
-                        i++;
-                        // end of list?
-                        if (i >= mutuallyExclusiveList.size())
-                        {
-                            break;
-                        }
-                        // move on into the list
-                        isBlanket = (mutuallyExclusiveList[i]->getValue(
-                                         mutuallyExclusiveList[i]->getCurrentValue()) == BLANKET);
-                    }
-                    while (true);
-                }
-                return isBlanketAllowed;
-            }
-        }
-    }
-    return true;
-}
-
-void JavaApplicationSettingsViewPrivate::_q_settingsChanged(bool)
-{
-    HbPushButton * sender = static_cast<HbPushButton*>(iPublicView->sender());
-    if (sender)
-    {
-        JavaApplicationSettings* settings = findSettings(sender);
-        if (settings->getName() == SECURITY_LEVEL)
-        {
-            QString newValue = settings->getValue(1 - settings->getCurrentValue());
-            securityWarningsChanged(newValue);
-            writeSettings(*settings, newValue);
-        }
-        else if (settings->getName() == NETWORK_CONNECTION)
-        {
-            handleNetworkSettings();
-        }
-    }
-}
-void JavaApplicationSettingsViewPrivate::_q_settingsChanged(const QString &newValue)
-{
-    HbComboBox * sender = static_cast<HbComboBox*>(iPublicView->sender());
-    if (sender)
-    {
-        JavaApplicationSettings* settings = findSettings(sender);
-        if (settings != NULL)
-        {
-            // any other settings are treated same
-            writeSettings(*settings, newValue);
-        }
-    }
-}
-
-void JavaApplicationSettingsViewPrivate::securityWarningsChanged(const QString &newValue)
-{
-    if (newValue == USER_DEFINED)
-    {
-        // append the extra settings and values
-        for (int i=0; i<extraSettings.size(); i++)
-        {
-            if (extraSettings[i].getCurrentValue() >= 0 && extraSettings[i].getId() == 0)
-            {
-                HbDataFormModelItem * appSettings = model->appendDataFormItem(
-                                                        HbDataFormModelItem::ComboBoxItem,
-                                                        extraSettings[i].getName(), securitySettingsGroup);
-                extraSettings[i].setId(appSettings);
-                // when settings the items, the settingsChanged signal gets emitted with the first value 
-                // as being the current value. This signal should be discarded (the first value is just 
-                // an intermediate value towards the actual current value which gets set shortly). 
-                // Therefore set the first value as the current value (this way the settingsChanged 
-                // signal gets discarded) and change the current value back to the real current value
-                int currentValue = extraSettings[i].getCurrentValue();
-                extraSettings[i].setCurrentValue(0);
-                appSettings->setContentWidgetData(QString("items"), extraSettings[i].getValues());                
-                extraSettings[i].setCurrentValue(currentValue);
-                appSettings->setContentWidgetData(QString("currentIndex"),extraSettings[i].getCurrentValue());
-            }
-        }
-    }
-    else
-    {
-        // remove the extra settings
-        for (int i=0; i<extraSettings.size(); i++)
-        {
-            if (extraSettings[i].getId())
-            {
-                HbComboBox * extraSettingsId = static_cast<HbComboBox*>(itemToWidget(extraSettings[i].getId()));
-                if (extraSettingsId)
-                {
-                    iPublicView->disconnect(extraSettingsId, 0, 0, 0);
-                    model->removeItem(model->indexFromItem(extraSettings[i].getId()));
-                    extraSettings[i].setId(0);
-                    extraSettings[i].disconnectFromUi();
-                }
-            }
-        }
-    }
-}
-
-void JavaApplicationSettingsViewPrivate::handleNetworkSettings()
-{
-    // init flags to show destinations and connection methods
-    QFlags<CmApplSettingsUi::SelectionDialogItems> listItems;
-    listItems |= CmApplSettingsUi::ShowDestinations;
-    listItems |= CmApplSettingsUi::ShowConnectionMethods;
-        
-    // empty filter -> all bearer types included
-    QSet<CmApplSettingsUi::BearerTypeFilter> filter;
-    // reset the result
-    netConnSelection.result = netConn.type;       
-    netConnSelection.id = netConn.id;
-    // init settings ui with destinations, filter and initial selection
-    netConnSettingsUi->setOptions(listItems, filter);
-    netConnSettingsUi->setSelection(netConnSelection);
-    // Connect the setting ui's signal with own slot where the netConnSelection is stored
-    connect(netConnSettingsUi, SIGNAL(finished(uint)), this, SLOT(netConnSelected(uint)));
-    // launch the setting ui    
-    netConnSettingsUi->open();
-}
-
-void JavaApplicationSettingsViewPrivate::_q_dataItemDisplayed(const QModelIndex dataItemIndex)
-{
-    HbDataFormModelItem *item = static_cast<HbDataFormModel*>(
-                                    mainForm->model())->itemFromIndex(dataItemIndex);
-    int itemType = item->data(HbDataFormModelItem::ItemTypeRole).toInt();
-    HbComboBox * comboBox = NULL;
-    HbPushButton * pushButton = NULL;
-    HbWidget * widget = (qobject_cast<HbDataFormViewItem *> 
-        (mainForm->itemByIndex(dataItemIndex)))->dataItemContentWidget();
-    JavaApplicationSettings* settings = findSettings(widget);
-    if (settings == NULL)
-    {
-        // stop right here
-        return;
-    }
-    switch(HbDataFormModelItem::DataItemType(itemType))
-    {
-        case HbDataFormModelItem::ComboBoxItem:
-            comboBox = static_cast<HbComboBox*>(widget);
-            if (settings->isConnectedToUi())
-            {
-                // need to do a reconnect: disconnect followed by a connect
-                iPublicView->disconnect(comboBox, 
-                        SIGNAL(currentIndexChanged(const QString &)), 
-                        iPublicView, 
-                        SLOT(_q_settingsChanged(const QString &)));
-            }
-            iPublicView->connect(comboBox,
-                                 SIGNAL(currentIndexChanged(const QString &)),
-                                 iPublicView, SLOT(_q_settingsChanged(const QString &)),
-                                 Qt::UniqueConnection);
-            break;
-        case HbDataFormModelItem::ToggleValueItem:
-            pushButton = static_cast< HbPushButton*>(widget);
-            if (settings->isConnectedToUi())
-            {
-                // need to do a reconnect: disconnect followed by a connect
-                iPublicView->disconnect(pushButton, 
-                        SIGNAL(clicked(bool)),
-                        iPublicView, 
-                        SLOT(_q_settingsChanged(bool)));
-            }
-            iPublicView->connect(pushButton,
-                                 SIGNAL(clicked(bool)),
-                                 iPublicView, SLOT(_q_settingsChanged(bool)),
-                                 Qt::UniqueConnection);
-            break;
-    }
-    settings->connectToUi();
-}
-
-void JavaApplicationSettingsViewPrivate::netConnSelected(uint netConnSelectionStatus)
-{
-    if (netConnSelectionStatus == CmApplSettingsUi::ApplSettingsErrorNone) 
-    {    
-        netConnSelection = netConnSettingsUi->selection();
-        // store the selection
-        if (netConnSelection.id != netConn.id 
-            && netConnSelection.id != defaultConnId)
-        {
-            TRAPD(err, 
-                switch(netConnSelection.result)
-                {
-                    case CmApplSettingsUi::SelectionTypeDestination:
-                        ConnectionManager::setDestinationNetworkIdL(iSuiteUid, netConnSelection.id);
-                        break;
-                    case CmApplSettingsUi::SelectionTypeConnectionMethod:
-                        ConnectionManager::setApnIdL(iSuiteUid, netConnSelection.id);
-                        break;
-                }                
-            );
-            if (err == KErrNone)
-            {
-                netConn.id = netConnSelection.id;
-                netConn.type = netConnSelection.result;
-                readNetworkConnectionName();
-                generalSettings[netSettIndex].getId()->setContentWidgetData(QString("text"), netConn.name);
-                generalSettings[netSettIndex].getId()->setContentWidgetData(QString("additionalText"), netConn.name);
-            }
-        }
-    }
-}
-
-void JavaApplicationSettingsViewPrivate::securityWarningDismissed(HbAction* action)
-{
-    HbMessageBox *dlg = static_cast<HbMessageBox*>(sender());
-    secWarningAccepted = (action == dlg->actions().at(0));
-    asyncToSyncCallEventLoop->exit();
-}
-
-void JavaApplicationSettingsViewPrivate::initNetworkConnection()
-{
-    TRAP_IGNORE(
-        netConn.id = ConnectionManager::getDestinationNetworkIdL(iSuiteUid);
-        if (netConn.id == (uint)KJavaNetworkAccessNotSpecified)
-        {
-            netConn.id = ConnectionManager::getApnIdL(iSuiteUid);
-        }
-    );
-    QNetworkConfigurationManager manager;
-    QNetworkConfiguration defaultCfg = manager.defaultConfiguration();
-    defaultConnId = defaultCfg.identifier().toInt();
-    QNetworkConfiguration cfg = manager.configurationFromIdentifier(
-        QString::number(netConn.id));
-    if (!cfg.isValid())
-    {
-        cfg = defaultCfg;
-    }
-    netConn.name = QString(hbTrId(cfg.name().toUtf8()));
-}
-
-void JavaApplicationSettingsViewPrivate::readNetworkConnectionName()
-{
-    QNetworkConfigurationManager manager;
-    QNetworkConfiguration cfg = manager.configurationFromIdentifier(
-        QString::number(netConn.id));
-    if (!cfg.isValid())
-    {
-        cfg = manager.defaultConfiguration();
-    }
-    netConn.name = QString(hbTrId(cfg.name().toUtf8()));
-}
-
-JavaApplicationSettings* JavaApplicationSettingsViewPrivate::findSettings(HbWidget* id)
-{
-    JavaApplicationSettings* settings = findSettings(id, generalSettings);
-    if (settings == NULL)
-    {
-        settings = findSettings(id, securitySettings);
-        if (settings == NULL)
-        {
-            settings = findSettings(id, extraSettings);
-        }
-    }
-    return settings;
-}
-
-JavaApplicationSettings* JavaApplicationSettingsViewPrivate::findSettings(HbWidget* id, QVector<JavaApplicationSettings>& allSettings)
-{
-    for (int i=0; i<allSettings.size(); i++)
-    {
-        if (itemToWidget(allSettings[i].getId()) == id)
-        {
-            return &allSettings[i];
-        }
-    }
-    return NULL;
-}
-
-HbWidget * JavaApplicationSettingsViewPrivate::itemToWidget(const HbDataFormModelItem * item)
-{
-    HbDataFormViewItem * viewItem = qobject_cast<HbDataFormViewItem *> (mainForm->itemByIndex(
-                                        model->indexFromItem(item)));
-    if (viewItem)
-    {
-        return static_cast<HbWidget*>(viewItem->dataItemContentWidget());
-    }
-    return NULL;
-}
-
-bool JavaApplicationSettingsViewPrivate::securityWarningAccepted(const QString& text, const QString& acceptActionLabel, const QString& rejectActionLabel, const QString& headingText)
-{
-    HbMessageBox securityWarning(HbMessageBox::MessageTypeQuestion);
-    securityWarning.setDismissPolicy(HbDialog::NoDismiss);
-    securityWarning.setTimeout(HbDialog::NoTimeout);
-    securityWarning.setIconVisible(false);
-    securityWarning.setText(text);
-    securityWarning.addAction(new HbAction(
-            acceptActionLabel, &securityWarning));
-    securityWarning.addAction(new HbAction(
-            rejectActionLabel, &securityWarning));
-    securityWarning.setHeadingWidget(new HbLabel(headingText));
-    securityWarning.open(this, SLOT(securityWarningDismissed(HbAction*)));
-    asyncToSyncCallEventLoop->exec();
-    return secWarningAccepted;
-}
-
-void JavaApplicationSettingsViewPrivate::configureList(QList<JavaApplicationSettings*>& list, const QStringList& settingsNames,  const QHash<QString, int>& settingsIndexes)
-{
-    for(int i=0; i<settingsNames.size(); i++)
-    {
-        if (settingsIndexes.contains(settingsNames[i]))
-        {
-            list << &(extraSettings[settingsIndexes.value(settingsNames[i])]);
-        }
-    }
-}
-
-void JavaApplicationSettingsViewPrivate::attachList(const QString& settingsName, const QList<JavaApplicationSettings*>& list, const QHash<QString, int>& settingsIndexes, bool isHighRiskList)
-{
-    if (settingsIndexes.contains(settingsName))
-    {
-        if (isHighRiskList)
-        {
-            extraSettings[settingsIndexes.value(settingsName)].setHighRiskList(list);
-        }
-        else
-        {
-            extraSettings[settingsIndexes.value(settingsName)].setMutuallyExclusiveList(list);
-        }
-    }
-}
-
-void JavaApplicationSettingsViewPrivate::installTranslator(const QString& translationFileName)
-{
-    QTranslator* translator = new QTranslator;
-
-    // load the correct translation of the localized strings for the java settings
-    // Current solution reads it from Z only (this does not work with IAD)
-    // -> check if translator can handle path without drive letter (e.g. the resource
-    // is loaded from the same drive where the DLL is loaded)
-    if (translator->load("z:/resource/qt/translations/" 
-        + translationFileName + "_" + QLocale::system().name()))
-    {
-        translators.append(translator); 
-        qApp->installTranslator(translator);
-    } 
-    else 
-    {
-        delete translator; 
-        translator = NULL;
-    }
-}
-
-void JavaApplicationSettingsViewPrivate::readFromStorage(JavaApplicationSettings& settings)
-{
-    if (settings.getColumnName().size() > 0 
-            && settings.getTableName().size() > 0)
-    {
-        wstring value = L"";
-
-        JavaStorageApplicationEntry_t query;
-        JavaStorageApplicationList_t queryResult;
-        JavaStorageEntry attr;
-        attr.setEntry(ID, iSuiteUid);
-        query.insert(attr);
-        if (settings.getFilterColumnName().size() > 0)
-        {
-            attr.setEntry(settings.getFilterColumnName(), settings.getFilterColumnValue());
-            query.insert(attr);
-        }
-        attr.setEntry(settings.getColumnName(), L"");
-        query.insert(attr);
-        if (settings.getValuesColumnName().size() > 0)
-        {
-            attr.setEntry(settings.getValuesColumnName(), L"");
-            query.insert(attr);
-        }
-
-        try
-        {
-            iStorage->search(settings.getTableName(), query, queryResult);
-        }
-        catch (JavaStorageException& aJse)
-        {
-            // Don't leave. Set defaults.
-        }
-
-        if (settings.getValuesColumnName().size() > 0)
-        {
-            findEntry(queryResult, settings.getValuesColumnName(), value);
-            if (value.size() > 0)
-            {
-                settings.setStorageValuesFilter(value);
-                filterSecuritySettings(settings);
-            }
-        }
-        
-        value = L"";
-        findEntry(queryResult, settings.getColumnName(), value);
-
-        if (value.size() > 0)
-        {
-            vector<wstring> storageValues = settings.getStorageValues();
-            for (int i=0; i<storageValues.size(); i++)
-            {
-                if (storageValues[i] == value)
-                {
-                    settings.setCurrentValue(i);
-                    break;
-                }
-            }
-        }
-    }
-}
-
-void JavaApplicationSettingsViewPrivate::filterSecuritySettings(JavaApplicationSettings& settings)
-{
-    std::wstring allowedModes = settings.getStorageValuesFilter();
-    if (allowedModes.size() <= 0)
-    {
-            return;
-    }
-    // The allowed modes info is stored as a 4-bit constant:
-    //    X(oneshot)X(session)X(blanket)X(no)
-    // e.g. 1011 (=11) means that oneshot, blanket and no are allowed.
-    // The following constants are used to encode/decode the allowed modes
-    // into/from a 4-bit number
-    int INTERACTION_MODE_DENIED = 1;
-    int INTERACTION_MODE_BLANKET = 2;
-    int INTERACTION_MODE_SESSION = 4;
-    int INTERACTION_MODE_ONESHOT = 8;
-    TInt allowedInteractionModes = JavaCommonUtils::wstringToInt(allowedModes);
-    int index = 0;
-    int tmp = allowedInteractionModes & INTERACTION_MODE_ONESHOT;
-    if (tmp <= 0)
-    {
-        settings.removeValue(index); 
-        index--;
-    }
-    index++;
-    tmp = allowedInteractionModes & INTERACTION_MODE_SESSION;
-    if (tmp <= 0)
-    {
-        settings.removeValue(index); 
-        index--;
-    }
-    index++;
-    tmp = allowedInteractionModes & INTERACTION_MODE_BLANKET;
-    if (tmp <= 0)
-    {
-        settings.removeValue(index); 
-        index--;
-    }
-    index++;
-    tmp = allowedInteractionModes & INTERACTION_MODE_DENIED;
-    if (tmp <= 0)
-    {
-        settings.removeValue(index); 
-    }
-}
-
-void JavaApplicationSettingsViewPrivate::writeToStorage(JavaApplicationSettings& settings)
-{
-    if (settings.getTableName().size() <= 0 
-            || settings.getColumnName().size() <= 0)
-    {
-        // storage details are not provided -> no point in going further
-        return;
-    }
-    JavaStorageApplicationEntry_t oldEntry;
-    JavaStorageEntry attr;
-    attr.setEntry(ID, iSuiteUid);
-    oldEntry.insert(attr);
-    JavaStorageApplicationEntry_t entry;
-    if (settings.getFilterColumnName().size() > 0)
-    {
-        attr.setEntry(settings.getFilterColumnName(), settings.getFilterColumnValue());
-        oldEntry.insert(attr);
-    }
-    attr.setEntry(settings.getColumnName(), settings.getStorageValues()[settings.getCurrentValue()]);
-    entry.insert(attr);
-
-    try
-    {
-        iStorage->update(settings.getTableName(), entry, oldEntry);
-    }
-    catch (JavaStorageException& aJse)
-    {
-    }
-}
-
-void JavaApplicationSettingsViewPrivate::findEntry(const JavaStorageApplicationList_t& queryResult,
-        const std::wstring& eName,
-        std::wstring& eValue)
-{
-    if (queryResult.size() > 0)
-    {
-        JavaStorageApplicationEntry_t entry = queryResult.front();
-        JavaStorageEntry findPattern;
-        findPattern.setEntry(eName, L"");
-        JavaStorageApplicationEntry_t::const_iterator findIterator =
-            entry.find(findPattern);
-        if (findIterator != entry.end())
-        {
-            eValue = findIterator->entryValue();
-        }
-    }
-}
-
-bool JavaApplicationSettingsViewPrivate::findFromStorage(const std::wstring& aColumnName, const std::wstring& aColumnFilterName, const std::wstring& aColumnFilterValue, const std::string& aTableName)
-{
-    wstring value = readFromStorage(aColumnName, aColumnFilterName, aColumnFilterValue, aTableName);
-
-    return (value.size() > 0);
-}
-
-wstring JavaApplicationSettingsViewPrivate::readFromStorage(const std::wstring& aColumnName, const std::wstring& aColumnFilterName, const std::wstring& aColumnFilterValue, const std::string& aTableName)
-{
-    wstring value = L"";
-
-    JavaStorageApplicationEntry_t query;
-    JavaStorageApplicationList_t queryResult;
-    JavaStorageEntry attr;
-    attr.setEntry(ID, iSuiteUid);
-    query.insert(attr);
-    if (aColumnFilterName.size() > 0)
-    {
-        attr.setEntry(aColumnFilterName, aColumnFilterValue);
-        query.insert(attr);
-    }
-    attr.setEntry(aColumnName, L"");
-    query.insert(attr);
-
-    try
-    {
-        iStorage->search(aTableName, query, queryResult);
-    }
-    catch (JavaStorageException& aJse)
-    {
-        // Don't leave. Set defaults.
-    }
-
-    findEntry(queryResult, aColumnName, value);
-
-    return value;
-}
-
-vector<IndexedSettingsName> JavaApplicationSettingsViewPrivate::readFromStorage(const std::wstring& aColumnName, const std::string& aPrimaryTableName, const std::string& aSecondaryTableName)
-{
-    vector<IndexedSettingsName> values;
-    
-    // hash for associating settings names with display indexes: 
-    // a settings with lower index is shown before a settings 
-    // with a higher index
-    QHash<QString, int> settingsNamesIndexes;
-    settingsNamesIndexes[QString::fromStdWString(NET_ACCESS_SETTINGS)] = 0; 
-    settingsNamesIndexes[QString::fromStdWString(LOW_LEVEL_NET_ACCESS_SETTINGS)] = 1;
-    settingsNamesIndexes[QString::fromStdWString(MESSAGING_SETTINGS)] = 2;
-    settingsNamesIndexes[QString::fromStdWString(RESTRICTED_MESSAGING_SETTINGS)] = 3;
-    settingsNamesIndexes[QString::fromStdWString(CALL_CONTROL_SETTINGS)] = 4;
-    settingsNamesIndexes[QString::fromStdWString(LOCAL_CONNECTIVITY_SETTINGS)] = 5;
-    settingsNamesIndexes[QString::fromStdWString(MULTIMEDIA_RECORDING_SETTINGS)] = 6;
-    settingsNamesIndexes[QString::fromStdWString(WRITE_USER_DATA_ACCESS_SETTINGS)] = 7;
-    settingsNamesIndexes[QString::fromStdWString(READ_USER_DATA_ACCESS_SETTINGS)] = 8;
-    settingsNamesIndexes[QString::fromStdWString(LOCATION_SETTINGS)] = 9;
-    settingsNamesIndexes[QString::fromStdWString(LANDMARK_SETTINGS)] = 10;
-    settingsNamesIndexes[QString::fromStdWString(AUTHENTICATION_SETTINGS)] = 11;
-    settingsNamesIndexes[QString::fromStdWString(SMART_CARD_COMMUNICATION_SETTINGS)] = 12;
-    settingsNamesIndexes[QString::fromStdWString(APPLICATION_AUTO_INVOCATION_SETTINGS)] = 13;
-    settingsNamesIndexes[QString::fromStdWString(BROADCAST_SETTINGS)] = 14;
-    settingsNamesIndexes[QString::fromStdWString(NFC_WRITE_ACCESS_SETTINGS)] = 15;
-    settingsNamesIndexes[QString::fromStdWString(URL_START_SETTINGS)] = 16;
-    int last_index = 16;
-    
-    JavaStorageApplicationEntry_t query;
-    JavaStorageApplicationList_t queryResult;
-    JavaStorageEntry attr;
-    attr.setEntry(ID, iSuiteUid);
-    query.insert(attr);
-    attr.setEntry(aColumnName, L"");
-    query.insert(attr);
-
-    try
-    {
-        iStorage->search(aPrimaryTableName, query, queryResult);
-        
-        JavaStorageApplicationList_t::const_iterator iterator;
-        JavaStorageApplicationList_t secondaryQueryResult;
-        for (iterator = queryResult.begin(); iterator != queryResult.end(); iterator++)
-        {
-            std::wstring name = L"";
-            JavaStorageApplicationEntry_t entry = (*iterator);
-            JavaStorageEntry findPattern;
-            findPattern.setEntry(aColumnName, L"");
-            JavaStorageApplicationEntry_t::const_iterator findIterator =
-                    entry.find(findPattern);
-            if (findIterator != entry.end())
-            {
-                name = findIterator->entryValue();
-            }            
-            if (name.size() > 0)
-            {
-                entry.clear();
-                query.clear();
-                attr.setEntry(ID, iSuiteUid);
-                query.insert(attr);
-                attr.setEntry(aColumnName, name);
-                query.insert(attr);
-                secondaryQueryResult.clear();
-                iStorage->search(aSecondaryTableName, query, secondaryQueryResult);
-                if (secondaryQueryResult.size() > 0)
-                {
-                    IndexedSettingsName value;
-                    value.name = name;
-                    value.index = last_index + 1;
-                    if (settingsNamesIndexes.contains(QString::fromStdWString(name)))
-                    {
-                        value.index = settingsNamesIndexes.value(QString::fromStdWString(name));
-                    }
-                    values.push_back(value);
-                }
-            }
-        }
-    }
-    catch (JavaStorageException& aJse)
-    {
-        // Don't leave. Set defaults.
-    }
-
-    return values;
-}
-
-void JavaApplicationSettingsViewPrivate::readSuiteUid(const QString& aAppUid)
-{
-    iSuiteUid = L"";
-    bool ok;
-    int tmp = aAppUid.toInt( &ok, 10 );
-    if (!ok)
-    {
-        return;
-    }
-    wstring appUid = L""; 
-    appUid.append(L"[").append(QString("%1").arg(tmp, 0, 16).toStdWString()).append(L"]");
-
-    JavaStorageApplicationEntry_t query;
-    JavaStorageApplicationList_t queryResult;
-    JavaStorageEntry attr;
-    attr.setEntry(ID, appUid);
-    query.insert(attr);
-    attr.setEntry(PACKAGE_ID, L"");
-    query.insert(attr);
-    try
-    {
-        iStorage->search(APPLICATION_TABLE, query, queryResult);
-    }
-    catch (JavaStorageException& aJse)
-    {
-        // Don't leave. Set defaults.
-    }
-    findEntry(queryResult, PACKAGE_ID, iSuiteUid);
-}
-
-
-#ifdef WIN32
-#include "./moc/moc_javaapplicationsettingsview.cpp"
-#else
-#include "moc_javaapplicationsettingsview.cpp"
-#endif
--- a/javamanager/javasettings/appsettingsview_qt/src/javaapplicationsettingsview_p.h	Tue Jul 06 14:10:26 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,118 +0,0 @@
-/*
-* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-#ifndef JAVAAPPLICATIONSETTINGSVIEW_P_H
-#define JAVAAPPLICATIONSETTINGSVIEW_P_H
-
-#include <QVector>
-#include <QList>
-#include <QTranslator>
-#include <QModelIndex>
-#include <QEventLoop>
-#include <memory>
-#include <cmapplsettingsui.h>
-#include "javaapplicationsettings.h"
-#include "javastorage.h"
-
-class HbWidget;
-class HbPushButton;
-class HbDataForm;
-class HbDataFormModel;
-class HbDataFormModelItem;
-class JavaApplicationSettingsView;
-class HbAction;
-
-struct IndexedSettingsName
-{
-    std::wstring name;
-    int index;
-};
-
-struct AscendingSort
-{
-    bool operator()(const IndexedSettingsName& i1, const IndexedSettingsName& i2)
-    {
-        return i1.index < i2.index;
-    }
-};
-
-class JavaApplicationSettingsViewPrivate: public QObject
-{
-    Q_OBJECT
-    
-public:
-    JavaApplicationSettingsViewPrivate(const QString& aApplication);
-    virtual ~JavaApplicationSettingsViewPrivate();
-    void init(JavaApplicationSettingsView*);
-
-    // slots
-    void _q_settingsChanged(const QString &newValue);
-    void _q_settingsChanged(bool);
-    void _q_dataItemDisplayed(const QModelIndex);
-
-private slots:
-    void netConnSelected(uint netConnSelectionStatus);
-    void securityWarningDismissed(HbAction*);
-
-private:
-    void readAllSettings();
-    void initSettings(QVector<JavaApplicationSettings>& settings, HbDataFormModelItem * parent);
-    void writeSettings(JavaApplicationSettings& settings, const QString &newValue);
-    void securityWarningsChanged(const QString &);
-    bool blanketAllowed(const JavaApplicationSettings &settings);
-    HbWidget * itemToWidget(const HbDataFormModelItem *);
-    JavaApplicationSettings* findSettings(HbWidget* id);
-    JavaApplicationSettings* findSettings(HbWidget* id, QVector<JavaApplicationSettings>& settings);
-    void readFromStorage(JavaApplicationSettings& settings);
-    void writeToStorage(JavaApplicationSettings& settings);
-    bool findFromStorage(const std::wstring&, const std::wstring&, const std::wstring&, const std::string&);
-    std::wstring readFromStorage(const std::wstring&, const std::wstring&, const std::wstring&, const std::string&);
-    std::vector<IndexedSettingsName> readFromStorage(const std::wstring& aColumnName, const std::string& aPrimaryTableName,const std::string& aSecondaryTableName);
-    void filterSecuritySettings(JavaApplicationSettings& settings);
-    void findEntry(const java::storage::JavaStorageApplicationList_t&, const std::wstring&, std::wstring& eValue);
-    void readSuiteUid(const QString& aAppUid);
-    bool securityWarningAccepted(const QString& text, const QString& acceptActionLabel, const QString& rejectActionLabel, const QString& headingText);
-    void handleNetworkSettings();
-    void readNetworkConnectionName();
-    void initNetworkConnection();
-    void configureList(QList<JavaApplicationSettings*>&, const QStringList&, const QHash<QString, int>&);
-    void attachList(const QString& settingsName, const QList<JavaApplicationSettings*>&, const QHash<QString, int>&, bool isHighRiskList = true);
-    void installTranslator(const QString& translationFileName);
-    
-private:
-    HbDataForm * mainForm;
-    HbDataFormModel *model;
-    HbDataFormModelItem * generalSettingsGroup;
-    HbDataFormModelItem * securitySettingsGroup;
-    QVector<JavaApplicationSettings> generalSettings;
-    QVector<JavaApplicationSettings> securitySettings;
-    QVector<JavaApplicationSettings> extraSettings;
-    JavaApplicationSettingsView* iPublicView;
-    std::auto_ptr<java::storage::JavaStorage> iStorage;
-    std::wstring iSuiteUid;
-    QString BLANKET,SESSION,ONESHOT,DENIED,SECURITY_LEVEL,USER_DEFINED,SENSITIVE_SETTINGS,SENSITIVE_SETTINGS_NET_USAGE,MUTUALLY_EXCLUSIVE_SETTINGS,OK,CANCEL,SECURITY_WARNING_TITLE,NET_ACCESS,LOW_LEVEL_NET_ACCESS,NETWORK_CONNECTION,NETWORK_CONNECTION_CHANGE,SETTINGS_TITLE,SETTINGS_NOT_AVAILABLE;
-    CmApplSettingsUi* netConnSettingsUi;
-    CmApplSettingsUi::SettingSelection netConnSelection;
-    JavaApplicationSettings::NetworkConnection netConn;
-    int netSettIndex;
-    QEventLoop* asyncToSyncCallEventLoop;
-    bool secWarningAccepted;
-    int defaultConnId;
-    QList<QTranslator *> translators;
-};
-
-
-#endif // JAVAAPPLICATIONSETTINGSVIEW_P_H
--- a/javamanager/javasettings/javasettings.pro	Tue Jul 06 14:10:26 2010 +0300
+++ b/javamanager/javasettings/javasettings.pro	Wed Aug 18 09:43:15 2010 +0300
@@ -14,5 +14,4 @@
 # Description: Generated file - do not edit manually
 #
 TEMPLATE = subdirs
-SUBDIRS += appsettingsview_qt/build/javaapplicationsettingsview.pro 
 BLD_INF_RULES.prj_extensions += "prj_extensions" 
--- a/javamanager/javasettings/subsystem.mk	Tue Jul 06 14:10:26 2010 +0300
+++ b/javamanager/javasettings/subsystem.mk	Wed Aug 18 09:43:15 2010 +0300
@@ -17,10 +17,7 @@
 include $(JAVA_SRC_ROOT)/build/Makefile.defs
 
 
-ifdef RD_JAVA_APPLICATION_SETTINGS_QT
-COMPONENTS += appsettingsview_qt/build
-SYMBIAN_ONLY += appsettingsview_qt/build
-else
+ifndef RD_JAVA_APPLICATION_SETTINGS_QT
 ifndef RD_JAVA_S60_RELEASE_5_0_IAD
 NONQTSUBSYSTEMS += appmngrplugin/build
 SYMBIAN_ONLY += appmngrplugin/build
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javamanager/javasettings_qt/build/javaapplicationsettingsview.pro	Wed Aug 18 09:43:15 2010 +0300
@@ -0,0 +1,43 @@
+#
+# Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+#
+# Contributors:
+#
+# Description:
+#
+TEMPLATE = lib
+TARGET = javaapplicationsettingsview
+CONFIG += qt hb stl plugin mobility
+MOBILITY += bearer
+LIBS += -ljavastorage -lcmapplsettingsui -ljavaconnectionmanager -ljavautils
+TRANSLATIONS = javaruntimeapplicationsettings.ts
+
+INCLUDEPATH += ../../../inc
+SOURCES += ..\src\javaapplicationsettingsview.cpp ..\src\javaapplicationsettingsview_p.cpp ..\src\javaapplicationsettings.cpp
+HEADERS += ..\src\javaapplicationsettingsview.h ..\src\javaapplicationsettingsview_p.h ..\src\javaapplicationsettings.h
+
+symbian : plugin {
+    TARGET.EPOCALLOWDLLDATA = 1
+    TARGET.CAPABILITY = ALL -TCB
+    PLUGIN_STUB_PATH = /resource/qt/plugins/appsettings
+    pluginstub.sources = $${TARGET}.dll
+    pluginstub.path = $$PLUGIN_STUB_PATH
+    DEPLOYMENT += pluginstub
+    qtplugins.path = $$PLUGIN_STUB_PATH
+    qtplugins.sources += qmakepluginstubs/$${TARGET}.qtplugin
+    for(qtplugin, qtplugins.sources):BLD_INF_RULES.prj_exports += "./$$qtplugin  z:$$qtplugins.path/$$basename(qtplugin)"
+
+    include(../../../build/symbian_uids.pri)
+
+}
+
+# Workaround for RVCT 4.0 QT/Symbian incmpatibility
+MMP_RULES -= $$MMP_RULES_DONT_EXPORT_ALL_CLASS_IMPEDIMENTA
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javamanager/javasettings_qt/src/applicationsettingsview.h	Wed Aug 18 09:43:15 2010 +0300
@@ -0,0 +1,51 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+#ifndef APPLICATIONSETTINGSVIEW_H
+#define APPLICATIONSETTINGSVIEW_H
+
+#include <hbview.h>
+#include <QtPlugin>
+
+class ApplicationSettingsView: public HbView
+{
+public:
+
+    /*
+     * Base constructor
+     */
+    explicit ApplicationSettingsView() : HbView() {}
+
+    /*
+     * Destructor
+     */
+    virtual ~ApplicationSettingsView() {}
+
+public slots:
+    /*
+     * Initializas the view with application specific info
+     *
+     * @param aAppUid Identifier for the application
+     *
+     */
+    void initialize(const QString& aAppUid);
+
+};
+
+Q_DECLARE_INTERFACE(ApplicationSettingsView,
+                    "com.nokia.ApplicationLibrary.ApplicationSettingsView/1.0");
+
+#endif // APPLICATIONSETTINGSVIEW_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javamanager/javasettings_qt/src/javaapplicationsettings.cpp	Wed Aug 18 09:43:15 2010 +0300
@@ -0,0 +1,214 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+#include "javaapplicationsettings.h"
+
+using namespace java::settings;
+
+JavaApplicationSettings::JavaApplicationSettings():
+    mName(),
+    mValues(),
+    mId(0),
+    mCurrentValue(0),
+    mColumnName(),
+    mTableName(),
+    mStorageValuesFilter(),
+    mValuesColumnName(),
+    mFilterColumnName(),
+    mFilterColumnValue(),
+    mConnectedToUi(false)
+{
+}
+
+JavaApplicationSettings::JavaApplicationSettings(const QString& aName, const QStringList& aValues):
+        mName(aName),
+        mValues(aValues),
+        mId(0),
+        mCurrentValue(0),
+        mColumnName(),
+        mTableName(),
+        mStorageValuesFilter(),
+        mValuesColumnName(),
+        mFilterColumnName(),
+        mFilterColumnValue(),
+        mConnectedToUi(false)
+{
+}
+
+JavaApplicationSettings::JavaApplicationSettings(const QString& aName, const QStringList& aValues, const std::wstring& aColumnName, const std::string& aTableName, const std::vector<std::wstring>& aStorageValues):
+        mName(aName),
+        mValues(aValues),
+        mId(0),
+        mCurrentValue(0),
+        mColumnName(aColumnName),
+        mTableName(aTableName),
+        mStorageValues(aStorageValues),
+        mStorageValuesFilter(),
+        mValuesColumnName(),
+        mFilterColumnName(),
+        mFilterColumnValue(),
+        mConnectedToUi(false)
+{
+}
+
+JavaApplicationSettings::JavaApplicationSettings(const QString& aName, const QStringList& aValues, const std::wstring& aColumnName, const std::string& aTableName, const std::vector<std::wstring>& aStorageValues, const std::wstring& aFilterColumnName, const std::wstring& aFilterColumnValue,  const std::wstring& aValuesColumnName):
+        mName(aName),
+        mValues(aValues),
+        mId(0),
+        mCurrentValue(0),
+        mColumnName(aColumnName),
+        mTableName(aTableName),
+        mStorageValues(aStorageValues),
+        mStorageValuesFilter(),
+        mValuesColumnName(aValuesColumnName),
+        mFilterColumnName(aFilterColumnName),
+        mFilterColumnValue(aFilterColumnValue),
+        mConnectedToUi(false)
+{
+}
+
+void JavaApplicationSettings::setCurrentValue(int aCurrentValue)
+{
+    mCurrentValue = aCurrentValue;
+}
+
+void JavaApplicationSettings::connectToUi()
+{
+    mConnectedToUi = true;
+}
+
+void JavaApplicationSettings::disconnectFromUi()
+{
+    mConnectedToUi = false;
+}
+
+bool JavaApplicationSettings::isConnectedToUi()
+{
+    return mConnectedToUi;
+}
+
+int JavaApplicationSettings::getCurrentValue()
+{
+    return mCurrentValue;
+}
+
+const QString JavaApplicationSettings::getValue(int aValueIndex)
+{
+    if (aValueIndex >= 0 && aValueIndex < mValues.size())
+        return mValues[aValueIndex];
+    return QString::null;
+}
+
+void JavaApplicationSettings::removeValue(int aValueIndex)
+{
+    if (aValueIndex >= 0 && aValueIndex < mStorageValues.size())
+        mStorageValues.erase(mStorageValues.begin() + aValueIndex);
+    if (aValueIndex >= 0 && aValueIndex < mValues.size())
+        mValues.erase(mValues.begin() + aValueIndex);
+}
+
+int JavaApplicationSettings::getValueIndex(const QString& aValue)
+{
+    int value = -1;
+    for (int i = 0; i < mValues.size(); i++)
+    {
+        if (mValues[i] == aValue)
+        {
+            return i;
+        }
+    }
+    return value;
+}
+
+void JavaApplicationSettings::setId(HbDataFormModelItem * aId)
+{
+    mId = aId;
+}
+
+HbDataFormModelItem * JavaApplicationSettings::getId()
+{
+    return mId;
+}
+
+const QString& JavaApplicationSettings::getName() const
+{
+    return mName;
+}
+
+const QStringList& JavaApplicationSettings::getValues() const
+{
+    return mValues;
+}
+
+const QList<JavaApplicationSettings*>& JavaApplicationSettings::getHighRiskList() const
+{
+    return mHighRiskList;
+}
+
+void JavaApplicationSettings::setHighRiskList(const QList<JavaApplicationSettings*>& aHighRiskList)
+{
+    mHighRiskList = aHighRiskList;
+}
+
+const QList<JavaApplicationSettings*>& JavaApplicationSettings::getMutuallyExclusiveList() const
+{
+    return mMutuallyExclusiveList;
+}
+
+void JavaApplicationSettings::setMutuallyExclusiveList(const QList<JavaApplicationSettings*>& aMutuallyExclusiveList)
+{
+    mMutuallyExclusiveList = aMutuallyExclusiveList;
+}
+
+const std::wstring& JavaApplicationSettings::getColumnName()
+{
+    return mColumnName;
+}
+
+const std::wstring& JavaApplicationSettings::getValuesColumnName()
+{
+    return mValuesColumnName;
+}
+
+const std::string& JavaApplicationSettings::getTableName()
+{
+    return mTableName;
+}
+
+const std::vector<std::wstring>& JavaApplicationSettings::getStorageValues()
+{
+    return mStorageValues;
+}
+
+void JavaApplicationSettings::setStorageValuesFilter(const std::wstring& aStorageValuesFilter)
+{
+    mStorageValuesFilter = aStorageValuesFilter;
+}
+
+const std::wstring& JavaApplicationSettings::getStorageValuesFilter()
+{
+    return mStorageValuesFilter;
+}
+
+const std::wstring& JavaApplicationSettings::getFilterColumnName()
+{
+    return mFilterColumnName;
+}
+
+const std::wstring& JavaApplicationSettings::getFilterColumnValue()
+{
+    return mFilterColumnValue;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javamanager/javasettings_qt/src/javaapplicationsettings.h	Wed Aug 18 09:43:15 2010 +0300
@@ -0,0 +1,120 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+#ifndef JAVAAPPLICATIONSETTINGS_H
+#define JAVAAPPLICATIONSETTINGS_H
+
+#include <string>
+#include <vector>
+#include <QString>
+#include <QStringList>
+#include <hbdataformmodelitem.h>
+#include <cmapplsettingsui.h>
+
+namespace java
+{
+namespace settings
+{
+
+/**
+ * Encapsulation of java settings:
+ *   - name (as localized string displayed to user)
+ *   - values (as a list of localized strings displayed to user)
+ *   - current value (one of the values)
+ *   - storage details (name of table, name of column, storage values)
+ * MIDP spec sets requirements for some combinations of settings:
+ *   - some combinations of settings values are considered as sensitive,
+ *     since they can cause privacy exposure or network costs. Whenever
+ *     such a combination is about to be set, the user needs to be
+ *     notified about possible consequences
+ *   - such combinations of settings values are forbidden (mutually exclusive)
+ * Each setting is initialized with a list of sensitive settings counterparts
+ * and mutually exclusive counterparts respectively
+ */
+class JavaApplicationSettings
+{
+public:
+
+    struct NetworkConnection
+        {
+        QString name;
+        uint id;
+        CmApplSettingsUi::SelectionType type;
+        };
+
+    JavaApplicationSettings(const QString& aName,
+                            const QStringList& aValues);
+    JavaApplicationSettings(const QString& aName,
+                            const QStringList& aValues,
+                            const std::wstring& aColumnName,
+                            const std::string& aTableName,
+                            const std::vector<std::wstring>& aStorageValues);
+    JavaApplicationSettings(const QString& aName,
+                            const QStringList& aValues,
+                            const std::wstring& aColumnName,
+                            const std::string& aTableName,
+                            const std::vector<std::wstring>& aStorageValues,
+                            const std::wstring& aFilterColumnName,
+                            const std::wstring& aFilterColumnValue,
+                            const std::wstring& aValuesColumnName);
+    JavaApplicationSettings();
+
+    const QString& getName() const;
+    const QStringList& getValues() const;
+    void setCurrentValue(int aCurrentValue);
+    int getCurrentValue();
+    const QString getValue(int aValueIndex);
+    int getValueIndex(const QString& aValue);
+    void removeValue(int aValueIndex);
+    void setId(HbDataFormModelItem * aId);
+    HbDataFormModelItem * getId();
+    const QList<JavaApplicationSettings*>& getHighRiskList() const;
+    void setHighRiskList(const QList<JavaApplicationSettings*>& aHighRiskList);
+    const QList<JavaApplicationSettings*>& getMutuallyExclusiveList() const;
+    void setMutuallyExclusiveList(const QList<JavaApplicationSettings*>& aMutuallyExclusiveList);
+    const std::wstring& getColumnName();
+    const std::string& getTableName();
+    const std::wstring& getValuesColumnName();
+    const std::wstring& getFilterColumnName();
+    const std::wstring& getFilterColumnValue();
+    const std::vector<std::wstring>& getStorageValues();
+    void setStorageValuesFilter(const std::wstring& aStorageValuesFilter);
+    const std::wstring& getStorageValuesFilter();
+    void connectToUi();
+    void disconnectFromUi();
+    bool isConnectedToUi();
+
+private:
+    QString mName;
+    QStringList mValues;
+    HbDataFormModelItem * mId;
+    QList<JavaApplicationSettings*> mHighRiskList;
+    QList<JavaApplicationSettings*> mMutuallyExclusiveList;
+    int mCurrentValue;
+    std::wstring mColumnName;
+    std::string mTableName;
+    std::vector<std::wstring> mStorageValues;
+    std::wstring mStorageValuesFilter;
+    std::wstring mValuesColumnName;
+    std::wstring mFilterColumnName;
+    std::wstring mFilterColumnValue;
+    bool mConnectedToUi;
+};
+
+} // namespace settings
+} // namespace java
+
+#endif // JAVAAPPLICATIONSETTINGS_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javamanager/javasettings_qt/src/javaapplicationsettingsview.cpp	Wed Aug 18 09:43:15 2010 +0300
@@ -0,0 +1,38 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+#include "javaapplicationsettingsview.h"
+#include "javaapplicationsettingsview_p.h"
+
+using namespace java::settings;
+
+JavaApplicationSettingsView::JavaApplicationSettingsView() :
+        ApplicationSettingsView()
+{
+}
+
+void JavaApplicationSettingsView::initialize(const QString& aApplication)
+{
+    d_ptr = new JavaApplicationSettingsViewPrivate(aApplication);
+    d_ptr->init(this);
+}
+
+JavaApplicationSettingsView::~JavaApplicationSettingsView()
+{
+    delete d_ptr;
+}
+
+Q_EXPORT_PLUGIN2(javaapplicationsettingsview, JavaApplicationSettingsView);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javamanager/javasettings_qt/src/javaapplicationsettingsview.h	Wed Aug 18 09:43:15 2010 +0300
@@ -0,0 +1,67 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+#ifndef JAVAAPPLICATIONSETTINGSVIEW_H
+#define JAVAAPPLICATIONSETTINGSVIEW_H
+
+#include "applicationsettingsview.h"
+
+namespace java
+{
+namespace settings
+{
+
+/**
+ * Realization of the p-impl pattern: settings view consists of a public part (
+ * implementing the ApplicationSettingsView interface) and the private part
+ * (containing the private details). The public part simply maintains a pointer
+ * to the private part thus enabling further changes into the private part without
+ * any risk of breaking the public part
+ */
+class JavaApplicationSettingsViewPrivate;
+
+class JavaApplicationSettingsView: public ApplicationSettingsView
+{
+    Q_OBJECT
+    Q_INTERFACES(ApplicationSettingsView)
+
+public:
+    explicit JavaApplicationSettingsView();
+    virtual ~JavaApplicationSettingsView();
+
+public slots:
+    void initialize(const QString&);
+
+signals:
+    void aboutToClose();
+
+private:
+    Q_DISABLE_COPY(JavaApplicationSettingsView)
+    Q_DECLARE_PRIVATE_D(d_ptr, JavaApplicationSettingsView)
+    Q_PRIVATE_SLOT(d_func(), void _q_settingsChanged(const QString & aNewValue))
+    Q_PRIVATE_SLOT(d_func(), void _q_settingsChanged(bool aNewValue))
+    Q_PRIVATE_SLOT(d_func(), void _q_dataItemDisplayed(const QModelIndex aDataItemIndex))
+
+private:
+    // the pointer to the private counterpart
+    JavaApplicationSettingsViewPrivate * d_ptr;
+};
+
+} // namespace settings
+} // namespace java
+
+
+#endif // JAVAAPPLICATIONSETTINGSVIEW_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javamanager/javasettings_qt/src/javaapplicationsettingsview_p.cpp	Wed Aug 18 09:43:15 2010 +0300
@@ -0,0 +1,1158 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+#include <hbmessagebox.h>
+#include <hbdataformviewitem.h>
+#include <hbcombobox.h>
+#include <hbpushbutton.h>
+#include <hbdataform.h>
+#include <hbdataformmodel.h>
+#include <hbdataformmodelitem.h>
+#include <hblabel.h>
+#include <hbaction.h>
+#include <QApplication>
+#include <QTranslator>
+#include <QLibraryInfo>
+#include <qnetworkconfigmanager.h>
+#include <qnetworkconfiguration.h>
+#include <algorithm>
+
+#include "javaapplicationsettings.h"
+#include "javaapplicationsettingsview.h"
+#include "javaapplicationsettingsview_p.h"
+#include "connectionmanager.h"
+#include "javacommonutils.h"
+
+#include "securitystoragedatadefs.h"
+#include "javastoragenames.h"
+
+#include "logger.h"
+
+QTM_USE_NAMESPACE
+
+using namespace java::settings;
+using namespace java::storage;
+using namespace java::util;
+using namespace std;
+
+const wchar_t ON_SCREEN_KEYPAD_VALUE_NO[] = L"0";
+const wchar_t ON_SCREEN_KEYPAD_VALUE_GAMEACTIONS[] = L"1";
+const wchar_t ON_SCREEN_KEYPAD_VALUE_NAVIGATION[] = L"2";
+
+JavaApplicationSettingsViewPrivate::JavaApplicationSettingsViewPrivate(const QString& aJavaAppUid):
+        mMainForm(0), mModel(0), mGeneralSettingsGroup(0), mSecuritySettingsGroup(0), mNetConnSettingsUi(0), mAsyncToSyncCallEventLoop(0), mSecWarningAccepted(false), mDefaultConnId(0)
+{
+    // init common values
+    init();
+
+    // init the suite UID from the application UID
+    readSuiteUid(aJavaAppUid);
+    if (mSuiteUid.size() <= 0)
+    {
+        ELOG1(EJavaSettings, "No suite found with uid %S", aJavaAppUid.toStdWString().c_str());
+        return;
+    }
+    ELOG1(EJavaSettings, "Initializing settings for suite %S", mSuiteUid.c_str());
+    
+    // init access point settings ui
+    mNetConnSettingsUi = new CmApplSettingsUi(this);
+    mAsyncToSyncCallEventLoop = new QEventLoop();
+
+    // read all settings
+    readAllSettings();
+
+    // init form
+    mMainForm = new HbDataForm();
+    mMainForm->setHeading(QString::fromStdWString(readFromStorage(PACKAGE_NAME, L"", L"", APPLICATION_PACKAGE_TABLE)));
+    mModel = new HbDataFormModel();
+
+    // init settings
+    mGeneralSettingsGroup = mModel->appendDataFormGroup(
+        QString(hbTrId(ID_GENERAL_GROUP_TITLE)), mModel->invisibleRootItem());
+    initSettings(mGeneralSettings, mGeneralSettingsGroup);
+    // append the security settings only if there are any user settings
+    if (mExtraSettings.size() > 0)
+    {
+        mSecuritySettingsGroup = mModel->appendDataFormGroup(
+            QString(hbTrId(ID_SECURITY_GROUP_TITLE)), mModel->invisibleRootItem());
+        initSettings(mSecuritySettings, mSecuritySettingsGroup);
+
+        // if security warnings is user defined -> add the extra settings, expand
+        if (mSecuritySettings[0].getCurrentValue() == 1)
+        {
+            securityWarningsChanged(TXT_USER_DEFINED);
+        }
+    }
+
+    // link form and model
+    mMainForm->setModel(mModel);
+    mMainForm->setExpanded(mModel->indexFromItem(mGeneralSettingsGroup), true);
+    if (mExtraSettings.size() > 0)
+    {
+        mMainForm->setExpanded(mModel->indexFromItem(mSecuritySettingsGroup), (mSecuritySettings[0].getCurrentValue() == 1));
+    }
+}
+
+void JavaApplicationSettingsViewPrivate::init(JavaApplicationSettingsView* aPublicView)
+{
+    mPublicView = aPublicView;
+
+    if (mMainForm)
+    {
+        // do the connect for the main form
+        mPublicView->connect(mMainForm, SIGNAL(itemShown(const QModelIndex)),
+                             mPublicView, SLOT(_q_dataItemDisplayed(const QModelIndex)));
+
+        // set the form as view's widget
+        mPublicView->setWidget(mMainForm);
+    }
+    else
+    {
+        // no settings available
+        HbLabel* label = new HbLabel(TXT_SETTINGS_NOT_AVAILABLE, mPublicView);
+        label->setAlignment(Qt::AlignVCenter);
+    }
+
+    // set title
+    mPublicView->setTitle(TXT_SETTINGS_TITLE);
+}
+
+JavaApplicationSettingsViewPrivate::~JavaApplicationSettingsViewPrivate()
+{
+    delete mMainForm;
+    delete mModel;
+    delete mNetConnSettingsUi;
+    delete mAsyncToSyncCallEventLoop;
+    foreach (QTranslator *translator, mTranslators) {
+        qApp->removeTranslator(translator);
+    }
+    qDeleteAll(mTranslators);
+    mTranslators.clear();
+}
+
+void JavaApplicationSettingsViewPrivate::readAllSettings()
+{
+    // general settings
+    initGeneralSettings();
+
+    // security settings
+    initSecuritySettings();
+}
+
+void JavaApplicationSettingsViewPrivate::init()
+{
+    // init storage
+    try
+    {
+        mStorage.reset(JavaStorage::createInstance());
+        mStorage->open();
+    }
+    catch (JavaStorageException& aJse)
+    {
+        ELOG1(EJavaSettings, "Error while opening the storage %S", aJse.toString().c_str());
+    }
+
+    QTranslator translator;
+    // load the correct translation of the localized strings for the cmmanager.
+    // Load this one first since it contains the smallest amount of strings
+    // (so it's ok to be searched last)
+    installTranslator("cmapplsettingsui");
+    installTranslator("cmmanager");
+    // load the correct translation of the localized strings for the java settings
+    // Current solution reads it from Z only (this does not work with IAD)
+    // -> check if translator can handle path without drive letter (e.g. the resource
+    // is loaded from the same drive where the DLL is loaded)
+    installTranslator("javaruntimeapplicationsettings");
+    // init strings
+    TXT_BLANKET = QString(hbTrId(ID_BLANKET));
+    TXT_SESSION = QString(hbTrId(ID_SESSION));
+    TXT_ONESHOT = QString(hbTrId(ID_ONESHOT));
+    TXT_DENIED = QString(hbTrId(ID_DENIED));
+    TXT_SECURITY_LEVEL = QString(hbTrId(ID_SECURITY_LEVEL));
+    TXT_USER_DEFINED = QString(hbTrId(ID_USER_DEFINED));
+    TXT_SENSITIVE_SETTINGS = QString(hbTrId(ID_SENSITIVE_SETTINGS));
+    TXT_SENSITIVE_SETTINGS_NET_USAGE = QString(hbTrId(ID_SENSITIVE_SETTINGS_NET_USAGE));
+    TXT_MUTUALLY_EXCLUSIVE_SETTINGS = QString(hbTrId(ID_MUTUALLY_EXCLUSIVE_SETTINGS));
+    TXT_OK = QString(hbTrId(ID_OK));
+    TXT_CANCEL = QString(hbTrId(ID_CANCEL));
+    TXT_SECURITY_WARNING_TITLE = QString(hbTrId(ID_SECURITY_WARNING_TITLE));
+    TXT_NET_ACCESS = QString(hbTrId(ID_NET_ACCESS));
+    TXT_LOW_LEVEL_NET_ACCESS = QString(hbTrId(ID_LOW_LEVEL_NET_ACCESS));
+    TXT_NETWORK_CONNECTION = QString(hbTrId(ID_NETWORK_CONNECTION));
+    TXT_SETTINGS_TITLE = QString(hbTrId(ID_SETTINGS_TITLE));
+    TXT_SETTINGS_NOT_AVAILABLE = QString(hbTrId(ID_SETTINGS_NOT_AVAILABLE));
+
+    // init the known localized settings names
+    mLocalizedSettingsNames[QString::fromStdWString(NET_ACCESS_SETTINGS)] = TXT_NET_ACCESS;
+    mLocalizedSettingsNames[QString::fromStdWString(LOW_LEVEL_NET_ACCESS_SETTINGS)] = TXT_LOW_LEVEL_NET_ACCESS;
+    mLocalizedSettingsNames[QString::fromStdWString(MESSAGING_SETTINGS)] = QString(hbTrId(ID_MESSAGING));
+    mLocalizedSettingsNames[QString::fromStdWString(RESTRICTED_MESSAGING_SETTINGS)] = QString(hbTrId(ID_RESTRICTED_MESSAGING));
+    mLocalizedSettingsNames[QString::fromStdWString(CALL_CONTROL_SETTINGS)] = QString(hbTrId(ID_CALL_CONTROL));
+    mLocalizedSettingsNames[QString::fromStdWString(LOCAL_CONNECTIVITY_SETTINGS)] = QString(hbTrId(ID_LOCAL_CONNECTIVITY));
+    mLocalizedSettingsNames[QString::fromStdWString(MULTIMEDIA_RECORDING_SETTINGS)] = QString(hbTrId(ID_MULTIMEDIA_RECORDING));
+    mLocalizedSettingsNames[QString::fromStdWString(WRITE_USER_DATA_ACCESS_SETTINGS)] = QString(hbTrId(ID_WRITE_USER_DATA_ACCESS));
+    mLocalizedSettingsNames[QString::fromStdWString(READ_USER_DATA_ACCESS_SETTINGS)] = QString(hbTrId(ID_READ_USER_DATA_ACCESS));
+    mLocalizedSettingsNames[QString::fromStdWString(LOCATION_SETTINGS)] = QString(hbTrId(ID_LOCATION));
+    mLocalizedSettingsNames[QString::fromStdWString(LANDMARK_SETTINGS)] = QString(hbTrId(ID_LANDMARK));
+    mLocalizedSettingsNames[QString::fromStdWString(AUTHENTICATION_SETTINGS)] = QString(hbTrId(ID_AUTHENTICATION));
+    mLocalizedSettingsNames[QString::fromStdWString(SMART_CARD_COMMUNICATION_SETTINGS)] = QString(hbTrId(ID_SMART_CARD_COMMUNICATION));
+    mLocalizedSettingsNames[QString::fromStdWString(APPLICATION_AUTO_INVOCATION_SETTINGS)] = QString(hbTrId(ID_APPLICATION_AUTO_INVOCATION));
+    mLocalizedSettingsNames[QString::fromStdWString(BROADCAST_SETTINGS)] = QString(hbTrId(ID_BROADCAST));
+    mLocalizedSettingsNames[QString::fromStdWString(NFC_WRITE_ACCESS_SETTINGS)] = QString(hbTrId(ID_NFC_WRITE_ACCESS));
+    mLocalizedSettingsNames[QString::fromStdWString(URL_START_SETTINGS)] = QString(hbTrId(ID_URL_START));
+    // init the display indexes associated with each settings
+    mSettingsNamesIndexes[QString::fromStdWString(NET_ACCESS_SETTINGS)] = NET_ACCESS_SETTINGS_INDEX;
+    mSettingsNamesIndexes[QString::fromStdWString(LOW_LEVEL_NET_ACCESS_SETTINGS)] = LOW_LEVEL_NET_ACCESS_SETTINGS_INDEX;
+    mSettingsNamesIndexes[QString::fromStdWString(MESSAGING_SETTINGS)] = MESSAGING_SETTINGS_INDEX;
+    mSettingsNamesIndexes[QString::fromStdWString(RESTRICTED_MESSAGING_SETTINGS)] = RESTRICTED_MESSAGING_SETTINGS_INDEX;
+    mSettingsNamesIndexes[QString::fromStdWString(CALL_CONTROL_SETTINGS)] = CALL_CONTROL_SETTINGS_INDEX;
+    mSettingsNamesIndexes[QString::fromStdWString(LOCAL_CONNECTIVITY_SETTINGS)] = LOCAL_CONNECTIVITY_SETTINGS_INDEX;
+    mSettingsNamesIndexes[QString::fromStdWString(MULTIMEDIA_RECORDING_SETTINGS)] = MULTIMEDIA_RECORDING_SETTINGS_INDEX;
+    mSettingsNamesIndexes[QString::fromStdWString(WRITE_USER_DATA_ACCESS_SETTINGS)] = WRITE_USER_DATA_ACCESS_SETTINGS_INDEX;
+    mSettingsNamesIndexes[QString::fromStdWString(READ_USER_DATA_ACCESS_SETTINGS)] = READ_USER_DATA_ACCESS_SETTINGS_INDEX;
+    mSettingsNamesIndexes[QString::fromStdWString(LOCATION_SETTINGS)] = LOCATION_SETTINGS_INDEX;
+    mSettingsNamesIndexes[QString::fromStdWString(LANDMARK_SETTINGS)] = LANDMARK_SETTINGS_INDEX;
+    mSettingsNamesIndexes[QString::fromStdWString(AUTHENTICATION_SETTINGS)] = AUTHENTICATION_SETTINGS_INDEX;
+    mSettingsNamesIndexes[QString::fromStdWString(SMART_CARD_COMMUNICATION_SETTINGS)] = SMART_CARD_COMMUNICATION_SETTINGS_INDEX;
+    mSettingsNamesIndexes[QString::fromStdWString(APPLICATION_AUTO_INVOCATION_SETTINGS)] = APPLICATION_AUTO_INVOCATION_SETTINGS_INDEX;
+    mSettingsNamesIndexes[QString::fromStdWString(BROADCAST_SETTINGS)] = BROADCAST_SETTINGS_INDEX;
+    mSettingsNamesIndexes[QString::fromStdWString(NFC_WRITE_ACCESS_SETTINGS)] = NFC_WRITE_ACCESS_SETTINGS_INDEX;
+    mSettingsNamesIndexes[QString::fromStdWString(URL_START_SETTINGS)] = URL_START_SETTINGS_INDEX;
+}
+
+
+void JavaApplicationSettingsViewPrivate::initGeneralSettings()
+{
+    QStringList settingsValues;
+    vector<wstring> storageValues;
+    if (!isInStorage(VALUE, NAME, L"Nokia-MIDlet-On-Screen-Keypad", APPLICATION_PACKAGE_ATTRIBUTES_TABLE))
+    {
+        // if the on screen keypad is predefined, it should not be changable by user
+        // -> right now it is not added to settings list. It should be changed so that
+        // the setting should not be editable by user
+        settingsValues<<QString(hbTrId(ID_OSK_NO))<<QString(hbTrId(ID_OSK_GAME))<<QString(hbTrId(ID_OSK_NAVIGATION));
+        storageValues.push_back(ON_SCREEN_KEYPAD_VALUE_NO);
+        storageValues.push_back(ON_SCREEN_KEYPAD_VALUE_GAMEACTIONS);
+        storageValues.push_back(ON_SCREEN_KEYPAD_VALUE_NAVIGATION);
+        mGeneralSettings.append(JavaApplicationSettings(QString(hbTrId(ID_OSK)), settingsValues, ON_SCREEN_KEYPAD, MIDP_PACKAGE_TABLE, storageValues));
+        readFromStorage(mGeneralSettings[0]);
+    }
+    settingsValues = QStringList();
+    initNetworkConnection();
+    settingsValues<<mNetConn.name;
+    mGeneralSettings.append(JavaApplicationSettings(TXT_NETWORK_CONNECTION, settingsValues));
+    mNetSettIndex = mGeneralSettings.size() - 1;
+}
+
+void JavaApplicationSettingsViewPrivate::initSecuritySettings()
+{
+    QStringList settingsValues;
+    vector<wstring> storageValues;
+    settingsValues = QStringList();
+    storageValues.clear();
+    settingsValues<<QString(hbTrId(ID_SECURITY_LEVEL_DEFAULT))<<TXT_USER_DEFINED;
+    storageValues.push_back(SECURITY_WARNINGS_DEFAULT_MODE);
+    storageValues.push_back(SECURITY_WARNINGS_USER_DEFINED_MODE);
+    mSecuritySettings.append(JavaApplicationSettings(TXT_SECURITY_LEVEL, settingsValues, SECURITY_WARNINGS, MIDP_PACKAGE_TABLE, storageValues));
+    readFromStorage(mSecuritySettings[0]);
+
+    // extra settings
+    settingsValues = QStringList();
+    storageValues.clear();
+    settingsValues<<TXT_ONESHOT<<TXT_SESSION<<TXT_BLANKET<<TXT_DENIED;
+    storageValues.push_back(ONESHOT_INTERACTION_MODE);
+    storageValues.push_back(SESSION_INTERACTION_MODE);
+    storageValues.push_back(BLANKET_INTERACTION_MODE);
+    storageValues.push_back(DENIED_INTERACTION_MODE);
+    vector<IndexedSettingsName> allSecuritySettings = readFromStorage(FUNCTION_GROUP, MIDP_FUNC_GRP_SETTINGS_TABLE, MIDP_PERMISSIONS_TABLE);
+    // sort the security settings according to how they should be displayed
+    std::sort(allSecuritySettings.begin(), allSecuritySettings.end(), AscendingSort());
+    for(int i=0; i<allSecuritySettings.size(); i++)
+    {
+        QString rawSettingsName = QString::fromStdWString(allSecuritySettings[i].name);
+        QString localizedSettingsName = rawSettingsName;
+        if (mLocalizedSettingsNames.contains(rawSettingsName))
+            localizedSettingsName = mLocalizedSettingsNames.value(rawSettingsName);
+        mExtraSettings.append(JavaApplicationSettings(
+            localizedSettingsName, settingsValues, CURRENT_SETTING,
+            MIDP_FUNC_GRP_SETTINGS_TABLE, storageValues, FUNCTION_GROUP,
+            allSecuritySettings[i].name, ALLOWED_SETTINGS));
+        readFromStorage(mExtraSettings[i]);
+        mSettingsIndexes[rawSettingsName] = i;
+    }
+
+    // configure the high risk lists
+    configureLists();
+}
+
+void JavaApplicationSettingsViewPrivate::configureLists()
+{
+    QList<JavaApplicationSettings*> highRiskList;
+    QStringList highRiskSettingsNames;
+    highRiskSettingsNames
+        <<QString::fromStdWString(MULTIMEDIA_RECORDING_SETTINGS)
+        <<QString::fromStdWString(READ_USER_DATA_ACCESS_SETTINGS);
+    configureList(highRiskList, highRiskSettingsNames, mSettingsIndexes);
+    // net access with multimedia and read user data
+    attachList(QString::fromStdWString(NET_ACCESS_SETTINGS),highRiskList, mSettingsIndexes);
+    // low level net access with multimedia and read user data
+    attachList(QString::fromStdWString(LOW_LEVEL_NET_ACCESS_SETTINGS),highRiskList, mSettingsIndexes);
+    // messaging with multimedia and read user data
+    attachList(QString::fromStdWString(MESSAGING_SETTINGS),highRiskList, mSettingsIndexes);
+    // restricted messaging with multimedia and read user data
+    attachList(QString::fromStdWString(RESTRICTED_MESSAGING_SETTINGS),highRiskList, mSettingsIndexes);
+    // call control with multimedia and read user data
+    attachList(QString::fromStdWString(CALL_CONTROL_SETTINGS),highRiskList, mSettingsIndexes);
+    // local connectivity with multimedia and read user data
+    attachList(QString::fromStdWString(LOCAL_CONNECTIVITY_SETTINGS),highRiskList, mSettingsIndexes);
+    // multimedia with net access, low level net access, messaging,
+    // restricted messaging, call control and local connectivity
+    highRiskList.clear();
+    highRiskSettingsNames.clear();
+    highRiskSettingsNames
+        <<QString::fromStdWString(NET_ACCESS_SETTINGS)
+        <<QString::fromStdWString(LOW_LEVEL_NET_ACCESS_SETTINGS)
+        <<QString::fromStdWString(MESSAGING_SETTINGS)
+        <<QString::fromStdWString(RESTRICTED_MESSAGING_SETTINGS)
+        <<QString::fromStdWString(CALL_CONTROL_SETTINGS)
+        <<QString::fromStdWString(LOCAL_CONNECTIVITY_SETTINGS)
+        <<QString::fromStdWString(MULTIMEDIA_RECORDING_SETTINGS);
+    configureList(highRiskList, highRiskSettingsNames, mSettingsIndexes);
+    attachList(QString::fromStdWString(MULTIMEDIA_RECORDING_SETTINGS),highRiskList, mSettingsIndexes);
+    // read user data with net access, low level net access, messaging,
+    // restricted messaging, call control and local connectivity
+    attachList(QString::fromStdWString(READ_USER_DATA_ACCESS_SETTINGS),highRiskList, mSettingsIndexes);
+
+    // configure the mutually exclusive list
+    QList<JavaApplicationSettings*> mutuallyExclusiveList;
+    QStringList mutuallyExclusiveSettingsNames;
+    mutuallyExclusiveSettingsNames
+        <<QString::fromStdWString(APPLICATION_AUTO_INVOCATION_SETTINGS);
+    configureList(mutuallyExclusiveList, mutuallyExclusiveSettingsNames, mSettingsIndexes);
+    //net access with application auto invocation
+    attachList(QString::fromStdWString(NET_ACCESS_SETTINGS),mutuallyExclusiveList, mSettingsIndexes, false /* is high risk list */);
+    //low level net access with application auto invocation
+    attachList(QString::fromStdWString(LOW_LEVEL_NET_ACCESS_SETTINGS),mutuallyExclusiveList, mSettingsIndexes, false /* is high risk list */);
+    //application auto invocation with net access and low level net access
+    mutuallyExclusiveList.clear();
+    mutuallyExclusiveSettingsNames.clear();
+    mutuallyExclusiveSettingsNames
+        <<QString::fromStdWString(NET_ACCESS_SETTINGS)
+        <<QString::fromStdWString(LOW_LEVEL_NET_ACCESS_SETTINGS);
+    configureList(mutuallyExclusiveList, mutuallyExclusiveSettingsNames, mSettingsIndexes);
+    attachList(QString::fromStdWString(APPLICATION_AUTO_INVOCATION_SETTINGS),mutuallyExclusiveList, mSettingsIndexes, false /* is high risk list */);
+}
+
+void JavaApplicationSettingsViewPrivate::initSettings(QVector<JavaApplicationSettings>& aSettings, HbDataFormModelItem * aParent)
+{
+    for (int i=0; i<aSettings.size(); i++)
+    {
+        HbDataFormModelItem * appSettings = NULL;
+        int currentValue = 0;
+        switch(aSettings[i].getValues().size())
+        {
+            case 1:
+                appSettings  = mModel->appendDataFormItem(
+                        HbDataFormModelItem::ToggleValueItem,
+                        aSettings[i].getName(), aParent);
+                // make it a toogle button (-> get rid of the "pressed" ui effect)
+                if (appSettings)
+                {
+                    appSettings->setContentWidgetData(QString("text"), aSettings[i].getValues()[0]);
+                    appSettings->setContentWidgetData(QString("additionalText"), aSettings[i].getValues()[0]);
+                }
+                break;
+            case 2:
+                appSettings  = mModel->appendDataFormItem(
+                        HbDataFormModelItem::ToggleValueItem,
+                        aSettings[i].getName(), aParent);
+                if (appSettings)
+                {
+                    currentValue = aSettings[i].getCurrentValue();
+                    if (currentValue < 0)
+                    {
+                        currentValue = 0;
+                    }
+                    appSettings->setContentWidgetData(QString("text"), aSettings[i].getValues()[currentValue]);
+                    appSettings->setContentWidgetData(QString("additionalText"),aSettings[i].getValues()[1 - currentValue]);
+                }
+                break;
+            default:
+                appSettings  = mModel->appendDataFormItem(
+                        HbDataFormModelItem::ComboBoxItem,
+                        aSettings[i].getName(), aParent);
+                if (appSettings)
+                {
+                    appSettings->setContentWidgetData(QString("items"), aSettings[i].getValues());
+                    appSettings->setContentWidgetData(QString("currentIndex"),aSettings[i].getCurrentValue());
+                }
+        }
+        aSettings[i].setId(appSettings);
+    }
+}
+
+void JavaApplicationSettingsViewPrivate::writeSettings(JavaApplicationSettings& aSettings, const QString &aNewValue)
+{
+    QStringList values = aSettings.getValues();
+    int currentValue = aSettings.getCurrentValue();
+    int newValue = aSettings.getValueIndex(aNewValue);
+    if (newValue != -1 && currentValue != newValue)
+    {
+        // handle blanket settings
+        if (aNewValue == TXT_BLANKET)
+        {
+            // check blanket settings
+            if (!isBlanketAllowed(aSettings))
+            {
+                // change back to the old value
+                HbComboBox * settingsCombo = static_cast<HbComboBox*>(itemToWidget(aSettings.getId()));
+                if (settingsCombo)
+                {
+                    settingsCombo->setCurrentIndex(currentValue);
+                }
+                return;
+            }
+        }
+        aSettings.setCurrentValue(newValue);
+        writeToStorage(aSettings);
+    }
+}
+
+bool JavaApplicationSettingsViewPrivate::isBlanketAllowed(const JavaApplicationSettings& aSettings)
+{
+    // handle the high risk items
+    QList<JavaApplicationSettings*> highRiskList = aSettings.getHighRiskList();
+    // go through the list and see if any of the setings are in blanket
+    for (int i=0; i<highRiskList.size(); i++)
+    {
+        if (highRiskList[i] &&
+                highRiskList[i]->getValue(highRiskList[i]->getCurrentValue())
+                == TXT_BLANKET)
+        {
+            QString secWarning = TXT_SENSITIVE_SETTINGS;
+            QString LOCAL_CONNECTIVITY = QString(hbTrId(ID_LOCAL_CONNECTIVITY));
+            if (aSettings.getName() != LOCAL_CONNECTIVITY
+                && highRiskList[i]->getName() != LOCAL_CONNECTIVITY)
+            {
+                secWarning = TXT_SENSITIVE_SETTINGS_NET_USAGE;
+            }
+            if (!isSecurityWarningAccepted(
+                secWarning,TXT_OK,TXT_CANCEL ,TXT_SECURITY_WARNING_TITLE))
+            {
+                LOG3(EJavaSettings, EInfo,"User did not accept the high risk due to having both \"%S\" and \"%S\" set to \"%S\"", aSettings.getName().toStdWString().c_str(), highRiskList[i]->getName().toStdWString().c_str(), TXT_BLANKET.toStdWString().c_str());
+                return false;
+            }
+            LOG3(EJavaSettings, EInfo,"User accepted the high risk due to having both \"%S\" and \"%S\" set to \"%S\"", aSettings.getName().toStdWString().c_str(), highRiskList[i]->getName().toStdWString().c_str(), TXT_BLANKET.toStdWString().c_str());
+            break;
+        }
+    }
+    // handle the mutually exclusive rules
+    QList<JavaApplicationSettings*> mutuallyExclusiveList = aSettings
+            .getMutuallyExclusiveList();
+    // go through the list and see if any of the setings are in blanket
+    for (int i=0; i<mutuallyExclusiveList.size(); i++)
+    {
+        if (mutuallyExclusiveList[i] && mutuallyExclusiveList[i]->getValue(
+                    mutuallyExclusiveList[i]->getCurrentValue()) == TXT_BLANKET)
+        {
+            bool isBlanketAllowed = isSecurityWarningAccepted(
+                TXT_MUTUALLY_EXCLUSIVE_SETTINGS, TXT_OK, TXT_CANCEL, TXT_SECURITY_WARNING_TITLE);
+            if (isBlanketAllowed)
+            {
+                // change  the current value to the maximum allowed
+                bool isBlanket = true;
+                do
+                {
+                    if (isBlanket)
+                    {
+                        QStringList allowedValues = mutuallyExclusiveList[i]->getValues();
+                        int selectedValue = mutuallyExclusiveList[i]->getCurrentValue();
+                        // select the maximum allowed value
+                        for (int j=0; j<allowedValues.size(); j++)
+                        {
+                            if (allowedValues[j] == TXT_SESSION)
+                            {
+                                selectedValue = j;
+                                break;
+                            }
+                            if (allowedValues[j] == TXT_ONESHOT)
+                            {
+                                selectedValue = j;
+                            }
+                            else if (allowedValues[j] == TXT_DENIED
+                                     && allowedValues[selectedValue] == TXT_BLANKET)
+                            {
+                                selectedValue = j;
+                            }
+                        }
+                        // set the maximum allowed value
+                        mutuallyExclusiveList[i]->setCurrentValue(selectedValue);
+                        HbComboBox * settingsCombo = static_cast<HbComboBox*>(itemToWidget(
+                                                         mutuallyExclusiveList[i]->getId()));
+                        if (settingsCombo)
+                        {
+                            settingsCombo->setCurrentIndex(selectedValue);
+                        }
+                        writeToStorage(*mutuallyExclusiveList[i]);
+                        LOG4(EJavaSettings, EInfo,"Changing \"%S\" to \"%S\" led to changing \"%S\" to \"%S\" due to mutually exclusive rules", aSettings.getName().toStdWString().c_str(), TXT_BLANKET.toStdWString().c_str(), mutuallyExclusiveList[i]->getName().toStdWString().c_str(), allowedValues[selectedValue].toStdWString().c_str());
+                    }
+                    i++;
+                    // end of list?
+                    if (i >= mutuallyExclusiveList.size())
+                    {
+                        break;
+                    }
+                    // move on into the list
+                    isBlanket = (mutuallyExclusiveList[i]->getValue(
+                                     mutuallyExclusiveList[i]->getCurrentValue()) == TXT_BLANKET);
+                }
+                while (true);
+            }
+            else
+            {
+                LOG1(EJavaSettings, EInfo,"User did not accept changes in \"%S\" due to mutually exclusive rules", mutuallyExclusiveList[i]->getName().toStdWString().c_str());
+            }
+            return isBlanketAllowed;
+        }
+    }
+    return true;
+}
+
+void JavaApplicationSettingsViewPrivate::_q_settingsChanged(bool)
+{
+    HbPushButton * sender = static_cast<HbPushButton*>(mPublicView->sender());
+    if (sender)
+    {
+        JavaApplicationSettings* settings = findSettings(sender);
+        if (settings == NULL)
+        {
+            return;
+        }
+        if (settings->getName() == TXT_SECURITY_LEVEL)
+        {
+            QString newValue = settings->getValue(1 - settings->getCurrentValue());
+            securityWarningsChanged(newValue);
+            writeSettings(*settings, newValue);
+        }
+        else if (settings->getName() == TXT_NETWORK_CONNECTION)
+        {
+            handleNetworkSettings();
+        }
+    }
+}
+void JavaApplicationSettingsViewPrivate::_q_settingsChanged(const QString& aNewValue)
+{
+    HbComboBox * sender = static_cast<HbComboBox*>(mPublicView->sender());
+    if (sender)
+    {
+        JavaApplicationSettings* settings = findSettings(sender);
+        if (settings != NULL)
+        {
+            // any other settings are treated same
+            writeSettings(*settings, aNewValue);
+        }
+    }
+}
+
+void JavaApplicationSettingsViewPrivate::securityWarningsChanged(const QString& aNewValue)
+{
+    if (aNewValue == TXT_USER_DEFINED)
+    {
+        // append the extra settings and values
+        for (int i=0; i<mExtraSettings.size(); i++)
+        {
+            if (mExtraSettings[i].getCurrentValue() >= 0 && mExtraSettings[i].getId() == 0)
+            {
+                HbDataFormModelItem * appSettings = mModel->appendDataFormItem(
+                                                        HbDataFormModelItem::ComboBoxItem,
+                                                        mExtraSettings[i].getName(), mSecuritySettingsGroup);
+                if (appSettings)
+                {
+                    mExtraSettings[i].setId(appSettings);
+                    // when settings the items, the settingsChanged signal gets emitted with the first value
+                    // as being the current value. This signal should be discarded (the first value is just
+                    // an intermediate value towards the actual current value which gets set shortly).
+                    // Therefore set the first value as the current value (this way the settingsChanged
+                    // signal gets discarded) and change the current value back to the real current value
+                    int currentValue = mExtraSettings[i].getCurrentValue();
+                    mExtraSettings[i].setCurrentValue(0);
+                    appSettings->setContentWidgetData(QString("items"), mExtraSettings[i].getValues());
+                    mExtraSettings[i].setCurrentValue(currentValue);
+                    appSettings->setContentWidgetData(QString("currentIndex"),mExtraSettings[i].getCurrentValue());
+                }
+            }
+        }
+    }
+    else
+    {
+        // remove the extra settings
+        for (int i=0; i<mExtraSettings.size(); i++)
+        {
+            if (mExtraSettings[i].getId())
+            {
+                HbComboBox * extraSettingsId = static_cast<HbComboBox*>(itemToWidget(mExtraSettings[i].getId()));
+                if (extraSettingsId)
+                {
+                    mPublicView->disconnect(extraSettingsId, 0, 0, 0);
+                    mModel->removeItem(mModel->indexFromItem(mExtraSettings[i].getId()));
+                    mExtraSettings[i].setId(0);
+                    mExtraSettings[i].disconnectFromUi();
+                }
+            }
+        }
+    }
+}
+
+void JavaApplicationSettingsViewPrivate::handleNetworkSettings()
+{
+    // init flags to show destinations and connection methods
+    QFlags<CmApplSettingsUi::SelectionDialogItems> listItems;
+    listItems |= CmApplSettingsUi::ShowDestinations;
+    listItems |= CmApplSettingsUi::ShowConnectionMethods;
+
+    // empty filter -> all bearer types included
+    QSet<CmApplSettingsUi::BearerTypeFilter> filter;
+    // reset the result
+    mNetConnSelection.result = mNetConn.type;
+    mNetConnSelection.id = mNetConn.id;
+    // init settings ui with destinations, filter and initial selection
+    mNetConnSettingsUi->setOptions(listItems, filter);
+    mNetConnSettingsUi->setSelection(mNetConnSelection);
+    // Connect the setting ui's signal with own slot where the mNetConnSelection is stored
+    connect(mNetConnSettingsUi, SIGNAL(finished(uint)), this, SLOT(netConnSelected(uint)));
+    // launch the setting ui
+    mNetConnSettingsUi->open();
+}
+
+void JavaApplicationSettingsViewPrivate::_q_dataItemDisplayed(const QModelIndex aDataItemIndex)
+{
+    HbDataFormModelItem *item = static_cast<HbDataFormModel*>(
+                                    mMainForm->model())->itemFromIndex(aDataItemIndex);
+    if (item == NULL)
+    {
+        return;
+    }
+    int itemType = item->data(HbDataFormModelItem::ItemTypeRole).toInt();
+    HbComboBox * comboBox = NULL;
+    HbPushButton * pushButton = NULL;
+    HbWidget * widget = (qobject_cast<HbDataFormViewItem *>
+        (mMainForm->itemByIndex(aDataItemIndex)))->dataItemContentWidget();
+    JavaApplicationSettings* settings = findSettings(widget);
+    if (settings == NULL)
+    {
+        // stop right here
+        return;
+    }
+    switch(HbDataFormModelItem::DataItemType(itemType))
+    {
+        case HbDataFormModelItem::ComboBoxItem:
+            comboBox = static_cast<HbComboBox*>(widget);
+            if (settings->isConnectedToUi())
+            {
+                // need to do a reconnect: disconnect followed by a connect
+                mPublicView->disconnect(comboBox,
+                        SIGNAL(currentIndexChanged(const QString &)),
+                        mPublicView,
+                        SLOT(_q_settingsChanged(const QString &)));
+            }
+            mPublicView->connect(comboBox,
+                                 SIGNAL(currentIndexChanged(const QString &)),
+                                 mPublicView, SLOT(_q_settingsChanged(const QString &)),
+                                 Qt::UniqueConnection);
+            break;
+        case HbDataFormModelItem::ToggleValueItem:
+            pushButton = static_cast< HbPushButton*>(widget);
+            if (settings->isConnectedToUi())
+            {
+                // need to do a reconnect: disconnect followed by a connect
+                mPublicView->disconnect(pushButton,
+                        SIGNAL(clicked(bool)),
+                        mPublicView,
+                        SLOT(_q_settingsChanged(bool)));
+            }
+            mPublicView->connect(pushButton,
+                                 SIGNAL(clicked(bool)),
+                                 mPublicView, SLOT(_q_settingsChanged(bool)),
+                                 Qt::UniqueConnection);
+            break;
+    }
+    settings->connectToUi();
+}
+
+void JavaApplicationSettingsViewPrivate::netConnSelected(uint aNetConnSelectionStatus)
+{
+    if (aNetConnSelectionStatus == CmApplSettingsUi::ApplSettingsErrorNone)
+    {
+        mNetConnSelection = mNetConnSettingsUi->selection();
+        // store the selection
+        if (mNetConnSelection.id != mNetConn.id
+            && mNetConnSelection.id != mDefaultConnId)
+        {
+            TRAPD(err,
+                switch(mNetConnSelection.result)
+                {
+                    case CmApplSettingsUi::SelectionTypeDestination:
+                        ConnectionManager::setDestinationNetworkIdL(mSuiteUid, mNetConnSelection.id);
+                        break;
+                    case CmApplSettingsUi::SelectionTypeConnectionMethod:
+                        ConnectionManager::setApnIdL(mSuiteUid, mNetConnSelection.id);
+                        break;
+                }
+            );
+            if (err == KErrNone)
+            {
+                mNetConn.id = mNetConnSelection.id;
+                mNetConn.type = mNetConnSelection.result;
+                readNetworkConnectionName();
+                mGeneralSettings[mNetSettIndex].getId()->setContentWidgetData(QString("text"), mNetConn.name);
+                mGeneralSettings[mNetSettIndex].getId()->setContentWidgetData(QString("additionalText"), mNetConn.name);
+            }
+        }
+    }
+}
+
+void JavaApplicationSettingsViewPrivate::securityWarningDismissed(HbAction* aDismissAction)
+{
+    HbMessageBox *dlg = static_cast<HbMessageBox*>(sender());
+    mSecWarningAccepted = (aDismissAction == dlg->actions().at(0));
+    mAsyncToSyncCallEventLoop->exit();
+}
+
+void JavaApplicationSettingsViewPrivate::initNetworkConnection()
+{
+    TRAP_IGNORE(
+        mNetConn.id = ConnectionManager::getDestinationNetworkIdL(mSuiteUid);
+        if (mNetConn.id == (uint)KJavaNetworkAccessNotSpecified)
+        {
+            mNetConn.id = ConnectionManager::getApnIdL(mSuiteUid);
+        }
+    );
+    QNetworkConfigurationManager manager;
+    QNetworkConfiguration defaultCfg = manager.defaultConfiguration();
+    mDefaultConnId = defaultCfg.identifier().toInt();
+    QNetworkConfiguration cfg = manager.configurationFromIdentifier(
+        QString::number(mNetConn.id));
+    if (!cfg.isValid())
+    {
+        cfg = defaultCfg;
+    }
+    mNetConn.name = QString(hbTrId(cfg.name().toUtf8()));
+}
+
+void JavaApplicationSettingsViewPrivate::readNetworkConnectionName()
+{
+    QNetworkConfigurationManager manager;
+    QNetworkConfiguration cfg = manager.configurationFromIdentifier(
+        QString::number(mNetConn.id));
+    if (!cfg.isValid())
+    {
+        cfg = manager.defaultConfiguration();
+    }
+    mNetConn.name = QString(hbTrId(cfg.name().toUtf8()));
+}
+
+JavaApplicationSettings* JavaApplicationSettingsViewPrivate::findSettings(HbWidget* aId)
+{
+    JavaApplicationSettings* settings = findSettings(aId, mGeneralSettings);
+    if (settings == NULL)
+    {
+        settings = findSettings(aId, mSecuritySettings);
+        if (settings == NULL)
+        {
+            settings = findSettings(aId, mExtraSettings);
+        }
+    }
+    return settings;
+}
+
+JavaApplicationSettings* JavaApplicationSettingsViewPrivate::findSettings(HbWidget* aId, QVector<JavaApplicationSettings>& aAllSettings)
+{
+    for (int i=0; i<aAllSettings.size(); i++)
+    {
+        if (itemToWidget(aAllSettings[i].getId()) == aId)
+        {
+            return &aAllSettings[i];
+        }
+    }
+    return NULL;
+}
+
+HbWidget * JavaApplicationSettingsViewPrivate::itemToWidget(const HbDataFormModelItem * aItem)
+{
+    HbDataFormViewItem * viewItem = qobject_cast<HbDataFormViewItem *> (mMainForm->itemByIndex(
+                                        mModel->indexFromItem(aItem)));
+    if (viewItem)
+    {
+        return static_cast<HbWidget*>(viewItem->dataItemContentWidget());
+    }
+    return NULL;
+}
+
+bool JavaApplicationSettingsViewPrivate::isSecurityWarningAccepted(const QString& aText, const QString& aAcceptActionLabel, const QString& aRejectActionLabel, const QString& aHeadingText)
+{
+    HbMessageBox securityWarning(HbMessageBox::MessageTypeQuestion);
+    securityWarning.setDismissPolicy(HbDialog::NoDismiss);
+    securityWarning.setTimeout(HbDialog::NoTimeout);
+    securityWarning.setIconVisible(false);
+    securityWarning.setText(aText);
+    securityWarning.addAction(new HbAction(
+            aAcceptActionLabel, &securityWarning));
+    securityWarning.addAction(new HbAction(
+            aRejectActionLabel, &securityWarning));
+    securityWarning.setHeadingWidget(new HbLabel(aHeadingText));
+    securityWarning.open(this, SLOT(securityWarningDismissed(HbAction*)));
+    mAsyncToSyncCallEventLoop->exec();
+    return mSecWarningAccepted;
+}
+
+void JavaApplicationSettingsViewPrivate::configureList(QList<JavaApplicationSettings*>& aList, const QStringList& aSettingsNames,  const QHash<QString, int>& aSettingsIndexes)
+{
+    for(int i=0; i<aSettingsNames.size(); i++)
+    {
+        if (aSettingsIndexes.contains(aSettingsNames[i]))
+        {
+            aList << &(mExtraSettings[aSettingsIndexes.value(aSettingsNames[i])]);
+        }
+    }
+}
+
+void JavaApplicationSettingsViewPrivate::attachList(const QString& aSettingsName, const QList<JavaApplicationSettings*>& aList, const QHash<QString, int>& aSettingsIndexes, bool aIsHighRiskList)
+{
+    if (aSettingsIndexes.contains(aSettingsName))
+    {
+        if (aIsHighRiskList)
+        {
+            mExtraSettings[aSettingsIndexes.value(aSettingsName)].setHighRiskList(aList);
+        }
+        else
+        {
+            mExtraSettings[aSettingsIndexes.value(aSettingsName)].setMutuallyExclusiveList(aList);
+        }
+    }
+}
+
+void JavaApplicationSettingsViewPrivate::installTranslator(const QString& aTranslationFileName)
+{
+    QTranslator* translator = new QTranslator;
+
+    // load the correct translation of the localized strings for the java settings
+    if (translator->load(
+            aTranslationFileName + "_" + QLocale::system().name(),
+            QLibraryInfo::location(QLibraryInfo::TranslationsPath)))
+    {
+        mTranslators.append(translator);
+        qApp->installTranslator(translator);
+    }
+    else
+    {
+        delete translator;
+        translator = NULL;
+    }
+}
+
+void JavaApplicationSettingsViewPrivate::readFromStorage(JavaApplicationSettings& aSettings)
+{
+    if (aSettings.getColumnName().size() > 0
+            && aSettings.getTableName().size() > 0)
+    {
+        wstring value = L"";
+
+        JavaStorageApplicationEntry_t query;
+        JavaStorageApplicationList_t queryResult;
+        JavaStorageEntry attr;
+        attr.setEntry(ID, mSuiteUid);
+        query.insert(attr);
+        if (aSettings.getFilterColumnName().size() > 0)
+        {
+            attr.setEntry(aSettings.getFilterColumnName(), aSettings.getFilterColumnValue());
+            query.insert(attr);
+        }
+        attr.setEntry(aSettings.getColumnName(), L"");
+        query.insert(attr);
+        if (aSettings.getValuesColumnName().size() > 0)
+        {
+            attr.setEntry(aSettings.getValuesColumnName(), L"");
+            query.insert(attr);
+        }
+
+        try
+        {
+            mStorage->search(aSettings.getTableName(), query, queryResult);
+        }
+        catch (JavaStorageException& aJse)
+        {
+            // Don't leave. Set defaults.
+            ELOG1(EJavaSettings, "Error while reading from storage %S", aJse.toString().c_str());
+        }
+
+        if (aSettings.getValuesColumnName().size() > 0)
+        {
+            findEntry(queryResult, aSettings.getValuesColumnName(), value);
+            if (value.size() > 0)
+            {
+                aSettings.setStorageValuesFilter(value);
+                filterSecuritySettings(aSettings);
+            }
+        }
+
+        value = L"";
+        findEntry(queryResult, aSettings.getColumnName(), value);
+
+        if (value.size() > 0)
+        {
+            vector<wstring> storageValues = aSettings.getStorageValues();
+            for (int i=0; i<storageValues.size(); i++)
+            {
+                if (storageValues[i] == value)
+                {
+                    aSettings.setCurrentValue(i);
+                    break;
+                }
+            }
+            LOG2(EJavaSettings, EInfo,"Setting \"%S\" initialized to \"%S\"", aSettings.getName().toStdWString().c_str(), aSettings.getValue(aSettings.getCurrentValue()).toStdWString().c_str());
+        }
+    }
+}
+
+void JavaApplicationSettingsViewPrivate::filterSecuritySettings(JavaApplicationSettings& aSettings)
+{
+    std::wstring allowedModes = aSettings.getStorageValuesFilter();
+    if (allowedModes.size() <= 0)
+    {
+            return;
+    }
+    // The allowed modes info is stored as a 4-bit constant:
+    //    X(oneshot)X(session)X(blanket)X(no)
+    // e.g. 1011 (=11) means that oneshot, blanket and no are allowed.
+    // The following constants are used to encode/decode the allowed modes
+    // into/from a 4-bit number
+    int INTERACTION_MODE_DENIED = 1;
+    int INTERACTION_MODE_BLANKET = 2;
+    int INTERACTION_MODE_SESSION = 4;
+    int INTERACTION_MODE_ONESHOT = 8;
+    TInt allowedInteractionModes = JavaCommonUtils::wstringToInt(allowedModes);
+    int index = 0;
+    int tmp = allowedInteractionModes & INTERACTION_MODE_ONESHOT;
+    if (tmp <= 0)
+    {
+        aSettings.removeValue(index);
+        index--;
+    }
+    index++;
+    tmp = allowedInteractionModes & INTERACTION_MODE_SESSION;
+    if (tmp <= 0)
+    {
+        aSettings.removeValue(index);
+        index--;
+    }
+    index++;
+    tmp = allowedInteractionModes & INTERACTION_MODE_BLANKET;
+    if (tmp <= 0)
+    {
+        aSettings.removeValue(index);
+        index--;
+    }
+    index++;
+    tmp = allowedInteractionModes & INTERACTION_MODE_DENIED;
+    if (tmp <= 0)
+    {
+        aSettings.removeValue(index);
+    }
+}
+
+void JavaApplicationSettingsViewPrivate::writeToStorage(JavaApplicationSettings& aSettings)
+{
+    if (aSettings.getTableName().size() <= 0
+            || aSettings.getColumnName().size() <= 0)
+    {
+        // storage details are not provided -> no point in going further
+        return;
+    }
+    JavaStorageApplicationEntry_t oldEntry;
+    JavaStorageEntry attr;
+    attr.setEntry(ID, mSuiteUid);
+    oldEntry.insert(attr);
+    JavaStorageApplicationEntry_t entry;
+    if (aSettings.getFilterColumnName().size() > 0)
+    {
+        attr.setEntry(aSettings.getFilterColumnName(), aSettings.getFilterColumnValue());
+        oldEntry.insert(attr);
+    }
+    attr.setEntry(aSettings.getColumnName(), aSettings.getStorageValues()[aSettings.getCurrentValue()]);
+    entry.insert(attr);
+
+    try
+    {
+        mStorage->update(aSettings.getTableName(), entry, oldEntry);
+    }
+    catch (JavaStorageException& aJse)
+    {
+        ELOG1(EJavaSettings, "Error while writing into storage %S", aJse.toString().c_str());
+    }
+    LOG2(EJavaSettings, EInfo,"Setting \"%S\" changed to \"%S\"", aSettings.getName().toStdWString().c_str(), aSettings.getValue(aSettings.getCurrentValue()).toStdWString().c_str());
+
+}
+
+void JavaApplicationSettingsViewPrivate::findEntry(const JavaStorageApplicationList_t& aQueryResult,
+        const std::wstring& aName,
+        std::wstring& aValue)
+{
+    if (aQueryResult.size() > 0)
+    {
+        JavaStorageApplicationEntry_t entry = aQueryResult.front();
+        JavaStorageEntry findPattern;
+        findPattern.setEntry(aName, L"");
+        JavaStorageApplicationEntry_t::const_iterator findIterator =
+            entry.find(findPattern);
+        if (findIterator != entry.end())
+        {
+            aValue = findIterator->entryValue();
+        }
+    }
+}
+
+bool JavaApplicationSettingsViewPrivate::isInStorage(const std::wstring& aColumnName, const std::wstring& aColumnFilterName, const std::wstring& aColumnFilterValue, const std::string& aTableName)
+{
+    wstring value = readFromStorage(aColumnName, aColumnFilterName, aColumnFilterValue, aTableName);
+
+    return (value.size() > 0);
+}
+
+wstring JavaApplicationSettingsViewPrivate::readFromStorage(const std::wstring& aColumnName, const std::wstring& aColumnFilterName, const std::wstring& aColumnFilterValue, const std::string& aTableName)
+{
+    wstring value = L"";
+
+    JavaStorageApplicationEntry_t query;
+    JavaStorageApplicationList_t queryResult;
+    JavaStorageEntry attr;
+    attr.setEntry(ID, mSuiteUid);
+    query.insert(attr);
+    if (aColumnFilterName.size() > 0)
+    {
+        attr.setEntry(aColumnFilterName, aColumnFilterValue);
+        query.insert(attr);
+    }
+    attr.setEntry(aColumnName, L"");
+    query.insert(attr);
+
+    try
+    {
+        mStorage->search(aTableName, query, queryResult);
+    }
+    catch (JavaStorageException& aJse)
+    {
+        // Don't leave. Set defaults.
+    }
+
+    findEntry(queryResult, aColumnName, value);
+
+    return value;
+}
+
+vector<IndexedSettingsName> JavaApplicationSettingsViewPrivate::readFromStorage(const std::wstring& aColumnName, const std::string& aPrimaryTableName, const std::string& aSecondaryTableName)
+{
+    vector<IndexedSettingsName> values;
+
+    JavaStorageApplicationEntry_t query;
+    JavaStorageApplicationList_t queryResult;
+    JavaStorageEntry attr;
+    attr.setEntry(ID, mSuiteUid);
+    query.insert(attr);
+    attr.setEntry(aColumnName, L"");
+    query.insert(attr);
+
+    try
+    {
+        mStorage->search(aPrimaryTableName, query, queryResult);
+
+        JavaStorageApplicationList_t::const_iterator iterator;
+        JavaStorageApplicationList_t secondaryQueryResult;
+        for (iterator = queryResult.begin(); iterator != queryResult.end(); iterator++)
+        {
+            std::wstring name = L"";
+            JavaStorageApplicationEntry_t entry = (*iterator);
+            JavaStorageEntry findPattern;
+            findPattern.setEntry(aColumnName, L"");
+            JavaStorageApplicationEntry_t::const_iterator findIterator =
+                    entry.find(findPattern);
+            if (findIterator != entry.end())
+            {
+                name = findIterator->entryValue();
+            }
+            if (name.size() > 0)
+            {
+                entry.clear();
+                query.clear();
+                attr.setEntry(ID, mSuiteUid);
+                query.insert(attr);
+                attr.setEntry(aColumnName, name);
+                query.insert(attr);
+                secondaryQueryResult.clear();
+                mStorage->search(aSecondaryTableName, query, secondaryQueryResult);
+                if (secondaryQueryResult.size() > 0)
+                {
+                    IndexedSettingsName value;
+                    value.name = name;
+                    value.index = LAST_SETTINGS_INDEX + 1;
+                    if (mSettingsNamesIndexes.contains(QString::fromStdWString(name)))
+                    {
+                        value.index = mSettingsNamesIndexes.value(QString::fromStdWString(name));
+                    }
+                    values.push_back(value);
+                }
+            }
+        }
+    }
+    catch (JavaStorageException& aJse)
+    {
+        // Don't leave. Set defaults.
+    }
+
+    return values;
+}
+
+void JavaApplicationSettingsViewPrivate::readSuiteUid(const QString& aAppUid)
+{
+    mSuiteUid = L"";
+    bool ok;
+    int tmp = aAppUid.toInt( &ok, 10 );
+    if (!ok)
+    {
+        return;
+    }
+    wstring appUid = L"";
+    appUid.append(L"[").append(QString("%1").arg(tmp, 0, 16).toStdWString()).append(L"]");
+
+    JavaStorageApplicationEntry_t query;
+    JavaStorageApplicationList_t queryResult;
+    JavaStorageEntry attr;
+    attr.setEntry(ID, appUid);
+    query.insert(attr);
+    attr.setEntry(PACKAGE_ID, L"");
+    query.insert(attr);
+    try
+    {
+        mStorage->search(APPLICATION_TABLE, query, queryResult);
+    }
+    catch (JavaStorageException& aJse)
+    {
+        // Don't leave. Set defaults.
+        ELOG1(EJavaSettings, "Error while reading from storage %S", aJse.toString().c_str());
+    }
+    findEntry(queryResult, PACKAGE_ID, mSuiteUid);
+}
+
+#include "moc_javaapplicationsettingsview.cpp"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javamanager/javasettings_qt/src/javaapplicationsettingsview_p.h	Wed Aug 18 09:43:15 2010 +0300
@@ -0,0 +1,229 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+#ifndef JAVAAPPLICATIONSETTINGSVIEW_P_H
+#define JAVAAPPLICATIONSETTINGSVIEW_P_H
+
+#include <QVector>
+#include <QList>
+#include <QTranslator>
+#include <QModelIndex>
+#include <QEventLoop>
+#include <memory>
+#include <cmapplsettingsui.h>
+#include "javaapplicationsettings.h"
+#include "javastorage.h"
+
+class HbWidget;
+class HbPushButton;
+class HbDataForm;
+class HbDataFormModel;
+class HbDataFormModelItem;
+class HbAction;
+
+namespace java
+{
+namespace settings
+{
+
+// constants used for retrieving the translations of different texts via hbTrId function
+const char* const ID_BLANKET = "txt_java_sett_setlabel_permission_val_blanket";
+const char* const ID_SESSION = "txt_java_sett_setlabel_permission_val_session";
+const char* const ID_ONESHOT = "txt_java_sett_setlabel_permission_val_oneshot";
+const char* const ID_DENIED = "txt_java_sett_setlabel_permission_val_no";
+const char* const ID_SECURITY_LEVEL = "txt_java_sett_setlabel_security_level";
+const char* const ID_USER_DEFINED = "txt_java_sett_setlabel_security_level_val_user_defined";
+const char* const ID_SENSITIVE_SETTINGS = "txt_java_sett_info_query_perm_sec";
+const char* const ID_SENSITIVE_SETTINGS_NET_USAGE = "txt_java_sett_info_query_perm_net";
+const char* const ID_MUTUALLY_EXCLUSIVE_SETTINGS = "txt_java_sett_info_query_perm_warn";
+const char* const ID_OK = "txt_java_sett_button_settings_ok";
+const char* const ID_CANCEL = "txt_java_sett_button_settings_cancel";
+const char* const ID_SECURITY_WARNING_TITLE = "txt_java_sett_title_note_security_warn";
+const char* const ID_NET_ACCESS = "txt_java_sett_setlabel_net_access";
+const char* const ID_LOW_LEVEL_NET_ACCESS = "txt_java_sett_setlabel_low_level_net_access";
+const char* const ID_NETWORK_CONNECTION = "txt_occ_title_network_connection";
+const char* const ID_SETTINGS_TITLE = "txt_java_sett_title_settings";
+const char* const ID_SETTINGS_NOT_AVAILABLE = "txt_java_sett_info_settings_not_available";
+const char* const ID_GENERAL_GROUP_TITLE = "txt_java_sett_subtitle_general";
+const char* const ID_SECURITY_GROUP_TITLE = "txt_java_sett_subtitle_security";
+const char* const ID_OSK_NO = "txt_java_sett_setlabel_osk_val_no";
+const char* const ID_OSK_GAME = "txt_java_sett_setlabel_osk_val_game";
+const char* const ID_OSK_NAVIGATION = "txt_java_sett_setlabel_osk_val_navigation";
+const char* const ID_OSK = "txt_java_sett_setlabel_osk";
+const char* const ID_SECURITY_LEVEL_DEFAULT = "txt_java_sett_setlabel_security_level_val_default";
+const char* const ID_MESSAGING = "txt_java_sett_setlabel_messaging";
+const char* const ID_RESTRICTED_MESSAGING = "txt_java_sett_setlabel_restricted_messaging";
+const char* const ID_CALL_CONTROL = "txt_java_sett_setlabel_call_control";
+const char* const ID_LOCAL_CONNECTIVITY = "txt_java_sett_setlabel_local_conn";
+const char* const ID_MULTIMEDIA_RECORDING = "txt_java_sett_setlabel_mm_record";
+const char* const ID_WRITE_USER_DATA_ACCESS = "txt_java_sett_setlabel_write_data";
+const char* const ID_READ_USER_DATA_ACCESS = "txt_java_sett_setlabel_read_data";
+const char* const ID_LOCATION = "txt_java_sett_setlabel_location";
+const char* const ID_LANDMARK = "txt_java_sett_setlabel_landmarks";
+const char* const ID_AUTHENTICATION = "txt_java_sett_setlabel_auth";
+const char* const ID_SMART_CARD_COMMUNICATION = "txt_java_sett_setlabel_smartcard";
+const char* const ID_APPLICATION_AUTO_INVOCATION = "txt_java_sett_setlabel_app_auto_invoc";
+const char* const ID_BROADCAST = "txt_java_sett_setlabel_broadcast";
+const char* const ID_NFC_WRITE_ACCESS = "txt_java_sett_setlabel_nfc_write_access";
+const char* const ID_URL_START = "txt_java_sett_setlabel_url_start";
+
+class JavaApplicationSettingsView;
+
+// this structures are used for ensuring the settings are always
+// displayed in same order: each setting has associated an index
+// - the lower the index is the higher in the list the setting is
+// displayed
+enum SettingsIndexes
+{
+    NET_ACCESS_SETTINGS_INDEX,
+    LOW_LEVEL_NET_ACCESS_SETTINGS_INDEX,
+    MESSAGING_SETTINGS_INDEX,
+    RESTRICTED_MESSAGING_SETTINGS_INDEX,
+    CALL_CONTROL_SETTINGS_INDEX,
+    LOCAL_CONNECTIVITY_SETTINGS_INDEX,
+    MULTIMEDIA_RECORDING_SETTINGS_INDEX,
+    WRITE_USER_DATA_ACCESS_SETTINGS_INDEX,
+    READ_USER_DATA_ACCESS_SETTINGS_INDEX,
+    LOCATION_SETTINGS_INDEX,
+    LANDMARK_SETTINGS_INDEX,
+    AUTHENTICATION_SETTINGS_INDEX,
+    SMART_CARD_COMMUNICATION_SETTINGS_INDEX,
+    APPLICATION_AUTO_INVOCATION_SETTINGS_INDEX,
+    BROADCAST_SETTINGS_INDEX,
+    NFC_WRITE_ACCESS_SETTINGS_INDEX,
+    URL_START_SETTINGS_INDEX,
+    LAST_SETTINGS_INDEX,
+};
+struct IndexedSettingsName
+{
+    std::wstring name;
+    int index;
+};
+struct AscendingSort
+{
+    bool operator()(const IndexedSettingsName& i1, const IndexedSettingsName& i2)
+    {
+        return i1.index < i2.index;
+    }
+};
+
+/**
+ * The Ui is build around the Orbit's HbDataForm, with one group for the general settings
+ * (including network settings and On screen keypad settings) and another group for
+ * security settings (including the security warnings mode and the actual security settings).
+ * The items inside the group are either of type tooglebutton (network settings and security
+ * warnings mode) or of type combobox. When the plugin is instantiated the two groups are
+ * created and the settings are read from storage. When the plugin receives an initialization
+ * signal the HbDataModel's  (associated to the main HbDataForm) itemShown signal is connected
+ * to the plugin's slot _q_dataItemDisplayed. While the groups become visible they are populated
+ * with dataitems of either type tooglebutton or combobox. After being added to their parent's
+ * group the dataitems's currentIndexChanged signal is connected to the plugin's _q_settingsChanged
+ * slot where the settings changes are handled.
+ */
+class JavaApplicationSettingsViewPrivate: public QObject
+{
+    Q_OBJECT
+
+public:
+    JavaApplicationSettingsViewPrivate(const QString& aJavaAppUid);
+    virtual ~JavaApplicationSettingsViewPrivate();
+    void init(JavaApplicationSettingsView* aPublicView);
+
+    // slots
+    void _q_settingsChanged(const QString& aNewValue);
+    void _q_settingsChanged(bool aNewValue);
+    void _q_dataItemDisplayed(const QModelIndex aDataItemIndex);
+
+private slots:
+    void netConnSelected(uint aNetConnSelectionStatus);
+    void securityWarningDismissed(HbAction* aDismissAction);
+
+private:
+    void init();
+    void initGeneralSettings();
+    void initSecuritySettings();
+    void readAllSettings();
+    void initSettings(QVector<JavaApplicationSettings>& aSettings, HbDataFormModelItem * aParent);
+    void writeSettings(JavaApplicationSettings& aSettings, const QString &aNewValue);
+    void securityWarningsChanged(const QString& aNewValue);
+    bool isBlanketAllowed(const JavaApplicationSettings& aSettings);
+    HbWidget * itemToWidget(const HbDataFormModelItem * aItem);
+    JavaApplicationSettings* findSettings(HbWidget* aId);
+    JavaApplicationSettings* findSettings(HbWidget* aId, QVector<JavaApplicationSettings>& aAllSettings);
+    void readFromStorage(JavaApplicationSettings& aSettings);
+    void writeToStorage(JavaApplicationSettings& aSettings);
+    bool isInStorage(const std::wstring& aColumnName, const std::wstring& aColumnFilterName, const std::wstring& aColumnFilterValue, const std::string& aTableName);
+    std::wstring readFromStorage(const std::wstring& aColumnName, const std::wstring& aColumnFilterName, const std::wstring& aColumnFilterValue, const std::string& aTableName);
+    std::vector<IndexedSettingsName> readFromStorage(const std::wstring& aColumnName, const std::string& aPrimaryTableName, const std::string& aSecondaryTableName);
+    void filterSecuritySettings(JavaApplicationSettings& aSettings);
+    void findEntry(const java::storage::JavaStorageApplicationList_t& aQueryResult, const std::wstring& aName, std::wstring& aValue);
+    void readSuiteUid(const QString& aAppUid);
+    bool isSecurityWarningAccepted(const QString& aText, const QString& aAcceptActionLabel, const QString& aRejectActionLabel, const QString& aHeadingText);
+    void handleNetworkSettings();
+    void readNetworkConnectionName();
+    void initNetworkConnection();
+    void configureList(QList<JavaApplicationSettings*>& aList, const QStringList& aSettingsNames,  const QHash<QString, int>& aSettingsIndexes);
+    void attachList(const QString& aSettingsName, const QList<JavaApplicationSettings*>& aList, const QHash<QString, int>& aSettingsIndexes, bool isHighRiskList = true);
+    void configureLists();
+    void installTranslator(const QString& aTranslationFileName);
+
+private:
+    HbDataForm * mMainForm;
+    HbDataFormModel *mModel;
+    HbDataFormModelItem * mGeneralSettingsGroup;
+    HbDataFormModelItem * mSecuritySettingsGroup;
+    QVector<JavaApplicationSettings> mGeneralSettings;
+    QVector<JavaApplicationSettings> mSecuritySettings;
+    QVector<JavaApplicationSettings> mExtraSettings;
+    JavaApplicationSettingsView* mPublicView;
+    std::auto_ptr<java::storage::JavaStorage> mStorage;
+    std::wstring mSuiteUid;
+    // licalized strings used more than once: the translation is
+    // retrieved only once
+    QString TXT_BLANKET,TXT_SESSION,TXT_ONESHOT,TXT_DENIED,TXT_SECURITY_LEVEL,TXT_USER_DEFINED,TXT_SENSITIVE_SETTINGS,TXT_SENSITIVE_SETTINGS_NET_USAGE,TXT_MUTUALLY_EXCLUSIVE_SETTINGS,TXT_OK,TXT_CANCEL,TXT_SECURITY_WARNING_TITLE,TXT_NET_ACCESS,TXT_LOW_LEVEL_NET_ACCESS,TXT_NETWORK_CONNECTION,TXT_NETWORK_CONNECTION_CHANGE,TXT_SETTINGS_TITLE,TXT_SETTINGS_NOT_AVAILABLE;
+    CmApplSettingsUi* mNetConnSettingsUi;
+    CmApplSettingsUi::SettingSelection mNetConnSelection;
+    JavaApplicationSettings::NetworkConnection mNetConn;
+    int mNetSettIndex;
+    // own event loop used for "translating" asynchronous calls into
+    // synchronous calls
+    QEventLoop* mAsyncToSyncCallEventLoop;
+    // boolean for carying the user's input in between two async calls
+    bool mSecWarningAccepted;
+    // the default network connection used if user did not specify one
+    // or the user specified network connection became invalid
+    // (e.g. after removing the user defined snap)
+    int mDefaultConnId;
+    // list of installed translators: settings view uses own
+    // translator ("javaruntimeapplicationsettings")
+    // and for network settings it uses the cmmanager's translators:
+    // "cmapplsettingsui" and "cmmanager"
+    QList<QTranslator *> mTranslators;
+    QHash<QString, QString> mLocalizedSettingsNames;
+    // hash for associating settings names with indexes within
+    // vectors (mGeneralSettings, mSecuritySettings)
+    QHash<QString, int> mSettingsIndexes;
+    // hash for associating settings names with display indexes:
+    // a settings with lower index is shown before a settings
+    // with a higher index
+    QHash<QString, int> mSettingsNamesIndexes;
+};
+
+} // namespace settings
+} // namespace java
+
+
+#endif // JAVAAPPLICATIONSETTINGSVIEW_P_H
--- a/javamanager/preinstaller/src.s60/silentmidletinstall.cpp	Tue Jul 06 14:10:26 2010 +0300
+++ b/javamanager/preinstaller/src.s60/silentmidletinstall.cpp	Wed Aug 18 09:43:15 2010 +0300
@@ -449,7 +449,7 @@
         LOG1WSTR(EJavaPreinstaller, EInfo,
                  "CSilentMIDletInstall::GetDirEntriesL Adding file %s",
                  (wchar_t *)(pathPtr.PtrZ()));
-        aVector.Append(path);
+        aVector.AppendL(path);
         CleanupStack::Pop(path);
     }
 
--- a/javamanager/subsystem.mk	Tue Jul 06 14:10:26 2010 +0300
+++ b/javamanager/subsystem.mk	Wed Aug 18 09:43:15 2010 +0300
@@ -21,17 +21,16 @@
 	javainstaller \
 	javaregistry \
 	javabackup \
-	javasettings
+	javasettings 
 
 COMPONENTS = \
 	preinstaller/build \
 	debugapi/build \
 	javalauncher/build \
-	javaupgradeapp/build
-
+	javaupgradeapp/build 
+    
 NONQTSUBSYSTEMS = \
-	javarecognizer/build \
-	javaappschemeplugin/build
+	javarecognizer/build 
 
 SYMBIAN_ONLY = \
 	javaregistry \
@@ -40,13 +39,20 @@
 	javabackup \
 	javarecognizer/build \
 	preinstaller/build \
-	debugapi/build \
-	javaappschemeplugin/build
+	debugapi/build 
 
 ifndef RD_JAVA_S60_RELEASE_10_1_ONWARDS    
-NONQTSUBSYSTEMS += javasidchecker/build
-SYMBIAN_ONLY += javasidchecker/build
+NONQTSUBSYSTEMS += javasidchecker/build javaappschemeplugin/build 
+SYMBIAN_ONLY += javasidchecker/build javaappschemeplugin/build 
 javasidchecker/build : javaregistry
+else
+COMPONENTS += javaappscheme/build javaqtrequest/build 
+SYMBIAN_ONLY += javaappscheme/build javaqtrequest/build 
+endif
+
+ifdef RD_JAVA_APPLICATION_SETTINGS_QT
+COMPONENTS += javasettings_qt/build 
+SYMBIAN_ONLY += javasettings_qt/build 
 endif
 
 # Declare that release preparation removes subdirectories not in build, except
--- a/javaruntimes/installer/starterdll/src/main.cpp	Tue Jul 06 14:10:26 2010 +0300
+++ b/javaruntimes/installer/starterdll/src/main.cpp	Wed Aug 18 09:43:15 2010 +0300
@@ -149,6 +149,15 @@
         return INSTALLER_ALREADY_RUNNING;
     }
 
+    // Check whether executing this process during first boot.
+    ret = JavaCommonUtils::initIsFirstBoot();
+    if (0 != ret)
+    {
+        ELOG1(EJavaRuntime, 
+            "INSTALLER main() Cannot create first_boot_done.dat flag file, errno.h err %d",
+            ret);
+    }
+
     int result = -1;
     try
     {
@@ -348,6 +357,12 @@
     const int oldHeapSize = 512;
     jvm->overrideOldHeapSize(oldHeapSize);
 
+#ifdef __WINSCW__
+    // Setting smaller max heap in the emulator.
+    const int maxHeapSize = 8 * 1024; // 8 MB
+    jvm->overrideMaxHeapSize(maxHeapSize);
+#endif  // __WINSCW__
+
     jvm->enableThreadDumping();
 
     jvm->setMainClass(INSTALLER_MAIN_CLASS);
@@ -371,7 +386,7 @@
         L"com.nokia.mj.impl.installer.ui.eswt2.InstallerRuntimeUi");
 #ifdef __SYMBIAN32__
 #ifndef __WINS__
-    jvm->appendSystemProperty(L"-Dcom.nokia.mj.impl.installer.ui.disableui=1");
+    //jvm->appendSystemProperty(L"-Dcom.nokia.mj.impl.installer.ui.disableui=1");
 #endif //__WINS__
 #endif // __SYMBIAN32__
 #else // RD_JAVA_S60_RELEASE_10_1_ONWARDS
--- a/javaruntimes/javaruntimes.pro	Tue Jul 06 14:10:26 2010 +0300
+++ b/javaruntimes/javaruntimes.pro	Wed Aug 18 09:43:15 2010 +0300
@@ -19,6 +19,7 @@
 SUBDIRS += installer/starterdll/build/javainstallerstarter.pro 
 SUBDIRS += installer/starterexe/build/javainstaller.pro 
 SUBDIRS += jvmargmodifier/file/build/javajvmargsmodifierfile.pro 
+SUBDIRS += standalone/build/javastarter.pro 
 SUBDIRS += starter/build/javamidp.pro 
 SUBDIRS += midp 
 BLD_INF_RULES.prj_extensions += "prj_extensions" 
--- a/javaruntimes/midp/runtime/build/build.xml	Tue Jul 06 14:10:26 2010 +0300
+++ b/javaruntimes/midp/runtime/build/build.xml	Wed Aug 18 09:43:15 2010 +0300
@@ -33,7 +33,6 @@
 
   <target name="system.properties">
       <properties>
-          microedition.hostname=localhost
           microedition.jtwi.version=1.0
           microedition.msa.version=1.1-SUBSET
           microedition.profiles=MIDP-2.1
--- a/javaruntimes/midp/runtime/javasrc/com/nokia/mj/impl/rt/midp/StorageAccessor.java	Tue Jul 06 14:10:26 2010 +0300
+++ b/javaruntimes/midp/runtime/javasrc/com/nokia/mj/impl/rt/midp/StorageAccessor.java	Wed Aug 18 09:43:15 2010 +0300
@@ -198,7 +198,6 @@
                         }
                         catch (NumberFormatException ne) 
                         {
-                            Log.logW("Error in getting localized name: " + nameStr, ne);
                         }
                     }
                 }
--- a/javaruntimes/midp/runtime/src.s60/platformrequesthandler.cpp	Tue Jul 06 14:10:26 2010 +0300
+++ b/javaruntimes/midp/runtime/src.s60/platformrequesthandler.cpp	Wed Aug 18 09:43:15 2010 +0300
@@ -18,9 +18,7 @@
 
 #include <memory>
 
-#ifdef RD_JAVA_S60_RELEASE_10_1_ONWARDS
-#include <SchemeHandler.h>
-#else
+#ifndef RD_JAVA_S60_RELEASE_10_1_ONWARDS
 #include <schemehandler.h>
 #endif
 
@@ -68,7 +66,7 @@
 void PlatformRequestHandler::handleUri(const std::wstring& aUri)
 {
     JELOG2(EJavaRuntime);
-    TRAPD(err,launchAppL(aUri););
+    TRAPD(err, launchAppL(aUri));
     if (err != KErrNone)
     {
         ELOG1(EJavaRuntime, "ERROR!!! PlatformRequestHandler::handleUri() %d",
@@ -76,8 +74,8 @@
         if (KErrNotFound == err)
         {
             if ((aUri.find(L"localapp:jam/launch?") == 0) ||
-                    (aUri.find(L"localapp://jam/launch?") == 0) ||
-                    (aUri.find(L"javaapp:") == 0))
+                (aUri.find(L"localapp://jam/launch?") == 0) ||
+                (aUri.find(L"javaapp:") == 0))
             {
                 // The URI is supported but the MIDlet specified by the URI
                 // does not exist.
@@ -112,9 +110,71 @@
     }
     else
     {
+#ifdef RD_JAVA_S60_RELEASE_10_1_ONWARDS
+        std::wstring uri;
+        std::wstring okScheme(L"javaapp:");
+        if (aUri.find(L"localapp:jam/launch?") == 0)
+        {
+            // Remove the scheme not supported by the devices in 10.1 from the
+            // beginning, replace it with okScheme that is supported
+            uri = okScheme;
+            uri += aUri.substr(20);  // 20 == wstrlen(L"localapp:jam/launch?")
+        }
+        else if (aUri.find(L"localapp://jam/launch?") == 0)
+        {
+            uri = okScheme;
+            uri += aUri.substr(22);  // 22 == wstrlen(L"localapp://jam/launch?")
+        }
+        else if (aUri.find(L"javaapp://") == 0)
+        {
+            // TODO: after QtHighway has been fixed to that
+            // it can recognize "javaapp://" scheme, remove this.
+            // At 2010wk26 it recognizes only "javaapp:"
+            uri = okScheme;
+            uri += aUri.substr(10);  // 10 == wstrlen(L"javaapp://")
+        }
+        else
+        {
+            uri = aUri;
+        }
+        LOG1(EJavaRuntime, EInfo, "Platform request. Converted uri: %S", uri.c_str());
+
+        TPtrC ptr((const TUint16 *)uri.c_str(), uri.length());
+        // Start javaqtrequest.exe so that url is command line argument.
+        // javaqtrequest is a Qt application that will use Qt Highway API
+        // to send the url request to correct XQServiceProvider
+        _LIT(KJavaQtRequestExe, "javaqtrequest.exe");
+        RProcess rProcess;
+        TInt err = rProcess.Create(KJavaQtRequestExe, ptr);
+        if (KErrNone != err)
+        {
+            ELOG1(EJavaRuntime,
+                "PlatformRequestHandler: launchAppL: Starting javaqtrequest.exe failed, err %d",
+                err);
+            User::Leave(err);
+        }
+
+        // Wait until javaqtrequest exits
+        TRequestStatus status;
+        rProcess.Logon(status);
+        rProcess.Resume();
+        User::WaitForRequest(status);
+
+        // Check the exit code of javaqtrequest
+        err = status.Int();
+        rProcess.Close();
+        if (err != KErrNone)
+        {
+            ELOG1(EJavaRuntime,
+                "PlatformRequestHandler: launchAppL: javaqtrequest.exe exited with err %d",
+                err);
+            User::Leave(err);
+        }
+#else
         TPtrC ptr((const TUint16 *)aUri.c_str(), aUri.length());
         std::auto_ptr<CSchemeHandler> schemeHandler(CSchemeHandler::NewL(ptr));
         schemeHandler->HandleUrlStandaloneL(); // Process Uri in standalone mode.
+#endif
     }
 }
 
--- a/javaruntimes/midp/runtimestarter/src/midpruntimestarter.cpp	Tue Jul 06 14:10:26 2010 +0300
+++ b/javaruntimes/midp/runtimestarter/src/midpruntimestarter.cpp	Wed Aug 18 09:43:15 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
 * All rights reserved.
 * This component and the accompanying materials are made available
 * under the terms of "Eclipse Public License v1.0"
@@ -397,36 +397,36 @@
             LOG(EJavaRuntime, EInfo, "Nokia-MIDlet-App-Orientation not defined");
         }
 
-        // Check if the MIDlet has defined the MIDlet-Splash-Screen-Image
+        // Check if the MIDlet has defined the Nokia-MIDlet-Splash-Screen-Image
         // JAD attribute.
         std::auto_ptr<std::wstring> splashScreen
         (getMidletAttributeFromStorage(*javaStorage.get(),
-                                       L"MIDlet-Splash-Screen-Image"));
+                                       L"Nokia-MIDlet-Splash-Screen-Image"));
         if (splashScreen.get() != 0)
         {
             std::transform(splashScreen->begin(), splashScreen->end(),
                            splashScreen->begin(), tolower);
             if (*splashScreen == L"suppress")
             {
-                // If MIDlet-Splash-Screen-Image JAD attribute is suppress then
+                // If Nokia-MIDlet-Splash-Screen-Image JAD attribute is suppress then
                 // we start the UI into background.
-                LOG(EJavaRuntime, EInfo, "MIDlet-Splash-Screen-Image is suppress");
+                LOG(EJavaRuntime, EInfo, "Nokia-MIDlet-Splash-Screen-Image is suppress");
                 uiParams.setScreenMode(NO_START_SCREEN);
                 uiParams.setBackgroundStart(true);
             }
             else
             {
-                // If MIDlet-Splash-Screen-Image JAD attribute is not suppress then
+                // If Nokia-MIDlet-Splash-Screen-Image JAD attribute is not suppress then
                 // we need to solve the root path of the MIDlet and provide that
                 // to the coreUI.
                 uiParams.setScreenMode(MIDLET_DEFINED_SCREEN);
-                LOG1(EJavaRuntime, EInfo, "MIDlet-Splash-Screen-Image, setPath to %S",
+                LOG1(EJavaRuntime, EInfo, "Nokia-MIDlet-Splash-Screen-Image, setPath to %S",
                      mMidletInfo->mMIDletRootPath.c_str());
             }
         }
         else
         {
-            LOG(EJavaRuntime, EInfo, "MIDlet-Splash-Screen-Image not defined");
+            LOG(EJavaRuntime, EInfo, "Nokia-MIDlet-Splash-Screen-Image not defined");
             uiParams.setScreenMode(DEFAULT_START_SCREEN);
         }
 
--- a/javaruntimes/starter/build/javamidp.pro	Tue Jul 06 14:10:26 2010 +0300
+++ b/javaruntimes/starter/build/javamidp.pro	Wed Aug 18 09:43:15 2010 +0300
@@ -31,8 +31,6 @@
     TARGET.EPOCSTACKSIZE = 16384
 }
 
-    TARGET.EPOCHEAPSIZE = 0x00001000 0x02000000
-
     TARGET.UID2 = 0x102033E6
     TARGET.UID3 = 0x102033E6
 
@@ -44,5 +42,11 @@
         ReadDeviceData ReadUserData WriteUserData UserEnvironment  \
         SwEvent Location MultiMediaDD NetworkControl TrustedUI
 }
+# For wins the max heap is 16 MB and for arm it is 64 MB
+MMP_RULES += "$${LITERAL_HASH}ifdef WINSCW"
+MMP_RULES += "EPOCHEAPSIZE        0x00001000 0x01000000"
+MMP_RULES += "$${LITERAL_HASH}else // WINSCW"
+MMP_RULES += "EPOCHEAPSIZE        0x00001000 0x04000000"
+MMP_RULES += "$${LITERAL_HASH}endif // WINSCW"
 
 include(../../../build/omj.pri)
--- a/javaruntimes/starterutils/build/exports.inf	Tue Jul 06 14:10:26 2010 +0300
+++ b/javaruntimes/starterutils/build/exports.inf	Wed Aug 18 09:43:15 2010 +0300
@@ -11,7 +11,7 @@
 *
 * Contributors:
 *
-* Description: 
+* Description:
 *
 */
 
@@ -19,3 +19,7 @@
 
 ../inc/jvmstarter.h             |../../../javaruntimes/inc/jvmstarter.h
 ../inc/runtimestarterutils.h    |../../../javaruntimes/inc/runtimestarterutils.h
+
+#ifdef RD_JAVA_SYMBIAN_TARGET
+../src.s60/javaruntimeprivatecrkeys.h |../../../inc/javaruntimeprivatecrkeys.h
+#endif
\ No newline at end of file
--- a/javaruntimes/starterutils/inc/jvmstarter.h	Tue Jul 06 14:10:26 2010 +0300
+++ b/javaruntimes/starterutils/inc/jvmstarter.h	Wed Aug 18 09:43:15 2010 +0300
@@ -258,6 +258,13 @@
     virtual void overrideNewHeapSize(int heapSize) = 0;
 
     /**
+     * Overrides the default max heap size.
+     * @param heapSize Heap size in kilo bytes.
+     * @throws std::exception on error cases
+     */
+    virtual void overrideMaxHeapSize(int heapSize) = 0;
+
+    /**
      * Overrides the default stack of the native thread.
      *
      * @param stackSize Stack size in kilo bytes.
--- a/javaruntimes/starterutils/src.s60/j9starters60.cpp	Tue Jul 06 14:10:26 2010 +0300
+++ b/javaruntimes/starterutils/src.s60/j9starters60.cpp	Wed Aug 18 09:43:15 2010 +0300
@@ -129,8 +129,15 @@
     mJvmArgs.push_back(L"-Xmine16K"); // Minimum size for heap expansion.
     mJvmArgs.push_back(L"-Xmns64K");  // Initial new space size. Keep this in sync with MemoryLogger.java
     mJvmArgs.push_back(L"-Xmos64K");  // Initial old space size. Keep this in sync with MemoryLogger.java
+
+#ifdef __WINSCW__
     mJvmArgs.push_back(L"-Xmox16M");  // Maximum old space size.
     mJvmArgs.push_back(L"-Xmx16M");   // Memory maximum.
+#else // __WINSCW__
+    mJvmArgs.push_back(L"-Xmox64M");  // Maximum old space size.
+    mJvmArgs.push_back(L"-Xmx64M");   // Memory maximum.
+#endif  // __WINSCW__
+
     mJvmArgs.push_back(L"-Xmco16k");  // ROM class segment increment.
     mJvmArgs.push_back(L"-Xmr1k");    // Remembered set size.
 
@@ -165,6 +172,24 @@
     mJvmArgs.push_back(oldSpace);
 }
 
+
+void J9StarterS60::overrideMaxHeapSize(int heapSize)
+{
+    JELOG2(EJavaRuntime);
+    std::wstring heapAsString(JavaCommonUtils::intToWstring(heapSize));
+    doOverideHeap(L"-Xmox", heapAsString);
+    doOverideHeap(L"-Xmx", heapAsString);
+}
+
+void J9StarterS60::doOverideHeap(const std::wstring& arg, const std::wstring& size)
+{
+    JELOG2(EJavaRuntime);
+	std::wstring maxHeapArg(arg);
+    maxHeapArg += size;
+    maxHeapArg += L"K";
+    mJvmArgs.push_back(maxHeapArg);
+}
+
 void J9StarterS60::overrideNewHeapSize(int heapSize)
 {
     JELOG2(EJavaRuntime);
--- a/javaruntimes/starterutils/src.s60/j9starters60.h	Tue Jul 06 14:10:26 2010 +0300
+++ b/javaruntimes/starterutils/src.s60/j9starters60.h	Wed Aug 18 09:43:15 2010 +0300
@@ -74,6 +74,11 @@
     /**
      * @see jvmstarter.h
      */
+    virtual void overrideMaxHeapSize(int heapSize);
+
+    /**
+     * @see jvmstarter.h
+     */
     virtual void overrideNativeStackSize(int stackSize);
 
     /**
@@ -106,6 +111,15 @@
      * @param odcFile Th ODC file to be appended.
      */
     void appendOdcFile(const std::wstring& odcFile);
+        
+    /**
+     * Internal utility for setting max heap sizes in kB. Used to
+	 * set -Xmx and -Xmox vm args.
+	 * @param arg String containing either -Xmx or -Xmox (not checked).
+	 * @param size Size of the heap as string in kilo bytes.
+     */
+    void doOverideHeap(const std::wstring& arg, const std::wstring& size);
+
 
 #ifdef __WINSCW__ // codescanner::ifpreprocessor
     /**
--- a/javaruntimes/subsystem.mk	Tue Jul 06 14:10:26 2010 +0300
+++ b/javaruntimes/subsystem.mk	Wed Aug 18 09:43:15 2010 +0300
@@ -26,7 +26,8 @@
 	installer/starterexe/build \
 	jvmargmodifier/default/build \
 	jvmargmodifier/file/build \
-	starterutils/build
+	starterutils/build \
+	standalone/build \
 
 ifdef RD_JAVA_S60_RELEASE_5_0_IAD
 	COMPONENTS += starter/build.iad
@@ -37,5 +38,6 @@
 starterutils/build: jvmargmodifier/default/build
 midp: starterutils/build
 installer/starterdll/build: starterutils/build
+standalone/build: starterutils/build
 
 include ${JAVA_SRC_ROOT}/build/Makefile.subsystem
--- a/javatools/tckrunner/starter/src/main.cpp	Tue Jul 06 14:10:26 2010 +0300
+++ b/javatools/tckrunner/starter/src/main.cpp	Wed Aug 18 09:43:15 2010 +0300
@@ -92,6 +92,12 @@
     // starterUtils->enableDevelopmentFeatures(*jvm.get());
     // jvm->enableThreadDumping();
 
+#ifdef __WINSCW__
+    // Setting smaller max heap in the emulator.
+    const int maxHeapSize = 2 * 1024; // 2 MB
+    jvm->overrideMaxHeapSize(maxHeapSize);
+#endif  // __WINSCW__
+
     jvm->appendSystemProperty(L"-Dcom.nokia.rt.port=tckrunner");
 
     jvm->setMainClass(TCK_RUNNER_MAIN_CLASS);
--- a/javauis/amms_qt/build/build.xml	Tue Jul 06 14:10:26 2010 +0300
+++ b/javauis/amms_qt/build/build.xml	Wed Aug 18 09:43:15 2010 +0300
@@ -23,15 +23,6 @@
   <!--property name="java.src.paths" value="../javasrc:../src_tuner/javasrc"/-->
   <property name="java.src.paths" value="../javasrc"/>
 
-  <!-- Needed by the utilities.xml. See the description form the utilities.xml
-       file -->
-
-  <target name="compile">
-              <omj.javac classpath="${compile.result.root}/javamobilemedia/classes/first:${compile.result.root}/javautils/classes/first"/>
-  </target>
-
-  <!-- Needed by the utilities.xml. See the description form the utilities.xml
-       file -->
   <property name="javah.classnames" 
             value="com.nokia.amms.control.audioeffect.EqualizerControl,
                    com.nokia.amms.control.audioeffect.ReverbControl,
--- a/javauis/amms_qt/src_tuner/javasrc/com/nokia/amms/control/tuner/TunerControlImpl.java	Tue Jul 06 14:10:26 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,548 +0,0 @@
-/*
-* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:  This class implements
- *                javax.microedition.amms.control.tuner.TunerControl
- *
-*/
-
-
-package com.nokia.amms.control.tuner;
-
-import javax.microedition.media.MediaException;
-import javax.microedition.media.Control;
-import com.nokia.microedition.media.InternalPlayer;
-import com.nokia.microedition.media.PlayerImpl;
-import com.nokia.microedition.media.Locator;
-import com.nokia.microedition.media.ManagerImpl;
-import com.nokia.microedition.media.control.ControlImpl;
-import com.nokia.mj.impl.rt.legacy.NativeError;
-
-public class TunerControlImpl
-        extends ControlImpl
-        implements javax.microedition.amms.control.tuner.TunerControl
-{
-    //preset name max length
-    private static final int MAX_PRESET_NAME_LENGTH = 100;
-    //max number of presets
-    private static final int MAX_NUMBER_OF_PRESETS = 20;
-    //all frequencys are in 100 Hertzs
-    private static final int HERTZ_MULTIPLIER = 100;
-
-    /**
-     * Constructor
-     */
-    public TunerControlImpl()
-    {
-        //JDEBUG( "AMMS TunerControlImpl Constructor" );
-    }
-
-    /**
-     * Gets the minimum frequency supported by this tuner
-     * with the given modulation.
-     *
-     * @param modulation The modulation whose supported minimum frequency
-     * is asked.
-     * @return The minimum frequency in 100 Hertzs.
-     * @throws IllegalArgumentException if the <code>modulation</code> is not supported or it is null.
-     */
-    public int getMinFreq(String aModulation)
-    {
-        if (aModulation != MODULATION_FM)
-        {
-            throw new IllegalArgumentException("Modulation is not valid.");
-        }
-
-        int minFreq = _getMinFreq(iEventSource,
-                                  iControlHandle);
-
-        NativeError.check(minFreq);
-
-        return minFreq / HERTZ_MULTIPLIER;
-    }
-
-    /**
-     * Gets the maximum frequency supported by this tuner
-     * with the given modulation.
-     *
-     * @param modulation The modulation whose supported maximum frequency
-     * is asked.
-     * @return The maximum frequency in 100 Hertzs.
-     * @throws IllegalArgumentException if the <code>modulation</code> is not supported or it is null.
-     */
-    public int getMaxFreq(String aModulation)
-    {
-        if (aModulation != MODULATION_FM)
-        {
-            throw new IllegalArgumentException("Modulation is not valid.");
-        }
-
-        int maxFreq = _getMaxFreq(iEventSource,
-                                  iControlHandle);
-
-        NativeError.check(maxFreq);
-
-        return maxFreq / HERTZ_MULTIPLIER;
-    }
-
-    /**
-     * Tunes to the given frequency or to the closest supported frequency.
-     *
-     * @param freq The frequency in 100 Hertzs that will be taken into use.
-     * If that frequency is not supported, the closest supported
-     * frequency will be taken into use.
-     *
-     * @param modulation The modulation to be used. <code>TunerControl</code> specifies
-     * predefined constants <code>MODULATION_FM</code> and <code>MODULATION_AM</code>
-     * but other modulations can be supported as well. Supported modulations can be queried
-     * by <code>System</code> property <code>tuner.modulations</code>.
-     *
-     * @throws IllegalArgumentException if <code>freq</code> is not inside the frequency band supported
-     * by the device or if the <code>modulation</code> is not supported or the <code>modulation</code> is null.
-     *
-     * @return the frequency in 100 Hertzs that was taken into use.
-     */
-    public int setFrequency(int aFreq, String aModulation)
-    {
-        if (aModulation != MODULATION_FM)
-        {
-            throw new IllegalArgumentException("Modulation is not valid.");
-        }
-
-        int freqInUse = _setFrequency(iEventSource,
-                                      iControlHandle,
-                                      aFreq * HERTZ_MULTIPLIER);
-
-        NativeError.check(freqInUse);
-
-        return freqInUse / HERTZ_MULTIPLIER;
-    }
-
-    /**
-     * Gets the frequency which the tuner has been tuned to.
-     *
-     * @return The frequency to which the device has been tuned, in 100 Hertzs.
-     */
-    public int getFrequency()
-    {
-        int freq = _getFrequency(iEventSource, iControlHandle);
-
-        NativeError.check(freq);
-
-        return freq / HERTZ_MULTIPLIER;
-    }
-
-    /**
-     * <p>Seeks for the next broadcast signal. If the end of the Player's
-     * frequency band is reached before a signal was found, the scan
-     * continues from the other end until a signal is found or the
-     * starting frequency is reached.</p>
-     *
-     * <p>After seeking, the frequency of the Player is the one that
-     * was returned or if nothing was found, the original frequency.</p>
-     *
-     * @param startFreq the frequency in 100 Hertzs wherefrom the scan starts (inclusive)
-     *
-     * @param modulation The modulation to be used. <code>TunerControl</code> specifies
-     * predefined constants <code>MODULATION_FM</code> and <code>MODULATION_AM</code>
-     * but other modulations can be supported as well. Supported modulations can be queried
-     * by <code>System</code> property <code>tuner.modulations</code>.
-     * @param upwards if <code>true</code>, the scan proceeds towards higher frequencies,
-     * otherwise towards lower frequencies
-     *
-     * @return The found frequency in 100 Hertzs or, if no signal was found, 0.
-     *
-     * @throws IllegalArgumentException if <code>startFreq</code> is not between the supported minimum
-     * and maximum frequencies or if the <code>modulation</code> is null.
-     * @throws MediaException if the seek functionality is not available for the given modulation.
-     */
-    public int seek(int aStartFreq, String aModulation, boolean aUpwards)
-    throws MediaException
-    {
-        if (aModulation != MODULATION_FM)
-        {
-            throw new IllegalArgumentException("Modulation is not valid.");
-        }
-
-        int foundFreq = _seek(iEventSource,
-                              iControlHandle,
-                              aStartFreq * HERTZ_MULTIPLIER,
-                              aUpwards);
-
-        NativeError.check(foundFreq);
-
-        return foundFreq / HERTZ_MULTIPLIER;
-    }
-
-    /**
-     * Gets the current squelching (muting in frequencies without broadcast)
-     * setting.
-     *
-     * @return <code>true</code> if squelch is on or <code>false</code> if squelch is off.
-     */
-    public boolean getSquelch()
-    {
-        int retValue = _getSquelch(iEventSource, iControlHandle);
-
-        NativeError.check(retValue);
-
-        if (retValue == NativeError.KErrNone)
-        {
-            return true;
-        }
-
-        return false;
-    }
-
-    /**
-     * Sets squelching on or off. Squelching means muting the frequencies
-     * that do not contain radio broadcast.
-     *
-     * @param squelch <code>true</code> to turn the squelch on or <code>false</code> to turn the squelch off.
-     * @throws MediaException if the given squelch setting is not supported.
-     */
-    public void setSquelch(boolean aSquelch) throws MediaException
-    {
-        int err = _setSquelch(iEventSource, iControlHandle, aSquelch);
-
-        NativeError.check(err);
-    }
-
-    /**
-     * Gets the modulation in use.
-     *
-     * @return The modulation currently in use.
-     */
-    public String getModulation()
-    {
-        //only FM modulation is supported
-        return MODULATION_FM;
-    }
-
-    /**
-     * Gets the strength of the recepted signal.
-     *
-     * @return A value between 0 and 100 where 0 means the faintest and 100 the strongest possible signal strength.
-     * @throws MediaException if querying the signal strength is not supported.
-     */
-    public int getSignalStrength() throws MediaException
-    {
-        int signalStrength = _getSignalStrength(iEventSource,
-                                                iControlHandle);
-
-        if (signalStrength != NativeError.KErrNone)
-        {
-            throw new MediaException("Signal strength is not supported.");
-        }
-
-        return signalStrength;
-    }
-
-    /**
-     * Gets the stereo mode in use.
-     *
-     * @return The stereo mode in use. Stereo mode is one of <code>MONO</code>,
-     * <code>STEREO</code> or <code>AUTO</code>.
-     */
-    public int getStereoMode()
-    {
-        int stereoMode = _getStereoMode(iEventSource, iControlHandle);
-
-        NativeError.check(stereoMode);
-
-        return stereoMode;
-    }
-
-    /**
-     * Sets the stereo mode.
-     *
-     * @param mode The stereo mode to be used. Stereo mode is one of <code>MONO</code>,
-     * <code>STEREO</code> or <code>AUTO</code>.
-     * @throws IllegalArgumentException if the given mode is not supported.
-     */
-    public void setStereoMode(int aStereoMode)
-    {
-        if (aStereoMode != MONO && aStereoMode != STEREO && aStereoMode != AUTO)
-        {
-            throw new IllegalArgumentException();
-        }
-
-        int err = _setStereoMode(iEventSource, iControlHandle, aStereoMode);
-
-        if (err != NativeError.KErrNone)
-        {
-            throw new IllegalArgumentException("Stereo mode is not supported.");
-        }
-    }
-
-    /**
-     * Gets the number of presets. The numbering of presets starts from one and the largest
-     * preset number equals the value returned from this method.
-     *
-     * @return The number of presets, or zero if the presets are not supported.
-     */
-    public int getNumberOfPresets()
-    {
-
-        return 0;
-    }
-
-    /**
-     * Tunes the tuner by using settings specified in the preset. Changes to
-     * presets following a <code>usePreset</code> call do not tune the tuner automatically.
-     *
-     * @param preset the preset to be used.
-     * @throws IllegalArgumentException if <code>preset</code> &lt 1 or <code>preset</code> &gt number of presets.
-     */
-    public void usePreset(int aPreset)
-    {
-        if (aPreset < 0 || aPreset > MAX_NUMBER_OF_PRESETS)
-        {
-            throw new IllegalArgumentException("Preset out of preset range.");
-        }
-        int err = _usePreset(iEventSource, iControlHandle, aPreset);
-
-        NativeError.check(err);
-    }
-
-    /**
-     * Configures the preset using current frequency and modulation
-     * (and stereo mode if native presets support storing it).
-     *
-     * @param preset the preset to be set.
-     * @throws IllegalArgumentException if <code>preset</code> &lt 1 or <code>preset</code> &gt number of preset range.
-     * @throws SecurityException if setting presets has been prohibited.
-     */
-    public void setPreset(int aPreset)
-    {
-        if (aPreset < 0 || aPreset > MAX_NUMBER_OF_PRESETS)
-        {
-            throw new IllegalArgumentException("Preset out of preset range.");
-        }
-        int err = _setPreset(iEventSource, iControlHandle, aPreset);
-
-        NativeError.check(err);
-    }
-
-    /**
-     * Configures the preset using given settings.
-     * The stereo mode might not be stored if it is not supported by the presets.
-     * (In that case, <code>IllegalArgumentException</code> is not thrown.)
-     *
-     * @param preset the preset to be configured.
-     * @param freq the frequency of the preset in 100 Hertzs.
-     * @param mod the modulation of the preset.
-     * @param stereoMode the stereo mode of the preset.
-     * @throws IllegalArgumentException if <code>preset</code> &lt 1 or <code>preset</code> &gt number of presets or
-     * <code>freq</code> or <code>modulation</code> are not available or if the <code>modulation</code> is null or if <code>stereoMode</code> is not a supported stereo mode.
-     * @throws SecurityException if setting presets has been prohibited.
-     */
-    public void setPreset(int aPreset, int aFreq, String aModulation, int aStereoMode)
-    {
-        if (aPreset < 0 || aPreset > MAX_NUMBER_OF_PRESETS)
-        {
-            throw new IllegalArgumentException("Preset out of preset range.");
-        }
-        if (aModulation != MODULATION_FM)
-        {
-            throw new IllegalArgumentException("Modulation is not valid.");
-        }
-        if (aStereoMode != MONO && aStereoMode != STEREO && aStereoMode != AUTO)
-        {
-            throw new IllegalArgumentException("Stereo mode is not supported.");
-        }
-
-        int err = _setPreset(iEventSource, iControlHandle, aPreset, aFreq * HERTZ_MULTIPLIER, aStereoMode);
-
-        NativeError.check(err);
-    }
-
-    /**
-     * Gets the preset's frequency.
-     *
-     * @param preset the preset whose frequency is to be returned.
-     * @return The frequency of the preset in 100 Hertzs.
-     * @throws IllegalArgumentException if <code>preset</code> &lt 1 or <code>preset</code> &gt number of presets.
-     */
-    public int getPresetFrequency(int aPreset)
-    {
-        if (aPreset < 0 || aPreset > MAX_NUMBER_OF_PRESETS)
-        {
-            throw new IllegalArgumentException("Preset out of preset range.");
-        }
-
-        int presetFreq = _getPresetFrequency(iEventSource, iControlHandle, aPreset);
-
-        NativeError.check(presetFreq);
-
-        return presetFreq / HERTZ_MULTIPLIER;
-    }
-
-    /**
-     * Gets the preset's modulation.
-     *
-     * @param preset the preset whose modulation is to be returned.
-     * @return The modulation of the preset.
-     * @throws IllegalArgumentException if <code>preset</code> &lt 1 or <code>preset</code> &gt number of presets.
-     */
-    public String getPresetModulation(int aPreset)
-    {
-        if (aPreset < 0 || aPreset > MAX_NUMBER_OF_PRESETS)
-        {
-            throw new IllegalArgumentException("Preset out of preset range.");
-        }
-        return MODULATION_FM;
-    }
-
-    /**
-     * Gets the preset's stereo mode.
-     *
-     * @param preset the preset whose stereo mode is to be returned.
-     * @return The stereo mode of the preset. Stereo mode is one of
-     * <code>MONO</code>, <code>STEREO</code> or <code>AUTO</code>.
-     * @throws IllegalArgumentException if <code>preset</code> &lt 1 or <code>preset</code> &gt number of presets.
-     * @throws MediaException if the presets do not support storing of the stereo mode.
-     */
-    public int getPresetStereoMode(int aPreset) throws MediaException
-    {
-        if (aPreset < 0 || aPreset > MAX_NUMBER_OF_PRESETS)
-        {
-            throw new IllegalArgumentException("Preset out of preset range.");
-        }
-
-        int presetStereoMode = _getPresetStereoMode(iEventSource, iControlHandle, aPreset);
-
-        NativeError.check(presetStereoMode);
-
-        return presetStereoMode;
-    }
-
-    /**
-     * Gets the preset name.
-     *
-     * @param preset the preset whose name is to be returned.
-     * @return A <code>String</code> containing the preset name.
-     * @throws IllegalArgumentException if <code>preset</code> &lt 1 or <code>preset</code> &gt number of presets.
-     */
-    public String getPresetName(int aPreset)
-    {
-        if (aPreset < 0 || aPreset > MAX_NUMBER_OF_PRESETS)
-        {
-            throw new IllegalArgumentException("Preset out of preset range.");
-        }
-
-        int[] error = new int[ 1 ];
-
-        String presetName = _getPresetName(iEventSource, iControlHandle, aPreset, error);
-
-        NativeError.check(error[ 0 ]);
-
-        return presetName;
-    }
-
-    /**
-     * Sets the preset name.
-     *
-     * @param preset the preset whose name is to be set.
-     * @param name the name of the preset.
-     * @throws IllegalArgumentException if <code>preset</code> &lt 1 or <code>preset</code> &gt number of presets or
-     * if the <code>name</code> is null.
-     * @throws SecurityException if setting presets has been prohibited.
-     */
-    public void setPresetName(int aPreset, String aName)
-    {
-        if (aPreset < 0 || aPreset > MAX_NUMBER_OF_PRESETS)
-        {
-            throw new IllegalArgumentException("Preset out of preset range.");
-        }
-        if (aName.length() > MAX_PRESET_NAME_LENGTH)
-        {
-            throw new IllegalArgumentException("Preset name too long");
-        }
-
-        int err = _setPresetName(iEventSource, iControlHandle, aPreset, aName);
-
-        NativeError.check(err);
-    }
-
-
-    private native int _getMinFreq(int aEventSourceHandle,
-                                   int aTunerControlHandle);
-
-    private native int _getMaxFreq(int aEventSourceHandle,
-                                   int aTunerControlHandle);
-
-    private native int _setFrequency(int aEventSourceHandle,
-                                     int aTunerControlHandle,
-                                     int aFreq);
-
-    private native int _getFrequency(int aEventSourceHandle,
-                                     int aTunerControlHandle);
-
-
-    private native int _seek(int aEventSourceHandle,
-                             int aTunerControlHandle,
-                             int aStartFreq,
-                             boolean aUpwards);
-
-    private native int _getSquelch(int aEventSourceHandle,
-                                   int aTunerControlHandle);
-
-    private native int _setSquelch(int aEventSourceHandle,
-                                   int aTunerControlHandle,
-                                   boolean aSquelch);
-
-    private native int _getSignalStrength(int aEventSourceHandle,
-                                          int aTunerControlHandle);
-
-    private native int _getStereoMode(int aEventSourceHandle,
-                                      int aTunerControlHandle);
-
-    private native int _setStereoMode(int aEventSourceHandle,
-                                      int aTunerControlHandle,
-                                      int aStereoMode);
-
-    private native int _usePreset(int aEventSourceHandle,
-                                  int aTunerControlHandle,
-                                  int aPreset);
-
-    private native int _setPreset(int aEventSourceHandle,
-                                  int aTunerControlHandle,
-                                  int aPreset);
-
-    private native int _setPreset(int aEventSourceHandle,
-                                  int aTunerControlHandle,
-                                  int aPreset,
-                                  int aFreq,
-                                  int aStereoMode);
-
-    private native int _getPresetFrequency(int aEventSourceHandle,
-                                           int aTunerControlHandle,
-                                           int aPreset);
-
-    private native int _getPresetStereoMode(int aEventSourceHandle,
-                                            int aTunerControlHandle,
-                                            int aPreset);
-
-    private native int _setPresetName(int aEventSourceHandle,
-                                      int aTunerControlHandle,
-                                      int aPreset,
-                                      String aName);
-
-    private native String _getPresetName(int aEventSourceHandle,
-                                         int aTunerControlHandle,
-                                         int aPreset,
-                                         int[] aError);
-
-
-}
--- a/javauis/amms_qt/src_tuner/javasrc/com/nokia/microedition/media/protocol/capture/radio/Protocol.java	Tue Jul 06 14:10:26 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,84 +0,0 @@
-/*
-* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:  This class is capture://radio protocol
- *
-*/
-
-package com.nokia.microedition.media.protocol.capture.radio;
-
-import com.nokia.microedition.media.Locator;
-import com.nokia.microedition.media.InternalPlayer;
-import com.nokia.microedition.media.PlayerImpl;
-import javax.microedition.media.MediaException;
-import com.nokia.mj.impl.rt.legacy.NativeError;
-import com.nokia.microedition.media.ManagerImpl;
-import com.nokia.amms.control.tuner.TunerControlImpl;
-
-/**
- * This class is capture://radio protocol.
- */
-public class Protocol
-        implements com.nokia.microedition.media.protocol.Protocol
-{
-    // Constants
-    private static final String TUNER_CONTROL_NAME =
-        "javax.microedition.amms.control.tuner.TunerControl";
-
-    /**
-     * Default constructor.
-     */
-    public Protocol()
-    {
-    }
-
-    /**
-     * From Protocol
-     */
-    public InternalPlayer createPlayer(Locator aLocator)
-    throws java.io.IOException,
-                MediaException,
-                java.lang.SecurityException
-    {
-        //   JDEBUG( "AMMS Tuner Protocol createPlayer" );
-
-        String locatorParameters = aLocator.getParameters();
-
-        // Create native tuner player. The native tuner player
-        // creates a native tuner control and adds it to its list.
-        // Handle for the native player are returned.
-        int playerHandle = 0;
-        playerHandle = _createNativeTunerPlayer(
-                           ManagerImpl.getEventSource(),
-                           locatorParameters);
-
-//      JDEBUG( "AMMS Tuner Protocol createPlayer playerHandle = " + playerHandle  );
-
-        NativeError.check(playerHandle);
-
-        PlayerImpl tunerPlayer = new PlayerImpl(playerHandle);
-
-        return tunerPlayer;
-    }
-
-    /**
-     * Creates native tuner player.
-     * Native tuner player creates and adds native tuner control.
-     *
-     * @param aEventSourceHandle Handle to event source.
-     * @param aLocatorParameters
-     * @return Error code.
-     */
-    private native int _createNativeTunerPlayer(int aEventSourceHandle,
-            String aLocatorParameters);
-}
--- a/javauis/amms_qt/src_tuner/native/external_include/fmradioenginecrkeys.h	Tue Jul 06 14:10:26 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,47 +0,0 @@
-/*
-* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:  Definition of central repository keys for FM Radio Engine.
-*
-*/
-
-
-#ifndef FMRADIOENGINECRKEYS_H
-#define FMRADIOENGINECRKEYS_H
-
-// FM Radio Engine UID
-const TUid KCRUidFMRadioEngine = {0x101F7CBC};
-
-// Radio headset volume
-const TUint32 KRadioHeadsetVolume =  0x00000001;
-
-// Radio speaker volume
-const TUint32 KRadioSpeakerVolume = 0x00000002;
-
-// The last played radio frequency
-const TUint32 KFmRadioFrequency = 0x00000003;
-
-// The last played radio channel
-const TUint32 KFmRadioChannel = 0x00000004;
-
-// The radio mode before radio off
-const TUint32 KFmRadioMode = 0x00000005;
-
-// The first preset channel's location in central repository
-const TUint32 KFmRadioPresetChannel1 = 0x0000000A;
-
-#endif // FMRADIOENGINECRKEYS_H
-
-// End of file
-
-
--- a/javauis/amms_qt/src_tuner/native/external_include/tuner.h	Tue Jul 06 14:10:26 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,2535 +0,0 @@
-/*
-* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:  Header file for Tuner component.
-*
-*/
-
-
-#ifndef TUNER_H
-#define TUNER_H
-
-#include <e32base.h>
-#include <MCustomCommand.h>
-#include <mmf/common/mmfbase.h>
-#include <mmf/common/mmfutilities.h>
-#include <mmf/common/mmfcontrollerframework.h>
-#include <mmf/common/mmfstandardcustomcommands.h>
-#include <mmf/common/mmfaudio.h>
-#include <Mda/Common/audio.h>
-class RRadioSession;
-
-/**
-@file
-@publishedAll
-@prototype
-*/
-/**
-The Tuner Capabilities structure defines the capabilities of the tuner
-on the device, as retrieved using the function GetCapabilities.
-*/
-class TTunerCapabilities
-{
-public:
-    inline TTunerCapabilities();
-    inline TTunerCapabilities(TUint32 aTunerBands, TUint32 aAdditionalFunctions);
-public:
-    /**
-    Bitfield (as defined by CMMTunerUtility::TTunerBand) with the bits of the
-    supported bands set
-    */
-    TUint32 iTunerBands;
-
-    /** Tuner Function bit flags - may be extended in future */
-    enum TTunerFunctions
-    {
-        /** Recording of Tuner Audio is possible */
-        ETunerFunctionRecording                 = 0x01,
-        /** Tuner can record and play back simultaneously */
-        ETunerFunctionSimultaneousPlayAndRecord = 0x02,
-        /** The tuner requires an external antenna (e.g. a headset) to function */
-        ETunerFunctionRequiresAntenna           = 0x04,
-        /** CMMRdsTunerUtility supported */
-        ETunerFunctionRds                       = 0x08,
-        /** The tuner can be used when the device is in flight mode */
-        ETunerFunctionAvailableInFlightMode     = 0x10
-    };
-
-    /** Bitfield (as defined by ETunerFunctions) with the bits of the supported functions set */
-    TUint32 iAdditionalFunctions;
-};
-
-/**
-Class representing a frequency.
-*/
-class TFrequency
-{
-public:
-    inline TFrequency();
-    explicit inline TFrequency(TInt aFrequency);
-    inline TInt operator==(const TFrequency& aFrequency) const;
-    inline TInt operator!=(const TFrequency& aFrequency) const;
-    inline TInt operator> (const TFrequency& aFrequency) const;
-    inline TInt operator>=(const TFrequency& aFrequency) const;
-    inline TInt operator< (const TFrequency& aFrequency) const;
-    inline TInt operator<=(const TFrequency& aFrequency) const;
-public:
-    /**
-    The Frequency, in Hertz. A TInt is at least 32 bits, giving a maximum frequency
-    of at least 2.4GHz (i.e. 0x7fffffff Hz)
-    */
-    TInt iFrequency;
-};
-
-
-class MMMTunerObserver;
-class MMMTunerChangeObserver;
-class MMMTunerStereoObserver;
-class MMMSignalStrengthObserver;
-class MMMTunerAudioPlayerObserver;
-class MMMTunerAudioRecorderObserver;
-class CMMTunerAudioPlayerUtility;
-class CMMTunerAudioRecorderUtility;
-class CMMTunerScannerUtility;
-class CMMRdsTunerUtility;
-
-/**
-The MMF Tuner API is present to allow clients to control
-the tuner hardware present on a device.
-*/
-class CMMTunerUtility : public CBase
-{
-    friend class CMMTunerAudioPlayerUtility;
-    friend class CMMTunerAudioRecorderUtility;
-    friend class CMMTunerScannerUtility;
-    friend class CMMRdsTunerUtility;
-public:
-    /** Tuner Band bit flags - may be extended in future */
-    enum TTunerBand
-    {
-        ETunerNoBand            = 0x00,
-        /** Long Wave - uses frequencies */
-        ETunerBandLw            = 0x01,
-        /** Amplitude Modulation or Medium Wave - uses frequencies */
-        ETunerBandAm            = 0x02,
-        /** Frequency Modulation, European and American band - uses frequencies */
-        ETunerBandFm            = 0x04,
-        /** Frequency Modulation, Japanese band - uses frequencies */
-        ETunerBandJapaneseFm    = 0x08,
-        /** Digital Audio Broadcasting - uses channels */
-        ETunerBandDab           = 0x10,
-        /** Digital Video Broadcasting */
-        ETunerBandDvb           = 0x20
-    };
-    /**
-    Search direction enumeration
-    */
-    enum TSearchDirection
-    {
-        /** Search for stations upwards - i.e. by increasing frequency */
-        ESearchDirectionUp = 1,
-        /** Search for stations downwards - i.e. by decreasing frequency */
-        ESearchDirectionDown
-    };
-    /**
-    The Tuner Access Priority enables clients to correctly identify their needs
-    when it comes to accessing the tuner. A process must have the MultimediaDD
-    capability to use priorities greater than ETunerAccessPriorityNormal.
-    */
-    enum TTunerAccessPriority
-    {
-        /** Radio accessible when device is idle */
-        ETunerAccessPriorityBackground      = -100,
-        /** Ordinary application priority */
-        ETunerAccessPriorityNormal          = 0,
-        /** Radio is to be used as an alarm sound */
-        ETunerAccessPriorityAlarm           = 75,
-        /** System use only */
-        ETunerAccessPrioritySystem          = 100
-    };
-    /**
-    Bitmasks to indicate what state the tuner is in.
-    */
-    enum TTunerState
-    {
-        /**
-        Tuner is active, and can therefore report frequency etc. If this bit is
-        not set, none of the others should be set.
-        */
-        ETunerStateActive       = 0x01,
-        /** The tuner is playing sound. */
-        ETunerStatePlaying      = 0x02,
-        /** The tuner is currently recording. */
-        ETunerStateRecording    = 0x04,
-        /** The tuner is currently retuning or searching for a new station. */
-        ETunerStateRetuning     = 0x08,
-    };
-public:
-
-    /**
-    Factory function to create a new instance of the Tuner. Tuner access priority
-    setting is required to ensure that applications such as alarms using the radio
-    as an alarm sound are not prevented from doing so by other clients. Priority
-    setting is needed for audio output when accessing the sound device. Tuner is
-    ready for use on return from this function.
-
-    @param aObserver The observer object for receiving async completion callbacks
-    @param aTunerIndex An index from 0 to TunersAvailable() - 1 specifying the tuner
-            device to use.
-    @param aAccessPriority Tuner access priority value
-    @leave KErrNoMemory Out of memory
-    @leave KErrNotFound The specified tuner or tuner controller is not present
-    @return A pointer and ownership of the fully constructed CMMTunerUtility object
-    */
-    IMPORT_C static CMMTunerUtility* NewL(MMMTunerObserver& aObserver,
-                                          TTunerBand aBand,
-                                          TInt aTunerIndex,
-                                          CMMTunerUtility::TTunerAccessPriority aAccessPriority = ETunerAccessPriorityNormal);
-
-    IMPORT_C virtual ~CMMTunerUtility();
-
-
-
-    /**
-    Set the current tuner access priority of this client. This priority is used to
-    arbitrate between multiple tuner clients, determining who get control of the
-    tuner.
-
-    The platform security capability is MultimediaDD and a client with this capability
-    is allowed to set the priority in preference to a client with a lower capability.
-
-    @param aAccessPriority The new priority to use.
-    @capability MultimediaDD
-    @return A standard system error code.
-    */
-    IMPORT_C TInt SetPriority(TTunerAccessPriority aAccessPriority);
-
-    /**
-    Get the current tuner access priority of this client.
-
-    @param aAccessPriority A variable to which the current priority will be written.
-    @return A standard system error code.
-    */
-    IMPORT_C TInt GetPriority(TTunerAccessPriority& aAccessPriority) const;
-
-
-    /**
-    Get the current state of the tuner.
-
-    @param aState A variable to set with the current state. Bits set according to
-           TTunerState.
-    @return A standard system error code.
-    */
-    IMPORT_C TInt GetState(TUint32& aState) const;
-
-    /**
-    Indicates if the external antenna is currently attached or not. The tuner
-    capabilties should be queried to determine if the external antenna is required
-    to use the tuner or not; A value of false returned here does not necessarily
-    imply that the tuner cannot be used.
-
-    @param aAttached When this function returns, this will contain ETrue if and only
-           if an external antenna is attached.
-    @return A standard system error code.
-    */
-    IMPORT_C TInt IsAntennaAttached(TBool& aAttached);
-
-    /**
-    Indicates if the device is currently in 'flight mode' or not. The tuner
-    capabilities should be queried to determine in the tuner can be used  in flight
-    mode or not.
-
-    @param aFlightMode On return, this will have been set to ETrue if and only if
-            the device is in flight mode.
-    @return A standard system error code.
-    */
-    IMPORT_C TInt GetFlightMode(TBool& aFlightMode) const;
-
-    /**
-    Tune the tuner to the required frequency specified in Hertz. This is an asynchronous
-    command and will result in a callback to MToTuneComplete or MToTunerError.
-
-    If the session does not currently have control of the tuner, a request for control
-    will be made. If control of the tuner is granted, a callback to MToTunerControlGranted
-    will occur. If not, there will be a callback to MtoTunerError with error value
-    KErrAccessDenied.
-
-    Once control of the tuner has been granted, it will be retained until either a
-    call to ReleaseTunerControl, or the session is preempted in which case there
-    will be a callback to MToTunerError with error value KErrAccessDenied.
-
-    @param aFrequency The frequency to tune to
-    @param aBand The band to which aFrequency belongs
-    */
-    IMPORT_C void Tune(TFrequency aFrequency);
-
-    /**
-    Find a radio station, starting at the start frequency and searching in the
-    direction specified (i.e. Up or down) the search is limited to the specified
-    band.  If the session does not currently have control of the tuner, a request
-    for control will be made. If control of the tuner is granted, a callback to
-    MToTunerControlGranted will occur. If not, there will be a callback to MToTunerError
-    with error value KErrAccessDenied.
-
-    Once control of the tuner has been granted, it will be retained until either a
-    call to ReleaseTunerControl, or the session is preempted in which case there
-    will be a callback to MToTunerError with error value KErrAccessDenied.
-
-    A callback to MToTuneComplete will occur if the Seek is successful.
-
-    @param aBand The band
-    @param aSearchDirect The direction to search in
-    @param aCircularSeek If set to ETrue the station seek will loop back to the other
-           end of the band once the end of the band has been reached. (Defaults to ETrue)
-           If not set reaching the end of the band without finding a station will result
-           in a callback to MToTuneComplete with error KErrNotFound.
-    */
-    IMPORT_C void StationSeek(TSearchDirection aSearchDirection);
-
-    /**
-    Cancels an ongoing retune operation, as initiated by a call to Tune or StationSeek.
-    The usual callback will not occur if this has been called.
-
-    Has not affect if no tune or seek operation is ongoing.
-    */
-    IMPORT_C void CancelRetune();
-
-    /**
-    Makes a synchronous request for control of the tuner. If this method returns
-    KErrNone, control of the tuner has been granted. Control of the tuner is kept
-    until it is explically released using ReleaseTunerControl, or it is revoked
-    in which case a callback to MToTunerError with an error of KErrAccessDenied
-    will occur.
-
-    If this method returns with KErrAccessDenied, a request to recieve a
-    notifiaction when control could be granted can be made using
-    NotifyTunerControl.
-
-    Note that methods that require control of the tuner (such as Tune) will make
-    a request for control themselves if control has not already been granted.
-
-    @return A standard system error code. If control was granted, KErrNone, and if
-            control was denied KErrAccessDenied.
-    */
-    IMPORT_C TInt RequestTunerControl();
-
-    /**
-    Makes an asyncronous request for control of the tuner. This method should be
-    called after an control of the tuner has been denied to receive a notification
-    when control of the tuner can be granted. A callback to MToTunerControlGranted
-    will occur in this event.
-    */
-    IMPORT_C TInt NotifyTunerControl();
-
-    /**
-    Release control of the tuner, allowing other clients to tune it. Change
-    notifications may still be received. A request for control of the tuner can be
-    made again by calling RequestTunerControl, or any methods that require control
-    of the tuner.
-    */
-    IMPORT_C void ReleaseTunerControl();
-
-    /**
-    Release the tuner. Any ongoing playing or recording activity will be stopped,
-    control of the tuner will be released, and the hardware will be powered down if
-    no other clients need it.
-    */
-    IMPORT_C void Close();
-
-    /**
-    Retrieve the current frequency that the tuner is tuned to
-
-    @param aFrequency The variable to set to the current frequency,
-    -1 if channels are in use
-    @param aBand The variable used to set the current band.
-    @return A standard system error code
-    */
-    IMPORT_C TInt GetFrequency(TFrequency& aFrequency) const;
-
-    /**
-    Retrieve the signal strenth of the currently tuned signal
-
-    @param aSignalStrength Variable into which the signal strength will be written.
-    @return A standard system error code
-    */
-    IMPORT_C TInt GetSignalStrength(TInt& aSignalStrength) const;
-
-    /**
-    Get the maximum possible signal strength of a tuned signal.
-
-    @param aMaxSignalStrength A variable that will have the maximun signal strength
-            written to.
-    @return A standard system error code
-    */
-    IMPORT_C TInt GetMaxSignalStrength(TInt& aMaxSignalStrength) const;
-
-    /**
-    Request notifications when the signal strength changes. Due to the potentially
-    short intervals at which the signal strength may change at, notifications will
-    only be sent when a relatively large change occurrs. This should allow a visual
-    display of signal strength to be maintained fairly accurately.
-
-    The first signal strength notification will be sent immediately after this
-    request.
-
-    @param aObserver The object which will receive notifications of signal strength
-            changes.
-    @return A standard system error code
-    */
-    IMPORT_C TInt NotifySignalStrength(MMMSignalStrengthObserver& aObserver);
-
-    /**
-    Cancel an outstanding NotifySignalStrength request.
-    */
-    IMPORT_C void CancelNotifySignalStrength();
-
-    /**
-    Find out if the current signal is being received in stereo or not.
-
-    @param aStereo On return, will be ETrue if and only if a stereo signal is
-           currently being received.
-    */
-    IMPORT_C TInt IsStereoSignal(TBool& aStereo);
-
-    /**
-    Request notifications when stereo reception is lost/restored.
-
-    @param aObserver The object requiring notification when a stereo signal is lost
-           or restored. The first notification will occur immediately.
-    @return A standard system error code
-    */
-    IMPORT_C TInt NotifyStereoChange(MMMTunerStereoObserver& aObserver);
-
-    /**
-    Cancels a stereo change notification request.
-    */
-    IMPORT_C void CancelNotifyStereoChange();
-
-    /**
-    Indicates whether the reception should be forced into monophonic mode.
-
-    @param aMono If ETrue, all reception will be in mono mode even if a stereo
-           signal is available. If EFalse, a stereo signal will be received when
-           possible.
-    @return A standard system error code.
-    */
-    IMPORT_C TInt ForceMonoReception(TBool aMono);
-
-    /**
-    Find out whether reception is forced into monophonic mode or not.
-
-    @param aMono This will be set to ETrue if all reception is forced to be mono. If
-           this is EFalse, this does not imply that stereo reception is currently
-           available.
-    @return A standard system error code.
-    */
-    IMPORT_C TInt GetForcedMonoReception(TBool& aMono) const;
-
-    /**
-    Sets the current squleching (muting in frequencies without reception) setting.
-
-    @param aEnabled ETrue to enable squelching, EFalse to disable it.
-    @return KErrNone if successful, else a system wide error code.
-    */
-    IMPORT_C TInt SetSquelch(TBool aEnabled);
-
-    /**
-    Gets the current squleching (muting in frequencies without reception) setting.
-
-    @param aEnabled This will be set to ETrue if squelching is enabled, EFalse otherwise.
-    @return KErrNone if successful, else a system wide error code.
-    */
-    IMPORT_C TInt GetSquelch(TBool& aEnabled) const;
-
-    /**
-    Get the capabilities of the tuner on the device
-
-    @param aCaps The capabilities object to fill
-    @return A standard system error code
-    */
-    IMPORT_C TInt GetCapabilities(TTunerCapabilities& aCaps) const;
-
-    /**
-    Get the frequency range (in Hertz) of the specified band.
-    This function should be used to enquire the frequency range
-    of the bands that GetCapabilities reports as supported.
-
-    @param aBand The band to query
-    @param aBottomFrequency The variable to set to the lowest frequency allowed
-    @param aTopFrequency The variable to set to the highest frequency allowed
-    @return A standard system error code
-    */
-    IMPORT_C TInt GetFrequencyBandRange(TFrequency& aBottomFrequency, TFrequency& aTopFrequency);
-
-    /**
-    Request to be notified when the tuned frequency or channel changes, or when the
-    tuner changes state (e.g. starts playing or recording)
-
-    @param aObserver The object wishing to receive tuning change events
-    @return A standard system error code
-    */
-    IMPORT_C TInt NotifyChange(MMMTunerChangeObserver& aObserver);
-
-    /**
-    Cancel request to be notified when the tuned frequency or channel changes
-    */
-    IMPORT_C void CancelNotifyChange();
-
-    /**
-    Send a synchronous custom command to the tuner.
-
-    @param aFunction The function number to indicate which function is to be called
-        on the interface defined by the first IPC argument
-    @param aArgs The IPC arguments to send to the tuner. The first of these
-        arguments must be the UID of the interface within the tuner to which the
-        command is destined, represented as an integer. Failure to set the first
-        argument properly will result in the command completing with
-        KErrNotSupported at best, but possibly  the client being panicked.
-    @return A standard system error code
-    */
-    IMPORT_C TInt CustomCommandSync(TInt aFunction, const TIpcArgs& aArgs);
-
-    /**
-    Send an asynchronous custom command to the tuner.
-
-    @param aFunction The function number to indicate which function is to be called
-        on the interface defined by the first IPC argument
-    @param aArgs The IPC arguments to send to the tuner. The first of these
-        arguments must be the UID of the interface within the tuner to which the
-        command is destined, represented as an integer. Failure to set the first
-        argument properly will result in the command completing with
-        KErrNotSupported at best, but possibly  the client being panicked.
-    @param aStatus The TRequestStatus of an active object. This will contain the
-        result of the request on completion.  The exact range of result values is
-        dependent on the interface.
-    */
-    IMPORT_C void CustomCommandAsync(TInt aFunction, const TIpcArgs& aArgs, TRequestStatus& aStatus);
-
-    /**
-    Get the Tuner Player Utility
-
-    @param aAccessPriority A variable to which the current priority will be written.
-    @return A standard system error code.
-    */
-    IMPORT_C CMMTunerAudioPlayerUtility* TunerPlayerUtilityL(MMMTunerAudioPlayerObserver& aObserver) ;
-    /**
-    Get the Tuner Recorder Utility
-
-    @param aAccessPriority A variable to which the current priority will be written.
-    @return A standard system error code.
-    */
-    IMPORT_C CMMTunerAudioRecorderUtility* TunerRecorderUtilityL(MMMTunerAudioRecorderObserver& aObserver) ;
-
-    /**
-    Get the Tuner Scanner Utility
-
-    @param aAccessPriority A variable to which the current priority will be written.
-    @return A standard system error code.
-    */
-    IMPORT_C CMMTunerScannerUtility* TunerScannerUtilityL() ;
-
-    /**
-    Get the Tuner Rds Utility
-
-    @param aAccessPriority A variable to which the current priority will be written.
-    @return A standard system error code.
-    */
-    IMPORT_C CMMRdsTunerUtility* TunerRdsUtilityL() ;
-
-private:
-    CMMTunerUtility();
-protected:
-    class CBody;
-private:
-    CBody* iBody;
-};
-
-/**
-The Tuner Observer mixin class defines asynchronous
-event completion function callbacks
-*/
-class MMMTunerObserver
-{
-public:
-    /**
-    Tune complete event. This event is asynchronous
-    and is received after a call to the Tune method.
-
-    @param aError A standard system error
-    */
-    virtual void MToTuneComplete(TInt aError) = 0;
-
-};
-
-/**
-The Tuner Change Observer mixin class defines the interface via which
-notification for changes to the tuned frequency, channel and other tuner
-state can be received. A client interested in these notifications
-should call the function CMMTunerUtility::NotifyChange.
-*/
-class MMMTunerChangeObserver
-{
-public:
-    /**
-    Called when the tuned frequency changes
-
-    @param aOldFrequency The frequency in use before the change
-    @param aNewFrequency The new tuned frequency
-    */
-    virtual void MTcoFrequencyChanged(const TFrequency& aOldFrequency, const TFrequency& aNewFrequency) = 0;
-
-    /**
-    Called when the state of the tuner changes.
-
-    @param aOldState The old state. Bits are set according to TTunerState.
-    @param aNewState The new state. Bits are set according to TTunerState.
-    */
-    virtual void MTcoStateChanged(const TUint32& aOldState, const TUint32& aNewState) = 0;
-
-    /**
-    This function is called when an external antenna is detached from the device.
-    This does not necessarily indicate that the tuner can no longer be used; the
-    capabilities of the tuner indicate if the external antenna is required in order
-    to use the tuner.
-    */
-    virtual void MTcoAntennaDetached() = 0;
-
-    /**
-    This function is called when an external antenna is attached to the device. If
-    the antenna is required to use the tuner, this indicates that the tuner can be
-    used again.
-    */
-    virtual void MTcoAntennaAttached() = 0;
-
-    /**
-    This function is called when the device enters or leaves flight mode. If the tuner
-    cannot be used in flight mode when the device enters this mode, this indicates
-    that the tuner can no longer be used; the capabilities of the tuner indicate if
-    it can be used in flight mode or not.
-
-    @param aFlightMode ETrue if the device has just entered flight mode, EFalse if
-            flight mode has just been left.
-    */
-    virtual void FlightModeChanged(TBool aFlightMode) = 0;
-};
-
-/**
-The stereo observer mixin class defines the interface by which clients can be
-notified when a stereo signal is received/lost. An interested client should call
-the function CMMTunerUtility::NotifyStereoChange.
-*/
-class MMMTunerStereoObserver
-{
-public:
-    /**
-    Called when stereo reception is lost/restored.
-
-    @param aStereo If true, indicates that stereo reception has just been restored.
-           If false, indicates that stereo reception has just been lost.
-    */
-    virtual void MTsoStereoReceptionChanged(TBool aStereo) = 0;
-
-    /**
-    Called when a client enables/disabled forced mono reception.
-
-    @param aForcedMono ETrue if reception is forced to be mono, even when a stereo
-           signal is available.
-    */
-    virtual void MTsoForcedMonoChanged(TBool aForcedMono) = 0;
-};
-
-/**
-This mixin class should be derived from by clients wishing to receive
-notifications when the signal strength changes. Such a client should call
-function CMMTunerUtility::NotifySignalStrength.
-*/
-class MMMSignalStrengthObserver
-{
-public:
-    /**
-    Callback indicating that the signal strength has changed by an amount meriting
-    a notification.
-
-    @param aNewSignalStrength The new signal strength.
-    */
-    virtual void MssoSignalStrengthChanged(TInt aNewSignalStrength) = 0;
-};
-
-
-class MMMAudioResourceNotificationCallback;
-
-/**
-The Tuner Audio Player Utility is used to initiate and control playback of audio
-from the tuner.
-*/
-class CMMTunerAudioPlayerUtility : public CBase, public MCustomCommand
-{
-    friend class CMMTunerUtility::CBody;
-public:
-
-    IMPORT_C ~CMMTunerAudioPlayerUtility();
-
-    /**
-    Set-up the API for playing the output from tuner to the speaker asynchronously.
-    Calls MMMTunerAudioPlayerObserver::MTapoInitializeComplete on completion. This must be
-    called before Play.
-
-    @param aPriority Sound device priority value
-    @param aPref Sound device priority preference value
-    */
-    IMPORT_C void InitializeL(TInt aAudioPriority = EMdaPriorityNormal, TMdaPriorityPreference aPref = EMdaPriorityPreferenceTimeAndQuality);
-
-    /**
-    Start playback of the tuner output. To stop playback, call Mute, or Stop if
-    play will not need to be restarted. InitializeL() must have already been
-    called, and a callback to MTapoInitializeComplete with an error of KErrNone must
-    have occurred; if this is not the case, this raises a TunerAudioPlay 1 panic.
-    */
-    IMPORT_C void Play();
-
-    /**
-    Mute or unmute playback.
-
-    Raises a TunerAudioPlay 1 panic if the player is not properly initialized.
-
-    @param aMute ETrue to mute the audio, EFalse to unmute it.
-    @return A standard system error code
-    */
-    IMPORT_C TInt Mute(TBool aMute);
-
-    /**
-    Stop playback, and release the output device for use by other clients
-
-    Raises a TunerAudioPlay 1 panic if the player is not properly initialized.
-
-    Playback should already be under way.
-    */
-    IMPORT_C void Stop();
-
-    /**
-    Set the current audio priority. This priority is used to arbitrate
-    between multiple audio sources trying to access the audio hardware.
-
-    @param aPriority A priority between EMdaPriorityMin and EMdaPriorityMax
-    @param aPref Time vs Quality priority preferences, enumerated in TMdaPriorityPreference
-    @return A standard system error code
-    */
-    IMPORT_C TInt SetPriority(TInt aPriority, TMdaPriorityPreference aPref);
-
-    /**
-    Get the current audio priority. This is used to arbitrate between simultaneous
-    accesses to the sound hardware.
-
-    @param aPriority A priority between EMdaPriorityMin and EMdaPriorityMax to return
-    @param aPref Time vs Quality priority preferences to return, enumerated in TMdaPriorityPreference
-    @return A standard system error code
-    */
-    IMPORT_C TInt GetPriority(TInt& aPriority, TMdaPriorityPreference& aPref) const;
-
-    /**
-    Set the volume to the specified level
-
-    Raises a TunerAudioPlay 1 panic if the player is not properly initialized.
-
-    @param aVolume The volume level to set
-    @return A standard system error code
-    */
-    IMPORT_C TInt SetVolume(TInt aVolume);
-
-    /**
-    Return the current volume
-
-    @param aVolume The variable to set to the current volume
-    @return A standard system error code
-    */
-    IMPORT_C TInt GetVolume(TInt& aVolume) const;
-
-    /**
-    Define a volume ramp, aRampInterval defining
-    the interval between valid volume settings
-
-    Raises a TunerAudioPlay 1 panic if the player is not properly initialized.
-
-    @param aRampInterval The time interval over which the volume
-    should be increased from zero to the current volume setting
-    @return A standard system error code
-    */
-    IMPORT_C TInt SetVolumeRamp(const TTimeIntervalMicroSeconds& aRampInterval);
-
-    /**
-    Return the maximum volume supported
-
-    @return The maximum volume setting permitted
-    */
-    IMPORT_C TInt MaxVolume() const;
-
-    /**
-    Set the stereo balance between left and right channels
-
-    Raises a TunerAudioPlay 1 panic if the player is not properly initialized.
-
-    @param aBalance The balance value to set - must be between
-    KMMFBalanceMaxLeft and KMMFBalanceMaxRight
-    @return A standard system error code
-    */
-    IMPORT_C TInt SetBalance(TInt aBalance = KMMFBalanceCenter);
-
-    /**
-    Return the current stereo balance
-
-    @param aBalance The variable to set to the current balance
-    @return A standard system error code
-    */
-    IMPORT_C TInt GetBalance(TInt& aBalance) const;
-
-    /**
-    Register for audio resource notifications, in the event that the audio resource is lost due to pre-emption
-    by a higher priority audio client.
-    */
-    IMPORT_C TInt RegisterAudioResourceNotification(MMMAudioResourceNotificationCallback& aCallback, TUid aNotificationEventUid, const TDesC8* aNotificationRegistrationData = NULL);
-
-    /**
-    Cancel an outstanding audio resource notification.
-    */
-    IMPORT_C void CancelRegisterAudioResourceNotification(TUid aNotificationEventId);
-
-    /**
-    Returns the controller implementation information associated with the current controller, if any.
-
-    @return The controller implementation structure associated with the controller
-    @leave KErrNotFound if no controller is in use.
-    */
-    IMPORT_C const CMMFControllerImplementationInformation& ControllerImplementationInformationL();
-
-    /**
-    Send a synchronous custom command to the playback controller, if ones exists.
-
-    @param aDestination The destination of the message, consisting of the uid of
-            the interface of this message
-    @param aFunction The function number to indicate which function is to be called
-            on the interface defined in the aDestination parameter
-    @param aDataTo1 The first chunk of data to be copied to the controller
-            framework. The exact contents of the data are dependent on the
-            interface being called. Can be KNullDesC8.
-    @param aDataTo2 The second chunk of data to be copied to the controller
-            framework. The exact contents of the data are dependent on the
-            interface being called. Can be KNullDesC8.
-    @return A standard system error code
-    */
-    IMPORT_C TInt CustomCommandSync(
-        const TMMFMessageDestinationPckg& aDestination,
-        TInt aFunction,
-        const TDesC8& aDataTo1,
-        const TDesC8& aDataTo2);
-
-    /**
-    Send a synchronous custom command to the playback controller, if ones exists.
-
-    @param aDestination The destination of the message, consisting of the uid of
-            the interface of this message
-    @param aFunction The function number to indicate which function is to be called
-            on the interface defined in the aDestination parameter
-    @param aDataTo1 The first chunk of data to be copied to the controller
-            framework. The exact contents of the data are dependent on the
-            interface being called. Can be KNullDesC8.
-    @param aDataTo2 The second chunk of data to be copied to the controller
-            framework. The exact contents of the data are dependent on the
-            interface being called. Can be KNullDesC8.
-    @param aDataFrom The area of memory to which the controller framework
-            will write any data to be passed back to the client. Can't be KNullDesC8.
-    @return A standard system error code
-    */
-    IMPORT_C TInt CustomCommandSync(
-        const TMMFMessageDestinationPckg& aDestination,
-        TInt aFunction,
-        const TDesC8& aDataTo1,
-        const TDesC8& aDataTo2,
-        TDes8& aDataFrom);
-
-    /**
-    Send an asynchronous custom command to the playback controller, if ones exists.
-
-    @param aDestination The destination of the message, consisting of the uid of
-            the interface of this message
-    @param aFunction The function number to indicate which function is to be called
-            on the interface defined in the aDestination parameter
-    @param aDataTo1 The first chunk of data to be copied to the controller
-            framework. The exact contents of the data are dependent on the
-            interface being called. Can be KNullDesC8.
-    @param aDataTo2 The second chunk of data to be copied to the controller
-            framework. The exact contents of the data are dependent on the
-            interface being called. Can be KNullDesC8.
-    @param aStatus The TRequestStatus of an active object. This will contain the
-            result of the request on completion.  The exact range of result values is
-            dependent on the interface.
-    */
-    IMPORT_C void CustomCommandAsync(
-        const TMMFMessageDestinationPckg& aDestination,
-        TInt aFunction,
-        const TDesC8& aDataTo1,
-        const TDesC8& aDataTo2,
-        TRequestStatus& aStatus);
-
-    /**
-    Send an asynchronous custom command to the playback controller, if ones exists.
-
-    @param aDestination The destination of the message, consisting of the uid of
-            the interface of this message
-    @param aFunction The function number to indicate which function is to be called
-            on the interface defined in the aDestination parameter
-    @param aDataTo1 The first chunk of data to be copied to the controller
-            framework. The exact contents of the data are dependent on the
-            interface being called. Can be KNullDesC8.
-    @param aDataTo2 The second chunk of data to be copied to the controller
-            framework. The exact contents of the data are dependent on the
-            interface being called. Can be KNullDesC8.
-    @param aDataFrom The area of memory to which the controller framework
-            will write any data to be passed back to the client. Can't be KNullDesC8.
-    @param aStatus The TRequestStatus of an active object. This will contain the
-            result of the request on completion.  The exact range of result values is
-            dependent on the interface.
-    */
-    IMPORT_C void CustomCommandAsync(
-        const TMMFMessageDestinationPckg& aDestination,
-        TInt aFunction,
-        const TDesC8& aDataTo1,
-        const TDesC8& aDataTo2,
-        TDes8& aDataFrom,
-        TRequestStatus& aStatus);
-
-protected:
-    /**
-    Factory function to create a new Tuner Audio Player utility. Note that only one audio player
-    utility may be created per instance of CMMTunerUtility. Multiple instances will result in an
-    error of KErrAlreadyExists when InitializeL() is called.
-
-    @param aTuner The tuner object which this utility will play the audio from.
-    @param aObserver The observer of the player utility to receive asychronous completion and
-            notifiction callbacks.
-    @leave KErrNoMemory Out of memory
-    @leave KErrNotSupported If the given tuner doesn't support audio playback.
-    @return A new tuner audio player utility.
-    */
-    static CMMTunerAudioPlayerUtility* NewL(CMMTunerUtility& aTuner, RRadioSession& aRadioSession, MMMTunerAudioPlayerObserver& aObserver);
-
-private:
-    CMMTunerAudioPlayerUtility();
-private:
-    class CBody;
-    CBody* iBody;
-};
-
-class MMMTunerAudioPlayerObserver
-{
-public:
-    /**
-    The TEvent enumeration is used to indicate which type of event is being sent to the client.
-    Each event will be associated with an error code and potentially some addition information,
-    and will be passed to the client via method MTapoPlayEvent().
-    */
-    enum TEventType
-    {
-        /** An event relating to the tuner itself. Any error other than KErrNone associated
-        with this event type may indicate that the tuner cannot be used anymore.
-
-        No additional information is associated with this type of event. */
-        ETunerEvent,
-        /**
-        An event relating to audio playback.
-
-        No additional information is associated with this type of event.
-        */
-        EAudioEvent
-    };
-public:
-    /**
-    Initialize complete event. This event is asynchronous and is received after
-    a call to CMMTunerAudioPlayerUtility::InitializeL().
-
-    @param aError A standard system error
-    */
-    virtual void MTapoInitializeComplete(TInt aError) = 0;
-
-    /**
-    Passes an asychronous event to the tuner client.
-
-    @param aEvent The type of event. See enumeration MMMTunerAudioPlayerObserver::TEventType
-            for more information about when the event types mean.
-    @param aError An error code associated with the event.
-    @param aAdditionalInfo Any additional information associated with the event, or NULL if
-            no such additional information exists.
-    */
-    virtual void MTapoPlayEvent(TEventType aEvent, TInt aError, TAny* aAdditionalInfo) = 0;
-};
-
-/**
-This class is used to perform recording of audio from the tuner. Many of the methods
-in this class have identical functionality to similarly names functions in class
-CMdaAudioRecorderUtility.
-*/
-class CMMTunerAudioRecorderUtility : public CBase
-{
-    friend class CMMTunerUtility::CBody;
-public:
-
-    IMPORT_C ~CMMTunerAudioRecorderUtility();
-
-    /**
-    Initialize for recording from the tuner to the specified file
-    asynchronously. Calls MMMTunerAudioRecorderObserver::MTaroInitializeComplete on completion
-
-    @param aRecordFilename The name of the file to create, if necessary, and record to
-    @param "aDestinationDataType" Data type for recording
-    @param "aControllerUid" The Uid of the controller to use for recording
-    @param "aDestinationFormatUid" Uid of record format
-    @param aPriority Sound device priority value
-    @param aPref Sound device priority preference value
-    */
-    IMPORT_C void InitializeL(const TDesC& aRecordFilename,
-                              TFourCC aDestinationDataType = KFourCCNULL,
-                              TUid aControllerUid=KNullUid,
-                              TUid aDestinationFormatUid=KNullUid,
-                              TInt aAudioPriority = EMdaPriorityNormal,
-                              TMdaPriorityPreference aPref = EMdaPriorityPreferenceTimeAndQuality);
-
-    /**
-    Initialize for recording from the tuner to the specified descriptor
-    asynchronously. Calls MMMTunerAudioRecorderObserver::MTaroInitializeComplete on completion
-
-    @param aRecordDescriptor The descriptor to record to
-    @param "aDestinationDataType" Data type for recording
-    @param "aControllerUid" The Uid of the controller to use for recording
-    @param "aDestinationFormatUid" Uid of record format
-    @param aPriority Sound device priority value
-    @param aPref Sound device priority preference value
-    */
-    IMPORT_C void InitializeL(TDes8& aRecordDescriptor,
-                              TFourCC aDestinationDataType = KFourCCNULL,
-                              TUid aControllerUid=KNullUid,
-                              TUid aDestinationFormatUid=KNullUid,
-                              TInt aAudioPriority = EMdaPriorityNormal,
-                              TMdaPriorityPreference aPref = EMdaPriorityPreferenceTimeAndQuality);
-
-    /**
-    Return a list of the supported data types for the record destination
-    @param "aSupportedDataTypes" list of four character codes, representing supported data
-        encodings for the record destination.
-    @leaves Can leave with one of the system-wide error codes
-    */
-    IMPORT_C void GetSupportedDestinationDataTypesL(RArray<TFourCC>& aSupportedDataTypes) const;
-
-    /**
-    Set the data type of the destination audio clip
-    @param "aDataType" four character code, representing the encoding of the destination audio clip
-    @leaves Can leave with one of the system-wide error codes
-    */
-    IMPORT_C void SetDestinationDataTypeL(TFourCC aDataType);
-
-    /**
-    Return the data type of the destination audio clip
-    @returns four character code, representing the encoding of the destination audio clip
-    @leaves Can leave with one of the system-wide error codes
-    */
-    IMPORT_C TFourCC DestinationDataTypeL() const;
-
-    /**
-    Set the bit rate for recording
-    @param "aBitRate" destination bit rate in bits/second
-    @leaves Can leave with one of the system-wide error codes
-    */
-    IMPORT_C void SetDestinationBitRateL(TUint aBitRate);
-
-    /**
-    Return the recording bit rate
-    @returns destination bit rate in bits/second
-    @leaves Can leave with one of the system-wide error codes
-    */
-    IMPORT_C TUint DestinationBitRateL() const;
-
-    /**
-    Return a list of the supported bit rates for recording
-    @param "aSupportedBitRates" List of bit rates supported for the record
-           destination
-    @leaves Can leave with one of the system-wide error codes
-    */
-    IMPORT_C void GetSupportedBitRatesL(RArray<TUint>& aSupportedBitRates) const;
-
-    /**
-    Set the sample rate for the record destination
-    @param "aSampleRate" The sample rate of the record destination
-    @leaves Can leave with one of the system-wide error codes
-    */
-    IMPORT_C void SetDestinationSampleRateL(TUint aSampleRate);
-
-    /**
-    Return the sample rate of the record destination
-    @returns The sample rate of the record destination
-    @leaves Can leave with one of the system-wide error codes
-    */
-    IMPORT_C TUint DestinationSampleRateL() const;
-
-    /**
-    Get a list of supported recording sample rates.
-    @param "aSupportedSampleRates" List of the sample rates that are supported for
-           recording
-    @leaves Can leave with one of the system-wide error codes
-    */
-    IMPORT_C void GetSupportedSampleRatesL(RArray<TUint>& aSupportedSampleRates) const;
-
-    /**
-    Set the format of the audio clip. This can only be done if the audio clip does not
-    exist
-
-    @param "aFormatUid" Uid of the audio clip format
-    @leaves KErrAlreadyExists if the clip already exists and the format is different
-     from the existing format, or can leave with one of the system-wide error codes
-    */
-    IMPORT_C void SetDestinationFormatL(TUid aFormatUid);
-
-    /**
-    Return the format of the audio clip
-    @returns Uid of the audio clip format
-    @leaves Can leave with one of the system-wide error codes
-    */
-    IMPORT_C TUid DestinationFormatL() const;
-
-    /**
-    Set the number of channels for the recorded audio clip
-    @param "aNumberOfChannels" The number of channels to record
-    @leaves Can leave with one of the system-wide error codes
-    */
-    IMPORT_C void SetDestinationNumberOfChannelsL(TUint aNumberOfChannels);
-
-    /**
-    Return the number of channels in audio clip
-    @returns number of channels supported by audio clip
-    @leaves Can leave with one of the system-wide error codes
-    */
-    IMPORT_C TUint DestinationNumberOfChannelsL() const;
-
-    /**
-    Return a list of the supported number of channels for recording
-    @param "aSupportedNumChannels" List of the number of channels supported for
-            recording
-    @leaves Can leave with one of the system-wide error codes
-    */
-    IMPORT_C void GetSupportedNumberOfChannelsL(RArray<TUint>& aSupportedNumChannels) const;
-
-    /** Start recording of the tuner output */
-    IMPORT_C void RecordL();
-
-    /**
-    Pause recording. Recording can be resumed with another call to Record.
-
-    @return A standard system error code
-    */
-    IMPORT_C TInt PauseRecord();
-
-    /**
-    Stop recording, and release the output device for use by other clients
-
-    Recording should already be under way.
-    */
-    IMPORT_C void Stop();
-
-    /**
-    Stop recording, and release the output device for use by other clients
-
-    Recording should already be under way.
-    */
-    IMPORT_C void Close();
-
-    /**
-    Return the maximum value for the gain
-
-    @return The maximum gain. For devices where automatic gain control is used, this value may be zero.
-    */
-    IMPORT_C TInt MaxGain() const;
-
-    /**
-    Sets the gain for the audio device to a specified value.
-
-    @param aGain The gain setting. This can be any value from zero to the value returned by a call to
-            MaxGain(). A value which is less than zero is set to zero. A value which is greater than
-            MaxGain() is set to MaxGain().
-    */
-    IMPORT_C void SetGain(TInt aGain);
-
-    /**
-    Sets the current recording balance setting between the left and right stereo channels
-
-    The balance can be changed before or during recording and is effective immediately.
-
-    @param aBalance The balance value to set. Any value between KMMFBalanceMaxLeft and
-            KMMFBalanceMaxRight, the default value being KMMFBalanceCenter.
-    @return An error code indicating if the call was successful. KErrNone on success,
-            otherwise another of the system-wide error codes.
-    */
-    IMPORT_C TInt SetRecordBalance(TInt aBalance = KMMFBalanceCenter);
-
-    /**
-    Returns the current recording balance setting between the left and right stereo channels.
-
-    @param aBalance On return, contains the current recording balance between KMMFBalanceMaxLeft
-            and KMMFBalanceMaxRight.
-    @return An error code indicating if the call was successful. KErrNone on success, otherwise
-            another of the system-wide error codes.
-    */
-    IMPORT_C TInt GetRecordBalance(TInt& aBalance) const;
-
-    /**
-    Set the current audio priority. This priority is used to arbitrate
-    between multiple audio sources trying to access the audio hardware.
-
-    @param aPriority A priority between EMdaPriorityMin and EMdaPriorityMax
-    @param aPref Time vs Quality priority preferences, enumerated in TMdaPriorityPreference
-    @return A standard system error code
-    */
-    IMPORT_C TInt SetPriority(TInt aPriority, TMdaPriorityPreference aPref);
-
-    /**
-    Get the current audio priority. This is used to arbitrate between simultaneous
-    accesses to the sound hardware.
-
-    @param aPriority A priority between EMdaPriorityMin and EMdaPriorityMax to return
-    @param aPref Time vs Quality priority preferences to return, enumerated in TMdaPriorityPreference
-    @return A standard system error code
-    */
-    IMPORT_C TInt GetPriority(TInt& aPriority, TMdaPriorityPreference& aPref) const;
-
-    /**
-    Register for audio resource notifications, in the event that the audio resource is lost due to pre-emption
-    by a higher priority audio client.
-    */
-    IMPORT_C TInt RegisterAudioResourceNotification(MMMAudioResourceNotificationCallback& aCallback, TUid aNotificationEventUid, const TDesC8* aNotificationRegistrationData = NULL);
-
-    /**
-    Cancel an outstanding audio resource notification.
-    */
-    IMPORT_C void CancelRegisterAudioResourceNotification(TUid aNotificationEventId);
-
-
-    /**
-    Sets the maximum size for a file that is being recorded.
-
-    When this limit is reached, MMF stops recording and notifies the client application. Notification is caused
-    by MMdaObjectStateChangeObserver::MoscoStateChangeEvent() with the error code KErrEof.
-
-    This function is provided so that applications such as recorders can limit the amount of file storage/memory
-    that should be allocated.
-
-    @param aMaxWriteLength
-           The maximum file size in kilobytes. If the default value is used, there is no maximum file size.
-
-    */
-    IMPORT_C void SetMaxWriteLength(TInt aMaxWriteLength = KMdaClipLocationMaxWriteLengthNone);
-
-    /**
-    Returns the recording time available for the selected file or descriptor and encoding format.
-    */
-    IMPORT_C const TTimeIntervalMicroSeconds& RecordTimeAvailable();
-
-    /**
-    Returns the duration of the audio sample data.
-    */
-    IMPORT_C const TTimeIntervalMicroSeconds& Duration();
-
-    /**
-    Return the controller implementation information structure of the current controller
-
-    @leave KErrNoMemory Out of memory
-    @return A reference to the current controller information
-    */
-    IMPORT_C const CMMFControllerImplementationInformation& ControllerImplementationInformationL();
-
-    /*
-    Returns the number of meta data entries associated with this clip.
-    @return Number of metadata entries
-    */
-    IMPORT_C TInt GetNumberOfMetaDataEntries(TInt& aNumEntries);
-
-    /*
-    Returns the specified meta data entry from the current audio clip.
-    @return Metadata entry
-    */
-    IMPORT_C CMMFMetaDataEntry* GetMetaDataEntryL(TInt aMetaDataIndex);
-
-    /*
-    Adds a meta data entry to the audio clip.
-    */
-    IMPORT_C void AddMetaDataEntryL(CMMFMetaDataEntry& aMetaDataEntry);
-
-    /*
-    Removes a specified meta data entry from the audio clip
-    @return An error code indicating if the call was successful
-    */
-    IMPORT_C TInt RemoveMetaDataEntry(TInt aMetaDataIndex);
-
-    /*
-    Replaces the specified meta data entry with a new entry
-    */
-    IMPORT_C void ReplaceMetaDataEntryL(TInt aMetaDataIndex, CMMFMetaDataEntry& aMetaDataEntry);
-
-
-    /**
-    Send a synchronous custom command to the recording controller
-
-    @param aDestination The destination of the message, consisting of the uid of
-    the interface of this message
-    @param aFunction The function number to indicate which function is to be called
-    on the interface defined in the aDestination parameter
-    @param aDataTo1 The first chunk of data to be copied to the controller
-    framework. The exact contents of the data are dependent on the
-    interface being called. Can be KNullDesC8.
-    @param aDataTo2 The second chunk of data to be copied to the controller
-    framework. The exact contents of the data are dependent on the
-    interface being called. Can be KNullDesC8.
-    @return A standard system error code
-    */
-    IMPORT_C TInt CustomCommandSync(
-        const TMMFMessageDestinationPckg& aDestination,
-        TInt aFunction,
-        const TDesC8& aDataTo1,
-        const TDesC8& aDataTo2);
-
-    /**
-    Send a synchronous custom command to the recording controller
-
-    @param aDestination The destination of the message, consisting of the uid of
-    the interface of this message
-    @param aFunction The function number to indicate which function is to be called
-    on the interface defined in the aDestination parameter
-    @param aDataTo1 The first chunk of data to be copied to the controller
-    framework. The exact contents of the data are dependent on the
-    interface being called. Can be KNullDesC8.
-    @param aDataTo2 The second chunk of data to be copied to the controller
-    framework. The exact contents of the data are dependent on the
-    interface being called. Can be KNullDesC8.
-    @param aDataFrom The area of memory to which the controller framework
-    will write any data to be passed back to the client. Can't be KNullDesC8.
-    @return A standard system error code
-    */
-    IMPORT_C TInt CustomCommandSync(
-        const TMMFMessageDestinationPckg& aDestination,
-        TInt aFunction,
-        const TDesC8& aDataTo1,
-        const TDesC8& aDataTo2,
-        TDes8& aDataFrom);
-
-    /**
-    Send an asynchronous custom command to the recording controller
-
-    @param aDestination The destination of the message, consisting of the uid of
-    the interface of this message
-    @param aFunction The function number to indicate which function is to be called
-    on the interface defined in the aDestination parameter
-    @param aDataTo1 The first chunk of data to be copied to the controller
-    framework. The exact contents of the data are dependent on the
-    interface being called. Can be KNullDesC8.
-    @param aDataTo2 The second chunk of data to be copied to the controller
-    framework. The exact contents of the data are dependent on the
-    interface being called. Can be KNullDesC8.
-    @param aStatus The TRequestStatus of an active object. This will contain the
-    result of the request on completion.  The exact range of result values is
-    dependent on the interface.
-    @return A standard system error code
-    */
-    IMPORT_C void CustomCommandAsync(
-        const TMMFMessageDestinationPckg& aDestination,
-        TInt aFunction,
-        const TDesC8& aDataTo1,
-        const TDesC8& aDataTo2,
-        TRequestStatus& aStatus);
-
-    /**
-    Send an asynchronous custom command to the recording controller
-
-    @param aDestination The destination of the message, consisting of the uid of
-    the interface of this message
-    @param aFunction The function number to indicate which function is to be called
-    on the interface defined in the aDestination parameter
-    @param aDataTo1 The first chunk of data to be copied to the controller
-    framework. The exact contents of the data are dependent on the
-    interface being called. Can be KNullDesC8.
-    @param aDataTo2 The second chunk of data to be copied to the controller
-    framework. The exact contents of the data are dependent on the
-    interface being called. Can be KNullDesC8.
-    @param aDataFrom The area of memory to which the controller framework
-    will write any data to be passed back to the client. Can't be KNullDesC8.
-    @param aStatus The TRequestStatus of an active object. This will contain the
-    result of the request on completion.  The exact range of result values is
-    dependent on the interface.
-    @return A standard system error code
-    */
-    IMPORT_C void CustomCommandAsync(
-        const TMMFMessageDestinationPckg& aDestination,
-        TInt aFunction,
-        const TDesC8& aDataTo1,
-        const TDesC8& aDataTo2,
-        TDes8& aDataFrom,
-        TRequestStatus& aStatus);
-
-protected:
-    /**
-    Create a new audio recorder utility. Note that only one audio recorder utility may be created
-    per instance of CMMTunerUtility. Multiple instances will result in an error of KErrAlreadyExists
-    when InitializeL() is called.
-    */
-    static CMMTunerAudioRecorderUtility* NewL(CMMTunerUtility& aTuner, MMMTunerAudioRecorderObserver& aObserver);
-
-private:
-    CMMTunerAudioRecorderUtility();
-private:
-    class CBody;
-    CBody* iBody;
-
-};
-
-class MMMTunerAudioRecorderObserver
-{
-public:
-    /**
-    The TEvent enumeration is used to indicate which type of event is being sent to the client.
-    Each event will be associated with an error code and potentially some addition information,
-    and will be passed to the client via method MTaroRecordEvent().
-    */
-    enum TEventType
-    {
-        /** An event relating to the tuner itself. Any error other than KErrNone associated
-        with this event type may indicate that the tuner cannot be used anymore.
-
-        No additional information is associated with this type of event. */
-        ETunerEvent,
-        /**
-        An event relating to audio recording.
-
-        No additional information is associated with this type of event.
-        */
-        EAudioEvent
-    };
-public:
-    /**
-    Initialize complete event. This event is asynchronous and is received after
-    a call to CMMTunerAudioRecorderUtility::InitializeL.
-
-    @param aError A standard system error
-    */
-    virtual void MTaroInitializeComplete(TInt aError) = 0;
-
-    /**
-    Passes an asychronous event to the tuner client.
-
-    @param aEvent The type of event. See enumeration MMMTunerAudioRecorderObserver::TEventType
-            for more information about when the event types mean.
-    @param aError An error code associated with the event.
-    @param aAdditionalInfo Any additional information associated with the event, or NULL if
-            no such additional information exists.
-    */
-    virtual void MTaroRecordEvent(TEventType aEvent, TInt aError, TAny* aAdditionalInfo) = 0;
-};
-
-/**
-This class augments CMMTunerUtility to provide station scanning functionality,
-whereby the frequency spectrum is searched, pausing for a specified amount of
-time when a station is found.
-*/
-class CMMTunerScannerUtility : public CBase
-{
-    friend class CMMTunerUtility::CBody;
-public:
-
-    IMPORT_C ~CMMTunerScannerUtility();
-
-    /**
-    Continuously scan for a radio station, pausing for the time specified before
-    continuing on to the next station. Call StopScan to select the currently tuned
-    station. The search is limited to the specified band.
-
-    @note The control of a CMMTunerUtility object must have been passed to this
-          class (using TransferTunerControl) before this function is called.
-
-    @param aBand The band to which aStartFrequency belongs
-    @param aSearchDirect The direction to search in
-    @param aPauseDuration Time to pause at each station
-    @param aCircularScan If set to ETrue the station scan will loop back to the other
-           end of the band once the end of the band has been reached. (Defaults to ETrue)
-    */
-    IMPORT_C void StationScan(CMMTunerUtility::TSearchDirection aSearchDirection,
-                              TTimeIntervalMicroSeconds32 aPauseDuration
-                             );
-
-    /**
-    Stop scanning and use the currently tuned station
-
-    @return ETrue if a station is tuned, EFalse otherwise
-    */
-    IMPORT_C TBool StopScan();
-
-protected:
-    /**
-    Factory function to create a new CMMTunerScannerUtility.
-
-    @param aTuner The tuner with which to perform the scanning.
-    @leave KErrNoMemory Out of memory.
-    @return A newly contructed tuner scanner utility.
-    */
-    static CMMTunerScannerUtility* NewL(CMMTunerUtility& aTuner,CMMTunerUtility::TTunerBand aBand);
-
-private:
-    CMMTunerScannerUtility();
-private:
-    class CBody;
-    CBody* iBody;
-
-};
-
-
-/** Programme Station name, 8 characters */
-typedef TBuf<8> TRdsStationName;
-/** Programme Type Name, 8 characters */
-typedef TBuf<8> TRdsProgrammeTypeName;
-/** RDS Programme Identifier, a unique ID for each radio station */
-typedef TInt TRdsProgrammeIdentifier;
-
-/**
-Programme Item Number - identifies the start time of the current programme,
-as published by the broadcaster.
-*/
-class TRdsProgrammeItemNumber
-{
-public:
-    /** The day of the month of the broadcast, in the range 1-31 */
-    TInt iDayOfMonth;
-    /** The hour of the day, in the range 0-23 */
-    TInt iHour;
-    /** The minute past the hour, in the range 0-59 */
-    TInt iMinute;
-public:
-    inline TInt operator==(const TRdsProgrammeItemNumber& aPin) const;
-    inline TInt operator!=(const TRdsProgrammeItemNumber& aPin) const;
-};
-
-/**
-An RDS extended country code. The meaning of a value of this type is defined
-by the RDS specification, IEC62106.
-*/
-typedef TInt TRdsCountryCode;
-
-/**
-An RDS language identification code. The meaning of a value of this type is
-defined by the RDS specification, IEC62106.
-*/
-typedef TInt TRdsLanguageIdentifier;
-
-/**
-RDS Programme Type.
-
-The interpretation of values of this type depends on the origin of the RDS
-broadcast: in North America, a slightly different standard, RBDS, is used.
-These PTY codes are defined by static values KRbdsPtyXxxxx, for example
-KRbdsPtySoftRock.
-
-Elsewhere, including Europe, the RDS standard is used. In these areas, the
-PTY codes are defined by static values KRdsPtyXxxxx, for example
-KRdsPtyChildrensProgrammes.
-
-In all other important aspects, the European RDS and North American RBDS
-standards are identical.
-*/
-typedef TInt TRdsProgrammeType;
-
-/** No programme type or undefined */
-const static TRdsProgrammeType KRdsPtyNone = 0;
-/** News */
-const static TRdsProgrammeType KRdsPtyNews = 1;
-/** CurrentAffairs */
-const static TRdsProgrammeType KRdsPtyCurrentAffairs = 2;
-/** Information */
-const static TRdsProgrammeType KRdsPtyInformation = 3;
-/** Sport */
-const static TRdsProgrammeType KRdsPtySport = 4;
-/** Education */
-const static TRdsProgrammeType KRdsPtyEducation = 5;
-/** Drama */
-const static TRdsProgrammeType KRdsPtyDrama = 6;
-/** Culture */
-const static TRdsProgrammeType KRdsPtyCulture = 7;
-/** Science */
-const static TRdsProgrammeType KRdsPtyScience = 8;
-/** VariedSpeech */
-const static TRdsProgrammeType KRdsPtyVariedSpeech = 9;
-/** PopMusic */
-const static TRdsProgrammeType KRdsPtyPopMusic = 10;
-/** RockMusic */
-const static TRdsProgrammeType KRdsPtyRockMusic = 11;
-/** EasyListening */
-const static TRdsProgrammeType KRdsPtyEasyListening = 12;
-/** LightClassical */
-const static TRdsProgrammeType KRdsPtyLightClassical = 13;
-/** SeriousClassics */
-const static TRdsProgrammeType KRdsPtySeriousClassical = 14;
-/** OtherMusic */
-const static TRdsProgrammeType KRdsPtyOtherMusic = 15;
-/** Weather */
-const static TRdsProgrammeType KRdsPtyWeather = 16;
-/** Finance */
-const static TRdsProgrammeType KRdsPtyFinance = 17;
-/** ChildrensProgrammes */
-const static TRdsProgrammeType KRdsPtyChildrensProgrammes = 18;
-/** SocialAffairs */
-const static TRdsProgrammeType KRdsPtySocialAffairs = 19;
-/** Religion */
-const static TRdsProgrammeType KRdsPtyReligion = 20;
-/** PhoneIn */
-const static TRdsProgrammeType KRdsPtyPhoneIn = 21;
-/** Travel */
-const static TRdsProgrammeType KRdsPtyTravel = 22;
-/** Leisure */
-const static TRdsProgrammeType KRdsPtyLeisure = 23;
-/** JazzMusic */
-const static TRdsProgrammeType KRdsPtyJazzMusic = 24;
-/** CountryMusic */
-const static TRdsProgrammeType KRdsPtyCountryMusic = 25;
-/** NationalMusic */
-const static TRdsProgrammeType KRdsPtyNationalMusic = 26;
-/** OldiesMusic */
-const static TRdsProgrammeType KRdsPtyOldiesMusic = 27;
-/** FolkMusic */
-const static TRdsProgrammeType KRdsPtyFolkMusic = 28;
-/** Documentary */
-const static TRdsProgrammeType KRdsPtyDocumentary = 29;
-/** AlarmTest */
-const static TRdsProgrammeType KRdsPtyAlarmTest = 30;
-/** Alarm */
-const static TRdsProgrammeType KRdsPtyAlarm = 31;
-
-
-/** No programme type or undefined */
-const static TRdsProgrammeType KRbdsPtyNone = 0;
-/** News */
-const static TRdsProgrammeType KRbdsPtyNews = 1;
-/** Informaion */
-const static TRdsProgrammeType KRbdsPtyInformation = 2;
-/** Sports */
-const static TRdsProgrammeType KRbdsPtySports = 3;
-/** Talk */
-const static TRdsProgrammeType KRbdsPtyTalk = 4;
-/** Rock */
-const static TRdsProgrammeType KRbdsPtyRock = 5;
-/** Classic Rock */
-const static TRdsProgrammeType KRbdsPtyClassicRock = 6;
-/** Adult Hits */
-const static TRdsProgrammeType KRbdsPtyAdultHits = 7;
-/** Soft Rock */
-const static TRdsProgrammeType KRbdsPtySoftRock = 8;
-/** Top 40 */
-const static TRdsProgrammeType KRbdsPtyTop40 = 9;
-/** Country */
-const static TRdsProgrammeType KRbdsPtyCountry = 10;
-/** Oldies */
-const static TRdsProgrammeType KRbdsPtyOldies = 11;
-/** Soft */
-const static TRdsProgrammeType KRbdsPtySoft = 12;
-/** Nostalgia */
-const static TRdsProgrammeType KRbdsPtyNostalgia = 13;
-/** Jazz */
-const static TRdsProgrammeType KRbdsPtyJazz = 14;
-/** Classical */
-const static TRdsProgrammeType KRbdsPtyClassical = 15;
-/** Rhythm and Blues */
-const static TRdsProgrammeType KRbdsPtyRhythmAndBlues = 16;
-/** Soft Rhythm and Blues */
-const static TRdsProgrammeType KRbdsPtySoftRhythmAndBlues = 17;
-/** Language */
-const static TRdsProgrammeType KRbdsPtyLanguage = 18;
-/** Religious Music */
-const static TRdsProgrammeType KRbdsPtyReligiousMusic = 19;
-/** Religious Talk */
-const static TRdsProgrammeType KRbdsPtyReligiousTalk = 20;
-/** Personality */
-const static TRdsProgrammeType KRbdsPtyPersonality = 21;
-/** Public */
-const static TRdsProgrammeType KRbdsPtyPublic = 22;
-/** College */
-const static TRdsProgrammeType KRbdsPtyCollege = 23;
-/** Unassigned */
-const static TRdsProgrammeType KRbdsPtyUnassigned1 = 24;
-/** Unassigned */
-const static TRdsProgrammeType KRbdsPtyUnassigned2 = 25;
-/** Unassigned */
-const static TRdsProgrammeType KRbdsPtyUnassigned3 = 26;
-/** Unassigned */
-const static TRdsProgrammeType KRbdsPtyUnassigned4 = 27;
-/** Unassigned */
-const static TRdsProgrammeType KRbdsPtyUnassigned5 = 28;
-/** Weather */
-const static TRdsProgrammeType KRbdsPtyWeather = 29;
-/** Emergency Test */
-const static TRdsProgrammeType KRbdsPtyEmergencyTest = 30;
-/** Emergency */
-const static TRdsProgrammeType KRbdsPtyEmergency = 31;
-
-/**
-The RDS Capabilities class defines the capabilities of the RDS tuner on the
-device, as retrieved using the function GetRdsCapabilities.
-*/
-class TRdsCapabilities
-{
-public:
-    /** RDS Function Bit Flags */
-    enum TRdsFunctions
-    {
-        /** Traffic Announcement */
-        ERdsFunctionTa      = 0x01,
-        /** Regional Links */
-        ERdsFunctionRegLink = 0x02,
-        /** News Announcement */
-        ERdsFunctionNa      = 0x04,
-        /** Programme Type */
-        ERdsFunctionPty     = 0x08,
-        /** Clock Time */
-        ERdsFunctionCt      = 0x10,
-        /** Enhanced Other Networks */
-        ERdsFunctionEon     = 0x20,
-        /** Alternative Frequency */
-        ERdsFunctionAf      = 0x40
-    };
-public:
-    /** Bitfield as defined by ERdsFunctions with the bits of the supported functions set */
-    TUint32 iRdsFunctions;
-};
-
-class MMMRdsDataObserver;
-class MMMRdsEonObserver;
-class MMMRdsStateChangeObserver;
-class MMMRdsAnnouncementObserver;
-
-/**
-This class represents the basic RDS data associated with an RDS station.
-*/
-class TRdsData
-{
-public:
-    inline TRdsData();
-public:
-    /**
-    Enumeration to indicate a subset of the members of class TRdsData. These values should
-    be bitwise or'ed together to indicate which members belong in a set.
-    */
-    enum TField
-    {
-        /** Indicates the the member iPi is in a set */
-        EProgrammeIdentifier    = 0x001,
-        /** Indicates the the member iPs is in a set */
-        EStationName            = 0x002,
-        /** Indicates the the member iTp is in a set */
-        ETrafficProgramme       = 0x004,
-        /** Indicates the the member iTa is in a set */
-        ETrafficAnnouncement    = 0x008,
-        /** Indicates the the member iPty is in a set */
-        EProgrammeType          = 0x010,
-        /** Indicates the the member iPtyn is in a set */
-        EProgrammeTypeName      = 0x020,
-        /** Indicates the the member iPin is in a set */
-        EProgrammeItemNumber    = 0x040,
-        /** Indicates the the member iMs is in a set */
-        EMusicSpeech            = 0x080,
-        /** Indicates the the member iBroadcastLanguage is in a set */
-        EBroadcastLanguage      = 0x100,
-        /** Indicates the the member iEcc is in a set */
-        EExtendedCountryCode    = 0x200
-    };
-    /**
-    A value indicating a set containig all RDS data encapsulated by class TRdsData.
-    */
-    const static TUint32 KAllRdsData = (EProgrammeIdentifier | EStationName | ETrafficProgramme | ETrafficAnnouncement
-                                        | EProgrammeType | EProgrammeTypeName | EProgrammeItemNumber | EMusicSpeech
-                                        | EBroadcastLanguage | EExtendedCountryCode);
-public:
-    /** Programme Identifier of the station */
-    TRdsProgrammeIdentifier iPi;
-    /** Programme Station name of the station */
-    TRdsStationName iPs;
-    /** Value of the Traffic Programme flag of the station */
-    TBool iTp;
-    /** Value of the Traffic Announcement flag of the station */
-    TBool iTa;
-    /** Programme Type of the station */
-    TRdsProgrammeType iPty;
-    /** Programme Type Name of the station */
-    TRdsProgrammeTypeName iPtyn;
-    /** Programme Item Number of the station */
-    TRdsProgrammeItemNumber iPin;
-    /** Value of the Music Speech flag of the station. EFalse indicates the speech is being
-    broadcast at present. ETrue indicates that music is being broadcast, or that the flag is
-    not in use by the broadcaster. */
-    TBool iMs;
-    /** The current language of the broadcast */
-    TRdsLanguageIdentifier iBroadcastLanguage;
-    /** The Extended Country Code of the station */
-    TRdsCountryCode iEcc;
-};
-
-/**
-Class representing a station broadcast as an Enhanced Other Networks station.
-*/
-class TEonStation
-{
-public:
-    /**
-    Enumeration to indicate a subset of the members of class TEonStation. These values should
-    be bitwise or'ed together to indicate which members belong in a set.
-    */
-    enum TField
-    {
-        /** Indicates that member iProgrammeIdentifier is valid. */
-        EProgrammeIdentifier= 0x01,
-        /** Indicates that member iStationName is valid. */
-        EStationName        = 0x02,
-        /** Indicates that member iProgrammeType is valid. */
-        EProgrammeType      = 0x04,
-        /** Indicates that member iTrafficProgramme is valid. */
-        ETrafficProgramme   = 0x08,
-        /** Indicates that member iTrafficAnnouncement is valid. */
-        ETrafficAnnouncement= 0x10,
-        /** Indicates that member iProgrammeItemNumber is valid. */
-        EProgrammeItemNumber= 0x20,
-        /** Indicates that member iNoFrequencies is valid. */
-        ENoFrequencies      = 0x40,
-        /** Indicates that member iNoMappedFrequencies is valid. */
-        ENoMappedFrequencies= 0x80
-    };
-public:
-    /** The unique identifier of this station */
-    TRdsProgrammeIdentifier iProgrammeIdentifier;
-    /** The textual name of this station */
-    TRdsStationName iStationName;
-    /** The current programme type (PTY) of this station */
-    TRdsProgrammeType iProgrammeType;
-    /** Indicates if this station broadcasts traffic programmes */
-    TBool iTrafficProgramme;
-    /** Indicates if this station is currently broadcasting a traffic announcement */
-    TBool iTrafficAnnouncement;
-    /** The programme item number (PIN) of the current broadcast on this station. */
-    TRdsProgrammeItemNumber iProgrammeItemNumber;
-    /**
-    The number of frequencies associated with this station. If this number is zero,
-    it may be that the EON station uses the mapped frequencies method instead. See
-    iNoMappedFrequencies.
-    */
-    TInt iNoFrequencies;
-    /**
-    The number of mapped frequencies associated with this station. If this number is
-    zero, it may be that the EON station uses a flat frequency list instead. See
-    iNoFrequencies.
-    */
-    TInt iNoMappedFrequencies;
-    /**
-    Indicates the subset of fields of the class that are valid. Bits are set according to enumeration
-    TEonStation::TField
-    */
-    TUint32 iValid;
-};
-
-/**
-Mapped frequencies can be broadcast as a part of the EON information. They relate the
-current tuning frequency with the frequency which the referred EON station will be
-broadcast on.
-*/
-class TEonMappedFrequency
-{
-public:
-    inline TEonMappedFrequency(TFrequency aTuningFrequency, TFrequency aMappedFrequency);
-public:
-    /** The current tuning frequency, relating to the station broadcasting the EON informarion. */
-    TFrequency iTuningFrequency;
-    /**
-    The mapped frequency. If iTunedFrequency matches the currently tuned frequency, the
-    EON station will be broadcast on this frequency.
-    */
-    TFrequency iMappedFrequency;
-};
-
-/**
-The RDS class augments the tuner API to give access to the RDS capabilities
-of the device. As such additional tuner technologies can be supported without
-changing the Tuner API.
-
-Note that despite this class being names 'RDS', it is capable of supporting both
-the RDS standard, and the North American equivilant RBDS. The only important difference
-from the APIs perspective is the interpretation of the Programme Type (PTY) codes. See
-TRdsProgrammeType for more information.
-*/
-class CMMRdsTunerUtility : public CBase
-{
-    friend class CMMTunerUtility::CBody;
-public:
-    /** RDS Announcement Type */
-    enum TAnnouncementType
-    {
-        /** Traffic announcement */
-        ERdsTrafficAnnouncement,
-        /** News announcement */
-        ERdsNewsAnnouncement
-    };
-public:
-    /**
-    Factory function to create a new instance of the RDS Tuner API
-
-    @param aTuner A RDS capable tuner object (check using CMMTunerUtility::GetCapabilities())
-    @param aObserver The observer of the tuner to receive asynchronous completion messages.
-    @leave KErrNoMemory Out of memory
-    @leave KErrNotFound CMMRdsTunerUtility object is not present
-    @leave KErrNotSupported RDS is not supported by the tuner
-    @return A pointer and ownership of a fully constructed CMMRdsTunerUtility object
-    */
-    IMPORT_C static CMMRdsTunerUtility* NewL(CMMTunerUtility& aTuner, MMMTunerObserver& aObserver, CMMTunerUtility::TTunerBand aBand);
-
-    IMPORT_C ~CMMRdsTunerUtility();
-
-    /**
-    Get the RDS capabilities of the device
-
-    @param aCaps The capabilities object to fill
-    @return A standard system error code
-    */
-    IMPORT_C TInt GetRdsCapabilities(TRdsCapabilities& aCaps) const;
-
-    /**
-    Find a radio station which contains RDS data starting at the start frequency
-    and searching in the direction specified (i.e. Up or down).
-
-    @note this function is subject to the same access control scheme as the Tune
-          methods of CMMTunerUtility
-
-    @param aStartFrequency The frequency to start searching from, or 0 to start at the
-            beginning of the stated band.
-    @param aBand The frequency band to search. This must be a FM band.
-    @param aSearchDirection The direction to search in
-    @param aCircularSeek If set to ETrue the station seek will loop back to the
-           other end of the band once the end of the band has been reached.
-           (Defaults to ETrue) If not set reaching the end of the band without
-           finding a station will result in a callback to MToTuneComplete with error
-           KErrNotFound.
-    */
-    IMPORT_C void StationSearchByRds(TFrequency     aStartFrequency,
-                                     CMMTunerUtility::TSearchDirection aSearchDirection
-                                    );
-
-    /**
-    Find a radio station, of the specified programme type starting at the start
-    frequency and searching in the direction specified (i.e. Up or down).
-
-    @note this function is subject to the same access control scheme as the Tune
-          methods of CMMTunerUtility
-
-    @param aProgType The type of programme to search for
-    @param aStartFrequency The frequency to start searching from, or 0 to start at the
-            beginning of the stated band.
-    @param aBand The frequency band to search. This must be a FM band.
-    @param aSearchDirection The direction to search in
-    @param aCircularSeek If set to ETrue the station seek will loop back to the
-           other end of the band once the end of the band has been reached.
-           (Defaults to ETrue) If not set reaching the end of the band without
-           finding a station will result in a callback to MToTuneComplete with error
-           KErrNotFound.
-    */
-    IMPORT_C void StationSearchByProgrammeType(
-        TRdsProgrammeType aProgType,
-        TFrequency aStartFrequency,
-        CMMTunerUtility::TSearchDirection aSearchDirection
-    );
-
-    /**
-    Find a radio station, with the specified programme identifier starting at the
-    start frequency and searching in the direction specified (i.e. Up or down).
-
-    @note this function is subject to the same access control scheme as the Tune
-          methods of CMMTunerUtility
-
-    @param aPi The programme identifier of the station to search for
-    @param aStartFrequency The frequency to start searching from, or 0 to start at the
-            beginning of the stated band.
-    @param aBand The frequency band to search. This must be a FM band.
-    @param aSearchDirection The direction to search in
-    @param aCircularSeek If set to ETrue the station seek will loop back to the other
-           end of the band once the end of the band has been reached. (Defaults to ETrue)
-           If not set reaching the end of the band without finding a station will result
-           in a callback to MToTuneComplete with error KErrNotFound.
-    */
-    IMPORT_C void StationSearchByProgrammeIdentifier(
-        TRdsProgrammeIdentifier             aPi,
-        TFrequency                          aStartFrequency,
-        CMMTunerUtility::TSearchDirection   aSearchDirection
-    );
-
-    /**
-    Find a radio station, with the specified traffic programme flag value starting at
-    the start frequency and searching in the direction specified (i.e. Up or down).
-
-    @note this function is subject to the same access control scheme as the Tune
-          methods of CMMTunerUtility
-
-    @param aTp The TP flag value of a station to search for
-    @param aStartFrequency The frequency to start searching from, or 0 to start at the
-            beginning of the stated band.
-    @param aBand The frequency band to search. This must be a FM band.
-    @param aSearchDirection The direction to search in
-    @param aCircularSeek If set to ETrue the station seek will loop back to the other
-           end of the band once the end of the band has been reached. (Defaults to ETrue)
-           If not set reaching the end of the band without finding a station will result
-           in a callback to MToTuneComplete with error KErrNotFound.
-    */
-    IMPORT_C void StationSearchByTrafficProgramme(
-        TBool                              aTp,
-        TFrequency                         aStartFrequency,
-        CMMTunerUtility::TSearchDirection  aSearchDirection
-    );
-
-    /**
-    Cancels an ongoing RDS search as initiated by one of the functions
-    StationSearchByRds, StationSearchByProgrammeType,
-    StationSearchByProgrammeIdentifier or StationSearchByTrafficProgramme. The
-    asynchronous callback will not occur if this is called.
-
-    Has not affect if no RDS search operation is ongoing.
-    */
-    IMPORT_C void CancelRdsSearch();
-
-    /**
-    Requests notifications when all RDS data become invalid due to the tuner being
-    retuned.
-
-    @param aObserver The client to be notified.
-    @param aWhichData The subset of data for which change notifications are required.
-    @return A standard system wide error code.
-    */
-    IMPORT_C TInt NotifyRdsDataChange(MMMRdsDataObserver& aObserver, TUint32 aWhichData = TRdsData::KAllRdsData);
-
-    /**
-    Cancel a NotifyRdsDataChange request.
-    */
-    IMPORT_C void CancelNotifyRdsDataChange();
-
-    /**
-    Request some RDS data. This will complete immediately with whatever RDS data have already been
-    received.
-
-    When this function returns, and data that was requested but is not indicated to be
-    valid can be assumed not to have been received.
-
-    @param aData The RDS data will be written to this variable.
-    @param aValid On return, indicates a subset of RDS data that are valid.
-    @param aWhichData The subset of RDS data that are being requested.
-    @return A standard system wide error code.
-    */
-    IMPORT_C TInt GetRdsData(TRdsData& aData, TUint32& aValid, TUint32 aWhichData = TRdsData::KAllRdsData) const;
-
-    /**
-    Converts an RDS language identifier into a Symbian TLanguage type. Note that not all
-    languages defined by the RDS specification IEC62106 are present in the TLanguage
-    enumeration; in these cases, a value of ELangOther will be returned.
-
-    @param aRdsLangId An RDS language identification code
-    @return The corresponding TLanguage member, or ELangOther if none exists.
-    */
-    IMPORT_C static TLanguage ConvertRdsLanguageId(TRdsLanguageIdentifier aRdsLangId);
-
-    /**
-    Get the length of the available radio text. If no radio text is available this
-    function will return KErrNotFound. The maximum possible length for radio text is 64 characters.
-
-    @param aLength The variable to set to the length of the avaiable radio text
-    @return A standard system error code.
-    */
-    IMPORT_C TInt GetRadioTextLength(TUint& aLength) const;
-
-    /**
-    Get the radio text. If no radio text is available, this will return KErrNotFound. In this
-    case, a client can call NotifyRadioText to receive a notification when it is received.
-
-    The radio text will have been converted to unicode, eliminating any control characters
-    within it.
-
-    @param aRadioText The descriptor to fill with the radio text
-    @return A standard system error code
-    */
-    IMPORT_C TInt GetRadioText(TDes& aRadioText) const;
-
-    /**
-    Request notification when the radio text is received or changes.
-
-    @param aObserver The client to be notified when the radio text is received or changes.
-    @return A standard system wide error code.
-    */
-    IMPORT_C TInt NotifyRadioText(MMMRdsDataObserver& aObserver);
-
-    /**
-    Cancel a NotifyRadioText request.
-    */
-    IMPORT_C void CancelNotifyRadioText();
-
-    /**
-    Turns regional link function on or off depending on the value of the parameter.
-    A value of ETrue should be passed if you wish to stay tuned to the currently
-    tuned local station regardless of signal quality and signal strength.
-    i.e. don't switch to another local station in the region.
-
-    @param aRegOn ETrue to turn regional link on, EFalse to turn it off
-    @return A standard system error code
-    */
-    IMPORT_C TInt SetRegionalLink(TBool aRegOn);
-
-    /**
-    Finds out if the regional link function is currently on or off.
-
-    @param aRegOn This will be set to ETrue on return if and only if the regional
-           link function is currently enabled.
-    @return A standard system error code.
-    */
-    IMPORT_C TInt GetRegionalLink(TBool& aRegOn) const;
-
-    /**
-    Turn the travel announcement function on or off depending on the value of the
-    parameter. A value of ETrue turns on Traffic Announcements, EFalse turns them off.
-
-    If Traffic announcements are disabled while the tuner is retuned to a traffic
-    announcement, the tuner will not revert to the original frequency. To revert to
-    the original frequency, StopAnnouncement() must be called before the traffic
-    announcement feature is disabled.
-
-    @param aTaOn ETrue to turn TA on, EFalse to turn it off
-    @return A standard system error code
-    */
-    IMPORT_C TInt SetTrafficAnnouncement(TBool aTaOn);
-
-    /**
-    Finds out if the traffic announcement function is currently enabled or not.
-
-    @param aTaOn This is set to ETrue on return if and only if the traffic
-           announcement function is currenly enabled.
-    */
-    IMPORT_C TInt GetTrafficAnnouncement(TBool& aTaOn) const;
-
-    /**
-    Set the absolute volume to apply during a traffic or news announcement.
-
-    @param aVolume The volume to use. Must be between 0 and MaxVolume.
-    @return A standard system error code.
-    */
-    IMPORT_C TInt SetAnnouncementVolume(TInt aVolume);
-
-    /**
-    Find the current absolute volume level used for news of traffic annoucements.
-
-    @param aVolume This will be set to the current volume used for annoucements.
-    @return A standard system error code, KErrNotFound if a annoucement volume offset has been set.
-            use.
-    */
-    IMPORT_C TInt GetAnnouncementVolume(TInt& aVolume) const;
-
-    /**
-    Set the offset to the system volume level to apply during a traffic or news announcement
-
-    @param aVolumeOffset The offset to the volume level to set for announcements. Must be between -MaxVolume and MaxVolume inclusive.
-                         the actual volume with the offset applied will be clipped between 0 and MaxVolume if the offset would
-                         otherwise result in a volume outside this range.
-    @return A standard system error code
-    */
-    IMPORT_C TInt SetAnnouncementVolumeOffset(TInt aVolumeOffset);
-
-    /**
-    Find the current offset of the system volume that applies during traffic and news announcements.
-
-    @param aVolumeOffset This will be set to the current traffic and news announcement offset on return.
-    @return A standard system error code, KErrNotFound if an absolute annoucement volume has been set.
-    */
-    IMPORT_C TInt GetAnnouncementVolumeOffset(TInt& aVolumeOffset) const;
-
-    /**
-    Turn the news announcement function on or off depending on the value of the
-    parameter. The news announcement function when enabled causes the radio to
-    retune to a station when that station is broadcasting a news report. When the
-    news announcement is finished the radio will tune back to the original station.
-    A value of ETrue turns on News Announcements, EFalse turns them off.
-
-    If News announcements are disabled while the tuner is retuned to a news
-    announcement, the tuner will not revert to the original frequency. To revert to
-    the original frequency, StopAnnouncement() must be called before the news
-    announcement feature is disabled.
-
-    @param aNaOn ETrue to turn NA on, EFalse to turn it off
-    @return A standard system error code
-    */
-    IMPORT_C TInt SetNewsAnnouncement(TBool aNaOn);
-
-    /**
-    Finds out whether the news announcement function is on or off.
-
-    @param aNaOn This will be set to ETrue if and only if the new announcement
-           function is currently on.
-    @return A standard system error code.
-    */
-    IMPORT_C TInt GetNewsAnnouncement(TBool& aNaOn) const;
-
-    /**
-    Cancels any current announcement, reverting to the original frequency. The announcement
-    feature will remain enabled. If no announcement is currently happening, this function
-    has no affect. This can be used for both News and Traffic announcements.
-
-    @return A standard system error code. KErrNone if an announcement was successfully
-            stopped, or KErrNotReady if no announcement is currently happening.
-    */
-    IMPORT_C TInt StopAnnouncement();
-
-    /**
-    Turns alternative frequency function on or off depending on the value of the parameter.
-    A value of ETrue should be passed if you wish to enable automatic retuning to the current
-    station on an alternative frequency.
-
-    @param aAfOn ETrue to turn alternative frequency on, EFalse to turn it off
-    @return A standard system error code
-    */
-    IMPORT_C TInt SetAlternativeFrequency(TBool aAfOn);
-
-    /**
-    Finds out whether the alternative frequency function is on or off.
-
-    @param aAfOn This will be set to ETrue if and only if the alternative frequency
-           function is currently on.
-    @return A standard system error code.
-    */
-    IMPORT_C TInt GetAlternativeFrequency(TBool& aAfOn) const;
-
-    /**
-    Requests a notification when RDS functionality is enabled or disabled, or when
-    the traffic announcement volume offset is changed.
-
-    @param aObserver The class which is to be notified of the changes.
-    @return A standard system error code.
-    */
-    IMPORT_C TInt NotifyRdsStateChange(MMMRdsStateChangeObserver& aObserver);
-
-    /**
-    Cancels an outstanding RDS state change notification request.
-    */
-    IMPORT_C void CancelNotifyRdsStateChange();
-
-    /**
-    Get the current RDS time. This is an asynchronous function due to the latency of
-    the RDS information becoming available. This information is broadcast at the start of
-    every minute, and is not cached for obvious reasons. Thus, whenever a request is made,
-    it will complete next time the Data and Time are broadcast. The RDS standard states
-    that this is broadcast within 0.1s of the start of a minute, and is accurate to one
-    minute. The latency of the notification reaching the application cannot be guarteed.
-
-    @param aTimeAndDate The variable to set to the current RDS time and date
-    @param aStatus A TRequestStatus. This will be signalled when the request completes
-    and will contain the result of the request, this will be one of the system error codes.
-    */
-    IMPORT_C void GetRdsTime(TPckg<TDateTime>& aTimeAndDate, TRequestStatus& aStatus) const;
-
-    /**
-    Cancel the GetRdsTime request
-    */
-    IMPORT_C void CancelGetRdsTime();
-
-    /**
-    Request notification when a retune caused by an announcement occurs. This will be
-    a traffic or news announcement. A notification will be provided both at
-    the start of the announcement and at the end.
-
-    @param aObserver The object wishing to receive announcement events
-    @return A standard system error code
-    */
-    IMPORT_C TInt NotifyAnnouncement(MMMRdsAnnouncementObserver& aObserver);
-
-    /**
-    Cancel the NotifyAnnouncement request
-    */
-    IMPORT_C void CancelNotifyAnnouncement();
-
-    /**
-    Returns a list containing information about other networks broadcast with the currently tuned
-    programmme. This call will return immediately with whatever EON information is currently available.
-    Note that is is possible for this function to return no EON stations when several are being broadcast
-    simply because not enough RDS frames have been received yet. An interested application should make a
-    call to NotifyEonInfo to receive notifications when EON information is received or changes.
-
-    @param aEonInfo An array to which the EON information will be appended.
-    */
-    IMPORT_C void GetEonInfoL(RArray<TEonStation>& aEonInfo) const;
-
-    /**
-    Gets the frequencies assoicated with an EON station. This will complete immediately with whatever
-    frequencies are currently cached. An interested application should make a call to NotifyEonChange
-    to receive notifications when more frequencies are received.
-
-    @param aEonStation the EON station to get the frequencies for
-    @param aFrequencies an array to which the frequencies associated with the given station will be
-            appended.
-    */
-    IMPORT_C void GetEonFrequenciesL(const TEonStation& aEonStation, RArray<TFrequency>& aFrequencies) const;
-
-    /**
-    Gets the mapped frequencies associated with an EON station. This will complete immediately with whatever
-    mapped frequencies are currently cached. An interested application should make a call to NotifyEonChange
-    to receive notifications when more frequencies are received.
-
-    @param aEonStation the EON station to get the mapped frequencies for
-    @param aMappedFrequencies an array to which the mapped frequencies associated with the given station
-            will be appended.
-    */
-    IMPORT_C void GetEonMappedFrequenciesL(const TEonStation& aEonStation, RArray<TEonMappedFrequency>& aMappedFrequencies) const;
-
-    /**
-    Request notification when the Enhanced Other Networks (EON) information changes.
-
-    @param aObserver The client to be notifier when EON information changes or an error occurs.
-    */
-    IMPORT_C TInt NotifyEonInfo(MMMRdsEonObserver& aObserver);
-
-    /**
-    Cancels a NotifyEonInfo request.
-    */
-    IMPORT_C void CancelNotifyEonInfo();
-
-    /**
-    Tunes to a station represented by a TEonStation. This will result to a callback to MtoTuneComplete.
-
-    @param aEonStation The EON station that is to be tuned to.
-    */
-    IMPORT_C void TuneToEonStation(const TEonStation& aEonStation);
-
-    /**
-    Send a synchronous custom command to the RDS tuner.
-
-    @param aFunction The function number to indicate which function is to be called
-        on the interface defined by the first IPC argument
-    @param aArgs The IPC arguments to send to the RDS tuner. The first of these
-        arguments must be the UID of the interface within the tuner to which the
-        command is destined, represented as an integer. Failure to set the first
-        argument properly will result in the command completing with
-        KErrNotSupported at best, but possibly the client being panicked.
-    @return A standard system error code
-    */
-    IMPORT_C TInt CustomCommandSync(TInt aFunction, const TIpcArgs& aArgs);
-
-    /**
-    Send an asynchronous custom command to the RDS tuner.
-
-    @param aFunction The function number to indicate which function is to be called
-        on the interface defined by the first IPC argument
-    @param aArgs The IPC arguments to send to the RDS tuner. The first of these
-        arguments must be the UID of the interface within the tuner to which the
-        command is destined, represented as an integer. Failure to set the first
-        argument properly will result in the command completing with
-        KErrNotSupported at best, but possibly  the client being panicked.
-    @param aStatus The TRequestStatus of an active object. This will contain the
-        result of the request on completion.  The exact range of result values is
-        dependent on the interface.
-    */
-    IMPORT_C void CustomCommandAsync(TInt aFunction, const TIpcArgs& aArgs, TRequestStatus& aStatus);
-
-private:
-    CMMRdsTunerUtility();
-private:
-    class CBody;
-    CBody* iBody;
-
-};
-
-/**
-This mixin class should be implemented by applications wishing to receive notifications
-when RDS data is received, changes or becomes invalid. Each method corresponds to a
-particular request in CMMRdsTunerUtility. Only methods corresponding to requests in
-CMMRdsTunerUtility that are used by a client need be implemented - empty default
-implementations are provided.
-*/
-class MMMRdsDataObserver
-{
-public:
-    /**
-    Called when some error occurs which makes RDS data unavailable.
-    */
-    virtual void MrdoError(TInt aError)  = 0;
-
-    /**
-    Called when some RDS data is received or has changed.
-
-    Two subsets of the RDS data supplied are indicted: that which has changed and that which is
-    valid. This information can be interpreted as follows:
-    For an item of RDS data x:
-        valid(x)  & !changed(x) => x was received before and has not changed
-        valid(x)  & changed(x)  => x has either just been received for the first time, or has just changed
-        !valid(x) & changed(x)  => x is no longer available
-        !valid(x) & !changed(x) => x was not available before, and is still not available.
-
-    When the tuner is retuned to a new station, all RDS data will be flushed. This will result in
-    a call to this function indicating that all RDS data has changed and is longer valid.
-
-    @param aData The RDS data.
-    @param aValid Indicates a subset of aData that is valid (i.e. has been received)
-    @param aChanged Indicates a subset of aData that has changed since the last call to this function.
-    */
-    virtual void MrdoDataReceived(const TRdsData& aData, TUint32 aValid, TUint32 aChanged) = 0;
-
-    /**
-    Called when the RDS Radio Text (RT) is received, changes, or is no longer available.
-
-    @param aRt The Radio Text message. This will be empty if aValid==EFalse.
-    @param aValid Indicates if the radio text is valid.
-    @param aChanges Indicates if the radio test has changed.
-    */
-    virtual void MrdoRadioTextReceived(const TDesC& aRt, TBool aValid, TBool aChanged) = 0;
-};
-
-/**
-The state change observer mixin class defines the interface via which changes to
-the state of the RDS radio can be observed. These state changes will be a result
-of a client enabling or disabling RDS functionality.
-*/
-class MMMRdsStateChangeObserver
-{
-public:
-    /**
-    Called when the regional link functionality is enabled/disabled.
-
-    @param aNewRegLinkOn The new setting: ETrue if the regional link function has
-           just been enabled.
-    */
-    virtual void MrscoRegionalLinkChanged(TBool aNewRegLinkOn) = 0;
-
-    /**
-    Called when the traffic announcement functionality has just been enabled or
-    disabled.
-
-    @param aNewTaOn ETrue if the TA function is now on, EFalse otherwise.
-    */
-    virtual void MrscoTrafficAnnouncementChanged(TBool aNewTaOn) = 0;
-
-    /**
-    Called when the traffic and news announcement volume offset is changed. A callback to
-    this method indicates the a volume offset is being used instead of an absolute volume.
-
-    @param aOldOffset The announcement volume offset before the change
-    @param aNewOffset The announcement volume offset after the change
-    */
-    virtual void MrscoAnnouncementVolumeOffsetChanged(TInt aOldOffset, TInt aNewOffset) = 0;
-
-    /**
-    Called when the traffic an news announcement volume is changed. A callback to
-    this method indicates that an absolute volume is being used instead of volume offsets.
-
-    @param aOldVolume The announcement volume before the change.
-    @param aNewVolume The announcement volume after the change.
-    */
-    virtual void MrscoAnnouncementVolumeChanged(TInt aOldVolume, TInt aNewVolume) = 0;
-
-    /**
-    Called when the news announcement functionality has just been enabled or
-    disabled.
-
-    @param aNewNAOn ETrue if the NA function is now enabled, else EFalse.
-    */
-    virtual void MrscoNewsAnnouncementChanged(TBool aNewNAOn) = 0;
-
-    /**
-    Called when the alternative frequencies function is turned on or off.
-
-    @param aNewAFOn ETrue if the AF function has just been turned on, else EFalse.
-    */
-    virtual void MrscoAlternativeFrequenciesChanged(TBool aNewAFOn) = 0;
-};
-
-
-/**
-The Announcement Observer mixin class defines the interface via which
-announcement events can be received. A client interested in such
-information calls the function NotifyAnnouncement.
-*/
-class MMMRdsAnnouncementObserver
-{
-public:
-    /**
-    Called when an announcement starts
-
-    @param aType The type of announcement (travel or news)
-    */
-    virtual void MraoAnnouncementStart(CMMRdsTunerUtility::TAnnouncementType aType) = 0;
-
-    /**
-    Called when an announcement ends
-
-    @param aType The type of announcement (travel or news)
-    */
-    virtual void MraoAnnouncementEnd(CMMRdsTunerUtility::TAnnouncementType aType) = 0;
-
-    /**
-    Called when an error occurs which results in announcement notifications
-    becoming unavailable.
-    */
-    virtual void MraoError(TInt aError) = 0;
-};
-
-/**
-The enhanced other networks observer mixin class defines the interface via
-which changes to the enhanced other networks information can be notified. A
-client interested in such information calls the function NotifyEonChange.
-*/
-class MMMRdsEonObserver
-{
-public:
-    /**
-    Called when some details of an EON station change. The station can be referenced
-    to an existing one using it's Programme Identifier, which cannot change.
-
-    @param aStation A TEonStation containing the new information about the station.
-    @param aChanged The subset of the members of aStation that have changed. Bits are
-            set according to TEonStation::TField.
-    */
-    virtual void MreoEonStationChanged(const TEonStation& aStation, TUint32 aChanged) = 0;
-
-    /**
-    Called when details of a new EON station are received.
-
-    @param aStation A TEonStation containing the new information about the station.
-    */
-    virtual void MreoNewEonStation(const TEonStation& aStation) = 0;
-
-    /**
-    Called when details of <b>all</b> EON stations cease to be broadcast. This will
-    typically happen when the tuner is retuned. More EON stations may continue to be
-    recieved: this call does not indicate that EON information is no longer available.
-    */
-    virtual void MreoAllEonStationsRemoved() = 0;
-
-    /**
-    Called when details of an EON station cease to be broadcast.
-
-    @param aPi The programme identifier of the EON station which has been removed.
-    */
-    virtual void MreoEonStationRemoved(const TRdsProgrammeIdentifier& aPi) = 0;
-
-    /**
-    Called when an error occurs resulting in EON notifications not being available.
-    */
-    virtual void MreoError(TInt aError) = 0;
-};
-
-#include <tuner.inl>
-
-#endif // TUNER_H
-
-// End of file
-
--- a/javauis/amms_qt/src_tuner/native/external_include/tuner.inl	Tue Jul 06 14:10:26 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,84 +0,0 @@
-/*
-* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:  Inline functions for Tuner component.
-*
-*/
-
-
-TTunerCapabilities::TTunerCapabilities()
-        : iTunerBands(0), iAdditionalFunctions(0)
-{}
-
-TTunerCapabilities::TTunerCapabilities(TUint32 aTunerBands, TUint32 aAdditionalFunctions)
-        : iTunerBands(aTunerBands), iAdditionalFunctions(aAdditionalFunctions)
-{}
-
-TFrequency::TFrequency()
-        : iFrequency(0)
-{}
-
-TFrequency::TFrequency(TInt aFrequency)
-        : iFrequency(aFrequency)
-{}
-
-TInt TFrequency::operator==(const TFrequency& aFrequency) const
-{
-    return (iFrequency==aFrequency.iFrequency);
-}
-
-TInt TFrequency::operator!=(const TFrequency& aFrequency) const
-{
-    return (iFrequency!=aFrequency.iFrequency);
-}
-
-TInt TFrequency::operator> (const TFrequency& aFrequency) const
-{
-    return (iFrequency>aFrequency.iFrequency);
-}
-
-TInt TFrequency::operator>=(const TFrequency& aFrequency) const
-{
-    return (iFrequency>=aFrequency.iFrequency);
-}
-
-TInt TFrequency::operator< (const TFrequency& aFrequency) const
-{
-    return (iFrequency<aFrequency.iFrequency);
-}
-
-TInt TFrequency::operator<=(const TFrequency& aFrequency) const
-{
-    return (iFrequency<=aFrequency.iFrequency);
-}
-
-TRdsData::TRdsData()
-{
-}
-
-TEonMappedFrequency::TEonMappedFrequency(TFrequency aTuningFrequency, TFrequency aMappedFrequency)
-        : iTuningFrequency(aTuningFrequency), iMappedFrequency(aMappedFrequency)
-{
-}
-
-TInt TRdsProgrammeItemNumber::operator==(const TRdsProgrammeItemNumber& aPin) const
-{
-    return ((iDayOfMonth==aPin.iDayOfMonth)&&(iHour==aPin.iHour)&&(iMinute==aPin.iMinute));
-}
-
-TInt TRdsProgrammeItemNumber::operator!=(const TRdsProgrammeItemNumber& aPin) const
-{
-    return (!((*this)==aPin));
-}
-
-// End of file
--- a/javauis/amms_qt/src_tuner/native/inc/ammstunerfactory.h	Tue Jul 06 14:10:26 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,95 +0,0 @@
-/*
-* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:  This class is used to create tuner player and control
-*
-*/
-
-
-
-#ifndef AMMSTUNERFACTORY_H
-#define AMMSTUNERFACTORY_H
-
-//  INCLUDES
-#include <e32base.h>
-
-#include "CAMMSTunerControl.h"
-
-// FORWARD DECLARATIONS
-class CAMMSTunerPlayer;
-class CAMMSTunerControl;
-
-// CLASS DECLARATION
-/**
-*  This class is used to create tuner player and control.
-*  It parses locator parameters and set them to control.
-*/
-
-NONSHARABLE_CLASS(AMMSTunerFactory)
-{
-public:  // Constructors and destructor
-
-    /**
-    * Destructor.
-    */
-    virtual ~AMMSTunerFactory();
-
-public: // New functions
-
-    /**
-    * ?member_description.
-    * @param aTunerPlayer
-    * @param aLocatorParams
-    */
-    static void CreatePlayerL(CAMMSTunerPlayer** aTunerPlayer,
-                              const TDesC* aLocatorParams);
-
-protected:  // New functions
-
-    /**
-    * Parse all locator parameters.
-    * @param aLocatorParams
-    * @param aFrequency
-    * @param aStereoMode
-    * @param aPreset
-    */
-    static void ParseParamsL(const TDesC* aLocatorParams,
-                             TInt& aFrequency,
-                             TInt& aStereoMode,
-                             TInt& aPreset);
-
-    /**
-    * Parses frequency parameter
-    * @param aFrequency - locator's frequency parameter
-    * @return frequency in TInt
-    */
-    static TInt ParseFreqL(const TPtrC aFrequency);
-
-    /**
-    * Converts TPtrC to TReal using TLex.
-    * @param aHertz - hertzs in TPtrC
-    * @return hertzs in TReal
-    */
-    static TReal TDesCToTRealL(const TPtrC aHertz);
-
-private:
-
-    /**
-    * C++ default constructor.
-    */
-    AMMSTunerFactory();
-};
-
-#endif // AMMSTUNERFACTORY_H
-
-// End of File
--- a/javauis/amms_qt/src_tuner/native/inc/cammstunercontrol.h	Tue Jul 06 14:10:26 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,290 +0,0 @@
-/*
-* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:  Control for tuner
-*
-*/
-
-
-#ifndef CAMMSTUNERCONTROL_H
-#define CAMMSTUNERCONTROL_H
-
-//  INCLUDES
-#include <e32base.h>
-#include <tuner.h>
-
-#include <CMMAControl.h>
-
-
-// FORWARD DECLARATIONS
-class CAMMSTunerPlayer;
-class CAMMSTunerPresetsHandler;
-
-// CLASS DECLARATION
-/**
-*  Control for tuner
-*/
-
-NONSHARABLE_CLASS(CAMMSTunerControl) : public CMMAControl,
-        public MMMTunerObserver,
-        public MMMTunerChangeObserver,
-        public MMMTunerStereoObserver
-{
-public:  // Constructors and destructor
-
-    /**
-    * Two-phased constructor.
-    */
-    static CAMMSTunerControl* NewL();
-
-    /**
-    * Destructor.
-    */
-    virtual ~CAMMSTunerControl();
-
-public: // New functions
-
-    /**
-    * Getter for CMMTunerUtility
-    * @return CMMTunerUtility
-    */
-    CMMTunerUtility* TunerUtility();
-
-    /**
-    * Gets the minimum frequency supported by this tuner
-    * with the given modulation.
-    * @return minimum frequency supported by this tuner
-    */
-    TInt MinFreqL();
-
-    /**
-    * Gets the maximum frequency supported by this tuner
-    * with the given modulation.
-    * @return maximum frequency supported by this tuner
-    */
-    TInt MaxFreqL();
-
-    /**
-    * Tunes to the given frequency or to the closest supported frequency.
-    * @param aFreq - the frequency in Hertzs that will be taken into use
-    * @return the frequency in 100 Hertzs that was taken into use
-
-    */
-    void SetFrequencyL(TInt aFreq);
-
-    /**
-    * Gets the frequency which the tuner has been tuned to.
-    * @return the frequency to which the device has been tuned,
-    *         in 100 Hertzs
-    */
-    TInt FrequencyL();
-
-    /**
-    * Seeks for the next broadcast signal.
-    * @param aStartFreq - the frequency in Hertzs wherefrom the scan starts
-    * @param aUpwards - if true, the scan proceeds towards higher
-    *                   frequencies, otherwise towards lower frequencies
-    * @return the found frequency
-    */
-    TInt SeekL(TInt aStartFreq, TBool aUpwards);
-
-    /**
-    * Gets the current squelching (muting in frequencies without broadcast)
-    * setting.
-    * @return true if squelch is on or false if squelch is off
-    */
-    TBool SquelchL();
-
-    /**
-    * Sets squelching on or off.
-    * @param aSquelch - true to turn the squelch on or false
-    *                   to turn the squelch off
-    */
-    void SetSquelchL(TBool aSquelch);
-
-    /**
-    * Gets the strength of the recepted signal.
-    * @return a value between 0 and 100 where 0 means the faintest
-    *         and 100 the strongest possible signal strength
-    */
-    TInt SignalStrengthL();
-
-    /**
-    * Gets the stereo mode in use.
-    * @return stereo mode in use
-    */
-    TInt StereoModeL();
-
-    /**
-    * Sets the stereo mode.
-    * @param aMode - the stereo mode to be used
-    */
-    void SetStereoModeL(TInt aMode);
-
-    /**
-    * Tunes the tuner by using settings specified in the preset.
-    * @param aPreset - the preset to be used.
-    */
-    void UsePresetL(TInt aPreset);
-
-    /**
-    * Configures the preset using current frequency and modulation
-    * and stereo mode.
-    * @param aPreset - the preset to be set.
-    */
-    void SetPresetL(TInt aPreset);
-
-    /**
-    * Configures the preset using given settings.
-    * @param aPreset - the preset to be set.
-    * @param aFrequency - the frequency to be set.
-    * @param aStereoMode - the stereo mode to be set.
-    */
-    void SetPresetL(TInt aPreset, TInt aFrequency, TInt aStereoMode);
-
-    /**
-    * Gets preset frequency
-    * @param aPreset - the preset whose frequency is to be returned
-    .       * @return the frequency of the preset in 100 Hertzs
-    */
-    TInt PresetFrequencyL(TInt aPreset);
-
-    /**
-    * Gets preset stereo mode
-    * @param aPreset - the preset whose stereo mode is to be returned
-    .       * @return the stereo mode of the preset.
-    */
-    TInt PresetStereoModeL(TInt aPreset);
-
-    /**
-    * Set preset name
-    * @param aPreset - the preset whose name is to be set
-    * @param aPresetName - the name of the preset
-    */
-    void SetPresetNameL(TInt aPreset, const TDesC* aPresetName);
-
-    /**
-    * Get preset name
-    * @param aPreset - the preset whose name is asked
-    * @param aPresetName - the name of the preset
-    */
-    void GetPresetNameL(TInt aPreset, TPtrC* aPresetName);
-
-public: // functions from base classes
-
-    // from CMMAControl
-
-    const TDesC& ClassName() const;
-
-    const TDesC& PublicClassName() const;
-
-    // from MMMTunerObserver
-
-    void MToTuneComplete(TInt aError);
-
-    // from class MMMTunerChangeObserver
-
-    /**
-    Called when the tuned frequency changes
-
-    @param aOldFrequency The frequency in use before the change
-    @param aNewFrequency The new tuned frequency
-    */
-    void MTcoFrequencyChanged(const TFrequency& aOldFrequency,
-                              const TFrequency& aNewFrequency);
-
-    /**
-    Called when the state of the tuner changes.
-
-    @param aOldState The old state. Bits are set according to TTunerState.
-    @param aNewState The new state. Bits are set according to TTunerState.
-    */
-    void MTcoStateChanged(const TUint32& aOldState,
-                          const TUint32& aNewState);
-
-    /**
-    This function is called when an external antenna is detached from the device.
-    This does not necessarily indicate that the tuner can no longer be used; the
-    capabilities of the tuner indicate if the external antenna is required in order
-    to use the tuner.
-    */
-    void MTcoAntennaDetached();
-
-    /**
-    This function is called when an external antenna is attached to the device. If
-    the antenna is required to use the tuner, this indicates that the tuner can be
-    used again.
-    */
-    void MTcoAntennaAttached();
-
-    /**
-    This function is called when the device enters or leaves flight mode. If the tuner
-    cannot be used in flight mode when the device enters this mode, this indicates
-    that the tuner can no longer be used; the capabilities of the tuner indicate if
-    it can be used in flight mode or not.
-
-    @param aFlightMode ETrue if the device has just entered flight mode, EFalse if
-            flight mode has just been left.
-    */
-    void FlightModeChanged(TBool aFlightMode);
-
-    // from class MMMTunerStereoObserver
-
-    /**
-    Called when stereo reception is lost/restored.
-
-    @param aStereo If true, indicates that stereo reception has just been restored.
-           If false, indicates that stereo reception has just been lost.
-    */
-    void MTsoStereoReceptionChanged(TBool aStereo);
-
-    /**
-    Called when a client enables/disabled forced mono reception.
-
-    @param aForcedMono ETrue if reception is forced to be mono, even when a stereo
-           signal is available.
-    */
-    void MTsoForcedMonoChanged(TBool aForcedMono);
-
-
-private:
-
-    /**
-    * C++ default constructor.
-    */
-    CAMMSTunerControl();
-
-    /**
-    * By default Symbian 2nd phase constructor is private.
-    */
-    void ConstructL();
-
-    // Prohibit copy constructor if not deriving from CBase.
-    // CAMMSTunerControl( const CAMMSTunerControl& );
-    // Prohibit assigment operator if not deriving from CBase.
-    // CAMMSTunerControl& operator=( const CAMMSTunerControl& );
-
-
-private:    // Data
-
-    TInt iMinFreq;
-    TInt iMaxFreq;
-
-    CMMTunerUtility*  iTunerUtility;
-    CActiveSchedulerWait* iActiveSchedulerWait;
-    CAMMSTunerPresetsHandler* iPresetsHandler;
-};
-
-#endif // CAMMSTUNERCONTROL_H
-
-// End of File
--- a/javauis/amms_qt/src_tuner/native/inc/cammstunerplayer.h	Tue Jul 06 14:10:26 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,92 +0,0 @@
-/*
-* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-
-
-#ifndef CAMMSTUNERPLAYER_H
-#define CAMMSTUNERPLAYER_H
-
-//  INCLUDES
-#include <CMMAPlayer.h>
-#include "CAMMSTunerControl.h"
-
-#include <e32base.h>
-#include <tuner.h>
-
-
-// CLASS DECLARATION
-
-/**
-*  Player for tuner
-*
-*/
-NONSHARABLE_CLASS(CAMMSTunerPlayer) : public CMMAPlayer,
-        public MMMTunerAudioPlayerObserver
-{
-public:  // Constructors and destructor
-
-    /**
-    * Two-phased constructor.
-    */
-    static CAMMSTunerPlayer* NewL(CAMMSTunerControl* aTunerControl);
-
-    /**
-    * Destructor.
-    */
-    virtual ~CAMMSTunerPlayer();
-
-public: // from CMMAPlayer
-
-    void PrefetchL();
-    void StartL();
-    void StopL(TBool aPostEvent);
-    void DeallocateL();
-    void GetMediaTime(TInt64* aMediaTime);
-
-public: // from MMMTunerAudioPlayerObserver
-
-    void MTapoInitializeComplete(TInt aError);
-    void MTapoPlayEvent(MMMTunerAudioPlayerObserver::TEventType aEvent, TInt aError, TAny* aAdditionalInfo);
-
-private:
-
-    /**
-    * C++ default constructor.
-    */
-    CAMMSTunerPlayer();
-
-    /**
-    * By default Symbian 2nd phase constructor is private.
-    */
-    void ConstructL(CAMMSTunerControl* aTunerControl);
-
-
-    TInt64 CurrentTime();
-
-private:    // Data
-    CMMTunerAudioPlayerUtility* iTunerPlayerUtility;
-    CAMMSTunerControl* iTunerControl;
-    CActiveSchedulerWait* iActiveSchedulerWait;
-
-    TBool  iIsInitialized;
-    TInt64 iMediaTime;
-    TInt64 iStartTime;
-};
-
-#endif // CAMMSTUNERPLAYER_H
-
-// End of File
--- a/javauis/amms_qt/src_tuner/native/inc/cammstunerpresetshandler.h	Tue Jul 06 14:10:26 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,95 +0,0 @@
-/*
-* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:  This class handles presets central repository usage.
-*
-*/
-
-
-
-#ifndef CAMMSTUNERPRESETSHANDLER_H
-#define CAMMSTUNERPRESETSHANDLER_H
-
-//  INCLUDES
-#include    <e32base.h>
-#include    <centralrepository.h>
-
-
-// FORWARD DECLARATIONS
-class TAMMSTunerPreset;
-
-// CLASS DECLARATION
-/**
-* This class handles presets central repository usage.
-*
-*  @lib ?library
-*  @since ?Series60_version
-*/
-NONSHARABLE_CLASS(CAMMSTunerPresetsHandler) : public CBase
-{
-public:  // Constructors and destructor
-
-    /**
-    * Two-phased constructor.
-    */
-    static CAMMSTunerPresetsHandler* NewL();
-
-    /**
-    * Destructor.
-    */
-    virtual ~CAMMSTunerPresetsHandler();
-
-public: // New functions
-
-    /**
-    * Gets presets from central repository
-    * @param aPreset - presets index
-    * @param aTunerPreset
-    */
-    void GetPresetL(TInt aPreset, TAMMSTunerPreset &aTunerPreset);
-
-    /**
-    * Save presets to central repository
-    * @param aPreset - presets index
-    * @param aTunerPreset
-    */
-    void SavePresetL(TInt aPreset, TAMMSTunerPreset aTunerPreset);
-
-private:
-
-    /**
-    * C++ default constructor.
-    */
-    CAMMSTunerPresetsHandler();
-
-    /**
-    * By default Symbian 2nd phase constructor is private.
-    */
-    void ConstructL();
-
-    // Prohibit copy constructor if not deriving from CBase.
-    // CAMMSTunerPresetsHandler( const CAMMSTunerPresetsHandler& );
-    // Prohibit assigment operator if not deriving from CBase.
-    // CAMMSTunerPresetsHandler& operator=( const CAMMSTunerPresetsHandler& );
-
-
-private:    // Data
-
-    CRepository* iCentralRepository;
-
-
-};
-
-#endif // CAMMSTUNERPRESETSHANDLER_H
-
-// End of File
--- a/javauis/amms_qt/src_tuner/native/inc/cammstunervolumecontrol.h	Tue Jul 06 14:10:26 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,61 +0,0 @@
-/*
-* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:  This class is used for setting volume to tuner player
-*
-*/
-
-
-#ifndef CAMMSTUNERVOLUMECONTROL_H
-#define CAMMSTUNERVOLUMECONTROL_H
-
-//  INCLUDES
-#include <e32base.h>
-
-#include <CMMAVolumeControl.h>
-
-// FORWARD DECLARATIONS
-class CAMMSTunerPlayer;
-
-// CLASS DECLARATION
-/**
-*  This class is used for setting volume to tuner player
-*/
-
-NONSHARABLE_CLASS(CAMMSTunerVolumeControl) : public CMMAVolumeControl
-{
-public:  // Constructor
-    static CAMMSTunerVolumeControl* NewL(CAMMSTunerPlayer* aTunerPlayer);
-
-public: // functions from base classes
-
-    // from CMMAVolumeControl
-
-    void DoSetLevelL(TInt aLevel);
-
-private:
-
-    /**
-    * C++ default constructor.
-    */
-    CAMMSTunerVolumeControl(CAMMSTunerPlayer* aTunerPlayer);
-
-
-private:    // Data
-
-    CAMMSTunerPlayer* iTunerPlayer;
-};
-
-#endif // CAMMSTUNERVOLUMECONTROL_H
-
-// End of File
--- a/javauis/amms_qt/src_tuner/native/inc/tammstunerpreset.h	Tue Jul 06 14:10:26 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,104 +0,0 @@
-/*
-* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:  Helper class for preset handling, reads and writes preset
-*                values in/out stream.
-*
-*/
-
-
-
-#ifndef TAMMSTUNERPRESET_H
-#define TAMMSTUNERPRESET_H
-
-//  INCLUDES
-#include <e32base.h>
-
-
-// FORWARD DECLARATIONS
-class RWriteStream;
-class RReadStream;
-
-// CONSTANTS
-const TInt KPresetNameLength = 100;
-
-// CLASS DECLARATION
-/**
-*  Helper class for preset handling, reads and writes preset
-*  values in/out stream.
-*
-*  @lib ?library
-*  @since ?Series60_version
-*/
-NONSHARABLE_CLASS(TAMMSTunerPreset)
-{
-public:
-
-    /**
-    * C++ default constructor.
-    */
-    TAMMSTunerPreset();
-
-    /**
-    * Setter for preset name.
-    */
-    void SetPresetName(const TDesC* aPresetName);
-
-    /**
-    * Setter for preset frequency.
-    */
-    void SetPresetFrequency(const TInt aPresetFrequency);
-
-    /**
-    * Setter for preset stereo mode.
-    */
-    void SetPresetStereoMode(const TInt aPresetStereoMode);
-
-    /**
-    * Getter for preset name.
-    */
-    TPtrC PresetName();
-
-    /**
-    * Getter for preset frequency.
-    */
-    TInt PresetFrequency();
-
-    /**
-    * Getter for preset stereo mode.
-    */
-    TInt PresetStereoMode();
-
-    /**
-    * Serialize the data to stream.
-    * @param aStream - used for write stream
-    */
-    void ExternalizeL(RWriteStream &aStream) const;
-
-    /**
-    * deserialize the data out of stream.
-    * @param aStream  used for read stream
-    */
-    void InternalizeL(RReadStream &aStream);
-
-private:
-
-    TBuf<KPresetNameLength> iPresetName;
-    TInt iPresetFrequency;
-    TInt iPresetStereoMode;
-
-};
-
-#endif // TAMMSTUNERPRESET_H
-
-// End of File
--- a/javauis/amms_qt/src_tuner/native/src/ammstunerfactory.cpp	Tue Jul 06 14:10:26 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,300 +0,0 @@
-/*
-* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:  This class is used to create tuner player and control
-*
-*/
-
-
-
-// INCLUDE FILES
-#include    "AMMSTunerFactory.h"
-#include    "CAMMSTunerPlayer.h"
-#include    "CAMMSTunerControl.h"
-//#include    "CAMMSTunerVolumeControl.h"
-#include    <CMMAPlayerProperties.h>
-
-#include    <e32std.h>
-#include    <e32math.h>
-#include <logger.h>
-
-// CONSTANTS
-_LIT(KFreqParam, "f");
-
-_LIT(KModulationParam, "mod");
-
-_LIT(KStereoModeParam, "st");
-MMA_PARAMETER_STR(KStereoModeParamMono, "mono");
-MMA_PARAMETER_STR(KStereoModeParamStereo, "stereo");
-MMA_PARAMETER_STR(KStereoModeParamAuto, "auto");
-MMA_PARAMETER_ARRAY(KValidStereoModeValues)
-{
-    {
-        &KStereoModeParamMono
-    }, {&KStereoModeParamStereo}, {&KStereoModeParamAuto}
-};
-
-_LIT(KProgramIdParam, "id");
-_LIT(KPresetParam, "preset");
-
-_LIT(KModulationFm, "fm");
-
-_LIT(KStereoModeMono, "mono");
-_LIT(KStereoModeStereo, "stereo");
-_LIT(KStereoModeAuto, "auto");
-
-const TInt KMegaHertzChar = 'M';
-const TInt KKiloHertzChar = 'k';
-const TInt KFreqDotChar   = '.';
-
-const TInt KMegaHzMultiplier = 1000000;
-const TInt KKiloHzMultiplier = 1000;
-
-const TInt KStereoModeMonoInt   = 1;
-const TInt KStereoModeStereoInt = 2;
-const TInt KStereoModeAutoInt   = 3;
-
-// ============================ MEMBER FUNCTIONS ===============================
-
-// Destructor
-AMMSTunerFactory::~AMMSTunerFactory()
-{
-
-}
-
-
-// -----------------------------------------------------------------------------
-// AMMSTunerFactory::CreatePlayerL
-// ?implementation_description
-// (other items were commented in a header).
-// -----------------------------------------------------------------------------
-//
-void AMMSTunerFactory::CreatePlayerL(CAMMSTunerPlayer** aTunerPlayer,
-                                     const TDesC* aLocatorParams)
-{
-    LOG( EJavaAMMS, EInfo, "AMMSTunerFactory::CreatePlayerL +");
-
-    TInt frequency = 0;
-    TInt stereoMode = 0;
-    TInt preset = 0;
-
-    if (aLocatorParams->Length() != 0)
-    {
-        LOG( EJavaAMMS, EInfo, "AMMSTunerFactory::CreatePlayerL 1");
-        ParseParamsL(aLocatorParams, frequency, stereoMode, preset);
-    }
-
-    //create tunercontrol
-    CAMMSTunerControl* tunerControl = CAMMSTunerControl::NewL();
-    CleanupStack::PushL(tunerControl);
-
-    //set values to tunercontrol
-    if (frequency > 0)
-    {
-        tunerControl->SetFrequencyL(frequency);
-    }
-
-    if (frequency == 0)
-    {
-        //by default frequency is fm modulation's min freq
-        tunerControl->SetFrequencyL(tunerControl->MinFreqL());
-    }
-
-    if (stereoMode > 0)
-    {
-        tunerControl->SetStereoModeL(stereoMode);
-    }
-
-    if (preset > 0)
-    {
-        tunerControl->UsePresetL(preset);
-    }
-
-    //create tunerplayer
-    *aTunerPlayer = CAMMSTunerPlayer::NewL(tunerControl);
-
-    //create tunervolumeconrol
-    //CAMMSTunerVolumeControl* tunerVolumeControl = CAMMSTunerVolumeControl::NewL( *aTunerPlayer );
-
-    //add controls to player
-    (*aTunerPlayer)->AddControlL(tunerControl);
-    //(*aTunerPlayer)->AddControlL( tunerVolumeControl );
-    CleanupStack::Pop(tunerControl);
-    LOG( EJavaAMMS, EInfo, "AMMSTunerFactory::CreatePlayerL -");
-}
-
-// -----------------------------------------------------------------------------
-// AMMSTunerFactory::ParseParamsL
-// ?implementation_description
-// (other items were commented in a header).
-// -----------------------------------------------------------------------------
-//
-void AMMSTunerFactory::ParseParamsL(const TDesC* aLocatorParams,
-                                    TInt& aFrequency,
-                                    TInt& aStereoMode,
-                                    TInt& aPreset)
-{
-    LOG( EJavaAMMS, EInfo, "AMMSTunerFactory::ParseParamsL +");
-    CMMAParameterRuleSet* rules = CMMAParameterRuleSet::NewLC();
-
-    //freq rule
-    TMMAParameterRuleDes freqRule(KFreqParam);
-    rules->AppendRuleL(&freqRule);
-
-    //modulation rule
-    TMMAParameterRuleDes modulationRule(KModulationParam);
-    rules->AppendRuleL(&modulationRule);
-
-    //stereo mode rule
-    TMMAParameterRuleDes stereoModeRule(KStereoModeParam, KValidStereoModeValues,
-                                        MMA_PARAMETER_ARRAY_SIZE(KValidStereoModeValues));
-    rules->AppendRuleL(&stereoModeRule);
-
-    //preset rule KMinTInt-KMaxTInt
-    TMMAParameterRuleInt presetRule(KPresetParam);
-    rules->AppendRuleL(&presetRule);
-
-    //id rule
-    TMMAParameterRuleDes idRule(KProgramIdParam);
-    rules->AppendRuleL(&idRule);
-
-    CMMAPlayerProperties* properties = CMMAPlayerProperties::NewL(*aLocatorParams, *rules);
-    CleanupStack::PushL(properties);
-
-    // validating properties
-    properties->ValidateL();
-
-    //get freq
-    TPtrC freq(NULL, 0);
-    properties->GetProperty(KFreqParam, freq);
-    //parse frequency
-    if (freq.Length() != 0)
-    {
-        aFrequency = ParseFreqL(freq);
-    }
-
-    //get modulation
-    TPtrC modulation(NULL, 0);
-    properties->GetProperty(KModulationParam, modulation);
-    if (modulation.Length() != 0)
-    {
-        // only fm modulation is supported
-        if (modulation.Compare(KModulationFm) != 0)
-        {
-            User::Leave(KErrNotSupported);
-        }
-    }
-
-    //get stereo mode
-    TPtrC stereoMode(NULL, 0);
-    properties->GetProperty(KStereoModeParam, stereoMode);
-    if (stereoMode.Compare(KStereoModeMono) == 0)
-    {
-        aStereoMode = KStereoModeMonoInt;
-    }
-    else if (stereoMode.Compare(KStereoModeStereo) == 0)
-    {
-        aStereoMode = KStereoModeStereoInt;
-    }
-    else if (stereoMode.Compare(KStereoModeAuto) == 0)
-    {
-        aStereoMode = KStereoModeAutoInt;
-    }
-
-    //get preset
-    properties->GetProperty(KPresetParam, aPreset);
-
-    //get id
-    TPtrC id(NULL, 0);
-    properties->GetProperty(KProgramIdParam, id);
-    if (id.Length() != 0)
-    {
-        // id is not supported
-        User::Leave(KErrNotSupported);
-    }
-
-    CleanupStack::PopAndDestroy(properties);
-    CleanupStack::PopAndDestroy(rules);
-    LOG( EJavaAMMS, EInfo, "AMMSTunerFactory::ParseParamsL -");
-}
-
-// -----------------------------------------------------------------------------
-// AMMSTunerFactory::ParseFreqL
-// ?implementation_description
-// (other items were commented in a header).
-// -----------------------------------------------------------------------------
-//
-TInt AMMSTunerFactory::ParseFreqL(const TPtrC aFrequency)
-{
-    LOG( EJavaAMMS, EInfo, "AMMSTunerFactory::ParseFreqL +");
-    TReal freqReal = 0;
-
-    //is value MHz or kHz or just hertz
-    TInt freqPrefixMPos = aFrequency.Locate(KMegaHertzChar);
-    TInt freqPrefixKPos = aFrequency.Locate(KKiloHertzChar);
-
-    if (freqPrefixMPos != KErrNotFound)
-    {
-        //there is a M
-        TPtrC hertz = aFrequency.Left(freqPrefixMPos);
-        //TPtrC -> TReal
-        TReal value = TDesCToTRealL(hertz);
-
-        freqReal = value * KMegaHzMultiplier;
-    }
-    else if (freqPrefixKPos != KErrNotFound)
-    {
-        //there is a k
-        TPtrC hertz = aFrequency.Left(freqPrefixKPos);
-        //TPtrC -> TReal
-        TReal value = TDesCToTRealL(hertz);
-
-        freqReal = value * KKiloHzMultiplier;
-    }
-    else
-    {
-        //parameter value is simply hertz, there is no M or k
-        //TPtrC -> TReal
-        freqReal = TDesCToTRealL(aFrequency);
-    }
-    TInt32 freqInt = 0;
-    //TReal -> TInt
-    TInt err = Math::Int(freqInt, freqReal);
-    if (err != KErrNone)
-    {
-        User::Leave(KErrArgument);
-    }
-
-    return freqInt;
-}
-
-// -----------------------------------------------------------------------------
-// AMMSTunerFactory::TDesCToTRealL
-// ?implementation_description
-// (other items were commented in a header).
-// -----------------------------------------------------------------------------
-//
-TReal AMMSTunerFactory::TDesCToTRealL(const TPtrC aHertz)
-{
-    LOG( EJavaAMMS, EInfo, "AMMSTunerFactory::TDesCToTRealL +");
-    TReal valueReal = 0;
-    TLex lex(aHertz);
-    if ((lex.Val(valueReal, KFreqDotChar) != KErrNone) ||
-            !lex.Eos())
-    {
-        User::Leave(KErrArgument);
-    }
-    return valueReal;
-}
-
-//  End of File
--- a/javauis/amms_qt/src_tuner/native/src/cammstunercontrol.cpp	Tue Jul 06 14:10:26 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,504 +0,0 @@
-/*
-* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:  This class is used to control tuner
-*
-*/
-
-
-
-// INCLUDE FILES
-#include    "CAMMSTunerControl.h"
-#include    "CAMMSTunerPlayer.h"
-#include    "CAMMSTunerPresetsHandler.h"
-#include    "TAMMSTunerPreset.h"
-#include    "AMMSTunerFactory.h"
-
-#include    <tuner.h>
-#include <logger.h>
-
-
-// CONSTANTS
-_LIT(KControlImplName, "com.nokia.amms.control.tuner.TunerControlImpl");
-_LIT(KControlPublicName, "javax.microedition.amms.control.tuner.TunerControl");
-
-const TInt KStereoModeMono   = 1;
-const TInt KStereoModeStereo = 2;
-const TInt KStereoModeAuto   = 3;
-
-
-// ============================ MEMBER FUNCTIONS ===============================
-
-// -----------------------------------------------------------------------------
-// CAMMSTunerControl::CAMMSTunerControl
-// C++ default constructor can NOT contain any code, that
-// might leave.
-// -----------------------------------------------------------------------------
-//
-CAMMSTunerControl::CAMMSTunerControl()
-{
-}
-
-// -----------------------------------------------------------------------------
-// CAMMSTunerControl::NewL
-// Two-phased constructor.
-// -----------------------------------------------------------------------------
-//
-CAMMSTunerControl* CAMMSTunerControl::NewL()
-{
-    CAMMSTunerControl* self = new(ELeave) CAMMSTunerControl;
-
-    CleanupStack::PushL(self);
-    self->ConstructL();
-    CleanupStack::Pop();
-
-    return self;
-}
-
-// -----------------------------------------------------------------------------
-// CAMMSTunerControl::ConstructL
-// Symbian 2nd phase constructor can leave.
-// -----------------------------------------------------------------------------
-//
-void CAMMSTunerControl::ConstructL()
-{
-    LOG( EJavaAMMS, EInfo, "CAMMSTunerControl::ConstructL +");
-
-    iTunerUtility = CMMTunerUtility::NewL(*this,
-                                          CMMTunerUtility::ETunerBandFm,
-                                          1,
-                                          CMMTunerUtility::ETunerAccessPriorityNormal);
-
-    iActiveSchedulerWait = new(ELeave) CActiveSchedulerWait();
-
-    iPresetsHandler = CAMMSTunerPresetsHandler::NewL();
-
-    iMinFreq = MinFreqL();
-    iMaxFreq = MaxFreqL();
-
-    LOG( EJavaAMMS, EInfo, "CAMMSTunerControl::ConstructL -");
-}
-
-
-// Destructor
-CAMMSTunerControl::~CAMMSTunerControl()
-{
-    LOG( EJavaAMMS, EInfo, "CAMMSTunerControl::~CAMMSTunerControl +");
-    delete iTunerUtility;
-    delete iActiveSchedulerWait;
-    delete iPresetsHandler;
-    LOG( EJavaAMMS, EInfo, "CAMMSTunerControl::~CAMMSTunerControl -");
-}
-
-// -----------------------------------------------------------------------------
-// CAMMSTunerControl::TunerUtility()
-// -----------------------------------------------------------------------------
-CMMTunerUtility* CAMMSTunerControl::TunerUtility()
-{
-    LOG( EJavaAMMS, EInfo, "CAMMSTunerControl::TunerUtility");
-    return iTunerUtility;
-}
-
-// -----------------------------------------------------------------------------
-// CAMMSTunerControl::MinFreq()
-// -----------------------------------------------------------------------------
-TInt CAMMSTunerControl::MinFreqL()
-{
-    LOG( EJavaAMMS, EInfo, "CAMMSTunerControl::MinFreqL +");
-    TFrequency minFreq;
-    TFrequency maxFreq;
-    User::LeaveIfError(iTunerUtility->GetFrequencyBandRange(minFreq,
-                       maxFreq));
-    LOG1( EJavaAMMS, EInfo, "CAMMSTunerControl::MinFreqL = %d", minFreq.iFrequency);
-    return minFreq.iFrequency;
-}
-
-// -----------------------------------------------------------------------------
-// CAMMSTunerControl::MaxFreq()
-// -----------------------------------------------------------------------------
-TInt CAMMSTunerControl::MaxFreqL()
-{
-    LOG( EJavaAMMS, EInfo, "CAMMSTunerControl::MaxFreqL +");
-    TFrequency minFreq;
-    TFrequency maxFreq;
-    User::LeaveIfError(iTunerUtility->GetFrequencyBandRange(minFreq,
-                       maxFreq));
-    LOG1( EJavaAMMS, EInfo, "CAMMSTunerControl::MaxFreqL = %d", maxFreq.iFrequency);
-    return maxFreq.iFrequency;
-}
-
-// -----------------------------------------------------------------------------
-// CAMMSTunerControl::SetFrequency()
-// -----------------------------------------------------------------------------
-void CAMMSTunerControl::SetFrequencyL(TInt aFreq)
-{
-    LOG( EJavaAMMS, EInfo, "CAMMSTunerControl::SetFrequency +");
-    if (aFreq < iMinFreq || aFreq > iMaxFreq)
-    {
-        User::Leave(KErrArgument);
-    }
-
-    TFrequency freq = TFrequency(aFreq);
-
-    TUint32 state = 0;
-    iTunerUtility->GetState(state);
-    LOG1( EJavaAMMS, EInfo, "CAMMSTunerControl::SetFrequency, state = %d", state);
-
-    LOG1( EJavaAMMS, EInfo, "CAMMSTunerControl::SetFrequency = %d", freq.iFrequency);
-
-    iTunerUtility->Tune(freq);
-    if (!iActiveSchedulerWait->IsStarted())
-    {
-        iActiveSchedulerWait->Start();  // CSI: 10 Active object state already checked. #
-    }
-    LOG( EJavaAMMS, EInfo, "CAMMSTunerControl::SetFrequency -");
-}
-
-// -----------------------------------------------------------------------------
-// CAMMSTunerControl::Frequency()
-// -----------------------------------------------------------------------------
-TInt CAMMSTunerControl::FrequencyL()
-{
-    LOG( EJavaAMMS, EInfo, "CAMMSTunerControl::Frequency +");
-    TFrequency freq;
-
-    User::LeaveIfError(iTunerUtility->GetFrequency(freq));
-    TInt frequency = freq.iFrequency;
-    LOG1( EJavaAMMS, EInfo, "CAMMSTunerControl::Frequency frequency = %d", frequency);
-    return frequency;
-}
-
-// -----------------------------------------------------------------------------
-// CAMMSTunerControl::SeekL()
-// -----------------------------------------------------------------------------
-TInt CAMMSTunerControl::SeekL(TInt aStartFreq, TBool aUpwards)
-{
-    LOG( EJavaAMMS, EInfo, "CAMMSTunerControl::SeekL +");
-    if (aStartFreq < iMinFreq || aStartFreq > iMaxFreq)
-    {
-        User::Leave(KErrArgument);
-    }
-
-    if (aUpwards)
-    {
-        iTunerUtility->StationSeek(CMMTunerUtility::ESearchDirectionUp);
-        if (!iActiveSchedulerWait->IsStarted())
-        {
-            iActiveSchedulerWait->Start();  // CSI: 10 Active object state already checked. #
-        }
-    }
-    else
-    {
-        iTunerUtility->StationSeek(CMMTunerUtility::ESearchDirectionDown);
-        if (!iActiveSchedulerWait->IsStarted())
-        {
-            iActiveSchedulerWait->Start();  // CSI: 10 Active object state already checked. #
-        }
-    }
-
-    return FrequencyL();
-}
-
-// -----------------------------------------------------------------------------
-// CAMMSTunerControl::SquelchL()
-// -----------------------------------------------------------------------------
-TBool CAMMSTunerControl::SquelchL()
-{
-    LOG( EJavaAMMS, EInfo, "CAMMSTunerControl::SquelchL +");
-    TBool enabled = EFalse;
-    User::LeaveIfError(iTunerUtility->GetSquelch(enabled));
-    return enabled;
-}
-
-// -----------------------------------------------------------------------------
-// CAMMSTunerControl::SetSquelchL()
-// -----------------------------------------------------------------------------
-void CAMMSTunerControl::SetSquelchL(TBool aSquelch)
-{
-    LOG( EJavaAMMS, EInfo, "CAMMSTunerControl::SetSquelchL +");
-    User::LeaveIfError(iTunerUtility->SetSquelch(aSquelch));
-}
-
-// -----------------------------------------------------------------------------
-// CAMMSTunerControl::SignalStrengthL()
-// -----------------------------------------------------------------------------
-TInt CAMMSTunerControl::SignalStrengthL()
-{
-    LOG( EJavaAMMS, EInfo, "CAMMSTunerControl::SignalStrengthL +");
-    TInt maxSignalStrength = 0;
-    TInt signalStrength = 0;
-
-    User::LeaveIfError(iTunerUtility->GetMaxSignalStrength(maxSignalStrength));
-    LOG1( EJavaAMMS, EInfo, "CAMMSTunerControl::SignalStrengthL, maxSignalStrength = %d", maxSignalStrength);
-    User::LeaveIfError(iTunerUtility->GetSignalStrength(signalStrength));
-    LOG1( EJavaAMMS, EInfo, "CAMMSTunerControl::SignalStrengthL, signalStrength = %d", signalStrength);
-    if (maxSignalStrength > 0)
-    {
-        return signalStrength / maxSignalStrength * 100; // CSI: 47 signal strength must be between 0 and 100 #
-    }
-    return KErrNotSupported;
-}
-
-// -----------------------------------------------------------------------------
-// CAMMSTunerControl::StereoModeL()
-// -----------------------------------------------------------------------------
-TInt CAMMSTunerControl::StereoModeL()
-{
-    LOG( EJavaAMMS, EInfo, "CAMMSTunerControl::StereoModeL +");
-    TBool mono = EFalse;
-    TBool stereo = EFalse;
-
-    User::LeaveIfError(iTunerUtility->GetForcedMonoReception(mono));
-    if (mono)
-    {
-        return KStereoModeMono;
-    }
-
-    //User::LeaveIfError( iTunerUtility->IsStereoSignal( stereo ) );
-    TInt err = iTunerUtility->IsStereoSignal(stereo);
-    //this is for emulator testing, FIX IT
-    if (err == KErrNotReady)
-    {
-        return KStereoModeAuto;
-    }
-    else if (err != KErrNone)
-    {
-        User::LeaveIfError(err);
-    }
-
-    if (stereo)
-    {
-        return KStereoModeStereo;
-    }
-
-    return KStereoModeAuto;
-}
-
-// -----------------------------------------------------------------------------
-// CAMMSTunerControl::SetStereoMode()
-// -----------------------------------------------------------------------------
-void CAMMSTunerControl::SetStereoModeL(TInt aMode)
-{
-    LOG( EJavaAMMS, EInfo, "CAMMSTunerControl::SetStereoModeL +");
-    if (aMode == KStereoModeMono)
-    {
-        User::LeaveIfError(iTunerUtility->ForceMonoReception(ETrue));
-    }
-
-    if (aMode == KStereoModeStereo)
-    {
-        User::LeaveIfError(iTunerUtility->ForceMonoReception(EFalse));
-        TBool stereo = EFalse;
-        User::LeaveIfError(iTunerUtility->IsStereoSignal(stereo));
-        if (!stereo)
-        {
-            User::Leave(KErrNotSupported);
-        }
-    }
-
-    if (aMode == KStereoModeAuto)
-    {
-        User::LeaveIfError(iTunerUtility->ForceMonoReception(EFalse));
-    }
-}
-
-// -----------------------------------------------------------------------------
-// CAMMSTunerControl::UsePresetL()
-// -----------------------------------------------------------------------------
-void CAMMSTunerControl::UsePresetL(TInt aPreset)
-{
-    LOG( EJavaAMMS, EInfo, "CAMMSTunerControl::UsePresetL +");
-    TAMMSTunerPreset tunerPreset;
-
-    //get presets
-    iPresetsHandler->GetPresetL(aPreset, tunerPreset);
-
-    //set presets to tunerutility
-    SetFrequencyL(tunerPreset.PresetFrequency());
-    SetStereoModeL(tunerPreset.PresetStereoMode());
-}
-
-// -----------------------------------------------------------------------------
-// CAMMSTunerControl::SetPresetL()
-// -----------------------------------------------------------------------------
-void CAMMSTunerControl::SetPresetL(TInt aPreset)
-{
-    LOG( EJavaAMMS, EInfo, "CAMMSTunerControl::SetPresetL1 +");
-    TAMMSTunerPreset tunerPreset;
-
-    //get current frequency
-    tunerPreset.SetPresetFrequency(FrequencyL());
-    //get current stereo mode
-    tunerPreset.SetPresetStereoMode(StereoModeL());
-
-    iPresetsHandler->SavePresetL(aPreset, tunerPreset);
-}
-
-// -----------------------------------------------------------------------------
-// CAMMSTunerControl::SetPresetL()
-// -----------------------------------------------------------------------------
-void CAMMSTunerControl::SetPresetL(TInt aPreset,
-                                   TInt aFrequency,
-                                   TInt aStereoMode)
-{
-    LOG( EJavaAMMS, EInfo, "CAMMSTunerControl::SetPresetL2 +");
-    TAMMSTunerPreset tunerPreset;
-
-    tunerPreset.SetPresetFrequency(aFrequency);
-    tunerPreset.SetPresetStereoMode(aStereoMode);
-
-    iPresetsHandler->SavePresetL(aPreset, tunerPreset);
-}
-
-// -----------------------------------------------------------------------------
-// CAMMSTunerControl::PresetFrequencyL()
-// -----------------------------------------------------------------------------
-TInt CAMMSTunerControl::PresetFrequencyL(TInt aPreset)
-{
-    LOG( EJavaAMMS, EInfo, "CAMMSTunerControl::PresetFrequencyL +");
-    TAMMSTunerPreset tunerPreset;
-
-    iPresetsHandler->GetPresetL(aPreset, tunerPreset);
-
-    return tunerPreset.PresetFrequency();
-}
-
-// -----------------------------------------------------------------------------
-// CAMMSTunerControl::PresetStereoModeL()
-// -----------------------------------------------------------------------------
-TInt CAMMSTunerControl::PresetStereoModeL(TInt aPreset)
-{
-    LOG( EJavaAMMS, EInfo, "CAMMSTunerControl::PresetStereoModeL +");
-    TAMMSTunerPreset tunerPreset;
-
-    iPresetsHandler->GetPresetL(aPreset, tunerPreset);
-
-    return tunerPreset.PresetStereoMode();
-}
-
-// -----------------------------------------------------------------------------
-// CAMMSTunerControl::SetPresetNameL()
-// -----------------------------------------------------------------------------
-void CAMMSTunerControl::SetPresetNameL(TInt aPreset, const TDesC* aPresetName)
-{
-    LOG( EJavaAMMS, EInfo, "CAMMSTunerControl::SetPresetNameL +");
-    TAMMSTunerPreset tunerPreset;
-
-    iPresetsHandler->GetPresetL(aPreset, tunerPreset);
-
-    tunerPreset.SetPresetName(aPresetName);
-
-    iPresetsHandler->SavePresetL(aPreset, tunerPreset);
-}
-
-// -----------------------------------------------------------------------------
-// CAMMSTunerControl::GetPresetNameL()
-// -----------------------------------------------------------------------------
-void CAMMSTunerControl::GetPresetNameL(TInt aPreset, TPtrC* aPresetName)
-{
-    LOG( EJavaAMMS, EInfo, "CAMMSTunerControl::GetPresetNameL +");
-    TAMMSTunerPreset tunerPreset;
-
-    iPresetsHandler->GetPresetL(aPreset, tunerPreset);
-
-    aPresetName->Set(tunerPreset.PresetName());
-}
-
-// -----------------------------------------------------------------------------
-// CAMMSTunerControl::ClassName()
-// -----------------------------------------------------------------------------
-const TDesC& CAMMSTunerControl::ClassName() const
-{
-    return KControlImplName;
-}
-
-// -----------------------------------------------------------------------------
-// CAMMSTunerControl::PublicClassName()
-// -----------------------------------------------------------------------------
-const TDesC& CAMMSTunerControl::PublicClassName() const
-{
-    return KControlPublicName;
-}
-
-// -----------------------------------------------------------------------------
-// CAMMSTunerControl::MToTuneComplete()
-// -----------------------------------------------------------------------------
-void CAMMSTunerControl::MToTuneComplete(TInt aError)
-{
-    if (iActiveSchedulerWait->IsStarted())
-    {
-        LOG( EJavaAMMS, EInfo, "CAMMSTunerControl::MToTuneComplete AsyncStop");
-        iActiveSchedulerWait->AsyncStop();
-    }
-    ELOG1( EJavaAMMS, "CAMMSTunerControl::MToTuneComplete ERROR = %d", aError);
-}
-
-// -----------------------------------------------------------------------------
-// CAMMSTunerControl::MTcoFrequencyChanged
-// -----------------------------------------------------------------------------
-void CAMMSTunerControl::MTcoFrequencyChanged(const TFrequency& /*aOldFrequency*/,
-        const TFrequency& /*aNewFrequency*/)
-{
-    LOG( EJavaAMMS, EInfo, "CAMMSTunerControl::MTcoFrequencyChanged");
-}
-
-// -----------------------------------------------------------------------------
-// CAMMSTunerControl::MTcoStateChanged
-// -----------------------------------------------------------------------------
-void CAMMSTunerControl::MTcoStateChanged(const TUint32& /*aOldState*/,
-        const TUint32& /*aNewState*/)
-{
-    LOG( EJavaAMMS, EInfo, "CAMMSTunerControl::MTcoStateChanged");
-}
-
-// -----------------------------------------------------------------------------
-// CAMMSTunerControl::MTcoAntennaDetached
-// -----------------------------------------------------------------------------
-void CAMMSTunerControl::MTcoAntennaDetached()
-{
-    LOG( EJavaAMMS, EInfo, "CAMMSTunerControl::MTcoAntennaDetached");
-}
-
-// -----------------------------------------------------------------------------
-// CAMMSTunerControl::MTcoAntennaAttached
-// -----------------------------------------------------------------------------
-void CAMMSTunerControl::MTcoAntennaAttached()
-{
-    LOG( EJavaAMMS, EInfo, "CAMMSTunerControl::MTcoAntennaAttached");
-}
-
-// -----------------------------------------------------------------------------
-// CAMMSTunerControl::FlightModeChanged
-// -----------------------------------------------------------------------------
-void CAMMSTunerControl::FlightModeChanged(TBool /*aFlightMode*/)
-{
-    LOG( EJavaAMMS, EInfo, "CAMMSTunerControl::FlightModeChanged");
-}
-
-// -----------------------------------------------------------------------------
-// CAMMSTunerControl::MTsoStereoReceptionChanged
-// -----------------------------------------------------------------------------
-void CAMMSTunerControl::MTsoStereoReceptionChanged(TBool /*aStereo*/)
-{
-    LOG( EJavaAMMS, EInfo, "CAMMSTunerControl::MTsoStereoReceptionChanged");
-}
-
-// -----------------------------------------------------------------------------
-// CAMMSTunerControl::MTsoForcedMonoChanged
-// -----------------------------------------------------------------------------
-void CAMMSTunerControl::MTsoForcedMonoChanged(TBool /*aForcedMono*/)
-{
-    LOG( EJavaAMMS, EInfo, "CAMMSTunerControl::MTsoForcedMonoChanged");
-}
-
-//  End of File
--- a/javauis/amms_qt/src_tuner/native/src/cammstunerplayer.cpp	Tue Jul 06 14:10:26 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,236 +0,0 @@
-/*
-* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:  This class is a tuner player
-*
-*/
-
-
-
-// INCLUDE FILES
-#include    "CAMMSTunerPlayer.h"
-#include    "CAMMSTunerControl.h"
-
-#include    <tuner.h>
-#include <logger.h>
-
-
-// ============================ MEMBER FUNCTIONS ===============================
-
-// -----------------------------------------------------------------------------
-// CAMMSTunerPlayer::CAMMSTunerPlayer
-// C++ default constructor can NOT contain any code, that
-// might leave.
-// -----------------------------------------------------------------------------
-//
-CAMMSTunerPlayer::CAMMSTunerPlayer()
-{
-}
-
-// -----------------------------------------------------------------------------
-// CAMMSTunerPlayer::NewL
-// Two-phased constructor.
-// -----------------------------------------------------------------------------
-//
-CAMMSTunerPlayer* CAMMSTunerPlayer::NewL(CAMMSTunerControl* aTunerControl)
-{
-    CAMMSTunerPlayer* self = new(ELeave) CAMMSTunerPlayer;
-
-    CleanupStack::PushL(self);
-    self->ConstructL(aTunerControl);
-    CleanupStack::Pop();
-
-    return self;
-}
-
-
-// -----------------------------------------------------------------------------
-// CAMMSTunerPlayer::ConstructL
-// Symbian 2nd phase constructor can leave.
-// -----------------------------------------------------------------------------
-//
-void CAMMSTunerPlayer::ConstructL(CAMMSTunerControl* aTunerControl)
-{
-    LOG( EJavaAMMS, EInfo, "CAMMSTunerPlayer::ConstructL +");
-    iTunerControl = aTunerControl;
-    iTunerPlayerUtility = iTunerControl->TunerUtility()->TunerPlayerUtilityL(*this);
-    iActiveSchedulerWait = new(ELeave) CActiveSchedulerWait();
-    iIsInitialized = EFalse;
-
-    LOG( EJavaAMMS, EInfo, "CAMMSTunerPlayer::ConstructL -");
-}
-
-// Destructor
-CAMMSTunerPlayer::~CAMMSTunerPlayer()
-{
-    LOG( EJavaAMMS, EInfo, "CAMMSTunerPlayer::~CAMMSTunerPlayer +");
-    delete iTunerPlayerUtility;
-    delete iActiveSchedulerWait;
-    LOG( EJavaAMMS, EInfo, "CAMMSTunerPlayer::~CAMMSTunerPlayer -");
-}
-
-// -----------------------------------------------------------------------------
-// CAMMSTunerPlayer::PrefetchL()
-// ?implementation_description
-// (other items were commented in a header).
-// -----------------------------------------------------------------------------
-void CAMMSTunerPlayer::PrefetchL()
-{
-    LOG( EJavaAMMS, EInfo, "CAMMSTunerPlayer::PrefetchL +");
-    //this must be called before play, stop, mute etc...
-    iTunerPlayerUtility->InitializeL(EMdaPriorityNormal,
-                                     EMdaPriorityPreferenceTimeAndQuality);
-    if (!iActiveSchedulerWait->IsStarted())
-    {
-        iActiveSchedulerWait->Start();  // CSI: 10 Active object state already checked. #
-    }
-
-    LOG( EJavaAMMS, EInfo, "CAMMSTunerPlayer::PrefetchL -");
-}
-
-// -----------------------------------------------------------------------------
-// CAMMSTunerPlayer::StartL()
-// ?implementation_description
-// (other items were commented in a header).
-// -----------------------------------------------------------------------------
-void CAMMSTunerPlayer::StartL()
-{
-    LOG( EJavaAMMS, EInfo, "CAMMSTunerPlayer::StartL +");
-    if (iIsInitialized)
-    {
-        // inform java side
-        ChangeState(EStarted);
-        iTunerPlayerUtility->Play();
-        // set time when started
-        iStartTime = CurrentTime();
-
-        TInt64 time;
-        GetMediaTime(&time);
-        PostLongEvent(CMMAPlayerEvent::EStarted, time);
-    }
-    else
-    {
-        User::Leave(KErrNotReady);
-    }
-    LOG( EJavaAMMS, EInfo, "CAMMSTunerPlayer::StartL -");
-}
-
-// -----------------------------------------------------------------------------
-// CAMMSTunerPlayer::StopL()
-// ?implementation_description
-// (other items were commented in a header).
-// -----------------------------------------------------------------------------
-void CAMMSTunerPlayer::StopL(TBool /*aPostEvent*/)
-{
-    LOG( EJavaAMMS, EInfo, "CAMMSTunerPlayer::StopL +");
-    if (iIsInitialized)
-    {
-        ChangeState(EPrefetched);
-
-        iTunerPlayerUtility->Stop();
-
-        TInt64 time;
-        GetMediaTime(&time);
-        iStartTime = KErrNotFound;
-        PostLongEvent(CMMAPlayerEvent::EStopped, time);
-    }
-    else
-    {
-        User::Leave(KErrNotReady);
-    }
-
-    LOG( EJavaAMMS, EInfo, "CAMMSTunerPlayer::StopL -");
-}
-
-// -----------------------------------------------------------------------------
-// CAMMSTunerPlayer::DeallocateL()
-// ?implementation_description
-// (other items were commented in a header).
-// -----------------------------------------------------------------------------
-void CAMMSTunerPlayer::DeallocateL()
-{
-
-}
-
-// -----------------------------------------------------------------------------
-// CAMMSTunerPlayer::GetMediaTime()
-// ?implementation_description
-// (other items were commented in a header).
-// -----------------------------------------------------------------------------
-void CAMMSTunerPlayer::GetMediaTime(TInt64* aMediaTime)
-{
-    if (iState == EStarted)
-    {
-        // add play time to media time
-        iMediaTime += CurrentTime() - iStartTime;
-        // set new start time
-        iStartTime = CurrentTime();
-    }
-
-    // set value to parameter
-    (*aMediaTime) = iMediaTime;
-}
-
-// -----------------------------------------------------------------------------
-// CAMMSTunerPlayer::MTapoInitializeComplete
-// Initialize complete event. This event is asynchronous and is received after
-//  a call to CMMTunerAudioPlayerUtility::InitializeL().
-// -----------------------------------------------------------------------------
-void CAMMSTunerPlayer::MTapoInitializeComplete(TInt aError)
-{
-    ELOG1( EJavaAMMS, "CAMMSTunerPlayer::MTapoInitializeComplete aError = %d", aError);
-    if (iActiveSchedulerWait->IsStarted())
-    {
-        LOG( EJavaAMMS, EInfo, "CAMMSTunerControl::MToTuneComplete AsyncStop");
-        iActiveSchedulerWait->AsyncStop();
-    }
-    if (aError == KErrNone)
-    {
-        iIsInitialized = ETrue;
-        ChangeState(EPrefetched);
-        // Inform Java side.
-        PostActionCompleted(KErrNone);
-    }
-    else
-    {
-        ELOG1( EJavaAMMS, "CAMMSTunerPlayer::MTapoInitializeComplete aError = %d", aError);
-        PostLongEvent(CMMAPlayerEvent::EError, aError);
-        //User::Leave( aError );
-    }
-}
-
-// -----------------------------------------------------------------------------
-// CAMMSTunerPlayer::MTapoPlayEvent
-// Passes an asychronous event to the tuner client.
-// (other items were commented in a header).
-// -----------------------------------------------------------------------------
-void CAMMSTunerPlayer::MTapoPlayEvent(
-    MMMTunerAudioPlayerObserver::TEventType /*aEvent*/,
-    TInt /*aError*/, TAny* /*aAdditionalInfo*/)
-{
-    LOG( EJavaAMMS, EInfo, "CAMMSTunerPlayer::MTapoPlayEvent +");
-}
-
-// -----------------------------------------------------------------------------
-// CAMMSTunerPlayer::CurrentTime()
-// ?implementation_description
-// (other items were commented in a header).
-// -----------------------------------------------------------------------------
-TInt64 CAMMSTunerPlayer::CurrentTime()
-{
-    TTime time;
-    time.HomeTime();
-    return time.Int64();
-}
-
-//  End of File
--- a/javauis/amms_qt/src_tuner/native/src/cammstunerpresetshandler.cpp	Tue Jul 06 14:10:26 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,133 +0,0 @@
-/*
-* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:  ?Description
-*
-*/
-
-
-
-// INCLUDE FILES
-#include    "CAMMSTunerPresetsHandler.h"
-#include    "TAMMSTunerPreset.h"
-
-#include    <FMRadioEngineCRKeys.h>
-#include    <s32mem.h>
-#include <logger.h>
-
-
-// CONSTANTS
-
-
-// ============================ MEMBER FUNCTIONS ===============================
-
-// -----------------------------------------------------------------------------
-// CAMMSTunerPresetsHandler::CAMMSTunerPresetsHandler
-// C++ default constructor can NOT contain any code, that
-// might leave.
-// -----------------------------------------------------------------------------
-//
-CAMMSTunerPresetsHandler::CAMMSTunerPresetsHandler()
-{
-}
-
-// -----------------------------------------------------------------------------
-// CAMMSTunerPresetsHandler::ConstructL
-// Symbian 2nd phase constructor can leave.
-// -----------------------------------------------------------------------------
-//
-void CAMMSTunerPresetsHandler::ConstructL()
-{
-    iCentralRepository = CRepository::NewL(KCRUidFMRadioEngine);
-}
-
-// -----------------------------------------------------------------------------
-// CAMMSTunerPresetsHandler::NewL
-// Two-phased constructor.
-// -----------------------------------------------------------------------------
-//
-CAMMSTunerPresetsHandler* CAMMSTunerPresetsHandler::NewL()
-{
-    CAMMSTunerPresetsHandler* self = new(ELeave) CAMMSTunerPresetsHandler;
-
-    CleanupStack::PushL(self);
-    self->ConstructL();
-    CleanupStack::Pop();
-
-    return self;
-}
-
-
-// Destructor
-CAMMSTunerPresetsHandler::~CAMMSTunerPresetsHandler()
-{
-    delete iCentralRepository;
-}
-
-
-// -----------------------------------------------------------------------------
-// CAMMSTunerPresetsHandler::GetPreset
-// ?implementation_description
-// (other items were commented in a header).
-// -----------------------------------------------------------------------------
-//
-void CAMMSTunerPresetsHandler::GetPresetL(TInt aPreset, TAMMSTunerPreset &aTunerPreset)
-{
-    // KFmRadioPresetChannel1 = The first preset channel's location in central repository
-    TInt tempChannelIndex = KFmRadioPresetChannel1 + aPreset;
-
-    HBufC8* buf = HBufC8::NewLC(sizeof(TAMMSTunerPreset));
-    TPtr8 bufPtr = buf->Des();
-
-    TInt err = iCentralRepository->Get(tempChannelIndex, bufPtr);
-    if (err == KErrNone)
-    {
-        RDesReadStream inStream;
-        inStream.Open(bufPtr);
-        CleanupClosePushL(inStream);
-        aTunerPreset.InternalizeL(inStream);
-        CleanupStack::PopAndDestroy(&inStream);
-    }
-    else
-    {
-        User::Leave(err);
-    }
-    CleanupStack::PopAndDestroy(); // buf
-}
-
-// -----------------------------------------------------------------------------
-// CAMMSTunerPresetsHandler::SavePreset
-// ?implementation_description
-// (other items were commented in a header).
-// -----------------------------------------------------------------------------
-//
-void CAMMSTunerPresetsHandler::SavePresetL(TInt aPreset, TAMMSTunerPreset aTunerPreset)
-{
-    // KFmRadioPresetChannel1 = The first preset channel's location in central repository
-    TInt fieldNameIndex = KFmRadioPresetChannel1 + TUint32(aPreset);
-
-    HBufC8* buf = HBufC8::NewLC(sizeof(TAMMSTunerPreset));
-    TPtr8 bufPtr = buf->Des();
-
-    RDesWriteStream outStream(bufPtr);
-    CleanupClosePushL(outStream);
-    aTunerPreset.ExternalizeL(outStream);
-    outStream.CommitL();
-    CleanupStack::PopAndDestroy(&outStream);
-
-    iCentralRepository->Set(fieldNameIndex, bufPtr);
-    CleanupStack::PopAndDestroy(); //buf
-}
-
-
-//  End of File
--- a/javauis/amms_qt/src_tuner/native/src/cammstunervolumecontrol.cpp	Tue Jul 06 14:10:26 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,52 +0,0 @@
-/*
-* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:  This class is used for setting volume to tuner player
-*
-*/
-
-
-
-// INCLUDE FILES
-#include    "CAMMSTunerVolumeControl.h"
-#include    "CAMMSTunerPlayer.h"
-
-#include <logger.h>
-
-
-CAMMSTunerVolumeControl::CAMMSTunerVolumeControl(CAMMSTunerPlayer* aTunerPlayer)
-        : CMMAVolumeControl(aTunerPlayer)
-{
-    iTunerPlayer = aTunerPlayer;
-}
-
-CAMMSTunerVolumeControl* CAMMSTunerVolumeControl::NewL(CAMMSTunerPlayer* aTunerPlayer)
-{
-    LOG( EJavaAMMS, EInfo, "CAMMSTunerVolumeControl::NewL +");
-    CAMMSTunerVolumeControl* self = new(ELeave) CAMMSTunerVolumeControl(aTunerPlayer);
-
-    CleanupStack::PushL(self);
-    self->ConstructL();
-    CleanupStack::Pop();
-
-    return self;
-}
-
-void CAMMSTunerVolumeControl::DoSetLevelL(TInt aLevel)
-{
-    LOG1( EJavaAMMS, EInfo, "CAMMSTunerVolumeControl::DoSetLevelL, aLevel = %d", aLevel);
-    // TunerPlayer does not currently have SetVolumeL method
-    User::Invariant();
-}
-
-//  End of File
--- a/javauis/amms_qt/src_tuner/native/src/protocol.cpp	Tue Jul 06 14:10:26 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,61 +0,0 @@
-/*
-* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:  Protocol JNI wrapper.
- *
-*/
-
-
-// EXTERNAL INCLUDES
-//#include <jutils.h>
-#include <logger.h>
-
-// INTERNAL INCLUDES
-#include "com_nokia_microedition_media_protocol_capture_radio_Protocol.h"
-#include <MMAFunctionServer.h>
-#include "CAMMSTunerControl.h"
-#include "CAMMSTunerPlayer.h"
-#include "AMMSTunerFactory.h"
-#include "jstringutils.h"
-using namespace java::util;
-
-// Creates native tuner player
-JNIEXPORT jint JNICALL
-Java_com_nokia_microedition_media_protocol_capture_radio_Protocol__1createNativeTunerPlayer(
-    JNIEnv* aJniEnv,
-    jobject /*aPeer*/,
-    jint aEventSourceHandle,
-    jstring aLocatorParameters)
-{
-    LOG( EJavaAMMS, EInfo, "AMMS Java_com_nokia_microedition_media_protocol_capture_radio_Protocol__1createNativeTunerPlayer +");
-    MMAFunctionServer* eventSource = reinterpret_cast< MMAFunctionServer* >(aEventSourceHandle);
-
-    JStringUtils locatorParams(*aJniEnv, aLocatorParameters);
-
-    CAMMSTunerPlayer* tunerPlayer = NULL;
-
-    TInt error = eventSource->ExecuteTrap(
-                     &AMMSTunerFactory::CreatePlayerL,
-                     &tunerPlayer,
-                     (const TDesC*)&locatorParams);
-
-    ELOG1( EJavaAMMS, "AMMS __1createNativeTunerPlayer, error = %d", error);
-
-    if (error != KErrNone)
-    {
-        return error;
-    }
-
-    return reinterpret_cast<TInt>(tunerPlayer);
-}
-
--- a/javauis/amms_qt/src_tuner/native/src/tammstunerpreset.cpp	Tue Jul 06 14:10:26 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,119 +0,0 @@
-/*
-* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:  ?Description
-*
-*/
-
-
-
-// INCLUDE FILES
-#include    "TAMMSTunerPreset.h"
-
-#include    <s32mem.h>
-#include <logger.h>
-
-
-// ============================ MEMBER FUNCTIONS ===============================
-
-// -----------------------------------------------------------------------------
-// TAMMSTunerPreset::TAMMSTunerPreset
-// C++ default constructor can NOT contain any code, that
-// might leave.
-// -----------------------------------------------------------------------------
-//
-TAMMSTunerPreset::TAMMSTunerPreset()
-{
-}
-
-// -----------------------------------------------------------------------------
-// TAMMSTunerPreset::SetPresetName
-// -----------------------------------------------------------------------------
-//
-void TAMMSTunerPreset::SetPresetName(const TDesC* aPresetName)
-{
-    iPresetName.Copy(*aPresetName);
-}
-
-// -----------------------------------------------------------------------------
-// TAMMSTunerPreset::SetPresetFrequency
-// -----------------------------------------------------------------------------
-//
-void TAMMSTunerPreset::SetPresetFrequency(const TInt aPresetFrequency)
-{
-    iPresetFrequency = aPresetFrequency;
-}
-
-// -----------------------------------------------------------------------------
-// TAMMSTunerPreset::SetPresetStereoMode
-// -----------------------------------------------------------------------------
-//
-void TAMMSTunerPreset::SetPresetStereoMode(const TInt aPresetStereoMode)
-{
-    iPresetStereoMode = aPresetStereoMode;
-}
-
-// -----------------------------------------------------------------------------
-// TAMMSTunerPreset::PresetName
-// -----------------------------------------------------------------------------
-//
-TPtrC TAMMSTunerPreset::PresetName()
-{
-    return iPresetName;
-}
-
-// -----------------------------------------------------------------------------
-// TAMMSTunerPreset::PresetFrequency
-// -----------------------------------------------------------------------------
-//
-TInt TAMMSTunerPreset::PresetFrequency()
-{
-    return iPresetFrequency;
-}
-
-// -----------------------------------------------------------------------------
-// TAMMSTunerPreset::PresetStereoMode
-// -----------------------------------------------------------------------------
-//
-TInt TAMMSTunerPreset::PresetStereoMode()
-{
-    return iPresetStereoMode;
-}
-
-// -----------------------------------------------------------------------------
-// TAMMSTunerPreset::ExternalizeL
-// Writes preset values to stream.
-// (other items were commented in a header).
-// -----------------------------------------------------------------------------
-//
-void TAMMSTunerPreset::ExternalizeL(RWriteStream& aStream) const
-{
-    aStream<<iPresetName;
-    aStream.WriteUint32L(iPresetFrequency);
-    aStream.WriteUint32L(iPresetStereoMode);
-}
-
-// -----------------------------------------------------------------------------
-// TAMMSTunerPreset::InternalizeL
-// Reads preset values from stream.
-// (other items were commented in a header).
-// -----------------------------------------------------------------------------
-//
-void TAMMSTunerPreset::InternalizeL(RReadStream& aStream)
-{
-    aStream>>iPresetName;
-    iPresetFrequency = aStream.ReadUint32L();
-    iPresetStereoMode = aStream.ReadUint32L();
-}
-
-//  End of File
--- a/javauis/amms_qt/src_tuner/native/src/tunercontrol.cpp	Tue Jul 06 14:10:26 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,731 +0,0 @@
-/*
-* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:  TunerControl JNI wrapper.
- *
-*/
-
-
-// EXTERNAL INCLUDES
-//#include <jutils.h>
-
-// INTERNAL INCLUDES
-#include "com_nokia_amms_control_tuner_TunerControlImpl.h"
-#include <MMAFunctionServer.h>
-#include "CAMMSTunerControl.h"
-#include "jstringutils.h"
-using namespace java::util;
-
-/**
-* Static delegator function for getMinFreq
-*/
-LOCAL_C void GetMinFreqL(CAMMSTunerControl* aNativeClass,
-                         TInt *aMinFreq)
-{
-
-    *aMinFreq = aNativeClass->MinFreqL();
-}
-
-/**
-*  getMinFreq JNI function
-*/
-JNIEXPORT jint JNICALL
-Java_com_nokia_amms_control_tuner_TunerControlImpl__1getMinFreq(
-    JNIEnv* /*aJni*/,
-    jobject /*aJobject*/,
-    jint aEventSourceHandle,
-    jint aTunerControlHandle)
-{
-    TInt minFreq;
-
-    MMAFunctionServer* eventSource =
-        reinterpret_cast<MMAFunctionServer*>(aEventSourceHandle);
-
-    CAMMSTunerControl* nativeHandle =
-        reinterpret_cast<CAMMSTunerControl*>(aTunerControlHandle);
-
-    TInt err = eventSource->ExecuteTrap(GetMinFreqL,
-                                        nativeHandle,
-                                        &minFreq);
-
-    if (err != KErrNone)
-    {
-        return err;
-    }
-
-    return minFreq;
-}
-
-
-/**
-* Static delegator function for getMaxFreq
-*/
-LOCAL_C void GetMaxFreqL(CAMMSTunerControl* aNativeClass,
-                         TInt *aMaxFreq)
-{
-
-    *aMaxFreq = aNativeClass->MaxFreqL();
-}
-
-/**
-*  getMaxFreq JNI function
-*/
-JNIEXPORT jint JNICALL
-Java_com_nokia_amms_control_tuner_TunerControlImpl__1getMaxFreq(
-    JNIEnv* /*aJni*/,
-    jobject /*aJobject*/,
-    jint aEventSourceHandle,
-    jint aTunerControlHandle)
-{
-    TInt maxFreq;
-
-    MMAFunctionServer* eventSource =
-        reinterpret_cast<MMAFunctionServer*>(aEventSourceHandle);
-
-    CAMMSTunerControl* nativeHandle =
-        reinterpret_cast<CAMMSTunerControl*>(aTunerControlHandle);
-
-    TInt err = eventSource->ExecuteTrap(GetMaxFreqL,
-                                        nativeHandle,
-                                        &maxFreq);
-
-    if (err != KErrNone)
-    {
-        return err;
-    }
-
-    return maxFreq;
-}
-
-
-/**
-* Static delegator function for setFrequency
-*/
-LOCAL_C void SetFreqL(CAMMSTunerControl* aNativeClass,
-                      TInt aFreq)
-{
-
-    aNativeClass->SetFrequencyL(aFreq);
-}
-
-/**
-* Static delegator function for getFrequency
-*/
-LOCAL_C void GetFreqL(CAMMSTunerControl* aNativeClass,
-                      TInt *aFreq)
-{
-    *aFreq = aNativeClass->FrequencyL();
-}
-
-/**
-*  setFrequency JNI function
-*/
-JNIEXPORT jint JNICALL
-Java_com_nokia_amms_control_tuner_TunerControlImpl__1setFrequency(
-    JNIEnv* /*aJni*/,
-    jobject /*aJobject*/,
-    jint aEventSourceHandle,
-    jint aTunerControlHandle,
-    jint aFreq)
-{
-    MMAFunctionServer* eventSource =
-        reinterpret_cast<MMAFunctionServer*>(aEventSourceHandle);
-
-    CAMMSTunerControl* nativeHandle =
-        reinterpret_cast<CAMMSTunerControl*>(aTunerControlHandle);
-
-    TInt err = eventSource->ExecuteTrap(SetFreqL,
-                                        nativeHandle,
-                                        aFreq);
-
-    if (err != KErrNone)
-    {
-        return err;
-    }
-
-    //get tuned frequency
-    TInt tunedFreq;
-    err = eventSource->ExecuteTrap(GetFreqL,
-                                   nativeHandle,
-                                   &tunedFreq);
-    if (err != KErrNone)
-    {
-        return err;
-    }
-
-    return tunedFreq;
-}
-
-/**
-*  getFrequency JNI function
-*/
-JNIEXPORT jint JNICALL
-Java_com_nokia_amms_control_tuner_TunerControlImpl__1getFrequency(
-    JNIEnv* /*aJni*/,
-    jobject /*aJobject*/,
-    jint aEventSourceHandle,
-    jint aTunerControlHandle)
-{
-    TInt freq;
-
-    MMAFunctionServer* eventSource =
-        reinterpret_cast<MMAFunctionServer*>(aEventSourceHandle);
-
-    CAMMSTunerControl* nativeHandle =
-        reinterpret_cast<CAMMSTunerControl*>(aTunerControlHandle);
-
-    TInt err = eventSource->ExecuteTrap(GetFreqL,
-                                        nativeHandle,
-                                        &freq);
-    if (err != KErrNone)
-    {
-        return err;
-    }
-
-    return freq;
-}
-
-
-/**
-* Static delegator function for seek
-*/
-LOCAL_C void SeekL(CAMMSTunerControl* aNativeClass,
-                   TInt aStartFreq,
-                   TBool aUpwards,
-                   TInt* aSeekedFreq)
-{
-
-    *aSeekedFreq = aNativeClass->SeekL(aStartFreq, aUpwards);
-}
-
-/**
-*  seek JNI function
-*/
-JNIEXPORT jint JNICALL
-Java_com_nokia_amms_control_tuner_TunerControlImpl__1seek(
-    JNIEnv* /*aJni*/,
-    jobject /*aJobject*/,
-    jint aEventSourceHandle,
-    jint aTunerControlHandle,
-    jint aStartFreq,
-    jboolean aUpwards)
-{
-    TInt seekedFreq;
-
-    MMAFunctionServer* eventSource =
-        reinterpret_cast<MMAFunctionServer*>(aEventSourceHandle);
-
-    CAMMSTunerControl* nativeHandle =
-        reinterpret_cast<CAMMSTunerControl*>(aTunerControlHandle);
-
-    TInt err = eventSource->ExecuteTrap(SeekL,
-                                        nativeHandle,
-                                        aStartFreq,
-                                        (TBool) aUpwards,
-                                        &seekedFreq);
-
-    if (err != KErrNone)
-    {
-        return err;
-    }
-
-    return seekedFreq;
-}
-
-
-/**
-* Static delegator function for getSquelch
-*/
-LOCAL_C void GetSquelchL(CAMMSTunerControl* aNativeClass,
-                         TBool* aSquelch)
-{
-
-    *aSquelch = aNativeClass->SquelchL();
-}
-
-/**
-*  getSquelch JNI function
-*/
-JNIEXPORT jint JNICALL
-Java_com_nokia_amms_control_tuner_TunerControlImpl__1getSquelch(
-    JNIEnv* /*aJni*/,
-    jobject /*aJobject*/,
-    jint aEventSourceHandle,
-    jint aTunerControlHandle)
-{
-    MMAFunctionServer* eventSource =
-        reinterpret_cast<MMAFunctionServer*>(aEventSourceHandle);
-
-    CAMMSTunerControl* nativeHandle =
-        reinterpret_cast<CAMMSTunerControl*>(aTunerControlHandle);
-
-    TBool squelch = EFalse;
-
-    TInt err = eventSource->ExecuteTrap(GetSquelchL,
-                                        nativeHandle,
-                                        &squelch);
-
-    if (err != KErrNone)
-    {
-        return err;
-    }
-
-    if (!squelch)
-    {
-        //return 1 if false
-        return 1;
-    }
-    //return 0 if true
-    return KErrNone;
-}
-
-
-/**
-* Static delegator function for setSquelch
-*/
-LOCAL_C void SetSquelchL(CAMMSTunerControl* aNativeClass,
-                         TBool aSquelch)
-{
-
-    aNativeClass->SetSquelchL(aSquelch);
-}
-
-/**
-*  setSquelch JNI function
-*/
-JNIEXPORT jint JNICALL
-Java_com_nokia_amms_control_tuner_TunerControlImpl__1setSquelch(
-    JNIEnv* /*aJni*/,
-    jobject /*aJobject*/,
-    jint aEventSourceHandle,
-    jint aTunerControlHandle,
-    jboolean aSquelch)
-{
-    MMAFunctionServer* eventSource =
-        reinterpret_cast<MMAFunctionServer*>(aEventSourceHandle);
-
-    CAMMSTunerControl* nativeHandle =
-        reinterpret_cast<CAMMSTunerControl*>(aTunerControlHandle);
-
-    TInt err = eventSource->ExecuteTrap(SetSquelchL,
-                                        nativeHandle,
-                                        (TBool) aSquelch);
-
-    if (err != KErrNone)
-    {
-        return err;
-    }
-
-    return KErrNone;
-}
-
-
-/**
-* Static delegator function for getSignalStrength
-*/
-LOCAL_C void GetSignalStrengthL(CAMMSTunerControl* aNativeClass,
-                                TInt *aSignalStrength)
-{
-
-    *aSignalStrength = aNativeClass->SignalStrengthL();
-}
-
-/**
-*  getSignalStrength JNI function
-*/
-JNIEXPORT jint JNICALL
-Java_com_nokia_amms_control_tuner_TunerControlImpl__1getSignalStrength(
-    JNIEnv* /*aJni*/,
-    jobject /*aJobject*/,
-    jint aEventSourceHandle,
-    jint aTunerControlHandle)
-{
-    TInt signalStrength;
-
-    MMAFunctionServer* eventSource =
-        reinterpret_cast<MMAFunctionServer*>(aEventSourceHandle);
-
-    CAMMSTunerControl* nativeHandle =
-        reinterpret_cast<CAMMSTunerControl*>(aTunerControlHandle);
-
-    TInt err = eventSource->ExecuteTrap(GetSignalStrengthL,
-                                        nativeHandle,
-                                        &signalStrength);
-    if (err != KErrNone)
-    {
-        return err;
-    }
-
-    return signalStrength;
-}
-
-
-/**
-* Static delegator function for getStereoMode
-*/
-LOCAL_C void GetStereoModeL(CAMMSTunerControl* aNativeClass,
-                            TInt *aStereoMode)
-{
-
-    *aStereoMode = aNativeClass->StereoModeL();
-}
-
-/**
-*  getStereoMode JNI function
-*/
-JNIEXPORT jint JNICALL
-Java_com_nokia_amms_control_tuner_TunerControlImpl__1getStereoMode(
-    JNIEnv* /*aJni*/,
-    jobject /*aJobject*/,
-    jint aEventSourceHandle,
-    jint aTunerControlHandle)
-{
-    TInt stereoMode;
-
-    MMAFunctionServer* eventSource =
-        reinterpret_cast<MMAFunctionServer*>(aEventSourceHandle);
-
-    CAMMSTunerControl* nativeHandle =
-        reinterpret_cast<CAMMSTunerControl*>(aTunerControlHandle);
-
-    TInt err = eventSource->ExecuteTrap(GetStereoModeL,
-                                        nativeHandle,
-                                        &stereoMode);
-    if (err != KErrNone)
-    {
-        return err;
-    }
-
-    return stereoMode;
-}
-
-
-/**
-* Static delegator function for setStereoMode
-*/
-LOCAL_C void SetStereoModeL(CAMMSTunerControl* aNativeClass,
-                            TInt aStereoMode)
-{
-    aNativeClass->SetStereoModeL(aStereoMode);
-}
-
-/**
-*  setStereoMode JNI function
-*/
-JNIEXPORT jint JNICALL
-Java_com_nokia_amms_control_tuner_TunerControlImpl__1setStereoMode(
-    JNIEnv* /*aJni*/,
-    jobject /*aJobject*/,
-    jint aEventSourceHandle,
-    jint aTunerControlHandle,
-    jint aStereoMode)
-{
-    MMAFunctionServer* eventSource =
-        reinterpret_cast<MMAFunctionServer*>(aEventSourceHandle);
-
-    CAMMSTunerControl* nativeHandle =
-        reinterpret_cast<CAMMSTunerControl*>(aTunerControlHandle);
-
-    TInt err = eventSource->ExecuteTrap(SetStereoModeL,
-                                        nativeHandle,
-                                        aStereoMode);
-
-    return err;
-}
-
-
-/**
-* Static delegator function for usePreset
-*/
-LOCAL_C void UsePresetL(CAMMSTunerControl* aNativeClass,
-                        TInt aPreset)
-{
-    aNativeClass->UsePresetL(aPreset);
-}
-
-/**
-*  usePreset JNI function
-*/
-JNIEXPORT jint JNICALL
-Java_com_nokia_amms_control_tuner_TunerControlImpl__1usePreset(
-    JNIEnv* /*aJni*/,
-    jobject /*aJobject*/,
-    jint aEventSourceHandle,
-    jint aTunerControlHandle,
-    jint aPreset)
-{
-    MMAFunctionServer* eventSource =
-        reinterpret_cast<MMAFunctionServer*>(aEventSourceHandle);
-
-    CAMMSTunerControl* nativeHandle =
-        reinterpret_cast<CAMMSTunerControl*>(aTunerControlHandle);
-
-    TInt err = eventSource->ExecuteTrap(UsePresetL,
-                                        nativeHandle,
-                                        aPreset);
-
-    return err;
-}
-
-
-/**
-* Static delegator function for setPreset__III
-*/
-LOCAL_C void SetPresetL(CAMMSTunerControl* aNativeClass,
-                        TInt aPreset)
-{
-    aNativeClass->SetPresetL(aPreset);
-}
-
-/**
-*  setPreset__III JNI function
-*/
-JNIEXPORT jint JNICALL
-Java_com_nokia_amms_control_tuner_TunerControlImpl__1setPreset__III(
-    JNIEnv* /*aJni*/,
-    jobject /*aJobject*/,
-    jint aEventSourceHandle,
-    jint aTunerControlHandle,
-    jint aPreset)
-{
-    MMAFunctionServer* eventSource =
-        reinterpret_cast<MMAFunctionServer*>(aEventSourceHandle);
-
-    CAMMSTunerControl* nativeHandle =
-        reinterpret_cast<CAMMSTunerControl*>(aTunerControlHandle);
-
-    TInt err = eventSource->ExecuteTrap(SetPresetL,
-                                        nativeHandle,
-                                        aPreset);
-
-    return err;
-}
-
-
-/**
-* Static delegator function for setPreset__IIIII
-*/
-LOCAL_C void SetPresetL(CAMMSTunerControl* aNativeClass,
-                        TInt aPreset,
-                        TInt aFrequency,
-                        TInt aStereoMode)
-{
-    aNativeClass->SetPresetL(aPreset, aFrequency, aStereoMode);
-}
-
-/**
-*  setPreset__IIIII JNI function
-*/
-JNIEXPORT jint JNICALL
-Java_com_nokia_amms_control_tuner_TunerControlImpl__1setPreset__IIIII(
-    JNIEnv* /*aJni*/,
-    jobject /*aJobject*/,
-    jint aEventSourceHandle,
-    jint aTunerControlHandle,
-    jint aPreset,
-    jint aFrequency,
-    jint aStereoMode)
-{
-    MMAFunctionServer* eventSource =
-        reinterpret_cast<MMAFunctionServer*>(aEventSourceHandle);
-
-    CAMMSTunerControl* nativeHandle =
-        reinterpret_cast<CAMMSTunerControl*>(aTunerControlHandle);
-
-    TInt err = eventSource->ExecuteTrap(SetPresetL,
-                                        nativeHandle,
-                                        aPreset,
-                                        aFrequency,
-                                        aStereoMode);
-
-    return err;
-}
-
-
-/**
-* Static delegator function for getPresetFrequency
-*/
-LOCAL_C void GetPresetFreqL(CAMMSTunerControl* aNativeClass,
-                            TInt aPreset,
-                            TInt *aPresetFreq)
-{
-
-    *aPresetFreq = aNativeClass->PresetFrequencyL(aPreset);
-}
-
-/**
-*  getPresetFrequency JNI function
-*/
-JNIEXPORT jint JNICALL
-Java_com_nokia_amms_control_tuner_TunerControlImpl__1getPresetFrequency(
-    JNIEnv* /*aJni*/,
-    jobject /*aJobject*/,
-    jint aEventSourceHandle,
-    jint aTunerControlHandle,
-    jint aPreset)
-{
-    TInt presetFreq;
-
-    MMAFunctionServer* eventSource =
-        reinterpret_cast<MMAFunctionServer*>(aEventSourceHandle);
-
-    CAMMSTunerControl* nativeHandle =
-        reinterpret_cast<CAMMSTunerControl*>(aTunerControlHandle);
-
-    TInt err = eventSource->ExecuteTrap(GetPresetFreqL,
-                                        nativeHandle,
-                                        aPreset,
-                                        &presetFreq);
-    if (err != KErrNone)
-    {
-        return err;
-    }
-
-    return presetFreq;
-}
-
-
-/**
-* Static delegator function for getPresetStereoMode
-*/
-LOCAL_C void GetPresetStereoModeL(CAMMSTunerControl* aNativeClass,
-                                  TInt aPreset,
-                                  TInt *aPresetStereoMode)
-{
-
-    *aPresetStereoMode = aNativeClass->PresetStereoModeL(aPreset);
-}
-
-/**
-*  getPresetStereoMode JNI function
-*/
-JNIEXPORT jint JNICALL
-Java_com_nokia_amms_control_tuner_TunerControlImpl__1getPresetStereoMode(
-    JNIEnv* /*aJni*/,
-    jobject /*aJobject*/,
-    jint aEventSourceHandle,
-    jint aTunerControlHandle,
-    jint aPreset)
-{
-    TInt presetStereoMode;
-
-    MMAFunctionServer* eventSource =
-        reinterpret_cast<MMAFunctionServer*>(aEventSourceHandle);
-
-    CAMMSTunerControl* nativeHandle =
-        reinterpret_cast<CAMMSTunerControl*>(aTunerControlHandle);
-
-    TInt err = eventSource->ExecuteTrap(GetPresetStereoModeL,
-                                        nativeHandle,
-                                        aPreset,
-                                        &presetStereoMode);
-    if (err != KErrNone)
-    {
-        return err;
-    }
-
-    return presetStereoMode;
-}
-
-
-/**
-* Static delegator function for setPresetName
-*/
-LOCAL_C void SetPresetNameL(CAMMSTunerControl* aNativeClass,
-                            TInt aPreset,
-                            const TDesC* aPresetName)
-{
-    aNativeClass->SetPresetNameL(aPreset, aPresetName);
-}
-
-/**
-*  setPresetName JNI function
-*/
-JNIEXPORT jint JNICALL
-Java_com_nokia_amms_control_tuner_TunerControlImpl__1setPresetName(
-    JNIEnv* aJni,
-    jobject /*aJobject*/,
-    jint aEventSourceHandle,
-    jint aTunerControlHandle,
-    jint aPreset,
-    jstring aPresetName)
-{
-    MMAFunctionServer* eventSource =
-        reinterpret_cast<MMAFunctionServer*>(aEventSourceHandle);
-
-    CAMMSTunerControl* nativeHandle =
-        reinterpret_cast<CAMMSTunerControl*>(aTunerControlHandle);
-
-    JStringUtils presetName(*aJni, aPresetName);
-
-    TInt err = eventSource->ExecuteTrap(SetPresetNameL,
-                                        nativeHandle,
-                                        aPreset,
-                                        (const TDesC*)&presetName);
-
-    return err;
-}
-
-
-/**
-* Static delegator function for getPresetName
-*/
-LOCAL_C void GetPresetNameL(CAMMSTunerControl* aNativeClass,
-                            TInt aPreset,
-                            TPtrC* aPresetName)
-{
-    aNativeClass->GetPresetNameL(aPreset, aPresetName);
-}
-
-/**
-*  getPresetName JNI function
-*/
-JNIEXPORT jstring JNICALL
-Java_com_nokia_amms_control_tuner_TunerControlImpl__1getPresetName(
-    JNIEnv* aJni,
-    jobject /*aJobject*/,
-    jint aEventSourceHandle,
-    jint aTunerControlHandle,
-    jint aPreset,
-    jintArray aError)
-{
-    MMAFunctionServer* eventSource =
-        reinterpret_cast<MMAFunctionServer*>(aEventSourceHandle);
-
-    CAMMSTunerControl* nativeHandle =
-        reinterpret_cast<CAMMSTunerControl*>(aTunerControlHandle);
-
-    TPtrC presetNamePtr(NULL, 0);
-    jstring presetName = NULL;
-
-    TInt err = eventSource->ExecuteTrap(GetPresetNameL,
-                                        nativeHandle,
-                                        aPreset,
-                                        &presetNamePtr);
-
-    if (err == KErrNone)
-    {
-        presetName = S60CommonUtils::NativeToJavaString(*aJni, presetNamePtr);
-        if (!presetName)
-        {
-            err = KErrNotSupported;
-        }
-    }
-
-    jint javaErr[ 1 ] = { err };
-    aJni->SetIntArrayRegion(aError, 0, 1, javaErr);
-
-    return presetName;
-}
-
-// End of file
--- a/javauis/eswt_qt/build/eswtqt/build.xml	Tue Jul 06 14:10:26 2010 +0300
+++ b/javauis/eswt_qt/build/eswtqt/build.xml	Wed Aug 18 09:43:15 2010 +0300
@@ -52,8 +52,10 @@
       </properties>
     </target>
 
+    <!-- Exclude CDCCompatibilityDelegate class from the build since we are
+         building for CLDC. -->
     <target name="compile">
-        <omj.javac classpath="${impl.cldc.jar}" excludes="**/CDCCompatibilityDelegate.java"/>
+        <omj.javac excludes="**/CDCCompatibilityDelegate.java"/>
     </target>
 
     <target name="create.public.api.jar">
--- a/javauis/eswt_qt/com.nokia.swt.extensions/extensions/org/eclipse/swt/internal/extension/ImageUtil.java	Tue Jul 06 14:10:26 2010 +0300
+++ b/javauis/eswt_qt/com.nokia.swt.extensions/extensions/org/eclipse/swt/internal/extension/ImageUtil.java	Wed Aug 18 09:43:15 2010 +0300
@@ -13,11 +13,83 @@
 
 import org.eclipse.swt.graphics.Device;
 import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.graphics.Point;
 import org.eclipse.swt.graphics.Internal_GfxPackageSupport;
+import java.io.InputStream;
 
 public final class ImageUtil{
     
     public static Image createImageWithoutSecurityCheck(Device device, String filename) {
         return Internal_GfxPackageSupport.createImageWithoutSecurityCheck(device, filename);
-     }
+    }
+    
+    /**
+     * @deprecated Use createImageFromTheme(Device device, String name) instead.
+     * @param device
+     * @param id
+     * @return
+     */
+    public static Image createImageFromTheme(Device device, int id) {
+        return null;
+    }
+    
+    /**
+     * Creates an eSWT Image from a theme icon.
+     * Example:
+     *      Image image = ImageUtil.createImageFromTheme(display, "qtg_fr_rocker_normal_c");
+     * @param device
+     * @param name
+     * @return
+     */
+    public static Image createImageFromTheme(Device device, String name) {
+        Image res = null;
+        int iconHandle = org.eclipse.swt.internal.qt.OS.HbIcon_new(name);
+        org.eclipse.swt.internal.qt.graphics.Image cgImage = 
+            org.eclipse.swt.internal.qt.graphics.Image.createImageFromPixmap(
+                    org.eclipse.swt.internal.qt.OS.HbIcon_pixmap(iconHandle));
+        res = Internal_GfxPackageSupport.new_Image(device, cgImage);
+        org.eclipse.swt.internal.qt.OS.HbIcon_delete(iconHandle);
+        return res;
+    }
+    
+    /**
+     * Returns the bounds of an Image without creating an actual Image instance.
+     * Useful if there's a need to check the bounds of large collection of images
+     * to choose one that gets initialized.
+     *
+     * For bitmap files the function returns the size of the bitmap. For SVG
+     * the default size of the image is returned.
+     *
+     * Note that contents of the file are loaded to memory even when using
+     * this function. If you are going to load the image anyway, using this 
+     * function is not efficient.
+     *
+     * @param device The device to use when loading
+     * @param filename Filename from where to read the image data from. File is loaded from the classpath, not from the file system. 
+     * @return Size of the image
+     * @throws IOException if image cannot be loaded
+     */
+    public static Point getImageSize(Device device, String filename) {
+        return Internal_GfxPackageSupport.getImageSize(device, filename);
+    }
+    
+    /**
+     * Returns the bounds of an Image without creating an actual Image instance.
+     * Useful if there's a need to check the bounds of large collection of images
+     * to choose one that gets initialized.
+     *
+     * For bitmap files the function returns the size of the bitmap. For SVG
+     * the default size of the image is returned.
+     *
+     * Note that contents of the file are loaded to memory even when using
+     * this function. If you are going to load the image anyway, using this 
+     * function is not efficient.
+     *
+     * @param is The InputStream from where to read the image data from
+     * @return Size of the image
+     * @throws IOException if image cannot be loaded
+     */
+    public static Point getImageSize(InputStream stream) {
+        return Internal_GfxPackageSupport.getImageSize(stream);
+    }
 }
--- a/javauis/eswt_qt/com.nokia.swt.extensions/extensions/org/eclipse/swt/internal/extension/LabelExtension.java	Tue Jul 06 14:10:26 2010 +0300
+++ b/javauis/eswt_qt/com.nokia.swt.extensions/extensions/org/eclipse/swt/internal/extension/LabelExtension.java	Wed Aug 18 09:43:15 2010 +0300
@@ -63,4 +63,8 @@
         
         Internal_PackageSupport.setStandardIcon(this, standardIcon, iconWidth, iconHeight);
     }
+    
+    public void setThemeIcon(String iconName) {        
+        Internal_PackageSupport.setThemeIcon(this, iconName);
+    }
 }
--- a/javauis/eswt_qt/org.eclipse.swt/Eclipse SWT/qt/org/eclipse/swt/graphics/Image.java	Tue Jul 06 14:10:26 2010 +0300
+++ b/javauis/eswt_qt/org.eclipse.swt/Eclipse SWT/qt/org/eclipse/swt/graphics/Image.java	Wed Aug 18 09:43:15 2010 +0300
@@ -20,6 +20,7 @@
 import org.eclipse.swt.internal.qt.graphics.GraphicsContext;
 import org.eclipse.swt.widgets.Display;
 import org.eclipse.swt.widgets.Internal_PackageSupport;
+import org.eclipse.swt.graphics.Point;
 
 import java.io.IOException;
 import java.io.InputStream;
@@ -72,44 +73,6 @@
  * @see ImageLoader
  */
 public final class Image implements Drawable {
-
-    static int getNullIconHandle() {
-        if( Device.nullIconHandle == 0 ){
-            Device.nullIconHandle = OS.QIcon_new();
-        }
-        return Device.nullIconHandle;
-    }
-
-    /*
-     * Creates new Image instance.
-     * <p>
-     * <b>IMPORTANT:</b> This method is <em>not</em> part of the public
-     * API for <code>Image</code>. It is marked public only so that it
-     * can be shared within the packages provided by SWT. It is not
-     * available on all platforms, and should never be called from
-     * application code.
-     * </p>
-     * @param device the device on which to create the image
-     * @param cgImage the internal image instance
-     *
-     * @exception IllegalArgumentException <ul>
-     *    <li>ERROR_NULL_ARGUMENT - if device is null and there is no current device</li>
-     *    <li>ERROR_NULL_ARGUMENT - if the iternal image is null</li>
-     * </ul>
-     * @exception SWTException <ul>
-     *    <li>ERROR_INVALID_IMAGE - if the given internal image is not valid</li>
-     * </ul>
-     * @exception SWTError <ul>
-     *    <li>ERROR_NO_HANDLES if a handle could not be obtained for image creation</li>
-     * </ul>
-     */
-    static Image new_Image(
-        Device device, org.eclipse.swt.internal.qt.graphics.Image cgImage) {
-        Image image = new Image(device);
-        image.init(cgImage);
-        return image;
-    }
-
     /**
      * specifies whether the receiver is a bitmap or an icon
      * (one of <code>SWT.BITMAP</code>, <code>SWT.ICON</code>)
@@ -367,7 +330,7 @@
      */
     public Image(Device device, String filename) {
         this(device, filename, true);
-     }
+    }
     
     private Image(Device device, String filename, boolean securityCheck) {
         this(device);
@@ -432,6 +395,43 @@
     static Image createImageWithoutSecurityCheck(Device device, String filename) {
         return new Image(device, filename, false);
     }
+    
+    /*
+     * Returns the bounds of an image without creating an Image instance.
+     */
+    static Point getImageSize(Device device, String filename) {
+        
+        if (filename == null) {
+            SWT.error(SWT.ERROR_NULL_ARGUMENT);
+        }
+        
+        InputStream is = device.getClass().getResourceAsStream(filename);
+        
+        if (is == null) {
+            SWT.error(SWT.ERROR_IO);
+        }
+        
+        return getImageSize(is);
+    }
+    
+    /*
+     * Returns the bounds of an image without creating an Image instance.
+     */
+    static Point getImageSize(InputStream stream) {
+        Point point = null;
+        
+        try {
+            point = org.eclipse.swt.internal.qt.graphics.ImageLoader.getImageSize(stream);
+        } catch (IOException e) {
+            SWT.error(SWT.ERROR_IO);
+        } catch (NullPointerException e) {
+            SWT.error(SWT.ERROR_NULL_ARGUMENT);
+        } catch (IllegalArgumentException e) {
+            SWT.error(SWT.ERROR_INVALID_ARGUMENT);
+        }
+        
+        return point;
+    }
 
     /**
      * Disposes of the operating system resources associated with the image.
@@ -821,4 +821,41 @@
     private void track() {
         if (Device.tracking) device.new_Object(this);
     }
+
+    static int getNullIconHandle() {
+        if( Device.nullIconHandle == 0 ){
+            Device.nullIconHandle = OS.QIcon_new();
+        }
+        return Device.nullIconHandle;
+    }
+    
+    /**
+     * Creates new Image instance.
+     * <p>
+     * <b>IMPORTANT:</b> This method is <em>not</em> part of the public
+     * API for <code>Image</code>. It is marked public only so that it
+     * can be shared within the packages provided by SWT. It is not
+     * available on all platforms, and should never be called from
+     * application code.
+     * </p>
+     * @param device the device on which to create the image
+     * @param cgImage the internal image instance
+     *
+     * @exception IllegalArgumentException <ul>
+     *    <li>ERROR_NULL_ARGUMENT - if device is null and there is no current device</li>
+     *    <li>ERROR_NULL_ARGUMENT - if the iternal image is null</li>
+     * </ul>
+     * @exception SWTException <ul>
+     *    <li>ERROR_INVALID_IMAGE - if the given internal image is not valid</li>
+     * </ul>
+     * @exception SWTError <ul>
+     *    <li>ERROR_NO_HANDLES if a handle could not be obtained for image creation</li>
+     * </ul>
+     */
+    static Image qt_new(
+        Device device, org.eclipse.swt.internal.qt.graphics.Image cgImage) {
+        Image image = new Image(device);
+        image.init(cgImage);
+        return image;
+    }
 }
--- a/javauis/eswt_qt/org.eclipse.swt/Eclipse SWT/qt/org/eclipse/swt/widgets/Composite.java	Tue Jul 06 14:10:26 2010 +0300
+++ b/javauis/eswt_qt/org.eclipse.swt/Eclipse SWT/qt/org/eclipse/swt/widgets/Composite.java	Wed Aug 18 09:43:15 2010 +0300
@@ -200,16 +200,9 @@
 
 boolean doHandleMouseEvent(int type, int widgetHandle, int button, int x, int y, int state, int buttons) {
     boolean cancel = super.doHandleMouseEvent(type, widgetHandle, button, x, y, state, buttons);
+    // From the CANVAS flag it's known if this is a Shell/stand-alone Composite/Canvas. 
     if((this.state & WidgetState.CANVAS) != 0) {
-        // From the CANVAS flag it's known if this is a Shell/stand-alone
-        // Composite/Canvas. Those don't process the native mouse event but let it
-        // through to the widget below. If the widget below also passes the event
-        // to this Java widget then it will be getting multiple events. To avoid this 
-        // the native event must be canceled.
-        // Note: Also WA_NoMousePropagation could be used for this. 
-        cancel = true;
-        
-        // Set focus for a canvas with no children
+        // Set focus for a Canvas with no children. 
         if(type == SWT.MouseDown) {
             if ((style & SWT.NO_FOCUS) == 0 && hooksKeys ()) {
                 Control[] children = getChildren();
--- a/javauis/eswt_qt/org.eclipse.swt/Eclipse SWT/qt/org/eclipse/swt/widgets/Control.java	Tue Jul 06 14:10:26 2010 +0300
+++ b/javauis/eswt_qt/org.eclipse.swt/Eclipse SWT/qt/org/eclipse/swt/widgets/Control.java	Wed Aug 18 09:43:15 2010 +0300
@@ -811,6 +811,14 @@
     }
 }
 
+void fixMousePropagation() {
+    // In SWT mouse events are not supposed to propagate to the parent like in
+    // Qt. Thus, the default is never to propagate. 
+    if(handle != 0) {
+        OS.QWidget_setAttribute(handle, OS.QT_WA_NOMOUSEPROPAGATION, true);
+    }
+}
+
 void flushBuffers() {
     if (bufferedGcs != null) {
         for (int i = 0; i < bufferedGcs.size(); i++) {
@@ -1857,23 +1865,23 @@
         }
 
         // Add the actions that may be added by CommandArranger
-	     if(commandList != null) {
-	        CommandUtils.sort(commandList);
-	        for (int i = 0; i < commandList.length; i++) {
-	            OS.QMenu_addAction(menuHandle, Internal_PackageSupport.topHandle(commandList[i]));
-	        }
-	     }
+         if(commandList != null) {
+            CommandUtils.sort(commandList);
+            for (int i = 0; i < commandList.length; i++) {
+                OS.QMenu_addAction(menuHandle, Internal_PackageSupport.topHandle(commandList[i]));
+            }
+         }
 
         OS.QMenu_exec(menuHandle, event.x, event.y, 0);
 
         // Clean-up the QActions from CommandArranger and QMenu
         if(commandList != null && menuHandle != 0)   {
-	        for (int i = 0; i < commandList.length; i++) {
-	            int action = Internal_PackageSupport.topHandle(commandList[i]);
-	        	if(action != 0) {
-	        		OS.QWidget_removeAction(menuHandle, action);
-	        	}
-	        }
+            for (int i = 0; i < commandList.length; i++) {
+                int action = Internal_PackageSupport.topHandle(commandList[i]);
+                if(action != 0) {
+                    OS.QWidget_removeAction(menuHandle, action);
+                }
+            }
         }
         if (commandMenu) {
             QObjectDeleteWrapper.deleteSafely(menuHandle);
--- a/javauis/eswt_qt/org.eclipse.swt/Eclipse SWT/qt/org/eclipse/swt/widgets/Decorations.java	Tue Jul 06 14:10:26 2010 +0300
+++ b/javauis/eswt_qt/org.eclipse.swt/Eclipse SWT/qt/org/eclipse/swt/widgets/Decorations.java	Wed Aug 18 09:43:15 2010 +0300
@@ -902,8 +902,10 @@
 
 boolean qt_event_windowActivate(int widgetHandle) {
     if(widgetHandle == topHandle) {
-        display.commandArranger.shellActivityChanged();
-        sendEvent(SWT.Activate);
+        if (display != null && display.commandArranger != null) {
+            display.commandArranger.shellActivityChanged();
+            sendEvent(SWT.Activate);
+        }
     }
     return false;
 }
--- a/javauis/eswt_qt/org.eclipse.swt/Eclipse SWT/qt/org/eclipse/swt/widgets/Display.java	Tue Jul 06 14:10:26 2010 +0300
+++ b/javauis/eswt_qt/org.eclipse.swt/Eclipse SWT/qt/org/eclipse/swt/widgets/Display.java	Wed Aug 18 09:43:15 2010 +0300
@@ -136,6 +136,12 @@
 static Widget[] widgetTable;
 final static int GROW_SIZE = 64;
 
+/*
+ * Set to have relevant QWidgets have their QObject names set to the SWT
+ * widget class names for easier debugging. 
+ */
+static boolean objectNames /*= true*/;
+
 static MobileDevice mobileDevice;
 static int mobileDeviceHandle;
 
@@ -2192,6 +2198,8 @@
 	    lastWidget = null;
 	    indexTable = null;
 	    widgetTable = null;
+	    freeSlot = 0;
+	    lastHandle = 0;
     }
     thread = null;
     disposeList = null;
--- a/javauis/eswt_qt/org.eclipse.swt/Eclipse SWT/qt/org/eclipse/swt/widgets/Label.java	Tue Jul 06 14:10:26 2010 +0300
+++ b/javauis/eswt_qt/org.eclipse.swt/Eclipse SWT/qt/org/eclipse/swt/widgets/Label.java	Wed Aug 18 09:43:15 2010 +0300
@@ -127,10 +127,11 @@
         }
 
         checkWidget();
+        
         if (changed) {
             OS.QWidget_updateGeometry(handle);
         }
-
+        
         /**
          * ComputeSize in super class is not able to handle the situation that
          * preferred height depends on the width. So ask QLabel for preferred
@@ -167,6 +168,7 @@
             else
                 height = defaultLength;
         }
+        
         return new Point(width, height);
     }
 
@@ -329,6 +331,25 @@
             OS.QPixmap_delete(pixmapHandle);
         }
     }
+    
+    void setThemeIcon(String name) {
+        checkWidget();
+        if ((style & SWT.SEPARATOR) != 0)
+            return;
+        int iconHandle = 0;
+        int pixmapHandle = 0;
+        try {
+            iconHandle = OS.HbIcon_new(name);
+            if (iconHandle != 0)
+                pixmapHandle = OS.HbIcon_pixmap(iconHandle);
+            if (pixmapHandle != 0)
+                OS.QLabel_setPixmap(topHandle, pixmapHandle);
+        } finally {
+            OS.HbIcon_delete(iconHandle);
+            OS.QPixmap_delete(pixmapHandle);
+        }
+    }
+    
 
     void setStyle(int style) {
         int qStyle = 0;
--- a/javauis/eswt_qt/org.eclipse.swt/Eclipse SWT/qt/org/eclipse/swt/widgets/Scrollable.java	Tue Jul 06 14:10:26 2010 +0300
+++ b/javauis/eswt_qt/org.eclipse.swt/Eclipse SWT/qt/org/eclipse/swt/widgets/Scrollable.java	Wed Aug 18 09:43:15 2010 +0300
@@ -212,6 +212,12 @@
             }            
         }
         createBars();
+        if(Display.objectNames) {
+            if(scrollAreaHandle != 0 && scrollAreaHandle != topHandle && scrollAreaHandle != handle) {
+                OS.QObject_setObjectName(scrollAreaHandle, 
+                        this.getClass().getName() + " Scrollable.scrollAreaHandle");
+            }
+        }
     }
 
     private void createBars() {
--- a/javauis/eswt_qt/org.eclipse.swt/Eclipse SWT/qt/org/eclipse/swt/widgets/Widget.java	Tue Jul 06 14:10:26 2010 +0300
+++ b/javauis/eswt_qt/org.eclipse.swt/Eclipse SWT/qt/org/eclipse/swt/widgets/Widget.java	Wed Aug 18 09:43:15 2010 +0300
@@ -50,6 +50,11 @@
  * @see #checkSubclass
  */
 public abstract class Widget {
+    // The handles of the child-most and the root-most QObject within the
+    // Widget, respectively. For Controls these are QWidgets but for some 
+    // Widgets only QObjects (e.g. QActions for MenuItems). Both can be 
+    // assigned the same QObject. If the handles are nonzero and not equal then
+    // handle is always (directly or indirectly) a QObject child of topHandle. 
     int handle, topHandle;
 
     int style, state;
@@ -312,6 +317,14 @@
     } else {
         createHandle_pp (index);
     }
+    if(Display.objectNames) {
+        if(handle != 0) {
+            OS.QObject_setObjectName(handle, this.getClass().getName() + " Widget.handle");
+        }
+        if(topHandle != 0 && topHandle != handle) {
+            OS.QObject_setObjectName(topHandle, this.getClass().getName() + " Widget.topHandle");
+        }
+    }
     // If subclasses didn't specify topHandle then it's assumed that there's
     // only one QWidget. I.e. handle is the root widget.
     if(topHandle == 0) topHandle = handle;
@@ -325,6 +338,7 @@
     } else {
         register_pp();
     }
+    fixMousePropagation();
 }
 
 void deregister_pp () {
@@ -380,6 +394,9 @@
     return Display.filters (eventType);
 }
 
+void fixMousePropagation() {
+}
+
 static final Command[] getCommands(Control control) {
     return control.getCommands();
 }
@@ -511,12 +528,6 @@
     return style;
 }
 
-// Experimental support for StyleSheets
-public String getStyleSheet(){
-    checkWidget();
-    return OS.QWidget_styleSheet(handle);
-}
-
 void hookEvents_pp () {
 }
 
@@ -1183,9 +1194,9 @@
     }
 
     if(key.equals(WidgetConstant.CSS_ID)){
-    	OS.QObject_setObjectName(topHandle,(String)value);
-    	// Do not return here and let Widget store the key
-    	// value.
+        OS.QObject_setObjectName(topHandle,(String)value);
+        // Do not return here and let Widget store the key
+        // value.
     }
 
     int index = 1;
--- a/javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/library/eswt_widgets.pri	Tue Jul 06 14:10:26 2010 +0300
+++ b/javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/library/eswt_widgets.pri	Wed Aug 18 09:43:15 2010 +0300
@@ -10,7 +10,8 @@
 #*******************************************************************************
 
 QT += core \
-      gui
+      gui \
+      svg
 
 DEFINES += SWTQT_LIBRARY
 
--- a/javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/library/graphics/gfxos.cpp	Tue Jul 06 14:10:26 2010 +0300
+++ b/javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/library/graphics/gfxos.cpp	Wed Aug 18 09:43:15 2010 +0300
@@ -11,6 +11,11 @@
 #include <QFont>
 #include <QFontMetrics>
 #include <QSharedDataPointer>
+#include <QByteArray>
+#include <QBuffer>
+#include <QImageReader>
+#include <QSize>
+#include <QSvgRenderer>
 
 #include <org_eclipse_swt_internal_qt_graphics_OS.h>
 #include "graphics.h"
@@ -962,6 +967,21 @@
     return POINTER_TO_HANDLE(img);
 }
 
+jint JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_image_1create__I
+  (JNIEnv* aJniEnv , jclass, jint aPixmapHandle)
+{
+    Image* img = NULL;
+    GFX_TRY
+    {
+        SWT_LOG_JNI_CALL();
+        HANDLE_TO_POINTER(QPixmap*, pixmap, aPixmapHandle);
+        if (pixmap)
+            img = GraphicsFactory::createImage(*pixmap);
+    }
+    GFX_CATCH
+    return POINTER_TO_HANDLE(img);
+}
+
 jint JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_image_1getFormat
   (JNIEnv* aJniEnv, jclass, jint aImageHandle)
 {
@@ -1244,6 +1264,46 @@
     GFX_CATCH
 }
 
+JNIEXPORT jobject JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_imageLoader_1getImageSize
+  (JNIEnv *aJniEnv, jclass, jbyteArray aData)
+{
+    jobject size = NULL;
+    GFX_TRY
+    {
+        SWT_LOG_JNI_CALL();
+        
+        jbyte* data = NULL;
+        data = aJniEnv->GetByteArrayElements(aData, NULL);
+        int length = aJniEnv->GetArrayLength(aData);
+        
+        QByteArray array = QByteArray::fromRawData(reinterpret_cast<const char*>(data), length);
+        QBuffer buffer(&array);
+        buffer.open(QIODevice::ReadOnly);
+
+        // Initialize imageReader
+        QImageReader imgReader(&buffer);
+        QSize imageSize(-1,-1);
+        
+        if (imgReader.supportsOption(QImageIOHandler::Size))
+        {
+            imageSize = imgReader.size();
+        }
+        else //if (imgReader.format() == "svg") 
+        {
+            // Qt SVG plugin does not support QImageIOHandler::Size option, 
+            // use QSvgRenderer to get the default size of the image instead.
+            QSvgRenderer svg(array);
+            imageSize = svg.defaultSize();
+        }
+        
+        size = swtApp->jniUtils().NewJavaPoint( aJniEnv, QPoint(imageSize.width(), imageSize.height()));
+        
+        aJniEnv->ReleaseByteArrayElements(aData, data, JNI_ABORT);
+    }
+    GFX_CATCH
+    
+    return size;
+}
 //
 // FontUtils
 //
--- a/javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/library/graphics/graphics.h	Tue Jul 06 14:10:26 2010 +0300
+++ b/javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/library/graphics/graphics.h	Wed Aug 18 09:43:15 2010 +0300
@@ -1675,6 +1675,13 @@
     static Image* createImage(const QImage& aImage);
 
     /**
+     * Create image from a QPixmap.
+     * 
+     * @param aImage The source QPixmap
+     */
+    static Image* createImage(const QPixmap& aPixmap);
+
+    /**
      * Creates an image based on the given ARGB data array.
      * @param aRgbData ARGB data array. One pixel is specified as 0xAARRGGBB.
      * @param aWidth Image width
--- a/javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/library/graphics/graphicsfactory.cpp	Tue Jul 06 14:10:26 2010 +0300
+++ b/javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/library/graphics/graphicsfactory.cpp	Wed Aug 18 09:43:15 2010 +0300
@@ -78,6 +78,14 @@
     return static_cast<Image*>(pixmap);
 }
 
+/*static*/ Image* GraphicsFactory::createImage(const QPixmap& aPixmap)
+{
+    GFX_LOG_FUNC_CALL();
+    Pixmap* pixmap = new Pixmap();
+    pixmap->createFromQPixmap(aPixmap);
+    return static_cast<Image*>(pixmap);
+}
+
 /*static*/ Image* GraphicsFactory::createImage(int* aRgbData, int aWidth, int aHeight, bool aHasAlpha)
 {
     Pixmap* pixmap = new Pixmap();
--- a/javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/library/graphics/qt/pixmap.cpp	Tue Jul 06 14:10:26 2010 +0300
+++ b/javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/library/graphics/qt/pixmap.cpp	Wed Aug 18 09:43:15 2010 +0300
@@ -60,6 +60,19 @@
     }
 }
 
+void Pixmap::createFromQPixmap(const QPixmap& aPixmap)
+{
+    GFX_LOG_FUNC_CALL();
+    Q_ASSERT(mPixmap.isNull());
+
+    mPixmap = QPixmap(aPixmap);
+
+    // Validate allocation
+    if(mPixmap.isNull())
+    {
+        throw GfxException(EGfxErrorNoMemory, "Image (Pixmap) creation failed");
+    }
+}
 
 void Pixmap::createFromImage(Image* aImage, int aX, int aY, int aWidth, int aHeight)
 {
--- a/javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/library/graphics/qt/pixmap.h	Tue Jul 06 14:10:26 2010 +0300
+++ b/javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/library/graphics/qt/pixmap.h	Wed Aug 18 09:43:15 2010 +0300
@@ -35,6 +35,7 @@
      */
     virtual void createBySize(int aWidth, int aHeight, int aFillColor, TImageFormat aFormat);
     virtual void createFromQImage(const QImage& aImage);
+    virtual void createFromQPixmap(const QPixmap& aPixmap);
     virtual void createFromImage(Image* aImage, int aX, int aY, int aWidth, int aHeight);
     virtual void createFromImageData(ImageDataWrapper* aData);
     virtual void createFromRGB(int* aRgbdata, int aWidth, int aHeight, bool aHasAlpha);
--- a/javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/library/os.cpp	Tue Jul 06 14:10:26 2010 +0300
+++ b/javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/library/os.cpp	Wed Aug 18 09:43:15 2010 +0300
@@ -86,6 +86,7 @@
 #include <qnetworkconfigmanager.h>
 #include <qnetworkconfiguration.h>
 #include <hbinputsettingproxy.h>
+#include <hbicon.h>
 #endif
 
 #include <org_eclipse_swt_internal_qt_OS.h>
@@ -5332,7 +5333,7 @@
         jboolean isCopy;
         jint* imagesHandles = NULL;
 
-        const QPixmap** detailImages = const_cast<const QPixmap**>(new QPixmap*[aDetailImageCount]);
+        QPixmap** detailImages = new QPixmap*[aDetailImageCount];
         if( !detailImages )
             {
             throw std::bad_alloc();
@@ -5342,6 +5343,7 @@
             imagesHandles = aJniEnv->GetIntArrayElements(aDetailImageHandles, &isCopy);
             if( !imagesHandles )
                 {
+                delete [] detailImages;
                 throw std::bad_alloc();
                 }
             for(int i = 0; i < aDetailImageCount; i++)
@@ -5351,9 +5353,10 @@
             aJniEnv->ReleaseIntArrayElements(aDetailImageHandles, imagesHandles, JNI_ABORT);
             }
 
-        const QPixmap** headingImages =  const_cast<const QPixmap**>(new QPixmap*[aHeadingImageCount]);
+        QPixmap** headingImages = new QPixmap*[aHeadingImageCount];
         if( !headingImages )
             {
+            delete [] detailImages; // allocated earlier
             throw std::bad_alloc();
             }
         if(aHeadingImageHandles)
@@ -5361,6 +5364,8 @@
             imagesHandles = aJniEnv->GetIntArrayElements(aHeadingImageHandles, &isCopy);
             if( !imagesHandles )
                 {
+                delete [] detailImages;
+                delete [] headingImages;
                 throw std::bad_alloc();
                 }
             for(int i = 0; i < aHeadingImageCount; i++)
@@ -5371,8 +5376,10 @@
             }
 
         ListModel* listDataModel = reinterpret_cast< ListModel* > ( aHandle );
-        listDataModel->appendItem( swtApp->jniUtils().JavaStringToQString( aJniEnv, aDetailText ), detailImages, aDetailImageCount,
-            swtApp->jniUtils().JavaStringToQString( aJniEnv, aHeadingText ), headingImages, aHeadingImageCount );
+        listDataModel->appendItem( swtApp->jniUtils().JavaStringToQString( aJniEnv, aDetailText ), 
+            const_cast<const QPixmap**>(detailImages), aDetailImageCount,
+            swtApp->jniUtils().JavaStringToQString( aJniEnv, aHeadingText ), 
+            const_cast<const QPixmap**>(headingImages), aHeadingImageCount );
         }
     SWT_CATCH
     }
@@ -6337,7 +6344,60 @@
     return reinterpret_cast< jint >(pixmap);
     }
 
-
+//
+// HbIcon
+//
+
+JNIEXPORT jint JNICALL OS_NATIVE ( HbIcon_1new )
+    (JNIEnv* aJniEnv , jclass, jstring aName)
+    {
+#ifdef __SYMBIAN32__
+    HbIcon* icon = NULL;
+    SWT_TRY
+        {
+        SWT_LOG_JNI_CALL();
+        icon = new HbIcon(swtApp->jniUtils().JavaStringToQString(aJniEnv, aName));
+        }
+    SWT_CATCH
+    return reinterpret_cast< jint >( static_cast< HbIcon* >( icon ) );
+#else
+    return 0;
+#endif
+    }
+
+JNIEXPORT jint JNICALL OS_NATIVE( HbIcon_1pixmap )
+    (JNIEnv* aJniEnv , jclass, jint aHandle)
+    {
+#ifdef __SYMBIAN32__
+    QPixmap* pixmap = NULL;
+    SWT_TRY
+        {
+        SWT_LOG_JNI_CALL();
+        HbIcon* icon = reinterpret_cast< HbIcon* >( aHandle );
+        pixmap = new QPixmap(icon->pixmap());
+        }
+    SWT_CATCH
+    return reinterpret_cast< jint >(pixmap);
+#else
+    return 0;
+#endif
+    }
+
+JNIEXPORT void JNICALL OS_NATIVE( HbIcon_1delete )
+    (JNIEnv* aJniEnv , jclass, jint aHandle)
+    {
+#ifdef __SYMBIAN32__
+    SWT_TRY
+        {
+        SWT_LOG_JNI_CALL();
+        SWT_LOG_DATA_1("handle=%x", aHandle);
+        HbIcon* icon = reinterpret_cast< HbIcon* >( aHandle );
+        delete icon;
+        icon = NULL;
+        }
+    SWT_CATCH
+#endif
+    }
 
 //
 // QSlider
@@ -11662,7 +11722,7 @@
         SWT_LOG_JNI_CALL();
         SWT_LOG_DATA_2( "handle=%x duration=%x", aHandle, aDuration );
         CSwtMobileDevice* mobileDevice =  reinterpret_cast<CSwtMobileDevice*>(aHandle);
-        vibraSupport = mobileDevice->Vibrate((TTimeIntervalMicroSeconds32)static_cast<TInt>(aDuration));
+        vibraSupport = mobileDevice->Vibrate(static_cast<TInt>(aDuration));
         }
     SWT_CATCH
 #endif
--- a/javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/library/swtmobiledevice.cpp	Tue Jul 06 14:10:26 2010 +0300
+++ b/javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/library/swtmobiledevice.cpp	Wed Aug 18 09:43:15 2010 +0300
@@ -226,14 +226,13 @@
 // ---------------------------------------------------------------------------
 //
 #if defined(__WINSCW__)
-TBool CSwtMobileDevice::Vibrate(const TTimeIntervalMicroSeconds32& /*aDuration*/)
+TBool CSwtMobileDevice::Vibrate(const TInt /*aDuration*/)
     {
     return EFalse;
     }
 #else // __WINSCW__
-TBool CSwtMobileDevice::Vibrate(const TTimeIntervalMicroSeconds32& aDuration)
+TBool CSwtMobileDevice::Vibrate(const TInt aDuration)
     {
-    TInt duration = aDuration.Int() / 1000; // convert micro to milli
     if (!iVibra)
         {
         TRAPD(err1, iVibra = CHWRMVibra::NewL());
@@ -244,9 +243,9 @@
         }
  
     TInt err2 = KErrNone;
-    if (duration)
+    if (aDuration)
         {
-        TRAP(err2, iVibra->StartVibraL(duration));
+        TRAP(err2, iVibra->StartVibraL(aDuration));
         }
     else
         {
@@ -265,16 +264,16 @@
 #endif // __WINSCW__
 
 // -----------------------------------------------------------------------------
-// CSwtMobileDevice::AppForegroundL
+// CSwtMobileDevice::AppForeground
 // -----------------------------------------------------------------------------
 //
 void CSwtMobileDevice::AppForeground()
     {
     if (iDuration > 0)
         {
-        TTime* now = new TTime();
-        now->HomeTime();
-        TInt nowDuration = now->MicroSecondsFrom(*iStartTime).Int64()/1000;
+        TTime now;
+        now.HomeTime();
+        TInt nowDuration = now.MicroSecondsFrom(*iStartTime).Int64()/1000;
         if (nowDuration >= iDuration)
             {
             iDuration = 0;
--- a/javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/library/swtmobiledevice.h	Tue Jul 06 14:10:26 2010 +0300
+++ b/javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/library/swtmobiledevice.h	Wed Aug 18 09:43:15 2010 +0300
@@ -67,7 +67,7 @@
      * Printing InfoMsg for the user for the duration given to vibrate
      * Must return true if the vibrator can be controlled by the application
      */
-    TBool Vibrate(const TTimeIntervalMicroSeconds32& aDuration);
+    TBool Vibrate(const TInt aDuration);
 
     void AppForeground();
 public: // From MHWRMLightObserver
--- a/javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/library/swts60.cpp	Tue Jul 06 14:10:26 2010 +0300
+++ b/javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/library/swts60.cpp	Wed Aug 18 09:43:15 2010 +0300
@@ -39,8 +39,8 @@
 // Stack size for the UI thread, 0x14000 = 80kB
 const TInt KSwtUiThreadStackSize = 0x14000;
 
-// Stack size for the support thread, 0x1F40 = 8kB
-const TInt KSwtSupportThreadStackSize = 0x1F40;
+// Stack size for the support thread
+const TInt KSwtSupportThreadStackSize = KSwtUiThreadStackSize;
 
 static const char* const EVENT_FILTER = "swt_event_filter";
 
@@ -164,7 +164,8 @@
     // Launch the support thread
     startSupportThread(reinterpret_cast<TAny*>(data));
 
-    return KErrNone;
+    // Return the support thread initialization status
+    return data->initStatus.Int();
     }
 
 void SymbianUtils::cleanupUiThread()
@@ -471,7 +472,7 @@
     JNIEnv* env = NULL;
     void* args = NULL;
     jint attachStatus = vm->AttachCurrentThread((void**)&env, args);
-    __ASSERT_DEBUG(attachStatus == 0, User::Panic(KSwtDllName, 0));
+    // Continue even if attach failed ->
 
     // Notify the waiting Java thread that we have attached and it can continue
     notifyThreadInitStatus(attachStatus, data->initThreadId, &data->initStatus);
@@ -495,9 +496,11 @@
         if(vm && openStatus == KErrNone) {
             if(uiThread.ExitType() != EExitPending)
                 {
-                // Notify once and detach the thread.
-                notifyUIThreadExit(env);
-                vm->DetachCurrentThread();
+                if(attachStatus == 0) {
+                    // Notify once and detach the thread.
+                    notifyUIThreadExit(env);
+                    vm->DetachCurrentThread();
+                }
                 env = NULL;
                 vm = NULL;
                 }
@@ -505,7 +508,7 @@
         }
 
     // Because the thread is waiting until the process terminates,
-    // execution will neve reach here.
+    // execution will never reach here.
     }
 
 void SymbianUtils::startSupportThread(TAny* aParams)
--- a/javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/org/eclipse/swt/graphics/Internal_GfxPackageSupport.java	Tue Jul 06 14:10:26 2010 +0300
+++ b/javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/org/eclipse/swt/graphics/Internal_GfxPackageSupport.java	Wed Aug 18 09:43:15 2010 +0300
@@ -11,6 +11,8 @@
 
 package org.eclipse.swt.graphics;
 
+import java.io.InputStream;
+
 /**
  * <p>
  * <b>IMPORTANT:</b> This class is <em>not</em> part of the SWT public API. It
@@ -24,27 +26,48 @@
 public static int getNullIconHandle() {
     return Image.getNullIconHandle();
 }
-public static Image new_Image(Device device, org.eclipse.swt.internal.qt.graphics.Image cgImage) {
-    return Image.new_Image(device, cgImage);
+
+public static Image new_Image(Device device, 
+        org.eclipse.swt.internal.qt.graphics.Image cgImage) {
+    return Image.qt_new(device, cgImage);
 }
+
 public static int getIconHandle(Image i) {
     return i.getIconHandle();
 }
+
 public static org.eclipse.swt.internal.qt.graphics.Image getImage(Image i) {
     return i.getImage();
 }
+
 public static int getImageHandle(Image i) {
     return i.getImageHandle();
 }
+
 public static int getPixmapHandle(Image i) {
     return i.getPixmapHandle();
 }
+
+public static Image createImageWithoutSecurityCheck(Device device,
+        String filename) {
+    return Image.createImageWithoutSecurityCheck(device, filename);
+}
+
+public static Point getImageSize(Device device, String filename) {
+    return Image.getImageSize(device, filename);
+}
+
+public static Point getImageSize(InputStream stream) {
+    return Image.getImageSize(stream);
+}
+
 /*
  * From the class Device
  */
 public static boolean internal(Device d) {
 	return d.internal;
 }
+
 public static boolean initialized() {
 	return Device.initialized;
 }
@@ -52,15 +75,9 @@
 public static Color newColor(Device device, int handle) {
     return Color.qt_new(device, handle);
 }
+
 public static Font newFont(Device device, int handle) {
     return Font.qt_new(device, handle);
 }
 
-/*
- * From the class Image
- */
-public static Image createImageWithoutSecurityCheck(Device device,
-        String filename) {
-    return Image.createImageWithoutSecurityCheck(device, filename);
 }
-}
--- a/javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/org/eclipse/swt/internal/qt/CommandArranger.java	Tue Jul 06 14:10:26 2010 +0300
+++ b/javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/org/eclipse/swt/internal/qt/CommandArranger.java	Wed Aug 18 09:43:15 2010 +0300
@@ -222,6 +222,10 @@
  * @see Control#qt_swt_event_focusWasGained() //TODO
  */
 public void shellActivityChanged() {
+    if (display == null) {
+        return;
+    }
+
     Shell activeShell = display.getActiveShell();
     
     if (activeShell == lastKnownActiveShell) {
--- a/javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/org/eclipse/swt/internal/qt/OS.java	Tue Jul 06 14:10:26 2010 +0300
+++ b/javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/org/eclipse/swt/internal/qt/OS.java	Wed Aug 18 09:43:15 2010 +0300
@@ -550,6 +550,7 @@
     public static final int QT_WA_PAINTONSCREEN = 8;
     public static final int QT_WA_PAINTUNCLIPPED = 52;
     public static final int QT_WA_INPUTMETHODENABLED = 14;
+    public static final int QT_WA_NOMOUSEPROPAGATION = 73;
 
     // QStyle::StandardPixmap
     public static final int QSTYLE_SP_MESSAGEBOXINFORMATION = 9;
@@ -1059,7 +1060,14 @@
     public static final native int QIcon_new();
     public static final native void QIcon_delete(int handle);
     public static final native int QIcon_pixmap(int handle, int w, int h);
-
+    
+    // 
+    // HbIcon
+    // 
+    public static final native int HbIcon_new(String name);
+    public static final native int HbIcon_pixmap(int handle);
+    public static final native void HbIcon_delete(int handle);
+    
     //
     // AbstractListModel
     //
--- a/javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/org/eclipse/swt/internal/qt/graphics/GraphicsContext.java	Tue Jul 06 14:10:26 2010 +0300
+++ b/javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/org/eclipse/swt/internal/qt/graphics/GraphicsContext.java	Wed Aug 18 09:43:15 2010 +0300
@@ -2233,7 +2233,7 @@
                         }
                         case JavaCommandBuffer.OP_DRAWROUNDRECT:
                         {
-                            OS.graphicsContext_fillRoundRect(handle, 
+                            OS.graphicsContext_drawRoundRect(handle, 
                                                              intParams[i++], 
                                                              intParams[i++], 
                                                              intParams[i++], 
--- a/javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/org/eclipse/swt/internal/qt/graphics/Image.java	Tue Jul 06 14:10:26 2010 +0300
+++ b/javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/org/eclipse/swt/internal/qt/graphics/Image.java	Wed Aug 18 09:43:15 2010 +0300
@@ -669,6 +669,21 @@
         int imageHandle = OS.image_create(imageData);
         return new Image(imageHandle);
     }
+    
+    /**
+     * Constructs new image with given native QPixmap handle.
+     * @param pixmapHandle Handle of native QPixmap.
+     * @return Instance of loaded image.
+     */
+    public static Image createImageFromPixmap(int pixmapHandle) {
+        // input validation
+        if(pixmapHandle <= 0) {
+            throw new IllegalArgumentException("Invalid pixmap handle");
+        }
+        // Construct an ge in native side and store the handle
+        int handle = OS.image_create(pixmapHandle);
+        return new Image(handle);
+    }
 
     /**
      * Obtains a shallow copy of this Image to be placed in the command buffer.
--- a/javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/org/eclipse/swt/internal/qt/graphics/ImageLoader.java	Tue Jul 06 14:10:26 2010 +0300
+++ b/javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/org/eclipse/swt/internal/qt/graphics/ImageLoader.java	Wed Aug 18 09:43:15 2010 +0300
@@ -13,6 +13,7 @@
 import java.io.*;
 
 import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.graphics.Device;
 
 /**
  * ImageLoader is class for image loading from various data formats.
@@ -230,6 +231,33 @@
     }
 
     /**
+     * Returns the bounds of an Image without creating an actual Image instance.
+     *
+     * @param is The InputStream from where to read the image data from
+     * @return Bounds of the image
+     */
+    public static Point getImageSize(InputStream is) throws IOException {
+
+        if (is == null) {
+            throw new NullPointerException("InputStream is null");
+        }
+
+        int bytesAvailable = is.available(); // may throw IOException
+
+        if (bytesAvailable == 0) {
+            throw new IllegalArgumentException("Empty file");
+        }
+
+        byte [] data = new byte[bytesAvailable];
+        
+        if (is.read(data, 0, data.length) != bytesAvailable) {
+            throw new IOException("Could not load data from InputStream");
+        }
+        
+        return OS.imageLoader_getImageSize(data);
+    }
+
+    /**
      * Private helper to check the state of the current instance.
      */
     private void checkState() {
--- a/javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/org/eclipse/swt/internal/qt/graphics/JavaCommandBuffer.java	Tue Jul 06 14:10:26 2010 +0300
+++ b/javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/org/eclipse/swt/internal/qt/graphics/JavaCommandBuffer.java	Wed Aug 18 09:43:15 2010 +0300
@@ -1,12 +1,4 @@
 /******************************************************************************* * Copyright (c) 2008, 2010 Nokia Corporation and/or its subsidiary(-ies). * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: *     Nokia Corporation - initial implementation *******************************************************************************/
 package org.eclipse.swt.internal.qt.graphics;
 import java.util.Vector;import java.util.Enumeration;
-/** * This class implements a command buffer that can be bound by GraphicsContext * to collect the drawing operations. Contents of the command buffer can be replayed to * GraphicsContext target with GraphicsContext.render() method. * * When JavaCommandBuffer is set as the target of GraphicsContext some of the methods * provided by GraphicsContext are not supported, e.g. getters, since the JavaCommandBuffer * does not have a real rendering target from which to query related data. To find out what is * supported see the methods of this class. In principal GraphicsContext supports all draw and set operations, * when JavaCommandBuffer is set as rendering target. */
-public final class JavaCommandBuffer {    // All collected drawing operations and their parameters    private int[] intParams;    private int intCount;    private StringBuffer strParams;    // Container for images    private Vector images;
-    // Container for rgbData    private Vector rgbData;
-    // This flag is indicates if this buffer is bound by some GraphicsContext    private boolean bound;
-    // This flag indicates if this buffer is empty or not    private boolean containsData;
-    // This flag indicates if this buffer has any draw commands in it    private boolean containsPrimitiveData;
-    // Memory management configuration constants    private static final int INT_BUF_GRANULARITY         = 10;    private static final int INT_BUF_INITIAL_SIZE        = 250;    private static final int IMAGE_BUF_INITIAL_SIZE      = 3;    private static final int IMAGE_BUF_GRANULARITY       = 2;    private static final int STRING_BUFFER_INITIAL_SIZE  = 10;
-    // Prefixes for different categories of op codes, stored in MSB    final static int DRAW_PREFIX = 0;    final static int FILL_PREFIX = 1;    final static int SET_PREFIX = 2;    final static int MISC_PREFIX = 3;
-    // Unique operation codes for all the gc operations that can be buffered.    static final int OP_DRAWARC            = ((DRAW_PREFIX << 24) | 1);    static final int OP_DRAWFOCUS          = ((DRAW_PREFIX << 24) | 2);    static final int OP_DRAWIMAGE1         = ((DRAW_PREFIX << 24) | 3);    static final int OP_DRAWIMAGE2         = ((DRAW_PREFIX << 24) | 4);    static final int OP_DRAWLINE           = ((DRAW_PREFIX << 24) | 5);    static final int OP_DRAWELLIPSE        = ((DRAW_PREFIX << 24) | 6);    static final int OP_DRAWPOINT          = ((DRAW_PREFIX << 24) | 7);    static final int OP_DRAWPOLYGON        = ((DRAW_PREFIX << 24) | 8);    static final int OP_DRAWPOLYLINE       = ((DRAW_PREFIX << 24) | 9);    static final int OP_DRAWRECT           = ((DRAW_PREFIX << 24) | 10);    static final int OP_DRAWRGB_INT        = ((DRAW_PREFIX << 24) | 11);    static final int OP_DRAWRGB_BYTE       = ((DRAW_PREFIX << 24) | 12);    static final int OP_DRAWRGB_SHORT      = ((DRAW_PREFIX << 24) | 13);    static final int OP_DRAWROUNDRECT      = ((DRAW_PREFIX << 24) | 14);    static final int OP_DRAWSTRING         = ((DRAW_PREFIX << 24) | 15);    static final int OP_FILLARC            = ((FILL_PREFIX << 24) | 16);    static final int OP_FILLGRADIENTRECT   = ((FILL_PREFIX << 24) | 17);    static final int OP_FILLELLIPSE        = ((FILL_PREFIX << 24) | 18);    static final int OP_FILLPOLYGON        = ((FILL_PREFIX << 24) | 19);    static final int OP_FILLRECT           = ((FILL_PREFIX << 24) | 20);    static final int OP_FILLROUNDRECT      = ((FILL_PREFIX << 24) | 21);    static final int OP_SETBACKGROUNDALPHA = ((SET_PREFIX << 24) | 22);    static final int OP_SETBACKGROUNDCOLOR = ((SET_PREFIX << 24) | 23);    static final int OP_SETBLENDINGMODE    = ((SET_PREFIX << 24) | 24);    static final int OP_SETCLIP            = ((SET_PREFIX << 24) | 25);    static final int OP_CANCELCLIPPING     = ((SET_PREFIX << 24) | 26);    static final int OP_SETFONT            = ((SET_PREFIX << 24) | 27);    static final int OP_SETFOREGROUNDALPHA = ((SET_PREFIX << 24) | 28);    static final int OP_SETFOREGROUNDCOLOR = ((SET_PREFIX << 24) | 29);    static final int OP_SETSTROKESTYLE     = ((SET_PREFIX << 24) | 30);    static final int OP_SETSTROKEWIDTH     = ((SET_PREFIX << 24) | 31);    static final int OP_TRANSLATE          = ((MISC_PREFIX << 24) | 32);    static final int OP_SCALE              = ((MISC_PREFIX << 24) | 33);    static final int OP_RESETTRANSFORM     = ((MISC_PREFIX << 24) | 34);    static final int OP_COPYAREA1          = ((MISC_PREFIX << 24) | 35);    static final int OP_COPYAREA2          = ((MISC_PREFIX << 24) | 36);    /**     * Constructs empty command buffer with defined buffer sizes.     */    public JavaCommandBuffer() {        intParams = new int[INT_BUF_INITIAL_SIZE];        strParams = new StringBuffer(STRING_BUFFER_INITIAL_SIZE);        images = new Vector(IMAGE_BUF_INITIAL_SIZE, IMAGE_BUF_GRANULARITY);        rgbData = new Vector(IMAGE_BUF_INITIAL_SIZE, IMAGE_BUF_GRANULARITY);    }    /**     * Resets the buffer, i.e. removes all recorded commands and related data. The integer array containing     * the actual operation codes is not deleted, only the index pointer is rested, thus the memory consumption of that is not freed.     * CommandBuffer can be reseted only if it is not bound by any GraphicsContext     * @throws IllegalStateException if this CommandBuffer is bound while calling reset     */    public void reset() {        if(bound) {            throw new IllegalStateException("CommandBuffer is still bound by gc");        }        intCount = 0;        strParams.setLength(0);        Enumeration allImages = images.elements();        while(allImages.hasMoreElements()) {            Image image = (Image)allImages.nextElement();            if(image != null) {                image.freeCommandBufferCopy();            }        }        images.removeAllElements();        rgbData.removeAllElements();        containsData = false;        containsPrimitiveData = false;    }    /**     * Checks that does this buffer contain any commands     * @return true if any command has been written to buffer otherwise false     */    public boolean containsData() {        return containsData;    }    /**     * Checks that does this buffer contain any draw commands, i.e. any setters etc.     * that does to cause any pixels to be rendered are ignored     * @return true if any draw command has been written to buffer otherwise false     */    public boolean containsDrawnPrimitives() {        return containsPrimitiveData;    }    /**     * Binds this buffer     */    void bind() {        bound = true;    }    /**     * Provides the binding status of this buffer     * @return true if this buffer has been already bound otherwise false     */    boolean isBound() {        return bound;    }    /**     * Releases this buffer, i.e. it can be bound by some other GraphicsContext     */    void release() {        bound = false;    }    private void ensureIntArraySpace(final int items) {        if( intParams.length < intCount + items) {            int[] dst = new int[intParams.length + Math.max(INT_BUF_GRANULARITY, items)];            System.arraycopy(intParams, 0, dst, 0, intParams.length);            intParams = dst;        }        containsData = true;    }    private void reportNotSupported() {        throw new RuntimeException("Intenal: Operation not supported with JavaCommandBuffer");    }//    private void printBufferInfo() {//        System.out.println("CommandBuffer Info: " +this);//        System.out.println("intParamCount: " + intCount);//        System.out.println("intBuffer Size: " + intParams.length);//        System.out.println("StringBuffer Size: " + strParams.length());//    }    private void raisePrimitiveFlag() {        containsPrimitiveData = true;    }    int[] intParams() {        return intParams;    }    int intParamCount() {        return intCount;    }    Vector rgbParams() {        return rgbData;    }    Vector images() {        return images;    }    String strParams() {        return strParams.toString();    }    void drawArc (final int x, final int y, final int width, final int height, final int startAngle, final int arcAngle) {        ensureIntArraySpace(7);        intParams[intCount++] = OP_DRAWARC;        intParams[intCount++] = x;        intParams[intCount++] = y;        intParams[intCount++] = width;        intParams[intCount++] = height;        intParams[intCount++] = startAngle;        intParams[intCount++] = arcAngle;        raisePrimitiveFlag();    }    void drawFocus (final int x, final int y, final int width, final int height) {        ensureIntArraySpace(5);        intParams[intCount++] = OP_DRAWFOCUS;        intParams[intCount++] = x;        intParams[intCount++] = y;        intParams[intCount++] = width;        intParams[intCount++] = height;        raisePrimitiveFlag();    }    // Must be called from UI thread as images cannot be creates outside that    void drawImage(final Image image, final int x, final int y) {        ensureIntArraySpace(3);        intParams[intCount++] = OP_DRAWIMAGE1;        intParams[intCount++] = x;        intParams[intCount++] = y;        // creating copy of image here uses implicit data sharing,        // thus only a shallow copy is made        images.addElement(image.getCommandBufferCopy());        raisePrimitiveFlag();    }    // must be called from UI thread as images cannot be creates outside that    void drawImage(final Image image, final int tx, final int ty, final int tw, final int th, final int sx, final int sy, final int sw, final int sh, final int manipulation) {        ensureIntArraySpace(10);        intParams[intCount++] = OP_DRAWIMAGE2;        intParams[intCount++] = tx;        intParams[intCount++] = ty;        intParams[intCount++] = tw;        intParams[intCount++] = th;        intParams[intCount++] = sx;        intParams[intCount++] = sy;        intParams[intCount++] = sw;        intParams[intCount++] = sh;        intParams[intCount++] = manipulation;        // creating copy of image here uses implicit data sharing,        // thus only a shallow copy is made        images.addElement(image.getCommandBufferCopy());        raisePrimitiveFlag();    }    void drawLine (final int x1, final int y1, final int x2, final int y2) {        ensureIntArraySpace(5);        intParams[intCount++] = OP_DRAWLINE;        intParams[intCount++] = x1;        intParams[intCount++] = y1;        intParams[intCount++] = x2;        intParams[intCount++] = y2;        raisePrimitiveFlag();    }    void drawEllipse (final int x, final int y, final int width, final int height) {        ensureIntArraySpace(5);        intParams[intCount++] = OP_DRAWELLIPSE;        intParams[intCount++] = x;        intParams[intCount++] = y;        intParams[intCount++] = width;        intParams[intCount++] = height;        raisePrimitiveFlag();    }    void drawPoint (final int x, final int y) {        ensureIntArraySpace(3);        intParams[intCount++] = OP_DRAWPOINT;        intParams[intCount++] = x;        intParams[intCount++] = y;        raisePrimitiveFlag();    }    void drawPolygon(final int[] pointArray) {        ensureIntArraySpace(2 + pointArray.length);        intParams[intCount++] = OP_DRAWPOLYGON;        intParams[intCount++] = pointArray.length;        for(int i = 0; i < pointArray.length; ++i) {            intParams[intCount++] = pointArray[i];        }        raisePrimitiveFlag();    }    void drawPolyline(final int[] pointArray) {        ensureIntArraySpace(2 + pointArray.length);        intParams[intCount++] = OP_DRAWPOLYLINE;        intParams[intCount++] = pointArray.length;        for(int i = 0; i < pointArray.length; ++i) {            intParams[intCount++] = pointArray[i];        }        raisePrimitiveFlag();    }    void drawRect (final int x, final int y, final int width, final int height) {        ensureIntArraySpace(5);        intParams[intCount++] = OP_DRAWRECT;        intParams[intCount++] = x;        intParams[intCount++] = y;        intParams[intCount++] = width;        intParams[intCount++] = height;        raisePrimitiveFlag();    }    void drawRGB(final int[] rgb, final int offset, final int scanlength, final int x, final int y, final int width, final int height, final boolean processAlpha, final int manipulation) {        ensureIntArraySpace(9);        intParams[intCount++] = OP_DRAWRGB_INT;        intParams[intCount++] = offset;        intParams[intCount++] = scanlength;        intParams[intCount++] = x;        intParams[intCount++] = y;        intParams[intCount++] = width;        intParams[intCount++] = height;        intParams[intCount++] = processAlpha? 1 : 0;        intParams[intCount++] = manipulation;        rgbData.addElement(rgb);        raisePrimitiveFlag();    }    void drawRGB(final byte[] rgb, final byte[] transparencyMask, final int offset, final int scanlength, final int x, final int y, final int width, final int height, final int manipulation, final int format) {        ensureIntArraySpace(9);        intParams[intCount++] = OP_DRAWRGB_BYTE;        intParams[intCount++] = offset;        intParams[intCount++] = scanlength;        intParams[intCount++] = x;        intParams[intCount++] = y;        intParams[intCount++] = width;        intParams[intCount++] = height;        intParams[intCount++] = manipulation;        intParams[intCount++] = format;        rgbData.addElement(rgb);        rgbData.addElement(transparencyMask);        raisePrimitiveFlag();    }    void drawRGB(final short[] rgb, final int offset, final int scanlength, final int x, final int y, final int width, final int height, final boolean processAlpha, final int manipulation, final int format) {        ensureIntArraySpace(10);        intParams[intCount++] = OP_DRAWRGB_SHORT;        intParams[intCount++] = offset;        intParams[intCount++] = scanlength;        intParams[intCount++] = x;        intParams[intCount++] = y;        intParams[intCount++] = width;        intParams[intCount++] = height;        intParams[intCount++] = processAlpha? 1 : 0;        intParams[intCount++] = manipulation;        intParams[intCount++] = format;        rgbData.addElement(rgb);        raisePrimitiveFlag();    }    void drawRoundRect (final int x, final int y, final int width, final int height, final int arcWidth, final int arcHeight) {        ensureIntArraySpace(7);        intParams[intCount++] = OP_DRAWROUNDRECT;        intParams[intCount++] = x;        intParams[intCount++] = y;        intParams[intCount++] = width;        intParams[intCount++] = height;        intParams[intCount++] = arcWidth;        intParams[intCount++] = arcHeight;        raisePrimitiveFlag();    }    void drawString(final String string, final int x, final int y, final int width, final int height, final int alignments, final int flags, final boolean isTransparent) {        ensureIntArraySpace(9);        intParams[intCount++] = OP_DRAWSTRING;        intParams[intCount++] = string.length();        intParams[intCount++] = x;        intParams[intCount++] = y;        intParams[intCount++] = width;        intParams[intCount++] = height;        intParams[intCount++] = alignments;        intParams[intCount++] = flags;        intParams[intCount++] = isTransparent? 1 : 0;        strParams.append(string);        raisePrimitiveFlag();    }    void fillArc (final int x, final int y, final int width, final int height, final int startAngle, final int arcAngle) {        ensureIntArraySpace(7);        intParams[intCount++] = OP_FILLARC;        intParams[intCount++] = x;        intParams[intCount++] = y;        intParams[intCount++] = width;        intParams[intCount++] = height;        intParams[intCount++] = startAngle;        intParams[intCount++] = arcAngle;        raisePrimitiveFlag();    }    void fillGradientRect(final int x, final int y, final int width, final int height, final boolean vertical, final boolean swapColors) {        ensureIntArraySpace(7);        intParams[intCount++] = OP_FILLGRADIENTRECT;        intParams[intCount++] = x;        intParams[intCount++] = y;        intParams[intCount++] = width;        intParams[intCount++] = height;        intParams[intCount++] = vertical ? 1 : 0;        intParams[intCount++] = swapColors ? 1 : 0;        raisePrimitiveFlag();    }    void fillEllipse (final int x, final int y, final int width, final int height) {        ensureIntArraySpace(5);        intParams[intCount++] = OP_FILLELLIPSE;        intParams[intCount++] = x;        intParams[intCount++] = y;        intParams[intCount++] = width;        intParams[intCount++] = height;        raisePrimitiveFlag();    }    void fillPolygon (final int[] pointArray) {        ensureIntArraySpace(2 + pointArray.length);        intParams[intCount++] = OP_FILLPOLYGON;        intParams[intCount++] = pointArray.length;        for(int i = 0; i < pointArray.length; ++i) {            intParams[intCount++] = pointArray[i];        }        raisePrimitiveFlag();    }    void fillRect (final int x, final int y, final int width, final int height) {        ensureIntArraySpace(5);        intParams[intCount++] = OP_FILLRECT;        intParams[intCount++] = x;        intParams[intCount++] = y;        intParams[intCount++] = width;        intParams[intCount++] = height;        raisePrimitiveFlag();    }    void fillRoundRectangle (final int x, final int y, final int width, final int height, final int arcWidth, final int arcHeight) {        ensureIntArraySpace(7);        intParams[intCount++] = OP_FILLROUNDRECT;        intParams[intCount++] = x;        intParams[intCount++] = y;        intParams[intCount++] = width;        intParams[intCount++] = height;        intParams[intCount++] = arcWidth;        intParams[intCount++] = arcHeight;        raisePrimitiveFlag();    }    public void setBackgroundAlpha(final int alpha) {        ensureIntArraySpace(2);        intParams[intCount++] = OP_SETBACKGROUNDALPHA;        intParams[intCount++] = alpha;    }    void setBackgroundColor(final int argb, final boolean updateAlpha) {        ensureIntArraySpace(3);        intParams[intCount++] = OP_SETBACKGROUNDCOLOR;        intParams[intCount++] = argb;        intParams[intCount++] = updateAlpha? 1 : 0;    }    void setBlendingMode(final int mode) {        ensureIntArraySpace(2);        intParams[intCount++] = OP_SETBLENDINGMODE;        intParams[intCount++] = mode;    }    void setClip(final int x, final int y, final int width, final int height, final boolean intersects) {        ensureIntArraySpace(6);        intParams[intCount++] = OP_SETCLIP;        intParams[intCount++] = x;        intParams[intCount++] = y;        intParams[intCount++] = width;        intParams[intCount++] = height;        intParams[intCount++] = intersects? 1 : 0;    }    void cancelClipping () {        ensureIntArraySpace(1);        intParams[intCount++] = OP_CANCELCLIPPING;    }    void setFont(final int fontHandle) {        ensureIntArraySpace(2);        intParams[intCount++] = OP_SETFONT;        intParams[intCount++] = fontHandle;    }    void setForegroundAlpha(final int alpha) {        ensureIntArraySpace(2);        intParams[intCount++] = OP_SETFOREGROUNDALPHA;        intParams[intCount++] = alpha;    }    void setForegroundColor(final int argb, final boolean updateAlpha) {        ensureIntArraySpace(3);        intParams[intCount++] = OP_SETFOREGROUNDCOLOR;        intParams[intCount++] = argb;        intParams[intCount++] = updateAlpha? 1 : 0;    }    void setStrokeStyle(final int style) {        ensureIntArraySpace(2);        intParams[intCount++] = OP_SETSTROKESTYLE;        intParams[intCount++] = style;    }    void setStrokeWidth(final int width) {        ensureIntArraySpace(2);        intParams[intCount++] = OP_SETSTROKEWIDTH;        intParams[intCount++] = width;    }    void translate(final int x, final int y) {        ensureIntArraySpace(3);        intParams[intCount++] = OP_TRANSLATE;        intParams[intCount++] = x;        intParams[intCount++] = y;    }    void scale(final int x, final int y) {        ensureIntArraySpace(3);        intParams[intCount++] = OP_SCALE;        intParams[intCount++] = x;        intParams[intCount++] = y;    }    void resetTransform() {        ensureIntArraySpace(1);        intParams[intCount++] = OP_RESETTRANSFORM;    }    void copyArea(final Image image, final int x, final int y) {        ensureIntArraySpace(3);        intParams[intCount++] = OP_COPYAREA1;        intParams[intCount++] = x;        intParams[intCount++] = y;        // TODO does this need flushing on the image        images.addElement(new Image(image));        raisePrimitiveFlag();    }    void copyArea(final int srcX, final int srcY, final int width, final int height, final int destX, final int destY, final boolean paint) {        ensureIntArraySpace(8);        intParams[intCount++] = OP_COPYAREA2;        intParams[intCount++] = srcX;        intParams[intCount++] = srcY;        intParams[intCount++] = width;        intParams[intCount++] = height;        intParams[intCount++] = destX;        intParams[intCount++] = destY;        intParams[intCount++] = paint? 1 : 0;        raisePrimitiveFlag();    }    // Unsupported operations    int getAdvancedCharacterWidth(final char ch, final boolean isAdvanced) {        reportNotSupported();        return 0;    }    void getFontMetricsData(final int[] data, final int fontHandle) {        reportNotSupported();    }    int getBackgroundAlpha() {        reportNotSupported();        return 0;    }    int getBackgroundColor() {        reportNotSupported();        return 0;    }    int getBlendingMode() {        reportNotSupported();        return 0;    }    void getClip(final int[] clip) {        reportNotSupported();    }    int getForegroundAlpha() {        reportNotSupported();        return 0;    }    int getForegroundColor() {        reportNotSupported();        return 0;    }    void getTextBoundingBox(final int[] boundingBox, final String string, final int alignments, final int flags, final int rectX, final int rectY, final int rectWidth, final int rectHeight) {        reportNotSupported();    }    int getStrokeWidth() {        reportNotSupported();        return 0;    }    int getStrokeStyle() {        reportNotSupported();        return 0;    }    int getTranslateX() {        reportNotSupported();        return 0;    }    int getTranslateY() {        reportNotSupported();        return 0;    }    boolean hasClipping() {        reportNotSupported();        return false;    }    void saveSettings() {        reportNotSupported();    }    void restoreSettings() {        reportNotSupported();    }}
\ No newline at end of file
+/** * This class implements a command buffer that can be bound by GraphicsContext * to collect the drawing operations. Contents of the command buffer can be replayed to * GraphicsContext target with GraphicsContext.render() method. * * When JavaCommandBuffer is set as the target of GraphicsContext some of the methods * provided by GraphicsContext are not supported, e.g. getters, since the JavaCommandBuffer * does not have a real rendering target from which to query related data. To find out what is * supported see the methods of this class. In principal GraphicsContext supports all draw and set operations, * when JavaCommandBuffer is set as rendering target. */public final class JavaCommandBuffer {    // All collected drawing operations and their parameters    private int[] intParams;    private int intCount;    private StringBuffer strParams;    // Container for images    private Vector images;    // Container for rgbData    private Vector rgbData;    // This flag is indicates if this buffer is bound by some GraphicsContext    private boolean bound;    // This flag indicates if this buffer is empty or not    private boolean containsData;    // This flag indicates if this buffer has any draw commands in it    private boolean containsPrimitiveData;    // Memory management configuration constants    private static final int INT_BUF_GRANULARITY         = 2560; // 10kB    private static final int INT_BUF_INITIAL_SIZE        = 256; // 1kB    private static final int IMAGE_BUF_INITIAL_SIZE      = 256; // 1kB    private static final int IMAGE_BUF_GRANULARITY       = 256; // 1kB    private static final int STRING_BUFFER_INITIAL_SIZE  = 256; // 1kB    // Prefixes for different categories of op codes, stored in MSB    final static int DRAW_PREFIX = 0;    final static int FILL_PREFIX = 1;    final static int SET_PREFIX = 2;    final static int MISC_PREFIX = 3;    // Unique operation codes for all the gc operations that can be buffered.    static final int OP_DRAWARC            = ((DRAW_PREFIX << 24) | 1);    static final int OP_DRAWFOCUS          = ((DRAW_PREFIX << 24) | 2);    static final int OP_DRAWIMAGE1         = ((DRAW_PREFIX << 24) | 3);    static final int OP_DRAWIMAGE2         = ((DRAW_PREFIX << 24) | 4);    static final int OP_DRAWLINE           = ((DRAW_PREFIX << 24) | 5);    static final int OP_DRAWELLIPSE        = ((DRAW_PREFIX << 24) | 6);    static final int OP_DRAWPOINT          = ((DRAW_PREFIX << 24) | 7);    static final int OP_DRAWPOLYGON        = ((DRAW_PREFIX << 24) | 8);    static final int OP_DRAWPOLYLINE       = ((DRAW_PREFIX << 24) | 9);    static final int OP_DRAWRECT           = ((DRAW_PREFIX << 24) | 10);    static final int OP_DRAWRGB_INT        = ((DRAW_PREFIX << 24) | 11);    static final int OP_DRAWRGB_BYTE       = ((DRAW_PREFIX << 24) | 12);    static final int OP_DRAWRGB_SHORT      = ((DRAW_PREFIX << 24) | 13);    static final int OP_DRAWROUNDRECT      = ((DRAW_PREFIX << 24) | 14);    static final int OP_DRAWSTRING         = ((DRAW_PREFIX << 24) | 15);    static final int OP_FILLARC            = ((FILL_PREFIX << 24) | 16);    static final int OP_FILLGRADIENTRECT   = ((FILL_PREFIX << 24) | 17);    static final int OP_FILLELLIPSE        = ((FILL_PREFIX << 24) | 18);    static final int OP_FILLPOLYGON        = ((FILL_PREFIX << 24) | 19);    static final int OP_FILLRECT           = ((FILL_PREFIX << 24) | 20);    static final int OP_FILLROUNDRECT      = ((FILL_PREFIX << 24) | 21);    static final int OP_SETBACKGROUNDALPHA = ((SET_PREFIX << 24) | 22);    static final int OP_SETBACKGROUNDCOLOR = ((SET_PREFIX << 24) | 23);    static final int OP_SETBLENDINGMODE    = ((SET_PREFIX << 24) | 24);    static final int OP_SETCLIP            = ((SET_PREFIX << 24) | 25);    static final int OP_CANCELCLIPPING     = ((SET_PREFIX << 24) | 26);    static final int OP_SETFONT            = ((SET_PREFIX << 24) | 27);    static final int OP_SETFOREGROUNDALPHA = ((SET_PREFIX << 24) | 28);    static final int OP_SETFOREGROUNDCOLOR = ((SET_PREFIX << 24) | 29);    static final int OP_SETSTROKESTYLE     = ((SET_PREFIX << 24) | 30);    static final int OP_SETSTROKEWIDTH     = ((SET_PREFIX << 24) | 31);    static final int OP_TRANSLATE          = ((MISC_PREFIX << 24) | 32);    static final int OP_SCALE              = ((MISC_PREFIX << 24) | 33);    static final int OP_RESETTRANSFORM     = ((MISC_PREFIX << 24) | 34);    static final int OP_COPYAREA1          = ((MISC_PREFIX << 24) | 35);    static final int OP_COPYAREA2          = ((MISC_PREFIX << 24) | 36);    /**     * Constructs empty command buffer with defined buffer sizes.     */    public JavaCommandBuffer() {        intParams = new int[INT_BUF_INITIAL_SIZE];        strParams = new StringBuffer(STRING_BUFFER_INITIAL_SIZE);        images = new Vector(IMAGE_BUF_INITIAL_SIZE, IMAGE_BUF_GRANULARITY);        rgbData = new Vector(IMAGE_BUF_INITIAL_SIZE, IMAGE_BUF_GRANULARITY);    }    /**     * Resets the buffer, i.e. removes all recorded commands and related data. The integer array containing     * the actual operation codes is not deleted, only the index pointer is rested, thus the memory consumption of that is not freed.     * CommandBuffer can be reseted only if it is not bound by any GraphicsContext     * @throws IllegalStateException if this CommandBuffer is bound while calling reset     */    public void reset() {        if(bound) {            throw new IllegalStateException("CommandBuffer is still bound by gc");        }        intCount = 0;        strParams.setLength(0);        Enumeration allImages = images.elements();        while(allImages.hasMoreElements()) {            Image image = (Image)allImages.nextElement();            if(image != null) {                image.freeCommandBufferCopy();            }        }        images.removeAllElements();        rgbData.removeAllElements();        containsData = false;        containsPrimitiveData = false;    }    /**     * Checks that does this buffer contain any commands     * @return true if any command has been written to buffer otherwise false     */    public boolean containsData() {        return containsData;    }    /**     * Checks that does this buffer contain any draw commands, i.e. any setters etc.     * that does to cause any pixels to be rendered are ignored     * @return true if any draw command has been written to buffer otherwise false     */    public boolean containsDrawnPrimitives() {        return containsPrimitiveData;    }    /**     * Binds this buffer     */    void bind() {        bound = true;    }    /**     * Provides the binding status of this buffer     * @return true if this buffer has been already bound otherwise false     */    boolean isBound() {        return bound;    }    /**     * Releases this buffer, i.e. it can be bound by some other GraphicsContext     */    void release() {        bound = false;    }    private void ensureIntArraySpace(final int items) {        if( intParams.length < intCount + items) {            int[] dst = new int[intParams.length + Math.max(INT_BUF_GRANULARITY, items)];            System.arraycopy(intParams, 0, dst, 0, intParams.length);            intParams = dst;        }        containsData = true;    }    private void reportNotSupported() {        throw new RuntimeException("Intenal: Operation not supported with JavaCommandBuffer");    }//    private void printBufferInfo() {//        System.out.println("CommandBuffer Info: " +this);//        System.out.println("intParamCount: " + intCount);//        System.out.println("intBuffer Size: " + intParams.length);//        System.out.println("StringBuffer Size: " + strParams.length());//    }    private void raisePrimitiveFlag() {        containsPrimitiveData = true;    }    int[] intParams() {        return intParams;    }    int intParamCount() {        return intCount;    }    Vector rgbParams() {        return rgbData;    }    Vector images() {        return images;    }    String strParams() {        return strParams.toString();    }    void drawArc (final int x, final int y, final int width, final int height, final int startAngle, final int arcAngle) {        ensureIntArraySpace(7);        intParams[intCount++] = OP_DRAWARC;        intParams[intCount++] = x;        intParams[intCount++] = y;        intParams[intCount++] = width;        intParams[intCount++] = height;        intParams[intCount++] = startAngle;        intParams[intCount++] = arcAngle;        raisePrimitiveFlag();    }    void drawFocus (final int x, final int y, final int width, final int height) {        ensureIntArraySpace(5);        intParams[intCount++] = OP_DRAWFOCUS;        intParams[intCount++] = x;        intParams[intCount++] = y;        intParams[intCount++] = width;        intParams[intCount++] = height;        raisePrimitiveFlag();    }    // Must be called from UI thread as images cannot be creates outside that    void drawImage(final Image image, final int x, final int y) {        ensureIntArraySpace(3);        intParams[intCount++] = OP_DRAWIMAGE1;        intParams[intCount++] = x;        intParams[intCount++] = y;        // creating copy of image here uses implicit data sharing,        // thus only a shallow copy is made        images.addElement(image.getCommandBufferCopy());        raisePrimitiveFlag();    }    // must be called from UI thread as images cannot be creates outside that    void drawImage(final Image image, final int tx, final int ty, final int tw, final int th, final int sx, final int sy, final int sw, final int sh, final int manipulation) {        ensureIntArraySpace(10);        intParams[intCount++] = OP_DRAWIMAGE2;        intParams[intCount++] = tx;        intParams[intCount++] = ty;        intParams[intCount++] = tw;        intParams[intCount++] = th;        intParams[intCount++] = sx;        intParams[intCount++] = sy;        intParams[intCount++] = sw;        intParams[intCount++] = sh;        intParams[intCount++] = manipulation;        // creating copy of image here uses implicit data sharing,        // thus only a shallow copy is made        images.addElement(image.getCommandBufferCopy());        raisePrimitiveFlag();    }    void drawLine (final int x1, final int y1, final int x2, final int y2) {        ensureIntArraySpace(5);        intParams[intCount++] = OP_DRAWLINE;        intParams[intCount++] = x1;        intParams[intCount++] = y1;        intParams[intCount++] = x2;        intParams[intCount++] = y2;        raisePrimitiveFlag();    }    void drawEllipse (final int x, final int y, final int width, final int height) {        ensureIntArraySpace(5);        intParams[intCount++] = OP_DRAWELLIPSE;        intParams[intCount++] = x;        intParams[intCount++] = y;        intParams[intCount++] = width;        intParams[intCount++] = height;        raisePrimitiveFlag();    }    void drawPoint (final int x, final int y) {        ensureIntArraySpace(3);        intParams[intCount++] = OP_DRAWPOINT;        intParams[intCount++] = x;        intParams[intCount++] = y;        raisePrimitiveFlag();    }    void drawPolygon(final int[] pointArray) {        ensureIntArraySpace(2 + pointArray.length);        intParams[intCount++] = OP_DRAWPOLYGON;        intParams[intCount++] = pointArray.length;        for(int i = 0; i < pointArray.length; ++i) {            intParams[intCount++] = pointArray[i];        }        raisePrimitiveFlag();    }    void drawPolyline(final int[] pointArray) {        ensureIntArraySpace(2 + pointArray.length);        intParams[intCount++] = OP_DRAWPOLYLINE;        intParams[intCount++] = pointArray.length;        for(int i = 0; i < pointArray.length; ++i) {            intParams[intCount++] = pointArray[i];        }        raisePrimitiveFlag();    }    void drawRect (final int x, final int y, final int width, final int height) {        ensureIntArraySpace(5);        intParams[intCount++] = OP_DRAWRECT;        intParams[intCount++] = x;        intParams[intCount++] = y;        intParams[intCount++] = width;        intParams[intCount++] = height;        raisePrimitiveFlag();    }    void drawRGB(final int[] rgb, final int offset, final int scanlength, final int x, final int y, final int width, final int height, final boolean processAlpha, final int manipulation) {        ensureIntArraySpace(9);        intParams[intCount++] = OP_DRAWRGB_INT;        intParams[intCount++] = offset;        intParams[intCount++] = scanlength;        intParams[intCount++] = x;        intParams[intCount++] = y;        intParams[intCount++] = width;        intParams[intCount++] = height;        intParams[intCount++] = processAlpha? 1 : 0;        intParams[intCount++] = manipulation;        rgbData.addElement(rgb);        raisePrimitiveFlag();    }    void drawRGB(final byte[] rgb, final byte[] transparencyMask, final int offset, final int scanlength, final int x, final int y, final int width, final int height, final int manipulation, final int format) {        ensureIntArraySpace(9);        intParams[intCount++] = OP_DRAWRGB_BYTE;        intParams[intCount++] = offset;        intParams[intCount++] = scanlength;        intParams[intCount++] = x;        intParams[intCount++] = y;        intParams[intCount++] = width;        intParams[intCount++] = height;        intParams[intCount++] = manipulation;        intParams[intCount++] = format;        rgbData.addElement(rgb);        rgbData.addElement(transparencyMask);        raisePrimitiveFlag();    }    void drawRGB(final short[] rgb, final int offset, final int scanlength, final int x, final int y, final int width, final int height, final boolean processAlpha, final int manipulation, final int format) {        ensureIntArraySpace(10);        intParams[intCount++] = OP_DRAWRGB_SHORT;        intParams[intCount++] = offset;        intParams[intCount++] = scanlength;        intParams[intCount++] = x;        intParams[intCount++] = y;        intParams[intCount++] = width;        intParams[intCount++] = height;        intParams[intCount++] = processAlpha? 1 : 0;        intParams[intCount++] = manipulation;        intParams[intCount++] = format;        rgbData.addElement(rgb);        raisePrimitiveFlag();    }    void drawRoundRect (final int x, final int y, final int width, final int height, final int arcWidth, final int arcHeight) {        ensureIntArraySpace(7);        intParams[intCount++] = OP_DRAWROUNDRECT;        intParams[intCount++] = x;        intParams[intCount++] = y;        intParams[intCount++] = width;        intParams[intCount++] = height;        intParams[intCount++] = arcWidth;        intParams[intCount++] = arcHeight;        raisePrimitiveFlag();    }    void drawString(final String string, final int x, final int y, final int width, final int height, final int alignments, final int flags, final boolean isTransparent) {        ensureIntArraySpace(9);        intParams[intCount++] = OP_DRAWSTRING;        intParams[intCount++] = string.length();        intParams[intCount++] = x;        intParams[intCount++] = y;        intParams[intCount++] = width;        intParams[intCount++] = height;        intParams[intCount++] = alignments;        intParams[intCount++] = flags;        intParams[intCount++] = isTransparent? 1 : 0;        strParams.append(string);        raisePrimitiveFlag();    }    void fillArc (final int x, final int y, final int width, final int height, final int startAngle, final int arcAngle) {        ensureIntArraySpace(7);        intParams[intCount++] = OP_FILLARC;        intParams[intCount++] = x;        intParams[intCount++] = y;        intParams[intCount++] = width;        intParams[intCount++] = height;        intParams[intCount++] = startAngle;        intParams[intCount++] = arcAngle;        raisePrimitiveFlag();    }    void fillGradientRect(final int x, final int y, final int width, final int height, final boolean vertical, final boolean swapColors) {        ensureIntArraySpace(7);        intParams[intCount++] = OP_FILLGRADIENTRECT;        intParams[intCount++] = x;        intParams[intCount++] = y;        intParams[intCount++] = width;        intParams[intCount++] = height;        intParams[intCount++] = vertical ? 1 : 0;        intParams[intCount++] = swapColors ? 1 : 0;        raisePrimitiveFlag();    }    void fillEllipse (final int x, final int y, final int width, final int height) {        ensureIntArraySpace(5);        intParams[intCount++] = OP_FILLELLIPSE;        intParams[intCount++] = x;        intParams[intCount++] = y;        intParams[intCount++] = width;        intParams[intCount++] = height;        raisePrimitiveFlag();    }    void fillPolygon (final int[] pointArray) {        ensureIntArraySpace(2 + pointArray.length);        intParams[intCount++] = OP_FILLPOLYGON;        intParams[intCount++] = pointArray.length;        for(int i = 0; i < pointArray.length; ++i) {            intParams[intCount++] = pointArray[i];        }        raisePrimitiveFlag();    }    void fillRect (final int x, final int y, final int width, final int height) {        ensureIntArraySpace(5);        intParams[intCount++] = OP_FILLRECT;        intParams[intCount++] = x;        intParams[intCount++] = y;        intParams[intCount++] = width;        intParams[intCount++] = height;        raisePrimitiveFlag();    }    void fillRoundRectangle (final int x, final int y, final int width, final int height, final int arcWidth, final int arcHeight) {        ensureIntArraySpace(7);        intParams[intCount++] = OP_FILLROUNDRECT;        intParams[intCount++] = x;        intParams[intCount++] = y;        intParams[intCount++] = width;        intParams[intCount++] = height;        intParams[intCount++] = arcWidth;        intParams[intCount++] = arcHeight;        raisePrimitiveFlag();    }    public void setBackgroundAlpha(final int alpha) {        ensureIntArraySpace(2);        intParams[intCount++] = OP_SETBACKGROUNDALPHA;        intParams[intCount++] = alpha;    }    void setBackgroundColor(final int argb, final boolean updateAlpha) {        ensureIntArraySpace(3);        intParams[intCount++] = OP_SETBACKGROUNDCOLOR;        intParams[intCount++] = argb;        intParams[intCount++] = updateAlpha? 1 : 0;    }    void setBlendingMode(final int mode) {        ensureIntArraySpace(2);        intParams[intCount++] = OP_SETBLENDINGMODE;        intParams[intCount++] = mode;    }    void setClip(final int x, final int y, final int width, final int height, final boolean intersects) {        ensureIntArraySpace(6);        intParams[intCount++] = OP_SETCLIP;        intParams[intCount++] = x;        intParams[intCount++] = y;        intParams[intCount++] = width;        intParams[intCount++] = height;        intParams[intCount++] = intersects? 1 : 0;    }    void cancelClipping () {        ensureIntArraySpace(1);        intParams[intCount++] = OP_CANCELCLIPPING;    }    void setFont(final int fontHandle) {        ensureIntArraySpace(2);        intParams[intCount++] = OP_SETFONT;        intParams[intCount++] = fontHandle;    }    void setForegroundAlpha(final int alpha) {        ensureIntArraySpace(2);        intParams[intCount++] = OP_SETFOREGROUNDALPHA;        intParams[intCount++] = alpha;    }    void setForegroundColor(final int argb, final boolean updateAlpha) {        ensureIntArraySpace(3);        intParams[intCount++] = OP_SETFOREGROUNDCOLOR;        intParams[intCount++] = argb;        intParams[intCount++] = updateAlpha? 1 : 0;    }    void setStrokeStyle(final int style) {        ensureIntArraySpace(2);        intParams[intCount++] = OP_SETSTROKESTYLE;        intParams[intCount++] = style;    }    void setStrokeWidth(final int width) {        ensureIntArraySpace(2);        intParams[intCount++] = OP_SETSTROKEWIDTH;        intParams[intCount++] = width;    }    void translate(final int x, final int y) {        ensureIntArraySpace(3);        intParams[intCount++] = OP_TRANSLATE;        intParams[intCount++] = x;        intParams[intCount++] = y;    }    void scale(final int x, final int y) {        ensureIntArraySpace(3);        intParams[intCount++] = OP_SCALE;        intParams[intCount++] = x;        intParams[intCount++] = y;    }    void resetTransform() {        ensureIntArraySpace(1);        intParams[intCount++] = OP_RESETTRANSFORM;    }    void copyArea(final Image image, final int x, final int y) {        ensureIntArraySpace(3);        intParams[intCount++] = OP_COPYAREA1;        intParams[intCount++] = x;        intParams[intCount++] = y;        // TODO does this need flushing on the image        images.addElement(new Image(image));        raisePrimitiveFlag();    }    void copyArea(final int srcX, final int srcY, final int width, final int height, final int destX, final int destY, final boolean paint) {        ensureIntArraySpace(8);        intParams[intCount++] = OP_COPYAREA2;        intParams[intCount++] = srcX;        intParams[intCount++] = srcY;        intParams[intCount++] = width;        intParams[intCount++] = height;        intParams[intCount++] = destX;        intParams[intCount++] = destY;        intParams[intCount++] = paint? 1 : 0;        raisePrimitiveFlag();    }    // Unsupported operations    int getAdvancedCharacterWidth(final char ch, final boolean isAdvanced) {        reportNotSupported();        return 0;    }    void getFontMetricsData(final int[] data, final int fontHandle) {        reportNotSupported();    }    int getBackgroundAlpha() {        reportNotSupported();        return 0;    }    int getBackgroundColor() {        reportNotSupported();        return 0;    }    int getBlendingMode() {        reportNotSupported();        return 0;    }    void getClip(final int[] clip) {        reportNotSupported();    }    int getForegroundAlpha() {        reportNotSupported();        return 0;    }    int getForegroundColor() {        reportNotSupported();        return 0;    }    void getTextBoundingBox(final int[] boundingBox, final String string, final int alignments, final int flags, final int rectX, final int rectY, final int rectWidth, final int rectHeight) {        reportNotSupported();    }    int getStrokeWidth() {        reportNotSupported();        return 0;    }    int getStrokeStyle() {        reportNotSupported();        return 0;    }    int getTranslateX() {        reportNotSupported();        return 0;    }    int getTranslateY() {        reportNotSupported();        return 0;    }    boolean hasClipping() {        reportNotSupported();        return false;    }    void saveSettings() {        reportNotSupported();    }    void restoreSettings() {        reportNotSupported();    }}
\ No newline at end of file
--- a/javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/org/eclipse/swt/internal/qt/graphics/OS.java	Tue Jul 06 14:10:26 2010 +0300
+++ b/javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/org/eclipse/swt/internal/qt/graphics/OS.java	Wed Aug 18 09:43:15 2010 +0300
@@ -11,6 +11,7 @@
 package org.eclipse.swt.internal.qt.graphics;
 
 import org.eclipse.swt.graphics.ImageData;
+import org.eclipse.swt.graphics.Point;
 
 final class OS {    
     // Graphics Context
@@ -78,10 +79,11 @@
     static final native void graphicsContext_restoreSettings(int handle);
 
     // Image
-    static final native int image_create(int width, int Height, int fillColor); 
+    static final native int image_create(int width, int height, int fillColor); 
     static final native int image_create(int imageHandle, int x, int y, int width, int height);
     static final native int image_create(ImageData imageData);
     static final native int image_create(int[] argbData, int width, int height, boolean hasAlpha);
+    static final native int image_create(int pixmapHandle);
     static final native int image_getFormat(int handle);
     static final native int image_getHeight(int handle);
     static final native int image_getWidth(int handle);
@@ -103,6 +105,7 @@
     static final native void imageLoader_dispose(int handle);
     static final native int imageLoader_load(int handle, String fileName);
     static final native void imageLoader_setLoadSize(int handle, int width, int height);
+    static final native Point imageLoader_getImageSize(byte[] data);
     
     // FontUtils
     static final native int  fontUtils_getAscent(int fontHandle);
--- a/javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/org/eclipse/swt/widgets/Internal_PackageSupport.java	Tue Jul 06 14:10:26 2010 +0300
+++ b/javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/org/eclipse/swt/widgets/Internal_PackageSupport.java	Wed Aug 18 09:43:15 2010 +0300
@@ -385,6 +385,9 @@
 public static void setStandardIcon(Label l, int iconType, int iconWidth, int iconHeight) {
     l.setStandardIcon(iconType, iconWidth, iconHeight);
 }
+public static void setThemeIcon(Label l, String iconName) {
+    l.setThemeIcon(iconName);
+}
 
 public static void setMobileDevice(Display display, MobileDevice mobileDevice){
 	Display.mobileDevice = mobileDevice;
--- a/javauis/javalegacyutils/javasrc/com/nokia/mj/impl/rt/legacy/ToolkitInvoker.java	Tue Jul 06 14:10:26 2010 +0300
+++ b/javauis/javalegacyutils/javasrc/com/nokia/mj/impl/rt/legacy/ToolkitInvoker.java	Wed Aug 18 09:43:15 2010 +0300
@@ -88,15 +88,6 @@
      */
     public abstract boolean isNgaEnabled();
 
-
-    /**
-     * NGA specific change.
-     * LCDUI's client APIs (e.g M3G) can check are they on foreground or not. 
-     * @return <code>true</code> if MIDlet is on foreground.
-     * @since S60 9.2
-     */
-    public abstract boolean isForeground();
-    
     //
     // Image access
     //
--- a/javauis/javalegacyutils/javasrc/com/nokia/mj/impl/rt/legacy/ToolkitObserverNGAExtension.java	Tue Jul 06 14:10:26 2010 +0300
+++ b/javauis/javalegacyutils/javasrc/com/nokia/mj/impl/rt/legacy/ToolkitObserverNGAExtension.java	Wed Aug 18 09:43:15 2010 +0300
@@ -21,9 +21,7 @@
 public interface ToolkitObserverNGAExtension extends ToolkitObserver
 {
     /**
-     * Notification about MIDlet going to background or coming foreground.
-     * @param foreground    true, when MIDlet came to foreground
-     *                      false, when MIDlet was sent to background
+     * Notification that observer should free all graphics memory immediately.
      */
-    void foregroundEvent(boolean foreground);
+    void freeGraphicsMemory();
 }
\ No newline at end of file
--- a/javauis/javauis.pro	Tue Jul 06 14:10:26 2010 +0300
+++ b/javauis/javauis.pro	Wed Aug 18 09:43:15 2010 +0300
@@ -18,7 +18,7 @@
 SUBDIRS += eswt_qt/build 
 SUBDIRS += lcdui_qt/build/openlcdui.pro 
 SUBDIRS += runtimeui_qt/build/javaruntimeui.pro 
-SUBDIRS += nokiauiapi_qt/build/nokiauiapiqt.pro 
+SUBDIRS += nokiauiapi_qt/build/javanokiaui.pro 
 SUBDIRS += mmapi_qt/build/javamobilemedia.pro 
 SUBDIRS += amms_qt/build/javaamms.pro 
 SUBDIRS += m3g_qt/build/javam3g.pro 
--- a/javauis/lcdui_qt/build/build.xml	Tue Jul 06 14:10:26 2010 +0300
+++ b/javauis/lcdui_qt/build/build.xml	Wed Aug 18 09:43:15 2010 +0300
@@ -26,10 +26,6 @@
 
     <property name="java.src.paths" value="../src:../src_j2me"/>
 
-    <target name="compile">
-        <omj.javac classpath="${impl.cldc.jar}"/>
-    </target>
-
     <target name="system.properties">
         <properties>
             com.nokia.mid.ui.version=1.2
@@ -85,5 +81,12 @@
                                     com/nokia/mid/ui/FullCanvas.class,
                                     com/nokia/mid/ui/TactileFeedback.class"/>
     </target>
+    
+    
+  <target name="create.internal.api.jar">
+    <omj.internal.apis includes=
+                 "com/nokia/mj/impl/nokialcdui/LCDUIInvoker.class,
+                com/nokia/mj/impl/nokialcdui/ItemControlStateChangeListener.class"/>
+  </target>
 
 </project>
--- a/javauis/lcdui_qt/src/javax/microedition/lcdui/Canvas.java	Tue Jul 06 14:10:26 2010 +0300
+++ b/javauis/lcdui_qt/src/javax/microedition/lcdui/Canvas.java	Wed Aug 18 09:43:15 2010 +0300
@@ -28,7 +28,6 @@
 import org.eclipse.swt.widgets.*;
 import org.eclipse.swt.widgets.Display;
 import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.internal.extension.CompositeExtension;
 import org.eclipse.swt.internal.qt.graphics.WindowSurface;
 import org.eclipse.swt.internal.extension.MobileShellExtension;
 import org.eclipse.swt.internal.qt.SymbianWindowVisibilityListener;
@@ -191,7 +190,6 @@
     //private Composite keypadComposite;
     private CanvasKeypad onScreenkeypad;
     private static CanvasKeypad sharedKeypad;
-    private int oskHeight;
 
     // Vector of flags that a certain key was pressed but was not released.
     // Used to implement keyRepeated since eSWT does not support
@@ -372,7 +370,7 @@
     Composite eswtConstructContent(int style)
     {
         // Get JAD attribute
-        setMode(NO_BACKGROUND, JadAttributeUtil.isValue(JadAttributeUtil.ATTRIB_NOKIA_UI_ENHANCEMENT,
+        setMode(NO_BACKGROUND, !JadAttributeUtil.isValue(JadAttributeUtil.ATTRIB_NOKIA_UI_ENHANCEMENT,
                                                 JadAttributeUtil.VALUE_CANVAS_HAS_BACKGROUND));
         if(isMode(NO_BACKGROUND))
         {
@@ -434,11 +432,12 @@
         canvasComp.setVisible(false);
 
         createOnScreenKeypad();
+        return canvasComp;
+    }
 
+    void eswtInitGraphics() {
         // create graphics buffer
-        graphicsBuffer = Buffer.createInstance(this, canvasComp);
-
-        return canvasComp;
+       graphicsBuffer = Buffer.createInstance(this, canvasComp);
     }
 
     /**
@@ -753,26 +752,6 @@
     {
         return KeyTable.getKeyName(keyCode);
     }
-    /**
-     * Gets height.
-     *
-     * @return Height of the Displayable in pixels.
-     */
-    public int getHeight()
-    {
-        ESWTUIThreadRunner.syncExec(new Runnable()
-        {
-            public void run()
-            {
-                if(onScreenkeypad != null)
-                {
-                    oskHeight = onScreenkeypad.getHeight();
-                }
-            }
-        });
-        return (super.getHeight() - oskHeight);
-
-    }
 
     /**
      * Callback to be implemented by the application to render the
@@ -1563,9 +1542,11 @@
     class CanvasShellVisibilityListener implements SymbianWindowVisibilityListener
     {
         public void handleSymbianWindowVisibilityChange(Widget widget, boolean visible) {
-            if (javax.microedition.lcdui.Canvas.this.getShell() == widget)
+            if (javax.microedition.lcdui.Canvas.this.getShell() == widget && graphicsBuffer != null)
             {
-                graphicsBuffer.getWindowSurface().handleSymbianWindowVisibilityChange(visible);
+                WindowSurface surface = graphicsBuffer.getWindowSurface();
+                if (surface != null)
+                    surface.handleSymbianWindowVisibilityChange(visible);
             }
         }
     }
--- a/javauis/lcdui_qt/src/javax/microedition/lcdui/CanvasKeypad.java	Tue Jul 06 14:10:26 2010 +0300
+++ b/javauis/lcdui_qt/src/javax/microedition/lcdui/CanvasKeypad.java	Wed Aug 18 09:43:15 2010 +0300
@@ -1,136 +1,129 @@
 /*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description:
+ *
+ */
 package javax.microedition.lcdui;
 
-import java.util.Vector;
 import java.util.Timer;
 import java.util.TimerTask;
 
-import org.eclipse.ercp.swt.mobile.MobileShell;
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.events.*;
 import org.eclipse.swt.widgets.*;
 import org.eclipse.swt.widgets.Display;
 import org.eclipse.swt.graphics.*;
+import org.eclipse.swt.internal.extension.ImageUtil;
 import org.eclipse.swt.internal.qt.*;
-import com.nokia.mj.impl.rt.support.ApplicationInfo;
 
 import org.eclipse.swt.layout.FormAttachment;
 import org.eclipse.swt.layout.FormData;
 import org.eclipse.swt.layout.FormLayout;
 
-import javax.microedition.lcdui.EventDispatcher.LCDUIEvent;
-
-
 /**
- * The CanvasKeypad class is designed to generate the on screen keypad
- * and handle graphical operations as well as low-level pointer events.
- * CanvasKeypad maps the pointer events to key events that are needed by the Canvas.
- *
+ * The CanvasKeypad class is designed to generate the on screen keypad and
+ * handle graphical operations as well as low-level pointer events. CanvasKeypad
+ * maps the pointer events to key events that are needed by the Canvas.
+ * 
  */
 final class CanvasKeypad implements MouseListener, MouseMoveListener
 {
-
     /**
-             *  Constant for <code>UP</code> game action.
-             */
+     * Constant for <code>UP</code> game action.
+     */
     private static final int UP = -1;
 
     /**
-             * Constant for <code>DOWN</code> game action.
-             */
+     * Constant for <code>DOWN</code> game action.
+     */
     private static final int DOWN = -2;
 
     /**
-             * Constant for <code>LEFT</code> game action.
-             */
+     * Constant for <code>LEFT</code> game action.
+     */
     private static final int LEFT = -3;
 
     /**
-             * Constant for <code>RIGHT</code> game action.
-             */
+     * Constant for <code>RIGHT</code> game action.
+     */
     private static final int RIGHT = -4;
 
     /**
-             * Constant for <code>FIRE</code> game action.
-             */
+     * Constant for <code>FIRE</code> game action.
+     */
     private static final int FIRE = -5;
 
     /**
-             * Constant for <code>SLK</code> game action.
-             */
+     * Constant for <code>SLK</code> game action.
+     */
     private static final int SLK = -6;
 
     /**
-             * Constant for <code>SRK</code> game action.
-             */
+     * Constant for <code>SRK</code> game action.
+     */
     private static final int SRK = -7;
 
     /**
-             * Constant for general "<code>A</code>" game action.
-             */
+     * Constant for general "<code>A</code>" game action.
+     */
     private static final int GAME_A = 55;
 
     /**
-             * Constant for general "<code>B</code>" game action.
-             */
+     * Constant for general "<code>B</code>" game action.
+     */
     private static final int GAME_B = 57;
 
     /**
-             * Constant for general "<code>C</code>" game action.
-             */
+     * Constant for general "<code>C</code>" game action.
+     */
     private static final int GAME_C = 42;
 
     /**
-             * Constant for general "<code>D</code>" game action.
-             */
+     * Constant for general "<code>D</code>" game action.
+     */
     private static final int GAME_D = 35;
 
     /**
-             * Constant for general invalid key code.
-             */
+     * Constant for general invalid key code.
+     */
     private static final int INVALID_CODE = -99;
 
     /**
-            * Constant for long keypress timeout.
-            */
+     * Constant for long keypress timeout.
+     */
     private static final int KEYREPEAT_INTERVAL = 500;
 
     /**
-             * alpha value of a transparent pixel.
-             */
+     * Alpha value of a transparent pixel.
+     */
     private static final int TRANSPARENT = 0;
 
     /**
-             * keypad and game keys composites.
-             */
+     * Keypad and game keys composites.
+     */
     private Composite keypadComposite;
     private Composite gameKeysComposite;
     private Canvas canvas;
 
     /**
-             * CSS engine instance
-             */
+     * CSS engine instance
+     */
     private BaseCSSEngine cssEngine;
 
     /**
-            * Canvas keypad buttons.
-            */
-
+     * Canvas keypad buttons.
+     */
     private Label center;
     private Label up;
     private Label down;
@@ -169,28 +162,30 @@
     private Label rockerKeyPressed;
 
     /**
-             * Timer for handling long key press and mouse move events.
-             */
+     * Timer for handling long key press and mouse move events.
+     */
     private Timer timer = new Timer();
     private CanvasKeypadTimerTask timerTask;
 
     /**
-             * Path of the osk graphics
-             */
+     * Path of the osk graphics
+     */
     private static final String RESOURCE_PATH = "c:/data/images/";
 
     /**
-             * offset on the composite in pixels where the osk rocker keys are layed out.
-             */
+     * Offset on the composite in pixels where the osk rocker keys are layed
+     * out.
+     */
     private int image_offset;
 
-
     /**
-             * Constructs a canvas kepad based on the JAD attribute
-             *
-             * @param canvas - canvas for which the keypad is required.
-             * @param mode- the jad attribute as a string.
-             */
+     * Constructs a canvas kepad based on the JAD attribute
+     * 
+     * @param canvas
+     *            - canvas for which the keypad is required.
+     * @param mode
+     *            - the jad attribute as a string.
+     */
     CanvasKeypad(Canvas canvas, String mode)
     {
 
@@ -199,45 +194,41 @@
 
         cssEngine = new BaseCSSEngine(display);
 
+        // Load the images
+        center_normal = ImageUtil.createImageFromTheme(display, "qtg_fr_rocker_normal_c");
+        center_pressed = ImageUtil.createImageFromTheme(display, "qtg_fr_rocker_pressed_c");
+        left_normal = ImageUtil.createImageFromTheme(display, "qtg_fr_rocker_normal_l");
+        left_pressed = ImageUtil.createImageFromTheme(display, "qtg_fr_rocker_pressed_l");
+        right_normal = ImageUtil.createImageFromTheme(display, "qtg_fr_rocker_normal_r");
+        right_pressed = ImageUtil.createImageFromTheme(display, "qtg_fr_rocker_pressed_r");
+        up_normal = ImageUtil.createImageFromTheme(display, "qtg_fr_rocker_normal_t");
+        up_pressed = ImageUtil.createImageFromTheme(display, "qtg_fr_rocker_pressed_t");
+        down_normal = ImageUtil.createImageFromTheme(display, "qtg_fr_rocker_normal_b");
+        down_pressed = ImageUtil.createImageFromTheme(display, "qtg_fr_rocker_pressed_b");
 
-        //load the images
-        center_normal = new org.eclipse.swt.graphics.Image(display,RESOURCE_PATH + "qtg_fr_rocker_normal_c.svg");
-        center_pressed = new org.eclipse.swt.graphics.Image(display,RESOURCE_PATH + "qtg_fr_rocker_pressed_c.svg");
-        left_normal = new org.eclipse.swt.graphics.Image(display,RESOURCE_PATH + "qtg_fr_rocker_normal_l.svg");
-        left_pressed = new org.eclipse.swt.graphics.Image(display,RESOURCE_PATH + "qtg_fr_rocker_pressed_l.svg");
-        right_normal = new org.eclipse.swt.graphics.Image(display,RESOURCE_PATH + "qtg_fr_rocker_normal_r.svg");
-        right_pressed = new org.eclipse.swt.graphics.Image(display,RESOURCE_PATH + "qtg_fr_rocker_pressed_r.svg");
-        up_normal = new org.eclipse.swt.graphics.Image(display,RESOURCE_PATH + "qtg_fr_rocker_normal_t.svg");
-        up_pressed = new org.eclipse.swt.graphics.Image(display,RESOURCE_PATH + "qtg_fr_rocker_pressed_t.svg");
-        down_normal = new org.eclipse.swt.graphics.Image(display,RESOURCE_PATH + "qtg_fr_rocker_normal_b.svg");
-        down_pressed = new org.eclipse.swt.graphics.Image(display,RESOURCE_PATH + "qtg_fr_rocker_pressed_b.svg");
+        image_offset = (display.getBounds().width / 2) - (center_normal.getBounds().width / 2);
 
-        image_offset = (display.getBounds().width/2) - (center_normal.getBounds().width/2);
-
-        //Load image data required to determine the osk button pressed on mouse events
+        // Load image data required to determine the osk button pressed on mouse events
         center_data = center_normal.getImageData();
         left_data = left_normal.getImageData();
         right_data = right_normal.getImageData();
         up_data = up_normal.getImageData();
         down_data = down_normal.getImageData();
 
-
-        //Set form layout for the shell containing the canvas.
+        // Set form layout for the shell containing the canvas.
         canvas.getShell().setLayout(new FormLayout());
 
-        //Create the Navigation keypad
+        // Create the Navigation keypad
         createNavKeypad();
 
-        //check if game keys are needed
-        if(mode.equalsIgnoreCase("gameactions"))
+        // Check if game keys are needed
+        if (mode.equalsIgnoreCase("gameactions"))
         {
-            //create the game key pad
             createGamePad();
         }
 
-
-        //Layout the game keys, navigation keys and the canvas composites on the shell using form layout
-
+        // Layout the game keys, navigation keys and the canvas composites on
+        // the shell using form layout
         FormData canvasData = new FormData();
         canvasData.right = new FormAttachment(100);
         canvasData.left = new FormAttachment(0);
@@ -249,23 +240,22 @@
         navKeyData.right = new FormAttachment(100);
         navKeyData.left = new FormAttachment(0);
 
-        if(gameKeysComposite != null)
+        if (gameKeysComposite != null)
         {
-            //game keypad was created above, so layout the game keys.
+            // Game keypad was created above, so layout the game keys.
             navKeyData.bottom = new FormAttachment(gameKeysComposite);
         }
         else
         {
-            //game keys are not needed
+            // Game keys are not needed
             navKeyData.bottom = new FormAttachment(100);
         }
 
         keypadComposite.setLayoutData(navKeyData);
 
-
-        if(gameKeysComposite != null)
+        if (gameKeysComposite != null)
         {
-            //game keys were created, layout the game keys
+            // Game keys were created, layout the game keys
             FormData gameKeyData = new FormData();
             gameKeyData.right = new FormAttachment(100);
             gameKeyData.left = new FormAttachment(0);
@@ -273,19 +263,15 @@
             gameKeysComposite.setLayoutData(gameKeyData);
         }
 
-        //layout the shell
         canvas.getShell().layout();
-
     }
 
     /**
-             * creates the navigation keypad - the directional keys and selctio key.
-             */
+     * creates the navigation keypad - the directional keys and selctio key.
+     */
     private void createNavKeypad()
     {
-
-        //Create the navigation key composite
-
+        // Create the navigation key composite
         keypadComposite = new Composite(canvas.getShell(), SWT.NONE);
 
         center = new Label(keypadComposite, SWT.NONE);
@@ -305,39 +291,42 @@
         down.setImage(down_normal);
         down.pack();
 
-        //layout the navigation keys
+        // layout the navigation keys
         keypadComposite.setLayout(new FormLayout());
 
-
         FormData navkeysFormData = new FormData();
-        navkeysFormData.top=new FormAttachment(0);
-        navkeysFormData.left = new FormAttachment(0,image_offset);
+        navkeysFormData.top = new FormAttachment(0);
+        navkeysFormData.left = new FormAttachment(0, image_offset);
         center.setLayoutData(navkeysFormData);
         left.setLayoutData(navkeysFormData);
         right.setLayoutData(navkeysFormData);
         up.setLayoutData(navkeysFormData);
         down.setLayoutData(navkeysFormData);
 
-        keypadComposite.pack();
+        keypadComposite.pack(); // will also layout
 
-        keypadComposite.layout();
-
+        // The down Label will catch all mouse down events as it is covering
+        // all other rocker Labels, with the assumption that they all have 
+        // the same bounds!
+        down.addMouseListener(this);
+        down.addMouseMoveListener(this);
+        
+        // We want to catch all drag events occurring on top of the rocker 
+        // including those starting outside. 
         keypadComposite.addMouseListener(this);
         keypadComposite.addMouseMoveListener(this);
-
     }
 
-
     /**
-             * creates the game keypad - the game action keys A, B, C and D.
-             */
+     * creates the game keypad - the game action keys A, B, C and D.
+     */
     private void createGamePad()
     {
-        //create the game pad composite
+        // create the game pad composite
         gameKeysComposite = new Composite(canvas.getShell(), SWT.NONE);
         gameKeysComposite.setLayout(new FormLayout());
 
-        //Add the game buttons
+        // Add the game buttons
         gameA = new Button(gameKeysComposite, SWT.PUSH);
         gameA.addMouseListener(this);
 
@@ -350,125 +339,93 @@
         gameD = new Button(gameKeysComposite, SWT.PUSH);
         gameD.addMouseListener(this);
 
-        //Set the game key style sheets
-        cssEngine.applyCSS(gameA,"QPushButton" +
-                           "{" +
-                           "background-color:white;" +
-                           "border-style: outset;" +
-                           "border-width: 1px; " +
-                           "border-color: black;" +
-                           "border-radius: 2px;" +
-                           "font: bold 14px;" +
-                           "min-height: 2em;" +
-                           "min-width: 5.1em;" +
-                           "image: url(" + RESOURCE_PATH + "qtg_mono_game_a.svg);" +
-                           "}" +
-                           "QPushButton:pressed { image: url(" + RESOURCE_PATH + "qtg_mono_game_a.svg);" +
-                           " border-style: inset;" +
-                           "}");
-        cssEngine.applyCSS(gameB,"QPushButton" +
-                           "{" +
-                           "background-color:white;" +
-                           "border-style: outset;" +
-                           "border-width: 1px; " +
-                           "border-color: black;" +
-                           "border-radius: 2px;" +
-                           "font: bold 14px;" +
-                           "min-height: 2em;" +
-                           "min-width: 5.1em;" +
-                           "image: url(" + RESOURCE_PATH + "qtg_mono_game_b.svg);" +
-                           "}" +
-                           "QPushButton:pressed { image: url(" + RESOURCE_PATH + "qtg_mono_game_b.svg);" +
-                           " border-style: inset;" +
-                           "}");
-        cssEngine.applyCSS(gameC,"QPushButton" +
-                           "{" +
-                           "background-color:white;" +
-                           "border-style: outset;" +
-                           "border-width: 1px; " +
-                           "border-color: black;" +
-                           "border-radius: 2px;" +
-                           "font: bold 14px;" +
-                           "min-height: 2em;" +
-                           "min-width: 5.1em;" +
-                           "image: url(" + RESOURCE_PATH + "qtg_mono_game_c.svg);" +
-                           "}" +
-                           "QPushButton:pressed { image: url(" + RESOURCE_PATH + "qtg_mono_game_c.svg);" +
-                           " border-style: inset;" +
-                           "}");
-        cssEngine.applyCSS(gameD,"QPushButton" +
-                           "{" +
-                           "background-color:white;" +
-                           "border-style: outset;" +
-                           "border-width: 1px; " +
-                           "border-color: black;" +
-                           "border-radius: 2px;" +
-                           "font: bold 14px;" +
-                           "min-height: 2em;" +
-                           "min-width: 5.1em;" +
-                           "image: url(" + RESOURCE_PATH + "qtg_mono_game_d.svg);" +
-                           "}" +
-                           "QPushButton:pressed { image: url(" + RESOURCE_PATH + "qtg_mono_game_d.svg);" +
-                           " border-style: inset;" +
-                           "}");
+        // Set the game key style sheets
+        cssEngine.applyCSS(gameA, "QPushButton" + "{" + "background-color:white;"
+            + "border-style: outset;" + "border-width: 1px; " + "border-color: black;"
+            + "border-radius: 2px;" + "font: bold 14px;" + "min-height: 2em;" + "min-width: 5.1em;"
+            + "image: url(" + RESOURCE_PATH + "qtg_mono_game_a.svg);" + "}"
+            + "QPushButton:pressed { image: url(" + RESOURCE_PATH + "qtg_mono_game_a.svg);"
+            + " border-style: inset;" + "}");
+        cssEngine.applyCSS(gameB, "QPushButton" + "{" + "background-color:white;"
+            + "border-style: outset;" + "border-width: 1px; " + "border-color: black;"
+            + "border-radius: 2px;" + "font: bold 14px;" + "min-height: 2em;" + "min-width: 5.1em;"
+            + "image: url(" + RESOURCE_PATH + "qtg_mono_game_b.svg);" + "}"
+            + "QPushButton:pressed { image: url(" + RESOURCE_PATH + "qtg_mono_game_b.svg);"
+            + " border-style: inset;" + "}");
+        cssEngine.applyCSS(gameC, "QPushButton" + "{" + "background-color:white;"
+            + "border-style: outset;" + "border-width: 1px; " + "border-color: black;"
+            + "border-radius: 2px;" + "font: bold 14px;" + "min-height: 2em;" + "min-width: 5.1em;"
+            + "image: url(" + RESOURCE_PATH + "qtg_mono_game_c.svg);" + "}"
+            + "QPushButton:pressed { image: url(" + RESOURCE_PATH + "qtg_mono_game_c.svg);"
+            + " border-style: inset;" + "}");
+        cssEngine.applyCSS(gameD, "QPushButton" + "{" + "background-color:white;"
+            + "border-style: outset;" + "border-width: 1px; " + "border-color: black;"
+            + "border-radius: 2px;" + "font: bold 14px;" + "min-height: 2em;" + "min-width: 5.1em;"
+            + "image: url(" + RESOURCE_PATH + "qtg_mono_game_d.svg);" + "}"
+            + "QPushButton:pressed { image: url(" + RESOURCE_PATH + "qtg_mono_game_d.svg);"
+            + " border-style: inset;" + "}");
 
-
-        //layout the game Keys
+        // layout the game Keys
         FormData gameAFormData = new FormData();
-        gameAFormData.bottom=new FormAttachment(100,0);
-        gameAFormData.left=new FormAttachment(0,0);
+        gameAFormData.bottom = new FormAttachment(100, 0);
+        gameAFormData.left = new FormAttachment(0, 0);
         gameA.setLayoutData(gameAFormData);
 
         FormData gameBFormData = new FormData();
-        gameBFormData.bottom=new FormAttachment(100,0);
-        gameBFormData.left=new FormAttachment(gameA,0);
+        gameBFormData.bottom = new FormAttachment(100, 0);
+        gameBFormData.left = new FormAttachment(gameA, 0);
         gameB.setLayoutData(gameBFormData);
 
         FormData gameCFormData = new FormData();
-        gameCFormData.bottom=new FormAttachment(100,0);
-        gameCFormData.left=new FormAttachment(gameB,0);
+        gameCFormData.bottom = new FormAttachment(100, 0);
+        gameCFormData.left = new FormAttachment(gameB, 0);
         gameC.setLayoutData(gameCFormData);
 
         FormData gameDFormData = new FormData();
-        gameDFormData.bottom=new FormAttachment(100,0);
-        gameDFormData.left=new FormAttachment(gameC,0);
+        gameDFormData.bottom = new FormAttachment(100, 0);
+        gameDFormData.left = new FormAttachment(gameC, 0);
         gameD.setLayoutData(gameDFormData);
 
         gameKeysComposite.layout();
     }
 
-
     /**
-             * Handles orientation changes.
-             */
+     * Handles orientation changes.
+     */
     void handleOrientationChange(int mode)
     {
-        //change the layout as per orientation mode
+        // change the layout as per orientation mode
     }
 
-
     /**
-             * Sets the currect Canvas for Key events.
-             * @param canvas - Current Canvas to which the key events needs to be delivered.
-             */
+     * Sets the currect Canvas for Key events.
+     * 
+     * @param canvas
+     *            - Current Canvas to which the key events needs to be
+     *            delivered.
+     */
     void setCurrentCanvas(Canvas canvas)
     {
         this.canvas = canvas;
     }
 
-
     /**
-             * Adds LSk and RSK keys to navigation keypad if the canvas is set to full screen mode.
-             * @param mode- Indicates if the canvas is in fullscreen mode or not. True if fullscreen, False otherwise.
-             */
+     * Adds LSk and RSK keys to navigation keypad if the canvas is set to full
+     * screen mode.
+     * 
+     * @param mode
+     *            - Indicates if the canvas is in fullscreen mode or not. True
+     *            if fullscreen, False otherwise.
+     */
     void setFullScreenMode(boolean mode)
     {
 
-        //add the soft keys if the canvas is set to full screen mode/remove otherwise
-        if(mode == true)
+        // add the soft keys if the canvas is set to full screen mode/remove
+        // otherwise
+        if (mode == true)
         {
 
-            if(keypadComposite != null)
+            if (keypadComposite != null)
             {
 
                 Color black = display.getSystemColor(SWT.COLOR_BLACK);
@@ -480,48 +437,31 @@
                 skleft = new Button(keypadComposite, SWT.PUSH);
                 skleft.addMouseListener(this);
 
-                //Set the style sheet
-                cssEngine.applyCSS(skright,"QPushButton" +
-                                   "{" +
-                                   "background-color:white;" +
-                                   "border-style: outset;" +
-                                   "border-width: 1px; " +
-                                   "border-bottom-left-radius: 22px;"+
-                                   "border-color: black;" +
-                                   "font: bold 14px;" +
-                                   "min-width: 3em;" +
-                                   "min-height: 2em;" +
-                                   "image: url(" + RESOURCE_PATH + "qtg_mono_rsk_horizontal.svg);" +
-                                   "}" +
-                                   "QPushButton:pressed { image: url(" + RESOURCE_PATH + "qtg_mono_rsk_horizontal.svg);" +
-                                   " border-style: inset;" +
-                                   "}");
+                // Set the style sheet
+                cssEngine.applyCSS(skright, "QPushButton" + "{" + "background-color:white;"
+                    + "border-style: outset;" + "border-width: 1px; "
+                    + "border-bottom-left-radius: 22px;" + "border-color: black;"
+                    + "font: bold 14px;" + "min-width: 3em;" + "min-height: 2em;" + "image: url("
+                    + RESOURCE_PATH + "qtg_mono_rsk_horizontal.svg);" + "}"
+                    + "QPushButton:pressed { image: url(" + RESOURCE_PATH
+                    + "qtg_mono_rsk_horizontal.svg);" + " border-style: inset;" + "}");
 
-                cssEngine.applyCSS(skleft,"QPushButton" +
-                                   "{" +
-                                   "background-color:white;" +
-                                   "border-style: outset;" +
-                                   "border-width: 1px; " +
-                                   "border-bottom-right-radius: 22px;"+
-                                   "border-color: black;" +
-                                   "font: bold 14px;" +
-                                   "min-width: 3em;" +
-                                   "min-height: 2em;" +
-                                   "image: url(" + RESOURCE_PATH + "qtg_mono_lsk_horizontal.svg);" +
-                                   "}" +
-                                   "QPushButton:pressed { image: url(" + RESOURCE_PATH + "qtg_mono_lsk_horizontal.svg);" +
-                                   " border-style: inset;" +
-                                   "}");
-
+                cssEngine.applyCSS(skleft, "QPushButton" + "{" + "background-color:white;"
+                    + "border-style: outset;" + "border-width: 1px; "
+                    + "border-bottom-right-radius: 22px;" + "border-color: black;"
+                    + "font: bold 14px;" + "min-width: 3em;" + "min-height: 2em;" + "image: url("
+                    + RESOURCE_PATH + "qtg_mono_lsk_horizontal.svg);" + "}"
+                    + "QPushButton:pressed { image: url(" + RESOURCE_PATH
+                    + "qtg_mono_lsk_horizontal.svg);" + " border-style: inset;" + "}");
 
                 FormData sklFormData = new FormData();
-                sklFormData.top=new FormAttachment(0, 0);
-                sklFormData.left=new FormAttachment(0, 0);
+                sklFormData.top = new FormAttachment(0, 0);
+                sklFormData.left = new FormAttachment(0, 0);
                 skleft.setLayoutData(sklFormData);
 
                 FormData skrFormData = new FormData();
-                skrFormData.top=new FormAttachment(0, 0);
-                skrFormData.right=new FormAttachment(100, 0);
+                skrFormData.top = new FormAttachment(0, 0);
+                skrFormData.right = new FormAttachment(100, 0);
                 skright.setLayoutData(skrFormData);
 
                 keypadComposite.layout();
@@ -529,10 +469,11 @@
         }
         else
         {
-            //LSK and RSK buttons are not needed, remove the buttons from navigation keypad
-            if(skright != null)
+            // LSK and RSK buttons are not needed, remove the buttons from
+            // navigation keypad
+            if (skright != null)
                 skright.dispose();
-            if(skleft != null)
+            if (skleft != null)
                 skleft.dispose();
 
             keypadComposite.setBackground(null);
@@ -541,384 +482,332 @@
     }
 
     /**
-             * returns the height of the canvas keypad in pixels.
-             * @return Height of the canvas keypad in pixels.
-             */
+     * returns the height of the canvas keypad in pixels.
+     * 
+     * @return Height of the canvas keypad in pixels.
+     */
     int getHeight()
     {
 
         int navKeyPadHeight = 0;
         int gameKeyPadHeight = 0;
 
-        if(keypadComposite != null)
+        if (keypadComposite != null)
         {
-            //calculate the navigation keypad height
+            // calculate the navigation keypad height
             navKeyPadHeight = keypadComposite.computeSize(SWT.DEFAULT, SWT.DEFAULT).y;
         }
 
-        if(gameKeysComposite != null)
+        if (gameKeysComposite != null)
         {
-            //calculate the game keypad height
+            // calculate the game keypad height
             gameKeyPadHeight = gameKeysComposite.computeSize(SWT.DEFAULT, SWT.DEFAULT).y;
         }
 
-        //return the total height
+        // return the total height
         return (navKeyPadHeight + gameKeyPadHeight);
     }
 
     /**
-             * returns the keycode corresponding to the canvas keypad button.
-             * @return keycode.
-             */
+     * returns the keycode corresponding to the canvas keypad button.
+     * 
+     * @return keycode.
+     */
     private int getKeyCode(Widget w)
     {
-
         int keyCode = INVALID_CODE;
 
         // Find out which osk button was pressed
-        if(w == up)
+        if (w == up)
         {
             keyCode = UP;
         }
-        else if(w == down)
+        else if (w == down)
         {
             keyCode = DOWN;
         }
-        else if(w == left)
+        else if (w == left)
         {
             keyCode = LEFT;
         }
-        else if(w == right)
+        else if (w == right)
         {
             keyCode = RIGHT;
         }
-        else if(w == center)
+        else if (w == center)
         {
             keyCode = FIRE;
         }
-        else if(w == skleft)
+        else if (w == skleft)
         {
             keyCode = SLK;
         }
-        else if(w == skright)
+        else if (w == skright)
         {
             keyCode = SRK;
         }
-        else if(w == gameA)
+        else if (w == gameA)
         {
             keyCode = GAME_A;
         }
-        else if(w == gameB)
+        else if (w == gameB)
         {
             keyCode = GAME_B;
         }
-        else if(w == gameC)
+        else if (w == gameC)
         {
             keyCode = GAME_C;
         }
-        else if(w == gameD)
+        else if (w == gameD)
         {
             keyCode = GAME_D;
         }
         else
         {
-            keyCode = INVALID_CODE;;
+            keyCode = INVALID_CODE;
         }
 
         return keyCode;
     }
 
-
     /**
-             * Mouse listeners.
-             */
-
+     * Mouse listeners.
+     */
     public void mouseDown(MouseEvent e)
     {
-
-        //handle the mouse down event
         handleMouseDown(e);
-
     }
 
     public void mouseUp(MouseEvent e)
     {
-
-        //handle the mouse up event
         handleMouseUp(e);
-
     }
 
     public void mouseMove(MouseEvent e)
     {
-
-        //handle the mouse move event
         handleMouseMove(e);
-
     }
 
     public void mouseDoubleClick(MouseEvent event)
     {
-        //do nothing
+        // Do nothing
     }
 
-
-
-
-
     /**
-             * Handles the mouse down event
-             *
-             */
+     * Handles the mouse down event
+     * Note that e.x and e.y are relative to the widget that was pressed.
+     */
     private void handleMouseDown(MouseEvent e)
     {
-
-        if(e.widget == keypadComposite)
+        if (e.widget == down) // highest in the z-order
         {
-            //the mouse down was grabbed by the keypad composite, map the key code based on the on rocker images.
             keyPressed = handleRockerPressed(e);
-
         }
         else
         {
-            //get the keycode of the game or soft keys based on the button that was clicked
             keyPressed = getKeyCode(e.widget);
         }
 
-        if(keyPressed != INVALID_CODE)
+        if (keyPressed != INVALID_CODE)
         {
-
-            //notify the canvas
             canvas.doKeyPressed(keyPressed);
 
-            // Create and Schedule the long keypress timer
             timerTask = new CanvasKeypadTimerTask();
             timer.schedule(timerTask, KEYREPEAT_INTERVAL);
         }
     }
 
     /**
-             * Handles the mouse up event
-             *
-             */
+     * Handles the mouse up event
+     * Note that e.x and e.y are relative to the widget that was pressed.
+     */
     private void handleMouseUp(MouseEvent e)
     {
         int keyReleased;
 
-        if(timerTask != null)
-        {
-            //cancel the long keypress timer if it is running
-            timerTask.cancel();
-            timerTask = null;
-        }
-
-        if(e.widget == keypadComposite)
-        {
-            //the mouse up was grabbed by the keypad composite, map the key code based on the on rocker images.
-            keyReleased = handleRockerReleased(e);
-
-        }
-        else
+        if (timerTask != null)
         {
-            //get the keycode of the game or soft keys based on the button that was clicked
-            keyReleased = getKeyCode(e.widget);
-        }
-
-        if(keyReleased != INVALID_CODE)
-        {
-
-            //notify the canvas
-            canvas.doKeyReleased(keyReleased);
-        }
-    }
-
-
-    /**
-             * Handles the mouse move event
-             *
-             */
-    private void handleMouseMove(MouseEvent e)
-    {
-
-        if(timerTask != null)
-        {
-            //cancel the long keypress timer if it is running
             timerTask.cancel();
             timerTask = null;
         }
 
-        if(e.widget == keypadComposite)
+        if (e.widget == down || e.widget == keypadComposite)
         {
-            //the mouse move was grabbed by the keypad composite, handle the rocker key swipe
-            handleRockerMoved(e);
-
+            keyReleased = handleRockerReleased(e);
         }
         else
         {
-            //get the keycode of the game or soft keys based on the button that was clicked
-            keyPressed = getKeyCode(e.widget);
+            keyReleased = getKeyCode(e.widget);
+        }
+
+        if (keyReleased != INVALID_CODE)
+        {
+            canvas.doKeyReleased(keyReleased);
+        }
+    }
 
-            //notify the canvas
+    /**
+     * Handles the mouse move event
+     * Note that e.x and e.y are relative to the widget that was pressed.
+     */
+    private void handleMouseMove(MouseEvent e)
+    {
+        if (timerTask != null)
+        {
+            timerTask.cancel();
+            timerTask = null;
+        }
+        
+        if (e.widget == down || e.widget == keypadComposite)
+        {
+            handleRockerMoved(e);    
+        }
+        else
+        {
+            keyPressed = getKeyCode(e.widget);
             canvas.doKeyPressed(keyPressed);
-
-            // Create and Schedule Timer
             timerTask = new CanvasKeypadTimerTask();
             timer.schedule(timerTask, KEYREPEAT_INTERVAL);
         }
-
-
     }
 
-
     /**
-             * Handles the rocker key press
-             *
-             */
+     * Handles the rocker key press
+     */
     private int handleRockerPressed(MouseEvent e)
     {
-
         keyPressed = INVALID_CODE;
-
-        Rectangle image_bounds = center.getBounds();
-
-        // Find out which rocker button was pressed
-        if(image_bounds.contains(e.x,e.y) == true)
+        
+        Point rockerSize = center.getSize();
+        if (e.x >= 0 && e.x <= rockerSize.x && e.y >= 0 && e.y <= rockerSize.y)
         {
-            //check each of the button images  to check which osk navkey button was pressed
-            if(center_data.getAlpha(e.x-image_offset,e.y)!=TRANSPARENT)
+            if (center_data.getAlpha(e.x, e.y) != TRANSPARENT)
             {
-                //center button was pressed
                 keyPressed = FIRE;
                 rockerKeyPressed = center;
                 center.setImage(center_pressed);
             }
-            else if(left_data.getAlpha(e.x-image_offset,e.y)!=TRANSPARENT)
+            else if (left_data.getAlpha(e.x, e.y) != TRANSPARENT)
             {
-                //left button was pressed
                 keyPressed = LEFT;
                 rockerKeyPressed = left;
                 left.setImage(left_pressed);
             }
-            else if(right_data.getAlpha(e.x-image_offset,e.y)!=TRANSPARENT)
+            else if (right_data.getAlpha(e.x, e.y) != TRANSPARENT)
             {
-                //right button was pressed
                 keyPressed = RIGHT;
                 rockerKeyPressed = right;
                 right.setImage(right_pressed);
             }
-            else if(up_data.getAlpha(e.x-image_offset,e.y)!=TRANSPARENT)
+            else if (up_data.getAlpha(e.x, e.y) != TRANSPARENT)
             {
-                //up button was pressed
                 keyPressed = UP;
                 rockerKeyPressed = up;
                 up.setImage(up_pressed);
             }
-            else if(down_data.getAlpha(e.x-image_offset,e.y)!=TRANSPARENT)
+            else if (down_data.getAlpha(e.x, e.y) != TRANSPARENT)
             {
-                //down button was pressed
                 keyPressed = DOWN;
                 rockerKeyPressed = down;
                 down.setImage(down_pressed);
             }
             else
             {
-                keyPressed = INVALID_CODE;;
+                keyPressed = INVALID_CODE;
             }
-
         }
 
         return keyPressed;
-
     }
 
-
     /**
-             * Handles the mouse released on the rocker keys
-             *
-             */
+     * Handles the mouse released on the rocker keys
+     */
     private int handleRockerReleased(MouseEvent e)
     {
-
         int keyReleased = INVALID_CODE;
 
-        Rectangle image_bounds = center.getBounds();
-
-        // Find out which rocker button was released
-        if(image_bounds.contains(e.x,e.y) == true)
+        Point rockerSize = center.getSize();
+        Point rockerLoc = center.getLocation();
+        
+        if (e.widget == keypadComposite)
         {
-            //check each of the button images  to check which osk navkey button was released
-            if((rockerKeyPressed == center) &&
-                    (center_data.getAlpha(e.x-image_offset,e.y)!=TRANSPARENT))
+            // Drag started outside rocker
+            e.x -= rockerLoc.x;
+            e.y -= rockerLoc.y;
+        }
+
+        if (e.x >= 0 && e.x <= rockerSize.x && e.y >= 0 && e.y <= rockerSize.y)
+        {
+            if ((rockerKeyPressed == center)
+                && (center_data.getAlpha(e.x, e.y) != TRANSPARENT))
             {
-                //center button was released
                 keyReleased = FIRE;
                 center.setImage(center_normal);
             }
-            else if((rockerKeyPressed == left) &&
-                    (left_data.getAlpha(e.x-image_offset,e.y)!=TRANSPARENT))
+            else if ((rockerKeyPressed == left)
+                && (left_data.getAlpha(e.x, e.y) != TRANSPARENT))
             {
-                //left button was released
                 keyReleased = LEFT;
                 left.setImage(left_normal);
             }
-            else if((rockerKeyPressed == right) &&
-                    (right_data.getAlpha(e.x-image_offset,e.y)!=TRANSPARENT))
+            else if ((rockerKeyPressed == right)
+                && (right_data.getAlpha(e.x, e.y) != TRANSPARENT))
             {
-                //right button was released
                 keyReleased = RIGHT;
                 right.setImage(right_normal);
             }
-            else if((rockerKeyPressed == up) &&
-                    (up_data.getAlpha(e.x-image_offset,e.y)!=TRANSPARENT))
+            else if ((rockerKeyPressed == up)
+                && (up_data.getAlpha(e.x, e.y) != TRANSPARENT))
             {
-                //up button was released
                 keyReleased = UP;
                 up.setImage(up_normal);
             }
-            else if((rockerKeyPressed == down) &&
-                    (down_data.getAlpha(e.x-image_offset,e.y)!=TRANSPARENT))
+            else if ((rockerKeyPressed == down)
+                && (down_data.getAlpha(e.x, e.y) != TRANSPARENT))
             {
-                //down button was released
                 keyReleased = DOWN;
                 down.setImage(down_normal);
             }
             else
             {
-                keyReleased = INVALID_CODE;;
+                keyReleased = INVALID_CODE;
             }
-
         }
 
         return keyReleased;
-
     }
 
-
     /**
-             * Handles the mouse move on the rocker keys
-             *
-             */
+     * Handles the mouse move on the rocker keys
+     */
     private void handleRockerMoved(MouseEvent e)
     {
-
         keyPressed = INVALID_CODE;
-
-        Rectangle image_bounds = center.getBounds();
+        Point size = center.getSize();
+        Point rockerLoc = center.getLocation();
+        
+        if (e.widget == keypadComposite)
+        {
+            // Drag started outside rocker
+            e.x -= rockerLoc.x;
+            e.y -= rockerLoc.y;
+        }
 
-        // Find out which rocker button was traversed to
-        if(image_bounds.contains(e.x,e.y) == true)
+        if (e.x >= 0 && e.x <= size.x && e.y >= 0 && e.y <= size.y)
         {
-            //check each of the button images  to check which osk navkey button was traversed to
-            if((center_data.getAlpha(e.x-image_offset,e.y)!=TRANSPARENT) &&
-                    (rockerKeyPressed != center))
+            if ((center_data.getAlpha(e.x, e.y) != TRANSPARENT)
+                && (rockerKeyPressed != center))
             {
-                //Mouse moved to center rocker key from another rocker key, release the other(source) rocker key
+                // Mouse moved to center rocker key from another rocker key,
+                // release the other(source) rocker key
                 releaseRockerKey(rockerKeyPressed);
             }
-            else if((left_data.getAlpha(e.x-image_offset,e.y)!=TRANSPARENT) &&
-                    (rockerKeyPressed != left))
+            else if ((left_data.getAlpha(e.x, e.y) != TRANSPARENT)
+                && (rockerKeyPressed != left))
             {
-                //Mouse moved to left rocker key from another rocker key, release the other(source) rocker key
+                // Mouse moved to left rocker key from another rocker key,
+                // release the other(source) rocker key
                 // and press the left key
                 releaseRockerKey(rockerKeyPressed);
                 keyPressed = LEFT;
@@ -927,10 +816,11 @@
                 canvas.doKeyPressed(keyPressed);
                 pressedKeyData = left_data;
             }
-            else if((right_data.getAlpha(e.x-image_offset,e.y)!=TRANSPARENT) &&
-                    (rockerKeyPressed != right))
+            else if ((right_data.getAlpha(e.x, e.y) != TRANSPARENT)
+                && (rockerKeyPressed != right))
             {
-                //Mouse moved to right rocker key from another rocker key, release the other(source) rocker key
+                // Mouse moved to right rocker key from another rocker key,
+                // release the other(source) rocker key
                 // and press the right key
                 releaseRockerKey(rockerKeyPressed);
                 keyPressed = RIGHT;
@@ -939,10 +829,11 @@
                 canvas.doKeyPressed(keyPressed);
                 pressedKeyData = right_data;
             }
-            else if((up_data.getAlpha(e.x-image_offset,e.y)!=TRANSPARENT) &&
-                    (rockerKeyPressed != up))
+            else if ((up_data.getAlpha(e.x, e.y) != TRANSPARENT)
+                && (rockerKeyPressed != up))
             {
-                //Mouse moved to up rocker key from another rocker key, release the other(source) rocker key
+                // Mouse moved to up rocker key from another rocker key, release
+                // the other(source) rocker key
                 // and press the up key
                 releaseRockerKey(rockerKeyPressed);
                 keyPressed = UP;
@@ -951,10 +842,11 @@
                 rockerKeyPressed = up;
                 pressedKeyData = up_data;
             }
-            else if((down_data.getAlpha(e.x-image_offset,e.y)!=TRANSPARENT) &&
-                    (rockerKeyPressed != down))
+            else if ((down_data.getAlpha(e.x, e.y) != TRANSPARENT)
+                && (rockerKeyPressed != down))
             {
-                //Mouse moved to down rocker key from another rocker key, release the other(source) rocker key
+                // Mouse moved to down rocker key from another rocker key,
+                // release the other(source) rocker key
                 // and press the down key
                 releaseRockerKey(rockerKeyPressed);
                 keyPressed = DOWN;
@@ -965,76 +857,65 @@
             }
             else
             {
-                if((pressedKeyData != null) &&
-                        (pressedKeyData.getAlpha(e.x-image_offset,e.y) == TRANSPARENT))
+                if ((pressedKeyData != null)
+                    && (pressedKeyData.getAlpha(e.x, e.y) == TRANSPARENT))
                 {
-                    //Mouse moved to out of all rocker keys from another rocker key, release the other(source) rocker key
+                    // Mouse moved to out of all rocker keys from another rocker
+                    // key, release the other(source) rocker key
                     releaseRockerKey(rockerKeyPressed);
                     pressedKeyData = null;
                     rockerKeyPressed = null;
 
                 }
             }
-
         }
         else
         {
-            //Mouse moved to out of all rocker keys, release the other(source) rocker key
+            // Mouse moved to out of all rocker keys, release the other(source)
+            // rocker key
             releaseRockerKey(rockerKeyPressed);
         }
-
-
     }
 
-
-
     /**
-             * Releases a rocker key
-             *
-             */
+     * Releases a rocker key
+     */
     private void releaseRockerKey(Label rockerKeyPressed)
     {
-
-        if(rockerKeyPressed == center)
+        if (rockerKeyPressed == center)
         {
             center.setImage(center_normal);
             canvas.doKeyReleased(FIRE);
         }
-        else if(rockerKeyPressed == left)
+        else if (rockerKeyPressed == left)
         {
             left.setImage(left_normal);
             canvas.doKeyReleased(LEFT);
         }
-        else if(rockerKeyPressed == right)
+        else if (rockerKeyPressed == right)
         {
             right.setImage(right_normal);
             canvas.doKeyReleased(RIGHT);
         }
-        else if(rockerKeyPressed == up)
+        else if (rockerKeyPressed == up)
         {
             up.setImage(up_normal);
             canvas.doKeyReleased(UP);
         }
-        else if(rockerKeyPressed == down)
+        else if (rockerKeyPressed == down)
         {
             down.setImage(down_normal);
             canvas.doKeyReleased(DOWN);
         }
-
     }
 
-
-
     /**
-             * Canvas Keypad timer task
-             *
-             */
+     * Canvas Keypad timer task
+     */
     class CanvasKeypadTimerTask extends TimerTask
     {
-
         public void run()
         {
-
             ESWTUIThreadRunner.syncExec(new Runnable()
             {
                 public void run()
@@ -1042,11 +923,6 @@
                     canvas.doKeyPressed(keyPressed);
                 }
             });
-
-
         }
     }
-
-
-
 }
--- a/javauis/lcdui_qt/src/javax/microedition/lcdui/ChoiceGroup.java	Tue Jul 06 14:10:26 2010 +0300
+++ b/javauis/lcdui_qt/src/javax/microedition/lcdui/ChoiceGroup.java	Wed Aug 18 09:43:15 2010 +0300
@@ -23,6 +23,18 @@
  */
 public class ChoiceGroup extends Item implements Choice
 {
+    /**
+     * If ChoiceGroup is changed, reasons for Re-layouting.
+     */
+	static final int UPDATE_REASON_APPEND = UPDATE_ITEM_MAX << 1;
+	static final int UPDATE_REASON_DELETE = UPDATE_ITEM_MAX << 2;
+	static final int UPDATE_REASON_DELETEALL = UPDATE_ITEM_MAX << 3;
+	static final int UPDATE_REASON_INSERT = UPDATE_ITEM_MAX << 4;
+	static final int UPDATE_REASON_SET = UPDATE_ITEM_MAX << 5;
+	static final int UPDATE_FITPOLICY = UPDATE_ITEM_MAX << 6;
+	static final int UPDATE_FONT = UPDATE_ITEM_MAX << 7;
+	static final int UPDATE_SELECTEDFLAGS = UPDATE_ITEM_MAX << 8;
+	static final int UPDATE_SELECTEDINDEX = UPDATE_ITEM_MAX << 9;
 
     private ChoiceImpl choiceImpl;
     private int type;
@@ -90,7 +102,7 @@
     public int append(String text, Image img)
     {
         int ret = choiceImpl.append(text, img);
-        updateParent(UPDATE_SIZE_CHANGED);
+        updateParent(UPDATE_REASON_APPEND);
         return ret;
     }
 
@@ -104,7 +116,7 @@
     public void insert(int position, String text, Image img)
     {
         choiceImpl.insert(position, text, img);
-        updateParent(UPDATE_SIZE_CHANGED);
+        updateParent(UPDATE_REASON_INSERT);
     }
 
     /**
@@ -117,7 +129,7 @@
     public void set(int position, String text, Image img)
     {
         choiceImpl.set(position, text, img);
-        updateParent(UPDATE_CONTENT);
+        updateParent(UPDATE_REASON_SET);
     }
 
     /**
@@ -128,7 +140,7 @@
     public void delete(int position)
     {
         choiceImpl.delete(position);
-        updateParent(UPDATE_SIZE_CHANGED);
+        updateParent(UPDATE_REASON_DELETE);
     }
 
     /**
@@ -137,7 +149,7 @@
     public void deleteAll()
     {
         choiceImpl.deleteAll();
-        updateParent(UPDATE_SIZE_CHANGED);
+        updateParent(UPDATE_REASON_DELETEALL);
     }
 
     /**
@@ -223,7 +235,7 @@
     public void setFitPolicy(int newFitPolicy)
     {
         choiceImpl.setFitPolicy(newFitPolicy);
-        updateParent(UPDATE_SIZE_CHANGED);
+        updateParent(UPDATE_FITPOLICY);
     }
 
     /**
@@ -235,7 +247,7 @@
     public void setFont(int position, Font font)
     {
         choiceImpl.setFont(position, font);
-        updateParent(UPDATE_SIZE_CHANGED);
+        updateParent(UPDATE_FONT);
     }
 
     /**
@@ -246,7 +258,7 @@
     public void setSelectedFlags(boolean[] selectedArray)
     {
         choiceImpl.setSelectedFlags(selectedArray);
-        updateParent(UPDATE_CONTENT);
+        updateParent(UPDATE_SELECTEDFLAGS);
     }
 
     /**
@@ -258,7 +270,7 @@
     public void setSelectedIndex(int position, boolean select)
     {
         choiceImpl.setSelected(position, select);
-        updateParent(UPDATE_CONTENT);
+        updateParent(UPDATE_SELECTEDINDEX);
     }
 
     /**
--- a/javauis/lcdui_qt/src/javax/microedition/lcdui/ChoiceGroupLayouter.java	Tue Jul 06 14:10:26 2010 +0300
+++ b/javauis/lcdui_qt/src/javax/microedition/lcdui/ChoiceGroupLayouter.java	Wed Aug 18 09:43:15 2010 +0300
@@ -45,9 +45,9 @@
     /**
      * Constructor.
      */
-    ChoiceGroupLayouter(DefaultFormLayoutPolicy dflp)
+    ChoiceGroupLayouter(FormLayouter aFormLayouter)
     {
-        super(dflp);
+        super(aFormLayouter);
     }
 
     /**
@@ -259,7 +259,7 @@
      */
     boolean eswtOfferKeyPressed(Item item, int key)
     {
-        LayoutObject lo = dfi.getFirstLayoutObjectOfItem(item);
+        LayoutObject lo = formLayouter.getFirstLayoutObjectOfItem(item);
         TableExtension tempExt;
         ChoiceGroup chgr = (ChoiceGroup) item;
         tempExt = (TableExtension) eswtFindSpecificControl(item,
@@ -478,7 +478,7 @@
 
         private void update(SelectionEvent se)
         {
-            //int vPosition = dfi.vPosition;
+            //int vPosition = formLayouter.vPosition;
             int index = ((Table) se.widget).indexOf((TableItem) se.item);
             choiceGroup.internalSetSelectedIndex(index,
                                                  !choiceGroup.isSelected(index));
@@ -546,20 +546,20 @@
             int topOfTable = table.getLocation().y;
             if(choicegroup.hasLabel())
             {
-                LayoutObject lo = dfi.getFirstLayoutObjectOfItem(choicegroup);
+                LayoutObject lo = formLayouter.getFirstLayoutObjectOfItem(choicegroup);
                 topOfTable += lo.getY();
             }
             int topYOfSelectedItem = topOfTable + (focusedIndex * itemHeight);
             if(te.keyCode == SWT.ARROW_DOWN)
             {
                 topYOfSelectedItem += itemHeight;
-                dfi.eswtScrollIfNeeded(topYOfSelectedItem,
+                formLayouter.eswtScrollIfNeeded(topYOfSelectedItem,
                                        topYOfSelectedItem + itemHeight);
             }
             else if(te.keyCode == SWT.ARROW_UP)
             {
                 topYOfSelectedItem -= itemHeight;
-                dfi.eswtScrollIfNeeded(topYOfSelectedItem,
+                formLayouter.eswtScrollIfNeeded(topYOfSelectedItem,
                                        topYOfSelectedItem + itemHeight);
             }
         }
@@ -582,7 +582,7 @@
         public void focusGained(FocusEvent focusEvent)
         {
             TableExtension te = (TableExtension) focusEvent.widget;
-            int direction = dfi.getDirection();
+            int direction = formLayouter.getDirection();
             if(choicegroup.getType() != ChoiceGroup.POPUP)
             {
                 if(direction == -1)
@@ -608,7 +608,7 @@
             int topOfTable = te.getLocation().y;
             if(choicegroup.hasLabel())
             {
-                LayoutObject lo = dfi.getFirstLayoutObjectOfItem(choicegroup);
+                LayoutObject lo = formLayouter.getFirstLayoutObjectOfItem(choicegroup);
                 topOfTable += lo.getY();
             }
 
@@ -616,13 +616,13 @@
             if(direction == SWT.ARROW_DOWN || direction == SWT.ARROW_RIGHT)
             {
                 topYOfSelectedItem += itemHeight;
-                dfi.eswtScrollIfNeeded(topYOfSelectedItem,
+                formLayouter.eswtScrollIfNeeded(topYOfSelectedItem,
                                        topYOfSelectedItem + itemHeight);
             }
             else if(direction == SWT.ARROW_UP || direction == SWT.ARROW_LEFT)
             {
                 topYOfSelectedItem -= itemHeight;
-                dfi.eswtScrollIfNeeded(topYOfSelectedItem,
+                formLayouter.eswtScrollIfNeeded(topYOfSelectedItem,
                                        topYOfSelectedItem + itemHeight);
             }
         }
--- a/javauis/lcdui_qt/src/javax/microedition/lcdui/ChoiceImpl.java	Tue Jul 06 14:10:26 2010 +0300
+++ b/javauis/lcdui_qt/src/javax/microedition/lcdui/ChoiceImpl.java	Wed Aug 18 09:43:15 2010 +0300
@@ -295,9 +295,9 @@
         validateSelectedArray(selectedArray);
         final int size = size();
         int numSelected = 0;
-        for(int i = 0; i < size; i++)
+        for(int i = 0; i < selectedArray.length; i++)
         {
-            if(((ChoiceData) items.elementAt(i)).sel)
+            if( (i < size) && (((ChoiceData) items.elementAt(i)).sel))
             {
                 selectedArray[i] = true;
                 numSelected++;
@@ -306,7 +306,8 @@
             {
                 selectedArray[i] = false;
             }
-        }
+        }      
+
         return numSelected;
     }
 
--- a/javauis/lcdui_qt/src/javax/microedition/lcdui/Command.java	Tue Jul 06 14:10:26 2010 +0300
+++ b/javauis/lcdui_qt/src/javax/microedition/lcdui/Command.java	Wed Aug 18 09:43:15 2010 +0300
@@ -132,11 +132,7 @@
         this.shortLabel = shortLabel;
         this.longLabel = longLabel;
         this.priority = priority;
-
-        if(EMPTY_STRING.equals(this.shortLabel))
-        {
-            this.shortLabel = getDefaultLabel(this.type);
-        }
+        
     }
 
     /**
--- a/javauis/lcdui_qt/src/javax/microedition/lcdui/CustomItem.java	Tue Jul 06 14:10:26 2010 +0300
+++ b/javauis/lcdui_qt/src/javax/microedition/lcdui/CustomItem.java	Wed Aug 18 09:43:15 2010 +0300
@@ -20,16 +20,13 @@
 
 import org.eclipse.swt.graphics.Point;
 import org.eclipse.swt.graphics.Rectangle;
-import org.eclipse.swt.internal.extension.CanvasExtension;
 import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Scrollable;
 
 /**
  * Implementation of LCDUI abstract <code>CustomItem</code> class.
  */
 public abstract class CustomItem extends Item
 {
-
     protected static final int NONE = 0;
     protected static final int TRAVERSE_HORIZONTAL = 1;
     protected static final int TRAVERSE_VERTICAL = 2;
@@ -43,9 +40,10 @@
     protected static final int POINTER_DRAG = 0x80;
 
     /**
-     * Constant used by layouter to repaint CustomItem's rectangle section.
+     * If CustomItem is changed, reasons for Re-layouting.
      */
-    static final int UPDATE_REPAINT_RECT = 4;
+	static final int UPDATE_REASON_REPAINT = UPDATE_ITEM_MAX << 1;
+
 
     private boolean cleanupNeeded;
     private int contentWidth;
@@ -154,7 +152,7 @@
     {
         Rectangle rect = new Rectangle(aX, aY, aWidth, aHeight);
         // From here it goes to updateItem()
-        updateParent(UPDATE_REPAINT_RECT, rect);
+        updateParent(UPDATE_REASON_REPAINT, rect);
     }
 
     /**
@@ -308,7 +306,7 @@
                 contentHeight = newHeight;
             }
             EventDispatcher eventDispatcher = EventDispatcher.instance();
-            LCDUIEvent event = eventDispatcher.newEvent(LCDUIEvent.CUSTOMITEM_SIZECHANGED, layouter.dfi.getForm());
+            LCDUIEvent event = eventDispatcher.newEvent(LCDUIEvent.CUSTOMITEM_SIZECHANGED, layouter.formLayouter.getForm());
             event.item = this;
             eventDispatcher.postEvent(event);
             synchronized(cleanupLock)
@@ -356,7 +354,7 @@
         else
         {
             // Item was added to a Form
-            layouter = ((CustomItemLayouter)((Form)parent).getLayoutPolicy().getLayouter(this));
+            layouter = ((CustomItemLayouter)((Form)parent).getFormLayouter().getItemLayouter(this));
         }
     }
 
@@ -432,7 +430,7 @@
                 {
                     EventDispatcher eventDispatcher = EventDispatcher.instance();
                     LCDUIEvent event = eventDispatcher.newEvent(
-                                           LCDUIEvent.CUSTOMITEM_PAINT_MIDLET_REQUEST, layouter.dfi.getForm());
+                                           LCDUIEvent.CUSTOMITEM_PAINT_MIDLET_REQUEST, layouter.formLayouter.getForm());
                     event.widget = control;
                     event.item = this;
                     eventDispatcher.postEvent(event);
--- a/javauis/lcdui_qt/src/javax/microedition/lcdui/CustomItemBufferLinux.java	Tue Jul 06 14:10:26 2010 +0300
+++ b/javauis/lcdui_qt/src/javax/microedition/lcdui/CustomItemBufferLinux.java	Wed Aug 18 09:43:15 2010 +0300
@@ -43,7 +43,7 @@
     protected void init() 
     {
     	super.init();
-    	surface = Internal_PackageSupport.getWindowsurface(host.layouter.dfi.getForm().getContentComp().getShell());
+    	surface = Internal_PackageSupport.getWindowsurface(host.layouter.formLayouter.getForm().getContentComp().getShell());
     }
     
     void bindToHost(GraphicsContext gc) {
--- a/javauis/lcdui_qt/src/javax/microedition/lcdui/CustomItemBufferSymbian.java	Tue Jul 06 14:10:26 2010 +0300
+++ b/javauis/lcdui_qt/src/javax/microedition/lcdui/CustomItemBufferSymbian.java	Wed Aug 18 09:43:15 2010 +0300
@@ -39,7 +39,7 @@
     protected void init() 
     {
     	super.init();
-    	surface = Internal_PackageSupport.getWindowsurface(host.layouter.dfi.getForm().getContentComp().getShell());
+    	surface = Internal_PackageSupport.getWindowsurface(host.layouter.formLayouter.getForm().getContentComp().getShell());
     }
     
     int getHostType()
--- a/javauis/lcdui_qt/src/javax/microedition/lcdui/CustomItemLayouter.java	Tue Jul 06 14:10:26 2010 +0300
+++ b/javauis/lcdui_qt/src/javax/microedition/lcdui/CustomItemLayouter.java	Wed Aug 18 09:43:15 2010 +0300
@@ -64,11 +64,11 @@
     /**
      * Constructor.
      *
-     * @param dflp DefaultFormLayoutPolicy used for layouting.
+     * @param aFormLayouter FormLayouter used for layouting.
      */
-    public CustomItemLayouter(DefaultFormLayoutPolicy dflp)
+    public CustomItemLayouter(FormLayouter aFormLayouter)
     {
-        super(dflp);
+        super(aFormLayouter);
 
         noBackground = JadAttributeUtil.isValue(JadAttributeUtil.ATTRIB_NOKIA_UI_ENHANCEMENT,
                                                 JadAttributeUtil.VALUE_CANVAS_HAS_BACKGROUND);
@@ -205,7 +205,7 @@
      */
     void eswtUpdateItem(Item item, Control control, int reason, Object param)
     {
-        if(reason == CustomItem.UPDATE_REPAINT_RECT)
+        if(reason == CustomItem.UPDATE_REASON_REPAINT)
         {
             Rectangle rect = (Rectangle) param;
             ((CustomItem)item).updateItem(rect, control);
@@ -267,7 +267,7 @@
         if(!((selectionKeyCompatibility == true) && (key == -5)))
         {
             EventDispatcher eventDispatcher = EventDispatcher.instance();
-            LCDUIEvent e = eventDispatcher.newEvent(LCDUIEvent.CUSTOMITEM_KEYPRESSED, dfi.getForm());
+            LCDUIEvent e = eventDispatcher.newEvent(LCDUIEvent.CUSTOMITEM_KEYPRESSED, formLayouter.getForm());
             e.item = customItem;
             e.keyCode = key;
             eventDispatcher.postEvent(e);
@@ -282,13 +282,13 @@
             int[] visRect = getVisRect(ctrl);
             // Offer event for inner traversal
             consumed = customItem.traverse(direction,
-                                           dfi.getFormWidth(), dfi.getFormHeight(), visRect);
+                                           formLayouter.getFormWidth(), formLayouter.getFormHeight(), visRect);
             if(consumed)
             {
                 // if inner focus is on - scroll to inner focus
                 Point loc = new Point(0, 0);
-                dfi.getControlPositionOnComposite(ctrl, loc);
-                dfi.eswtScrolltoRegion(loc.y + visRect[1],
+                formLayouter.getControlPositionOnComposite(ctrl, loc);
+                formLayouter.eswtScrolltoRegion(loc.y + visRect[1],
                                        loc.y + visRect[1] + visRect[3], key);
             }
             control.redraw();
@@ -306,7 +306,7 @@
         if(!((selectionKeyCompatibility == true) && (key == -5)))
         {
             EventDispatcher eventDispatcher = EventDispatcher.instance();
-            LCDUIEvent e = eventDispatcher.newEvent(LCDUIEvent.CUSTOMITEM_KEYRELEASED, dfi.getForm());
+            LCDUIEvent e = eventDispatcher.newEvent(LCDUIEvent.CUSTOMITEM_KEYRELEASED, formLayouter.getForm());
             e.item = customItem;
             e.keyCode = key;
             eventDispatcher.postEvent(e);
@@ -332,12 +332,12 @@
             Control ctrl = eswtFindSpecificControl(item, control);
             int[] visRect = getVisRect(ctrl);
             if(customItem.traverse(getCanvasDirection(swtDir),
-                                   dfi.getFormWidth(), dfi.getFormHeight(), visRect))
+                                   formLayouter.getFormWidth(), formLayouter.getFormHeight(), visRect))
             {
                 // if inner focus is on - scroll to inner focus
                 Point loc = new Point(0, 0);
-                dfi.getControlPositionOnComposite(ctrl, loc);
-                dfi.eswtScrolltoRegion(loc.y + visRect[1],
+                formLayouter.getControlPositionOnComposite(ctrl, loc);
+                formLayouter.eswtScrolltoRegion(loc.y + visRect[1],
                                        loc.y + visRect[1] + visRect[3], swtDir);
             }
             control.redraw();
@@ -360,7 +360,7 @@
     void eswtHandleShow(Item item)
     {
         EventDispatcher eventDispatcher = EventDispatcher.instance();
-        LCDUIEvent event = eventDispatcher.newEvent(LCDUIEvent.CUSTOMITEM_SHOWNOTIFY, dfi.getForm());
+        LCDUIEvent event = eventDispatcher.newEvent(LCDUIEvent.CUSTOMITEM_SHOWNOTIFY, formLayouter.getForm());
         event.item = item;
         eventDispatcher.postEvent(event);
         CustomItem customItem = (CustomItem) item;
@@ -373,7 +373,7 @@
     void eswtHandleHide(Item item)
     {
         EventDispatcher eventDispatcher = EventDispatcher.instance();
-        LCDUIEvent event = eventDispatcher.newEvent(LCDUIEvent.CUSTOMITEM_HIDENOTIFY, dfi.getForm());
+        LCDUIEvent event = eventDispatcher.newEvent(LCDUIEvent.CUSTOMITEM_HIDENOTIFY, formLayouter.getForm());
         event.item = item;
         eventDispatcher.postEvent(event);
     }
@@ -445,7 +445,7 @@
                 // the paint callback has been executed.
                 EventDispatcher eventDispatcher = EventDispatcher.instance();
                 LCDUIEvent event = eventDispatcher.newEvent(
-                                       LCDUIEvent.CUSTOMITEM_PAINT_NATIVE_REQUEST, dfi.getForm());
+                                       LCDUIEvent.CUSTOMITEM_PAINT_NATIVE_REQUEST, formLayouter.getForm());
                 event.x = pe.x;
                 event.y = pe.y;
                 event.width = pe.width;
@@ -473,7 +473,7 @@
         public void mouseDown(MouseEvent event)
         {
             EventDispatcher eventDispatcher = EventDispatcher.instance();
-            LCDUIEvent e = eventDispatcher.newEvent(LCDUIEvent.CUSTOMITEM_POINTERPRESSED, dfi.getForm());
+            LCDUIEvent e = eventDispatcher.newEvent(LCDUIEvent.CUSTOMITEM_POINTERPRESSED, formLayouter.getForm());
             e.item = customItem;
             e.x = event.x;
             e.y = event.y;
@@ -513,7 +513,7 @@
                 }
             }
             EventDispatcher eventDispatcher = EventDispatcher.instance();
-            LCDUIEvent e = eventDispatcher.newEvent(LCDUIEvent.CUSTOMITEM_POINTERRELEASED, dfi.getForm());
+            LCDUIEvent e = eventDispatcher.newEvent(LCDUIEvent.CUSTOMITEM_POINTERRELEASED, formLayouter.getForm());
             e.item = customItem;
             e.x = pointerUpX;
             e.y = pointerUpY;
@@ -526,7 +526,7 @@
             if(disableTapDetection || (!suppressDragEvent) || !checkWithinRect(event.x, event.y))
             {
                 EventDispatcher eventDispatcher = EventDispatcher.instance();
-                LCDUIEvent e = eventDispatcher.newEvent(LCDUIEvent.CUSTOMITEM_POINTERDRAGGED, dfi.getForm());
+                LCDUIEvent e = eventDispatcher.newEvent(LCDUIEvent.CUSTOMITEM_POINTERDRAGGED, formLayouter.getForm());
                 e.item = customItem;
                 e.x = event.x;
                 e.y = event.y;
--- a/javauis/lcdui_qt/src/javax/microedition/lcdui/DateField.java	Tue Jul 06 14:10:26 2010 +0300
+++ b/javauis/lcdui_qt/src/javax/microedition/lcdui/DateField.java	Wed Aug 18 09:43:15 2010 +0300
@@ -25,7 +25,6 @@
  */
 public class DateField extends Item
 {
-
     /**
      * Input mode that displays only date.
      */
@@ -41,6 +40,13 @@
      */
     public static final int DATE_TIME = 3;
 
+    /**
+     * If DateField is changed, reasons for Re-layouting.
+     */
+	static final int UPDATE_DATE = UPDATE_ITEM_MAX << 1;
+	static final int UPDATE_INPUTMODE = UPDATE_ITEM_MAX << 2;
+
+
     private Date date;
 
     private int mode;
@@ -100,8 +106,9 @@
             calendar.set(Calendar.HOUR_OF_DAY,0);
             calendar.set(Calendar.MINUTE,0);
             calendar.set(Calendar.SECOND,0);
+            calendar.set(Calendar.MILLISECOND,0);
         }
-        return calendar.getTime();//date;
+        return calendar.getTime();
     }
 
     /**
@@ -112,7 +119,7 @@
     public void setDate(Date newDate)
     {
         internalSetDate(newDate);
-        updateParent(UPDATE_CONTENT);
+        updateParent((newDate == null ? UPDATE_DATE | UPDATE_SIZE_CHANGED : UPDATE_DATE)); 
     }
 
     /**
@@ -142,8 +149,12 @@
             throw new IllegalArgumentException(
                 MsgRepository.DATEFIELD_EXCEPTION_INVALID_MODE);
         }
-        mode = inputMode;
-        updateParent(UPDATE_SIZE_CHANGED);
+
+		if(getInputMode() != inputMode)
+		{
+	        mode = inputMode;
+	        updateParent(UPDATE_INPUTMODE | UPDATE_SIZE_CHANGED);
+		}
     }
 
     /**
@@ -207,15 +218,21 @@
                 }
                 else
                 {
+                    calendar.set(Calendar.SECOND,0);
+	                calendar.set(Calendar.MILLISECOND,0);
                     date = calendar.getTime();
                 }
                 break;
             case DATE:
                 calendar.set(Calendar.HOUR_OF_DAY, 0);
                 calendar.set(Calendar.MINUTE, 0);
+                calendar.set(Calendar.SECOND,0);
+                calendar.set(Calendar.MILLISECOND,0);
                 date = calendar.getTime();
                 break;
             case DATE_TIME:
+                calendar.set(Calendar.SECOND,0);
+                calendar.set(Calendar.MILLISECOND,0);
                 date = calendar.getTime();
                 break;
             default:
--- a/javauis/lcdui_qt/src/javax/microedition/lcdui/DateFieldLayouter.java	Tue Jul 06 14:10:26 2010 +0300
+++ b/javauis/lcdui_qt/src/javax/microedition/lcdui/DateFieldLayouter.java	Wed Aug 18 09:43:15 2010 +0300
@@ -16,15 +16,18 @@
 */
 package javax.microedition.lcdui;
 
+import java.util.Date;
 import java.util.Calendar;
 
-import org.eclipse.ercp.swt.mobile.DateEditor;
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.events.ModifyEvent;
 import org.eclipse.swt.events.ModifyListener;
 import org.eclipse.swt.graphics.Point;
 import org.eclipse.swt.widgets.Composite;
 import org.eclipse.swt.widgets.Control;
+import org.eclipse.ercp.swt.mobile.DateEditor;
+import org.eclipse.ercp.swt.mobile.CaptionedControl;
+
 
 /**
  * Super class for all DateField Layouters. Contains their common
@@ -36,41 +39,38 @@
     /**
      * Key name for modify listener.
      */
-    private static final String MODIFY_LISTENER = "modify";
-
-    private static DateEditor staticDate;
+    private static final String MODIFY_LISTENER = "ModifyListener";
 
     /**
      * Constructor.
      *
-     * @param dflp DefaultFormLayoutPolicy used for layouting.
+     * @param aFormLayouter FormLayouter used for layouting.
      */
-    DateFieldLayouter(DefaultFormLayoutPolicy dflp)
+    DateFieldLayouter(FormLayouter aFormLayouter)
     {
-        super(dflp);
+        super(aFormLayouter);
     }
 
     /**
-     * Get static eSWT DateEditor widget for size calculations.
+     * Creates the eSWT Control for this item.
+     *
+     * @param parent where to create.
+     * @param item DateField Item.
+     * @return Control.
      */
-    static DateEditor eswtGetStaticDate()
+    Control eswtGetControl(Composite parent, Item item)
     {
-        if(staticDate == null)
-        {
-            staticDate = new DateEditor(eswtGetStaticShell(), SWT.NONE,
-                                        DateEditor.DATE_TIME | DateEditor.COMPACT);
-        }
-        return staticDate;
+	    return eswtCreateControl(parent, item);
     }
 
     /**
-     * Creates the eSWT control.
+     * Creates the eSWT Control for this item.
      *
      * @param parent where to create.
-     * @param item on which it is based. Must be DateField.
+     * @param item DateField Item.
      * @return Control.
      */
-    Control eswtGetControl(Composite parent, Item item)
+    static Control eswtCreateControl(Composite parent, Item item)
     {
         DateField dateField = (DateField) item;
         DateEditor dateEditor = null;
@@ -101,7 +101,8 @@
         {
             dateEditor.setDate(dateField.getDate());
         }
-        return dateEditor;
+		parent.pack();
+        return parent;
     }
 
     /**
@@ -109,12 +110,16 @@
      */
     void eswtAddSpecificListeners(Item item, Control control)
     {
-        super.eswtAddSpecificListeners(item, control);
-        DateField dateField = (DateField) item;
-        DateEditor de = (DateEditor) control;
-        ModifyListener listener = new DateEditorModifyListener(dateField);
-        de.addModifyListener(listener);
-        de.setData(MODIFY_LISTENER, listener);
+        DateEditor dateEditor = (DateEditor) control;
+        ModifyListener listener = (ModifyListener)dateEditor.getData(MODIFY_LISTENER);
+        if(listener == null)
+        {
+	        super.eswtAddSpecificListeners(item, control);
+	        DateField dateField = (DateField) item;
+	        listener = new DateEditorModifyListener(dateField);
+	        dateEditor.addModifyListener(listener);
+	        dateEditor.setData(MODIFY_LISTENER, listener);
+        }
     }
 
     /**
@@ -122,13 +127,13 @@
      */
     void eswtRemoveSpecificListeners(Item item, Control control)
     {
-        super.eswtRemoveSpecificListeners(item, control);
-        DateEditor de = (DateEditor) control;
-        ModifyListener listener = (ModifyListener) de.getData(MODIFY_LISTENER);
+        DateEditor dateEditor = (DateEditor) control;
+        ModifyListener listener = (ModifyListener)dateEditor.getData(MODIFY_LISTENER);
         if(listener != null)
         {
-            de.removeModifyListener(listener);
-            de.setData(MODIFY_LISTENER, null);
+            super.eswtRemoveSpecificListeners(item, control);
+            dateEditor.removeModifyListener(listener);
+            dateEditor.setData(MODIFY_LISTENER, null);
         }
     }
 
@@ -143,20 +148,80 @@
     /**
      * Updates the values of DateField.
      */
-    void eswtUpdateItem(Item item, Control control, int reason, Object param)
+    void eswtUpdateItem(Item item, Control control, int aReason, Object param)
     {
-        DateField dateField = (DateField) item;
-        DateEditor dateEditor = (DateEditor) control;
+		if(!(control instanceof  CaptionedControl))
+		{
+			return;
+		}
+		
+		DateField dateField = (DateField)item;
+		int reason = aReason & Item.UPDATE_SIZE_MASK;
+		
+		switch(reason)
+		{
+		case Item.UPDATE_NONE:
+			break;
+
+		case Item.UPDATE_LABEL:
+		{
+			String label = dateField.getLabel();
+			if(label == null)
+			{
+				label = "";
+			}
+	
+			((CaptionedControl)control).setText(label);
+			control.pack();
+			break;
+		}
+
+		case DateField.UPDATE_DATE:
+		{
+			Control ctrl = eswtFindSpecificControl(dateField, control);
+
+			if(ctrl instanceof DateEditor)
+			{
+				DateEditor dateEditor = (DateEditor)ctrl;
+				Date date = dateField.getDate();
 
-        if(dateField.getDate() != null)
-        {
-            dateEditor.setDate(dateField.getDate());
-        }
+				if(date != null)
+				{
+					if(dateField.getTimeZone() != null)
+					{
+						dateEditor.setTimeZone(dateField.getTimeZone());
+					}
+					dateEditor.setDate(date);
+				}
+				else
+				{
+					//It is expected that on dispose of  DateEditor it will remove ModifyListener.
+					dateEditor.dispose();
+					eswtGetControl((CaptionedControl)control, item);
+				}			
+			}
+			break;
+		}
 
-        if(dateField.getTimeZone() != null)
-        {
-            dateEditor.setTimeZone(dateField.getTimeZone());
-        }
+		case DateField.UPDATE_INPUTMODE:
+		{
+			Control ctrl = eswtFindSpecificControl(dateField, control);
+
+			if(ctrl instanceof DateEditor)
+			{
+				DateEditor dateEditor = (DateEditor)ctrl;
+				//It is expected that on dispose of  DateEditor it will remove ModifyListener.
+				dateEditor.dispose();
+				eswtGetControl((CaptionedControl)control, item);
+			}
+			break;
+		}
+
+		default:
+		{
+			break;
+		}
+		}
     }
 
     /**
@@ -169,7 +234,7 @@
     {
         if(key == SWT.ARROW_LEFT || key == SWT.ARROW_RIGHT)
         {
-            return true;
+            //return true;
         }
         return false;
     }
@@ -182,18 +247,25 @@
      */
     static Point calculateMinimumBounds(final DateField datefield)
     {
-        final Point minSize = new Point(0, 0);
+	    final Point minSize = new Point(0, 0);
         ESWTUIThreadRunner.syncExec(new Runnable()
         {
             public void run()
             {
-                DateEditor tempEditor = eswtGetStaticDate();
-                minSize.x = getMaximumItemWidth(datefield);
-                minSize.y = tempEditor.computeSize(minSize.x, SWT.DEFAULT).y;
-                applyMinMargins(datefield, minSize);
+		        CaptionedControl captioned = new CaptionedControl(eswtGetStaticShell(), SWT.VERTICAL);
+		        if(datefield.hasLabel())
+		        {
+			        captioned.setText(MIN_TEXT);
+				}
+		        eswtCreateControl(captioned, datefield);
+				int maxWidth = getMaximumItemWidth(datefield);
+		        Point size = captioned.computeSize(maxWidth, SWT.DEFAULT);
+		        captioned.dispose();
+		        minSize.x = size.x;
+		        minSize.y = size.y;
             }
         });
-        return minSize;
+		return minSize;
     }
 
     /**
@@ -203,22 +275,27 @@
      * @return Preferred area needed to display Item. x is width and y is
      *         height.
      */
-    static Point calculatePreferredBounds(Item item)
+    static Point calculatePreferredBounds(final DateField datefield)
     {
-        final Point prefSize = new Point(0, 0);
-        final DateField datefield = (DateField) item;
+	    final Point prefSize = new Point(0, 0);
         ESWTUIThreadRunner.syncExec(new Runnable()
         {
             public void run()
             {
-                DateEditor tempEditor = eswtGetStaticDate();
-                prefSize.x = getMaximumItemWidth(datefield);
-                prefSize.y = tempEditor.computeSize(prefSize.x, SWT.DEFAULT).y;
-                applyPrefMargins(datefield, prefSize);
+		        CaptionedControl captioned = new CaptionedControl(eswtGetStaticShell(), SWT.VERTICAL);
+		        if(datefield.hasLabel())
+		        {
+			        captioned.setText(datefield.getLabel());
+				}
+		        eswtCreateControl(captioned, datefield);
+				int maxWidth = getMaximumItemWidth(datefield);
+		        Point size = captioned.computeSize(maxWidth, SWT.DEFAULT);
+		        captioned.dispose();
+		        prefSize.x = size.x;
+		        prefSize.y = size.y;
             }
         });
-        return prefSize;
-        // return calculateMinimumBounds((DateField) item);
+		return prefSize;
     }
 
     /**
@@ -226,30 +303,29 @@
      */
     class DateEditorModifyListener implements ModifyListener
     {
-
         private DateField dateField;
 
         /**
-         * Constructor.
-         * @param dateField DateField to be updated.
-         */
+          * Constructor.
+          * @param dateField DateField to be updated.
+          */
         public DateEditorModifyListener(DateField dateField)
         {
             this.dateField = dateField;
         }
 
         /**
-         * Called by eSWT when DateEditor's value is modified.
-         *
-         * @param e Event.
-         */
+          * Called by eSWT when DateEditor's value is modified.
+          *
+          * @param e Event.
+          */
         public void modifyText(ModifyEvent e)
         {
             // Actions needed only if value is adjusted. Compare values
             // depending of dateField's type and exit if values are same.
             if(!isEqualDate(dateField, (DateEditor) e.getSource()))
             {
-                Logger.method(dateField, "modify", e);
+                Logger.method(dateField, MODIFY_LISTENER, e);
                 dateField.internalSetDate(((DateEditor) e.getSource()).getDate());
                 // notify item state listener
                 dateField.notifyStateChanged();
--- a/javauis/lcdui_qt/src/javax/microedition/lcdui/DefaultFormInteraction.java	Tue Jul 06 14:10:26 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,652 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-package javax.microedition.lcdui;
-
-import java.util.Timer;
-import java.util.TimerTask;
-
-import org.eclipse.swt.SWT;
-
-/**
- * Responsible for implementing interaction in DefaultFormLayoutPolicy.
- */
-class DefaultFormInteraction extends DefaultFormLayoutPolicy
-{
-
-    private static final int NO_DIRECTION = -1;
-
-    private Item currentSelectedItem;
-
-    private int direction = NO_DIRECTION;
-
-    private boolean mousePressed;
-
-    private LayoutObject currentlyUnderMouse;
-
-    /**
-     * Constructor.
-     *
-     * @param form where DFLP is applied.
-     */
-    DefaultFormInteraction(Form form)
-    {
-        super(form);
-    }
-
-    final void handleShowCurrentEvent()
-    {
-        super.handleShowCurrentEvent();
-        eswtApplyCurrentFocus();
-    }
-
-    final void handleHideCurrentEvent()
-    {
-        super.handleHideCurrentEvent();
-        direction = NO_DIRECTION;
-    }
-
-    /* (non-Javadoc)
-     * @see DefaultFormLayoutPolicy#eswtLayoutForm(int)
-     */
-    final void eswtLayoutForm(int startIndex)
-    {
-        super.eswtLayoutForm(startIndex);
-
-        // clear invalid selected item
-        eswtCheckCurrentSelectedItem();
-
-        if(currentSelectedItem != null
-                && (currentSelectedItem.isFocusable()))
-        {
-            eswtApplyCurrentFocus();
-        }
-        else
-        {
-            // If there's no item currently selected try to find first
-            // focusable item and set it current (if found):
-            Item found = eswtGetNextFocusableItem(
-                             getItem(startIndex - 1), SWT.ARROW_RIGHT);
-            if(found != null)
-            {
-                eswtSetCurrentSelectedItem(found, NO_DIRECTION);
-            }
-            else
-            {
-                eswtApplyCurrentFocus();
-            }
-        }
-    }
-
-    /* (non-Javadoc)
-     * @see DefaultFormLayoutPolicy#eswtSetCurrentItem(Item)
-     */
-    boolean eswtSetCurrentItem(Item item)
-    {
-        boolean ret = super.eswtSetCurrentItem(item);
-        if(ret && item != null && item.isFocusable())
-        {
-            eswtSetCurrentSelectedItem(item, NO_DIRECTION);
-            Logger.info("eswtSetCurrentItem" + item);
-        }
-        return ret;
-    }
-
-    /**
-     * DefaultFormInteraction handler for key events.<br>
-     * The DefaultFormInteraction is responsible to react to key presses
-     * accordingly. The implementation moves focus and/or scrolls the form when
-     * needed. The method is called by the Form.
-     *
-     * @param keyCode eSWT key code.
-     * @param keyType eSWT key type.
-     */
-    final void handleKeyEvent(int keyCode, int keyType)
-    {
-        Logger.method(this, "handleKeyEvent", currentSelectedItem,
-                      String.valueOf(keyCode), String.valueOf(keyType));
-
-        boolean isDirectionalKey = isDirectionKey(keyCode);
-        if(keyType == SWT.KeyDown && isDirectionalKey)
-        {
-            eswtCheckCurrentSelectedItem();
-        }
-
-        if(currentSelectedItem != null)
-        {
-            if(getLayouter(currentSelectedItem).eswtOfferKeyEvent(
-                        currentSelectedItem, keyCode, keyType))
-            {
-                // if the key has been consumed
-                return;
-            }
-        }
-
-        // scrolling/focus traverse only happens on directional key's down event
-        if(keyType == SWT.KeyDown && isDirectionalKey)
-        {
-            // try to find next focusable item
-            Item next = eswtGetNextFocusableItem(currentSelectedItem, keyCode);
-
-            // if no visible & focusable item was found to transfer focus
-            if(next == currentSelectedItem)
-            {
-                // try to scroll a bit
-                eswtSetScrollingPosition(getNextScrollingPosition(keyCode),
-                                         true);
-                // find next focusable after scrolling
-                next = eswtGetNextFocusableItem(currentSelectedItem, keyCode);
-            }
-
-            if(next != currentSelectedItem)
-            {
-                //textfield always have to be fully visible when focused.
-                if(next instanceof TextField)
-                {
-                    eswtScrollToItem(next);
-                }
-                eswtSetCurrentSelectedItem(next, keyCode);
-            }
-        }
-    }
-
-    /**
-     * Returns if the parameter is a eSWT directional key code.
-     *
-     * @param keyCode key code
-     */
-    private boolean isDirectionKey(int keyCode)
-    {
-        return (keyCode == SWT.ARROW_DOWN || keyCode == SWT.ARROW_UP
-                || keyCode == SWT.ARROW_LEFT || keyCode == SWT.ARROW_RIGHT);
-    }
-
-    /**
-     * DefaultFormInteraction handler for pointer events.<br>
-     * The method is called by the Form.
-     *
-     * @param x coordinate relative to scrolledComposite
-     * @param y coordinate relative to scrolledComposite
-     * @param type event type: SWT.MouseDown, SWT.MouseMove, SWT.MouseUp
-     */
-    final void handlePointerEvent(int x, int y, int type)
-    {
-        Logger.method(this, "handlePointerEvent", String.valueOf(x),
-                      String.valueOf(y), String.valueOf(type));
-
-        // TODO: change when DirectUI style arrives.
-        /*
-        Item item;
-        if (type == SWT.MouseMove) {
-            if (currentlyUnderMouse == null
-                    || !currentlyUnderMouse.contains(x, y)) {
-                if (currentlyUnderMouse != null) {
-                    //currentlyUnderMouse.getControl().setCapture(false);
-                }
-                item = eswtFindItemUnderMouse(x, y);
-                if (item != null && item != currentSelectedItem
-                        && item.isFocusable()) {
-                    setCurrentItem(item);
-                    item.internalSetFocused(true);
-                    eswtSetCurrentSelectedItem(item);
-                    //following method causes all mouse events delivered to it
-
-                    currentlyUnderMouse.getControl().setCapture(true);
-                    Logger.warning("seting capture to:" + item);
-                }
-            }
-            int currentVPosition = getVPosition();
-            boolean isMouseDirectionUp = false;
-            boolean doScrolling = false;
-            int localY = y;
-
-            if (y <= currentVPosition) {
-                localY = Math.max(0, y);
-                eswtSetScrollingPosition(localY, true);
-                isMouseDirectionUp = true;
-                doScrolling = true;
-            }
-            else if (y > (currentVPosition + getFormHeight())) {
-                //check for maxVPosition
-                if (y > (eswtGetMaxVPosition() + getFormHeight())) {
-                    localY = eswtGetMaxVPosition() + getFormHeight();
-                }
-                else {
-                    localY = y;
-                }
-                currentVPosition = localY - getFormHeight();
-                eswtSetScrollingPosition(currentVPosition, true);
-
-                isMouseDirectionUp = false;
-                doScrolling = true;
-            }
-            if (mousePressed && doScrolling) {
-                resetEventTimer(isMouseDirectionUp, localY);
-            }
-        }
-        else
-        if (type == SWT.MouseDown) {
-            mousePressed = true;
-            item = eswtFindItemUnderMouse(x, y);
-            if (item != null && item != currentSelectedItem
-                    && item.isFocusable() && getForm().getShell() ==
-                        getForm().getShell().getDisplay().getActiveShell()) {
-                //eswtScrollToItem(item);
-                //following method causes all mouse events delivered to it
-
-                //currentlyUnderMouse.getControl().setCapture(true);
-            }
-        }
-        else if (type == SWT.MouseUp) {
-            mousePressed = false;
-            if (currentlyUnderMouse != null) {
-                //currentlyUnderMouse.getControl().setCapture(false);
-            }
-        }*/
-    }
-
-    /**
-     * Find item at the specified point.
-     *
-     * @param x coordinate.
-     * @param y coordinate.
-     * @return Item.
-     */
-    Item eswtFindItemUnderMouse(int x, int y)
-    {
-        Row itemRow;
-        for(int i = 0; i < getRowCount(); i++)
-        {
-            itemRow = getRow(i);
-            if(itemRow.getYShift() <= y && y <= itemRow.getBottomPosition())
-            {
-                LayoutObject lo;
-                for(int j = 0; j < itemRow.size(); j++)
-                {
-                    lo = itemRow.getLayoutObject(j);
-                    if(lo.contains(x, y))
-                    {
-                        Logger.info("Item under mouse: "
-                                    + lo.getOwningItem());
-                        currentlyUnderMouse = lo;
-                        return lo.getOwningItem();
-                    }
-                }
-                break;
-            }
-        }
-        return null;
-    }
-
-    /* (non-Javadoc)
-     * @see DefaultFormLayoutPolicy#eswtHandleVisibilityChanges()
-     */
-    protected void eswtHandleVisibilityChanges()
-    {
-        super.eswtHandleVisibilityChanges();
-        eswtCheckCurrentSelectedItem();
-    }
-
-    /**
-     * Gets next (or nearest) focusable item.
-     *
-     * @param fromItem Item where to start to search the next focusable item.
-     * @param dir Search direction, one of the arrow key constants defined
-     *      in class SWT.
-     *
-     * @return Nearest focusable item or null if no item found.
-     */
-    final Item eswtGetNextFocusableItem(Item fromItem, int dir)
-    {
-        Item nextItem = fromItem;
-
-        switch(dir)
-        {
-        case SWT.ARROW_RIGHT:
-        {
-            LayoutObject obj = getLastLayoutObjectOfItem(fromItem);
-            while((obj = getNextLayoutObjectOfItem(obj, null)) != null)
-            {
-                Item owner = obj.getOwningItem();
-                if(owner != null && owner != fromItem
-                        && owner.isFocusable()
-                        && isPartiallyVisible(obj, Config.DFI_VISIBILITY_PERCENT))
-                {
-                    nextItem = owner;
-                    break;
-                }
-            }
-            break;
-        }
-
-        case SWT.ARROW_LEFT:
-        {
-            LayoutObject obj = getFirstLayoutObjectOfItem(fromItem);
-            while((obj = getPrevLayoutObjectOfItem(obj, null)) != null)
-            {
-                Item owner = obj.getOwningItem();
-                if(owner != null && owner != fromItem
-                        && owner.isFocusable()
-                        && isPartiallyVisible(obj, Config.DFI_VISIBILITY_PERCENT))
-                {
-                    nextItem = owner;
-                    break;
-                }
-            }
-            break;
-        }
-
-        case SWT.ARROW_DOWN:
-        {
-            int minDist = Integer.MAX_VALUE;
-            LayoutObject start = getLastLayoutObjectOfItem(fromItem);
-            LayoutObject obj = start;
-            while((obj = getNextLayoutObjectOfItem(obj, null)) != null)
-            {
-                Item owner = obj.getOwningItem();
-                if(owner != null && owner != fromItem
-                        && owner.isFocusable() && obj.isBelow(start)
-                        && isPartiallyVisible(obj, Config.DFI_VISIBILITY_PERCENT))
-                {
-                    int dist = obj.distanceTo(start);
-                    if(dist < minDist)
-                    {
-                        minDist = dist;
-                        nextItem = owner;
-                    }
-                }
-            }
-            break;
-        }
-
-        case SWT.ARROW_UP:
-        {
-            int minDist = Integer.MAX_VALUE;
-            LayoutObject start = getFirstLayoutObjectOfItem(fromItem);
-            LayoutObject obj = start;
-            while((obj = getPrevLayoutObjectOfItem(obj, null)) != null)
-            {
-                Item owner = obj.getOwningItem();
-                if(owner != null && owner != fromItem
-                        && owner.isFocusable() && obj.isAbove(start)
-                        && isPartiallyVisible(obj, Config.DFI_VISIBILITY_PERCENT))
-                {
-                    int dist = obj.distanceTo(start);
-                    if(dist < minDist)
-                    {
-                        minDist = dist;
-                        nextItem = owner;
-                    }
-                }
-            }
-            break;
-        }
-
-        default:
-        }
-
-        return nextItem;
-    }
-
-    /**
-     * Check if the currentSelectedItem is valid and visible. If not then it
-     * sets it to null.
-     */
-    final void eswtCheckCurrentSelectedItem()
-    {
-        if(currentSelectedItem != null)
-        {
-            if(currentSelectedItem.getParent() != getForm()
-                    || !currentSelectedItem.isVisible())
-            {
-                // we need to find another
-                Logger.method(this, "eswtCheckCurrentSelectedItem");
-                eswtSetCurrentSelectedItem(null, NO_DIRECTION);
-            }
-        }
-    }
-
-    /**
-     * Sets currentSelectedItem and sets focus to it.<br>
-     * If one of form's items is already selected when this method is called,
-     * removes focus from old item and then moves focus to new one.
-     *
-     * @param item Item to set as current selected. If null, nothing happens.
-     * @param dir Direction which is delivered to layouter.
-     */
-    void eswtSetCurrentSelectedItem(Item item, int dir)
-    {
-        if(currentSelectedItem != item)
-        {
-            Logger.info(this + "::SelectedItem: "
-                        + currentSelectedItem + " --(" + dir + ")--> " + item);
-
-            // Save direction
-            direction = dir;
-            // Remove focus from currentSelectedItem and notify its Layouter.
-            if(currentSelectedItem != null)
-            {
-                getLayouter(currentSelectedItem).eswtFocusLost(
-                    currentSelectedItem);
-            }
-
-            // Set new currentSelectedItem, must be focusable or null
-            currentSelectedItem = item;
-
-            // Set focus to currentSelectedItem and notify its Layouter.
-            if(currentSelectedItem != null)
-            {
-                getLayouter(currentSelectedItem).eswtFocusGained(
-                    currentSelectedItem, dir);
-            }
-
-            // Apply eSWT focus to currentSelectedItem's control
-            eswtApplyCurrentFocus();
-        }
-    }
-
-    /**
-     * Sets currentSelectedItem and sets focus to it.<br>
-     * If one of form's items is already selected when this method is called,
-     * removes focus from old item and then moves focus to new one.
-     *
-     * @param item Item to set as current selected. If null, nothing happens.
-     * @param dir Direction which is delivered to layouter.
-     */
-    void eswtSetCurrentSelectedItem(Item item)
-    {
-        if(currentSelectedItem != item)
-        {
-            Logger.info(this + "::SelectedItem: "
-                        + currentSelectedItem + " ---> " + item);
-
-            // Remove focus from currentSelectedItem and notify its Layouter.
-            if(currentSelectedItem != null)
-            {
-                getLayouter(currentSelectedItem).eswtFocusLost(
-                    currentSelectedItem);
-            }
-
-            // Set new currentSelectedItem, must be focusable or null
-            currentSelectedItem = item;
-
-            // Set focus to currentSelectedItem and notify its Layouter.
-            if(currentSelectedItem != null)
-            {
-                getLayouter(currentSelectedItem).eswtFocusGained(
-                    currentSelectedItem, NO_DIRECTION);
-            }
-
-            // Apply eSWT focus to currentSelectedItem's control
-            //eswtApplyCurrentFocus();
-        }
-    }
-
-    /**
-     * Sets focus to currentSelectedItem's control if its partially visible.
-     * Otherwise it sets dummy focus to form's composite.<br>
-     * <br>
-     * Note that this method applies focus only to eSWT control. Item focus
-     * update and layouter notifications are handled in method
-     * <code>eswtSetCurrentSelectedItem()</code>.<br>
-     * If currentSelectedItem is null or form is not shown, this method has no
-     * effect.
-     */
-    void eswtApplyCurrentFocus()
-    {
-        if(isFormCurrent())
-        {
-            // if any of the Item's LayoutObjects is visible
-            if(isItemPartiallyVisible(currentSelectedItem))
-            {
-                Logger.method(this, "ApplyFocus", currentSelectedItem);
-                eswtSetFocusToFirstControl(currentSelectedItem);
-            }
-            else
-            {
-                Logger.method(this, "ApplyFocus", "dummy");
-                formComposite.forceFocus();
-            }
-        }
-    }
-
-    /**
-     * If the Item is valid and it is layouted, then sets the Item's first
-     * LayoutObject focused.
-     *
-     * @param item an item which first LayoutObject is set focused.
-     */
-    void eswtSetFocusToFirstControl(Item item)
-    {
-        if(item != null && item.isFocusable())
-        {
-            LayoutObject lo = getFirstLayoutObjectOfItem(item);
-            if(lo != null)
-            {
-                lo.getControl().forceFocus();
-            }
-        }
-    }
-
-    /**
-     * Gets Current selected item.
-     *
-     * @return Current selected item. May also return null.
-     */
-    Item getCurrentSelectedItem()
-    {
-        return currentSelectedItem;
-    }
-
-    /**
-     * Get the direction of scrolling.
-     *
-     * @return direction of scrolling.
-     */
-    int getDirection()
-    {
-        return direction;
-    }
-
-    /* (non-Javadoc)
-     * @see DefaultFormLayoutPolicy#eswtResizeItemAndShift(Item)
-     */
-    int eswtResizeItemAndShift(Item item)
-    {
-        // save the state of the last row before resizing and Shifting.
-        boolean itemWasVisible = isItemPartiallyVisible(item);
-
-        int newVPosition = super.eswtResizeItemAndShift(item);
-
-        if(item == currentSelectedItem)
-        {
-            if(itemWasVisible)
-            {
-                int itemTop = getItemTopPosition(item);
-                int itemBottom = getItemBottomPosition(item);
-                // currentSelectedItem has to be focused if it was focused
-                // before resizing e.g TextField when it is resized by adding a
-                // new row and it was in the bottom of the Screen.
-                if(newVPosition <= itemTop
-                        && (newVPosition + getFormHeight()) >= itemBottom)
-                {
-                    // do not change vPosition;
-                }
-                else if(newVPosition > itemTop)
-                {
-                    newVPosition = itemTop;
-                }
-                else if((newVPosition + getFormHeight()) < itemBottom)
-                {
-                    newVPosition = itemBottom - getFormHeight();
-                }
-            }
-        }
-        return newVPosition;
-    }
-
-    private Timer eventTimer = new Timer();
-    private EventGeneratorTask eventTask;
-
-    /**
-     * Reset timer for do layout with a given start index.
-     */
-    private void resetEventTimer(boolean directionUp, int y)
-    {
-        if(eventTimer != null)
-        {
-            if(eventTask != null)
-            {
-                eventTask.cancel();
-                eventTask = null;
-            }
-            // schedule new timer
-            eventTask = new EventGeneratorTask(directionUp, y);
-            eventTimer.schedule(eventTask, Config.DFI_EVENT_TIMER_DELAY);
-        }
-    }
-
-    /**
-     * Form Timer task. Triggers the formComposite to Layout.
-     */
-    class EventGeneratorTask extends TimerTask
-    {
-
-        private boolean isUpDirection;
-        private int localY;
-
-        public EventGeneratorTask(boolean direction, int y)
-        {
-            isUpDirection = direction;
-            localY = y;
-            Logger.info("y is " + localY);
-        }
-
-        public void run()
-        {
-            if(isUpDirection)
-            {
-                localY -= Config.DFI_EVENT_MOVE_DELTA;
-            }
-            else
-            {
-                localY += Config.DFI_EVENT_MOVE_DELTA;
-            }
-            handlePointerEvent(0, localY, SWT.MouseMove);
-        }
-    }
-
-}
--- a/javauis/lcdui_qt/src/javax/microedition/lcdui/DefaultFormLayoutPolicy.java	Tue Jul 06 14:10:26 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1433 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-package javax.microedition.lcdui;
-
-import java.util.NoSuchElementException;
-import java.util.Vector;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-
-/**
- * DefaultFormLayoutPolciy implements form layout algorithm.
- */
-class DefaultFormLayoutPolicy extends FormLayoutPolicy
-{
-
-    /**
-     * Form instance (not owned).
-     */
-    private Form form;
-
-    /**
-     * Form's scrolled composite (not owned).
-     */
-    protected ScrolledComposite formComposite;
-
-    /**
-     * Rows vector.
-     */
-    private Vector rows = new Vector();
-
-    /**
-     * Form's current horizontal alignment
-     */
-    private int currentHLayoutDirective;
-
-    private ImageItemLayouter imIL;
-
-    private StringItemLayouter sIL;
-
-    private GaugeLayouter gL;
-
-    private TextFieldLayouter tfL;
-
-    private DateFieldLayouter dfL;
-
-    private ChoiceGroupLayouter cgL;
-
-    private CustomItemLayouter ciL;
-
-    private SpacerLayouter sL;
-
-    private int vPosition;
-
-    private Item deferredScrollToItem;
-
-    private boolean isCurrent;
-
-    // Used by getItemControl() method to return Item's main conrol.
-    private Control itemMainControl;
-
-    /**
-     * Constructor.
-     *
-     * @param form Form to perform layout on.
-     */
-    DefaultFormLayoutPolicy(Form form)
-    {
-        this.form = form;
-        formComposite = form.getFormComposite();
-        imIL = new ImageItemLayouter(this);
-        sIL = new StringItemLayouter(this);
-        gL = new GaugeLayouter(this);
-        dfL = new DateFieldLayouter(this);
-        tfL = new TextFieldLayouter(this);
-        cgL = new ChoiceGroupLayouter(this);
-        ciL = new CustomItemLayouter(this);
-        sL = new SpacerLayouter(this);
-    }
-
-    /**
-     * Dispose and cleanup layouted items.
-     */
-    void dispose()
-    {
-        ESWTUIThreadRunner.syncExec(new Runnable()
-        {
-            public void run()
-            {
-                eswtClearRows(0, null);
-            }
-        });
-    }
-
-    /**
-     * Log out a control with all its children at the given indentation level.
-     */
-    void logControl(int level, Control control)
-    {
-        if(control != null)
-        {
-            String s2 = control.toString();
-            s2 = s2.substring(0, s2.indexOf('}') - 1);
-            String s3 = control.getBounds().toString();
-            s3 = s3.substring(s3.indexOf('{'));
-            Logger.verbose(Logger.indent(s2 + s3, level * 2));
-            if(control instanceof Composite)
-            {
-                Control[] arr = ((Composite) control).getChildren();
-                for(int i = 0; i < arr.length; i++)
-                {
-                    logControl(level + 1, arr[i]);
-                }
-            }
-        }
-    }
-
-    /**
-     * Log out all layoutobjects for each item.
-     */
-    void logFormLayout()
-    {
-        Logger.verbose(form + " ---------------------------------------------");
-        LayoutObject lo = null;
-        Item item = null;
-        int line = -1;
-        while((lo = getNextLayoutObjectOfItem(lo, null)) != null)
-        {
-            if(lo.getOwningItem() != item)
-            {
-                item = lo.getOwningItem();
-                Logger.verbose(item.toString());
-            }
-            if(lo.getRowIdx() != line)
-            {
-                line = lo.getRowIdx();
-            }
-            Logger.verbose(Logger.indent("Row:" + lo.getRowIdx(), 2));
-            logControl(2, lo.getControl());
-        }
-        Logger.verbose(form + " ---------------------------------------------");
-    }
-
-    /**
-     * Called when Form is about to be shown.<br>
-     * NOTE: this is called from eSWT UI-thread
-     */
-    void handleShowCurrentEvent()
-    {
-        Logger.method(this, "handleShowCurrentEvent");
-        isCurrent = true;
-
-        // restore our scrolling position (eSWT resets it to 0 by default)
-        eswtSetScrollingPosition(vPosition, true);
-
-        Item item = null;
-        LayoutObject lo = null;
-        while((lo = getNextLayoutObjectOfItem(lo, null)) != null)
-        {
-            if(lo.getOwningItem() != item)
-            {
-                // item border
-                item = lo.getOwningItem();
-                getLayouter(item).eswtAddListeners(item, lo);
-            }
-        }
-    }
-
-    /**
-     * Called when Form is about to be hidden.<br>
-     * NOTE: this is called from eSWT UI-thread
-     */
-    void handleHideCurrentEvent()
-    {
-        Logger.method(this, "handleHideCurrentEvent");
-        isCurrent = false;
-
-        Item item = null;
-        LayoutObject lo = null;
-        while((lo = getNextLayoutObjectOfItem(lo, null)) != null)
-        {
-            if(lo.getOwningItem() != item)
-            {
-                // item border
-                item = lo.getOwningItem();
-                getLayouter(item).eswtRemoveListeners(item, lo);
-                getLayouter(item).eswtHandleVisibilityChange(item, false);
-            }
-        }
-    }
-
-    /**
-     * Called when Form is beeing resized.<br>
-     * NOTE: this is called from eSWT UI-thread
-     */
-    void handleResizeEvent(int width, int height)
-    {
-        // Logger.method(this, "handleResizeEvent");
-        int numitems = getItemCount();
-        for(int i = 0; i < numitems; i++)
-        {
-            getItem(i).invalidateCachedSizes();
-        }
-        ItemLayouter.eswtUpdateStaticShellSize(width, height);
-    }
-
-    /**
-     * Do form layout according to startIndex.
-     *
-     * @param startItem - index of item which need to be layouted.
-     */
-    void layoutForm(final int startItem)
-    {
-        ESWTUIThreadRunner.syncExec(new Runnable()
-        {
-            public void run()
-            {
-                eswtLayoutForm(startItem);
-            }
-        });
-    }
-
-    /**
-     * eSWT callback for doLayout().
-     */
-    void eswtLayoutForm(int startItem)
-    {
-        int numItems = getItemCount();
-        Logger.method(this, "eswtLayoutForm", startItem + " / " + numItems);
-
-        eswtUpdateFormComposite(false);
-        if(numItems > 0)
-        {
-            Item previousItem = null;
-            int startRowIndex = 0;
-
-            if(startItem > 0)
-            {
-                // Find row with previous item.
-                previousItem = getItem(startItem - 1);
-                Row prevItemRow = getLastRowOfItem(previousItem);
-                if(prevItemRow != null)
-                {
-                    startRowIndex = rows.indexOf(prevItemRow);
-                }
-            }
-
-            // Clear rows starting from item - partial re-layouting
-            eswtClearRows(startRowIndex, previousItem);
-
-            // Layout items
-            for(int i = startItem; i < numItems; i++)
-            {
-                eswtLayoutItem(getItem(i));
-            }
-
-            // Update last row
-            eswtUpdateRow(getLastRow());
-        }
-        else
-        {
-            eswtClearRows(0, null);
-        }
-        // check if we need to scroll to a particular item
-        if(deferredScrollToItem != null)
-        {
-            eswtSetCurrentItem(deferredScrollToItem);
-            deferredScrollToItem = null;
-        }
-        eswtUpdateFormComposite(true);
-        eswtHandleVisibilityChanges();
-
-        if(Logger.isLogVerbose())
-        {
-            logFormLayout();
-        }
-    }
-
-    void handleKeyEvent(int keyCode, int keyType)
-    {
-        // Implemented in sub-class DefaultFormInteraction
-    }
-
-    void handlePointerEvent(int x, int y, int type)
-    {
-        // Implemented in sub-class DefaultFormInteraction
-    }
-
-    /**
-     * Set focus to an item if it is focusable and scroll form to make it
-     * visible if it is not.
-     *
-     * @param item Item to set as current item.
-     */
-    void setCurrentItem(final Item item)
-    {
-        Logger.method(this, "setCurrentItem", item);
-        ESWTUIThreadRunner.syncExec(new Runnable()
-        {
-            public void run()
-            {
-                eswtSetCurrentItem(item);
-            }
-        });
-    }
-
-    /**
-     * eSWT callback for setCurrentItem.
-     */
-    boolean eswtSetCurrentItem(Item item)
-    {
-        if(item != null)
-        {
-            if(isItemLayouted(item))
-            {
-                eswtScrollToItem(item);
-                deferredScrollToItem = null;
-                return true;
-            }
-            else
-            {
-                deferredScrollToItem = item;
-            }
-        }
-        return false;
-    }
-
-    void eswtScrollToItem(Item item)
-    {
-        if(item != null)
-        {
-            int pos = getItemBottomPosition(item) - getFormHeight();
-            if(!isItemPartiallyVisible(item))
-            {
-                eswtSetScrollingPosition(pos, true);
-            }
-            else if(item instanceof TextField && !isItemFullyVisible(item))
-            {
-                eswtSetScrollingPosition(pos, true);
-            }
-        }
-    }
-
-    void eswtScrolltoRegion(int yTop, int yBottom, int swtDir)
-    {
-        if(yTop < vPosition || yBottom > vPosition + getFormHeight())
-        {
-            // if the region is somewhat outside the screen
-            if(swtDir == SWT.ARROW_DOWN || swtDir == SWT.ARROW_RIGHT)
-            {
-                // align to top
-                eswtSetScrollingPosition(yTop, true);
-            }
-            else
-            {
-                // align to bottom
-                eswtSetScrollingPosition(yBottom - getFormHeight(), true);
-            }
-        }
-    }
-
-    void eswtScrollIfNeeded(final int top, final int bottom)
-    {
-        if(bottom > vPosition + getFormHeight())
-        {
-            eswtSetScrollingPosition(bottom - (getFormHeight() / 2), true);
-        }
-        else if(top < vPosition)
-        {
-            eswtSetScrollingPosition(bottom - (getFormHeight() / 2), true);
-        }
-    }
-
-    /**
-     * Get control's position relative to composite.
-     */
-    void getControlPositionOnComposite(Control control, Point location)
-    {
-        if(control != formComposite)
-        {
-            Point rel = control.getLocation();
-            location.x += rel.x;
-            location.y += rel.y;
-            getControlPositionOnComposite(control.getParent(), location);
-        }
-    }
-
-    /**
-     * eSWT specific calls to do update ScrolledComposite.
-     */
-    private void eswtUpdateFormComposite(boolean show)
-    {
-        if(getRowCount() > 0)
-        {
-            if(show)
-            {
-                formComposite.updateScrollbar(getLastRow().getBottomPosition());
-                formComposite.pack();
-            }
-        }
-        // Could happen if changing item from very tall to very short.
-        // so we have to update VPosition
-        if(getVPosition() > eswtGetMaxVPosition())
-        {
-            eswtSetScrollingPosition(eswtGetMaxVPosition(), false);
-        }
-
-        formComposite.setRedraw(show);
-        formComposite.setVisible(show);
-    }
-
-    /**
-     * Clean all form rows starting from startIndex.
-     *
-     * @param startIndex Start row from which to clean.
-     * @param keepItem - item in a startRow which shouldn't be recreated.
-     */
-    private void eswtClearRows(int startIndex, Item keepItem)
-    {
-        Logger.method(this, "clearRows", String.valueOf(startIndex), keepItem);
-        Row row = null;
-        for(int i = (getRowCount() - 1); i >= startIndex; i--)
-        {
-            row = getRow(i);
-            if(row.cleanRow(keepItem))
-            {
-                break;
-            }
-            else
-            {
-                rows.removeElement(row);
-            }
-        }
-
-        // one row always should be available.
-        if((getRowCount() == 0))
-        {
-            // rows.addElement(tempRow);
-            currentHLayoutDirective = Item.LAYOUT_DEFAULT;
-            Row newRow = new Row(ItemLayouter.getMaximumItemWidth(null),
-                                 getCurrentHLayoutDirective());
-            rows.addElement(newRow);
-        }
-    }
-
-    /**
-     * Update Row's internal layout. Handles LAYOUT_2 related post-processing.
-     *
-     * @param row Row
-     */
-    private void eswtUpdateRow(Row row)
-    {
-        if(row != null)
-        {
-            //Logger.verbose("updateRow start: " + row);
-            int numShrink = row.getNumLayoutObjects(Item.LAYOUT_SHRINK);
-            int numExpand = row.getNumLayoutObjects(Item.LAYOUT_EXPAND);
-            //Logger.verbose("shrink: " + numShrink + " expand: " + numExpand);
-
-            int vMask = Item.LAYOUT_VSHRINK | Item.LAYOUT_VEXPAND;
-            // Expand items vertically with VSHRINK or VEXPAND layout directive
-            LayoutObject lo = null;
-            int maxHeight = row.getRowHeight(vMask);
-            while((lo = row.getNextLayoutObject(lo, vMask)) != null)
-            {
-                if(lo.getOwningItem().hasLayout(Item.LAYOUT_VSHRINK))
-                {
-                    int pref = lo.getOwningItem().getPreferredHeight();
-                    getLayouter(lo.getOwningItem()).eswtResizeObject(lo,
-                            lo.getWidth(), Math.min(pref, maxHeight));
-                }
-                else if(lo.getOwningItem().hasLayout(Item.LAYOUT_VEXPAND))
-                {
-                    getLayouter(lo.getOwningItem()).eswtResizeObject(lo,
-                            lo.getWidth(), maxHeight);
-                }
-            }
-
-            // Expand items with SHRINK layout directive
-            if(numShrink > 0)
-            {
-                // Get extra space before shrink and expand
-                int offset = row.getFreeSpace() / numShrink;
-                // Logger.verbose("shrinkOffset: " + offset);
-                if(offset >= 0)
-                {
-                    while((lo = row.getNextLayoutObject(lo, Item.LAYOUT_SHRINK)) != null)
-                    {
-                        int pref = lo.getOwningItem().getPreferredWidth();
-                        int min = lo.getOwningItem().getMinimumWidth();
-                        int itemWidth = Math.min(pref, min + offset);
-                        getLayouter(lo.getOwningItem()).eswtResizeObject(lo,
-                                itemWidth, lo.getHeight());
-                    }
-                }
-            }
-
-            // Expand items with EXPAND layout directive
-            if(numExpand > 0)
-            {
-                // Get extra space after shrink but before expand
-                int offset = row.getFreeSpace(Item.LAYOUT_EXPAND) / numExpand;
-                if(offset >= 0)
-                {
-                    // Logger.verbose("expandOffset: " + offset);
-                    while((lo = row.getNextLayoutObject(lo, Item.LAYOUT_EXPAND)) != null)
-                    {
-                        int pref = lo.getOwningItem().getPreferredWidth();
-                        getLayouter(lo.getOwningItem()).eswtResizeObject(lo,
-                                pref + offset, lo.getHeight());
-                    }
-                }
-            }
-
-            //if (numShrink > 0 || numExpand > 0) {
-            row.updateRowInternals();
-            //}
-
-            row.updateRowLayout(form.getLeftRightLanguage());
-            // Logger.verbose("updateRow: " + row);
-        }
-    }
-
-    /**
-     * Add a new Row.
-     */
-    private Row eswtAddNewRow()
-    {
-        Row lastRow = getLastRow();
-        eswtUpdateRow(lastRow);
-        int yShift = (lastRow == null ? 0 : lastRow.getBottomPosition());
-        // create new Row
-        Row newRow = new Row(ItemLayouter.getMaximumItemWidth(null),
-                             getCurrentHLayoutDirective());
-        newRow.setYShift(yShift);
-        rows.addElement(newRow);
-        return newRow;
-    }
-
-    /**
-     * Add a LayoutObject to the last Row.
-     *
-     * @param layoutObject the layout object
-     */
-    void eswtAddNewLayoutObject(LayoutObject layoutObject)
-    {
-        Row lastRow = getLastRow();
-        // check if the current Row is full
-        if(!lastRow.isEmpty()
-                && lastRow.getFreeSpace() < layoutObject.getWidth())
-        {
-            lastRow = eswtAddNewRow();
-        }
-        lastRow.eswtAddLayoutObject(layoutObject);
-        layoutObject.setRowIdx(getRowCount() - 1);
-    }
-
-    /**
-     * Optionally add a new Row and adds a LayoutObject.
-     *
-     * @param layoutObject the layout object
-     * @param newRow adds a new row if true. If false, adds new row only if
-     *            there's no space for layoutObject in current row.
-     */
-    void eswtAddNewLayoutObject(LayoutObject layoutObject, boolean newRow)
-    {
-        if(newRow)
-        {
-            eswtAddNewRow();
-        }
-        eswtAddNewLayoutObject(layoutObject);
-    }
-
-    /**
-     * Layout item in a row, if needed new row is added.
-     *
-     * @param row - where to startLayout.
-     * @param item - Item to Layout
-     */
-    private void eswtLayoutItem(Item item)
-    {
-        Row lastRow = getLastRow();
-        boolean hlChange = setCurrentHLayoutDirective(item.internalGetLayout());
-        if(hlChange || getItemNewLineBefore(item))
-        {
-            // newline directive or horizontal layout changed
-            if(lastRow.isEmpty())
-            {
-                // if the current/last row is empty - use that
-                lastRow.setRowHLayout(getCurrentHLayoutDirective());
-            }
-            else
-            {
-                eswtAddNewRow();
-            }
-        }
-
-        // Use the specific layouter to layout item in the last row
-        getLayouter(item).eswtLayoutItem(getLastRow(), item);
-
-        if(form.eswtIsShown())
-        {
-            LayoutObject lo = getFirstLayoutObjectOfItem(item);
-            if(lo != null)
-            {
-                getLayouter(item).eswtAddListeners(item, lo);
-            }
-        }
-
-        if(getItemNewLineAfter(item))
-        {
-            eswtAddNewRow();
-        }
-    }
-
-    /**
-     * Set Form's Layout directive. if it differ from current set flag
-     * startFromNewLine = true;
-     *
-     * @param newLayoutDirective
-     * @return true if a layout change has occured
-     */
-    private boolean setCurrentHLayoutDirective(int newLayoutDirective)
-    {
-        int newHLayoutDirective = Item.getHorizontalLayout(newLayoutDirective);
-        if((newHLayoutDirective != currentHLayoutDirective)
-                && (newHLayoutDirective != Item.LAYOUT_DEFAULT))
-        {
-            currentHLayoutDirective = newHLayoutDirective;
-            return true;
-        }
-        return false;
-    }
-
-    /**
-     * Get Form current Layout directive.
-     *
-     * @return current Layout directive for Form.
-     */
-    private int getCurrentHLayoutDirective()
-    {
-        if(currentHLayoutDirective == Item.LAYOUT_DEFAULT)
-        {
-            return getLanguageSpecificLayoutDirective();
-        }
-        return currentHLayoutDirective;
-    }
-
-    /**
-     * Returns language specific layout directive.
-     *
-     * @return LAYOUT_LEFT or LAYOUT_RIGHT.
-     */
-    int getLanguageSpecificLayoutDirective()
-    {
-        if(form.getLeftRightLanguage())
-        {
-            return Item.LAYOUT_LEFT;
-        }
-        else
-        {
-            return Item.LAYOUT_RIGHT;
-        }
-    }
-
-    private boolean getItemNewLineBefore(Item item)
-    {
-        return ((item.internalGetLayout() & Item.LAYOUT_NEWLINE_BEFORE) != 0);
-    }
-
-    private boolean getItemNewLineAfter(Item item)
-    {
-        return ((item.internalGetLayout() & Item.LAYOUT_NEWLINE_AFTER) != 0);
-    }
-
-    boolean isItemLayouted(Item item)
-    {
-        return (getFirstLayoutObjectOfItem(item) != null);
-    }
-
-    /**
-     * Returns if the form is shown.
-     */
-    boolean isFormCurrent()
-    {
-        return isCurrent;
-    }
-
-    /**
-     * Returns if the region is partially visible.
-     *
-     * @param viewTop viewPort's top position
-     * @param viewBottom viewPort's bottom position
-     * @return true if visible
-     */
-    boolean isPartiallyVisible(int yTop, int yBottom)
-    {
-        int vBottomPosition = vPosition + getFormHeight();
-        if((vPosition <= yTop && vBottomPosition <= yTop)
-                || (vPosition >= yBottom && vBottomPosition >= yBottom))
-        {
-            return false;
-        }
-        return true;
-    }
-
-    /**
-     * Returns if at least the region's given percentage is visible.
-     */
-    boolean isPartiallyVisible(int yTop, int yBottom, int minPercent)
-    {
-        int visPercent = getVisibilityPercent(yTop, yBottom);
-        if(visPercent > minPercent)
-        {
-            return true;
-        }
-        return false;
-    }
-
-    /**
-     * Returns the region's visibility percentage.
-     */
-    int getVisibilityPercent(int yTop, int yBottom)
-    {
-        if(yTop >= yBottom)
-        {
-            return 0;
-        }
-        int vBottomPosition = vPosition + getFormHeight();
-        int r1 = Math.max(vPosition, Math.min(yTop, vBottomPosition));
-        int r2 = Math.min(vBottomPosition, Math.max(yBottom, vPosition));
-        return ((r2 - r1) * 100) / (yBottom - yTop);
-    }
-
-    /**
-     * Returns if the LayoutObject is partially visible.
-     */
-    boolean isPartiallyVisible(LayoutObject lo)
-    {
-        if(lo != null)
-        {
-            return isPartiallyVisible(lo.getY(), lo.getY() + lo.getHeight());
-        }
-        return false;
-    }
-
-    /**
-     * Returns if at least the LayoutObject's given percentage is visible.
-     */
-    boolean isPartiallyVisible(LayoutObject lo, int minPercent)
-    {
-        if(lo != null)
-        {
-            return isPartiallyVisible(lo.getY(), lo.getY() + lo.getHeight(),
-                                      minPercent);
-        }
-        return false;
-    }
-
-    /**
-     * Returns if the Item is partially visible (if one of its LayoutObjects is
-     * partially visible).
-     *
-     * @param item the Item
-     * @return true if partially visible
-     */
-    boolean isItemPartiallyVisible(Item item)
-    {
-        if(item != null)
-        {
-            LayoutObject lo = null;
-            while((lo = getNextLayoutObjectOfItem(lo, item)) != null)
-            {
-                if(isPartiallyVisible(lo))
-                {
-                    return true;
-                }
-            }
-        }
-        return false;
-    }
-
-
-
-    /**
-     * Returns true if item is fully visible.
-     *
-     * @param item the Item.
-     * @return true if fully visible.
-     */
-    boolean isItemFullyVisible(Item item)
-    {
-        if(item != null)
-        {
-            LayoutObject lo = null;
-            while((lo = getNextLayoutObjectOfItem(lo, item)) != null)
-            {
-                if(!isLOFullyVisible(lo))
-                {
-                    return false;
-                }
-            }
-        }
-        return true;
-    }
-
-    /**
-     * Returns if the LayoutObject is fully visible.
-     */
-    boolean isLOFullyVisible(LayoutObject lo)
-    {
-        if(lo != null)
-        {
-            return isFullyVisible(lo.getY(), lo.getY() + lo.getHeight());
-        }
-        return false;
-    }
-
-    /**
-     * Returns if the region is fully visible.
-     *
-     * @param viewTop viewPort's top position
-     * @param viewBottom viewPort's bottom position
-     * @return true if visible
-     */
-    boolean isFullyVisible(int yTop, int yBottom)
-    {
-        int vBottomPosition = vPosition + getFormHeight();
-        if((vPosition <= yTop && vBottomPosition >= yBottom))
-        {
-            return true;
-        }
-        return false;
-    }
-
-    int getItemTopPosition(Item item)
-    {
-        LayoutObject lo = getFirstLayoutObjectOfItem(item);
-        if(lo != null)
-        {
-            return lo.getY();
-        }
-        return 0;
-    }
-
-    int getItemBottomPosition(Item item)
-    {
-        LayoutObject lo = getLastLayoutObjectOfItem(item);
-        if(lo != null)
-        {
-            return lo.getY() + lo.getHeight();
-        }
-        return 0;
-    }
-
-    int getItemCount()
-    {
-        return form.size();
-    }
-
-    Item getItem(int index)
-    {
-        try
-        {
-            return (Item) form.getItems().elementAt(index);
-        }
-        catch(ArrayIndexOutOfBoundsException e)
-        {
-            // Logger.exception(e);
-            return null;
-        }
-    }
-
-    int getItemIndex(Item item)
-    {
-        return form.getItems().indexOf(item);
-    }
-
-    int getRowCount()
-    {
-        return rows.size();
-    }
-
-    /**
-     * Return the Row with the given index.
-     *
-     * @param index Row's index
-     * @return a Row
-     */
-    Row getRow(int index)
-    {
-        try
-        {
-            return (Row) rows.elementAt(index);
-        }
-        catch(ArrayIndexOutOfBoundsException e)
-        {
-            Logger.exception("getRow", e);
-            return null;
-        }
-    }
-
-    /**
-     * Return the Row to which the given LayoutObject belongs.
-     *
-     * @param lo LayoutObject
-     * @return the owning Row
-     */
-    Row getRow(LayoutObject lo)
-    {
-        try
-        {
-            return getRow(lo.getRowIdx());
-        }
-        catch(NullPointerException e)
-        {
-            // Logger.exception("getRow", e);
-            return null;
-        }
-    }
-
-    /**
-     * Returns the last row of the form.
-     */
-    Row getLastRow()
-    {
-        try
-        {
-            return (Row) rows.lastElement();
-        }
-        catch(NoSuchElementException nse)
-        {
-            // Logger.exception("getLastRow", nse);
-            return null;
-        }
-    }
-
-    /**
-     * Find last row which contains corresponding Item.
-     *
-     * @param item Item in a Row.
-     * @return Last Row with that item.
-     */
-    Row getLastRowOfItem(Item item)
-    {
-        return getRow(getLastLayoutObjectOfItem(item));
-    }
-
-    /**
-     * Get Form which requires layout.
-     *
-     * @return form.
-     */
-    Form getForm()
-    {
-        return form;
-    }
-
-    /**
-     * Form's content height.
-     */
-    int getFormHeight()
-    {
-        return form.getHeight();
-    }
-
-    /**
-     * Form's content width.
-     */
-    int getFormWidth()
-    {
-        return form.getWidth();
-    }
-
-    /**
-     * Returns the next LayoutObject belonging to this Item.<br>
-     *
-     * @param lo starting LayoutObject; if null then it start from first.
-     * @param item specifies the parent Item; null means any Item
-     * @return the next LayoutObject in the layout.
-     */
-    LayoutObject getNextLayoutObjectOfItem(LayoutObject lo, Item item)
-    {
-        int startRow = (lo == null ? 0 : lo.getRowIdx());
-        LayoutObject temp = null;
-        for(int i = startRow; i < getRowCount(); i++)
-        {
-            temp = getRow(i).getNextLayoutObject(lo, item);
-            if(temp != null && temp != lo)
-            {
-                return temp;
-            }
-        }
-        return null;
-    }
-
-    /**
-     * Returns the previous LayoutObject belonging to this Item.<br>
-     *
-     * @param lo starting LayoutObject; if null then it start from last.
-     * @param item specifies the parent Item; null means any Item
-     * @return the previous LayoutObject in the layout.
-     */
-    LayoutObject getPrevLayoutObjectOfItem(LayoutObject lo, Item item)
-    {
-        int startRow = (lo == null ? rows.size() - 1 : lo.getRowIdx());
-        LayoutObject temp = null;
-        for(int i = startRow; i >= 0; i--)
-        {
-            temp = getRow(i).getPrevLayoutObject(lo, item);
-            if(temp != null && temp != lo)
-            {
-                return temp;
-            }
-        }
-        return null;
-    }
-
-    /**
-     * Returns the first LayoutObject of a layouted item.
-     *
-     * @param item
-     * @return the LO, or NULL if the item is not layouted
-     */
-    LayoutObject getFirstLayoutObjectOfItem(Item item)
-    {
-        if(item != null)
-        {
-            return getNextLayoutObjectOfItem(null, item);
-        }
-        return null;
-    }
-
-    /**
-     * Returns the last LayoutObject of a layouted item.
-     *
-     * @param item
-     * @return the LO, or NULL if the item is not layouted
-     */
-    LayoutObject getLastLayoutObjectOfItem(Item item)
-    {
-        if(item != null)
-        {
-            return getPrevLayoutObjectOfItem(null, item);
-        }
-        return null;
-    }
-
-    /**
-     * Update item state in form.
-     *
-     * @param item
-     * @param updateReason
-     * @param param additional parameter
-     */
-    void updateItemState(Item item, int updateReason, Object param)
-    {
-        Logger.method(this, "updateItemState", item,
-                      String.valueOf(updateReason), param);
-
-        // Clean reason - without resizing flags
-        int reason = updateReason & Item.UPDATE_REASON_MASK;
-        switch(reason)
-        {
-        case Item.UPDATE_NONE:
-            break;
-        case Item.UPDATE_ADDCOMMAND:
-        {
-            if(isFormCurrent() && param != null)
-            {
-                LayoutObject lo = getFirstLayoutObjectOfItem(item);
-                if(lo != null && param instanceof Command)
-                {
-                    lo.addCommand((Command) param);
-                }
-            }
-            break;
-        }
-        case Item.UPDATE_REMOVECOMMAND:
-        {
-            if(isFormCurrent() && param != null)
-            {
-                LayoutObject lo = getFirstLayoutObjectOfItem(item);
-                if(lo != null && param instanceof Command)
-                {
-                    lo.removeCommand((Command) param);
-                }
-            }
-            break;
-        }
-        default:
-        {
-            LayoutObject lo = getFirstLayoutObjectOfItem(item);
-            if(lo != null)
-            {
-                getLayouter(item).updateItem(item, lo.getControl(), reason,
-                                             param);
-            }
-            break;
-        }
-        }
-
-        // Check this always - because this is a flag
-        if((updateReason & Item.UPDATE_HEIGHT_CHANGED)
-                == Item.UPDATE_HEIGHT_CHANGED)
-        {
-            resizeItemAndShift(item);
-        }
-    }
-
-    int eswtGetMaxVPosition()
-    {
-        return formComposite.getSize().y - getFormHeight();
-    }
-
-    /**
-     * Called by key Form to compute new vertical coordinate to position form's
-     * content.
-     *
-     * @param swtDir scrolling direction.
-     * @return New vertical position of Form's content.
-     */
-    protected int getNextScrollingPosition(int swtDir)
-    {
-        boolean scrollDown = (swtDir == SWT.ARROW_DOWN
-                              || swtDir == SWT.ARROW_RIGHT);
-        int formHeight = getFormHeight();
-        int refPoint;
-        int ret = vPosition;
-        if(scrollDown)
-        {
-            ret += formHeight / 5;
-            refPoint = (vPosition + 1) + formHeight;
-        }
-        else
-        {
-            ret -= formHeight / 5;
-            refPoint = (vPosition - 1);
-        }
-
-        Row row = null;
-        for(int i = 0; i < getRowCount(); i++)
-        {
-            row = getRow(i);
-            if(row.isInsideRow(refPoint)
-                    && (row.getRowHeight() < formHeight))
-            {
-                if(scrollDown)
-                {
-                    ret = row.getBottomPosition() - formHeight;
-                }
-                else
-                {
-                    ret = row.getYShift();
-                }
-                break;
-            }
-        }
-
-        return ret;
-    }
-
-    /**
-     * Set the scrolling to the specified position.<br>
-     * This method also updates the Form's scrollbars.
-     *
-     * @param position new position
-     */
-    void eswtSetScrollingPosition(int position, boolean keyNav)
-    {
-        // check constraints
-        int newVPosition = position;
-        int maxVPos = eswtGetMaxVPosition();
-        newVPosition = Math.min(newVPosition, maxVPos);
-        newVPosition = Math.max(newVPosition, 0);
-
-        vPosition = newVPosition;
-        formComposite.setRedraw(false);
-        formComposite.setOrigin(0, vPosition, keyNav);
-        formComposite.pack();
-        formComposite.setRedraw(true);
-
-        eswtHandleVisibilityChanges();
-    }
-
-    /**
-     * Returns the scrolling position.
-     */
-    protected int getScrollingPosition()
-    {
-        return vPosition;
-    }
-
-    /**
-     * Updates visibility status of all items.
-     */
-    protected void eswtHandleVisibilityChanges()
-    {
-        // Logger.method(this, "eswtHandleVisibilityChanges");
-        boolean shown = false;
-        Item item = null;
-        LayoutObject lo = null;
-        // Go through all LayoutObjects and check/update visibilities
-        while((lo = getNextLayoutObjectOfItem(lo, null)) != null)
-        {
-            // check if owning item is changing
-            if(lo.getOwningItem() != item)
-            {
-                if(item != null)
-                {
-                    // set current item's visibility
-                    getLayouter(item).eswtHandleVisibilityChange(item, shown);
-                }
-                // new item
-                item = lo.getOwningItem();
-                shown = false;
-            }
-
-            // track current item's visibility
-            if(!shown && isFormCurrent() && isPartiallyVisible(lo))
-            {
-                shown = true;
-            }
-        }
-
-        // call it for last item
-        if(item != null)
-        {
-            getLayouter(item).eswtHandleVisibilityChange(item, shown);
-        }
-    }
-
-    /**
-     * Changes item size and does shift of all Rows.
-     *
-     * @param item - item to changeSize.
-     */
-    void resizeItemAndShift(final Item item)
-    {
-        ESWTUIThreadRunner.syncExec(new Runnable()
-        {
-            public void run()
-            {
-                int newVPosition = eswtResizeItemAndShift(item);
-                if(newVPosition != vPosition)
-                {
-                    eswtSetScrollingPosition(newVPosition, true);
-                }
-                else
-                {
-                    eswtHandleVisibilityChanges();
-                }
-            }
-        });
-    }
-
-    /**
-     * eSWT callback for resizeItemAndShift.
-     *
-     * @param item Item to be resized.
-     * @return new scrolling vPosition
-     */
-    int eswtResizeItemAndShift(Item item)
-    {
-        Row row = getLastRowOfItem(item);
-        int deltaYShift = row.getRowHeight();
-        // if we un-comment this then when we set true,
-        // focus will jump to first item.
-        // eswtUpdateFormComposite(false);
-        LayoutObject lo = getFirstLayoutObjectOfItem(item);
-        if(lo != null)
-        {
-            getLayouter(item).eswtResizeObject(lo);
-        }
-
-        eswtUpdateRow(row);
-
-        /*
-        // to avoid double call of updateRowInternals
-        if (row.getNumLayoutObjects(Item.LAYOUT_SHRINK) > 0
-                || row.getNumLayoutObjects(Item.LAYOUT_EXPAND) > 0) {
-            eswtUpdateRow(row);
-        }
-        else {
-            row.updateRowInternals();
-        }
-        */
-        deltaYShift = row.getRowHeight() - deltaYShift;
-        // row's height change - all remaining rows are shifted with this.
-
-        Row lastRow = getLastRow();
-        if(row != lastRow)
-        {
-            for(int i = rows.indexOf(row) + 1; i < getRowCount(); i++)
-            {
-                row = getRow(i);
-                row.setYShift(row.getYShift() + deltaYShift);
-                eswtUpdateRow(row);
-            }
-        }
-
-        // following code updates scrolling if needed.
-        // need to check where in the form resize happeneed.
-
-        int itemRowYShift = getLastRowOfItem(item).getYShift();
-        // vPosition should be changed in syncexec
-        int newVPosition = vPosition;
-
-        // we need to scroll only if changes happened above the screen.
-        if(newVPosition >= itemRowYShift)
-        {
-            newVPosition = Math.max(0, newVPosition + deltaYShift);
-        }
-        // check to avoid gap in the bottom of the form
-        if(newVPosition + getFormHeight() > lastRow.getBottomPosition())
-        {
-            newVPosition = Math.max(0,
-                                    lastRow.getBottomPosition() - getFormHeight());
-        }
-
-        eswtUpdateFormComposite(true);
-
-        // formComposite.pack();
-        // formComposite.updateScrollbarSize(lastRow.getBottomPosition());
-
-        return newVPosition;
-    }
-
-    /**
-     * Gets layouter that can layout the specified item.
-     *
-     * @param item Item to be layouted.
-     * @return ItemLayouter or null if no Layouter found.
-     */
-    protected final ItemLayouter getLayouter(Item item)
-    {
-        if(item instanceof StringItem)
-        {
-            return sIL;
-        }
-        else if(item instanceof ImageItem)
-        {
-            return imIL;
-        }
-        else if(item instanceof Gauge)
-        {
-            return gL;
-        }
-        else if(item instanceof TextField)
-        {
-            return tfL;
-        }
-        else if(item instanceof DateField)
-        {
-            return dfL;
-        }
-        else if(item instanceof ChoiceGroup)
-        {
-            return cgL;
-        }
-        else if(item instanceof CustomItem)
-        {
-            return ciL;
-        }
-        else if(item instanceof Spacer)
-        {
-            return sL;
-        }
-        return null;
-    }
-
-    /**
-     * Returns eSWT Control that represents the item specified.
-     */
-    Control getItemControl(final Item item)
-    {
-        final LayoutObject lo = getFirstLayoutObjectOfItem(item);
-        if(lo != null)
-        {
-            ESWTUIThreadRunner.syncExec(new Runnable()
-            {
-                public void run()
-                {
-                    itemMainControl = getLayouter(item)
-                                      .eswtFindSpecificControl(item, lo.getControl());
-                }
-            });
-            return itemMainControl;
-        }
-        return null;
-    }
-
-    void updateScrolling(final int value, final boolean keyNav)
-    {
-        Logger.method("updateScrolling", String.valueOf(value));
-        ESWTUIThreadRunner.syncExec(new Runnable()
-        {
-            public void run()
-            {
-
-                eswtSetScrollingPosition(value, keyNav);
-
-            }
-        });
-    }
-
-    /**
-     * Get current scrolling value.
-     *
-     * @return vPosition.
-     */
-    int getVPosition()
-    {
-        return vPosition;
-    }
-
-}
--- a/javauis/lcdui_qt/src/javax/microedition/lcdui/Display.java	Tue Jul 06 14:10:26 2010 +0300
+++ b/javauis/lcdui_qt/src/javax/microedition/lcdui/Display.java	Wed Aug 18 09:43:15 2010 +0300
@@ -201,12 +201,12 @@
      */
     public int eswtNumColors()
     {
-
-        final int MAX_SHIFT = 30;
+        final int MAX_SHIFT = 24;
 
         Screen[] screens = MobileDevice.getMobileDevice().getScreens();
         Screen activeScreen = null;
         int depth = 0;
+
         if(screens != null)
         {
             for(int i = 0; i < screens.length; i++)
@@ -216,22 +216,20 @@
                     activeScreen = screens[i];
                 }
             }
+
             depth = activeScreen.getColorDepth();
-            if(depth > MAX_SHIFT)
+
+            if(depth >= MAX_SHIFT)
             {
-                numColors = Integer.MAX_VALUE;
+            	   // For 16 Million Colors
+                 numColors = (1 << 24);
             }
             else
             {
                 numColors = (1 << depth);
             }
         }
-        else
-        {
-            numColors = 0;
-        }
 
-        numColors = 2 << 16;
         return numColors;
     }
 
@@ -552,6 +550,9 @@
      */
     public int getBestImageWidth(int imgType)
     {
+        if ((imgType < LIST_ELEMENT) || (imgType > ALERT))
+            throw new IllegalArgumentException();
+
         return DisplayExtension.getBestImageWidth(imgType);
     }
 
@@ -563,6 +564,9 @@
      */
     public int getBestImageHeight(int imgType)
     {
+        if ((imgType < LIST_ELEMENT) || (imgType > ALERT))
+            throw new IllegalArgumentException();
+
         return DisplayExtension.getBestImageHeight(imgType);
     }
 
--- a/javauis/lcdui_qt/src/javax/microedition/lcdui/Displayable.java	Tue Jul 06 14:10:26 2010 +0300
+++ b/javauis/lcdui_qt/src/javax/microedition/lcdui/Displayable.java	Wed Aug 18 09:43:15 2010 +0300
@@ -28,7 +28,6 @@
 import org.eclipse.swt.internal.extension.MobileShellExtension;
 import org.eclipse.swt.widgets.*;
 import com.nokia.mj.impl.rt.support.ApplicationUtils;
-import com.nokia.mj.impl.rt.support.ApplicationInfo;
 
 /**
  * Implementation of LCDUI <code>Displayable</code> class.
@@ -130,6 +129,7 @@
                 eswtSetTitle();
                 contentComp = eswtConstructContent(SWT.NONE);
                 contentArea = eswtLayoutShellContent();
+                eswtInitGraphics();
             }
         });
     }
@@ -184,6 +184,13 @@
     }
 
     /**
+     * Initializes the Displayable for Graphics drawing. 
+     */
+    void eswtInitGraphics() {
+    
+    }
+    
+    /**
      * Called by Display when Displayable should become visible.
      */
     void eswtHandleShowCurrentEvent()
--- a/javauis/lcdui_qt/src/javax/microedition/lcdui/ESWTUIThreadRunner.java	Tue Jul 06 14:10:26 2010 +0300
+++ b/javauis/lcdui_qt/src/javax/microedition/lcdui/ESWTUIThreadRunner.java	Wed Aug 18 09:43:15 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2009, 2010 Nokia Corporation and/or its subsidiary(-ies).
 * All rights reserved.
 * This component and the accompanying materials are made available
 * under the terms of "Eclipse Public License v1.0"
@@ -30,27 +30,19 @@
 /**
  * Singleton class which is responsible to run the eSWT UI thread. This class is
  * also access-point to eSWT's Display-class.<br>
- * <br>
- * UI thread is started in static initialization block. If another UI Thread is
- * created before that the run()-method will fail and this class won't try to
- * run UI thread anymore. Instead, existing UI-thread will be used to run LCDUI.
- * <br>
- * <br>
- * Note that the method getDisplay() will still work normally.<br>
- * <br>
- * Also note that if the other thread which is running eSWT stops executing then
- * this class stops working too.
  */
 final class ESWTUIThreadRunner implements Listener, ShutdownListener, Runnable
 {
-
+    // States of the UI event loop
     private static final int NONE = 1;
     private static final int CREATING = 2;
     private static final int RUNNING = 4;
     private static final int EXITING = 8;
     private static final int ALL = NONE | CREATING | RUNNING | EXITING;
 
+    // Singleton instance
     private static ESWTUIThreadRunner instance;
+
     private static int lastKeyScancode;
     private static int lastKeyModifier;
     private static int keyRepeatCount;
@@ -60,6 +52,12 @@
 
     private Object lock = new Object();
 
+    // For synchronously shutting down
+    private Object uiThreadShutdownLock = new Object();
+    private boolean uiThreadStarted;
+    private boolean uiThreadShutdownRequested;
+    private boolean uiThreadExitNotified;
+
     private Display display;
     private int state = NONE;
 
@@ -70,12 +68,6 @@
 
         // Create dispose storage to clean up newly created Fonts and Images.
         ds = new DisposeStorage();
-
-        // Starting thread here makes sure that eSWT services
-        // are always available when they are needed.
-
-        // uiThread = new Thread(getInstance(), UI_THREAD_NAME);
-        // uiThread.start();
     }
 
     /**
@@ -83,7 +75,7 @@
      */
     private ESWTUIThreadRunner()
     {
-        Logger.info("Starting up");
+        Logger.info("ESWTUIThreadRunner: Starting up");
 
         // TODO: check if the startUI throws RuntimeException on already
         // existing UI thread
@@ -259,7 +251,7 @@
         {
         case SWT.Close:
         {
-            Logger.info("Close event");
+            Logger.info("ESWTUIThreadRunner: Close event");
             // Check if the No-Exit attribute is set
             if(JadAttributeUtil.isValue(JadAttributeUtil.ATTRIB_NOKIA_MIDLET_NO_EXIT, JadAttributeUtil.VALUE_TRUE))
             {
@@ -302,20 +294,91 @@
      */
     public void shuttingDown()
     {
-        Logger.info("Shutting Down");
-        EventDispatcher.instance().terminate(new Runnable()
+        Logger.info("ESWTUIThreadRunner: Shutdown requested, performing synchronous shutdown");
+
+        synchronized(uiThreadShutdownLock)
         {
-            public void run()
+            // Set a flag that prevents the UI thread from starting the event
+            // loop if it hasn't done that yet.
+            uiThreadShutdownRequested = true;
+
+            Logger.info("ESWTUIThreadRunner: Asynchronously signalling LCDUI event dispatcher to exit");
+            EventDispatcher.instance().terminate(new Runnable()
             {
-                changeState(EXITING);
+                public void run()
+                {
+                    Logger.info("ESWTUIThreadRunner: LCDUI event dispatcher signalled having completed its exit procedure, initiating UI event loop exit");
+                    changeState(EXITING);
+                }
+            });
+
+            // Wait until UI cleanup completes.
+            try {
+                // Don't wait if the UI thread hasn't started.
+                if(!uiThreadStarted)
+                {
+                    Logger.info("ESWTUIThreadRunner: The UI thread has not been started, shutdown complete");
+                    return;
+                }
+                // Don't wait if the UI thread already went past the exit
+                // notification phase.
+                if(uiThreadExitNotified)
+                {
+                    Logger.info("ESWTUIThreadRunner: The UI thread has notified having exited, no need to wait, shutdown complete");
+                    return;
+                }
+
+                // The UI thread is running, wait for it to exit
+                Logger.info("ESWTUIThreadRunner: Waiting for the UI thread to exit");
+                uiThreadShutdownLock.wait(3000);
+
+                if(uiThreadExitNotified)
+                {
+                    Logger.info("ESWTUIThreadRunner: The UI thread notified having completed its exit procedure");
+                }
+                else
+                {
+                    Logger.error("ESWTUIThreadRunner: UI thread exit wait timed out");
+                    return;
+                }
             }
-        });
+            catch(InterruptedException e)
+            {
+                Logger.error("ESWTUIThreadRunner: The wait for the UI thread to exit was interrupted");
+            }
+        }
+        Logger.info("ESWTUIThreadRunner: Synchronous UI shutdown is complete");
+    }
+
+    /*
+     * The entry point of the UI thread.
+     */
+    public void run() {
+        try {
+            synchronized(uiThreadShutdownLock)
+            {
+                uiThreadStarted = true;
+                if(uiThreadShutdownRequested)
+                {
+                    return;
+                }
+            }
+            runEventLoop();
+        }
+        finally
+        {
+            synchronized(uiThreadShutdownLock)
+            {
+                uiThreadExitNotified = true;
+                uiThreadShutdownLock.notifyAll();
+            }
+        }
     }
 
     /**
-     * Creates new eSWT Display and runs eSWT UI-thread.
+     * Creates new eSWT Display and runs eSWT UI event loop.
      */
-    public void run()
+    private void runEventLoop()
     {
         changeState(CREATING);
         onStartup();
@@ -340,19 +403,19 @@
                     if(t != null && t instanceof RuntimeException)
                     {
                         // this might be an expected exception of safeSyncExec
-                        Logger.warning("eSWT Thread Exception: " + ex);
+                        Logger.warning("ESWTUIThreadRunner: eSWT Thread Exception: " + ex);
                         // t.printStackTrace();
                     }
                 }
                 else
                 {
-                    Logger.error("eSWT Thread Exception: " + ex);
+                    Logger.error("ESWTUIThreadRunner: eSWT Thread Exception: " + ex);
                     ex.printStackTrace();
                 }
             }
             catch(Error er)
             {
-                Logger.error("eSWT Thread Error" + er);
+                Logger.error("ESWTUIThreadRunner: eSWT Thread Error" + er);
                 er.printStackTrace();
             }
         }
@@ -370,7 +433,7 @@
 
     private void changeState(int newstate)
     {
-        Logger.info(getStateString(state) + " --> " + getStateString(newstate));
+        Logger.info("ESWTUIThreadRunner: Event loop state: " + getStateString(state) + " --> " + getStateString(newstate));
         if(display != null)
         {
             try
@@ -454,6 +517,4 @@
         }
         finalizers.clear();
     }
-
-
 }
--- a/javauis/lcdui_qt/src/javax/microedition/lcdui/Form.java	Tue Jul 06 14:10:26 2010 +0300
+++ b/javauis/lcdui_qt/src/javax/microedition/lcdui/Form.java	Wed Aug 18 09:43:15 2010 +0300
@@ -34,7 +34,7 @@
     /**
      * Abstract layouting policy.
      */
-    private FormLayoutPolicy layoutPolicy;
+    private FormLayouter formLayouter;
 
     /**
      * Item vector.
@@ -69,7 +69,7 @@
     {
         super(title);
         construct();
-        layoutPolicy = new DefaultFormInteraction(this);
+        formLayouter = new FormLayouter(this);
     }
 
     /**
@@ -117,7 +117,7 @@
         {
             vBar.addSelectionListener(fsbl);
         }
-        layoutPolicy.handleShowCurrentEvent();
+        formLayouter.handleShowCurrentEvent();
     }
 
     /* (non-Javadoc)
@@ -132,7 +132,7 @@
         {
             vBar.removeSelectionListener(fsbl);
         }
-        layoutPolicy.handleHideCurrentEvent();
+        formLayouter.handleHideCurrentEvent();
     }
 
     /* (non-Javadoc)
@@ -147,7 +147,7 @@
             formComposite.setOrigin(0, 0, true);
             formComposite.setSize(width, height);
             formComposite.setRedraw(true);
-            layoutPolicy.handleResizeEvent(width, height);
+            formLayouter.handleResizeEvent(width, height);
             resetLayoutTimer(0);
         }
     }
@@ -166,7 +166,7 @@
         }
         else
         {
-            layoutPolicy.handleKeyEvent(e.keyCode, e.type);
+            formLayouter.handleKeyEvent(e.keyCode, e.type);
         }
     }
 
@@ -189,7 +189,7 @@
                 MsgRepository.FORM_EXCEPTION_ITEM_OWNED_BY_CONTAINER);
         }
         int returnValue = -1;
-        synchronized(layoutPolicy)
+        synchronized(formLayouter)
         {
             item.setParent(this);
             items.addElement(item);
@@ -255,7 +255,7 @@
             throw new IndexOutOfBoundsException(
                 MsgRepository.FORM_EXCEPTION_INVALID_ITEM_INDEX);
         }
-        synchronized(layoutPolicy)
+        synchronized(formLayouter)
         {
             item.setParent(this);
             items.insertElementAt(item, position);
@@ -276,9 +276,11 @@
             throw new IndexOutOfBoundsException(
                 MsgRepository.FORM_EXCEPTION_INVALID_ITEM_INDEX);
         }
-        synchronized(layoutPolicy)
+        synchronized(formLayouter)
         {
-            ((Item) items.elementAt(position)).setParent(null);
+        	Item item = ((Item) items.elementAt(position));
+            item.clearParent();
+        	formLayouter.removeLayoutObject(item);			
             items.removeElementAt(position);
             resetLayoutTimer(position - 1);
         }
@@ -289,11 +291,13 @@
      */
     public void deleteAll()
     {
-        synchronized(layoutPolicy)
+        synchronized(formLayouter)
         {
             for(int i = 0; i < items.size(); i++)
             {
-                ((Item) items.elementAt(i)).setParent(null);
+	        	Item item = ((Item) items.elementAt(i));
+                item.clearParent();
+	        	formLayouter.removeLayoutObject(item);
             }
             items.removeAllElements();
             resetLayoutTimer(0);
@@ -324,11 +328,13 @@
             throw new IndexOutOfBoundsException(
                 MsgRepository.FORM_EXCEPTION_INVALID_ITEM_INDEX);
         }
-        synchronized(layoutPolicy)
+        synchronized(formLayouter)
         {
             newItem.setParent(this);
             // clear reference to a form for "old" item.
-            get(position).setParent(null);
+            Item oldItem = get(position);
+			oldItem.clearParent();
+			formLayouter.removeLayoutObject(oldItem);
             items.setElementAt(newItem, position);
             resetLayoutTimer(position);
         }
@@ -344,7 +350,7 @@
     public Item get(int position)
     {
         Item returnItem = null;
-        synchronized(layoutPolicy)
+        synchronized(formLayouter)
         {
             try
             {
@@ -386,7 +392,7 @@
      */
     void setCurrentItem(Item item)
     {
-        layoutPolicy.setCurrentItem(item);
+        formLayouter.setCurrentItem(item);
     }
 
     /**
@@ -419,30 +425,24 @@
      * @param updateReason
      * @param param additional parameter
      */
-    void updateItemState(Item item, int updateReason, Object param)
-    {
-        if(item != null && item.getParent() == this)
-        {
-            if((updateReason & Item.UPDATE_WIDTH_CHANGED) != 0)
-            {
-                synchronized(layoutPolicy)
-                {
-                    resetLayoutTimer(items.indexOf(item));
-                }
-            }
-            else
-            {
-                if(layoutPolicy instanceof DefaultFormInteraction)
-                {
-                    if(layoutTimer != null)
-                    {
-                        ((DefaultFormInteraction) layoutPolicy)
-                        .updateItemState(item, updateReason, param);
-                    }
-                }
-            }
-        }
-    }
+	void updateItemState(Item item, int updateReason, Object param)
+	{
+		if(item != null && item.getParent() == this)
+		{
+			if(layoutTimer != null)
+			{
+				formLayouter.updateItemState(item, updateReason, param);
+			}
+			
+			if((updateReason & Item.UPDATE_SIZE_CHANGED) != 0)
+			{
+				synchronized(formLayouter)
+				{
+					resetLayoutTimer(items.indexOf(item));
+				}
+			}
+		}
+	}
 
     /**
      * Get Vector of items.
@@ -464,13 +464,13 @@
 
 
     /**
-     * Returns form layout policy.
+     * Returns form Form Layouter.
      * @return Reference to layout policy.
      *
      */
-    FormLayoutPolicy getLayoutPolicy()
+    FormLayouter getFormLayouter()
     {
-        return layoutPolicy;
+        return formLayouter;
     }
 
     // =========================================================================
@@ -483,7 +483,7 @@
         super(title);
         construct();
         layoutLR = leftRightLanguage;
-        layoutPolicy = new DefaultFormInteraction(this);
+        formLayouter = new FormLayouter(this);
     }
 
     // =========================================================================
@@ -510,13 +510,30 @@
             }
             // schedule new timer
             startIndex = Math.max(0, Math.min(newStartIndex, startIndex));
-            // layoutPolicy.layoutForm(startIndex);
+            // formLayouter.layoutForm(startIndex);
             formTimerTask = new FormTimerTask(startIndex);
             layoutTimer.schedule(formTimerTask, Config.FORM_LAYOUT_TIMER_DELAY);
         }
     }
 
     /**
+     * Cancel Layout Timer.
+     */
+    private void cancelLayoutTimer()
+    {
+        if(layoutTimer != null)
+        {
+            if(formTimerTask != null)
+            {
+                formTimerTask.cancel();
+                formTimerTask = null;
+            }
+            layoutTimer.cancel();
+			layoutTimer = null;
+        }
+    }
+
+    /**
      * Form Timer task. Triggers the formComposite to Layout.
      */
     class FormTimerTask extends TimerTask
@@ -532,7 +549,7 @@
         public void run()
         {
             Logger.method(Form.this, "layout");
-            layoutPolicy.layoutForm(index);
+            formLayouter.layoutForm(index);
             startIndex = items.size();
         }
 
@@ -550,7 +567,7 @@
                 Point p = ((Control) e.widget).toDisplay(new Point(e.x, e.y));
                 // translate display coordinates to composite coordinates
                 p = formComposite.toControl(p);
-                layoutPolicy.handlePointerEvent(p.x, p.y, e.type);
+                formLayouter.handlePointerEvent(p.x, p.y, e.type);
             }
         }
     }*/
@@ -568,7 +585,7 @@
         public void widgetSelected(SelectionEvent se)
         {
             ScrollBar sb = (ScrollBar) se.widget;
-            layoutPolicy.updateScrolling(sb.getSelection(), false);
+            formLayouter.updateScrolling(sb.getSelection(), false);
         }
     }
 
@@ -577,12 +594,12 @@
      */
     void dispose()
     {
+        cancelLayoutTimer();
         super.dispose();
-        layoutTimer.cancel();
-        layoutTimer = null;
         deleteAll();
-        ((DefaultFormInteraction) layoutPolicy).dispose();
-        layoutPolicy = null;
+        formLayouter.dispose();
+		items = null;
+        formLayouter = null;
     }
 
     /*
@@ -593,7 +610,7 @@
         if((event.type & LCDUIEvent.CUSTOMITEMBIT) != 0)
         {
             // Synchronize with Form content modification operations.
-            synchronized(layoutPolicy)
+            synchronized(formLayouter)
             {
                 // If the eSWT widget has been explicitly disposed while the event
                 // was in the queue then ignore the event.
--- a/javauis/lcdui_qt/src/javax/microedition/lcdui/FormLayoutPolicy.java	Tue Jul 06 14:10:26 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,89 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-package javax.microedition.lcdui;
-
-abstract class FormLayoutPolicy
-{
-
-    /**
-     * Layouts the Form.
-     *
-     * @param startItem item from which to start Layout;
-     */
-    abstract void layoutForm(int startItem);
-
-    /**
-     * Set focus to an item.
-     */
-    abstract void setCurrentItem(Item item);
-
-    /**
-     * Called when Form becomes current Displayable.
-     */
-    abstract void handleShowCurrentEvent();
-
-    /**
-     * Called when Form stops being current Displayable.
-     */
-    abstract void handleHideCurrentEvent();
-
-    /**
-     * Called when Form is being resized.
-     *
-     * @param width new width
-     * @param height new height
-     */
-    abstract void handleResizeEvent(int width, int height);
-
-    /**
-     * Handle key event.
-     *
-     * @param keyCode key
-     * @param keyType type
-     */
-    abstract void handleKeyEvent(int keyCode, int keyType);
-
-    /**
-     * Handle pointer event.
-     *
-     * @param x coordinate relative to scrolledComposite
-     * @param y coordinate relative to scrolledComposite
-     * @param type event type: SWT.MouseDown, SWT.MouseMove, SWT.MouseUp
-     */
-    abstract void handlePointerEvent(int x, int y, int type);
-
-    /**
-     * Set scrolling of form composite.
-     */
-    abstract void updateScrolling(int value, boolean keyNavi);
-
-    /**
-     * Get the layouted conrol of an item.
-     *
-     * @param item item
-     * @return layouted control
-     */
-    abstract org.eclipse.swt.widgets.Control getItemControl(Item item);
-
-    /**
-     * Gets layouter that can layout the specified item.
-     *
-     * @param item Item to be layouted.
-     * @return ItemLayouter or null if no Layouter found.
-     */
-    abstract ItemLayouter getLayouter(Item item);
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/lcdui_qt/src/javax/microedition/lcdui/FormLayouter.java	Wed Aug 18 09:43:15 2010 +0300
@@ -0,0 +1,2060 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+package javax.microedition.lcdui;
+
+import java.util.NoSuchElementException;
+import java.util.Vector;
+import java.util.Enumeration;
+import java.util.Timer;
+import java.util.TimerTask;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+
+/**
+ * FormLayouter implements form layout algorithm.
+ */
+class FormLayouter
+{
+
+    /**
+     * Form instance (not owned).
+     */
+    private Form form;
+
+    /**
+     * Form's scrolled composite (not owned).
+     */
+    protected ScrolledComposite formComposite;
+
+    /**
+     * Controls vector.
+     */
+    private Vector layoutObjects = new Vector();
+
+    /**
+     * Rows vector.
+     */
+    private Vector rows = new Vector();
+
+    /**
+     * Form's current horizontal alignment
+     */
+    private int currentHLayoutDirective;
+
+    private ImageItemLayouter imIL;
+
+    private StringItemLayouter sIL;
+
+    private GaugeLayouter gL;
+
+    private TextFieldLayouter tfL;
+
+    private DateFieldLayouter dfL;
+
+    private ChoiceGroupLayouter cgL;
+
+    private CustomItemLayouter ciL;
+
+    private SpacerLayouter sL;
+
+    private int vPosition;
+
+    private Item deferredScrollToItem;
+
+    private boolean isCurrent;
+
+    private Control itemMainControl;
+
+    private static final int NO_DIRECTION = -1;
+
+    private Item currentSelectedItem;
+
+    private int direction = NO_DIRECTION;
+
+    private boolean mousePressed;
+
+    private LayoutObject currentlyUnderMouse;
+
+
+    /**
+     * Constructor.
+     *
+     * @param form Form to perform layout on.
+     */
+    FormLayouter(Form form)
+    {
+        this.form = form;
+        formComposite = form.getFormComposite();
+        imIL = new ImageItemLayouter(this);
+        sIL = new StringItemLayouter(this);
+        gL = new GaugeLayouter(this);
+        dfL = new DateFieldLayouter(this);
+        tfL = new TextFieldLayouter(this);
+        cgL = new ChoiceGroupLayouter(this);
+        ciL = new CustomItemLayouter(this);
+        sL = new SpacerLayouter(this);
+    }
+
+    /**
+     * Dispose and cleanup layouted items.
+     */
+    void dispose()
+    {
+        ESWTUIThreadRunner.syncExec(new Runnable()
+        {
+            public void run()
+            {
+                eswtClearRows(0, null);
+    			removeAllLayoutObjects();
+				rows = null;
+				layoutObjects = null;
+            }
+        });
+    }
+
+    /**
+     * Log out a control with all its children at the given indentation level.
+     */
+    void logControl(int level, Control control)
+    {
+        if(control != null)
+        {
+            String s2 = control.toString();
+            s2 = s2.substring(0, s2.indexOf('}') - 1);
+            String s3 = control.getBounds().toString();
+            s3 = s3.substring(s3.indexOf('{'));
+            Logger.verbose(Logger.indent(s2 + s3, level * 2));
+            if(control instanceof Composite)
+            {
+                Control[] arr = ((Composite) control).getChildren();
+                for(int i = 0; i < arr.length; i++)
+                {
+                    logControl(level + 1, arr[i]);
+                }
+            }
+        }
+    }
+
+    /**
+     * Log out all layoutobjects for each item.
+     */
+    void logFormLayout()
+    {
+        Logger.verbose(form + " ---------------------------------------------");
+        LayoutObject lo = null;
+        Item item = null;
+        int line = -1;
+        while((lo = getNextLayoutObjectOfItem(lo, null)) != null)
+        {
+            if(lo.getOwningItem() != item)
+            {
+                item = lo.getOwningItem();
+                Logger.verbose(item.toString());
+            }
+            if(lo.getRowIdx() != line)
+            {
+                line = lo.getRowIdx();
+            }
+            Logger.verbose(Logger.indent("Row:" + lo.getRowIdx(), 2));
+            logControl(2, lo.getControl());
+        }
+        Logger.verbose(form + " ---------------------------------------------");
+    }
+
+    /**
+     * Called when Form is about to be shown.<br>
+     * NOTE: this is called from eSWT UI-thread
+     */
+    void handleShowCurrentEvent()
+    {
+        Logger.method(this, "handleShowCurrentEvent");
+        isCurrent = true;
+
+        // restore our scrolling position (eSWT resets it to 0 by default)
+        eswtSetScrollingPosition(vPosition, true);
+
+        Item item = null;
+        LayoutObject lo = null;
+        while((lo = getNextLayoutObjectOfItem(lo, null)) != null)
+        {
+            if(lo.getOwningItem() != item)
+            {
+                // item border
+                item = lo.getOwningItem();
+                getItemLayouter(item).eswtAddListeners(item, lo);
+            }
+        }
+
+		eswtApplyCurrentFocus();	
+    }
+
+    /**
+     * Called when Form is about to be hidden.<br>
+     * NOTE: this is called from eSWT UI-thread
+     */
+    void handleHideCurrentEvent()
+    {
+        Logger.method(this, "handleHideCurrentEvent");
+        isCurrent = false;
+
+        Item item = null;
+        LayoutObject lo = null;
+        while((lo = getNextLayoutObjectOfItem(lo, null)) != null)
+        {
+            if(lo.getOwningItem() != item)
+            {
+                // item border
+                item = lo.getOwningItem();
+                getItemLayouter(item).eswtRemoveListeners(item, lo);
+                getItemLayouter(item).eswtHandleVisibilityChange(item, false);
+            }
+        }
+
+		direction = NO_DIRECTION;
+    }
+
+    /**
+     * Called when Form is beeing resized.<br>
+     * NOTE: this is called from eSWT UI-thread
+     */
+    void handleResizeEvent(int width, int height)
+    {
+        // Logger.method(this, "handleResizeEvent");
+        int numitems = getItemCount();
+        for(int i = 0; i < numitems; i++)
+        {
+            getItem(i).invalidateCachedSizes();
+        }
+        ItemLayouter.eswtUpdateStaticShellSize(width, height);
+    }
+
+    /**
+     * Do form layout according to startIndex.
+     *
+     * @param startItem - index of item which need to be layouted.
+     */
+    void layoutForm(final int startIndex)
+    {
+        ESWTUIThreadRunner.syncExec(new Runnable()
+        {
+            public void run()
+            {
+                eswtLayoutForm(startIndex);
+            }
+        });
+    }
+
+    /**
+     * eSWT callback for doLayout().
+     */
+    void eswtLayoutForm(int startIndex)
+    {
+        int numItems = getItemCount();
+        Logger.method(this, "eswtLayoutForm", startIndex + " / " + numItems);
+
+        eswtUpdateFormComposite(false);
+        if(numItems > 0)
+        {
+            Item previousItem = null;
+            int startRowIndex = 0;
+
+            if(startIndex > 0)
+            {
+                // Find row with previous item.
+                previousItem = getItem(startIndex - 1);
+                Row prevItemRow = getLastRowOfItem(previousItem);
+                if(prevItemRow != null)
+                {
+                    startRowIndex = rows.indexOf(prevItemRow);
+                }
+            }
+
+            // Clear rows starting from item - partial re-layouting
+            eswtClearRows(startRowIndex, previousItem);
+            // Layout items
+            for(int i = startIndex; i < numItems; i++)
+            {
+                eswtLayoutItem(getItem(i));
+            }
+            // Update last row
+            eswtUpdateRow(getLastRow());
+        }
+        else
+        {
+            eswtClearRows(0, null);
+        }
+        // check if we need to scroll to a particular item
+        if(deferredScrollToItem != null)
+        {
+            eswtSetCurrentItem(deferredScrollToItem);
+            deferredScrollToItem = null;
+        }
+        eswtUpdateFormComposite(true);
+        eswtHandleVisibilityChanges();
+
+        if(Logger.isLogVerbose())
+        {
+            logFormLayout();
+        }
+
+		// clear invalid selected item
+		eswtCheckCurrentSelectedItem();
+		
+		if(currentSelectedItem != null
+				&& (currentSelectedItem.isFocusable()))
+		{
+			eswtApplyCurrentFocus();
+		}
+		else
+		{
+			// If there's no item currently selected try to find first
+			// focusable item and set it current (if found):
+			Item found = eswtGetNextFocusableItem(
+							 getItem(startIndex - 1), SWT.ARROW_RIGHT);
+			if(found != null)
+			{
+				eswtSetCurrentSelectedItem(found, NO_DIRECTION);
+			}
+			else
+			{
+				eswtApplyCurrentFocus();
+			}
+		}		
+    }
+
+    /**
+     * Returns if the parameter is a eSWT directional key code.
+     *
+     * @param keyCode key code
+     */
+    private boolean isDirectionKey(int keyCode)
+    {
+        return (keyCode == SWT.ARROW_DOWN || keyCode == SWT.ARROW_UP
+                || keyCode == SWT.ARROW_LEFT || keyCode == SWT.ARROW_RIGHT);
+    }
+
+    /**
+     * Handler for key events.<br>
+     * The implementation moves focus and/or scrolls the form when
+     * needed. The method is called by the Form.
+     *
+     * @param keyCode eSWT key code.
+     * @param keyType eSWT key type.
+     */
+    final void handleKeyEvent(int keyCode, int keyType)
+    {
+        Logger.method(this, "handleKeyEvent", currentSelectedItem,
+                      String.valueOf(keyCode), String.valueOf(keyType));
+
+        boolean isDirectionalKey = isDirectionKey(keyCode);
+        if(keyType == SWT.KeyDown && isDirectionalKey)
+        {
+            eswtCheckCurrentSelectedItem();
+        }
+
+        if(currentSelectedItem != null)
+        {
+            if(getItemLayouter(currentSelectedItem).eswtOfferKeyEvent(
+                        currentSelectedItem, keyCode, keyType))
+            {
+                // if the key has been consumed
+                return;
+            }
+        }
+
+        // scrolling/focus traverse only happens on directional key's down event
+        if(keyType == SWT.KeyDown && isDirectionalKey)
+        {
+            // try to find next focusable item
+            Item next = eswtGetNextFocusableItem(currentSelectedItem, keyCode);
+
+            // if no visible & focusable item was found to transfer focus
+            if(next == currentSelectedItem)
+            {
+                // try to scroll a bit
+                eswtSetScrollingPosition(getNextScrollingPosition(keyCode),
+                                         true);
+                // find next focusable after scrolling
+                next = eswtGetNextFocusableItem(currentSelectedItem, keyCode);
+            }
+
+            if(next != currentSelectedItem)
+            {
+                //textfield always have to be fully visible when focused.
+                if(next instanceof TextField)
+                {
+                    eswtScrollToItem(next);
+                }
+                eswtSetCurrentSelectedItem(next, keyCode);
+            }
+        }
+    }
+
+    /**
+     * Handler for pointer events.<br>
+     * The method is called by the Form.
+     *
+     * @param x coordinate relative to scrolledComposite
+     * @param y coordinate relative to scrolledComposite
+     * @param type event type: SWT.MouseDown, SWT.MouseMove, SWT.MouseUp
+     */
+    final void handlePointerEvent(int x, int y, int type)
+    {
+        Logger.method(this, "handlePointerEvent", String.valueOf(x),
+                      String.valueOf(y), String.valueOf(type));
+
+        // TODO: change when DirectUI style arrives.
+        /*
+        Item item;
+        if (type == SWT.MouseMove) {
+            if (currentlyUnderMouse == null
+                    || !currentlyUnderMouse.contains(x, y)) {
+                if (currentlyUnderMouse != null) {
+                    //currentlyUnderMouse.getControl().setCapture(false);
+                }
+                item = eswtFindItemUnderMouse(x, y);
+                if (item != null && item != currentSelectedItem
+                        && item.isFocusable()) {
+                    setCurrentItem(item);
+                    item.internalSetFocused(true);
+                    eswtSetCurrentSelectedItem(item);
+                    //following method causes all mouse events delivered to it
+
+                    currentlyUnderMouse.getControl().setCapture(true);
+                    Logger.warning("seting capture to:" + item);
+                }
+            }
+            int currentVPosition = getVPosition();
+            boolean isMouseDirectionUp = false;
+            boolean doScrolling = false;
+            int localY = y;
+
+            if (y <= currentVPosition) {
+                localY = Math.max(0, y);
+                eswtSetScrollingPosition(localY, true);
+                isMouseDirectionUp = true;
+                doScrolling = true;
+            }
+            else if (y > (currentVPosition + getFormHeight())) {
+                //check for maxVPosition
+                if (y > (eswtGetMaxVPosition() + getFormHeight())) {
+                    localY = eswtGetMaxVPosition() + getFormHeight();
+                }
+                else {
+                    localY = y;
+                }
+                currentVPosition = localY - getFormHeight();
+                eswtSetScrollingPosition(currentVPosition, true);
+
+                isMouseDirectionUp = false;
+                doScrolling = true;
+            }
+            if (mousePressed && doScrolling) {
+                resetEventTimer(isMouseDirectionUp, localY);
+            }
+        }
+        else
+        if (type == SWT.MouseDown) {
+            mousePressed = true;
+            item = eswtFindItemUnderMouse(x, y);
+            if (item != null && item != currentSelectedItem
+                    && item.isFocusable() && getForm().getShell() ==
+                        getForm().getShell().getDisplay().getActiveShell()) {
+                //eswtScrollToItem(item);
+                //following method causes all mouse events delivered to it
+
+                //currentlyUnderMouse.getControl().setCapture(true);
+            }
+        }
+        else if (type == SWT.MouseUp) {
+            mousePressed = false;
+            if (currentlyUnderMouse != null) {
+                //currentlyUnderMouse.getControl().setCapture(false);
+            }
+        }*/
+    }
+
+    /**
+     * Find item at the specified point.
+     *
+     * @param x coordinate.
+     * @param y coordinate.
+     * @return Item.
+     */
+    Item eswtFindItemUnderMouse(int x, int y)
+    {
+        Row itemRow;
+        for(int i = 0; i < getRowCount(); i++)
+        {
+            itemRow = getRow(i);
+            if(itemRow.getYShift() <= y && y <= itemRow.getBottomPosition())
+            {
+                LayoutObject lo;
+                for(int j = 0; j < itemRow.size(); j++)
+                {
+                    lo = itemRow.getLayoutObject(j);
+                    if(lo.contains(x, y))
+                    {
+                        Logger.info("Item under mouse: "
+                                    + lo.getOwningItem());
+                        currentlyUnderMouse = lo;
+                        return lo.getOwningItem();
+                    }
+                }
+                break;
+            }
+        }
+        return null;
+    }
+
+    /**
+     * Gets next (or nearest) focusable item.
+     *
+     * @param fromItem Item where to start to search the next focusable item.
+     * @param dir Search direction, one of the arrow key constants defined
+     *      in class SWT.
+     *
+     * @return Nearest focusable item or null if no item found.
+     */
+    final Item eswtGetNextFocusableItem(Item fromItem, int dir)
+    {
+        Item nextItem = fromItem;
+
+        switch(dir)
+        {
+        case SWT.ARROW_RIGHT:
+        {
+            LayoutObject obj = getLastLayoutObjectOfItem(fromItem);
+            while((obj = getNextLayoutObjectOfItem(obj, null)) != null)
+            {
+                Item owner = obj.getOwningItem();
+                if(owner != null && owner != fromItem
+                        && owner.isFocusable()
+                        && isPartiallyVisible(obj, Config.DFI_VISIBILITY_PERCENT))
+                {
+                    nextItem = owner;
+                    break;
+                }
+            }
+            break;
+        }
+
+        case SWT.ARROW_LEFT:
+        {
+            LayoutObject obj = getFirstLayoutObjectOfItem(fromItem);
+            while((obj = getPrevLayoutObjectOfItem(obj, null)) != null)
+            {
+                Item owner = obj.getOwningItem();
+                if(owner != null && owner != fromItem
+                        && owner.isFocusable()
+                        && isPartiallyVisible(obj, Config.DFI_VISIBILITY_PERCENT))
+                {
+                    nextItem = owner;
+                    break;
+                }
+            }
+            break;
+        }
+
+        case SWT.ARROW_DOWN:
+        {
+            int minDist = Integer.MAX_VALUE;
+            LayoutObject start = getLastLayoutObjectOfItem(fromItem);
+            LayoutObject obj = start;
+            while((obj = getNextLayoutObjectOfItem(obj, null)) != null)
+            {
+                Item owner = obj.getOwningItem();
+                if(owner != null && owner != fromItem
+                        && owner.isFocusable() && obj.isBelow(start)
+                        && isPartiallyVisible(obj, Config.DFI_VISIBILITY_PERCENT))
+                {
+                    int dist = obj.distanceTo(start);
+                    if(dist < minDist)
+                    {
+                        minDist = dist;
+                        nextItem = owner;
+                    }
+                }
+            }
+            break;
+        }
+
+        case SWT.ARROW_UP:
+        {
+            int minDist = Integer.MAX_VALUE;
+            LayoutObject start = getFirstLayoutObjectOfItem(fromItem);
+            LayoutObject obj = start;
+            while((obj = getPrevLayoutObjectOfItem(obj, null)) != null)
+            {
+                Item owner = obj.getOwningItem();
+                if(owner != null && owner != fromItem
+                        && owner.isFocusable() && obj.isAbove(start)
+                        && isPartiallyVisible(obj, Config.DFI_VISIBILITY_PERCENT))
+                {
+                    int dist = obj.distanceTo(start);
+                    if(dist < minDist)
+                    {
+                        minDist = dist;
+                        nextItem = owner;
+                    }
+                }
+            }
+            break;
+        }
+
+        default:
+        }
+
+        return nextItem;
+    }
+
+    /**
+     * Check if the currentSelectedItem is valid and visible. If not then it
+     * sets it to null.
+     */
+    final void eswtCheckCurrentSelectedItem()
+    {
+        if(currentSelectedItem != null)
+        {
+            if(currentSelectedItem.getParent() != getForm()
+                    || !currentSelectedItem.isVisible())
+            {
+                // we need to find another
+                Logger.method(this, "eswtCheckCurrentSelectedItem");
+                eswtSetCurrentSelectedItem(null, NO_DIRECTION);
+            }
+        }
+    }
+
+    /**
+     * Sets currentSelectedItem and sets focus to it.<br>
+     * If one of form's items is already selected when this method is called,
+     * removes focus from old item and then moves focus to new one.
+     *
+     * @param item Item to set as current selected. If null, nothing happens.
+     * @param dir Direction which is delivered to layouter.
+     */
+    void eswtSetCurrentSelectedItem(Item item, int dir)
+    {
+        if(currentSelectedItem != item)
+        {
+            Logger.info(this + "::SelectedItem: "
+                        + currentSelectedItem + " --(" + dir + ")--> " + item);
+
+            // Save direction
+            direction = dir;
+            // Remove focus from currentSelectedItem and notify its Layouter.
+            if(currentSelectedItem != null)
+            {
+                getItemLayouter(currentSelectedItem).eswtFocusLost(
+                    currentSelectedItem);
+            }
+
+            // Set new currentSelectedItem, must be focusable or null
+            currentSelectedItem = item;
+
+            // Set focus to currentSelectedItem and notify its Layouter.
+            if(currentSelectedItem != null)
+            {
+                getItemLayouter(currentSelectedItem).eswtFocusGained(
+                    currentSelectedItem, dir);
+            }
+
+            // Apply eSWT focus to currentSelectedItem's control
+            eswtApplyCurrentFocus();
+        }
+    }
+
+    /**
+     * Sets currentSelectedItem and sets focus to it.<br>
+     * If one of form's items is already selected when this method is called,
+     * removes focus from old item and then moves focus to new one.
+     *
+     * @param item Item to set as current selected. If null, nothing happens.
+     * @param dir Direction which is delivered to layouter.
+     */
+    void eswtSetCurrentSelectedItem(Item item)
+    {
+        if(currentSelectedItem != item)
+        {
+            Logger.info(this + "::SelectedItem: "
+                        + currentSelectedItem + " ---> " + item);
+
+            // Remove focus from currentSelectedItem and notify its Layouter.
+            if(currentSelectedItem != null)
+            {
+                getItemLayouter(currentSelectedItem).eswtFocusLost(
+                    currentSelectedItem);
+            }
+
+            // Set new currentSelectedItem, must be focusable or null
+            currentSelectedItem = item;
+
+            // Set focus to currentSelectedItem and notify its Layouter.
+            if(currentSelectedItem != null)
+            {
+                getItemLayouter(currentSelectedItem).eswtFocusGained(
+                    currentSelectedItem, NO_DIRECTION);
+            }
+
+            // Apply eSWT focus to currentSelectedItem's control
+            //eswtApplyCurrentFocus();
+        }
+    }
+
+    /**
+     * Sets focus to currentSelectedItem's control if its partially visible.
+     * Otherwise it sets dummy focus to form's composite.<br>
+     * <br>
+     * Note that this method applies focus only to eSWT control. Item focus
+     * update and layouter notifications are handled in method
+     * <code>eswtSetCurrentSelectedItem()</code>.<br>
+     * If currentSelectedItem is null or form is not shown, this method has no
+     * effect.
+     */
+    void eswtApplyCurrentFocus()
+    {
+        if(isFormCurrent())
+        {
+            // if any of the Item's LayoutObjects is visible
+            if(isItemPartiallyVisible(currentSelectedItem))
+            {
+                Logger.method(this, "ApplyFocus", currentSelectedItem);
+                eswtSetFocusToFirstControl(currentSelectedItem);
+            }
+            else
+            {
+                Logger.method(this, "ApplyFocus", "dummy");
+                formComposite.forceFocus();
+            }
+        }
+    }
+
+    /**
+     * If the Item is valid and it is layouted, then sets the Item's first
+     * LayoutObject focused.
+     *
+     * @param item an item which first LayoutObject is set focused.
+     */
+    void eswtSetFocusToFirstControl(Item item)
+    {
+        if(item != null && item.isFocusable())
+        {
+            LayoutObject lo = getFirstLayoutObjectOfItem(item);
+            if(lo != null)
+            {
+                lo.getControl().forceFocus();
+            }
+        }
+    }
+
+    /**
+     * Gets Current selected item.
+     *
+     * @return Current selected item. May also return null.
+     */
+    Item getCurrentSelectedItem()
+    {
+        return currentSelectedItem;
+    }
+
+    /**
+     * Get the direction of scrolling.
+     *
+     * @return direction of scrolling.
+     */
+    int getDirection()
+    {
+        return direction;
+    }
+
+    /**
+     * Set focus to an item if it is focusable and scroll form to make it
+     * visible if it is not.
+     *
+     * @param item Item to set as current item.
+     */
+    void setCurrentItem(final Item item)
+    {
+        Logger.method(this, "setCurrentItem", item);
+        ESWTUIThreadRunner.syncExec(new Runnable()
+        {
+            public void run()
+            {
+                eswtSetCurrentItem(item);
+            }
+        });
+    }
+
+    /**
+     * eSWT callback for setCurrentItem.
+     */
+    boolean eswtSetCurrentItem(Item item)
+    {
+        if(item != null)
+        {
+            if(isItemLayouted(item))
+            {
+                eswtScrollToItem(item);
+                deferredScrollToItem = null;
+
+				if(item.isFocusable())
+				{
+					eswtSetCurrentSelectedItem(item, NO_DIRECTION);
+					Logger.info("eswtSetCurrentItem" + item);
+				}
+                return true;
+            }
+            else
+            {
+                deferredScrollToItem = item;
+            }
+        }
+        return false;
+    }
+
+    void eswtScrollToItem(Item item)
+    {
+        if(item != null)
+        {
+            int pos = getItemBottomPosition(item) - getFormHeight();
+            if(!isItemPartiallyVisible(item))
+            {
+                eswtSetScrollingPosition(pos, true);
+            }
+            else if(item instanceof TextField && !isItemFullyVisible(item))
+            {
+                eswtSetScrollingPosition(pos, true);
+            }
+        }
+    }
+
+    void eswtScrolltoRegion(int yTop, int yBottom, int swtDir)
+    {
+        if(yTop < vPosition || yBottom > vPosition + getFormHeight())
+        {
+            // if the region is somewhat outside the screen
+            if(swtDir == SWT.ARROW_DOWN || swtDir == SWT.ARROW_RIGHT)
+            {
+                // align to top
+                eswtSetScrollingPosition(yTop, true);
+            }
+            else
+            {
+                // align to bottom
+                eswtSetScrollingPosition(yBottom - getFormHeight(), true);
+            }
+        }
+    }
+
+    void eswtScrollIfNeeded(final int top, final int bottom)
+    {
+        if(bottom > vPosition + getFormHeight())
+        {
+            eswtSetScrollingPosition(bottom - (getFormHeight() / 2), true);
+        }
+        else if(top < vPosition)
+        {
+            eswtSetScrollingPosition(bottom - (getFormHeight() / 2), true);
+        }
+    }
+
+    /**
+     * Get control's position relative to composite.
+     */
+    void getControlPositionOnComposite(Control control, Point location)
+    {
+        if(control != formComposite)
+        {
+            Point rel = control.getLocation();
+            location.x += rel.x;
+            location.y += rel.y;
+            getControlPositionOnComposite(control.getParent(), location);
+        }
+    }
+
+    /**
+     * eSWT specific calls to do update ScrolledComposite.
+     */
+    private void eswtUpdateFormComposite(boolean show)
+    {
+        if(getRowCount() > 0)
+        {
+            if(show)
+            {
+                formComposite.updateScrollbar(getLastRow().getBottomPosition());
+                formComposite.pack();
+            }
+        }
+        // Could happen if changing item from very tall to very short.
+        // so we have to update VPosition
+        if(getVPosition() > eswtGetMaxVPosition())
+        {
+            eswtSetScrollingPosition(eswtGetMaxVPosition(), false);
+        }
+
+        formComposite.setRedraw(show);
+        formComposite.setVisible(show);
+    }
+
+    /**
+     * Clean all form rows starting from startIndex.
+     *
+     * @param startIndex Start row from which to clean.
+     * @param keepItem - item in a startRow which shouldn't be recreated.
+     */
+    private void eswtClearRows(int startIndex, Item keepItem)
+    {
+        Logger.method(this, "clearRows", String.valueOf(startIndex), keepItem);
+        Row row = null;
+        for(int i = (getRowCount() - 1); i >= startIndex; i--)
+        {
+            row = getRow(i);
+            if(row.cleanRow(keepItem))
+            {
+                break;
+            }
+            else
+            {
+                rows.removeElement(row);
+            }
+        }
+
+        // one row always should be available.
+        if((getRowCount() == 0))
+        {
+            // rows.addElement(tempRow);
+            currentHLayoutDirective = Item.LAYOUT_DEFAULT;
+            Row newRow = new Row(ItemLayouter.getMaximumItemWidth(null),
+                                 getCurrentHLayoutDirective());
+            rows.addElement(newRow);
+        }
+    }
+
+    /**
+     * Update Row's internal layout. Handles LAYOUT_2 related post-processing.
+     *
+     * @param row Row
+     */
+    private void eswtUpdateRow(Row row)
+    {
+        if(row != null)
+        {
+            //Logger.verbose("updateRow start: " + row);
+            int numShrink = row.getNumLayoutObjects(Item.LAYOUT_SHRINK);
+            int numExpand = row.getNumLayoutObjects(Item.LAYOUT_EXPAND);
+            //Logger.verbose("shrink: " + numShrink + " expand: " + numExpand);
+
+            int vMask = Item.LAYOUT_VSHRINK | Item.LAYOUT_VEXPAND;
+            // Expand items vertically with VSHRINK or VEXPAND layout directive
+            LayoutObject lo = null;
+            int maxHeight = row.getRowHeight(vMask);
+            while((lo = row.getNextLayoutObject(lo, vMask)) != null)
+            {
+                if(lo.getOwningItem().hasLayout(Item.LAYOUT_VSHRINK))
+                {
+                    int pref = lo.getOwningItem().getPreferredHeight();
+                    getItemLayouter(lo.getOwningItem()).eswtResizeObject(lo,
+                            lo.getWidth(), Math.min(pref, maxHeight));
+                }
+                else if(lo.getOwningItem().hasLayout(Item.LAYOUT_VEXPAND))
+                {
+                    getItemLayouter(lo.getOwningItem()).eswtResizeObject(lo,
+                            lo.getWidth(), maxHeight);
+                }
+            }
+
+            // Expand items with SHRINK layout directive
+            if(numShrink > 0)
+            {
+                // Get extra space before shrink and expand
+                int offset = row.getFreeSpace() / numShrink;
+                // Logger.verbose("shrinkOffset: " + offset);
+                if(offset >= 0)
+                {
+                    while((lo = row.getNextLayoutObject(lo, Item.LAYOUT_SHRINK)) != null)
+                    {
+                        int pref = lo.getOwningItem().getPreferredWidth();
+                        int min = lo.getOwningItem().getMinimumWidth();
+                        int itemWidth = Math.min(pref, min + offset);
+                        getItemLayouter(lo.getOwningItem()).eswtResizeObject(lo,
+                                itemWidth, lo.getHeight());
+                    }
+                }
+            }
+
+            // Expand items with EXPAND layout directive
+            if(numExpand > 0)
+            {
+                // Get extra space after shrink but before expand
+                int offset = row.getFreeSpace(Item.LAYOUT_EXPAND) / numExpand;
+                if(offset >= 0)
+                {
+                    // Logger.verbose("expandOffset: " + offset);
+                    while((lo = row.getNextLayoutObject(lo, Item.LAYOUT_EXPAND)) != null)
+                    {
+                        int pref = lo.getOwningItem().getPreferredWidth();
+                        getItemLayouter(lo.getOwningItem()).eswtResizeObject(lo,
+                                pref + offset, lo.getHeight());
+                    }
+                }
+            }
+
+            //if (numShrink > 0 || numExpand > 0) {
+            row.updateRowInternals();
+            //}
+
+            row.updateRowLayout(form.getLeftRightLanguage());
+            // Logger.verbose("updateRow: " + row);
+        }
+    }
+
+    /**
+     * Add a new Row.
+     */
+    private Row eswtAddNewRow()
+    {
+        Row lastRow = getLastRow();
+        eswtUpdateRow(lastRow);
+        int yShift = (lastRow == null ? 0 : lastRow.getBottomPosition());
+        // create new Row
+        Row newRow = new Row(ItemLayouter.getMaximumItemWidth(null),
+                             getCurrentHLayoutDirective());
+        newRow.setYShift(yShift);
+        rows.addElement(newRow);
+        return newRow;
+    }
+
+    /**
+     * Add a LayoutObject to the last Row.
+     *
+     * @param layoutObject the layout object
+     */
+    void eswtAddNewLayoutObject(LayoutObject layoutObject)
+    {
+    	if(!layoutObjects.contains(layoutObject))
+    	{
+    		layoutObjects.addElement(layoutObject);
+    	}
+        Row lastRow = getLastRow();
+        // check if the current Row is full
+        if(!lastRow.isEmpty()
+                && lastRow.getFreeSpace() < layoutObject.getWidth())
+        {
+            lastRow = eswtAddNewRow();
+        }
+        lastRow.eswtAddLayoutObject(layoutObject);
+        layoutObject.setRowIdx(getRowCount() - 1);
+    }
+
+    /**
+     * Optionally add a new Row and adds a LayoutObject.
+     *
+     * @param layoutObject the layout object
+     * @param newRow adds a new row if true. If false, adds new row only if
+     *            there's no space for layoutObject in current row.
+     */
+    void eswtAddNewLayoutObject(LayoutObject layoutObject, boolean newRow)
+    {
+        if(newRow)
+        {
+            eswtAddNewRow();
+        }
+        eswtAddNewLayoutObject(layoutObject);
+    }
+
+    /**
+     * Layout item in a row, if needed new row is added.
+     *
+     * @param row - where to startLayout.
+     * @param item - Item to Layout
+     */
+    private void eswtLayoutItem(Item item)
+    {
+        Row lastRow = getLastRow();
+        boolean hlChange = setCurrentHLayoutDirective(item.internalGetLayout());
+        if(hlChange || getItemNewLineBefore(item))
+        {
+            // newline directive or horizontal layout changed
+            if(lastRow.isEmpty())
+            {
+                // if the current/last row is empty - use that
+                lastRow.setRowHLayout(getCurrentHLayoutDirective());
+            }
+            else
+            {
+                eswtAddNewRow();
+            }
+        }
+
+        // Use the specific layouter to layout item in the last row
+        getItemLayouter(item).eswtLayoutItem(getLastRow(), item);
+
+        if(form.eswtIsShown())
+        {
+            LayoutObject lo = getFirstLayoutObjectOfItem(item);
+            if(lo != null)
+            {
+                getItemLayouter(item).eswtAddListeners(item, lo);
+            }
+        }
+
+        if(getItemNewLineAfter(item))
+        {
+            eswtAddNewRow();
+        }
+    }
+
+    /**
+     * Set Form's Layout directive. if it differ from current set flag
+     * startFromNewLine = true;
+     *
+     * @param newLayoutDirective
+     * @return true if a layout change has occured
+     */
+    private boolean setCurrentHLayoutDirective(int newLayoutDirective)
+    {
+        int newHLayoutDirective = Item.getHorizontalLayout(newLayoutDirective);
+        if((newHLayoutDirective != currentHLayoutDirective)
+                && (newHLayoutDirective != Item.LAYOUT_DEFAULT))
+        {
+            currentHLayoutDirective = newHLayoutDirective;
+            return true;
+        }
+        return false;
+    }
+
+    /**
+     * Get Form current Layout directive.
+     *
+     * @return current Layout directive for Form.
+     */
+    private int getCurrentHLayoutDirective()
+    {
+        if(currentHLayoutDirective == Item.LAYOUT_DEFAULT)
+        {
+            return getLanguageSpecificLayoutDirective();
+        }
+        return currentHLayoutDirective;
+    }
+
+    /**
+     * Returns language specific layout directive.
+     *
+     * @return LAYOUT_LEFT or LAYOUT_RIGHT.
+     */
+    int getLanguageSpecificLayoutDirective()
+    {
+        if(form.getLeftRightLanguage())
+        {
+            return Item.LAYOUT_LEFT;
+        }
+        else
+        {
+            return Item.LAYOUT_RIGHT;
+        }
+    }
+
+    private boolean getItemNewLineBefore(Item item)
+    {
+        return ((item.internalGetLayout() & Item.LAYOUT_NEWLINE_BEFORE) != 0);
+    }
+
+    private boolean getItemNewLineAfter(Item item)
+    {
+        return ((item.internalGetLayout() & Item.LAYOUT_NEWLINE_AFTER) != 0);
+    }
+
+    boolean isItemLayouted(Item item)
+    {
+        return (getFirstLayoutObjectOfItem(item) != null);
+    }
+
+    /**
+     * Returns if the form is shown.
+     */
+    boolean isFormCurrent()
+    {
+        return isCurrent;
+    }
+
+    /**
+     * Returns if the region is partially visible.
+     *
+     * @param viewTop viewPort's top position
+     * @param viewBottom viewPort's bottom position
+     * @return true if visible
+     */
+    boolean isPartiallyVisible(int yTop, int yBottom)
+    {
+        int vBottomPosition = vPosition + getFormHeight();
+        if((vPosition <= yTop && vBottomPosition <= yTop)
+                || (vPosition >= yBottom && vBottomPosition >= yBottom))
+        {
+            return false;
+        }
+        return true;
+    }
+
+    /**
+     * Returns if at least the region's given percentage is visible.
+     */
+    boolean isPartiallyVisible(int yTop, int yBottom, int minPercent)
+    {
+        int visPercent = getVisibilityPercent(yTop, yBottom);
+        if(visPercent > minPercent)
+        {
+            return true;
+        }
+        return false;
+    }
+
+    /**
+     * Returns the region's visibility percentage.
+     */
+    int getVisibilityPercent(int yTop, int yBottom)
+    {
+        if(yTop >= yBottom)
+        {
+            return 0;
+        }
+        int vBottomPosition = vPosition + getFormHeight();
+        int r1 = Math.max(vPosition, Math.min(yTop, vBottomPosition));
+        int r2 = Math.min(vBottomPosition, Math.max(yBottom, vPosition));
+        return ((r2 - r1) * 100) / (yBottom - yTop);
+    }
+
+    /**
+     * Returns if the LayoutObject is partially visible.
+     */
+    boolean isPartiallyVisible(LayoutObject lo)
+    {
+        if(lo != null)
+        {
+            return isPartiallyVisible(lo.getY(), lo.getY() + lo.getHeight());
+        }
+        return false;
+    }
+
+    /**
+     * Returns if at least the LayoutObject's given percentage is visible.
+     */
+    boolean isPartiallyVisible(LayoutObject lo, int minPercent)
+    {
+        if(lo != null)
+        {
+            return isPartiallyVisible(lo.getY(), lo.getY() + lo.getHeight(),
+                                      minPercent);
+        }
+        return false;
+    }
+
+    /**
+     * Returns if the Item is partially visible (if one of its LayoutObjects is
+     * partially visible).
+     *
+     * @param item the Item
+     * @return true if partially visible
+     */
+    boolean isItemPartiallyVisible(Item item)
+    {
+        if(item != null)
+        {
+            LayoutObject lo = null;
+            while((lo = getNextLayoutObjectOfItem(lo, item)) != null)
+            {
+                if(isPartiallyVisible(lo))
+                {
+                    return true;
+                }
+            }
+        }
+        return false;
+    }
+
+
+
+    /**
+     * Returns true if item is fully visible.
+     *
+     * @param item the Item.
+     * @return true if fully visible.
+     */
+    boolean isItemFullyVisible(Item item)
+    {
+        if(item != null)
+        {
+            LayoutObject lo = null;
+            while((lo = getNextLayoutObjectOfItem(lo, item)) != null)
+            {
+                if(!isLOFullyVisible(lo))
+                {
+                    return false;
+                }
+            }
+        }
+        return true;
+    }
+
+    /**
+     * Returns if the LayoutObject is fully visible.
+     */
+    boolean isLOFullyVisible(LayoutObject lo)
+    {
+        if(lo != null)
+        {
+            return isFullyVisible(lo.getY(), lo.getY() + lo.getHeight());
+        }
+        return false;
+    }
+
+    /**
+     * Returns if the region is fully visible.
+     *
+     * @param viewTop viewPort's top position
+     * @param viewBottom viewPort's bottom position
+     * @return true if visible
+     */
+    boolean isFullyVisible(int yTop, int yBottom)
+    {
+        int vBottomPosition = vPosition + getFormHeight();
+        if((vPosition <= yTop && vBottomPosition >= yBottom))
+        {
+            return true;
+        }
+        return false;
+    }
+
+    int getItemTopPosition(Item item)
+    {
+        LayoutObject lo = getFirstLayoutObjectOfItem(item);
+        if(lo != null)
+        {
+            return lo.getY();
+        }
+        return 0;
+    }
+
+    int getItemBottomPosition(Item item)
+    {
+        LayoutObject lo = getLastLayoutObjectOfItem(item);
+        if(lo != null)
+        {
+            return lo.getY() + lo.getHeight();
+        }
+        return 0;
+    }
+
+    int getItemCount()
+    {
+        return form.size();
+    }
+
+    Item getItem(int index)
+    {
+        try
+        {
+            return (Item) form.getItems().elementAt(index);
+        }
+        catch(ArrayIndexOutOfBoundsException e)
+        {
+            // Logger.exception(e);
+            return null;
+        }
+    }
+
+    int getItemIndex(Item item)
+    {
+        return form.getItems().indexOf(item);
+    }
+
+    int getRowCount()
+    {
+        return rows.size();
+    }
+
+    /**
+     * Return the Row with the given index.
+     *
+     * @param index Row's index
+     * @return a Row
+     */
+    Row getRow(int index)
+    {
+        try
+        {
+            return (Row) rows.elementAt(index);
+        }
+        catch(ArrayIndexOutOfBoundsException e)
+        {
+            Logger.exception("getRow", e);
+            return null;
+        }
+    }
+
+    /**
+     * Return the Row to which the given LayoutObject belongs.
+     *
+     * @param lo LayoutObject
+     * @return the owning Row
+     */
+    Row getRow(LayoutObject lo)
+    {
+        try
+        {
+            return getRow(lo.getRowIdx());
+        }
+        catch(NullPointerException e)
+        {
+            // Logger.exception("getRow", e);
+            return null;
+        }
+    }
+
+    /**
+     * Returns the last row of the form.
+     */
+    Row getLastRow()
+    {
+        try
+        {
+            return (Row) rows.lastElement();
+        }
+        catch(NoSuchElementException nse)
+        {
+            // Logger.exception("getLastRow", nse);
+            return null;
+        }
+    }
+
+    /**
+     * Find last row which contains corresponding Item.
+     *
+     * @param item Item in a Row.
+     * @return Last Row with that item.
+     */
+    Row getLastRowOfItem(Item item)
+    {
+        return getRow(getLastLayoutObjectOfItem(item));
+    }
+
+    /**
+     * Get Form which requires layout.
+     *
+     * @return form.
+     */
+    Form getForm()
+    {
+        return form;
+    }
+
+    /**
+     * Form's content height.
+     */
+    int getFormHeight()
+    {
+        return form.getHeight();
+    }
+
+    /**
+     * Form's content width.
+     */
+    int getFormWidth()
+    {
+        return form.getWidth();
+    }
+
+    /**
+     * Returns LayoutObject for the given Item.
+     *
+     * @param item Item to layout
+     * @return LayoutObject
+     */
+    LayoutObject getLayoutObject(Item item)
+	{
+		int num = layoutObjects.size();
+
+		for(int i = 0; i < num; i++)
+		{
+			if(((LayoutObject)layoutObjects.elementAt(i)).getOwningItem() == item)
+			{
+				LayoutObject lo = (LayoutObject)(layoutObjects.elementAt(i));
+				lo.setRowIdx(-1);
+				return lo;
+			}
+		}
+
+		return null;
+	}
+
+    /**
+     * Removes Layout Object for the given Item.
+     *
+     * @param item Item to remove LayoutObject
+     */
+    void removeLayoutObject(Item item)
+	{
+
+		int num = layoutObjects.size();
+
+		for(int i = 0; i < num; i++)
+		{
+			if(((LayoutObject)layoutObjects.elementAt(i)).getOwningItem() == item)
+			{
+				LayoutObject lo = (LayoutObject)(layoutObjects.elementAt(i));
+				layoutObjects.removeElement(lo);
+				lo.dispose();
+				break;
+			}
+		}
+	}
+
+    /**
+     * Removes all Layout Objects from the FormLayouter.
+     */
+    void removeAllLayoutObjects()
+	{
+		Enumeration e = layoutObjects.elements();
+
+		while(e.hasMoreElements())
+		{
+			LayoutObject lo = (LayoutObject)e.nextElement();
+			layoutObjects.removeElement(lo);
+			lo.dispose();
+		}
+	}
+
+    /**
+     * Returns the next LayoutObject belonging to this Item.<br>
+     *
+     * @param lo starting LayoutObject; if null then it start from first.
+     * @param item specifies the parent Item; null means any Item
+     * @return the next LayoutObject in the layout.
+     */
+    LayoutObject getNextLayoutObjectOfItem(LayoutObject lo, Item item)
+    {
+        int startRow = (lo == null ? 0 : lo.getRowIdx());
+        LayoutObject temp = null;
+        for(int i = startRow; i < getRowCount(); i++)
+        {
+            temp = getRow(i).getNextLayoutObject(lo, item);
+            if(temp != null && temp != lo)
+            {
+                return temp;
+            }
+        }
+        return null;
+    }
+
+    /**
+     * Returns the previous LayoutObject belonging to this Item.<br>
+     *
+     * @param lo starting LayoutObject; if null then it start from last.
+     * @param item specifies the parent Item; null means any Item
+     * @return the previous LayoutObject in the layout.
+     */
+    LayoutObject getPrevLayoutObjectOfItem(LayoutObject lo, Item item)
+    {
+        int startRow = (lo == null ? rows.size() - 1 : lo.getRowIdx());
+        LayoutObject temp = null;
+        for(int i = startRow; i >= 0; i--)
+        {
+            temp = getRow(i).getPrevLayoutObject(lo, item);
+            if(temp != null && temp != lo)
+            {
+                return temp;
+            }
+        }
+        return null;
+    }
+
+    /**
+     * Returns the first LayoutObject of a layouted item.
+     *
+     * @param item
+     * @return the LO, or NULL if the item is not layouted
+     */
+    LayoutObject getFirstLayoutObjectOfItem(Item item)
+    {
+        if(item != null)
+        {
+            return getNextLayoutObjectOfItem(null, item);
+        }
+        return null;
+    }
+
+    /**
+     * Returns the last LayoutObject of a layouted item.
+     *
+     * @param item
+     * @return the LO, or NULL if the item is not layouted
+     */
+    LayoutObject getLastLayoutObjectOfItem(Item item)
+    {
+        if(item != null)
+        {
+            return getPrevLayoutObjectOfItem(null, item);
+        }
+        return null;
+    }
+
+    /**
+     * Update item state in form.
+     *
+     * @param item
+     * @param updateReason
+     * @param param additional parameter
+     */
+    void updateItemState(Item item, int updateReason, Object param)
+    {
+        Logger.method(this, "updateItemState", item,
+                      String.valueOf(updateReason), param);
+
+		LayoutObject lo = getFirstLayoutObjectOfItem(item);
+
+		if(lo != null)
+		{
+			getItemLayouter(item).updateItem(item, lo.getControl(), updateReason,
+										 param);
+		}
+
+        // Clean reason - without resizing flags
+        int reason = updateReason & Item.UPDATE_SIZE_MASK;
+        switch(reason)
+        {
+        case Item.UPDATE_ADDCOMMAND:
+        {
+            if(isFormCurrent() && param != null)
+            {
+                if(lo != null && param instanceof Command)
+                {
+                    lo.addCommand((Command) param);
+                }
+            }
+            break;
+        }
+        case Item.UPDATE_REMOVECOMMAND:
+        {
+            if(isFormCurrent() && param != null)
+            {
+                if(lo != null && param instanceof Command)
+                {
+                    lo.removeCommand((Command) param);
+                }
+            }
+            break;
+        }
+        }
+
+        // Check this always - because this is a flag
+        if((updateReason & Item.UPDATE_HEIGHT_CHANGED)
+                == Item.UPDATE_HEIGHT_CHANGED)
+        {
+            resizeItemAndShift(item);
+        }
+    }
+
+    int eswtGetMaxVPosition()
+    {
+        return formComposite.getSize().y - getFormHeight();
+    }
+
+    /**
+     * Called by key Form to compute new vertical coordinate to position form's
+     * content.
+     *
+     * @param swtDir scrolling direction.
+     * @return New vertical position of Form's content.
+     */
+    protected int getNextScrollingPosition(int swtDir)
+    {
+        boolean scrollDown = (swtDir == SWT.ARROW_DOWN
+                              || swtDir == SWT.ARROW_RIGHT);
+        int formHeight = getFormHeight();
+        int refPoint;
+        int ret = vPosition;
+        if(scrollDown)
+        {
+            ret += formHeight / 5;
+            refPoint = (vPosition + 1) + formHeight;
+        }
+        else
+        {
+            ret -= formHeight / 5;
+            refPoint = (vPosition - 1);
+        }
+
+        Row row = null;
+        for(int i = 0; i < getRowCount(); i++)
+        {
+            row = getRow(i);
+            if(row.isInsideRow(refPoint)
+                    && (row.getRowHeight() < formHeight))
+            {
+                if(scrollDown)
+                {
+                    ret = row.getBottomPosition() - formHeight;
+                }
+                else
+                {
+                    ret = row.getYShift();
+                }
+                break;
+            }
+        }
+
+        return ret;
+    }
+
+    /**
+     * Set the scrolling to the specified position.<br>
+     * This method also updates the Form's scrollbars.
+     *
+     * @param position new position
+     */
+    void eswtSetScrollingPosition(int position, boolean keyNav)
+    {
+        // check constraints
+        int newVPosition = position;
+        int maxVPos = eswtGetMaxVPosition();
+        newVPosition = Math.min(newVPosition, maxVPos);
+        newVPosition = Math.max(newVPosition, 0);
+
+        vPosition = newVPosition;
+        formComposite.setRedraw(false);
+        formComposite.setOrigin(0, vPosition, keyNav);
+        formComposite.pack();
+        formComposite.setRedraw(true);
+
+        eswtHandleVisibilityChanges();
+    }
+
+    /**
+     * Returns the scrolling position.
+     */
+    protected int getScrollingPosition()
+    {
+        return vPosition;
+    }
+
+    /**
+     * Updates visibility status of all items.
+     */
+    protected void eswtHandleVisibilityChanges()
+    {
+        // Logger.method(this, "eswtHandleVisibilityChanges");
+        boolean shown = false;
+        Item item = null;
+        LayoutObject lo = null;
+        // Go through all LayoutObjects and check/update visibilities
+        while((lo = getNextLayoutObjectOfItem(lo, null)) != null)
+        {
+            // check if owning item is changing
+            if(lo.getOwningItem() != item)
+            {
+                if(item != null)
+                {
+                    // set current item's visibility
+                    getItemLayouter(item).eswtHandleVisibilityChange(item, shown);
+                }
+                // new item
+                item = lo.getOwningItem();
+                shown = false;
+            }
+
+            // track current item's visibility
+            if(!shown && isFormCurrent() && isPartiallyVisible(lo))
+            {
+                shown = true;
+            }
+        }
+
+        // call it for last item
+        if(item != null)
+        {
+            getItemLayouter(item).eswtHandleVisibilityChange(item, shown);
+        }
+
+		eswtCheckCurrentSelectedItem();
+    }
+
+    /**
+     * Changes item size and does shift of all Rows.
+     *
+     * @param item - item to changeSize.
+     */
+    void resizeItemAndShift(final Item item)
+    {
+        ESWTUIThreadRunner.syncExec(new Runnable()
+        {
+            public void run()
+            {
+                int newVPosition = eswtResizeItemAndShift(item);
+                if(newVPosition != vPosition)
+                {
+                    eswtSetScrollingPosition(newVPosition, true);
+                }
+                else
+                {
+                    eswtHandleVisibilityChanges();
+                }
+            }
+        });
+    }
+
+    /**
+     * eSWT callback for resizeItemAndShift.
+     *
+     * @param item Item to be resized.
+     * @return new scrolling vPosition
+     */
+    int eswtResizeItemAndShift(Item item)
+    {
+		// save the state of the last row before resizing and Shifting.
+		boolean itemWasVisible = isItemPartiallyVisible(item);
+        Row row = getLastRowOfItem(item);
+        int deltaYShift = row.getRowHeight();
+        // if we un-comment this then when we set true,
+        // focus will jump to first item.
+        // eswtUpdateFormComposite(false);
+        LayoutObject lo = getFirstLayoutObjectOfItem(item);
+        if(lo != null)
+        {
+            getItemLayouter(item).eswtResizeObject(lo);
+        }
+
+        eswtUpdateRow(row);
+
+        /*
+        // to avoid double call of updateRowInternals
+        if (row.getNumLayoutObjects(Item.LAYOUT_SHRINK) > 0
+                || row.getNumLayoutObjects(Item.LAYOUT_EXPAND) > 0) {
+            eswtUpdateRow(row);
+        }
+        else {
+            row.updateRowInternals();
+        }
+        */
+        deltaYShift = row.getRowHeight() - deltaYShift;
+        // row's height change - all remaining rows are shifted with this.
+
+        Row lastRow = getLastRow();
+        if(row != lastRow)
+        {
+            for(int i = rows.indexOf(row) + 1; i < getRowCount(); i++)
+            {
+                row = getRow(i);
+                row.setYShift(row.getYShift() + deltaYShift);
+                eswtUpdateRow(row);
+            }
+        }
+
+        // following code updates scrolling if needed.
+        // need to check where in the form resize happeneed.
+
+        int itemRowYShift = getLastRowOfItem(item).getYShift();
+        // vPosition should be changed in syncexec
+        int newVPosition = vPosition;
+
+        // we need to scroll only if changes happened above the screen.
+        if(newVPosition >= itemRowYShift)
+        {
+            newVPosition = Math.max(0, newVPosition + deltaYShift);
+        }
+        // check to avoid gap in the bottom of the form
+        if(newVPosition + getFormHeight() > lastRow.getBottomPosition())
+        {
+            newVPosition = Math.max(0,
+                                    lastRow.getBottomPosition() - getFormHeight());
+        }
+
+        eswtUpdateFormComposite(true);
+
+        // formComposite.pack();
+        // formComposite.updateScrollbarSize(lastRow.getBottomPosition());
+
+		if(item == currentSelectedItem)
+		{
+			if(itemWasVisible)
+			{
+				int itemTop = getItemTopPosition(item);
+				int itemBottom = getItemBottomPosition(item);
+				// currentSelectedItem has to be focused if it was focused
+				// before resizing e.g TextField when it is resized by adding a
+				// new row and it was in the bottom of the Screen.
+				if(newVPosition <= itemTop
+						&& (newVPosition + getFormHeight()) >= itemBottom)
+				{
+					// do not change vPosition;
+				}
+				else if(newVPosition > itemTop)
+				{
+					newVPosition = itemTop;
+				}
+				else if((newVPosition + getFormHeight()) < itemBottom)
+				{
+					newVPosition = itemBottom - getFormHeight();
+				}
+			}
+		}
+		return newVPosition;
+    }
+
+    /**
+     * Gets layouter that can layout the specified item.
+     *
+     * @param item Item to be layouted.
+     * @return ItemLayouter or null if no Layouter found.
+     */
+    protected final ItemLayouter getItemLayouter(Item item)
+    {
+        if(item instanceof StringItem)
+        {
+            return sIL;
+        }
+        else if(item instanceof ImageItem)
+        {
+            return imIL;
+        }
+        else if(item instanceof Gauge)
+        {
+            return gL;
+        }
+        else if(item instanceof TextField)
+        {
+            return tfL;
+        }
+        else if(item instanceof DateField)
+        {
+            return dfL;
+        }
+        else if(item instanceof ChoiceGroup)
+        {
+            return cgL;
+        }
+        else if(item instanceof CustomItem)
+        {
+            return ciL;
+        }
+        else if(item instanceof Spacer)
+        {
+            return sL;
+        }
+        return null;
+    }
+
+    /**
+     * Returns eSWT Control that represents the item specified.
+     */
+    Control getItemControl(final Item item)
+    {
+        final LayoutObject lo = getFirstLayoutObjectOfItem(item);
+        if(lo != null)
+        {
+            ESWTUIThreadRunner.syncExec(new Runnable()
+            {
+                public void run()
+                {
+                    itemMainControl = getItemLayouter(item)
+                                      .eswtFindSpecificControl(item, lo.getControl());
+                }
+            });
+            return itemMainControl;
+        }
+        return null;
+    }
+
+    void updateScrolling(final int value, final boolean keyNav)
+    {
+        Logger.method("updateScrolling", String.valueOf(value));
+        ESWTUIThreadRunner.syncExec(new Runnable()
+        {
+            public void run()
+            {
+
+                eswtSetScrollingPosition(value, keyNav);
+
+            }
+        });
+    }
+
+    /**
+     * Get current scrolling value.
+     *
+     * @return vPosition.
+     */
+    int getVPosition()
+    {
+        return vPosition;
+    }
+
+
+	private Timer eventTimer = new Timer();
+	private EventGeneratorTask eventTask;
+
+	/**
+	 * Reset timer for do layout with a given start index.
+	 */
+	private void resetEventTimer(boolean directionUp, int y)
+	{
+		if(eventTimer != null)
+		{
+			if(eventTask != null)
+			{
+				eventTask.cancel();
+				eventTask = null;
+			}
+			// schedule new timer
+			eventTask = new EventGeneratorTask(directionUp, y);
+			eventTimer.schedule(eventTask, Config.DFI_EVENT_TIMER_DELAY);
+		}
+	}
+
+	/**
+	 * Form Timer task. Triggers the formComposite to Layout.
+	 */
+	class EventGeneratorTask extends TimerTask
+	{
+
+		private boolean isUpDirection;
+		private int localY;
+
+		public EventGeneratorTask(boolean direction, int y)
+		{
+			isUpDirection = direction;
+			localY = y;
+			Logger.info("y is " + localY);
+		}
+
+		public void run()
+		{
+			if(isUpDirection)
+			{
+				localY -= Config.DFI_EVENT_MOVE_DELTA;
+			}
+			else
+			{
+				localY += Config.DFI_EVENT_MOVE_DELTA;
+			}
+			handlePointerEvent(0, localY, SWT.MouseMove);
+		}
+	}
+
+}
--- a/javauis/lcdui_qt/src/javax/microedition/lcdui/Gauge.java	Tue Jul 06 14:10:26 2010 +0300
+++ b/javauis/lcdui_qt/src/javax/microedition/lcdui/Gauge.java	Wed Aug 18 09:43:15 2010 +0300
@@ -23,7 +23,6 @@
  */
 public class Gauge extends Item
 {
-
     /**
      * Indefinite constant.
      */
@@ -49,9 +48,17 @@
      */
     public static final int INCREMENTAL_UPDATING = 3;
 
+    /**
+     * If Gauge is changed, reasons for Re-layouting.
+     */
+	static final int UPDATE_MAXVALUE = UPDATE_ITEM_MAX << 1;
+	static final int UPDATE_VALUE = UPDATE_ITEM_MAX << 2;
+	
+
     private int maxValue;
     private int value;
     private boolean interactive;
+    private boolean isGaugeCreation;
 
     /**
      * Constructor.
@@ -64,9 +71,11 @@
     public Gauge(String name, boolean interactive, int maxVal, int initVal)
     {
         setLabel(name);
+        isGaugeCreation = true;
         this.interactive = interactive;
         setMaxValue(maxVal);
         setValue(initVal);
+        isGaugeCreation = false;
     }
 
     /**
@@ -76,22 +85,30 @@
      * @param maxVal the maximum value.
      * @return validated value.
      */
-    private static int checkValue(int value, int maxVal)
+    private int checkValue(int value, int maxVal)
     {
         if(maxVal == INDEFINITE)
         {
-            switch(value)
+            if(isGaugeCreation)
             {
-            case CONTINUOUS_IDLE:
-            case INCREMENTAL_IDLE:
-            case CONTINUOUS_RUNNING:
-            case INCREMENTAL_UPDATING:
-                break;
-            default:
-                throw new IllegalArgumentException(
-                    MsgRepository.GAUGE_EXCEPTION_INVALID_VALUE);
+                switch(value)
+                {
+                case CONTINUOUS_IDLE:
+                case INCREMENTAL_IDLE:
+                case CONTINUOUS_RUNNING:
+                case INCREMENTAL_UPDATING:
+                    break;
+                default:
+                    throw new IllegalArgumentException(
+                        MsgRepository.GAUGE_EXCEPTION_INVALID_VALUE);
+                }
+                
+                return value;
             }
-            return value;
+            else
+            {
+            	return CONTINUOUS_IDLE;
+            }
         }
         else
         {
@@ -111,18 +128,14 @@
      */
     private static int checkMaxValue(int maxVal, boolean interactive)
     {
-        if(!interactive)
+        if(interactive)
         {
-            if(maxVal == INDEFINITE)
+            if(maxVal <= 0)
             {
-                return maxVal;
+                throw new IllegalArgumentException(
+                    MsgRepository.GAUGE_EXCEPTION_INVALID_MAXVALUE);
             }
         }
-        if(maxVal <= 0)
-        {
-            throw new IllegalArgumentException(
-                MsgRepository.GAUGE_EXCEPTION_INVALID_MAXVALUE);
-        }
         return maxVal;
     }
 
@@ -140,7 +153,7 @@
          * that requires eSWT extension.
          */
         this.value = checkValue(value, this.maxValue);
-        updateParent(UPDATE_CONTENT);
+        updateParent(UPDATE_VALUE);
     }
 
     /**
@@ -162,7 +175,7 @@
     {
         this.maxValue = checkMaxValue(maxValue, interactive);
         this.value = checkValue(getValue(), this.maxValue);
-        updateParent(UPDATE_CONTENT);
+        updateParent(UPDATE_MAXVALUE);
     }
 
     /**
@@ -257,7 +270,7 @@
     {
         return (!isInteractive()
                 && getParent() == null
-                && !hasLabel()
+                && getLabel() == null
                 && getLayout() == Item.LAYOUT_DEFAULT
                 && !isSizeLocked()
                 && getNumCommands() == 0
--- a/javauis/lcdui_qt/src/javax/microedition/lcdui/GaugeLayouter.java	Tue Jul 06 14:10:26 2010 +0300
+++ b/javauis/lcdui_qt/src/javax/microedition/lcdui/GaugeLayouter.java	Wed Aug 18 09:43:15 2010 +0300
@@ -38,11 +38,11 @@
     /**
      * Constructor.
      *
-     * @param dflp DefaultFormLayoutPolicy
+     * @param aFormLayouter FormLayouter used for layouting.
      */
-    GaugeLayouter(DefaultFormLayoutPolicy dflp)
+    GaugeLayouter(FormLayouter aFormLayouter)
     {
-        super(dflp);
+        super(aFormLayouter);
     }
 
     /**
--- a/javauis/lcdui_qt/src/javax/microedition/lcdui/Graphics.java	Tue Jul 06 14:10:26 2010 +0300
+++ b/javauis/lcdui_qt/src/javax/microedition/lcdui/Graphics.java	Wed Aug 18 09:43:15 2010 +0300
@@ -750,7 +750,7 @@
     public void drawSubstring(java.lang.String string, int offset, int length,
                               int xPos, int yPos, int anch)
     {
-        drawString(string.substring(offset, length), xPos, yPos, anch);
+        drawString(string.substring(offset, offset+length), xPos, yPos, anch);
     }
 
     /**
--- a/javauis/lcdui_qt/src/javax/microedition/lcdui/ImageItem.java	Tue Jul 06 14:10:26 2010 +0300
+++ b/javauis/lcdui_qt/src/javax/microedition/lcdui/ImageItem.java	Wed Aug 18 09:43:15 2010 +0300
@@ -26,7 +26,6 @@
  */
 public class ImageItem extends Item
 {
-
     /**
      * Left here for source compatibility purposes. Use layout directives from
      * Item class instead.
@@ -63,6 +62,13 @@
      */
     public static final int LAYOUT_NEWLINE_AFTER = Item.LAYOUT_NEWLINE_AFTER;
 
+    /**
+     * If ImageItem is changed, reasons for Re-layouting.
+     */
+	static final int UPDATE_ALTTEXT = UPDATE_ITEM_MAX << 1;
+	static final int UPDATE_IMAGE = UPDATE_ITEM_MAX << 2;
+
+
     private Image image;
     private int appearanceMode;
     private String alternateText;
@@ -129,8 +135,12 @@
      */
     public void setImage(Image image)
     {
+    	if((image == null) && (this.image == null))
+		{
+			return;
+		}
         this.image = image;
-        updateParent(UPDATE_SIZE_CHANGED);
+        updateParent(UPDATE_IMAGE | UPDATE_SIZE_CHANGED);
     }
 
     /**
@@ -151,7 +161,7 @@
     public void setAltText(String newAltText)
     {
         alternateText = newAltText;
-        updateParent(UPDATE_SIZE_CHANGED);
+        updateParent(UPDATE_ALTTEXT);
     }
 
     /**
@@ -173,6 +183,44 @@
     }
 
     /**
+     * Adds command to this ImageItem. If same command is already added to this item,
+     * nothing happens.
+     *
+     * @param command A command to be added.
+     * @throws NullPointerException if cmd is null.
+     */
+    public void addCommand(Command command)
+    {
+    	int numCmds = getNumCommands();
+
+    	super.addCommand(command);
+		
+		if((getNumCommands() != numCmds) && (getNumCommands() == 1))
+		{
+			updateParent(UPDATE_SIZE_CHANGED);
+		}
+    }
+
+    /**
+     * Removes command from the ImageItem. If command doesn't exists in this item,
+     * nothing happens.
+     *
+     * @param command The command to be removed.
+     */
+    public void removeCommand(Command command)
+    {
+    	int numCmds = getNumCommands();
+
+    	super.removeCommand(command);
+		
+		if((getNumCommands() != numCmds) && (getNumCommands() == 0))
+
+		{
+			updateParent(UPDATE_SIZE_CHANGED);
+		}
+    }
+
+    /**
      * Calculates minimum size of this item.
      *
      * @return Minimum size.
--- a/javauis/lcdui_qt/src/javax/microedition/lcdui/ImageItemLayouter.java	Tue Jul 06 14:10:26 2010 +0300
+++ b/javauis/lcdui_qt/src/javax/microedition/lcdui/ImageItemLayouter.java	Wed Aug 18 09:43:15 2010 +0300
@@ -18,7 +18,6 @@
 
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.graphics.Rectangle;
 import org.eclipse.swt.widgets.*;
 import org.eclipse.ercp.swt.mobile.CaptionedControl;
 
@@ -31,29 +30,28 @@
     /**
      * Constructor.
      *
-     * @param dflp - DefaultFormLayoutPolicy used for layouting.
+     * @param aFormLayouter FormLayouter used for layouting.
      */
-    ImageItemLayouter(DefaultFormLayoutPolicy dflp)
+    ImageItemLayouter(FormLayouter aFormLayouter)
     {
-        super(dflp);
-    }
-
-    int eswtGetLabelAlignmentDirective()
-    {
-        return Item.LAYOUT_BOTTOM;
+        super(aFormLayouter);
     }
 
     /**
-     * Layout Item in a row.
+     * Creates LayoutObject for the given Item.
      *
-     * @param row current Row
      * @param item Item to layout
+     * @return LayoutObject
      */
-    void eswtLayoutItem(Row row, Item item)
+    LayoutObject getLayoutObject(Item item)
     {
-        LayoutObject lo = new LayoutObject(item, eswtGetControl(formComposite, item));
-        dfi.eswtAddNewLayoutObject(lo);
-    }
+    	LayoutObject lo = formLayouter.getLayoutObject(item);
+    	if(lo == null)
+    	{
+        	lo = new LayoutObject(item, eswtGetControl(formComposite, item));
+    	}
+		return lo;
+    }	
 
     /**
      * Creates the eSWT CaptionedControl or Composite for this item.
@@ -61,10 +59,7 @@
     Control eswtGetControl(Composite parent, Item item)
     {
         Control ret = eswtCreateControl(parent, item);
-        Point size = new Point(0,0);
-        size.x = item.getLayoutWidth();
-        size.y = item.getLayoutHeight();
-        eswtCaptionedResize(item, ret, size.x, size.y);
+        eswtCaptionedResize(item, ret, item.getLayoutWidth(), item.getLayoutHeight());
         return ret;
     }
 
@@ -73,18 +68,22 @@
      */
     static Control eswtCreateControl(Composite parent, Item item)
     {
-        if(item.hasLabel())
-        {
-            CaptionedControl captioned = new CaptionedControl(parent, SWT.VERTICAL);
-            captioned.setText(item.getLabel());
-            eswtSpecificControl(captioned, item);
-            return captioned;
-        }
-        else
-        {
-            Control ret = eswtSpecificControl(parent, item);
-            return ret;
-        }
+        CaptionedControl captioned = new CaptionedControl(parent, SWT.VERTICAL);
+		if(item.hasLabel())
+		{
+        	captioned.setText(item.getLabel());
+		}
+
+		if(((ImageItem)item).getImage() != null)
+		{
+			eswtSpecificControl(captioned, item);
+		}
+		else
+		{
+			updateControlSize(null, captioned, (ImageItem)item);
+		}
+
+        return captioned;
     }
 
     /**
@@ -94,38 +93,10 @@
     {
         ImageItem imgItem = (ImageItem) item;
 
-        if(item.getNumCommands() == 0)
+        if(imgItem.getNumCommands() == 0)
         {
             Label imageLabel = new Label(parent, SWT.CENTER);
-            imageLabel.setImage(Image.getESWTImage(imgItem.getImage()));
-            imageLabel.pack();
-            int imageWidth = imageLabel.getBounds().width;
-            int imageHeight = imageLabel.getBounds().height;
-            int maxWidth = getMaximumItemWidth(item);
-            if(imageWidth > maxWidth)
-            {
-                Point size = imageLabel.computeSize(maxWidth, SWT.DEFAULT);
-                //Image Resize has to be done.
-                imageLabel.setSize(size.x, size.y);
-                imageWidth = size.x;
-                imageHeight = size.y;
-            }
-
-            if(imgItem.hasLabel())
-            {
-                int labelWidth = Font.getDefaultFont().stringWidth(imgItem.getLabel());
-
-                if(labelWidth > imageWidth)
-                {
-                    Point size = parent.computeSize(Math.min(labelWidth, maxWidth), SWT.DEFAULT);
-                    parent.setSize(size.x, size.y);
-                }
-                else
-                {
-                    parent.pack();
-                }
-            }
-
+			constructLabel(imageLabel, parent, imgItem);
             return imageLabel;
         }
         else
@@ -143,54 +114,176 @@
                 button = new Button(parent, SWT.FLAT | SWT.NONE);
                 break;
             }
-            button.setImage(Image.getESWTImage(imgItem.getImage()));
-            button.pack();
-            int buttonWidth = button.getBounds().width;
-            int buttonHeight = button.getBounds().height;
-            int maxWidth = getMaximumItemWidth(item);
-            if(buttonWidth > maxWidth)
-            {
-                Point size = button.computeSize(maxWidth, SWT.DEFAULT);
-                //Image Resize has to be done.
-                button.setSize(size.x, size.y);
-                buttonWidth = size.x;
-                buttonHeight = size.y;
-            }
-
-            if(imgItem.hasLabel())
-            {
-                int labelWidth = Font.getDefaultFont().stringWidth(imgItem.getLabel());
-
-                if(labelWidth > buttonWidth)
-                {
-                    Point size = parent.computeSize(Math.min(labelWidth, maxWidth), SWT.DEFAULT);
-                    parent.setSize(size.x, size.y);
-                }
-                else
-                {
-                    parent.pack();
-                }
-            }
-
+			constructButton(button, parent, imgItem);
             return button;
         }
     }
 
+	static private void constructLabel(Label imageLabel, Composite parent, ImageItem imgItem)
+	{
+        imageLabel.setImage(Image.getESWTImage(imgItem.getImage()));
+        imageLabel.pack();
+		updateControlSize(imageLabel, parent, imgItem);
+	}
+
+	static private void constructButton(Button button, Composite parent, ImageItem imgItem)
+	{
+		button.setImage(Image.getESWTImage(imgItem.getImage()));
+		button.pack();
+		updateControlSize(button, parent, imgItem);
+	}
+
+	static private void updateControlSize(Control control, Composite parent, ImageItem imgItem)
+	{
+		int controlWidth;
+		int controlHeight;
+		int maxWidth = getMaximumItemWidth(imgItem);
+
+		if(control != null)
+		{
+			controlWidth = control.getBounds().width;
+			controlHeight = control.getBounds().height;
+			
+			if(controlWidth > maxWidth)
+			{
+				//Image Resize has to be done.
+				Point size = control.computeSize(maxWidth, SWT.DEFAULT);
+				control.setSize(size.x, size.y);
+				controlWidth = size.x;
+				controlHeight = size.y;
+			}
+		}
+		else
+		{
+			controlWidth = maxWidth;
+		}
+		
+		if(imgItem.hasLabel())
+		{
+			int labelWidth = Font.getDefaultFont().stringWidth(imgItem.getLabel());
+		
+			if(labelWidth > controlWidth)
+			{
+				Point size = parent.computeSize(Math.min(labelWidth, maxWidth), SWT.DEFAULT);
+				parent.setSize(size.x, size.y);
+				return;
+			}
+		}
+		else if(control == null)
+		{
+			parent.setSize(0, 0);
+			return;
+		}
+
+		parent.pack();
+	}
+
     /**
      * Returns if this eSWT control is Layouter specific.
      */
     boolean eswtIsSpecificControl(Item item, Control control)
     {
-        // No implementation needed
         return ((control instanceof Label) || (control instanceof Button));
     }
 
     /**
      * Updates the values of ImageItem.
      */
-    void eswtUpdateItem(Item item, Control control, int reason, Object param)
+    void eswtUpdateItem(Item item, Control control, int aReason, Object param)
     {
-        // No implementation needed
+   		if(!(control instanceof  CaptionedControl))
+		{
+			return;
+		}
+			
+    	ImageItem imgItem = (ImageItem)item;
+		int reason = aReason & Item.UPDATE_SIZE_MASK;
+
+		switch(reason)
+		{
+		case Item.UPDATE_NONE:
+		case ImageItem.UPDATE_ALTTEXT:
+			break;
+
+		case Item.UPDATE_LABEL:
+		{
+			String label = imgItem.getLabel();
+			if(label == null)
+			{
+				label = "";
+			}
+
+			((CaptionedControl)control).setText(label);
+			Control sCtrl = eswtFindSpecificControl(imgItem, control);
+			updateControlSize(sCtrl, (Composite)control, imgItem);
+			break;
+		}
+
+		case ImageItem.UPDATE_IMAGE:
+		{
+			Control sCtrl = eswtFindSpecificControl(imgItem, control);
+			if(sCtrl != null)
+			{
+				if(imgItem.getImage() != null)
+				{
+					if(sCtrl instanceof Label)
+					{
+						constructLabel((Label)sCtrl, (Composite)control, imgItem);
+					}
+					else if(sCtrl instanceof Button)
+					{
+						constructButton((Button)sCtrl, (Composite)control, imgItem);
+					}
+				}
+				else
+				{
+					sCtrl.dispose();
+					updateControlSize(null, (Composite)control, imgItem);						
+				}
+			}
+			else
+			{
+				if(imgItem.getImage() != null)
+				{
+					eswtSpecificControl((Composite)control, imgItem);
+				}
+			}
+			break;
+		}
+
+		case Item.UPDATE_ADDCOMMAND:
+		{
+			Control sCtrl = eswtFindSpecificControl(imgItem, control);
+			if(sCtrl != null)
+			{
+				if((sCtrl instanceof Label) && (imgItem.getNumCommands()==1))
+				{
+					sCtrl.dispose();
+					eswtSpecificControl((Composite)control, imgItem);
+				}
+			}
+		}
+		break;
+		
+		case Item.UPDATE_REMOVECOMMAND:
+		{
+			Control sCtrl = eswtFindSpecificControl(imgItem, control);
+			if(sCtrl != null)
+			{
+				if((sCtrl instanceof Button) && (imgItem.getNumCommands()==0))
+				{
+					sCtrl.dispose();
+					eswtSpecificControl((Composite)control, imgItem);
+				}
+			}
+		}
+		break;
+
+		default:
+		{
+			break;
+		}
+		}
     }
 
     /**
--- a/javauis/lcdui_qt/src/javax/microedition/lcdui/Item.java	Tue Jul 06 14:10:26 2010 +0300
+++ b/javauis/lcdui_qt/src/javax/microedition/lcdui/Item.java	Wed Aug 18 09:43:15 2010 +0300
@@ -17,6 +17,7 @@
 package javax.microedition.lcdui;
 
 import java.util.Vector;
+import java.lang.ref.WeakReference;
 
 import javax.microedition.lcdui.EventDispatcher.LCDUIEvent;
 import com.nokia.mj.impl.nokialcdui.ItemControlStateChangeListener;
@@ -136,35 +137,27 @@
 
     static final int LAYOUT_VERTICAL_MASK = LAYOUT_VCENTER; // 48;
 
-
-    static final int UPDATE_NONE = 0;
-
-    static final int UPDATE_ADDCOMMAND = 1;
-
-    static final int UPDATE_REMOVECOMMAND = 2;
-
     /**
-     * Item content has changed. Re-layouting not needed.
+     * If Item is changed, reasons for Re-layouting.
      */
-    static final int UPDATE_CONTENT = 3; // general update value
-
-    static final int UPDATE_REASON_MASK = 255;
+	static final int UPDATE_NONE = 0;
 
-    /**
-     * Item height has changed. Re-layouting not needed.
-     */
-    static final int UPDATE_HEIGHT_CHANGED = 256;
+	static final int UPDATE_ADDCOMMAND = 1;
+	static final int UPDATE_REMOVECOMMAND = 1 << 1;
+	static final int UPDATE_DEFAULTCOMMAND = 1 << 2;
+	static final int UPDATE_ITEMCOMMANDLISTENER = 1 << 3;
+	static final int UPDATE_LABEL = 1 << 4;
+	static final int UPDATE_LAYOUT = 1 << 5;
+	static final int UPDATE_PREFERREDSIZE = 1 << 6;
 
-    /**
-     * Item width is changed. Re-layouting asap.
-     */
-    static final int UPDATE_WIDTH_CHANGED = 512;
-
-    /**
-     * Item width and height changed. Re-layouting asap.
-     */
+    static final int UPDATE_HEIGHT_CHANGED = 1 << 7;
+    static final int UPDATE_WIDTH_CHANGED = 1 << 8;
     static final int UPDATE_SIZE_CHANGED =
         UPDATE_HEIGHT_CHANGED | UPDATE_WIDTH_CHANGED;
+    static final int UPDATE_SIZE_MASK = ~UPDATE_SIZE_CHANGED;
+
+	static final int UPDATE_ITEM_MAX = 1 << 15;
+
 
     private String label;
 
@@ -177,7 +170,7 @@
     private ItemControlStateChangeListener controlListener;
 
     private Command defaultCommand;
-    private Screen parent;
+	private WeakReference wParent;
 
     private int layout;
     private int lockedPrefWidth = -1;
@@ -191,11 +184,18 @@
 
     /**
      * Sets the parent of this Item.
-     * @param parent new Parent. If null, current parent is removed.
+     * @param parent new Parent. If null, current parent is to be removed.
      */
     void setParent(Screen parent)
     {
-        this.parent = parent;
+    	if(parent != null)
+    	{
+    		wParent = new WeakReference(parent);
+    	}
+		else
+		{
+			clearParent();
+		}
     }
 
     /**
@@ -205,7 +205,27 @@
      */
     Screen getParent()
     {
-        return parent;
+    	if(wParent != null)
+    	{
+    		return (Screen)wParent.get();
+    	}
+		else
+		{
+			return null;
+		}
+    }
+
+    /**
+     * Clears the Item's parent.
+     *
+     */
+    void clearParent()
+    {
+    	if(wParent != null)
+    	{
+    		wParent.clear();
+			wParent = null;
+    	}
     }
 
     /**
@@ -221,8 +241,12 @@
             throw new IllegalStateException(
                 MsgRepository.ITEM_EXCEPTION_OWNED_BY_ALERT);
         }
+    	if((newLabel == null) && (label == null))
+		{
+			return;
+		}
         label = newLabel;
-        updateParent(UPDATE_SIZE_CHANGED);
+        updateParent(UPDATE_LABEL | UPDATE_SIZE_CHANGED);
     }
 
     /**
@@ -276,7 +300,7 @@
         }
         layout = newLayout;
         Logger.method(this, "setLayout", String.valueOf(layout));
-        updateParent(UPDATE_SIZE_CHANGED);
+        updateParent(UPDATE_LAYOUT | UPDATE_SIZE_CHANGED);
     }
 
     /**
@@ -302,19 +326,7 @@
         if(!commands.contains(command))
         {
             commands.addElement(command);
-
-            int reason = UPDATE_ADDCOMMAND;
-
-            if(this instanceof StringItem && commands.size() == 1)
-            {
-                reason |= UPDATE_SIZE_CHANGED;
-            }
-            if(this instanceof ImageItem && commands.size() == 1)
-            {
-                reason |= UPDATE_SIZE_CHANGED;
-            }
-
-            updateParent(reason, command);
+            updateParent(UPDATE_ADDCOMMAND, command);
         }
     }
 
@@ -332,21 +344,11 @@
         {
             // Remove command from commands-vector
             commands.removeElement(command);
-
-            defaultCommand = null;
-
-            int reason = UPDATE_REMOVECOMMAND;
-
-            if(this instanceof StringItem && commands.size() == 0)
-            {
-                reason |= UPDATE_SIZE_CHANGED;
-            }
-            if(this instanceof ImageItem && commands.size() == 0)
-            {
-                reason |= UPDATE_SIZE_CHANGED;
-            }
-
-            updateParent(reason, command);
+			if(defaultCommand == command)
+			{
+            	defaultCommand = null;
+			}
+            updateParent(UPDATE_REMOVECOMMAND, command);
         }
     }
 
@@ -519,7 +521,7 @@
         Logger.method(this, "setPrefSize",
                       String.valueOf(lockedPrefWidth),
                       String.valueOf(lockedPrefHeight));
-        updateParent(UPDATE_SIZE_CHANGED);
+        updateParent(UPDATE_PREFERREDSIZE | UPDATE_SIZE_CHANGED);
     }
 
     /**
@@ -568,7 +570,7 @@
                 MsgRepository.ITEM_EXCEPTION_NOT_OWNED_BY_FORM);
         }
         // Notify item state listener
-        ((Form) parent).notifyItemStateChanged(this);
+        ((Form) getParent()).notifyItemStateChanged(this);
     }
 
     /**
@@ -628,7 +630,7 @@
      */
     boolean isContainedInAlert()
     {
-        return (parent != null && parent instanceof Alert);
+        return ((wParent != null) && (getParent() instanceof Alert));
     }
 
     /**
@@ -636,7 +638,7 @@
      */
     boolean isContainedInForm()
     {
-        return (parent != null && parent instanceof Form);
+        return ((wParent != null) && (getParent() instanceof Form));
     }
 
     /**
@@ -670,7 +672,7 @@
         }
         if(isContainedInForm())
         {
-            ((Form) parent).updateItemState(this, updateReason, param);
+        	((Form) getParent()).updateItemState(this, updateReason, param);
         }
     }
 
--- a/javauis/lcdui_qt/src/javax/microedition/lcdui/ItemLayouter.java	Tue Jul 06 14:10:26 2010 +0300
+++ b/javauis/lcdui_qt/src/javax/microedition/lcdui/ItemLayouter.java	Wed Aug 18 09:43:15 2010 +0300
@@ -36,11 +36,11 @@
     /**
      * Key name for paint listener.
      */
-    private static final String FOCUS_LISTENER = "itemfocus";
+    private static final String FOCUS_LISTENER = "FocusListener";
 
     protected static final String MIN_TEXT = "...";
 
-    protected DefaultFormInteraction dfi;
+    protected FormLayouter formLayouter;
 
     protected Composite formComposite;
 
@@ -112,12 +112,12 @@
     /**
      * Constructor.
      *
-     * @param dflp - DefaultFormLayoutPolicy used for layouting.
+     * @param aFormLayouter FormLayouter used for layouting.
      */
-    ItemLayouter(DefaultFormLayoutPolicy dflp)
+    ItemLayouter(FormLayouter aFormLayouter)
     {
-        this.dfi = (DefaultFormInteraction) dflp;
-        formComposite = dflp.getForm().getFormComposite();
+        formLayouter = aFormLayouter;
+        formComposite = formLayouter.getForm().getFormComposite();
         ESWTUIThreadRunner.syncExec(new Runnable()
         {
             public void run()
@@ -132,7 +132,7 @@
      */
     int eswtGetLabelAlignmentDirective()
     {
-        return dfi.getLanguageSpecificLayoutDirective();
+        return formLayouter.getLanguageSpecificLayoutDirective();
     }
 
     /**
@@ -143,8 +143,8 @@
      */
     void eswtLayoutItem(Row row, Item item)
     {
-        LayoutObject lo = new LayoutObject(item, eswtGetCaptionedControl(item));
-        dfi.eswtAddNewLayoutObject(lo);
+    	LayoutObject lo = getLayoutObject(item);
+        formLayouter.eswtAddNewLayoutObject(lo);
         if(item instanceof CustomItem)
         {
             ItemControlStateChangeListener listener = item.getItemControlStateChangeListener();
@@ -157,6 +157,22 @@
     }
 
     /**
+     * Creates LayoutObject for the given Item.
+     *
+     * @param item Item to layout
+     * @return LayoutObject
+     */
+    LayoutObject getLayoutObject(Item item)
+    {
+    	LayoutObject lo = formLayouter.getLayoutObject(item);
+    	if(lo == null)
+    	{
+        	lo = new LayoutObject(item, eswtGetCaptionedControl(item));
+    	}
+		return lo;
+    }
+
+    /**
      * Wraps this item's control in the necessary composites.<br>
      * Based on the item, the result of this method can be:
      * <li> specific Control
@@ -169,20 +185,14 @@
      */
     final Control eswtGetCaptionedControl(Item item)
     {
+        CaptionedControl captioned = new CaptionedControl(formComposite, SWT.VERTICAL);
         if(item.hasLabel())
         {
-            CaptionedControl captioned = new CaptionedControl(formComposite, SWT.VERTICAL);
-            captioned.setText(item.getLabel());
-            eswtGetControl(captioned, item);
-            eswtCaptionedResize(item, captioned, item.getLayoutWidth(), item.getLayoutHeight());
-            return captioned;
-        }
-        else
-        {
-            Control ret = eswtGetControl(formComposite, item);
-            eswtCaptionedResize(item, ret, item.getLayoutWidth(), item.getLayoutHeight());
-            return ret;
-        }
+	        captioned.setText(item.getLabel());
+		}
+        eswtGetControl(captioned, item);
+        eswtCaptionedResize(item, captioned, item.getLayoutWidth(), item.getLayoutHeight());
+        return captioned;
     }
 
     /**
@@ -244,7 +254,10 @@
      */
     void eswtResizeControl(Item item, Control control, int width, int height)
     {
-        control.setSize(width, height);
+    	if(control != null)
+    	{
+        	control.setSize(width, height);
+    	}
     }
 
     /**
@@ -337,12 +350,11 @@
         {
             public void run()
             {
-                Control specific = eswtFindSpecificControl(item, control);
-                if(specific != null)
+                if(control != null)
                 {
-                    if(!specific.isDisposed())
+                    if(!control.isDisposed())
                     {
-                        eswtUpdateItem(item, specific, reason, param);
+                        eswtUpdateItem(item, control, reason, param);
                     }
                     else
                     {
@@ -430,7 +442,7 @@
      */
     Control eswtGetFirstControl(Item item)
     {
-        LayoutObject lo = dfi.getFirstLayoutObjectOfItem(item);
+        LayoutObject lo = formLayouter.getFirstLayoutObjectOfItem(item);
         if(lo != null)
         {
             return lo.getControl();
@@ -446,7 +458,7 @@
      */
     Control eswtGetFirstSpecificControl(Item item)
     {
-        LayoutObject lo = dfi.getFirstLayoutObjectOfItem(item);
+        LayoutObject lo = formLayouter.getFirstLayoutObjectOfItem(item);
         if(lo != null)
         {
             Control control = lo.getControl();
@@ -707,7 +719,7 @@
             if(!item.isFocused())
             {
                 // Logger.method(item, "focusGained");
-                dfi.eswtSetCurrentSelectedItem(item);
+                formLayouter.eswtSetCurrentSelectedItem(item);
             }
         }
 
--- a/javauis/lcdui_qt/src/javax/microedition/lcdui/KeyTable.java	Tue Jul 06 14:10:26 2010 +0300
+++ b/javauis/lcdui_qt/src/javax/microedition/lcdui/KeyTable.java	Wed Aug 18 09:43:15 2010 +0300
@@ -27,29 +27,33 @@
     static final int[][] KEY_TO_GAME_TABLE =
     {
         {-1,  Canvas.UP},
-        {50,  Canvas.UP},
+        {Canvas.KEY_NUM2,  Canvas.UP},
         {SWT.ARROW_UP,  Canvas.UP},
 
         {-2,  Canvas.DOWN},
-        {56,  Canvas.DOWN},
+        {Canvas.KEY_NUM8,  Canvas.DOWN},
         {SWT.ARROW_DOWN,  Canvas.DOWN},
 
         {-3,  Canvas.LEFT},
-        {52,  Canvas.LEFT},
+        {Canvas.KEY_NUM4,  Canvas.LEFT},
         {SWT.ARROW_LEFT,  Canvas.LEFT},
 
         {-4,  Canvas.RIGHT},
-        {54,  Canvas.RIGHT},
+        {Canvas.KEY_NUM6,  Canvas.RIGHT},
         {SWT.ARROW_RIGHT,  Canvas.RIGHT},
 
         {-5,  Canvas.FIRE},
-        {53,  Canvas.FIRE},
+        {Canvas.KEY_NUM5,  Canvas.FIRE},
         {-10, Canvas.FIRE},
 
-        {55,  Canvas.GAME_A},
-        {57,  Canvas.GAME_B},
-        {42,  Canvas.GAME_C},
-        {35,  Canvas.GAME_D},
+        {Canvas.KEY_NUM7,  Canvas.GAME_A},
+        {Canvas.KEY_NUM9,  Canvas.GAME_B},
+        {Canvas.KEY_STAR,  Canvas.GAME_C},
+        {Canvas.KEY_POUND,  Canvas.GAME_D},
+        
+        {Canvas.KEY_NUM0, 0},
+        {Canvas.KEY_NUM1, 0},
+        {Canvas.KEY_NUM3, 0}
     };
 
     /**
@@ -91,43 +95,42 @@
 
         switch(keyCode)
         {
-            /*case Canvas.KEY_NUM0:
-                return "0";
+        case Canvas.KEY_NUM0:
+            return "0";
 
-            case Canvas.KEY_NUM1:
-                return "1";
+        case Canvas.KEY_NUM1:
+            return "1";
 
-            case Canvas.KEY_NUM2:
-                return "2";
+        case Canvas.KEY_NUM2:
+            return "2";
 
-            case Canvas.KEY_NUM3:
-                return "3";
+        case Canvas.KEY_NUM3:
+            return "3";
 
-            case Canvas.KEY_NUM4:
-                return "4";
+        case Canvas.KEY_NUM4:
+            return "4";
 
-            case Canvas.KEY_NUM5:
-                return "5";
+        case Canvas.KEY_NUM5:
+            return "5";
 
-            case Canvas.KEY_NUM6:
-                return "6";
+        case Canvas.KEY_NUM6:
+            return "6";
 
-            case Canvas.KEY_NUM7:
-                return "7";
+        case Canvas.KEY_NUM7:
+            return "7";
 
-            case Canvas.KEY_NUM8:
-                return "8";
+        case Canvas.KEY_NUM8:
+            return "8";
 
-            case Canvas.KEY_NUM9:
-                return "9";
-
+        case Canvas.KEY_NUM9:
+            return "9";
 
-            case Canvas.KEY_STAR:
-                return "*";
+        case Canvas.KEY_STAR:
+            return "*";
 
-            case Canvas.KEY_POUND:
-                return "#";
-                */
+        case Canvas.KEY_POUND:
+            return "#";
+                
         case -1:
             return OpenLcduiLocalization.getMessage("key_up");
 
@@ -144,7 +147,8 @@
             return OpenLcduiLocalization.getMessage("key_select");
 
         default:
-            return "";
+            throw new IllegalArgumentException(
+            MsgRepository.CANVAS_EXCEPTION_INVALID_KEY_CODE);
         }
     }
 
--- a/javauis/lcdui_qt/src/javax/microedition/lcdui/LCDUIInvokerImpl.java	Tue Jul 06 14:10:26 2010 +0300
+++ b/javauis/lcdui_qt/src/javax/microedition/lcdui/LCDUIInvokerImpl.java	Wed Aug 18 09:43:15 2010 +0300
@@ -62,7 +62,7 @@
             if(item.isContainedInForm())
             {
                 Form parentForm = (Form) item.getParent();
-                return parentForm.getLayoutPolicy().getItemControl(item);
+                return parentForm.getFormLayouter().getItemControl(item);
             }
         }
         return null;
--- a/javauis/lcdui_qt/src/javax/microedition/lcdui/LayoutObject.java	Tue Jul 06 14:10:26 2010 +0300
+++ b/javauis/lcdui_qt/src/javax/microedition/lcdui/LayoutObject.java	Wed Aug 18 09:43:15 2010 +0300
@@ -108,32 +108,25 @@
         Control ret = null;
 
         //If the Control is focusable add the commands to the same.
-        if((ctrl instanceof CaptionedControl) || (ctrl.isFocusControl()))
+        if((ctrl instanceof CaptionedControl) || (ctrl instanceof Button) 
+			|| (ctrl.isFocusControl()))
         {
             return ctrl;
         }
 
-
-        if(ctrl != null)
+        if(ctrl instanceof Composite)
         {
-            if(ctrl instanceof Button)
-            {
-                ret = ctrl;
-            }
-            else if(ctrl instanceof Composite)
+            Control[] children = ((Composite) ctrl).getChildren();
+            for(int i = 0; i < children.length; i++)
             {
-                Control[] children = ((Composite) ctrl).getChildren();
-                for(int i = 0; i < children.length; i++)
+                ret = eswtGetCommandControl(children[i]);
+                if(ret != null)
                 {
-                    Control result = eswtGetCommandControl(children[i]);
-                    if(result != null)
-                    {
-                        ret = result;
-                        break;
-                    }
+                    break;
                 }
             }
         }
+
         return ret;
     }
 
@@ -146,6 +139,7 @@
         {
             public void run()
             {
+            	owningItem = null;
                 control.dispose();
                 control = null;
                 commandControl = null;
--- a/javauis/lcdui_qt/src/javax/microedition/lcdui/List.java	Tue Jul 06 14:10:26 2010 +0300
+++ b/javauis/lcdui_qt/src/javax/microedition/lcdui/List.java	Wed Aug 18 09:43:15 2010 +0300
@@ -466,7 +466,14 @@
     {
         if(type == Choice.IMPLICIT)
         {
-            if(cmd != SELECT_COMMAND)
+            if(cmd == null)
+            {
+            	if(selectCommand != null)
+            	{
+            		super.removeCommand(selectCommand);
+            	}
+            }
+            else if(cmd != SELECT_COMMAND)
             {
                 addCommand(cmd);
             }
--- a/javauis/lcdui_qt/src/javax/microedition/lcdui/Row.java	Tue Jul 06 14:10:26 2010 +0300
+++ b/javauis/lcdui_qt/src/javax/microedition/lcdui/Row.java	Wed Aug 18 09:43:15 2010 +0300
@@ -190,7 +190,6 @@
             else
             {
                 layoutObjects.removeElement(lo);
-                lo.dispose();
             }
         }
         updateRowInternals();
@@ -199,7 +198,7 @@
 
     /**
      * Update item positions in a row.<br>
-     * This method called by Layouters or FormLayoutPolicy when row is full and
+     * This method called by FormLayouter when row is full and
      * ready for layout.
      */
     void updateRowLayout(boolean isLeftToRight)
--- a/javauis/lcdui_qt/src/javax/microedition/lcdui/Spacer.java	Tue Jul 06 14:10:26 2010 +0300
+++ b/javauis/lcdui_qt/src/javax/microedition/lcdui/Spacer.java	Wed Aug 18 09:43:15 2010 +0300
@@ -23,6 +23,10 @@
  */
 public class Spacer extends Item
 {
+    /**
+     * If Spacer is changed, reasons for Re-layouting.
+     */
+	static final int UPDATE_MINIMUMSIZE = UPDATE_ITEM_MAX << 1;
 
     private int minimumWidth = -1;
     private int minimumHeight = -1;
@@ -90,14 +94,17 @@
             if(minW != getMinimumWidth())
             {
                 minimumWidth = minW;
-                updateReason |= Item.UPDATE_WIDTH_CHANGED;
+                updateReason |= UPDATE_MINIMUMSIZE | UPDATE_SIZE_CHANGED;
             }
             if(minH != getMinimumHeight())
             {
                 minimumHeight = minH;
-                updateReason |= Item.UPDATE_HEIGHT_CHANGED;
+                updateReason |= UPDATE_MINIMUMSIZE | UPDATE_SIZE_CHANGED;
             }
-            updateParent(updateReason);
+			if(updateReason != Item.UPDATE_NONE)
+            {
+            	updateParent(updateReason);
+			}
         }
     }
 
--- a/javauis/lcdui_qt/src/javax/microedition/lcdui/SpacerLayouter.java	Tue Jul 06 14:10:26 2010 +0300
+++ b/javauis/lcdui_qt/src/javax/microedition/lcdui/SpacerLayouter.java	Wed Aug 18 09:43:15 2010 +0300
@@ -29,11 +29,27 @@
     /**
      * Constructor.
      *
-     * @param dflp DefaultFormLayoutPolicy.
+     * @param aFormLayouter FormLayouter used for layouting.
      */
-    SpacerLayouter(DefaultFormLayoutPolicy dflp)
+    SpacerLayouter(FormLayouter aFormLayouter)
     {
-        super(dflp);
+        super(aFormLayouter);
+    }
+
+    /**
+     * Creates LayoutObject for the given Item.
+     *
+     * @param item Item to layout
+     * @return LayoutObject
+     */
+    LayoutObject getLayoutObject(Item item)
+    {
+    	LayoutObject lo = formLayouter.getLayoutObject(item);
+    	if(lo == null)
+    	{
+        	lo = new LayoutObject(item, eswtGetControl(formComposite, item));
+    	}
+		return lo;
     }
 
     /**
@@ -58,7 +74,7 @@
      */
     boolean eswtIsSpecificControl(Item item, Control control)
     {
-        return true;
+	    return (control instanceof Composite);
     }
 
     /**
@@ -68,9 +84,38 @@
      * @param control eSWT control.
      * @param reason reason to update.
      */
-    void eswtUpdateItem(Item item, Control control, int reason, Object param)
+    void eswtUpdateItem(Item item, Control control, int aReason, Object param)
     {
-        // no implementation needed.
+		/*if(control instanceof  Composite)
+		{
+			control.setSize(item.getMinimumWidth(), item.getMinimumHeight());
+		}*/
+
+   		if(!(control instanceof  Composite))
+		{
+			return;
+		}
+			
+    	Spacer spacer = (Spacer)item;
+		int reason = aReason & Item.UPDATE_SIZE_MASK;
+
+		switch(reason)
+		{
+		case Item.UPDATE_NONE:
+			break;
+
+		case Spacer.UPDATE_MINIMUMSIZE:
+		{
+			Control sCtrl = eswtFindSpecificControl(spacer, control);
+			sCtrl.setSize(item.getMinimumWidth(), item.getMinimumHeight());
+			break;
+		}
+
+		default:
+		{
+			break;
+		}
+		}
     }
 
 }
--- a/javauis/lcdui_qt/src/javax/microedition/lcdui/StringItem.java	Tue Jul 06 14:10:26 2010 +0300
+++ b/javauis/lcdui_qt/src/javax/microedition/lcdui/StringItem.java	Wed Aug 18 09:43:15 2010 +0300
@@ -23,6 +23,11 @@
  */
 public class StringItem extends Item
 {
+    /**
+     * If StringItem is changed, reasons for Re-layouting.
+     */
+	static final int UPDATE_FONT = UPDATE_ITEM_MAX << 1;
+	static final int UPDATE_TEXT = UPDATE_ITEM_MAX << 2;
 
     private String text;
     private int appearanceMode;
@@ -90,7 +95,7 @@
         {
             text = newTxt;
         }
-        updateParent(UPDATE_SIZE_CHANGED);
+        updateParent(UPDATE_TEXT);
     }
 
     /**
@@ -113,7 +118,7 @@
     public void setFont(Font f)
     {
         font = (f == null ? Font.getDefaultFont() : f);
-        updateParent(UPDATE_SIZE_CHANGED);
+        updateParent(UPDATE_FONT);
     }
 
     /**
@@ -136,6 +141,39 @@
     }
 
     /**
+     * Adds command to this StringItem. If same command is already added to this item,
+     * nothing happens.
+     *
+     * @param command A command to be added.
+     * @throws NullPointerException if cmd is null.
+     */
+    public void addCommand(Command command)
+    {
+    	super.addCommand(command);
+		
+		if(getCommands().size() == 1)
+		{
+			updateParent(UPDATE_SIZE_CHANGED);
+		}
+    }
+
+    /**
+     * Removes command from the StringItem. If command doesn't exists in this item,
+     * nothing happens.
+     *
+     * @param command The command to be removed.
+     */
+    public void removeCommand(Command command)
+    {
+    	super.removeCommand(command);
+		
+		if(getCommands().size() == 0)
+		{
+			updateParent(UPDATE_SIZE_CHANGED);
+		}
+    }
+
+    /**
      * Calculates minimum size of this item.
      *
      * @return Minimum size.
--- a/javauis/lcdui_qt/src/javax/microedition/lcdui/StringItemLayouter.java	Tue Jul 06 14:10:26 2010 +0300
+++ b/javauis/lcdui_qt/src/javax/microedition/lcdui/StringItemLayouter.java	Wed Aug 18 09:43:15 2010 +0300
@@ -46,11 +46,11 @@
     /**
      * Constructor.
      *
-     * @param dflp DefaultFormLayoutPolicy
+     * @param aFormLayouter FormLayouter used for layouting.
      */
-    StringItemLayouter(DefaultFormLayoutPolicy dflp)
+    StringItemLayouter(FormLayouter aFormLayouter)
     {
-        super(dflp);
+        super(aFormLayouter);
     }
 
     /**
@@ -162,8 +162,9 @@
             if(stringItem.getAppearanceMode() == StringItem.BUTTON)
             {
                 // BUTTON
-                dfi.eswtAddNewLayoutObject(
-                    new LayoutObject(item, eswtGetCaptionedControl(item)));
+                LayoutObject lo = formLayouter.getLayoutObject(item);
+                formLayouter.eswtAddNewLayoutObject(lo == null ? 
+					new LayoutObject(item, eswtGetCaptionedControl(item)) : lo);
             }
             else
             {
@@ -203,7 +204,7 @@
         String label = item.getLabel();
 
         Vector strings = StringWrapper.wrapString(item.getText(),
-                         item.getFont(), dfi.getForm().getLeftRightLanguage(),
+                         item.getFont(), formLayouter.getForm().getLeftRightLanguage(),
                          row.getRowWidth(), row.getFreeSpace());
 
         if(strings != null)
@@ -212,7 +213,7 @@
             {
                 // create primitive StringItem
                 Control control = eswtCreateLabeledPrimitiveStringItem(
-                                      dfi.getForm().getFormComposite(),
+                                      formLayouter.getForm().getFormComposite(),
                                       (String) strings.elementAt(i),
                                       label, item.getFont(), isHyperlink,
                                       getMaximumItemWidth(item));
@@ -221,8 +222,9 @@
                 label = null;
 
                 // layoutObject which represent primitive StringItem
-                dfi.eswtAddNewLayoutObject(
-                    new LayoutObject(item, control), i != 0);
+                LayoutObject lo = formLayouter.getLayoutObject(item);
+                formLayouter.eswtAddNewLayoutObject((lo == null ?
+                    new LayoutObject(item, control) : lo), i != 0);
             }
         }
     }
@@ -246,7 +248,7 @@
         int height = item.getPreferredHeight();
 
         Vector strings = StringWrapper.wrapString(item.getText(),
-                         item.getFont(), dfi.getForm().getLeftRightLanguage(),
+                         item.getFont(), formLayouter.getForm().getLeftRightLanguage(),
                          width, width);
 
         // Create composite which will contain the lines of locked stringitem:
@@ -301,7 +303,8 @@
                 label = null;
             }
         }
-        dfi.eswtAddNewLayoutObject(new LayoutObject(item, comp), false);
+		LayoutObject lo = formLayouter.getLayoutObject(item);
+        formLayouter.eswtAddNewLayoutObject((lo == null ? new LayoutObject(item, comp) : lo), false);
     }
 
     /**
@@ -354,10 +357,10 @@
             int objectWidth = Math.max(textWidth, headerWidth);
 
             header.setLocation(ItemLayouter.getXLocation(objectWidth,
-                               headerWidth, dfi.getLanguageSpecificLayoutDirective()), 0);
+                               headerWidth, formLayouter.getLanguageSpecificLayoutDirective()), 0);
 
             text.setLocation(ItemLayouter.getXLocation(objectWidth, textWidth,
-                             dfi.getLanguageSpecificLayoutDirective()),
+                             formLayouter.getLanguageSpecificLayoutDirective()),
                              header.getBounds().height);
 
             comp.pack();
@@ -657,7 +660,7 @@
     {
         LayoutObject lo = null;
         Control c = null;
-        while((lo = dfi.getNextLayoutObjectOfItem(lo, item)) != null)
+        while((lo = formLayouter.getNextLayoutObjectOfItem(lo, item)) != null)
         {
             if((c = lo.getControl()) != null)
             {
@@ -778,7 +781,7 @@
         {
             Logger.method(this, "widgetSelected");
             e.doit = false;
-            Item item = dfi.getCurrentSelectedItem();
+            Item item = formLayouter.getCurrentSelectedItem();
             item.callCommandAction(item.getMSKCommand());
         }
     }
--- a/javauis/lcdui_qt/src/javax/microedition/lcdui/TextBox.java	Tue Jul 06 14:10:26 2010 +0300
+++ b/javauis/lcdui_qt/src/javax/microedition/lcdui/TextBox.java	Wed Aug 18 09:43:15 2010 +0300
@@ -286,6 +286,9 @@
     public void setConstraints(int newConstraints)
     {
         textWrapper.setConstraints(newConstraints);
+
+        if(!textWrapper.isValidText(getString() , textWrapper.getTypeConstraint(newConstraints)))
+    	          setString("");        
     }
 
     /**
--- a/javauis/lcdui_qt/src/javax/microedition/lcdui/TextField.java	Tue Jul 06 14:10:26 2010 +0300
+++ b/javauis/lcdui_qt/src/javax/microedition/lcdui/TextField.java	Wed Aug 18 09:43:15 2010 +0300
@@ -78,10 +78,15 @@
     public static final int CONSTRAINT_MASK = 65535; // 0xFFFF
 
     /**
-     * Constant used by layouter to update TextField when setInitialInputMode
-     * was called.
+     * If TextField is changed, reasons for Re-layouting.
      */
-    static final int UPDATE_INITIAL_INPUT_MODE = 8;
+	static final int UPDATE_REASON_DELETE = UPDATE_ITEM_MAX << 1;
+	static final int UPDATE_REASON_INSERT = UPDATE_ITEM_MAX << 2;
+	static final int UPDATE_CHARS = UPDATE_ITEM_MAX << 3;
+	static final int UPDATE_CONSTRAINTS = UPDATE_ITEM_MAX << 4;
+	static final int UPDATE_INITIALINPUTMODE = UPDATE_ITEM_MAX << 5;
+	static final int UPDATE_MAXSIZE = UPDATE_ITEM_MAX << 6;
+	static final int UPDATE_STRING = UPDATE_ITEM_MAX << 7;
 
 
     private TextWrapper textWrapper;
@@ -132,7 +137,7 @@
     {
         textWrapper.setContent(newTxt);
         linesCount = 0;
-        updateParent(Item.UPDATE_CONTENT | Item.UPDATE_HEIGHT_CHANGED);
+        updateParent(UPDATE_STRING);
     }
 
     /**
@@ -182,7 +187,7 @@
         }
         textWrapper.setContent(extractedString);
         linesCount = 0;
-        updateParent(Item.UPDATE_CONTENT | Item.UPDATE_HEIGHT_CHANGED);
+        updateParent(UPDATE_CHARS);
     }
 
     /**
@@ -195,7 +200,7 @@
     {
         textWrapper.insert(newTxt, position);
         linesCount = 0;
-        updateParent(Item.UPDATE_CONTENT | Item.UPDATE_HEIGHT_CHANGED);
+        updateParent(UPDATE_REASON_INSERT);
     }
 
     /**
@@ -225,7 +230,7 @@
         }
         textWrapper.insert(extractedString, position);
         linesCount = 0;
-        updateParent(Item.UPDATE_CONTENT | Item.UPDATE_HEIGHT_CHANGED);
+        updateParent(UPDATE_REASON_INSERT);
     }
 
     /**
@@ -238,7 +243,7 @@
     {
         textWrapper.delete(offset, length);
         linesCount = 0;
-        updateParent(Item.UPDATE_CONTENT | Item.UPDATE_HEIGHT_CHANGED);
+        updateParent(UPDATE_REASON_DELETE);
     }
 
     /**
@@ -262,7 +267,7 @@
     {
         textWrapper.setMaxSize(newMaxSize);
         linesCount = 0;
-        updateParent(Item.UPDATE_CONTENT | Item.UPDATE_HEIGHT_CHANGED);
+        updateParent(UPDATE_MAXSIZE);
         return textWrapper.getMaxSize();
     }
 
@@ -284,7 +289,10 @@
     public void setConstraints(int newConstraints)
     {
         textWrapper.setConstraints(newConstraints);
-        updateParent(Item.UPDATE_CONTENT | Item.UPDATE_SIZE_CHANGED);
+        updateParent(UPDATE_CONSTRAINTS);
+        if(!textWrapper.isValidText(getString() , textWrapper.getTypeConstraint(newConstraints)))
+    	          setString("");
+        updateParent(UPDATE_STRING | UPDATE_SIZE_CHANGED);
     }
 
     /**
@@ -305,7 +313,7 @@
     public void setInitialInputMode(String inputMode)
     {
         textWrapper.setInputMode(inputMode);
-        updateParent(UPDATE_INITIAL_INPUT_MODE);
+        updateParent(UPDATE_INITIALINPUTMODE);
     }
 
     /**
--- a/javauis/lcdui_qt/src/javax/microedition/lcdui/TextFieldLayouter.java	Tue Jul 06 14:10:26 2010 +0300
+++ b/javauis/lcdui_qt/src/javax/microedition/lcdui/TextFieldLayouter.java	Wed Aug 18 09:43:15 2010 +0300
@@ -58,11 +58,11 @@
     /**
      * Constructor.
      *
-     * @param dflp DefaultFormLayoutPolicy`
+     * @param aFormLayouter FormLayouter used for layouting.
      */
-    TextFieldLayouter(DefaultFormLayoutPolicy dflp)
+    TextFieldLayouter(FormLayouter aFormLayouter)
     {
-        super(dflp);
+        super(aFormLayouter);
     }
 
     /**
@@ -112,6 +112,24 @@
     static boolean checkText(final int constraint, final String text)
     {
         isCorrectText = true;
+
+        try
+        {   
+         	  if(constraint == TextField.NUMERIC && !text.equals(""))
+            {
+                Integer.parseInt(text);
+            }
+            else if(constraint == TextField.DECIMAL && !text.equals(""))
+            {
+                Float.parseFloat(text);
+            }
+        }
+        catch( NumberFormatException e )
+        {   
+        	  // Illegal text
+            return false;
+        }
+
         ESWTUIThreadRunner.syncExec(new Runnable()
         {
             public void run()
@@ -149,7 +167,7 @@
 
         if(textfield.getInitialInputMode() != null)
         {
-            eswtUpdateItem(textfield, te, TextField.UPDATE_INITIAL_INPUT_MODE,
+            eswtUpdateItem(textfield, te, TextField.UPDATE_INITIALINPUTMODE,
                            null);
         }
         return te;
@@ -178,16 +196,16 @@
     void eswtUpdateItem(Item item, Control control, int reason, Object param)
     {
         TextField textfield = (TextField) item;
-        if(reason == Item.UPDATE_CONTENT)
-        {
-            TextWrapper.eswtSetContent(control, textfield.getString());
-        }
-        else if(reason == TextField.UPDATE_INITIAL_INPUT_MODE)
+        if(reason == TextField.UPDATE_INITIALINPUTMODE)
         {
             TextWrapper.eswtSetInputMode(control,
                                          textfield.getInitialInputMode(),
                                          textfield.getConstraints());
         }
+        else
+        {
+            TextWrapper.eswtSetContent(control, textfield.getString());
+        }
     }
 
     /**
@@ -413,7 +431,7 @@
                 textfield.internalSetLinesCount(lines);
                 Control control = eswtGetFirstControl(textfield);
                 if(control.getSize().y + te.getLineHeight()
-                        + Config.TEXTFIELD_MARGIN <= dfi.getFormHeight())
+                        + Config.TEXTFIELD_MARGIN <= formLayouter.getFormHeight())
                 {
                     textfield.updateParent(Item.UPDATE_HEIGHT_CHANGED);
                 }
@@ -490,9 +508,9 @@
         {
             // this is needed if focus was changed with touch.
             // so ne scrolling was done in DFI.
-            if(!dfi.isItemFullyVisible(textfield))
+            if(!formLayouter.isItemFullyVisible(textfield))
             {
-                dfi.eswtScrollToItem(textfield);
+                formLayouter.eswtScrollToItem(textfield);
             }
             textfield.internalSetCaretPosition(
                 TextWrapper.eswtGetCaretPosition((Control) keyEvent.widget));
--- a/javauis/lcdui_qt/tsrc/src/com/nokia/openlcdui/mt/AllTests.java	Tue Jul 06 14:10:26 2010 +0300
+++ b/javauis/lcdui_qt/tsrc/src/com/nokia/openlcdui/mt/AllTests.java	Wed Aug 18 09:43:15 2010 +0300
@@ -186,6 +186,7 @@
         addTest(com.nokia.openlcdui.mt.gauge.GaugeTest.suite());
         addTest(com.nokia.openlcdui.mt.graphics.DirectGraphicsTest.suite());
         addTest(com.nokia.openlcdui.mt.graphics.GraphicsTest.suite());
+        addTest(com.nokia.openlcdui.mt.graphics.CommandBufferingTest.suite());
         addTest(com.nokia.openlcdui.mt.image.ImageTest.suite());
         addTest(com.nokia.openlcdui.mt.imageitem.ImageItemTest.suite());
         addTest(com.nokia.openlcdui.mt.item.ItemTest.suite());
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/lcdui_qt/tsrc/src/com/nokia/openlcdui/mt/graphics/CommandBufferingTest.java	Wed Aug 18 09:43:15 2010 +0300
@@ -0,0 +1,913 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+package com.nokia.openlcdui.mt.graphics;
+
+import junit.framework.*;
+import javax.microedition.lcdui.*;
+import com.nokia.openlcdui.mt.SWTTestCase;
+
+public class CommandBufferingTest extends SWTTestCase
+{
+    private Image testImage;
+    private final int testImageWidth = 20;
+    private final int testImageHeight = 20;
+    private int[] pixelData;
+    
+    private final int GRAPHICS_SETTINGS_1 = 1;
+    private final int GRAPHICS_SETTINGS_2 = 2;
+    
+    private final int WHITE = 0x00ffffff;
+    private final int BLACK = 0x00000000;
+    private final int RED =   0x00ff0000; 
+    private final int GREEN = 0x0000ff00;
+    private final int BLUE =  0x000000ff; 
+       
+    /**
+     * Constructor.
+     */
+    public CommandBufferingTest()
+    {
+    }
+
+    /**
+     * Constructor.
+     *
+     * @param sTestName Test name.
+     * @param rTestMethod Test method.
+     */
+    public CommandBufferingTest(String sTestName)
+    {
+        super(sTestName);
+    }
+
+    protected void setUp() throws Exception
+    {
+        super.setUp();
+        testImage = Image.createImage(testImageWidth, testImageHeight);
+        pixelData = new int[testImageWidth*testImageHeight];
+    }
+
+    protected void tearDown() throws Exception
+    {
+        super.tearDown();
+        testImage = null;
+        pixelData = null;
+    }
+
+    /**
+     * To create the test suite. You need to add a new aSuite.addTest entry for
+     * any new test methods.
+     *
+     * @return new testsuite.
+     */
+    public static Test suite()
+    {
+        TestSuite suite = new TestSuite();
+
+        java.util.Vector methodNames;
+        java.util.Enumeration e;
+
+        // Add widget tests
+        methodNames = CommandBufferingTest.methodNames();
+        e = methodNames.elements();
+        while(e.hasMoreElements())
+        {
+            suite.addTest(new CommandBufferingTest((String)e.nextElement()));
+        }
+
+        return suite;
+    }
+
+    public static java.util.Vector methodNames()
+    {
+        java.util.Vector methodNames = new java.util.Vector();
+        methodNames.addElement("testDefaultValues");
+        methodNames.addElement("testClip1");
+        methodNames.addElement("testClip2");
+        methodNames.addElement("testDrawArc");
+        methodNames.addElement("testDrawImage");
+        methodNames.addElement("testDrawLine");
+        methodNames.addElement("testDrawRect");
+        methodNames.addElement("testDrawRGB");
+        methodNames.addElement("testDrawRoundRect");
+        methodNames.addElement("testDrawString");
+        methodNames.addElement("testFillArc");
+        methodNames.addElement("testFillRect");
+        methodNames.addElement("testFillRoundRect");
+        methodNames.addElement("testFillTriangle");
+
+        return methodNames;
+    }
+
+    protected void runTest() throws Throwable
+    {
+    	if(getName().equals("testDefaultValues")) testDefaultValues();
+    	else if(getName().equals("testClip1")) testClip1();
+    	else if(getName().equals("testClip2")) testClip2();
+    	else if(getName().equals("testDrawArc")) testDrawArc();
+    	else if(getName().equals("testDrawImage")) testDrawImage();
+    	else if(getName().equals("testDrawLine")) testDrawLine();
+    	else if(getName().equals("testDrawRect")) testDrawRect();
+    	else if(getName().equals("testDrawRGB")) testDrawRGB();
+    	else if(getName().equals("testDrawRoundRect")) testDrawRoundRect();
+    	else if(getName().equals("testDrawString")) testDrawString();
+    	else if(getName().equals("testFillArc")) testFillArc();
+    	else if(getName().equals("testFillRect")) testFillRect();
+    	else if(getName().equals("testFillRoundRect")) testFillRoundRect();
+    	else if(getName().equals("testFillTriangle")) testFillTriangle();
+
+        else super.runTest();
+    }
+
+    /**
+     * Tests the default value of a newly created Graphics object
+     */
+    void testDefaultValues()
+    {
+    	boolean pass = true;
+    	String errorMsg = "";
+    	Graphics g = testImage.getGraphics();
+    	
+    	// Validate default color
+    	final int color = g.getColor();
+    	if(color != BLACK) 
+    	{
+    	    pass = false;
+    	    errorMsg += "Default color was " + color + ", while expected " + BLACK+". ";
+    	}
+    	
+    	// Validate default clip
+    	final int clipX = g.getClipX();
+    	final int clipY = g.getClipY();
+    	final int clipW = g.getClipWidth();
+    	final int clipH = g.getClipHeight();
+        if((clipX != 0) || (clipY != 0) || 
+           (clipW != testImageWidth) || (clipH != testImageHeight))
+        {
+        	pass = false;
+        	errorMsg += "Default clip was ("+clipX+","+clipY+","+clipW+","+clipH+"), " +
+        			"while expected (0,0,"+testImageWidth+","+testImageHeight+"). ";
+        }
+    	
+        // Validate that origin is in the top left corner
+        final int transX = g.getTranslateX();
+        final int transY = g.getTranslateY();
+        if((transX != 0) || (transY != 0))
+        {
+        	pass = false;
+        	errorMsg += "Default origo was ("+transX+","+transY+"), while expected (0,0). ";
+        }
+        
+        // Validate default font
+        final Font font = g.getFont();
+        final Font refFont = Font.getDefaultFont();
+        if((font.getFace() != refFont.getFace()) || 
+           (font.getHeight() != refFont.getHeight()) ||
+           (font.getSize() != refFont.getSize()) ||
+           (font.getStyle() != refFont.getStyle())) 
+        {
+        	pass = false;
+        	errorMsg += "Default font from Graphics does not match with the font returned by Font.getDefaultFont()	. ";
+        }
+        
+        // Validate stroke style
+        final int style = g.getStrokeStyle();
+        if(style != Graphics.SOLID)
+        {
+            pass = false;
+            errorMsg += "Default stroke style was "+ style +", while expected (SOLID) "+Graphics.SOLID;
+        }
+    	
+    	if(!pass) 
+    	{
+    		fail(errorMsg);
+    	}
+    }
+    
+    /**
+     * Test default clip by the values returned from Graphics 
+     * and by rendering dots in corners and validating them
+     */
+    void testClip1()
+    {
+    	boolean pass = true;
+    	String errorMsg = "Pixel validation failed at: ";
+    	Graphics g = testImage.getGraphics();
+    	g.drawLine(0, 0, 0, 0); // top-left
+    	g.drawLine(testImageWidth-1, 0, testImageWidth-1, 0); // top-right
+    	g.drawLine(0, testImageHeight-1, 0, testImageHeight-1); // bottom-left
+    	g.drawLine(testImageWidth-1, testImageHeight-1, testImageWidth-1, testImageHeight-1); // bottom-right
+    	
+    	readTestImagePixels();
+
+    	if(!validatePixel(0, 0, BLACK))
+    	{
+    		pass = false;
+    		errorMsg += "top-left, ";
+    	}
+    	if(!validatePixel(testImageWidth-1, 0, BLACK))
+    	{
+    		pass = false;
+    		errorMsg += "top-right, ";
+    	}
+    	if(!validatePixel(0, testImageHeight-1, BLACK))
+    	{
+    		pass = false;
+    		errorMsg += "bottom-left, ";
+    	}
+    	if(!validatePixel(testImageWidth-1, testImageHeight-1, BLACK))
+    	{
+    		pass = false;
+    		errorMsg += "bottom-right.";
+    	}
+    	
+    	if(!pass) 
+    	{
+    		fail(errorMsg);
+    	}
+    }
+    
+    /**
+     * Test clip with two different graphics objects 
+     */
+    void testClip2()
+    {	
+    	boolean pass = true;
+    	String errorMsg = "Pixel check failed at: ";
+    	Graphics g1 = testImage.getGraphics();
+    	Graphics g2 = testImage.getGraphics();
+    	final int[] clip1 = {1,1,testImageWidth-2, testImageHeight-2};
+    	final int[] clip2 = {4,4,testImageWidth-9, testImageHeight-9};
+    	final int[] clip3 = {8,8,testImageWidth-17, testImageHeight-17};
+    	
+    	// Set clip one pixel smaller than the test image
+    	// and fill whole image with red, using graphics object 1
+    	g1.setClip(clip1[0], clip1[1], clip1[2], clip1[3]);
+    	g1.setColor(RED);
+    	g1.fillRect(0, 0, testImageWidth, testImageHeight);
+    	
+    	// Set clip four pixels smaller than the test image
+    	// and fill whole image with green, using graphics object 2
+    	g2.setClip(clip2[0], clip2[1], clip2[2], clip2[3]);
+    	g2.setColor(GREEN);
+    	g2.fillRect(0, 0, testImageWidth, testImageHeight);
+    	
+    	// Set clip eight pixels smaller than the test image
+    	// and fill whole image with blue, using again graphics object 1
+    	g1.setClip(clip3[0], clip3[1], clip3[2], clip3[3]);
+    	g1.setColor(BLUE);
+    	g1.fillRect(0, 0, testImageWidth, testImageHeight);
+    	
+     	// read image pixels to member array
+    	readTestImagePixels();
+    	
+    	final int[] spotsToValidate = {
+    			clip1[0]-1,        clip1[1],          WHITE,  // left border (outside) of clip 1, white
+    			clip1[0]+clip1[2], clip1[1],          WHITE,  // right border (outside) of clip 1, white  
+    			clip1[0]+1,        clip1[1]-1,        WHITE,  // top border (outside) of clip 1, white
+    			clip1[0]+1,        clip1[1]+clip1[3], WHITE,  // bottom border (outside) of clip 1, white
+    			
+    			clip1[0],            clip1[1],            RED,  // left border (inside) of clip 1, red
+    			clip1[0]+clip1[2]-1, clip1[1],            RED,  // right border (inside) of clip 1, red
+    			clip1[0],            clip1[1]+1,          RED,  // top border (inside) of clip 1, red
+    			clip1[0]+1,          clip1[1]+clip1[3]-1, RED,  // bottom border (inside) of clip 1, red
+    			
+    			clip2[0]-1,        clip2[1],          RED,  // left border (outside) of clip 2, red
+    			clip2[0]+clip2[2], clip2[1],          RED,  // right border (outside) of clip 2, red  
+    			clip2[0]+1,        clip2[1]-1,        RED,  // top border (outside) of clip 2, red
+    			clip2[0]+1,        clip2[1]+clip2[3], RED,  // bottom border (outside) of clip 2, red
+    			
+    			clip2[0],            clip2[1],            GREEN,  // left border (inside) of clip 2, green
+    			clip2[0]+clip2[2]-1, clip2[1],            GREEN,  // right border (inside) of clip 2, green
+    			clip2[0],            clip2[1]+1,          GREEN,  // top border (inside) of clip 2, green
+    			clip2[0]+1,          clip2[1]+clip2[3]-1, GREEN,  // bottom border (inside) of clip 2, green
+    			
+    			clip3[0]-1,        clip3[1],          GREEN,  // left border (outside) of clip 3, green
+    			clip3[0]+clip3[2], clip3[1],          GREEN,  // right border (outside) of clip 3, green  
+    			clip3[0]+1,        clip3[1]-1,        GREEN,  // top border (outside) of clip 3, green
+    			clip3[0]+1,        clip3[1]+clip3[3], GREEN,  // bottom border (outside) of clip 3, green
+    			
+    			clip3[0],            clip3[1],            BLUE,  // left border (inside) of clip 3, blue
+    			clip3[0]+clip3[2]-1, clip3[1],            BLUE,  // right border (inside) of clip 3, blue
+    			clip3[0],            clip3[1]+1,          BLUE,  // top border (inside) of clip 3, blue
+    			clip3[0]+1,          clip3[1]+clip3[3]-1, BLUE,  // bottom border (inside) of clip 3, blue
+    	};
+    	
+    	// Validate test points against reference color
+    	for(int i = 0; i < spotsToValidate.length ; i=i+3) 
+    	{
+    		if(!validatePixel(spotsToValidate[i], spotsToValidate[i+1], spotsToValidate[i+2]))
+        	{
+        		pass = false;
+        		errorMsg += "("+spotsToValidate[i]+","+spotsToValidate[i+1]+"), expected "+colorToString(spotsToValidate[i+2])+
+        		            ", got "+ colorToString(getPixelIgnoreAlpha(spotsToValidate[i], spotsToValidate[i+1]))+" : ";
+        	}
+    	}
+    	
+    	if(!pass) 
+    	{
+    		fail(errorMsg);
+    	}
+    }
+    
+    /**
+     * Test drawArc with two graphics 
+     */
+    void testDrawArc()
+    {
+    	boolean pass = true;
+    	String errorMsg = "Pixel check failed at: ";
+    	Graphics g1 = testImage.getGraphics();
+    	Graphics g2 = testImage.getGraphics();
+    	
+    	// run different settings in the graphics instances
+    	applyGraphicsSettings(g1, GRAPHICS_SETTINGS_1);
+    	applyGraphicsSettings(g2, GRAPHICS_SETTINGS_2);
+    	
+    	g1.drawArc(0, 0, 8, 8, 0, 180);
+    	g2.drawArc(0, 0, 8, 8, 0, 180);
+    	g1.drawArc(0, 8, 8, 8, 0, 180);
+    	
+     	// read image pixels to member array
+    	readTestImagePixels();
+    	
+    	// Most of the points to validate are based on the values 
+    	// set by applyGraphicsSettings() -method
+    	final int[] spotsToValidate = {
+    			1,  9, BLUE, // Starting point of the first arc drawn with g1. Y location is arc y + ((height/2)+1) as specified in lcdui spec
+    			9,  9, BLUE, // end point
+    			5,  5, BLUE, // tip of the arc 
+    			10, 8, RED,  // start arc 2
+    			18, 8, RED,  // end arc 2
+    			14, 4, RED,  // tip of arc 2
+    			1,  17, BLUE, // start arc 3
+    			9,  17, BLUE, // end arc 3
+    			5,  13, BLUE, // tip of arc 3		
+    	};
+    	
+    	// Validate test points against reference color
+    	for(int i = 0; i < spotsToValidate.length ; i=i+3) 
+    	{
+    		if(!validatePixel(spotsToValidate[i], spotsToValidate[i+1], spotsToValidate[i+2]))
+        	{
+        		pass = false;
+        		errorMsg += "("+spotsToValidate[i]+","+spotsToValidate[i+1]+"), expected "+colorToString(spotsToValidate[i+2])+
+        		            ", got "+ colorToString(getPixelIgnoreAlpha(spotsToValidate[i], spotsToValidate[i+1]))+" : ";
+        	}
+    	}
+    	
+    	if(!pass) 
+    	{
+    		fail(errorMsg);
+    	}
+    }
+    
+    /**
+     * Test drawImage with two graphics
+     */
+	void testDrawImage()
+	{
+    	boolean pass = true;
+    	String errorMsg = "Pixel check failed at: ";
+    	
+    	// prepare image to be drawn
+    	Image img = Image.createImage(5,5);
+    	Graphics ig = img.getGraphics();
+    	ig.fillRect(0, 0, 5, 5);
+    	
+    	Graphics g1 = testImage.getGraphics();
+    	Graphics g2 = testImage.getGraphics();
+    	
+    	// run different settings in the graphics instances
+    	applyGraphicsSettings(g1, GRAPHICS_SETTINGS_1);
+    	applyGraphicsSettings(g2, GRAPHICS_SETTINGS_2);
+    	
+    	g1.drawImage(img, 0, 0, 0);
+    	g2.drawImage(img, 0, 0, 0);
+    	g1.drawImage(img, 0, 8, 0);
+    	
+     	// read image pixels to member array
+    	readTestImagePixels();
+    	
+    	// Most of the points to validate are based on the values 
+    	// set by applyGraphicsSettings() -method
+    	final int[] spotsToValidate = {
+    			1, 5, BLACK, // top-left corner of image 1
+    			5, 5, BLACK, // top-right corner of image 1
+    			1, 9, BLACK, // bottom-left corner of image 1 
+    		    5, 9, BLACK,  // bottom-right corner of image 1
+    		    
+    		    0, 7, WHITE, // Left border (outside) of image 1
+    		    6, 7, WHITE, // Right border (outside) of image 1
+    		    3, 4, WHITE, // Top border (outside) of image 1
+    		    3, 10, WHITE, // Bottom border (outside) of image 1
+    		    
+    			10, 4, BLACK, // top-left corner of image 2
+    			14, 4, BLACK, // top-right corner of image 2
+    			10, 8, BLACK, // bottom-left corner of image 2 
+    		    14, 8, BLACK,  // bottom-right corner of image 2
+    		    
+    		    9,  6, WHITE, // Left border (outside) of image 2
+    		    15, 6, WHITE, // Right border (outside) of image 2
+    		    12, 3, WHITE, // Top border (outside) of image 2
+    		    12, 9, WHITE, // Bottom border (outside) of image 2
+    		    
+    			1, 13, BLACK, // top-left corner of image 3
+    			5, 13, BLACK, // top-right corner of image 3
+    			1, 17, BLACK, // bottom-left corner of image 3 
+    		    5, 17, BLACK,  // bottom-right corner of image 3	
+    		    
+    		    0, 15, WHITE, // Left border (outside) of image 3
+    		    6, 15, WHITE, // Right border (outside) of image 3
+    		    3, 12, WHITE, // Top border (outside) of image 3
+    		    3, 18, WHITE, // Bottom border (outside) of image 3
+    	};
+    	
+    	// Validate test points against reference color
+    	for(int i = 0; i < spotsToValidate.length ; i=i+3) 
+    	{
+    		if(!validatePixel(spotsToValidate[i], spotsToValidate[i+1], spotsToValidate[i+2]))
+        	{
+        		pass = false;
+        		errorMsg += "("+spotsToValidate[i]+","+spotsToValidate[i+1]+"), expected "+colorToString(spotsToValidate[i+2])+
+        		            ", got "+ colorToString(getPixelIgnoreAlpha(spotsToValidate[i], spotsToValidate[i+1]))+" : ";
+        	}
+    	}
+    	
+    	if(!pass) 
+    	{
+    		fail(errorMsg);
+    	}
+	}
+	
+	void testDrawLine()
+	{
+    	boolean pass = true;
+    	String errorMsg = "Pixel check failed at: ";
+    	
+    	Graphics g1 = testImage.getGraphics();
+    	Graphics g2 = testImage.getGraphics();
+    	
+    	// run different settings in the graphics instances
+    	applyGraphicsSettings(g1, GRAPHICS_SETTINGS_1);
+    	applyGraphicsSettings(g2, GRAPHICS_SETTINGS_2);
+    	
+    	g1.drawLine(0, 0, 0, 7);
+    	g2.drawLine(0, 0, 0, 5);
+    	g1.drawLine(0, 12, 7, 12);
+    	
+     	// read image pixels to member array
+    	readTestImagePixels();
+    	
+    	// Most of the points to validate are based on the values 
+    	// set by applyGraphicsSettings() -method
+    	final int[] spotsToValidate = {
+    			// Dotted blue line 1
+    			1, 4, WHITE, // point before line 1 start 
+    			1, 5, BLUE,  // start of line 1
+    			1, 7, WHITE, // middle of line 1, verify that its dotted
+    		    1, 11, BLUE,  // end of line 1
+    		    1, 12, WHITE, // point after line 1 end
+    		    
+    		    // Solid red line 2
+    			10, 3, WHITE, // point before line 2 start 
+    			10, 4, RED,  // start of line 2
+    		    10, 9, RED,  // end of line 2
+    		    10, 10, WHITE, // point after line 2 end
+    		    
+    		    // Dotted blue line 3
+    			0, 17, WHITE, // point before line 1 start 
+    			1, 17, BLUE,  // start of line 1
+    			3, 17, WHITE, // middle of line 1, verify that its dotted
+    		    7, 17, BLUE,  // end of line 1
+    		    8, 17, WHITE, // point after line 1 end
+    	};
+    	
+    	// Validate test points against reference color
+    	for(int i = 0; i < spotsToValidate.length ; i=i+3) 
+    	{
+    		if(!validatePixel(spotsToValidate[i], spotsToValidate[i+1], spotsToValidate[i+2]))
+        	{
+        		pass = false;
+        		errorMsg += "("+spotsToValidate[i]+","+spotsToValidate[i+1]+"), expected "+colorToString(spotsToValidate[i+2])+
+        		            ", got "+ colorToString(getPixelIgnoreAlpha(spotsToValidate[i], spotsToValidate[i+1]))+" : ";
+        	}
+    	}
+    	
+    	if(!pass) 
+    	{
+    		fail(errorMsg);
+    	}
+	}
+	
+	/**
+	 * Test drawRect with two graphics
+	 */
+	void testDrawRect()	
+	{
+    	boolean pass = true;
+    	String errorMsg = "Pixel check failed at: ";
+    	
+    	Graphics g1 = testImage.getGraphics();
+    	Graphics g2 = testImage.getGraphics();
+    	
+    	// run different settings in the graphics instances
+    	applyGraphicsSettings(g1, GRAPHICS_SETTINGS_1);
+    	applyGraphicsSettings(g2, GRAPHICS_SETTINGS_2);
+    	
+    	g1.drawRect(0, 0, 6, 6);
+    	g2.drawRect(0, 0, 6, 6);
+    	g1.drawRect(0, 8, 3, 3);
+    	
+     	// read image pixels to member array
+    	readTestImagePixels();
+    	//print(pixelData, testImageWidth);
+    	
+    	// Most of the points to validate are based on the values 
+    	// set by applyGraphicsSettings() -method
+    	final int[] spotsToValidate = {
+    			// Dotted rectangle
+    			1, 5, BLUE,  // top-left corner of rectangle 1
+    			7, 5, BLUE,  // top-right corner of rectangle 1
+    			1, 11, BLUE, // bottom-left corner of rectangle 1 
+    		    7, 11, BLUE, // bottom-right corner of rectangle 1
+    		    3, 5, WHITE, // middle of one side, verify that its dotted
+    		    
+    		    0, 7, WHITE, // Left border (outside) of rectangle 1
+    		    8, 7, WHITE, // Right border (outside) of rectangle 1
+    		    3, 4, WHITE, // Top border (outside) of rectangle 1
+    		    3, 12, WHITE, // Bottom border (outside) of rectangle 1
+    		    
+    		    // Solid rectangle
+    			10, 4, RED,  // top-left corner of rectangle 2
+    			16, 4, RED,  // top-right corner of rectangle 2
+    			10, 10, RED, // bottom-left corner of rectangle 2 
+    		    16, 10, RED, // bottom-right corner of rectangle 2
+    		    
+    		    9, 6, WHITE, // Left border (outside) of rectangle 2
+    		    17, 6, WHITE, // Right border (outside) of rectangle 2
+    		    12, 3, WHITE, // Top border (outside) of rectangle 2
+    		    14, 11, WHITE, // Bottom border (outside) of rectangle 2
+    		    
+    		    // Dotted rectangle
+    			1, 13, BLUE,  // top-left corner of rectangle 3
+    			4, 13, BLUE,  // top-right corner of rectangle 3
+    			1, 16, BLUE, // bottom-left corner of rectangle 3 
+    		    4, 16, BLUE, // bottom-right corner of rectangle 3
+    		    3, 13, WHITE, // middle of one side, verify that its dotted
+    		    
+    		    0, 14, WHITE, // Left border (outside) of rectangle 3
+    		    5, 14, WHITE, // Right border (outside) of rectangle 3
+    		    3, 12, WHITE, // Top border (outside) of rectangle 3
+    		    3, 17, WHITE, // Bottom border (outside) of rectangle 3
+    	};
+    	
+    	// Validate test points against reference color
+    	for(int i = 0; i < spotsToValidate.length ; i=i+3) 
+    	{
+    		if(!validatePixel(spotsToValidate[i], spotsToValidate[i+1], spotsToValidate[i+2]))
+        	{
+        		pass = false;
+        		errorMsg += "("+spotsToValidate[i]+","+spotsToValidate[i+1]+"), expected "+colorToString(spotsToValidate[i+2])+
+        		            ", got "+ colorToString(getPixelIgnoreAlpha(spotsToValidate[i], spotsToValidate[i+1]))+" : ";
+        	}
+    	}
+    	
+    	if(!pass) 
+    	{
+    		fail(errorMsg);
+    	}	
+	}
+	
+	/**
+	 * Test drawRGB with two graphics
+	 */
+	void testDrawRGB() 
+	{
+    	boolean pass = true;
+    	String errorMsg = "Pixel check failed at: ";
+    	
+    	// prepare test rgbdata
+    	final int r = 0xffff0000;
+    	final int b = 0xff0000ff;
+    	final int[] rgb1 = {
+    			r,r,r,r,r,
+    			r,r,r,r,r,
+    			r,r,r,r,r,
+    			r,r,r,r,r,
+    			r,r,r,r,r
+    	};
+    	
+    	final int[] rgb2 = {
+    			b,b,b,b,b,
+    			b,b,b,b,b,
+    			b,b,b,b,b,
+    			b,b,b,b,b,
+    			b,b,b,b,b
+    	};
+    	
+    	Graphics g1 = testImage.getGraphics();
+    	Graphics g2 = testImage.getGraphics();
+    	
+    	// run different settings in the graphics instances
+    	applyGraphicsSettings(g1, GRAPHICS_SETTINGS_1);
+    	applyGraphicsSettings(g2, GRAPHICS_SETTINGS_2);
+    	
+    	g1.drawRGB(rgb1, 0, 5, 0, 0, 5, 5, false);
+    	g2.drawRGB(rgb2, 0, 5, 0, 0, 5, 5, false);
+    	g1.drawRGB(rgb1, 0, 5, 0, 8, 5, 5, false);
+    	
+     	// read image pixels to member array
+    	readTestImagePixels();
+    	//print(pixelData, testImageWidth);
+    	
+    	// Most of the points to validate are based on the values 
+    	// set by applyGraphicsSettings() -method
+    	final int[] spotsToValidate = {
+    			1, 5, RED,  // top-left corner of rectangle 1
+    			5, 5, RED,  // top-right corner of rectangle 1
+    			1, 9, RED, // bottom-left corner of rectangle 1 
+    		    5, 9, RED, // bottom-right corner of rectangle 1
+    		    
+    		    0, 7, WHITE, // Left border (outside) of rectangle 1
+    		    6, 7, WHITE, // Right border (outside) of rectangle 1
+    		    3, 4, WHITE, // Top border (outside) of rectangle 1
+    		    3, 10, WHITE, // Bottom border (outside) of rectangle 1
+    		    
+    			10, 4, BLUE,  // top-left corner of rectangle 2
+    			14, 4, BLUE,  // top-right corner of rectangle 2
+    			10, 8, BLUE, // bottom-left corner of rectangle 2 
+    		    14, 8, BLUE, // bottom-right corner of rectangle 2
+    		    
+    		    9,  6, WHITE, // Left border (outside) of rectangle 2
+    		    15, 6, WHITE, // Right border (outside) of rectangle 2
+    		    12, 3, WHITE, // Top border (outside) of rectangle 2
+    		    12, 9, WHITE, // Bottom border (outside) of rectangle 2
+    		    
+    			1, 13, RED,  // top-left corner of rectangle 3
+    			5, 13, RED,  // top-right corner of rectangle 3
+    			1, 17, RED, // bottom-left corner of rectangle 3 
+    		    5, 17, RED, // bottom-right corner of rectangle 3
+    		    
+    		    0, 14, WHITE, // Left border (outside) of rectangle 3
+    		    6, 14, WHITE, // Right border (outside) of rectangle 3
+    		    3, 12, WHITE, // Top border (outside) of rectangle 3
+    		    3, 18, WHITE, // Bottom border (outside) of rectangle 3
+    	};
+    	
+    	// Validate test points against reference color
+    	for(int i = 0; i < spotsToValidate.length ; i=i+3) 
+    	{
+    		if(!validatePixel(spotsToValidate[i], spotsToValidate[i+1], spotsToValidate[i+2]))
+        	{
+        		pass = false;
+        		errorMsg += "("+spotsToValidate[i]+","+spotsToValidate[i+1]+"), expected "+colorToString(spotsToValidate[i+2])+
+        		            ", got "+ colorToString(getPixelIgnoreAlpha(spotsToValidate[i], spotsToValidate[i+1]))+" : ";
+        	}
+    	}
+    	
+    	if(!pass) 
+    	{
+    		fail(errorMsg);
+    	}	
+	}
+	
+	/**
+	 * Test drawRoundRect with two graphics
+	 */
+	void testDrawRoundRect()
+	{
+	 	boolean pass = true;
+    	String errorMsg = "Pixel check failed at: ";
+    	
+    	Graphics g1 = testImage.getGraphics();
+    	Graphics g2 = testImage.getGraphics();
+    	
+    	// run different settings in the graphics instances
+    	applyGraphicsSettings(g1, GRAPHICS_SETTINGS_1);
+    	applyGraphicsSettings(g2, GRAPHICS_SETTINGS_2);
+    	
+    	g1.drawRoundRect(0, 0, 6, 6, 2, 2);
+    	g2.drawRoundRect(0, 0, 6, 6, 2, 2);
+    	g1.drawRoundRect(0, 8, 5, 5, 2, 2);
+    	
+     	// read image pixels to member array
+    	readTestImagePixels();
+    	//print(pixelData, testImageWidth);
+    	
+    	// Most of the points to validate are based on the values 
+    	// set by applyGraphicsSettings() -method
+    	final int[] spotsToValidate = {
+    			// Dotted rectangle
+    			1, 6, BLUE,  // left side of rectangle 1
+    			7, 6, BLUE,  // right side of rectangle 1
+    			3, 5, BLUE, // top side of rectangle 1 
+    		    3, 11, BLUE, // bottom side of rectangle 1
+    		    5, 5, WHITE, // middle of one side, verify that its dotted
+    		    
+    		    0, 7, WHITE, // Left border (outside) of rectangle 1
+    		    7, 7, WHITE, // Right border (outside) of rectangle 1
+    		    3, 4, WHITE, // Top border (outside) of rectangle 1
+    		    3, 12, WHITE, // Bottom border (outside) of rectangle 1
+    		    
+    		    // Solid rectangle
+    			10, 6, RED,  // left side of rectangle 2
+    			16, 6, RED,  // right side of rectangle 2
+    			12, 4, RED, // top side of rectangle 2 
+    		    12, 10, RED, // bottom side corner of rectangle 2
+    		    
+    		    9, 6, WHITE, // Left border (outside) of rectangle 2
+    		    17, 6, WHITE, // Right border (outside) of rectangle 2
+    		    12, 3, WHITE, // Top border (outside) of rectangle 2
+    		    14, 11, WHITE, // Bottom border (outside) of rectangle 2
+    		    
+    		    // Dotted rectangle
+    			1, 15, BLUE,  // left side of of rectangle 3
+    			6, 14, BLUE,  // right side of of rectangle 3
+    			2, 13, BLUE, // top side of rectangle 3 
+    		    2, 18, BLUE, // bottom side of rectangle 3
+    		    1,  4, WHITE, // middle of one side, verify that its dotted
+    		    
+    		    0, 14, WHITE, // Left border (outside) of rectangle 3
+    		    7, 14, WHITE, // Right border (outside) of rectangle 3
+    		    3, 12, WHITE, // Top border (outside) of rectangle 3
+    		    3, 19, WHITE, // Bottom border (outside) of rectangle 3
+    	};
+    	
+    	// Validate test points against reference color
+    	for(int i = 0; i < spotsToValidate.length ; i=i+3) 
+    	{
+    		if(!validatePixel(spotsToValidate[i], spotsToValidate[i+1], spotsToValidate[i+2]))
+        	{
+        		pass = false;
+        		errorMsg += "("+spotsToValidate[i]+","+spotsToValidate[i+1]+"), expected "+colorToString(spotsToValidate[i+2])+
+        		            ", got "+ colorToString(getPixelIgnoreAlpha(spotsToValidate[i], spotsToValidate[i+1]))+" : ";
+        	}
+    	}
+    	
+    	if(!pass) 
+    	{
+    		fail(errorMsg);
+    	}	
+	}
+	
+	void testDrawString()
+	{
+		
+	}
+	
+	void testFillArc()
+	{
+		
+	}
+	
+	void testFillRect()
+	{
+		
+	}
+	
+	void testFillRoundRect()
+	{
+		
+	}
+	
+	void testFillTriangle()
+	{
+		
+	}
+  
+    
+	private void applyGraphicsSettings(Graphics g, int settings) 
+	{
+		
+		Font defaultFont = Font.getDefaultFont();
+		if(settings == GRAPHICS_SETTINGS_1)
+		{
+			Font font = Font.getFont(defaultFont.getFace(), defaultFont.getStyle(), Font.SIZE_LARGE);
+			g.setColor(BLUE);
+			g.translate(1, 5);
+			g.setStrokeStyle(Graphics.DOTTED);
+		}
+		else if(settings == GRAPHICS_SETTINGS_2)
+		{
+			Font font = Font.getFont(defaultFont.getFace(), defaultFont.getStyle(), Font.SIZE_SMALL);
+			g.setColor(RED);
+			g.translate(10, 4);
+			g.setStrokeStyle(Graphics.SOLID);
+		}
+	}
+	
+    /**
+     * Reads all pixels of the testImage to the class member array pixelData
+     */
+    private void readTestImagePixels()
+    {
+    	testImage.getRGB(pixelData, 0, testImageWidth, 0, 0, testImageWidth, testImageHeight);
+    }
+    
+	void print(int[] array, int scanlength) {
+		final int width = scanlength;
+		String output = "";
+		
+		int y = 0;
+		for(int i = 0; i < array.length; i++) {
+			
+			int a = ((array[i] >> 24) & 0xff);
+			int r = ((array[i] >> 16) & 0xff); 
+			int g = ((array[i] >> 8 ) & 0xff);
+			int b = ( array[i] & 0xff);
+			
+			if (a == 255 && r == 0 && g == 0 && b == 0) {
+				output += "B,";
+			} else if (a == 255 && r == 255 && g == 255 && b == 255) {
+				output += "0,";
+			}
+			else if(a == 255 && r == 255 && g == 0 && b == 0) {
+				output += "r,";
+			}
+			else if(a == 255 && r == 0 && g == 255 && b == 0) {
+				output += "g,";
+			}
+			else if(a == 255 && r == 0 && g == 0 && b == 255) {
+				output += "b,";
+			}
+			else {
+				//output += "x,";
+				output += "("+a+","+r+","+g+","+b+")";
+			}
+			
+			if(i==((y*width) + (width-1))) {
+				output += "\n";
+				y++;
+			}
+		}
+		System.out.println(output);
+	}
+    
+    
+    /**
+     * Validates that the pixel in given coordinate equals given color and ignores alpha.
+     * @return True if given pixel has given refColor value, otherwise false
+     */
+    private boolean validatePixel(final int x, final int y, final int refColor)
+    {
+    	final int sweetSpot = pixelData[(testImageWidth*y)+x];
+    	final int[] sweetSpotComponents = getColorComponents(sweetSpot);
+    	final int[] refColorComponents = getColorComponents(refColor);
+    	
+    	if((sweetSpotComponents[1] == refColorComponents[1]) &&    // red
+    		(sweetSpotComponents[2] == refColorComponents[2]) &&   // green 
+    		(sweetSpotComponents[3] == refColorComponents[3]))     // blue
+    	{
+    		return true;
+    	}
+    	return false;
+    }
+    
+    private int getPixel(int x, int y)
+    {
+    	return pixelData[(testImageWidth*y)+x];
+    }
+    
+    private int getPixelIgnoreAlpha(int x, int y) 
+    {
+    	int pixel = pixelData[(testImageWidth*y)+x];
+    	return pixel & 0x00ffffff; // mask alpha to zero
+    }
+    
+    private String colorToString(final int color) 
+    {
+    	int[] c = getColorComponents(color);
+    	return new String("("+c[0]+","+c[1]+","+c[2]+","+c[3]+") ");
+    }
+    
+    private int[] getColorComponents(final int color) 
+    {
+    	final int a = ((color >> 24) & 0xff);
+    	final int r = ((color >> 16) & 0xff); 
+    	final int g = ((color >> 8 ) & 0xff);
+    	final int b = ( color & 0xff);
+    	return new int[] {a, r, g, b};
+    }
+    
+    private void printColor(final int color) {
+    	int[] components = getColorComponents(color);
+    	System.out.println("Color components ("+color+"): r="+components[0]+", g="+components[1]+
+    			            ", b="+components[2]+", a="+components[3]);
+    }
+
+}
--- a/javauis/m3g_qt/build/build.xml	Tue Jul 06 14:10:26 2010 +0300
+++ b/javauis/m3g_qt/build/build.xml	Wed Aug 18 09:43:15 2010 +0300
@@ -27,15 +27,6 @@
   <!-- Needed by the utilities.xml. See the description form the utilities.xml
        file -->
 
-
-  <target name="compile">
-    <omj.javac classpath="${impl.cldc.jar}" excludes="**/CDCCompatibilityDelegate.java"/>
-  </target>
-
-
-  <!-- Needed by the utilities.xml. See the description form the utilities.xml
-       file -->
-
   <property name="javah.classnames" 
             value="javax.microedition.m3g.AnimationController,
                    javax.microedition.m3g.AnimationTrack,
--- a/javauis/mmapi_qt/animated_gif_notUsed/inc/cmmaanimationframepositioningcontrol.h	Tue Jul 06 14:10:26 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,70 +0,0 @@
-/*
-* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:  This class implements FramePositioningControl for animation
-*
-*/
-
-
-#ifndef CMMAANIMATIONFRAMEPOSITIONINGCONTROL_H
-#define CMMAANIMATIONFRAMEPOSITIONINGCONTROL_H
-
-//  INTERNAL INCLUDES
-#include "cmmaanimationplayer.h"
-#include "cmmaframepositioningcontrol.h" // base class
-
-
-// CONSTANTS
-
-// FORWARD DECLARATIONS
-class MIHLImageViewer;
-
-//  CLASS DECLARATION
-/**
-*   This class implements FramePositioningControl for video player
-*/
-NONSHARABLE_CLASS(CMMAAnimationFramePositioningControl) :
-        public CMMAFramePositioningControl
-{
-public:
-    static CMMAAnimationFramePositioningControl* NewL(CMMAAnimationPlayer* aPlayer);
-
-    /**
-     * Destructor.
-     */
-    ~CMMAAnimationFramePositioningControl();
-
-protected:
-    /**
-     * Constructor.
-     */
-    CMMAAnimationFramePositioningControl(CMMAAnimationPlayer* aPlayer);
-
-    void ConstructL(CMMAAnimationPlayer* aPlayer);
-
-public: // From CMMAFramePositioningControl
-    TInt SeekL(TInt aFrameNumber);
-    TInt SkipL(TInt aFramesToSkip);
-    void MapFrameToTimeL(TInt aFrameNumber, TInt64* aMediaTime);
-    TInt MapTimeToFrameL(TInt64* aMediaTime);
-
-private: // New methods
-    TInt FindFrame(MIHLImageViewer* aViewer, TInt aFrameNumber);
-
-private: // Data
-    CMMAAnimationPlayer* iPlayer;
-
-};
-
-
-#endif // CMMAANIMATIONFRAMEPOSITIONINGCONTROL_H
--- a/javauis/mmapi_qt/animated_gif_notUsed/inc/cmmaanimationplayer.h	Tue Jul 06 14:10:26 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,230 +0,0 @@
-/*
-* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:  This class is used for playing animated images.
-*
-*/
-
-
-#ifndef CMMAANIMATIONPLAYER_H
-#define CMMAANIMATIONPLAYER_H
-
-//  INCLUDES
-#include <w32std.h>
-#include "cmmaplayer.h"
-#include "mmmaguiplayer.h"
-#include "mmmasnapshot.h"
-#include "rmmatempfile.h"
-#include "MIHLViewerObserver.h"
-#include "MIHLImageViewer.h"
-
-// FORWARD DECLARATIONS
-class MMAFunctionServer;
-class CMMAAnimationWindow;
-class MIHLFileImage;
-class MIHLBitmap;
-class CFbsBitmap;
-
-// CONSTANTS
-_LIT(KMMAVideoPlayer, "VideoPlayer");
-
-NONSHARABLE_CLASS(MMMAAnimationObserver)
-{
-public: // new methods
-    /**
-     * Listener for animation advancing
-     * @param aFrame current frame
-     * @param aMediaTime current media time
-     */
-    virtual void AnimationAdvancedL(TInt aFrame, TInt64 aMediaTime) = 0;
-};
-
-//  CLASS DECLARATION
-/**
-*   This class is used for playing animated images.
-*
-*/
-NONSHARABLE_CLASS(CMMAAnimationPlayer): public CMMAPlayer,
-        public MMMAGuiPlayer,
-        public MMMASnapshot,
-        public MIHLViewerObserver
-{
-public: // Construction
-    static CMMAAnimationPlayer* NewLC();
-    static CMMAAnimationPlayer* NewLC(const TDesC& aFileName);
-
-    //   Destructor
-    ~CMMAAnimationPlayer();
-
-protected:
-    //   C++ constructor
-    CMMAAnimationPlayer();
-    void ConstructL();
-
-public: // from CMMAPlayer
-    void SetPlayerListenerObjectL(jobject aListenerObject,
-                                  JNIEnv* aJni,
-                                  MMMAEventPoster* aEventPoster);
-    void RealizeL();
-    void PrefetchL();
-    void StartL();
-    void StopL(TBool aPostEvent);
-    void DeallocateL();
-    void GetDuration(TInt64* aDuration);
-    const TDesC& Type();
-    void SetMediaTimeL(TInt64* aTime);
-    void GetMediaTime(TInt64* aMediaTime);
-
-public: // from CMMAPlayer/MMMASourceStreamListener
-    void ReadCompletedL(TInt aStatus, const TDesC8& aData);
-
-public: // new methods
-    void PrefetchFileL();
-    void PrefetchDataL(const TDesC8& aData);
-
-    /**
-     * Check whether this player is playing from a file locator
-     * @return ETrue if is a file player, EFalse otherwise
-     */
-    TBool IsFilePlayer();
-
-    // Finds current frame for given media time
-    TInt FindFrame(TInt64 aTime);
-
-    // Calculates media time for specified frame
-    TInt64 MediaTimeForFrame(TInt aFrameIndex);
-
-    // Frame duration of specified frame
-    TTimeIntervalMicroSeconds32 FrameDuration(TInt aFrameIndex);
-
-    MIHLImageViewer* Viewer();
-
-    // Setter for frame listener, used for stop time control
-    void SetAnimationObserver(MMMAAnimationObserver* aAnimationObserver);
-
-    /**
-     * @param aRate Rate to set in "milli-percentage"..
-     * @return Actual rate set.
-     */
-    TInt SetRateL(TInt aRate);
-
-    /**
-     * @return The current playback rate in "milli-percentage".
-     */
-    TInt RateL();
-
-private: // new methods
-    void PrepareViewerL();
-    void ProcessCurrentFrameL();
-
-public: // From MMMAGuiPlayer
-    void SetDisplayL(MMMADisplay* aDisplay);
-    TSize SourceSize();
-    void NotifyWithStringEvent(CMMAPlayerEvent::TEventType aEventType,
-                               const TDesC& aStringEventData);
-
-    MMMASnapshot* SnapshoterL();
-
-public: // From MMMASnapshot
-    MMMASnapshot::TEncoding TakeSnapshotL(TRequestStatus* aStatus,
-                                          const TSize& aSize,
-                                          const CMMAImageSettings& aSettings);
-    CFbsBitmap* SnapshotBitmap();
-    HBufC8* SnapshotEncoded();
-
-public: // From MIHLViewerObserver
-    virtual void ViewerBitmapChangedL();
-    virtual void ViewerError(TInt aError);
-
-    private: // Data
-
-    /**
-     * Display to draw animation.
-     */
-    MMMADisplay* iDisplay;
-
-    /**
-     * Window to draw animation.
-     */
-    CMMAAnimationWindow* iWindow;
-
-    /**
-     * Dimensions of animation.
-     */
-    TSize iSourceSize;
-
-    /**
-     * Animated image to play. Owned.
-     */
-    MIHLFileImage* iImage;
-
-    /**
-     * Destination bitmap for animation. Owned.
-     */
-    MIHLBitmap* iBitmap;
-
-    /**
-     * Animation viewer. Owned.
-     */
-    MIHLImageViewer* iViewer;
-
-    /**
-     * Bitmap for snapshot. Ownership is transferred for
-     * snapshot requester, but owned if not null.
-     */
-    CFbsBitmap* iSnapshotBitmap;
-
-    /**
-     * File system session for IHL interfacing
-     */
-    RFs iFSession;
-
-    /**
-     * Animation frame count. Held locally for optimization.
-     */
-    TInt iFrameCount;
-
-    /**
-     * Possible file name, owned
-     */
-    HBufC* iFileName;
-
-    /**
-     * Current Media Time
-     */
-    TInt64 iMediaTime;
-
-    /**
-     * Animation listener
-     */
-    MMMAAnimationObserver* iAnimationObserver;
-
-    /**
-     * Current rate
-     */
-    TInt iCurrentRate;
-
-    /**
-     * Hold the information whether playback should be started
-     * from beginning on next start or from current position
-     */
-    TBool iEndReached;
-
-    /**
-     * EndOfMedia will be delivered when next frame arrives if
-     * iSendEndOfMediaOnNextFrame is true
-     */
-    TBool iSendEndOfMediaOnNextFrame;
-};
-
-#endif // CMMAANIMATIONPLAYER_H
--- a/javauis/mmapi_qt/animated_gif_notUsed/inc/cmmaanimationplayerfactory.h	Tue Jul 06 14:10:26 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,77 +0,0 @@
-/*
-* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:  This class is used for creating animation player
-*
-*/
-
-
-#ifndef CMMAANIMATIONPLAYERFACTORY_H
-#define CMMAANIMATIONPLAYERFACTORY_H
-
-//  INCLUDES
-#include "mmmaplayerfactory.h"
-
-// CONSTANTS
-
-// FORWARD DECLARATIONS
-class CMMAAnimationPlayer;
-
-//  CLASS DECLARATION
-/**
-*   This class is used for creating animation player.
-*
-*/
-NONSHARABLE_CLASS(CMMAAnimationPlayerFactory): public MMMAPlayerFactory
-{
-public: // Constructor and destructor
-    static CMMAAnimationPlayerFactory* NewLC();
-    ~CMMAAnimationPlayerFactory();
-
-private: // Constructor
-    CMMAAnimationPlayerFactory();
-
-public: // From MMMAPlayerFactory
-
-    // Creates new player according to a content type.
-    virtual CMMAPlayer* CreatePlayerL(const TDesC& aContentType);
-
-    // Creates new player according to a locator
-    virtual CMMAPlayer* CreatePlayerL(const TDesC& aProtocol,
-                                      const TDesC& aMiddlePart,
-                                      const TDesC& aParameters);
-
-    // Creates new player according to a header data
-    virtual CMMAPlayer* CreatePlayerL(const TDesC8& aHeaderData);
-
-    // Gets player's supported content types.
-    virtual void GetSupportedContentTypesL(const TDesC& aProtocol,
-                                           CDesC16Array& aMimeTypeArray);
-
-    // Gets player's supported protocols for the content type.
-    virtual void GetSupportedProtocolsL(const TDesC& aContentType,
-                                        CDesC16Array& aProtocolArray);
-
-private:
-    // Create instance of animation player with sufficient controls
-    CMMAAnimationPlayer* CreateAnimationPlayerL();
-
-    // Create instance of animation player with sufficient controls, with specified file
-    CMMAAnimationPlayer* CreateAnimationPlayerL(const TDesC& aFileName);
-
-    // Add animation controls to player
-    void AddControlsL(CMMAAnimationPlayer* aPlayer);
-
-};
-
-#endif // CMMAANIMATIONPLAYERFACTORY_H
--- a/javauis/mmapi_qt/animated_gif_notUsed/inc/cmmaanimationratecontrol.h	Tue Jul 06 14:10:26 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,84 +0,0 @@
-/*
-* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:  This class implements AnimationRateControl functionality.
-*
-*/
-
-
-#ifndef CMMAANIMATIONRATECONTROL_H
-#define CMMAANIMATIONRATECONTROL_H
-
-// EXTERNAL INCLUDES
-
-//  INTERNAL INCLUDES
-#include "cmmaratecontrol.h" // base class
-
-// CONSTANTS
-
-class CMMAAnimationPlayer;
-
-//  CLASS DECLARATION
-/**
-*   This class implements AnimationRateControl interface.
-*
-*
-*/
-NONSHARABLE_CLASS(CMMAAnimationRateControl): public CMMARateControl
-{
-public:
-    /**
-     * Creates new CMMAAnimationRateControl.
-     *
-     * @param aPlayer Player that plays the content.
-     */
-    static CMMAAnimationRateControl* NewL(CMMAAnimationPlayer* aPlayer);
-
-    /**
-     * Destructor.
-     */
-    ~CMMAAnimationRateControl();
-protected:
-    /**
-     * Constructor.
-     * @param aPlayer Player that plays the content.
-     */
-    CMMAAnimationRateControl(CMMAAnimationPlayer* aPlayer);
-
-    /**
-     * Initializes this control.
-     */
-    void ConstructL();
-
-public: // From CMMARateControl
-    /**
-     * @param aRate Rate to set in "milli-percentage"..
-     * @return Actual rate set.
-     */
-    TInt SetRateL(TInt aRate);
-
-    /**
-     * @return The current playback rate in "milli-percentage".
-     */
-    TInt RateL();
-
-private: // Data
-    /**
-     * Used to control animation.
-     */
-    CMMAAnimationPlayer* iPlayer;
-
-};
-
-
-#endif // CMMAANIMATIONRATECONTROL_H
--- a/javauis/mmapi_qt/animated_gif_notUsed/inc/cmmaanimationstoptimecontrol.h	Tue Jul 06 14:10:26 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,50 +0,0 @@
-/*
-* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:  This class is used for stoptime controlling for animation player
-*
-*/
-
-
-#ifndef CMMAANIMATIONSTOPTIMECONTROL_H
-#define CMMAANIMATIONSTOPTIMECONTROL_H
-
-//  INCLUDES
-#include "cmmaanimationplayer.h"
-#include "cmmastoptimecontrol.h"
-
-//  CLASS DECLARATION
-/**
-*   This class is used for stoptime controlling for animation
-*
-*
-*/
-
-NONSHARABLE_CLASS(CMMAAnimationStopTimeControl): public CMMAStopTimeControl,
-        public MMMAAnimationObserver
-{
-public:
-    static CMMAAnimationStopTimeControl* NewL(CMMAAnimationPlayer* aPlayer);
-    ~CMMAAnimationStopTimeControl();
-
-protected:
-    CMMAAnimationStopTimeControl(CMMAAnimationPlayer* aPlayer);
-
-public: // from CMMAStopTimeControl
-    void SetStopTimeL(const TInt64& aTime);
-
-public: // from MMMAAnimationObserver
-    void AnimationAdvancedL(TInt aFrame, TInt64 aMediaTime);
-};
-
-#endif // CMMAANIMATIONSTOPTIMECONTROL_H
--- a/javauis/mmapi_qt/animated_gif_notUsed/inc/cmmaanimationwindow.h	Tue Jul 06 14:10:26 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,91 +0,0 @@
-/*
-* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:  This abstract class implements MMMADisplayWindow functionality
-*                in CFbsBitmap based displays.
-*
-*/
-
-
-#ifndef CMMAANIMATIONWINDOW_H
-#define CMMAANIMATIONWINDOW_H
-
-//  INCLUDES
-#include <MIHLImageViewer.h>
-//#include "MMMADisplayWindow.h"
-#include "cmmabitmapwindow.h"
-#include "mmafunctionserver.h"
-
-//  CONSTANTS
-
-//  FORWARD DECLARATIONS
-//class CFbsBitmap;
-
-
-//  CLASS DECLARATION
-/**
-*   This abstract class implements MMMADisplayWindow functionality in
-*   CFbsBitmap based displays.
-*
-*
-*/
-
-
-NONSHARABLE_CLASS(CMMAAnimationWindow): public CMMABitmapWindow
-{
-public:     // Constructors and destructors
-    ~CMMAAnimationWindow();   // Destructor ()
-
-    static CMMAAnimationWindow* NewL(MMAFunctionServer* aEventSource);
-
-protected:  // Constructors and destructors
-    // Default constructor, protected to allow derivation
-    CMMAAnimationWindow(MMAFunctionServer* aEventSource);
-
-public: // new methods
-    /**
-     * Setter for viewer, used for changing the size
-     */
-    void SetViewer(MIHLImageViewer* aViewer);
-
-public: // Methods derived from MMMADisplayWindow
-    void SetDestinationBitmapL(CFbsBitmap* aBitmap);
-    void DrawFrameL(const CFbsBitmap* aBitmap);
-    void SetDrawRect(const TRect& aRect);
-    void SetDrawRectThread(const TRect& aRect);
-
-    /*private:
-        static void StaticSetDrawRect(
-            CMMAAnimationWindow* aWindow,
-            TRect aRect,
-            MMAFunctionServer* aEventSource );*/
-
-protected:  // Data
-    /**
-     * not owned, used for switching from UI thread to MMA thread
-     */
-    MMAFunctionServer* iEventSource;
-
-    /**
-     * Pointer to bitmap context, used for BitBlt instead of
-     * slow DrawRect
-     */
-    CBitmapContext* iBitContext;
-
-    /**
-     * Viewer used for setting new size, not owned
-     */
-    MIHLImageViewer* iViewer;
-};
-
-#endif // CMMAANIMATIONWINDOW_H
--- a/javauis/mmapi_qt/animated_gif_notUsed/src/cmmaanimationframepositioningcontrol.cpp	Tue Jul 06 14:10:26 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,126 +0,0 @@
-/*
-* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:  This class implements FramePositioningControl for animation
-*
-*/
-
-
-//  INCLUDE FILES
-#include <logger.h>
-#include <e32base.h>
-
-#include "MIHLImageViewer.h"
-#include "cmmaanimationframepositioningcontrol.h"
-
-CMMAAnimationFramePositioningControl*
-CMMAAnimationFramePositioningControl::NewL(CMMAAnimationPlayer* aPlayer)
-{
-    CMMAAnimationFramePositioningControl* self =
-        new(ELeave) CMMAAnimationFramePositioningControl(aPlayer);
-    return self;
-}
-
-CMMAAnimationFramePositioningControl::
-CMMAAnimationFramePositioningControl(CMMAAnimationPlayer* aPlayer)
-        : CMMAFramePositioningControl(aPlayer), iPlayer(aPlayer)
-{
-    LOG(EJavaMMAPI, EInfo, "MMA:CMMAAnimationFramePositioningControl::CMMAAnimationFramePositioningControl");
-}
-
-CMMAAnimationFramePositioningControl::~CMMAAnimationFramePositioningControl()
-{
-    LOG(EJavaMMAPI, EInfo, "MMA:CMMAAnimationFramePositioningControl::~CMMAAnimationFramePositioningControl");
-}
-
-TInt CMMAAnimationFramePositioningControl::SeekL(TInt aFrameNumber)
-{
-    LOG(EJavaMMAPI, EInfo, "CMMAAnimationFramePositioningControl::SeekL");
-    MIHLImageViewer* viewer = iPlayer->Viewer();
-    if (!viewer)
-    {
-        return KErrNotFound;
-    }
-    TInt frameNumber = FindFrame(viewer, aFrameNumber);
-    TInt64 mediaTime = iPlayer->MediaTimeForFrame(frameNumber);
-    // adjust wanted media time to get right frame (equal value returns one too small)
-    mediaTime++;
-    iPlayer->SetMediaTimeL(&mediaTime);
-    frameNumber = viewer->AnimationFrame();
-    return frameNumber;
-}
-
-TInt CMMAAnimationFramePositioningControl::SkipL(TInt aFramesToSkip)
-{
-    LOG(EJavaMMAPI, EInfo, "CMMAAnimationFramePositioningControl::SkipL");
-    MIHLImageViewer* viewer = iPlayer->Viewer();
-    if (!viewer)
-    {
-        return KErrNotFound;
-    }
-
-    TInt frameNumber = viewer->AnimationFrame();
-
-    SeekL(frameNumber + aFramesToSkip);
-
-    // Calculate number of frames skipped
-    return viewer->AnimationFrame() - frameNumber;
-}
-
-void CMMAAnimationFramePositioningControl::MapFrameToTimeL(
-    TInt aFrameNumber,
-    TInt64* aMediaTime)
-{
-    LOG(EJavaMMAPI, EInfo, "CMMAAnimationFramePositioningControl::MapFrameToTimeL");
-    MIHLImageViewer* viewer = iPlayer->Viewer();
-    if (!viewer || (aFrameNumber < 0) ||
-            (aFrameNumber >= viewer->AnimationFrameCount()))
-    {
-        *aMediaTime = KErrNotFound;
-    }
-    else
-    {
-        *aMediaTime = iPlayer->MediaTimeForFrame(aFrameNumber);
-    }
-}
-TInt CMMAAnimationFramePositioningControl::MapTimeToFrameL(
-    TInt64* aMediaTime)
-{
-    LOG(EJavaMMAPI, EInfo, "CMMAAnimationFramePositioningControl::MapTimeToFrameL");
-    MIHLImageViewer* viewer = iPlayer->Viewer();
-    TInt64 duration;
-    iPlayer->GetDuration(&duration);
-    if (!viewer || (*aMediaTime < 0) ||
-            (duration == KErrNotFound))
-    {
-        return KErrNotFound;
-    }
-    return iPlayer->FindFrame(*aMediaTime);
-}
-
-TInt CMMAAnimationFramePositioningControl::FindFrame(MIHLImageViewer* aViewer, TInt aFrameNumber)
-{
-    TInt frame = 0;
-    TInt count = aViewer->AnimationFrameCount();
-    if (aFrameNumber >= count)
-    {
-        frame = count - 1;
-    }
-    else if (aFrameNumber > 0)
-    {
-        frame = aFrameNumber;
-    }
-    return frame;
-}
-
-//  END OF FILE
--- a/javauis/mmapi_qt/animated_gif_notUsed/src/cmmaanimationplayer.cpp	Tue Jul 06 14:10:26 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,621 +0,0 @@
-/*
-* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:  This class is used for playing animated images.
-*
-*/
-
-
-//  INCLUDE FILES
-#include <logger.h>
-
-// For Image Handling Library (IHL)
-#include "IHLImageFactory.h"
-#include "MIHLFileImage.h"
-#include "IHLViewerFactory.h"
-#include "MIHLImageViewer.h"
-#include "MIHLBitmap.h"
-#include "IHLBitmapUtil.h"
-
-// MMAPI includes
-#include "mmmadisplay.h"
-
-// Class header
-#include "cmmaanimationplayer.h"
-#include "cmmaanimationwindow.h"
-
-namespace
-{
-const TInt64 KMMATimeUnknown = -1;
-_LIT(KMMAAnimationContentType, "image/gif");
-
-// Approximated minimum showing time of each frame is 0.12s
-// this value basically depends on how fast device can load frames
-// it is not quaranteed anyway that the media time is equal to
-// clock time, so this needed to be only somewhat close
-
-_LIT(KVideoControlName, "VideoControl");
-}
-
-CMMAAnimationPlayer* CMMAAnimationPlayer::NewLC()
-{
-    LOG(EJavaMMAPI, EInfo, "MMA::CMMAAnimationPlayer::NewLC");
-    CMMAAnimationPlayer* self = new(ELeave) CMMAAnimationPlayer();
-    CleanupStack::PushL(self);
-    self->ConstructL();
-    return self;
-}
-
-CMMAAnimationPlayer* CMMAAnimationPlayer::NewLC(const TDesC& aFileName)
-{
-    CMMAAnimationPlayer* self = NewLC();
-    self->iFileName = aFileName.AllocL();
-    return self;
-}
-
-CMMAAnimationPlayer::~CMMAAnimationPlayer()
-{
-    LOG(EJavaMMAPI, EInfo, "MMA::CMMAAnimationPlayer::~CMMAAnimationPlayer +");
-    if (iViewer && iViewer->IsPlaying())
-    {
-        iViewer->Stop();
-    }
-    delete iWindow;
-    delete iSnapshotBitmap;
-    delete iViewer;
-    // viewer has reference to iImage,
-    // thus deletion order is important.
-    delete iBitmap;
-    delete iImage;
-
-    delete iFileName;
-
-    iFSession.Close();
-    LOG(EJavaMMAPI, EInfo, "MMA::CMMAAnimationPlayer::~CMMAAnimationPlayer -");
-}
-
-CMMAAnimationPlayer::CMMAAnimationPlayer()
-        : iFrameCount(0), iMediaTime(KMMATimeUnknown), iEndReached(EFalse),
-        iSendEndOfMediaOnNextFrame(EFalse)
-{
-}
-
-void CMMAAnimationPlayer::ConstructL()
-{
-    LOG(EJavaMMAPI, EInfo, "MMA::CMMAAnimationPlayer::ConstructL +");
-    CMMAPlayer::ConstructL();
-    HBufC* contentType = KMMAAnimationContentType().AllocL();
-    SetContentType(contentType);
-
-    // Connect to file session, needed also when playing from data
-    User::LeaveIfError(iFSession.Connect());
-
-    // File session must be share protected for IHL
-    User::LeaveIfError(iFSession.ShareProtected());
-
-    LOG(EJavaMMAPI, EInfo, "MMA::CMMAAnimationPlayer::ConstructL -");
-}
-
-void CMMAAnimationPlayer::SetPlayerListenerObjectL(
-    jobject aListenerObject,
-    JNIEnv* aJni,
-    MMMAEventPoster* aEventPoster)
-{
-    CMMAPlayer::SetPlayerListenerObjectL(aListenerObject,
-                                         aJni,
-                                         aEventPoster);
-
-    // this method must be called only ones
-    __ASSERT_DEBUG(!iWindow, User::Invariant());
-
-    // create window for animationplayer
-    // event poster is always MMAFunctionServer type.
-    iWindow = CMMAAnimationWindow::NewL(
-                  static_cast< MMAFunctionServer* >(iEventPoster));
-}
-
-void CMMAAnimationPlayer::RealizeL()
-{
-    LOG(EJavaMMAPI, EInfo, "MMA::CMMAAnimationPlayer::RealizeL");
-    // For file locator file must be prefetched here because
-    // FramePositioningControl must know duration of media
-    // in realized state
-    if (iFileName)
-    {
-        TRAPD(err, PrefetchFileL());
-        if (err != KErrNone)
-        {
-            User::Leave(err);
-        }
-    }
-    CMMAPlayer::RealizeL();
-}
-
-void CMMAAnimationPlayer::PrefetchL()
-{
-    LOG(EJavaMMAPI, EInfo, "MMA::CMMAAnimationPlayer::PrefetchL +");
-    __ASSERT_DEBUG((iSourceStreams.Count() > 0) || iFileName, User::Invariant());
-
-    if (iFileName)
-    {
-        // file data is already fetched in when realizing
-
-        // If initDisplayMode was called before prefetch,
-        // then the display must notified about source size.
-        if (iDisplay)
-        {
-            iDisplay->SourceSizeChanged(iSourceSize);
-            NotifyWithStringEvent(CMMAPlayerEvent::ESizeChanged, KVideoControlName);
-        }
-
-        // ChangeState(EPrefetched);
-        // PostActionCompleted(KErrNone);
-        // we can go to prefetched state immediately
-        PostActionCompletedFile();
-        ChangeState(EPrefetched);
-    }
-    else
-    {
-        // Using TDes -- load the whole animation
-        iSourceStreams[ 0 ]->ReadAllL();
-    }
-
-    // CMMASourceStream will notify with ReadCompleted
-    LOG(EJavaMMAPI, EInfo, "MMA::CMMAAnimationPlayer::PrefetchL -");
-}
-
-void CMMAAnimationPlayer::StartL()
-{
-    LOG(EJavaMMAPI, EInfo, "MMA::CMMAAnimationPlayer::StartL +");
-
-    // If end of media has been reached, then
-    // start from beginning
-    if (iEndReached)
-    {
-        iEndReached = EFalse;
-        iViewer->SetAnimationFrame(0);
-        iMediaTime = 0;
-    }
-    PostLongEvent(CMMAPlayerEvent::EStarted, iMediaTime);
-
-    // process current frame
-    ProcessCurrentFrameL();
-
-    // progress to next frame (start playback) only if rate is not zero
-    if (iCurrentRate > 0)
-    {
-        iViewer->Play();
-    }
-    ChangeState(EStarted);
-    PostActionCompletedStart();
-    // PostActionCompleted(KErrNone);   // java start return
-
-
-    LOG(EJavaMMAPI, EInfo, "MMA::CMMAAnimationPlayer::StartL -");
-}
-
-void CMMAAnimationPlayer::ProcessCurrentFrameL()
-{
-    if (iSendEndOfMediaOnNextFrame)
-    {
-        iSendEndOfMediaOnNextFrame = EFalse;
-        // we are reached the end
-        if (!iRepeatForever)
-        {
-            iRepeatCount++;
-            if (iRepeatCount >= iRepeatNumberOfTimes)
-            {
-                LOG(EJavaMMAPI, EInfo, "CMMAAnimationPlayer:ProcessCurrentFrameL: Reached repeat count, Stopping");
-                // end looping, do not send stopped event
-                StopL(EFalse);
-                iViewer->SetAnimationFrame(iFrameCount - 1);
-                SetLoopCount(iRepeatNumberOfTimes);   // reset loop count
-
-                // Signal that end of media has been reached so on next
-                // start playback will be started from beginning. This is needed
-                // because if user sets media time to end of media, then start
-                // should not start from beginning but just deliver end of media.
-                // After that, the next start should start from beginning.
-                iEndReached = ETrue;
-            }
-        }
-        PostLongEvent(CMMAPlayerEvent::EEndOfMedia, iMediaTime);
-        LOG(EJavaMMAPI, EInfo, "CMMAAnimationPlayer:ProcessCurrentFrameL: sent END_OF_MEDIA");
-
-        // Prevents this frame from being viewed if playback has terminated
-        // (e.g. not looping)
-        if (iEndReached)
-        {
-            return;
-        }
-    }
-
-    // draw current frame to display if we have it
-    if (iDisplay)
-    {
-        const CFbsBitmap& bitmap = iBitmap->Bitmap();
-        iDisplay->DrawFrameL(&bitmap);
-    }
-
-    TInt currentFrame = iViewer->AnimationFrame();
-    if (currentFrame == 0)
-    {
-        LOG(EJavaMMAPI, EInfo, "CMMAAnimationPlayer:ProcessCurrentFrameL: Reset mediatime");
-        // reset media time when looping
-        iMediaTime = 0;
-    }
-    iMediaTime += FrameDuration(currentFrame).Int();
-
-    // Media time has gone over duration if user has
-    // set media time explicitely to duration.
-    if (iMediaTime > iDuration)
-    {
-        iMediaTime = iDuration;
-    }
-
-    if (currentFrame == (iFrameCount - 1))
-    {
-        // End has been reached, so EndOfMedia is sent when
-        // duration of last frame has passed
-        iSendEndOfMediaOnNextFrame = ETrue;
-    }
-
-    // inform observer
-    if (iAnimationObserver)
-    {
-        iAnimationObserver->AnimationAdvancedL(iViewer->AnimationFrame(), iMediaTime);
-    }
-}
-
-void CMMAAnimationPlayer::StopL(TBool aPostEvent)
-{
-    LOG(EJavaMMAPI, EInfo, "MMA::CMMAAnimationPlayer::StopL +");
-    iViewer->Stop();
-    // adjust mediatime
-    if (aPostEvent)
-    {
-        PostLongEvent(CMMAPlayerEvent::EStopped, iMediaTime);
-    }
-    ChangeState(EPrefetched);
-    LOG(EJavaMMAPI, EInfo, "MMA::CMMAAnimationPlayer::StopL -");
-}
-
-void CMMAAnimationPlayer::DeallocateL()
-{
-    LOG(EJavaMMAPI, EInfo, "MMA::CMMAAnimationPlayer::DeallocateL +");
-    // If player is in starte state when deallocate is called,
-    // player is stopped from java side -> state is changed to
-    // prefetched.
-    if (iViewer)
-    {
-        if (iViewer->IsPlaying())
-            iViewer->Stop();
-
-        delete iViewer;
-        iViewer = NULL;
-    }
-
-    if (iState == EPrefetched)
-    {
-        ResetSourceStreams();
-        iEndReached = EFalse;
-        iSendEndOfMediaOnNextFrame = EFalse;
-        ChangeState(ERealized);
-    }
-    LOG(EJavaMMAPI, EInfo, "MMA::CMMAAnimationPlayer::DeallocateL -");
-}
-
-void CMMAAnimationPlayer::GetDuration(TInt64* aDuration)
-{
-    *aDuration = iDuration;
-}
-
-TInt CMMAAnimationPlayer::FindFrame(TInt64 aTime)
-{
-    __ASSERT_DEBUG(iImage, User::Invariant());
-
-    // if we are out of bounds
-    if (aTime > iDuration)
-    {
-        return KErrNotFound;
-    }
-
-    TInt64 time = 0;
-    TInt fIndex = 0;
-    while ((time < aTime) && (fIndex < iFrameCount))
-    {
-        time += FrameDuration(fIndex++).Int();
-    }
-
-    // adjust to previous frame
-    if (fIndex > 0)
-    {
-        fIndex--;
-    }
-
-    return fIndex;
-}
-
-TInt64 CMMAAnimationPlayer::MediaTimeForFrame(TInt aFrameIndex)
-{
-    __ASSERT_DEBUG((aFrameIndex <= iFrameCount) && (aFrameIndex >= 0),
-                   User::Invariant());
-
-    TInt64 time = 0;
-    for (TInt fIndex = 0; fIndex < aFrameIndex; fIndex++)
-    {
-        time += FrameDuration(fIndex).Int();
-    }
-    return time;
-}
-
-TTimeIntervalMicroSeconds32 CMMAAnimationPlayer::FrameDuration(TInt aFrameIndex)
-{
-    __ASSERT_DEBUG(iImage, User::Invariant());
-    TTimeIntervalMicroSeconds32 fDur = iImage->AnimationFrameDelay(aFrameIndex);
-    const TTimeIntervalMicroSeconds32 KMMAMinimumFrameTime = 120000;
-
-    if (fDur < KMMAMinimumFrameTime)
-    {
-        fDur = KMMAMinimumFrameTime;
-    }
-    return fDur;
-}
-
-void CMMAAnimationPlayer::SetMediaTimeL(TInt64* aTime)
-{
-    if (!iImage && !iViewer)
-    {
-        // not yet prefetched
-        *aTime = KErrNotSupported;
-    }
-    else
-    {
-        // Media time of last frame is not the same as duration of
-        // media, so if media time of duration is requested, then it must
-        // be given out altough media time of last frame is lower than that.
-        if (*aTime >= iDuration)
-        {
-            User::LeaveIfError(iViewer->SetAnimationFrame(iFrameCount - 1));
-            iMediaTime = iDuration;
-        }
-        else
-        {
-            TInt frame = FindFrame(*aTime);
-            User::LeaveIfError(iViewer->SetAnimationFrame(frame));
-            iMediaTime = MediaTimeForFrame(frame);
-        }
-        *aTime = iMediaTime;
-        iEndReached = EFalse;
-        iSendEndOfMediaOnNextFrame = EFalse;
-    }
-
-}
-
-void CMMAAnimationPlayer::GetMediaTime(TInt64* aMediaTime)
-{
-    *aMediaTime = iMediaTime;
-}
-
-const TDesC& CMMAAnimationPlayer::Type()
-{
-    return KMMAVideoPlayer;
-}
-
-void CMMAAnimationPlayer::ReadCompletedL(TInt aStatus, const TDesC8& aData)
-{
-    if (aStatus < KErrNone)
-    {
-        PostActionCompleted(aStatus);
-    }
-    else
-    {
-        TRAPD(err, PrefetchDataL(aData));
-        if (err == KErrNone)
-        {
-            ChangeState(EPrefetched);
-        }
-        PostActionCompleted(err);
-    }
-}
-
-void CMMAAnimationPlayer::PrefetchFileL()
-{
-    iImage = IHLImageFactory::OpenFileImageL(iFSession, *iFileName);
-    PrepareViewerL();
-}
-
-void CMMAAnimationPlayer::PrefetchDataL(const TDesC8& aData)
-{
-    LOG1(EJavaMMAPI, EInfo, "MMA::CMMAAnimationPlayer::PrefetchDataL aData size %d",
-         aData.Size());
-
-    // Create source image from data
-    iImage = IHLImageFactory::OpenBufferedFileImageL(iFSession, aData);
-    PrepareViewerL();
-}
-
-TBool CMMAAnimationPlayer::IsFilePlayer()
-{
-    if (iFileName != NULL)
-    {
-        return ETrue;
-    }
-    return EFalse;
-}
-
-void CMMAAnimationPlayer::PrepareViewerL()
-{
-    // Non-animated gifs are not supported
-    if (!(iImage->IsAnimation()))
-    {
-        User::Leave(KErrNotSupported);
-    }
-
-    // Store image dimensions
-    iSourceSize = iImage->Size();
-
-    // Create destination bitmap
-    iBitmap = IHLBitmap::CreateL();
-    User::LeaveIfError(iBitmap->Create(iSourceSize, iImage->DisplayMode()));
-
-    // Create image viewer
-    iViewer = IHLViewerFactory::CreateImageViewerL(
-                  iSourceSize,
-                  *iImage, // source
-                  *iBitmap, // destination
-                  *this);  // reference to MIHLViewerObserver
-
-    // Set viewer for window
-    iWindow->SetViewer(iViewer);
-
-    // Store animation frame count locally
-    iFrameCount = iViewer->AnimationFrameCount();
-
-    // calculate duration
-    iDuration = MediaTimeForFrame(iFrameCount);
-
-    // set media time to begin
-    iMediaTime = 0;
-
-    // If init has been already done
-    if (iDisplay)
-    {
-        iDisplay->SourceSizeChanged(iSourceSize);
-        NotifyWithStringEvent(CMMAPlayerEvent::ESizeChanged, KVideoControlName);
-    }
-}
-
-MIHLImageViewer* CMMAAnimationPlayer::Viewer()
-{
-    return iViewer;
-}
-
-void CMMAAnimationPlayer::SetAnimationObserver(MMMAAnimationObserver* aAnimationObserver)
-{
-    iAnimationObserver = aAnimationObserver;
-}
-
-TInt CMMAAnimationPlayer::SetRateL(TInt aRate)
-{
-    LOG(EJavaMMAPI, EInfo, "MMA:CMMAAnimationPlayer::SetRateL");
-    if ((iState == EStarted) && (iCurrentRate != aRate))
-    {
-        if (aRate <= 0)
-        {
-            iViewer->Stop();
-        }
-        else
-        {
-            iViewer->Play();
-        }
-    }
-    iCurrentRate = aRate;
-    return iCurrentRate;
-}
-
-TInt CMMAAnimationPlayer::RateL()
-{
-    LOG(EJavaMMAPI, EInfo, "MMA:CMMAAnimationPlayer::RateL");
-    return iCurrentRate;
-}
-
-void CMMAAnimationPlayer::SetDisplayL(MMMADisplay* aDisplay)
-{
-    // now it is ready to draw
-    iDisplay = aDisplay;
-    iDisplay->SetWindowL(iWindow);
-
-    // if state < prefeteched then we dont know actual source size yet
-    // and it will be set after prefetch
-    if (iState >= EPrefetched ||
-            (iFileName && iState == ERealized))
-    {
-        iDisplay->SourceSizeChanged(iSourceSize);
-        NotifyWithStringEvent(CMMAPlayerEvent::ESizeChanged, KVideoControlName);
-    }
-}
-
-TSize CMMAAnimationPlayer::SourceSize()
-{
-    return iSourceSize;
-}
-
-void CMMAAnimationPlayer::NotifyWithStringEvent(
-    CMMAPlayerEvent::TEventType aEventType,
-    const TDesC& aStringEventData)
-{
-    PostStringEvent(aEventType, aStringEventData);
-}
-
-MMMASnapshot* CMMAAnimationPlayer::SnapshoterL()
-{
-    return this;
-}
-
-MMMASnapshot::TEncoding CMMAAnimationPlayer::TakeSnapshotL(TRequestStatus* aStatus,
-        const TSize& /*aSize*/,
-        const CMMAImageSettings& /*aSettings*/)
-{
-    if (iBitmap)
-    {
-        // Bitmap has to be copied to get ownership of the bitmap instance.
-        iSnapshotBitmap = IHLBitmapUtil::CopyBitmapL(iBitmap->Bitmap());
-    }
-    else
-    {
-        // When content comes from a stream, iBitmap is not available
-        // until prefetched state is entered. In this case an empty bitmap
-        // is returned instead.
-        iSnapshotBitmap = new(ELeave) CFbsBitmap();
-    }
-    // notify the caller, error code or KErrNone
-    User::RequestComplete(aStatus, KErrNone);
-
-    // Return raw bitmap encoding and thus SnapshotEncoded() should not
-    // get called later on.
-    return EBitmap;
-}
-
-CFbsBitmap* CMMAAnimationPlayer::SnapshotBitmap()
-{
-    CFbsBitmap* bitmap = iSnapshotBitmap;
-    // ownership is transferred to caller
-    iSnapshotBitmap = NULL;
-    return bitmap;
-}
-
-HBufC8* CMMAAnimationPlayer::SnapshotEncoded()
-{
-    // This method should never be called.
-    // Asserted in debug build to be sure.
-    __ASSERT_DEBUG(EFalse, User::Invariant());
-
-    return NULL;
-}
-
-void CMMAAnimationPlayer::ViewerBitmapChangedL()
-{
-    if (iState == EStarted)
-    {
-        ProcessCurrentFrameL();
-    }
-}
-
-void CMMAAnimationPlayer::ViewerError(TInt /*aError*/)
-{
-    // Not implemented currently because
-    // not implemented by IHL either.
-}
-
-//  END OF FILE
--- a/javauis/mmapi_qt/animated_gif_notUsed/src/cmmaanimationplayerfactory.cpp	Tue Jul 06 14:10:26 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,196 +0,0 @@
-/*
-* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:  This class is used for creating animation player.
-*
-*/
-
-
-//  INCLUDE FILES
-#include <logger.h>
-
-#include "cmmavideocontrol.h"
-#include "cmmaanimationratecontrol.h"
-#include "cmmaanimationstoptimecontrol.h"
-#include "cmmaanimationframepositioningcontrol.h"
-#include "cmmaanimationplayer.h"
-#include "cmmaanimationplayerfactory.h"
-
-// Animation type info
-_LIT(KMMAAnimationMimeTypeGIF, "image/gif");
-_LIT(KMMAAnimationSuffixGIF, "gif");
-
-// header data and length
-_LIT8(KMMAAnimationGIFVersion, "GIF89a");
-const TUint8 KMMAGifVersionLength = 6;
-
-CMMAAnimationPlayerFactory* CMMAAnimationPlayerFactory::NewLC()
-{
-    CMMAAnimationPlayerFactory* pFactory =
-        new(ELeave) CMMAAnimationPlayerFactory();
-    CleanupStack::PushL(pFactory);
-    return pFactory;
-}
-
-CMMAAnimationPlayerFactory::CMMAAnimationPlayerFactory()
-{
-}
-
-
-CMMAAnimationPlayerFactory::~CMMAAnimationPlayerFactory()
-{
-}
-
-// Creates new player according to a content type.
-CMMAPlayer* CMMAAnimationPlayerFactory::CreatePlayerL(
-    const TDesC& aContentType)
-{
-    CMMAPlayer* player = NULL;
-    if (aContentType == KMMAAnimationMimeTypeGIF)
-    {
-        player = CreateAnimationPlayerL();
-    }
-    return player;
-}
-
-// Creates new player according to a locator
-CMMAPlayer* CMMAAnimationPlayerFactory::CreatePlayerL(
-    const TDesC& aProtocol,
-    const TDesC& aMiddlePart,
-    const TDesC& /*aParameters*/)
-{
-    CMMAPlayer* player = NULL;
-    if (aProtocol == KMMAFileProtocol)
-    {
-        // filename ends to gif suffix
-        if (aMiddlePart.Right(KMMAAnimationSuffixGIF().Length()) ==
-                KMMAAnimationSuffixGIF())
-        {
-            player = CreateAnimationPlayerL(aMiddlePart);
-        }
-        else
-        {
-            // try to recognize from headerdata
-            RFs fs;
-            CleanupClose< RFs >::PushL(fs);
-            User::LeaveIfError(fs.Connect());
-
-            RFile file;
-            CleanupClose< RFile >::PushL(file);
-
-            User::LeaveIfError(file.Open(fs, aMiddlePart, EFileRead));
-
-            TBuf8< KMMAGifVersionLength > header;
-            User::LeaveIfError(file.Read(header));
-
-            CleanupStack::PopAndDestroy(2);   // fs, file
-
-            if (header == KMMAAnimationGIFVersion())
-            {
-                player = CreateAnimationPlayerL(aMiddlePart);
-            }
-        }
-    }
-
-    return (CMMAPlayer*) player;
-}
-
-// Creates new player according to a header data
-CMMAPlayer* CMMAAnimationPlayerFactory::CreatePlayerL(
-    const TDesC8& aHeaderData)
-{
-    CMMAPlayer* player = NULL;
-    TPtrC8 header = aHeaderData.Left(KMMAAnimationGIFVersion().Length());
-    if (header == KMMAAnimationGIFVersion())
-    {
-        player = CreateAnimationPlayerL();
-    }
-    return player;
-}
-
-// Gets player's supported content types.
-void CMMAAnimationPlayerFactory::GetSupportedContentTypesL(
-    const TDesC& aProtocol,
-    CDesC16Array& aMimeTypeArray)
-{
-    if (aProtocol == KNullDesC ||
-            aProtocol == KMMAHttpProtocol ||
-            aProtocol == KMMAHttpsProtocol ||
-            aProtocol == KMMAFileProtocol)
-    {
-        aMimeTypeArray.AppendL(KMMAAnimationMimeTypeGIF);
-    }
-}
-
-// Gets player's supported protocols for the content type.
-void CMMAAnimationPlayerFactory::GetSupportedProtocolsL(
-    const TDesC& aContentType,
-    CDesC16Array& aProtocolArray)
-{
-    if (aContentType == KNullDesC ||
-            aContentType == KMMAAnimationMimeTypeGIF)
-    {
-        aProtocolArray.AppendL(KMMAHttpProtocol);
-        aProtocolArray.AppendL(KMMAHttpsProtocol);
-        aProtocolArray.AppendL(KMMAFileProtocol);
-    }
-}
-
-CMMAAnimationPlayer* CMMAAnimationPlayerFactory::CreateAnimationPlayerL(const TDesC& aFileName)
-{
-    CMMAAnimationPlayer* player = CMMAAnimationPlayer::NewLC(aFileName);
-    AddControlsL(player);
-    CleanupStack::Pop(); // player
-    return player;
-}
-
-CMMAAnimationPlayer* CMMAAnimationPlayerFactory::CreateAnimationPlayerL()
-{
-    CMMAAnimationPlayer* player = CMMAAnimationPlayer::NewLC();
-    AddControlsL(player);
-    CleanupStack::Pop(); // player
-    return player;
-}
-
-void CMMAAnimationPlayerFactory::AddControlsL(CMMAAnimationPlayer* aPlayer)
-{
-    CMMAVideoControl* videoControl = new(ELeave) CMMAVideoControl(aPlayer);
-    CleanupStack::PushL(videoControl);
-    aPlayer->AddControlL(videoControl);
-    CleanupStack::Pop(videoControl);
-
-    CMMAAnimationStopTimeControl* stopTimeControl =
-        CMMAAnimationStopTimeControl::NewL(aPlayer);
-    CleanupStack::PushL(stopTimeControl);
-    aPlayer->AddControlL(stopTimeControl);
-    CleanupStack::Pop(stopTimeControl);
-
-    // Own RateControl
-    CMMAAnimationRateControl* rateControl =
-        CMMAAnimationRateControl::NewL(aPlayer);
-    CleanupStack::PushL(rateControl);
-    aPlayer->AddControlL(rateControl);
-    CleanupStack::Pop(rateControl);
-
-    // FramePositioningControl is only supported for file locator
-    if (aPlayer->IsFilePlayer())
-    {
-        CMMAAnimationFramePositioningControl* animationFramePositioningControl =
-            CMMAAnimationFramePositioningControl::NewL(aPlayer);
-        CleanupStack::PushL(animationFramePositioningControl);
-        aPlayer->AddControlL(animationFramePositioningControl);
-        CleanupStack::Pop(animationFramePositioningControl);
-    }
-
-}
-//  END OF FILE
--- a/javauis/mmapi_qt/animated_gif_notUsed/src/cmmaanimationratecontrol.cpp	Tue Jul 06 14:10:26 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,104 +0,0 @@
-/*
-* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-
-//  INCLUDE FILES
-#include <logger.h>
-#include <e32base.h>
-
-#include "cmmaanimationratecontrol.h"
-#include "cmmaanimationplayer.h"
-
-
-// -----------------------------------------------------------------------------
-// CMMAAnimationRateControl::NewL
-// Two-phased constructor.
-// -----------------------------------------------------------------------------
-//
-CMMAAnimationRateControl* CMMAAnimationRateControl::NewL(CMMAAnimationPlayer* aPlayer)
-{
-    CMMAAnimationRateControl* self = new(ELeave) CMMAAnimationRateControl(aPlayer);
-    CleanupStack::PushL(self);
-    self->ConstructL();
-    CleanupStack::Pop();
-    return self;
-}
-
-// -----------------------------------------------------------------------------
-// CMMAAnimationRateControl::CMMAAnimationRateControl
-// C++ default constructor can NOT contain any code, that
-// might leave.
-// -----------------------------------------------------------------------------
-//
-CMMAAnimationRateControl::CMMAAnimationRateControl(CMMAAnimationPlayer* aPlayer)
-{
-    LOG(EJavaMMAPI, EInfo, "MMA:CMMAAnimationRateControl::CMMAAnimationRateControl");
-    iPlayer = aPlayer;
-}
-
-// Destructor
-CMMAAnimationRateControl::~CMMAAnimationRateControl()
-{
-    LOG(EJavaMMAPI, EInfo, "MMA:CMMAAnimationRateControl::~CMMAAnimationRateControl");
-}
-
-// -----------------------------------------------------------------------------
-// CMMAAnimationRateControl::ConstructL
-// Symbian 2nd phase constructor can leave.
-// -----------------------------------------------------------------------------
-//
-void CMMAAnimationRateControl::ConstructL()
-{
-    LOG(EJavaMMAPI, EInfo, "MMA:CMMAAnimationRateControl::ConstructL");
-    iPlayer->SetRateL(KMMADefaultRate);
-}
-
-// -----------------------------------------------------------------------------
-// CMMAAnimationRateControl::SetRateL
-// Set rate to minimum or default rate depending on parameter. Informs player
-// that rate has changed. Returns set rate.
-// (other items were commented in a header).
-// -----------------------------------------------------------------------------
-TInt CMMAAnimationRateControl::SetRateL(TInt aRate)
-{
-    LOG(EJavaMMAPI, EInfo, "MMA:CMMAAnimationRateControl::SetRateL");
-    TInt rate = aRate;
-
-    if (rate <= KMMAMinRate)
-    {
-        rate = KMMAMinRate;
-    }
-    else
-    {
-        rate = KMMADefaultRate;
-    }
-    return iPlayer->SetRateL(rate);
-}
-
-// -----------------------------------------------------------------------------
-// CMMAAnimationRateControl::RateL
-// Returns current rate.
-//
-// (other items were commented in a header).
-// -----------------------------------------------------------------------------
-TInt CMMAAnimationRateControl::RateL()
-{
-    LOG(EJavaMMAPI, EInfo, "MMA:CMMAAnimationRateControl::RateL");
-    return iPlayer->RateL();
-}
-
-//  END OF FILE
--- a/javauis/mmapi_qt/animated_gif_notUsed/src/cmmaanimationstoptimecontrol.cpp	Tue Jul 06 14:10:26 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,66 +0,0 @@
-/*
-* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:  This class is used for stoptime controlling
-*
-*/
-
-
-//  INCLUDE FILES
-#include <logger.h>
-#include <e32std.h>
-
-#include "cmmaanimationstoptimecontrol.h"
-#include "cmmaplayer.h"
-
-CMMAAnimationStopTimeControl* CMMAAnimationStopTimeControl::NewL(CMMAAnimationPlayer* aPlayer)
-{
-    LOG(EJavaMMAPI, EInfo, "MMA:CMMAAnimationStopTimeControl::NewL");
-    CMMAAnimationStopTimeControl* control =
-        new(ELeave) CMMAAnimationStopTimeControl(aPlayer);
-    aPlayer->SetAnimationObserver(control);
-    return control;
-}
-
-
-CMMAAnimationStopTimeControl::~CMMAAnimationStopTimeControl()
-{
-}
-
-
-CMMAAnimationStopTimeControl::CMMAAnimationStopTimeControl(CMMAAnimationPlayer* aPlayer)
-        : CMMAStopTimeControl(aPlayer)
-{
-}
-
-void CMMAAnimationStopTimeControl::SetStopTimeL(const TInt64& aTime)
-{
-    LOG(EJavaMMAPI, EInfo, "MMA:CMMAAnimationStopTimeControl::SetStopTimeL");
-    iStopTime = aTime;
-}
-
-void CMMAAnimationStopTimeControl::AnimationAdvancedL(TInt /*aFrame*/, TInt64 aMediaTime)
-{
-    LOG(EJavaMMAPI, EInfo, "MMA:CMMAAnimationStopTimeControl::AnimationAdvancedL");
-    if (aMediaTime > iStopTime)
-    {
-        iPlayer->StopL(EFalse);
-        iPlayer->PostLongEvent(CMMAPlayerEvent::EStoppedAtTime, aMediaTime);
-        iStopTime = iNoTimer;
-    }
-}
-
-
-
-
-//  END OF FILE
--- a/javauis/mmapi_qt/animated_gif_notUsed/src/cmmaanimationwindow.cpp	Tue Jul 06 14:10:26 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,101 +0,0 @@
-/*
-* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:  This abstract class implements MMMADisplayWindow functionality
-*                in CFbsBitmap based displays.
-*
-*/
-
-
-//  Include Files
-#include <logger.h>
-#include <bitdev.h>
-#include "cmmaanimationwindow.h"
-
-// Destructor (virtual by CBase)
-CMMAAnimationWindow::~CMMAAnimationWindow()
-{
-    delete iBitContext;
-}
-
-CMMAAnimationWindow* CMMAAnimationWindow::NewL(
-    MMAFunctionServer* aEventSource)
-{
-    CMMAAnimationWindow* self =
-        new(ELeave)CMMAAnimationWindow(aEventSource);
-    return self;
-}
-
-CMMAAnimationWindow::CMMAAnimationWindow(MMAFunctionServer* aEventSource):
-        iEventSource(aEventSource)
-{
-}
-
-void CMMAAnimationWindow::SetViewer(MIHLImageViewer* aViewer)
-{
-    iViewer = aViewer;
-}
-
-void CMMAAnimationWindow::SetDestinationBitmapL(CFbsBitmap* aBitmap)
-{
-    CMMABitmapWindow::SetDestinationBitmapL(aBitmap);
-    User::LeaveIfError(iBitmapDevice->CreateBitmapContext(iBitContext));
-}
-
-void CMMAAnimationWindow::DrawFrameL(const CFbsBitmap* aBitmap)
-{
-    if (iBitmap)
-    {
-        iBitContext->BitBlt(iDrawRect.iTl, aBitmap);
-    }
-}
-
-// Local wrapper function to SetDrawRect method
-LOCAL_C void StaticSetDrawRect(
-    CMMAAnimationWindow* aWindow,
-    const TRect* aRect)
-{
-    aWindow->SetDrawRect(*aRect);
-}
-
-void CMMAAnimationWindow::SetDrawRect(const TRect& aRect)
-{
-    iDrawRect = aRect;
-    if (iViewer)
-    {
-        TReal zoomRatio = 1.0;
-        if ((iViewer->SourceSize().iWidth - aRect.Width()) >
-                (iViewer->SourceSize().iHeight - aRect.Height()))
-        {
-            // calculate zoom ratio from width
-            zoomRatio = (TReal)aRect.Width() / (TReal)iViewer->SourceSize().iWidth;
-        }
-        else
-        {
-            // calculate zoom ratio from height
-            zoomRatio = (TReal)aRect.Height() / (TReal)iViewer->SourceSize().iHeight;
-        }
-
-        iViewer->SetViewerSize(iDrawRect.Size());
-        iViewer->SetZoomRatio(zoomRatio);
-    }
-}
-
-void CMMAAnimationWindow::SetDrawRectThread(const TRect& aRect)
-{
-    iEventSource->ExecuteV(&StaticSetDrawRect,
-                           this,
-                           &aRect);
-}
-
-//  END OF FILE
--- a/javauis/mmapi_qt/baseline/inc.nga/cmmasurfacewindow.h	Tue Jul 06 14:10:26 2010 +0300
+++ b/javauis/mmapi_qt/baseline/inc.nga/cmmasurfacewindow.h	Wed Aug 18 09:43:15 2010 +0300
@@ -65,7 +65,8 @@
         EResetSurfaceParameters,
         ESetChangedSurfaceParameters,
         ECleanVideoDisplay,
-        EDestroyWindow
+        EDestroyWindow,
+        EChangeVisibility        
     };
 
 private:
@@ -158,6 +159,7 @@
     const TRect& WindowRect();
     void ContainerDestroyed();
     void ContainerSet();
+    void DoSetVisibleL();
 /*
 public: // from base class MUiEventConsumer
     void MdcDSAResourcesCallback(RWsSession &aWs,
--- a/javauis/mmapi_qt/baseline/inc/mmmadisplaywindow.h	Tue Jul 06 14:10:26 2010 +0300
+++ b/javauis/mmapi_qt/baseline/inc/mmmadisplaywindow.h	Wed Aug 18 09:43:15 2010 +0300
@@ -246,6 +246,10 @@
     virtual void UICallback( TInt /*aCallbackId*/ )
     {
     }
+    
+    virtual void DoSetVisibleL()
+    {
+    }
 };
 
 #endif // MMMADISPLAYWINDOW_H
--- a/javauis/mmapi_qt/baseline/javasrc.emc/com/nokia/microedition/media/ManagerImpl.java	Tue Jul 06 14:10:26 2010 +0300
+++ b/javauis/mmapi_qt/baseline/javasrc.emc/com/nokia/microedition/media/ManagerImpl.java	Wed Aug 18 09:43:15 2010 +0300
@@ -469,24 +469,28 @@
         InternalPlayer player =null;
         /// Implementation done for java ui 3.x req
         // in case of AnimationPlayer file protocol, we won't be using the ProtocolFactory class.
-        // We need to do this kind of work out, only if it is file protocol 
-		if (new Locator(aLocator).getProtocol().equals("file")) {
-			Enumeration plugins = iPlugIns.elements();
-			AnimationPlayerFactory apf = null;
-			while (plugins.hasMoreElements() && (player == null)) {
-				PlugIn temp = (PlugIn) plugins.nextElement();
-				if (temp instanceof AnimationPlayerFactory) {
-					apf = (AnimationPlayerFactory) temp;
-					break;
-				}
-			}
-			if (apf != null) {
-				player = apf.createPlayer(aLocator);
-			}
-		}
+        // We need to do this kind of work out, only if it is file protocol
+        if (new Locator(aLocator).getProtocol().equals("file"))
+        {
+            Enumeration plugins = iPlugIns.elements();
+            AnimationPlayerFactory apf = null;
+            while (plugins.hasMoreElements() && (player == null))
+            {
+                PlugIn temp = (PlugIn) plugins.nextElement();
+                if (temp instanceof AnimationPlayerFactory)
+                {
+                    apf = (AnimationPlayerFactory) temp;
+                    break;
+                }
+            }
+            if (apf != null)
+            {
+                player = apf.createPlayer(aLocator);
+            }
+        }
         ////////////////////////////////////////////////////////
         // if player is still null, try to create the native player
-		System.out.println("ManagerImpl::createPlayer(String locator )locator is "+aLocator );
+        System.out.println("ManagerImpl::createPlayer(String locator )locator is "+aLocator);
         if (player==null)
             player =iProtocolFactory.createPlayer(
                         new Locator(aLocator));
--- a/javauis/mmapi_qt/baseline/javasrc/com/nokia/microedition/media/animation/AnimationPlayer.java	Tue Jul 06 14:10:26 2010 +0300
+++ b/javauis/mmapi_qt/baseline/javasrc/com/nokia/microedition/media/animation/AnimationPlayer.java	Wed Aug 18 09:43:15 2010 +0300
@@ -16,19 +16,14 @@
 */
 package com.nokia.microedition.media.animation;
 
-import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
 import java.io.IOException;
 import java.io.InputStream;
-import java.io.OutputStream;
 import java.util.Enumeration;
 import java.util.Hashtable;
-import java.util.Timer;
-import java.util.TimerTask;
 
 import javax.microedition.media.Control;
 import javax.microedition.media.MediaException;
-import javax.microedition.media.Player;
 import javax.microedition.media.PlayerListener;
 import javax.microedition.media.protocol.DataSource;
 
@@ -48,8 +43,6 @@
 import com.nokia.microedition.media.InputStreamSourceStream;
 import com.nokia.microedition.media.PlayerBase;
 import com.nokia.microedition.media.PlayerListenerImpl;
-import com.nokia.mj.impl.nokialcdui.LCDUIInvoker;
-import com.nokia.mj.impl.utils.Logger;
 
 public class AnimationPlayer extends PlayerBase implements ESWTinitializeListener
 {
@@ -98,7 +91,7 @@
     // of VideoControl should return the actual width and height of the image
     private Point iSourceDimension;
     // Current dimension of the image, MIDlet developer may change the size of VideoControl
-//    private Point iCurrentVideoDimension;
+    private Point iCurrentVideoDimension;
     // Total time taken so far to player the animation, it keeps updating as player moves
     private long iMediaTime;
     // Time at which, player should be stopped
@@ -121,8 +114,9 @@
     /**
      *
      * @param ds DataSource which contains the data to be displayed
+     * @throws MediaException
      */
-    public AnimationPlayer(DataSource ds)
+    public AnimationPlayer(DataSource ds) throws MediaException
     {
         iPlayerListenerImpl= new PlayerListenerImpl(this);
         //TODO check if we can do it in better way
@@ -135,7 +129,14 @@
         if (is!=null)
         {
             ImageLoader imageLoader= new ImageLoader();
+
+            // If it is any other format other than the image(jpeg, png and gif),
+            // following line will throw the SWT exception
             iImageData=imageLoader.load(is);
+            // If the image is loaded properly, we need to check whether it is GIF image or not.
+            // It can be PNG and JPEG as well
+            if (iImageData[0].type!=SWT.IMAGE_GIF)
+                throw new MediaException("Could not create player");
             try
             {
                 is.close();
@@ -145,6 +146,7 @@
                 e.printStackTrace();
             }
             iSourceDimension= new Point(imageLoader.logicalScreenWidth, imageLoader.logicalScreenHeight);
+            iCurrentVideoDimension= new Point(imageLoader.logicalScreenWidth, imageLoader.logicalScreenHeight);
             iBackgroundPixel= imageLoader.backgroundPixel;
         }
         populateControl();
@@ -156,13 +158,19 @@
      * @param locator
      * @throws SWTException
      */
-    public AnimationPlayer(String locator) throws SWTException
+    public AnimationPlayer(String locator) throws SWTException, MediaException
     {
-        iPlayerListenerImpl= new PlayerListenerImpl(this);
         ImageLoader imageLoader= new ImageLoader();
-        // Following line may throw SWTException
+        // If it is any other format other than the image(jpeg, png and gif),
+        // following line will throw the SWT exception
         iImageData=imageLoader.load(locator);
+        // If the image is loaded properly, we need to check whether it is GIF image or not.
+        // It can be PNG and JPEG as well
+        if (iImageData[0].type!=SWT.IMAGE_GIF)
+            throw new MediaException("Could not create player");
+        iPlayerListenerImpl= new PlayerListenerImpl(this);
         iSourceDimension= new Point(imageLoader.logicalScreenWidth, imageLoader.logicalScreenHeight);
+        iCurrentVideoDimension= new Point(imageLoader.logicalScreenWidth, imageLoader.logicalScreenHeight);
         iBackgroundPixel= imageLoader.backgroundPixel;
         populateControl();
     }
@@ -206,7 +214,8 @@
     {
         // since after stopping the player the player state will move to pre-fetched state
         changePlayerState(PREFETCHED);
-        iPlayerListenerImpl.postEvent(PlayerListener.STOPPED, new Long(iMediaTime * 10000));
+        //iPlayerListenerImpl.postEvent(PlayerListener.STOPPED, new Long(iMediaTime * 10000));
+        iPlayerListenerImpl.postEvent(PlayerListener.STOPPED, new Long(iMediaTime));
     }
 
     /**
@@ -251,8 +260,7 @@
     public long getMediaTime()
     {
         closeCheck();
-        // Since we have to return it in microsecond multiply it with 10000;
-        return iMediaTime*10000;
+        return iMediaTime;
     }
 
     public int getState()
@@ -272,12 +280,11 @@
     /**
      *
      */
-
+    GC gc = null;
     public void start() throws MediaException
     {
         final String DEBUG_STR = "AnimationPlayer::start()";
-        final long inTime = System.currentTimeMillis();
-
+//        final long inTime = System.currentTimeMillis();
         prefetch();
         // Only prefetched player may be started. If player is already started
         // this method returns silently.
@@ -288,21 +295,21 @@
             Thread thread = new Thread("Animation")
             {
                 int loopCount = iCurrentLoopCount;
-                GC gc = null;
                 public void run()
                 {
                     //changePlayerState(STARTED);
                     final int noOfFrames = iImageData.length;
                     while (iState == STARTED)
                     {
-                        final int delayTimeForNextFrame = iImageData[iFrameIndex].delayTime;
+                        final int delayTimeForNextFrame = iImageData[iFrameIndex].delayTime*10000 ;
                         // Since we are going to display first frame, notify all
                         // PlayerListener that Player has started
                         if (iFrameIndex == 0)
                         {
+                            iMediaTime=0;
                             iPlayerListenerImpl.postEvent(
-                                PlayerListener.STARTED, new Long(
-                                    iMediaTime * 10000));
+                                PlayerListener.STARTED, new Long(0));
+
                         }
                         if (iDisplay != null)
                         {
@@ -310,9 +317,15 @@
                             {
                                 public void run()
                                 {
-                                    if (gc == null)
-                                        gc = new GC(iImage);
-                                    Image tempImage = new Image(iDisplay,iImageData[iFrameIndex]);
+                                    // For out of memory issue in case of full screen, we are scaling the image
+                                    // while displaying it.
+                                    ImageData tempImageData =iImageData[iFrameIndex] ;
+                                    if (iSourceDimension.x!=iCurrentVideoDimension.x || iSourceDimension.x!=iCurrentVideoDimension.x)
+                                    {
+                                        tempImageData = iImageData[iFrameIndex].scaledTo(iCurrentVideoDimension.x , iCurrentVideoDimension.y);
+                                    }
+                                    Image tempImage = new Image(iDisplay,tempImageData);
+                                    //Image tempImage = new Image(iDisplay,iImageData[iFrameIndex]);
                                     gc.drawImage(tempImage, 0, 0);
                                     tempImage.dispose();
                                     iFrameIndex = (iFrameIndex + 1) % noOfFrames;
@@ -324,18 +337,17 @@
                                 }
                             });
                         }
-                        else// if the initDisplayMode is not called yer
+                        else// if the initDisplayMode is not called yet
                         {
                             iFrameIndex = (iFrameIndex + 1) % noOfFrames;
                             iMediaTime += delayTimeForNextFrame;
                         }
                         try
                         {
-                            Thread.sleep(delayTimeForNextFrame * 10);
+                            Thread.sleep(delayTimeForNextFrame / 1000);
                         }
                         catch (InterruptedException e)
                         {
-                            // TODO Auto-generated catch block
                             e.printStackTrace();
                         }
                         // post EOM event
@@ -352,22 +364,18 @@
                             // listener
                             iPlayerListenerImpl.postEvent(
                                 PlayerListener.END_OF_MEDIA,
-                                new Long(iMediaTime * 10000));
-                            iMediaTime = 0;
+                                new Long(iMediaTime));
                         }
                         if (iAnimationObserver!=null)
                         {
-                            iAnimationObserver.animationAdvanced(iMediaTime*10000);
+                            iAnimationObserver.animationAdvanced(iMediaTime);
                         }
                     }// end of while loop
                     iCurrentLoopCount = loopCount;
-                    // Logger.LOG(Logger.EJavaMMAPI, Logger.EInfo, DEBUG_STR
-
                 }
             };
             thread.start();
         }
-        // Logger.LOG(Logger.EJavaMMAPI, Logger.EInfo,DEBUG_STR + "-");
     }
 
     /**
@@ -573,7 +581,15 @@
     public void notifyDisplayAvailable(Display aDisplay)
     {
         iDisplay= aDisplay;
-        iImage=new Image(iDisplay, iImageData[0]);
+        //iImage=new Image(iDisplay, iImageData[0]);
+        iImage=new Image(iDisplay, iImageData[iFrameIndex]);
+        iDisplay.syncExec(new Runnable()
+        {
+            public void run()
+            {
+                gc = new GC(iImage);
+            }
+        });
     }
     /**
      * Notified when the control is available
@@ -593,14 +609,17 @@
      * @param width : to be set of the video(Animated GIF)
      * @param height : height to be set of video(Animated GIF)
      */
-    void updateImageData(int width, int height)
+    void updateImageData(int aWidth, int aHeight)
     {
-        int noOfFrames= iImageData.length;
-        for (int i=0; i<noOfFrames; i++)
-        {
-            iImageData[i]=iImageData[i].scaledTo(width, height);
-        }
-        iImage=new Image(iDisplay, iImageData[iFrameIndex]);
+//        int noOfFrames= iImageData.length;
+//        for (int i=0; i<noOfFrames; i++)
+//        {
+//            iImageData[i]=iImageData[i].scaledTo(aWidth, aHeight);
+//        }
+//        iImage=new Image(iDisplay, iImageData[iFrameIndex]);
+        iCurrentVideoDimension.x=aWidth;
+        iCurrentVideoDimension.y= aHeight;
+        iImage=new Image(iDisplay, iImageData[iFrameIndex].scaledTo(aWidth, aHeight));
     }
 
     /**
@@ -641,10 +660,10 @@
      * Called from VideoControl to get the image width and height,
      * so that Item will be created exactly of same dimension
      */
-    Point getImageDimension()
+    Point getCurrentVideoDimension()
     {
-//      return iCurrentVideoDimension;
-        return new org.eclipse.swt.graphics.Point(iImageData[0].width, iImageData[0].height);
+        return iCurrentVideoDimension;
+        // return new org.eclipse.swt.graphics.Point(iImageData[0].width, iImageData[0].height);
     }
 
 
@@ -661,7 +680,6 @@
         iDisplayLocation.x=aX;
         iDisplayLocation.y=aY;
     }
-
     /**
      * @return the position of the image to be displayed
      */
@@ -749,7 +767,7 @@
         this.iIsControlVisible = iIsControlVisible;
     }
     /**
-     * Called from
+     * Called from StopTimeControl.animationAdvanced(long), once the stopped time is greater than or equal media time.
      */
     void postEvent(long aMediaTime)
     {
--- a/javauis/mmapi_qt/baseline/javasrc/com/nokia/microedition/media/animation/AnimationPlayerFactory.java	Tue Jul 06 14:10:26 2010 +0300
+++ b/javauis/mmapi_qt/baseline/javasrc/com/nokia/microedition/media/animation/AnimationPlayerFactory.java	Wed Aug 18 09:43:15 2010 +0300
@@ -96,7 +96,7 @@
      * @return InternalPlayer object
      * @throws IOException if it is not possible to read the file from location specified
      */
-    public InternalPlayer createPlayer(String locator) throws IOException
+    public InternalPlayer createPlayer(String locator) throws IOException, MediaException
     {
         final String DEBUG_STR="AnimationPlayerFactory::createPlayer(String locator )";
         Logger.LOG(Logger.EJavaMMAPI, Logger.EInfo,DEBUG_STR+"+");
--- a/javauis/mmapi_qt/baseline/javasrc/com/nokia/microedition/media/animation/VideoControl.java	Tue Jul 06 14:10:26 2010 +0300
+++ b/javauis/mmapi_qt/baseline/javasrc/com/nokia/microedition/media/animation/VideoControl.java	Wed Aug 18 09:43:15 2010 +0300
@@ -17,38 +17,20 @@
 
 package com.nokia.microedition.media.animation;
 
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.DataOutputStream;
-import java.io.IOException;
-
-import javax.microedition.lcdui.Image;
 import javax.microedition.lcdui.Item;
 import javax.microedition.media.MediaException;
 import javax.microedition.media.Player;
 import javax.microedition.media.PlayerListener;
 
-import org.eclipse.ercp.swt.mobile.MobileShell;
-import org.eclipse.swt.events.PaintEvent;
-import org.eclipse.swt.events.PaintListener;
 import org.eclipse.swt.graphics.Point;
 import org.eclipse.swt.graphics.Rectangle;
-import org.eclipse.swt.widgets.Composite;
 import org.eclipse.swt.widgets.Control;
 import org.eclipse.swt.widgets.Display;
 import org.eclipse.swt.widgets.ProxyControl;
-import org.eclipse.swt.widgets.Shell;
 
-//import com.nokia.microedition.media.control.ApplicationUtils;
 import com.nokia.microedition.media.control.ControlImpl;
-import com.nokia.microedition.media.control.MMAGUIFactory;
+import com.nokia.mj.impl.nokialcdui.ItemControlStateChangeListener;
 import com.nokia.mj.impl.rt.support.Finalizer;
-import com.nokia.mj.impl.media.PlayerPermission;
-import com.nokia.mj.impl.nokialcdui.ItemControlStateChangeListener;
-import com.nokia.mj.impl.nokialcdui.LCDUIInvoker;
-
-//import com.nokia.mj.impl.media.PlayerPermission;
-import com.nokia.mj.impl.rt.support.ApplicationUtils;
 import com.nokia.mj.impl.utils.Logger;
 
 
@@ -74,29 +56,46 @@
     private static String ESWT_CONTROL = ".control";
 
     private static final int NOT_INITIALIZED = -1;
-    protected int iStatus = NOT_INITIALIZED;
+    private int iStatus = NOT_INITIALIZED;
     private static final int UNDEFINED_RETURN_VALUE=0;
     // For integrating with eSWT API
     private Display iDisplay;
     // This is reference of eSWT Control, don't get confused with the Player Control
     private Control iControl;
+
+    /**
+     * This variable stores the information whether the VideoControl is in full screen mode or not.
+     * by default it's value is false
+     */
+    private boolean iFullScreenMode;
     /**
     * When video display is set to full screen mode, old
-    * video position & size is stored to this member. When
+    * video size is stored to this member. When
     * full screen mode is turned off, this member is used to
     * find out if display size has been changed during full
     * screen mode. This is needed to generate a SIZE_CHANGED
     * event.
     */
-    private Point iOldDisplaySize;
+    private Point iOldDisplaySize= new Point(0,0);
+    /**
+     * When video display is set to full screen mode, old
+    * video location is stored to this member. When
+    * full screen mode is turned off, this member is used to
+    * find out if display location has been changed during full
+    * screen mode.
+     */
+    private Point iOldDisplayLocation= new Point(0,0);
     /**
      * A CustomItem which needs to be returned in case USE_GUI_PRIMITIVE and null to MIDlet
      * from initDisplayMode function.
      */
     // Global??? yes because we need to remove it from player listener, while finalizer will be called
     private VideoItem iVideoItem;
-
-    ESWTinitializeListener iESWTinitializeListener;
+    /**
+     * An interface, which listen for eSWT Display and Control, here it is AnimationPlayer
+     * and is getting notified, as soon as the either of these is ready to use
+     */
+    private ESWTinitializeListener iESWTinitializeListener;
 
     /**
      * Constructor of VideoControl
@@ -156,7 +155,7 @@
                 "VideoControl.initDisplayMode() not called yet");
         }
         // Following function will always return Player's current height
-        return ((AnimationPlayer) iPlayer).getImageDimension().x;
+        return ((AnimationPlayer) iPlayer).getCurrentVideoDimension().y;
     }
 
     /**
@@ -172,7 +171,7 @@
             throw new IllegalStateException(
                 "VideoControl.initDisplayMode() not called yet");
         }
-        return ((AnimationPlayer) iPlayer).getImageDimension().x;
+        return ((AnimationPlayer) iPlayer).getCurrentVideoDimension().x;
     }
 
     /**
@@ -385,7 +384,7 @@
      */
     private Object initLCDUI()
     {
-        iVideoItem = new VideoItem(((AnimationPlayer)iPlayer).getImageDimension());
+        iVideoItem = new VideoItem(((AnimationPlayer)iPlayer).getCurrentVideoDimension());
         iPlayer.addPlayerListener(iVideoItem);
         iStatus = USE_GUI_PRIMITIVE;
         return iVideoItem;
@@ -480,7 +479,7 @@
             {
                 public void run()
                 {
-                    control=new ProxyControl(((AnimationPlayer)iPlayer).getImageDimension());
+                    control=new ProxyControl(((AnimationPlayer)iPlayer).getCurrentVideoDimension());
                 }
             });
         }
@@ -539,8 +538,12 @@
             // Before going to full screen mode, we need to store the current display size;
             // so that when user will exit from the full screen,
             // it will return to it's previous size
-            iOldDisplaySize = ((AnimationPlayer)iPlayer).getImageDimension();
-            Rectangle displayDimension=calculateFullScreenDimension();
+
+            iOldDisplaySize.x = ((AnimationPlayer)iPlayer).getCurrentVideoDimension().x;
+            iOldDisplaySize.y = ((AnimationPlayer)iPlayer).getCurrentVideoDimension().y;
+            iOldDisplayLocation.x= ((AnimationPlayer)iPlayer).getiDisplayLocation().x;
+            iOldDisplayLocation.y= ((AnimationPlayer)iPlayer).getiDisplayLocation().y;
+            Rectangle displayDimension = calculateFullScreenDimension();
             ((AnimationPlayer)iPlayer).updateImageData(displayDimension.width, displayDimension.height);
             setDisplayLocation(displayDimension.x, displayDimension.y);
             ((AnimationPlayer)iPlayer).getiPlayerListenerImpl().postEvent(PlayerListener.SIZE_CHANGED, this);
@@ -552,12 +555,14 @@
             if (iOldDisplaySize!=null)
             {
                 ((AnimationPlayer)iPlayer).updateImageData(iOldDisplaySize);
+                ((AnimationPlayer)iPlayer).setDisplayLocation(iOldDisplayLocation.x, iOldDisplayLocation.y);
                 // Do we need to make it null?
                 iOldDisplaySize=null;
                 // post event to player Listener
                 ((AnimationPlayer)iPlayer).getiPlayerListenerImpl().postEvent(PlayerListener.SIZE_CHANGED, this);
             }
         }
+        iFullScreenMode = aFullScreenMode;
     }
 
     /* (non-Javadoc)
@@ -582,6 +587,16 @@
         // notifyControlAvailable function is not get called)
         if (iControl==null)// || (iControl instanceof org.eclipse.swt.internal.extension.CanvasExtension))
             return ;
+        //if video control is in full screen mode
+        // this function should not take effect
+        // following block will store the location to be set
+        // so that when player will exit from full screen mode, this size will be effective
+        if (iFullScreenMode)
+        {
+            iOldDisplayLocation.x = aX;
+            iOldDisplayLocation.y = aY;
+            return;
+        }
         ((AnimationPlayer)iPlayer).setDisplayLocation(aX, aY);
     }
 
@@ -605,6 +620,16 @@
             throw new IllegalArgumentException(
                 "Width and height must be positive");
         }
+        //this function should not take effect, when the
+        if (iFullScreenMode)
+        {
+            // if video is playing in full screen mode, just store the size
+            // to changed in this variable, so that when full screen mode of videocontrol will exit
+            // we need to display the image size in this dimension
+            iOldDisplaySize.x = aWidth;
+            iOldDisplaySize.y = aHeight;
+            return;
+        }
         // resize the all frames
         ((AnimationPlayer) iPlayer).updateImageData(aWidth, aHeight);
         // Since the DisplaySize is being changed, we need to change the
@@ -650,23 +675,6 @@
     }
     /*******************************FOLLOWING FUNCTIONS ARE USED FOR INTERNAL PURPOSE***********************/
     /**
-     *
-     * @return Display object retrieved from ESWT
-    //     */
-//    Display getiDisplay()
-//    {
-//        return iDisplay;
-//    }
-
-    /**
-     *
-     * @return
-     */
-//    Control getControl()
-//    {
-//        return iControl;
-//    }
-    /**
      * Function of ItemStateChangeListener
      * Notified by LCDUI implementation
      * @param ctrl
@@ -704,7 +712,7 @@
     private Rectangle deviceDimension;
     private Rectangle calculateFullScreenDimension()
     {
-        Point actualImageSize = ((AnimationPlayer)iPlayer).getImageDimension();
+        Point actualImageSize = ((AnimationPlayer)iPlayer).getSourceDimension();
         // initialize the deviceDimension, in local variable
         iDisplay.syncExec(new Runnable()
         {
--- a/javauis/mmapi_qt/baseline/javasrc/com/nokia/microedition/media/control/BaseDisplay.java	Tue Jul 06 14:10:26 2010 +0300
+++ b/javauis/mmapi_qt/baseline/javasrc/com/nokia/microedition/media/control/BaseDisplay.java	Wed Aug 18 09:43:15 2010 +0300
@@ -219,6 +219,17 @@
         }
         return rect;
     }
+
+    public Rectangle getFullScreenBounds()
+    {
+        //return new Rectangle(0,0,0,0);
+        org.eclipse.swt.widgets.Display disp = com.nokia.mj.impl.nokialcdui.LCDUIInvoker.getEswtDisplay();
+        Rectangle temp = disp.getBounds();
+        Logger.LOG(Logger.EJavaMMAPI,Logger.EInfo,"  getBounds returns width = "+temp.width+"height= "+temp.height);
+        temp = disp.getClientArea();
+        Logger.LOG(Logger.EJavaMMAPI,Logger.EInfo,"  getBounds returns width = "+temp.width+"height= "+temp.height);
+        return temp;
+    }
     // abstract functions implemented by concrete class
     protected abstract void setDisplaySize(int aWidth, int aHeight);
     protected abstract void setDisplayFullScreen(final boolean aFullScreenMode);
--- a/javauis/mmapi_qt/baseline/javasrc/com/nokia/microedition/media/control/ItemDisplay.java	Tue Jul 06 14:10:26 2010 +0300
+++ b/javauis/mmapi_qt/baseline/javasrc/com/nokia/microedition/media/control/ItemDisplay.java	Wed Aug 18 09:43:15 2010 +0300
@@ -368,10 +368,18 @@
 
     }
 
-    public void setContainerVisibilityToNative(boolean active)
+    public void setContainerVisibilityToNative(final boolean active)
     {
         Logger.LOG(Logger.EJavaMMAPI,Logger.EInfo,"ItemDisplay.java : SetContainerVisibilityToNative + ");
-        _setContainerVisible(nativeDisplayHandle,active);
+        new Thread()
+        {
+            public void run()
+            {
+                Logger.LOG(Logger.EJavaMMAPI,Logger.EInfo,"ItemDisplay.java : SetContainerVisibilityToNative execute the native function in new thread ");
+                _setContainerVisible(iEventSourceHandle,nativeDisplayHandle,active);
+            }
+        } .start();
+        //_setContainerVisible(nativeDisplayHandle,active);
         Logger.LOG(Logger.EJavaMMAPI,Logger.EInfo,"ItemDisplay.java : SetContainerVisibilityToNative - ");
     }
 
@@ -504,7 +512,7 @@
     private native void _setVisible(int nativeDisplayHandle,
                                     boolean value);
 
-    private native void _setContainerVisible(int nativeDisplayHandle,
+    private native void _setContainerVisible(int iEventSourceHandle,int nativeDisplayHandle,
             boolean value);
     private native void _setFullScreenMode(int nativeDisplayHandle, boolean value);
     private native void _setWindowToNative(int nativeDisplayHandle,int qwidgetHandle);
--- a/javauis/mmapi_qt/baseline/javasrc/com/nokia/microedition/media/control/MMAeSWTDisplay.java	Tue Jul 06 14:10:26 2010 +0300
+++ b/javauis/mmapi_qt/baseline/javasrc/com/nokia/microedition/media/control/MMAeSWTDisplay.java	Wed Aug 18 09:43:15 2010 +0300
@@ -229,20 +229,16 @@
         {
 
             final org.eclipse.swt.widgets.Display display = org.eclipse.swt.widgets.Display.getDefault();
-
-            //display.syncExec(new Runnable() {
-            //public void run() {
-            iControl.setBounds(display.getClientArea());
-            System.out.println("enetr in to the full screen mode setDisplayFullScreen %d"+iControl.getBounds());
-//                  new MobileShell(display).setFullScreenMode(aFullScreenMode);
-            //((MobileShell)iControl.getShell()).setFullScreenMode(aFullScreenMode);
-            //  new Shell(display).setFullScreenMode(aFullScreenMode);
-            //((Shell)iControl.getShell()).setFullScreenMode(aFullScreenMode);
-            //TODO
-            // instruct native to switch to full screen mode
-            //_setFullScreenMode(nativeDisplayHandle, aFullScreenMode);
-            //}
-            //});
+            if (iControl.getParent() instanceof MobileShell)
+            {
+                System.out.println("is instance of MobileShell");
+                MobileShell mobileShell = (MobileShell) iControl.getParent();
+                mobileShell.setFullScreenMode(aFullScreenMode);
+            }
+            else
+            {
+                System.out.println("is not instance of MobileShell");
+            }
         }
         catch (Exception e)
         {
@@ -361,9 +357,9 @@
                 public void run()
                 {
                     Logger.LOG(Logger.EJavaMMAPI,Logger.EInfo,"MMAPI: MMAeSWTDisplay.java: setVisible() inside asyncExec run()");
-                    //eswtCanvasControl.setVisible(visible);
+                    iControl.setVisible(visible);
                     // call native side to set the visibiity
-                    _setVisible(nativeDisplayHandle, visible);
+                    //_setVisible(nativeDisplayHandle, visible);
                     Logger.LOG(Logger.EJavaMMAPI,Logger.EInfo,"MMAPI: MMAeSWTDisplay.java: _setVisible() native call completed");
                 }
             });
@@ -421,10 +417,27 @@
         Logger.LOG(Logger.EJavaMMAPI,Logger.EInfo,"MMAPI: MMAeSWTDisplay.java: getCallbackSourceSizeChanged() +");
     }
 
-    public void setContainerVisibilityToNative(boolean active)
+    public void setContainerVisibilityToNative(final boolean active)
     {
-        // TODO Auto-generated method stub
+        Logger.LOG(Logger.EJavaMMAPI,Logger.EInfo,"MMACanvasDisplay.java : SetContainerVisibilityToNative + ");
+        new Thread()
+        {
+            public void run()
+            {
+                Logger.LOG(Logger.EJavaMMAPI,Logger.EInfo,"MMACanvasDisplay.java : SetContainerVisibilityToNative execute the native function in new thread ");
+                _setContainerVisible(nativeDisplayHandle,active);
+            }
+        } .start();
 
+        Logger.LOG(Logger.EJavaMMAPI,Logger.EInfo,"MMACanvasDisplay.java : SetContainerVisibilityToNative - ");
+
+    }
+
+    public Rectangle getFullScreenBounds()
+    {
+
+        final org.eclipse.swt.widgets.Display display = org.eclipse.swt.widgets.Display.getDefault();
+        return display.getClientArea();
     }
 
     private native void _setVisible(int nativeDisplayHandle, boolean value);
--- a/javauis/mmapi_qt/baseline/javasrc/com/nokia/microedition/media/control/VideoControl.java	Tue Jul 06 14:10:26 2010 +0300
+++ b/javauis/mmapi_qt/baseline/javasrc/com/nokia/microedition/media/control/VideoControl.java	Wed Aug 18 09:43:15 2010 +0300
@@ -45,6 +45,7 @@
 import com.nokia.microedition.media.control.ItemDisplay;
 
 import org.eclipse.swt.*;
+import org.eclipse.swt.graphics.Rectangle;
 import org.eclipse.swt.widgets.*;
 import javax.microedition.lcdui.*;
 import org.eclipse.ercp.swt.mobile.MobileShell;
@@ -208,7 +209,7 @@
 
         if (iGuiType == DISPLAY_ESWT)
         {
-            iDisplay.setDisplaySize(aWidth, aHeight);
+            //iDisplay.setDisplaySize(aWidth, aHeight);
         }
         int ret = setDisplayProperty(aWidth, aHeight, SET_DISPLAY_SIZE);
         if (ret < 0)
@@ -242,8 +243,14 @@
         int ret;
         if (aFullScreenMode)
         {
-            iDisplay.setDisplayFullScreen(aFullScreenMode);
-            ret = setDisplayProperty(360,487,SET_DISPLAY_FULLSCREEN_TRUE);
+            if (iGuiType == DISPLAY_ESWT)
+            {
+                iDisplay.setDisplayFullScreen(aFullScreenMode);
+            }
+            //Rectangle fullscreenRect = iDisplay.getFullScreenBounds();
+            Rectangle fullscreenRect = iDisplay.getBounds();
+            System.out.println("MMAPI: setDisplayFullscreen size width = " + fullscreenRect.width + " height = " + fullscreenRect.height);
+            ret = setDisplayProperty(fullscreenRect.width, fullscreenRect.height, SET_DISPLAY_FULLSCREEN_TRUE);
         }
         else
         {
--- a/javauis/mmapi_qt/baseline/src.nga/cmmasurfacewindow.cpp	Tue Jul 06 14:10:26 2010 +0300
+++ b/javauis/mmapi_qt/baseline/src.nga/cmmasurfacewindow.cpp	Wed Aug 18 09:43:15 2010 +0300
@@ -70,9 +70,9 @@
 
 void CMMASurfaceWindow::SetDrawRectThread(const TRect& aRect)
 {
-    LOG2(EJavaMMAPI, EInfo,  "MID::CMMASurfaceWindow::SetDrawRectThread TL %d %d",
+    LOG2(EJavaMMAPI, EInfo,  "CMMASurfaceWindow::SetDrawRectThread TL %d %d",
          aRect.iTl.iX, aRect.iTl.iY);
-    LOG2(EJavaMMAPI, EInfo,  "MID::CMMASurfaceWindow::SetDrawRectThread BR %d %d",
+    LOG2(EJavaMMAPI, EInfo,  "CMMASurfaceWindow::SetDrawRectThread BR %d %d",
          aRect.iBr.iX, aRect.iBr.iY);
 
     iContentRect = aRect;
@@ -80,16 +80,16 @@
     TInt error = StaticRedrawVideo(*this);
     if (KErrNone != error)
     {
-        ELOG1(EJavaMMAPI, "MID::CMMASurfaceWindow::SetDrawRectThread, StaticRedrawVideo error = %d", error);
+        ELOG1(EJavaMMAPI, "CMMASurfaceWindow::SetDrawRectThread, StaticRedrawVideo error = %d", error);
     }
 }
 
 void CMMASurfaceWindow::SetRWindowRect(const TRect& aRect,
                                        MMMADisplay::TThreadType aThreadType)
 {
-    LOG2(EJavaMMAPI, EInfo,  "MID::CMMASurfaceWindow::SetRWindowRect TL %d %d",
+    LOG2(EJavaMMAPI, EInfo,  "CMMASurfaceWindow::SetRWindowRect TL %d %d",
          aRect.iTl.iX, aRect.iTl.iY);
-    LOG2(EJavaMMAPI, EInfo,  "MID::CMMASurfaceWindow::SetRWindowRect BR %d %d",
+    LOG2(EJavaMMAPI, EInfo,  "CMMASurfaceWindow::SetRWindowRect BR %d %d",
          aRect.iBr.iX, aRect.iBr.iY);
 
     if (iRWindowRect == aRect)
@@ -122,14 +122,14 @@
         TInt error = SetClipRect();
         if (KErrNone != error)
         {
-            LOG1(EJavaMMAPI,EInfo,"MID::CMMASurfaceWindow::SetRWindowRect, error = %d", error);
+            LOG1(EJavaMMAPI,EInfo,"CMMASurfaceWindow::SetRWindowRect, error = %d", error);
         }
     }
 }
 
 TInt CMMASurfaceWindow::SetClipRect()
 {
-    LOG(EJavaMMAPI,EInfo,"MID::CMMASurfaceWindow::SetClipRect");
+    LOG(EJavaMMAPI,EInfo,"CMMASurfaceWindow::SetClipRect");
 
     // CMediaClientVideoDisplay expects client to RemoveDisplayWindow
     // and AddDisplayWindow again everytime when RWindow rect changes
@@ -170,7 +170,7 @@
                 EVerticalAlignCenter,
                 (RWindow*)iWindow));
 
-        LOG(EJavaMMAPI,EInfo,"MID::CMMASurfaceWindow::SetClipRect -");
+        LOG(EJavaMMAPI,EInfo,"CMMASurfaceWindow::SetClipRect -");
         return error;
     }
     return KErrNone;
@@ -178,13 +178,13 @@
 
 void CMMASurfaceWindow::SetDrawRect(const TRect& aRect)
 {
-    LOG2(EJavaMMAPI,EInfo,"MID::CMMASurfaceWindow::SetDrawRect TL %d %d",
+    LOG2(EJavaMMAPI,EInfo,"CMMASurfaceWindow::SetDrawRect TL %d %d",
          aRect.iTl.iX, aRect.iTl.iY);
-    LOG2(EJavaMMAPI,EInfo,"MID::CMMASurfaceWindow::SetDrawRect BR %d %d",
+    LOG2(EJavaMMAPI,EInfo,"CMMASurfaceWindow::SetDrawRect BR %d %d",
          aRect.iBr.iX, aRect.iBr.iY);
 
     iContentRect = aRect;
-    LOG2(EJavaMMAPI,EInfo,"MID::CMMASurfaceWindow::SetDrawRect aRect size = (%d,%d) ",iContentRect.Height(),iContentRect.Width());
+    LOG1(EJavaMMAPI,EInfo,"CMMASurfaceWindow::SetDrawRect aRect %d",iContentRect);
     if (iDisplay)
     {
         // iDisplay->UIGetCallback( *this,
@@ -199,13 +199,13 @@
         {
             iDisplay->GetCallbackInUiThread((TInt)CMMASurfaceWindow::ESetDrawRect);
         }
-        LOG(EJavaMMAPI,EInfo,"MID::CMMASurfaceWindow::SetDrawRect, after GetCallbackInUiThread");
+        LOG(EJavaMMAPI,EInfo,"CMMASurfaceWindow::SetDrawRect, after GetCallbackInUiThread");
     }
 }
 
 TInt CMMASurfaceWindow::StaticRedrawVideo(CMMASurfaceWindow& aSurfaceWindow)
 {
-    LOG(EJavaMMAPI,EInfo,"CMMASurfaceWindow::RedrawVideoL +");
+    LOG(EJavaMMAPI,EInfo,"CMMASurfaceWindow::StaticRedrawVideo +");
     TRAPD(error, aSurfaceWindow.RedrawVideoL());
     LOG1(EJavaMMAPI,EInfo,"CMMASurfaceWindow::RedrawVideoL - error = %d",error);
     return error;
@@ -216,7 +216,7 @@
     LOG(EJavaMMAPI, EInfo,  "CMMASurfaceWindow::RedrawVideoL +");
     if (!iMediaClientVideoDisplay)
     {
-        LOG(EJavaMMAPI, EInfo,  "MID::CMMASurfaceWindow::RedrawVideoL: no MediaClientVideoDisplay set, aborting -");
+        LOG(EJavaMMAPI, EInfo,  "CMMASurfaceWindow::RedrawVideoL: no MediaClientVideoDisplay set, aborting -");
         return;
     }
     //iVisible = true;
@@ -225,49 +225,49 @@
         TRect contentRect;
         if (iVisible)
         {
-            LOG2(EJavaMMAPI, EInfo,  "MID::CMMASurfaceWindow::RedrawVideoL: if visible true iContentRect = %d X %d",iContentRect.Width(),iContentRect.Height());
+            LOG2(EJavaMMAPI, EInfo,  "CMMASurfaceWindow::RedrawVideoL: if visible true iContentRect = %d X %d",iContentRect.Width(),iContentRect.Height());
             contentRect = iContentRect;
             // ScaleVideoL(contentRect);
         }
         else
         {
-            LOG(EJavaMMAPI, EInfo,  "MID::CMMASurfaceWindow::RedrawVideoL - if visible false");
+            LOG(EJavaMMAPI, EInfo,  "CMMASurfaceWindow::RedrawVideoL - if visible false");
             TRect emptyRect(0,0,0,0);
             contentRect = emptyRect;
         }
-        LOG2(EJavaMMAPI, EInfo,  "MID::CMMASurfaceWindow::RedrawVideoL: RedrawWindows() - before intersection contentRect = %d X %d",contentRect.Width(),contentRect.Height());
+        LOG2(EJavaMMAPI, EInfo,  "CMMASurfaceWindow::RedrawVideoL: RedrawWindows() - before intersection contentRect = %d X %d",contentRect.Width(),contentRect.Height());
 
         // align parent rect with respect to RWindow
         TRect relativeParentRect;
         relativeParentRect = iParentRect;
-        LOG2(EJavaMMAPI, EInfo,  "MID::CMMASurfaceWindow::RedrawVideoL: RedrawWindows() - before moving parentRect = %d X %d",relativeParentRect.Width(),relativeParentRect.Height());
+        LOG2(EJavaMMAPI, EInfo,  "CMMASurfaceWindow::RedrawVideoL: RedrawWindows() - before moving parentRect = %d X %d",relativeParentRect.Width(),relativeParentRect.Height());
 
-        LOG2(EJavaMMAPI, EInfo,  "MID::CMMASurfaceWindow::RedrawVideoL: RedrawWindows() - before moving parentRect.iTL = %d X %d",relativeParentRect.iTl.iX,relativeParentRect.iTl.iY);
-        LOG2(EJavaMMAPI, EInfo,  "MID::CMMASurfaceWindow::RedrawVideoL: RedrawWindows() - before moving parentRect.iBr = %d X %d\n\n",relativeParentRect.iBr.iX,relativeParentRect.iBr.iY);
-        LOG2(EJavaMMAPI, EInfo,  "MID::CMMASurfaceWindow::RedrawVideoL: RedrawWindows() - iRWindowRect.iTL = %d X %d",iRWindowRect.iTl.iX,iRWindowRect.iTl.iY);
-        LOG2(EJavaMMAPI, EInfo,  "MID::CMMASurfaceWindow::RedrawVideoL: RedrawWindows() - iRWindowRect.iBr = %d X %d\n\n",iRWindowRect.iBr.iX,iRWindowRect.iBr.iY);
+        LOG2(EJavaMMAPI, EInfo,  "CMMASurfaceWindow::RedrawVideoL: RedrawWindows() - before moving parentRect.iTL = %d X %d",relativeParentRect.iTl.iX,relativeParentRect.iTl.iY);
+        LOG2(EJavaMMAPI, EInfo,  "CMMASurfaceWindow::RedrawVideoL: RedrawWindows() - before moving parentRect.iBr = %d X %d\n\n",relativeParentRect.iBr.iX,relativeParentRect.iBr.iY);
+        LOG2(EJavaMMAPI, EInfo,  "CMMASurfaceWindow::RedrawVideoL: RedrawWindows() - iRWindowRect.iTL = %d X %d",iRWindowRect.iTl.iX,iRWindowRect.iTl.iY);
+        LOG2(EJavaMMAPI, EInfo,  "CMMASurfaceWindow::RedrawVideoL: RedrawWindows() - iRWindowRect.iBr = %d X %d\n\n",iRWindowRect.iBr.iX,iRWindowRect.iBr.iY);
 
 
 
         relativeParentRect.Move(-iRWindowRect.iTl);
-        LOG2(EJavaMMAPI, EInfo,  "MID::CMMASurfaceWindow::RedrawVideoL: RedrawWindows() -after moving parentRect = %d X %d",relativeParentRect.Width(),relativeParentRect.Height());
-        LOG2(EJavaMMAPI, EInfo,  "MID::CMMASurfaceWindow::RedrawVideoL: RedrawWindows() - after moving parentRect.iTL = %d X %d",relativeParentRect.iTl.iX,relativeParentRect.iTl.iY);
-        LOG2(EJavaMMAPI, EInfo,  "MID::CMMASurfaceWindow::RedrawVideoL: RedrawWindows() - after moving parentRect.iBr = %d X %d\n\n",relativeParentRect.iBr.iX,relativeParentRect.iBr.iY);
-        LOG2(EJavaMMAPI, EInfo,  "MID::CMMASurfaceWindow::RedrawVideoL: RedrawWindows() - before moving draw rect.iTL = %d X %d",contentRect.iTl.iX,contentRect.iTl.iY);
-        LOG2(EJavaMMAPI, EInfo,  "MID::CMMASurfaceWindow::RedrawVideoL: RedrawWindows() - before moving draw rect.iBr = %d X %d",contentRect.iBr.iX,contentRect.iBr.iY);
+        LOG2(EJavaMMAPI, EInfo,  "CMMASurfaceWindow::RedrawVideoL: RedrawWindows() -after moving parentRect = %d X %d",relativeParentRect.Width(),relativeParentRect.Height());
+        LOG2(EJavaMMAPI, EInfo,  "CMMASurfaceWindow::RedrawVideoL: RedrawWindows() - after moving parentRect.iTL = %d X %d",relativeParentRect.iTl.iX,relativeParentRect.iTl.iY);
+        LOG2(EJavaMMAPI, EInfo,  "CMMASurfaceWindow::RedrawVideoL: RedrawWindows() - after moving parentRect.iBr = %d X %d\n\n",relativeParentRect.iBr.iX,relativeParentRect.iBr.iY);
+        LOG2(EJavaMMAPI, EInfo,  "CMMASurfaceWindow::RedrawVideoL: RedrawWindows() - before moving draw rect.iTL = %d X %d",contentRect.iTl.iX,contentRect.iTl.iY);
+        LOG2(EJavaMMAPI, EInfo,  "CMMASurfaceWindow::RedrawVideoL: RedrawWindows() - before moving draw rect.iBr = %d X %d",contentRect.iBr.iX,contentRect.iBr.iY);
 
         // setting video draw rect and adjusting it to window
         TRect drawRect = contentRect;
         drawRect.Move(relativeParentRect.iTl);
 
-        LOG2(EJavaMMAPI, EInfo,  "MID::CMMASurfaceWindow::RedrawVideoL: RedrawWindows() - after moving draw rect = %d X %d",drawRect.Width(),drawRect.Height());
-        LOG2(EJavaMMAPI, EInfo,  "MID::CMMASurfaceWindow::RedrawVideoL: RedrawWindows() - after moving draw rect.iTL = %d X %d",drawRect.iTl.iX,drawRect.iTl.iY);
-        LOG2(EJavaMMAPI, EInfo,  "MID::CMMASurfaceWindow::RedrawVideoL: RedrawWindows() - after moving draw rect.iBr = %d X %d",drawRect.iBr.iX,drawRect.iBr.iY);
+        LOG2(EJavaMMAPI, EInfo,  "CMMASurfaceWindow::RedrawVideoL: RedrawWindows() - after moving draw rect = %d X %d",drawRect.Width(),drawRect.Height());
+        LOG2(EJavaMMAPI, EInfo,  "CMMASurfaceWindow::RedrawVideoL: RedrawWindows() - after moving draw rect.iTL = %d X %d",drawRect.iTl.iX,drawRect.iTl.iY);
+        LOG2(EJavaMMAPI, EInfo,  "CMMASurfaceWindow::RedrawVideoL: RedrawWindows() - after moving draw rect.iBr = %d X %d",drawRect.iBr.iX,drawRect.iBr.iY);
 
 
 
-        LOG2(EJavaMMAPI, EInfo,  "MID::CMMASurfaceWindow::RedrawVideoL: RedrawWindows() - iVideoCropRegion.iTL = %d X %d",iVideoCropRegion.iTl.iX,iVideoCropRegion.iTl.iY);
-        LOG2(EJavaMMAPI, EInfo,  "MID::CMMASurfaceWindow::RedrawVideoL: RedrawWindows() - iVideoCropRegion.iBr = %d X %d\n\n",iVideoCropRegion.iBr.iX,iVideoCropRegion.iBr.iY);
+        LOG2(EJavaMMAPI, EInfo,  "CMMASurfaceWindow::RedrawVideoL: RedrawWindows() - iVideoCropRegion.iTL = %d X %d",iVideoCropRegion.iTl.iX,iVideoCropRegion.iTl.iY);
+        LOG2(EJavaMMAPI, EInfo,  "CMMASurfaceWindow::RedrawVideoL: RedrawWindows() - iVideoCropRegion.iBr = %d X %d\n\n",iVideoCropRegion.iBr.iX,iVideoCropRegion.iBr.iY);
 
         /*TRect temp1(TPoint(127,8),TPoint(255,104));
         TRect temp2(TPoint(0,0),TPoint(128,96));
@@ -281,7 +281,7 @@
 
         LOG(EJavaMMAPI, EInfo,  "CMMASurfaceWindow::RedrawvideoL() - after setVideoExtentL");
 
-        //LOG2( EJavaMMAPI, EInfo,  "MID::CMMASurfaceWindow::RedrawVideoL: RedrawWindows() -  areaRect = %d X %d",areaRect.Width(),areaRect.Height() );
+        //LOG2( EJavaMMAPI, EInfo,  "CMMASurfaceWindow::RedrawVideoL: RedrawWindows() -  areaRect = %d X %d",areaRect.Width(),areaRect.Height() );
 
         iMediaClientVideoDisplay->RedrawWindows(iVideoCropRegion);
         LOG(EJavaMMAPI, EInfo,  "CMMASurfaceWindow::RedrawvideoL() - after redrawWindows");
@@ -310,35 +310,40 @@
     TInt error = StaticRedrawVideo(*this);
     if (KErrNone != error)
     {
-        ELOG1(EJavaMMAPI, "MID::CMMASurfaceWindow::SetPosition, StaticRedrawVideo error = %d", error);
+        ELOG1(EJavaMMAPI, "CMMASurfaceWindow::SetPosition, StaticRedrawVideo error = %d", error);
     }
 }
 
 TBool CMMASurfaceWindow::IsVisible() const
 {
-    LOG1(EJavaMMAPI, EInfo,  "MID::CMMASurfaceWindow::IsVisible %d ", iVisible);
+    LOG1(EJavaMMAPI, EInfo,  "CMMASurfaceWindow::IsVisible %d ", iVisible);
     return iVisible;
 }
 
 void CMMASurfaceWindow::SetVisible(TBool aVisible, TBool aUseEventServer)
 {
-    LOG1(EJavaMMAPI, EInfo,  "MID::CMMASurfaceWindow::SetVisible aVisible %d", aVisible);
+    LOG1(EJavaMMAPI, EInfo,  "CMMASurfaceWindow::SetVisible aVisible %d", aVisible);
     RPointerArray< CMMAPlayer > players = iEventSource->Players();
 
     if (players.Find(iPlayer) != KErrNotFound)
     {
-        LOG(EJavaMMAPI, EInfo,  "MID::CMMASurfaceWindow::SetVisible : Player found");
+        LOG(EJavaMMAPI, EInfo,  "CMMASurfaceWindow::SetVisible : Player found");
         if (aVisible != iVisible)
         {
-            LOG(EJavaMMAPI, EInfo,  "MID::CMMASurfaceWindow::SetVisible: Changed visibility");
+            LOG(EJavaMMAPI, EInfo,  "CMMASurfaceWindow::SetVisible: Changed visibility");
             iVisible = aVisible;
 
             if (aUseEventServer)
             {
-                TInt error = StaticRedrawVideo(*this);
+                /*TInt error = StaticRedrawVideo(*this);
                 if (KErrNone != error)
                 {
-                    LOG1(EJavaMMAPI,EInfo,"MID::CMMASurfaceWindow::SetVisible, StaticRedrawVideo error = %d", error);
+                    LOG1(EJavaMMAPI,EInfo,"CMMASurfaceWindow::SetVisible, StaticRedrawVideo error = %d", error);
+                }*/
+                TRAPD(error,DoSetVisibleL());
+                if (error != KErrNone)
+                {
+                    LOG1(EJavaMMAPI, EInfo,"CMMASurfaceWindow::SetVisible,DoSetVisibleL error = %d", error);
                 }
             }
             else
@@ -346,9 +351,10 @@
                 if (iDisplay)
                 {
 
-                    LOG(EJavaMMAPI,EInfo,"MID::CMMASurfaceWindow::SetVisible,calling GetCallbackInUiThread");
-                    iDisplay->GetCallbackInUiThread((TInt)CMMASurfaceWindow::ESetDrawRect);
-                    LOG(EJavaMMAPI,EInfo,"MID::CMMASurfaceWindow::SetVisible,after GetCallbackInUiThread");
+                    LOG(EJavaMMAPI,EInfo,"CMMASurfaceWindow::SetVisible,calling GetCallbackInUiThread");
+                    //iDisplay->GetCallbackInUiThread((TInt)CMMASurfaceWindow::ESetDrawRect);
+                    iDisplay->GetCallbackInUiThread((TInt)CMMASurfaceWindow::EChangeVisibility);
+                    LOG(EJavaMMAPI,EInfo,"CMMASurfaceWindow::SetVisible,after GetCallbackInUiThread");
 
                 }
 
@@ -357,11 +363,65 @@
     }
 }
 
+void CMMASurfaceWindow::DoSetVisibleL()
+{
+    LOG(EJavaMMAPI,EInfo,"CMMASurfaceWindow::DoSetVisible +");
+    if (iVisible)
+    {
+        TRect contentRect;
+        if (iVisible)
+        {
+            contentRect = iContentRect;
+        }
+        else
+        {
+            TRect emptyRect(0,0,0,0);
+            contentRect = emptyRect;
+        }
+
+        // align parent rect with respect to RWindow
+        TRect relativeParentRect;
+        relativeParentRect = iParentRect;
+        relativeParentRect.Move(-iRWindowRect.iTl);
+
+        // setting video draw rect and adjusting it to window
+        TRect drawRect = contentRect;
+        drawRect.Move(relativeParentRect.iTl);
+
+        TRect clipRect(0,0,iRWindowRect.Width(),iRWindowRect.Height());
+        //iWindow->SetExtentErr(TPoint(127,8),TSize(128,96));
+        LOG(EJavaMMAPI,EInfo,"CMMASurfaceWindow::DoSetVisible:: AddDisplayWindowL");
+        if (iMediaClientVideoDisplay)
+        {
+            iMediaClientVideoDisplay->AddDisplayWindowL(iWindow,
+                    clipRect,
+                    iVideoCropRegion,
+                    drawRect,  // video extent
+                    0.0f, // ignore
+                    0.0f, // ignore
+                    EVideoRotationNone,
+                    EAutoScaleBestFit,
+                    EHorizontalAlignCenter,
+                    EVerticalAlignCenter,
+                    (RWindow*)iWindow);
+        }
+        RedrawVideoL();
+    }
+    else
+    {
+        if (iWindow && iMediaClientVideoDisplay)
+        {
+            iMediaClientVideoDisplay->RemoveDisplayWindow(*iWindow);
+        }
+    }
+    LOG(EJavaMMAPI,EInfo,"CMMASurfaceWindow::DoSetVisible -");
+}
+
 void CMMASurfaceWindow::SetWindowRect(const TRect& aRect,MMMADisplay::TThreadType /*aThreadType*/)
 {
-    LOG2(EJavaMMAPI, EInfo,  "MID::CMMASurfaceWindow::SetWindowRect aRect TL %d %d",
+    LOG2(EJavaMMAPI, EInfo,  "CMMASurfaceWindow::SetWindowRect aRect TL %d %d",
          aRect.iTl.iX, aRect.iTl.iY);
-    LOG2(EJavaMMAPI, EInfo,  "MID::CMMASurfaceWindow::SetWindowRect aRect BR %d %d",
+    LOG2(EJavaMMAPI, EInfo,  "CMMASurfaceWindow::SetWindowRect aRect BR %d %d",
          aRect.iBr.iX, aRect.iBr.iY);
 
     iParentRect = aRect;
@@ -386,7 +446,7 @@
 
 void CMMASurfaceWindow::SetDisplay(MMMADisplay *aDisplay)
 {
-    LOG(EJavaMMAPI, EInfo,  "MID::CMMASurfaceWindow::SetDisplay +");
+    LOG(EJavaMMAPI, EInfo,  "CMMASurfaceWindow::SetDisplay +");
 
     if (iDisplay != aDisplay)
     {
@@ -419,12 +479,12 @@
             */
     }
 
-    LOG(EJavaMMAPI, EInfo,  "MID::CMMASurfaceWindow::SetDisplay -");
+    LOG(EJavaMMAPI, EInfo,  "CMMASurfaceWindow::SetDisplay -");
 }
 
 void CMMASurfaceWindow::ContainerSet()
 {
-    LOG(EJavaMMAPI,EInfo, "MID::CMMASurfaceWindow::ContainerSet");
+    LOG(EJavaMMAPI,EInfo, "CMMASurfaceWindow::ContainerSet");
     // We are in UI thread now
 
     // Container was probably not set when
@@ -439,7 +499,7 @@
 
 void CMMASurfaceWindow::Destroy()
 {
-    LOG(EJavaMMAPI, EInfo,  "MID::CMMASurfaceWindow::Destroy");
+    LOG(EJavaMMAPI, EInfo,  "CMMASurfaceWindow::Destroy");
     // Delete itself
     delete this;
 }
@@ -451,19 +511,19 @@
     iWs = aWs;
     iScreenDevice = aScreenDevice;
     iWindow = aWindow;
-    LOG(EJavaMMAPI,EInfo, "MID::CMMASurfaceWindow::ProcureWindowResourcesFromQWidget");
+    LOG(EJavaMMAPI,EInfo, "CMMASurfaceWindow::ProcureWindowResourcesFromQWidget");
     switch (iVideoDisplayInitState)
     {
     case EUIResourcesAndSurfaceParametersNotSet:
     {
-        LOG(EJavaMMAPI,EInfo, "MID::CMMASurfaceWindow::ProcureWindowResourcesFromQWidget  -8");
+        LOG(EJavaMMAPI,EInfo, "CMMASurfaceWindow::ProcureWindowResourcesFromQWidget  -8");
         iVideoDisplayInitState =
             EUIResourcesSetAndSurfaceParametersNotSet;
     }
     break;
     case ESurfaceParametersSetAndUIResourcesNotSet:
     {
-        LOG(EJavaMMAPI,EInfo, "MID::CMMASurfaceWindow::ProcureWindowResourcesFromQWidget  -9");
+        LOG(EJavaMMAPI,EInfo, "CMMASurfaceWindow::ProcureWindowResourcesFromQWidget  -9");
         iVideoDisplayInitState =
             EUIResourcesAndSurfaceParametersSet;
     }
@@ -473,7 +533,7 @@
     case EUIResourcesAndSurfaceParametersSet:
     default:
     {
-        LOG(EJavaMMAPI,EInfo, "MID::CMMASurfaceWindow::ProcureWindowResourcesFromQWidget  -10");
+        LOG(EJavaMMAPI,EInfo, "CMMASurfaceWindow::ProcureWindowResourcesFromQWidget  -10");
         __ASSERT_DEBUG(EFalse, User::Invariant());
     }
     break;
@@ -481,12 +541,12 @@
 
     if (iVideoDisplayInitState == EUIResourcesAndSurfaceParametersSet)
     {
-        LOG(EJavaMMAPI,EInfo, "MID::CMMASurfaceWindow::ProcureWindowResourcesFromQWidget  -11");
+        LOG(EJavaMMAPI,EInfo, "CMMASurfaceWindow::ProcureWindowResourcesFromQWidget  -11");
         TRAPD(error, InitVideoDisplayL());
-        LOG(EJavaMMAPI,EInfo, "MID::CMMASurfaceWindow::ProcureWindowResourcesFromQWidget  -12");
+        LOG(EJavaMMAPI,EInfo, "CMMASurfaceWindow::ProcureWindowResourcesFromQWidget  -12");
         if (KErrNone != error)
         {
-            ELOG1(EJavaMMAPI, "MID::CMMASurfaceWindow::MdcDSAResourcesCallback, error = %d", error);
+            ELOG1(EJavaMMAPI, "CMMASurfaceWindow::MdcDSAResourcesCallback, error = %d", error);
         }
     }
 
@@ -497,7 +557,7 @@
     CWsScreenDevice &aScreenDevice,
     RWindowBase &aWindow )
     {
-    LOG(EJavaMMAPI,EInfo, "MID::CMMASurfaceWindow::MdcDSAResourcesCallback" );
+    LOG(EJavaMMAPI,EInfo, "CMMASurfaceWindow::MdcDSAResourcesCallback" );
 
     // We are in UI thread context now.
     iWs = &aWs;
@@ -533,7 +593,7 @@
             TRAPD(error, InitVideoDisplayL());
             if ( KErrNone != error )
                 {
-                LOG1(EJavaMMAPI,EInfo,"MID::CMMASurfaceWindow::MdcDSAResourcesCallback, error = %d", error);
+                LOG1(EJavaMMAPI,EInfo,"CMMASurfaceWindow::MdcDSAResourcesCallback, error = %d", error);
                 }
             }
     }
@@ -541,7 +601,7 @@
 void CMMASurfaceWindow::UICallback(TInt aCallbackId)
 {
     // We are in UI thread context now.
-    LOG1(EJavaMMAPI, EInfo,  "MID::CMMASurfaceWindow::MdcUICallback CallbackId = %d", aCallbackId);
+    LOG1(EJavaMMAPI, EInfo,  "CMMASurfaceWindow::UICallback CallbackId = %d", aCallbackId);
 
     TInt error = KErrNone;
     switch (aCallbackId)
@@ -549,25 +609,25 @@
     case ESetClipRect:
     {
         error = SetClipRect();
-        LOG1(EJavaMMAPI,EInfo,"MID::CMMASurfaceWindow::MdcUICallback,SetClipRect error = %d", error);
+        LOG1(EJavaMMAPI,EInfo,"CMMASurfaceWindow::UICallback,SetClipRect error = %d", error);
     }
     break;
     case ERemoveSurface:
     {
-        LOG(EJavaMMAPI, EInfo, "MID::CMMASurfaceWindow::MdcUICallback, ERemoveSurface ");
+        LOG(EJavaMMAPI, EInfo, "CMMASurfaceWindow::UICallback, ERemoveSurface ");
         DoRemoveSurface();
     }
     break;
     case ESetDrawRect:
     {
         error = StaticRedrawVideo(*this);
-        ELOG1(EJavaMMAPI, "MID::CMMASurfaceWindow::MdcUICallback,StaticRedrawVideo error = %d", error);
+        ELOG1(EJavaMMAPI, "CMMASurfaceWindow::UICallback,StaticRedrawVideo error = %d", error);
     }
     break;
     case EInitVideoDisplay:
     {
         TRAP(error, InitVideoDisplayL());
-        ELOG1(EJavaMMAPI, "MID::CMMASurfaceWindow::MdcUICallback,InitVideoDisplayL error = %d", error);
+        ELOG1(EJavaMMAPI, "CMMASurfaceWindow::UICallback,InitVideoDisplayL error = %d", error);
     }
     break;
     case ESetChangedSurfaceParameters:
@@ -590,6 +650,15 @@
         Destroy();
     }
     break;
+    case EChangeVisibility:
+    {
+        TRAPD(error,DoSetVisibleL());
+        if (error != KErrNone)
+        {
+            LOG1(EJavaMMAPI, EInfo,"CMMASurfaceWindow::UICallback,DoSetVisibleL error = %d", error);
+        }
+    }
+    break;
     default:
     {
         __ASSERT_DEBUG(EFalse, User::Invariant());
@@ -711,9 +780,9 @@
     LOG(EJavaMMAPI, EInfo, "CMMASurfaceWindow::DoRemoveSurface() +");
     if (iMediaClientVideoDisplay)
     {
-        LOG(EJavaMMAPI,EInfo,"MID::CMMASurfaceWindow::DoRemoveSurface, Removing Surface");
+        LOG(EJavaMMAPI,EInfo,"CMMASurfaceWindow::DoRemoveSurface, Removing Surface");
         iMediaClientVideoDisplay->RemoveSurface();
-        LOG(EJavaMMAPI,EInfo,"MID::CMMASurfaceWindow::DoRemoveSurface, Surface Removed");
+        LOG(EJavaMMAPI,EInfo,"CMMASurfaceWindow::DoRemoveSurface, Surface Removed");
 
     }
     LOG(EJavaMMAPI, EInfo, "CMMASurfaceWindow::DoRemoveSurface() -");
@@ -731,7 +800,7 @@
                      iPixelAspectRatio,
                      iVideoCropRegion);
 
-        ELOG1(EJavaMMAPI, "MID::CMMASurfaceWindow::DoResetSurfaceParameters,SurfaceCreated error = %d", error);
+        ELOG1(EJavaMMAPI, "CMMASurfaceWindow::DoResetSurfaceParameters,SurfaceCreated error = %d", error);
 
         iMediaClientVideoDisplay->RedrawWindows(iVideoCropRegion);
     }
@@ -745,7 +814,7 @@
                      iCropRect,
                      iPixelAspectRatio);
 
-        ELOG1(EJavaMMAPI, "MID::CMMASurfaceWindow::DoSetChangedSurfaceParameters,SurfaceParametersChanged, error = %d", error);
+        ELOG1(EJavaMMAPI, "CMMASurfaceWindow::DoSetChangedSurfaceParameters,SurfaceParametersChanged, error = %d", error);
 
         iMediaClientVideoDisplay->RedrawWindows(iVideoCropRegion);
     }
@@ -789,7 +858,7 @@
                  iPixelAspectRatio,
                  iVideoCropRegion);
 
-    ELOG1(EJavaMMAPI,  "MID::CMMASurfaceWindow::InitVideoDisplayL error = %d", error);
+    ELOG1(EJavaMMAPI,  "CMMASurfaceWindow::InitVideoDisplayL error = %d", error);
     User::LeaveIfError(error);
 
     TRect contentRect;
@@ -833,7 +902,7 @@
 
 void CMMASurfaceWindow::CleanVideoDisplay()
 {
-    LOG(EJavaMMAPI, EInfo,  "MID::CMMASurfaceWindow::CleanVideoDisplay +");
+    LOG(EJavaMMAPI, EInfo,  "CMMASurfaceWindow::CleanVideoDisplay +");
 
     SetVisible(EFalse, ETrue);
     if (iMediaClientVideoDisplay)
@@ -851,7 +920,7 @@
         iWs = NULL;
     }
 
-    LOG(EJavaMMAPI, EInfo,  "MID::CMMASurfaceWindow::CleanVideoDisplay -");
+    LOG(EJavaMMAPI, EInfo,  "CMMASurfaceWindow::CleanVideoDisplay -");
 }
 
 
--- a/javauis/mmapi_qt/baseline/src/cmmacamerawindow.cpp	Tue Jul 06 14:10:26 2010 +0300
+++ b/javauis/mmapi_qt/baseline/src/cmmacamerawindow.cpp	Wed Aug 18 09:43:15 2010 +0300
@@ -103,7 +103,7 @@
             //      *this, CMMACameraWindow::EShowViewFinder);
             LOG(EJavaMMAPI,EInfo,"CMMACameraWindow::SetStarted : before GetCallbackInUiThread + EShowViewFinder");
             iDisplay->GetCallbackInUiThread((TInt)CMMACameraWindow::EShowViewFinder);
-            LOG(EJavaMMAPI,EInfo,"CMMACameraWindow::SetStarted : before GetCallbackInUiThread  - EShowViewFinder");
+            LOG(EJavaMMAPI,EInfo,"CMMACameraWindow::SetStarted : after GetCallbackInUiThread  - EShowViewFinder");
         }
         else
         {
@@ -111,7 +111,7 @@
             //       *this, CMMACameraWindow::EHideViewFinder);
             LOG(EJavaMMAPI,EInfo,"CMMACameraWindow::SetStarted : before GetCallbackInUiThread + EHideViewFinder");
             iDisplay->GetCallbackInUiThread((TInt)CMMACameraWindow::EHideViewFinder);
-            LOG(EJavaMMAPI,EInfo,"CMMACameraWindow::SetStarted : before GetCallbackInUiThread  - EHideViewFinder");
+            LOG(EJavaMMAPI,EInfo,"CMMACameraWindow::SetStarted : after GetCallbackInUiThread  - EHideViewFinder");
         }
     }
 }
@@ -150,7 +150,7 @@
             //MMAPI UI 3.x req.
             LOG(EJavaMMAPI,EInfo,"CMMACameraWindow::SetDisplay : before GetCallbackInUiThread +");
             iDisplay->GetCallbackInUiThread((TInt)CMMACameraWindow::EDeleteViewFinder);
-            LOG(EJavaMMAPI,EInfo,"CMMACameraWindow::SetDisplay : before GetCallbackInUiThread  -");
+            LOG(EJavaMMAPI,EInfo,"CMMACameraWindow::SetDisplay : after GetCallbackInUiThread  -");
         }
 
         // Set the new Display
@@ -212,7 +212,7 @@
         //iDisplay->UIGetCallback(*this, CMMACameraWindow::EResetViewFinder);
         LOG(EJavaMMAPI,EInfo,"CMMACameraWindow::SetDisplay : before GetCallbackInUiThread + EResetViewFinder");
         iDisplay->GetCallbackInUiThread((TInt)CMMACameraWindow::EResetViewFinder);
-        LOG(EJavaMMAPI,EInfo,"CMMACameraWindow::SetDisplay : before GetCallbackInUiThread  - EResetViewFinder");
+        LOG(EJavaMMAPI,EInfo,"CMMACameraWindow::SetDisplay : after GetCallbackInUiThread  - EResetViewFinder");
 
     }
 }
@@ -308,7 +308,7 @@
                 //    *this, CMMACameraWindow::EShowViewFinder);
                 LOG(EJavaMMAPI,EInfo,"CMMACameraWindow::SetVisible : before GetCallbackInUiThread - EShowViewFinder");
                 iDisplay->GetCallbackInUiThread((TInt)CMMACameraWindow::EShowViewFinder);
-                LOG(EJavaMMAPI,EInfo,"CMMACameraWindow::SetVisible : before GetCallbackInUiThread  - EShowViewFinder");
+                LOG(EJavaMMAPI,EInfo,"CMMACameraWindow::SetVisible : after GetCallbackInUiThread  - EShowViewFinder");
             }
             else
             {
@@ -316,7 +316,7 @@
                 //     *this, CMMACameraWindow::EHideViewFinder);
                 LOG(EJavaMMAPI,EInfo,"CMMACameraWindow::SetVisible : before GetCallbackInUiThread - EHideViewFinder");
                 iDisplay->GetCallbackInUiThread((TInt)CMMACameraWindow::EHideViewFinder);
-                LOG(EJavaMMAPI,EInfo,"CMMACameraWindow::SetVisible : before GetCallbackInUiThread  - EHideViewFinder");
+                LOG(EJavaMMAPI,EInfo,"CMMACameraWindow::SetVisible : after GetCallbackInUiThread  - EHideViewFinder");
             }
         }
     }
@@ -352,7 +352,7 @@
             //      *this, CMMACameraWindow::EResetViewFinder);
             LOG(EJavaMMAPI,EInfo,"CMMACameraWindow::SetWindowRect : before GetCallbackInUiThread + EResetViewFinder");
             iDisplay->GetCallbackInUiThread((TInt)CMMACameraWindow::EHideViewFinder);
-            LOG(EJavaMMAPI,EInfo,"CMMACameraWindow::SetWindowRect : before GetCallbackInUiThread  - EResetViewFinder");
+            LOG(EJavaMMAPI,EInfo,"CMMACameraWindow::SetWindowRect : after GetCallbackInUiThread  - EResetViewFinder");
         }
     }
 
--- a/javauis/mmapi_qt/baseline/src/cmmacanvasdisplay.cpp	Tue Jul 06 14:10:26 2010 +0300
+++ b/javauis/mmapi_qt/baseline/src/cmmacanvasdisplay.cpp	Wed Aug 18 09:43:15 2010 +0300
@@ -170,24 +170,31 @@
     iFullScreen = aFullScreen;
     if (iContainerVisible)
     {
+        LOG2(EJavaMMAPI,EInfo,"CMMACanvasDisplay::SetFullScreenL widht=%d height=%d", iFullScreenSize.iWidth,
+             iFullScreenSize.iHeight);
         RemoveClippingRegion();
-
+        LOG2(EJavaMMAPI,EInfo,"CMMACanvasDisplay::SetFullScreenL widht=%d height=%d", iFullScreenSize.iWidth,
+             iFullScreenSize.iHeight);
+        LOG2(EJavaMMAPI,EInfo,"CMMACanvasDisplay::SetFullScreenL::iSourceSize widht=%d height=%d", iSourceSize.iWidth,
+             iSourceSize.iHeight);
         if (aFullScreen)
         {
             // use new scaled rect
             // iWindow->SetDrawRect(ScaleToFullScreen(fullScreenSize, iSourceSize));
-            iWindow->SetDrawRectThread(ScaleToFullScreen(iFullScreenSize, iSourceSize));
+            LOG(EJavaMMAPI,EInfo,"CMMACanvasDisplay::SetFullScreenL -  true scale to fullscreen");
+            iWindow->SetDrawRect(ScaleToFullScreen(iFullScreenSize, iSourceSize));
         }
         else
         {
             // use size set from java
-            //iWindow->SetDrawRect(iUserRect);
-            iWindow->SetDrawRectThread(iUserRect);
+            LOG(EJavaMMAPI,EInfo,"CMMACanvasDisplay::SetFullScreenL -  false - draw the user rect set previously");
+            LOG2(EJavaMMAPI,EInfo,"CMMACanvasDisplay::SetFullScreenL iUserRect = (%d,%d) ",iUserRect.Width(),iUserRect.Height());
+            iWindow->SetDrawRect(iUserRect);
         }
 
         AddClippingRegion();
     }
-    LOG(EJavaMMAPI,EInfo,"CMMACanvasDisplay::SetFullScreenL +");
+    LOG(EJavaMMAPI,EInfo,"CMMACanvasDisplay::SetFullScreenL -");
 }
 
 void CMMACanvasDisplay::SetWindowL(MMMADisplayWindow* aWindow)
@@ -270,7 +277,7 @@
     TPoint topleft(xcoordinate,ycoordinate);
     TSize rectsize(width,height);
     TRect boundRect(topleft,rectsize);
-    iJni->ReleaseIntArrayElements(javaboundinfoarr, nativeboundinfoarr, JNI_COMMIT);
+    iJni->ReleaseIntArrayElements(javaboundinfoarr, nativeboundinfoarr,0);
     LOG(EJavaMMAPI,EInfo,"MMA::CMMACanvasDisplay::BoundRect -");
     return boundRect;
 }
--- a/javauis/mmapi_qt/baseline/src/cmmadisplay.cpp	Tue Jul 06 14:10:26 2010 +0300
+++ b/javauis/mmapi_qt/baseline/src/cmmadisplay.cpp	Wed Aug 18 09:43:15 2010 +0300
@@ -59,7 +59,7 @@
 {
     iEventSource = eventSource;
     iJavadisplayref = javadisplayref;
-    LOG1(EJavaMMAPI,EInfo,"MID::CMMADisplay::Construct=%d",iIseSWT);
+    LOG1(EJavaMMAPI,EInfo,"CMMADisplay::Construct=%d",iIseSWT);
     if (iIseSWT)
     {
         iJni = aJni;
@@ -112,8 +112,8 @@
      // Get component visibility. Later visibility changes will
      // be informed through MDirectContent observer.
      iContainerVisible = iDirectContainer->MdcContainerVisibility();
-     LOG1(EJavaMMAPI,EInfo,"MID::CMMADisplay::Construct iContainerVisible = %d", iContainerVisible);
-     LOG1(EJavaMMAPI,EInfo,"MID::CMMADisplay::Construct iVisible = %d", iVisible);
+     LOG1(EJavaMMAPI,EInfo,"CMMADisplay::Construct iContainerVisible = %d", iContainerVisible);
+     LOG1(EJavaMMAPI,EInfo,"CMMADisplay::Construct iVisible = %d", iVisible);
 
      // Add this MDirectContent to the MDirectContainer. Cannot fail.
      iDirectContainer->MdcAddContent(this);
@@ -202,6 +202,7 @@
     {
         LOG(EJavaMMAPI,EInfo,"CMMADisplay::SetClippingRegion: Removing old rect");
         //iDirectContainer->MdcRemoveContentBounds(iClipRect);
+        RemoveContentBoundFromJavaControl(iClipRect);
         iClipRect.SetRect(0, 0, 0, 0);
         refreshScreen = ETrue;
     }
@@ -287,15 +288,15 @@
 // from MMMADisplay
 TSize CMMADisplay::DisplaySize()
 {
-    LOG(EJavaMMAPI,EInfo,"MID::CMMADisplay::DisplaySize +");
+    LOG(EJavaMMAPI,EInfo,"CMMADisplay::DisplaySize +");
     if (iWindow && iFullScreen)
     {
-        LOG(EJavaMMAPI,EInfo,"MID::CMMADisplay::DisplaySize if loop ");
+        LOG(EJavaMMAPI,EInfo,"CMMADisplay::DisplaySize if loop ");
         return iWindow->DrawRect().Size();
     }
     else
     {
-        LOG1(EJavaMMAPI,EInfo,"MID::CMMADisplay::DisplaySize else loop %d",iUserRect.Size().iHeight);
+        LOG1(EJavaMMAPI,EInfo,"CMMADisplay::DisplaySize else loop %d",iUserRect.Size().iHeight);
         return iUserRect.Size();
     }
 }
@@ -305,21 +306,21 @@
 {
     // user rect contains size set from java.
     iUserRect.SetSize(aSize);
-    LOG2(EJavaMMAPI,EInfo,"MID::CMMADisplay::SetDisplaySizeL iUserRect = %d X %d", iUserRect.Width() ,iUserRect.Height());
+    LOG2(EJavaMMAPI,EInfo,"CMMADisplay::SetDisplaySizeL iUserRect = %d X %d", iUserRect.Width() ,iUserRect.Height());
     // Size change has no effect if fullscreen mode is on.
     // New size could be used when fullscreen is turned off.
     if (iContainerVisible && !iFullScreen && iWindow)
     {
-        LOG1(EJavaMMAPI,EInfo,"MID::CMMADisplay::SetVisible + iContainerVisible = %d", iContainerVisible);
+        LOG1(EJavaMMAPI,EInfo,"CMMADisplay::SetVisible + iContainerVisible = %d", iContainerVisible);
         RemoveClippingRegion();
-        LOG2(EJavaMMAPI,EInfo,"MID::CMMADisplay::SetDisplaySizeL iUserRect after removingClipRegion = %d X %d", iUserRect.Width() ,iUserRect.Height());
+        LOG2(EJavaMMAPI,EInfo,"CMMADisplay::SetDisplaySizeL iUserRect after removingClipRegion = %d X %d", iUserRect.Width() ,iUserRect.Height());
         iWindow->SetDrawRect(iUserRect);
         AddClippingRegion();
-        LOG2(EJavaMMAPI,EInfo,"MID::CMMADisplay::SetDisplaySizeL iUserRect after AddingClipRegion = %d X %d", iUserRect.Width() ,iUserRect.Height());
+        LOG2(EJavaMMAPI,EInfo,"CMMADisplay::SetDisplaySizeL iUserRect after AddingClipRegion = %d X %d", iUserRect.Width() ,iUserRect.Height());
     }
     else
     {
-        LOG1(EJavaMMAPI,EInfo,"MID::CMMADisplay::SetVisible + iContainerVisible = %d", iContainerVisible);
+        LOG1(EJavaMMAPI,EInfo,"CMMADisplay::SetVisible + iContainerVisible = %d", iContainerVisible);
         iResetDrawRect = ETrue;
     }
 }
@@ -330,11 +331,11 @@
     iVisible = aValue;
     // Window may be set visible only if container is on screen,
 
-    LOG1(EJavaMMAPI,EInfo,"MID::CMMADisplay::SetVisible + iContainerVisible = %d", iContainerVisible);
-    LOG1(EJavaMMAPI,EInfo,"MID::CMMADisplay::SetVisible iVisible = %d", iVisible);
+    LOG1(EJavaMMAPI,EInfo,"CMMADisplay::SetVisible + iContainerVisible = %d", iContainerVisible);
+    LOG1(EJavaMMAPI,EInfo,"CMMADisplay::SetVisible iVisible = %d", iVisible);
     if (!iIsForeground)
     {
-        LOG(EJavaMMAPI,EInfo,"MID::CMMADisplay::SetVisible - iIsForeground = 0");
+        LOG(EJavaMMAPI,EInfo,"CMMADisplay::SetVisible - iIsForeground = 0");
         return;
     }
     // if not it can not be set visible.
@@ -350,9 +351,9 @@
         {
             iWindow->SetVisible(aValue, EFalse);
         }
-        LOG(EJavaMMAPI,EInfo,"MID::CMMADisplay::SetVisible after iWindow->SetVisible()");
+        LOG(EJavaMMAPI,EInfo,"CMMADisplay::SetVisible after iWindow->SetVisible()");
         SetClippingRegion();
-        LOG(EJavaMMAPI,EInfo,"MID::CMMADisplay::SetVisible -");
+        LOG(EJavaMMAPI,EInfo,"CMMADisplay::SetVisible -");
     }
 }
 
@@ -383,8 +384,8 @@
 
 TBool CMMADisplay::IsVisible()
 {
-    LOG1(EJavaMMAPI,EInfo,"MID::CMMADisplay::IsVisible iContainerVisible = %d", iContainerVisible);
-    LOG1(EJavaMMAPI,EInfo,"MID::CMMADisplay::IsVisible iVisible = %d", iVisible);
+    LOG1(EJavaMMAPI,EInfo,"CMMADisplay::IsVisible iContainerVisible = %d", iContainerVisible);
+    LOG1(EJavaMMAPI,EInfo,"CMMADisplay::IsVisible iVisible = %d", iVisible);
     // display is visible if container is on screen and
     // java side has set it visible
     return iVisible && iContainerVisible;
@@ -421,33 +422,36 @@
         if (aVisible != iWindow->IsVisible())
         {
             // Allow
-            LOG(EJavaMMAPI,EInfo,"MID::CMMADisplay::MdcContainerVisibilityChanged Allow ");
+            LOG(EJavaMMAPI,EInfo,"CMMADisplay::MdcContainerVisibilityChanged Allow ");
         }
         else if (iContainerVisible == aVisible)
         {
-            LOG(EJavaMMAPI,EInfo,"MID::CMMADisplay::MdcContainerVisibilityChanged iContainerVisible == aVisible ");
+            LOG(EJavaMMAPI,EInfo,"CMMADisplay::MdcContainerVisibilityChanged iContainerVisible == aVisible ");
             // if state is not changed, we do not need to do it again
             return;
         }
     }
 
-    LOG(EJavaMMAPI,EInfo,"MID::CMMADisplay::MdcContainerVisibilityChanged After condition2");
+    LOG(EJavaMMAPI,EInfo,"CMMADisplay::MdcContainerVisibilityChanged After condition2");
 
     if (iWindow)
     {
-        LOG(EJavaMMAPI,EInfo,"MID::CMMADisplay::MdcContainerVisibilityChanged iWindow is valid ");
+        LOG(EJavaMMAPI,EInfo,"CMMADisplay::MdcContainerVisibilityChanged iWindow is valid ");
         // change is only needed if java side has set display visible or
         // if container loses focus
         if (!iContainerVisible || iVisible)
         {
+            LOG(EJavaMMAPI,EInfo,"CMMADisplay::MdcContainerVisibilityChanged container is invisible and window is visible");
             if (iResetDrawRect && aVisible && !iFullScreen)
             {
+                LOG(EJavaMMAPI,EInfo,"CMMADisplay::MdcContainerVisibilityChanged resetdrawrect is true");
                 iWindow->SetDrawRectThread(iUserRect);
                 iResetDrawRect = EFalse;
             }
             if (iIsForeground)
             {
-                iWindow->SetVisible(aVisible);
+                LOG(EJavaMMAPI,EInfo,"CMMADisplay::MdcContainerVisibilityChanged container foreground is true");
+                iWindow->SetVisible(aVisible,false);
             }
             SetClippingRegion();
         }
@@ -727,7 +731,7 @@
     nativeRectDimensionArr[3] = aRect.Height();
     // Now the dimension array in java is updated hence reset the java rect
 
-    validJni->ReleaseIntArrayElements(javaDimensionarr, nativeRectDimensionArr, JNI_COMMIT);
+    validJni->ReleaseIntArrayElements(javaDimensionarr, nativeRectDimensionArr, 0);
     validJni->CallVoidMethod(iJavaDisplayObject,setRectID);
 
     LOG(EJavaMMAPI,EInfo,"MMA::CMMACanvasDisplay::ResetJavaRectObject -");
--- a/javauis/mmapi_qt/baseline/src/cmmavideocontrol.cpp	Tue Jul 06 14:10:26 2010 +0300
+++ b/javauis/mmapi_qt/baseline/src/cmmavideocontrol.cpp	Wed Aug 18 09:43:15 2010 +0300
@@ -334,7 +334,7 @@
     case com_nokia_microedition_media_control_VideoControl_SET_DISPLAY_SIZE:
     {
         TSize displaySize(aPropertyA, aPropertyB);
-        LOG2(EJavaMMAPI, EInfo, "CMMAVideoControl::statepropertyl %d , %d",displaySize.iHeight,displaySize.iWidth);
+        LOG1(EJavaMMAPI, EInfo, "CMMAVideoControl::statepropertyl %d",displaySize);
         display->SetDisplaySizeL(displaySize);
         LOG(EJavaMMAPI, EInfo, "CMMAVideoControl::SetDisplayProperty:: setDisplaySizeL Completed");
         // inform java side
@@ -370,27 +370,25 @@
              aPropertyA);
         LOG1(EJavaMMAPI, EInfo, "MMA::CMMAVideoControl::StaticSetPropertyL b property %d",
              aPropertyB);
-        //TSize fullscreenSize(aPropertyA, aPropertyB);
-        //display->SetFullscreenSize(fullscreenSize);
-        //display->SetDisplaySizeL(fullscreenSize);
-        //display->SetFullScreenL(ETrue);
-        display->SourceSizeChanged(aPropertyA, aPropertyB,0,0,TRect(0,0,0,0));
+        TSize fullscreenSize(aPropertyA, aPropertyB);
+        display->SetFullscreenSize(fullscreenSize);
+        //display->SetDisplaySizeL(fullsclreenSize);
+        display->SetFullScreenL(ETrue);
+        //display->SourceSizeChanged(aPropertyA, aPropertyB,0,0,TRect(0,0,0,0));
         break;
     }
     case com_nokia_microedition_media_control_VideoControl_SET_DISPLAY_FULLSCREEN_FALSE:
     {
-        TSize fullscreenSize = aControl->iOldDisplaySize;
-        display->SetFullscreenSize(fullscreenSize);
         display->SetFullScreenL(EFalse);
 
         // Send SIZE_CHANGED event when fullscreen is turned off if
         // size of the video display has changed. Possible position
         // change is however disregarded
-        /* if (aControl->iOldDisplaySize != display->DisplaySize())
-         {
-             aControl->iGuiPlayer->NotifyWithStringEvent(
-                 CMMAPlayerEvent::ESizeChanged, KControlName);
-         }*/
+        if (aControl->iOldDisplaySize != display->DisplaySize())
+        {
+            aControl->iGuiPlayer->NotifyWithStringEvent(
+                CMMAPlayerEvent::ESizeChanged, KControlName);
+        }
 
         break;
     }
--- a/javauis/mmapi_qt/baseline/src/itemdisplayjni.cpp	Tue Jul 06 14:10:26 2010 +0300
+++ b/javauis/mmapi_qt/baseline/src/itemdisplayjni.cpp	Wed Aug 18 09:43:15 2010 +0300
@@ -37,15 +37,20 @@
     LOG(EJavaMMAPI,EInfo,"ItemDisplayJni : setVisible -");
 }
 
+LOCAL_C void LocalSetContainerVisible(CMMADisplay* display,TBool visible)
+{
+    display ->SetContainerVisibility(visible);
+}
 
 JNIEXPORT void JNICALL Java_com_nokia_microedition_media_control_ItemDisplay__1setContainerVisible
-(JNIEnv *, jobject, jint nativeDisplayHandle, jboolean isActive)
+(JNIEnv *, jobject, jint aEventSourceHandle,jint nativeDisplayHandle, jboolean aIsActive)
 {
     LOG(EJavaMMAPI,EInfo,"ItemDisplayJni : setContainerVisible +");
+    MMAFunctionServer* eventSource =  reinterpret_cast<MMAFunctionServer *>(aEventSourceHandle);
     CMMADisplay* display = reinterpret_cast<CMMADisplay*>(nativeDisplayHandle);
-    TBool visible = (TBool)isActive;
-    display ->SetContainerVisibility(visible);
-    LOG(EJavaMMAPI,EInfo,"JNI_canvasdisplay.cpp : setContainerVisible -");
+    TBool visible = (TBool)aIsActive;
+    eventSource->ExecuteTrap(&LocalSetContainerVisible,display,visible);
+    LOG(EJavaMMAPI,EInfo,"itemdisplayjni.cpp : setContainerVisible -");
 }
 
 JNIEXPORT void JNICALL Java_com_nokia_microedition_media_control_ItemDisplay__1setFullScreenMode
@@ -96,7 +101,7 @@
     TInt b = formbounds[1];
     TInt w = formbounds[2];
     TInt h = formbounds[3];
-    aJni->ReleaseIntArrayElements(aFormArray,formbounds,JNI_COMMIT);
+    aJni->ReleaseIntArrayElements(aFormArray,formbounds,0);
     TRect formRect(TPoint(a,b),TPoint(w,h));
     MMAFunctionServer* eventSource =  reinterpret_cast<MMAFunctionServer *>(aEventSourceHandle);
     // need to call in Function server thread context because CMMADisplay's JNI pointer
--- a/javauis/mmapi_qt/baseline/src/outputstreamwriter.cpp	Tue Jul 06 14:10:26 2010 +0300
+++ b/javauis/mmapi_qt/baseline/src/outputstreamwriter.cpp	Wed Aug 18 09:43:15 2010 +0300
@@ -77,8 +77,8 @@
                                         outputBufferSize, // returns readed size
                                         &readStatus);
 
-    aJni->ReleaseByteArrayElements(aOutputBuffer, outputBuffer, JNI_COMMIT);
-    aJni->ReleaseIntArrayElements(aOutputBufferSize, outputBufferSize, JNI_COMMIT);
+    aJni->ReleaseByteArrayElements(aOutputBuffer, outputBuffer, 0);
+    aJni->ReleaseIntArrayElements(aOutputBufferSize, outputBufferSize, 0);
 
     if (err != KErrNone)
     {
--- a/javauis/mmapi_qt/build/build.xml	Tue Jul 06 14:10:26 2010 +0300
+++ b/javauis/mmapi_qt/build/build.xml	Wed Aug 18 09:43:15 2010 +0300
@@ -21,13 +21,6 @@
   <import file="../../../build/utilities.xml"/>
 
  
-  <!-- Needed by the utilities.xml. See the description form the utilities.xml
-       file -->
-
-  <target name="compile">
-    <omj.javac classpath="${classpath}:${compile.result.root}/eswtqt/classes/first:${compile.result.root}/openlcdui/classes/first:${compile.result.root}/javautils/classes/first"/>
-  </target>
-
 <!-- conditional compilation variation depending upon the platform
 -->
   <target name="init.component.properties">
@@ -206,7 +199,14 @@
 
   <target name="create.internal.api.jar">
     <omj.internal.apis includes="com/nokia/microedition/media/control/ControlImpl.class,
-                                 com/nokia/microedition/media/control/MMAGUIFactory.class"/>
+                                 com/nokia/microedition/media/control/MMAGUIFactory.class,
+                                 com/nokia/microedition/media/NativeError.class,
+                                 com/nokia/microedition/media/InternalPlayer.class,
+                                 com/nokia/microedition/media/PlayerImpl.class,
+                                 com/nokia/microedition/media/PlugIn.class,
+                                 com/nokia/microedition/media/MMAInvokeListener.class,
+                                 com/nokia/microedition/media/PlayerBase.class,
+                                 com/nokia/microedition/media/ManagerImpl.class"/>
   </target>
 
 </project>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/nokiauiapi_qt/.classpath	Wed Aug 18 09:43:15 2010 +0300
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+	<classpathentry excluding="**/.svn/" kind="src" path="src"/>
+	<classpathentry kind="src" path="src_j2me"/>
+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+	<classpathentry kind="var" path="CLDC_JAR"/>
+	<classpathentry kind="output" path="bin"/>
+</classpath>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/nokiauiapi_qt/.project	Wed Aug 18 09:43:15 2010 +0300
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>nokiauiapi</name>
+	<comment></comment>
+	<projects>
+	</projects>
+	<buildSpec>
+		<buildCommand>
+			<name>org.eclipse.jdt.core.javabuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+	</buildSpec>
+	<natures>
+		<nature>org.eclipse.jdt.core.javanature</nature>
+	</natures>
+</projectDescription>
--- a/javauis/nokiauiapi_qt/build/build.xml	Tue Jul 06 14:10:26 2010 +0300
+++ b/javauis/nokiauiapi_qt/build/build.xml	Wed Aug 18 09:43:15 2010 +0300
@@ -29,9 +29,7 @@
 
     <property name="java.src.paths" value="../src:../src_j2me"/>
 
-    <target name="compile">
-        <omj.javac classpath="${impl.cldc.jar}"/>
-    </target>
+
 
     <property name="javah.classnames" value="com.nokia.mid.ui.internal.OS"/>
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/nokiauiapi_qt/build/javanokiaui.pro	Wed Aug 18 09:43:15 2010 +0300
@@ -0,0 +1,44 @@
+#
+# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of the License "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+#
+# Contributors:
+#
+# Description: 
+#
+
+TEMPLATE=lib
+TARGET=javanokiaui
+CONFIG += omj java
+
+
+QT += core
+
+
+symbian {
+    
+
+    include(../library/nokiauiapi.pri)
+    
+    LIBS += -lcone
+    LIBS += -ltouchfeedback
+
+    
+}
+
+include(../../../build/omj.pri)
+
+
+
+
+
+
+
+
--- a/javauis/nokiauiapi_qt/build/nokiauiapiqt.pro	Tue Jul 06 14:10:26 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,44 +0,0 @@
-#
-# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-# All rights reserved.
-# This component and the accompanying materials are made available
-# under the terms of the License "Eclipse Public License v1.0"
-# which accompanies this distribution, and is available
-# at the URL "http://www.eclipse.org/legal/epl-v10.html".
-#
-# Initial Contributors:
-# Nokia Corporation - initial contribution.
-#
-# Contributors:
-#
-# Description: 
-#
-
-TEMPLATE=lib
-TARGET=javanokiaui
-CONFIG += omj java
-
-
-QT += core
-
-
-symbian {
-    
-
-    include(../library/nokiauiapi.pri)
-    
-    LIBS += -lcone
-    LIBS += -ltouchfeedback
-
-    
-}
-
-include(../../../build/omj.pri)
-
-
-
-
-
-
-
-
--- a/javauis/tsrc/fute/lcdui/Midp_StringItem_01/build.xml	Tue Jul 06 14:10:26 2010 +0300
+++ b/javauis/tsrc/fute/lcdui/Midp_StringItem_01/build.xml	Wed Aug 18 09:43:15 2010 +0300
@@ -28,7 +28,7 @@
     <property name="midlet.permissions" value=""/>
     <property name="package.name" value="Midp_StringItem_01"/>
     <property name="company.name" value="Nokia"/>
-    <property name="midlet.version" value="1.1"/>
+    <property name="midlet.version" value="1.2"/>
     <property name="midlet.description" value=""/>
 
     <!-- Get settings for a basic MIDlet. -->
--- a/javauis/tsrc/fute/lcdui/Midp_StringItem_01/src/FormStringItemTests.java	Tue Jul 06 14:10:26 2010 +0300
+++ b/javauis/tsrc/fute/lcdui/Midp_StringItem_01/src/FormStringItemTests.java	Wed Aug 18 09:43:15 2010 +0300
@@ -62,9 +62,11 @@
 
     //the command to create the StringItem with the entered label and text and with focus
     private Command cmdCreateHL = new Command("Create as Hyperlink", Command.SCREEN, 1);
+    private Command cmdCreateHLM = new Command("Create as Hyperlink 2 cmds", Command.SCREEN, 1);
 
     //the command to create the StringItem with the entered label and text and with focus
     private Command cmdCreateButton = new Command("Create as Button", Command.SCREEN, 1);
+    private Command cmdCreateButtonM = new Command("Create as Button 2 cmds", Command.SCREEN, 1);
 
     //the command to unlock the Item
     private Command cmdUnlock = new Command("Unlock", Command.SCREEN, 1);
@@ -97,6 +99,11 @@
     private Command cmdNext = new Command("Next", Command.SCREEN, 1);
     private Command cmdExit = new Command("Exit", Command.EXIT, 1);
 
+    // commands for the form
+    private Command cmdItemF = new Command("ItemF", Command.ITEM, 1);
+    private Command cmdOkF = new Command("OkF", Command.OK, 1);
+    private Command cmdScreenF = new Command("Add form commands", Command.SCREEN, 1);
+
     static int change = -1;
 
     public FormStringItemTests(Midp_StringItem_01 m)
@@ -118,7 +125,9 @@
         append(cg);
         addCommand(cmdCreate);
         addCommand(cmdCreateHL);
+        addCommand(cmdCreateHLM);
         addCommand(cmdCreateButton);
+        addCommand(cmdCreateButtonM);
         addCommand(cmdLayout);
         addCommand(cmdLayoutHL);
         addCommand(cmdLayoutButton);
@@ -134,6 +143,7 @@
         //create StringItemForm
         stringItemForm = new Form("StringItem");
         stringItemForm.addCommand(cmdBack);
+        stringItemForm.addCommand(cmdScreenF);
         stringItemForm.setCommandListener(this);
     }
 
@@ -223,39 +233,27 @@
         }
         else if (c == cmdLayout)
         {
-
             layoutTest(Item.PLAIN);
-
         }
         else if (c == cmdLayoutHL)
         {
-
             layoutTest(Item.HYPERLINK);
-
         }
         else if (c == cmdLayoutButton)
         {
-
             layoutTest(Item.BUTTON);
-
         }
         else if (c == cmdVLayout)
         {
-
             verticalLayoutTest(Item.PLAIN);
-
         }
         else if (c == cmdVLayoutHL)
         {
-
             verticalLayoutTest(Item.HYPERLINK);
-
         }
         else if (c == cmdVLayoutButton)
         {
-
             verticalLayoutTest(Item.BUTTON);
-
         }
         else if (c == cmdAddListeners)
         {
@@ -272,6 +270,11 @@
             m.destroyApp(false);
             m.notifyDestroyed();
         }
+        else if (c == cmdScreenF)
+        {
+            stringItemForm.addCommand(cmdItemF);
+            stringItemForm.addCommand(cmdOkF);
+        }
         else
         {
             String l = label.getString();
@@ -282,12 +285,12 @@
 
             if (c == cmdCreate)
                 si = new StringItem(l, t);
-            else if (c == cmdCreateHL)
+            else if (c == cmdCreateHL || c == cmdCreateHLM)
             {
                 si = new StringItem(l, t, Item.HYPERLINK);
                 si.setDefaultCommand(cmdItem);
             }
-            else if (c == cmdCreateButton)
+            else if (c == cmdCreateButton || c == cmdCreateButtonM)
             {
                 si = new StringItem(l, t, Item.BUTTON);
                 si.setDefaultCommand(cmdItem);
@@ -352,6 +355,10 @@
             stringItemForm.addCommand(cmdRemoveCommand);
             stringItemForm.addCommand(cmdRestoreCommand);
             stringItemForm.addCommand(cmdRemoveItem);
+            if (c == cmdCreateButtonM || c == cmdCreateHLM)
+            {
+                si.addCommand(cmdBack);
+            }
             Display.getDisplay(m).setCurrent(stringItemForm);
         }
     }
--- a/layers.sysdef.xml	Tue Jul 06 14:10:26 2010 +0300
+++ b/layers.sysdef.xml	Wed Aug 18 09:43:15 2010 +0300
@@ -12,26 +12,12 @@
               qmakeArgs="-r"
               filter="!sf_build" />
       </module>
-      
-<!--  When releasing to SF, change the sf_build to this.
       <module name="jrt_sf">
         <unit name="jrt_sf" unitID="jrt.jrt_sf" mrp=""
               bldFile="&layer_real_source_path;" proFile="jrt.pro"
               qmakeArgs="-r RD_JAVA_SF_BUILD=1"
               filter="sf_build" />
       </module>
--->
-      <module name="jrt">
-        <unit name="jrt_jrt_plat" unitID="jrt.jrt.jrt_plat" mrp=""
-              bldFile="&layer_real_source_path;/jrt_plat/group"
-              filter="sf_build"  />
-      </module>
-      <module name="jrt">
-        <unit name="jrt_jrt_stubs" unitID="jrt.jrt.java_stubs" mrp=""
-              bldFile="&layer_real_source_path;/java_stubs/group"
-              filter="sf_build" />
-      </module>
-      
     </layer>
   </systemModel>
 </SystemDefinition>
--- a/rom/java_2_2.iby	Tue Jul 06 14:10:26 2010 +0300
+++ b/rom/java_2_2.iby	Wed Aug 18 09:43:15 2010 +0300
@@ -180,6 +180,7 @@
 file=ABI_DIR\BUILD_DIR\javaruntimeui.dll                                    SHARED_LIB_DIR\javaruntimeui.dll
 data=JAVA_VM_RES_BLD\javaruntimeui.odc                                      JAVA_VM_RES_IMG\javaruntimeui.odc
 file=ABI_DIR\BUILD_DIR\javaruntimestarterutils.dll                          SHARED_LIB_DIR\javaruntimestarterutils.dll
+file=ABI_DIR\BUILD_DIR\javastarter.dll                                      SHARED_LIB_DIR\javastarter.dll
 
 // MIDP runtime
 file=ABI_DIR\BUILD_DIR\javamidp.exe                                         PROGRAMS_DIR\javamidp.exe
@@ -364,4 +365,8 @@
 // Utility for Services team
 file=ABI_DIR\BUILD_DIR\javaupgradeapp.exe                                   PROGRAMS_DIR\javaupgradeapp.exe
 
+// Java icon size notifier ecom plugin
+ECOM_PLUGIN(javaiconsizenotifplugin.dll, javaiconsizenotifplugin.rsc)
+data=ZRESOURCE\plugins\javaiconsizenotifplugin.rsc ECOM_RESOURCE_DIR\javaiconsizenotifplugin.rsc
+
 #endif
--- a/rom/java_3_1.iby	Tue Jul 06 14:10:26 2010 +0300
+++ b/rom/java_3_1.iby	Wed Aug 18 09:43:15 2010 +0300
@@ -78,13 +78,14 @@
 
 // Launchers
 file=ABI_DIR\BUILD_DIR\javalauncher.exe                                     PROGRAMS_DIR\javalauncher.exe
-ECOM_PLUGIN(javaappschemeplugin.dll,javaappschemeplugin.rsc)
-data=ZRESOURCE\plugins\javaappschemeplugin.rsc                              ECOM_RESOURCE_DIR\javaappschemeplugin.rsc
+file=ABI_DIR\BUILD_DIR\javaappscheme.exe                                    PROGRAMS_DIR\javaappscheme.exe
+file=ABI_DIR\BUILD_DIR\javaqtrequest.exe                                    PROGRAMS_DIR\javaqtrequest.exe
 
 #ifdef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK
 // Usif installer plugin
 ECOM_PLUGIN(javasifplugin.dll,javasifplugin.rsc)
 data=ZRESOURCE\plugins\javasifplugin.rsc                                    ECOM_RESOURCE_DIR\javasifplugin.rsc
+file=ABI_DIR\BUILD_DIR\javainstallcopier.exe                                PROGRAMS_DIR\javainstallcopier.exe
 #endif
 
 // Recognizers
@@ -165,6 +166,7 @@
 file=ABI_DIR\BUILD_DIR\javaruntimeui.dll                                    SHARED_LIB_DIR\javaruntimeui.dll
 data=JAVA_VM_RES_BLD\javaruntimeui.odc                                      JAVA_VM_RES_IMG\javaruntimeui.odc
 file=ABI_DIR\BUILD_DIR\javaruntimestarterutils.dll                          SHARED_LIB_DIR\javaruntimestarterutils.dll
+file=ABI_DIR\BUILD_DIR\javastarter.dll                                      SHARED_LIB_DIR\javastarter.dll
 
 // MIDP runtime
 file=ABI_DIR\BUILD_DIR\javamidp.exe                                         PROGRAMS_DIR\javamidp.exe