Revision: 201033
authorDremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Wed, 25 Aug 2010 15:45:01 +0300
changeset 0 39ab869ed429
child 1 753e33780645
Revision: 201033
htiui/HtiAdmin/data/HtiAdmin.rss
htiui/HtiAdmin/data/HtiAdmin_reg.rss
htiui/HtiAdmin/group/HtiAdmin.mmp
htiui/HtiAdmin/group/bld.inf
htiui/HtiAdmin/inc/HtiAdmin.hrh
htiui/HtiAdmin/inc/HtiAdmin.pan
htiui/HtiAdmin/inc/HtiAdminAppUi.h
htiui/HtiAdmin/inc/HtiAdminAppView.h
htiui/HtiAdmin/inc/HtiAdminApplication.h
htiui/HtiAdmin/inc/HtiAdminDocument.h
htiui/HtiAdmin/src/HtiAdmin.cpp
htiui/HtiAdmin/src/HtiAdminAppUi.cpp
htiui/HtiAdmin/src/HtiAdminAppView.cpp
htiui/HtiAdmin/src/HtiAdminApplication.cpp
htiui/HtiAdmin/src/HtiAdminDocument.cpp
htiui/HtiAdminQt/HtiAdmin.pro
htiui/HtiAdminQt/chtiadminengine.cpp
htiui/HtiAdminQt/chtiadminengine.h
htiui/HtiAdminQt/htienginewrapper.cpp
htiui/HtiAdminQt/htienginewrapper.h
htiui/HtiAdminQt/main.cpp
htiui/HtiAdminQt/mainview.cpp
htiui/HtiAdminQt/mainview.h
htiui/HtiDeviceReboot/group/HtiDeviceReboot.mmp
htiui/HtiDeviceReboot/group/bld.inf
htiui/HtiDeviceReboot/src/HtiDeviceReboot.cpp
htiui/HtiServicePlugins/HtiAppServicePlugin/bwins/HtiAppControlu.def
htiui/HtiServicePlugins/HtiAppServicePlugin/eabi/HtiAppControlu.def
htiui/HtiServicePlugins/HtiAppServicePlugin/group/HtiAppControl.mmp
htiui/HtiServicePlugins/HtiAppServicePlugin/group/bld.inf
htiui/HtiServicePlugins/HtiAppServicePlugin/inc/HtiAppControl.h
htiui/HtiServicePlugins/HtiAppServicePlugin/src/HtiAppControl.cpp
htiui/HtiServicePlugins/HtiAudioServicePlugin/data/1020DEC8.rss
htiui/HtiServicePlugins/HtiAudioServicePlugin/group/HtiAudioServicePlugin.mmp
htiui/HtiServicePlugins/HtiAudioServicePlugin/group/bld.inf
htiui/HtiServicePlugins/HtiAudioServicePlugin/inc/HtiAudioServicePlugin.h
htiui/HtiServicePlugins/HtiAudioServicePlugin/src/HtiAudioServicePlugin.cpp
htiui/HtiServicePlugins/HtiAudioServicePlugin/src/proxy.cpp
htiui/HtiServicePlugins/HtiCameraServicePlugin/data/2002EA9D.rss
htiui/HtiServicePlugins/HtiCameraServicePlugin/engine/inc/EngineVideoRecording.h
htiui/HtiServicePlugins/HtiCameraServicePlugin/engine/inc/VideoRecordingQualityLevels.h
htiui/HtiServicePlugins/HtiCameraServicePlugin/engine/src/EngineVideoRecording.cpp
htiui/HtiServicePlugins/HtiCameraServicePlugin/engine/src/VideoRecordingQualityLevels.cpp
htiui/HtiServicePlugins/HtiCameraServicePlugin/group/HtiCameraServicePlugin.mmp
htiui/HtiServicePlugins/HtiCameraServicePlugin/group/bld.inf
htiui/HtiServicePlugins/HtiCameraServicePlugin/inc/HtiCameraServicePlugin.h
htiui/HtiServicePlugins/HtiCameraServicePlugin/src/HtiCameraServicePlugin.cpp
htiui/HtiServicePlugins/HtiCameraServicePlugin/src/proxy.cpp
htiui/HtiServicePlugins/HtiFtpBackupFake/bwins/HtiFtpBackupFakeu.def
htiui/HtiServicePlugins/HtiFtpBackupFake/eabi/HtiFtpBackupFakeu.def
htiui/HtiServicePlugins/HtiFtpBackupFake/group/HtiFtpBackupFake.mmp
htiui/HtiServicePlugins/HtiFtpBackupFake/group/bld.inf
htiui/HtiServicePlugins/HtiFtpBackupFake/inc/HtiFtpBackupFake.h
htiui/HtiServicePlugins/HtiFtpBackupFake/src/HtiFtpBackupFake.cpp
htiui/HtiServicePlugins/HtiKeyEventServicePlugin/data/1020DEC0.rss
htiui/HtiServicePlugins/HtiKeyEventServicePlugin/group/HtiKeyEventServicePlugin.mmp
htiui/HtiServicePlugins/HtiKeyEventServicePlugin/group/bld.inf
htiui/HtiServicePlugins/HtiKeyEventServicePlugin/inc/HtiKeyEventServicePlugin.h
htiui/HtiServicePlugins/HtiKeyEventServicePlugin/inc/KeyEventHandler.h
htiui/HtiServicePlugins/HtiKeyEventServicePlugin/inc/MultiTouchPointerEvent.h
htiui/HtiServicePlugins/HtiKeyEventServicePlugin/inc/MultiTouchPointerEventHandler.h
htiui/HtiServicePlugins/HtiKeyEventServicePlugin/inc/PointerEventHandler.h
htiui/HtiServicePlugins/HtiKeyEventServicePlugin/src/HtiKeyEventServicePlugin.cpp
htiui/HtiServicePlugins/HtiKeyEventServicePlugin/src/KeyEventHandler.cpp
htiui/HtiServicePlugins/HtiKeyEventServicePlugin/src/MultiTouchPointerEvent.cpp
htiui/HtiServicePlugins/HtiKeyEventServicePlugin/src/MultiTouchPointerEventHandler.cpp
htiui/HtiServicePlugins/HtiKeyEventServicePlugin/src/PointerEventHandler.cpp
htiui/HtiServicePlugins/HtiKeyEventServicePlugin/src/proxy.cpp
htiui/HtiServicePlugins/HtiMessagesServicePlugin/data/200212C5.rss
htiui/HtiServicePlugins/HtiMessagesServicePlugin/group/HtiMessagesServicePlugin.mmp
htiui/HtiServicePlugins/HtiMessagesServicePlugin/group/bld.inf
htiui/HtiServicePlugins/HtiMessagesServicePlugin/inc/HtiIAPHandler.h
htiui/HtiServicePlugins/HtiMessagesServicePlugin/inc/HtiMailboxHandler.h
htiui/HtiServicePlugins/HtiMessagesServicePlugin/inc/HtiMessagesServicePlugin.h
htiui/HtiServicePlugins/HtiMessagesServicePlugin/inc/HtiMsgSettingsHandler.h
htiui/HtiServicePlugins/HtiMessagesServicePlugin/inc/MessageMgmntHandler.h
htiui/HtiServicePlugins/HtiMessagesServicePlugin/src/HtiIAPHandler.cpp
htiui/HtiServicePlugins/HtiMessagesServicePlugin/src/HtiMailboxHandler.cpp
htiui/HtiServicePlugins/HtiMessagesServicePlugin/src/HtiMessagesServicePlugin.cpp
htiui/HtiServicePlugins/HtiMessagesServicePlugin/src/HtiMsgSettingsHandler.cpp
htiui/HtiServicePlugins/HtiMessagesServicePlugin/src/MessageMgmntHandler.cpp
htiui/HtiServicePlugins/HtiMessagesServicePlugin/src/proxy.cpp
htiui/HtiServicePlugins/HtiPIMServicePlugin/data/200212C3.rss
htiui/HtiServicePlugins/HtiPIMServicePlugin/group/HtiNpdHlp.mmp
htiui/HtiServicePlugins/HtiPIMServicePlugin/group/HtiPIMServicePlugin.mmp
htiui/HtiServicePlugins/HtiPIMServicePlugin/group/bld.inf
htiui/HtiServicePlugins/HtiPIMServicePlugin/inc/HtiBookmarkHandler.h
htiui/HtiServicePlugins/HtiPIMServicePlugin/inc/HtiPIMServicePlugin.h
htiui/HtiServicePlugins/HtiPIMServicePlugin/inc/HtiSimDirHandler.h
htiui/HtiServicePlugins/HtiPIMServicePlugin/inc/PIMHandler.h
htiui/HtiServicePlugins/HtiPIMServicePlugin/src/HtiBookmarkHandler.cpp
htiui/HtiServicePlugins/HtiPIMServicePlugin/src/HtiNpdHlp.cpp
htiui/HtiServicePlugins/HtiPIMServicePlugin/src/HtiPIMServicePlugin.cpp
htiui/HtiServicePlugins/HtiPIMServicePlugin/src/HtiSimDirHandler.cpp
htiui/HtiServicePlugins/HtiPIMServicePlugin/src/PIMHandler.cpp
htiui/HtiServicePlugins/HtiPIMServicePlugin/src/proxy.cpp
htiui/HtiServicePlugins/HtiScreenshotServicePlugin/data/1020DEC2.rss
htiui/HtiServicePlugins/HtiScreenshotServicePlugin/group/HtiScreenshotServicePlugin.mmp
htiui/HtiServicePlugins/HtiScreenshotServicePlugin/group/bld.inf
htiui/HtiServicePlugins/HtiScreenshotServicePlugin/inc/HtiScreenshotServicePlugin.h
htiui/HtiServicePlugins/HtiScreenshotServicePlugin/inc/HtiTextRcg.h
htiui/HtiServicePlugins/HtiScreenshotServicePlugin/src/HtiScreenshotServicePlugin.cpp
htiui/HtiServicePlugins/HtiScreenshotServicePlugin/src/HtiTextRcg.cpp
htiui/HtiServicePlugins/HtiScreenshotServicePlugin/src/proxy.cpp
htiui/HtiServicePlugins/HtiSysInfoServicePlugin/data/10210CC6.rss
htiui/HtiServicePlugins/HtiSysInfoServicePlugin/group/HtiSysInfoServicePlugin.mmp
htiui/HtiServicePlugins/HtiSysInfoServicePlugin/group/bld.inf
htiui/HtiServicePlugins/HtiSysInfoServicePlugin/inc/HtiLightsController.h
htiui/HtiServicePlugins/HtiSysInfoServicePlugin/inc/HtiPropertySubscriber.h
htiui/HtiServicePlugins/HtiSysInfoServicePlugin/inc/HtiSysInfoServicePlugin.h
htiui/HtiServicePlugins/HtiSysInfoServicePlugin/src/HtiLightsController.cpp
htiui/HtiServicePlugins/HtiSysInfoServicePlugin/src/HtiPropertySubscriber.cpp
htiui/HtiServicePlugins/HtiSysInfoServicePlugin/src/HtiSysInfoServicePlugin.cpp
htiui/HtiServicePlugins/HtiSysInfoServicePlugin/src/proxy.cpp
htiui/HtiStartupWait/bwins/HtiStartupWaitu.def
htiui/HtiStartupWait/eabi/HtiStartupWaitu.def
htiui/HtiStartupWait/group/HtiStartupWait.mmp
htiui/HtiStartupWait/group/bld.inf
htiui/HtiStartupWait/inc/HtiStartupWait.h
htiui/HtiStartupWait/src/HtiStartupWait.cpp
htiui/HtiTcbHlp/group/HtiTcbHlp.mmp
htiui/HtiTcbHlp/group/bld.inf
htiui/HtiTcbHlp/src/HtiTcbHlp.cpp
htiui/group/bld.inf
htiui/group/hti_stub_sis.mk
htiui/htiui.pro
htiui/rom/htiui.iby
htiui/rom/htiui_10_1.iby
htiui/sis/HTI_S60-10_1.pkg
htiui/sis/HTI_S60-52.pkg
htiui/sis/HTI_S60_Upgrade-10_1.pkg
htiui/sis/HTI_S60_Upgrade-52.pkg
htiui/sis/HTI_stub.pkg
htiui/symbian_version.hrh
layers.sysdef.xml
stifui/avkon/group/ReleaseNote.txt
stifui/avkon/group/bld.inf
stifui/avkon/rom/Stifui.iby
stifui/avkon/sis/Stifui.pkg
stifui/avkon/sis/Stifui_31.sis
stifui/avkon/sis/Stifui_31_Stub.SIS
stifui/avkon/stifui/data/Stifui.rss
stifui/avkon/stifui/data/Stifui_reg.rss
stifui/avkon/stifui/group/Stifui.mmp
stifui/avkon/stifui/group/bld.inf
stifui/avkon/stifui/inc/AppUIApp.h
stifui/avkon/stifui/inc/AppUIAppUi.h
stifui/avkon/stifui/inc/AppUIDocument.h
stifui/avkon/stifui/inc/Container.h
stifui/avkon/stifui/inc/CreatedTestSetMenuContainer.h
stifui/avkon/stifui/inc/CreatedTestSetMenuView.h
stifui/avkon/stifui/inc/MainMenuContainer.h
stifui/avkon/stifui/inc/MainMenuView.h
stifui/avkon/stifui/inc/MenuListBox.h
stifui/avkon/stifui/inc/ShowStartedCasesContainer.h
stifui/avkon/stifui/inc/ShowStartedCasesView.h
stifui/avkon/stifui/inc/StartCasesContainer.h
stifui/avkon/stifui/inc/StartCasesView.h
stifui/avkon/stifui/inc/StartedCasesMenuContainer.h
stifui/avkon/stifui/inc/StartedCasesMenuView.h
stifui/avkon/stifui/inc/StatisticsContainer.h
stifui/avkon/stifui/inc/StatisticsView.h
stifui/avkon/stifui/inc/Stifui.hrh
stifui/avkon/stifui/inc/Stifui_loc.hrh
stifui/avkon/stifui/inc/TestCaseMenuContainer.h
stifui/avkon/stifui/inc/TestCaseMenuView.h
stifui/avkon/stifui/inc/TestCaseOutputContainer.h
stifui/avkon/stifui/inc/TestCaseOutputView.h
stifui/avkon/stifui/inc/TestModulesMenuContainer.h
stifui/avkon/stifui/inc/TestModulesMenuView.h
stifui/avkon/stifui/inc/TestSetBaseMenuContainer.h
stifui/avkon/stifui/inc/TestSetBaseMenuView.h
stifui/avkon/stifui/inc/TestSetInsertMenuContainer.h
stifui/avkon/stifui/inc/TestSetInsertMenuView.h
stifui/avkon/stifui/inc/TestSetMenuContainer.h
stifui/avkon/stifui/inc/TestSetMenuView.h
stifui/avkon/stifui/inc/TestSetStartedCasesContainer.h
stifui/avkon/stifui/inc/TestSetStartedCasesView.h
stifui/avkon/stifui/inc/UIStoreHandler.h
stifui/avkon/stifui/inc/View.h
stifui/avkon/stifui/inc/version.h
stifui/avkon/stifui/src/AppUIApp.cpp
stifui/avkon/stifui/src/AppUIAppUi.cpp
stifui/avkon/stifui/src/AppUIDocument.cpp
stifui/avkon/stifui/src/Container.cpp
stifui/avkon/stifui/src/CreatedTestSetMenuContainer.cpp
stifui/avkon/stifui/src/CreatedTestSetMenuView.cpp
stifui/avkon/stifui/src/MainMenuContainer.cpp
stifui/avkon/stifui/src/MainMenuView.cpp
stifui/avkon/stifui/src/MenuListBox.cpp
stifui/avkon/stifui/src/ShowStartedCasesContainer.cpp
stifui/avkon/stifui/src/ShowStartedCasesView.cpp
stifui/avkon/stifui/src/StartCasesContainer.cpp
stifui/avkon/stifui/src/StartCasesView.cpp
stifui/avkon/stifui/src/StartedCasesMenuContainer.cpp
stifui/avkon/stifui/src/StartedCasesMenuView.cpp
stifui/avkon/stifui/src/StatisticsContainer.cpp
stifui/avkon/stifui/src/StatisticsView.cpp
stifui/avkon/stifui/src/TestCaseMenuContainer.cpp
stifui/avkon/stifui/src/TestCaseMenuView.cpp
stifui/avkon/stifui/src/TestCaseOutputContainer.cpp
stifui/avkon/stifui/src/TestCaseOutputView.cpp
stifui/avkon/stifui/src/TestModulesMenuContainer.cpp
stifui/avkon/stifui/src/TestSetBaseMenuContainer.cpp
stifui/avkon/stifui/src/TestSetBaseMenuView.cpp
stifui/avkon/stifui/src/TestSetInsertMenuContainer.cpp
stifui/avkon/stifui/src/TestSetInsertMenuView.cpp
stifui/avkon/stifui/src/TestSetMenuContainer.cpp
stifui/avkon/stifui/src/TestSetMenuView.cpp
stifui/avkon/stifui/src/TestSetStartedCasesContainer.cpp
stifui/avkon/stifui/src/TestSetStartedCasesView.cpp
stifui/avkon/stifui/src/Testmodulesmenuview.cpp
stifui/avkon/stifui/src/UIStoreHandler.cpp
stifui/avkon/stifui/src/View.cpp
stifui/avkon/uitestserverstarter/data/UITestServerStarter.rls
stifui/avkon/uitestserverstarter/data/UITestServerStarter.rss
stifui/avkon/uitestserverstarter/data/UITestServerStarter_reg.rss
stifui/avkon/uitestserverstarter/group/UITestServerStarter.mmp
stifui/avkon/uitestserverstarter/group/bld.inf
stifui/avkon/uitestserverstarter/inc/AknUiEnvProxy.h
stifui/avkon/uitestserverstarter/inc/EventUtil.h
stifui/avkon/uitestserverstarter/inc/TestServerThreadStarter.h
stifui/avkon/uitestserverstarter/inc/UITestServerStarter.hrh
stifui/avkon/uitestserverstarter/inc/UITestServerStarterAppContainer.h
stifui/avkon/uitestserverstarter/inc/UITestServerStarterAppUi.h
stifui/avkon/uitestserverstarter/inc/UITestServerStarterAppView.h
stifui/avkon/uitestserverstarter/inc/UITestServerStarterApplication.h
stifui/avkon/uitestserverstarter/inc/UITestServerStarterDocument.h
stifui/avkon/uitestserverstarter/src/AknUiEnvProxy.cpp
stifui/avkon/uitestserverstarter/src/EventUtil.cpp
stifui/avkon/uitestserverstarter/src/TestServerThreadStarter.cpp
stifui/avkon/uitestserverstarter/src/UITestServerStarter.cpp
stifui/avkon/uitestserverstarter/src/UITestServerStarterAppContainer.cpp
stifui/avkon/uitestserverstarter/src/UITestServerStarterAppUi.cpp
stifui/avkon/uitestserverstarter/src/UITestServerStarterAppView.cpp
stifui/avkon/uitestserverstarter/src/UITestServerStarterApplication.cpp
stifui/avkon/uitestserverstarter/src/UITestServerStarterDocument.cpp
stifui/qt/ReleaseNote.txt
stifui/qt/inc/cstfcase.h
stifui/qt/inc/cstfmodule.h
stifui/qt/inc/dlgoutput.h
stifui/qt/inc/dlgrepeatrun.h
stifui/qt/inc/dlgsetselector.h
stifui/qt/inc/dlgsetting.h
stifui/qt/inc/frmmain.h
stifui/qt/inc/istfqtuicontroller.h
stifui/qt/inc/istfqtuimodel.h
stifui/qt/inc/stfqtuicontroller.h
stifui/qt/inc/stfqtuimodel.h
stifui/qt/inc/stifexecutor.h
stifui/qt/inc/uisetting.h
stifui/qt/inc/uiversion.h
stifui/qt/inc/version.h
stifui/qt/qss/coffee.qss
stifui/qt/resource/StfQtUI.qrc
stifui/qt/rom/stfui.iby
stifui/qt/sis/stifqtui.pkg
stifui/qt/sis/stifqtui.sis
stifui/qt/src/dlgoutput.cpp
stifui/qt/src/dlgrepeatrun.cpp
stifui/qt/src/dlgsetselector.cpp
stifui/qt/src/dlgsetting.cpp
stifui/qt/src/frmmain.cpp
stifui/qt/src/main.cpp
stifui/qt/src/stfqtuicontroller.cpp
stifui/qt/src/stfqtuimodel.cpp
stifui/qt/src/stifexecutor.cpp
stifui/qt/src/uisetting.cpp
stifui/qt/stifqtui.pro
symbianunittestui/qt/dialogaddtests.cpp
symbianunittestui/qt/dialogaddtests.h
symbianunittestui/qt/dialogmsg.cpp
symbianunittestui/qt/dialogmsg.h
symbianunittestui/qt/dialogsettings.cpp
symbianunittestui/qt/dialogsettings.h
symbianunittestui/qt/main.cpp
symbianunittestui/qt/mainwindow.cpp
symbianunittestui/qt/mainwindow.h
symbianunittestui/qt/qss/coffee.qss
symbianunittestui/qt/qss/pagefold.qss
symbianunittestui/qt/rom/sutui.iby
symbianunittestui/qt/settings.cpp
symbianunittestui/qt/settings.h
symbianunittestui/qt/symbianunittestqt.pro
symbianunittestui/qt/symbianunittestqt.qrc
symbianunittestui/qt/tabwidgettestrun.cpp
symbianunittestui/qt/tabwidgettestrun.h
symbianunittestui/qt/testitemlist.cpp
symbianunittestui/qt/testitemlist.h
symbianunittestui/qt/testrunner_s60.cpp
symbianunittestui/qt/testrunner_s60.h
symbianunittestui/qt/widgettestrunner.cpp
symbianunittestui/qt/widgettestrunner.h
sysdef_1_4_0.dtd
sysdef_1_5_1.dtd
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiAdmin/data/HtiAdmin.rss	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,317 @@
+/*
+* 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:  Resource definitions for HtiAdmin
+*
+*/
+
+NAME HTIA
+
+// INCLUDES
+#include <eikon.rh>
+#include <eikon.rsg>
+#include <avkon.rh>
+#include <avkon.rsg>
+#include <appinfo.rh>
+#include <data_caging_paths_strings.hrh>
+#include "HtiAdmin.hrh"
+
+
+// RESOURCE DEFINITIONS
+
+// ---------------------------------------------------------
+//
+//    Define the resource file signature
+//    This resource should be empty.
+//
+// ---------------------------------------------------------
+//
+RESOURCE RSS_SIGNATURE { }
+
+// ---------------------------------------------------------
+//
+//    Default Document Name
+//
+// ---------------------------------------------------------
+//
+RESOURCE TBUF r_default_document_name { buf=""; }
+
+// ---------------------------------------------------------
+//
+//    Define default menu and CBA key.
+//
+// ---------------------------------------------------------
+//
+RESOURCE EIK_APP_INFO
+    {
+    menubar = r_htiadmin_menubar;
+    cba = R_AVKON_SOFTKEYS_OPTIONS_EXIT;
+    }
+
+
+// ---------------------------------------------------------
+//
+//   r_htiadmin_menubar
+//   Menubar for HtiAdmin example
+//
+// ---------------------------------------------------------
+//
+RESOURCE MENU_BAR r_htiadmin_menubar
+    {
+    titles =
+        {
+        MENU_TITLE {menu_pane = r_htiadmin_menu;}
+        };
+    }
+
+
+// ---------------------------------------------------------
+//
+//   Options menu items
+//
+//
+// ---------------------------------------------------------
+
+RESOURCE MENU_PANE r_htiadmin_submenu_logs
+    {
+    items =
+        {
+        MENU_ITEM {command = EHtiAdminCreateLogFolder; txt = "Create c:\\logs\\hti";},
+        MENU_ITEM {command = EHtiAdminRemoveLogFolder; txt = "Remove c:\\logs\\hti";},
+        MENU_ITEM {command = EHtiAdminClearLogs;       txt = "Clear";}
+        };
+    }
+
+RESOURCE MENU_PANE r_htiadmin_submenu_priority
+    {
+    items =
+        {
+        MENU_ITEM {command = EHtiAdminPriorityBackground;   flags = EEikMenuItemCheckBox; txt="Background"; },
+        MENU_ITEM {command = EHtiAdminPriorityForeground;   flags = EEikMenuItemCheckBox; txt="Foreground"; },
+        MENU_ITEM {command = EHtiAdminPriorityHigh;         flags = EEikMenuItemCheckBox; txt="High"; },
+        MENU_ITEM {command = EHtiAdminPriorityAbsoluteHigh; flags = EEikMenuItemCheckBox; txt="AbsoluteHigh"; }
+        };
+    }
+
+RESOURCE MENU_PANE r_htiadmin_submenu_watchdog
+    {
+    items =
+        {
+        MENU_ITEM {command = EHtiAdminWatchDogEnable;  flags = EEikMenuItemCheckBox; txt="Enable"; },
+        MENU_ITEM {command = EHtiAdminWatchDogDisable; flags = EEikMenuItemCheckBox; txt="Disable"; }
+        };
+    }
+
+RESOURCE MENU_PANE r_htiadmin_submenu_console
+    {
+    items =
+        {
+        MENU_ITEM {command = EHtiAdminConsoleEnable;  flags = EEikMenuItemCheckBox; txt="Enable"; },
+        MENU_ITEM {command = EHtiAdminConsoleDisable; flags = EEikMenuItemCheckBox; txt="Disable"; }
+        };
+    }
+
+RESOURCE MENU_PANE r_htiadmin_submenu_error_dialogs
+    {
+    items =
+        {
+        MENU_ITEM {command = EHtiAdminErrorDialogsEnable;  flags = EEikMenuItemCheckBox; txt="Enable"; },
+        MENU_ITEM {command = EHtiAdminErrorDialogsDisable; flags = EEikMenuItemCheckBox; txt="Disable"; }
+        };
+    }
+
+RESOURCE MENU_PANE r_htiadmin_submenu_autostart
+    {
+    items =
+        {
+        MENU_ITEM {command = EHtiAdminAutoStartEnable;  flags = EEikMenuItemCheckBox; txt="Enable"; },
+        MENU_ITEM {command = EHtiAdminAutoStartDisable; flags = EEikMenuItemCheckBox; txt="Disable"; }
+        };
+    }
+
+RESOURCE MENU_PANE r_htiadmin_submenu_set_param
+    {
+    items =
+        {
+        MENU_ITEM {command = EHtiAdminHtiCfg;           txt = "Hti.cfg";},
+        MENU_ITEM {command = EHtiAdminHtiBtCommCfg;     txt = "HtiBtComm.cfg";},
+        MENU_ITEM {command = EHtiAdminHtiSerialCommCfg; txt = "HtiSerialComm.cfg";},
+        MENU_ITEM {command = EHtiAdminHtiIPCommCfg;     txt = "HtiIPComm.cfg";}
+        };
+    }
+
+RESOURCE MENU_PANE r_htiadmin_submenu_options
+    {
+    items =
+        {
+        MENU_ITEM {command = EHtiAdminSubComms;        txt = "Comms";},
+        MENU_ITEM {command = EHtiAdminSubAutoStart;    cascade = r_htiadmin_submenu_autostart;     txt = "AutoStart";},
+        MENU_ITEM {command = EHtiAdminSubLogs;         cascade = r_htiadmin_submenu_logs;          txt = "Logs";},
+        MENU_ITEM {command = EHtiAdminSubPriority;     cascade = r_htiadmin_submenu_priority;      txt = "Priority";},
+        MENU_ITEM {command = EHtiAdminSubWatchDog;     cascade = r_htiadmin_submenu_watchdog;      txt = "Watchdog";},
+        MENU_ITEM {command = EHtiAdminSubConsole;      cascade = r_htiadmin_submenu_console;       txt = "Console";},
+        MENU_ITEM {command = EHtiAdminSubErrorDialogs; cascade = r_htiadmin_submenu_error_dialogs; txt = "Error dialogs";},
+        MENU_ITEM {command = EHtiAdminSubSetParam;     cascade = r_htiadmin_submenu_set_param;     txt = "Set parameter";}
+        };
+    }
+
+// ---------------------------------------------------------
+//
+//   r_htiadmin_menu
+//   Menu for "Options"
+//
+// ---------------------------------------------------------
+//
+RESOURCE MENU_PANE r_htiadmin_menu
+    {
+    items =
+        {
+        MENU_ITEM {command = EHtiAdminStart;   txt = "Start";},
+        MENU_ITEM {command = EHtiAdminStop;    txt = "Stop";},
+        MENU_ITEM {command = EHtiAdminSubOptions; cascade = r_htiadmin_submenu_options;   txt = "Options";},
+        MENU_ITEM {command = EHtiAdminAbout;   txt = "About";},
+        MENU_ITEM {command = EAknSoftkeyExit;  txt = "Exit";}
+        };
+    }
+
+
+RESOURCE DIALOG r_numeric_query
+  {
+  flags = EGeneralQueryFlags;
+  buttons = R_AVKON_SOFTKEYS_OK_CANCEL;
+  items =
+    {
+    DLG_LINE
+      {
+      type = EAknCtQuery;
+      id = EGeneralQuery;
+      control = AVKON_DATA_QUERY
+        {
+        layout = EDataLayout;
+        control = EDWIN
+          {
+          flags = EEikEdwinNoHorizScrolling | EEikEdwinResizable;
+          default_input_mode = EAknEditorNumericInputMode;
+          };
+        };
+      }
+    };
+  }
+
+RESOURCE DIALOG r_text_query
+  {
+  flags = EGeneralQueryFlags;
+  buttons = R_AVKON_SOFTKEYS_OK_CANCEL;
+  items =
+    {
+    DLG_LINE
+      {
+      type = EAknCtQuery;
+      id = EGeneralQuery;
+      control = AVKON_DATA_QUERY
+        {
+        layout = EDataLayout;
+        control = EDWIN
+          {
+          flags = EEikEdwinNoHorizScrolling | EEikEdwinResizable;
+          default_input_mode = EAknEditorTextInputMode;
+          };
+        };
+      }
+    };
+  }
+
+RESOURCE AVKON_LIST_QUERY r_query_dialog
+{
+   flags = EGeneralQueryFlags;
+   softkeys = R_AVKON_SOFTKEYS_OK_CANCEL;
+   items =
+   {
+      AVKON_LIST_QUERY_DLG_LINE
+      {
+         control = AVKON_LIST_QUERY_CONTROL
+         {
+            listtype = EAknCtSinglePopupMenuListBox;
+            listbox = AVKON_LIST_QUERY_LIST
+            {
+            };
+            heading = "Select Option";
+         };
+      }
+   };
+}
+
+RESOURCE AVKON_LIST_QUERY r_select_iap_dialog
+{
+   flags = EGeneralQueryFlags;
+   softkeys = R_AVKON_SOFTKEYS_OK_CANCEL;
+   items =
+   {
+      AVKON_LIST_QUERY_DLG_LINE
+      {
+         control = AVKON_LIST_QUERY_CONTROL
+         {
+            listtype = EAknCtSinglePopupMenuListBox;
+            listbox = AVKON_LIST_QUERY_LIST
+            {
+            };
+            heading = "Select IAP";
+         };
+      }
+   };
+}
+
+// ---------------------------------------------------------
+//
+//   r_htiadmin_about_dialog
+//   About dialog
+//
+// ---------------------------------------------------------
+//
+RESOURCE DIALOG r_htiadmin_about_dialog
+   {
+   flags = EGeneralQueryFlags | EEikDialogFlagNoBorder | EEikDialogFlagNoShadow;
+   buttons = R_AVKON_SOFTKEYS_OK_EMPTY;
+   items=
+       {
+       DLG_LINE
+           {
+           type = EAknCtPopupHeadingPane;
+           id = EAknMessageQueryHeaderId;
+           control = AVKON_HEADING
+               {
+               label = "About HTI Admin";
+               headinglayout = R_AVKON_WML_SIGN_QUERY_HEADING_PANE;
+               };
+           },
+       DLG_LINE
+           {
+           type = EAknCtMessageQuery;
+           id = EAknMessageQueryContentId;
+           control = AVKON_MESSAGE_QUERY
+               {             
+               };
+           }
+       };
+   }
+
+// ---------------------------------------------------------
+//
+//   r_htiadmin_about_text
+//   Text for the About dialog
+//
+// ---------------------------------------------------------
+//
+RESOURCE TBUF r_htiadmin_about_text { buf="Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved."; }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiAdmin/data/HtiAdmin_reg.rss	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,34 @@
+/*
+* 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:  App registration resource definitions for HtiAdmin
+*
+*/
+
+
+// INCLUDES
+#include <appinfo.rh>
+#include <data_caging_paths_strings.hrh>
+
+// RESOURCE DEFINITIONS
+
+UID2 KUidAppRegistrationResourceFile
+UID3 0x1020DEB5 // application UID
+
+RESOURCE APP_REGISTRATION_INFO
+    {
+    app_file = "HtiAdmin";
+    group_name = "RnD Tools";
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiAdmin/group/HtiAdmin.mmp	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,76 @@
+/*
+* 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:  Project file for HtiAdmin
+*
+*/
+
+
+#include <platform_paths.hrh>
+#include <data_caging_paths.hrh>
+
+TARGET          HtiAdmin.exe
+TARGETTYPE      EXE
+
+UID             0x100039CE 0x1020DEB5
+
+VENDORID        0x101FB657
+
+CAPABILITY      ALL -TCB
+
+EPOCSTACKSIZE   0x5000
+
+TARGETPATH      PROGRAMS_DIR
+
+LANG            SC
+
+USERINCLUDE     ../inc
+APP_LAYER_SYSTEMINCLUDE
+
+SOURCEPATH      ../src
+SOURCE          HtiAdmin.cpp
+SOURCE          HtiAdminApplication.cpp
+SOURCE          HtiAdminAppView.cpp
+SOURCE          HtiAdminAppUi.cpp
+SOURCE          HtiAdminDocument.cpp
+
+SOURCEPATH      ../data
+
+START RESOURCE  HtiAdmin.rss
+HEADER
+TARGETPATH      APP_RESOURCE_DIR
+LANG            SC
+END
+
+START RESOURCE  HtiAdmin_reg.rss
+HEADER
+TARGETPATH      /private/10003a3f/apps
+END
+
+LIBRARY         apparc.lib
+LIBRARY         avkon.lib
+LIBRARY         cone.lib
+LIBRARY         ecom.lib
+LIBRARY         eikcoctl.lib
+LIBRARY         eikcore.lib
+LIBRARY         euser.lib
+LIBRARY         gdi.lib
+LIBRARY         hticfg.lib
+LIBRARY         ws32.lib
+LIBRARY         flogger.lib
+LIBRARY         bafl.lib
+LIBRARY         commdb.lib
+
+SMPSAFE
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiAdmin/group/bld.inf	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,23 @@
+/*
+* 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:  UI application to start/stop HtiFramework.exe
+*
+*/
+
+
+PRJ_MMPFILES
+
+HtiAdmin.mmp
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiAdmin/inc/HtiAdmin.hrh	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,66 @@
+/*
+* 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:  Command ids
+*
+*/
+
+#ifndef __HTIADMIN_HRH__
+#define __HTIADMIN_HRH__
+
+/* HtiAdmin enumerate command codes */
+enum THtiAdminIds
+    {
+    EHtiAdminStart = 1,
+    EHtiAdminStop,
+    EHtiAdminAbout,
+    EHtiAdminSubOptions,
+
+        EHtiAdminSubComms,
+                
+        EHtiAdminSubAutoStart,
+            EHtiAdminAutoStartEnable,
+            EHtiAdminAutoStartDisable,
+
+        EHtiAdminSubLogs,
+            EHtiAdminCreateLogFolder,
+            EHtiAdminRemoveLogFolder,
+            EHtiAdminClearLogs,
+
+        EHtiAdminSubPriority,
+            EHtiAdminPriorityBackground,
+            EHtiAdminPriorityForeground,
+            EHtiAdminPriorityHigh,
+            EHtiAdminPriorityAbsoluteHigh,
+
+        EHtiAdminSubWatchDog,
+            EHtiAdminWatchDogEnable,
+            EHtiAdminWatchDogDisable,
+
+        EHtiAdminSubConsole,
+            EHtiAdminConsoleEnable,
+            EHtiAdminConsoleDisable,
+
+        EHtiAdminSubErrorDialogs,
+            EHtiAdminErrorDialogsEnable,
+            EHtiAdminErrorDialogsDisable,
+
+        EHtiAdminSubSetParam,
+            EHtiAdminHtiCfg,
+            EHtiAdminHtiBtCommCfg,
+            EHtiAdminHtiSerialCommCfg,
+            EHtiAdminHtiIPCommCfg
+    };
+
+
+#endif // __HTIADMIN_HRH__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiAdmin/inc/HtiAdmin.pan	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,35 @@
+/*
+* 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:  Panics definitions for HtiAdmin
+*
+*/
+
+
+#ifndef __HTIADMIN_PAN__
+#define __HTIADMIN_PAN__
+
+/** HtiAdmin application panic codes */
+enum THtiAdminPanics
+    {
+    EHtiAdminBasicUi = 1
+    // add further panics here
+    };
+
+inline void Panic(THtiAdminPanics aReason)
+    {
+    _LIT(applicationName,"HtiAdmin");
+    User::Panic(applicationName, aReason);
+    }
+
+#endif // __HTIADMIN_PAN__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiAdmin/inc/HtiAdminAppUi.h	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,155 @@
+/*
+* 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:  AppUi class
+*
+*/
+
+
+#ifndef __HTIADMIN_APPUI_H__
+#define __HTIADMIN_APPUI_H__
+
+// INCLUDES
+#include <aknappui.h>
+
+// FORWARD DECLARATIONS
+class CHtiAdminAppView;
+class CHtiCfg;
+
+// CLASS DECLARATION
+
+/**
+* An instance of class CHtiAdminAppUi is the UserInterface part of the AVKON
+* application framework for the HtiAdmin application
+*/
+class CHtiAdminAppUi : public CAknAppUi
+    {
+    public:
+        /**
+        * Perform the second phase construction of a CHtiAdminAppUi object.
+        * This needs to be public due to the way the framework constructs the AppUi
+        */
+        void ConstructL();
+
+        /**
+        * Perform the first phase of two phase construction.
+        * This needs to be public due to the way the framework constructs the AppUi
+        */
+        CHtiAdminAppUi();
+
+
+        /**
+        * Destroy the object and release all memory objects.
+        */
+        ~CHtiAdminAppUi();
+
+        /**
+        * Tries to find the HTIFramework.exe process and open a handle to it.
+        * @param aPrs on return contains an open handle to the HTIFramework.exe
+        * process if process found and opened successfully
+        * @return ETrue if process found and opened successfully,
+        * otherwise EFalse
+        */
+        TBool OpenHtiProcess( RProcess& aPrs );
+
+        /**
+        * Updates the version text in the display.
+        */
+        void UpdateVersion();
+
+        /**
+        * Updates the HTI Framework process status in the display.
+        */
+        void UpdateStatusL();
+
+        /**
+        * Updates the HTI auto start status in the display.
+        */
+        void UpdateAutoStartStatus();
+
+        /**
+        * Updates the selected communication in the display.
+        */
+        void UpdateSelectedComm();
+
+        /**
+        * Kills the HtiWatchDog process if it is running.
+        */
+        void KillHtiWatchDogL();
+
+        /**
+        * Stops the timer issuing the periodical HTI Framework process
+        * status checks.
+        */
+        void KillTimer();
+
+        /**
+        * The method called by the periodic timer.
+        * @param aPtr pointer to this CHtiAdminAppUi instance
+        * @return zero if the callback function should not be called again,
+        * otherwise non-zero. Current implementation returns always ETrue.
+        */
+        static TInt TimerCallBackL( TAny* aPtr );
+
+    public: // from CAknAppUi
+        /**
+        * Handle user menu selections
+        * @param aCommand the enumerated code for the option selected
+        */
+        void HandleCommandL( TInt aCommand );
+
+        /**
+        * Updates the HTI Framework status information and starts the
+        * periodical status polling when application comes to foreground -
+        * stops the polling when going to background.
+        * @param aForeground ETrue if the application is in the foreground,
+        * otherwise EFalse
+        */
+        void HandleForegroundEventL( TBool aForeground );
+
+    public: // from MEikMenuObserver
+        /**
+        * Used to initialize user menu content dynamically
+        * @param aResourceId the resource id of the menu pane being initialised
+        * @param aMenuPane the in-memory representation of the menu pane
+        */
+        void DynInitMenuPaneL( TInt aResourceId, CEikMenuPane *aMenuPane );
+    
+    private:
+    	void ShowBTListQueryL();
+    	void ShowIPListQueryL();
+    	void ShowCommsListQueryL();
+    	void ShowCommsDBListQueryL();
+    	void HandleBtByAddress();
+    	void HandleBtByName();
+    	void HandleBtSearch();
+    	void HandleIPConnect();
+    	void HandleIPListen();
+    	
+    	void StartTimer();
+
+    private:
+
+        // The application view
+        CHtiAdminAppView* iAppView;
+
+        // Timer triggering periodic checking of HTIFramework process status
+        CPeriodic*        iPeriodic;
+
+        // For reading and writing HTI configuration files
+        CHtiCfg*          iHtiCfg;
+    };
+
+#endif // __HTIADMIN_APPUI_H__
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiAdmin/inc/HtiAdminAppView.h	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,110 @@
+/*
+* 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:  App view displays 2 labels.
+*
+*/
+
+
+#ifndef __HTIADMIN_APPVIEW_H__
+#define __HTIADMIN_APPVIEW_H__
+
+// INCLUDES
+#include <coecntrl.h>
+
+// CONSTANTS
+const static TInt KMaxDisplayText = 64;
+
+// CLASS DECLARATION
+/**
+    An instance of the Application View object for the HtiAdmin
+  example application
+  */
+class CHtiAdminAppView : public CCoeControl
+    {
+public:
+
+/**
+    Create a CHtiAdminAppView object, which will draw itself to aRect
+  @param aRect the rectangle this view will be drawn to
+  @return a pointer to the created instance of CHtiAdminAppView
+  */
+    static CHtiAdminAppView* NewL(const TRect& aRect);
+
+/**
+    Create a CHtiAdminAppView object, which will draw itself to aRect
+  @param aRect the rectangle this view will be drawn to
+  @return a pointer to the created instance of CHtiAdminAppView
+  */
+    static CHtiAdminAppView* NewLC(const TRect& aRect);
+
+
+/**
+    Destroy the object and release all memory objects
+  */
+     ~CHtiAdminAppView();
+
+    /**
+    Set text for the labels in the view.
+    */
+    void SetCaption( const TDesC& aText );
+    void SetStatus( const TDesC& aText );
+    void SetVersionCaption( const TDesC& aText );
+    void SetVersion( const TDesC& aText );
+    void SetAutoStartCaption( const TDesC& aText );
+    void SetAutoStartStatus( const TDesC& aText );
+    void SetSelectedCommCaption( const TDesC& aText );
+    void SetSelectedComm( const TDesC& aText );
+    void SetCommDetails( const TDesC& aText );
+
+public:  // from CCoeControl
+/**
+    Draw this CHtiAdminAppView to the screen
+  @param aRect the rectangle of this view that needs updating
+  */
+    void Draw( const TRect& aRect ) const;
+
+
+private:
+
+/**
+    Perform the second phase construction of a CHtiAdminAppView object
+  @param aRect the rectangle this view will be drawn to
+  */
+    void ConstructL( const TRect& aRect );
+
+/**
+    Perform the first phase of two phase construction
+  */
+    CHtiAdminAppView();
+
+private:
+    /**
+    text to show in the view
+    */
+    HBufC* iHtiCaption;
+    HBufC* iHtiStatus;
+    HBufC* iHtiVersionCaption;
+    HBufC* iHtiVersion;
+    HBufC* iHtiAutoStartCaption;
+    HBufC* iHtiAutoStartStatus;
+    HBufC* iHtiSelectedCommCaption;
+    HBufC* iHtiSelectedComm;
+    HBufC* iHtiCommDetails;
+    };
+
+
+#endif // __HTIADMIN_APPVIEW_H__
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiAdmin/inc/HtiAdminApplication.h	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,52 @@
+/*
+* 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:  Application class
+*
+*/
+
+
+#ifndef __HTIADMIN_APPLICATION_H__
+#define __HTIADMIN_APPLICATION_H__
+
+// INCLUDES
+
+#include <aknapp.h>
+
+// CLASS DECLARATION
+/**
+    An instance of CHtiAdminApplication is the application part of the AVKON
+  application framework for the HtiAdmin example application
+  */
+class CHtiAdminApplication : public CAknApplication
+    {
+public:  // from CAknApplication
+
+/**
+    Returns the application DLL UID value
+  @return the UID of this Application/Dll
+  */
+    TUid AppDllUid() const;
+
+protected: // from CAknApplication
+/**
+    Create a CApaDocument object and return a pointer to it
+  @return a pointer to the created document
+  */
+    CApaDocument* CreateDocumentL();
+    };
+
+#endif // __HTIADMIN_APPLICATION_H__
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiAdmin/inc/HtiAdminDocument.h	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,87 @@
+/*
+* 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:  Document class
+*
+*/
+
+
+#ifndef __HTIADMIN_DOCUMENT_H__
+#define __HTIADMIN_DOCUMENT_H__
+
+// INCLUDES
+#include <AknDoc.h>
+
+// FORWARD DECLARATIONS
+class CHtiAdminAppUi;
+class CEikApplication;
+
+// CLASS DECLARATION
+/**
+  An instance of class CHtiAdminDocument is the Document part of the AVKON
+  application framework for the HtiAdmin example application
+  */
+class CHtiAdminDocument : public CAknDocument
+    {
+public:
+
+/**
+    Construct a CHtiAdminDocument for the AVKON application aApp
+  using two phase construction, and return a pointer to the created object
+
+  @param aApp application creating this document
+  @return a pointer to the created instance of CHtiAdminDocument
+  */
+    static CHtiAdminDocument* NewL(CEikApplication& aApp);
+
+/**
+    Construct a CHtiAdminDocument for the AVKON application aApp
+  using two phase construction, and return a pointer to the created object
+  @param aApp application creating this document
+
+  @return a pointer to the created instance of CHtiAdminDocument
+  */
+    static CHtiAdminDocument* NewLC(CEikApplication& aApp);
+
+/**
+Destroy the object and release all memory objects
+  */
+    ~CHtiAdminDocument();
+
+public: // from CAknDocument
+/**
+    Create a CHtiAdminAppUi object and return a pointer to it
+  @return a pointer to the created instance of the AppUi created
+  */
+    CEikAppUi* CreateAppUiL();
+
+private:
+
+/**
+    Perform the second phase construction of a CHtiAdminDocument object
+  */
+    void ConstructL();
+
+/**
+    Perform the first phase of two phase construction
+  @param aApp application creating this document
+  */
+    CHtiAdminDocument(CEikApplication& aApp);
+
+    };
+
+
+#endif // __HTIADMIN_DOCUMENT_H__
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiAdmin/src/HtiAdmin.cpp	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,33 @@
+/*
+* 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 HtiAdmin main.
+*
+*/
+
+
+#include "HtiAdminApplication.h"
+#include <eikstart.h>
+
+
+LOCAL_C CApaApplication* NewApplication()
+    {
+    //HTI_LOG_TEXT("NewApplication");
+    return new CHtiAdminApplication;
+    }
+
+GLDEF_C TInt E32Main()
+    {
+    //HTI_LOG_TEXT("E32Main");
+    return EikStart::RunApplication(NewApplication);
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiAdmin/src/HtiAdminAppUi.cpp	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,1143 @@
+/*
+* 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:  AppUi implementation, all functions here
+*
+*/
+
+// INCLUDE FILES
+#include <avkon.hrh>
+#include <aknnotewrappers.h>
+#include <AknQueryDialog.h>
+#include <aknmessagequerydialog.h>
+#include <w32std.h>
+#include <eikmenup.h>
+#include <commdb.h>
+
+#include <HtiAdmin.rsg>
+#include <HtiCommPluginInterface.h> // for KHTICommInterfaceUid
+#include <HtiCfg.h>
+#include <HtiVersion.h>
+
+#include "HtiAdmin.pan"
+#include "HtiAdminAppUi.h"
+#include "HtiAdminAppView.h"
+#include "HtiAdmin.hrh"
+
+
+#ifdef __ENABLE_LOGGING__
+
+#include <flogger.h>
+
+_LIT(KLogFolder, "hti");
+_LIT(KLogFile, "htiadmin.txt");
+#define HTI_LOG_TEXT(a1) {_LIT(temp, a1); RFileLogger::Write(KLogFolder, KLogFile, EFileLoggingModeAppend, temp);}
+#define HTI_LOG_FORMAT(a1,a2) {_LIT(temp, a1); RFileLogger::WriteFormat(KLogFolder, KLogFile, EFileLoggingModeAppend, temp, (a2));}
+#define HTI_LOG_DES(a1) {RFileLogger::Write(KLogFolder, KLogFile, EFileLoggingModeAppend, (a1));}
+
+#else // __ENABLE_LOGGING__
+
+#define HTI_LOG_TEXT(a1)
+#define HTI_LOG_FORMAT(a1,a2)
+#define HTI_LOG_DES(a1)
+
+#endif // __ENABLE_LOGGING__
+
+// CONSTANTS
+_LIT( KHtiWatchDogMatchPattern, "HtiWatchDog*" );
+_LIT( KHtiFrameworkExe, "HtiFramework.exe" );
+_LIT( KHtiMatchPattern, "HtiFramework*" );
+_LIT( KHtiFrameworkCaption, "HTI status: " );
+_LIT( KHtiAutoStartCaption, "AutoStart: " );
+_LIT( KHtiVersionCaption, "Version: " );
+_LIT( KHtiSelectedCommCaption, "Communication: " );
+_LIT( KHtiAdminStartParameter, "admin" );
+_LIT( KHtiAdminVersionFormat, "%u.%u.%u (%uwk%02u)" );
+_LIT( KHtiAdminAboutVersionFormat, "Version %u.%u.%u - " );
+const static TInt KTerminateReason = 1;
+
+
+const TInt32 KHTIImplUidSerial    = {0x10210CCA};
+const TInt32 KHTIImplUidBluetooth = {0x200212CC};
+const TInt32 KHTIImplUidIPComm    = {0x200212CE};
+
+// configuration file constants
+_LIT( KCfgFilePath,         "\\");
+_LIT( KHtiCfg,              "hti.cfg" );
+_LIT( KHtiBtCommCfg,        "HTIBtComm.cfg" );
+_LIT( KHtiSerialCommCfg ,   "HTISerialComm.cfg" );
+_LIT( KHtiIPCommCfg,        "HTIIPComm.cfg" );
+// hti.cfg
+_LIT8( KCommPlugin,         "CommPlugin" );
+_LIT8( KPriority,           "Priority" );
+_LIT8( KShowConsole,        "ShowConsole" );
+_LIT8( KEnableHtiWatchDog,  "EnableHtiWatchDog" );
+_LIT8( KEnableHtiAutoStart, "EnableHtiAutoStart" );
+_LIT8( KShowErrorDialogs,   "ShowErrorDialogs" );
+// HtiBtComm.cfg
+_LIT8( KBtDeviceAddress,    "BtDeviceAddress" );
+_LIT8( KBtDeviceName,       "BtDeviceName" );
+// HtiSerialComm.cfg
+_LIT8( KCommPortNumber,     "CommPort" );
+// HTIIPComm.cfg
+_LIT8( KLocalPort,          "LocalPort" );
+_LIT8( KRemoteHost,         "RemoteHost" );
+_LIT8( KRemotePort,         "RemotePort" );
+_LIT8( KIAPName,            "IAPName" );
+
+
+// ConstructL is called by the application framework
+void CHtiAdminAppUi::ConstructL()
+    {
+    BaseConstructL( EAknEnableSkin );
+    iAppView = CHtiAdminAppView::NewL( ClientRect() );
+    AddToStackL( iAppView );
+
+    iAppView->SetCaption( KHtiFrameworkCaption );
+    iAppView->SetVersionCaption( KHtiVersionCaption );
+    iAppView->SetAutoStartCaption( KHtiAutoStartCaption );
+    iAppView->SetSelectedCommCaption( KHtiSelectedCommCaption );
+    UpdateVersion();
+    UpdateStatusL();
+    StartTimer();
+    iHtiCfg = CHtiCfg::NewL();
+    UpdateAutoStartStatus(); // uses iHtiCfg
+    UpdateSelectedComm(); // uses iHtiCfg
+    }
+
+CHtiAdminAppUi::CHtiAdminAppUi()
+    {
+    iHtiCfg = NULL;
+    }
+
+CHtiAdminAppUi::~CHtiAdminAppUi()
+    {
+    KillTimer();
+    if ( iAppView )
+        {
+        RemoveFromStack( iAppView );
+        delete iAppView;
+        iAppView = NULL;
+        }
+
+    if ( iHtiCfg )
+        delete iHtiCfg;
+    }
+
+void CHtiAdminAppUi::DynInitMenuPaneL(TInt aResourceId, CEikMenuPane *aMenuPane)
+    {
+    HTI_LOG_FORMAT( "DynInitMenuPaneL 0x%x", aResourceId );
+
+    if ( aResourceId == R_HTIADMIN_MENU )
+        {
+        RProcess prs;
+        if ( OpenHtiProcess( prs ) )
+            {
+            if ( prs.ExitType() == EExitPending )
+                {
+                aMenuPane->SetItemDimmed( EHtiAdminStart, ETrue );
+                aMenuPane->SetItemDimmed( EHtiAdminSubOptions, ETrue );
+                prs.Close();
+                return;
+                }
+            }
+        aMenuPane->SetItemDimmed( EHtiAdminStop, ETrue );
+        prs.Close();
+        }
+
+    else if ( aResourceId == R_HTIADMIN_SUBMENU_OPTIONS )
+        {
+#if !defined(__ENABLE_LOGGING__)
+        aMenuPane->SetItemDimmed( EHtiAdminSubLogs, ETrue );
+#endif
+        }
+    else if ( aResourceId == R_HTIADMIN_SUBMENU_PRIORITY )
+        {
+        TInt priority = 3; // default value
+        TRAPD( err, iHtiCfg->LoadCfgL( KCfgFilePath, KHtiCfg ) );
+        if ( !err )
+            {
+            TRAP( err, priority = iHtiCfg->GetParameterIntL( KPriority ) );
+            }
+
+        switch ( priority )
+            {
+            case 1:
+                aMenuPane->SetItemButtonState( EHtiAdminPriorityBackground, EEikMenuItemSymbolOn );
+                break;
+            case 2:
+                aMenuPane->SetItemButtonState( EHtiAdminPriorityForeground, EEikMenuItemSymbolOn );
+                break;
+            case 4:
+                aMenuPane->SetItemButtonState( EHtiAdminPriorityAbsoluteHigh, EEikMenuItemSymbolOn );
+                break;
+            default:
+                aMenuPane->SetItemButtonState( EHtiAdminPriorityHigh, EEikMenuItemSymbolOn );
+                break;
+            }
+        }
+
+    else if ( aResourceId == R_HTIADMIN_SUBMENU_AUTOSTART )
+        {
+#ifdef __WINS__
+        TInt value = 0; // default value for emulator
+#else
+        TInt value = 1; // default value for hardware
+#endif
+        TRAPD( err, iHtiCfg->LoadCfgL( KCfgFilePath, KHtiCfg ) );
+        if ( !err )
+            {
+            TRAP( err, value = iHtiCfg->GetParameterIntL( KEnableHtiAutoStart ) );
+            }
+
+        if ( value )
+            aMenuPane->SetItemButtonState( EHtiAdminAutoStartEnable, EEikMenuItemSymbolOn );
+        else
+            aMenuPane->SetItemButtonState( EHtiAdminAutoStartDisable, EEikMenuItemSymbolOn );
+        }
+
+    else if ( aResourceId == R_HTIADMIN_SUBMENU_WATCHDOG )
+        {
+        TInt value = 0; // default value
+        TRAPD( err, iHtiCfg->LoadCfgL( KCfgFilePath, KHtiCfg ) );
+        if ( !err )
+            {
+            TRAP( err, value = iHtiCfg->GetParameterIntL( KEnableHtiWatchDog ) );
+            }
+
+        if ( value )
+            aMenuPane->SetItemButtonState( EHtiAdminWatchDogEnable, EEikMenuItemSymbolOn );
+        else
+            aMenuPane->SetItemButtonState( EHtiAdminWatchDogDisable, EEikMenuItemSymbolOn );
+        }
+
+    else if ( aResourceId == R_HTIADMIN_SUBMENU_CONSOLE )
+        {
+        TInt value = 0; // default value
+        TRAPD( err, iHtiCfg->LoadCfgL( KCfgFilePath, KHtiCfg ) );
+        if ( !err )
+            {
+            TRAP( err, value = iHtiCfg->GetParameterIntL( KShowConsole ) );
+            }
+
+        if ( value )
+            aMenuPane->SetItemButtonState( EHtiAdminConsoleEnable, EEikMenuItemSymbolOn );
+        else
+            aMenuPane->SetItemButtonState( EHtiAdminConsoleDisable, EEikMenuItemSymbolOn );
+        }
+
+    else if ( aResourceId == R_HTIADMIN_SUBMENU_ERROR_DIALOGS )
+        {
+        TInt value = 1; // default value
+        TRAPD( err, iHtiCfg->LoadCfgL( KCfgFilePath, KHtiCfg ) );
+        if ( !err )
+            {
+            TRAP( err, value = iHtiCfg->GetParameterIntL( KShowErrorDialogs ) );
+            }
+
+        if ( value )
+            aMenuPane->SetItemButtonState( EHtiAdminErrorDialogsEnable, EEikMenuItemSymbolOn );
+        else
+            aMenuPane->SetItemButtonState( EHtiAdminErrorDialogsDisable, EEikMenuItemSymbolOn );
+        }
+    }
+
+
+// Helper function to get data from a dialog
+TInt ShowDialog(TInt aResourceId, const TDesC &aText, TDes8 &aValue)
+    {
+    TBuf<KMaxParameterValueLength> data;
+
+    CAknTextQueryDialog* dlg;
+    dlg = new (ELeave) CAknTextQueryDialog(data);
+    CleanupStack::PushL(dlg);
+    dlg->SetPromptL(aText);
+    dlg->SetMaxLength(KMaxParameterValueLength);
+    CleanupStack::Pop(); // dlg
+
+    if ( dlg->ExecuteLD( aResourceId ) )
+        {
+        aValue.Copy(data);
+        return KErrNone;
+        }
+
+    return KErrCancel;
+    }
+
+void CHtiAdminAppUi::ShowBTListQueryL()
+	{
+	TInt selectedOption( KErrNotFound );
+	        	 
+	CDesCArrayFlat* array = new (ELeave) CDesCArrayFlat(20);
+	CleanupStack::PushL(array);
+	
+	array->AppendL(_L("By BT address"));
+	array->AppendL(_L("By BT Name"));
+	array->AppendL(_L("Search when starting"));
+				 
+	CAknListQueryDialog* dlg = new(ELeave) CAknListQueryDialog( &selectedOption );
+	dlg->PrepareLC(R_QUERY_DIALOG);
+	dlg->SetItemTextArray(array);
+	dlg->SetOwnershipType(ELbmDoesNotOwnItemArray);
+	dlg->RunLD();
+	
+	CleanupStack::PopAndDestroy(array); 
+	
+	if(selectedOption == 0)
+		{
+		HandleBtByAddress();
+		}
+	else if(selectedOption == 1)
+		{
+		HandleBtByName();
+		}
+	else if (selectedOption == 2)
+		{
+		HandleBtSearch();
+		}
+	}
+
+void CHtiAdminAppUi::ShowIPListQueryL()
+	{
+	TInt selectedOption( KErrNotFound );
+	        	 
+	CDesCArrayFlat* array = new (ELeave) CDesCArrayFlat(10);
+	CleanupStack::PushL(array);
+	
+	array->AppendL(_L("Listen"));
+	array->AppendL(_L("Connect"));
+	
+	CAknListQueryDialog* dlg = new(ELeave) CAknListQueryDialog( &selectedOption );
+	dlg->PrepareLC(R_QUERY_DIALOG);
+	dlg->SetItemTextArray(array);
+	dlg->SetOwnershipType(ELbmDoesNotOwnItemArray);
+	dlg->RunLD();
+	
+	CleanupStack::PopAndDestroy(array); 
+	
+	if(selectedOption == 0)
+		{
+		HandleIPListen();
+		}
+	else if(selectedOption == 1)
+		{
+		HandleIPConnect();
+		}
+	}
+
+void CleanupRArray( TAny* object )
+    {
+    ( ( RImplInfoPtrArray* ) object )->ResetAndDestroy();
+    }
+
+void CHtiAdminAppUi::ShowCommsListQueryL()
+	{
+	TInt selectedOption( KErrNotFound );
+	        	 
+	const TInt pluginNameArrayGranularity (15);
+	CDesCArrayFlat* pluginNameArray = new (ELeave) CDesCArrayFlat(pluginNameArrayGranularity);
+	CleanupStack::PushL(pluginNameArray);
+		
+	RImplInfoPtrArray implInfoArray;
+	CleanupStack::PushL( TCleanupItem( CleanupRArray, &implInfoArray ) );
+	
+	REComSession::ListImplementationsL( KHTICommInterfaceUid, implInfoArray );
+
+	for ( TInt i = 0; i < implInfoArray.Count(); ++i )
+		{
+		pluginNameArray->AppendL(implInfoArray[i]->DisplayName());
+		}
+	
+	CAknListQueryDialog* dlg = new(ELeave) CAknListQueryDialog( &selectedOption );
+	
+	dlg->PrepareLC(R_QUERY_DIALOG);
+	dlg->SetHeaderTextL(_L("Select communication"));
+	dlg->SetItemTextArray(pluginNameArray);
+	dlg->SetOwnershipType(ELbmDoesNotOwnItemArray);
+	
+	if(dlg->RunLD())
+		{
+		TInt32 uid = implInfoArray[selectedOption]->ImplementationUid().iUid;
+		switch(uid)
+			{
+			case KHTIImplUidSerial:  
+				{
+				TRAP_IGNORE( iHtiCfg->LoadCfgL( KCfgFilePath, KHtiCfg ) );
+				iHtiCfg->SetParameterL( KCommPlugin, _L8( "SERIAL" ) );
+				iHtiCfg->SaveCfgL( KCfgFilePath, KHtiCfg );
+
+				TBuf8<KMaxParameterValueLength> portNum;
+				if ( !ShowDialog( R_NUMERIC_QUERY, _L("Com port number:"), portNum ) )
+					{
+					TRAP_IGNORE( iHtiCfg->LoadCfgL( KCfgFilePath, KHtiSerialCommCfg ) );
+					iHtiCfg->SetParameterL( KCommPortNumber, portNum );
+					iHtiCfg->SaveCfgL( KCfgFilePath, KHtiSerialCommCfg );
+					}
+				UpdateSelectedComm();
+				}
+				break;
+				
+			case KHTIImplUidBluetooth:  
+				{
+				ShowBTListQueryL();				
+				}
+				break;
+				
+			case KHTIImplUidIPComm:  
+				{
+				ShowIPListQueryL();
+				}
+				break;
+			default:
+				{
+				//Just save the conf info for other plugins
+				TRAP_IGNORE( iHtiCfg->LoadCfgL( KCfgFilePath, KHtiCfg ) );
+				iHtiCfg->SetParameterL( KCommPlugin, implInfoArray[selectedOption]->DataType() );
+				iHtiCfg->SaveCfgL( KCfgFilePath, KHtiCfg );
+				UpdateSelectedComm();
+				}
+			}
+		}
+	CleanupStack::PopAndDestroy(2, pluginNameArray);  
+	}
+
+void CHtiAdminAppUi::HandleBtByAddress()
+	{
+	TRAP_IGNORE( iHtiCfg->LoadCfgL( KCfgFilePath,  KHtiCfg ) );
+	iHtiCfg->SetParameterL( KCommPlugin, _L8( "BTSERIAL" ) );
+	iHtiCfg->SaveCfgL( KCfgFilePath, KHtiCfg );
+
+	TRAP_IGNORE( iHtiCfg->LoadCfgL( KCfgFilePath, KHtiBtCommCfg ) );
+	iHtiCfg->RemoveParameterL( KBtDeviceName );
+	iHtiCfg->RemoveParameterL( KBtDeviceAddress );
+
+	TBuf8<KMaxParameterValueLength> address;
+	if ( !ShowDialog( R_TEXT_QUERY, _L("BT address:"), address) )
+		{
+		iHtiCfg->SetParameterL( KBtDeviceAddress, address);
+		}
+
+	iHtiCfg->SaveCfgL( KCfgFilePath, KHtiBtCommCfg);
+	UpdateSelectedComm();
+	}
+
+void CHtiAdminAppUi::HandleBtByName()
+	{
+	TRAP_IGNORE( iHtiCfg->LoadCfgL( KCfgFilePath, KHtiCfg ) );
+	iHtiCfg->SetParameterL( KCommPlugin, _L8( "BTSERIAL" ) );
+	iHtiCfg->SaveCfgL( KCfgFilePath, KHtiCfg );
+
+	TRAP_IGNORE( iHtiCfg->LoadCfgL( KCfgFilePath, KHtiBtCommCfg ) );
+	iHtiCfg->RemoveParameterL( KBtDeviceName );
+	iHtiCfg->RemoveParameterL( KBtDeviceAddress );
+
+	TBuf8<KMaxParameterValueLength> name;
+	if ( !ShowDialog( R_TEXT_QUERY, _L( "BT name:" ), name ) )
+		{
+		iHtiCfg->SetParameterL( KBtDeviceName, name );
+		}
+
+	iHtiCfg->SaveCfgL( KCfgFilePath, KHtiBtCommCfg );
+	UpdateSelectedComm();
+	}
+
+void CHtiAdminAppUi::HandleBtSearch()
+	{
+	TRAP_IGNORE( iHtiCfg->LoadCfgL( KCfgFilePath, KHtiCfg ) );
+	iHtiCfg->SetParameterL( KCommPlugin, _L8( "BTSERIAL" ) );
+	iHtiCfg->SaveCfgL( KCfgFilePath, KHtiCfg );
+
+	TRAP_IGNORE( iHtiCfg->LoadCfgL( KCfgFilePath, KHtiBtCommCfg ) );
+	iHtiCfg->RemoveParameterL( KBtDeviceName );
+	iHtiCfg->RemoveParameterL( KBtDeviceAddress );
+	iHtiCfg->SaveCfgL( KCfgFilePath, KHtiBtCommCfg );
+	UpdateSelectedComm();
+	}
+
+void CHtiAdminAppUi::HandleIPListen()
+	{
+	TRAP_IGNORE( iHtiCfg->LoadCfgL( KCfgFilePath, KHtiCfg ) );
+	iHtiCfg->SetParameterL( KCommPlugin, _L8("IPCOMM"));
+	iHtiCfg->SaveCfgL( KCfgFilePath, KHtiCfg );
+
+	TRAP_IGNORE( iHtiCfg->LoadCfgL( KCfgFilePath, KHtiIPCommCfg ) );
+	iHtiCfg->RemoveParameterL( KRemotePort );
+	iHtiCfg->RemoveParameterL( KRemoteHost );
+	
+	TBuf8<KMaxParameterValueLength> localPort;
+	if ( !ShowDialog( R_TEXT_QUERY, _L( "Local port:" ), localPort ) )
+		{
+		iHtiCfg->SetParameterL( KLocalPort, localPort );
+		ShowCommsDBListQueryL();
+		}
+	iHtiCfg->SaveCfgL( KCfgFilePath, KHtiIPCommCfg );
+	UpdateSelectedComm();
+	}
+	
+void CHtiAdminAppUi::HandleIPConnect()
+	{
+	TRAP_IGNORE( iHtiCfg->LoadCfgL( KCfgFilePath, KHtiCfg ) );
+	iHtiCfg->SetParameterL( KCommPlugin, _L8( "IPCOMM" ) );
+	iHtiCfg->SaveCfgL( KCfgFilePath, KHtiCfg );
+
+	TRAP_IGNORE( iHtiCfg->LoadCfgL( KCfgFilePath, KHtiIPCommCfg ) );
+	iHtiCfg->RemoveParameterL( KLocalPort );
+	TBuf8<KMaxParameterValueLength> remoteHost;
+	TBuf8<KMaxParameterValueLength> remotePort;
+	if ( !ShowDialog( R_TEXT_QUERY, _L("Remote host:"), remoteHost ) )
+		{
+		iHtiCfg->SetParameterL( KRemoteHost, remoteHost );
+		if ( !ShowDialog( R_TEXT_QUERY, _L( "Remote port:" ), remotePort ) )
+			{
+			iHtiCfg->SetParameterL( KRemotePort, remotePort );
+			ShowCommsDBListQueryL();
+			}
+		}
+	iHtiCfg->SaveCfgL( KCfgFilePath, KHtiIPCommCfg );
+	UpdateSelectedComm();
+	}
+	
+
+// handle any menu commands
+void CHtiAdminAppUi::HandleCommandL(TInt aCommand)
+    {
+    TFileName cfgFile;
+
+    switch ( aCommand )
+        {
+        case EEikCmdExit:
+        case EAknSoftkeyExit:
+            Exit();
+            break;
+
+        case EHtiAdminStart:
+            {
+            HTI_LOG_TEXT( "Start" );
+            RProcess prs;
+            TInt err;
+            TBool isRunning = EFalse;
+            if ( OpenHtiProcess( prs ) )
+                {
+                if ( prs.ExitType() == EExitPending )
+                    {
+                    isRunning = ETrue;
+                    _LIT(KText, "Already running");
+                    iAppView->SetStatus( KText );
+                    }
+                prs.Close();
+                }
+
+            if ( !isRunning )
+                {
+                HTI_LOG_TEXT( "create process" );
+                err = prs.Create( KHtiFrameworkExe, KHtiAdminStartParameter );
+                if ( err == KErrNone )
+                    {
+                    prs.Resume();
+                    prs.Close();
+                    UpdateStatusL();
+                    HTI_LOG_TEXT("create done");
+                    }
+                else
+                    {
+                    TBuf<64> msg;
+                    msg.Format( _L("Error in starting: %d"), err );
+                    iAppView->SetStatus( msg );
+                    HTI_LOG_TEXT("create error");
+                    }
+                }
+            }
+            break;
+
+        case EHtiAdminStop:
+            {
+            HTI_LOG_TEXT("Stop");
+
+            // kill the watchdog to prevent it from restarting HTI again
+            KillHtiWatchDogL();
+
+            RProcess prs;
+            if ( OpenHtiProcess( prs ) )
+                {
+                if ( prs.ExitType() == EExitPending )
+                    {
+                    HTI_LOG_TEXT("try to kill");
+                    prs.Kill( KTerminateReason );
+                    UpdateStatusL();
+                    }
+                else
+                    {
+                    _LIT(KText, "Already stopped");
+                    iAppView->SetStatus( KText );
+                    }
+                prs.Close();
+                }
+            }
+            break;
+
+        case EHtiAdminAbout:
+            {
+            HTI_LOG_TEXT("About");
+            TDateSuffix suffix( KHtiVersionDay - 1 );
+            TMonthName month( ( TMonth ) ( KHtiVersionMonth - 1 ) );
+            TBuf<64> msgPart1;
+            msgPart1.Format( KHtiAdminAboutVersionFormat,
+                    KHtiVersionMajor, KHtiVersionMinor, KHtiVersionBuild );
+            msgPart1.AppendNum( KHtiVersionDay );
+            msgPart1.Append( suffix );
+            msgPart1.Append( ' ' );
+            msgPart1.Append( month );
+            msgPart1.Append( ' ' );
+            msgPart1.AppendNum( KHtiVersionYear );
+            msgPart1.Append( '.' );
+            msgPart1.Append( ' ' );
+            HBufC* msgPart2 = iEikonEnv->AllocReadResourceLC( R_HTIADMIN_ABOUT_TEXT );
+            HBufC* fullMsg = HBufC::NewLC( msgPart1.Length() + msgPart2->Length() );
+            fullMsg->Des().Append( msgPart1 );
+            fullMsg->Des().Append( *msgPart2 );
+            CAknMessageQueryDialog* dialog = new ( ELeave ) CAknMessageQueryDialog;
+            dialog->PrepareLC( R_HTIADMIN_ABOUT_DIALOG );
+            dialog->SetMessageTextL( *fullMsg );
+            dialog->RunLD();
+            CleanupStack::PopAndDestroy( 2 ); // fullMsg, msgPart2
+            }
+            break;
+
+        case EHtiAdminSubOptions:
+            break;
+
+        case EHtiAdminSubLogs:
+            break;
+
+        case EHtiAdminCreateLogFolder:
+#ifdef __ENABLE_LOGGING__
+            {
+            TInt err = KErrNone;
+            RFs fs;
+            err = fs.Connect();
+            if ( err == KErrNone )
+                {
+                err = fs.MkDirAll(_L("c:\\logs\\hti\\"));
+                }
+            fs.Close();
+            }
+#endif
+            break;
+
+        case EHtiAdminRemoveLogFolder:
+#ifdef __ENABLE_LOGGING__
+            {
+            TInt err = KErrNone;
+            RFs fs;
+            err = fs.Connect();
+            if ( err == KErrNone )
+                {
+                CFileMan *fileman = CFileMan::NewL( fs );
+                fileman->RmDir( _L( "c:\\logs\\hti\\" ) );
+                delete fileman;
+                }
+            fs.Close();
+            }
+#endif
+            break;
+
+        case EHtiAdminClearLogs:
+#ifdef __ENABLE_LOGGING__
+            {
+            TInt err = KErrNone;
+            RFs fs;
+            err = fs.Connect();
+            if ( err == KErrNone )
+                {
+                CFileMan *fileman = CFileMan::NewL( fs );
+                fileman->Delete( _L( "c:\\logs\\hti\\*" ) );
+                fileman->Delete( _L( "c:\\HTI_*.log" ) );
+                delete fileman;
+                }
+            fs.Close();
+            }
+#endif
+            break;
+
+        case EHtiAdminSubComms:
+        	{
+        	ShowCommsListQueryL();
+        	}
+            break;
+
+        case EHtiAdminSubPriority:
+            break;
+
+        case EHtiAdminPriorityBackground:
+            TRAP_IGNORE( iHtiCfg->LoadCfgL( KCfgFilePath, KHtiCfg ) );
+            iHtiCfg->SetParameterL( KPriority, _L8("1"));
+            iHtiCfg->SaveCfgL( KCfgFilePath, KHtiCfg );
+            break;
+
+        case EHtiAdminPriorityForeground:
+            TRAP_IGNORE( iHtiCfg->LoadCfgL( KCfgFilePath, KHtiCfg ) );
+            iHtiCfg->SetParameterL( KPriority, _L8("2"));
+            iHtiCfg->SaveCfgL( KCfgFilePath, KHtiCfg );
+            break;
+
+        case EHtiAdminPriorityHigh:
+            TRAP_IGNORE( iHtiCfg->LoadCfgL( KCfgFilePath, KHtiCfg ) );
+            iHtiCfg->SetParameterL( KPriority, _L8("3"));
+            iHtiCfg->SaveCfgL( KCfgFilePath, KHtiCfg );
+            break;
+
+        case EHtiAdminPriorityAbsoluteHigh:
+            TRAP_IGNORE( iHtiCfg->LoadCfgL( KCfgFilePath, KHtiCfg ) );
+            iHtiCfg->SetParameterL( KPriority, _L8("4"));
+            iHtiCfg->SaveCfgL( KCfgFilePath, KHtiCfg );
+            break;
+
+        case EHtiAdminSubAutoStart:
+            break;
+
+        case EHtiAdminAutoStartEnable:
+            TRAP_IGNORE( iHtiCfg->LoadCfgL( KCfgFilePath, KHtiCfg ) );
+            iHtiCfg->SetParameterL( KEnableHtiAutoStart, _L8("1"));
+            iHtiCfg->SaveCfgL( KCfgFilePath, KHtiCfg );
+            UpdateAutoStartStatus();
+            break;
+
+        case EHtiAdminAutoStartDisable:
+            TRAP_IGNORE( iHtiCfg->LoadCfgL( KCfgFilePath, KHtiCfg ) );
+            iHtiCfg->SetParameterL( KEnableHtiAutoStart, _L8("0"));
+            iHtiCfg->SaveCfgL( KCfgFilePath, KHtiCfg );
+            UpdateAutoStartStatus();
+            break;
+
+        case EHtiAdminSubWatchDog:
+            break;
+
+        case EHtiAdminWatchDogEnable:
+            TRAP_IGNORE( iHtiCfg->LoadCfgL( KCfgFilePath, KHtiCfg ) );
+            iHtiCfg->SetParameterL( KEnableHtiWatchDog, _L8("1"));
+            iHtiCfg->SaveCfgL( KCfgFilePath, KHtiCfg );
+            break;
+
+        case EHtiAdminWatchDogDisable:
+            TRAP_IGNORE( iHtiCfg->LoadCfgL( KCfgFilePath, KHtiCfg ) );
+            iHtiCfg->SetParameterL( KEnableHtiWatchDog, _L8("0"));
+            iHtiCfg->SaveCfgL( KCfgFilePath, KHtiCfg );
+            break;
+
+        case EHtiAdminSubConsole:
+            break;
+
+        case EHtiAdminConsoleEnable:
+            TRAP_IGNORE( iHtiCfg->LoadCfgL( KCfgFilePath, KHtiCfg ) );
+            iHtiCfg->SetParameterL( KShowConsole, _L8("1"));
+            iHtiCfg->SaveCfgL( KCfgFilePath, KHtiCfg );
+            break;
+
+        case EHtiAdminConsoleDisable:
+            TRAP_IGNORE( iHtiCfg->LoadCfgL( KCfgFilePath, KHtiCfg ) );
+            iHtiCfg->SetParameterL( KShowConsole, _L8("0"));
+            iHtiCfg->SaveCfgL( KCfgFilePath, KHtiCfg );
+            break;
+
+        case EHtiAdminErrorDialogsEnable:
+            TRAP_IGNORE( iHtiCfg->LoadCfgL( KCfgFilePath, KHtiCfg ) );
+            iHtiCfg->SetParameterL( KShowErrorDialogs, _L8("1"));
+            iHtiCfg->SaveCfgL( KCfgFilePath, KHtiCfg );
+            break;
+
+        case EHtiAdminErrorDialogsDisable:
+            TRAP_IGNORE( iHtiCfg->LoadCfgL( KCfgFilePath, KHtiCfg ) );
+            iHtiCfg->SetParameterL( KShowErrorDialogs, _L8("0"));
+            iHtiCfg->SaveCfgL( KCfgFilePath, KHtiCfg );
+            break;
+
+        case EHtiAdminSubSetParam:
+            break;
+
+        case EHtiAdminHtiCfg:
+            cfgFile = KHtiCfg;
+
+        case EHtiAdminHtiBtCommCfg:
+            if ( !cfgFile.Length() )
+                cfgFile = KHtiBtCommCfg;
+
+        case EHtiAdminHtiIPCommCfg:
+            if ( !cfgFile.Length() )
+                cfgFile = KHtiIPCommCfg;
+
+        case EHtiAdminHtiSerialCommCfg:
+            {
+            if ( !cfgFile.Length() )
+                cfgFile = KHtiSerialCommCfg;
+
+            TBuf8<KMaxParameterNameLength> parameterName;
+            if ( !ShowDialog( R_TEXT_QUERY, _L("Parameter name:"), parameterName) )
+                {
+                TBuf8<KMaxParameterValueLength> parameterValue;
+                if ( !ShowDialog( R_TEXT_QUERY, _L("Parameter value:"), parameterValue ) )
+                    {
+                    TRAP_IGNORE( iHtiCfg->LoadCfgL( KCfgFilePath, cfgFile ) );
+                    iHtiCfg->SetParameterL( parameterName, parameterValue );
+                    iHtiCfg->SaveCfgL( KCfgFilePath, cfgFile);
+                    }
+                }
+            }
+            break;
+
+        default:
+        	{
+			CAknErrorNote* dialog = new(ELeave)CAknErrorNote(ETrue);			 
+			dialog->ExecuteLD(_L("Unknown Command Recieved"));
+			}
+        	break;
+        }
+    }
+
+void CHtiAdminAppUi::HandleForegroundEventL( TBool aForeground )
+    {
+    CAknAppUi::HandleForegroundEventL( aForeground );
+
+    if ( aForeground )
+        {
+        UpdateStatusL();
+        UpdateAutoStartStatus();
+        StartTimer();
+        }
+    else
+        {
+        KillTimer();
+        }
+    }
+
+TBool CHtiAdminAppUi::OpenHtiProcess( RProcess& aPrs )
+    {
+    HTI_LOG_TEXT( "OpenHtiProcess" );
+
+    TFullName processName;
+    TInt err;
+
+    TFindProcess finder( KHtiMatchPattern );
+    err = finder.Next( processName );
+    if ( err == KErrNone )
+        {
+        HTI_LOG_TEXT( "try to open..." );
+        err = aPrs.Open( finder );
+        HTI_LOG_TEXT( "opened" );
+
+        if ( err == KErrNone )
+            {
+            HTI_LOG_TEXT( "OpenHtiProcess OK" );
+            return ETrue;
+            }
+        else
+            {
+            HTI_LOG_TEXT( "Failed to open process" );
+            TBuf<64> msg;
+            msg.Format( _L( "Error: %d" ), err );
+            iAppView->SetStatus( msg );
+            }
+        }
+    else if ( err == KErrNotFound )
+        {
+        HTI_LOG_TEXT( "Not found" );
+        _LIT( KNotFound, "Stopped" );
+        iAppView->SetStatus( KNotFound );
+        }
+    else
+        {
+        TBuf<64> msg;
+        msg.Format( _L( "Error: %d" ), err );
+        iAppView->SetStatus( msg );
+        }
+
+    HTI_LOG_TEXT( "OpenHtiProcess NOK" );
+
+    return EFalse;
+    }
+
+
+void CHtiAdminAppUi::UpdateVersion()
+    {
+    HTI_LOG_TEXT( "UpdateVersion" );
+    TBuf<128> tmp;
+    tmp.Format( KHtiAdminVersionFormat, KHtiVersionMajor, KHtiVersionMinor,
+        KHtiVersionBuild, KHtiVersionYear, KHtiVersionWeek );
+     iAppView->SetVersion( tmp );
+    }
+
+
+void CHtiAdminAppUi::UpdateStatusL()
+    {
+    HTI_LOG_TEXT( "UpdateStatusL" );
+    RProcess prs;
+    if ( OpenHtiProcess( prs ) )
+        {
+        HTI_LOG_TEXT( "Update display" );
+        TExitType exT = prs.ExitType();
+
+        switch ( exT )
+            {
+            case EExitPending:
+                {
+                _LIT( KTxt, "Running" );
+                iAppView->SetStatus( KTxt );
+                }
+                break;
+
+            case EExitKill:
+            case EExitTerminate:
+                {
+                _LIT( KTxt, "Stopped" );
+                iAppView->SetStatus( KTxt );
+                }
+                break;
+
+            case EExitPanic:
+                {
+                _LIT( KTxt, "Panic" );
+                iAppView->SetStatus( KTxt );
+                }
+                break;
+            };
+        prs.Close();
+        }
+    }
+
+void CHtiAdminAppUi::UpdateAutoStartStatus()
+    {
+    HTI_LOG_TEXT( "UpdateAutoStartStatus" );
+    TInt value = KErrNotFound;
+    TRAPD( err, iHtiCfg->LoadCfgL( KCfgFilePath, KHtiCfg ) );
+    if ( !err )
+        {
+        TRAP( err, value = iHtiCfg->GetParameterIntL(KEnableHtiAutoStart) );
+        }
+
+    if ( value == KErrNotFound )
+        {
+        // Use default values if not found from config.
+#ifdef __WINS__
+        value = 0;
+#else
+        value = 1;
+#endif
+        }
+
+    if ( value == 0 )
+        {
+        _LIT( KTxt, "Disabled" );
+        iAppView->SetAutoStartStatus( KTxt );
+        }
+    else if ( value == 1 )
+        {
+        _LIT( KTxt, "Enabled" );
+        iAppView->SetAutoStartStatus( KTxt );
+        }
+    else
+        {
+        _LIT( KTxt, "Unknown" );
+        iAppView->SetAutoStartStatus( KTxt );
+        }
+    }
+
+void CHtiAdminAppUi::UpdateSelectedComm()
+    {
+    HTI_LOG_TEXT( "UpdateSelectedComm" );
+    TBuf<64> commPlugin;
+    TRAPD( err, iHtiCfg->LoadCfgL( KCfgFilePath, KHtiCfg ) );
+    if ( !err )
+        {
+        TBuf8<KMaxParameterValueLength> commValue;
+        TRAP( err, commValue = iHtiCfg->GetParameterL( KCommPlugin ) );
+        if ( err == KErrNone )
+            {
+            commPlugin.Copy( commValue );
+            }
+        }
+    // Use default if not found from config
+    if ( commPlugin.Length() == 0 )
+        {
+        commPlugin.Copy(KCommDefaultImplementation  );        
+        }
+    iAppView->SetSelectedComm( commPlugin );
+
+    if ( commPlugin.Compare( _L( "SERIAL" ) ) == 0 )
+        {
+        TInt portNum = 0;
+        TRAP( err, iHtiCfg->LoadCfgL( KCfgFilePath, KHtiSerialCommCfg ) );
+        if ( err == KErrNone )
+            {
+            TRAP( err, portNum = iHtiCfg->GetParameterIntL( KCommPortNumber ) );
+            }
+        TBuf<16> portBuf;
+        portBuf.Copy( _L( "Port: " ) );
+        portBuf.AppendNum( portNum );
+        iAppView->SetCommDetails( portBuf );
+        }
+
+    else if ( commPlugin.Compare( _L( "BTSERIAL" ) ) == 0 )
+        {
+        TBuf<64> hostBuf;
+        TRAP( err, iHtiCfg->LoadCfgL( KCfgFilePath, KHtiBtCommCfg ) );
+        if ( err == KErrNone )
+            {
+            TBuf8<KMaxParameterValueLength> hostValue;
+            TRAP( err, hostValue = iHtiCfg->GetParameterL( KBtDeviceAddress ) );
+            if ( err != KErrNone )
+                {
+                TRAP( err, hostValue = iHtiCfg->GetParameterL( KBtDeviceName ) );
+                }
+            if ( err == KErrNone )
+                {
+                hostBuf.Copy( hostValue );
+                }
+            }
+        if ( hostBuf.Length() > 0 )
+            {
+            hostBuf.Insert( 0, _L( "Host: " ) );
+            }
+        iAppView->SetCommDetails( hostBuf );
+        }
+
+    else if ( commPlugin.Compare( _L( "IPCOMM" ) ) == 0 )
+        {
+        TBuf<128> hostBuf;
+        TRAP( err, iHtiCfg->LoadCfgL( KCfgFilePath, KHtiIPCommCfg ) );
+        if ( err == KErrNone )
+            {
+            TInt localPort = 0;
+            TRAP( err, localPort = iHtiCfg->GetParameterIntL( KLocalPort ) );
+            if ( err == KErrNone && localPort > 0 )
+                {
+                hostBuf.Copy( _L( "Listen: " ) );
+                hostBuf.AppendNum( localPort );
+                }
+            else
+                {
+                TBuf8<KMaxParameterValueLength> remoteHost;
+                TInt remotePort = 0;
+                TRAP( err, remoteHost = iHtiCfg->GetParameterL( KRemoteHost ) );
+                if ( err == KErrNone )
+                    {
+                    TRAP( err, remotePort = iHtiCfg->GetParameterIntL(
+                            KRemotePort ) );
+                    }
+                if ( err == KErrNone )
+                    {
+                    hostBuf.Copy( remoteHost );
+                    hostBuf.Insert( 0, _L("Connect: " ) );
+                    hostBuf.Append( ':' );
+                    hostBuf.AppendNum( remotePort );
+                    }
+                else
+                    {
+                    hostBuf.Copy( _L( "Invalid config!" ) );
+                    }
+                }
+            }
+        iAppView->SetCommDetails( hostBuf );
+        }
+
+    else
+        {
+        iAppView->SetCommDetails( KNullDesC );
+        }
+    }
+
+void CHtiAdminAppUi::KillHtiWatchDogL()
+    {
+    TFullName processName;
+    TFindProcess finder( KHtiWatchDogMatchPattern );
+    TInt err = finder.Next( processName );
+    if ( err == KErrNone )
+        {
+        HTI_LOG_TEXT( "HTI watchdog process found. Trying to open and kill it..." );
+        RProcess prs;
+        User::LeaveIfError( prs.Open( finder ) );
+        prs.Kill( KTerminateReason );
+        prs.Close();
+        HTI_LOG_TEXT( "HTI watchdog killed" );
+        }
+    }
+
+void CHtiAdminAppUi::StartTimer()
+    {
+    // start timer to watch the status
+    if ( !iPeriodic )
+        {
+        iPeriodic = CPeriodic::NewL( CActive::EPriorityIdle );
+        iPeriodic->Start( 1 * 1000 * 1000,
+                          10 * 1000 * 1000,
+                          TCallBack( TimerCallBackL, this ) );
+        }
+    }
+
+void CHtiAdminAppUi::KillTimer()
+    {
+    if ( iPeriodic )
+        {
+        iPeriodic->Cancel();
+        delete iPeriodic;
+        iPeriodic = NULL;
+        }
+    }
+
+TInt CHtiAdminAppUi::TimerCallBackL( TAny* aPtr )
+    {
+    ( (CHtiAdminAppUi*)aPtr )->UpdateStatusL();
+    return ETrue;
+    }
+
+void CHtiAdminAppUi::ShowCommsDBListQueryL()
+    {
+    TInt selectedOption( KErrNotFound );
+    TBuf<KMaxParameterValueLength> name;
+                 
+    CDesCArrayFlat* array = new (ELeave) CDesCArrayFlat(16);
+    CleanupStack::PushL(array);
+
+    // Get IAP names from the database
+    CCommsDatabase* db = CCommsDatabase::NewL(EDatabaseTypeIAP);;
+    CleanupStack::PushL(db);
+    db->ShowHiddenRecords();
+    CCommsDbTableView* view = db->OpenTableLC(TPtrC(IAP));
+    TInt res = view->GotoFirstRecord();
+
+    while(res == KErrNone)
+        {
+        view->ReadTextL(TPtrC(COMMDB_NAME), name);
+        array->InsertL(0, name);
+        res = view->GotoNextRecord();
+        }
+
+    CleanupStack::PopAndDestroy(view); //view
+    CleanupStack::PopAndDestroy(db); //db    
+
+    // Show IAP selection dialog
+    CAknListQueryDialog* dlg = new(ELeave) CAknListQueryDialog(&selectedOption);
+    dlg->PrepareLC(R_SELECT_IAP_DIALOG);
+    dlg->SetItemTextArray(array);
+    dlg->SetOwnershipType(ELbmDoesNotOwnItemArray);
+    dlg->RunLD();
+
+    if(selectedOption != KErrNotFound)
+        {
+        // Write selected IAP name to config file
+        name = array->MdcaPoint(selectedOption); 
+        TBuf8<KMaxParameterValueLength> iapName;
+        iapName.Copy(name);
+        iHtiCfg->SetParameterL(KIAPName, iapName);
+        }
+    CleanupStack::PopAndDestroy(array); 
+    }
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiAdmin/src/HtiAdminAppView.cpp	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,184 @@
+/*
+* 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:  AppView implementation, only displays two labels changed
+*                from CHtiAdminAppUi class
+*
+*/
+
+
+#include <coemain.h>
+#include <AknUtils.h>
+#include <HtiAdmin.rsg>
+
+#include "HtiAdminAppView.h"
+#include "HtiAdminApplication.h" //logging
+
+// Standard construction sequence
+CHtiAdminAppView* CHtiAdminAppView::NewL(const TRect& aRect)
+    {
+    CHtiAdminAppView* self = CHtiAdminAppView::NewLC(aRect);
+    CleanupStack::Pop(self);
+    return self;
+    }
+
+CHtiAdminAppView* CHtiAdminAppView::NewLC(const TRect& aRect)
+    {
+    CHtiAdminAppView* self = new (ELeave) CHtiAdminAppView;
+    CleanupStack::PushL(self);
+    self->ConstructL(aRect);
+    return self;
+    }
+
+CHtiAdminAppView::CHtiAdminAppView()
+    {
+    // no implementation required
+    }
+
+CHtiAdminAppView::~CHtiAdminAppView()
+    {
+    delete iHtiCaption;
+    delete iHtiStatus;
+    delete iHtiVersionCaption;
+    delete iHtiVersion;
+    delete iHtiAutoStartCaption;
+    delete iHtiAutoStartStatus;
+    delete iHtiSelectedCommCaption;
+    delete iHtiSelectedComm;
+    delete iHtiCommDetails;
+    }
+
+void CHtiAdminAppView::ConstructL(const TRect& aRect)
+    {
+    //HTI_LOG_TEXT("CHtiAdminAppView::ConstructL");
+
+    iHtiCaption = HBufC::NewL( KMaxDisplayText );
+    iHtiStatus = HBufC::NewL( KMaxDisplayText );
+    iHtiVersionCaption = HBufC::NewL( KMaxDisplayText );
+    iHtiVersion = HBufC::NewL( KMaxDisplayText );
+    iHtiAutoStartCaption = HBufC::NewL( KMaxDisplayText );
+    iHtiAutoStartStatus = HBufC::NewL( KMaxDisplayText );
+    iHtiSelectedCommCaption = HBufC::NewL( KMaxDisplayText );
+    iHtiSelectedComm = HBufC::NewL( KMaxDisplayText );
+    iHtiCommDetails = HBufC::NewL( KMaxDisplayText );
+
+    // Create a window for this application view
+    CreateWindowL();
+
+    // Set the windows size
+    SetRect(aRect);
+
+    // Activate the window, which makes it ready to be drawn
+    ActivateL();
+    }
+
+// Draw this application's view to the screen
+void CHtiAdminAppView::Draw(const TRect& /*aRect*/) const
+    {
+    // Get the standard graphics context
+    CWindowGc& gc = SystemGc();
+
+    // Gets the control's extent
+    TRect rect = Rect();
+
+    // Clears the screen
+    gc.Clear(rect);
+
+    //draw text
+    const CFont* f = AknLayoutUtils::FontFromId( EAknLogicalFontSecondaryFont );
+    gc.UseFont( f );
+
+    TInt leftMargin = f->MaxNormalCharWidthInPixels() / 4;
+
+    TPoint dP( leftMargin, f->FontLineGap() );
+    gc.DrawText( *iHtiCaption, dP );
+    dP.iX += f->TextWidthInPixels( *iHtiCaption );
+    gc.DrawText( *iHtiStatus, dP );
+
+    dP.iX = leftMargin;
+    dP.iY += f->FontLineGap() * 1.5;
+    gc.DrawText( *iHtiVersionCaption, dP );
+    dP.iX += f->TextWidthInPixels( *iHtiVersionCaption );
+    gc.DrawText( *iHtiVersion, dP );
+
+    dP.iX = leftMargin;
+    dP.iY += f->FontLineGap() * 1.5;
+    gc.DrawText( *iHtiAutoStartCaption, dP );
+    dP.iX += f->TextWidthInPixels( *iHtiAutoStartCaption );
+    gc.DrawText( *iHtiAutoStartStatus, dP );
+
+    dP.iX = leftMargin;
+    dP.iY += f->FontLineGap() * 1.5;
+    gc.DrawText( *iHtiSelectedCommCaption, dP );
+    dP.iX += f->TextWidthInPixels( *iHtiSelectedCommCaption );
+    gc.DrawText( *iHtiSelectedComm, dP );
+    dP.iX = leftMargin;
+    dP.iY += f->FontLineGap();
+    gc.DrawText( *iHtiCommDetails, dP );
+    }
+
+void CHtiAdminAppView::SetCaption( const TDesC& aText )
+    {
+    iHtiCaption->Des().Copy( aText );
+    DrawDeferred();
+    }
+
+void CHtiAdminAppView::SetStatus( const TDesC& aText )
+    {
+    iHtiStatus->Des().Copy( aText );
+    DrawDeferred();
+    }
+
+void CHtiAdminAppView::SetVersionCaption( const TDesC& aText )
+    {
+    iHtiVersionCaption->Des().Copy( aText );
+    DrawDeferred();
+    }
+
+void CHtiAdminAppView::SetVersion( const TDesC& aText )
+    {
+    iHtiVersion->Des().Copy( aText );
+    DrawDeferred();
+    }
+
+void CHtiAdminAppView::SetAutoStartCaption( const TDesC& aText )
+    {
+    iHtiAutoStartCaption->Des().Copy( aText );
+    DrawDeferred();
+    }
+
+void CHtiAdminAppView::SetAutoStartStatus( const TDesC& aText )
+    {
+    iHtiAutoStartStatus->Des().Copy( aText );
+    DrawDeferred();
+    }
+
+void CHtiAdminAppView::SetSelectedCommCaption( const TDesC& aText )
+    {
+    iHtiSelectedCommCaption->Des().Copy( aText );
+    DrawDeferred();
+    }
+
+void CHtiAdminAppView::SetSelectedComm( const TDesC& aText )
+    {
+    iHtiSelectedComm->Des().Copy( aText );
+    DrawDeferred();
+    }
+
+void CHtiAdminAppView::SetCommDetails( const TDesC& aText )
+    {
+    iHtiCommDetails->Des().Copy( aText );
+    DrawDeferred();
+    }
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiAdmin/src/HtiAdminApplication.cpp	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,38 @@
+/*
+* 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:  Application implemetation
+*
+*/
+
+
+#include "HtiAdminDocument.h"
+#include "HtiAdminApplication.h"
+
+// UID for the application, this should correspond to the uid defined in the mmp file
+static const TUid KUidHtiAdminApp = {0x1020DEB5};
+
+CApaDocument* CHtiAdminApplication::CreateDocumentL()
+    {
+    //HTI_LOG_TEXT("CreateDocumentL");
+    // Create an HtiAdmin document, and return a pointer to it
+    CApaDocument* document = CHtiAdminDocument::NewL(*this);
+    return document;
+    }
+
+TUid CHtiAdminApplication::AppDllUid() const
+    {
+    // Return the UID for the HtiAdmin application
+    return KUidHtiAdminApp;
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiAdmin/src/HtiAdminDocument.cpp	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,60 @@
+/*
+* 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:  AppDoc implemetation
+*
+*/
+
+
+#include "HtiAdminAppUi.h"
+#include "HtiAdminDocument.h"
+
+// Standard Symbian OS construction sequence
+CHtiAdminDocument* CHtiAdminDocument::NewL(CEikApplication& aApp)
+    {
+    CHtiAdminDocument* self = NewLC(aApp);
+    CleanupStack::Pop(self);
+    return self;
+    }
+
+CHtiAdminDocument* CHtiAdminDocument::NewLC(CEikApplication& aApp)
+    {
+    CHtiAdminDocument* self = new (ELeave) CHtiAdminDocument(aApp);
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    return self;
+    }
+
+void CHtiAdminDocument::ConstructL()
+    {
+    // no implementation required
+    }
+
+CHtiAdminDocument::CHtiAdminDocument(CEikApplication& aApp) : CAknDocument(aApp)
+    {
+    // no implementation required
+    }
+
+CHtiAdminDocument::~CHtiAdminDocument()
+    {
+    // no implementation required
+    }
+
+CEikAppUi* CHtiAdminDocument::CreateAppUiL()
+    {
+    // Create the application user interface, and return a pointer to it,
+    // the framework takes ownership of this object
+    CEikAppUi* appUi = new (ELeave) CHtiAdminAppUi;
+    return appUi;
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiAdminQt/HtiAdmin.pro	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,33 @@
+TEMPLATE = app
+TARGET = HtiAdmin
+DEPENDPATH += .
+INCLUDEPATH += .
+INCLUDEPATH += . /epoc32/include/mw/hb/hbcore /epoc32/include/mw/hb/hbwidgets /epoc32/include/mw/hb/hbtools
+LIBS += -lhbcore -lhbwidgets
+
+HEADERS += mainview.h 
+SOURCES += main.cpp mainview.cpp 
+
+symbian: { 
+    
+	LIBS += -lestor -lws32 -lPlatformEnv -limageconversion -leikcore -lfbscli -lapgrfx -lcommonengine -lgdi -lhticfg -lbafl -lecom -lcommdb
+	
+
+    HEADERS += htienginewrapper.h chtiadminengine.h 
+    SOURCES += htienginewrapper.cpp chtiadminengine.cpp 
+    RSS_RULES += "group_name = \"RnD Tools\"";
+    TARGET.CAPABILITY = ALL -TCB
+    TARGET.UID2 = 0x100039CE
+    
+    TARGET.UID3 = 0x1020DEB5
+    
+    
+    # TARGET.SID = 0x1020DEB5
+    TARGET.VID = 0x101FB657 
+        
+    # TARGET.EPOCHEAPSIZE = 0x020000 0x800000 // Min 128Kb, Max 16Mb
+    # TARGET.EPOCSTACKSIZE = 0x5000
+}else {
+    error("Only Symbian supported!")
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiAdminQt/chtiadminengine.cpp	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,903 @@
+/*
+* 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 HtiAdmin main.
+*
+*/
+
+#include <coecntrl.h>
+#include <w32std.h>
+#include <commdb.h>
+
+#include <HtiCfg.h>
+#include <HtiCommPluginInterface.h> // for KHTICommInterfaceUid
+
+
+#include "htienginewrapper.h"
+#include "chtiadminengine.h"
+
+
+#ifdef __ENABLE_LOGGING__
+
+#include <flogger.h>
+
+_LIT(KLogFolder, "hti");
+_LIT(KLogFile, "htiadmin.txt");
+#define HTI_LOG_TEXT(a1) {_LIT(temp, a1); RFileLogger::Write(KLogFolder, KLogFile, EFileLoggingModeAppend, temp);}
+#define HTI_LOG_FORMAT(a1,a2) {_LIT(temp, a1); RFileLogger::WriteFormat(KLogFolder, KLogFile, EFileLoggingModeAppend, temp, (a2));}
+#define HTI_LOG_DES(a1) {RFileLogger::Write(KLogFolder, KLogFile, EFileLoggingModeAppend, (a1));}
+
+#else // __ENABLE_LOGGING__
+
+#define HTI_LOG_TEXT(a1)
+#define HTI_LOG_FORMAT(a1,a2)
+#define HTI_LOG_DES(a1)
+
+#endif // __ENABLE_LOGGING__
+
+// CONSTANTS
+_LIT( KHtiWatchDogMatchPattern, "HtiWatchDog*" );
+_LIT( KHtiFrameworkExe, "HtiFramework.exe" );
+_LIT( KHtiMatchPattern, "HtiFramework*" );
+_LIT( KHtiFrameworkCaption, "HTI status: " );
+_LIT( KHtiAutoStartCaption, "AutoStart: " );
+_LIT( KHtiVersionCaption, "Version: " );
+_LIT( KHtiSelectedCommCaption, "Communication: " );
+_LIT( KHtiAdminStartParameter, "admin" );
+_LIT( KHtiAdminVersionFormat, "%u.%u.%u (%uwk%02u)" );
+_LIT( KHtiAdminAboutVersionFormat, "Version %u.%u.%u - " );
+const static TInt KTerminateReason = 1;
+
+const TInt32 KHTIImplUidIsaComm   = {0x1020DEBD};
+const TInt32 KHTIImplUidSerial    = {0x10210CCA};
+const TInt32 KHTIImplUidBluetooth = {0x200212CC};
+const TInt32 KHTIImplUidIPComm    = {0x200212CE};
+const TInt32 KHTIImplUidUsbSerialComm = {0x200212D0};
+const TInt32 KHTIImplUidTraceComm = {0x200212D8};
+
+// configuration file constants
+_LIT( KCfgFilePath,         "\\");
+_LIT( KHtiCfg,              "hti.cfg" );
+_LIT( KHtiBtCommCfg,        "HTIBtComm.cfg" );
+_LIT( KHtiSerialCommCfg ,   "HTISerialComm.cfg" );
+_LIT( KHtiIPCommCfg,        "HTIIPComm.cfg" );
+// hti.cfg
+_LIT8( KCommPlugin,         "CommPlugin" );
+_LIT8( KPriority,           "Priority" );
+_LIT8( KShowConsole,        "ShowConsole" );
+_LIT8( KEnableHtiWatchDog,  "EnableHtiWatchDog" );
+_LIT8( KEnableHtiAutoStart, "EnableHtiAutoStart" );
+_LIT8( KShowErrorDialogs,   "ShowErrorDialogs" );
+// HtiBtComm.cfg
+_LIT8( KBtDeviceAddress,    "BtDeviceAddress" );
+_LIT8( KBtDeviceName,       "BtDeviceName" );
+// HtiSerialComm.cfg
+_LIT8( KCommPortNumber,     "CommPort" );
+// HTIIPComm.cfg
+_LIT8( KLocalPort,          "LocalPort" );
+_LIT8( KRemoteHost,         "RemoteHost" );
+_LIT8( KRemotePort,         "RemotePort" );
+_LIT8( KIAPName,            "IAPName");
+
+
+// ---------------------------------------------------------------------------
+
+CHtiAdminEngine::CHtiAdminEngine()
+{
+    iIAPsArray = NULL;
+}
+
+// ---------------------------------------------------------------------------
+CHtiAdminEngine* CHtiAdminEngine::NewLC(HtiEngineWrapper *aEngineWrapper)
+    {
+    CHtiAdminEngine* self = new (ELeave) CHtiAdminEngine();
+    CleanupStack::PushL(self);
+    self->ConstructL(aEngineWrapper);
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+CHtiAdminEngine* CHtiAdminEngine::NewL(HtiEngineWrapper *aEngineWrapper)
+    {
+    CHtiAdminEngine* self = CHtiAdminEngine::NewLC(aEngineWrapper);
+    CleanupStack::Pop(); // self;
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+void CHtiAdminEngine::ConstructL(HtiEngineWrapper *aEngineWrapper)
+    {
+    iEngineWrapper = aEngineWrapper;
+    iHtiCfg = CHtiCfg::NewL();
+    
+    CheckStatusesL();
+    StartTimer();
+    }
+
+// ---------------------------------------------------------------------------
+void CHtiAdminEngine::CheckStatusesL()
+    {
+    UpdateConsoleStatus();
+    UpdateWatchDogStatus();
+    UpdateAutoStartStatus(); 
+    UpdateSelectedComm();
+    UpdateStatusL();
+    }
+
+
+// ---------------------------------------------------------------------------
+CHtiAdminEngine::~CHtiAdminEngine()
+{
+	KillTimer();	
+	delete iHtiCfg;
+	delete iPluginNameArray;	
+	delete iPluginDataTypeArray;	
+}
+
+// ---------------------------------------------------------------------------
+void CHtiAdminEngine::StartHtiL()
+{
+
+	RProcess prs;
+	TInt err;
+	TBool isRunning = EFalse;
+	if ( OpenHtiProcess( prs ) )
+		{
+		if ( prs.ExitType() == EExitPending )
+			{
+			isRunning = ETrue;
+			iEngineWrapper->updateStatus(HtiEngineWrapper::Running);
+			}
+		prs.Close();
+		}
+
+	if ( !isRunning )
+		{
+		HTI_LOG_TEXT( "create process" );
+		err = prs.Create( KHtiFrameworkExe, KHtiAdminStartParameter );
+		if ( err == KErrNone )
+			{
+			prs.Resume();
+			prs.Close();
+			UpdateStatusL();
+			HTI_LOG_TEXT("create done");
+			}
+		else
+			{
+			iEngineWrapper->updateStatus(HtiEngineWrapper::Error);
+			HTI_LOG_TEXT("create error");
+			}
+		}
+
+}
+
+
+// ---------------------------------------------------------------------------
+
+void CHtiAdminEngine::StopHtiL()
+{
+	HTI_LOG_TEXT("Stop");
+
+	// kill the watchdog to prevent it from restarting HTI again
+	KillHtiWatchDogL();
+
+	RProcess prs;
+	if ( OpenHtiProcess( prs ) )
+		{
+		if ( prs.ExitType() == EExitPending )
+			{
+			HTI_LOG_TEXT("try to kill");
+			prs.Kill( KTerminateReason );
+			UpdateStatusL();
+			}
+		else
+			{
+			iEngineWrapper->updateStatus(HtiEngineWrapper::Stopped);
+			}
+		prs.Close();
+		}
+
+}
+
+// ---------------------------------------------------------------------------
+
+void CHtiAdminEngine::EnableBtByAddressL(const TDesC& aAddress)
+{
+	TRAP_IGNORE( iHtiCfg->LoadCfgL( KCfgFilePath,  KHtiCfg ) );
+	iHtiCfg->SetParameterL( KCommPlugin, _L8( "BTSERIAL" ) );
+	iHtiCfg->SaveCfgL( KCfgFilePath, KHtiCfg );
+
+	TRAP_IGNORE( iHtiCfg->LoadCfgL( KCfgFilePath, KHtiBtCommCfg ) );
+	iHtiCfg->RemoveParameterL( KBtDeviceName );
+	iHtiCfg->RemoveParameterL( KBtDeviceAddress );
+	
+	TBuf8<KMaxParameterValueLength> value;
+	value.Copy(aAddress);
+	iHtiCfg->SetParameterL( KBtDeviceAddress, value);
+
+	iHtiCfg->SaveCfgL( KCfgFilePath, KHtiBtCommCfg);
+	UpdateSelectedComm();
+
+}
+
+// ---------------------------------------------------------------------------
+void CHtiAdminEngine::EnableBtByNameL(const TDesC& aAddress)
+{
+	TRAP_IGNORE( iHtiCfg->LoadCfgL( KCfgFilePath, KHtiCfg ) );
+	iHtiCfg->SetParameterL( KCommPlugin, _L8( "BTSERIAL" ) );
+	iHtiCfg->SaveCfgL( KCfgFilePath, KHtiCfg );
+
+	TRAP_IGNORE( iHtiCfg->LoadCfgL( KCfgFilePath, KHtiBtCommCfg ) );
+	iHtiCfg->RemoveParameterL( KBtDeviceName );
+	iHtiCfg->RemoveParameterL( KBtDeviceAddress );
+
+	TBuf8<KMaxParameterValueLength> value;
+	value.Copy(aAddress);
+	iHtiCfg->SetParameterL( KBtDeviceName, value);
+	
+	iHtiCfg->SaveCfgL( KCfgFilePath, KHtiBtCommCfg );
+	UpdateSelectedComm();
+}
+
+
+// ---------------------------------------------------------------------------
+void CHtiAdminEngine::BtSearchL()
+{
+	TRAP_IGNORE( iHtiCfg->LoadCfgL( KCfgFilePath, KHtiCfg ) );
+	iHtiCfg->SetParameterL( KCommPlugin, _L8( "BTSERIAL" ) );
+	iHtiCfg->SaveCfgL( KCfgFilePath, KHtiCfg );
+
+	TRAP_IGNORE( iHtiCfg->LoadCfgL( KCfgFilePath, KHtiBtCommCfg ) );
+	iHtiCfg->RemoveParameterL( KBtDeviceName );
+	iHtiCfg->RemoveParameterL( KBtDeviceAddress );
+	iHtiCfg->SaveCfgL( KCfgFilePath, KHtiBtCommCfg );
+	UpdateSelectedComm();
+}
+
+// ---------------------------------------------------------------------------
+void CHtiAdminEngine::IPListenL(const TDesC& aPort, const TDesC& aIAP)
+{
+	TRAP_IGNORE( iHtiCfg->LoadCfgL( KCfgFilePath, KHtiCfg ) );
+	iHtiCfg->SetParameterL( KCommPlugin, _L8("IPCOMM"));
+	iHtiCfg->SaveCfgL( KCfgFilePath, KHtiCfg );
+
+	TRAP_IGNORE( iHtiCfg->LoadCfgL( KCfgFilePath, KHtiIPCommCfg ) );
+	
+	TBuf8<KMaxParameterValueLength> port;
+	port.Copy(aPort);
+	iHtiCfg->SetParameterL( KLocalPort, port);
+	
+	TBuf8<KMaxParameterValueLength> iap;
+	iap.Copy(aIAP);
+	iHtiCfg->SetParameterL(KIAPName, iap);
+
+	iHtiCfg->SaveCfgL( KCfgFilePath, KHtiIPCommCfg );
+	UpdateSelectedComm();
+
+}
+
+// ---------------------------------------------------------------------------
+void CHtiAdminEngine::IPConnectL(const TDesC& aHost, const TDesC& aPort, const TDesC& aIAP)
+{
+	TRAP_IGNORE( iHtiCfg->LoadCfgL( KCfgFilePath, KHtiCfg ) );
+	iHtiCfg->SetParameterL( KCommPlugin, _L8( "IPCOMM" ) );
+	iHtiCfg->SaveCfgL( KCfgFilePath, KHtiCfg );
+
+	TRAP_IGNORE( iHtiCfg->LoadCfgL( KCfgFilePath, KHtiIPCommCfg ) );
+	iHtiCfg->RemoveParameterL( KLocalPort );
+
+	TBuf8<KMaxParameterValueLength> value;
+	value.Copy(aHost);
+	iHtiCfg->SetParameterL( KRemoteHost, value);
+	
+	TBuf8<KMaxParameterValueLength> port;
+    port.Copy(aPort);
+    iHtiCfg->SetParameterL(KRemotePort, port);
+
+    TBuf8<KMaxParameterValueLength> iap;
+    iap.Copy(aIAP);
+    iHtiCfg->SetParameterL(KIAPName, iap);
+
+    iHtiCfg->SaveCfgL(KCfgFilePath, KHtiIPCommCfg);
+    UpdateSelectedComm();
+}
+
+// ---------------------------------------------------------------------------
+void CHtiAdminEngine::EnableSerialL(const TDesC& aComPortNumber)
+{
+	TRAP_IGNORE( iHtiCfg->LoadCfgL( KCfgFilePath, KHtiCfg ) );
+	iHtiCfg->SetParameterL( KCommPlugin, _L8( "SERIAL" ) );
+	iHtiCfg->SaveCfgL( KCfgFilePath, KHtiCfg );
+	
+	TBuf8<KMaxParameterValueLength> value;
+	value.Copy(aComPortNumber);
+	iHtiCfg->SetParameterL( KCommPortNumber, value );
+	iHtiCfg->SaveCfgL( KCfgFilePath, KHtiSerialCommCfg );
+	UpdateSelectedComm();
+}
+
+
+// ---------------------------------------------------------------------------
+void CHtiAdminEngine::EnableOtherCommL(const TDesC& aSelectedPluginName)
+{
+	TRAP_IGNORE( iHtiCfg->LoadCfgL( KCfgFilePath, KHtiCfg ) );
+	
+	TInt namePosition;
+	iPluginNameArray->Find(aSelectedPluginName, namePosition);
+	
+	//Save correct data type for selected plugin
+	iHtiCfg->SetParameterL( KCommPlugin, iPluginDataTypeArray->MdcaPoint(namePosition) );
+	iHtiCfg->SaveCfgL( KCfgFilePath, KHtiCfg );
+	UpdateSelectedComm();
+}
+
+// ---------------------------------------------------------------------------
+void CHtiAdminEngine::SetPriorityBackgroundL()
+{
+	TRAP_IGNORE( iHtiCfg->LoadCfgL( KCfgFilePath, KHtiCfg ) );
+	iHtiCfg->SetParameterL( KPriority, _L8("1"));
+	iHtiCfg->SaveCfgL( KCfgFilePath, KHtiCfg );
+
+}
+
+// ---------------------------------------------------------------------------
+void CHtiAdminEngine::SetPriorityForegroundL()
+{
+	TRAP_IGNORE( iHtiCfg->LoadCfgL( KCfgFilePath, KHtiCfg ) );
+	iHtiCfg->SetParameterL( KPriority, _L8("2"));
+	iHtiCfg->SaveCfgL( KCfgFilePath, KHtiCfg );
+
+}
+
+// ---------------------------------------------------------------------------
+void CHtiAdminEngine::SetPriorityHighL()
+{
+	TRAP_IGNORE( iHtiCfg->LoadCfgL( KCfgFilePath, KHtiCfg ) );
+	iHtiCfg->SetParameterL( KPriority, _L8("3"));
+	iHtiCfg->SaveCfgL( KCfgFilePath, KHtiCfg );
+
+}
+
+// ---------------------------------------------------------------------------
+void CHtiAdminEngine::SetPriorityAbsoluteHighL()
+{
+	TRAP_IGNORE( iHtiCfg->LoadCfgL( KCfgFilePath, KHtiCfg ) );
+	iHtiCfg->SetParameterL( KPriority, _L8("4"));
+	iHtiCfg->SaveCfgL( KCfgFilePath, KHtiCfg );
+}
+
+// ---------------------------------------------------------------------------
+void CHtiAdminEngine::AutoStartEnableL(TBool aEnableAutoStart)
+{
+	TRAP_IGNORE( iHtiCfg->LoadCfgL( KCfgFilePath, KHtiCfg ) );
+	if(aEnableAutoStart)
+		{
+		iHtiCfg->SetParameterL( KEnableHtiAutoStart, _L8("1"));
+		}
+	else
+		{
+		iHtiCfg->SetParameterL( KEnableHtiAutoStart, _L8("0"));
+		}
+	
+	iHtiCfg->SaveCfgL( KCfgFilePath, KHtiCfg );
+	UpdateAutoStartStatus();
+}
+
+// ---------------------------------------------------------------------------
+void CHtiAdminEngine::WatchDogEnableL(TBool aEnableWDog)
+{
+	TRAP_IGNORE( iHtiCfg->LoadCfgL( KCfgFilePath, KHtiCfg ) );
+    
+	if(aEnableWDog)
+		{
+		iHtiCfg->SetParameterL( KEnableHtiWatchDog, _L8("1"));
+		}
+	else
+		{
+		iHtiCfg->SetParameterL( KEnableHtiWatchDog, _L8("0"));
+		}
+    
+    iHtiCfg->SaveCfgL( KCfgFilePath, KHtiCfg );
+    UpdateWatchDogStatus();
+}
+
+// ---------------------------------------------------------------------------
+void CHtiAdminEngine::ConsoleEnableL(TBool aEnableConsole)
+{
+	TRAP_IGNORE( iHtiCfg->LoadCfgL( KCfgFilePath, KHtiCfg ) );
+    
+	if(aEnableConsole)
+		{
+		iHtiCfg->SetParameterL( KShowConsole, _L8("1"));
+		}
+	else
+		{
+		iHtiCfg->SetParameterL( KShowConsole, _L8("0"));
+		}
+    
+    iHtiCfg->SaveCfgL( KCfgFilePath, KHtiCfg );
+    UpdateConsoleStatus();
+}
+
+// ---------------------------------------------------------------------------
+void CHtiAdminEngine::ErrorDialogsEnableL(TBool aEnableErrorDialogs)
+{
+	TRAP_IGNORE( iHtiCfg->LoadCfgL( KCfgFilePath, KHtiCfg ) );
+    
+	if(aEnableErrorDialogs)
+		{
+		iHtiCfg->SetParameterL( KShowErrorDialogs, _L8("1"));
+		}
+	else
+		{
+		iHtiCfg->SetParameterL( KShowErrorDialogs, _L8("0"));
+		}
+    
+    iHtiCfg->SaveCfgL( KCfgFilePath, KHtiCfg );
+}
+
+// ---------------------------------------------------------------------------
+void CHtiAdminEngine::SetHtiCfgParamL(const TDesC& aParamName, const TDesC& aParamValue)
+{
+	SetCfgParamL(aParamName, aParamValue, KHtiCfg);
+}
+
+// ---------------------------------------------------------------------------
+void CHtiAdminEngine::SetBtCfgParamL(const TDesC& aParamName, const TDesC& aParamValue)
+{
+	SetCfgParamL(aParamName, aParamValue, KHtiBtCommCfg);
+}
+
+// ---------------------------------------------------------------------------
+void CHtiAdminEngine::SetSerialCfgParamL(const TDesC& aParamName, const TDesC& aParamValue)
+{
+	SetCfgParamL(aParamName, aParamValue, KHtiSerialCommCfg);
+}
+
+// ---------------------------------------------------------------------------
+void CHtiAdminEngine::SetIPCfgParamL(const TDesC& aParamName, const TDesC& aParamValue)
+{
+	SetCfgParamL(aParamName, aParamValue, KHtiIPCommCfg);
+}
+
+// ---------------------------------------------------------------------------
+void CHtiAdminEngine::SetCfgParamL(const TDesC& aParamName, const TDesC& aParamValue, const TDesC& aFileName)
+{
+	TBuf8<KMaxParameterNameLength> name;
+	name.Copy(aParamName);
+	
+	TBuf8<KMaxParameterValueLength> value;
+	value.Copy(aParamValue);
+	
+	TRAP_IGNORE( iHtiCfg->LoadCfgL( KCfgFilePath, aFileName ) );
+	
+	iHtiCfg->SetParameterL( name, value );
+	iHtiCfg->SaveCfgL( KCfgFilePath, aFileName);
+}
+
+// ---------------------------------------------------------------------------
+void CHtiAdminEngine::GetHtiCfgParamL(const TDesC& aParamName, TDes& aParamValue)
+    {
+    GetCfgParamL(aParamName, aParamValue, KHtiCfg);
+    }
+
+// ---------------------------------------------------------------------------
+void CHtiAdminEngine::GetBtCfgParamL(const TDesC& aParamName, TDes& aParamValue)
+    {
+    GetCfgParamL(aParamName, aParamValue, KHtiBtCommCfg);
+    }
+
+// ---------------------------------------------------------------------------
+void CHtiAdminEngine::GetSerialCfgParamL(const TDesC& aParamName, TDes& aParamValue)
+    {
+    GetCfgParamL(aParamName, aParamValue, KHtiSerialCommCfg);
+    }
+
+// ---------------------------------------------------------------------------
+void CHtiAdminEngine::GetIPCfgParamL(const TDesC& aParamName, TDes& aParamValue)
+    {
+    GetCfgParamL(aParamName, aParamValue, KHtiIPCommCfg);
+    }
+
+// ---------------------------------------------------------------------------
+void CHtiAdminEngine::GetCfgParamL(const TDesC& aParamName, TDes& aParamValue, const TDesC& aFileName)
+    {
+    TBuf8<KMaxParameterNameLength> name;
+    name.Copy(aParamName);
+    
+    TBuf<KMaxParameterValueLength> value;
+
+    TRAP_IGNORE( iHtiCfg->LoadCfgL( KCfgFilePath, aFileName ) );
+    aParamValue.Copy(iHtiCfg->GetParameterL(name));
+    }
+
+// ---------------------------------------------------------------------------
+void CHtiAdminEngine::GetSelectedComm(TDes& aPluginName)
+    {
+    TBuf8<KMaxParameterValueLength> commValue;
+    TRAPD( err, iHtiCfg->LoadCfgL( KCfgFilePath, KHtiCfg ) );
+    if ( !err )
+        {
+        TRAP( err, commValue = iHtiCfg->GetParameterL( KCommPlugin ) );
+        }
+    // Use default if not found from config
+    if ( commValue.Length() == 0 )
+        {
+        commValue.Copy(KCommDefaultImplementation  );        
+        }
+    TInt typePosition;
+    iPluginDataTypeArray->Find(commValue, typePosition);
+    aPluginName.Copy(iPluginNameArray->MdcaPoint(typePosition));
+    }
+
+// ---------------------------------------------------------------------------
+TBool CHtiAdminEngine::OpenHtiProcess( RProcess& aPrs )
+{
+    HTI_LOG_TEXT( "OpenHtiProcess" );
+
+	TFullName processName;
+	TInt err;
+
+	TFindProcess finder( KHtiMatchPattern );
+	err = finder.Next( processName );
+	if ( err == KErrNone )
+		{
+		HTI_LOG_TEXT( "try to open..." );
+		err = aPrs.Open( finder );
+		HTI_LOG_TEXT( "opened" );
+
+		if ( err == KErrNone )
+			{
+			HTI_LOG_TEXT( "OpenHtiProcess OK" );
+			return ETrue;
+			}
+		else
+			{
+			iEngineWrapper->updateStatus(HtiEngineWrapper::Error);
+			}
+		}
+	else if ( err == KErrNotFound )
+		{
+		iEngineWrapper->updateStatus(HtiEngineWrapper::Stopped);
+		}
+	else
+		{
+		iEngineWrapper->updateStatus(HtiEngineWrapper::Error);
+		}
+
+	HTI_LOG_TEXT( "OpenHtiProcess NOK" );
+
+	return EFalse;
+}
+
+// ---------------------------------------------------------------------------
+void CHtiAdminEngine::UpdateStatusL()
+    {
+    HTI_LOG_TEXT( "UpdateStatusL" );
+    RProcess prs;
+    if ( OpenHtiProcess( prs ) )
+        {
+        HTI_LOG_TEXT( "Update display" );
+        TExitType exT = prs.ExitType();
+
+        switch ( exT )
+            {
+            case EExitPending:
+                {
+                iEngineWrapper->updateStatus(HtiEngineWrapper::Running);
+                }
+                break;
+
+            case EExitKill:
+            case EExitTerminate:
+                {
+                iEngineWrapper->updateStatus(HtiEngineWrapper::Stopped);
+                }
+                break;
+
+            case EExitPanic:
+                {
+                iEngineWrapper->updateStatus(HtiEngineWrapper::Panic);
+                }
+                break;
+            };
+        prs.Close();
+        }
+    }
+
+// ---------------------------------------------------------------------------
+void CHtiAdminEngine::KillHtiWatchDogL()
+    {
+    TFullName processName;
+    TFindProcess finder( KHtiWatchDogMatchPattern );
+    TInt err = finder.Next( processName );
+    if ( err == KErrNone )
+        {
+        HTI_LOG_TEXT( "HTI watchdog process found. Trying to open and kill it..." );
+        RProcess prs;
+        User::LeaveIfError( prs.Open( finder ) );
+        prs.Kill( KTerminateReason );
+        prs.Close();
+        HTI_LOG_TEXT( "HTI watchdog killed" );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+void CHtiAdminEngine::StartTimer()
+    {
+    // start timer to watch the status
+    if ( !iPeriodic )
+        {
+        iPeriodic = CPeriodic::NewL( CActive::EPriorityIdle );
+        iPeriodic->Start( 1 * 1000 * 1000,
+                          10 * 1000 * 1000,
+                          TCallBack( TimerCallBackL, this ) );
+        }
+    }
+// ---------------------------------------------------------------------------
+void CHtiAdminEngine::KillTimer()
+    {
+    if ( iPeriodic )
+        {
+        iPeriodic->Cancel();
+        delete iPeriodic;
+        iPeriodic = NULL;
+        }
+    }
+
+// ---------------------------------------------------------------------------
+TInt CHtiAdminEngine::TimerCallBackL( TAny* aPtr )
+    {
+    ( (CHtiAdminEngine*)aPtr )->UpdateStatusL();
+    return ETrue;
+    }
+
+
+// ---------------------------------------------------------------------------
+void CHtiAdminEngine::UpdateAutoStartStatus()
+    {
+    HTI_LOG_TEXT( "UpdateAutoStartStatus" );
+    TInt value = KErrNotFound;
+    TRAPD( err, iHtiCfg->LoadCfgL( KCfgFilePath, KHtiCfg ) );
+    if ( !err )
+        {
+        TRAP( err, value = iHtiCfg->GetParameterIntL(KEnableHtiAutoStart) );
+        }
+
+    if ( value == KErrNotFound )
+        {
+        // Use default values if not found from config.
+#ifdef __WINS__
+        value = 0;
+#else
+        value = 1;
+#endif
+        }
+
+    if ( value == 0 )
+        {
+        iEngineWrapper->updateAutostartStatus( HtiEngineWrapper::AutoStartDisabled );
+        }
+    else if ( value == 1 )
+        {
+        iEngineWrapper->updateAutostartStatus( HtiEngineWrapper::AutoStartEnabled );
+        }
+    else
+        {
+        iEngineWrapper->updateAutostartStatus( HtiEngineWrapper::AutoStartUnknown );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+void CHtiAdminEngine::UpdateConsoleStatus()
+    {
+    HTI_LOG_TEXT( "UpdateConsoleStatus" );
+    TInt value = KErrNotFound;
+    TRAPD( err, iHtiCfg->LoadCfgL( KCfgFilePath, KHtiCfg ) );
+    if(!err)
+        {
+        TRAP( err, value = iHtiCfg->GetParameterIntL(KShowConsole) );
+        }
+    
+    if ( value == KErrNotFound )
+        {
+        value = 0;
+        }
+
+    iEngineWrapper->updateConsoleStatus(value);
+    }
+
+// ---------------------------------------------------------------------------
+void CHtiAdminEngine::UpdateWatchDogStatus()
+    {
+    HTI_LOG_TEXT( "UpdateWatchDogStatus" );
+    TInt value = KErrNotFound;
+    TRAPD( err, iHtiCfg->LoadCfgL( KCfgFilePath, KHtiCfg ) );
+    if(!err)
+        {
+        TRAP( err, value = iHtiCfg->GetParameterIntL(KEnableHtiWatchDog) );
+        }
+    
+    if ( value == KErrNotFound )
+        {
+        value = 0;
+        }
+
+    iEngineWrapper->updateWatchDogStatus(value);    
+    }
+
+// ---------------------------------------------------------------------------
+void CHtiAdminEngine::UpdateSelectedComm()
+    {
+    HTI_LOG_TEXT( "UpdateSelectedComm" );
+    TBuf<64> commPlugin;
+    TRAPD( err, iHtiCfg->LoadCfgL( KCfgFilePath, KHtiCfg ) );
+    if ( !err )
+        {
+        TBuf8<KMaxParameterValueLength> commValue;
+        TRAP( err, commValue = iHtiCfg->GetParameterL( KCommPlugin ) );
+        if ( err == KErrNone )
+            {
+            commPlugin.Copy( commValue );
+            }
+        }
+    // Use default if not found from config
+    if ( commPlugin.Length() == 0 )
+        {
+        commPlugin.Copy(KCommDefaultImplementation  );        
+        }
+		iEngineWrapper->updateSelectedComm( commPlugin );
+
+    if ( commPlugin.Compare( _L( "SERIAL" ) ) == 0 )
+        {
+        TInt portNum = 0;
+        TRAP( err, iHtiCfg->LoadCfgL( KCfgFilePath, KHtiSerialCommCfg ) );
+        if ( err == KErrNone )
+            {
+            TRAP( err, portNum = iHtiCfg->GetParameterIntL( KCommPortNumber ) );
+            }
+        TBuf<16> portBuf;
+        portBuf.Copy( _L( "Port: " ) );
+        portBuf.AppendNum( portNum );
+        iEngineWrapper->updateCommDetails( portBuf );
+        }
+
+    else if ( commPlugin.Compare( _L( "BTSERIAL" ) ) == 0 )
+        {
+        TBuf<64> hostBuf;
+        TRAP( err, iHtiCfg->LoadCfgL( KCfgFilePath, KHtiBtCommCfg ) );
+        if ( err == KErrNone )
+            {
+            TBuf8<KMaxParameterValueLength> hostValue;
+            TRAP( err, hostValue = iHtiCfg->GetParameterL( KBtDeviceAddress ) );
+            if ( err != KErrNone )
+                {
+                TRAP( err, hostValue = iHtiCfg->GetParameterL( KBtDeviceName ) );
+                }
+            if ( err == KErrNone )
+                {
+                hostBuf.Copy( hostValue );
+                }
+            }
+        if ( hostBuf.Length() > 0 )
+            {
+            hostBuf.Insert( 0, _L( "Host: " ) );
+            }
+        iEngineWrapper->updateCommDetails(hostBuf);
+        }
+
+    else if ( commPlugin.Compare( _L( "IPCOMM" ) ) == 0 )
+        {
+        TBuf<128> hostBuf;
+        TRAP( err, iHtiCfg->LoadCfgL( KCfgFilePath, KHtiIPCommCfg ) );
+        if ( err == KErrNone )
+            {
+            TInt localPort = 0;
+            TRAP( err, localPort = iHtiCfg->GetParameterIntL( KLocalPort ) );
+            if ( err == KErrNone && localPort > 0 )
+                {
+                hostBuf.Copy( _L( "Listen: " ) );
+                hostBuf.AppendNum( localPort );
+                }
+            else
+                {
+                TBuf8<KMaxParameterValueLength> remoteHost;
+                TInt remotePort = 0;
+                TRAP( err, remoteHost = iHtiCfg->GetParameterL( KRemoteHost ) );
+                if ( err == KErrNone )
+                    {
+                    TRAP( err, remotePort = iHtiCfg->GetParameterIntL(
+                            KRemotePort ) );
+                    }
+                if ( err == KErrNone )
+                    {
+                    hostBuf.Copy( remoteHost );
+                    hostBuf.Insert( 0, _L("Connect: " ) );
+                    hostBuf.Append( ':' );
+                    hostBuf.AppendNum( remotePort );
+                    }
+                else
+                    {
+                    hostBuf.Copy( _L( "Invalid config!" ) );
+                    }
+                }
+            }
+        iEngineWrapper->updateCommDetails(hostBuf);
+        }
+
+    else
+        {
+        iEngineWrapper->updateCommDetails(KNullDesC);
+        }
+    }
+
+// ---------------------------------------------------------------------------
+void CleanupRArray( TAny* object )
+    {
+    ( ( RImplInfoPtrArray* ) object )->ResetAndDestroy();
+    }
+
+// ---------------------------------------------------------------------------
+CDesCArray* CHtiAdminEngine::SearchCommPluginsL()
+    {
+    const TInt pluginNameArrayGranularity (15);
+	iPluginNameArray = new (ELeave) CDesCArrayFlat(pluginNameArrayGranularity);
+	iPluginDataTypeArray = new (ELeave) CDesC8ArrayFlat(pluginNameArrayGranularity);
+			
+	RImplInfoPtrArray implInfoArray;
+	CleanupStack::PushL( TCleanupItem( CleanupRArray, &implInfoArray ) );
+	
+	REComSession::ListImplementationsL( KHTICommInterfaceUid, implInfoArray );
+
+	for ( TInt i = 0; i < implInfoArray.Count(); ++i )
+		{
+		iPluginNameArray->AppendL(implInfoArray[i]->DisplayName());
+		iPluginDataTypeArray->AppendL(implInfoArray[i]->DataType());
+		}
+    
+	CleanupStack::PopAndDestroy(); //implInfoArray
+		
+	return iPluginNameArray;
+    }
+
+// ---------------------------------------------------------------------------
+CDesCArray* CHtiAdminEngine::SearchIAPsL()
+    {
+    if(iIAPsArray)
+        {
+        return iIAPsArray;
+        }
+    
+    TBuf<KMaxParameterValueLength> name;
+    const TInt arrayGranularity (10);
+    iIAPsArray = new (ELeave) CDesCArrayFlat(arrayGranularity);
+
+    // Get IAP names from the database
+    CCommsDatabase* db = CCommsDatabase::NewL(EDatabaseTypeIAP);;
+    CleanupStack::PushL(db);
+    db->ShowHiddenRecords();
+    CCommsDbTableView* view = db->OpenTableLC(TPtrC(IAP));
+    TInt res = view->GotoFirstRecord();
+
+    while(res == KErrNone)
+        {
+        view->ReadTextL(TPtrC(COMMDB_NAME), name);
+        iIAPsArray->InsertL(0, name);
+        res = view->GotoNextRecord();
+        }
+
+    CleanupStack::PopAndDestroy(view); //view
+    CleanupStack::PopAndDestroy(db); //db   
+    
+    return iIAPsArray;
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiAdminQt/chtiadminengine.h	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,184 @@
+/*
+* 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 HtiAdmin main.
+*
+*/
+
+#ifndef CHTIADMINENGINE_H
+#define CHTIADMINENGINE_H
+
+#include <e32std.h>
+#include <e32base.h>
+#include <badesca.h> 
+
+
+class HtiEngineWrapper;
+class CPeriodic;
+class CHtiCfg;
+
+
+class CHtiAdminEngine : public CBase
+	{
+	public:
+	
+	/**
+	 * Constructor
+	 */
+	CHtiAdminEngine();
+	
+	/**
+	 * Destructor
+	 */
+	~CHtiAdminEngine();
+	
+	/**
+	 * Two-phased constructor.
+	 */
+	static CHtiAdminEngine* NewL(HtiEngineWrapper *aEngineWrapper);
+
+	/**
+	 * Two-phased constructor.
+	 */
+	static CHtiAdminEngine* NewLC(HtiEngineWrapper *aEngineWrapper);
+	
+	void StartHtiL();
+	
+	void StopHtiL();
+	
+	void EnableBtByAddressL(const TDesC& aAddress);
+	
+	void EnableBtByNameL(const TDesC& aAddress);
+	
+	void BtSearchL();
+	
+	void IPListenL(const TDesC& aPort, const TDesC& aIAP);
+	
+	void IPConnectL(const TDesC& aHost, const TDesC& aPort, const TDesC& aIAP);
+	
+	void EnableSerialL(const TDesC& aComPortNumber);
+	
+	void EnableOtherCommL(const TDesC& aSelectedPluginName);
+	
+	void SetPriorityBackgroundL();
+	
+	void SetPriorityForegroundL();
+	
+	void SetPriorityHighL();
+	
+	void SetPriorityAbsoluteHighL();
+	
+	void AutoStartEnableL(TBool aEnableAutoStart);
+	
+	void ConsoleEnableL(TBool aEnableConsole);
+	
+	void ErrorDialogsEnableL(TBool aEnableErrorDialogs);
+	
+	void SetHtiCfgParamL(const TDesC& aParamName, const TDesC& aParamValue);
+	void GetHtiCfgParamL(const TDesC& aParamName, TDes& aParamValue);
+	
+	void SetBtCfgParamL(const TDesC& aParamName, const TDesC& aParamValue);
+	void GetBtCfgParamL(const TDesC& aParamName, TDes& aParamValue);
+	
+	void SetSerialCfgParamL(const TDesC& aParamName, const TDesC& aParamValue);
+	void GetSerialCfgParamL(const TDesC& aParamName, TDes& aParamValue);
+	
+	void SetIPCfgParamL(const TDesC& aParamName, const TDesC& aParamValue);
+	void GetIPCfgParamL(const TDesC& aParamName, TDes& aParamValue);
+	
+	void GetSelectedComm(TDes& aPluginName);
+	
+	void CheckStatusesL();
+	
+	CDesCArray* SearchCommPluginsL();	
+	
+	CDesCArray* SearchIAPsL();
+	
+	void CHtiAdminEngine::WatchDogEnableL(TBool aEnableWDog);
+	
+	/**
+	* Kills the HtiWatchDog process if it is running.
+	*/
+	void KillHtiWatchDogL();
+
+	/**
+	* Stops the timer issuing the periodical HTI Framework process
+	* status checks.
+	*/
+	void KillTimer();
+
+	/**
+	* The method called by the periodic timer.
+	* @param aPtr pointer to this CHtiAdminAppUi instance
+	* @return zero if the callback function should not be called again,
+	* otherwise non-zero. Current implementation returns always ETrue.
+	*/
+	static TInt TimerCallBackL( TAny* aPtr );
+	
+	/**
+	* Tries to find the HTIFramework.exe process and open a handle to it.
+	* @param aPrs on return contains an open handle to the HTIFramework.exe
+	* process if process found and opened successfully
+	* @return ETrue if process found and opened successfully,
+	* otherwise EFalse
+	*/
+	TBool OpenHtiProcess( RProcess& aPrs );
+	
+	/**
+	* Updates the HTI Framework process status in the display.
+	*/
+	void UpdateStatusL();
+	
+	/**
+	* Updates the HTI auto start status in the display.
+	*/
+	void UpdateAutoStartStatus();
+	
+	
+	void UpdateConsoleStatus();
+	
+	void UpdateWatchDogStatus();
+	
+	/**
+	* Updates the selected communication in the display.
+	*/
+	void UpdateSelectedComm();
+
+	private:
+		void ConstructL(HtiEngineWrapper *aEngineWrapper);
+		
+		void SetCfgParamL(const TDesC& aParamName, const TDesC& aParamValue, const TDesC& aFileName);
+		void GetCfgParamL(const TDesC& aParamName, TDes& aParamValue, const TDesC& aFileName);
+		
+		void StartTimer();
+		
+	private:
+		// Enginewrapper that is used for communicating between QT and Symbian
+		HtiEngineWrapper* iEngineWrapper;             
+		
+		// Timer triggering periodic checking of HTIFramework process status
+        CPeriodic*        iPeriodic;
+        
+        // For reading and writing HTI configuration files
+        CHtiCfg*          iHtiCfg;
+        
+        CDesCArrayFlat* iPluginNameArray;
+        
+        CDesC8ArrayFlat* iPluginDataTypeArray;
+
+        CDesCArrayFlat* iIAPsArray;
+	
+		
+	};
+
+#endif //CHTIADMINENGINE_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiAdminQt/htienginewrapper.cpp	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,563 @@
+/*
+* 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 HtiAdmin main.
+*
+*/
+
+
+#include "htienginewrapper.h"
+#include "chtiadminengine.h"
+
+#include <coecntrl.h>
+#include <QString>
+#include <qlocale.h>
+
+
+#include <HtiVersion.h>
+
+
+
+// ---------------------------------------------------------------------------
+
+HtiEngineWrapper::HtiEngineWrapper():
+	iEngine(0)
+{
+}
+// ---------------------------------------------------------------------------	
+HtiEngineWrapper::~HtiEngineWrapper()
+{
+	delete iEngine;
+}
+
+// ---------------------------------------------------------------------------
+bool HtiEngineWrapper::init()
+{
+    TRAPD(error, iEngine = CHtiAdminEngine::NewL(this));
+    
+    if (error != KErrNone) {
+		return false;
+	}
+	else {
+		return true;
+	}
+}
+
+// ---------------------------------------------------------------------------
+bool HtiEngineWrapper::startHti()
+{
+	TRAPD(error, iEngine->StartHtiL());
+	
+	if (error != KErrNone) {
+		return false;
+	}
+	else {
+		return true;
+	}
+}
+
+// ---------------------------------------------------------------------------
+bool HtiEngineWrapper::stopHti()
+{
+	TRAPD(error, iEngine->StopHtiL());
+	
+	if (error != KErrNone) {
+		return false;
+	}
+	else {
+		return true;
+	}
+}
+
+// ---------------------------------------------------------------------------
+bool HtiEngineWrapper::enableBtByAddress(QString& address)
+{
+	// A conversion between a TBuf and QString is needed here.
+	TBuf<64> convertedAddress(address.utf16());
+	
+	
+	TRAPD(error, iEngine->EnableBtByAddressL(convertedAddress));
+		
+		if (error != KErrNone) {
+			return false;
+		}
+		else {
+			return true;
+		}
+	
+}
+
+// ---------------------------------------------------------------------------
+bool HtiEngineWrapper::ipListen(QString& port, QString& iap)
+{
+	// A conversion between a TBuf and QString is needed here.
+	TBuf<64> convertedPort(port.utf16());
+	TBuf<64> convertedIAP(iap.utf16());
+	
+	TRAPD(error, iEngine->IPListenL(convertedPort, convertedIAP));
+		
+	if (error != KErrNone) {
+		return false;
+	}
+	else {
+		return true;
+	}
+	
+}
+
+// ---------------------------------------------------------------------------
+bool HtiEngineWrapper::ipConnect(QString& host, QString& port, QString& iap)
+{
+	// A conversion between a TBuf and QString is needed here.
+	TBuf<64> convertedHostAddress(host.utf16());
+	TBuf<64> convertedPort(port.utf16());
+	TBuf<64> convertedIAP(iap.utf16());
+		
+	TRAPD(error, iEngine->IPConnectL(convertedHostAddress, convertedPort, convertedIAP));
+		
+	if (error != KErrNone) {
+		return false;
+	}
+	else {
+		return true;
+	}
+	
+}
+
+// ---------------------------------------------------------------------------
+bool HtiEngineWrapper::enableBtByName(QString& address)
+	{
+	// A conversion between a TBuf and QString is needed here.
+	TBuf<64> convertedAddress(address.utf16());
+	
+	
+	TRAPD(error, iEngine->EnableBtByNameL(convertedAddress));
+		
+		if (error != KErrNone) {
+			return false;
+		}
+		else {
+			return true;
+		}
+	
+	}
+
+// ---------------------------------------------------------------------------
+bool HtiEngineWrapper::btSearch()
+	{
+	TRAPD(error, iEngine->BtSearchL());
+		
+		if (error != KErrNone) {
+			return false;
+		}
+		else {
+			return true;
+		}
+	
+	}
+
+// ---------------------------------------------------------------------------
+bool HtiEngineWrapper::enableSerial(QString& commPort)
+{
+	// A conversion between a TBuf and QString is needed here.
+	TBuf<64> convertedText(commPort.utf16());
+		
+	TRAPD(error, iEngine->EnableSerialL(convertedText));
+		
+	if (error != KErrNone) {
+		return false;
+	}
+	else {
+		return true;
+	}
+	
+}
+
+// ---------------------------------------------------------------------------
+bool HtiEngineWrapper::enableOtherComm(QString& pluginName)
+	{
+	// A conversion between a TBuf and QString is needed here.
+	TBuf<64> convertedText(pluginName.utf16());
+	
+	TRAPD(error, iEngine->EnableOtherCommL(convertedText));
+		
+		if (error != KErrNone) {
+			return false;
+		}
+		else {
+			return true;
+		}
+	
+	}
+
+// ---------------------------------------------------------------------------
+bool HtiEngineWrapper::setPriorityBackground()
+	{
+	TRAPD(error, iEngine->SetPriorityBackgroundL());
+		
+		if (error != KErrNone) {
+			return false;
+		}
+		else {
+			return true;
+		}
+	}
+
+// ---------------------------------------------------------------------------
+bool HtiEngineWrapper::setPriorityForeground()
+	{
+	TRAPD(error, iEngine->SetPriorityForegroundL());
+		
+		if (error != KErrNone) {
+			return false;
+		}
+		else {
+			return true;
+		}
+	}
+
+// ---------------------------------------------------------------------------
+bool HtiEngineWrapper::setPriorityHigh()
+	{
+	TRAPD(error, iEngine->SetPriorityHighL());
+		
+		if (error != KErrNone) {
+			return false;
+		}
+		else {
+			return true;
+		}
+	}
+
+// ---------------------------------------------------------------------------
+bool HtiEngineWrapper::setPriorityAbsoluteHigh()
+	{
+	TRAPD(error, iEngine->SetPriorityAbsoluteHighL());
+		
+		if (error != KErrNone) {
+			return false;
+		}
+		else {
+			return true;
+		}
+	}
+
+// ---------------------------------------------------------------------------
+bool HtiEngineWrapper::watchDogEnable(bool enable)
+	{
+	TRAPD(error, iEngine->WatchDogEnableL(enable));
+		
+		if (error != KErrNone) {
+			return false;
+		}
+		else {
+			return true;
+		}
+	}
+
+
+// ---------------------------------------------------------------------------
+bool HtiEngineWrapper::autoStartEnable(bool enable)
+	{
+	TRAPD(error, iEngine->AutoStartEnableL(enable));
+		
+		if (error != KErrNone) {
+			return false;
+		}
+		else {
+			return true;
+		}
+	}
+
+// ---------------------------------------------------------------------------
+bool HtiEngineWrapper::consoleEnable(bool enable)
+	{
+	TRAPD(error, iEngine->ConsoleEnableL(enable));
+		
+		if (error != KErrNone) {
+			return false;
+		}
+		else {
+			return true;
+		}
+	}
+
+// ---------------------------------------------------------------------------
+bool HtiEngineWrapper::errorDialogsEnable(bool enable)
+	{
+	TRAPD(error, iEngine->ErrorDialogsEnableL(enable));
+		
+		if (error != KErrNone) {
+			return false;
+		}
+		else {
+			return true;
+		}
+	}
+
+// ---------------------------------------------------------------------------
+bool HtiEngineWrapper::setHtiCfgParam(QString& paramName, QString& paramValue)
+{
+	// A conversion between a TBuf and QString is needed here.
+	TBuf<64> convertedName(paramName.utf16());
+	TBuf<64> convertedValue(paramValue.utf16());
+		
+	TRAPD(error, iEngine->SetHtiCfgParamL(convertedName, convertedValue));
+		
+	if (error != KErrNone) {
+		return false;
+	}
+	else {
+		return true;
+	}
+}
+
+// ---------------------------------------------------------------------------
+bool HtiEngineWrapper::getHtiCfgParam(QString& paramName, QString& paramValue)
+{
+    // A conversion between a TBuf and QString is needed here.
+    TBuf<64> convertedName(paramName.utf16());
+    TBuf<64> value;
+        
+    TRAPD(error, iEngine->GetHtiCfgParamL(convertedName, value));
+        
+    paramValue = QString((QChar*)value.Ptr(),value.Length());
+    if (error != KErrNone) {
+        return false;
+    }
+    else {
+        return true;
+    }
+}
+
+// ---------------------------------------------------------------------------
+bool HtiEngineWrapper::setBtCfgParam(QString& paramName, QString& paramValue)
+{
+	// A conversion between a TBuf and QString is needed here.
+	TBuf<64> convertedName(paramName.utf16());
+	TBuf<64> convertedValue(paramValue.utf16());
+		
+	TRAPD(error, iEngine->SetBtCfgParamL(convertedName, convertedValue));
+		
+	if (error != KErrNone) {
+		return false;
+	}
+	else {
+		return true;
+	}
+}
+
+// ---------------------------------------------------------------------------
+bool HtiEngineWrapper::getBtCfgParam(QString& paramName, QString& paramValue)
+{
+    // A conversion between a TBuf and QString is needed here.
+    TBuf<64> convertedName(paramName.utf16());
+    TBuf<64> value;
+        
+    TRAPD(error, iEngine->GetBtCfgParamL(convertedName, value));
+    paramValue = QString((QChar*)value.Ptr(),value.Length());    
+    if (error != KErrNone) {
+        return false;
+    }
+    else {
+        return true;
+    }
+}
+
+// ---------------------------------------------------------------------------
+bool HtiEngineWrapper::setSerialCfgParam(QString& paramName, QString& paramValue)
+{
+	// A conversion between a TBuf and QString is needed here.
+	TBuf<64> convertedName(paramName.utf16());
+	TBuf<64> convertedValue(paramValue.utf16());
+		
+	TRAPD(error, iEngine->SetSerialCfgParamL(convertedName, convertedValue));
+		
+	if (error != KErrNone) {
+		return false;
+	}
+	else {
+		return true;
+	}
+}
+
+// ---------------------------------------------------------------------------
+bool HtiEngineWrapper::getSerialCfgParam(QString& paramName, QString& paramValue)
+{
+    // A conversion between a TBuf and QString is needed here.
+    TBuf<64> convertedName(paramName.utf16());
+    TBuf<64> value;
+        
+    TRAPD(error, iEngine->GetSerialCfgParamL(convertedName, value));
+    paramValue = QString((QChar*)value.Ptr(),value.Length());
+    
+    if (error != KErrNone) {
+        return false;
+    }
+    else {
+        return true;
+    }
+}
+
+// ---------------------------------------------------------------------------
+bool HtiEngineWrapper::setIPCfgParam(QString& paramName, QString& paramValue)
+{
+	// A conversion between a TBuf and QString is needed here.
+	TBuf<64> convertedName(paramName.utf16());
+	TBuf<64> convertedValue(paramValue.utf16());
+		
+	TRAPD(error, iEngine->SetIPCfgParamL(convertedName, convertedValue));
+		
+	if (error != KErrNone) {
+		return false;
+	}
+	else {
+		return true;
+	}
+}
+
+// ---------------------------------------------------------------------------
+bool HtiEngineWrapper::getIPCfgParam(QString& paramName, QString& paramValue)
+{
+    // A conversion between a TBuf and QString is needed here.
+    TBuf<64> convertedName(paramName.utf16());
+    TBuf<64> value;
+        
+    TRAPD(error, iEngine->GetIPCfgParamL(convertedName, value));
+    paramValue = QString((QChar*)value.Ptr(),value.Length());    
+    if (error != KErrNone) {
+        return false;
+    }
+    else {
+        return true;
+    }
+}
+
+// ---------------------------------------------------------------------------
+void HtiEngineWrapper::getVersionIfo(QString& version)
+{
+	version= QString("%1.%2.%3 (%4 wk%5)")
+				.arg(KHtiVersionMajor).arg(KHtiVersionMinor).arg(KHtiVersionBuild)
+				.arg(KHtiVersionYear).arg(KHtiVersionWeek);
+}
+
+// ---------------------------------------------------------------------------
+bool HtiEngineWrapper::updateStatuses()
+{
+	TRAPD(error, iEngine->CheckStatusesL());
+	
+	if (error != KErrNone) {
+		return false;
+	}
+	else {
+		return true;
+	}
+}
+
+// ---------------------------------------------------------------------------
+void HtiEngineWrapper::updateStatus(HtiStatus status)
+{
+	emit statusChanged(status);
+}
+
+// ---------------------------------------------------------------------------
+void HtiEngineWrapper::updateSelectedComm(const TDesC& aText)
+{
+	iSelectedCommText = QString((QChar*)aText.Ptr(),aText.Length());
+
+	emit commSet(iSelectedCommText);
+}
+
+// ---------------------------------------------------------------------------
+void HtiEngineWrapper::updateCommDetails(const TDesC& aText)
+{
+	iCommDetailsText = QString((QChar*)aText.Ptr(),aText.Length());
+
+	emit commDetails(iCommDetailsText);
+}
+
+// ---------------------------------------------------------------------------
+void HtiEngineWrapper::updateAutostartStatus(AutoStartStatus status)
+{
+	emit autostartSet(status);
+}
+
+void HtiEngineWrapper::updateConsoleStatus(bool bEnabled)
+{
+    emit consoleSet(bEnabled);
+}
+
+void HtiEngineWrapper::updateWatchDogStatus(bool bEnabled)
+{
+    emit watchDogSet(bEnabled);
+}
+
+// ---------------------------------------------------------------------------
+bool HtiEngineWrapper::listCommPlugins()
+{
+	CDesCArray* pluginsArray = NULL;
+	
+	TRAPD(error, pluginsArray = iEngine->SearchCommPluginsL());
+		
+	if (error != KErrNone) {
+		return false;
+	}
+	else {
+		for(TInt i = 0; i < pluginsArray->Count(); ++i)
+			{
+			TPtrC16 plugin (pluginsArray->MdcaPoint(i));
+			int len = pluginsArray->MdcaPoint(i).Length();
+			
+			QString name ((QChar*)plugin.Ptr(), len);
+			iPluginNames << name;
+			}
+		
+		emit commPluginsRetrieved(iPluginNames);
+		
+		return true;
+	}
+}
+
+// ---------------------------------------------------------------------------
+bool HtiEngineWrapper::listIAPs(QStringList& list)
+{
+    CDesCArray* arrayIAPs = NULL;
+    
+    TRAPD(error, arrayIAPs = iEngine->SearchIAPsL());
+        
+    if (error != KErrNone) {
+        return false;
+    }
+    else {
+        for(TInt i = 0; i < arrayIAPs->Count(); ++i)
+            {
+            TPtrC16 iap (arrayIAPs->MdcaPoint(i));
+            int len = arrayIAPs->MdcaPoint(i).Length();
+            
+            QString name ((QChar*)iap.Ptr(), len);
+            list << name;
+            }
+        
+        return true;
+    }
+    return true;
+}
+
+// ---------------------------------------------------------------------------
+bool HtiEngineWrapper::getSelectedComm(QString& commName)
+{
+    TBuf<64> pluginName;
+    iEngine->GetSelectedComm(pluginName);
+    commName = QString((QChar*)pluginName.Ptr(), pluginName.Length());
+    return true;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiAdminQt/htienginewrapper.h	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,121 @@
+/*
+* 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 HtiAdmin main.
+*
+*/
+
+#ifndef HTIENGINEWRAPPER_H
+#define HTIENGINEWRAPPER_H
+
+#include <e32cmn.h>
+#include <qobject.h>
+#include <qstringlist.h>
+
+class CHtiAdminEngine;
+class QString;
+
+
+
+
+/**
+ * class that is used for communicating between Symbian and Qt code.
+ */
+class HtiEngineWrapper : public QObject 
+	{
+	Q_OBJECT
+public:
+	enum AutoStartStatus{
+		AutoStartDisabled,
+		AutoStartEnabled,
+		AutoStartUnknown		
+	};
+	
+	enum HtiStatus{
+		Running,
+		Stopped,
+		Panic,
+		Error
+		};
+	
+	/**
+	 * Constructor
+	 */
+	HtiEngineWrapper();
+	
+	/**
+	 * Destructor
+	 */
+	~HtiEngineWrapper();
+	
+	
+	bool init();
+	bool stopHti();
+	bool startHti();
+	bool enableBtByAddress(QString& address);
+	bool enableBtByName(QString& address);
+	bool ipListen(QString& port, QString& iap);
+	bool ipConnect(QString& host, QString& port, QString& iap);
+	bool enableSerial(QString& commPort);
+	bool btSearch();
+	bool enableOtherComm(QString& pluginName);
+	bool setPriorityBackground();
+	bool setPriorityForeground();
+	bool setPriorityHigh();
+	bool setPriorityAbsoluteHigh();
+	bool watchDogEnable(bool enable);
+	bool autoStartEnable(bool enable);
+	bool consoleEnable(bool enable);
+	bool errorDialogsEnable(bool enable);
+	bool setHtiCfgParam(QString& paramName, QString& paramValue);
+	bool getHtiCfgParam(QString& paramName, QString& paramValue);
+	bool setBtCfgParam(QString& paramName, QString& paramValue);
+	bool getBtCfgParam(QString& paramName, QString& paramValue);
+	bool setSerialCfgParam(QString& paramName, QString& paramValue);
+	bool getSerialCfgParam(QString& paramName, QString& paramValue);
+	bool setIPCfgParam(QString& paramName, QString& paramValue);
+	bool getIPCfgParam(QString& paramName, QString& paramValue);
+	void getVersionIfo(QString& version);
+	bool updateStatuses();
+	bool listCommPlugins();
+	bool listIAPs(QStringList& list);
+	bool getSelectedComm(QString& commName);
+	
+	//Called from engine side
+	void updateStatus(HtiStatus status);
+	void updateSelectedComm(const TDesC& aText);
+	void updateAutostartStatus(AutoStartStatus status);
+	void updateConsoleStatus(bool bEnabled);
+	void updateWatchDogStatus(bool bEnabled);
+	void updateCommDetails(const TDesC& aText);
+	
+		
+
+signals:
+	void statusChanged(HtiEngineWrapper::HtiStatus status);	
+	void commSet(QString& statusText);
+	void commDetails(QString& statusText);
+	void commPluginsRetrieved(QStringList& pluginNames);
+	void autostartSet(HtiEngineWrapper::AutoStartStatus status);
+	void consoleSet(bool enabled);
+	void watchDogSet(bool enabled);
+	
+private:
+		CHtiAdminEngine* iEngine;
+		QString iSelectedCommText;
+		QString iCommDetailsText;
+		QStringList iPluginNames;
+		
+	};
+
+#endif //HTIENGINEWRAPPER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiAdminQt/main.cpp	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,63 @@
+/*
+* 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 HtiAdmin main.
+*
+*/
+
+#include <hbmainwindow.h>
+//#include <hbview.h>
+#include <coecntrl.h>
+#include <hbapplication.h>
+
+
+#include "mainview.h"
+#include "htienginewrapper.h"
+
+
+
+
+
+int main(int argc, char *argv[])
+{
+	// Initialization
+    HbApplication app(argc, argv);
+    
+    // Create HtiEngineWrapper
+    HtiEngineWrapper engineWrapper;
+    
+    if (!engineWrapper.init()) {
+            return EXIT_FAILURE;
+        }
+ 
+    // Main window widget. 
+    // Includes decorators such as signal strength and battery life indicator.
+    HbMainWindow mainWindow;
+
+    //Create main view
+	MainView* view = new MainView(mainWindow, engineWrapper);
+
+	//initialize main view
+	view->init(app);
+	
+	// Add View to main window and reveal it.
+	mainWindow.addView(view);
+
+    // Show widget
+    //mainWindow.show();
+    mainWindow.showFullScreen();
+
+    int result = app.exec();
+      
+    return result;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiAdminQt/mainview.cpp	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,726 @@
+/*
+* 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 HtiAdmin main.
+*
+*/
+
+
+#include <hbmainwindow.h>
+#include <hbapplication.h>
+#include <hbmenu.h>
+#include <hbaction.h>
+#include <hblabel.h>
+#include <hbinputdialog.h>
+#include <qgraphicslinearlayout.h>
+#include <hbselectiondialog.h>
+#include <hbmessagebox.h>
+
+
+
+#include "htienginewrapper.h"
+#include "mainview.h"
+#include "hbtoolbar.h"
+
+// ---------------------------------------------------------------------------
+
+MainView::MainView(HbMainWindow &mainWindow, HtiEngineWrapper& engineWrapper):
+    mMainWindow(mainWindow),
+    mEngineWrapper(engineWrapper)
+{
+}
+
+// ---------------------------------------------------------------------------
+
+MainView::~MainView()
+{
+
+}
+
+// ---------------------------------------------------------------------------
+
+void MainView::init(HbApplication &app)
+{
+    this->setTitle("Hti Admin");
+    createToolbar();
+    createMenu(app);
+    createTexts();
+    
+    mEngineWrapper.updateStatuses();
+    
+    QString version;
+    mEngineWrapper.getVersionIfo(version);
+    mEngineWrapper.listCommPlugins();
+    
+    mHtiVersionTxt->setPlainText("Hti Version: " + version);
+}
+
+// ---------------------------------------------------------------------------
+void MainView::createMenu(HbApplication& app)
+{
+    
+    HbMenu* menu = new HbMenu();
+    
+    if (menu != NULL) {
+        
+        mActionExit = menu->addAction("Exit");
+        connect(mActionExit, SIGNAL(triggered()), &app, SLOT( quit() ) );
+
+        connect(mActionStartHti, SIGNAL(triggered()), this, SLOT( startHti() ) );
+        connect(mActionStopHti, SIGNAL(triggered()), this, SLOT( stopHti() ) );
+        
+        mActionSelectComm = menu->addAction("Select Communication");
+        connect(mActionSelectComm, SIGNAL(triggered()), this, SLOT( enableComm() ) );
+        
+        mActionSetPriority = menu->addAction("Set Priority");
+        connect(mActionSetPriority, SIGNAL(triggered()), this, SLOT( setPriority() ) );
+        
+        mActionEnableAuto = menu->addAction("Enable Auto Start");
+        connect(mActionEnableAuto, SIGNAL(triggered()), this, SLOT( enableAutoStart() ) );
+        
+        mActionDisableAuto = menu->addAction("Disable Auto Start");
+        connect(mActionDisableAuto, SIGNAL(triggered()), this, SLOT( disableAutoStart() ) );
+        
+        mActionEnableWdog = menu->addAction("Enable Watchdog");
+        connect(mActionEnableWdog, SIGNAL(triggered()), this, SLOT( enableWatchdog() ) );
+                
+        mActionDisableWdog = menu->addAction("Disable Watchdog");
+        connect(mActionDisableWdog, SIGNAL(triggered()), this, SLOT( disableWatchdog() ) );
+        
+        mActionEnableConsole = menu->addAction("Enable Console");
+        connect(mActionEnableConsole, SIGNAL(triggered()), this, SLOT( enableConsole() ) );
+                        
+		mActionDisableConsole = menu->addAction("Disable Console");
+		connect(mActionDisableConsole, SIGNAL(triggered()), this, SLOT( disableConsole() ) );
+		
+		mActionSetParameter = menu->addAction("Set Parameter");
+		connect(mActionSetParameter, SIGNAL(triggered()), this, SLOT( showParamList() ) );
+        
+        this->setMenu(menu);
+    }
+    
+    
+    connect(&mEngineWrapper, SIGNAL(statusChanged(HtiEngineWrapper::HtiStatus)), this, SLOT(htiStatusChanged(HtiEngineWrapper::HtiStatus)));
+    connect(&mEngineWrapper, SIGNAL(commSet(QString&)), this, SLOT(commStatusChanged(QString&)));
+    connect(&mEngineWrapper, SIGNAL(commDetails(QString&)), this, SLOT(commDetailsChanged(QString&)));
+    connect(&mEngineWrapper, SIGNAL(autostartSet(HtiEngineWrapper::AutoStartStatus)), this, SLOT(autostartStatusChanged(HtiEngineWrapper::AutoStartStatus)));
+    connect(&mEngineWrapper, SIGNAL(consoleSet(bool)), this, SLOT(consoleStatusChanged(bool)));
+    connect(&mEngineWrapper, SIGNAL(watchDogSet(bool)), this, SLOT(watchDogStatusChanged(bool)));
+    connect(&mEngineWrapper, SIGNAL(commPluginsRetrieved(QStringList&)), this, SLOT(updatePluginInfo(QStringList&)));
+    
+    
+}
+
+// ---------------------------------------------------------------------------
+void MainView::createTexts()
+{
+	QGraphicsLinearLayout* layout = new QGraphicsLinearLayout(Qt::Vertical, this);
+	
+	mCommDetailsTxt = new HbLabel(this);
+	mHtiStatusTxt = new HbLabel(this);
+	mHtiVersionTxt = new HbLabel(this);
+	
+	mHtiAutoStartStatusTxt = new HbLabel(this);
+	mCommunicationTxt = new HbLabel(this);
+	
+	mHtiStatusTxt->setPlainText("Hti Status:");
+	mHtiVersionTxt->setPlainText("Hti Version:");
+	mHtiAutoStartStatusTxt->setPlainText("Auto Start:");
+	mCommunicationTxt->setPlainText("Communication ");
+		
+	layout->addItem(mHtiStatusTxt);
+	layout->addItem(mHtiVersionTxt);
+	layout->addItem(mHtiAutoStartStatusTxt);
+	layout->addItem(mCommunicationTxt);
+	layout->addItem(mCommDetailsTxt);
+
+	layout->setMaximumHeight(300);
+	this->setLayout(layout);
+}
+
+// ---------------------------------------------------------------------------
+void MainView::htiStatusChanged(HtiEngineWrapper::HtiStatus newStatus)
+{
+	switch(newStatus)
+			{
+			case HtiEngineWrapper::Running:
+				mHtiStatusTxt->setPlainText("Hti Status: Running" );
+				break;
+			case HtiEngineWrapper::Stopped:
+				mHtiStatusTxt->setPlainText("Hti Status: Stopped" );
+				break;
+			case HtiEngineWrapper::Panic:
+				mHtiStatusTxt->setPlainText("Hti Status: Panic" );
+				break;
+			default:
+				mHtiStatusTxt->setPlainText("Hti Status: Error" );
+			}
+	
+	// Update menu items status
+	bool isRunning = (newStatus == HtiEngineWrapper::Running);
+    mActionStartHti->setEnabled(!isRunning);
+    mActionStopHti->setEnabled(isRunning);
+    mActionSelectComm->setEnabled(!isRunning);
+    mActionSetPriority->setEnabled(!isRunning);
+    mActionEnableAuto->setEnabled(!isRunning);
+    mActionDisableAuto->setEnabled(!isRunning);
+    mActionEnableWdog->setEnabled(!isRunning);
+    mActionDisableWdog->setEnabled(!isRunning);
+    mActionEnableConsole->setEnabled(!isRunning);
+    mActionDisableConsole->setEnabled(!isRunning);
+    mActionSetParameter->setEnabled(!isRunning);
+}
+
+// ---------------------------------------------------------------------------
+void MainView::commStatusChanged(QString& newStatus)
+{
+	if (mCommunicationTxt) {
+		mCommunicationTxt->setPlainText("Communication: " + newStatus);
+	}
+}
+
+// ---------------------------------------------------------------------------
+void MainView::commDetailsChanged(QString& newStatus)
+{
+	if (mCommDetailsTxt) {
+		mCommDetailsTxt->setPlainText(newStatus);
+	}
+}
+
+// ---------------------------------------------------------------------------
+void MainView::updatePluginInfo(QStringList& pluginList)
+{
+	mPluginList = pluginList;
+}
+
+// ---------------------------------------------------------------------------
+void MainView::autostartStatusChanged(HtiEngineWrapper::AutoStartStatus newStatus)
+{
+	switch(newStatus)
+		{
+		case HtiEngineWrapper::AutoStartDisabled:
+			mHtiAutoStartStatusTxt->setPlainText("Auto Start: Disabled" );
+			break;
+		case HtiEngineWrapper::AutoStartEnabled:
+			mHtiAutoStartStatusTxt->setPlainText("Auto Start: Enabled" );
+			break;
+		default:
+			mHtiAutoStartStatusTxt->setPlainText("Auto Start: Unknown" );
+		}
+	
+	bool isAutoStartEnabled = (newStatus == HtiEngineWrapper::AutoStartEnabled);
+    mActionEnableAuto->setVisible(!isAutoStartEnabled);
+    mActionDisableAuto->setVisible(isAutoStartEnabled);
+}
+
+// ---------------------------------------------------------------------------
+void MainView::consoleStatusChanged(bool enabled)
+{
+    mActionEnableConsole->setVisible(!enabled);
+    mActionDisableConsole->setVisible(enabled);
+}
+
+// ---------------------------------------------------------------------------
+void MainView::watchDogStatusChanged(bool enabled)
+{
+    mActionEnableWdog->setVisible(!enabled);
+    mActionDisableWdog->setVisible(enabled);
+}
+
+
+// ---------------------------------------------------------------------------
+
+void MainView::createToolbar()
+{
+	mActionStartHti = toolBar()->addAction("Start Hti");
+	mActionStopHti = toolBar()->addAction("Stop Hti");
+}
+
+// ---------------------------------------------------------------------------
+
+void MainView::startHti()
+{
+	mEngineWrapper.startHti();
+}
+
+// ---------------------------------------------------------------------------
+
+void MainView::stopHti()
+{
+	mEngineWrapper.stopHti();
+}
+
+
+// ---------------------------------------------------------------------------
+void MainView::enableComm()
+{
+    //Get current selection
+	QString currentComm;
+	mEngineWrapper.getSelectedComm(currentComm);
+	int curSelection = mPluginList.indexOf(currentComm, 0);
+	openListDialog(mPluginList, curSelection, QString("Select Comm"), this, SLOT(doSelectComm(HbAction*)));
+}
+
+void MainView::doSelectComm(HbAction* action)
+{
+    HbSelectionDialog *dlg = static_cast<HbSelectionDialog*>(sender());
+    if(dlg && dlg->selectedModelIndexes().count() &&
+            (!action || action == dlg->actions().at(0)))
+    {
+        int selectionIndex = dlg->selectedModelIndexes().at(0).row();
+
+        if (mPluginList[selectionIndex] == QString("Bt serial comm"))
+        {
+            enableBTComm();
+        }
+        else if (mPluginList[selectionIndex] == QString("IP comm"))
+        {
+            enableIPComm();
+        }
+        else if (mPluginList[selectionIndex] == QString("SERIAL comm"))
+        {
+            enableSerialComm();
+        }
+        else
+        {
+            //All other comm plugins
+            mEngineWrapper.enableOtherComm(mPluginList[selectionIndex]);
+        }   
+    }    
+}
+// ---------------------------------------------------------------------------
+void MainView::enableSerialComm()
+{
+    QString heading = QString("Set Comm Port number");
+    HbInputDialog::getInteger(heading, this, SLOT(doEnableSerialComm(HbAction*)), 0, scene());
+}
+
+void MainView::doEnableSerialComm(HbAction* action)
+{
+    HbInputDialog *dlg = static_cast<HbInputDialog*>(sender());
+    if (action == dlg->actions().at(0))
+    {
+        QString strPortNumber = dlg->value().toString();
+        mEngineWrapper.enableSerial(strPortNumber);
+    }
+}
+// ---------------------------------------------------------------------------
+void MainView::enableIPComm()
+{
+    // Get IAPs list
+    QStringList iapsList;
+    mEngineWrapper.listIAPs(iapsList); 
+    if(iapsList.count() == 0)
+    {
+        HbMessageBox::warning(QString("No IAPs for selection!"));
+        return;
+    }
+    
+    // Get current selection
+    QString curIapName;
+    QString param = "IAPName";
+    mEngineWrapper.getIPCfgParam(param, curIapName);
+    int curSelection = iapsList.indexOf(curIapName, 0);
+    
+    openListDialog(iapsList, curSelection, QString("Select IAP:"), this, SLOT(doSelectIAP(HbAction*)));
+}
+
+void MainView::doSelectIAP(HbAction* action)
+{
+    HbSelectionDialog *dlg = static_cast<HbSelectionDialog*>(sender());
+    if(dlg && dlg->selectedModelIndexes().count() &&
+            (!action || action == dlg->actions().at(0)))
+    {
+        int selectionIndex = dlg->selectedModelIndexes().at(0).row();
+        mIapSelection = dlg->stringItems()[selectionIndex];
+        
+        QStringList items;
+        items <<"Listen" <<"Connect";
+        openListDialog(items, 0, QString("Select IP Comm"), this, SLOT(doSelectIpComm(HbAction*)));
+    }  
+}
+
+void MainView::doSelectIpComm(HbAction* action)
+{
+    HbSelectionDialog *dlg = static_cast<HbSelectionDialog*>(sender());
+    if(dlg && dlg->selectedModelIndexes().count() &&
+            (!action || action == dlg->actions().at(0)))
+    {
+        int selectionIndex = dlg->selectedModelIndexes().at(0).row();
+        if(selectionIndex == 0) //Listen
+        {
+            HbInputDialog::getInteger(QString("Local port"), this, SLOT(doListenOnPort(HbAction*)), 0, scene());
+        }
+        else //Connect
+        {
+            openIPAddressDialog(QString("Remote Host"), this, SLOT(doConnectRemoteHost(HbAction*)));
+        }
+    }
+}
+
+void MainView::doListenOnPort(HbAction* action)
+{
+    HbInputDialog *dlg = static_cast<HbInputDialog*>(sender());
+    if (action == dlg->actions().at(0))
+    {
+        QString port = dlg->value().toString();
+        mEngineWrapper.ipListen(port, mIapSelection);
+    }
+}
+
+void MainView::doConnectRemoteHost(HbAction* action)
+{
+    HbInputDialog *dlg = static_cast<HbInputDialog*>(sender());
+    if (action == dlg->actions().at(0))
+    {
+        QString host = dlg->value(0).toString();
+        QString port = dlg->value(1).toString();
+        mEngineWrapper.ipConnect(host, port, mIapSelection);
+    }
+}
+
+// ---------------------------------------------------------------------------
+void MainView::enableBTComm()
+{
+	QStringList items;
+	items <<"BT address" <<"BT name" <<"Search when starting" ;
+	openListDialog(items, 0, QString("Bluetooth Comm"), this, SLOT(doSelectBTComm(HbAction*)));
+}
+
+void MainView::doSelectBTComm(HbAction* action)
+{
+    HbSelectionDialog *dlg = static_cast<HbSelectionDialog*>(sender());
+    if(dlg && dlg->selectedModelIndexes().count() &&
+            (!action || action == dlg->actions().at(0)))
+    {
+        int selectionIndex = dlg->selectedModelIndexes().at(0).row();
+        if(selectionIndex == 0)
+        {
+            HbInputDialog::getText(QString("BT address"), this, SLOT(doEnableByBTAddress(HbAction*)));
+        }
+        else if(selectionIndex == 1)
+        {
+            HbInputDialog::getText(QString("BT name"), this, SLOT(doEnableByBTName(HbAction*)));
+        }
+        else if(selectionIndex == 2)
+        {
+            mEngineWrapper.btSearch();
+        }
+    }
+}
+
+void MainView::doEnableByBTAddress(HbAction* action)
+{
+    HbInputDialog *dlg = static_cast<HbInputDialog*>(sender());
+    if (action == dlg->actions().at(0))
+    {
+        QString address = dlg->value().toString();
+        mEngineWrapper.enableBtByAddress(address);
+    }
+}
+void MainView::doEnableByBTName(HbAction* action)
+{
+    HbInputDialog *dlg = static_cast<HbInputDialog*>(sender());
+    if (action == dlg->actions().at(0))
+    {
+        QString name = dlg->value().toString();
+        mEngineWrapper.enableBtByName(name);
+    }
+}
+
+// ---------------------------------------------------------------------------
+void MainView::setPriority()
+{
+    // Get current priority
+    bool ok = false;
+    QString curPriority;
+    QString param = "Priority";
+    mEngineWrapper.getHtiCfgParam(param, curPriority);
+    int curSelection = curPriority.toInt(&ok);
+    if(ok){
+        curSelection--;
+    }
+    else{
+    curSelection = 2;
+    }
+    
+	QStringList items;
+	items <<"Backgroung" <<"Foregound" <<"High" << "Absolute High";
+	openListDialog(items, curSelection, QString("Select Hti Priority"), 
+	        this, SLOT(doSetPriority(HbAction*)));
+}
+
+void MainView::doSetPriority(HbAction* action)
+{
+    HbSelectionDialog *dlg = static_cast<HbSelectionDialog*>(sender());
+    if(dlg && dlg->selectedModelIndexes().count() &&
+            (!action || action == dlg->actions().at(0)))
+    {
+        int selectionIndex = dlg->selectedModelIndexes().at(0).row();
+        if(selectionIndex == 0)
+        {
+            mEngineWrapper.setPriorityBackground();
+        }
+        else if(selectionIndex == 1)
+        {
+            mEngineWrapper.setPriorityForeground();
+        }
+        else if(selectionIndex == 2)
+        {
+            mEngineWrapper.setPriorityHigh();
+        }
+        else
+        {
+            mEngineWrapper.setPriorityAbsoluteHigh();
+        }
+    }
+}
+// ---------------------------------------------------------------------------
+void MainView::enableAutoStart()
+{
+	mEngineWrapper.autoStartEnable(true);
+}
+
+// ---------------------------------------------------------------------------
+void MainView::disableAutoStart()
+{
+	mEngineWrapper.autoStartEnable(false);
+}
+
+// ---------------------------------------------------------------------------
+void MainView::enableWatchdog()
+{
+	mEngineWrapper.watchDogEnable(true);
+}
+
+// ---------------------------------------------------------------------------
+void MainView::disableWatchdog()
+{
+	mEngineWrapper.watchDogEnable(false);
+}
+
+// ---------------------------------------------------------------------------
+void MainView::enableConsole()
+{
+	mEngineWrapper.consoleEnable(true);
+}
+
+// ---------------------------------------------------------------------------
+void MainView::disableConsole()
+{
+	mEngineWrapper.consoleEnable(false);
+}
+
+// ---------------------------------------------------------------------------
+void MainView::showParamList()
+{
+    QStringList items;
+    items << "Hti.cfg" << "HtiBtComm.cfg" << "HtiSerialComm.cfg" << "HtiIPComm.cfg";
+    openListDialog(items, 0, QString("Select cfg file to modify"), 
+            this, SLOT(doSelectCfgFile(HbAction*)));
+}
+
+void MainView::doSelectCfgFile(HbAction* action)
+{
+    HbSelectionDialog *dlg = static_cast<HbSelectionDialog*>(sender());
+    if(dlg && dlg->selectedModelIndexes().count() &&
+            (!action || action == dlg->actions().at(0)))
+    {
+        int selectionIndex = dlg->selectedModelIndexes().at(0).row();
+        QStringList items;
+        if(selectionIndex == 0)
+        {
+            items <<"CommPlugin" <<"MaxMsgSize" <<"MaxQueueSize" <<"MaxHeapSize"<<"Priority"
+                    <<"ShowConsole"<<"MaxWaitTime"<<"StartUpDelay"<<"EnableHtiWatchDog"
+                    <<"EnableHtiAutoStart"<<"ShowErrorDialogs"<<"ReconnectDelay";
+            openListDialog(items, 0, QString("Hti.cfg"), this, SLOT(doModifyHtiCfgFile(HbAction*)));
+        }
+        else if(selectionIndex == 1)
+        {
+            items <<"BtDeviceName" <<"BtDeviceName";
+            openListDialog(items, 0, QString("HtiBtComm.cfg"), this, SLOT(doModifyBtCfgFile(HbAction*)));
+        }
+        else if(selectionIndex == 2)
+        {
+            items <<"CommPort" <<"DataRate"<<"Parity"<<"DataBits"<<"StopBits"<<"SendDelay"<<"Handshake";
+            openListDialog(items, 0, QString("HtiSerialComm.cfg"), this, SLOT(doModifySerialCfgFile(HbAction*)));
+        }
+        else
+        {
+            items <<"IAPName"<<"LocalPort"<<"RemoteHost"<<"RemotePort"<<"ConnectTimeout";
+            openListDialog(items, 0, QString("HtiIPComm.cfg"), this, SLOT(doModifyIPCfgFile(HbAction*)));
+        }
+    }
+}
+
+void MainView::doModifyHtiCfgFile(HbAction* action)
+{
+    HbSelectionDialog *dlgSelection = static_cast<HbSelectionDialog*>(sender());
+    if(dlgSelection && dlgSelection->selectedModelIndexes().count() &&
+            (!action || action == dlgSelection->actions().at(0)))
+    {
+        int selectionIndex = dlgSelection->selectedModelIndexes().at(0).row();
+        HbInputDialog* dlgInput = new HbInputDialog();
+        dlgInput->setAttribute(Qt::WA_DeleteOnClose);
+        dlgInput->setPromptText(dlgSelection->stringItems()[selectionIndex]);
+        dlgInput->setInputMode(HbInputDialog::TextInput);
+        
+        HbLabel *title = new HbLabel(dlgInput);
+        title->setPlainText(QString("Set parameter value"));
+        dlgInput->setHeadingWidget(title);
+        
+        dlgInput->open(this, SLOT(doSetHtiCfgParameter(HbAction*)));
+    }
+}
+
+void MainView::doSetHtiCfgParameter(HbAction* action)
+{
+    HbInputDialog *dlg = static_cast<HbInputDialog*>(sender());
+    if (action == dlg->actions().at(0))
+    {
+        QString parameter = dlg->promptText();
+        QString value = dlg->value().toString();
+        mEngineWrapper.setHtiCfgParam(parameter, value);
+    }
+}
+
+void MainView::doModifyBtCfgFile(HbAction* action)
+{
+    HbSelectionDialog *dlgSelection = static_cast<HbSelectionDialog*>(sender());
+    if(dlgSelection && dlgSelection->selectedModelIndexes().count() &&
+            (!action || action == dlgSelection->actions().at(0)))
+    {
+        int selectionIndex = dlgSelection->selectedModelIndexes().at(0).row();
+        HbInputDialog* dlgInput = new HbInputDialog();
+        dlgInput->setAttribute(Qt::WA_DeleteOnClose);
+        dlgInput->setPromptText(dlgSelection->stringItems()[selectionIndex]);
+        dlgInput->setInputMode(HbInputDialog::TextInput);
+        
+        HbLabel *title = new HbLabel(dlgInput);
+        title->setPlainText(QString("Set parameter value"));
+        dlgInput->setHeadingWidget(title);
+        
+        dlgInput->open(this, SLOT(doSetBtCfgParameter(HbAction*)));
+    }
+}
+
+void MainView::doSetBtCfgParameter(HbAction* action)
+{
+    HbInputDialog *dlg = static_cast<HbInputDialog*>(sender());
+    if (action == dlg->actions().at(0))
+    {
+        QString parameter = dlg->promptText();
+        QString value = dlg->value().toString();
+        mEngineWrapper.setBtCfgParam(parameter, value);
+    }
+}
+
+void MainView::doModifySerialCfgFile(HbAction* action)
+{
+    HbSelectionDialog *dlgSelection = static_cast<HbSelectionDialog*>(sender());
+    if(dlgSelection && dlgSelection->selectedModelIndexes().count() &&
+            (!action || action == dlgSelection->actions().at(0)))
+    {
+        int selectionIndex = dlgSelection->selectedModelIndexes().at(0).row();
+        HbInputDialog* dlgInput = new HbInputDialog();
+        dlgInput->setAttribute(Qt::WA_DeleteOnClose);
+        dlgInput->setPromptText(dlgSelection->stringItems()[selectionIndex]);
+        dlgInput->setInputMode(HbInputDialog::TextInput);
+        
+        HbLabel *title = new HbLabel(dlgInput);
+        title->setPlainText(QString("Set parameter value"));
+        dlgInput->setHeadingWidget(title);
+        
+        dlgInput->open(this, SLOT(doSetSerialCfgParameter(HbAction*)));
+    }
+}
+
+void MainView::doSetSerialCfgParameter(HbAction* action)
+{
+    HbInputDialog *dlg = static_cast<HbInputDialog*>(sender());
+    if (action == dlg->actions().at(0))
+    {
+        QString parameter = dlg->promptText();
+        QString value = dlg->value().toString();
+        mEngineWrapper.setSerialCfgParam(parameter, value);
+    }
+}
+
+void MainView::doModifyIPCfgFile(HbAction* action)
+{
+    HbSelectionDialog *dlgSelection = static_cast<HbSelectionDialog*>(sender());
+    if(dlgSelection && dlgSelection->selectedModelIndexes().count() &&
+            (!action || action == dlgSelection->actions().at(0)))
+    {
+        int selectionIndex = dlgSelection->selectedModelIndexes().at(0).row();
+        HbInputDialog* dlgInput = new HbInputDialog();
+        dlgInput->setAttribute(Qt::WA_DeleteOnClose);
+        dlgInput->setPromptText(dlgSelection->stringItems()[selectionIndex]);
+        dlgInput->setInputMode(HbInputDialog::TextInput);
+        
+        HbLabel *title = new HbLabel(dlgInput);
+        title->setPlainText(QString("Set parameter value"));
+        dlgInput->setHeadingWidget(title);
+        
+        dlgInput->open(this, SLOT(doSetIPCfgParameter(HbAction*)));
+    }
+}
+
+void MainView::doSetIPCfgParameter(HbAction* action)
+{
+    HbInputDialog *dlg = static_cast<HbInputDialog*>(sender());
+    if (action == dlg->actions().at(0))
+    {
+        QString parameter = dlg->promptText();
+        QString value = dlg->value().toString();
+        mEngineWrapper.setIPCfgParam(parameter, value);
+    }
+}
+
+void MainView::openListDialog(const QStringList& items, const int currentSelection,
+        const QString &titleText, QObject* receiver, const char* member)
+{
+    // Create a list and some simple content for it
+    HbSelectionDialog *dlg = new HbSelectionDialog();
+    dlg->setAttribute(Qt::WA_DeleteOnClose);
+    // Set items to be popup's content
+    dlg->setStringItems(items);
+    dlg->setSelectionMode(HbAbstractItemView::SingleSelection);
+    QList<QVariant> current;
+    current.append(QVariant(currentSelection));
+    dlg->setSelectedItems(current);
+    
+    HbLabel *title = new HbLabel(dlg);
+    title->setPlainText(titleText);
+    dlg->setHeadingWidget(title);
+
+    // Launch popup and handle the user response:
+    dlg->open(receiver, member);
+}
+
+void MainView::openIPAddressDialog(const QString &titleText, QObject* receiver, const char* member)
+{
+    HbInputDialog* dlg = new HbInputDialog();
+    dlg->setAttribute(Qt::WA_DeleteOnClose);
+    dlg->setAdditionalRowVisible(true);
+    dlg->setPromptText(QString("IP Address:"), 0);
+    dlg->setInputMode(HbInputDialog::IpInput, 0);
+    dlg->setPromptText(QString("Port:"), 1);
+    dlg->setInputMode(HbInputDialog::IntInput, 1);
+    
+    HbLabel *title = new HbLabel(dlg);
+    title->setPlainText(titleText);
+    dlg->setHeadingWidget(title);
+    
+    dlg->open(receiver, member);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiAdminQt/mainview.h	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,162 @@
+/*
+* 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 HtiAdmin main.
+*
+*/
+
+#ifndef MAINVIEW_H
+#define MAINVIEW_H
+
+
+#include <hbview.h>
+#include "htienginewrapper.h"
+
+
+class HbMainWindow;
+class HbApplication;
+class SettingsView;
+class HbAction;
+class HbTextEdit;
+class HbTextItem;
+class HbLabel;
+class QGraphicsLinearLayout;
+class QGraphicsGridLayout;
+
+
+/**
+ * Class that implements the main view of Screen Grabber
+  */
+class MainView : public HbView
+{
+    Q_OBJECT
+    
+public:
+    
+    /**
+     * Constructor
+	*/
+    MainView(HbMainWindow &mainWindow, HtiEngineWrapper &engineWrapper);
+    
+    /**
+     * Destructor
+     */
+	~MainView();
+
+	/**
+     * Initializes Engine Wrapper
+     * @param app application class of Screen Grabber
+     */
+    void init(HbApplication &app);
+    
+    void enableSerialComm();
+    void enableBTComm();
+    void enableIPComm();
+    
+
+private slots:
+	void htiStatusChanged(HtiEngineWrapper::HtiStatus newStatus);
+	void commStatusChanged(QString& newStatus);
+	void updatePluginInfo(QStringList& pluginList);
+	void autostartStatusChanged(HtiEngineWrapper::AutoStartStatus newStatus);
+	void consoleStatusChanged(bool enabled);
+	void watchDogStatusChanged(bool enabled);
+	void commDetailsChanged(QString& newStatus);
+	
+	void startHti();
+	void stopHti();
+	void enableComm();
+	void setPriority();
+	void enableAutoStart();
+	void disableAutoStart();
+	void enableWatchdog();
+	void disableWatchdog();
+	void enableConsole();
+	void disableConsole();
+	void showParamList ();
+
+	void doSelectComm(HbAction*);
+	void doEnableSerialComm(HbAction* );
+	void doSelectIAP(HbAction* );
+	void doSelectIpComm(HbAction* );
+	void doListenOnPort(HbAction* );
+	void doConnectRemoteHost(HbAction*);
+	void doSelectBTComm(HbAction*);
+	void doEnableByBTAddress(HbAction*);
+	void doEnableByBTName(HbAction*);
+	void doSetPriority(HbAction*);
+	void doSelectCfgFile(HbAction*);
+	void doModifyHtiCfgFile(HbAction*);
+	void doModifyBtCfgFile(HbAction*);
+	void doModifySerialCfgFile(HbAction*);
+	void doModifyIPCfgFile(HbAction*);
+	void doSetHtiCfgParameter(HbAction*);
+	void doSetBtCfgParameter(HbAction*);
+	void doSetSerialCfgParameter(HbAction*);
+	void doSetIPCfgParameter(HbAction*);
+private:
+    
+    /**
+     * Creates menu
+     */
+    void createMenu(HbApplication &app);
+    
+    /**
+     * Creates toolbar components
+     */
+    void createToolbar();
+    
+    void createTexts();
+    
+    void openListDialog(const QStringList& items, const int currentSelection, 
+            const QString &titleText, QObject* receiver, const char* member);
+    void openIPAddressDialog(const QString &titleText, QObject* receiver, const char* member);
+	
+public:
+    
+private:
+	/* Main windo of Screen Grabber */
+    HbMainWindow &mMainWindow;
+    
+    /* Hti Engine Wrapper */
+    HtiEngineWrapper& mEngineWrapper;
+    
+    /* Actions that are used in toolbars and menus */
+    HbAction* mActionExit;
+    HbAction* mActionStartHti;
+    HbAction* mActionStopHti;
+    HbAction* mActionSelectComm;
+    HbAction* mActionSetPriority;
+    HbAction* mActionEnableAuto;
+    HbAction* mActionDisableAuto;
+    HbAction* mActionEnableWdog;
+    HbAction* mActionDisableWdog;
+    HbAction* mActionEnableConsole;
+	HbAction* mActionDisableConsole;
+	HbAction* mActionSetParameter;
+    
+    HbLabel* mHtiStatusTxt;
+    HbLabel* mHtiVersionTxt;
+    HbLabel* mHtiAutoStartStatusTxt;
+    HbLabel* mCommunicationTxt;
+    HbLabel* mCommDetailsTxt;
+    
+    QStringList mPluginList;
+    
+    QString mIapSelection;
+
+};
+
+#endif // MAINVIEW_H
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiDeviceReboot/group/HtiDeviceReboot.mmp	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,42 @@
+/*
+* 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 description file for HtiDeviceReboot in APP layer
+*
+*/
+
+#include <platform_paths.hrh>
+
+TARGET          HtiDeviceRebootUI.exe
+TARGETTYPE      EXE
+
+UID             0x1000008d 0x200212D6
+
+VENDORID        0x101FB657
+
+CAPABILITY      ALL -TCB
+
+SOURCEPATH      ../src
+SOURCE          HtiDeviceReboot.cpp
+
+APP_LAYER_SYSTEMINCLUDE
+
+LIBRARY         euser.lib
+LIBRARY         hal.lib
+LIBRARY         starterclient.lib
+LIBRARY         syslangutil.lib
+LIBRARY         flogger.lib
+
+SMPSAFE
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiDeviceReboot/group/bld.inf	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,32 @@
+/*
+* 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 file for HtiDeviceReboot
+*
+*/
+
+
+PRJ_PLATFORMS
+
+DEFAULT
+
+PRJ_EXPORTS
+
+PRJ_TESTEXPORTS
+
+PRJ_MMPFILES
+HtiDeviceReboot.mmp
+
+PRJ_TESTMMPFILES
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiDeviceReboot/src/HtiDeviceReboot.cpp	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,148 @@
+/*
+* 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:  HtiDeviceReboot implementation.
+*
+*/
+
+
+// INCLUDE FILES
+#include <e32base.h>
+#include <hal.h>
+#include <starterclient.h>
+#include <syslangutil.h>
+
+// CONSTANTS
+_LIT( KHtiDeviceRebootName, "HtiDeviceReboot" );
+_LIT( KParamNormalRfs, "rfsnormal" );
+_LIT( KParamDeepRfs,   "rfsdeep" );
+
+// MACROS
+
+// LOCAL CONSTANTS AND MACROS
+
+// MODULE DATA STRUCTURES
+
+// LOCAL FUNCTION PROTOTYPES
+LOCAL_C TInt StartL();
+LOCAL_C TInt Reboot(RStarterSession::TResetReason aReason);
+LOCAL_C TInt RestoreFactorySettings( TBool aIsDeepRfs );
+
+
+// FORWARD DECLARATIONS
+
+// ============================ LOCAL FUNCTIONS ===============================
+
+LOCAL_C TInt StartL()
+    {
+    TInt error = KErrNone;
+
+    TInt cmdLen = User::CommandLineLength();
+    HBufC* cmdLine = HBufC::NewLC( cmdLen );
+    TPtr ptCmdLine = cmdLine->Des();
+    User::CommandLine( ptCmdLine );
+
+    if ( cmdLen == 0 )
+        {
+        error = Reboot(RStarterSession::EUnknownReset);
+        }
+
+    else
+        {
+        TLex parser( *cmdLine );
+        TInt input;
+        TInt ret = parser.Val(input);
+        
+        parser.SkipCharacters();
+        if ( parser.MarkedToken().CompareF( KParamNormalRfs ) == 0 )
+            {
+            error = RestoreFactorySettings( EFalse );
+            }
+        else if ( parser.MarkedToken().CompareF( KParamDeepRfs ) == 0 )
+            {
+            error = RestoreFactorySettings( ETrue );
+            }
+        else
+            {
+            if(ret != KErrNone )
+                {
+                error = KErrArgument;  // Unknown argument
+                }
+            else
+                {
+                error = Reboot(static_cast<RStarterSession::TResetReason>(input));
+                }
+            }
+        }
+
+    CleanupStack::PopAndDestroy(); // cmdLine
+    return error;
+    }
+
+LOCAL_C TInt Reboot(RStarterSession::TResetReason aReason)
+    {
+    RStarterSession session;
+    TInt error = session.Connect();
+    if ( error == KErrNone )
+        {
+        session.Reset( aReason );
+        session.Close();
+        }
+    return error;
+    }
+
+LOCAL_C TInt RestoreFactorySettings( TBool aIsDeepRfs )
+    {
+    // In case of deep rfs, set language to default
+    if ( aIsDeepRfs )
+        {
+        TInt lang = 0;
+        if ( SysLangUtil::GetDefaultLanguage( lang ) == KErrNone )
+            {
+            HAL::Set( HALData::ELanguageIndex, lang );
+            }
+        }
+
+    // Do reboot with appropriate rfs reason code
+    RStarterSession session;
+    TInt error = session.Connect();
+    if ( error == KErrNone )
+        {
+        session.Reset( aIsDeepRfs ? RStarterSession::EDeepRFSReset :
+            RStarterSession::ENormalRFSReset );
+        session.Close();
+        }
+    return error;
+    }
+
+GLDEF_C TInt E32Main()
+    {
+    __UHEAP_MARK;
+
+    CTrapCleanup* cleanup = CTrapCleanup::New();
+    CActiveScheduler *scheduler = new(ELeave) CActiveScheduler;
+    CActiveScheduler::Install( scheduler );
+
+    User::RenameThread( KHtiDeviceRebootName );
+
+    TRAPD( err, StartL() );
+
+    delete scheduler;
+    delete cleanup;
+
+   __UHEAP_MARKEND;
+
+    return err;
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiServicePlugins/HtiAppServicePlugin/bwins/HtiAppControlu.def	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,3 @@
+EXPORTS
+	?NewHtiAppControl@@YAPAVCHtiAppControl@@XZ @ 1 NONAME ; class CHtiAppControl * NewHtiAppControl(void)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiServicePlugins/HtiAppServicePlugin/eabi/HtiAppControlu.def	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,3 @@
+EXPORTS
+	_Z16NewHtiAppControlv @ 1 NONAME
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiServicePlugins/HtiAppServicePlugin/group/HtiAppControl.mmp	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,59 @@
+/*
+* 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 description file for HtiAppControl
+*
+*/
+
+
+#include <platform_paths.hrh>
+#include "../../../symbian_version.hrh"
+
+TARGET      HtiAppControl.dll
+TARGETTYPE  dll
+
+
+UID 0x1020DEB7 0x2002B3E9
+
+VENDORID    0x101FB657
+
+CAPABILITY      ALL -TCB
+
+SOURCEPATH  ../src
+SOURCE      HtiAppControl.cpp
+
+USERINCLUDE     ../inc
+APP_LAYER_SYSTEMINCLUDE
+
+LIBRARY     bafl.lib
+LIBRARY     ecom.lib
+LIBRARY     efsrv.lib
+LIBRARY     euser.lib
+LIBRARY     apgrfx.lib
+LIBRARY     apparc.lib
+LIBRARY     apmime.lib
+LIBRARY     ws32.lib
+#if ( SYMBIAN_VERSION_SUPPORT < SYMBIAN_4 )
+LIBRARY     swinstcli.lib
+#else
+LIBRARY     sif.lib       // USIF
+LIBRARY     scrclient.lib // SCR
+#endif
+LIBRARY     sisregistryclient.lib
+LIBRARY     javaregistryclient.lib
+LIBRARY     widgetregistryclient.lib
+LIBRARY     flogger.lib
+
+SMPSAFE
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiServicePlugins/HtiAppServicePlugin/group/bld.inf	Wed Aug 25 15:45:01 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:  Build information file for HtiAppServicePlugin
+*
+*/
+
+
+PRJ_PLATFORMS
+
+PRJ_EXPORTS
+
+PRJ_MMPFILES
+HtiAppControl.mmp
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiServicePlugins/HtiAppServicePlugin/inc/HtiAppControl.h	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,226 @@
+/*
+* 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 ECOM plug-in service interface providing
+*                process and application control service.
+*
+*/
+
+
+
+#ifndef HTIAPPSERVICEPLUGIN_H__
+#define HTIAPPSERVICEPLUGIN_H__
+
+//  INCLUDES
+#include "../../../symbian_version.hrh"
+
+#include <e32base.h>
+#include <apgcli.h>
+#include <w32std.h>
+#if ( SYMBIAN_VERSION_SUPPORT < SYMBIAN_4 )
+#include <SWInstDefs.h>
+#include <swi/sisregistryentry.h>
+#else
+#include <usif/usifcommon.h>
+#endif
+#include <HtiServicePluginInterface.h>
+
+// CONSTANTS
+
+// MACROS
+
+// DATA TYPES
+
+// FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+class CDesC8ArrayFlat;
+class TApaTask;
+
+// CLASS DECLARATION
+
+NONSHARABLE_CLASS (CHtiAppControl) : public CHTIServicePluginInterface
+    {
+protected:
+    //commands
+    enum TAppCommand
+        {
+        //commands
+        EProcessLastCommand = 0x0F, //!!! used to sort process control from
+                                    //!!! app control
+
+        //app control
+        EStartApp               = 0x10,
+        EStartApp_u             = 0x11,
+        EStartApp_uid           = 0x12,
+        EStartApp_uid_u         = 0x13,
+        EStartDoc               = 0x14,
+        EStartDoc_u             = 0x15,
+        EStatusApp              = 0x16,
+        EStatusApp_u            = 0x17,
+        EStatusDoc              = 0x18,
+        EStatusDoc_u            = 0x19,
+        EStatusApp_uid          = 0x1A,
+        EStopApp                = 0x1C,
+        EStopApp_u              = 0x1D,
+        EStopDoc                = 0x1E,
+        EStopDoc_u              = 0x1F,
+        EStopApp_uid            = 0x20,
+        EListApps               = 0x24,
+        EListApps_u             = 0x25,
+        EListInstalledApps      = 0x26,
+        EListInstalledApps_u    = 0x27,
+
+        EAppLastCommand     = 0x2F, //!!! used to sort process control from
+                                    //!!! app control
+        EInstall            = 0x30,
+        EInstall_u          = 0x31,
+        EUnInstall          = 0x32,
+        EUnInstallName_u    = 0x33,
+        EUnInstallName      = 0x34,
+
+        ESisLastCommand = 0x3F, //!!! used to sort sis control from
+                                //!!! app control
+        //responses
+        EOk             = 0xF0,
+        ENotFound       = 0xF1,
+        EAlreadyRunning = 0xF2,
+        EAlreadyStopped = 0xF3,
+        ERunning        = 0xF4,
+        EKilled         = 0xF5,
+        EPanic          = 0xF6
+        };
+
+public:
+    static CHtiAppControl* NewL();
+
+    // Interface implementation
+    void ProcessMessageL(const TDesC8& aMessage,
+                         THtiMessagePriority aPriority);
+
+protected:
+    CHtiAppControl();
+    void ConstructL();
+
+    virtual ~CHtiAppControl();
+    
+    void HandleAppControlL(const TDesC8& aMessage);
+    void HandleInstallerControlL( const TDesC8& aMessage );
+    /**
+    * Extracts string from incoming request and convert it to unicode
+    * for non-unicode request
+    * aResult should have enough maz length and it will contain
+    * Function returns either offset for a next parameter in aRequest
+    * or some symbian error code
+    */
+    TInt ParseString( const TDesC8& aRequest,
+                      TInt anOffset,
+                      TBool aUnicode,
+                      TDes& aResult);
+
+    //command handlers
+    void HandleStartProcessL( const TDesC& aProgramName,
+                              const TDesC& aCmdLine,
+                              TBool aStoreProcessHandle );
+
+    void HandleStopProcessL( RProcess& aProcess );
+    void HandleStatusProcessL( RProcess& aProcess );
+
+    void HandleListProcessesL( const TDesC& aMatch );
+
+    void HandleStartAppL( TApaAppInfo &aAppInfo, const TDesC& aDocName );
+
+    void HandleListAppsL( TBool aIncludeHidden,
+                          TBool aIncludeSystem,
+                          TBool aUnicode );
+
+    void HandleListInstalledAppsL( TBool aUnicode );
+
+    //construct and send short message
+    void SendMessageL(TAppCommand aResponseCode, const TDesC8& aMsg = KNullDesC8 );
+
+    /**
+    * Helper to send error message
+    * @return KErrNone or some system-wide error code
+    */
+    inline TInt SendErrorMsg( TInt anError, const TDesC8& aMsg );
+
+    /**
+    *
+    */
+    TInt OpenProcessL( RProcess& aProcess, const TDesC& aMatch );
+    TInt OpenProcessL( RProcess& aProcess, const TUint32 aProcessId );
+
+#if ( SYMBIAN_VERSION_SUPPORT < SYMBIAN_4 )
+    SwiUI::TPolicy ConvertToPolicy( const TInt8 aValue );
+    TInt GetPackageUidL( const TDesC& aPackageName, TInt aMimeIndex );
+#else
+    Usif::TSifPolicy ConvertToSifPolicy( const TInt8 aValue );
+    TInt GetComponentIdFromUid(const TInt32 aUid);
+    TInt GetComponentIdFromPackageName(const TDesC& aPackageName);
+#endif
+
+    TBool ValidateInstallParams( const TDesC8& aParams, TBool aIsUnicode );
+
+    /**
+    * Find application based on its full path name and fill in aAppInfo
+    * @return KErrNone or KErrNotFound
+    */
+    TBool FindAppL( TApaAppInfo &aAppInfo, const TDesC& aAppFullName );
+    TBool FindAppL( TApaAppInfo &aAppInfo, const TInt32 aUid );
+
+    /**
+     * Find a task running the application specified by the UID as a root app
+     * (i.e. not embedded.
+     * @param aAppUid the UID of the application to find
+     * @return the found task or an empty task if not found
+     */
+    TApaTask FindRunningRootApp( TUid aAppUid );
+
+    /**
+    * Convert string to T 32bit int (e.g. TUint, TInt32)
+    */
+    template<class T> T Parse32( const TDesC8& a32int);
+
+protected:
+
+    // Session to Window Server
+    RWsSession iWs;
+
+    // Session to Application Architecture Server
+    RApaLsSession iAppServer;
+
+    // A flag that is set to EFalse if connecting to Window Server or
+    // Application Architecture Server fails. In that case all application
+    // related commands will return a "not supported" error.
+    TBool iIsAppCmdsSupported;
+
+    // Container array for process handles for querying the process exit codes
+    RArray<RProcess> iProcessHandleArray;
+
+    // possible mimetypes for silent software uninstallation
+    CDesC8ArrayFlat* iMimeTypes;
+
+#if ( SYMBIAN_VERSION_SUPPORT < SYMBIAN_4 )
+    SwiUI::TInstallOptions iInstOpts;
+    SwiUI::TInstallOptionsPckg iInstOptsPckg;
+    SwiUI::TUninstallOptions iUnInstOpts;
+    SwiUI::TUninstallOptionsPckg iUnInstOptsPckg;
+    RPointerArray<Swi::CSisRegistryPackage> iAugmentations;
+    TInt iAugmentationIndex;
+#endif
+    };
+
+#endif
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiServicePlugins/HtiAppServicePlugin/src/HtiAppControl.cpp	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,2094 @@
+/*
+* 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:  HtiAppControl implementation
+*
+*/
+
+
+// INCLUDE FILES
+#include <apacmdln.h>
+#include <apgtask.h>
+#include <apgwgnam.h>
+#include <apmstd.h>
+
+#include <badesca.h>
+#include <f32file.h>
+
+#include "HtiAppControl.h"
+#include <HtiDispatcherInterface.h>
+#include <HtiLogging.h>
+
+#if ( SYMBIAN_VERSION_SUPPORT < SYMBIAN_4 )
+#include <SWInstApi.h>
+#include <swi/sisregistrysession.h>
+#include <swi/sisregistrypackage.h>
+#else
+#include <usif/sif/sif.h>
+#include <usif/scr/scr.h>    //RSoftwareComponentRegistry
+#endif
+#include <javaregistryincludes.h>
+#include <widgetregistryclient.h>
+
+using namespace Java;
+#if ( SYMBIAN_VERSION_SUPPORT >= SYMBIAN_4 )
+_LIT8( KSisxMimeType, "x-epoc/x-sisx-app" );
+_LIT8( KSisMimeType, "application/vnd.symbian.install" );
+_LIT8( KPipMimeType, "application/x-pip" );
+_LIT8( KJadMIMEType, "text/vnd.sun.j2me.app-descriptor" );
+_LIT8( KJarMIMEType, "application/java-archive" );
+_LIT8( KJavaMIMEType, "application/java");
+_LIT8( KJarxMIMEType, "application/x-java-archive");
+#endif
+
+// CONSTANTS
+const static TUid KAppServiceUid = { 0x1020DEC7 }; //This is Uid of AppServiceOS
+
+//error descriptions
+_LIT8( KErrDescrNoMemory, "No memory" );
+_LIT8( KErrDescrInvalidCmd, "Invalid command" );
+_LIT8( KErrDescrInvalidArguments, "Invalid arguments" );
+_LIT8( KErrDescrFailedCreateProcess, "Failed create process" );
+_LIT8( KErrDescrNotSupported, "Command not supported" );
+
+_LIT8( KErrDescrFailedStartApp, "Failed start app" );
+_LIT8( KErrDescrInvalidUid, "Invalid application uid" );
+_LIT8( KErrDescrFailedFindApp, "Failed find app" );
+
+_LIT8( KErrDescrFailedConnectSilentInstaller, "Failed to connect to silent installer" );
+_LIT8( KErrDescrFailedInstall, "Failed to install" );
+_LIT8( KErrDescrFailedUnInstall, "Failed to uninstall" );
+_LIT8( KErrDescrFailedFindPackage, "Failed to find the package" );
+#if ( SYMBIAN_VERSION_SUPPORT >= SYMBIAN_4 )
+_LIT8( KErrDescrBadComponentId, "Bad component id");
+#endif
+_LIT8( KErrDescrFailedListInstApps, "Failed to list installed apps" );
+
+const static TUint8 KUnicodeMask = 0x01;
+const static TInt KTerminateReason = 0;
+const static TInt KTUintLength = sizeof(TUint);
+const static TInt KCloseTaskDelay = 250000; // microseconds
+
+// MACROS
+
+// LOCAL CONSTANTS AND MACROS
+
+// MODULE DATA STRUCTURES
+
+// LOCAL FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+// ============================ MEMBER FUNCTIONS ===============================
+CHtiAppControl* CHtiAppControl::NewL()
+    {
+    CHtiAppControl* self = new ( ELeave ) CHtiAppControl;
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop();
+    return self;
+    }
+
+// Constructor
+CHtiAppControl::CHtiAppControl():iIsAppCmdsSupported( EFalse )
+    {
+    }
+
+EXPORT_C CHtiAppControl* NewHtiAppControl()
+    {
+    return CHtiAppControl::NewL();
+    }
+
+CHtiAppControl::~CHtiAppControl()
+    {
+    HTI_LOG_FUNC_IN( "~CHtiAppControl" );
+
+    for ( TInt i = 0; i < iProcessHandleArray.Count(); i++ )
+        {
+        iProcessHandleArray[i].Close();
+        }
+    iProcessHandleArray.Close();
+
+    iAppServer.Close();
+    iWs.Close();
+
+    if ( iMimeTypes )
+        {
+        iMimeTypes->Reset();
+        delete iMimeTypes;
+        }
+
+#if ( SYMBIAN_VERSION_SUPPORT < SYMBIAN_4 )
+    iAugmentations.ResetAndDestroy();
+#endif
+
+    HTI_LOG_FUNC_OUT( "~CHtiAppControl" );
+    }
+
+// Second phase construction.
+void CHtiAppControl::ConstructL()
+    {
+    HTI_LOG_FUNC_IN( "CHtiAppControl::ConstructL" );
+    iMimeTypes = new (ELeave) CDesC8ArrayFlat( 8 );
+#if ( SYMBIAN_VERSION_SUPPORT < SYMBIAN_4 )
+    iMimeTypes->AppendL( SwiUI::KSisxMimeType() );
+    iMimeTypes->AppendL( SwiUI::KSisMimeType() );
+    iMimeTypes->AppendL( SwiUI::KPipMimeType() );
+    iMimeTypes->AppendL( SwiUI::KJadMIMEType() );
+    iMimeTypes->AppendL( SwiUI::KJarMIMEType() );
+    iMimeTypes->AppendL( SwiUI::KJavaMIMEType() );
+    iMimeTypes->AppendL( SwiUI::KJarxMIMEType() );
+#else
+    iMimeTypes->AppendL( KSisxMimeType() );
+    iMimeTypes->AppendL( KSisMimeType() );
+    iMimeTypes->AppendL( KPipMimeType() );
+    iMimeTypes->AppendL( KJadMIMEType() );
+    iMimeTypes->AppendL( KJarMIMEType() );
+    iMimeTypes->AppendL( KJavaMIMEType() );
+    iMimeTypes->AppendL( KJarxMIMEType() );
+#endif
+    iMimeTypes->AppendL( KWidgetMime() ); // from widgetregistryconstants.h
+#if ( SYMBIAN_VERSION_SUPPORT < SYMBIAN_4 )
+    iAugmentationIndex = 0;
+#endif
+
+    TInt err = iAppServer.Connect();
+    if ( err == KErrNone )
+        {
+        err = iWs.Connect();
+        }
+    if ( err == KErrNone )
+        {
+        iIsAppCmdsSupported = ETrue;
+        }
+    else
+        {
+        iAppServer.Close();
+        }
+    HTI_LOG_FUNC_OUT( "CHtiAppControl::ConstructL" );
+    }
+
+TInt CHtiAppControl::ParseString( const TDesC8& aRequest,
+                                        TInt anOffset,
+                                        TBool aUnicode,
+                                        TDes& aResult )
+    {
+    HTI_LOG_FUNC_IN( "CHtiAppControl::ParseString" );
+    //validate parameters
+    //if offset outside the string return empty string
+    if ( anOffset >= aRequest.Size() )
+        {
+        return anOffset;
+        }
+
+    TInt len = aRequest[anOffset];
+    HTI_LOG_FORMAT( "length %d", len );
+
+    if ( len > aResult.MaxLength() )
+        {
+        return KErrBadDescriptor;
+        }
+
+    TInt nextOffset = ( aUnicode ? len * 2 : len ) + anOffset + 1;
+    HTI_LOG_FORMAT( "nextOffset %d", nextOffset );
+    HTI_LOG_FORMAT( "reqSize %d", aRequest.Size() );
+    if ( nextOffset > aRequest.Size() )
+        {
+        return KErrArgument;
+        }
+
+    if ( aUnicode )
+        {
+        const TPtrC8 aFrom( aRequest.Mid( anOffset + 1, len * 2 ) );
+        aResult.SetLength( len );
+        for ( TInt i = 0; i < len; ++i )
+            {
+            aResult[i] = ( TUint16 ) aFrom[i << 1] +
+                ( ( ( TUint16 ) aFrom[( i << 1 ) + 1] ) << 8 );
+            }
+        }
+    else
+        {
+        aResult.Copy( aRequest.Mid( anOffset + 1, len ) );
+        }
+
+    HTI_LOG_FUNC_OUT( "CHtiAppControl::ParseString" );
+    return nextOffset;
+    }
+
+void CHtiAppControl::ProcessMessageL( const TDesC8& aMessage,
+                THtiMessagePriority /*aPriority*/ )
+    {
+    HTI_LOG_FUNC_IN( "CHtiAppControl::ProcessMessage" );
+    if ( aMessage.Length() < 1 )
+        {
+        // no command
+        SendErrorMsg( KErrArgument, KErrDescrInvalidCmd );
+        return;
+        }
+
+    if ( aMessage.Length() < 2 &&
+         aMessage[0] !=  EListInstalledApps &&
+         aMessage[0] !=  EListInstalledApps_u)
+        {
+         // parameter is required with all commands except
+         // listing processes or installed applications
+        SendErrorMsg( KErrArgument, KErrDescrInvalidCmd );
+        return;
+        }
+
+    HTI_LOG_FORMAT( "cmd %d", aMessage[0] );
+
+    if ( aMessage[0] > EProcessLastCommand &&
+              aMessage[0] < EAppLastCommand)
+        {
+        if ( iIsAppCmdsSupported )
+            {
+            HandleAppControlL( aMessage );
+            }
+        else
+            {
+            SendErrorMsg( KErrNotSupported, KErrDescrNotSupported );
+            }
+        }
+    else if ( aMessage[0] > EAppLastCommand &&
+              aMessage[0] < ESisLastCommand )
+        {
+        HandleInstallerControlL( aMessage );
+        }
+    else
+        {
+        SendErrorMsg( KErrArgument, KErrDescrInvalidCmd );
+        }
+    HTI_LOG_FUNC_OUT( "CHtiAppControl::ProcessMessage" );
+    }
+
+void CHtiAppControl::HandleAppControlL( const TDesC8& aMessage )
+    {
+    HTI_LOG_FUNC_IN( "CHtiAppControl::HandleAppControl" );
+
+    TBool unicode = aMessage[0] & KUnicodeMask;
+
+    HTI_LOG_FORMAT( "unicode %d", unicode );
+
+    TApaAppInfo appInfo;
+    TFileName appName;
+    TFileName docName;
+
+    switch ( aMessage[0] )
+        {
+        case EStartApp_uid:
+        case EStartApp_uid_u:
+            {
+            TPtrC8 parameters = aMessage.Mid( 1 );
+            if ( parameters.Length() >= 4 )
+                {
+                TInt32 uid = Parse32<TInt32>( parameters );
+
+                TInt offset = ParseString( parameters, 4, unicode, docName );
+                if ( offset >= 0)
+                    {
+                    if ( FindAppL( appInfo, uid ) )
+                        {
+                        HandleStartAppL( appInfo, docName );
+                        }
+                    }
+                else
+                    {
+                    SendErrorMsg( offset , KErrDescrInvalidArguments );
+                    }
+                }
+            else
+                {
+                SendErrorMsg( KErrArgument , KErrDescrInvalidUid );
+                }
+            }
+            break;
+        case EStartApp:
+        case EStartApp_u:
+            {
+            TInt offset = ParseString( aMessage, 1, unicode, appName );
+            if ( offset >= 0 )
+                {
+                offset = ParseString( aMessage, offset, unicode, docName );
+                if ( offset >= 0 )
+                    {
+                    //find appInfo by app full name
+                    if ( FindAppL( appInfo, appName ) )
+                        {
+                        HTI_LOG_TEXT( "call HandleStartAppL" );
+                        HandleStartAppL( appInfo, docName );
+                        }
+                    }
+                }
+
+            if ( offset < 0 )
+                {
+                SendErrorMsg( offset , KErrDescrInvalidArguments );
+                }
+            }
+            break;
+        case EStartDoc:
+        case EStartDoc_u:
+            {
+            TInt offset = ParseString( aMessage, 1, unicode, docName );
+            if ( offset >= 0 )
+                {
+                HandleStartAppL( appInfo, docName ); //appInfo is empty
+                }
+            else
+                {
+                SendErrorMsg( offset , KErrDescrInvalidArguments );
+                }
+            }
+            break;
+        case EStatusApp_uid:
+            {
+            TPtrC8 appUid8 = aMessage.Mid( 1 );
+            if ( appUid8.Length() == 4 )
+                {
+                TApaTaskList tl( iWs );
+                TInt32 appUid = Parse32<TInt32>( appUid8 );
+                TApaTask task = tl.FindApp( TUid::Uid( appUid ) );
+                if ( task.Exists() )
+                    {
+                    SendMessageL( ERunning );
+                    }
+                else
+                    {
+                    SendMessageL( ENotFound );
+                    }
+                }
+            else
+                {
+                SendErrorMsg( KErrArgument, KErrDescrInvalidUid );
+                }
+            }
+            break;
+        case EStatusApp:
+        case EStatusApp_u:
+            {
+            TInt offset = ParseString( aMessage, 1, unicode, appName );
+            if ( offset >= 0 )
+                {
+                TApaTaskList tl( iWs );
+                TApaTask task = tl.FindApp( appName );
+                if ( task.Exists() )
+                    {
+                    SendMessageL( ERunning );
+                    break; // we are done
+                    }
+
+                // Maybe the user gave path or filename instead of caption
+                if ( FindAppL( appInfo, appName ) )
+                    {
+                    TApaTask task2 = tl.FindApp( appInfo.iUid );
+                    if ( task2.Exists() )
+                        {
+                        SendMessageL( ERunning );
+                        }
+                    else
+                        {
+                        SendMessageL( ENotFound );
+                        }
+                    }
+                // If app was not found by FindAppL method, a response message
+                // has already been sent there - no need to send anything here.
+                }
+            else
+                {
+                SendErrorMsg( offset , KErrDescrInvalidArguments );
+                }
+            }
+            break;
+        case EStatusDoc:
+        case EStatusDoc_u:
+            {
+            TInt offset = ParseString( aMessage, 1, unicode, docName );
+            if ( offset >= 0 )
+                {
+                TApaTaskList tl( iWs );
+                TApaTask task = tl.FindDoc( docName );
+                if ( task.Exists() )
+                    {
+                    SendMessageL( ERunning );
+                    }
+                else
+                    {
+                    SendMessageL( ENotFound );
+                    }
+                }
+            else
+                {
+                SendErrorMsg( offset , KErrDescrInvalidArguments );
+                }
+            }
+            break;
+        case EStopApp:
+        case EStopApp_u:
+            {
+            TInt offset = ParseString( aMessage, 1, unicode, appName );
+            if ( offset >= 0 )
+                {
+                TApaTaskList tl( iWs );
+                TApaTask task = tl.FindApp( appName );
+                if ( task.Exists() )
+                    {
+                    task.EndTask();
+                    User::After( KCloseTaskDelay );
+                    TApaTask task = tl.FindApp( appName );
+                    if ( task.Exists() )
+                        {
+                        task.KillTask();
+                        }
+                    SendMessageL( EOk );
+                    break; // we are done
+                    }
+
+                // Maybe the user gave path or filename instead of caption
+                if ( FindAppL( appInfo, appName ) )
+                    {
+                    TApaTask task2 = tl.FindApp( appInfo.iUid );
+                    if ( task2.Exists() )
+                        {
+                        task2.EndTask();
+                        User::After( KCloseTaskDelay );
+                        TApaTask task2 = tl.FindApp( appInfo.iUid );
+                        if ( task2.Exists() )
+                            {
+                            task2.KillTask();
+                            }
+                        SendMessageL( EOk );
+                        }
+                    else
+                        {
+                        SendMessageL( ENotFound );
+                        }
+                    }
+                // If app was not found by FindAppL method, a response message
+                // has already been sent there - no need to send anything here.
+                }
+            else
+                {
+                SendErrorMsg( offset , KErrDescrInvalidArguments );
+                }
+            }
+            break;
+        case EStopDoc:
+        case EStopDoc_u:
+            {
+            TInt offset = ParseString( aMessage, 1, unicode, docName );
+            if ( offset >= 0 )
+                {
+                TApaTaskList tl( iWs );
+                TApaTask task = tl.FindDoc( docName );
+                if ( task.Exists() )
+                    {
+                    task.EndTask();
+                    User::After( KCloseTaskDelay );
+                    TApaTask task = tl.FindDoc( docName );
+                    if ( task.Exists() )
+                        {
+                        task.KillTask();
+                        }
+                    SendMessageL( EOk );
+                    }
+                else
+                    {
+                    SendMessageL( ENotFound );
+                    }
+                }
+            else
+                {
+                SendErrorMsg( offset , KErrDescrInvalidArguments );
+                }
+            }
+            break;
+        case EStopApp_uid:
+            {
+            TPtrC8 appUid8 = aMessage.Mid( 1 );
+            if ( appUid8.Length() == 4 )
+                {
+                TApaTaskList tl( iWs );
+                TInt32 appUid = Parse32<TInt32>( appUid8 );
+                TApaTask task = tl.FindApp( TUid::Uid( appUid ) );
+                if ( task.Exists() )
+                    {
+                    task.EndTask();
+                    User::After(KCloseTaskDelay);
+                    TApaTask task = tl.FindApp( TUid::Uid( appUid ) );
+                    if ( task.Exists() )
+                        {
+                        task.KillTask();
+                        }
+                    SendMessageL( EOk );
+                    }
+                else
+                    {
+                    SendMessageL( ENotFound );
+                    }
+                }
+            else
+                {
+                SendErrorMsg( KErrArgument , KErrDescrInvalidUid );
+                }
+            }
+            break;
+        case EListApps:
+        case EListApps_u:
+            {
+            if ( aMessage.Length() != 3 )
+                {
+                SendErrorMsg( KErrArgument, KErrDescrInvalidArguments );
+                }
+            else
+                {
+                HandleListAppsL( aMessage[1], aMessage[2], unicode );
+                }
+            }
+            break;
+        case EListInstalledApps:
+        case EListInstalledApps_u:
+            {
+            if ( aMessage.Length() != 1 )
+                {
+                SendErrorMsg( KErrArgument, KErrDescrInvalidArguments );
+                }
+            else
+                {
+                HandleListInstalledAppsL( unicode );
+                }
+            }
+            break;
+        default:
+            {
+            SendErrorMsg( KErrArgument, KErrDescrInvalidCmd );
+            }
+        }
+
+    HTI_LOG_FUNC_OUT("CHtiAppControl::HandleAppControl");
+    }
+
+void CHtiAppControl::HandleInstallerControlL( const TDesC8& aMessage )
+    {
+    HTI_LOG_FUNC_IN( "CHtiAppControl::HandleInstallerControlL" );
+
+    if ( aMessage.Length() < 2 )
+        {
+        HTI_LOG_TEXT( "Command parameters missing" );
+        SendErrorMsg( KErrArgument , KErrDescrInvalidCmd );
+        return;
+        }
+
+    TBool unicode = aMessage[0] & KUnicodeMask;
+    HTI_LOG_FORMAT( "Unicode flag: %d", unicode );
+
+    TFileName path;
+#if ( SYMBIAN_VERSION_SUPPORT < SYMBIAN_4 )
+    TBuf<SwiUI::KSWInstMaxPasswordLength> login;
+    TBuf<SwiUI::KSWInstMaxPasswordLength> password;
+#endif
+
+    switch ( aMessage[0] )
+        {
+        case EInstall:
+        case EInstall_u:
+            {
+            TPtrC8 parameters = aMessage.Mid( 1 );
+            if ( ValidateInstallParams( parameters, unicode ) )
+                {
+                TInt offset = ParseString( parameters, 0, unicode, path );
+
+                HTI_LOG_TEXT( "Parsed path to install package:" );
+                HTI_LOG_DES( path )
+
+                if ( offset >= 0)
+                    {
+#if ( SYMBIAN_VERSION_SUPPORT < SYMBIAN_4 )
+                    iInstOpts = SwiUI::TInstallOptions();
+
+                    iInstOpts.iUpgrade =            ConvertToPolicy( parameters[offset] ); offset++;
+                    iInstOpts.iOptionalItems =      ConvertToPolicy( parameters[offset] ); offset++;
+                    iInstOpts.iOCSP =               ConvertToPolicy( parameters[offset] ); offset++;
+                    iInstOpts.iIgnoreOCSPWarnings = ConvertToPolicy( parameters[offset] ); offset++;
+                    iInstOpts.iUntrusted =          ConvertToPolicy( parameters[offset] ); offset++;
+                    iInstOpts.iPackageInfo =        ConvertToPolicy( parameters[offset] ); offset++;
+                    iInstOpts.iCapabilities =       ConvertToPolicy( parameters[offset] ); offset++;
+                    iInstOpts.iKillApp =            ConvertToPolicy( parameters[offset] ); offset++;
+                    iInstOpts.iOverwrite =          ConvertToPolicy( parameters[offset] ); offset++;
+                    iInstOpts.iDownload =           ConvertToPolicy( parameters[offset] ); offset++;
+
+                    HTI_LOG_FORMAT( "iUpgrade: %d",            iInstOpts.iUpgrade );
+                    HTI_LOG_FORMAT( "iOptionalItems: %d",      iInstOpts.iOptionalItems );
+                    HTI_LOG_FORMAT( "iOCSP: %d",               iInstOpts.iOCSP );
+                    HTI_LOG_FORMAT( "iIgnoreOCSPWarnings: %d", iInstOpts.iIgnoreOCSPWarnings );
+                    HTI_LOG_FORMAT( "iUntrusted: %d",          iInstOpts.iUntrusted );
+                    HTI_LOG_FORMAT( "iPackageInfo: %d",        iInstOpts.iPackageInfo );
+                    HTI_LOG_FORMAT( "iCapabilities: %d",       iInstOpts.iCapabilities );
+                    HTI_LOG_FORMAT( "iKillApp: %d",            iInstOpts.iKillApp );
+                    HTI_LOG_FORMAT( "iOverwrite: %d",          iInstOpts.iOverwrite );
+                    HTI_LOG_FORMAT( "iDownload: %d",           iInstOpts.iDownload );
+
+                    offset = ParseString( parameters, offset, unicode, login );
+                    iInstOpts.iLogin.Copy( login );
+                    HTI_LOG_TEXT( "Parsed login:" );
+                    HTI_LOG_DES( login )
+
+                    offset = ParseString( parameters, offset, unicode, password );
+                    iInstOpts.iPassword.Copy( password );
+                    HTI_LOG_TEXT( "Parsed password:" );
+                    HTI_LOG_DES( password )
+
+                    iInstOpts.iDrive =        (TChar) parameters[offset]; offset++;
+                    iInstOpts.iLang =         (TLanguage) parameters[offset]; offset++;
+                    iInstOpts.iUsePhoneLang = (TBool) parameters[offset]; offset++;
+                    iInstOpts.iUpgradeData =  ConvertToPolicy( parameters[offset] );
+                    offset++;
+                    HTI_LOG_FORMAT( "parameters length: %d", parameters.Length());
+                    HTI_LOG_FORMAT( "next offset: %d", offset);
+
+                    if(parameters.Length() > offset)
+                        {
+                        TInt language = iInstOpts.iLang;
+                        if (parameters.Length() == offset+2)
+                            {
+                            language = parameters[offset] + (parameters[offset+1]<<8);
+                            }
+                        if (parameters.Length() == offset+1)
+                            {
+                            language = parameters[offset];
+                            }
+                        if ((language > ELangTest) && (language < ELangMaximum))
+                            {
+                            iInstOpts.iLang =         (TLanguage) language;
+                            }
+                        }
+                    HTI_LOG_FORMAT( "iDrive: %c",        iInstOpts.iDrive.GetLowerCase() );
+                    HTI_LOG_FORMAT( "iLang: %d",         iInstOpts.iLang );
+                    HTI_LOG_FORMAT( "iUsePhoneLang: %d", iInstOpts.iUsePhoneLang );
+                    HTI_LOG_FORMAT( "iUpgradeData: %d",  iInstOpts.iUpgradeData );
+
+                    iInstOptsPckg = iInstOpts;
+
+                    // Connect to silent installer
+                    SwiUI::RSWInstSilentLauncher launcher;
+                    TInt err = launcher.Connect();
+                    if ( err )
+                        {
+                        HTI_LOG_FORMAT( "Error connecting to silent installer, err: %d", err );
+                        SendErrorMsg( err , KErrDescrFailedConnectSilentInstaller );
+                        break;
+                        }
+
+                    err = launcher.SilentInstall( path, iInstOptsPckg );
+                    if ( err )
+                        {
+                        HTI_LOG_FORMAT( "Error installing software, err: %d", err );
+                        launcher.Close();
+                        SendErrorMsg( err , KErrDescrFailedInstall );
+                        break;
+                        }
+
+                    launcher.Close();
+                    SendMessageL( EOk );
+#else
+                    HTI_LOG_TEXT( "============RSoftwareInstall::Install=============" );
+                    Usif::RSoftwareInstall installer;
+                    TInt err = installer.Connect();
+                    if(err)
+                        {
+                        SendErrorMsg( err , KErrDescrFailedConnectSilentInstaller );
+                        HTI_LOG_FORMAT("cannot connect to SIF server, err %d", err);
+                        User::Leave(err);
+                        }
+                    CleanupClosePushL(installer);
+                    TRequestStatus status;
+                    Usif::COpaqueNamedParams *arguments = Usif::COpaqueNamedParams::NewL();
+                    CleanupStack::PushL(arguments);
+                    Usif::COpaqueNamedParams *results = Usif::COpaqueNamedParams::NewL();
+                    CleanupStack::PushL(results);
+                    
+                    arguments->AddIntL(Usif::KSifInParam_InstallSilently, ETrue);
+                    
+                    TInt intValue = ConvertToSifPolicy(parameters[offset]); offset++;
+                    if(intValue != Usif::EAllowed)
+                        arguments->AddIntL(Usif::KSifInParam_AllowUpgrade, intValue);
+                    HTI_LOG_FORMAT( "iUpgrade: %d", intValue );
+                    intValue = ConvertToSifPolicy(parameters[offset]); offset++; 
+                    if(intValue != Usif::EAllowed)
+                        arguments->AddIntL(Usif::KSifInParam_InstallOptionalItems, intValue);
+                    HTI_LOG_FORMAT( "iOptionalItems: %d", intValue );
+                    intValue = ConvertToSifPolicy(parameters[offset]); offset++;
+                    if(intValue != Usif::EAllowed)
+                        arguments->AddIntL(Usif::KSifInParam_PerformOCSP, intValue);
+                    HTI_LOG_FORMAT( "iOCSP: %d", intValue );
+                    intValue = ConvertToSifPolicy(parameters[offset]); offset++;
+                    if(intValue != Usif::EAllowed)
+                        arguments->AddIntL(Usif::KSifInParam_IgnoreOCSPWarnings, intValue);
+                    HTI_LOG_FORMAT( "iIgnoreOCSPWarnings: %d", intValue );
+                    intValue = ConvertToSifPolicy(parameters[offset]); offset++;
+                    if(intValue != Usif::ENotAllowed)
+                        arguments->AddIntL(Usif::KSifInParam_AllowUntrusted, intValue);
+                    HTI_LOG_FORMAT( "iUntrusted: %d", intValue );
+                    intValue = ConvertToSifPolicy(parameters[offset]); offset++;
+                    if(intValue != Usif::EAllowed)
+						arguments->AddIntL(Usif::KSifInParam_PackageInfo, intValue);
+                    HTI_LOG_FORMAT( "iPackageInfo: %d", intValue );
+                    intValue = ConvertToSifPolicy(parameters[offset]); offset++;
+                    if(intValue != Usif::EAllowed)
+                        arguments->AddIntL(Usif::KSifInParam_GrantCapabilities,intValue);
+                    HTI_LOG_FORMAT( "iCapabilities: %d", intValue );
+                    intValue = ConvertToSifPolicy(parameters[offset]); offset++;
+                    if(intValue != Usif::EAllowed)
+                        arguments->AddIntL(Usif::KSifInParam_AllowAppShutdown,intValue);
+                    HTI_LOG_FORMAT( "iKillApp: %d", intValue );
+                    intValue = ConvertToSifPolicy(parameters[offset]); offset++;
+                    if(intValue != Usif::EAllowed)
+                        arguments->AddIntL(Usif::KSifInParam_AllowOverwrite,intValue);
+                    HTI_LOG_FORMAT( "iOverwrite: %d", intValue );
+                    intValue = ConvertToSifPolicy(parameters[offset]); offset++;
+                    if(intValue != Usif::EAllowed)
+                        arguments->AddIntL(Usif::KSifInParam_AllowDownload, intValue);
+                    HTI_LOG_FORMAT( "iDownload: %d", intValue );
+
+                    TBuf<32> login;
+                    offset = ParseString( parameters, offset, unicode, login );
+                    HTI_LOG_FORMAT( "login length: %d", login.Length() );
+                    if(login != KNullDesC)
+                        {
+                        arguments->AddStringL(Usif::KSifInParam_UserName, login);
+                        }
+                    HTI_LOG_TEXT( "Parsed login:" );
+                    HTI_LOG_DES( login )
+
+                    TBuf<32> password;
+                    offset = ParseString( parameters, offset, unicode, password );
+                    HTI_LOG_FORMAT( "password length: %d", password.Length() );
+                    if(password != KNullDesC)
+                        {
+                        arguments->AddStringL(Usif::KSifInParam_Password, password );
+                        }
+                    HTI_LOG_TEXT( "Parsed password:" );
+                    HTI_LOG_DES( password )
+
+                    TChar driver = (TChar) parameters[offset]; offset++;
+                    if(driver >= 'A' && driver <= 'Z')
+                        {
+                        intValue = driver - (TChar)'A';
+                        arguments->AddIntL(Usif::KSifInParam_Drive, intValue);
+                        HTI_LOG_FORMAT( "iDrive: %c", intValue + 'a' );
+                        }
+                    else if(driver >= 'a' && driver <= 'z')
+                        {
+                        intValue = driver - (TChar)'a';
+                        arguments->AddIntL(Usif::KSifInParam_Drive, intValue);
+                        HTI_LOG_FORMAT( "iDrive: %c", intValue + 'a' );
+                        }
+
+                    TLanguage oldFormatLanuage = (TLanguage)parameters[offset]; offset++;
+
+                    TBool usePhoneLang = (TBool)parameters[offset]; offset++;
+                    HTI_LOG_FORMAT( "iUsePhoneLang: %d", usePhoneLang );
+
+                    intValue =  ConvertToSifPolicy( parameters[offset] );offset++;
+                    /*if(intValue != Usif::EAllowed)
+                        arguments->AddIntL(Usif::KSifInParam_AllowUpgrade, intValue);*/
+                    HTI_LOG_FORMAT( "iUpgradeData: %d",  intValue ); 
+                    
+                    HTI_LOG_FORMAT( "parameters length: %d", parameters.Length());
+                    HTI_LOG_FORMAT( "next offset: %d", offset);
+
+                    if(usePhoneLang == EFalse)
+                        {
+                        if(parameters.Length() > offset)
+                            {
+                            TLanguage language = ELangTest;
+                            if (parameters.Length() == offset+2)
+                                {
+                                language = (TLanguage)(parameters[offset] + (parameters[offset+1]<<8));
+                                }
+                            else if (parameters.Length() == offset+1)
+                                {
+                                language = (TLanguage)(parameters[offset]);
+                                }
+                            if ((language > ELangTest) && (language < ELangMaximum))
+                                {
+                                arguments->AddIntL(Usif::KSifInParam_Languages, language);
+                                HTI_LOG_FORMAT( "iLang: %d", language );
+                                }
+                            }
+                        else
+                            {
+                            arguments->AddIntL(Usif::KSifInParam_Languages, oldFormatLanuage);
+                            HTI_LOG_FORMAT( "iLang0: %d", oldFormatLanuage );
+                            }
+                        }
+
+                    installer.Install(path, *arguments, *results, status);
+                    User::WaitForRequest(status);
+                    HTI_LOG_FORMAT("install status: %d", status.Int());
+                    TInt componentId = 0;
+                    TBool idExisted = results->GetIntByNameL(Usif::KSifOutParam_ComponentId, componentId);
+                    if ( idExisted )
+                        {
+                        HTI_LOG_FORMAT( "componentId:%d", componentId);
+                        }
+                    CleanupStack::PopAndDestroy(3);
+                    if (status != KErrNone)
+                        {
+                        SendErrorMsg( status.Int(), KErrDescrFailedInstall );
+                        break;
+                        }
+                    SendMessageL( EOk );
+#endif
+                    }
+                else
+                    {
+                    HTI_LOG_TEXT( "Error parsing path" );
+                    SendErrorMsg( offset , KErrDescrInvalidArguments );
+                    }
+                }
+            else
+                {
+                SendErrorMsg( KErrArgument, KErrDescrInvalidCmd );
+                }
+            }
+            break;
+
+        case EUnInstall:
+        case EUnInstallName:
+        case EUnInstallName_u:
+            {
+            TPtrC8 parameters = aMessage.Mid( 1 );
+            if ( ( aMessage[0] == EUnInstall && parameters.Length() != 7 ) ||
+                 ( aMessage[0] == EUnInstallName &&
+                   parameters.Length() != parameters[0] + 4 ) ||
+                 ( aMessage[0] == EUnInstallName_u &&
+                   parameters.Length() != parameters[0] * 2 + 4 ) )
+                {
+                HTI_LOG_FORMAT( "Invalid command length: %d",
+                    parameters.Length() );
+                SendErrorMsg( KErrArgument, KErrDescrInvalidCmd );
+                break;
+                }
+
+            TInt offset = 0;
+            TInt32 uid = KErrNotFound;
+            HBufC* packageName = NULL;
+#if ( SYMBIAN_VERSION_SUPPORT >= SYMBIAN_4 )
+            Usif::TComponentId cid = KErrNotFound; 
+            HTI_LOG_TEXT( "============RSoftwareInstall::Uninstall=============" );
+            Usif::RSoftwareInstall installer;
+            TInt err = installer.Connect();
+            if(err)
+                {
+                SendErrorMsg( err , KErrDescrFailedConnectSilentInstaller );
+                HTI_LOG_FORMAT("cannot connect to SIF server, err %d", err);
+                User::Leave(err);
+                }
+            CleanupClosePushL(installer);
+            TRequestStatus status;
+            Usif::COpaqueNamedParams *arguments = Usif::COpaqueNamedParams::NewL();
+            CleanupStack::PushL(arguments);
+            Usif::COpaqueNamedParams *results = Usif::COpaqueNamedParams::NewL();
+            CleanupStack::PushL(results);
+#endif
+            if ( aMessage[0] == EUnInstall )
+                {
+                uid = Parse32<TInt32>( parameters );
+                offset += 4;
+                HTI_LOG_FORMAT( "Uninstall by uid: %d", uid );
+#if ( SYMBIAN_VERSION_SUPPORT >= SYMBIAN_4 )
+                cid = GetComponentIdFromUid(uid);
+                if ( cid == KErrNotFound )
+                    {
+                    HTI_LOG_FORMAT( "cid: %d", cid );
+                    SendErrorMsg( KErrNotFound, KErrDescrBadComponentId );
+                    CleanupStack::PopAndDestroy(3); //results, arguments, installer
+                    break;
+                    }
+#endif
+                }
+            else
+                {
+                packageName = HBufC::NewLC( parameters[offset] );
+                TPtr namePtr = packageName->Des();
+                offset = ParseString( parameters, offset, unicode, namePtr );
+                HTI_LOG_FORMAT( "Uninstall by name: %S", packageName );
+#if ( SYMBIAN_VERSION_SUPPORT >= SYMBIAN_4 )
+                cid = GetComponentIdFromPackageName(*packageName);
+                CleanupStack::PopAndDestroy(); // packageName
+                if ( cid == KErrNotFound )
+                    {
+                    HTI_LOG_FORMAT( "cid: %d", cid );
+                    SendErrorMsg( KErrNotFound, KErrDescrFailedFindPackage );
+                    CleanupStack::PopAndDestroy(3); //results, arguments, installer
+                    break;
+                    }
+#endif
+                }
+#if ( SYMBIAN_VERSION_SUPPORT < SYMBIAN_4 )
+            iUnInstOpts = SwiUI::TUninstallOptions();
+            iUnInstOpts.iKillApp = ConvertToPolicy( parameters[offset] );
+            offset++;
+            iUnInstOpts.iBreakDependency = ConvertToPolicy( parameters[offset] );
+            offset++;
+            HTI_LOG_FORMAT( "iKillApp: %d",         iUnInstOpts.iKillApp );
+            HTI_LOG_FORMAT( "iBreakDependency: %d", iUnInstOpts.iBreakDependency );
+
+            TInt mimeIndex = parameters[offset];
+            if ( mimeIndex > iMimeTypes->Count() - 1 )
+                {
+                HTI_LOG_FORMAT( "Invalid mime type: %d", mimeIndex );
+                SendErrorMsg( KErrArgument, KErrDescrInvalidCmd );
+                break;
+                }
+
+            HTI_LOG_TEXT( "Uninstall mime type:" );
+            HTI_LOG_DES( (*iMimeTypes)[mimeIndex] );
+
+            TInt err = KErrNone;
+            iAugmentationIndex = 0;
+            if ( packageName )
+                {
+                TRAP( err, uid = GetPackageUidL( *packageName, mimeIndex ) );
+                CleanupStack::PopAndDestroy(); // packageName
+                iAugmentations.ResetAndDestroy();
+                if ( err != KErrNone )
+                    {
+                    SendErrorMsg( err, KErrDescrFailedFindPackage );
+                    break;
+                    }
+                }
+            HTI_LOG_FORMAT( "UID = %d", uid );
+
+            iUnInstOptsPckg = iUnInstOpts;
+
+            // Connect to silent installer
+            SwiUI::RSWInstSilentLauncher launcher;
+            err = launcher.Connect();
+            if ( err )
+                {
+                HTI_LOG_FORMAT( "Error connecting to silent installer, err: %d", err );
+                SendErrorMsg( err , KErrDescrFailedConnectSilentInstaller );
+                break;
+                }
+
+            if ( iAugmentationIndex > 0 )
+                {
+                SwiUI::TOpUninstallIndexParam params;
+                params.iUid = TUid::Uid( uid );
+                params.iIndex = iAugmentationIndex;
+                SwiUI::TOpUninstallIndexParamPckg paramPckg( params );
+                SwiUI::TOperation operation( SwiUI::EOperationUninstallIndex );
+                err = launcher.SilentCustomUninstall( operation, iUnInstOptsPckg,
+                    paramPckg, (*iMimeTypes)[mimeIndex] );
+                }
+            else
+                {
+                err = launcher.SilentUninstall( TUid::Uid( uid ), iUnInstOptsPckg,
+                        (*iMimeTypes)[mimeIndex] );
+                }
+
+            if ( err )
+                {
+                HTI_LOG_FORMAT( "Error uninstalling software, err: %d", err );
+                launcher.Close();
+                SendErrorMsg( err , KErrDescrFailedUnInstall );
+                break;
+                }
+
+            launcher.Close();
+#else
+            
+            TInt intValue = ConvertToSifPolicy( parameters[offset] );
+            offset++;
+            arguments->AddIntL(Usif::KSifInParam_AllowAppShutdown, intValue);
+            HTI_LOG_FORMAT( "iKillApp: %d", intValue );
+            intValue = ConvertToSifPolicy( parameters[offset] );
+            offset++;
+            arguments->AddIntL(Usif::KSifInParam_AllowAppBreakDependency, intValue);
+            HTI_LOG_FORMAT( "iBreakDependency: %d", intValue );
+
+            TInt mimeIndex = parameters[offset];
+            if ( mimeIndex > iMimeTypes->Count() - 1 )
+                {
+                HTI_LOG_FORMAT( "Invalid mime type: %d", mimeIndex );
+                SendErrorMsg( KErrArgument, KErrDescrInvalidCmd );
+                break;
+                }
+
+            HTI_LOG_TEXT( "Uninstall mime type:" );
+            HTI_LOG_DES( (*iMimeTypes)[mimeIndex] );
+
+            HBufC* buf = HBufC::NewLC((*iMimeTypes)[mimeIndex].Length());
+            TPtr ptr = buf->Des();
+            ptr.Copy((*iMimeTypes)[mimeIndex]);
+            arguments->AddStringL(Usif::KSifInParam_MimeType, *buf);
+            CleanupStack::PopAndDestroy(); // buf
+      
+            HTI_LOG_FORMAT( "Component ID = %d", cid );
+            
+            arguments->AddIntL(Usif::KSifInParam_InstallSilently, ETrue);
+            
+            installer.Uninstall(cid, *arguments, *results, status, EFalse);
+            User::WaitForRequest(status);
+            HTI_LOG_FORMAT("uninstall status:%d", status.Int());
+            CleanupStack::PopAndDestroy(3); //results, arguments, installer
+            if (status != KErrNone)
+                {
+                SendErrorMsg(status.Int(), KErrDescrFailedUnInstall);
+                break;
+                }            
+#endif
+            SendMessageL( EOk );
+            }
+            break;
+
+        default:
+            {
+            SendErrorMsg( KErrArgument, KErrDescrInvalidCmd );
+            }
+        }
+
+    HTI_LOG_FUNC_OUT( "CHtiAppControl::HandleInstallerControlL" );
+    }
+
+
+void CHtiAppControl::HandleStartProcessL( const TDesC& aProgramName,
+                                                const TDesC& aCmdLine,
+                                                TBool aStoreProcessHandle )
+    {
+    HTI_LOG_FUNC_IN( "CHtiAppControl::HandleStartProcessL" );
+    HTI_LOG_FORMAT( "progr name %d", aProgramName.Length() );
+    HTI_LOG_DES( aProgramName );
+
+    RProcess process;
+    TInt err = process.Create( aProgramName, aCmdLine ); // command parameters
+
+    if ( err == KErrNone )
+        {
+        CleanupClosePushL( process );
+
+        //convert process id to binary des
+        TUint processId = process.Id();
+        HTI_LOG_FORMAT( "process id %d", processId );
+
+        TBuf8<KTUintLength> processIdDes;
+        processIdDes.Append(
+                ( TUint8* )( &processId ), KTUintLength );
+
+        SendMessageL( EOk, processIdDes );
+
+        process.Resume();
+
+        if ( aStoreProcessHandle )
+            {
+            HTI_LOG_TEXT( "Storing the process handle" );
+            iProcessHandleArray.Append( process );
+            CleanupStack::Pop();
+            }
+        else
+            {
+            CleanupStack::PopAndDestroy();
+            }
+        }
+    else if ( err == KErrNotFound )
+        {
+        SendMessageL( ENotFound );
+        }
+    else
+        {
+        SendErrorMsg( err ,KErrDescrFailedCreateProcess );
+        }
+
+    HTI_LOG_FUNC_OUT( "CHtiAppControl::HandleStartProcessL" );
+    }
+
+void CHtiAppControl::HandleStopProcessL( RProcess& aProcess )
+    {
+    if ( aProcess.ExitType() == EExitPending )
+        {
+        aProcess.Kill( KTerminateReason );
+        SendMessageL( EOk );
+        }
+    else
+        {
+        SendMessageL( EAlreadyStopped );
+        }
+    }
+
+void CHtiAppControl::HandleStatusProcessL( RProcess& aProcess )
+    {
+    TExitType exT = aProcess.ExitType();
+
+    switch ( exT )
+        {
+        case EExitPending:
+            {
+            SendMessageL( ERunning );
+            }
+            break;
+        case EExitKill:
+        case EExitTerminate:
+            {
+            SendMessageL( EKilled );
+            }
+            break;
+        case EExitPanic:
+            {
+            SendMessageL( EPanic );
+            }
+            break;
+        };
+    }
+
+
+void CHtiAppControl::HandleListProcessesL( const TDesC& aMatch )
+    {
+    HTI_LOG_FUNC_IN( "CHtiAppControl::HandleListProcessesL" );
+
+    RProcess process;
+    TFullName processName;
+    TUint processId;
+    TBuf8<KTUintLength> processIdDes;
+    TExitType exitType;
+
+    TBuf8<128> buf;
+    CBufFlat* processListBuf = NULL;
+    TRAPD( err, processListBuf = CBufFlat::NewL( 128 ) );
+    if ( err )
+        {
+        SendErrorMsg( err ,KErrDescrNoMemory );
+        return;
+        }
+
+    CleanupStack::PushL( processListBuf );
+
+    // The default match pattern is the single character *
+    TFindProcess finder;
+
+    // if some real match pattern is defined, use it
+    if ( aMatch.Length() > 0 )
+        {
+        HTI_LOG_TEXT( "Match pattern was given:" );
+        HTI_LOG_DES( aMatch );
+        finder.Find( aMatch );
+        }
+
+    TInt pos = 0;
+    TUint numberOfEntries = 0;
+
+    while ( finder.Next( processName ) == KErrNone )
+        {
+        err = process.Open( finder );
+
+        //convert process id to binary des
+        processId = process.Id();
+        processIdDes.Append( ( TUint8* ) ( &processId ), KTUintLength );
+        buf.Append( processIdDes );
+
+        // status
+        exitType = process.ExitType();
+        switch ( exitType )
+            {
+            case EExitPending:
+                {
+                buf.Append( ERunning );
+                }
+                break;
+            case EExitKill:
+            case EExitTerminate:
+                {
+                buf.Append( EKilled );
+                }
+                break;
+            case EExitPanic:
+                {
+                buf.Append( EPanic );
+                }
+                break;
+            };
+
+        // name length
+        buf.Append( processName.Length() );
+
+        // name
+        buf.Append( processName );
+
+        process.Close();
+
+        TRAP( err, processListBuf->ExpandL( pos, buf.Length() ) );
+        if ( err )
+            {
+            SendErrorMsg( err , KErrDescrNoMemory );
+            delete processListBuf;
+            return;
+            }
+        processListBuf->Write( pos, buf, buf.Length() );
+
+        pos += buf.Length();
+        buf.Zero();
+        processIdDes.Zero();
+        numberOfEntries++;
+        }
+
+    // insert the number of entries in the beginning
+    TBuf8<2> entries;
+    entries.Append( ( TUint8* ) ( &numberOfEntries ), 2 );
+    processListBuf->ExpandL( 0, 2 );
+    processListBuf->Write( 0, entries, 2 );
+
+    SendMessageL( EOk, processListBuf->Ptr( 0 ) );
+
+    CleanupStack::PopAndDestroy( processListBuf );
+
+    HTI_LOG_FUNC_OUT( "CHtiAppControl::HandleListProcessesL" );
+    }
+
+
+void CHtiAppControl::HandleStartAppL( TApaAppInfo &aAppInfo,
+                                            const TDesC& aDocName )
+    {
+    HTI_LOG_FUNC_IN( "CHtiAppControl::HandleStartAppL" );
+
+    // Check if app is running as a root app (not embedded)
+    TApaTask task = FindRunningRootApp( aAppInfo.iUid );
+    if ( task.Exists() )
+        {
+        User::ResetInactivityTime();
+        task.BringToForeground();
+        SendMessageL( EAlreadyRunning );
+        }
+    else
+        {
+        TThreadId threadId;
+        TInt err = KErrNone;
+        if ( aAppInfo.iUid != TUid::Null() )
+            {
+            TApaAppCapabilityBuf capBuf;
+            err = iAppServer.GetAppCapability( capBuf, aAppInfo.iUid );
+            TApaAppCapability& caps = capBuf();
+            CApaCommandLine* cmdLine = CApaCommandLine::NewLC();
+            cmdLine->SetExecutableNameL( aAppInfo.iFullName );
+            if ( caps.iLaunchInBackground )
+                {
+                cmdLine->SetCommandL( EApaCommandBackground );
+                HTI_LOG_TEXT( "Launching in background" );
+                }
+            else
+                {
+                if ( aDocName != KNullDesC )
+                    {
+                    cmdLine->SetCommandL( EApaCommandOpen );
+                    cmdLine->SetDocumentNameL( aDocName );
+                    HTI_LOG_TEXT( "Launching with document" );
+                    }
+                else
+                    {
+                    cmdLine->SetCommandL( EApaCommandRun );
+                    HTI_LOG_TEXT( "Launching without document" );
+                    }
+                }
+            err = iAppServer.StartApp( *cmdLine, threadId );
+            CleanupStack::PopAndDestroy( cmdLine );
+            }
+        else if ( aDocName != KNullDesC )
+            {
+            HTI_LOG_TEXT( "Launching a document" );
+            /*
+             * If the app that should handle the doc is already running, we
+             * try to switch the open file and bring it to foreground. Whether
+             * switching the file works depends on the application: It must
+             * implement CEikAppUi::OpenFileL() or CAknAppUi::OpenFileL() in S60.
+             */
+            TUid appUid;
+            TDataType dataType;
+            err = iAppServer.AppForDocument( aDocName, appUid, dataType );
+            if ( err == KErrNone )
+                {
+                TApaTask task = FindRunningRootApp( appUid );
+                if ( task.Exists() )
+                    {
+                    HTI_LOG_TEXT( "App for doc already running, switch file" );
+                    err = task.SwitchOpenFile( aDocName );
+                    task.BringToForeground();
+                    }
+                else
+                    {
+                    err = iAppServer.StartDocument( aDocName, threadId );
+                    }
+                }
+            }
+        else
+            {
+            User::Leave( KErrArgument );
+            }
+
+        if ( err == KErrNone )
+            {
+            User::ResetInactivityTime();
+            //convert thread id to string
+            TUint threadIdUint = threadId; //cast to UInt
+            TBuf8<KTUintLength> threadIdDes;
+            threadIdDes.Append( ( TUint8* )( &threadIdUint ), KTUintLength );
+            SendMessageL( EOk, threadIdDes );
+            }
+        else if ( err == KErrNotFound )
+            {
+            SendMessageL( ENotFound );
+            }
+        else
+            {
+            SendErrorMsg( err, KErrDescrFailedStartApp );
+            }
+        }
+    HTI_LOG_FUNC_OUT( "CHtiAppControl::HandleStartAppL" );
+    }
+
+void CHtiAppControl::HandleListInstalledAppsL( TBool aUnicode )
+    {
+    HTI_LOG_FUNC_IN( "CHtiAppControl::HandleListInstalledAppsL" );
+
+    // max file name + max caption + max short caption + 7 constant bytes
+    TInt bufSize = KMaxFileName + 2 * KApaMaxAppCaption + 7;
+    if ( aUnicode )
+        {
+        bufSize *= 2;
+        }
+
+    CBufFlat* appListBuf = CBufFlat::NewL( bufSize );
+    CleanupStack::PushL( appListBuf );
+
+    HBufC8* appsArray = HBufC8::NewLC( bufSize );
+    TPtr8 appsArrayPtr = appsArray->Des();
+
+    TInt err = KErrNone;
+    err = iAppServer.GetAllApps();
+    if ( err != KErrNone )
+        {
+        SendErrorMsg( err, KErrDescrFailedListInstApps );
+        }
+    else
+        {
+        TApaAppInfo appInfo;
+        TInt pos( 0 );
+
+        // Add application count
+        TInt numOfEntries = 0;
+        iAppServer.AppCount( numOfEntries );
+
+        appsArrayPtr.Append( ( TUint8*) ( &numOfEntries ), 2 );
+
+        while ( iAppServer.GetNextApp( appInfo ) == KErrNone )
+            {
+            TUint appUidUint = appInfo.iUid.iUid;
+            appsArrayPtr.Append( ( TUint8* ) &appUidUint, KTUintLength );
+
+            // Add length of full name
+            appsArrayPtr.Append( appInfo.iFullName.Length() );
+            // Add full name if there is one
+            if ( appInfo.iFullName.Length() > 0 )
+                {
+                if ( aUnicode )
+                    {
+                    appsArrayPtr.Append( ( TUint8* ) appInfo.iFullName.Ptr(),
+                        appInfo.iFullName.Length() * 2 );
+                    }
+                else
+                    {
+                    appsArrayPtr.Append( appInfo.iFullName );
+                    }
+                }
+
+            // Add length of caption
+            appsArrayPtr.Append( appInfo.iCaption.Length() );
+            // Add caption if there is one
+            if ( appInfo.iCaption.Length() > 0 )
+                {
+                if ( aUnicode )
+                    {
+                    appsArrayPtr.Append( ( TUint8* ) appInfo.iCaption.Ptr(),
+                        appInfo.iCaption.Length() * 2 );
+                    }
+                else
+                    {
+                    appsArrayPtr.Append( appInfo.iCaption );
+                    }
+                }
+
+            // Add length of short caption
+            appsArrayPtr.Append( appInfo.iShortCaption.Length() );
+            // Add short caption if there is one
+            if ( appInfo.iShortCaption.Length() > 0 )
+                {
+                if ( aUnicode )
+                    {
+                    appsArrayPtr.Append( ( TUint8* ) appInfo.iShortCaption.Ptr(),
+                        appInfo.iCaption.Length() * 2 );
+                    }
+                else
+                    {
+                    appsArrayPtr.Append( appInfo.iShortCaption );
+                    }
+                }
+
+            // Add app info to response buffer
+            appListBuf->ExpandL( pos, appsArray->Length() );
+            appListBuf->Write( pos, *appsArray, appsArray->Length() );
+
+            pos += appsArray->Length();
+            appsArrayPtr.Zero();
+            }
+
+        SendMessageL( EOk, appListBuf->Ptr( 0 ) );
+        }
+
+    CleanupStack::PopAndDestroy( 2 ); //appListBuf, appsArray
+
+    HTI_LOG_FUNC_IN( "CHtiAppControl::HandleListInstalledAppsL" );
+    }
+
+void CHtiAppControl::HandleListAppsL( TBool aIncludeHidden,
+                                            TBool aIncludeSystem,
+                                            TBool aUnicode )
+    {
+    HTI_LOG_FUNC_IN( "CHtiAppControl::HandleListAppsL" );
+
+    RArray<RWsSession::TWindowGroupChainInfo>* wgChain = new ( ELeave )
+                            RArray<RWsSession::TWindowGroupChainInfo>( 12 );
+    CleanupDeletePushL( wgChain );
+    CleanupClosePushL( *wgChain );
+    User::LeaveIfError( iWs.WindowGroupList( 0, wgChain ) );
+    TInt wgCount = wgChain->Count();
+
+    HTI_LOG_FORMAT( "%d Window Groups in the chain", wgCount );
+
+    TInt bufSize = 2 * KMaxFileName + 11; // caption & document + 11 constant bytes
+    if ( aUnicode )
+        {
+        bufSize *= 2;
+        }
+    CBufFlat* appListBuf = CBufFlat::NewL( bufSize );
+    CleanupStack::PushL( appListBuf );
+    HBufC8* buf = HBufC8::NewLC( bufSize );
+    TPtr8 bufPtr = buf->Des();
+
+    TInt pos = 0;
+    TInt numOfEntries = 0;
+
+    for ( TInt i = 0; i < wgCount; i++ )
+        {
+        const RWsSession::TWindowGroupChainInfo& info = ( *wgChain )[i];
+        CApaWindowGroupName* wgName = CApaWindowGroupName::NewLC( iWs, info.iId );
+
+        HTI_LOG_FORMAT( "WG ID: %d", info.iId );
+        HTI_LOG_DES( wgName->WindowGroupName() );
+
+        // Info is returned only from root tasks and system and hidden tasks
+        // are included only if requested.
+        if ( info.iParentId <= 0 &&
+             ( !wgName->IsSystem() || aIncludeSystem ) &&
+             ( !wgName->Hidden() || aIncludeHidden ) )
+            {
+            // Add application UID
+            TUint appUidUint = wgName->AppUid().iUid;
+            bufPtr.Append( ( TUint8* ) &appUidUint, KTUintLength );
+
+            // Add caption
+            TPtrC caption = wgName->Caption();
+            bufPtr.Append( caption.Length() );
+            if ( caption.Length() > 0 )
+                {
+                if ( aUnicode )
+                    {
+                    bufPtr.Append(
+                        ( TUint8* ) caption.Ptr(), caption.Length() * 2 );
+                    }
+                else
+                    {
+                    bufPtr.Append( caption );
+                    }
+                }
+
+            // Add document name
+            TPtrC document = wgName->DocName();
+            bufPtr.Append( document.Length() );
+            if ( document.Length() > 0 )
+                {
+                if ( aUnicode )
+                    {
+                    bufPtr.Append(
+                        ( TUint8* ) document.Ptr(), document.Length() * 2 );
+                    }
+                else
+                    {
+                    bufPtr.Append( document );
+                    }
+                }
+
+            // Add Hidden flag
+            if ( wgName->Hidden() )
+                bufPtr.Append( 1 );
+            else
+                bufPtr.Append( 0 );
+
+            // Add System flag
+            if ( wgName->IsSystem() )
+                bufPtr.Append( 1 );
+            else
+                bufPtr.Append( 0 );
+
+            // Add Ready flag
+            if ( wgName->IsAppReady() )
+                bufPtr.Append( 1 );
+            else
+                bufPtr.Append( 0 );
+
+            // Add Busy flag
+            if ( wgName->IsBusy() )
+                bufPtr.Append( 1 );
+            else
+                bufPtr.Append( 0 );
+
+            // Add Shutdown response flag
+            if ( wgName->RespondsToShutdownEvent() )
+                bufPtr.Append( 1 );
+            else
+                bufPtr.Append( 0 );
+
+            // Add this task's info to response buffer
+            appListBuf->ExpandL( pos, buf->Length() );
+            appListBuf->Write( pos, *buf, buf->Length() );
+
+            pos += buf->Length();
+            bufPtr.Zero();
+            numOfEntries++;
+            } // if
+        CleanupStack::PopAndDestroy(); // wgName
+        } // for
+
+    CleanupStack::PopAndDestroy(); // buf
+
+    // Add number of entries to the beginning of the response
+    TBuf8<2> entries;
+    entries.Append( ( TUint8* ) ( &numOfEntries ), 2 );
+    appListBuf->ExpandL( 0, 2 );
+    appListBuf->Write( 0, entries, 2 );
+
+    SendMessageL( EOk, appListBuf->Ptr( 0 ) );
+
+    CleanupStack::PopAndDestroy( 3 ); // appListBuf, wgChain Close, wgChain delete
+
+    HTI_LOG_FUNC_OUT( "CHtiAppControl::HandleListAppsL" );
+    }
+
+TBool CHtiAppControl::FindAppL( TApaAppInfo& aAppInfo,
+                                    const TDesC& aAppFullName )
+    {
+    HTI_LOG_FUNC_IN( "CHtiAppControl::FindAppL name" );
+    TInt err = KErrNone;
+    err = iAppServer.GetAllApps();
+    if ( err != KErrNone )
+        {
+        SendErrorMsg( err, KErrDescrFailedFindApp );
+        return EFalse;
+        }
+
+    TParse toFind;
+    err = toFind.SetNoWild( aAppFullName, NULL, NULL );
+    if ( err != KErrNone )
+        {
+        SendErrorMsg( err, KErrDescrFailedFindApp );
+        return EFalse;
+        }
+
+    TBool isFullName = ( toFind.DrivePresent() && toFind.PathPresent() );
+
+    while ( ( err = iAppServer.GetNextApp( aAppInfo) ) == KErrNone )
+        {
+        if ( isFullName )  // assume that full path has been given
+            {
+            if ( !aAppFullName.CompareF( aAppInfo.iFullName )  )
+                {
+                return ETrue;
+                }
+            }
+        else // assume that only filename has been given
+            {
+            TParsePtrC current( aAppInfo.iFullName );
+
+            // does the given filename contain extension
+            if ( toFind.ExtPresent() )
+                {
+                // compare with filename + extension
+                if ( !toFind.NameAndExt().CompareF( current.NameAndExt() ) )
+                    {
+                    return ETrue;
+                    }
+                }
+            else
+                {
+                // compare with filename only
+                if ( !toFind.Name().CompareF( current.Name() ) )
+                    {
+                    return ETrue;
+                    }
+                // Try to match the caption.
+                // For Java MIDlets the full name is like C:\270194328.fakeapp
+                // so we have to use caption to find MIDlets.
+                if ( !toFind.Name().CompareF( aAppInfo.iCaption ) )
+                    {
+                    return ETrue;
+                    }
+                }
+            }
+        }
+
+    if ( err == RApaLsSession::ENoMoreAppsInList )
+        {
+        SendMessageL( ENotFound );
+        }
+    else if ( err != KErrNone )
+        {
+        SendErrorMsg( err,KErrDescrFailedFindApp );
+        }
+    HTI_LOG_FUNC_OUT( "CHtiAppControl::FindAppL name" );
+    return EFalse;
+    }
+
+TBool CHtiAppControl::FindAppL( TApaAppInfo &aAppInfo,
+                                     const TInt32 aUid )
+    {
+    HTI_LOG_FUNC_IN( "CHtiAppControl::FindAppL uid" );
+    TInt err = iAppServer.GetAppInfo( aAppInfo, TUid::Uid( aUid ) );
+    if ( err == KErrNone )
+        {
+        return ETrue;
+        }
+    else if ( err == KErrNotFound )
+        {
+        SendMessageL( ENotFound );
+        }
+    else
+        {
+        SendErrorMsg( err , KErrDescrFailedFindApp );
+        }
+    HTI_LOG_FUNC_OUT( "CHtiAppControl::FindAppL uid" );
+    return EFalse;
+    }
+
+TApaTask CHtiAppControl::FindRunningRootApp( TUid aAppUid )
+    {
+    HTI_LOG_FUNC_IN( "CHtiAppControl::FindRunningRootApp" );
+    TApaTask task( iWs );
+    task.SetWgId( 0 ); // initialize to empty task
+
+    TInt wgId = 0; // on first call to FindByAppUid wgId must be zero
+    CApaWindowGroupName::FindByAppUid( aAppUid, iWs, wgId );
+    HTI_LOG_FORMAT( "FindByAppUid returned WG ID: %d", wgId );
+
+    RArray<RWsSession::TWindowGroupChainInfo> wgs;
+    TInt err = KErrNone;
+    TInt wgCount = 0;
+    if ( wgId != KErrNotFound )
+        {
+        // Get a list of Window Group Chain Infos
+        err = iWs.WindowGroupList( 0, &wgs ); // get only priority 0 WGs
+        wgCount = wgs.Count();
+        HTI_LOG_FORMAT( "WindowGroupList returned %d WGs", wgCount );
+        }
+    while ( wgId != KErrNotFound && task.WgId() == 0 && err == KErrNone )
+        {
+        // App was found - check if it is root by looping through the
+        // WG chain infos to find the one with out wgId
+        TInt i = 0;
+        while ( task.WgId() == 0 && i < wgCount )
+            {
+            const RWsSession::TWindowGroupChainInfo& info = wgs[i];
+            if ( info.iId == wgId && info.iParentId <= 0 )
+                {
+                // This is the one and it is root (does not have parent)
+                task.SetWgId( wgId );
+                }
+            i++;
+            }
+        if ( task.WgId() == 0 )
+            {
+            // This was not root - check if there's more instances of the app
+            CApaWindowGroupName::FindByAppUid( aAppUid, iWs, wgId );
+            HTI_LOG_FORMAT( "FindByAppUid returned WG ID: %d", wgId );
+            }
+        }
+
+    wgs.Close();
+    HTI_LOG_FORMAT( "Returning task with WG ID %d", task.WgId() );
+    HTI_LOG_FUNC_OUT( "CHtiAppControl::FindRunningRootApp" );
+    return task;
+    }
+
+TInt CHtiAppControl::OpenProcessL( RProcess& aProcess,
+                                         const TDesC& aMatch )
+    {
+    HTI_LOG_FUNC_IN( "CHtiAppControl::OpenProcessL" );
+    TFullName processName;
+    TInt err = KErrNone;
+    TFindProcess finder( aMatch );
+
+    err = finder.Next( processName );
+    if ( err == KErrNone )
+        {
+        err = aProcess.Open( finder );
+        }
+
+    HTI_LOG_FUNC_OUT( "CHtiAppControl::OpenProcessL" );
+    return err;
+    }
+
+template<class T> T CHtiAppControl::Parse32(
+                        const TDesC8& a32int )
+    {
+    //manually construct TUint or TInt32
+    return T( a32int[0] + ( a32int[1] << 8 ) +
+                      ( a32int[2] << 16) + ( a32int[3] << 24) );
+    }
+
+void CHtiAppControl::SendMessageL( TAppCommand aResponseCode,
+                                         const TDesC8& aMsg )
+    {
+    HTI_LOG_FORMAT( "SendMessage %d", aResponseCode );
+    HTI_LOG_FORMAT( "Message len %d", aMsg.Length() );
+    HBufC8* sendMsg = HBufC8::NewL( 1 + aMsg.Length() );
+    CleanupStack::PushL( sendMsg );
+    sendMsg->Des().Append( aResponseCode );
+    sendMsg->Des().Append( aMsg );
+
+    User::LeaveIfError( iDispatcher->DispatchOutgoingMessage(
+                            sendMsg,
+                            KAppServiceUid ) );
+    CleanupStack::Pop();
+    }
+
+inline TInt CHtiAppControl::SendErrorMsg( TInt anError,
+                                                const TDesC8& aMsg )
+    {
+    return iDispatcher->DispatchOutgoingErrorMessage( anError,
+                                               aMsg,
+                                               KAppServiceUid );
+    }
+
+#if ( SYMBIAN_VERSION_SUPPORT < SYMBIAN_4 )
+SwiUI::TPolicy CHtiAppControl::ConvertToPolicy( const TInt8 aValue )
+    {
+    if ( aValue == 0 ) return SwiUI::EPolicyNotAllowed;
+
+    return  SwiUI::EPolicyAllowed;
+    }
+#else
+Usif::TSifPolicy CHtiAppControl::ConvertToSifPolicy( const TInt8 aValue )
+    {
+    if ( aValue == 0 ) return Usif::ENotAllowed;
+
+    return  Usif::EAllowed;    
+    }
+#endif
+
+TBool CHtiAppControl::ValidateInstallParams( const TDesC8& aParams, TBool aIsUnicode )
+    {
+    HTI_LOG_FORMAT( "ValidateInstallParams => length: %d", aParams.Length() );
+    if ( aParams.Length() > 0 )
+        {
+        TInt offset = 0;
+        TInt length = aParams[offset]; // inst package path length;
+        if ( aIsUnicode ) length *= 2;
+        offset++;
+        if ( aParams.Length() < offset + length )
+            {
+            HTI_LOG_TEXT( "ValidateInstallParams: Failed, data missing in inst pkg path" );
+            return EFalse;
+            }
+
+        offset += length; // skip over inst package path
+        offset += 10;     // skip over the following one byte params
+
+        if ( aParams.Length() < offset )
+            {
+            HTI_LOG_TEXT( "ValidateInstallParams: Failed, data missing in one byte params" );
+            return EFalse;
+            }
+
+        length = aParams[offset]; // login username length;
+        if ( aIsUnicode ) length *= 2;
+        offset++;
+        if ( aParams.Length() < offset + length )
+            {
+            HTI_LOG_TEXT( "ValidateInstallParams: Failed, data missing in username" );
+            return EFalse;
+            }
+
+        offset += length; // skip over login username
+
+        length = aParams[offset]; // password length;
+        if ( aIsUnicode ) length *= 2;
+        offset++;
+        if ( aParams.Length() < offset + length )
+            {
+            HTI_LOG_TEXT( "ValidateInstallParams: Failed, data missing in password" );
+            return EFalse;
+            }
+
+        offset += length; // skip over password
+        offset += 4;      // the last one byte params
+
+        if ( aParams.Length() < offset || aParams.Length() > offset + 2)
+            {
+            HTI_LOG_TEXT( "ValidateInstallParams: Failed, final length incorrect" );
+            return EFalse;
+            }
+
+        return ETrue;
+        }
+
+    return EFalse;
+    }
+
+#if ( SYMBIAN_VERSION_SUPPORT < SYMBIAN_4 )
+TInt CHtiAppControl::GetPackageUidL( const TDesC& aPackageName,
+                                          TInt aMimeIndex )
+    {
+    HTI_LOG_FUNC_IN( "CHtiAppControl::GetPackageUidL" );
+
+    if ( aMimeIndex >= 0 && aMimeIndex < 2 ) // SIS
+        {
+        Swi::RSisRegistrySession regSession;
+        User::LeaveIfError( regSession.Connect() );
+        CleanupClosePushL( regSession );
+
+        RArray<TUid> uids;
+        CleanupClosePushL( uids );
+        regSession.InstalledUidsL( uids );
+        TInt count = uids.Count();
+        HTI_LOG_FORMAT( "Found %d SISx installations", count );
+        for ( TInt i = 0; i < count; i++ )
+            {
+            Swi::RSisRegistryEntry entry;
+            CleanupClosePushL( entry );
+            User::LeaveIfError( entry.Open( regSession, uids[i] ) );
+            if ( !entry.IsInRomL() && entry.IsPresentL() )
+                {
+                if ( aPackageName.Compare( *( entry.PackageNameL() ) ) == 0 )
+                    {
+                    HTI_LOG_TEXT( "Matching SIS package found" );
+                    TInt uid = entry.UidL().iUid;
+                    CleanupStack::PopAndDestroy( 3 ); // entry, uids, regSession
+                    return uid;
+                    }
+                }
+            // Check augmentations of this entry
+            entry.AugmentationsL( iAugmentations );
+            TInt augCount = iAugmentations.Count();
+            for ( TInt j = 0; j < augCount; j++ )
+                {
+                Swi::RSisRegistryEntry augmentation;
+                CleanupClosePushL( augmentation );
+                augmentation.OpenL( regSession, *iAugmentations[j] );
+                if ( aPackageName.Compare(
+                        *( augmentation.PackageNameL() ) ) == 0 )
+                    {
+                    if ( !augmentation.IsInRomL() && augmentation.IsPresentL() )
+                        {
+                        HTI_LOG_TEXT( "Matching SIS augmentation found" );
+                        TInt uid = augmentation.UidL().iUid;
+                        Swi::CSisRegistryPackage* pkg = augmentation.PackageL();
+                        iAugmentationIndex = pkg->Index();
+                        delete pkg;
+                        HTI_LOG_FORMAT( "Aug. index %d", iAugmentationIndex );
+                        CleanupStack::PopAndDestroy( 4 ); // augmentation, entry, uids, regSession
+                        return uid;
+                        }
+                    }
+                CleanupStack::PopAndDestroy(); // augmentation
+                } // for j
+            iAugmentations.ResetAndDestroy();
+            CleanupStack::PopAndDestroy(); // entry
+            } // for i
+        User::Leave( KErrNotFound );
+        }
+
+    else if ( aMimeIndex > 2 && aMimeIndex < 7 ) // Java
+        {
+            RArray<TUid> uids;
+            CleanupClosePushL( uids );
+
+            CJavaRegistry* javaRegistry = CJavaRegistry::NewLC();
+            javaRegistry->GetRegistryEntryUidsL( uids );
+
+            TInt uid = KErrNotFound;
+            TInt count = uids.Count();
+            HTI_LOG_FORMAT( "Found %d Java installations", count );
+            for ( TInt i = 0; i < count; i++ )
+                {
+                CJavaRegistryEntry* entry = javaRegistry->RegistryEntryL( uids[i] );
+                if ( entry )
+                    {
+                    CleanupStack::PushL( entry );
+                    if ( entry->Type() >= EGeneralPackage &&
+                            entry->Type() < EGeneralApplication )
+                        {
+                        // entry was a package (MIDlet suite)
+                        CJavaRegistryPackageEntry* packageEntry =
+                            ( CJavaRegistryPackageEntry* ) entry;
+                        if ( aPackageName.Compare( packageEntry->Name() ) == 0 )
+                            {
+                            HTI_LOG_TEXT( "Matching Java installation found" );
+                            uid = packageEntry->Uid().iUid;
+                            CleanupStack::PopAndDestroy( entry );
+                            break;
+                            }
+                        }
+                    CleanupStack::PopAndDestroy( entry );
+                    }
+                }
+            CleanupStack::PopAndDestroy( javaRegistry );
+            CleanupStack::PopAndDestroy( &uids );
+            User::LeaveIfError( uid );
+            return uid;
+        }
+
+    else if ( aMimeIndex == 7 ) // Widget
+        {
+        RWidgetRegistryClientSession widgetRegistry;
+        User::LeaveIfError( widgetRegistry.Connect() );
+
+        RWidgetInfoArray widgets;
+        TRAPD( err, widgetRegistry.InstalledWidgetsL( widgets ) );
+        if ( err != KErrNone )
+            {
+            HTI_LOG_FORMAT( "Failed to get installed widgets %d", err );
+            widgets.ResetAndDestroy();
+            widgetRegistry.Disconnect();
+            User::Leave( err );
+            }
+
+        TInt uid = KErrNotFound;
+        TInt count = widgets.Count();
+        HTI_LOG_FORMAT( "Found %d Widget installations", count );
+        for ( TInt i = 0; i < count; i++ )
+            {
+            CWidgetInfo* widgetInfo = widgets[i];
+            HTI_LOG_DES( *( widgetInfo->iBundleName ) );
+            if ( aPackageName.Compare( *( widgetInfo->iBundleName ) ) == 0 )
+                {
+                HTI_LOG_TEXT( "Matching Widget installation found" );
+                uid = widgetInfo->iUid.iUid;
+                break;
+                }
+            }
+        widgets.ResetAndDestroy();
+        widgetRegistry.Disconnect();
+        User::LeaveIfError( uid );
+        return uid;
+        }
+
+    else  // invalid mime index
+        {
+        User::Leave( KErrArgument );
+        }
+
+    return KErrNone; // never returns from here
+    }
+#else
+TInt CHtiAppControl::GetComponentIdFromUid(const TInt32 aUid)
+    {
+    TInt cid = KErrNotFound;
+    Usif::RSoftwareComponentRegistry registry;
+    User::LeaveIfError(registry.Connect());
+    CleanupClosePushL(registry);
+    RArray<TUid> uidList;
+    CleanupClosePushL(uidList);
+    RArray<Usif::TComponentId> componentIdList;
+    CleanupClosePushL(componentIdList);
+    registry.GetComponentIdsL(componentIdList);
+    for(TInt i = 0; i < componentIdList.Count(); i++)
+        {
+        Usif::TComponentId compId = componentIdList[i];
+        Usif::CComponentEntry *compEntry = Usif::CComponentEntry::NewLC();
+        if(registry.GetComponentL(compId, *compEntry))
+            {
+            /*if(compEntry->IsRemovable() && 
+                 compEntry->SoftwareType() == Usif::KSoftwareTypeNative)*/
+            if(compEntry->IsRemovable())
+                {
+                _LIT(KCompUid, "CompUid");
+                Usif::CPropertyEntry *property = 
+                    registry.GetComponentPropertyL(compId, KCompUid);
+                CleanupStack::PushL(property);
+                Usif::CIntPropertyEntry* intProperty = 
+                    dynamic_cast<Usif::CIntPropertyEntry*>(property);
+                uidList.AppendL(TUid::Uid(intProperty->IntValue()));
+                CleanupStack::PopAndDestroy(property);
+                }
+            else
+                {
+                uidList.AppendL(KNullUid);
+                }
+            }
+        CleanupStack::PopAndDestroy( compEntry );
+        }
+    TUid tuid(TUid::Uid(aUid));
+    if(tuid != KNullUid)
+        {
+        TInt index = uidList.Find(tuid);
+        if(index >= 0 && index < componentIdList.Count())
+            {
+            cid = componentIdList[index];
+            }
+        }
+        CleanupStack::PopAndDestroy( 3, &registry );// componentIdList, uidList, registry
+        return cid;
+    }
+
+TInt CHtiAppControl::GetComponentIdFromPackageName(const TDesC& aPackageName)
+    {
+    TInt cid = KErrNotFound;
+    Usif::RSoftwareComponentRegistry registry;
+    User::LeaveIfError(registry.Connect());
+    CleanupClosePushL(registry);
+    RArray<Usif::TComponentId> componentIdList;
+    CleanupClosePushL(componentIdList);
+    registry.GetComponentIdsL(componentIdList);
+    TInt count = componentIdList.Count();    
+    for(TInt i = 0; i < count; i++)
+        {
+        Usif::TComponentId compId = componentIdList[i];
+        Usif::CComponentEntry *compEntry = Usif::CComponentEntry::NewLC();
+        if(registry.GetComponentL(compId, *compEntry))
+            {
+            if(compEntry->IsRemovable())
+                {
+                if ( aPackageName.Compare( compEntry->Name() ) == 0 )
+                    {
+                    cid = compId;
+                    CleanupStack::PopAndDestroy( compEntry );
+                    break;
+                    }
+                }
+            }
+        CleanupStack::PopAndDestroy( compEntry );
+        }
+        CleanupStack::PopAndDestroy( 2, &registry );// componentIdList, registry
+        return cid;
+    }
+
+#endif
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiServicePlugins/HtiAudioServicePlugin/data/1020DEC8.rss	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,66 @@
+/*
+* 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:  HTI service plugin for playing audio.
+*
+*/
+
+
+
+//  RESOURCE IDENTIFIER
+
+//  INCLUDES
+#include <ecom/registryinfo.rh>
+
+//  CONSTANTS
+
+//  MACROS
+
+
+//  RESOURCE DEFINITIONS
+// -----------------------------------------------------------------------------
+//
+// theInfo
+// ECom registry info resource.
+//
+// -----------------------------------------------------------------------------
+//
+
+RESOURCE REGISTRY_INFO theInfo
+    {
+    // UID for the DLL
+    dll_uid = 0x1020DEC8;
+    // Declare array of interface info
+    interfaces =
+        {
+        INTERFACE_INFO
+            {
+            // UID of interface that is implemented
+            interface_uid = 0x1020DEB7;
+            implementations =
+                {
+                IMPLEMENTATION_INFO
+                    {
+                    implementation_uid = 0x10210CCB;
+                    version_no         = 1;
+                    display_name       = "Audio Control Service";
+                    default_data       = "AUDIO";
+                    opaque_data        = "";
+                    }
+                };
+            }
+        };
+    }
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiServicePlugins/HtiAudioServicePlugin/group/HtiAudioServicePlugin.mmp	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,54 @@
+/*
+* 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:  HTI service plugin for controlling audio playback.
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+TARGET      HtiAudioServicePlugin.dll
+TARGETTYPE  PLUGIN
+
+// ECom Dll recognition UID followed by the unique UID for this dll
+UID 0x10009D8D 0x1020DEC8
+
+VENDORID    0x101FB657
+
+CAPABILITY      ALL -TCB
+
+SOURCEPATH  ../src
+SOURCE      proxy.cpp
+SOURCE      HtiAudioServicePlugin.cpp
+
+USERINCLUDE     ../inc
+APP_LAYER_SYSTEMINCLUDE
+
+START RESOURCE  ../data/1020DEC8.rss
+TARGET          HtiAudioServicePlugin.rsc
+END
+
+LIBRARY     apgrfx.lib  // RApaLsSession
+LIBRARY     apmime.lib  // TDataType
+LIBRARY     bafl.lib
+LIBRARY     ecom.lib
+LIBRARY     efsrv.lib
+LIBRARY     euser.lib
+LIBRARY     mediaclientaudio.lib
+LIBRARY     platformenv.lib
+LIBRARY     flogger.lib
+
+SMPSAFE
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiServicePlugins/HtiAudioServicePlugin/group/bld.inf	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,27 @@
+/*
+* 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 file for HtiAudioServicePlugin
+*
+*/
+
+
+
+PRJ_PLATFORMS
+
+PRJ_EXPORTS
+
+PRJ_MMPFILES
+HtiAudioServicePlugin.mmp
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiServicePlugins/HtiAudioServicePlugin/inc/HtiAudioServicePlugin.h	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,284 @@
+/*
+* 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:  Defines the ECom plugin for HTI audio playback control service.
+*
+*/
+
+
+
+#ifndef HTIAUDIOSERVICEPLUGIN_H
+#define HTIAUDIOSERVICEPLUGIN_H
+
+//  INCLUDES
+#include <badesca.h>
+#include <HtiServicePluginInterface.h>
+#include <mdaaudiosampleplayer.h>
+#include <mdaaudiotoneplayer.h>
+
+// CONSTANTS
+
+// MACROS
+
+// DATA TYPES
+
+// FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+// CLASS DECLARATION
+
+/**
+*  The ECom plugin for HTI audio playback control service.
+*
+*/
+class CHtiAudioServicePlugin : public CHTIServicePluginInterface,
+                               public MMdaAudioPlayerCallback,
+                               public MMdaAudioToneObserver
+    {
+
+    protected:
+        // commands
+        enum TAudioCommands
+            {
+            ECmdListAudioFiles = 0x01,
+            ECmdPlayFile       = 0x02,
+            ECmdPlayTone       = 0x03,
+            ECmdPlayDtmf       = 0x04,
+            ECmdStop           = 0x05,
+            ECmdGetDuration    = 0x06,
+            ECmdGetMaxVol      = 0x07,
+            ECmdSetVol         = 0x08,
+            ECmdPlayFile2      = 0x10,
+            ECmdPlayTone2      = 0x11,
+            ECmdPlayDtmf2      = 0x12,
+            ECmdGetMaxVol2     = 0x13,
+            ECmdSetVol2        = 0x14
+            };
+
+        // audio setting options
+        enum TAudioSetting
+            {
+            EDefault,
+            EGeneralMusic,
+            ERingTonePreview,
+            //EIncomingCall,
+            EDtmfString
+            };
+
+    public:  // Constructors and destructor
+
+        /**
+        * Two-phased constructor.
+        */
+        static CHtiAudioServicePlugin* NewL();
+
+    public: // New functions
+
+    public: // Functions from base classes
+
+        /**
+        * From CHTIServicePluginInterface
+        * Called by the HTI Framework when sending message to this service.
+        * @param aMessage message body destinated to a servive
+        * @param aPriority message priority
+        */
+        void ProcessMessageL( const TDesC8& aMessage,
+            THtiMessagePriority aPriority );
+
+        /**
+        * From CHTIServicePluginInterface
+        * Called by HTI Framework to tell the service how much memory is
+        * available for messages in the message queue.
+        * @param aAvailableMemory amount of currently available memory
+        *        in the message queue
+        */
+        void NotifyMemoryChange( TInt aAvailableMemory );
+
+        /**
+        * From CHTIServicePluginInterface
+        * Indicates to HTI Framework whether the plugin is ready to process
+        * a new message or if it's busy processing previous message.
+        */
+        TBool IsBusy();
+
+        /**
+        * From MMdaAudioToneObserver
+        * Handle the event when a tone utility initialisation
+        * operation has completed.
+        * @param aError indicates whether an error occurred.
+        */
+        void MatoPrepareComplete( TInt aError );
+
+        /**
+        * From MMdaAudioToneObserver
+        * Handle the event when a tone playing operation has completed.
+        * @param aError indicates whether an error occurred.
+        */
+        void MatoPlayComplete( TInt aError );
+
+        /**
+        * From MMdaAudioPlayerCallback
+        * Handle the event when initialisation of
+        * the audio player utility is complete.
+        * @param aError The status of the audio sample after initialisation
+        * @param aDuration The duration of the sample
+        */
+        void MapcInitComplete( TInt aError,
+                               const TTimeIntervalMicroSeconds& aDuration );
+
+        /**
+        * From MMdaAudioPlayerCallback
+        * Handle the event when when the audio player utility
+        * completes asynchronous playing.
+        * @param aError The status of playback
+        */
+        void MapcPlayComplete( TInt aError );
+
+
+    protected:  // New functions
+
+        /**
+        * C++ default constructor.
+        */
+        CHtiAudioServicePlugin();
+
+        /**
+        * 2nd phase constructor.
+        */
+        void ConstructL();
+
+        /**
+        * Destructor.
+        */
+        virtual ~CHtiAudioServicePlugin();
+
+
+    protected:  // Functions from base classes
+
+    private:
+
+        void HandleListAudioFilesCmdL( const TDesC8& aMessage );
+
+        void HandlePlayFileCmdL( const TDesC8&aMessage );
+
+        void HandlePlayToneCmdL( const TDesC8& aMessage );
+
+        void HandlePlayDtmfCmdL( const TDesC8& aMessage );
+
+        void HandleStopCmdL( const TDesC8& aMessage );
+
+        void HandleGetDurationCmdL( const TDesC8& aMessage );
+
+        void HandleGetMaxVolCmdL( const TDesC8& aMessage );
+
+        void HandleSetVolCmdL( const TDesC8& aMessage );
+
+        TInt ParseString( const TDesC8& aRequest,
+                               TInt aOffset, TDes& aResult );
+
+        TInt SendResponseMsg( const TDesC8& aMsg,
+                             const TUint8 aCommandId = 0  );
+
+        TInt SendErrorResponseMsg( TInt aErrorCode,
+                                   const TDesC8& aErrorDescription,
+                                   const TUint8 aCommandId = 0 );
+
+        void AddSubdirsRecursivelyL( const TDesC& aPath,
+                                    CDesCArraySeg& aArray, RFs& aFs );
+
+        TBool MatchMimeTypeL( const TDesC& aFilePath,
+                              const TDesC& aMimeTypeMatchPattern );
+
+        void SetAudioSettings( TAudioSetting aSetting );
+
+        inline TUint ParseUint16( const TUint8* aPtr )
+            {
+            return aPtr[0] + ( aPtr[1] << 8 );
+            }
+
+        inline TUint ParseUint32( const TUint8* aPtr )
+            {
+            return aPtr[0] + ( aPtr[1] << 8 )
+                           + ( aPtr[2] << 16 ) + ( aPtr[3] << 24 );
+            }
+
+
+    public:     // Data
+
+    protected:  // Data
+
+    private:    // Data
+        // Flag telling if the service is busy processing a message
+        TBool iIsBusy;
+
+        // Flag telling if audio or tone is currently playing
+        TBool iIsPlaying;
+
+        // Id of the latest command
+        TUint8 iCommandId;
+
+        // Id of the latest play command
+        TUint8 iPlayCommandId;
+
+        // Container for the response message to be dispatched out
+        HBufC8* iMessage;
+
+        // Error code in the outgoing error message
+        TInt iErrorCode;
+
+        // Audio player utility object
+        CMdaAudioPlayerUtility* iAudioPlayer;
+
+        // Tone player utility object
+        CMdaAudioToneUtility* iTonePlayer;
+
+        // Current volume value
+        TInt iVolume;
+
+        // Current repeat value
+        TInt iRepeats;
+
+        // Current trailing silence value
+        TInt iTrailingSilence;
+
+        // DTMF tone length
+        TInt iDtmfLength;
+
+        // Silence between DTMF tones
+        TInt iDtmfGapLength;
+
+        // Playback start position
+        TInt iStartPos;
+
+        // Playback end position
+        TInt iEndPos;
+
+        // Audio priority setting
+        TInt iAudioPriority;
+
+        // Audio priority preference setting
+        TMdaPriorityPreference iAudioPriorityPreference;
+
+
+    public:     // Friend classes
+
+    protected:  // Friend classes
+
+    private:    // Friend classes
+
+    };
+
+#endif      // HTIAUDIOSERVICEPLUGIN_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiServicePlugins/HtiAudioServicePlugin/src/HtiAudioServicePlugin.cpp	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,1777 @@
+/*
+* 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 the ECom plugin for HTI audio playback control
+*                service.
+*
+*/
+
+
+
+// INCLUDE FILES
+#include <apgcli.h>
+#include <AudioPreference.h>
+#include <bautils.h>
+#include <e32std.h>
+#include <HtiDispatcherInterface.h>
+#include <HtiLogging.h>
+#include <pathinfo.h>
+
+#include "HtiAudioServicePlugin.h"
+
+// EXTERNAL DATA STRUCTURES
+
+// EXTERNAL FUNCTION PROTOTYPES
+
+// CONSTANTS
+const static TInt KPlayToneCmdLength        = 13;
+const static TInt KPlayTone2CmdLength       = 16;
+const static TInt KStopCmdLength            = 1;
+const static TInt KSetVolCmdLength          = 2;
+const static TInt KSetVol2CmdLength         = 5;
+const static TInt KListCmdMinLength         = 4;
+const static TInt KPlayDtmfCmdMinLength     = 17;
+const static TInt KPlayDtmf2CmdMinLength    = 20;
+const static TInt KPlayFileCmdMinLength     = 21;
+const static TInt KPlayFile2CmdMinLength    = 24;
+const static TInt KDurationCmdMinLength     = 6;
+const static TInt KMaxVolCmdMinLength       = 6;
+
+const static TInt KTUintSize = sizeof( TUint );
+
+// MACROS
+
+// LOCAL CONSTANTS AND MACROS
+const static TUid KAudioServiceUid = { 0x10210CCB };
+
+_LIT( KBackslash, "\\" );
+_LIT( KRngMimeType, "application/vnd.nokia.ringing-tone" );
+_LIT( KAudioMimeType, "audio/*" );
+
+// NOTE: Max length for error description is defined
+// in HtiDispatcherInterface.h (currently 118).
+_LIT8( KErrorNoCmd, "ERROR: No command given" );
+_LIT8( KErrorUnknownCmd, "ERROR: Unknown Audio Service command" );
+_LIT8( KErrorInvalidParameters,
+    "ERROR: Invalid parameter data for this command" );
+_LIT8( KErrorInvalidPath, "ERROR: Invalid path" );
+_LIT8( KErrorToneInitFailed, "ERROR: Tone initialization failed" );
+_LIT8( KErrorTonePlayFailed, "ERROR: Tone playing failed" );
+_LIT8( KErrorFileInitFailed, "ERROR: File playing initialization failed" );
+_LIT8( KErrorFilePlayFailed, "ERROR: File playing failed" );
+_LIT8( KErrorBusyPlaying, "ERROR: Currently busy playing" );
+_LIT8( KErrorNothingPlaying, "ERROR: Nothing playing" );
+_LIT8( KErrorDurationFailed, "ERROR: Duration query failed" );
+_LIT8( KErrorMaxVolFailed, "ERROR: Max volume query failed" );
+_LIT8( KErrorPosition, "ERROR: Invalid start or end position value" );
+
+// MODULE DATA STRUCTURES
+
+// LOCAL FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+// ============================= LOCAL FUNCTIONS ===============================
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CHtiAudioServicePlugin::CHtiAudioServicePlugin
+// C++ default constructor can NOT contain any code, that might leave.
+// -----------------------------------------------------------------------------
+//
+CHtiAudioServicePlugin::CHtiAudioServicePlugin():iIsBusy( EFalse ),
+                                                 iIsPlaying( EFalse ),
+                                                 iCommandId( 0 ),
+                                                 iPlayCommandId( 0 ),
+                                                 iMessage( NULL ),
+                                                 iErrorCode( 0 ),
+                                                 iVolume( 0 ),
+                                                 iRepeats( 0 ),
+                                                 iTrailingSilence( 0 ),
+                                                 iDtmfLength( 0 ),
+                                                 iDtmfGapLength( 0 ),
+                                                 iStartPos( 0 ),
+                                                 iEndPos( 0 )
+    {
+    }
+
+
+// -----------------------------------------------------------------------------
+// CHtiAudioServicePlugin::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CHtiAudioServicePlugin::ConstructL()
+    {
+    }
+ 
+
+// -----------------------------------------------------------------------------
+// CHtiAudioServicePlugin::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CHtiAudioServicePlugin* CHtiAudioServicePlugin::NewL()
+    {
+    CHtiAudioServicePlugin* self = new (ELeave) CHtiAudioServicePlugin;
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop();
+    return self;
+    }
+
+
+// Destructor
+CHtiAudioServicePlugin::~CHtiAudioServicePlugin()
+    {
+    delete iMessage;
+    iMessage = NULL;
+    delete iAudioPlayer;
+    iAudioPlayer = NULL;
+    delete iTonePlayer;
+    iTonePlayer = NULL;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CHtiAudioServicePlugin::ProcessMessageL
+// -----------------------------------------------------------------------------
+//
+void CHtiAudioServicePlugin::ProcessMessageL( const TDesC8& aMessage,
+                                        THtiMessagePriority /*aPriority*/ )
+    {
+    HTI_LOG_FUNC_IN( "CHtiAudioServicePlugin::ProcessMessageL" );
+    HTI_LOG_FORMAT( "Message length = %d", aMessage.Length() );
+
+    if ( iIsBusy )
+        {
+        HTI_LOG_TEXT( "Plugin is busy - leaving" );
+        User::Leave( KErrInUse );
+        }
+
+    // Will be set to EFalse in the SendResponseMsg or SendErrorResponseMsg
+    // methods when the response has been successfully sent and the plugin is
+    // ready for next message.
+    iIsBusy = ETrue;
+
+    if ( aMessage.Length() < 1 )
+        {
+        User::LeaveIfError(
+            SendErrorResponseMsg( KErrArgument, KErrorNoCmd ) );
+        return;
+        }
+
+    iCommandId = aMessage[0];
+    HTI_LOG_FORMAT( "Command = %d", iCommandId );
+    TInt err = KErrNone;
+
+    if ( iCommandId == ECmdListAudioFiles )
+        {
+        TRAP( err, HandleListAudioFilesCmdL( aMessage ) );
+        }
+
+    else if ( iCommandId == ECmdPlayFile || iCommandId == ECmdPlayFile2)
+        {
+        TRAP( err, HandlePlayFileCmdL( aMessage ) );
+        }
+
+    else if ( iCommandId == ECmdPlayTone || iCommandId == ECmdPlayTone2)
+        {
+        TRAP( err, HandlePlayToneCmdL( aMessage ) );
+        }
+
+    else if ( iCommandId == ECmdPlayDtmf || iCommandId == ECmdPlayDtmf2)
+        {
+        TRAP( err, HandlePlayDtmfCmdL( aMessage ) );
+        }
+
+    else if ( iCommandId == ECmdStop )
+        {
+        TRAP( err, HandleStopCmdL( aMessage ) );
+        }
+
+    else if ( iCommandId == ECmdGetDuration )
+        {
+        TRAP( err, HandleGetDurationCmdL( aMessage ) );
+        }
+
+    else if ( iCommandId == ECmdGetMaxVol || iCommandId == ECmdGetMaxVol2)
+        {
+        TRAP( err, HandleGetMaxVolCmdL( aMessage ) );
+        }
+
+    else if ( iCommandId == ECmdSetVol || iCommandId == ECmdSetVol2)
+        {
+        TRAP( err, HandleSetVolCmdL( aMessage ) );
+        }
+
+    else
+        {
+        User::LeaveIfError(
+            SendErrorResponseMsg( KErrArgument, KErrorUnknownCmd ) );
+        }
+
+    if ( err != KErrNone )
+        {
+        User::LeaveIfError(
+                SendErrorResponseMsg( err, KNullDesC8, iCommandId ) );
+        }
+
+    HTI_LOG_FUNC_OUT( "CHtiAudioServicePlugin::ProcessMessageL" );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CHtiAudioServicePlugin::HandleListAudioFilesCmdL()
+// -----------------------------------------------------------------------------
+//
+void CHtiAudioServicePlugin::HandleListAudioFilesCmdL( const TDesC8& aMessage )
+    {
+    HTI_LOG_FUNC_IN( "CHtiAudioServicePlugin::HandleListAudioFilesCmdL" );
+
+    RFs fsSession;
+    User::LeaveIfError( fsSession.Connect() );
+    CleanupClosePushL( fsSession );
+
+    // Build a list of directories to scan
+    CDesCArraySeg* directories = new (ELeave) CDesCArraySeg( 5 );
+    CleanupStack::PushL( directories );
+
+    if ( aMessage.Length() == 1 )  // Add default sound directories
+        {
+        TFileName directory;
+
+        // ROM
+        directory.Append( PathInfo::RomRootPath() );
+        directory.Append( PathInfo::SoundsPath() );
+        if ( BaflUtils::PathExists( fsSession, directory ) )
+            {
+            directories->AppendL( directory );
+            AddSubdirsRecursivelyL( directories->MdcaPoint(
+                directories->Count() - 1 ), *directories, fsSession );
+            }
+
+        // Phone memory
+        directory.Zero();
+        directory.Append( PathInfo::PhoneMemoryRootPath() );
+        directory.Append( PathInfo::SoundsPath() );
+        if ( BaflUtils::PathExists( fsSession, directory ) )
+            {
+            directories->AppendL( directory );
+            AddSubdirsRecursivelyL( directories->MdcaPoint(
+                directories->Count() - 1 ), *directories, fsSession );
+            }
+
+        // Memory card
+        directory.Zero();
+        directory.Append( PathInfo::MemoryCardRootPath() );
+        directory.Append( PathInfo::SoundsPath() );
+        if ( BaflUtils::PathExists( fsSession, directory ) )
+            {
+            directories->AppendL( directory );
+            AddSubdirsRecursivelyL( directories->MdcaPoint(
+                directories->Count() - 1 ), *directories, fsSession );
+            }
+        }
+
+    else  // Add given directory
+        {
+        if ( aMessage.Length() < KListCmdMinLength )
+            {
+            User::LeaveIfError( SendErrorResponseMsg(
+                                    KErrArgument, KErrorInvalidParameters ) );
+            CleanupStack::PopAndDestroy( 2 ); // directories, fsSession
+            return;
+            }
+
+        TInt pathLength = aMessage[1];
+        if ( ( aMessage.Length() - pathLength ) != KListCmdMinLength - 2 )
+            {
+            User::LeaveIfError( SendErrorResponseMsg(
+                                    KErrArgument, KErrorInvalidParameters ) );
+            CleanupStack::PopAndDestroy( 2 ); // directories, fsSession
+            return;
+            }
+
+        TFileName directory;
+        TInt nextOffset = ParseString( aMessage, 1, directory );
+        TInt dirLength = directory.Length();
+        if ( dirLength < 2 || nextOffset < 0 )
+            {
+            User::LeaveIfError( SendErrorResponseMsg(
+                                    KErrArgument, KErrorInvalidParameters ) );
+            CleanupStack::PopAndDestroy( 2 ); // directories, fsSession
+            return;
+            }
+
+        HTI_LOG_DES( directory );
+
+        if ( directory[dirLength - 1] != '\\' )
+            {
+            HTI_LOG_TEXT( "Adding backslash to the end" );
+            directory.Append( KBackslash );
+            HTI_LOG_DES( directory );
+            }
+
+        if ( BaflUtils::PathExists( fsSession, directory ) )
+            {
+            HTI_LOG_TEXT( "Given path exists" );
+            directories->AppendL( directory );
+            AddSubdirsRecursivelyL( directories->MdcaPoint(
+                directories->Count() - 1 ), *directories, fsSession );
+            }
+        }
+
+    // Buffer for the file list that is returned
+    CBufFlat* fileListBuf = CBufFlat::NewL( 256 );
+    CleanupStack::PushL( fileListBuf );
+    TInt bufPos = 0;
+
+    TInt audioFileCount = 0;
+    TInt dirCount( directories->Count() );
+    HTI_LOG_FORMAT( "Total directory count = %d", dirCount );
+
+    if ( dirCount == 0 )
+        {
+        HTI_LOG_TEXT( "The given directory did not exist" );
+        User::LeaveIfError( SendErrorResponseMsg(
+                                KErrArgument, KErrorInvalidPath ) );
+        CleanupStack::PopAndDestroy( 3 ); // fileListBuf, directories, fsSession
+        return;
+        }
+
+    // Loop all the directories
+    for ( TInt i = 0; i < dirCount; i++ )
+        {
+        HTI_LOG_TEXT( "Reading dir:" );
+        HTI_LOG_DES( directories->MdcaPoint( i ) );
+        CDir* dir;
+        TInt err = fsSession.GetDir( directories->MdcaPoint( i ),
+            KEntryAttNormal, ESortNone, dir );
+        if ( err )
+            {
+            delete dir;
+            dir = NULL;
+            continue; // This dir is skipped
+            }
+        CleanupStack::PushL( dir );
+
+        // Loop all the entries in this directory
+        TInt fileCount( dir->Count() );
+        for ( TInt j = 0; j < fileCount; j++ )
+            {
+            TFileName filePath;
+            filePath.Copy( directories->MdcaPoint( i ) );
+            filePath.Append( ( *dir )[j].iName );
+
+            // Check MIME type match
+            if ( MatchMimeTypeL( filePath, KAudioMimeType ) ||
+                 MatchMimeTypeL( filePath, KRngMimeType ) )
+                {
+                HBufC8* filePathBuf8 = HBufC8::NewLC( KMaxFileName );
+                filePathBuf8->Des().Copy( filePath );
+                TInt pathLength = filePathBuf8->Length();
+                HTI_LOG_DES( *filePathBuf8 );
+                fileListBuf->ExpandL( bufPos, pathLength + 1 );
+                TBuf8<1> lengthBuf;
+                lengthBuf.Append( pathLength );
+                fileListBuf->Write( bufPos, lengthBuf, 1 );
+                bufPos++;
+                fileListBuf->Write( bufPos, filePathBuf8->Ptr(), pathLength );
+                bufPos += pathLength;
+                CleanupStack::PopAndDestroy(); // filePathBuf8
+                audioFileCount++;
+                }
+
+            } // files loop
+        CleanupStack::PopAndDestroy(); // dir
+        } // directories loop
+
+    HTI_LOG_FORMAT( "Total audio file count = %d", audioFileCount );
+
+    // All files added - write number of files to the beginning of buffer...
+    TBuf8<2> countBuf;
+    countBuf.Append( (TUint8*)(&audioFileCount), 2 );
+    fileListBuf->InsertL( 0, countBuf, 2 );
+
+    // ...and send it away
+    TPtr8 ptr = fileListBuf->Ptr( 0 );
+    User::LeaveIfError( SendResponseMsg( ptr ) );
+
+    CleanupStack::PopAndDestroy( 3 ); // fileListBuf, directories, fsSession
+
+    HTI_LOG_FUNC_OUT( "CHtiAudioServicePlugin::HandleListAudioFilesCmdL" );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CHtiAudioServicePlugin::HandlePlayFileCmdL()
+// -----------------------------------------------------------------------------
+//
+void CHtiAudioServicePlugin::HandlePlayFileCmdL( const TDesC8&aMessage )
+    {
+    HTI_LOG_FUNC_IN( "CHtiAudioServicePlugin::HandlePlayFileCmdL" );
+
+    if ( iIsPlaying )
+        {
+        User::LeaveIfError( SendErrorResponseMsg(
+                                KErrInUse, KErrorBusyPlaying ) );
+        return;
+        }
+
+    iPlayCommandId = (TUint8) aMessage[0];
+
+    /*
+    Message bytes:
+             0      = command code
+             1      = path length
+         2 - n      = full path to file
+        next 1 or 4 = volume
+        next 4      = start position
+        next 4      = end position
+        next 1      = repeats
+        next 4      = silence between repeats
+        next 1      = audio setting
+    */
+
+    if ( aMessage.Length() < KPlayFileCmdMinLength )
+        {
+        User::LeaveIfError( SendErrorResponseMsg(
+                                KErrArgument, KErrorInvalidParameters ) );
+        return;
+        }
+
+    // Parse parameter values from the message
+    const TUint8* ptr = aMessage.Ptr();
+    TInt pathLength = aMessage[1];
+
+    if ( (iPlayCommandId == ECmdPlayFile &&
+            ( aMessage.Length() - pathLength ) !=  ( KPlayFileCmdMinLength - 4 ))
+            || (iPlayCommandId == ECmdPlayFile2 && 
+            ( aMessage.Length() - pathLength ) !=  ( KPlayFile2CmdMinLength - 4 )))
+        {
+        User::LeaveIfError( SendErrorResponseMsg(
+                                KErrArgument, KErrorInvalidParameters ) );
+        return;
+        }
+
+    TFileName filePath;
+    TInt nextOffset = ParseString( aMessage, 1, filePath );
+    if ( filePath.Length() < 2 || nextOffset < 0 )
+        {
+        User::LeaveIfError( SendErrorResponseMsg(
+                                KErrArgument, KErrorInvalidParameters ) );
+        return;
+        }
+    HTI_LOG_TEXT( "Full file path:" );
+    HTI_LOG_DES( filePath );
+    if(iPlayCommandId == ECmdPlayFile)
+        {
+        iVolume = aMessage[nextOffset];
+        nextOffset++;
+        }
+    else
+        {
+        iVolume = ParseUint32( ptr + nextOffset );
+        nextOffset += 4;
+        }
+    HTI_LOG_FORMAT( "Volume = %d", iVolume );
+    iStartPos = ParseUint32( ptr + nextOffset );
+    HTI_LOG_FORMAT( "Start position = %d", iStartPos );
+    nextOffset += 4;
+    iEndPos = ParseUint32( ptr + nextOffset );
+    HTI_LOG_FORMAT( "End position = %d", iEndPos );
+    nextOffset += 4;
+    iRepeats = aMessage[nextOffset];
+    nextOffset++;
+    HTI_LOG_FORMAT( "Repeats = %d", iRepeats );
+    iTrailingSilence = ParseUint32( ptr + nextOffset );
+    HTI_LOG_FORMAT( "Trailing silence = %d", iTrailingSilence );
+    nextOffset += 4;
+    TInt audioSetting = aMessage[nextOffset];
+    HTI_LOG_FORMAT( "Audio setting = %d", audioSetting );
+
+    // Set audio settings
+    if ( audioSetting > ERingTonePreview ) audioSetting = EDefault;
+    SetAudioSettings( ( TAudioSetting ) audioSetting );
+
+    // Check if file is rng ringtone, it has to be played using tone player -
+    // other formats are played with audio player.
+
+    TInt err = KErrNone;
+    TBool isRng = EFalse;
+    TRAP( err, isRng = MatchMimeTypeL( filePath, KRngMimeType ) );
+
+    if ( err )
+        {
+        User::LeaveIfError( SendErrorResponseMsg( err, KErrorFileInitFailed ) );
+        return;
+        }
+
+    if ( isRng )
+        {
+        HTI_LOG_TEXT( "File is RNG - creating tone player" );
+        TRAP( err, iTonePlayer = CMdaAudioToneUtility::NewL(
+                *this, NULL, iAudioPriority, iAudioPriorityPreference ) );
+        }
+
+    else
+        {
+        HTI_LOG_TEXT( "File is not RNG - creating audio player" );
+        TRAP( err, iAudioPlayer = CMdaAudioPlayerUtility::NewFilePlayerL(
+                filePath, *this, iAudioPriority, iAudioPriorityPreference ) );
+        // MapcInitComplete callback function will be called
+        }
+
+    if ( err )
+        {
+        delete iAudioPlayer;
+        iAudioPlayer = NULL;
+        delete iTonePlayer;
+        iTonePlayer = NULL;
+        User::LeaveIfError( SendErrorResponseMsg(
+                                err, KErrorFileInitFailed ) );
+        }
+
+    if ( iTonePlayer )
+        {
+        iTonePlayer->PrepareToPlayFileSequence( filePath );
+        // MatoPrepareComplete callback function will be called
+        }
+
+    HTI_LOG_FUNC_OUT( "CHtiAudioServicePlugin::HandlePlayFileCmdL" );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CHtiAudioServicePlugin::HandlePlayToneCmdL()
+// -----------------------------------------------------------------------------
+//
+void CHtiAudioServicePlugin::HandlePlayToneCmdL( const TDesC8& aMessage )
+    {
+    HTI_LOG_FUNC_IN( "CHtiAudioServicePlugin::HandlePlayToneCmdL" );
+
+    if ( iIsPlaying )
+        {
+        User::LeaveIfError( SendErrorResponseMsg(
+                                KErrInUse, KErrorBusyPlaying ) );
+        return;
+        }
+
+    iPlayCommandId = (TUint8)aMessage[0];
+
+    /*
+    Message bytes(ECmdPlayTone):
+            0  = command code
+        1 - 2  = frequency value
+        3 - 6  = duration value
+            7  = volume value
+            8  = repeat value
+        9 - 12 = silence between repeats
+            
+    Message bytes(ECmdPlayTone2):
+            0  = command code
+        1 - 2  = frequency value
+        3 - 6  = duration value
+        7 - 10 = volume value
+            11 = repeat value
+        12- 15 = silence between repeats
+    */
+
+    if ( (iPlayCommandId == ECmdPlayTone && aMessage.Length() != KPlayToneCmdLength)
+            || (iPlayCommandId == ECmdPlayTone2 && aMessage.Length() != KPlayTone2CmdLength))
+        {
+        User::LeaveIfError( SendErrorResponseMsg(
+                                KErrArgument, KErrorInvalidParameters ) );
+        return;
+        }
+
+    // Parse parameter values from the message
+    const TUint8* ptr = aMessage.Ptr();
+    TInt nextOffset = 1;
+    TInt frequency = ParseUint16( ptr + nextOffset );
+    HTI_LOG_FORMAT( "Freq = %d", frequency );
+    nextOffset += 2;
+    TUint duration = ParseUint32( ptr + 3 );
+    HTI_LOG_FORMAT( "Duration = %d", duration );
+    nextOffset += 4;
+    if(iPlayCommandId == ECmdPlayTone)
+        {
+        iVolume = aMessage[nextOffset];
+        nextOffset++;
+        }
+    else
+        {
+        iVolume = ParseUint32( ptr + nextOffset );
+        nextOffset += 4;
+        }
+    HTI_LOG_FORMAT( "Volume = %d", iVolume );
+    iRepeats = aMessage[nextOffset];
+    nextOffset++;
+    HTI_LOG_FORMAT( "Repeats = %d", iRepeats );
+    iTrailingSilence = ParseUint32( ptr + nextOffset );
+    nextOffset +=4;
+    HTI_LOG_FORMAT( "Silence = %d", iTrailingSilence );
+
+    TRAPD( err, iTonePlayer = CMdaAudioToneUtility::NewL( *this ) );
+
+    if ( err )
+        {
+        delete iTonePlayer;
+        iTonePlayer = NULL;
+        User::LeaveIfError( SendErrorResponseMsg(
+                                err, KErrorToneInitFailed ) );
+        }
+
+    iTonePlayer->PrepareToPlayTone( frequency,
+                              TTimeIntervalMicroSeconds( duration ) );
+    // MatoPrepareComplete callback function will be called when ready to play
+    HTI_LOG_FUNC_OUT( "CHtiAudioServicePlugin::HandlePlayToneCmdL" );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CHtiAudioServicePlugin::HandlePlayDtmfCmdL()
+// -----------------------------------------------------------------------------
+//
+void CHtiAudioServicePlugin::HandlePlayDtmfCmdL( const TDesC8& aMessage )
+    {
+    HTI_LOG_FUNC_IN( "CHtiAudioServicePlugin::HandlePlayDtmfCmdL" );
+
+    if ( iIsPlaying )
+        {
+        User::LeaveIfError( SendErrorResponseMsg(
+                                KErrInUse, KErrorBusyPlaying ) );
+        return;
+        }
+
+    iPlayCommandId = (TUint8)aMessage[0];
+
+    /*
+    Message bytes:
+             0      = command code
+             1      = DTMF string length
+         2 - n      = dtmf string
+        next 4      = tone length
+        next 4      = tone gap length
+        next 1 or 4 = volume
+        next 1      = repeats
+        next 4      = silence between repeats
+    */
+
+    if ( (iPlayCommandId == ECmdPlayDtmf && aMessage.Length() < KPlayDtmfCmdMinLength )
+            || (iPlayCommandId == ECmdPlayDtmf2 && aMessage.Length() < KPlayDtmf2CmdMinLength ))
+        {
+        User::LeaveIfError( SendErrorResponseMsg(
+                                KErrArgument, KErrorInvalidParameters ) );
+        return;
+        }
+
+    // Parse parameter values from the message
+    const TUint8* ptr = aMessage.Ptr();
+    TInt stringLength = aMessage[1];
+
+    if ( (iPlayCommandId == ECmdPlayDtmf && ( aMessage.Length() - stringLength ) !=
+         ( KPlayDtmfCmdMinLength - 1 ))
+         || (iPlayCommandId == ECmdPlayDtmf2 && ( aMessage.Length() - stringLength ) !=
+                 ( KPlayDtmf2CmdMinLength - 1 )))
+        {
+        User::LeaveIfError( SendErrorResponseMsg(
+                                KErrArgument, KErrorInvalidParameters ) );
+        return;
+        }
+
+    TBuf<255> dtmfString;
+    TInt nextOffset = ParseString( aMessage, 1, dtmfString );
+    if ( dtmfString.Length() < 1 || nextOffset < 0 )
+        {
+        User::LeaveIfError( SendErrorResponseMsg(
+                                KErrArgument, KErrorInvalidParameters ) );
+        return;
+        }
+    HTI_LOG_TEXT( "DTMF string:" );
+    HTI_LOG_DES( dtmfString );
+    iDtmfLength = ParseUint32( ptr + nextOffset );
+    nextOffset += 4;
+    HTI_LOG_FORMAT( "DTMF length = %d", iDtmfLength );
+    iDtmfGapLength = ParseUint32( ptr + nextOffset );
+    nextOffset += 4;
+    HTI_LOG_FORMAT( "DTMF gap length = %d", iDtmfGapLength );
+    if(iPlayCommandId == ECmdPlayDtmf)
+        {
+        iVolume = aMessage[nextOffset];
+        nextOffset++;
+        }
+    else
+        {
+        iVolume = ParseUint32( ptr + nextOffset );
+        nextOffset += 4;
+        }
+    HTI_LOG_FORMAT( "Volume = %d", iVolume );
+    iRepeats = aMessage[nextOffset];
+    nextOffset++;
+    HTI_LOG_FORMAT( "Repeats = %d", iRepeats );
+    iTrailingSilence = ParseUint32( ptr + nextOffset );
+    HTI_LOG_FORMAT( "Trailing silence = %d", iTrailingSilence );
+
+    SetAudioSettings( EDtmfString );
+
+    TRAPD( err, iTonePlayer = CMdaAudioToneUtility::NewL(
+            *this, NULL, iAudioPriority, iAudioPriorityPreference ) );
+
+    if ( err )
+        {
+        delete iTonePlayer;
+        iTonePlayer = NULL;
+        User::LeaveIfError( SendErrorResponseMsg( err, KErrorToneInitFailed ) );
+        }
+
+    iTonePlayer->PrepareToPlayDTMFString( dtmfString );
+    // MatoPrepareComplete callback function will be called when ready to play
+    HTI_LOG_FUNC_OUT( "CHtiAudioServicePlugin::HandlePlayDtmfCmdL" );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CHtiAudioServicePlugin::HandleStopCmdL()
+// -----------------------------------------------------------------------------
+//
+void CHtiAudioServicePlugin::HandleStopCmdL( const TDesC8& aMessage )
+    {
+    HTI_LOG_FUNC_IN( "CHtiAudioServicePlugin::HandleStopCmdL" );
+
+    if ( aMessage.Length() != KStopCmdLength )
+        {
+        User::LeaveIfError( SendErrorResponseMsg(
+                                KErrArgument, KErrorInvalidParameters ) );
+        return;
+        }
+
+    if ( !iIsPlaying )
+        {
+        HTI_LOG_TEXT( "Not playing - nothing to stop" );
+        // Just send "OK" reply if nothing is currently playing
+        User::LeaveIfError( SendResponseMsg( _L8( "OK" ) ) );
+        }
+
+    else
+        {
+        if ( iAudioPlayer )
+            {
+            HTI_LOG_TEXT( "Stopping audio player" );
+            iAudioPlayer->Stop();
+            iIsPlaying = EFalse;
+            delete iAudioPlayer;
+            iAudioPlayer = NULL;
+            // According to documentation should call MapcPlayComplete callback
+            // method but it doesn't, so sending reply here.
+            User::LeaveIfError( SendResponseMsg( _L8( "OK" ) ) );
+            }
+
+        else if ( iTonePlayer )
+            {
+            HTI_LOG_TEXT( "Stopping tone player" );
+            iTonePlayer->CancelPlay();
+            iIsPlaying = EFalse;
+            delete iTonePlayer;
+            iTonePlayer = NULL;
+            // Callback method MatoPlayComplete is not called -
+            // sending reply here.
+            User::LeaveIfError( SendResponseMsg( _L8( "OK" ) ) );
+            }
+        }
+    HTI_LOG_FUNC_OUT( "CHtiAudioServicePlugin::HandleStopCmdL" );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CHtiAudioServicePlugin::HandleGetDurationCmdL()
+// -----------------------------------------------------------------------------
+//
+void CHtiAudioServicePlugin::HandleGetDurationCmdL( const TDesC8& aMessage )
+    {
+    HTI_LOG_FUNC_IN( "CHtiAudioServicePlugin::HandleGetDurationCmdL" );
+
+    if ( iIsPlaying )
+        {
+         // If currently playing, no parameters allowed. Returns the duration
+         // of currently playing sound.
+        if ( aMessage.Length() != 1 )
+            {
+            User::LeaveIfError( SendErrorResponseMsg(
+                                    KErrInUse, KErrorBusyPlaying ) );
+            return;
+            }
+
+        if ( iAudioPlayer )
+            {
+            TTimeIntervalMicroSeconds durationValue =
+                                iAudioPlayer->Duration();
+
+            if ( I64HIGH( durationValue.Int64() ) > 0 )
+                {
+                User::LeaveIfError( SendErrorResponseMsg(
+                                        KErrOverflow, KErrorDurationFailed ) );
+                return;
+                }
+            else
+                {
+                TUint duration = I64LOW( durationValue.Int64() );
+                TBuf8<KTUintSize> durationBuf;
+                durationBuf.Append( (TUint8*)(&duration), KTUintSize );
+                User::LeaveIfError( SendResponseMsg( durationBuf ) );
+                return;
+                }
+            }
+
+        else  // Duration supported only for audio player
+            {
+            User::LeaveIfError( SendErrorResponseMsg(
+                                    KErrNotSupported, KErrorDurationFailed ) );
+            return;
+            }
+        }
+
+    /* Command must have file path parameter if not currently playing.
+    Message bytes:
+             0 = command code
+             1 = path length
+         2 - n = full path to file
+    */
+
+    if ( aMessage.Length() < KDurationCmdMinLength )
+        {
+        User::LeaveIfError( SendErrorResponseMsg(
+                                KErrArgument, KErrorInvalidParameters ) );
+        return;
+        }
+
+    TInt pathLength = aMessage[1];
+    if ( ( aMessage.Length() - pathLength ) !=
+         ( KDurationCmdMinLength - 4 ) )
+        {
+        User::LeaveIfError( SendErrorResponseMsg(
+                                KErrArgument, KErrorInvalidParameters ) );
+        return;
+        }
+
+    // Parse parameter values from the message
+    TFileName filePath;
+    TInt nextOffset = ParseString( aMessage, 1, filePath );
+    if ( filePath.Length() < 2 || nextOffset < 0 )
+        {
+        User::LeaveIfError( SendErrorResponseMsg(
+                                KErrArgument, KErrorInvalidParameters ) );
+        return;
+        }
+    HTI_LOG_TEXT( "Full file path:" );
+    HTI_LOG_DES( filePath );
+
+    TRAPD( err, iAudioPlayer = CMdaAudioPlayerUtility::NewFilePlayerL(
+                                                        filePath, *this ) );
+    if ( err )
+        {
+        delete iAudioPlayer;
+        iAudioPlayer = NULL;
+        User::LeaveIfError( SendErrorResponseMsg( err, KErrorDurationFailed ) );
+        }
+
+    // MapcInitComplete callback function will be called
+    HTI_LOG_FUNC_OUT( "CHtiAudioServicePlugin::HandleGetDurationCmdL" );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CHtiAudioServicePlugin::HandleGetMaxVolCmdL()
+// -----------------------------------------------------------------------------
+//
+void CHtiAudioServicePlugin::HandleGetMaxVolCmdL( const TDesC8& aMessage )
+    {
+    HTI_LOG_FUNC_IN( "CHtiAudioServicePlugin::HandleGetMaxVolCmdL" );
+
+    if ( iIsPlaying )
+        {
+         // If currently playing, no parameters allowed. Returns the max volume
+         // of currently playing sound.
+        if ( aMessage.Length() != 1 )
+            {
+            User::LeaveIfError( SendErrorResponseMsg(
+                                    KErrInUse, KErrorBusyPlaying ) );
+            return;
+            }
+
+        TInt maxVol = -1;
+
+        if ( iAudioPlayer )
+            {
+            maxVol = iAudioPlayer->MaxVolume();
+            }
+
+        else if ( iTonePlayer )
+            {
+            maxVol = iTonePlayer->MaxVolume();
+            }
+
+        HTI_LOG_FORMAT( "Max volume = %d", maxVol );
+
+        if ( maxVol < 0 )
+            {
+            // Should not happen
+            User::LeaveIfError( SendErrorResponseMsg(
+                                    KErrGeneral, KErrorMaxVolFailed ) );
+            return;
+            }
+
+        if(aMessage[0] == ECmdGetMaxVol)
+            {
+            if ( maxVol > 255 ) maxVol = 255;
+            TBuf8<1> maxVolBuf;
+            maxVolBuf.Append( maxVol );
+            User::LeaveIfError( SendResponseMsg( maxVolBuf ) );
+            }
+        else
+            {
+            TBuf8<4> maxVolBuf;
+            maxVolBuf.Append( (TUint8*) &maxVol, 4 );
+            User::LeaveIfError( SendResponseMsg( maxVolBuf ) );
+            }
+        return;
+        }
+
+    /*
+    Message bytes:
+             0 = command code
+             1 = path length
+         2 - n = full path to file
+    */
+
+    if ( aMessage.Length() < KMaxVolCmdMinLength )
+        {
+        User::LeaveIfError( SendErrorResponseMsg(
+                                KErrArgument, KErrorInvalidParameters ) );
+        return;
+        }
+
+    TInt pathLength = aMessage[1];
+    if ( ( aMessage.Length() - pathLength ) != ( KMaxVolCmdMinLength - 4 ) )
+        {
+        User::LeaveIfError( SendErrorResponseMsg(
+                                KErrArgument, KErrorInvalidParameters ) );
+        return;
+        }
+
+    // Parse parameter values from the message
+    TFileName filePath;
+    TInt nextOffset = ParseString( aMessage, 1, filePath );
+    if ( filePath.Length() < 2 || nextOffset < 0 )
+        {
+        User::LeaveIfError( SendErrorResponseMsg(
+                                KErrArgument, KErrorInvalidParameters ) );
+        return;
+        }
+    HTI_LOG_TEXT( "Full file path:" );
+    HTI_LOG_DES( filePath );
+
+    TInt err = KErrNone;
+    TBool isRng = EFalse;
+    TRAP( err, isRng = MatchMimeTypeL( filePath, KRngMimeType ) );
+
+    if ( err )
+        {
+        User::LeaveIfError( SendErrorResponseMsg( err, KErrorMaxVolFailed ) );
+        return;
+        }
+
+    if ( isRng )
+        {
+        HTI_LOG_TEXT( "File is RNG - creating tone player" );
+        TRAP( err, iTonePlayer = CMdaAudioToneUtility::NewL( *this ) );
+        }
+
+    else
+        {
+        HTI_LOG_TEXT( "File is not RNG - creating audio player" );
+        TRAP( err, iAudioPlayer = CMdaAudioPlayerUtility::NewFilePlayerL(
+                                                        filePath, *this ) );
+        // MapcInitComplete callback function will be called
+        }
+
+    if ( err )
+        {
+        delete iAudioPlayer;
+        iAudioPlayer = NULL;
+        delete iTonePlayer;
+        iTonePlayer = NULL;
+        User::LeaveIfError( SendErrorResponseMsg( err, KErrorMaxVolFailed ) );
+        }
+
+    if ( iTonePlayer )
+        {
+        iTonePlayer->PrepareToPlayFileSequence( filePath );
+        // MatoPrepareComplete callback function will be called
+        }
+
+    HTI_LOG_FUNC_OUT( "CHtiAudioServicePlugin::HandleGetMaxVolCmdL" );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CHtiAudioServicePlugin::HandleSetVolCmdL()
+// -----------------------------------------------------------------------------
+//
+void CHtiAudioServicePlugin::HandleSetVolCmdL( const TDesC8& aMessage )
+    {
+    HTI_LOG_FUNC_IN( "CHtiAudioServicePlugin::HandleSetVolCmdL" );
+
+    if ( (aMessage[0] == ECmdSetVol && aMessage.Length() != KSetVolCmdLength )
+            || (aMessage[0] == ECmdSetVol2 && aMessage.Length() != KSetVol2CmdLength ))
+        {
+        User::LeaveIfError( SendErrorResponseMsg( KErrArgument,
+                                                  KErrorInvalidParameters ) );
+        }
+
+    if ( !iIsPlaying )
+        {
+        HTI_LOG_TEXT( "Nothing playing - not setting volume" );
+        User::LeaveIfError( SendErrorResponseMsg(
+                                KErrNotReady, KErrorNothingPlaying ) );
+        }
+
+    else if(aMessage[0] == ECmdSetVol)
+        {
+        TInt volume = aMessage[1]; // [0] = command code, [1] = volume value
+        HTI_LOG_FORMAT( "requested volume = %d", volume );
+
+        if ( iAudioPlayer )
+            {
+            HTI_LOG_TEXT( "Setting audio player volume" );
+            TInt maxVol = iAudioPlayer->MaxVolume();
+            HTI_LOG_FORMAT( "max volume = %d", maxVol );
+            if ( volume > maxVol ) volume = maxVol;
+            iAudioPlayer->SetVolume( volume );
+            TBuf8<1> volBuf;
+            volBuf.Append( volume );
+            User::LeaveIfError( SendResponseMsg( volBuf ) );
+            }
+        else if ( iTonePlayer )
+            {
+            HTI_LOG_TEXT( "Setting tone player volume" );
+            TInt maxVol = iTonePlayer->MaxVolume();
+            HTI_LOG_FORMAT( "max volume = %d", maxVol );
+            if ( volume > maxVol ) volume = maxVol;
+            iTonePlayer->SetVolume( volume );
+            TBuf8<1> volBuf;
+            volBuf.Append( volume );
+            User::LeaveIfError( SendResponseMsg( volBuf ) );
+            }
+        }
+    else if(aMessage[0] == ECmdSetVol2)
+        {
+        TInt volume = aMessage[1] + (aMessage[2] << 8)
+                + (aMessage[3] << 16) + (aMessage[4] << 24);
+        HTI_LOG_FORMAT( "requested volume = %d", volume );
+    
+        if ( iAudioPlayer )
+            {
+            HTI_LOG_TEXT( "Setting audio player volume" );
+            TInt maxVol = iAudioPlayer->MaxVolume();
+            HTI_LOG_FORMAT( "max volume = %d", maxVol );
+            if ( volume > maxVol ) volume = maxVol;
+            iAudioPlayer->SetVolume( volume );
+            TBuf8<4> volBuf;
+            volBuf.Append( (TUint8*)&volume, 4 );
+            User::LeaveIfError( SendResponseMsg( volBuf ) );
+            }
+        else if ( iTonePlayer )
+            {
+            HTI_LOG_TEXT( "Setting tone player volume" );
+            TInt maxVol = iTonePlayer->MaxVolume();
+            HTI_LOG_FORMAT( "max volume = %d", maxVol );
+            if ( volume > maxVol ) volume = maxVol;
+            iTonePlayer->SetVolume( volume );
+            TBuf8<4> volBuf;
+            volBuf.Append( (TUint8*)&volume, 4 );
+            User::LeaveIfError( SendResponseMsg( volBuf ) );
+            }
+        }
+    HTI_LOG_FUNC_OUT( "CHtiAudioServicePlugin::HandleSetVolCmdL" );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CHtiAudioServicePlugin::MatoPrepareComplete()
+// Tone player prepare complete
+// -----------------------------------------------------------------------------
+//
+void CHtiAudioServicePlugin::MatoPrepareComplete( TInt aError )
+    {
+    HTI_LOG_FUNC_IN( "CHtiAudioServicePlugin::MatoPrepareComplete" );
+
+    if ( iCommandId == ECmdGetMaxVol || iCommandId == ECmdGetMaxVol2)
+        {
+        if ( aError )
+            {
+            SendErrorResponseMsg( aError, KErrorMaxVolFailed );
+            }
+
+        else
+            {
+            TInt maxVol = iTonePlayer->MaxVolume();
+            HTI_LOG_FORMAT( "Max volume = %d", maxVol );
+            if(iCommandId == ECmdGetMaxVol)
+                {
+                if ( maxVol > 255 ) maxVol = 255;
+                TBuf8<1> maxVolBuf;
+                maxVolBuf.Append( maxVol );
+                SendResponseMsg( maxVolBuf );
+                }
+            else
+                {
+                TBuf8<4> maxVolBuf;
+                maxVolBuf.Append( (TUint8*)&maxVol, 4 );
+                SendResponseMsg( maxVolBuf );
+                }
+            }
+
+        delete iTonePlayer;
+        iTonePlayer = NULL;
+        return;
+        }
+
+    if ( aError )
+        {
+        SendErrorResponseMsg( aError, KErrorToneInitFailed );
+        delete iTonePlayer;
+        iTonePlayer = NULL;
+        }
+
+    else
+        {
+        if ( iCommandId == ECmdPlayDtmf || iCommandId == ECmdPlayDtmf2)
+            {
+            iTonePlayer->SetDTMFLengths(
+                TTimeIntervalMicroSeconds32( iDtmfLength ),
+                TTimeIntervalMicroSeconds32( iDtmfGapLength ),
+                TTimeIntervalMicroSeconds32( 0 ) );
+            }
+
+        if ( iVolume > iTonePlayer->MaxVolume() )
+            {
+            iVolume = iTonePlayer->MaxVolume();
+            }
+
+        iTonePlayer->SetVolume( iVolume );
+        iTonePlayer->SetRepeats( iRepeats + 1,
+                        TTimeIntervalMicroSeconds( iTrailingSilence ) );
+        iIsPlaying = ETrue;
+        iTonePlayer->Play();
+        iIsBusy = EFalse;
+        // MatoPlayComplete callback function will be called when playing ends.
+        }
+
+    HTI_LOG_FUNC_OUT( "CHtiAudioServicePlugin::MatoPrepareComplete" );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CHtiAudioServicePlugin::MatoPlayComplete()
+// Tone play complete
+// -----------------------------------------------------------------------------
+//
+void CHtiAudioServicePlugin::MatoPlayComplete( TInt aError )
+    {
+    HTI_LOG_FUNC_IN( "CHtiAudioServicePlugin::MatoPlayComplete" );
+
+    iIsPlaying = EFalse;
+    iIsBusy = ETrue; // Busy dispatching the play complete message
+
+    if ( aError )
+        {
+        SendErrorResponseMsg( aError, KErrorTonePlayFailed, iPlayCommandId );
+        }
+
+    else
+        {
+        SendResponseMsg( _L8( "OK" ), iPlayCommandId );
+        }
+
+    delete iTonePlayer;
+    iTonePlayer = NULL;
+
+    HTI_LOG_FUNC_OUT( "CHtiAudioServicePlugin::MatoPlayComplete" );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CHtiAudioServicePlugin::MapcInitComplete()
+// Audio player init complete
+// -----------------------------------------------------------------------------
+//
+void CHtiAudioServicePlugin::MapcInitComplete( TInt aError,
+                                 const TTimeIntervalMicroSeconds& aDuration )
+    {
+    HTI_LOG_FUNC_IN( "CHtiAudioServicePlugin::MapcInitComplete" );
+
+    if ( iCommandId == ECmdPlayFile || iCommandId == ECmdPlayFile2)
+        {
+        if ( aError )
+            {
+            SendErrorResponseMsg( aError, KErrorFileInitFailed );
+            delete iAudioPlayer;
+            iAudioPlayer = NULL;
+            }
+
+        else
+            {
+            if ( iEndPos < iStartPos ||
+                        TTimeIntervalMicroSeconds( iStartPos ) > aDuration )
+                {
+                SendErrorResponseMsg( KErrArgument, KErrorPosition );
+                delete iAudioPlayer;
+                iAudioPlayer = NULL;
+                return;
+                }
+
+            if ( iEndPos > 0 )
+                {
+                iAudioPlayer->SetPlayWindow(
+                    TTimeIntervalMicroSeconds( iStartPos ),
+                    TTimeIntervalMicroSeconds( iEndPos ) );
+                }
+
+            HTI_LOG_FORMAT( "Max volume = %d", iAudioPlayer->MaxVolume() );
+            HTI_LOG_FORMAT( "Setting volume = %d", iVolume );
+            if ( iVolume > iAudioPlayer->MaxVolume() )
+                {
+                iVolume = iAudioPlayer->MaxVolume();
+                }
+
+            iAudioPlayer->SetVolume( iVolume );
+            iAudioPlayer->SetRepeats( iRepeats,
+                            TTimeIntervalMicroSeconds( iTrailingSilence ) );
+            iIsPlaying = ETrue;
+            iAudioPlayer->Play();
+
+            // Have to do this after play command because
+            // volume setting before play seems to have no effect.
+            iAudioPlayer->SetVolume( 0 );
+            iAudioPlayer->SetVolume( iVolume );
+
+            iIsBusy = EFalse;
+            // MapcPlayComplete callback function is called when playing ends
+            }
+        }
+
+    else if ( iCommandId == ECmdGetDuration )
+        {
+        if ( aError )
+            {
+            SendErrorResponseMsg( aError, KErrorDurationFailed );
+            }
+
+        else
+            {
+            if ( I64HIGH( aDuration.Int64() ) > 0 )
+                {
+                SendErrorResponseMsg( KErrOverflow, KErrorDurationFailed );
+                }
+            else
+                {
+                TUint duration = I64LOW( aDuration.Int64() );
+                TBuf8<KTUintSize> durationBuf;
+                durationBuf.Append( (TUint8*)(&duration), KTUintSize );
+                SendResponseMsg( durationBuf );
+                }
+            }
+        delete iAudioPlayer;
+        iAudioPlayer = NULL;
+        }
+
+    else if ( iCommandId == ECmdGetMaxVol || iCommandId == ECmdGetMaxVol2)
+        {
+        if ( aError )
+            {
+            SendErrorResponseMsg( aError, KErrorMaxVolFailed );
+            }
+
+        else
+            {
+            TInt maxVol = iAudioPlayer->MaxVolume();
+            HTI_LOG_FORMAT( "Max volume = %d", maxVol );
+            if(iCommandId == ECmdGetMaxVol)
+                {
+                if ( maxVol > 255 ) maxVol = 255;
+                TBuf8<1> maxVolBuf;
+                maxVolBuf.Append( maxVol );
+                SendResponseMsg( maxVolBuf );
+                }
+            else
+                {
+                TBuf8<4> maxVolBuf;
+                maxVolBuf.Append( (TUint8*)&maxVol, 4 );
+                SendResponseMsg( maxVolBuf );
+                }
+            }
+        delete iAudioPlayer;
+        iAudioPlayer = NULL;
+        }
+
+    HTI_LOG_FUNC_OUT( "CHtiAudioServicePlugin::MapcInitComplete" );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CHtiAudioServicePlugin::MapcPlayComplete()
+// Audio play complete
+// -----------------------------------------------------------------------------
+//
+void CHtiAudioServicePlugin::MapcPlayComplete( TInt aError )
+    {
+    HTI_LOG_FUNC_IN( "CHtiAudioServicePlugin::MapcPlayComplete" );
+
+    iIsPlaying = EFalse;
+    iIsBusy = ETrue; // Busy dispatching the play complete message
+
+    if ( aError )
+        {
+        SendErrorResponseMsg( aError, KErrorFilePlayFailed, ECmdPlayFile );
+        }
+
+    else
+        {
+        SendResponseMsg( _L8( "OK" ), iPlayCommandId );
+        }
+
+    delete iAudioPlayer;
+    iAudioPlayer = NULL;
+
+    HTI_LOG_FUNC_OUT( "CHtiAudioServicePlugin::MapcPlayComplete" );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CHtiAudioServicePlugin::NotifyMemoryChange
+// Called when HTI Framework has dispatched a message forward and the amount
+// of free memory in the message queue has changed.
+// -----------------------------------------------------------------------------
+//
+void CHtiAudioServicePlugin::NotifyMemoryChange( TInt aAvailableMemory )
+    {
+    if ( iIsBusy && iMessage )
+        {
+        if ( aAvailableMemory >= iMessage->Size() )
+            {
+            if ( iErrorCode == 0 )
+                {
+                TInt err = iDispatcher->DispatchOutgoingMessage(
+                    iMessage, KAudioServiceUid );
+
+                if ( err == KErrNone )
+                    {
+                    // Ownership of iMessage has been transferred
+                    iMessage = NULL;
+                    iIsBusy = EFalse;
+                    iDispatcher->RemoveMemoryObserver( this );
+                    }
+
+                else if ( err == KErrNoMemory )
+                    {
+                    // Keep retrying.
+                    }
+
+                else // Give up on sending
+                    {
+                    delete iMessage;
+                    iMessage = NULL;
+                    iIsBusy = EFalse;
+                    iDispatcher->RemoveMemoryObserver( this );
+                    }
+                }
+
+            else
+                {
+                TInt err = iDispatcher->DispatchOutgoingErrorMessage(
+                    iErrorCode, *iMessage, KAudioServiceUid );
+
+                // If it was success or some other error than KErrNoMemory
+                // we are done sending or trying to send this message.
+                if ( err != KErrNoMemory )
+                    {
+                    delete iMessage;
+                    iMessage = NULL;
+                    iIsBusy = EFalse;
+                    iDispatcher->RemoveMemoryObserver( this );
+                    }
+
+                else
+                    {
+                    // Keep retrying.
+                    }
+                }
+            }
+        }
+    }
+
+
+// -----------------------------------------------------------------------------
+// CHtiAudioServicePlugin::IsBusy
+// -----------------------------------------------------------------------------
+//
+TBool CHtiAudioServicePlugin::IsBusy()
+    {
+    return iIsBusy;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CHtiAudioServicePlugin::SendResponseMsg
+// Sends a message out to the message dispatcher.
+// -----------------------------------------------------------------------------
+//
+TInt CHtiAudioServicePlugin::SendResponseMsg( const TDesC8& aMsg,
+                                              const TUint8 aCommandId )
+    {
+    HTI_LOG_FUNC_IN( "CHtiAudioServicePlugin::SendResponseMsg" );
+
+    iErrorCode = 0;
+
+    if ( iDispatcher == NULL )
+        {
+        iIsBusy = EFalse;
+        return KErrGeneral;
+        }
+
+    iDispatcher->RemoveMemoryObserver( this );
+
+    delete iMessage;
+    iMessage = NULL;
+    iMessage = HBufC8::New( aMsg.Length() + 1 );
+
+    if ( iMessage == NULL )
+        {
+        iIsBusy = EFalse;
+        return KErrNoMemory;
+        }
+
+    TPtr8 ptr8 = iMessage->Des();
+    if ( aCommandId != 0 )
+        {
+        ptr8.Append( aCommandId );
+        }
+    else
+        {
+        ptr8.Append( iCommandId );
+        }
+
+    ptr8.Append( aMsg );
+
+    TInt err = KErrNone;
+
+    err = iDispatcher->DispatchOutgoingMessage( iMessage, KAudioServiceUid );
+
+    if ( err == KErrNoMemory )
+        {
+        HTI_LOG_TEXT( "Message queue memory full - waiting" );
+        iIsBusy = ETrue; // Should already be true, but just in case
+        iDispatcher->AddMemoryObserver( this );
+        // For the caller of this method all is OK, sending is just delayed
+        err = KErrNone;
+        }
+
+    else if ( err == KErrNone )
+        {
+        HTI_LOG_TEXT( "Message sent to dispatcher" );
+        iMessage = NULL; // Ownership of iMessage has been transferred
+        iIsBusy = EFalse;
+        }
+
+    else // give up on sending
+        {
+        HTI_LOG_FORMAT( "Other dispatcher error %d", err );
+        delete iMessage;
+        iMessage = NULL;
+        iIsBusy = EFalse;
+        }
+
+    HTI_LOG_FUNC_OUT( "CHtiAudioServicePlugin::SendResponseMsg" );
+    return err;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CHtiAudioServicePlugin::SendErrorResponseMsg
+// Sends an error message out to the message dispatcher.
+// -----------------------------------------------------------------------------
+//
+TInt CHtiAudioServicePlugin::SendErrorResponseMsg( TInt aErrorCode,
+                        const TDesC8& aErrorDescription,
+                        const TUint8 aCommandId )
+    {
+    HTI_LOG_FUNC_IN( "CHtiAudioServicePlugin::SendErrorResponseMsg" );
+
+    iErrorCode = aErrorCode;
+
+    if ( iDispatcher == NULL )
+        {
+        iIsBusy = EFalse;
+        return KErrGeneral;
+        }
+
+    iDispatcher->RemoveMemoryObserver( this );
+
+    delete iMessage;
+    iMessage = NULL;
+    iMessage = HBufC8::New( aErrorDescription.Length() + 1 );
+
+    if ( iMessage == NULL )
+        {
+        iIsBusy = EFalse;
+        return KErrNoMemory;
+        }
+
+    TPtr8 ptr8 = iMessage->Des();
+    if ( aCommandId != 0 )
+        {
+        ptr8.Append( aCommandId );
+        }
+    else
+        {
+        ptr8.Append( iCommandId );
+        }
+
+    ptr8.Append( aErrorDescription );
+
+    TInt err = KErrNone;
+
+    err = iDispatcher->DispatchOutgoingErrorMessage(
+        aErrorCode, *iMessage, KAudioServiceUid );
+
+    if ( err == KErrNoMemory )
+        {
+        HTI_LOG_TEXT( "Message queue memory full - waiting" );
+        iIsBusy = ETrue; // Should already be true, but just in case
+        iDispatcher->AddMemoryObserver( this );
+        // For the caller of this method all is OK, sending is just delayed
+        err = KErrNone;
+        }
+
+    else if ( err == KErrNone )
+        {
+        HTI_LOG_TEXT( "Error message sent to dispatcher" );
+        delete iMessage;
+        iMessage = NULL;
+        iIsBusy = EFalse;
+        }
+
+    else // give up on sending
+        {
+        HTI_LOG_FORMAT( "Other dispatcher error %d", err );
+        delete iMessage;
+        iMessage = NULL;
+        iIsBusy = EFalse;
+        }
+
+    HTI_LOG_FUNC_OUT( "CHtiAudioServicePlugin::SendErrorResponseMsg" );
+    return err;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CHtiAudioServicePlugin::ParseString()
+// -----------------------------------------------------------------------------
+//
+TInt CHtiAudioServicePlugin::ParseString( const TDesC8& aRequest,
+                                          TInt aOffset,
+                                          TDes& aResult )
+    {
+    HTI_LOG_FUNC_IN( "CHtiAudioServicePlugin::ParseString" );
+
+    // If offset outside the string return empty string
+    if ( aOffset >= aRequest.Size() )
+        {
+        return aOffset;
+        }
+
+    TInt length = aRequest[aOffset];
+    HTI_LOG_FORMAT( "String length = %d", length );
+
+    // If length is zero return empty string
+    if ( length < 1 )
+        {
+        return aOffset + 1;
+        }
+
+    if ( length > aResult.MaxLength() )
+        {
+        return KErrBadDescriptor;
+        }
+
+    TInt nextOffset = length + aOffset + 1;
+    HTI_LOG_FORMAT( "Next offset = %d", nextOffset );
+    HTI_LOG_FORMAT( "Request size = %d", aRequest.Size() );
+
+    if ( nextOffset > aRequest.Size() )
+        {
+        return KErrArgument;
+        }
+
+    aResult.Copy( aRequest.Mid( aOffset + 1, length ) );
+
+    HTI_LOG_FUNC_OUT( "CHtiAudioServicePlugin::ParseString" );
+    return nextOffset;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CHtiAudioServicePlugin::AddSubdirsRecursivelyL
+// Scan all subdirectories from the given path and add them to the aArray.
+// -----------------------------------------------------------------------------
+//
+void CHtiAudioServicePlugin::AddSubdirsRecursivelyL( const TDesC& aPath,
+                                                     CDesCArraySeg& aArray,
+                                                     RFs& aFs )
+    {
+    HTI_LOG_FUNC_IN( "CHtiAudioServicePlugin::AddSubdirsRecursivelyL" );
+
+    CDirScan* dirScan = CDirScan::NewL( aFs );
+    CleanupStack::PushL( dirScan );
+
+    TFileName* path = new (ELeave) TFileName;
+    CleanupStack::PushL( path );
+
+    CDir* directory = NULL;
+    TPtrC currentPath;
+
+    dirScan->SetScanDataL( aPath, KEntryAttMatchExclusive | KEntryAttDir, ESortNone );
+    dirScan->NextL( directory );
+
+    while ( directory )
+        {
+        CleanupStack::PushL( directory );
+        currentPath.Set( dirScan->FullPath() );
+
+        TInt dirCount( directory->Count() );
+        for ( TInt i = 0; i < dirCount ; ++i )
+            {
+            path->Copy( currentPath );
+            path->Append( ( *directory )[ i ].iName );
+            path->Append( KBackslash );
+            aArray.AppendL( *path );
+            }
+
+        CleanupStack::PopAndDestroy( directory );
+        directory = NULL;
+
+        dirScan->NextL( directory );
+        }
+
+    CleanupStack::PopAndDestroy( 2 ); // path, dirScan
+
+    HTI_LOG_FUNC_OUT( "CHtiAudioServicePlugin::AddSubdirsRecursivelyL" );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CHtiAudioServicePlugin::MatchMimeTypeL
+// Check if the MIME type of the given file matches to the given pattern.
+// -----------------------------------------------------------------------------
+//
+TBool CHtiAudioServicePlugin::MatchMimeTypeL( const TDesC& aFilePath,
+                      const TDesC& aMimeTypeMatchPattern )
+    {
+    HTI_LOG_FUNC_IN( "CHtiAudioServicePlugin::MatchMimeTypeL" );
+
+    RApaLsSession apaSession;
+    User::LeaveIfError( apaSession.Connect() );
+    CleanupClosePushL( apaSession );
+
+    TUid dummyUid( KNullUid );
+    TDataType dataType;
+    User::LeaveIfError( apaSession.AppForDocument( aFilePath,
+                                                   dummyUid,
+                                                   dataType ) );
+    CleanupStack::PopAndDestroy(); // apaSession
+
+    if ( dataType.Des().MatchF( aMimeTypeMatchPattern ) >= 0 )
+        {
+        HTI_LOG_TEXT( "Match" );
+        return ETrue;
+        }
+
+    HTI_LOG_TEXT( "Not match" );
+    HTI_LOG_FUNC_OUT( "CHtiAudioServicePlugin::MatchMimeTypeL" );
+    return EFalse;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CHtiAudioServicePlugin::SetAudioSettings
+// Set the audio priority and priority preference values.
+// -----------------------------------------------------------------------------
+//
+void CHtiAudioServicePlugin::SetAudioSettings( TAudioSetting aSetting )
+    {
+    HTI_LOG_FUNC_IN( "CHtiAudioServicePlugin::SetAudioSettings" );
+    HTI_LOG_FORMAT( "Setting values for audio setting %d", aSetting );
+
+    switch ( aSetting )
+        {
+        case EGeneralMusic:
+            {
+            iAudioPriority = KAudioPriorityRealOnePlayer;
+            iAudioPriorityPreference =
+                ( TMdaPriorityPreference ) KAudioPrefRealOneLocalPlayback;
+            break;
+            }
+
+        case ERingTonePreview:
+            {
+            iAudioPriority = KAudioPriorityRingingTonePreview;
+            iAudioPriorityPreference =
+                ( TMdaPriorityPreference ) KAudioPrefRingFilePreview;
+            break;
+            }
+/*
+        case EIncomingCall:
+            {
+            iAudioPriority = KAudioPriorityPhoneCall;
+            iAudioPriorityPreference =
+                ( TMdaPriorityPreference ) KAudioPrefIncomingCall;
+            break;
+            }
+*/
+        case EDtmfString:
+            {
+
+            iAudioPriority = KAudioPriorityDTMFString;
+            iAudioPriorityPreference =
+                ( TMdaPriorityPreference ) KAudioDTMFString;
+            break;
+            }
+
+        default:
+            {
+            iAudioPriority = EMdaPriorityNormal;
+            iAudioPriorityPreference = EMdaPriorityPreferenceTimeAndQuality;
+            break;
+            }
+        }
+
+    HTI_LOG_FUNC_OUT( "CHtiAudioServicePlugin::SetAudioSettings" );
+    }
+
+
+// ========================== OTHER EXPORTED FUNCTIONS =========================
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiServicePlugins/HtiAudioServicePlugin/src/proxy.cpp	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,35 @@
+/*
+* 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 proxy for the ECom plugin.
+*
+*/
+
+
+
+// INCLUDE FILES
+#include <e32std.h>
+#include <ecom/implementationproxy.h>
+#include "HtiAudioServicePlugin.h"
+
+const TImplementationProxy ImplementationTable[] =
+    {
+        IMPLEMENTATION_PROXY_ENTRY( 0x10210CCB, CHtiAudioServicePlugin::NewL )
+    };
+
+// Function used to return an instance of the proxy table.
+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/htiui/HtiServicePlugins/HtiCameraServicePlugin/data/2002EA9D.rss	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,66 @@
+/*
+* 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:  HTI service plugin for playing audio.
+*
+*/
+
+
+
+//  RESOURCE IDENTIFIER
+
+//  INCLUDES
+#include <ecom/registryinfo.rh>
+
+//  CONSTANTS
+
+//  MACROS
+
+
+//  RESOURCE DEFINITIONS
+// -----------------------------------------------------------------------------
+//
+// theInfo
+// ECom registry info resource.
+//
+// -----------------------------------------------------------------------------
+//
+
+RESOURCE REGISTRY_INFO theInfo
+    {
+    // UID for the DLL
+    dll_uid = 0x2002EA9D;
+    // Declare array of interface info
+    interfaces =
+        {
+        INTERFACE_INFO
+            {
+            // UID of interface that is implemented
+            interface_uid = 0x1020DEB7;
+            implementations =
+                {
+                IMPLEMENTATION_INFO
+                    {
+                    implementation_uid = 0x2002EA9E;
+                    version_no         = 1;
+                    display_name       = "Camera Service";
+                    default_data       = "Camera";
+                    opaque_data        = "";
+                    }
+                };
+            }
+        };
+    }
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiServicePlugins/HtiCameraServicePlugin/engine/inc/EngineVideoRecording.h	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,524 @@
+/*
+* 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:  Video recording engine implementation class.
+*
+*/
+
+#ifndef ENGINEVIDEORECORDING_H
+#define ENGINEVIDEORECORDING_H
+
+//  INCLUDES
+#include <ecam.h>
+#include <videorecorder.h>
+#include <e32std.h>
+
+// CONSTANTS
+const TInt KCameraPriority = -1; // Relative priority (-100...100) of camera HW
+
+// FORWARD DECLARATIONS
+class CVideoRecorderUtility;
+class CVideoRecordingQualityLevels;
+
+
+class TEngineVideoRecordingInfo
+    {
+    public:
+
+        // Camera hardware version present.
+        TVersion iHardwareVersion;
+        // Camera driver software version present.
+        TVersion iSoftwareVersion;
+        // Actual orientation of the camera.
+        TCameraInfo::TCameraOrientation iOrientation;
+
+        // Bitfield of CCamera::TOptions available. 
+        TUint32 iOptionsSupported;
+        // Bitfield of CCamera::TFlash modes available.
+        TUint32 iFlashModesSupported;
+        // Bitfield of CCamera::TExposure modes available.
+        TUint32 iExposureModesSupported;
+        // Bitfield of CCamera::TWhiteBalance modes available.
+        TUint32 iWhiteBalanceModesSupported;
+
+        // Minimum zoom value allowed. Must be negative or 
+        // zero (for not supported).
+        TInt iMinZoom;
+        // Maximum zoom value allowed. Must be positive or 
+        // zero (for not supported).
+        TInt iMaxZoom;
+        // Maximum digital zoom value allowed. Must be positive or 
+        // zero (for not supported).
+        TInt iMaxDigitalZoom;
+
+        // Image size multiplier corresponding to minimum zoom value. 
+        // Must be between 0 and 1 inclusive.
+        TReal32 iMinZoomFactor;
+        // Image size multiplier corresponding to maximum zoom value. 
+        // Must be greater than or equal to 1.
+        TReal32 iMaxZoomFactor;
+        // Image size multiplier corresponding to maximum digital zoom value. 
+        // Must be greater than or equal to 1.
+        TReal32 iMaxDigitalZoomFactor;
+
+        // Count of still image capturing sizes allowed.
+        TInt iNumImageSizesSupported;
+        // Bitfield of still image CCamera::TFormat values supported.
+        TUint32 iImageFormatsSupported;
+    
+        // Count of still image capturing quality levels initialized.
+        TInt iNumStillQualityLevelsSupported;
+        // Count of video recording quality levels initialized.
+        TInt iNumVideoQualityLevelsSupported;
+
+        // Bitfield of CCaeEngine::TOptions available. 
+        TUint32 iCaeOptionsSupported;
+
+        // Integer (e.g. -9) that corresponds to minimum EV compensation value.
+        TInt iMinEvCompensation;
+        // Integer (e.g. 9) that corresponds to maximum EV compensation value.
+        TInt iMaxEvCompensation;
+        // Minimum camera EV compensation value (e.g. -3.0).
+        TReal32 iMinEvCompensationValue;
+        // Maximum camera EV compensation value (e.g. 3.0).
+        TReal32 iMaxEvCompensationValue;
+    };
+
+class MEngineVideoRecordingObserver
+    {
+
+    public:
+        /**
+        * Called asynchronously when CEngineVideoRecording::Init(), CCaeEngine::CEngineVideoRecording(), 
+        * or CEngineVideoRecording::Reserve() completes.
+        * Indicates if Video Recording Engine is ready for operation, 
+        * the camera is reserved and its power is switched on.
+        * @param aError Error code KErrNone to indicate success or a standard Symbian OS error code.
+        * @return void
+        */
+        virtual void MevroInitComplete( TInt aError ) = 0;
+    
+        /**
+        * Called asynchronously when preparing of video recording completes 
+        * after PrepareVideoRecordingL() has been called.
+        * May be called second time with an error code after a successful preparation 
+        * if video recording loses its prepared state for some reason (e.g. audio HW 
+        * is reserved for some other application).
+        * @param aError Error code KErrNone to indicate success or a standard Symbian OS error code.
+        * @return void
+        */
+        virtual void MevroVideoPrepareComplete( TInt aError ) = 0;
+
+        /**
+        * Called (possibly asynchronously) when video recording is running 
+        * after CEngineVideoRecording::StartVideoRecording() or 
+        * CEngineVideoRecording::ResumeVideoRecording() has been called.
+        * @param aError Error code KErrNone to indicate success or a standard Symbian OS error code.
+        * @return void
+        */
+        virtual void MevroVideoRecordingOn( TInt aError ) = 0;
+
+        /**
+        * Called (possibly asynchronously) when video recording is paused after 
+        * CEngineVideoRecording::PauseVideoRecording() has been called.
+        * @param aError Error code KErrNone to indicate success or a standard Symbian OS error code.
+        * @return void
+        */
+        virtual void MevroVideoRecordingPaused( TInt aError ) = 0;
+
+        /**
+        * Called (possibly asynchronously) when video recording is completed 
+        * after CEngineVideoRecording::StopVideoRecording() has been called or 
+        * recording has been completed for some other reason.
+        * @param aError Error code KErrNone to indicate success or a standard Symbian OS error code.
+        * if aError == KErrDiskFull, then disk storage is full.
+        * if aError == KErrCompletion, then clip max size was reached.
+        * @return void
+        */
+        virtual void MevroVideoRecordingComplete( TInt aError ) = 0;
+    };
+
+
+NONSHARABLE_CLASS( CEngineVideoRecording ) : public CBase,
+        public MVideoRecorderUtilityObserver,
+        public MCameraObserver,
+        public MCameraObserver2
+    {
+    public:
+    // Possible zooming modes.
+    enum TZoomMode
+        {
+        EZoomModeDigital        = 0x00, // Digital zoom (default).
+        EZoomModeOptical        = 0x01, // Optical zoom.
+        EZoomModeOpticalDigital = 0x02  // Optical+digital zoom.
+        };
+    
+    public:
+        /**
+        * Destructor.
+        */
+        virtual ~CEngineVideoRecording();
+        
+        // Construction and destruction
+        static CEngineVideoRecording* NewL(MEngineVideoRecordingObserver& aObserver,
+                TInt aCameraIndex);
+        
+        void InitL();
+        
+        void InitVideoRecorderL();
+    
+        void SetVideoRecordingFileNameL( 
+            const TDesC& aVideoClipFileName );
+        
+        void ChangeVideoFileNameL();
+        
+        void PrepareVideoRecordingL( 
+            TInt aVideoQualityIndex );
+
+        void PrepareVideoRecordingL( 
+            const TSize&  aFrameSize, 
+            TReal32       aFrameRate, 
+            TInt          aBitRate, 
+            TBool         aAudioEnabled,
+            const TDesC8& aMimeType, 
+            const TDesC&  aPreferredSupplier, 
+            const TDesC8& aVideoType = KNullDesC8, 
+            const TDesC8& aAudioType = KNullDesC8 );
+
+        void PrepareVideoRecordingL( 
+            const TSize&  aFrameSize, 
+            TReal32       aFrameRate, 
+            TInt          aBitRate, 
+            TBool         aAudioEnabled,
+            TInt          aAudioBitRate, 
+            const TDesC8& aMimeType, 
+            const TDesC&  aPreferredSupplier, 
+            const TDesC8& aVideoType, 
+            const TDesC8& aAudioType );
+        
+        void CloseVideoRecording();
+
+        TInt VideoQualityIndex() const;
+        
+        TInt VideoQualityCount() const;
+
+        void GetVideoFrameSize( 
+            TInt   aVideoQualityIndex, 
+            TSize& aSize ) const;
+
+        TReal32 VideoFrameRate( 
+            TInt aVideoQualityIndex ) const;
+
+        TInt EstimatedVideoRecordingBitRateL( 
+            TInt aVideoQualityIndex ) const;
+
+        void SetVideoClipMaxSizeL( 
+            TInt aMaxClipSizeInBytes = 0 );
+
+        TInt VideoClipMaxSize() const;
+
+        void SetVideoAudioL( 
+            TBool aAudioEnabled );
+
+        TBool VideoAudio() const;
+
+        void StartVideoRecording();
+
+        void StopVideoRecording();
+
+        void PauseVideoRecording();
+
+        void ResumeVideoRecording();
+
+        TTimeIntervalMicroSeconds RemainingVideoRecordingTime() const;
+
+        TBool IsVideoRecording() const;
+        
+        void Reserve();
+
+        void Release();
+
+        void PowerOn();
+
+        void PowerOff();
+    
+        void SetZoomModeL(TZoomMode aZoomMode = EZoomModeDigital);
+    
+        TZoomMode ZoomMode() const;
+    
+        void SetZoomValueL(TInt aZoomValue = 0);
+    
+        TInt ZoomValue() const;
+        
+        TInt MaxZoomValue() const;
+        TInt MinZoomValue() const;
+    
+        void SetBrightnessL(TInt aBrightness = 0);
+    
+        TInt Brightness() const;
+    
+        void SetContrastL(TInt aContrast = 0);
+    
+        TInt Contrast() const;
+    
+        void SetExposureModeL(CCamera::TExposure aExposureMode =
+                CCamera::EExposureAuto);
+    
+        CCamera::TExposure ExposureMode() const;
+    
+        void SetWhiteBalanceModeL(CCamera::TWhiteBalance aWhiteBalanceMode =
+                CCamera::EWBAuto);
+    
+        CCamera::TWhiteBalance WhiteBalanceMode() const;
+    
+        void SetFlashModeL(CCamera::TFlash aFlashMode = CCamera::EFlashNone);
+    
+        CCamera::TFlash FlashMode() const;
+    
+        void ResetToDefaultsL();
+    private:
+        void InitializeInfo(const CCamera& aCamera);
+    
+        /**
+         * Checks that power is on. If not, then leaves.
+         * @since 2.1
+         * @return void
+         */
+        void CheckPowerL();
+    
+        void CancelVideoRecording();
+    
+        void PrepareVideoSettingsL();
+    
+        void FindVideoUidsL(const TDesC8& aMimeType,
+                const TDesC& aPreferredSupplier);
+    
+        TFourCC ConvertAndSetVideoAudioTypeL(const TDesC8& aAudioType);
+    
+    private:    
+        
+        /**
+         * From MVideoRecorderUtilityObserver
+         * Notification to the client that the opening of the video clip has completed,
+         * successfully, or otherwise.
+         * @param  aError
+         *          The status of the video recorder after initialisation.
+         *          This is either KErrNone if the open has completed successfully,
+         *          or one of the system wide error codes.
+         */
+        virtual void MvruoOpenComplete(TInt aError);  
+
+        /**
+         * From MVideoRecorderUtilityObserver
+         * Notification that video recorder is ready to begin recording. This callback
+         * is generated in response to a call to Prepare.
+         * @param  aError
+         *          This is either KErrNone if the video recorder has been prepared for
+         *          recording successfully, or one of the system wide error codes
+         */
+        virtual void MvruoPrepareComplete(TInt aError);
+
+        /**
+         * From MVideoRecorderUtilityObserver
+         * Notification that video recording has completed. This is not called if
+         * recording is explicitly stopped by calling Stop.
+         * @param  aError
+         *          This is either KErrNone if recording was completed successfully,
+         *          or one of the system wide error codes.
+         */
+        virtual void MvruoRecordComplete(TInt aError);
+
+        /**
+         * From MVideoRecorderUtilityObserver
+         * General event notification from controller. These events are specified by
+         * the supplier of the controller.
+         * @param  aEvent
+         * The event sent by the controller.
+         */
+        virtual void MvruoEvent(const TMMFEvent& aEvent);
+        
+    private: // From Camera Observer / ECam.h
+
+        void ReserveComplete( 
+            TInt aError );
+
+        void PowerOnComplete( 
+            TInt aError );
+
+        void ViewFinderFrameReady( 
+            CFbsBitmap& /*aFrame*/ ){};
+
+        void ImageReady( 
+            CFbsBitmap* /*aBitmap*/, 
+            HBufC8*     /*aData*/, 
+            TInt        /*aError*/ ){};
+
+        void FrameBufferReady( 
+            MFrameBuffer* /*aFrameBuffer*/, 
+            TInt          /*aError*/ ) {}; // Empty default because not in use.
+        
+    private: // From Camera Observer2 / ECam.h
+        
+        void HandleEvent(const TECAMEvent& aEvent);
+
+        void ViewFinderReady(MCameraBuffer& /*aCameraBuffer*/,TInt /*aError*/){};
+
+        void ImageBufferReady(MCameraBuffer& /*aCameraBuffer*/,TInt /*aError*/){};
+    
+        void VideoBufferReady(MCameraBuffer& /*aCameraBuffer*/,TInt /*aError*/){};
+    protected:  
+
+        /**
+        * C++ default constructor.
+        */
+        CEngineVideoRecording();
+
+        /**
+        * 2nd phase constructor.
+        */
+        void ConstructL(MEngineVideoRecordingObserver& aObserver,
+                TInt aCameraIndex);
+
+    private:
+        // Camera API implementation object.
+        CCamera* iCamera;
+        
+        // Video Recorder API implementation object.
+        CVideoRecorderUtility* iVideoRecorder;
+        
+        // Video Recording observer
+        MEngineVideoRecordingObserver* iVideoRecordingObserver;
+    
+        // Video Recording Engine info object.
+        TEngineVideoRecordingInfo* iInfo;
+        
+        // Video recording quality levels container.
+        CVideoRecordingQualityLevels* iVideoQualityLevels;
+        
+        // Video recording frame size.
+        // This is ptr because video recorder is not necessarily initialized.
+        TSize* iVideoFrameSize;
+
+        // Video recording frame size (to be prepared).
+        // This is ptr because video recorder is not necessarily initialized.
+        TSize* iVideoFrameSizePrep;
+
+        // Video clip file name.
+        HBufC* iVideoClipFileName;
+        
+        // Video Recorder video type.
+        HBufC8* iVideoType;
+        
+        // Boolean indicating if camera module is reserved for the engine.
+        TBool iReserved;
+
+        // Boolean indicating if camera module power is on.
+        TBool iPowerOn;
+        
+        // Boolean indicating if video recording is initialized.
+        TBool iVideoInitialized;
+    
+        // Boolean indicating if video recording is opened.
+        TBool iVideoOpened;
+    
+        // Boolean indicating if video recording is prepared.
+        TBool iVideoPrepared;
+        
+        // Boolean indicating if video recording is currently running.
+        TBool iVideoRecordingRunning;
+
+        // Boolean indicating if video recording is currently paused.
+        TBool iVideoRecordingPaused;
+        
+        // Video recording quality level index currently prepared.
+        TInt iVideoQualityIndex;
+
+        // Handle to the camera used.
+        TInt iCameraHandle;
+
+        // Video Recorder controller UID.
+        TUid iVideoControllerUid;
+
+        // Video Recorder format UID.
+        TUid iVideoFormatUid;
+
+        // Video Recorder audio type.
+        TFourCC iVideoAudioType;
+
+        //// Camera module settings related variables. ////
+
+            // Current zoom mode.
+            TZoomMode iZoomMode;
+
+            // Current zoom value.
+            TInt iZoomValue;
+
+            // Current brightness value.
+            TInt iBrightness;
+
+            // Current contrast value.
+            TInt iContrast;
+
+            // Camera exposure mode.
+            CCamera::TExposure iExposureMode;
+
+            // Camera white balance mode.
+            CCamera::TWhiteBalance iWhiteBalanceMode;
+
+            // Camera flash mode.
+            CCamera::TFlash iFlashMode;
+    //// Video recording parameters prepared. ////
+        
+        // Video recording frame rate.
+        TReal32 iVideoFrameRate;
+
+        // Video recording bit rate.
+        TInt iVideoBitRate;
+
+        // Boolean indicating if audio is enabled with video recording.
+        TBool iVideoAudioEnabled;
+
+        // Video recording audio bit rate.
+        TInt iVideoAudioBitRate;
+
+        // Video recording maximum clip size in bytes.
+        TInt iMaxClipSizeInBytes;
+
+    //// Video recording parameters to be prepared. ////
+
+        // Video recording frame rate (to be prepared).
+        TReal32 iVideoFrameRatePrep;
+
+        // Video recording bit rate (to be prepared).
+        TInt iVideoBitRatePrep;
+
+        // Boolean indicating if audio is enabled with video recording (to be prepared).
+        TBool iVideoAudioEnabledPrep;
+
+        // Video recording audio bit rate (to be prepared).
+        TInt iVideoAudioBitRatePrep;
+
+        // Video recording maximum clip size in bytes (to be prepared).
+        TInt iMaxClipSizeInBytesPrep;
+
+        // Boolean indicating if parameters are/were prepared in video recording preparation..
+        TBool iPrepPars;
+
+        // Boolean indicating if video audio bit rate should be prepared.
+        TBool iPrepareVideoAudioBitRate;
+    };
+
+
+
+
+#endif //ENGINEVIDEORECORDING_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiServicePlugins/HtiCameraServicePlugin/engine/inc/VideoRecordingQualityLevels.h	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,135 @@
+/*
+* 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:  Engine video quality level and container.
+*
+*/
+
+#ifndef VIDEORECORDINGQUALITYLEVELS_H_
+#define VIDEORECORDINGQUALITYLEVELS_H_
+
+
+const TInt KMaxVideoStringParLength = 32;
+const TInt KMaxAudioTypeStringParLength = 4;
+
+const TInt KMaxVideoQltyLevelCount = 6;
+
+const TInt KImgWidthSubQCIF  = 128; 
+const TInt KImgHeightSubQCIF = 96; 
+
+const TInt KImgWidthQCIF     = 176; 
+const TInt KImgHeightQCIF    = 144; 
+
+const TInt KImgWidthCIF      = 352; 
+const TInt KImgHeightCIF     = 288; 
+
+_LIT8(KVideoMimeType, "video/3gpp");
+
+_LIT(KPreferredSupplier, "Nokia");
+
+_LIT8(KVideoType, "video/H263-2000");
+
+_LIT8(KAudioType, " AMR");
+
+class CVideoRecordingQualityLevel : public CBase
+    {
+public:
+    CVideoRecordingQualityLevel(){}
+    virtual ~CVideoRecordingQualityLevel(){}
+    
+public:
+
+    // The video recording frame size.
+    TSize iFrameSize;
+
+    // The video recording frame rate.
+    TReal32 iFrameRate;
+
+    // The video recording bit rate.
+    TInt iBitRate;
+
+    // A Boolean indicating if video recording audio is enabled or not.
+    TBool iAudioEnabled;
+
+    // The video recording audio bit rate.
+    TInt iAudioBitRate;
+
+    // The video MIME type (e.g. "video/3gpp").
+    TBuf8<KMaxVideoStringParLength> iMimeType;
+
+    // The preferred supplier of video controller (e.g. "Company X").
+    TBuf<KMaxVideoStringParLength> iPreferredSupplier;
+
+    // The video type (e.g. "video/H263-2000").
+    TBuf8<KMaxVideoStringParLength> iVideoType;
+
+    // The audio type expressed with four characters (e.g. " AMR").
+    TBuf8<KMaxAudioTypeStringParLength> iAudioType;
+
+    // The estimated video recording bit rate to storage (bits per second).
+    TInt iStorageRate;
+    };
+
+
+class CVideoRecordingQualityLevels : public CBase
+    {
+public:
+    /**
+    * Destructor.
+    */
+    virtual ~CVideoRecordingQualityLevels();
+    
+    /**
+    * Two-phased constructor.
+    */
+    static CVideoRecordingQualityLevels* NewL();
+
+    /**
+    * Initializes quality levels to hardcoded default values.
+    * @return The count of quality levels initialized
+    */
+    TInt InitDefaultsL();
+    
+    /**
+    * Gets the quality level count.
+    * @return Quality level count
+    */
+    TInt Count() const;
+
+    /**
+    * Gets the specified quality level.
+    * @param aIndex Quality level index
+    * @return Video quality level
+    */
+    CVideoRecordingQualityLevel& At( 
+        TInt aIndex ) const;
+    
+private:
+
+    /**
+    * C++ constructor.
+    */
+    CVideoRecordingQualityLevels();
+
+    /**
+    * Symbian OS 2nd phase constructor that can leave.
+    */
+    void ConstructL();
+    
+private:
+
+    // Supported video recording quality levels.
+    CArrayFixFlat<CVideoRecordingQualityLevel>* iQualityLevels;
+    };
+
+#endif /* VIDEORECORDINGQUALITYLEVELS_H_ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiServicePlugins/HtiCameraServicePlugin/engine/src/EngineVideoRecording.cpp	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,1429 @@
+/*
+* 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:  Engine implementation video recording methods.
+*
+*/
+
+
+// INCLUDE FILES
+#include <HtiLogging.h>
+#include <AudioPreference.h>                // For MMF audio preference definitions.
+
+
+#include "EngineVideoRecording.h"
+#include "VideoRecordingQualityLevels.h"
+// EXTERNAL DATA STRUCTURES
+
+// EXTERNAL FUNCTION PROTOTYPES
+
+// CONSTANTS
+
+// MACROS
+
+// LOCAL CONSTANTS AND MACROS
+
+// MODULE DATA STRUCTURES
+
+// LOCAL FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+// ============================= LOCAL FUNCTIONS ===============================
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CEngineVideoRecording::CEngineVideoRecording
+// C++ default constructor can NOT contain any code, that might leave.
+// -----------------------------------------------------------------------------
+//
+CEngineVideoRecording::CEngineVideoRecording() :
+    iZoomMode( EZoomModeDigital ), 
+    iExposureMode( CCamera::EExposureAuto ),
+    iWhiteBalanceMode( CCamera::EWBAuto ), 
+    iFlashMode( CCamera::EFlashNone ),
+    iMaxClipSizeInBytes( KMMFNoMaxClipSize ), 
+    iMaxClipSizeInBytesPrep( KMMFNoMaxClipSize )
+    {
+    }
+
+
+// -----------------------------------------------------------------------------
+// CEngineVideoRecording::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CEngineVideoRecording::ConstructL(MEngineVideoRecordingObserver& aObserver,
+        TInt aCameraIndex)
+    {
+    HTI_LOG_FUNC_IN( "CEngineVideoRecording::ConstructL" );
+    iVideoRecordingObserver = &aObserver;
+    
+    if ( ( aCameraIndex < 0 ) || 
+         ( aCameraIndex >= CCamera::CamerasAvailable() ) )
+        {
+        HTI_LOG_FORMAT("Cae: CEngineVideoRecording::ConstructL leaving KErrHardwareNotAvailable, aCameraIndex=%d", aCameraIndex );
+        User::Leave( KErrHardwareNotAvailable );
+        }
+
+    // Create a new Camera API implementation object, if supported
+    TRAPD( err, iCamera = CCamera::New2L( static_cast<MCameraObserver2&>(*this), aCameraIndex, KCameraPriority ) );
+    if ( err )
+        {
+        HTI_LOG_FORMAT("CEngineVideoRecording::ConstructL() CCamera::New2L return code=%d", err ); 
+
+        // Create old Camera API implementation object.
+        iCamera = CCamera::NewL( static_cast<MCameraObserver&>(*this), aCameraIndex );
+        HTI_LOG_TEXT("CEngineVideoRecording::ConstructL() using MCameraObserver"); 
+        }
+    else
+        {
+    HTI_LOG_TEXT("CEngineVideoRecording::ConstructL() using MCameraObserver2"); 
+        }
+
+
+    // Get camera handle.
+    iCameraHandle = iCamera->Handle();
+    
+    // Create and initialize info object.
+    iInfo = new( ELeave ) TEngineVideoRecordingInfo;
+    InitializeInfo( *iCamera );
+    
+    HTI_LOG_FUNC_OUT( "CEngineVideoRecording::ConstructL" );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CEngineVideoRecording::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CEngineVideoRecording* CEngineVideoRecording::NewL(MEngineVideoRecordingObserver& aObserver,
+        TInt aCameraIndex)
+    {
+    CEngineVideoRecording* self = new (ELeave) CEngineVideoRecording;
+    CleanupStack::PushL( self );
+    self->ConstructL(aObserver, aCameraIndex);
+    CleanupStack::Pop();
+    return self;
+    }
+
+
+// Destructor
+CEngineVideoRecording::~CEngineVideoRecording()
+    {
+    HTI_LOG_FUNC_IN( "CEngineVideoRecording::~CEngineVideoRecording");
+
+        delete iVideoType;
+        delete iVideoClipFileName;
+
+        // Turn camera power off first, then release camera.
+        if ( iCamera ) 
+            {
+            if ( iReserved ) 
+                {
+                if ( iPowerOn ) 
+                    {
+                    iCamera->PowerOff();
+                    }
+                iCamera->Release();
+                }
+            }
+
+        delete iVideoFrameSizePrep;
+        delete iVideoFrameSize;
+
+        delete iVideoRecorder;
+
+        delete iVideoQualityLevels;
+        
+        delete iCamera;
+
+        REComSession::FinalClose();
+
+        HTI_LOG_FUNC_OUT( "CEngineVideoRecording::~CEngineVideoRecording");
+    }
+
+void CEngineVideoRecording::InitL( )
+    {
+    HTI_LOG_FUNC_IN( "CEngineVideoRecording::InitL");
+
+    // To allow re-initialization, release the camera (first cancels possible 
+    // activities and turns camera power off).
+    Release();
+   
+    iCamera->Reserve();
+
+    HTI_LOG_FUNC_OUT( "CEngineVideoRecording::InitL");
+    }
+
+void CEngineVideoRecording::InitializeInfo( 
+    const CCamera& aCamera )
+    {
+
+    // Initialise Camera (API) info.
+
+    TCameraInfo cameraInfo;
+    aCamera.CameraInfo( cameraInfo );
+
+    iInfo->iHardwareVersion = cameraInfo.iHardwareVersion;
+    iInfo->iSoftwareVersion = cameraInfo.iSoftwareVersion;
+
+    iInfo->iOrientation = cameraInfo.iOrientation;
+
+    iInfo->iOptionsSupported = cameraInfo.iOptionsSupported;
+    
+    iInfo->iFlashModesSupported = cameraInfo.iFlashModesSupported;
+
+    iInfo->iExposureModesSupported = cameraInfo.iExposureModesSupported;
+
+    iInfo->iWhiteBalanceModesSupported = cameraInfo.iWhiteBalanceModesSupported;
+
+    iInfo->iMinZoom = cameraInfo.iMinZoom;
+    iInfo->iMaxZoom = cameraInfo.iMaxZoom;
+    iInfo->iMaxDigitalZoom = cameraInfo.iMaxDigitalZoom;
+
+    iInfo->iMinZoomFactor = cameraInfo.iMinZoomFactor;
+    iInfo->iMaxZoomFactor = cameraInfo.iMaxZoomFactor;
+    iInfo->iMaxDigitalZoomFactor = cameraInfo.iMaxDigitalZoomFactor;
+
+    iInfo->iNumImageSizesSupported = cameraInfo.iNumImageSizesSupported;
+    iInfo->iImageFormatsSupported = cameraInfo.iImageFormatsSupported;
+
+    // Initialize EV compensation info (no supported in this version)
+    iInfo->iMinEvCompensation = 0;
+    iInfo->iMaxEvCompensation = 0;
+    iInfo->iMinEvCompensationValue = 0;
+    iInfo->iMaxEvCompensationValue = 0;
+
+    // Initialize engine info.
+
+    iInfo->iNumStillQualityLevelsSupported = 0; // Quality levels are initialized separately.
+    iInfo->iNumVideoQualityLevelsSupported = 0; // Quality levels are initialized separately.
+
+    }
+void CEngineVideoRecording::InitVideoRecorderL()
+    {
+    HTI_LOG_FUNC_IN( "CEngineVideoRecording::InitVideoRecorderL()");
+
+    iVideoInitialized = EFalse;
+
+    // Close video recording if previously opened/prepared.
+    CloseVideoRecording();
+    
+    // (Re-)initialize these.
+    iMaxClipSizeInBytes = KMMFNoMaxClipSize; 
+    iMaxClipSizeInBytesPrep = KMMFNoMaxClipSize;
+
+    // Create video quality levels container object.
+    iVideoQualityLevels = CVideoRecordingQualityLevels::NewL();
+
+    // Destroy possible video clip file name. (Its allocated elsewhere when file name is set.)
+    delete iVideoClipFileName;
+    iVideoClipFileName = NULL;
+
+    // Create video recorder.
+    delete iVideoRecorder;
+    iVideoRecorder = NULL;
+    iVideoRecorder = CVideoRecorderUtility::NewL( *this , KAudioPriorityVideoRecording,
+        TMdaPriorityPreference( KAudioPrefVideoRecording ) );
+
+    delete iVideoFrameSize;
+    iVideoFrameSize = NULL;
+    iVideoFrameSize = new( ELeave ) TSize();
+    
+    delete iVideoFrameSizePrep;
+    iVideoFrameSizePrep = NULL;
+    iVideoFrameSizePrep = new( ELeave ) TSize();
+
+    iInfo->iNumVideoQualityLevelsSupported = iVideoQualityLevels->InitDefaultsL();
+    iVideoInitialized = ETrue;
+
+    HTI_LOG_FUNC_OUT( "CEngineVideoRecording::InitVideoRecorderL()");
+    }
+
+void CEngineVideoRecording::SetVideoRecordingFileNameL( 
+    const TDesC& aVideoClipFileName )
+    {
+    HTI_LOG_FUNC_IN("CEngineVideoRecording::SetVideoRecordingFileNameL");
+
+    if ( !iVideoInitialized || iVideoRecordingRunning ) 
+        {
+        HTI_LOG_TEXT("CEngineVideoRecording::SetVideoRecordingFileNameL leaving KErrNotReady" );
+        User::Leave( KErrNotReady );
+        }
+
+    if ( aVideoClipFileName.Length() > 0 )
+        {
+        // Memorize the video clip file name.
+        delete iVideoClipFileName;
+        iVideoClipFileName = NULL;
+        iVideoClipFileName = aVideoClipFileName.AllocL();
+        }
+    else 
+        {
+        HTI_LOG_TEXT("CEngineVideoRecording::SetVideoRecordingFileNameL leaving KErrArgument");
+        User::Leave( KErrArgument );
+        }
+
+    if ( iVideoPrepared ) 
+        {
+        // Does the actual change of file name, only if video is prepared.
+        // Note: Variated implementation
+        ChangeVideoFileNameL();
+        }
+
+    HTI_LOG_FUNC_OUT("CEngineVideoRecording::SetVideoRecordingFileNameL");
+    }
+
+void CEngineVideoRecording::ChangeVideoFileNameL()
+    {
+    HTI_LOG_FUNC_IN("CEngineVideoRecording::ChangeVideoFileNameL");
+
+    // Close if previously prepared.
+    CloseVideoRecording();
+    // Open video recorder.
+    iVideoOpened = ETrue; // This is always set to ETrue when 
+                          // OpenFileL has been called to allow 
+                          // freeing resources by CloseVideoRecording().
+    iVideoRecorder->OpenFileL( iVideoClipFileName->Des(),
+                               iCameraHandle,
+                               iVideoControllerUid,
+                               iVideoFormatUid, 
+                               iVideoType->Des(),  
+                               iVideoAudioType );
+
+    HTI_LOG_FUNC_OUT("CEngineVideoRecording::ChangeVideoFileNameL");
+    }
+
+void CEngineVideoRecording::PrepareVideoRecordingL( 
+    TInt aVideoQualityIndex )
+    {
+    HTI_LOG_TEXT("CEngineVideoRecording::PrepareVideoRecordingL with video quality index");
+
+    if ( ( aVideoQualityIndex < 0 ) || 
+         ( aVideoQualityIndex >= iVideoQualityLevels->Count() ) ) 
+        {
+        HTI_LOG_TEXT("PrepareVideoRecordingL() leaving KErrArgument");
+        User::Leave( KErrArgument );
+        }
+    
+    PrepareVideoRecordingL( iVideoQualityLevels->At( aVideoQualityIndex ).iFrameSize, 
+                            iVideoQualityLevels->At( aVideoQualityIndex ).iFrameRate, 
+                            iVideoQualityLevels->At( aVideoQualityIndex ).iBitRate, 
+                            iVideoQualityLevels->At( aVideoQualityIndex ).iAudioEnabled,
+                            iVideoQualityLevels->At( aVideoQualityIndex ).iAudioBitRate, 
+                            iVideoQualityLevels->At( aVideoQualityIndex ).iMimeType, 
+                            iVideoQualityLevels->At( aVideoQualityIndex ).iPreferredSupplier, 
+                            iVideoQualityLevels->At( aVideoQualityIndex ).iVideoType,    
+                            iVideoQualityLevels->At( aVideoQualityIndex ).iAudioType );
+    
+    iVideoQualityIndex = aVideoQualityIndex;
+    }
+
+void CEngineVideoRecording::PrepareVideoRecordingL( 
+    const TSize&  aFrameSize, 
+    TReal32       aFrameRate, 
+    TInt          aBitRate, 
+    TBool         aAudioEnabled,
+    const TDesC8& aMimeType, 
+    const TDesC&  aPreferredSupplier, 
+    const TDesC8& aVideoType, 
+    const TDesC8& aAudioType )
+    {
+    HTI_LOG_FUNC_IN("CEngineVideoRecording::PrepareVideoRecordingL");
+    // Leave if not initialized properly or busy doing something else.
+    if ( !iVideoInitialized || 
+         !iVideoClipFileName || 
+         iVideoRecordingRunning   ) 
+        {
+        HTI_LOG_TEXT("PrepareVideoRecordingL leaving KErrNotReady");
+        User::Leave( KErrNotReady );
+        }
+
+    CheckPowerL();
+    
+    // Leave if video clip file name is not set properly.
+    if ( iVideoClipFileName->Length() == 0 )
+        {
+        HTI_LOG_TEXT("PrepareVideoRecordingL() leaving KErrArgument (iVideoClipFileName)");
+        User::Leave( KErrArgument );
+        }
+
+    // Close if previously opened/prepared.
+    CloseVideoRecording();
+
+    // Find values for iVideoControllerUid and iVideoFormatUid.
+    // Those are also needed if clip file name is changed when prepared.
+    FindVideoUidsL( aMimeType, aPreferredSupplier );
+
+    // Memorize video type.
+    delete iVideoType;
+    iVideoType = NULL;
+    iVideoType = aVideoType.AllocL();
+
+    // Convert audio type from TDesC8 to TFourCC.
+    iVideoAudioType = ConvertAndSetVideoAudioTypeL( aAudioType );
+
+    // Memorize the parameters to be prepared.
+    *iVideoFrameSizePrep   = aFrameSize;
+    iVideoFrameRatePrep    = aFrameRate;
+    iVideoBitRatePrep      = aBitRate;
+    iVideoAudioEnabledPrep = aAudioEnabled;
+
+    // Open video recorder.
+    iVideoOpened = ETrue; // This is always set to ETrue when 
+                          // OpenFileL has been called to allow 
+                          // freeing resources by CloseVideoRecording().
+    iVideoRecorder->OpenFileL( iVideoClipFileName->Des(),
+                               iCameraHandle,
+                               iVideoControllerUid,
+                               iVideoFormatUid, 
+                               iVideoType->Des(),  
+                               iVideoAudioType );
+    HTI_LOG_FUNC_OUT("CEngineVideoRecording::PrepareVideoRecordingL");
+    }
+
+void CEngineVideoRecording::PrepareVideoRecordingL( 
+    const TSize&  aFrameSize, 
+    TReal32       aFrameRate, 
+    TInt          aBitRate, 
+    TBool         aAudioEnabled,
+    TInt          aAudioBitRate, 
+    const TDesC8& aMimeType, 
+    const TDesC&  aPreferredSupplier, 
+    const TDesC8& aVideoType, 
+    const TDesC8& aAudioType )
+    {
+    HTI_LOG_TEXT("CEngineVideoRecording::PrepareVideoRecordingL with audio bit rate");
+    // Memorize video audio bit rate value to be prepared.
+    iVideoAudioBitRatePrep = aAudioBitRate;
+    // Force audio bit rate preparation.
+    iPrepareVideoAudioBitRate = ETrue;
+
+    // Call the version without audio bit rate argument.
+    // This is possible because the separate PrepareVideoSettingsL() is doing
+    // settings after succesfull opening of video recording.
+    PrepareVideoRecordingL( aFrameSize, 
+                            aFrameRate, 
+                            aBitRate, 
+                            aAudioEnabled, 
+                            aMimeType, 
+                            aPreferredSupplier, 
+                            aVideoType, 
+                            aAudioType );
+    }
+
+void CEngineVideoRecording::CloseVideoRecording()
+    {
+    HTI_LOG_FUNC_IN("CEngineVideoRecording::CloseVideoRecording");
+
+    if ( iVideoPrepared ) 
+        {
+        CancelVideoRecording();
+        iVideoPrepared = EFalse;
+        }
+
+    if ( iVideoOpened )
+        {
+        iVideoRecorder->Close();
+        iVideoOpened = EFalse;
+        }
+
+    HTI_LOG_FUNC_OUT("CEngineVideoRecording::CloseVideoRecording");
+    }
+
+TInt CEngineVideoRecording::VideoQualityIndex() const
+    {
+    HTI_LOG_FUNC_IN("CEngineVideoRecording::VideoQualityIndex");
+
+    TInt qualityIndex( -1 );
+    if ( iVideoPrepared )
+        {
+        qualityIndex = iVideoQualityIndex;
+        }
+    HTI_LOG_FUNC_OUT("CEngineVideoRecording::VideoQualityIndex");
+    return qualityIndex;
+    }
+
+TInt CEngineVideoRecording::VideoQualityCount() const
+        {
+        return iVideoQualityLevels->Count();
+        }
+
+
+void CEngineVideoRecording::GetVideoFrameSize( 
+    TInt aVideoQualityIndex, 
+    TSize& aFrameSize ) const
+    {
+    HTI_LOG_FUNC_IN("CEngineVideoRecording::GetVideoFrameSize");
+    
+    if ( aVideoQualityIndex >= 0 &&  
+         aVideoQualityIndex < iVideoQualityLevels->Count() )
+        {
+        aFrameSize = iVideoQualityLevels->At( aVideoQualityIndex ).iFrameSize;
+        }
+    HTI_LOG_FUNC_OUT("CEngineVideoRecording::GetVideoFrameSize");
+    }
+
+TReal32 CEngineVideoRecording::VideoFrameRate( 
+    TInt aVideoQualityIndex ) const
+    {
+    HTI_LOG_FUNC_IN("CEngineVideoRecording::VideoFrameRate");
+
+    TReal32 frameRate( 0.0 );
+    if ( aVideoQualityIndex >= 0 &&  
+         aVideoQualityIndex < iVideoQualityLevels->Count() )
+        {
+        frameRate = iVideoQualityLevels->At( aVideoQualityIndex ).iFrameRate;
+        }
+    HTI_LOG_FUNC_OUT("CEngineVideoRecording::VideoFrameRate");
+    return frameRate;
+    }
+
+TInt CEngineVideoRecording::EstimatedVideoRecordingBitRateL( 
+    TInt aVideoQualityIndex ) const
+    {
+    HTI_LOG_FUNC_IN("CEngineVideoRecording::EstimatedVideoRecordingBitRateL");
+
+    TInt storageRate( 0 );
+    if ( aVideoQualityIndex >= 0 &&  
+         aVideoQualityIndex < iVideoQualityLevels->Count() )
+        {
+        storageRate = iVideoQualityLevels->At( aVideoQualityIndex ).iStorageRate;
+        }
+    HTI_LOG_FUNC_OUT("CEngineVideoRecording::EstimatedVideoRecordingBitRateL");
+    return storageRate;
+    }
+
+void CEngineVideoRecording::SetVideoClipMaxSizeL( 
+    TInt aMaxClipSizeInBytes )
+    {
+    HTI_LOG_FUNC_IN("CEngineVideoRecording::SetVideoClipMaxSizeL");
+
+    if ( !iVideoInitialized || iVideoRecordingRunning ) 
+        {
+        HTI_LOG_TEXT("SetVideoClipMaxSizeL leaving KErrNotReady");
+        User::Leave( KErrNotReady );
+        }
+
+    if ( aMaxClipSizeInBytes > 0 ) 
+        {
+        iMaxClipSizeInBytesPrep = aMaxClipSizeInBytes;
+        }
+    else 
+        {
+        iMaxClipSizeInBytesPrep = KMMFNoMaxClipSize;
+        }
+
+    if ( iVideoPrepared )
+        {
+        iPrepPars = ETrue;
+        iVideoRecorder->SetMaxClipSizeL( iMaxClipSizeInBytesPrep );
+        iVideoRecorder->Prepare();
+        }
+
+    HTI_LOG_FUNC_OUT("CEngineVideoRecording::SetVideoClipMaxSizeL");
+    }
+
+TInt CEngineVideoRecording::VideoClipMaxSize() const 
+    {
+    HTI_LOG_FUNC_IN("CEngineVideoRecording::VideoClipMaxSize");
+
+    TInt maxClipSizeInBytes( 0 );
+    if ( iMaxClipSizeInBytes != KMMFNoMaxClipSize ) 
+        {
+        maxClipSizeInBytes = iMaxClipSizeInBytes;
+        }
+
+    HTI_LOG_FUNC_OUT("CEngineVideoRecording::VideoClipMaxSize");
+    return maxClipSizeInBytes;
+    }
+
+void CEngineVideoRecording::SetVideoAudioL( 
+    TBool aAudioEnabled )
+    {
+    HTI_LOG_FUNC_IN("CEngineVideoRecording::SetVideoAudioL");
+
+    if ( !iVideoInitialized || iVideoRecordingRunning ) 
+        {
+        HTI_LOG_TEXT("SetVideoAudioL leaving KErrNotReady");
+        User::Leave( KErrNotReady );
+        }
+
+    iVideoAudioEnabledPrep = aAudioEnabled;
+    iVideoRecorder->SetAudioEnabledL( iVideoAudioEnabledPrep );
+    iPrepPars = ETrue;
+    iVideoRecorder->Prepare();
+
+    HTI_LOG_FUNC_OUT("CEngineVideoRecording::SetVideoAudioL");
+    }
+
+TBool CEngineVideoRecording::VideoAudio() const
+    {
+    HTI_LOG_FUNC_IN("CEngineVideoRecording::VideoAudio");
+
+    TBool audioEnabled( EFalse );
+    if ( iVideoRecorder )
+        {
+        TRAPD( error, { audioEnabled = iVideoRecorder->AudioEnabledL(); } );
+        if ( error != KErrNone ) 
+            {
+            audioEnabled = EFalse;
+            }
+        }
+    HTI_LOG_FUNC_OUT("CEngineVideoRecording::VideoAudio");
+    return audioEnabled;
+    }
+
+void CEngineVideoRecording::StartVideoRecording()
+    {
+    HTI_LOG_FUNC_IN("CEngineVideoRecording::StartVideoRecording");
+
+    TInt error( KErrNone );
+
+    if ( iVideoPrepared && !iVideoRecordingRunning ) 
+        {
+        iVideoRecordingRunning = ETrue;
+        iVideoRecordingPaused = EFalse;
+        
+       // Start video recording.
+        iVideoRecorder->Record();
+        }
+    else 
+        {
+        error = KErrNotReady;
+        }
+
+
+    iVideoRecordingObserver->MevroVideoRecordingOn( error );
+
+    HTI_LOG_FUNC_OUT("CEngineVideoRecording::StartVideoRecording");
+    }
+
+void CEngineVideoRecording::StopVideoRecording()
+    {
+    HTI_LOG_FUNC_IN("CEngineVideoRecording::StopVideoRecording");
+        
+    TInt stoppingError( KErrNone );
+    
+    if ( iVideoRecordingRunning ) 
+        {
+        iVideoRecordingRunning = EFalse;
+        stoppingError = iVideoRecorder->Stop();
+        
+        // Can't be paused anymore.
+        iVideoRecordingPaused = EFalse;
+        }
+    else 
+        {
+        stoppingError = KErrNotReady;
+        }
+
+    iVideoRecordingObserver->MevroVideoRecordingComplete( stoppingError );
+
+    HTI_LOG_FUNC_OUT("CEngineVideoRecording::StopVideoRecording");
+    }
+
+void CEngineVideoRecording::PauseVideoRecording()
+    {
+    HTI_LOG_FUNC_IN("CEngineVideoRecording::PauseVideoRecording");
+
+    TInt error( KErrNone );
+
+    if ( iVideoRecordingRunning && !iVideoRecordingPaused ) 
+        {
+        // Pause video recording.
+        TRAP( error, iVideoRecorder->PauseL() );
+
+        if ( error == KErrNone ) 
+            {
+            iVideoRecordingPaused = ETrue;
+            }
+        }
+    else 
+        {
+        error = KErrNotReady;
+        }
+
+    iVideoRecordingObserver->MevroVideoRecordingPaused( error );
+
+    HTI_LOG_FUNC_OUT("CEngineVideoRecording::PauseVideoRecording");
+    }
+
+void CEngineVideoRecording::ResumeVideoRecording()
+    {
+    HTI_LOG_FUNC_IN("CEngineVideoRecording::ResumeVideoRecording");
+
+    TInt error( KErrNone );
+
+    if ( iVideoRecordingRunning && iVideoRecordingPaused ) 
+        {
+        // Start video recording.
+        iVideoRecorder->Record();
+        iVideoRecordingPaused = EFalse;
+        }
+    else 
+        {
+        error = KErrNotReady;
+        }
+
+    iVideoRecordingObserver->MevroVideoRecordingOn( error );
+
+    HTI_LOG_FUNC_OUT("CEngineVideoRecording::ResumeVideoRecording");
+    }
+
+TTimeIntervalMicroSeconds CEngineVideoRecording::RemainingVideoRecordingTime() const
+    {
+    HTI_LOG_FUNC_IN("CEngineVideoRecording::RemainingVideoRecordingTime");
+    
+    TTimeIntervalMicroSeconds remaining( 0 );
+    if ( iVideoRecorder )
+        {
+        remaining = iVideoRecorder->RecordTimeAvailable();
+        }
+    HTI_LOG_FUNC_OUT("CEngineVideoRecording::RemainingVideoRecordingTime");
+    return remaining;
+    }
+
+TBool CEngineVideoRecording::IsVideoRecording() const
+    {
+    return iVideoRecordingRunning;    
+    }
+
+
+void CEngineVideoRecording::CancelVideoRecording()
+    {
+    HTI_LOG_FUNC_IN("CEngineVideoRecording::CancelVideoRecording");
+    
+    if ( iVideoRecordingRunning ) 
+        {
+        iVideoRecordingRunning = EFalse;
+        // Stop video recording. Do not call MevroVideoRecordingComplete()
+        (void) iVideoRecorder->Stop();
+        iVideoRecordingPaused = EFalse;
+        }
+    
+    HTI_LOG_FUNC_OUT("CEngineVideoRecording::CancelVideoRecording");
+    }
+
+void CEngineVideoRecording::PrepareVideoSettingsL()
+    {
+    HTI_LOG_FUNC_IN("CEngineVideoRecording::PrepareVideoSettingsL");
+
+    iVideoRecorder->SetVideoFrameSizeL( *iVideoFrameSizePrep );
+    iVideoRecorder->SetVideoFrameRateL( iVideoFrameRatePrep );
+    iVideoRecorder->SetVideoBitRateL( iVideoBitRatePrep );
+    iVideoRecorder->SetAudioEnabledL( iVideoAudioEnabledPrep );
+    if ( iPrepareVideoAudioBitRate )
+        {
+        iVideoRecorder->SetAudioBitRateL( iVideoAudioBitRatePrep );
+        iPrepareVideoAudioBitRate = EFalse;
+        }
+    iVideoRecorder->SetMaxClipSizeL( iMaxClipSizeInBytesPrep );
+
+    // Set the recording gain to the maximum
+    TInt gain = iVideoRecorder->GainL();
+    HTI_LOG_FORMAT("CEngineVideoRecording::PrepareVideoSettingsL() GainL was %d", gain );
+    gain = iVideoRecorder->MaxGainL();
+    HTI_LOG_FORMAT("CEngineVideoRecording::PrepareVideoSettingsL() MaxGainL is %d", gain );
+    iVideoRecorder->SetGainL( gain );
+    gain = iVideoRecorder->GainL();
+    HTI_LOG_FORMAT("CEngineVideoRecording::PrepareVideoSettingsL() GainL set to %d", gain );
+
+    iPrepPars = ETrue;
+    iVideoRecorder->Prepare();
+
+    HTI_LOG_FUNC_OUT("CEngineVideoRecording::PrepareVideoSettingsL");
+    }
+
+void CEngineVideoRecording::FindVideoUidsL(
+    const TDesC8& aMimeType, 
+    const TDesC&  aPreferredSupplier )
+    {
+    HTI_LOG_FUNC_IN("CEngineVideoRecording::FindVideoUidsL");
+
+    iVideoControllerUid.iUid = 0;
+    iVideoFormatUid.iUid = 0; 
+
+    // Retrieve a list of possible controllers from ECOM.
+    //
+    // Controller must support recording the requested mime type.
+    // Controller must be provided by preferred supplier.
+
+    CMMFControllerPluginSelectionParameters* cSelect = 
+        CMMFControllerPluginSelectionParameters::NewLC();
+    CMMFFormatSelectionParameters* fSelect = 
+        CMMFFormatSelectionParameters::NewLC();
+
+    fSelect->SetMatchToMimeTypeL( aMimeType );
+    cSelect->SetRequiredRecordFormatSupportL( *fSelect );
+    cSelect->SetPreferredSupplierL( aPreferredSupplier,
+       CMMFPluginSelectionParameters::EOnlyPreferredSupplierPluginsReturned );
+
+    RMMFControllerImplInfoArray controllers;
+    CleanupResetAndDestroyPushL( controllers );
+    cSelect->ListImplementationsL( controllers );
+
+    if ( controllers.Count() < 1 )
+        {
+        // No appropriate controllers found.
+        HTI_LOG_TEXT("CEngineVideoRecording::FindVideoUidsL() leaving KErrNotSupported (no controllers found)");
+        User::Leave( KErrNotSupported );
+        }
+
+    TBool found( EFalse );
+    for ( TInt contInd = 0; contInd < controllers.Count() && !found; contInd++ ) // there can be more than one controller, search from all of them
+        {
+        // Get the controller UID.
+        iVideoControllerUid = controllers[contInd]->Uid();
+        HTI_LOG_FORMAT("CEngineVideoRecording::FindVideoUidsL()  iVideoControllerUid=%x", iVideoControllerUid.iUid );
+
+        // Inquires the controller about supported formats.
+        RMMFFormatImplInfoArray formats = controllers[contInd]->RecordFormats();
+
+        // Get the first format that supports our mime type.
+        for ( TInt i = 0; i < formats.Count(); i++ )
+            {
+            if ( formats[i]->SupportsMimeType( aMimeType ) )
+                {
+                iVideoFormatUid = formats[i]->Uid(); // set the UID
+                found = ETrue;
+                HTI_LOG_FORMAT("CEngineVideoRecording::FindVideoUidsL() Found iVideoFormatUid=%x", iVideoFormatUid.iUid);
+                break;
+                }
+            }
+        }
+    if ( !found )
+        {
+        // No appropriate video format found.
+        HTI_LOG_TEXT("CEngineVideoRecording::FindVideoUidsL() leaving KErrNotSupported (no video format found)");
+        User::Leave( KErrNotSupported );
+        }
+
+    CleanupStack::PopAndDestroy( 3, cSelect ); // cselect, fselect, controllers
+
+    HTI_LOG_FUNC_OUT("CEngineVideoRecording::FindVideoUidsL");
+    }
+
+
+TFourCC CEngineVideoRecording::ConvertAndSetVideoAudioTypeL(
+    const TDesC8& aAudioType )
+    {
+    if ( aAudioType == KNullDesC8 )
+        {
+        return KMMFFourCCCodeNULL;
+        }
+    else
+        {
+        if ( aAudioType.Length() != 4 ) 
+            {
+            User::Leave( KErrArgument );
+            }
+        return TFourCC( aAudioType[0], aAudioType[1], aAudioType[2], aAudioType[3] );
+        }
+    }
+
+void CEngineVideoRecording::Reserve()
+    {
+    HTI_LOG_FUNC_IN("CEngineVideoRecording::Reserve");
+
+    if ( !iReserved ) 
+        {
+        iCamera->Reserve();
+        }
+    else if ( !iPowerOn ) // in case previous reserve ok, but poweron failed
+        {
+        PowerOn();
+        }
+
+
+    HTI_LOG_FUNC_OUT("CEngineVideoRecording::Reserve");
+    }
+
+
+void CEngineVideoRecording::Release()
+    {
+    HTI_LOG_FUNC_IN("CEngineVideoRecording::Release");
+
+    if ( iReserved ) 
+        {
+        PowerOff();         // Cancel all activities (if any) and turn power off.
+        iCamera->Release(); // Release Camera HW.
+        iReserved = EFalse;
+        iVideoPrepared = EFalse;
+        iVideoOpened = EFalse;
+        }
+
+    HTI_LOG_FUNC_OUT("CEngineVideoRecording::Release");
+    }
+
+
+void CEngineVideoRecording::PowerOn()
+    {
+    HTI_LOG_FUNC_IN("CEngineVideoRecording::PowerOn");
+
+    if ( iReserved && !iPowerOn ) 
+        {
+        iCamera->PowerOn();
+        }
+
+    HTI_LOG_FUNC_OUT("CEngineVideoRecording::PowerOn");
+    }
+
+
+void CEngineVideoRecording::PowerOff()
+    {
+    HTI_LOG_FUNC_IN("CEngineVideoRecording::PowerOff");
+
+    if ( iPowerOn ) 
+        {
+        iCamera->PowerOff();
+        iPowerOn = EFalse;
+        }
+
+    HTI_LOG_FUNC_OUT("CEngineVideoRecording::PowerOff");
+    }
+
+
+void CEngineVideoRecording::SetZoomModeL( 
+    TZoomMode aZoomMode )
+    {
+    HTI_LOG_FUNC_IN("CEngineVideoRecording::SetZoomModeL");
+
+    // Currently supporting digital and optical zooms, not EZoomModeOpticalDigital.
+    if ( ( aZoomMode != EZoomModeDigital ) && ( aZoomMode != EZoomModeOptical ) )
+        {
+        HTI_LOG_FORMAT("CEngineVideoRecording::SetZoomModeL leaving KErrNotSupported, aZoomMode=%d", aZoomMode );
+        User::Leave( KErrNotSupported );
+        }
+
+    iZoomMode = aZoomMode;
+
+    HTI_LOG_FUNC_OUT("CEngineVideoRecording::SetZoomModeL");
+    }
+
+
+CEngineVideoRecording::TZoomMode CEngineVideoRecording::ZoomMode() const
+    {
+    HTI_LOG_TEXT("CEngineVideoRecording::ZoomMode");
+
+    return iZoomMode;
+    }
+
+
+void CEngineVideoRecording::SetZoomValueL( 
+    TInt aZoomValue )
+    {
+    HTI_LOG_FUNC_IN("CEngineVideoRecording::SetZoomValueL");
+
+    CheckPowerL();
+
+    switch ( iZoomMode )
+        {
+        case EZoomModeDigital:
+            // Leave if zoom factor is out of range.
+            if ( ( aZoomValue < 0 ) || 
+                 ( aZoomValue > iInfo->iMaxDigitalZoom ) )
+                {
+                HTI_LOG_FORMAT("CEngineVideoRecording::SetZoomValueL leaving KErrArgument, aZoomValue=%d", aZoomValue );
+                HTI_LOG_FORMAT("The min digital zool value is 0, the max is %d", iInfo->iMaxDigitalZoom);
+                User::Leave( KErrArgument );
+                }
+            // Set DIGITAL zoom value.
+            iCamera->SetDigitalZoomFactorL( aZoomValue );
+            iZoomValue = aZoomValue;
+            break;
+        case EZoomModeOptical:
+            // Leave if zoom factor is out of range.
+            if ( ( aZoomValue < iInfo->iMinZoom ) || 
+                 ( aZoomValue > iInfo->iMaxZoom ) )
+                {
+                HTI_LOG_FORMAT("CEngineVideoRecording::SetZoomValueL leaving KErrArgument, aZoomValue=%d", aZoomValue );
+                HTI_LOG_FORMAT("The max optical zoom value is %d", iInfo->iMaxZoom);
+                HTI_LOG_FORMAT("The min optical zoom value is %d", iInfo->iMinZoom);
+                if(iInfo->iMinZoom == iInfo->iMaxZoom)
+                    {
+                    User::Leave(KErrNotSupported);
+                    }
+                User::Leave( KErrArgument );
+                }
+            // Set OPTICAL zoom value.
+            iCamera->SetZoomFactorL( aZoomValue );
+            iZoomValue = aZoomValue;
+            break;
+        default:
+            // EZoomModeOpticalDigital not supported
+            HTI_LOG_FORMAT("CEngineVideoRecording::SetZoomValueL leaving KErrNotSupported, iZoomMode=%d", iZoomMode );
+            User::Leave( KErrNotSupported );
+            break;
+        }
+
+    HTI_LOG_FUNC_OUT("CEngineVideoRecording::SetZoomValueL");
+    }
+
+
+TInt CEngineVideoRecording::ZoomValue() const
+    {
+    HTI_LOG_FUNC_IN("CEngineVideoRecording::ZoomValue");
+    
+    TInt zoomValue( 0 );
+    if ( iPowerOn )
+        {
+        switch ( iZoomMode )
+            {
+            case EZoomModeDigital:
+                zoomValue = iCamera->DigitalZoomFactor();
+                break;
+            case EZoomModeOptical:
+                zoomValue = iCamera->ZoomFactor();
+                break;
+            default:
+                // EZoomModeOpticalDigital not supported
+                break;
+            }
+        }    
+
+    HTI_LOG_FUNC_OUT("CEngineVideoRecording::ZoomValue");
+    return zoomValue;
+    }
+
+TInt CEngineVideoRecording::MaxZoomValue() const
+    {
+    HTI_LOG_FUNC_IN("CEngineVideoRecording::MaxZoomValue");
+    
+    TInt zoomValue( 0 );
+    if ( iPowerOn )
+        {
+        switch ( iZoomMode )
+            {
+            case EZoomModeDigital:
+                zoomValue = iInfo->iMaxDigitalZoom;
+                break;
+            case EZoomModeOptical:
+                zoomValue = iInfo->iMaxZoom;
+                break;
+            default:
+                // EZoomModeOpticalDigital not supported
+                break;
+            }
+        }
+        
+    HTI_LOG_FUNC_OUT("CEngineVideoRecording::MaxZoomValue");
+    return zoomValue;
+    }
+
+TInt CEngineVideoRecording::MinZoomValue() const
+    {
+    HTI_LOG_FUNC_IN("CEngineVideoRecording::MinZoomValue");
+    
+    TInt zoomValue( 0 );
+    if ( iPowerOn )
+        {
+        switch ( iZoomMode )
+            {
+            case EZoomModeDigital:
+                zoomValue = 0;
+                break;
+            case EZoomModeOptical:
+                zoomValue = iInfo->iMinZoom;
+                break;
+            default:
+                // EZoomModeOpticalDigital not supported
+                break;
+            }
+        }
+    
+    HTI_LOG_FUNC_OUT("CEngineVideoRecording::MinZoomValue");
+    return zoomValue;
+    }
+void CEngineVideoRecording::SetBrightnessL( 
+    TInt aBrightness )
+    {
+    HTI_LOG_FUNC_IN("CEngineVideoRecording::SetBrightnessL");
+    // Leave if not supported.
+    if ( !( iInfo->iOptionsSupported & TCameraInfo::EBrightnessSupported ) )
+        {
+        HTI_LOG_FORMAT("CEngineVideoRecording::SetBrightnessL leaving KErrNotSupported, aBrightness=%d", aBrightness );
+        User::Leave( KErrNotSupported );
+        }
+
+    CheckPowerL();
+
+    iCamera->SetBrightnessL( aBrightness );
+    iBrightness = aBrightness;
+
+    HTI_LOG_FUNC_OUT("CEngineVideoRecording::SetBrightnessL"); 
+    }
+
+
+TInt CEngineVideoRecording::Brightness() const
+    {
+    HTI_LOG_FUNC_IN("CEngineVideoRecording::Brightness");
+
+    TInt brightness( 0 );
+    if ( iPowerOn && ( iInfo->iOptionsSupported & TCameraInfo::EBrightnessSupported ) )
+        {
+        brightness = iCamera->Brightness();
+        }
+    
+    HTI_LOG_FUNC_OUT("CEngineVideoRecording::Brightness");
+    return brightness;
+    }
+
+
+void CEngineVideoRecording::SetContrastL( 
+    TInt aContrast )
+    {
+    HTI_LOG_FUNC_IN("CEngineVideoRecording::SetContrastL");
+    
+    // Leave if not supported.
+    if ( !( iInfo->iOptionsSupported & TCameraInfo::EContrastSupported ) )
+        {
+        HTI_LOG_FORMAT("CEngineVideoRecording::SetContrastL leaving KErrNotSupported, aContrast=%d", aContrast );
+        User::Leave( KErrNotSupported );
+        }
+
+    CheckPowerL();
+
+    iCamera->SetContrastL( aContrast );
+    iContrast = aContrast;
+
+    HTI_LOG_FUNC_OUT("CEngineVideoRecording::SetContrastL");
+    }
+
+
+TInt CEngineVideoRecording::Contrast() const
+    {
+    HTI_LOG_FUNC_IN("CEngineVideoRecording::Contrast");
+    TInt contrast( 0 );
+    if ( iPowerOn && ( iInfo->iOptionsSupported & TCameraInfo::EContrastSupported ) )
+        {
+        contrast = iCamera->Contrast();
+        }
+    
+    HTI_LOG_FUNC_OUT("CEngineVideoRecording::Contrast");
+    return contrast;
+    }
+
+
+void CEngineVideoRecording::SetExposureModeL( 
+    CCamera::TExposure aExposureMode )
+    {
+    HTI_LOG_FUNC_IN("CEngineVideoRecording::SetExposureModeL");
+
+    // Leave is requested exposure mode is not supported, 
+    // EExposureAuto should be always supported.
+    if ( ( ( aExposureMode != CCamera::EExposureAuto ) && 
+          !( aExposureMode & iInfo->iExposureModesSupported ) ) ||
+           ( aExposureMode < 0 ) )
+        {
+        HTI_LOG_FORMAT("CEngineVideoRecording::SetExposureModeL leaving KErrNotSupported, aExposureMode=%d", aExposureMode );
+        User::Leave( KErrNotSupported );
+        }
+
+    CheckPowerL();
+
+    iCamera->SetExposureL( aExposureMode );
+    iExposureMode = aExposureMode;
+    
+    HTI_LOG_FUNC_OUT("CEngineVideoRecording::SetExposureModeL");
+    }
+
+
+CCamera::TExposure CEngineVideoRecording::ExposureMode() const
+    {
+    HTI_LOG_FUNC_IN("CEngineVideoRecording::ExposureMode");
+
+    CCamera::TExposure exposureMode( CCamera::EExposureAuto );
+    if ( iPowerOn )
+        {
+        exposureMode = iCamera->Exposure();
+        }
+    
+    HTI_LOG_FUNC_OUT("CEngineVideoRecording::ExposureMode");
+    return exposureMode;
+    }
+
+
+void CEngineVideoRecording::SetWhiteBalanceModeL( 
+    CCamera::TWhiteBalance aWhiteBalanceMode )
+    {
+    HTI_LOG_FUNC_IN("CEngineVideoRecording::SetWhiteBalanceModeL");
+
+    // Leave is requested WB mode is not supported. 
+    // EWBAuto is always supported.
+    if ( ( ( aWhiteBalanceMode != CCamera::EWBAuto ) && 
+          !( aWhiteBalanceMode & iInfo->iWhiteBalanceModesSupported ) ) ||
+           ( aWhiteBalanceMode < 0 ) )
+        {
+        HTI_LOG_FORMAT("CEngineVideoRecording::SetWhiteBalanceModeL leaving KErrNotSupported, aWhiteBalanceMode=%d", aWhiteBalanceMode );
+        User::Leave( KErrNotSupported );
+        }
+    
+    CheckPowerL();
+
+    iCamera->SetWhiteBalanceL( aWhiteBalanceMode );
+    iWhiteBalanceMode = aWhiteBalanceMode;
+
+    HTI_LOG_FUNC_OUT("CEngineVideoRecording::SetWhiteBalanceModeL");
+    }
+
+
+CCamera::TWhiteBalance CEngineVideoRecording::WhiteBalanceMode() const
+    {
+    HTI_LOG_FUNC_IN("CEngineVideoRecording::WhiteBalanceMode");
+
+    CCamera::TWhiteBalance whiteBalanceMode( CCamera::EWBAuto );
+    if ( iPowerOn )
+        {
+        whiteBalanceMode = iCamera->WhiteBalance();
+        }
+    
+    HTI_LOG_FUNC_OUT("CEngineVideoRecording::WhiteBalanceMode");
+    return whiteBalanceMode;
+    }
+
+
+void CEngineVideoRecording::SetFlashModeL( 
+    CCamera::TFlash aFlashMode )
+    {
+    HTI_LOG_FUNC_IN("CEngineVideoRecording::SetFlashModeL");
+    
+    // Leave is requested flash mode is not supported. 
+    // EFlashNone is always supported.
+    if ( ( ( aFlashMode != CCamera::EFlashNone ) && 
+          !( aFlashMode & iInfo->iFlashModesSupported ) ) || 
+           ( aFlashMode < 0 ) )
+        {
+        HTI_LOG_FORMAT("CEngineVideoRecording::SetFlashModeL leaving KErrNotSupported, aFlashMode=%d", aFlashMode );
+        User::Leave( KErrNotSupported );
+        }
+
+    CheckPowerL();
+
+    iCamera->SetFlashL( aFlashMode );
+    iFlashMode = aFlashMode;
+
+    HTI_LOG_FUNC_OUT("CEngineVideoRecording::SetFlashModeL");
+    }
+
+
+CCamera::TFlash CEngineVideoRecording::FlashMode() const
+    {
+    HTI_LOG_FUNC_IN("CEngineVideoRecording::FlashMode");
+
+    CCamera::TFlash flashMode( CCamera::EFlashNone );
+    if ( iPowerOn )
+        {
+        flashMode = iCamera->Flash();
+        }
+    
+    HTI_LOG_FUNC_OUT("CEngineVideoRecording::FlashMode");
+    return flashMode;
+    }
+
+
+void CEngineVideoRecording::ResetToDefaultsL()
+    {
+    HTI_LOG_FUNC_IN("CEngineVideoRecording::ResetToDefaultsL");
+
+    SetExposureModeL();
+    SetWhiteBalanceModeL();
+    SetZoomModeL();
+    SetZoomValueL();
+    SetFlashModeL();
+
+    // Reset this setting only if it is supported by Camera API.
+    if ( iInfo->iOptionsSupported & TCameraInfo::EBrightnessSupported )
+        {
+        SetBrightnessL();
+        }
+
+    // Reset this setting only if it is supported by Camera API.
+    if ( iInfo->iOptionsSupported & TCameraInfo::EContrastSupported )
+        {
+        SetContrastL();
+        }
+
+    HTI_LOG_FUNC_OUT("CEngineVideoRecording::ResetToDefaultsL");
+    }
+
+void CEngineVideoRecording::CheckPowerL()
+    {
+    if ( !iPowerOn ) 
+        {
+        HTI_LOG_TEXT("CEngineVideoRecording::CheckPowerL() leaving KErrNotReady (iPowerOn)");
+        User::Leave( KErrNotReady );
+        }
+    }
+
+void CEngineVideoRecording::MvruoOpenComplete(TInt aError)
+    {
+    HTI_LOG_FUNC_IN("CEngineVideoRecording::MvruoOpenComplete");
+
+    HTI_LOG_FORMAT("aError = %d", aError);
+    if ( aError == KErrNone )
+        {
+        // To get default video audio bit rate.
+        TRAP( aError, { iVideoAudioBitRate = iVideoRecorder->AudioBitRateL(); } );
+        // (ignore possible error)
+        // Prepare settings only if no errors in opening.
+        TRAP( aError, PrepareVideoSettingsL() );
+        if ( aError != KErrNone ) 
+            {
+            iVideoRecordingObserver->MevroVideoPrepareComplete( aError );
+            }
+        }
+    else
+        {
+        iVideoRecordingObserver->MevroVideoPrepareComplete( aError );
+        }
+
+    HTI_LOG_FUNC_OUT("CEngineVideoRecording::MvruoOpenComplete");
+    }
+
+void CEngineVideoRecording::MvruoPrepareComplete(TInt aError)
+    {
+    HTI_LOG_FUNC_IN("CEngineVideoRecording::MvruoPrepareComplete");
+
+    HTI_LOG_FORMAT("aError = %d", aError);
+    if ( iVideoOpened && ( aError == KErrNone ) )
+        {
+        iVideoPrepared = ETrue; // Later errors with settings after 
+                                // do not change the value.
+        }
+
+    if ( iPrepPars )
+        {
+        iPrepPars = EFalse;
+        // If no error, then fresh parameters are valid.
+        // Otherwise, old parameters are kept.
+        if ( aError == KErrNone )
+            {
+            *iVideoFrameSize    = *iVideoFrameSizePrep;
+            iVideoFrameRate     = iVideoFrameRatePrep;
+            iVideoBitRate       = iVideoBitRatePrep;
+            iVideoAudioEnabled  = iVideoAudioEnabledPrep;
+            iVideoAudioBitRate  = iVideoAudioBitRatePrep;
+            iMaxClipSizeInBytes = iMaxClipSizeInBytesPrep;
+            }
+        else 
+            {
+            *iVideoFrameSizePrep    = *iVideoFrameSize;
+            iVideoFrameRatePrep     = iVideoFrameRate;
+            iVideoBitRatePrep       = iVideoBitRate;
+            iVideoAudioEnabledPrep  = iVideoAudioEnabled;
+            iVideoAudioBitRatePrep  = iVideoAudioBitRate;
+            iMaxClipSizeInBytesPrep = iMaxClipSizeInBytes;
+            }
+        }
+
+    iVideoRecordingObserver->MevroVideoPrepareComplete( aError );
+
+    HTI_LOG_FUNC_OUT("CEngineVideoRecording::MvruoPrepareComplete");
+    }
+
+void CEngineVideoRecording::MvruoRecordComplete(TInt aError)
+    {
+    HTI_LOG_FUNC_IN("CEngineVideoRecording::MvruoRecordComplete");
+
+    HTI_LOG_FORMAT("aError = %d", aError);    
+
+    // Recording stopped: can't be paused anymore.
+    iVideoRecordingPaused = EFalse; 
+        
+    if ( iVideoRecordingRunning) // To ensure that McaeoVideoRecordingComplete 
+        {                                                   // gets called just once per recording.
+        iVideoRecordingRunning = EFalse;
+        
+        // Close video recording always in error case. Otherwise the camcorder plugin would
+        // be in indeterminated state. 
+        // The code KErrCompletion means that video reocording has been completed by timer
+        if ( aError && aError != KErrCompletion && aError != KErrDiskFull ) 
+            { 
+            CloseVideoRecording();
+            }
+            
+        iVideoRecordingObserver->MevroVideoRecordingComplete( aError );
+        }
+    
+    HTI_LOG_FUNC_IN("CEngineVideoRecording::MvruoRecordComplete");
+    }
+
+void CEngineVideoRecording::MvruoEvent(const TMMFEvent& /*aEvent*/)
+    {
+    HTI_LOG_FUNC_IN("CEngineVideoRecording::MvruoEvent");
+    HTI_LOG_FUNC_OUT("CEngineVideoRecording::MvruoEvent");
+    }
+
+void CEngineVideoRecording::ReserveComplete(                                 
+    TInt aError )
+    {
+    HTI_LOG_FUNC_IN("CEngineVideoRecording::ReserveComplete");
+
+    if ( aError == KErrNone )
+        {
+        iReserved = ETrue;
+        PowerOn();
+        }
+    else
+        {
+        iVideoRecordingObserver->MevroInitComplete( aError );
+        }
+
+    HTI_LOG_FUNC_OUT("CEngineVideoRecording::ReserveComplete");
+    }
+
+
+void CEngineVideoRecording::PowerOnComplete( 
+    TInt aError )
+    {
+    HTI_LOG_FUNC_IN("CEngineVideoRecording::PowerOnComplete");
+
+    if ( aError == KErrNone ) 
+        {
+        iPowerOn = ETrue;
+        }
+    
+    iVideoRecordingObserver->MevroInitComplete( aError );
+
+    HTI_LOG_FUNC_OUT("CEngineVideoRecording::PowerOnComplete");
+    }
+
+void CEngineVideoRecording::HandleEvent( const TECAMEvent& aEvent)
+    {
+    HTI_LOG_FUNC_IN("CEngineVideoRecording::HandleEvent");
+    if (aEvent.iEventType == KUidECamEventCameraNoLongerReserved)
+        {
+        HTI_LOG_TEXT("CEngineVideoRecording::HandleEvent() KUidECamEventCameraNoLongerReserved");
+        iPowerOn = EFalse;
+        iReserved = EFalse;
+        iVideoPrepared = EFalse;
+        iVideoOpened = EFalse;
+        iVideoRecordingObserver->MevroInitComplete(KErrInUse); // Tell the client that other application has taken the camera
+        }
+    else if (aEvent.iEventType == KUidECamEventPowerOnComplete)
+        {
+        HTI_LOG_TEXT("CEngineVideoRecording::HandleEvent() KUidECamEventPowerOnComplete");
+        PowerOnComplete(aEvent.iErrorCode);
+        }
+    else if (aEvent.iEventType == KUidECamEventReserveComplete)
+        {
+        HTI_LOG_TEXT("CEngineVideoRecording::HandleEvent() KUidECamEventReserveComplete");
+        ReserveComplete(aEvent.iErrorCode);
+        }
+    
+    HTI_LOG_FUNC_OUT("CEngineVideoRecording::HandleEvent");
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiServicePlugins/HtiCameraServicePlugin/engine/src/VideoRecordingQualityLevels.cpp	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,144 @@
+/*
+* 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:  Engine video quality level and container.
+*
+*/
+
+
+#include <e32std.h>
+#include <e32base.h> 
+
+
+#include "VideoRecordingQualityLevels.h"
+
+
+// CONSTANTS
+const TInt KQualityLevelArrayGranularity = 3;
+
+CVideoRecordingQualityLevels::CVideoRecordingQualityLevels()
+    {
+    // TODO Auto-generated constructor stub
+
+    }
+
+CVideoRecordingQualityLevels::~CVideoRecordingQualityLevels()
+    {
+    delete iQualityLevels;
+    }
+
+void CVideoRecordingQualityLevels::ConstructL()
+    {
+
+    iQualityLevels = new( ELeave ) CArrayFixFlat<CVideoRecordingQualityLevel>( KQualityLevelArrayGranularity );
+
+    }
+
+CVideoRecordingQualityLevels* CVideoRecordingQualityLevels::NewL()
+    {
+
+    CVideoRecordingQualityLevels* self = new( ELeave ) CVideoRecordingQualityLevels;
+
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+
+
+    return self;
+    }
+
+TInt CVideoRecordingQualityLevels::InitDefaultsL()
+    {
+
+    // Delete all elements from the array and 
+    // free the memory allocated to the array buffer.
+    iQualityLevels->Reset();
+
+    // Initialize hardcoded default quality levels.
+
+    TSize size;
+
+    CVideoRecordingQualityLevel* videoQualityLevel = new( ELeave ) CVideoRecordingQualityLevel;
+    CleanupStack::PushL( videoQualityLevel );
+    
+    // Level 0:
+    size.SetSize( KImgWidthQCIF, KImgHeightQCIF );
+    videoQualityLevel->iFrameSize    = size;
+    videoQualityLevel->iFrameRate    = 15.0;  // Frames per second. Basically HW dependent.
+    videoQualityLevel->iBitRate      = 64000; // Bits per second. Basically HW dependent.
+    videoQualityLevel->iAudioEnabled = EFalse;
+    videoQualityLevel->iAudioBitRate = 12200; // Bits per second. Basically HW dependent.
+    videoQualityLevel->iMimeType.Copy( KVideoMimeType );
+    videoQualityLevel->iPreferredSupplier.Copy( KPreferredSupplier );
+    videoQualityLevel->iVideoType.Copy( KVideoType );
+    videoQualityLevel->iAudioType.Copy( KAudioType );
+    videoQualityLevel->iStorageRate = 78000;  // That many bits per second to store. Estimate only
+
+    iQualityLevels->AppendL( *videoQualityLevel );
+
+    // Level 1:
+    size.SetSize( KImgWidthSubQCIF, KImgHeightSubQCIF );
+    videoQualityLevel->iFrameSize    = size;
+    videoQualityLevel->iFrameRate    = 15.0;  // Frames per second. Basically HW dependent.
+    videoQualityLevel->iBitRate      = 60000; // Bits per second. Basically HW dependent.
+    videoQualityLevel->iAudioEnabled = EFalse;
+    videoQualityLevel->iAudioBitRate = 6700;  // Bits per second. Basically HW dependent.
+    videoQualityLevel->iMimeType.Copy( KVideoMimeType );
+    videoQualityLevel->iPreferredSupplier.Copy( KPreferredSupplier );
+    videoQualityLevel->iVideoType.Copy( KVideoType );
+    videoQualityLevel->iAudioType.Copy( KAudioType );
+    videoQualityLevel->iStorageRate = 68000;  // That many bits per second to store. Estimate only
+
+    iQualityLevels->AppendL( *videoQualityLevel );
+
+    // Level 2:
+    size.SetSize( KImgWidthSubQCIF, KImgHeightSubQCIF );
+    videoQualityLevel->iFrameSize    = size;
+    videoQualityLevel->iFrameRate    = 5.0;   // Frames per second. Basically HW dependent.
+    videoQualityLevel->iBitRate      = 40000; // Bits per second. Basically HW dependent.
+    videoQualityLevel->iAudioEnabled = EFalse;
+    videoQualityLevel->iAudioBitRate = 5150;  // Bits per second. Basically HW dependent.
+    videoQualityLevel->iMimeType.Copy( KVideoMimeType );
+    videoQualityLevel->iPreferredSupplier.Copy( KPreferredSupplier );
+    videoQualityLevel->iVideoType.Copy( KVideoType );
+    videoQualityLevel->iAudioType.Copy( KAudioType );
+    videoQualityLevel->iStorageRate = 47000;  // That many bits per second to store. Estimate only
+
+    iQualityLevels->AppendL( *videoQualityLevel );
+
+    CleanupStack::PopAndDestroy( videoQualityLevel );
+
+
+    return iQualityLevels->Count();
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeVideoQualityLevelsCont::Count
+// -----------------------------------------------------------------------------
+//
+TInt CVideoRecordingQualityLevels::Count() const
+    {
+    return iQualityLevels->Count();
+    }
+
+        
+// -----------------------------------------------------------------------------
+// CCaeVideoQualityLevelsCont::At
+// -----------------------------------------------------------------------------
+//
+CVideoRecordingQualityLevel& CVideoRecordingQualityLevels::At( 
+    TInt aIndex ) const
+    {
+    return iQualityLevels->At( aIndex );
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiServicePlugins/HtiCameraServicePlugin/group/HtiCameraServicePlugin.mmp	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,55 @@
+/*
+* 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:  HTI service plugin for controlling audio playback.
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+TARGET      HtiCameraServicePlugin.dll
+TARGETTYPE  PLUGIN
+
+// ECom Dll recognition UID followed by the unique UID for this dll
+UID 0x10009D8D 0x2002EA9D
+
+VENDORID    0x101FB657
+
+CAPABILITY      ALL -TCB
+
+SOURCEPATH  ../src
+SOURCE      proxy.cpp
+SOURCE      HtiCameraServicePlugin.cpp
+
+SOURCE 		../engine/src/EngineVideoRecording.cpp
+SOURCE 		../engine/src/VideoRecordingQualityLevels.cpp
+
+USERINCLUDE     ../inc
+USERINCLUDE     ../engine/inc
+APP_LAYER_SYSTEMINCLUDE
+
+START RESOURCE  ../data/2002EA9D.rss
+TARGET          HtiCameraServicePlugin.rsc
+END
+
+LIBRARY     ecom.lib
+LIBRARY     efsrv.lib
+LIBRARY     euser.lib
+LIBRARY     flogger.lib
+LIBRARY     mediaclientvideo.lib 
+LIBRARY     MMFControllerFramework.lib
+LIBRARY     ECAM.lib
+SMPSAFE
+
+// End of file
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiServicePlugins/HtiCameraServicePlugin/group/bld.inf	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,27 @@
+/*
+* 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 file for HtiAudioServicePlugin
+*
+*/
+
+
+
+PRJ_PLATFORMS
+
+PRJ_EXPORTS
+
+PRJ_MMPFILES
+HtiCameraServicePlugin.mmp
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiServicePlugins/HtiCameraServicePlugin/inc/HtiCameraServicePlugin.h	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,204 @@
+/*
+* 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:  Defines the ECom plugin for HTI camera service.
+*
+*/
+
+
+
+#ifndef HTICAMERASERVICEPLUGIN_H
+#define HTICAMERASERVICEPLUGIN_H
+
+//  INCLUDES
+#include <HtiServicePluginInterface.h>
+#include "EngineVideoRecording.h"
+// CONSTANTS
+
+// MACROS
+
+// DATA TYPES
+
+// FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+class CEngineVideoRecording;
+class MEngineVideoRecordingObserver;
+
+// CLASS DECLARATION
+
+/**
+*  The ECom plugin for HTI camera service.
+*
+*/
+class CHtiCameraServicePlugin : public CHTIServicePluginInterface,
+                                public MEngineVideoRecordingObserver
+    {
+
+    protected:
+        // commands
+        enum TCommands
+            {
+            ECmdInitialize              = 0x01,
+            ECmdPrepareVideoRecording   = 0x02,
+            ECmdStartVideoRecording     = 0x05,
+            ECmdPausingVideoRecording   = 0x06,
+            ECmdResumeVideoRecording    = 0x07,
+            ECmdStopVideoRecording      = 0x08,
+            ECmdCloseVideoRecording     = 0x09,
+            ECmdGetZoom                 = 0x0a,
+            ECmdSetZoom                 = 0x0b,
+            
+            ECmdUninitialize            = 0x51,
+            EResultOk                   = 0xFF // only for response message
+            };
+
+
+    public:  // Constructors and destructor
+
+        /**
+        * Two-phased constructor.
+        */
+        static CHtiCameraServicePlugin* NewL();
+
+    public: // New functions
+
+    public:
+    // Functions from base classes
+
+    /**
+     * From CHTIServicePluginInterface
+     * Called by the HTI Framework when sending message to this service.
+     * @param aMessage message body destinated to a servive
+     * @param aPriority message priority
+     */
+    void ProcessMessageL(const TDesC8& aMessage,
+            THtiMessagePriority aPriority);
+
+    /**
+     * From CHTIServicePluginInterface
+     * Indicates to HTI Framework whether the plugin is ready to process
+     * a new message or if it's busy processing previous message.
+     */
+    TBool IsBusy();
+
+ 
+    protected:  // New functions
+
+        /**
+        * C++ default constructor.
+        */
+        CHtiCameraServicePlugin();
+
+        /**
+        * 2nd phase constructor.
+        */
+        void ConstructL();
+
+        /**
+        * Destructor.
+         */
+        virtual ~CHtiCameraServicePlugin();
+    
+    protected:
+        // Functions from base classes
+        
+        /**
+        * From MEngineVideoRecordingObserver
+        * Called asynchronously when CEngineVideoRecording::Init(), CCaeEngine::CEngineVideoRecording(), 
+        * or CEngineVideoRecording::Reserve() completes.
+        * Indicates if Video Recording Engine is ready for operation, 
+        * the camera is reserved and its power is switched on.
+        * @param aError Error code KErrNone to indicate success or a standard Symbian OS error code.
+        * @return void
+        */
+        virtual void MevroInitComplete( TInt aError );
+        
+        /**
+         * From MEngineVideoRecordingObserver
+         * Called asynchronously when preparing of video recording completes 
+         * after PrepareVideoRecordingL() has been called.
+         * May be called second time with an error code after a successful preparation 
+         * if video recording loses its prepared state for some reason (e.g. audio HW 
+         * is reserved for some other application).
+         * @param aError Error code KErrNone to indicate success or a standard Symbian OS error code.
+         * @return void
+         */
+        virtual void MevroVideoPrepareComplete(TInt aError);
+    
+        /**
+         * From MEngineVideoRecordingObserver
+         * Called (possibly asynchronously) when video recording is running 
+         * after CEngineVideoRecording::StartVideoRecording() or 
+         * CEngineVideoRecording::ResumeVideoRecording() has been called.
+         * @param aError Error code KErrNone to indicate success or a standard Symbian OS error code.
+         * @return void
+         */
+        virtual void MevroVideoRecordingOn(TInt aError);
+    
+        /**
+         * From MEngineVideoRecordingObserver
+         * Called (possibly asynchronously) when video recording is paused after 
+         * CEngineVideoRecording::PauseVideoRecording() has been called.
+         * @param aError Error code KErrNone to indicate success or a standard Symbian OS error code.
+         * @return void
+         */
+        virtual void MevroVideoRecordingPaused(TInt aError);
+    
+        /**
+         * From MEngineVideoRecordingObserver
+         * Called (possibly asynchronously) when video recording is completed 
+         * after CEngineVideoRecording::StopVideoRecording() has been called or 
+         * recording has been completed for some other reason.
+         * @param aError Error code KErrNone to indicate success or a standard Symbian OS error code.
+         * if aError == KErrDiskFull, then disk storage is full.
+         * if aError == KErrCompletion, then clip max size was reached.
+         * @return void
+         */
+        virtual void MevroVideoRecordingComplete(TInt aError);
+    
+    private:
+        void HandleInitializeCmdL(const TDesC8& aData);
+        void HandleUninitializeCmdL(const TDesC8& aData);
+        void HandlePrepareVideoRecordingCmdL(const TDesC8& aData);
+        void HandleStartVideoRecordingCmdL( const TDesC8& aData );
+        void HandlePausingVideoRecordingCmdL( const TDesC8& aData );
+        void HandleResumeVideoRecordingCmdL( const TDesC8& aData );
+        void HandleStopVideoRecordingCmdL( const TDesC8& aData );
+        void HandleCloseVideoRecordingCmdL( const TDesC8& aData );
+        void HandleGetZoomCmdL( const TDesC8& aData );
+        void HandleSetZoomCmdL( const TDesC8& aData );
+        
+        void SendOkMsgL( const TDesC8& aData );
+        void SendErrorMessageL( TInt aError, const TDesC8& aDescription );
+        
+        TInt ParseString( const TDesC8& aRequest,
+                                       TInt aOffset, TDes& aResult );
+
+    public:     // Data
+
+    protected:  // Data
+
+    private:    // Data
+        // Flag telling if the service is busy processing a message
+        TBool                   iIsBusy;
+        
+        TInt                    iError;
+        CEngineVideoRecording*  iVideoRecordingEngine;
+        CActiveSchedulerWait*   iWaiter;
+
+    };
+
+#endif      // HTICAMERASERVICEPLUGIN_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiServicePlugins/HtiCameraServicePlugin/src/HtiCameraServicePlugin.cpp	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,637 @@
+/*
+* 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 the ECom plugin for HTI camera
+*                service.
+*
+*/
+
+
+
+// INCLUDE FILES
+#include <HtiDispatcherInterface.h>
+#include <HtiLogging.h>
+
+
+#include "HtiCameraServicePlugin.h"
+
+// EXTERNAL DATA STRUCTURES
+
+// EXTERNAL FUNCTION PROTOTYPES
+
+// CONSTANTS
+
+// MACROS
+
+// LOCAL CONSTANTS AND MACROS
+const static TUid KCameraServiceUid = { 0x2002EA9E };
+
+
+
+// NOTE: Max length for error description is defined
+// in HtiDispatcherInterface.h (currently 118).
+
+_LIT8( KErrorNoCommand, "ERROR: No command given" );
+_LIT8( KErrorUnknownCmd, "ERROR: Unknown Camera Service command" );
+_LIT8( KErrorInitFailed, "ERROR: Failed to init");
+_LIT8( KErrorUninitialized, "ERROR: Uninitialized");
+_LIT8( KErrInvalidateParameters, "ERROR: Invalidate parameters");
+_LIT8( KErrQualityLevel, "ERROR: Invalidate quality level");
+_LIT8( KErrorPrepareVideoRecordingFailed, "ERROR: Prepare video recording failed");
+_LIT8( KErrorStartVideoRecordingFailed, "ERROR: Start video recording failed");
+_LIT8( KErrorPausingVideoRecordingFailed, "ERROR: Pausing video recording failed");
+_LIT8( KErrorResumeVideoRecordingFailed, "ERROR: Resume video recording failed");
+_LIT8( KErrorStopVideoRecordingFailed, "ERROR: Stop video recording failed");
+_LIT8( KErrorSetZoomModeFailed, "ERROR: Set zoom mode failed");
+_LIT8( KErrorSetZoomValueFailed, "ERROR: Set zoom value failed");
+
+// MODULE DATA STRUCTURES
+
+// LOCAL FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+// ============================= LOCAL FUNCTIONS ===============================
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CHtiCameraServicePlugin::CHtiCameraServicePlugin
+// C++ default constructor can NOT contain any code, that might leave.
+// -----------------------------------------------------------------------------
+//
+CHtiCameraServicePlugin::CHtiCameraServicePlugin():iIsBusy(EFalse), iError(0),
+        iVideoRecordingEngine(NULL), iWaiter(NULL)
+    {
+    }
+
+
+// -----------------------------------------------------------------------------
+// CHtiCameraServicePlugin::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CHtiCameraServicePlugin::ConstructL()
+    {
+    HTI_LOG_TEXT( "CHtiCameraServicePlugin::ConstructL" );
+    iWaiter = new ( ELeave ) CActiveSchedulerWait;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CHtiCameraServicePlugin::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CHtiCameraServicePlugin* CHtiCameraServicePlugin::NewL()
+    {
+    CHtiCameraServicePlugin* self = new (ELeave) CHtiCameraServicePlugin;
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop();
+    return self;
+    }
+
+
+// Destructor
+CHtiCameraServicePlugin::~CHtiCameraServicePlugin()
+    {
+    if(iVideoRecordingEngine)
+        {
+        delete iVideoRecordingEngine;
+        iVideoRecordingEngine = NULL;
+        }
+    
+    delete iWaiter;
+    iWaiter = NULL;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CHtiCameraServicePlugin::ProcessMessageL
+// -----------------------------------------------------------------------------
+//
+void CHtiCameraServicePlugin::ProcessMessageL( const TDesC8& aMessage,
+                                        THtiMessagePriority /*aPriority*/ )
+    {
+    HTI_LOG_FUNC_IN( "CHtiCameraServicePlugin::ProcessMessageL" );
+    HTI_LOG_FORMAT( "Message length = %d", aMessage.Length() );
+
+    if ( iIsBusy )
+        {
+        HTI_LOG_TEXT( "Plugin is busy - leaving" );
+        User::Leave( KErrInUse );
+        }
+
+    // Will be set to EFalse in the SendResponseMsg or SendErrorResponseMsg
+    // methods when the response has been successfully sent and the plugin is
+    // ready for next message.
+    iIsBusy = ETrue;
+
+    if ( aMessage.Length() < 1 )
+        {
+        SendErrorMessageL( KErrArgument, KErrorNoCommand );
+        return;
+        }
+    
+    TUint8 command = aMessage.Ptr()[0];
+    TInt err = KErrNone;
+
+    switch (command)
+        {
+        case ECmdInitialize:
+            TRAP(err, HandleInitializeCmdL(aMessage.Right( aMessage.Length() - 1 )));
+            break;
+        case ECmdUninitialize:
+            TRAP(err, HandleUninitializeCmdL(aMessage.Right( aMessage.Length() - 1 )));
+            break;
+        case ECmdPrepareVideoRecording:
+            TRAP(err, HandlePrepareVideoRecordingCmdL(aMessage.Right( aMessage.Length() - 1 )));
+            break;
+        case ECmdStartVideoRecording:
+            TRAP(err, HandleStartVideoRecordingCmdL(aMessage.Right( aMessage.Length() - 1 )));
+            break;
+        case ECmdPausingVideoRecording:
+            TRAP(err, HandlePausingVideoRecordingCmdL(aMessage.Right( aMessage.Length() - 1 )));
+            break;
+        case ECmdResumeVideoRecording:
+            TRAP(err, HandleResumeVideoRecordingCmdL(aMessage.Right( aMessage.Length() - 1 )));
+            break;
+        case ECmdStopVideoRecording:
+            TRAP(err, HandleStopVideoRecordingCmdL(aMessage.Right( aMessage.Length() - 1 )));
+            break;
+        case ECmdCloseVideoRecording:
+            TRAP(err, HandleCloseVideoRecordingCmdL(aMessage.Right( aMessage.Length() - 1 )));
+            break;
+        case ECmdGetZoom:
+            TRAP(err, HandleGetZoomCmdL(aMessage.Right( aMessage.Length() - 1 )));
+            break;
+        case ECmdSetZoom:
+            TRAP(err, HandleSetZoomCmdL(aMessage.Right( aMessage.Length() - 1 )));
+            break;
+        default:
+            TRAP(err, SendErrorMessageL(KErrArgument, KErrorUnknownCmd));
+            break;
+        }
+    
+    if(err != KErrNone)
+        {
+        iIsBusy = EFalse;
+        User::Leave( err );
+        }
+
+    HTI_LOG_FUNC_OUT( "CHtiCameraServicePlugin::ProcessMessageL" );
+    }
+
+void CHtiCameraServicePlugin::HandleInitializeCmdL( const TDesC8& aData )
+    {
+    HTI_LOG_FUNC_IN( "CHtiCameraServicePlugin::HandleInitializeCmdL" );
+    if(aData.Length() != 0)
+        {
+        SendErrorMessageL(KErrArgument, KErrInvalidateParameters);
+        return;
+        }
+    
+    HTI_LOG_TEXT("Initializes Camera Application Engine");
+    if(iVideoRecordingEngine)
+        {
+        delete iVideoRecordingEngine;
+        iVideoRecordingEngine = NULL;
+        }
+    
+    iVideoRecordingEngine = CEngineVideoRecording::NewL(*this, 0);
+    iVideoRecordingEngine->InitL();
+    iWaiter->Start();
+    if(iError != KErrNone)
+        {
+        SendErrorMessageL(iError, KErrorInitFailed);
+        }
+    else
+        {
+        HTI_LOG_TEXT("Initializes video recording");
+        iVideoRecordingEngine->InitVideoRecorderL();
+        
+        SendOkMsgL(KNullDesC8);
+        }
+
+    HTI_LOG_FUNC_OUT( "CHtiCameraServicePlugin::HandleInitializeCmdL" );
+    }
+
+void CHtiCameraServicePlugin::HandleUninitializeCmdL(const TDesC8& aData)
+    {
+    HTI_LOG_FUNC_IN( "CHtiCameraServicePlugin::HandleUninitializeCmdL" );
+    if(aData.Length() != 0)
+        {
+        SendErrorMessageL(KErrArgument, KErrInvalidateParameters);
+        return;
+        }
+    
+    if(iVideoRecordingEngine == NULL)
+        {
+        SendErrorMessageL(KErrNotReady, KErrorUninitialized);
+        return;
+        }
+    
+    delete iVideoRecordingEngine;
+    iVideoRecordingEngine = NULL;
+    
+    SendOkMsgL(KNullDesC8);
+    HTI_LOG_FUNC_OUT( "CHtiCameraServicePlugin::HandleUninitializeCmdL" );
+    }
+
+void CHtiCameraServicePlugin::HandlePrepareVideoRecordingCmdL( const TDesC8& aData )
+    {
+    HTI_LOG_FUNC_IN( "CHtiCameraServicePlugin::HandlePrepareVideoRecordingCmdL" );
+    if(aData.Length() < 2 || aData[1] != aData.Length() -2)
+        {
+        SendErrorMessageL(KErrArgument, KErrInvalidateParameters);
+        return;
+        }
+    
+    if(iVideoRecordingEngine == NULL)
+        {
+        SendErrorMessageL(KErrNotReady, KErrorUninitialized);
+        return;
+        }
+    
+    TInt qualityLevelIndex = aData[0];
+    if(qualityLevelIndex < 0 || qualityLevelIndex > iVideoRecordingEngine->VideoQualityCount() -1)
+        {
+        SendErrorMessageL(KErrOverflow, KErrQualityLevel);
+        return;
+        }
+    
+    TBuf<255> filePath;
+    TInt nextOffset = ParseString( aData, 1, filePath );
+    if ( filePath.Length() < 1 || nextOffset < 0 )
+        {
+        SendErrorMessageL(KErrArgument, KErrInvalidateParameters);
+        return;
+        }
+    
+    HTI_LOG_FORMAT("Set video recording file name: %S", &filePath);
+    iVideoRecordingEngine->SetVideoRecordingFileNameL(filePath);
+    
+    HTI_LOG_FORMAT("Prepare video recording with quality level index: %d", qualityLevelIndex);
+    iVideoRecordingEngine->PrepareVideoRecordingL(qualityLevelIndex);
+    
+    iWaiter->Start();
+    if(iError != KErrNone)
+        {
+        SendErrorMessageL(iError, KErrorPrepareVideoRecordingFailed);
+        }
+    else
+        {
+        SendOkMsgL(KNullDesC8);
+        }
+    
+     HTI_LOG_FUNC_OUT( "CHtiCameraServicePlugin::HandlePrepareVideoRecordingCmdL" );
+    }
+
+void CHtiCameraServicePlugin::HandleStartVideoRecordingCmdL( const TDesC8& aData )
+    {
+    HTI_LOG_FUNC_IN( "CHtiCameraServicePlugin::HandleStartVideoRecordingCmdL" );
+    if(aData.Length() != 0)
+        {
+        SendErrorMessageL(KErrArgument, KErrInvalidateParameters);
+        return;
+        }
+    
+    if(iVideoRecordingEngine == NULL)
+        {
+        SendErrorMessageL(KErrNotReady, KErrorUninitialized);
+        return;
+        }
+    
+    HTI_LOG_TEXT("Start video recording...");
+    iVideoRecordingEngine->StartVideoRecording();
+    
+    if(iError != KErrNone)
+        {
+        SendErrorMessageL(iError, KErrorStartVideoRecordingFailed);
+        }
+    else
+        {
+        SendOkMsgL(KNullDesC8);
+        }
+
+    HTI_LOG_FUNC_OUT( "CHtiCameraServicePlugin::HandleStartVideoRecordingCmdL" );
+    }
+
+void CHtiCameraServicePlugin::HandlePausingVideoRecordingCmdL( const TDesC8& aData )
+    {
+    HTI_LOG_FUNC_IN( "CHtiCameraServicePlugin::HandlePausingVideoRecordingCmdL" );
+    if(aData.Length() != 0)
+        {
+        SendErrorMessageL(KErrArgument, KErrInvalidateParameters);
+        return;
+        }
+    
+    if(iVideoRecordingEngine == NULL)
+        {
+        SendErrorMessageL(KErrNotReady, KErrorUninitialized);
+        return;
+        }
+    
+    HTI_LOG_TEXT("Pausing video recording");
+    iVideoRecordingEngine->PauseVideoRecording();
+    if(iError != KErrNone)
+        {
+        SendErrorMessageL(iError, KErrorPausingVideoRecordingFailed);
+        }
+    else
+        {
+        SendOkMsgL(KNullDesC8);
+        }
+    HTI_LOG_FUNC_OUT( "CHtiCameraServicePlugin::HandlePausingVideoRecordingCmdL" );
+    }
+
+void CHtiCameraServicePlugin::HandleResumeVideoRecordingCmdL( const TDesC8& aData )
+    {
+    HTI_LOG_FUNC_IN( "CHtiCameraServicePlugin::HandleResumeVideoRecordingCmdL" );
+    if(aData.Length() != 0)
+        {
+        SendErrorMessageL(KErrArgument, KErrInvalidateParameters);
+        return;
+        }
+    
+    if(iVideoRecordingEngine == NULL)
+        {
+        SendErrorMessageL(KErrNotReady, KErrorUninitialized);
+        return;
+        }
+    
+    HTI_LOG_TEXT("Resume video recording...");
+    iVideoRecordingEngine->ResumeVideoRecording();
+    
+    if(iError != KErrNone)
+        {
+        SendErrorMessageL(iError, KErrorResumeVideoRecordingFailed);
+        }
+    else
+        {
+        SendOkMsgL(KNullDesC8);
+        }
+    HTI_LOG_FUNC_OUT( "CHtiCameraServicePlugin::HandleResumeVideoRecordingCmdL" );
+    }
+
+void CHtiCameraServicePlugin::HandleStopVideoRecordingCmdL( const TDesC8& aData )    
+    {
+    HTI_LOG_FUNC_IN( "CHtiCameraServicePlugin::HandleStopVideoRecordingCmdL" );
+    if(aData.Length() != 0)
+        {
+        SendErrorMessageL(KErrArgument, KErrInvalidateParameters);
+        return;
+        }
+    
+    if(iVideoRecordingEngine == NULL)
+        {
+        SendErrorMessageL(KErrNotReady, KErrorUninitialized);
+        return;
+        }
+    
+    HTI_LOG_TEXT("Stop video recording");
+    iVideoRecordingEngine->StopVideoRecording();
+    if(iError != KErrNone)
+        {
+        SendErrorMessageL(iError, KErrorStopVideoRecordingFailed);
+        }
+    else
+        {
+        SendOkMsgL(KNullDesC8);
+        }
+    HTI_LOG_FUNC_OUT( "CHtiCameraServicePlugin::HandleStopVideoRecordingCmdL" );
+    }
+
+void CHtiCameraServicePlugin::HandleCloseVideoRecordingCmdL( const TDesC8& aData )
+    {
+    HTI_LOG_FUNC_IN( "CHtiCameraServicePlugin::HandleCloseVideoRecordingCmdL" );
+    if(aData.Length() != 0)
+        {
+        SendErrorMessageL(KErrArgument, KErrInvalidateParameters);
+        return;
+        }
+    
+    if(iVideoRecordingEngine == NULL)
+        {
+        SendErrorMessageL(KErrNotReady, KErrorUninitialized);
+        return;
+        }
+    
+    HTI_LOG_TEXT("Close video recording");
+    iVideoRecordingEngine->CloseVideoRecording();
+    SendOkMsgL(KNullDesC8);
+    HTI_LOG_FUNC_OUT( "CHtiCameraServicePlugin::HandleCloseVideoRecordingCmdL" );
+    }
+
+void CHtiCameraServicePlugin::HandleGetZoomCmdL( const TDesC8& aData )
+    {
+    HTI_LOG_FUNC_IN( "CHtiCameraServicePlugin::HandleGetZoomCmdL" );
+    if(aData.Length() != 0)
+        {
+        SendErrorMessageL(KErrArgument, KErrInvalidateParameters);
+        return;
+        }
+    
+    if(iVideoRecordingEngine == NULL)
+        {
+        SendErrorMessageL(KErrNotReady, KErrorUninitialized);
+        return;
+        }
+    
+    TUint8 zoomMode = (TUint8)iVideoRecordingEngine->ZoomMode();
+    HTI_LOG_FORMAT("Current zoom mode: %d", zoomMode);
+    
+    TUint32 zoomValue = iVideoRecordingEngine->ZoomValue();
+    HTI_LOG_FORMAT("Current zoom value: %d", zoomValue);
+    
+    TUint32 zoomMinValue = iVideoRecordingEngine->MinZoomValue();
+    HTI_LOG_FORMAT("Min zoom value: %d", zoomMinValue);
+    
+    TUint32 zoomMaxValue = iVideoRecordingEngine->MaxZoomValue();
+    HTI_LOG_FORMAT("Max zoom value: %d", zoomMaxValue);
+    
+    TBuf8<13> buf;
+    buf.Append(zoomMode);
+    buf.Append((TUint8*)&zoomValue, 4);
+    buf.Append((TUint8*)&zoomMinValue, 4);
+    buf.Append((TUint8*)&zoomMaxValue, 4);
+    SendOkMsgL( buf );
+
+    HTI_LOG_FUNC_OUT( "CHtiCameraServicePlugin::HandleGetZoomCmdL" );
+    }
+
+void CHtiCameraServicePlugin::HandleSetZoomCmdL( const TDesC8& aData )
+    {
+    HTI_LOG_FUNC_IN( "CHtiCameraServicePlugin::HandleSetZoomCmdL" );
+    if(aData.Length() != 5)
+        {
+        SendErrorMessageL(KErrArgument, KErrInvalidateParameters);
+        return;
+        }
+    
+    if(iVideoRecordingEngine == NULL)
+        {
+        SendErrorMessageL(KErrNotReady, KErrorUninitialized);
+        return;
+        }
+    
+    CEngineVideoRecording::TZoomMode zoomMode = (CEngineVideoRecording::TZoomMode)aData[0];
+    HTI_LOG_FORMAT("Set zoom mode: %d", zoomMode);
+    TRAPD(err, iVideoRecordingEngine->SetZoomModeL(zoomMode));
+    if(err != KErrNone)
+        {
+        SendErrorMessageL(err, KErrorSetZoomModeFailed);
+        }
+    else
+        {
+        TInt value = aData[1] + ( aData[2] << 8 )
+                + ( aData[3] << 16 )
+                + ( aData[4] << 24 );
+        HTI_LOG_FORMAT("Set zoom value: %d", value);
+        TRAPD(err, iVideoRecordingEngine->SetZoomValueL(value));
+        if(err != KErrNone)
+            {
+            SendErrorMessageL(err, KErrorSetZoomValueFailed);
+            }
+        else
+            {
+            SendOkMsgL(KNullDesC8);
+            }
+        }
+    
+    HTI_LOG_FUNC_OUT( "CHtiCameraServicePlugin::HandleSetZoomCmdL" );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CHtiCameraServicePlugin::IsBusy
+// -----------------------------------------------------------------------------
+//
+TBool CHtiCameraServicePlugin::IsBusy()
+    {
+    return iIsBusy;
+    }
+
+
+// ----------------------------------------------------------------------------
+void CHtiCameraServicePlugin::SendOkMsgL( const TDesC8& aData )
+    {
+    HTI_LOG_FUNC_IN( "CHtiCameraServicePlugin::SendOkMsgL: Starting" );
+
+    User::LeaveIfNull( iDispatcher );
+
+    HBufC8* temp = HBufC8::NewL( aData.Length() + 1 );
+    TPtr8 response = temp->Des();
+    response.Append( ( TChar ) EResultOk );
+    response.Append( aData );
+    User::LeaveIfError( iDispatcher->DispatchOutgoingMessage(
+        temp, KCameraServiceUid ) );
+    iIsBusy = EFalse;
+    HTI_LOG_FUNC_OUT( "CHtiCameraServicePlugin::SendOkMsgL: Done" );
+    }
+
+// ----------------------------------------------------------------------------
+void CHtiCameraServicePlugin::SendErrorMessageL( TInt aError, const TDesC8& aDescription )
+    {
+    HTI_LOG_FUNC_IN( "CHtiCameraServicePlugin::SendErrorMessageL: Starting" );
+    User::LeaveIfNull( iDispatcher );
+    User::LeaveIfError( iDispatcher->DispatchOutgoingErrorMessage(
+        aError, aDescription, KCameraServiceUid ) );
+    iIsBusy = EFalse;
+    HTI_LOG_FUNC_OUT( "CHtiCameraServicePlugin::SendErrorMessageL: Done" );
+    }
+
+TInt CHtiCameraServicePlugin::ParseString( const TDesC8& aRequest,
+                                          TInt aOffset,
+                                          TDes& aResult )
+    {
+    HTI_LOG_FUNC_IN( "CHtiCameraServicePlugin::ParseString" );
+
+    // If offset outside the string return empty string
+    if ( aOffset >= aRequest.Size() )
+        {
+        return aOffset;
+        }
+
+    TInt length = aRequest[aOffset];
+    HTI_LOG_FORMAT( "String length = %d", length );
+
+    // If length is zero return empty string
+    if ( length < 1 )
+        {
+        return aOffset + 1;
+        }
+
+    if ( length > aResult.MaxLength() )
+        {
+        return KErrBadDescriptor;
+        }
+
+    TInt nextOffset = length + aOffset + 1;
+    HTI_LOG_FORMAT( "Next offset = %d", nextOffset );
+    HTI_LOG_FORMAT( "Request size = %d", aRequest.Size() );
+
+    if ( nextOffset > aRequest.Size() )
+        {
+        return KErrArgument;
+        }
+
+    aResult.Copy( aRequest.Mid( aOffset + 1, length ) );
+
+    HTI_LOG_FUNC_OUT( "CHtiCameraServicePlugin::ParseString" );
+    return nextOffset;
+    }
+
+void CHtiCameraServicePlugin::MevroInitComplete( TInt aError )
+    {
+    HTI_LOG_FUNC_IN( "CHtiCameraServicePlugin::MevroInitComplete" );
+    HTI_LOG_FORMAT("aError = %d", aError);
+    iError = aError; 
+    iWaiter->AsyncStop();
+    HTI_LOG_FUNC_OUT( "CHtiCameraServicePlugin::MevroInitComplete" );
+    }
+
+void CHtiCameraServicePlugin::MevroVideoPrepareComplete(TInt aError)
+    {
+    HTI_LOG_FUNC_IN( "CHtiCameraServicePlugin::MevroVideoPrepareComplete" );
+    HTI_LOG_FORMAT("aError = %d", aError);
+    iError = aError;
+    iWaiter->AsyncStop();
+    HTI_LOG_FUNC_OUT( "CHtiCameraServicePlugin::MevroVideoPrepareComplete" );
+    }
+
+void CHtiCameraServicePlugin::MevroVideoRecordingOn(TInt aError)
+    {
+    HTI_LOG_FUNC_IN( "CHtiCameraServicePlugin::MevroVideoRecordingOn" );
+    HTI_LOG_FORMAT("aError = %d", aError);
+    iError = aError;
+    HTI_LOG_FUNC_OUT( "CHtiCameraServicePlugin::MevroVideoRecordingOn" );
+    }
+
+void CHtiCameraServicePlugin::MevroVideoRecordingPaused(TInt aError)
+    {
+    HTI_LOG_FUNC_IN( "CHtiCameraServicePlugin::MevroVideoRecordingPaused" );
+    HTI_LOG_FORMAT("aError = %d", aError);
+    iError = aError;
+    HTI_LOG_FUNC_OUT( "CHtiCameraServicePlugin::MevroVideoRecordingPaused" );
+    }
+
+void CHtiCameraServicePlugin::MevroVideoRecordingComplete(TInt aError)
+    {
+    HTI_LOG_FUNC_IN( "CHtiCameraServicePlugin::MevroVideoRecordingComplete" );
+    HTI_LOG_FORMAT("aError = %d", aError);
+    iError = aError;
+    HTI_LOG_FUNC_OUT( "CHtiCameraServicePlugin::MevroVideoRecordingComplete" );
+    }
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiServicePlugins/HtiCameraServicePlugin/src/proxy.cpp	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,35 @@
+/*
+* 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 proxy for the ECom plugin.
+*
+*/
+
+
+
+// INCLUDE FILES
+#include <e32std.h>
+#include <ecom/implementationproxy.h>
+#include "HtiCameraServicePlugin.h"
+
+const TImplementationProxy ImplementationTable[] =
+    {
+        IMPLEMENTATION_PROXY_ENTRY( 0x2002EA9E, CHtiCameraServicePlugin::NewL )
+    };
+
+// Function used to return an instance of the proxy table.
+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/htiui/HtiServicePlugins/HtiFtpBackupFake/bwins/HtiFtpBackupFakeu.def	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,3 @@
+EXPORTS
+	?NewHtiFtpBackupFake@@YAPAVCHtiFtpBackupFake@@XZ @ 1 NONAME ; class CHtiFtpBackupFake * NewHtiFtpBackupFake(void)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiServicePlugins/HtiFtpBackupFake/eabi/HtiFtpBackupFakeu.def	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,3 @@
+EXPORTS
+	_Z19NewHtiFtpBackupFakev @ 1 NONAME
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiServicePlugins/HtiFtpBackupFake/group/HtiFtpBackupFake.mmp	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,45 @@
+/*
+* 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 description file for HtiFtpBackupFake
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+TARGET          HtiFtpBackupFake.dll
+TARGETTYPE      DLL
+
+// HtiFtpBackupFakeInterface UID followed by the unique UID for this DLL
+UID             0x20022D5F 0x20022D60
+
+VENDORID        0x101FB657
+
+CAPABILITY      ALL -TCB
+
+SOURCEPATH      ../src
+SOURCE          HtiFtpBackupFake.cpp
+
+USERINCLUDE     ../inc
+APP_LAYER_SYSTEMINCLUDE
+SYSTEMINCLUDE   /epoc32/include/connect
+
+LIBRARY         euser.lib
+LIBRARY         efsrv.lib
+LIBRARY         sbeclient.lib
+LIBRARY         flogger.lib
+
+SMPSAFE
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiServicePlugins/HtiFtpBackupFake/group/bld.inf	Wed Aug 25 15:45:01 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:  Build information file for HtiFtpBackupFake
+*
+*/
+
+
+PRJ_PLATFORMS
+
+PRJ_EXPORTS
+
+PRJ_MMPFILES
+HtiFtpBackupFake.mmp
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiServicePlugins/HtiFtpBackupFake/inc/HtiFtpBackupFake.h	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,64 @@
+/*
+* 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:  Definition of the CHtiFtpBackupFake class.
+*
+*/
+
+
+#ifndef __HTIFTPBACKUPFAKE_H
+#define __HTIFTPBACKUPFAKE_H
+
+//  INCLUDES
+#include <e32std.h>
+#include <f32file.h>
+#include <connect/sbeclient.h>
+#include <HtiFtpBackupFakeBase.h>
+
+using namespace conn;
+
+// CONSTANTS
+
+// MACROS
+
+// DATA TYPES
+
+// FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+// CLASS DECLARATION
+
+/**
+* Definition of the class implementing the CHtiFtpBackupFakeBase
+*/
+NONSHARABLE_CLASS( CHtiFtpBackupFake ) : public CHtiFtpBackupFakeBase
+    {
+    public:
+        // constructor support
+        virtual void ConstructL( RFs* aFs );
+
+        // destructor
+        virtual ~CHtiFtpBackupFake();
+
+    public: // from CHtiFtpBackupFakeBase
+        virtual TInt ActivateBackup();
+        virtual TInt DeactivateBackup();
+
+    private:
+        CSBEClient* iSBEClient; // owned
+    };
+
+#endif // __HTIFTPBACKUPFAKE_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiServicePlugins/HtiFtpBackupFake/src/HtiFtpBackupFake.cpp	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,143 @@
+/*
+* 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:  CHtiFtpBackupFake implementation
+*
+*/
+
+
+// INCLUDE FILES
+#include "HtiFtpBackupFake.h"
+#include <HtiLogging.h>
+
+// CONSTANTS
+
+// LOCAL CONSTANTS AND MACROS
+
+// MODULE DATA STRUCTURES
+
+// LOCAL FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+
+// ============================= LOCAL FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CHtiFtpBackupFake* NewHtiFtpBackupFake()
+// Function to construct the CHtiFtpBackupFakeBase derived object.
+// Exported at ordinal 1 and not a member of the class.
+// -----------------------------------------------------------------------------
+EXPORT_C CHtiFtpBackupFake* NewHtiFtpBackupFake()
+    {
+    return new ( ELeave ) CHtiFtpBackupFake();
+    }
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CHtiFtpBackupFake::ConstructL
+// -----------------------------------------------------------------------------
+void CHtiFtpBackupFake::ConstructL( RFs* aFs )
+    {
+    HTI_LOG_FUNC_IN( "CHtiFtpBackupFake::ConstructL" );
+    iFs = aFs;
+    iSBEClient = NULL;
+    HTI_LOG_FUNC_OUT( "CHtiFtpBackupFake::ConstructL" );
+    }
+
+// -----------------------------------------------------------------------------
+// CHtiFtpBackupFake::~CHtiFtpBackupFake()
+// -----------------------------------------------------------------------------
+CHtiFtpBackupFake::~CHtiFtpBackupFake()
+    {
+    HTI_LOG_FUNC_IN( "CHtiFtpBackupFake::~CHtiFtpBackupFake" );
+    if ( iSBEClient )
+        {
+        DeactivateBackup(); // will delete iSBEClient
+        }
+    delete iSBEClient;  // just to be sure
+    iSBEClient = NULL;
+    iFs = NULL; // iFs is not owned
+    HTI_LOG_FUNC_OUT( "CHtiFtpBackupFake::~CHtiFtpBackupFake" );
+    }
+
+// -----------------------------------------------------------------------------
+// CHtiFtpBackupFake::ActivateBackup()
+// Activates the backup operation if isn't already active.
+// -----------------------------------------------------------------------------
+TInt CHtiFtpBackupFake::ActivateBackup()
+    {
+    HTI_LOG_FUNC_IN( "CHtiFtpBackupFake::ActivateBackup" );
+    TInt err = KErrNone;
+    if ( iSBEClient )
+        {
+        err = KErrAlreadyExists; // Backup already active
+        }
+    else
+        {
+        HTI_LOG_TEXT( "Activating backup" );
+        TDriveList drives;
+        err = iFs->DriveList( drives );
+        if ( !err )
+            {
+            TRAP( err, iSBEClient = CSBEClient::NewL() );
+            if ( !err )
+                {
+                TRAP( err, iSBEClient->SetBURModeL(
+                    drives, EBURBackupFull, EBackupBase ) );
+                HTI_LOG_FORMAT( "CSBEClient::SetBURModeL returned %d", err );
+                if ( !err )
+                    {
+                    User::After( 1000000 ); // wait for the backup to activate
+                    }
+                }
+            }
+        }
+    HTI_LOG_FUNC_OUT( "CHtiFtpBackupFake::ActivateBackup" );
+    return err;
+    }
+
+// -----------------------------------------------------------------------------
+// CHtiFtpBackupFake::DeactivateBackup()
+// Deactivates the backup operation if it's active.
+// -----------------------------------------------------------------------------
+TInt CHtiFtpBackupFake::DeactivateBackup()
+    {
+    HTI_LOG_FUNC_IN( "CHtiFtpBackupFake::DeactivateBackup" );
+    TInt err = KErrNone;
+
+    if ( !iSBEClient )
+        {
+        err = KErrNotReady; // Backup not active
+        }
+    else
+        {
+        HTI_LOG_TEXT( "Deactivating Backup" );
+        TDriveList drives;
+        err = iFs->DriveList( drives );
+        if ( !err )
+            {
+            TRAP( err, iSBEClient->SetBURModeL(
+                drives, EBURNormal, ENoBackup ) );
+            HTI_LOG_FORMAT( "CSBEClient::SetBURModeL returned %d", err );
+            }
+        delete iSBEClient;
+        iSBEClient = NULL;
+        }
+
+    HTI_LOG_FUNC_OUT( "CHtiFtpBackupFake::DeactivateBackup" );
+    return err;
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiServicePlugins/HtiKeyEventServicePlugin/data/1020DEC0.rss	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,49 @@
+/*
+* 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:  Resource definitions for key event service ECOM plugin.
+*
+*/
+
+
+// INCLUDES
+#include <ecom/registryinfo.rh>
+
+
+//  RESOURCE DEFINITIONS
+RESOURCE REGISTRY_INFO theInfo
+    {
+    // UID for the DLL
+    dll_uid = 0x1020DEC0;
+    // Declare array of interface info
+    interfaces =
+        {
+        INTERFACE_INFO
+            {
+            // UID of interface that is implemented
+            interface_uid = 0x1020DEB7;
+            implementations =
+                {
+                IMPLEMENTATION_INFO
+                    {
+                    implementation_uid = 0x1020DEC1;
+                    version_no         = 1;
+                    display_name       = "Key event service";
+                    default_data       = "KEYEVENT";
+                    opaque_data        = "";
+                    }
+                };
+            }
+        };
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiServicePlugins/HtiKeyEventServicePlugin/group/HtiKeyEventServicePlugin.mmp	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,56 @@
+/*
+* 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 implementation of key event service
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+TARGET          HtiKeyEventServicePlugin.dll
+TARGETTYPE      PLUGIN
+
+// ECom Dll recognition UID followed by the unique UID for this dll
+UID             0x10009D8D 0x1020DEC0
+
+VENDORID        0x101FB657
+
+CAPABILITY      ALL -TCB
+
+SOURCEPATH      ../src
+SOURCE          proxy.cpp
+SOURCE          HtiKeyEventServicePlugin.cpp
+SOURCE          KeyEventHandler.cpp
+SOURCE          PointerEventHandler.cpp
+SOURCE			MultiTouchPointerEventHandler.cpp MultiTouchPointerEvent.cpp
+
+USERINCLUDE     ../inc
+APP_LAYER_SYSTEMINCLUDE
+
+START RESOURCE  ../data/1020DEC0.rss
+TARGET          HtiKeyEventServicePlugin.rsc
+END
+
+LIBRARY         apgrfx.lib
+LIBRARY         centralrepository.lib
+LIBRARY         cenrepnotifhandler.lib
+LIBRARY         ecom.lib
+LIBRARY         euser.lib
+LIBRARY         ws32.lib
+LIBRARY         flogger.lib
+LIBRARY         hal.lib
+
+SMPSAFE
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiServicePlugins/HtiKeyEventServicePlugin/group/bld.inf	Wed Aug 25 15:45:01 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:  Build info for HtiKeyEventServicePlugin
+*
+*/
+
+
+PRJ_PLATFORMS
+
+PRJ_EXPORTS
+
+PRJ_MMPFILES
+HtiKeyEventServicePlugin.mmp
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiServicePlugins/HtiKeyEventServicePlugin/inc/HtiKeyEventServicePlugin.h	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,77 @@
+/*
+* 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 ECOM plug-in service interface. Provides
+*                key event service.
+*
+*/
+
+
+#ifndef CHTIKEYEVENTSERVICEPLUGIN_H
+#define CHTIKEYEVENTSERVICEPLUGIN_H
+
+// INCLUDES
+#include <HtiServicePluginInterface.h>
+#include <w32std.h>
+#include <centralrepository.h>
+#include <cenrepnotifyhandler.h>
+
+
+// CONSTANTS
+const TInt KKeyEventServiceUidValue = 0x1020DEC1; // ECOM Implementation UID
+const TUid KKeyEventServiceUid = { KKeyEventServiceUidValue };
+
+// FORWARD DECLARATIONS
+class CKeyEventHandler;
+class CPointerEventHandler;
+
+// CLASS DECLARATION
+
+/**
+* Implementation of ECOM plug-in service interface.
+*/
+class CHtiKeyEventServicePlugin : public CHTIServicePluginInterface
+                                 ,public MCenRepNotifyHandlerCallback
+    {
+public:
+
+    static CHtiKeyEventServicePlugin* NewL();
+
+    // Interface implementation
+    void ProcessMessageL( const TDesC8& aMessage,
+        THtiMessagePriority aPriority );
+
+protected:
+
+    CHtiKeyEventServicePlugin();
+    void ConstructL();
+
+    virtual ~CHtiKeyEventServicePlugin();
+
+    // from MCenRepNotifyHandlerCallback
+    void HandleNotifyInt( TUint32 aId, TInt aNewValue );
+    void HandleNotifyError( TUint32 aId, TInt error,
+            CCenRepNotifyHandler* aHandler );
+
+private:
+
+    CKeyEventHandler* iKeyHandler;
+    CPointerEventHandler* iPointerHandler;
+
+    TInt iLightTimeout;
+    CRepository* iCenRepSession;
+    CCenRepNotifyHandler* iLightTimeoutSettingHandler;
+    };
+
+#endif // CHTIKEYEVENTSERVICEPLUGIN_H
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiServicePlugins/HtiKeyEventServicePlugin/inc/KeyEventHandler.h	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,118 @@
+/*
+* 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:  Functional implentation of key event service.
+*
+*/
+
+
+#ifndef CKEYEVENTHANDLER_H
+#define CKEYEVENTHANDLER_H
+
+
+// INCLUDES
+#include <HtiServicePluginInterface.h>
+#include <w32std.h>
+
+// CONSTANTS
+
+// CLASS DECLARATION
+
+/**
+*  Functional implentation of key event service.
+*/
+class CKeyEventHandler : public CActive
+    {
+public:
+
+    static CKeyEventHandler* NewL();
+
+    // Interface implementation
+    void ProcessMessageL( const TDesC8& aMessage,
+        THtiMessagePriority aPriority );
+
+    virtual ~CKeyEventHandler();
+
+    void SetDispatcher( MHtiDispatcher* aDispatcher );
+
+    enum TError
+        {
+        EMissingCommand          = 0x01,
+        EUnrecognizedCommand     = 0x02,
+        ENotReadyCommand         = 0x03,
+        EInvalidScancode         = 0x80,
+        EEmptyUnicodeCharArray   = 0x90,
+        EInvalidUnicodeCharArray = 0x91
+        };
+
+    enum TCommand
+        {
+        EPressKey         = 0x01,
+        EKeyDown          = 0x02,
+        EKeyUp            = 0x03,
+        ETypeText         = 0x04,
+        ELongKeyPress     = 0x05,
+        ETypeTextPassword = 0x06,
+        EPressKeySequence = 0x07,
+        EPointer          = 0x10,
+        EResultOk = 0xFF // only for response message
+        };
+
+protected:
+
+    void RunL();
+    TInt RunError(TInt aError);
+    void DoCancel();
+
+private:
+
+    CKeyEventHandler();
+    void ConstructL();
+
+private: // helpers
+
+    void HandleTypeTextFuncL( const TDesC8& aUnicodeChars );
+    void HandleKeyboardFuncL( const TDesC8& aData );
+    void HandleLongKeyPressFuncL( const TDesC8& aData );
+    void HandlePressKeySequenceFuncL( const TDesC8& aData );
+
+    void SendOkMsgL();
+    void SendErrorMessageL( TInt aError, const TDesC8& aDescription );
+
+    void TypeTextWithDelay( TInt aNextIndex );
+    void SimulateKeyEventL( const TDesC8& aUnicodeChars, TInt aIndex );
+    void PressKeySequenceKeyL();
+
+    void KeyUp( TUint aCode );
+    void KeyDown( TUint aCode );
+
+private:
+
+    RWsSession iWsSession;
+    MHtiDispatcher* iDispatcher; // referenced
+
+    // Typetext specialities:
+    RTimer  iTimer;
+    TInt    iFocusedWindowGroup;
+    HBufC8* iUnicodeChars;
+    TInt    iUnicodeCharIndex;
+
+    TBool                           iReady;
+    TUint8                          iCommand;
+    TUint                           iHoldingScanCode;
+    TTimeIntervalMicroSeconds32     iKeySequenceHoldTime;
+    TTimeIntervalMicroSeconds32     iKeySequenceInterval;
+    TBool                           iHoldingKey;
+    };
+
+#endif // CKEYEVENTHANDLER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiServicePlugins/HtiKeyEventServicePlugin/inc/MultiTouchPointerEvent.h	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,132 @@
+/*
+* 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:  Functional implementation of one touch(pointer sequence) event service.
+*
+*/
+
+#ifndef CMULTITOUCHPOINTER_UNIT_H
+#define CMULTITOUCHPOINTER_UNIT_H
+
+// INCLUDES
+#include <HtiServicePluginInterface.h>
+#include <w32std.h>
+
+// CONSTANTS
+
+// MACROS
+
+// DATA TYPES
+
+// FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+// CLASS DECLARATION
+class CMultiTouchPointerEventHandler;
+
+/**
+*  Functional implentation of pointer event service.
+*/
+class CMultiTouchPointerEvent : public CActive
+    {
+    public:
+
+        /**
+        * Two-phased constructor.
+        */
+        static CMultiTouchPointerEvent* NewL(TUint8 aTouchNumber,
+                CMultiTouchPointerEventHandler* aEventHandler);
+
+        /**
+        * Destructor.
+        */
+        virtual ~CMultiTouchPointerEvent();       
+
+
+        /**
+         * Touch active object start function
+         * @param aDelayTime initial wait time to start "finger" down for touch
+         */
+        void StartTouch();
+        
+        void AddPointL(TTimeIntervalMicroSeconds32 aTime,
+        		TInt aX, TInt aY, TInt aZ, TRawEvent::TType aEventType);
+        
+        void PrintInfo();
+        
+        /**
+         * Insert a dragging event between two given pointers
+         * Interpolate pointer sequence with step aStepCount and dragging time.
+         * @param aX1, aY1, aZ1 3D coordinate of start point
+         * @param aX2, aY2, aZ2 3D coordinate of end point
+         * @param aDragTime dragging time between start point and end point
+         * @param aStepCount step count between two points
+         */
+        void InterpolatePointL(TInt aX1,TInt aY1, TInt aZ1, TInt aX2,TInt aY2, TInt aZ2, 
+                TTimeIntervalMicroSeconds32 aDragTime, TInt aStepCount);
+        
+    protected: // Functions from base classes
+
+        // From CActive
+        void RunL();
+        TInt RunError(TInt aError);
+        void DoCancel();
+
+    private:
+
+        /**
+        * C++ default constructor.
+        */
+        CMultiTouchPointerEvent(TUint8 aTouchNumber, CMultiTouchPointerEventHandler* aEventHandler);
+
+        /**
+        * 2nd phase constructor.
+        */
+        void ConstructL();
+
+        void  SimulatePointerEvent();
+        
+        /**
+         * Insert an advanced pointer to pointer sequence array for a touch
+         * @param aX, aY, aZ pointer 3D coordinate
+         * @param aEventType event type
+         */
+        void InsertPointArrayL(TInt aX, TInt aY, TInt aZ, TRawEvent::TType aEventType);
+
+        /**
+         * Insert time duration to time array
+         * @param aDelayTime time duation to wait for
+         */
+        void InsertTimeArrayL(TTimeIntervalMicroSeconds32 aDelayTime); 
+        
+    private: // data
+
+        struct TAdvancedPointer
+            {
+            TInt             X;
+            TInt             Y;
+            TInt             Z; 
+            TRawEvent::TType EventType;
+            };  
+        
+        CMultiTouchPointerEventHandler* iEventHandler;
+        TUint8 iTouchNumber;
+
+        RTimer iTimer;
+
+		RPointerArray<TAdvancedPointer> iAdvPointerArray;
+		RPointerArray<TTimeIntervalMicroSeconds32> iTimeArray;
+		};
+
+#endif // CMULTITOUCHPOINTER_UNIT_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiServicePlugins/HtiKeyEventServicePlugin/inc/MultiTouchPointerEventHandler.h	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,106 @@
+/*
+* 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:  Functional implementation of advanced pointer multitouch service.
+*
+*/
+
+#ifndef CMULTITOUCHPOINTEREVENTHANDLER_H
+#define CMULTITOUCHPOINTEREVENTHANDLER_H
+
+// INCLUDES
+#include <HtiServicePluginInterface.h>
+
+// CONSTANTS
+
+// MACROS
+
+// DATA TYPES
+
+// FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+// CLASS DECLARATION
+class CMultiTouchPointerEvent;
+
+/**
+* Observer interface for Multi touch event.
+*/
+class MHtiMultiTouchObserver
+    {
+public:
+    /**
+    * Notify multi touch event completed
+    */
+    virtual void NotifyMultiTouchComplete() = 0;
+
+    };
+/**
+*  Functional implentation of pointer event service.
+*/
+class CMultiTouchPointerEventHandler: public CBase
+    {
+    public:
+        /**
+        * Two-phased constructor.
+        */
+        static CMultiTouchPointerEventHandler* NewL(MHtiMultiTouchObserver& aObserver);
+
+        /**
+        * Destructor.
+        */
+        virtual ~CMultiTouchPointerEventHandler();      
+
+
+        TBool HandleMultiTouchL( const TDesC8& aData );
+
+        /**
+         * Callback function called by CMultiTouchPointerEvent to notify CMultiTouchPointerEventHandler 
+         * that this touch action(pointer sequence) is conpleted.
+         * @param aTouchNumber touch number ordinal
+         */
+        void NotifyTouchComplete(TUint8 aTouchNumber);        
+     
+        void SimulateEvent(TUint8 aTouchNumber,TInt aX, TInt aY, TInt aZ, TRawEvent::TType aEventType);
+        
+        void Clear();
+        
+    private:
+
+        /**
+        * C++ default constructor.
+        */
+        CMultiTouchPointerEventHandler(MHtiMultiTouchObserver& aObserver);
+
+        /**
+        * 2nd phase constructor.
+        */
+        void ConstructL();
+        
+        TBool ParsePoint( const TDesC8& aData, TInt& aoffset,
+        		TInt& aX, TInt& aY, TInt& aZ, 
+        		TTimeIntervalMicroSeconds32& aWait, TTimeIntervalMicroSeconds32& aHold );
+        
+        TBool ParseMove( const TDesC8& aData, TInt& aoffset,
+        		TTimeIntervalMicroSeconds32& aDragTime, TInt& aStepCount );
+
+    private: // data
+        RWsSession iWsSession;
+        RPointerArray<CMultiTouchPointerEvent> iTouchPointerArray;
+        TUint8 iFinishedCount;
+        
+        MHtiMultiTouchObserver& iObserver;
+		};
+
+#endif // CKEYEVENTHANDLER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiServicePlugins/HtiKeyEventServicePlugin/inc/PointerEventHandler.h	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,182 @@
+/*
+* 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:  Functional implentation of pointer event service.
+*
+*/
+
+#ifndef CPOINTEREVENTHANDLER_H
+#define CPOINTEREVENTHANDLER_H
+
+// INCLUDES
+#include <HtiServicePluginInterface.h>
+#include <w32std.h>
+#include "MultiTouchPointerEventHandler.h"
+// CONSTANTS
+
+// MACROS
+
+// DATA TYPES
+
+// FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+// CLASS DECLARATION
+
+
+/**
+*  Functional implentation of pointer event service.
+*/
+class CPointerEventHandler : 
+	public CActive,
+	public MHtiMultiTouchObserver
+    {
+    public:
+
+        enum TError
+            {
+            EMissingCommand          = 0x01,
+            EUnrecognizedCommand     = 0x02,
+            ENotReadyCommand         = 0x03,
+            EInvalidParameters       = 0x9A
+            };
+
+        enum TCommand
+            {
+            ETapScreen = 0x10,
+            ETapAndDrag = 0x11,
+            ETapAndDragMultipoint = 0x12,
+            EPressPointerDown = 0x13,
+            ELiftPointerUp = 0x14,
+			EAdvancedTapScreen = 0x15, //for advanced pointer
+			EPinchZoom = 0x16, //for advanced pointer
+			EMultiTouch = 0x17, //for advanced pointer
+            EResultOk = 0xFF // only for response message
+            };
+
+        enum TPointerState
+            {
+            EPointerUp,
+            EPointerDown,
+            EPointerMoving
+            };
+
+        struct TAdvancedPointer
+            {
+            TUint8 PointerNum;
+            TInt   X;
+            TInt   Y;
+            TInt   Z;            
+            };			
+
+			
+
+        /**
+        * Two-phased constructor.
+        */
+        static CPointerEventHandler* NewL();
+
+        /**
+        * Destructor.
+        */
+        virtual ~CPointerEventHandler();
+
+        /**
+        * Called by the HtiKeyEventServicePlugin when a pointer event
+        * command is received.
+        * @param aMessage message body destinated to the servive
+        * @param aPriority message priority
+        */
+        void ProcessMessageL( const TDesC8& aMessage,
+            THtiMessagePriority aPriority );
+
+        /**
+        * Sets the dispatcher to send outgoing messages to.
+        * @param aDispatcher pointer to dispatcher instance
+        */
+        void SetDispatcher( MHtiDispatcher* aDispatcher );
+
+
+    protected: // Functions from base classes
+
+        // From CActive
+        void RunL();
+        TInt RunError(TInt aError);
+        void DoCancel();
+        
+        // From MHtiMultiTouchObserver
+        void NotifyMultiTouchComplete();
+
+    private:
+
+        /**
+        * C++ default constructor.
+        */
+        CPointerEventHandler();
+
+        /**
+        * 2nd phase constructor.
+        */
+        void ConstructL();
+
+        // Helper methods
+        void HandleTapScreenL( const TDesC8& aData );
+        void HandleTapAndDragL( const TDesC8& aData );
+        void HandleTapAndDragMultipointL( const TDesC8& aData );
+        void HandlePointerDownOrUpL( const TDesC8& aData );
+        
+        //for advanced pointer
+		void HandleAdvancedTapScreenL( const TDesC8& aData ); 
+        void HandlePinchZoomL( const TDesC8& aData ); 
+        void HandleMultiTouchL( const TDesC8& aData );
+
+        void SendOkMsgL();
+        void SendErrorMessageL( TInt aError, const TDesC8& aDescription );
+
+        void ChangePointerStateL();
+        void MoveToNextPointL();
+        void PointerDown();
+        void PointerUp();
+        void PointerMove();
+        void SimulatePointerEvent( TRawEvent::TType aType );
+        TBool IsMultitouch();
+        void AdvanceAddMiddlePointL(TInt aPointNumber,TInt aX1,TInt aY1, TInt aZ1,TInt aX2,TInt aY2, TInt aZ2 , TInt aStepCount );
+        void AdvancedAddDelayArray(TTimeIntervalMicroSeconds32 aDelay , TInt aStepCount );
+        TBool AdvancedStartDelay();
+
+
+    private: // data
+
+        RWsSession iWsSession;
+        MHtiDispatcher* iDispatcher; // referenced
+
+        RTimer iTimer;
+        TBool  iReady;
+        TUint8 iCommand;
+        TInt   iX;
+        TInt   iY;
+        TInt   iTapCount;
+        TTimeIntervalMicroSeconds32 iEventDelay;
+        TTimeIntervalMicroSeconds32 iActionDelay;
+        TPointerState iState;
+        RArray<TInt>* iCoords;
+		RPointerArray<TAdvancedPointer> iAdvancedPointers;
+		
+		RPointerArray<TAdvancedPointer> iAdvPointerMoveArray;
+		RPointerArray<TTimeIntervalMicroSeconds32> iDelayArray;
+		
+		CMultiTouchPointerEventHandler* iMultiTouchHandler;
+		};
+
+#endif // CKEYEVENTHANDLER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiServicePlugins/HtiKeyEventServicePlugin/src/HtiKeyEventServicePlugin.cpp	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,167 @@
+/*
+* 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:  KeyEventPlugin entry implementation
+*
+*/
+
+
+// INCLUDE FILES
+#include "HtiKeyEventServicePlugin.h"
+#include "KeyEventHandler.h"
+#include "PointerEventHandler.h"
+
+#include <HtiDispatcherInterface.h>
+#include <HtiLogging.h>
+#include <hwrmlightdomaincrkeys.h>
+
+// CONSTANTS
+_LIT8( KErrorMissingCommand, "Command was not given - message was empty" );
+const TInt KDefaultMinLightTimeout = 5;
+const TInt KWakeupWaitTime = 200000; // 0.2 sec
+
+// ----------------------------------------------------------------------------
+// CHtiKeyEventServicePlugin::NewL()
+// Create instance of concrete ECOM interface implementation
+// ----------------------------------------------------------------------------
+CHtiKeyEventServicePlugin* CHtiKeyEventServicePlugin::NewL()
+    {
+    CHtiKeyEventServicePlugin* self = new (ELeave) CHtiKeyEventServicePlugin;
+    CleanupStack::PushL (self);
+    self->ConstructL();
+    CleanupStack::Pop();
+    return self;
+    }
+
+// ----------------------------------------------------------------------------
+// CHtiKeyEventServicePlugin::CHtiKeyEventServicePlugin()
+// ----------------------------------------------------------------------------
+CHtiKeyEventServicePlugin::CHtiKeyEventServicePlugin()
+        : iLightTimeout( KDefaultMinLightTimeout ),
+          iCenRepSession( NULL ),
+          iLightTimeoutSettingHandler( NULL )
+    {
+    }
+
+// ----------------------------------------------------------------------------
+// CHtiKeyEventServicePlugin::~CHtiKeyEventServicePlugin()
+// ----------------------------------------------------------------------------
+CHtiKeyEventServicePlugin::~CHtiKeyEventServicePlugin()
+    {
+    HTI_LOG_TEXT( "CHtiKeyEventServicePlugin destroy" );
+    delete iKeyHandler;
+    delete iPointerHandler;
+
+    if ( iLightTimeoutSettingHandler )
+        {
+        iLightTimeoutSettingHandler->StopListening();
+        }
+    delete iLightTimeoutSettingHandler;
+    delete iCenRepSession;
+    }
+
+// ----------------------------------------------------------------------------
+// CHtiKeyEventServicePlugin::ConstructL()
+// ----------------------------------------------------------------------------
+void CHtiKeyEventServicePlugin::ConstructL()
+    {
+    HTI_LOG_FUNC_IN( "CHtiKeyEventServicePlugin::ConstructL" );
+    iCenRepSession = CRepository::NewL( KCRUidLightSettings );
+    iLightTimeoutSettingHandler = CCenRepNotifyHandler::NewL( *this,
+            *iCenRepSession, CCenRepNotifyHandler::EIntKey,
+            KDisplayLightsTimeout );
+    iLightTimeoutSettingHandler->StartListeningL();
+    HTI_LOG_FUNC_OUT( "CHtiKeyEventServicePlugin::ConstructL" );
+    }
+
+// ----------------------------------------------------------------------------
+// CHtiKeyEventServicePlugin::ProcessMessageL()
+// ----------------------------------------------------------------------------
+void CHtiKeyEventServicePlugin::ProcessMessageL( const TDesC8& aMessage,
+    THtiMessagePriority aPriority)
+    {
+    HTI_LOG_FUNC_IN( "CHtiKeyEventServicePlugin::ProcessMessageL" );
+
+    if ( aMessage.Length() == 0 )
+        {
+        User::LeaveIfNull( iDispatcher );
+        User::LeaveIfError( iDispatcher->DispatchOutgoingErrorMessage(
+            CKeyEventHandler::EMissingCommand,
+            KErrorMissingCommand, KKeyEventServiceUid ) );
+        return;
+        }
+
+    HTI_LOG_FORMAT( "Light timeout = %d", iLightTimeout );
+    TTimeIntervalSeconds inactivityTime = User::InactivityTime();
+    HTI_LOG_FORMAT( "Inactivity time = %d", inactivityTime.Int() );
+    if ( inactivityTime.Int() >= iLightTimeout )
+        {
+        HTI_LOG_TEXT( "Waking up" );
+        User::ResetInactivityTime();
+        User::After( KWakeupWaitTime );
+        }
+
+    if ( aMessage[0] <= CKeyEventHandler::EPressKeySequence )
+        {
+        if ( iKeyHandler == NULL )
+            {
+            iKeyHandler = CKeyEventHandler::NewL();
+            iKeyHandler->SetDispatcher( iDispatcher );
+            }
+        iKeyHandler->ProcessMessageL( aMessage, aPriority );
+        }
+
+    else 
+        {
+        if ( iPointerHandler == NULL )
+            {
+            iPointerHandler = CPointerEventHandler::NewL();
+            iPointerHandler->SetDispatcher( iDispatcher );
+            }
+        iPointerHandler->ProcessMessageL( aMessage, aPriority );
+        }   
+
+
+    HTI_LOG_FUNC_OUT( "CHtiKeyEventServicePlugin::ProcessMessageL: Done" );
+    }
+
+// ---------------------------------------------------------------------------
+// From MCenRepNotifyHandlerCallback.
+// CHtiKeyEventServicePlugin::HandleNotifyInt
+// ---------------------------------------------------------------------------
+//
+void CHtiKeyEventServicePlugin::HandleNotifyInt( TUint32 aId, TInt aNewValue )
+    {
+    HTI_LOG_FUNC_IN( "CHtiKeyEventServicePlugin::HandleNotifyInt" );
+    if ( aId == KDisplayLightsTimeout )
+        {
+        HTI_LOG_FORMAT( "New light timeout value %d", aNewValue );
+        iLightTimeout = aNewValue;
+        }
+    HTI_LOG_FUNC_OUT( "CHtiKeyEventServicePlugin::HandleNotifyInt" );
+    }
+
+// ---------------------------------------------------------------------------
+// From MCenRepNotifyHandlerCallback.
+// CHtiKeyEventServicePlugin::HandleNotifyError
+// ---------------------------------------------------------------------------
+//
+void CHtiKeyEventServicePlugin::HandleNotifyError( TUint32 /*aId*/,
+        TInt /*error*/, CCenRepNotifyHandler* /*aHandler*/ )
+    {
+    HTI_LOG_TEXT( "CHtiKeyEventServicePlugin::HandleNotifyError()" );
+    iLightTimeout = KDefaultMinLightTimeout;
+    TRAP_IGNORE( iLightTimeoutSettingHandler->StartListeningL() );
+    }
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiServicePlugins/HtiKeyEventServicePlugin/src/KeyEventHandler.cpp	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,663 @@
+/*
+* 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:  Functional implementation of key event service
+*
+*/
+
+
+// INCLUDE FILES
+#include "HtiKeyEventServicePlugin.h"
+#include "KeyEventHandler.h"
+
+#include <apgtask.h>
+#include <HtiDispatcherInterface.h>
+#include <HtiLogging.h>
+
+
+// CONSTANTS
+_LIT8( KErrorServiceNotReady, "Service is busy - possibly executing long running typetext or long key press functionality" );
+_LIT8( KErrorUnrecognizedCommand, "Unrecognized command" );
+_LIT8( KErrorEmptyUnicodeArray, "Unicode char array was empty" );
+_LIT8( KErrorInvalidUnicodeCharArray, "Invalid unicode character array" );
+_LIT8( KErrorInvalidScancode, "Invalid scancode. Wrong length" );
+_LIT8( KErrorTypeTextFailure, "Internal typetext failure" );
+_LIT8( KErrorLongKeyPressFailure, "Internal long key press failure" );
+
+const TInt KKeyboardFuncDataLength = 2;  // scancode with 2 bytes
+const TInt KLongKeyPressDataLength = 4;  // scancode 2 bytes + time 2 bytes
+const TInt KPressKeySequenceMinDataLength = 6;  // hold time 2 bytes + key press interval 2 bytes + at least one scancode 2 bytes
+const TInt KTypeTextDelayBetweenCharsInMicroSeconds = 50000; // 50 milliseconds
+const TInt KTypeTextStartPausing = 200; // start pausing after this many characters
+const TInt KTypeTextPauseInterval = 50; // how many chars to type before pausing
+const TInt KTypeTextPauseInMicroSeconds = 800000; // 0.8 sec
+
+
+// ----------------------------------------------------------------------------
+// UintValue()
+// Helper: aPtr must point to 16 bits area where the value will be extracted
+// ----------------------------------------------------------------------------
+TUint UintValue( const TUint8* aPtr )
+    {
+    // This is short way to do it..
+    //return (aPtr[1]<<8) + aPtr[0];
+
+    TUint8 uInt8Low = *aPtr;
+    TUint8 uInt8High = *(aPtr+1);
+
+    HTI_LOG_FORMAT( "UintValue:: Low: %d", uInt8Low );
+    HTI_LOG_FORMAT( "UintValue:: High: %d", uInt8High );
+
+    TUint16 uInt16 = (TUint16)uInt8High;
+    uInt16 = (uInt16 << 8);
+    uInt16 = uInt16 + (TUint)uInt8Low;
+
+    HTI_LOG_FORMAT( "UintValue:: 16-bit value: %d", uInt16 );
+
+    TUint uInt = (TUint)uInt16;
+    HTI_LOG_FORMAT( "UintValue:: 32-bit value: %d", uInt );
+
+    return uInt;
+    }
+
+// ----------------------------------------------------------------------------
+// CKeyEventHandler::NewL()
+// ----------------------------------------------------------------------------
+CKeyEventHandler* CKeyEventHandler::NewL()
+    {
+    HTI_LOG_FUNC_IN( "CKeyEventHandler::NewL" );
+    CKeyEventHandler* self = new (ELeave) CKeyEventHandler();
+    CleanupStack::PushL ( self );
+    self->ConstructL();
+    CleanupStack::Pop();
+    HTI_LOG_FUNC_OUT( "CKeyEventHandler::Done" );
+    return self;
+    }
+
+// ----------------------------------------------------------------------------
+// CKeyEventHandler::CKeyEventHandler()
+// ----------------------------------------------------------------------------
+CKeyEventHandler::CKeyEventHandler()
+    : CActive( CActive::EPriorityStandard ), iReady( ETrue ), iCommand( 0 ),
+      iHoldingScanCode( 0 )
+
+    {
+    }
+
+// ----------------------------------------------------------------------------
+// CKeyEventHandler::~CKeyEventHandler()
+// ----------------------------------------------------------------------------
+CKeyEventHandler::~CKeyEventHandler()
+    {
+    HTI_LOG_TEXT( "CKeyEventHandler destroy" );
+    Cancel();
+    iTimer.Close();
+    iWsSession.Close();
+    delete iUnicodeChars;
+    iUnicodeChars = NULL;
+    }
+
+// ----------------------------------------------------------------------------
+// CKeyEventHandler::ConstructL()
+// ----------------------------------------------------------------------------
+void CKeyEventHandler::ConstructL()
+    {
+    HTI_LOG_TEXT( "CKeyEventHandler::ConstructL" );
+    User::LeaveIfError( iWsSession.Connect() );
+    User::LeaveIfError( iTimer.CreateLocal() );
+    CActiveScheduler::Add( this );
+    }
+
+// ----------------------------------------------------------------------------
+// CKeyEventHandler::SetDispatcher()
+// ----------------------------------------------------------------------------
+void CKeyEventHandler::SetDispatcher( MHtiDispatcher* aDispatcher )
+    {
+    iDispatcher = aDispatcher;
+    }
+
+// ----------------------------------------------------------------------------
+// CKeyEventHandler::RunL()
+// ----------------------------------------------------------------------------
+void CKeyEventHandler::RunL()
+    {
+    HTI_LOG_FUNC_IN( "CKeyEventHandler::RunL" );
+
+    if ( iCommand == ELongKeyPress )
+        {
+        KeyUp( iHoldingScanCode );
+        SendOkMsgL();
+        iReady = ETrue;
+        HTI_LOG_TEXT( "CKeyEventHandler::RunL: LongKeyPress has finished" );
+        }
+
+    else if ( iCommand == ETypeText || iCommand == ETypeTextPassword )
+        {
+        SimulateKeyEventL( *iUnicodeChars, iUnicodeCharIndex );
+
+        if ( iUnicodeCharIndex == iUnicodeChars->Length() / 2 - 1 )
+            {
+            delete iUnicodeChars;
+            iUnicodeChars = NULL;
+            SendOkMsgL();
+            iReady = ETrue;
+            HTI_LOG_TEXT( "CKeyEventHandler::RunL: TypeText has finished: OK" );
+            }
+        else
+            {
+            iUnicodeCharIndex++;
+            TypeTextWithDelay( iUnicodeCharIndex );
+            }
+        }
+
+    else if ( iCommand == EPressKeySequence )
+        {
+        PressKeySequenceKeyL();
+        }
+
+    HTI_LOG_FUNC_OUT( "CKeyEventHandler::RunL" );
+    }
+
+// ----------------------------------------------------------------------------
+// CKeyEventHandler::RunError()
+// ----------------------------------------------------------------------------
+TInt CKeyEventHandler::RunError( TInt aError )
+    {
+    TInt dispatchResult = KErrNone;
+
+    if ( iCommand == ELongKeyPress )
+        {
+        HTI_LOG_FORMAT( "CKeyEventHandler::RunError: LongKeyPress failure: %d.", aError );
+        dispatchResult = iDispatcher->DispatchOutgoingErrorMessage( aError,
+                KErrorLongKeyPressFailure,  KKeyEventServiceUid );
+        }
+
+    else // it's TypeText
+        {
+        HTI_LOG_FORMAT( "CKeyEventHandler::RunError: TypeText failure: %d.", aError );
+        dispatchResult = iDispatcher->DispatchOutgoingErrorMessage( aError,
+                KErrorTypeTextFailure,  KKeyEventServiceUid );
+        }
+
+    if ( dispatchResult != KErrNone )
+        {
+        HTI_LOG_FORMAT( "CKeyEventHandler::RunError: Failed to send error report to framework: %d.", dispatchResult );
+        }
+    iReady = ETrue;
+    return KErrNone;
+    }
+
+// ----------------------------------------------------------------------------
+// CKeyEventHandler::DoCancel()
+// ----------------------------------------------------------------------------
+void CKeyEventHandler::DoCancel()
+    {
+    iTimer.Cancel();
+    delete iUnicodeChars;
+    iUnicodeChars = NULL;
+    }
+
+// ----------------------------------------------------------------------------
+// CKeyEventHandler::ProcessMessageL()
+// ----------------------------------------------------------------------------
+void CKeyEventHandler::ProcessMessageL( const TDesC8& aMessage,
+    THtiMessagePriority /*aPriority*/ )
+    {
+    HTI_LOG_FUNC_IN("CKeyEventHandler::ProcessMessageL");
+    HTI_LOG_FORMAT("Msg len: %d.", aMessage.Length());
+
+    if ( !iReady )
+        {
+        SendErrorMessageL( ENotReadyCommand, KErrorServiceNotReady );
+        return;
+        }
+
+    iCommand = aMessage.Ptr()[0];
+    switch ( iCommand )
+        {
+        case EPressKey:
+        case EKeyDown:
+        case EKeyUp:
+            HandleKeyboardFuncL( aMessage.Right( aMessage.Length() - 1 ) );
+            break;
+        case ETypeText:
+        case ETypeTextPassword:
+            HandleTypeTextFuncL( aMessage.Right( aMessage.Length() - 1 ) );
+            break;
+        case ELongKeyPress:
+            HandleLongKeyPressFuncL( aMessage.Right( aMessage.Length() - 1 ) );
+            break;
+        case EPressKeySequence:
+            HandlePressKeySequenceFuncL( aMessage.Right( aMessage.Length() - 1 ) );
+            break;
+        default:
+            SendErrorMessageL( EUnrecognizedCommand,
+                KErrorUnrecognizedCommand );
+        break;
+        }
+
+    HTI_LOG_FUNC_OUT( "CKeyEventHandler::ProcessMessageL: Done" );
+    }
+
+// ----------------------------------------------------------------------------
+// CKeyEventHandler::HandleTypeTextFuncL()
+// Handle request to send one or more unicode characters to top most
+// focused UI application.
+// ----------------------------------------------------------------------------
+void CKeyEventHandler::HandleTypeTextFuncL(
+    const TDesC8& aUnicodeChars )
+    {
+    HTI_LOG_FUNC_IN( "CKeyEventHandler::HandleTypeTextFunc" );
+
+    // For UCS-2 and common unicode key code areas, see
+    // http://czyborra.com/unicode/characters.html
+    // "How are the Unicode characters numbered?"
+
+    if ( aUnicodeChars.Size() == 0 )
+        {
+        SendErrorMessageL( EEmptyUnicodeCharArray, KErrorEmptyUnicodeArray );
+        return;
+        }
+
+#ifdef __ENABLE_LOGGING__
+    CArrayFixFlat<TInt> *windowGroups = new (ELeave) CArrayFixFlat<TInt>(5);
+    iWsSession.WindowGroupList(windowGroups);
+    HTI_LOG_FORMAT("WindowGroupList, %d groups:",windowGroups->Count());
+    for ( TInt i = 0; i < windowGroups->Count(); i++ )
+    {
+        TBuf<125> wgname; // max length for wg name?
+        iWsSession.GetWindowGroupNameFromIdentifier((*windowGroups)[i], wgname);
+
+        TBuf<145> logmsg;
+        logmsg.AppendFormat(_L("WgId %3d - \""), (*windowGroups)[i]);
+        logmsg.Append(wgname);
+        logmsg.Append(_L("\""));
+        HTI_LOG_DES(logmsg);
+    }
+    delete windowGroups;
+#endif
+
+    // Get the front most focused window group. Note that this might
+    // not necessarily be the front-most window group, as
+    // window groups can disable keyboard focus.
+    iFocusedWindowGroup = iWsSession.GetFocusWindowGroup();
+
+    HTI_LOG_TEXT("FocusWindowGroup name :");
+    TBuf<125> focusWindowGroupName; // max length for wg name?
+    iWsSession.GetWindowGroupNameFromIdentifier(iFocusedWindowGroup, focusWindowGroupName);
+    HTI_LOG_DES(focusWindowGroupName);
+
+    // ...exception to above! (in EKA2) :
+    // When we are in idle state the text must be sent to 'Telephone' task's
+    // windowgroup because 'idle' windowgroup does not handle keyevents.
+    //
+    // Also when typing in idle state we need EKeyUp event to prevent the key
+    // beeing stuck in the pressed position.
+    //
+    // Window group name contains UID - we are using UID to find the
+    // 'Idle' window group so it will be found also with different
+    // localizations. The name 'Idle' cannot be used since the name is
+    // localized.
+
+    if ( ( focusWindowGroupName.Find( _L( "101fd64c" ) ) != KErrNotFound ) ||
+         ( focusWindowGroupName.Find( _L( "102750f0" ) ) != KErrNotFound ) )
+        {
+        HTI_LOG_TEXT( "FocusWindowGroup is \"Idle\". Sending text to \"Telephone\" task." );
+        TApaTaskList taskList( iWsSession );
+        TApaTask telephoneTask = taskList.FindApp( TUid::Uid( 0x100058b3 ) );
+        if ( !telephoneTask.Exists() )
+            {
+            HTI_LOG_FUNC_OUT( "CKeyEventHandler::SimulateKeyEventL: \"Telephone\" task does not exist" );
+            User::Leave( KErrNotFound );
+            }
+
+        iFocusedWindowGroup = telephoneTask.WgId();
+
+        // We must also get focus to 'Telephone' task for it
+        // to receive our text.
+        TWsEvent event;
+        event.SetType( EEventFocusGained );
+        iWsSession.SendEventToWindowGroup( telephoneTask.WgId(), event );
+        }
+
+    if ( aUnicodeChars.Size() % 2 == 1 )
+        {
+        // aUnicodeChars descriptor must be divisible by two,
+        // because expecting two-byte characters
+        SendErrorMessageL( EInvalidUnicodeCharArray,
+            KErrorInvalidUnicodeCharArray );
+        return;
+        }
+
+    // Start work
+    if ( iUnicodeChars )
+        {
+        delete iUnicodeChars;
+        iUnicodeChars = NULL;
+        }
+
+    // If the string begins with unicode byte order mark 0xfffe, strip it away
+    if ( ( aUnicodeChars[0] == 0xff && aUnicodeChars[1] == 0xfe ) )
+        {
+        HTI_LOG_TEXT( "Ignoring Unicode BOM (first 2 bytes) from the string" );
+        iUnicodeChars = aUnicodeChars.Mid( 2 ).AllocL();
+        }
+    else // take the string as it is
+        {
+        iUnicodeChars = aUnicodeChars.AllocL();
+        }
+    iReady = EFalse;
+
+    TypeTextWithDelay( 0 );
+
+    HTI_LOG_FUNC_OUT("CKeyEventHandler::HandleTypeTextFunc: Done (operation started)");
+    }
+
+// ----------------------------------------------------------------------------
+// CKeyEventHandler::TypeTextWithDelay()
+// ----------------------------------------------------------------------------
+void CKeyEventHandler::TypeTextWithDelay( TInt aNextIndex )
+    {
+    iUnicodeCharIndex = aNextIndex;
+    // Keep a longer pause in some character intervals if the given text
+    // is very long to avoid losing characters.
+    if ( iUnicodeCharIndex > KTypeTextStartPausing &&
+        iUnicodeCharIndex % KTypeTextPauseInterval == 0 )
+        {
+        iTimer.After( iStatus, KTypeTextPauseInMicroSeconds );
+        }
+    else
+        {
+        iTimer.After( iStatus, KTypeTextDelayBetweenCharsInMicroSeconds );
+        }
+    SetActive();
+    }
+
+// ----------------------------------------------------------------------------
+// CKeyEventHandler::SimulateKeyEventL()
+// ----------------------------------------------------------------------------
+void CKeyEventHandler::SimulateKeyEventL( const TDesC8& aUnicodeChars,
+    TInt aIndex )
+    {
+
+    // Expect aUnicodeChars to be Unicode characters (each two bytes)
+    // Note: aIndex is within range of 0 to aUnicodeChars/2
+
+    HTI_LOG_FUNC_IN("CKeyEventHandler::SimulateKeyEventL");
+    TKeyEvent keyEvent;
+    const TUint8* rawDataStart = aUnicodeChars.Ptr();
+    keyEvent.iCode = *( (TUint16*) ( rawDataStart + aIndex * 2 ) );
+    // Set modifier to treat key events as events from external keyboard
+    // so that AknFep won't interfere with numbers and * and # characters.
+    keyEvent.iModifiers = EModifierKeyboardExtend;
+    keyEvent.iRepeats = 0;
+    //keyEvent.iScanCode = EStdKeyNull;
+    // change because FEP got confused about EStdKeyNull in key-up event and
+    // opened the edit menu
+    keyEvent.iScanCode = 255;
+
+    TWsEvent event;
+    *event.Key() = keyEvent;
+
+    if ( iCommand == ETypeTextPassword )
+        {
+        // Typing a password needs only EEventKey.
+        // Otherwise it will appear to be pressed twice.
+        HTI_LOG_FORMAT( "EEventKey 0x%x", keyEvent.iCode );
+        event.SetType( EEventKey );
+        iWsSession.SendEventToWindowGroup( iFocusedWindowGroup, event );
+        }
+    else
+        {
+        // EEventKeyUp is needed when typing a SMS or MMS. Otherwise the
+        // counters will not be updated and message will be corrupt.
+        // Also typing in idle state requires EEventKeyUp for the key to be
+        // released.
+        HTI_LOG_FORMAT( "EEventKey&EEventKeyUp 0x%x", keyEvent.iCode );
+        event.SetType( EEventKey );
+        iWsSession.SendEventToWindowGroup( iFocusedWindowGroup, event );
+
+        event.SetType( EEventKeyUp );
+        iWsSession.SendEventToWindowGroup( iFocusedWindowGroup, event );
+        }
+
+    HTI_LOG_FUNC_OUT( "CKeyEventHandler::SimulateKeyEventL" );
+    }
+
+// ----------------------------------------------------------------------------
+// CKeyEventHandler::KeyUp()
+// ----------------------------------------------------------------------------
+void CKeyEventHandler::KeyUp( TUint aCode )
+    {
+    HTI_LOG_FUNC_IN( "CKeyEventHandler::KeyUp: Starting" );
+    TRawEvent rawEvent;
+    rawEvent.Set( TRawEvent::EKeyUp, aCode );
+    iWsSession.SimulateRawEvent( rawEvent );
+    iWsSession.Flush();
+    HTI_LOG_FUNC_OUT( "CKeyEventHandler::KeyUp: Done" );
+    }
+
+// ----------------------------------------------------------------------------
+// CKeyEventHandler::KeyDown()
+// ----------------------------------------------------------------------------
+void CKeyEventHandler::KeyDown( TUint aCode )
+    {
+    HTI_LOG_FUNC_IN( "CKeyEventHandler::KeyDown: Starting" );
+    User::ResetInactivityTime();
+    TRawEvent rawEvent;
+    rawEvent.Set( TRawEvent::EKeyDown, aCode );
+    iWsSession.SimulateRawEvent( rawEvent );
+    iWsSession.Flush();
+    HTI_LOG_FUNC_OUT( "CKeyEventHandler::KeyDown: Done" );
+    }
+
+// ----------------------------------------------------------------------------
+// CKeyEventHandler::HandleKeyboardFuncL()
+// Handle request to emulate pressing keyboard keys in sequence.
+// ----------------------------------------------------------------------------
+void CKeyEventHandler::HandleKeyboardFuncL( const TDesC8& aData )
+    {
+    HTI_LOG_FUNC_IN( "CKeyEventHandler::HandleKeyboardFuncL" );
+
+    HTI_LOG_FORMAT( "CKeyEventHandler::HandleKeyboardFuncL: Size of data: %d", aData.Length() );
+    HTI_LOG_TEXT( "CKeyEventHandler::HandleKeyboardFuncL: Data: " );
+    HTI_LOG_DES( aData );
+
+//  <scancode> is unsigned short integer, a scancode of
+//  keyboard key. Theses are defined in E32KEYS.H. It depends on
+//  device how these are mapped to actual keyboard keys in the
+//  device.
+//
+//  Client note: each call to KEYDOWN should be followed by KEYUP
+//               with the same scancode at some point.
+
+    if ( aData.Length() != KKeyboardFuncDataLength )
+        {
+//        HTI_LOG_FORMAT( "PRESSKEY: Invalid scancode length: %d (expecting 2 bytes).", ptr.Length() - 1);
+        SendErrorMessageL( EInvalidScancode, KErrorInvalidScancode );
+        return;
+        }
+
+    iReady = EFalse;
+
+    TUint scanCode = UintValue( aData.Ptr() );
+
+    switch ( iCommand )
+        {
+        case EPressKey:
+            KeyDown( scanCode );
+            KeyUp( scanCode );
+            break;
+
+        case EKeyDown:
+            KeyDown( scanCode );
+            break;
+
+        case EKeyUp:
+            KeyUp( scanCode );
+            break;
+
+        default:
+        break;
+        }
+    SendOkMsgL();
+    iReady = ETrue;
+    HTI_LOG_FUNC_OUT("CKeyEventHandler::HandleKeyboardFuncL: Done");
+    }
+
+// ----------------------------------------------------------------------------
+// CKeyEventHandler::HandleLongKeyPressFuncL()
+// Handle request to emulate holding a key down for specified time.
+// ----------------------------------------------------------------------------
+void CKeyEventHandler::HandleLongKeyPressFuncL( const TDesC8& aData )
+    {
+    HTI_LOG_FUNC_IN( "CKeyEventHandler::HanldeLongKeyPressFuncL" );
+
+    if ( aData.Length() != KLongKeyPressDataLength )
+        {
+        SendErrorMessageL( EInvalidScancode, KErrorInvalidScancode );
+        return;
+        }
+
+    iReady = EFalse;
+    iHoldingScanCode = UintValue( aData.Ptr() );
+    TTimeIntervalMicroSeconds32 holdTime( UintValue( aData.Ptr() + 2 ) * 1000 );
+    KeyDown( iHoldingScanCode );
+    iTimer.After( iStatus, holdTime );
+    SetActive();
+
+    HTI_LOG_FUNC_OUT( "CKeyEventHandler::HanldeLongKeyPressFuncL" );
+    }
+
+// ----------------------------------------------------------------------------
+// CKeyEventHandler::HandlePressKeySequenceFuncL()
+// Handle request to press keys in sequence.
+// ----------------------------------------------------------------------------
+void CKeyEventHandler::HandlePressKeySequenceFuncL( const TDesC8& aData )
+    {
+    HTI_LOG_FUNC_IN( "CKeyEventHandler::HandlePressKeySequenceFuncL" );
+
+    if ( aData.Length() % 2 != 0 )
+        {
+        HTI_LOG_FORMAT( "Invalid data length: %d", aData.Length() );
+        SendErrorMessageL( EInvalidUnicodeCharArray, KErrorInvalidUnicodeCharArray );
+        return;
+        }
+
+    if ( aData.Length() < KPressKeySequenceMinDataLength )
+        {
+        HTI_LOG_FORMAT( "Too short data: %d", aData.Length() );
+        SendErrorMessageL( EEmptyUnicodeCharArray, KErrorEmptyUnicodeArray );
+        return;
+        }
+
+    iReady = EFalse;
+
+    iKeySequenceHoldTime = UintValue( aData.Ptr() ) * 1000;
+    iKeySequenceInterval = UintValue( aData.Ptr() + 2 ) * 1000;
+    HTI_LOG_FORMAT( "Parsed key sequence hold time: %d", iKeySequenceHoldTime.Int() / 1000 );
+    HTI_LOG_FORMAT( "Parsed key sequence interval: %d", iKeySequenceInterval.Int() / 1000 );
+    if ( iKeySequenceInterval.Int() < KTypeTextDelayBetweenCharsInMicroSeconds )
+        {
+        HTI_LOG_TEXT( "Given key sequence interval too low, using the default value" );
+        iKeySequenceInterval = KTypeTextDelayBetweenCharsInMicroSeconds;
+        }
+
+    if(iUnicodeChars)
+		{
+			delete iUnicodeChars;
+			iUnicodeChars = NULL;
+		}
+	
+	iUnicodeChars = aData.Mid( 4 ).AllocL();
+    iUnicodeCharIndex = 0;
+    iHoldingKey = EFalse;
+
+    PressKeySequenceKeyL();
+
+    HTI_LOG_FUNC_OUT( "CKeyEventHandler::HandlePressKeySequenceFuncL" );
+    }
+
+// ----------------------------------------------------------------------------
+// CKeyEventHandler::PressKeySequenceKeyL()
+// Handle a single key press from press keys in sequence command.
+// ----------------------------------------------------------------------------
+void CKeyEventHandler::PressKeySequenceKeyL()
+    {
+    HTI_LOG_FUNC_IN( "CKeyEventHandler::PressKeySequenceKeyL" );
+
+    if ( iHoldingKey )
+        {
+        KeyUp( iHoldingScanCode );
+        iHoldingKey = EFalse;
+
+        HTI_LOG_FORMAT( "Released key: %d", iHoldingScanCode );
+
+        if ( iUnicodeChars->Length() > iUnicodeCharIndex )
+            {
+            iTimer.After( iStatus, iKeySequenceInterval );
+            SetActive();
+            }
+        else
+            {
+            HTI_LOG_TEXT( "PressKeySequence has finished: OK" );
+            SendOkMsgL();
+            iReady = ETrue;
+            }
+        }
+    else
+        {
+        iHoldingScanCode = UintValue( iUnicodeChars->Ptr() + iUnicodeCharIndex );
+        iUnicodeCharIndex += 2;
+
+        KeyDown( iHoldingScanCode );
+        iHoldingKey = ETrue;
+
+        HTI_LOG_FORMAT( "Holding down key: %d", iHoldingScanCode );
+
+        iTimer.After( iStatus, iKeySequenceHoldTime );
+        SetActive();
+        }
+
+    HTI_LOG_FUNC_OUT( "CKeyEventHandler::HandlePressKeySequenceFuncL" );
+    }
+
+// ----------------------------------------------------------------------------
+// CKeyEventHandler::SendOkMsgL()
+// ----------------------------------------------------------------------------
+void CKeyEventHandler::SendOkMsgL()
+    {
+    HTI_LOG_FUNC_IN("CKeyEventHandler::SendOkMsgL: Starting");
+
+    User::LeaveIfNull( iDispatcher );
+    TBuf8<1> response;
+    response.Append( EResultOk );
+    HBufC8* respH8 = response.AllocL();
+    User::LeaveIfError( iDispatcher->DispatchOutgoingMessage(
+        respH8, KKeyEventServiceUid ) );
+
+    HTI_LOG_FUNC_OUT("CKeyEventHandler::SendOkMsgL: Done");
+    }
+
+// ----------------------------------------------------------------------------
+// CKeyEventHandler::SendErrorMessageL()
+// ----------------------------------------------------------------------------
+void CKeyEventHandler::SendErrorMessageL( TInt aError,
+        const TDesC8& aDescription )
+    {
+    HTI_LOG_FUNC_IN("CKeyEventHandler::SendErrorMessageL: Starting");
+    User::LeaveIfNull( iDispatcher );
+    User::LeaveIfError( iDispatcher->DispatchOutgoingErrorMessage(
+        aError, aDescription, KKeyEventServiceUid ) );
+    HTI_LOG_FUNC_OUT("CKeyEventHandler::SendErrorMessageL: Done");
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiServicePlugins/HtiKeyEventServicePlugin/src/MultiTouchPointerEvent.cpp	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,257 @@
+/*
+* 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: Functional implementation of one touch(pointer sequence) event service.
+*
+*/
+
+// INCLUDE FILES
+#include "HtiKeyEventServicePlugin.h"
+#include "MultiTouchPointerEvent.h"
+#include "MultiTouchPointerEventHandler.h"
+
+#include <HtiLogging.h>
+
+
+// CONSTANTS
+_LIT8( KErrorInternalFailure, "Internal pointer command failure" );
+_LIT (KPrintInfoString, "PrintInfo event id=%d time=%d type=%d X=%d Y=%d Z=%d");
+
+// ----------------------------------------------------------------------------
+// CMultiTouchPointerUnit::NewL()
+// ----------------------------------------------------------------------------
+CMultiTouchPointerEvent* CMultiTouchPointerEvent::NewL(TUint8 aTouchNumber,
+        CMultiTouchPointerEventHandler* aEventHandler)
+    {
+    HTI_LOG_FUNC_IN( "CMultiTouchPointerEvent::NewL" );
+    CMultiTouchPointerEvent* self = new (ELeave) CMultiTouchPointerEvent(aTouchNumber, aEventHandler);
+    CleanupStack::PushL ( self );
+    self->ConstructL();
+    CleanupStack::Pop();
+    HTI_LOG_FUNC_OUT( "CMultiTouchPointerEvent::NewL" );
+    return self;
+    }
+
+// ----------------------------------------------------------------------------
+// CMultiTouchPointerEvent::CMultiTouchPointerEvent()
+// ----------------------------------------------------------------------------
+CMultiTouchPointerEvent::CMultiTouchPointerEvent(TUint8 aTouchNumber,
+        CMultiTouchPointerEventHandler *aEventHandler)
+    : CActive(CActive::EPriorityStandard),
+      iEventHandler(aEventHandler),
+      iTouchNumber(aTouchNumber)
+    {
+    HTI_LOG_TEXT( "CMultiTouchPointerEvent constructor" );
+    }
+
+// ----------------------------------------------------------------------------
+// CMultiTouchPointerEvent::~CMultiTouchPointerEvent()
+// ----------------------------------------------------------------------------
+CMultiTouchPointerEvent::~CMultiTouchPointerEvent()
+    {
+    HTI_LOG_TEXT( "CMultiTouchPointerEvent destructor" );
+    Cancel();
+    iTimer.Close();
+	
+    iTimeArray.ResetAndDestroy(); 
+	iAdvPointerArray.ResetAndDestroy(); 
+    }
+
+// ----------------------------------------------------------------------------
+// CMultiTouchPointerEvent::ConstructL()
+// ----------------------------------------------------------------------------
+void CMultiTouchPointerEvent::ConstructL()
+    {
+    HTI_LOG_TEXT( "CMultiTouchPointerEvent::ConstructL" );
+    iTimeArray.Reset(); 
+
+    User::LeaveIfError( iTimer.CreateLocal() );
+    CActiveScheduler::Add( this );
+    }
+
+
+// ----------------------------------------------------------------------------
+// CMultiTouchPointerEvent::StartTouch()
+// ----------------------------------------------------------------------------
+void CMultiTouchPointerEvent::StartTouch()
+    {
+    HTI_LOG_FUNC_IN( "CMultiTouchPointerEvent::StartTouch" );
+    TBool bcontinue=ETrue;
+    while (iTimeArray.Count()>0 && bcontinue)
+        {
+        TTimeIntervalMicroSeconds32* time=iTimeArray[0];
+        iTimeArray.Remove(0);        
+    	HTI_LOG_FORMAT( "Event time=%d ", time->Int() );    	
+        if (time->Int()==0) 
+            {
+			// execute immediately            
+			SimulatePointerEvent(); 
+            }
+        else
+        	{
+			// wait for specified time
+			iTimer.After( iStatus, *time );
+			SetActive();        
+			bcontinue=EFalse;
+        	}
+        delete time;
+        }
+    
+    if (iTimeArray.Count()==0)
+    	{
+		HTI_LOG_FORMAT( "Notify touch %d complete", iTouchNumber );
+		iEventHandler->NotifyTouchComplete(iTouchNumber);  
+    	}
+    HTI_LOG_FUNC_OUT( "CMultiTouchPointerEvent::StartTouch" );
+    }
+
+// ----------------------------------------------------------------------------
+// void CMultiTouchPointerEvent::InsertPointArrayL()
+// ----------------------------------------------------------------------------
+void CMultiTouchPointerEvent::InsertPointArrayL(TInt aX,TInt aY,TInt aZ,TRawEvent::TType aEventType)
+    {
+
+    TAdvancedPointer* point = new (ELeave) TAdvancedPointer;
+    CleanupStack::PushL(point);
+    iAdvPointerArray.AppendL(point);
+    CleanupStack::Pop();
+
+    point->X=aX;
+    point->Y=aY;
+    point->Z=aZ;
+    point->EventType=aEventType;
+
+    }
+
+// ----------------------------------------------------------------------------
+// void CMultiTouchPointerEvent::InsertTimeArrayL()
+// ----------------------------------------------------------------------------
+void CMultiTouchPointerEvent::InsertTimeArrayL(TTimeIntervalMicroSeconds32 aDelayTime)
+    {
+
+    TTimeIntervalMicroSeconds32* time=new (ELeave) TTimeIntervalMicroSeconds32(aDelayTime);
+    iTimeArray.AppendL(time);
+
+    }
+
+// ----------------------------------------------------------------------------
+// CMultiTouchPointerEvent::InterpolatePointL()
+// ----------------------------------------------------------------------------
+void CMultiTouchPointerEvent::InterpolatePointL(TInt aX1,TInt aY1, TInt aZ1, 
+        TInt aX2,TInt aY2, TInt aZ2, TTimeIntervalMicroSeconds32 aDragTime, TInt aStepCount)
+    {
+    HTI_LOG_FUNC_IN( "CMultiTouchPointerEvent::InterpolatePointL" );
+    TInt dx = (aX2-aX1)/aStepCount;
+    TInt dy = (aY2-aY1)/aStepCount;  
+    
+    TTimeIntervalMicroSeconds32 dt = aDragTime.Int()/aStepCount;
+    TInt X,Y,Z;
+    for (TInt i=1;i<=aStepCount;i++)
+        {         
+        if (i<aStepCount)
+            {
+            X=aX1+i*dx;
+            Y=aY1+i*dy;
+            Z=aZ1;
+            }
+        else
+            {
+            X=aX2;
+            Y=aY2;
+            Z=aZ2;
+            }             
+        AddPointL(dt,X,Y,Z,TRawEvent::EPointerMove);        
+        }
+    
+    HTI_LOG_FUNC_OUT( "CMultiTouchPointerEvent::InterpolatePointL" );
+    }
+// ----------------------------------------------------------------------------
+// CMultiTouchPointerEvent::RunL()
+// ----------------------------------------------------------------------------
+void CMultiTouchPointerEvent::RunL()
+    {
+    HTI_LOG_FUNC_IN( "CMultiTouchPointerEvent::RunL" );
+    SimulatePointerEvent();
+    StartTouch();
+    HTI_LOG_FUNC_OUT( "CMultiTouchPointerEvent::RunL" );
+    }
+
+// ----------------------------------------------------------------------------
+// CMultiTouchPointerEvent::RunError()
+// ----------------------------------------------------------------------------
+TInt CMultiTouchPointerEvent::RunError( TInt aError )
+    {
+    HTI_LOG_FORMAT( "CMultiTouchPointerEvent::RunError %d", aError );
+
+    return KErrNone;
+    }
+
+// ----------------------------------------------------------------------------
+// CMultiTouchPointerEvent::DoCancel()
+// ----------------------------------------------------------------------------
+void CMultiTouchPointerEvent::DoCancel()
+    {
+    HTI_LOG_FUNC_IN( "CMultiTouchPointerEvent::DoCancel" );
+    iTimer.Cancel();
+    HTI_LOG_FUNC_OUT( "CMultiTouchPointerEvent::DoCancel" );
+    }
+
+void CMultiTouchPointerEvent::PrintInfo()
+	{
+#ifdef __ENABLE_LOGGING__
+	HTI_LOG_FUNC_IN( "CMultiTouchPointerEvent::PrintInfo" );
+	
+	HTI_LOG_FORMAT( "PrintInfo touch number=%d ", iTouchNumber );
+	
+	TInt size=iTimeArray.Count(); 
+	HTI_LOG_FORMAT( "PrintInfo event array=%d ", size );	
+
+	TBuf<255> buf;
+
+	for (TInt i=0;i<size;i++)
+		{
+        buf.Format(KPrintInfoString, 
+                i, iTimeArray[i]->Int(),iAdvPointerArray[i]->EventType ,
+                iAdvPointerArray[i]->X ,iAdvPointerArray[i]->Y, iAdvPointerArray[i]->Z );
+        HTI_LOG_DES(buf);
+		}
+	HTI_LOG_FUNC_OUT( "CMultiTouchPointerEvent::PrintInfo" );
+#endif
+	}
+// ----------------------------------------------------------------------------
+// CMultiTouchPointerEvent::SimulatePointerEvent()
+// Sends the pointer event as a raw event.
+// ----------------------------------------------------------------------------
+void CMultiTouchPointerEvent::SimulatePointerEvent()
+    {
+    HTI_LOG_FUNC_IN( "CMultiTouchPointerEvent::SimulatePointerEvent" );    
+       
+	if (iAdvPointerArray.Count()>0)
+        {
+        TAdvancedPointer* pointer = iAdvPointerArray[0];    
+        iAdvPointerArray.Remove(0);
+        
+        iEventHandler->SimulateEvent(iTouchNumber, pointer->X, pointer->Y, pointer->Z,pointer->EventType);        
+        delete pointer;
+        }
+
+    HTI_LOG_FUNC_OUT( "CMultiTouchPointerEvent::SimulatePointerEvent" );
+
+    }
+void CMultiTouchPointerEvent::AddPointL(TTimeIntervalMicroSeconds32 aTime,
+		TInt aX, TInt aY, TInt aZ, TRawEvent::TType aEventType)
+	{
+	InsertPointArrayL( aX, aY, aZ,aEventType);
+	InsertTimeArrayL(aTime);
+	}
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiServicePlugins/HtiKeyEventServicePlugin/src/MultiTouchPointerEventHandler.cpp	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,286 @@
+/*
+* 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:  Functional implementation of advanced pointer multitouch service
+*
+*/
+
+// INCLUDE FILES
+#include "HtiKeyEventServicePlugin.h"
+#include "MultiTouchPointerEventHandler.h"
+#include "MultiTouchPointerEvent.h"
+
+#include <HtiDispatcherInterface.h>
+#include <HtiLogging.h>
+
+// CONSTANTS
+
+
+// ----------------------------------------------------------------------------
+// CMultiTouchPointerEventHandler::NewL()
+// ----------------------------------------------------------------------------
+CMultiTouchPointerEventHandler* CMultiTouchPointerEventHandler::NewL(MHtiMultiTouchObserver& aObserver)
+    {
+    HTI_LOG_FUNC_IN( "CMultiTouchPointerEventHandler::NewL" );
+    CMultiTouchPointerEventHandler* self = new (ELeave) CMultiTouchPointerEventHandler(aObserver);
+    CleanupStack::PushL ( self );
+    self->ConstructL();
+    CleanupStack::Pop();
+    HTI_LOG_FUNC_OUT( "CMultiTouchPointerEventHandler::NewL" );
+    return self;
+    }
+
+// ----------------------------------------------------------------------------
+// CMultiTouchPointerEventHandler::CMultiTouchPointerEventHandler()
+// ----------------------------------------------------------------------------
+CMultiTouchPointerEventHandler::CMultiTouchPointerEventHandler(MHtiMultiTouchObserver& aObserver)
+	:iFinishedCount(0),	iObserver(aObserver)
+    {
+    HTI_LOG_TEXT( "CMultiTouchPointerEventHandler constructor" );
+    }
+
+// ----------------------------------------------------------------------------
+// CMultiTouchPointerEventHandler::~CMultiTouchPointerEventHandler()
+// ----------------------------------------------------------------------------
+CMultiTouchPointerEventHandler::~CMultiTouchPointerEventHandler()
+    {
+    HTI_LOG_TEXT( "CMultiTouchPointerEventHandler destructor" );    
+    Clear();
+    iWsSession.Close();
+    }
+
+// ----------------------------------------------------------------------------
+// CMultiTouchPointerEventHandler::ConstructL()
+// ----------------------------------------------------------------------------
+void CMultiTouchPointerEventHandler::ConstructL()
+    {
+    HTI_LOG_TEXT( "CMultiTouchPointerEventHandler::ConstructL" ); 
+    User::LeaveIfError( iWsSession.Connect() );
+    }
+// ----------------------------------------------------------------------------
+// CMultiTouchPointerEventHandler::Clear()
+// ----------------------------------------------------------------------------
+void CMultiTouchPointerEventHandler::Clear()
+	{
+	HTI_LOG_TEXT( "CMultiTouchPointerEventHandler::Clear" ); 
+	iTouchPointerArray.ResetAndDestroy();
+	iFinishedCount=0;
+	}
+// ----------------------------------------------------------------------------
+// CMultiTouchPointerEventHandler::NotifyTouchComplete()
+// ----------------------------------------------------------------------------
+void CMultiTouchPointerEventHandler::NotifyTouchComplete(TUint8 aTouchNumber)
+    {
+    HTI_LOG_FUNC_IN("CMultiTouchPointerEventHandler::NotifyTouchComplete");
+    
+    iFinishedCount++;
+    HTI_LOG_FORMAT( "touch number %d finished", aTouchNumber);
+    HTI_LOG_FORMAT( "%d touch finished", iFinishedCount);
+    
+    if(iTouchPointerArray.Count() == iFinishedCount)
+    	{
+		// notify observer
+		iObserver.NotifyMultiTouchComplete();
+    	}
+    
+    HTI_LOG_FUNC_OUT("CMultiTouchPointerEventHandler::NotifyTouchComplete");
+    }
+// ----------------------------------------------------------------------------
+// CMultiTouchPointerEventHandler::ParsePoint()
+// ----------------------------------------------------------------------------
+TBool CMultiTouchPointerEventHandler::ParsePoint( const TDesC8& aData, TInt& aoffset,
+		TInt& aX, TInt& aY, TInt& aZ, 
+		TTimeIntervalMicroSeconds32& aWait, TTimeIntervalMicroSeconds32& aHold )
+    {
+    HTI_LOG_FUNC_IN( "CMultiTouchPointerEventHandler::ParsePoint" );
+    
+    TInt dataLength = aData.Length();
+    if ( dataLength-aoffset < 14 ) 
+        return EFalse ;
+    
+    aX = aData[aoffset] + ( aData[aoffset+1] << 8 );
+    aoffset += 2;
+    
+    aY = aData[aoffset] + ( aData[aoffset+1] << 8 );
+    aoffset += 2;
+
+    aZ = aData[aoffset] + ( aData[aoffset+1] << 8 );
+    aoffset += 2;
+
+    aWait = (aData[aoffset] + ( aData[aoffset+1] << 8 )
+                + ( aData[aoffset+2] << 16 ) + (aData[aoffset+3] << 24) ) * 1000;
+    aoffset += 4;      
+    
+    aHold = ( aData[aoffset] + ( aData[aoffset+1] << 8 )
+                + ( aData[aoffset+2] << 16 ) + (aData[aoffset+3] << 24) ) * 1000;
+    aoffset += 4;
+    
+    HTI_LOG_FUNC_OUT( "CMultiTouchPointerEventHandler::ParsePoint" );
+    return ETrue;
+    }
+// ----------------------------------------------------------------------------
+// CMultiTouchPointerEventHandler::ParseMove()
+// ----------------------------------------------------------------------------
+TBool CMultiTouchPointerEventHandler::ParseMove( const TDesC8& aData, TInt& aoffset,
+		TTimeIntervalMicroSeconds32& aDragTime, TInt& aStepCount )
+    {
+    HTI_LOG_FUNC_IN( "CMultiTouchPointerEventHandler::ParseMove" );
+    
+    TInt dataLength = aData.Length();
+    if ( dataLength-aoffset < 6 ) 
+        return EFalse ;
+    
+    aDragTime = ( aData[aoffset] + ( aData[aoffset+1] << 8 )
+				+ ( aData[aoffset+2] << 16 ) + (aData[aoffset+3] << 24) ) * 1000;
+    aoffset += 4;
+    
+	aStepCount = aData[aoffset] + ( aData[aoffset+1] << 8 );
+	aoffset += 2;
+    
+    HTI_LOG_FUNC_OUT( "CMultiTouchPointerEventHandler::ParseMove" );
+    return ETrue;
+    }
+// ----------------------------------------------------------------------------
+// CMultiTouchPointerEventHandler::HandleMultiTouchL()
+// ----------------------------------------------------------------------------
+TBool CMultiTouchPointerEventHandler::HandleMultiTouchL( const TDesC8& aData )
+    {
+    HTI_LOG_FUNC_IN( "CMultiTouchPointerEventHandler::HandleMultiTouchL" );
+    TBool validparameter=EFalse;
+    
+    TInt dataLength = aData.Length();
+    if ( dataLength < 1 )
+        return validparameter;
+	
+    // Parse the parameters - correct length is already verified
+	TInt offset = 0;
+
+    TInt touchCount = aData[offset];
+    offset += 1;
+    HTI_LOG_FORMAT( "Number of touches: %d", touchCount );
+    if (touchCount<=0)
+    	return validparameter;
+
+    for(TInt i=0; i<touchCount; i++)
+        {
+        //check valid data length
+        if(dataLength-offset < 3)
+            return validparameter;
+        
+        TInt pointerNumber = aData[offset];
+        offset += 1;
+        HTI_LOG_FORMAT( "Pointer Number %d", pointerNumber );
+        
+        TInt pointerCount = aData[offset] + ( aData[offset+1] << 8 );
+        offset += 2;
+        HTI_LOG_FORMAT( "Number of points: %d", pointerCount );
+        
+        if (pointerCount == 0 )
+            return validparameter;
+        
+        CMultiTouchPointerEvent* touch = CMultiTouchPointerEvent::NewL(pointerNumber,this);        
+        CleanupStack::PushL(touch);
+        iTouchPointerArray.AppendL(touch);
+        CleanupStack::Pop();
+        
+        TInt lastX, lastY, lastZ, stepCount; 
+        TTimeIntervalMicroSeconds32 dragTime;
+        
+        for (TInt j=0;j<pointerCount;j++)
+        	{
+			// read point
+			TInt X1, Y1, Z1; 
+			TTimeIntervalMicroSeconds32 waitTime, holdTime;
+			if (!ParsePoint( aData, offset,X1, Y1, Z1, waitTime, holdTime))
+				return validparameter;
+			
+			HTI_LOG_FORMAT( "X coord down = %d", X1 );
+			HTI_LOG_FORMAT( "Y coord down = %d", Y1 );
+			HTI_LOG_FORMAT( "Z coord down = %d", Z1 );
+			HTI_LOG_FORMAT( "Event wait time = %d", waitTime.Int() );   
+			HTI_LOG_FORMAT( "Point holding time = %d", holdTime.Int() );
+			
+			if ( waitTime.Int() < 0 || holdTime.Int() < 0 )
+				return validparameter;
+			
+			// add move event from last point to this point 
+			if (j!=0)
+				{
+				HTI_LOG_FORMAT( "Point dragging time = %d", dragTime.Int() );
+				HTI_LOG_FORMAT( "Step count between two points = %d", stepCount );
+				touch->InterpolatePointL(lastX, lastY, lastZ,X1,Y1,Z1,dragTime,stepCount);
+				}				
+			
+			// set last point
+			lastX=X1;
+			lastY=Y1;
+			lastZ=Z1;
+			
+			// wait event
+			touch->AddPointL(waitTime,X1,Y1,Z1,TRawEvent::EButton1Down);
+			
+			// hold event
+			touch->AddPointL(holdTime, X1,Y1,Z1,TRawEvent::EPointerMove);
+			
+			if (j!=pointerCount-1)
+				{
+				// not last point
+				if (!ParseMove(aData, offset, dragTime, stepCount))
+					return validparameter;				
+				if (dragTime.Int() < 0 || stepCount <= 0)
+					return validparameter;        				
+				}
+			else
+				{
+				// last point
+				touch->AddPointL(0,X1,Y1,Z1,TRawEvent::EButton1Up);
+				}
+        	}  
+        
+            touch->PrintInfo();
+
+        } 
+
+    
+    for (TInt i=0;i<touchCount;i++)
+        iTouchPointerArray[i]->StartTouch();
+    
+    validparameter=ETrue;
+    
+    HTI_LOG_FUNC_OUT( "CMultiTouchPointerEventHandler::HandleMultiTouchL" );
+    return validparameter;
+    }	
+
+void CMultiTouchPointerEventHandler::SimulateEvent(TUint8 aTouchNumber, 
+		TInt aX, TInt aY, TInt aZ, TRawEvent::TType aEventType)
+    {
+    HTI_LOG_FUNC_IN( "CMultiTouchPointerEventHandler::SimulateEvent" );
+    
+	TRawEvent rawEvent;
+	rawEvent.SetPointerNumber( aTouchNumber ); 
+	rawEvent.Set( aEventType, aX,  aY,  aZ);   
+
+	HTI_LOG_FORMAT( "SimulatePointer touch number=%d ", aTouchNumber );
+	HTI_LOG_FORMAT( "SimulatePointer event=%d ", aEventType );
+	HTI_LOG_FORMAT( "SimulatePointer X=%d ", aX );
+	HTI_LOG_FORMAT( "SimulatePointer Y=%d ", aY );
+	HTI_LOG_FORMAT( "SimulatePointer Z=%d", aZ );
+	
+	iWsSession.SimulateRawEvent( rawEvent );
+	iWsSession.Flush();
+	
+    HTI_LOG_FUNC_OUT( "CMultiTouchPointerEventHandler::SimulateEvent" );
+
+    }
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiServicePlugins/HtiKeyEventServicePlugin/src/PointerEventHandler.cpp	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,918 @@
+/*
+* 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:  Functional implementation of pointer event service
+*
+*/
+
+// INCLUDE FILES
+#include "HtiKeyEventServicePlugin.h"
+#include "PointerEventHandler.h"
+
+
+#include <HtiDispatcherInterface.h>
+#include <HtiLogging.h>
+
+
+// CONSTANTS
+_LIT8( KErrorMissingCommand, "Command was not given - message was empty" );
+_LIT8( KErrorServiceNotReady, "Service is busy - possibly executing long running pointer events" );
+_LIT8( KErrorInvalidParameters, "Command parameters not valid" );
+_LIT8( KErrorUnrecognizedCommand, "Unrecognized command" );
+_LIT8( KErrorInternalFailure, "Internal pointer command failure" );
+_LIT8( KErrorGetHALData, "Can not get the HAL data" );
+
+const TInt KTapCmdLength = 10;
+const TInt KDragMultiCmdMinLength = 14;
+const TInt KSinglePointerCmdLength = 4;
+const TInt KAdvancedTapScreenCmdMinLength = 16;
+const TInt KPinchZoomCmdMinLength = 30;
+
+
+// ----------------------------------------------------------------------------
+// CPointerEventHandler::NewL()
+// ----------------------------------------------------------------------------
+CPointerEventHandler* CPointerEventHandler::NewL()
+    {
+    HTI_LOG_FUNC_IN( "CPointerEventHandler::NewL" );
+    CPointerEventHandler* self = new (ELeave) CPointerEventHandler();
+    CleanupStack::PushL ( self );
+    self->ConstructL();
+    CleanupStack::Pop();
+    HTI_LOG_FUNC_OUT( "CPointerEventHandler::Done" );
+    return self;
+    }
+
+// ----------------------------------------------------------------------------
+// CPointerEventHandler::CPointerEventHandler()
+// ----------------------------------------------------------------------------
+CPointerEventHandler::CPointerEventHandler()
+    : CActive( CActive::EPriorityStandard ), iReady( ETrue ), iCommand( 0 ), iMultiTouchHandler(NULL),
+      iState( EPointerUp )
+    {
+    }
+
+// ----------------------------------------------------------------------------
+// CPointerEventHandler::~CPointerEventHandler()
+// ----------------------------------------------------------------------------
+CPointerEventHandler::~CPointerEventHandler()
+    {
+    HTI_LOG_TEXT( "CPointerEventHandler destroy" );
+    Cancel();
+    iTimer.Close();
+    iWsSession.Close();
+    if ( iCoords )
+        {
+        iCoords->Close();
+        }
+    delete iCoords;
+    delete iMultiTouchHandler;
+	
+	iAdvancedPointers.ResetAndDestroy();
+	iDelayArray.ResetAndDestroy();  
+	iAdvPointerMoveArray.ResetAndDestroy(); 
+    }
+
+// ----------------------------------------------------------------------------
+// CPointerEventHandler::ConstructL()
+// ----------------------------------------------------------------------------
+void CPointerEventHandler::ConstructL()
+    {
+    HTI_LOG_TEXT( "CPointerEventHandler::ConstructL" );
+    User::LeaveIfError( iWsSession.Connect() );
+    User::LeaveIfError( iTimer.CreateLocal() );
+    CActiveScheduler::Add( this );
+    }
+
+// ----------------------------------------------------------------------------
+// void CPointerEventHandler::SetDispatcher()
+// ----------------------------------------------------------------------------
+void CPointerEventHandler::SetDispatcher( MHtiDispatcher* aDispatcher )
+    {
+    iDispatcher = aDispatcher;
+    }
+
+// ----------------------------------------------------------------------------
+// CPointerEventHandler::RunL()
+// ----------------------------------------------------------------------------
+void CPointerEventHandler::RunL()
+    {
+    HTI_LOG_FUNC_IN( "CPointerEventHandler::RunL" );
+
+    if ( iCommand == ETapScreen || iCommand == EAdvancedTapScreen )
+        {
+        ChangePointerStateL();
+        }
+
+    else if ( iCommand == ETapAndDrag  && iState == EPointerDown )
+        {
+        PointerMove();
+        PointerUp();
+        SendOkMsgL();
+        iReady = ETrue;
+        }
+
+    else if ( iCommand == ETapAndDragMultipoint )
+        {
+        if ( iState == EPointerUp )  // Starting a new line
+            {
+            PointerDown();
+            iTapCount--;
+            iTimer.After( iStatus, iEventDelay );
+            SetActive();
+            }
+        else
+            {
+            MoveToNextPointL(); // Continuing current line
+            }
+        }
+    
+    else if ( iCommand == EPinchZoom )
+        {
+        PointerMove();
+        if ( !AdvancedStartDelay())
+            {
+            PointerUp();
+            SendOkMsgL();
+            iAdvPointerMoveArray.ResetAndDestroy(); 
+            iReady = ETrue;
+            }
+        }		
+    
+    else if ( iCommand == EMultiTouch )
+        {
+        SendOkMsgL();
+        iMultiTouchHandler->Clear();
+        iReady = ETrue;
+        }		
+    HTI_LOG_FUNC_OUT( "CPointerEventHandler::RunL" );
+    }
+
+// ----------------------------------------------------------------------------
+// CPointerEventHandler::RunError()
+// ----------------------------------------------------------------------------
+TInt CPointerEventHandler::RunError( TInt aError )
+    {
+    HTI_LOG_FORMAT( "CPointerEventHandler::RunError %d", aError );
+
+    TInt dispatchResult = KErrNone;
+    TRAP( dispatchResult, SendErrorMessageL( aError, KErrorInternalFailure ) );
+    if ( dispatchResult != KErrNone )
+        {
+        HTI_LOG_FORMAT( "CPointerEventHandler::RunError: Failed to send error report to framework: %d.", dispatchResult );
+        }
+    iReady = ETrue;
+    return KErrNone;
+    }
+
+// ----------------------------------------------------------------------------
+// CPointerEventHandler::DoCancel()
+// ----------------------------------------------------------------------------
+void CPointerEventHandler::DoCancel()
+    {
+    iTimer.Cancel();
+    }
+
+// ----------------------------------------------------------------------------
+// CPointerEventHandler::ProcessMessageL()
+// ----------------------------------------------------------------------------
+void CPointerEventHandler::ProcessMessageL( const TDesC8& aMessage,
+    THtiMessagePriority /*aPriority*/ )
+    {
+    HTI_LOG_FUNC_IN("CPointerEventHandler::ProcessMessageL");
+    HTI_LOG_FORMAT("Msg len: %d.", aMessage.Length());
+
+    if ( !iReady )
+        {
+        SendErrorMessageL( ENotReadyCommand, KErrorServiceNotReady );
+        return;
+        }
+    if ( aMessage.Length() == 0 )
+        {
+        SendErrorMessageL( EMissingCommand, KErrorMissingCommand );
+        return;
+        }
+
+    User::ResetInactivityTime();
+    iCommand = aMessage.Ptr()[0];
+    switch ( iCommand )
+        {
+        case ETapScreen:
+            HandleTapScreenL( aMessage.Right( aMessage.Length() - 1 ) );
+            break;
+        case ETapAndDrag:
+            HandleTapAndDragL( aMessage.Right( aMessage.Length() - 1 ) );
+            break;
+        case ETapAndDragMultipoint:
+            HandleTapAndDragMultipointL(
+                aMessage.Right( aMessage.Length() - 1 ) );
+            break;
+        case EPressPointerDown:
+        case ELiftPointerUp:
+            HandlePointerDownOrUpL( aMessage.Right( aMessage.Length() - 1 ) );
+            break;
+		case EAdvancedTapScreen:
+		    HandleAdvancedTapScreenL( aMessage.Right( aMessage.Length() - 1 ) );
+            break;		
+		case EPinchZoom: 
+		    HandlePinchZoomL( aMessage.Right( aMessage.Length() - 1 ) );
+            break;
+		case EMultiTouch:
+			HandleMultiTouchL(aMessage.Right( aMessage.Length() - 1 ));
+			break;
+        default:
+            SendErrorMessageL( EUnrecognizedCommand,
+                KErrorUnrecognizedCommand );
+            break;
+        }
+
+    HTI_LOG_FUNC_OUT( "CPointerEventHandler::ProcessMessageL: Done" );
+    }
+
+// ----------------------------------------------------------------------------
+// CPointerEventHandler::HandleTapScreenL()
+// Handles single or multiple taps to one point.
+// ----------------------------------------------------------------------------
+void CPointerEventHandler::HandleTapScreenL( const TDesC8& aData )
+    {
+    HTI_LOG_FUNC_IN( "CPointerEventHandler::HandleTapScreenL" );
+
+    if ( aData.Length() != KTapCmdLength )
+        {
+        SendErrorMessageL( EInvalidParameters, KErrorInvalidParameters );
+        return;
+        }
+
+    // Parse the parameters - correct length is already verified
+    TInt offset = 0;
+    iX = aData[offset] + ( aData[offset+1] << 8 );
+    offset += 2;
+    HTI_LOG_FORMAT( "X coord = %d", iX );
+    iY = aData[offset] + ( aData[offset+1] << 8 );
+    offset += 2;
+    HTI_LOG_FORMAT( "Y coord = %d", iY );
+    iEventDelay = ( aData[offset] + ( aData[offset+1] << 8 ) ) * 1000;
+    offset += 2;
+    HTI_LOG_FORMAT( "Time to hold down = %d", iEventDelay.Int() );
+    iTapCount = aData[offset] + ( aData[offset+1] << 8 );
+    offset += 2;
+    HTI_LOG_FORMAT( "Tap count = %d", iTapCount );
+    iActionDelay = ( aData[offset] + ( aData[offset+1] << 8 ) ) * 1000;
+    HTI_LOG_FORMAT( "Pause between taps = %d", iActionDelay.Int() );
+
+    // Start tapping
+    iReady = EFalse;
+    ChangePointerStateL();
+
+    HTI_LOG_FUNC_OUT( "CPointerEventHandler::HandleTapScreenL" );
+    }
+	
+
+
+// ----------------------------------------------------------------------------
+// CPointerEventHandler::HandleTapAndDragL()
+// Handles a single drag and drop with straight line.
+// ----------------------------------------------------------------------------
+void CPointerEventHandler::HandleTapAndDragL( const TDesC8& aData )
+    {
+    HTI_LOG_FUNC_IN( "CPointerEventHandler::HandleTapAndDragL" );
+
+    if ( aData.Length() != KTapCmdLength )
+        {
+        SendErrorMessageL( EInvalidParameters, KErrorInvalidParameters );
+        return;
+        }
+
+    TInt offset = 0;
+    iX = aData[offset] + ( aData[offset+1] << 8 );
+    offset += 2;
+    HTI_LOG_FORMAT( "X coord down = %d", iX );
+    iY = aData[offset] + ( aData[offset+1] << 8 );
+    offset += 2;
+    HTI_LOG_FORMAT( "Y coord down = %d", iY );
+    TInt xUp = aData[offset] + ( aData[offset+1] << 8 );
+    offset += 2;
+    HTI_LOG_FORMAT( "X coord up = %d", xUp );
+    TInt yUp = aData[offset] + ( aData[offset+1] << 8 );
+    offset += 2;
+    HTI_LOG_FORMAT( "Y coord up = %d", yUp );
+    iEventDelay = ( aData[offset] + ( aData[offset+1] << 8 ) ) * 1000;
+    HTI_LOG_FORMAT( "Drag time = %d", iEventDelay.Int() );
+
+    iReady = EFalse;
+    PointerDown();
+    iX = xUp;
+    iY = yUp;
+    iTimer.After( iStatus, iEventDelay );
+    SetActive();
+
+    HTI_LOG_FUNC_OUT( "CPointerEventHandler::HandleTapAndDragL" );
+    }
+
+// ----------------------------------------------------------------------------
+// CPointerEventHandler::HandleTapAndDragMultipointL()
+// Handles drawing one or more curvy lines.
+// ----------------------------------------------------------------------------
+void CPointerEventHandler::HandleTapAndDragMultipointL( const TDesC8& aData )
+    {
+    HTI_LOG_FUNC_IN( "CPointerEventHandler::HandleTapAndDragMultipointL" );
+
+    TInt dataLength = aData.Length();
+    if ( dataLength < KDragMultiCmdMinLength || dataLength % 2 != 0 )
+        {
+        SendErrorMessageL( EInvalidParameters, KErrorInvalidParameters );
+        return;
+        }
+
+    TInt offset = 0;
+    iEventDelay = ( aData[offset] + ( aData[offset+1] << 8 ) ) * 1000;
+    offset += 2;
+    HTI_LOG_FORMAT( "Time between events = %d", iEventDelay.Int() );
+    iActionDelay = ( aData[offset] + ( aData[offset+1] << 8 ) ) * 1000;
+    offset += 2;
+    HTI_LOG_FORMAT( "Pause between lines = %d", iActionDelay.Int() );
+
+    if ( iCoords == NULL )
+        {
+        iCoords = new ( ELeave ) RArray<TInt>();
+        }
+    iCoords->Reset();
+
+    // Read integers from aData to the array, all integers are 2 bytes
+    while ( offset < dataLength )
+        {
+        iCoords->AppendL( aData[offset] + ( aData[offset + 1] << 8 ) );
+        offset += 2;
+        }
+
+    iReady = EFalse;
+    iTapCount = ( *iCoords )[0];
+    iCoords->Remove( 0 );
+    iX = ( *iCoords )[0];
+    iCoords->Remove( 0 );
+    iY = ( *iCoords )[0];
+    iCoords->Remove( 0 );
+    HTI_LOG_FORMAT( "Point count for first line = %d", iTapCount );
+    PointerDown();
+    iTapCount--;
+    iTimer.After( iStatus, iEventDelay );
+    SetActive();
+
+    HTI_LOG_FUNC_OUT( "CPointerEventHandler::HandleTapAndDragMultipointL" );
+    }
+
+// ----------------------------------------------------------------------------
+// CPointerEventHandler::HandlePointerDownOrUpL()
+// Handles pushing pointer down in one point or lifting it up.
+// This is synchronous operation and sends OK message right after the event
+// is simulated.
+// ----------------------------------------------------------------------------
+void CPointerEventHandler::HandlePointerDownOrUpL( const TDesC8& aData )
+    {
+    HTI_LOG_FUNC_IN( "CPointerEventHandler::HandlePointerDownOrUpL" );
+    if ( aData.Length() != KSinglePointerCmdLength )
+        {
+        SendErrorMessageL( EInvalidParameters, KErrorInvalidParameters );
+        return;
+        }
+
+    // Parse the parameters - correct length is already verified
+    TInt offset = 0;
+    iX = aData[offset] + ( aData[offset+1] << 8 );
+    offset += 2;
+    HTI_LOG_FORMAT( "X coord = %d", iX );
+    iY = aData[offset] + ( aData[offset+1] << 8 );
+    offset += 2;
+    HTI_LOG_FORMAT( "Y coord = %d", iY );
+
+    if ( iCommand == EPressPointerDown )
+        {
+        PointerDown();
+        }
+    else
+        {
+        PointerUp();
+        }
+    SendOkMsgL();
+    HTI_LOG_FUNC_OUT( "CPointerEventHandler::HandlePointerDownOrUpL" );
+    }
+
+// ----------------------------------------------------------------------------
+// CPointerEventHandler::ChangePointerStateL()
+// Decides whether to do  "pointer down" or "pointer up" event next or if
+// operation is complete.
+// This function is used by ETapScreen command.
+// ----------------------------------------------------------------------------
+void CPointerEventHandler::ChangePointerStateL()
+    {
+    HTI_LOG_FUNC_IN( "CPointerEventHandler::ChangePointerStateL" );
+    HTI_LOG_FORMAT( "Taps remaining = %d", iTapCount );
+    if ( iTapCount < 1 )
+        {
+        SendOkMsgL();
+        iReady = ETrue;
+        return;
+        }
+
+    if ( iState == EPointerUp )
+        {
+        PointerDown();
+        iTimer.After( iStatus, iEventDelay );
+        SetActive();
+        }
+    else if ( iState == EPointerDown )
+        {
+        PointerUp();
+        iTapCount--; // one tap done
+        if ( iTapCount > 0 ) // do we continue tapping?
+            {
+            iTimer.After( iStatus, iActionDelay );
+            SetActive();
+            }
+        else
+            {
+            SendOkMsgL();  // tapping done
+            iReady = ETrue;
+            }
+        }
+    HTI_LOG_FUNC_OUT( "CPointerEventHandler::ChangePointerStateL" );
+    }
+	
+	// ----------------------------------------------------------------------------
+	
+// ----------------------------------------------------------------------------
+// CPointerEventHandler::HandleAdvancedTapScreenL()
+// ****cherry.
+// ----------------------------------------------------------------------------
+
+void CPointerEventHandler::HandleAdvancedTapScreenL( const TDesC8& aData )
+    {
+    
+    HTI_LOG_FUNC_IN( "CPointerEventHandler::HandleAdvancedTapScreenL" );
+
+    if ( aData.Length() < KAdvancedTapScreenCmdMinLength ) //KAdvancedTapScreenCmdMinLength needs to be defined
+        {
+        SendErrorMessageL( EInvalidParameters, KErrorInvalidParameters );
+        return;
+        }
+	TInt dataLength = aData.Length();
+	
+    // Parse the parameters - correct length is already verified
+	TInt offset = 0;
+	
+	iEventDelay = ( aData[offset] + ( aData[offset+1] << 8 ) ) * 1000;
+    offset += 2;
+    HTI_LOG_FORMAT( "Time to hold down = %d", iEventDelay.Int() );
+    iTapCount = aData[offset] + ( aData[offset+1] << 8 );
+    offset += 2;
+    HTI_LOG_FORMAT( "Tap count = %d", iTapCount );
+    iActionDelay = ( aData[offset] + ( aData[offset+1] << 8 ) ) * 1000;
+	offset += 2;
+    HTI_LOG_FORMAT( "Pause between taps = %d", iActionDelay.Int() );		
+	TInt pointerCount = aData[offset] + ( aData[offset+1] << 8 );
+	offset += 2;
+	HTI_LOG_FORMAT( "Pointer Count = %d", pointerCount );
+	
+    iAdvancedPointers.ResetAndDestroy();
+
+    // Read integers from aData to the array, all integers are 2 bytes
+    for ( TInt i = 0; i < pointerCount; i++ )
+        {
+		TAdvancedPointer* advancedPointer = new (ELeave) TAdvancedPointer;
+		
+		advancedPointer->PointerNum = aData[offset];
+		offset += 1;
+		HTI_LOG_FORMAT( "%d Pointer", advancedPointer->PointerNum );
+		
+		advancedPointer->X = aData[offset] + ( aData[offset+1] << 8 );
+		offset += 2;
+		HTI_LOG_FORMAT( "X coord down = %d", advancedPointer->X );
+		
+		advancedPointer->Y = aData[offset] + ( aData[offset+1] << 8 );
+		offset += 2;
+		HTI_LOG_FORMAT( "Y coord down = %d", advancedPointer->Y );
+
+		advancedPointer->Z = aData[offset] + ( aData[offset+1] << 8 );
+		offset += 2;
+		HTI_LOG_FORMAT( "Z coord down = %d", advancedPointer->Z );
+		
+        iAdvancedPointers.AppendL( advancedPointer );
+        }
+	
+    // Start tapping
+    iReady = EFalse;
+    ChangePointerStateL();
+
+    HTI_LOG_FUNC_OUT( "CPointerEventHandler::HandleAdvancedTapScreenL" );
+    
+    }
+	
+// ----------------------------------------------------------------------------
+// CPointerEventHandler::HandlePinchZoomL()
+// ****cherry
+// ----------------------------------------------------------------------------
+void CPointerEventHandler::HandlePinchZoomL( const TDesC8& aData )
+    {
+    HTI_LOG_FUNC_IN( "CPointerEventHandler::HandlePinchZoomL" );
+
+    if ( aData.Length() < KPinchZoomCmdMinLength ) //KPinchZoomCmdMinLength needs to be defined
+        {
+        SendErrorMessageL( EInvalidParameters, KErrorInvalidParameters );
+        return;
+        }
+	TInt dataLength = aData.Length();
+	
+    // Parse the parameters - correct length is already verified
+	TInt offset = 0;
+	
+	TTimeIntervalMicroSeconds32 eventDelay = ( aData[offset] + ( aData[offset+1] << 8 ) ) * 1000;
+	offset += 2;
+    HTI_LOG_FORMAT( "Event time = %d", eventDelay.Int() );
+    
+    if (eventDelay.Int()<=0)
+        {
+        SendErrorMessageL( EInvalidParameters, KErrorInvalidParameters );
+        return;        
+        }
+    
+    TInt stepCount = aData[offset] + ( aData[offset+1] << 8 );
+    offset += 2;
+    HTI_LOG_FORMAT( "Step Count = %d", stepCount );
+        
+	TInt pointerCount = aData[offset] + ( aData[offset+1] << 8 );
+	offset += 2;
+	HTI_LOG_FORMAT( "Pointer Count = %d", pointerCount );
+	
+	iAdvPointerMoveArray.ResetAndDestroy();	
+
+    // Read integers from aData to the array, all integers are 2 bytes
+    for ( TInt i = 0; i < pointerCount; i++ )
+        {
+        TInt pointNumber,X1, Y1, Z1,X2,Y2, Z2 ;
+        
+        // invalid pointer array 
+        if ((dataLength-offset)<3*2*2+1)
+            {
+            SendErrorMessageL( EInvalidParameters, KErrorInvalidParameters );
+            return;        
+            }        
+        // start point	
+		pointNumber = aData[offset];
+		offset += 1;
+		HTI_LOG_FORMAT( "%d Pointer Start", pointNumber );
+		
+		X1 = aData[offset] + ( aData[offset+1] << 8 );
+		offset += 2;
+		HTI_LOG_FORMAT( "X coord down = %d", X1 );
+		
+		Y1 = aData[offset] + ( aData[offset+1] << 8 );
+		offset += 2;
+		HTI_LOG_FORMAT( "Y coord down = %d", Y1 );
+
+		Z1 = aData[offset] + ( aData[offset+1] << 8 );
+		offset += 2;
+		HTI_LOG_FORMAT( "Z coord down = %d", Z1 );		
+
+		// end point     
+		X2 = aData[offset] + ( aData[offset+1] << 8 );
+        offset += 2;
+        HTI_LOG_FORMAT( "X coord down = %d", X2 );
+        
+        Y2 = aData[offset] + ( aData[offset+1] << 8 );
+        offset += 2;
+        HTI_LOG_FORMAT( "Y coord down = %d", Y2 );
+
+        Z2 = aData[offset] + ( aData[offset+1] << 8 );
+        offset += 2;
+        HTI_LOG_FORMAT( "Z coord down = %d", Z2 );
+        
+        AdvanceAddMiddlePointL(pointNumber,X1, Y1, Z1,X2,Y2, Z2,stepCount );        
+
+        }
+    	
+    AdvancedAddDelayArray(eventDelay,stepCount);
+   
+    iReady = EFalse;
+    PointerDown();
+
+    if (!AdvancedStartDelay())
+        {
+        SendErrorMessageL( EInvalidParameters, KErrorInvalidParameters );
+        return;        
+        }
+
+    HTI_LOG_FUNC_OUT( "CPointerEventHandler::HandlePinchZoomL" );
+    }	
+// ----------------------------------------------------------------------------
+// void CPointerEventHandler::HandleMultiTouchL()
+// ----------------------------------------------------------------------------
+void CPointerEventHandler::HandleMultiTouchL( const TDesC8& aData )
+	{
+	HTI_LOG_FUNC_IN( "CPointerEventHandler::HandleMultiTouchL" );	
+	
+	if (iMultiTouchHandler == NULL)
+		iMultiTouchHandler=CMultiTouchPointerEventHandler::NewL(*this);	
+	
+    if ( !iMultiTouchHandler->HandleMultiTouchL ( aData ) )
+    	{
+		iMultiTouchHandler->Clear();
+		SendErrorMessageL( EInvalidParameters, KErrorInvalidParameters );
+    	}
+    else
+		iReady = EFalse;
+	
+	HTI_LOG_FUNC_OUT( "CPointerEventHandler::HandleMultiTouchL" );
+	}
+// ----------------------------------------------------------------------------
+// void CPointerEventHandler::NotifyMultiTouchComplete()
+// ----------------------------------------------------------------------------
+void CPointerEventHandler::NotifyMultiTouchComplete()
+    {
+    HTI_LOG_FUNC_IN("CPointerEventHandler::NotifyMultiTouchComplete"); 
+    
+    // wait for 1000 microsecond then clear multi touch and send ok msg 
+    TTimeIntervalMicroSeconds32 time(1000);
+    iTimer.After( iStatus, time );
+    SetActive();    
+    
+    HTI_LOG_FUNC_OUT("CPointerEventHandler::NotifyMultiTouchComplete");
+    }
+// ----------------------------------------------------------------------------
+// CPointerEventHandler::AdvancedStartDelay()
+// ----------------------------------------------------------------------------
+TBool CPointerEventHandler::AdvancedStartDelay()
+    {
+    HTI_LOG_FUNC_IN( "CPointerEventHandler::AdvancedStartDelay" );
+    TBool ret=EFalse;
+    if (iDelayArray.Count()>0)
+        {
+        TTimeIntervalMicroSeconds32* time=iDelayArray[0];
+        iDelayArray.Remove(0);
+        ret=ETrue;
+  
+        iTimer.After( iStatus, *time );
+        delete time;
+        SetActive();
+        }
+    HTI_LOG_FUNC_OUT( "CPointerEventHandler::AdvancedStartDelay" );
+    return ret;
+    }
+
+// ----------------------------------------------------------------------------
+// CPointerEventHandler::AdvanceAddMiddlePointL()
+// ----------------------------------------------------------------------------
+void CPointerEventHandler::AdvanceAddMiddlePointL(TInt aPointNumber,TInt aX1,TInt aY1, TInt aZ1, 
+        TInt aX2,TInt aY2, TInt aZ2 , TInt aStepCount )
+    {
+    HTI_LOG_FUNC_IN( "CPointerEventHandler::AdvanceAddMiddlePointL" );
+    TInt dx=(aX2-aX1)/aStepCount;
+    TInt dy=(aY2-aY1)/aStepCount;  
+    
+    for (TInt i=0;i<=aStepCount+1;i++)
+        {
+        TAdvancedPointer* point = new (ELeave) TAdvancedPointer;
+        CleanupStack::PushL(point);
+        iAdvPointerMoveArray.AppendL(point);
+        CleanupStack::Pop();
+        
+        point->PointerNum=aPointNumber;
+        if (i<aStepCount)
+            {
+            point->X=aX1+i*dx;
+            point->Y=aY1+i*dy;
+            point->Z=aZ1;
+            }
+        else
+            {
+            point->X=aX2;
+            point->Y=aY2;
+            point->Z=aZ2;
+            }             
+                  
+        } 
+    
+    HTI_LOG_FUNC_OUT( "CPointerEventHandler::AdvanceAddMiddlePointL" );
+    }
+
+// ----------------------------------------------------------------------------
+// CPointerEventHandler::AdvancedAddDelayArray()
+// ----------------------------------------------------------------------------
+void CPointerEventHandler::AdvancedAddDelayArray(TTimeIntervalMicroSeconds32 aDelay , TInt aStepCount )
+    {
+    HTI_LOG_FUNC_IN( "CPointerEventHandler::AdvancedAddDelayArray" );
+    
+    TInt interval=aDelay.Int()/aStepCount;
+    iDelayArray.ResetAndDestroy();    
+    
+    for (TInt i=0;i<aStepCount;i++)
+        {
+        TTimeIntervalMicroSeconds32* time = new (ELeave) TTimeIntervalMicroSeconds32(interval);
+        CleanupStack::PushL(time);
+        iDelayArray.AppendL(time);
+        CleanupStack::Pop(time);
+        } 
+    HTI_LOG_FUNC_OUT( "CPointerEventHandler::AdvancedAddDelayArray" );
+    }
+
+// ----------------------------------------------------------------------------
+// CPointerEventHandler::MoveToNextPointL()
+// Takes the next point from the coordinate array and initiates pointer moving
+// to that point.
+// This function is used by ETapAndDragMultipoint command and called from
+// the RunL().
+// ----------------------------------------------------------------------------
+void CPointerEventHandler::MoveToNextPointL()
+    {
+    HTI_LOG_FUNC_IN( "CPointerEventHandler::MoveToNextPointL" );
+    HTI_LOG_FORMAT( "Points remaining for this line = %d", iTapCount );
+
+    if ( iTapCount == 0 ) // End of current line
+        {
+        PointerUp();
+        if ( iCoords->Count() < 5 ) // point count & at least 2 points
+            {
+            // This was the last line, we are done
+            SendOkMsgL();
+            iReady = ETrue;
+            }
+        else
+            {
+            // New line starts: take the point count of this line and
+            // first coordinates.
+            iTapCount = ( *iCoords )[0];
+            iCoords->Remove( 0 );
+            iX = ( *iCoords )[0];
+            iCoords->Remove( 0 );
+            iY = ( *iCoords )[0];
+            iCoords->Remove( 0 );
+            HTI_LOG_FORMAT( "Point count for new line = %d", iTapCount );
+            iTimer.After( iStatus, iActionDelay );
+            SetActive();
+            }
+        }
+
+    else  // Current line continues: take next point coords and move
+        {
+        iX = ( *iCoords )[0];
+        iCoords->Remove( 0 );
+        iY = ( *iCoords )[0];
+        iCoords->Remove( 0 );
+        PointerMove();
+        iTapCount--;
+        iTimer.After( iStatus, iEventDelay );
+        SetActive();
+        }
+
+    HTI_LOG_FUNC_OUT( "CPointerEventHandler::MoveToNextPointL" );
+    }
+
+// ----------------------------------------------------------------------------
+// CPointerEventHandler::PointerDown()
+// ----------------------------------------------------------------------------
+void CPointerEventHandler::PointerDown()
+    {
+    HTI_LOG_FUNC_IN( "CPointerEventHandler::PointerDown" );
+    SimulatePointerEvent( TRawEvent::EButton1Down );
+    iState = EPointerDown;
+    HTI_LOG_FUNC_OUT( "CPointerEventHandler::PointerDown" );
+    }
+
+// ----------------------------------------------------------------------------
+// CPointerEventHandler::PointerUp()
+// ----------------------------------------------------------------------------
+void CPointerEventHandler::PointerUp()
+    {
+    HTI_LOG_FUNC_IN( "CPointerEventHandler::PointerUp" );
+    SimulatePointerEvent( TRawEvent::EButton1Up );
+    iState = EPointerUp;
+    HTI_LOG_FUNC_OUT( "CPointerEventHandler::PointerUp" );
+    }
+
+// ----------------------------------------------------------------------------
+// CPointerEventHandler::PointerMove()
+// ----------------------------------------------------------------------------
+void CPointerEventHandler::PointerMove()
+    {
+    HTI_LOG_FUNC_IN( "CPointerEventHandler::PointerMove" );
+    SimulatePointerEvent( TRawEvent::EPointerMove );
+    iState = EPointerMoving;
+    HTI_LOG_FUNC_OUT( "CPointerEventHandler::PointerMove" );
+    }
+
+// ----------------------------------------------------------------------------
+// CPointerEventHandler::SimulatePointerEvent()
+// Sends the pointer event as a raw event.
+// ----------------------------------------------------------------------------
+void CPointerEventHandler::SimulatePointerEvent( TRawEvent::TType aType )
+    {
+    HTI_LOG_FUNC_IN( "CPointerEventHandler::SimulatePointerEvent" );
+    
+    TRawEvent rawEvent;
+    
+    if ( iCommand == EAdvancedTapScreen )
+        {
+        TInt i;
+         for ( i = 0; i < iAdvancedPointers.Count(); i++ )
+             {
+             rawEvent.SetPointerNumber( iAdvancedPointers[i]->PointerNum ); 
+             rawEvent.Set( aType, iAdvancedPointers[i]->X, iAdvancedPointers[i]->Y, iAdvancedPointers[i]->Z);    
+             iWsSession.SimulateRawEvent( rawEvent );    
+             }      
+        }
+    else if ( iCommand == EPinchZoom  )
+        {
+        TInt i,index,pointnum=-1;
+        RPointerArray<TAdvancedPointer> array;
+        for ( i = 0; i < iAdvPointerMoveArray.Count(); i++ )
+            {
+            TAdvancedPointer* point=iAdvPointerMoveArray[i];   
+            if (point->PointerNum!=pointnum)
+                {
+                pointnum=point->PointerNum;                
+                rawEvent.SetPointerNumber( point->PointerNum ); 
+                rawEvent.Set( aType, point->X, point->Y, point->Z); 	
+                iWsSession.SimulateRawEvent( rawEvent );	
+                
+                HTI_LOG_FORMAT( "SimulateAdvanced event=%d ", aType );
+                HTI_LOG_FORMAT( "SimulateAdvanced PointerNum=%d", point->PointerNum );
+                HTI_LOG_FORMAT( "SimulateAdvanced X=%d ", point->X );
+                HTI_LOG_FORMAT( "SimulateAdvanced Y=%d ", point->Y );
+                HTI_LOG_FORMAT( "SimulateAdvanced Z=%d", point->Z );
+                
+                array.Append(point);
+                }
+            }
+        for (i=0;i<array.Count();i++)
+            {
+            index=iAdvPointerMoveArray.Find(array[i]);
+            if (index!=KErrNotFound)
+                iAdvPointerMoveArray.Remove(index);
+            }
+        array.ResetAndDestroy();
+        }
+    else
+        {	
+        rawEvent.Set( aType, iX, iY );
+        iWsSession.SimulateRawEvent( rawEvent );
+        }
+    
+    iWsSession.Flush();
+    HTI_LOG_FUNC_OUT( "CPointerEventHandler::SimulatePointerEvent" );
+    }
+
+// ----------------------------------------------------------------------------
+// CPointerEventHandler::IsMultitouch()
+// ----------------------------------------------------------------------------
+TBool CPointerEventHandler::IsMultitouch()
+    {
+    HTI_LOG_FUNC_IN("CPointerEventHandler::IsMultitouch");
+    TBool isMultitouch = EFalse;
+    if ( iCommand == EAdvancedTapScreen || iCommand == EPinchZoom )
+        {
+        isMultitouch = ETrue;
+        }
+    HTI_LOG_FUNC_OUT("CPointerEventHandler::IsMultitouch");
+    return isMultitouch;
+    }    
+    
+// ----------------------------------------------------------------------------
+// CPointerEventHandler::SendOkMsgL()
+// ----------------------------------------------------------------------------
+void CPointerEventHandler::SendOkMsgL()
+    {
+    HTI_LOG_FUNC_IN("CPointerEventHandler::SendOkMsgL");
+
+    User::LeaveIfNull( iDispatcher );
+    TBuf8<1> response;
+    response.Append( EResultOk );
+    HBufC8* respH8 = response.AllocL();
+    User::LeaveIfError( iDispatcher->DispatchOutgoingMessage(
+        respH8, KKeyEventServiceUid ) );
+
+    HTI_LOG_FUNC_OUT("CPointerEventHandler::SendOkMsgL");
+    }
+
+// ----------------------------------------------------------------------------
+// CPointerEventHandler::SendErrorMessageL()
+// ----------------------------------------------------------------------------
+void CPointerEventHandler::SendErrorMessageL(
+        TInt aError, const TDesC8& aDescription )
+    {
+    HTI_LOG_FUNC_IN("CPointerEventHandler::SendErrorMessageL");
+    User::LeaveIfNull( iDispatcher );
+    User::LeaveIfError( iDispatcher->DispatchOutgoingErrorMessage(
+        aError, aDescription, KKeyEventServiceUid ) );
+    HTI_LOG_FUNC_OUT("CPointerEventHandler::SendErrorMessageL");
+    }
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiServicePlugins/HtiKeyEventServicePlugin/src/proxy.cpp	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,37 @@
+/*
+* 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 proxy for key event service plugin dll
+*
+*/
+
+
+// INCLUDE FILES
+#include "HtiKeyEventServicePlugin.h"
+
+#include <e32std.h>
+#include <ecom/implementationproxy.h>
+
+// Provides a key value pair table, this is used to identify
+// the correct construction function for the requested interface.
+const TImplementationProxy ImplementationTable[] =
+    {
+        IMPLEMENTATION_PROXY_ENTRY(0x1020DEC1,  CHtiKeyEventServicePlugin::NewL)
+    };
+
+// Function used to return an instance of the proxy table.
+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/htiui/HtiServicePlugins/HtiMessagesServicePlugin/data/200212C5.rss	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,49 @@
+/*
+* 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:  Resource definitions for Message management (inbox, etc)
+*                service ECOM plugin.
+*
+*/
+
+
+// INCLUDES
+#include <ecom/registryinfo.rh>
+
+
+//  RESOURCE DEFINITIONS
+RESOURCE REGISTRY_INFO theInfo
+    {
+    // UID for the DLL
+    dll_uid = 0x200212C5;
+    // Declare array of interface info
+    interfaces =
+        {
+        INTERFACE_INFO
+            {
+            // UID of interface that is implemented
+            interface_uid = 0x1020DEB7;
+            implementations =
+                {
+                IMPLEMENTATION_INFO
+                    {
+                    implementation_uid = 0x200212C6;
+                    version_no         = 1;
+                    display_name       = "Message management service (inbox etc.)";
+                    default_data       = "MessageMgmnt";
+                    opaque_data        = "";
+                    }
+                };
+            }
+        };
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiServicePlugins/HtiMessagesServicePlugin/group/HtiMessagesServicePlugin.mmp	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,67 @@
+/*
+* 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 implementation of HtiMessagesServicePlugin service
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+TARGET          HtiMessagesServicePlugin.dll
+TARGETTYPE      PLUGIN
+
+UID             0x10009D8D 0x200212C5
+
+VENDORID        0x101FB657
+
+CAPABILITY      ALL -TCB
+
+SOURCEPATH      ../src
+SOURCE          proxy.cpp
+SOURCE          HtiMessagesServicePlugin.cpp
+SOURCE          MessageMgmntHandler.cpp
+SOURCE          HtiIAPHandler.cpp
+SOURCE          HtiMailboxHandler.cpp
+SOURCE          HtiMsgSettingsHandler.cpp
+
+USERINCLUDE     ../inc
+APP_LAYER_SYSTEMINCLUDE
+
+START RESOURCE  ../data/200212C5.rss
+TARGET          HtiMessagesServicePlugin.rsc
+END
+
+LIBRARY         apgrfx.lib
+LIBRARY         apmime.lib
+LIBRARY         bafl.lib
+LIBRARY         centralRepository.lib
+LIBRARY         charconv.lib
+LIBRARY         cmmanager.lib
+LIBRARY         connmon.lib
+LIBRARY         ecom.lib
+LIBRARY         efsrv.lib
+LIBRARY         euser.lib
+LIBRARY         gsmu.lib
+LIBRARY         imcm.lib
+LIBRARY         msgs.lib
+LIBRARY         smcm.lib
+LIBRARY         etel.lib
+LIBRARY         etelmm.lib
+LIBRARY         etext.lib
+LIBRARY         mmsserversettings.lib
+LIBRARY         flogger.lib
+
+SMPSAFE
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiServicePlugins/HtiMessagesServicePlugin/group/bld.inf	Wed Aug 25 15:45:01 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:  Build information file for HtiMessagesServicePlugin
+*
+*/
+
+
+PRJ_PLATFORMS
+
+PRJ_EXPORTS
+
+PRJ_MMPFILES
+HtiMessagesServicePlugin.mmp
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiServicePlugins/HtiMessagesServicePlugin/inc/HtiIAPHandler.h	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,170 @@
+/*
+* 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:  HTI Internet Access Point handler.
+*
+*/
+
+
+#ifndef CHTIIAPHANDLER_H
+#define CHTIIAPHANDLER_H
+
+
+// INCLUDES
+#include <cmpsettingsconsts.h>
+#include <HtiServicePluginInterface.h>
+
+// CONSTANTS
+
+// MACROS
+
+// DATA TYPES
+enum TApFieldDataType
+    {
+    EDataTypeText,
+    EDataTypeBool,
+    EDataTypeUint,
+    EDataTypeText8,
+    EDataTypeUnknown
+    };
+
+struct TApField
+    {
+    TInt      iId;
+    HBufC*    iData;
+    TApFieldDataType iDataType;
+    };
+
+// FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+// CLASS DECLARATION
+/**
+*  HTI Internet Access Point handler.
+*/
+class CHtiIAPHandler : public CBase
+    {
+    public:
+        enum TLegacyApFieldCodes
+        {
+        EApWapStartPage            =   3,
+        EApIspDefaultTelNumber     =  18,
+        EApIspUseLoginScript       =  20,
+        EApIspLoginScript          =  21,
+        EApIspLoginName            =  23,
+        EApIspLoginPass            =  24,
+        EApIspIfPromptForAuth      =  29,
+        EApIspIfCallbackEnabled    =  33,
+        EApIspIfCallbackType       =  34,
+        EApIspIfCallbackInfo       =  35,
+        EApIspIPAddr               =  38,
+        EApIspIPNameServer1        =  42,
+        EApIspIPNameServer2        =  43,
+        EApIspEnableIpHeaderComp   =  44,
+        EApIspDisablePlainTextAuth =  46,
+        EApIspBearerSpeed          =  49,
+        EApIspBearerCallTypeIsdn   =  50,
+        EApIspInitString           =  52,
+        EApGprsAccessPointName     =  58,
+        EApGprsPdpType             =  59,
+        EApProxyServerAddress      =  91,
+        EApProxyPortNumber         =  93,
+        EApIP6NameServer1          = 104,
+        EApIP6NameServer2          = 105,
+        EApWlanNetworkName         = 163,
+        EApWlanNetworkMode         = 164,
+        EApWlanSecurityMode        = 165,
+
+        // new fields that do not exist in legacy TApMember enum
+        EApSeamlessnessLevel       = 200
+        };
+
+        /**
+        * Two-phased constructor.
+        */
+        static CHtiIAPHandler* NewL();
+
+        /**
+        * Called when there is a message to be processed by this service.
+        * @param aMessage message body destinated to the servive
+        * @param aPriority message priority
+        */
+        void ProcessMessageL( const TDesC8& aMessage,
+                              THtiMessagePriority aPriority );
+
+        /**
+        * Destructor.
+        */
+        virtual ~CHtiIAPHandler();
+
+        /**
+        * Sets the dispatcher to send outgoing messages to.
+        * @param aDispatcher pointer to dispatcher instance
+        */
+        void SetDispatcher( MHtiDispatcher* aDispatcher );
+
+    private:
+
+        /**
+        * C++ default constructor.
+        */
+        CHtiIAPHandler();
+
+        /**
+        * 2nd phase constructor.
+        */
+        void ConstructL();
+
+    private: // helpers
+
+        void HandleCreateIapL( const TDesC8& aData );
+        void HandleDeleteIapL( const TDesC8& aData );
+        void HandleCreateDestinationL( const TDesC8& aData );
+        void HandleDeleteDestinationL( const TDesC8& aData );
+        void ModifyDestinationL( const TInt aCommand, const TDesC8& aData );
+        void SetDefaultConnectionL( const TDesC8& aData );
+
+        void ParseCreateMessageL( const TDesC8& aData );
+        TInt GetAccessPointUIDL();
+        TInt GetDestinationIDL( const TDesC& aName );
+        void CloseActiveConnectionsL();
+
+        TUint GetBearerUID( const TInt aBearerType );
+        void MapLegacyFieldIDs();
+        void ResolveFieldDataTypes();
+
+        void SendOkMsgL( const TDesC8& aData );
+        void SendErrorMessageL( TInt aError, const TDesC8& aDescription );
+
+    private:  // Data
+
+        // Pointer to the dispatcher (referenced)
+        MHtiDispatcher* iDispatcher; // referenced
+
+        // Name of the connection to create/delete
+        TBuf<KMaxConnNameLength>   iConnName;
+        TBuf<KMaxConnNameLength>   iDestName;
+
+        // The type of Access Point to create
+        TUint         iBearerType;
+
+        // The fields to add to the Access Point
+        RArray<TApField> iFields;
+
+    };
+
+#endif // CHTIIAPHANDLER_H
+
+// End of file
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiServicePlugins/HtiMessagesServicePlugin/inc/HtiMailboxHandler.h	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,145 @@
+/*
+* 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:  HTI Mailbox settings handler.
+*
+*/
+
+
+#ifndef HTIMAILBOXHANDLER_H_
+#define HTIMAILBOXHANDLER_H_
+
+// INCLUDES
+#include <cmmanager.h>
+#include <msvapi.h>
+#include <HtiServicePluginInterface.h>
+
+// CONSTANTS
+
+// MACROS
+
+// DATA TYPES
+
+// FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+class TSmtpAccount;
+
+// CLASS DECLARATION
+/**
+*  HTI Mailbox settings handler.
+*/
+class CHtiMailboxHandler : public CBase,
+                           public MMsvSessionObserver
+    {
+    public:
+
+        /**
+        * Two-phased constructor.
+        */
+        static CHtiMailboxHandler* NewL();
+
+        /**
+        * Called when there is a message to be processed by this service.
+        * @param aMessage message body destinated to the servive
+        * @param aPriority message priority
+        */
+        void ProcessMessageL( const TDesC8& aMessage,
+                              THtiMessagePriority aPriority );
+
+        /**
+        * Destructor.
+        */
+        virtual ~CHtiMailboxHandler();
+
+        /**
+        * Sets the dispatcher to send outgoing messages to.
+        * @param aDispatcher pointer to dispatcher instance
+        */
+        void SetDispatcher( MHtiDispatcher* aDispatcher );
+
+    private:
+
+        /**
+        * C++ default constructor.
+        */
+        CHtiMailboxHandler();
+
+        /**
+        * 2nd phase constructor.
+        */
+        void ConstructL();
+
+    private: // helpers
+
+        void HandleCreateMailboxL( const TDesC8& aData );
+        void HandleDeleteMailboxL( const TDesC8& aData );
+        void ParseCreateMsgL( const TDesC8& aData );
+        HBufC*  ParseStringL( const TDesC8& aData, TInt aStrLenOffset,
+                                TInt aStrLenBytes = 1 );
+        HBufC8* ParseString8L( const TDesC8& aData, TInt aStrLenOffset,
+                                TInt aStrLenBytes = 1 );
+        TInt AccessPointUIDL( const TDesC& aApName );
+        TInt FindSmtpAccount( const TDesC& aAccountName,
+                              TSmtpAccount& aAccount );
+        void GetDeviceImeiL( TDes& aResult );
+        void ResetVariables();
+        void SendOkMsgL( const TDesC8& aData );
+        void SendErrorMessageL( TInt aError, const TDesC8& aDescription );
+
+    private: // from MMsvSessionObserver
+
+        void HandleSessionEventL( TMsvSessionEvent aEvent,
+                                  TAny* aArg1, TAny* aArg2, TAny* aArg3 );
+
+    private:  // Data
+
+        // Pointer to the dispatcher (referenced)
+        MHtiDispatcher* iDispatcher;
+
+        // Handle to connection manager
+        RCmManager iCmManager;
+
+        // Email account settings
+        TInt    iMailboxType;
+        HBufC*  iMailboxName;
+        HBufC*  iIncomingServer;
+        HBufC*  iIncomingApName;
+        HBufC8* iIncomingUserName;
+        HBufC8* iIncomingPassword;
+        TInt    iIncomingSecurity;
+        TInt    iIncomingPort;
+        TBool   iAPopSecureLogin;
+        HBufC*  iOutgoingServer;
+        HBufC*  iOutgoingApName;
+        HBufC8* iOutgoingUserName;
+        HBufC8* iOutgoingPassword;
+        TInt    iOutgoingSecurity;
+        TInt    iOutgoingPort;
+        HBufC*  iOwnMailAddress;
+        HBufC*  iOwnName;
+        TInt    iSendOption;           // (enum TImSMTPSendMessageOption)
+        TInt    iSendCopyToOwnAddress; // (enum TImSMTPSendCopyToSelf)
+        HBufC*  iSignatureText;
+        TBool   iNewMailIndicators;
+        TInt    iRetrievedParts;
+        TInt    iRetrieveSizeLimitKb;
+        TInt    iEmailsToRetrieve;
+        HBufC8* iImapFolderPath;
+        TInt    iAutomaticUpdate;
+        TBool   iSetAsDefault;
+    };
+
+#endif // HTIMAILBOXHANDLER_H_
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiServicePlugins/HtiMessagesServicePlugin/inc/HtiMessagesServicePlugin.h	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,103 @@
+/*
+* 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 ECOM plug-in service interface. Provides
+*                HtiMessagesServicePlugin service.
+*
+*/
+
+
+#ifndef CHTIMESSAGESSERVICEPLUGIN_H
+#define CHTIMESSAGESSERVICEPLUGIN_H
+
+// INCLUDES
+#include <HtiServicePluginInterface.h>
+
+// CONSTANTS
+const TInt KHtiMessagesServiceUidValue = 0x10210CCF; // ECOM Implementation UID
+const TUid KHtiMessagesServiceUid = {KHtiMessagesServiceUidValue};
+
+// FORWARD DECLARATIONS
+class CMessageMgmntHandler;
+class CHtiIAPHandler;
+class CHtiMailboxHandler;
+class CHtiMsgSettingsHandler;
+
+// CLASS DECLARATION
+
+/**
+* Implementation of ECOM plug-in service interface.
+*/
+class CHtiMessagesServicePlugin : public CHTIServicePluginInterface
+    {
+public:
+
+    enum TCommand
+        {
+        // MessagesMgmntHandler
+        EAddSms              = 0x01,
+        EAddMms              = 0x02,
+        EAddEmail            = 0x03,
+        EAddIrMsg            = 0x04,
+        EAddBtMsg            = 0x05,
+        EAddSmartMsg         = 0x06,
+        EAddAudioMsg         = 0x07,
+        EDeleteMessage       = 0x10,
+        EDeleteFolderContent = 0x11,
+
+        // MailboxHandler
+        ECreateMailBox       = 0x20,
+        EDeleteMailBox       = 0x21,
+
+        // IAPHandler
+        ECreateIAP           = 0x30,
+        EDeleteIAP           = 0x31,
+        ECreateDestination   = 0x32,
+        EDeleteDestination   = 0x33,
+        EAddToDestination    = 0x34,
+        ERemoveFromDestination = 0x35,
+        ESetDefaultConnection = 0x36,
+
+        // MgsSettingsHandler
+        ESetDefaultSmsCenter = 0x40,
+        EDeleteSmsCenter     = 0x41,
+        ESetSmsSettings      = 0x42,
+        ESetMmsSettings      = 0x45,
+
+        // only for response message
+        EResultOk            = 0xFF,
+        };
+
+    static CHtiMessagesServicePlugin* NewL();
+
+    // Interface implementation
+    void ProcessMessageL( const TDesC8& aMessage,
+        THtiMessagePriority aPriority );
+
+protected:
+
+    CHtiMessagesServicePlugin();
+    void ConstructL();
+
+    virtual ~CHtiMessagesServicePlugin();
+
+private:
+
+    CMessageMgmntHandler*   iMessageHandler;
+    CHtiIAPHandler*         iIAPHandler;
+    CHtiMailboxHandler*     iMailboxHandler;
+    CHtiMsgSettingsHandler* iMsgSettingsHandler;
+    };
+
+#endif // CHTIMESSAGESSERVICEPLUGIN_H
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiServicePlugins/HtiMessagesServicePlugin/inc/HtiMsgSettingsHandler.h	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,110 @@
+/*
+* 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:  HTI message settings handler.
+*
+*/
+
+
+#ifndef CHTIMSGSETTINGSHANDLER_H
+#define CHTIMSGSETTINGSHANDLER_H
+
+
+// INCLUDES
+#include <HtiServicePluginInterface.h>
+
+// CONSTANTS
+
+// MACROS
+
+// DATA TYPES
+
+// FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+// CLASS DECLARATION
+/**
+*  HTI Internet Access Point handler.
+*/
+class CHtiMsgSettingsHandler : public CBase
+    {
+    public:
+
+        /**
+        * Character support settings values.
+        */
+        enum TCharSetSupport
+            {
+            ECharSetFull,
+            ECharSetReduced,
+            ECharSetFullLocked,
+            ECharSetReducedLocked
+            };
+
+        /**
+        * Two-phased constructor.
+        */
+        static CHtiMsgSettingsHandler* NewL();
+
+        /**
+        * Called when there is a message to be processed by this service.
+        * @param aMessage message body destinated to the servive
+        * @param aPriority message priority
+        */
+        void ProcessMessageL( const TDesC8& aMessage,
+                              THtiMessagePriority aPriority );
+
+        /**
+        * Destructor.
+        */
+        virtual ~CHtiMsgSettingsHandler();
+
+        /**
+        * Sets the dispatcher to send outgoing messages to.
+        * @param aDispatcher pointer to dispatcher instance
+        */
+        void SetDispatcher( MHtiDispatcher* aDispatcher );
+
+    private:
+
+        /**
+        * C++ default constructor.
+        */
+        CHtiMsgSettingsHandler();
+
+        /**
+        * 2nd phase constructor.
+        */
+        void ConstructL();
+
+    private: // helpers
+
+        void HandleSetDefaultSmsCenterL( const TDesC8& aData );
+        void HandleDeleteSmsCenterL( const TDesC8& aData );
+        void HandleSetSmsSettingsL( const TDesC8& aData );
+
+        void HandleSetMmsSettingsL( const TDesC8& aData );
+
+        TInt GetAccessPointUIDL( const TDesC& aApName );
+        void SendOkMsgL( const TDesC8& aData );
+        void SendErrorMessageL( TInt aError, const TDesC8& aDescription );
+
+    private:  // Data
+
+        // Pointer to the dispatcher (referenced)
+        MHtiDispatcher* iDispatcher; // referenced
+    };
+
+
+#endif // CHTIMSGSETTINGSHANDLER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiServicePlugins/HtiMessagesServicePlugin/inc/MessageMgmntHandler.h	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,150 @@
+/*
+* 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:  Functional implentation of message management service.
+*
+*/
+
+
+#ifndef CHTIMESSAGESSERVICEPLUGINHANDLER_H
+#define CHTIMESSAGESSERVICEPLUGINHANDLER_H
+
+
+// INCLUDES
+#include <msvapi.h>
+#include <HtiServicePluginInterface.h>
+
+// CONSTANTS
+
+// FORWARD DECLARATIONS
+class CClientMtmRegistry;
+
+// CLASS DECLARATION
+/**
+*  Functional implentation of message management service.
+*/
+class CMessageMgmntHandler : public CBase,
+                             public MMsvSessionObserver
+    {
+public:
+
+    static CMessageMgmntHandler* NewL();
+
+    // Interface implementation
+    void ProcessMessageL( const TDesC8& aMessage,
+                          THtiMessagePriority aPriority );
+
+    virtual ~CMessageMgmntHandler();
+
+    void SetDispatcher( MHtiDispatcher* aDispatcher );
+
+    enum TFolder
+        {
+        EAllFolders = 0x00,
+        EInbox,
+        EDrafts,
+        ESent,
+        EOutbox,
+        ENumberOfFolders, // this must always be the last one
+        };
+
+    enum TMessageType
+        {
+        EAllMessageTypes = 0x00,
+        ESMS,
+        EMMS,
+        ESmartMessage,
+        EEmail,
+        EIrMessage,
+        EBtMessage,
+        EAudioMessage,
+        EEmailPOP3,
+        EEmailIMAP4,
+        ENumberOfMessageTypes,  // this must always be the last one
+        };
+
+private:
+
+    CMessageMgmntHandler();
+    void ConstructL();
+
+private: // helpers
+
+    void HandleCreateSmsL( const TDesC8& aData );
+    void HandleCreateMmsL( const TDesC8& aData );
+    void HandleCreateEmailL( const TDesC8& aData );
+    void HandleCreateObexMsgL( const TDesC8& aData, TUid aMtmUid,  TUid aMsgTypeUid );
+    void HandleCreateSmartMsgL( const TDesC8& aData );
+
+    void HandleDeleteMessageL( const TDesC8& aData );
+    void HandleDeleteMessagesL( const TDesC8& aData );
+    void HandleDeleteFromAllFoldersL( TMessageType aType );
+    void HandleDeleteAllMessageTypesL( TFolder aFolder );
+    void HandleDeleteFromFolderByTypeL( TFolder aFolder, TMessageType aType );
+
+    void SendOkMsgL( const TDesC8& aData );
+    void SendErrorMessageL( TInt aError, const TDesC8& aDescription );
+
+    TBool ValidateAddSmsCommand( const TDesC8& aData );
+    TBool ValidateAddMmsOrAddEmailCommand( const TDesC8& aData );
+    TBool ValidateAddObexMsgCommand( const TDesC8& aData );
+    TBool ValidateAddSmartMsgCommand( const TDesC8& aData );
+
+    HBufC16* ExtractDesLC( const TDesC8& aUtf8Data, TInt& aPosition, TInt aSizeBytes );
+    HBufC8* ExtractDes8LC( const TDesC8& aUtf8Data, TInt& aPosition, TInt aSizeBytes );
+    TMsvId MapFolderToIdL( TFolder aFolder );
+    TUid MapMessageTypeToUidL( TMessageType aType );
+
+private: // from MMsvSessionObserver
+
+    void HandleSessionEventL( TMsvSessionEvent aEvent,
+                              TAny* aArg1,
+                              TAny* aArg2,
+                              TAny* aArg3 );
+
+private:
+
+    MHtiDispatcher*      iDispatcher; // referenced
+    CMsvSession*         iSession;
+    CClientMtmRegistry*  iMtmReg;
+    };
+
+
+
+// CLASS DECLARATION
+/**
+*  Helper class to wait the async requests.
+*/
+class CWaiter : public CActive
+    {
+public:
+    static CWaiter* NewL( TInt aPriority = EPriorityStandard );
+    static CWaiter* NewLC( TInt aPriority = EPriorityStandard );
+    ~CWaiter();
+
+    void StartAndWait();
+    TInt Result() const;
+
+private:
+    CWaiter( TInt aPriority );
+
+    // from CActive
+    void RunL();
+    void DoCancel();
+
+private:
+    CActiveSchedulerWait iWait;
+    TInt iResult;
+    };
+
+#endif // CHTIMESSAGESSERVICEPLUGINHANDLER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiServicePlugins/HtiMessagesServicePlugin/src/HtiIAPHandler.cpp	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,1446 @@
+/*
+* 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 internet access point handling.
+*
+*/
+
+
+// INCLUDE FILES
+#include "HtiMessagesServicePlugin.h"
+#include "HtiIAPHandler.h"
+
+#include <HtiDispatcherInterface.h>
+#include <HtiLogging.h>
+#include <cmconnectionmethodext.h>
+#include <cmconnectionmethoddef.h>
+#include <cmdestinationext.h>
+#include <cmmanagerext.h>
+#include <cmplugincsddef.h>
+#include <cmpluginhscsddef.h>
+#include <cmpluginpacketdatadef.h>
+#include <cmpluginwlandef.h>
+#include <rconnmon.h>
+
+using namespace CMManager;
+
+// EXTERNAL DATA STRUCTURES
+
+// EXTERNAL FUNCTION PROTOTYPES
+
+// CONSTANTS
+const TInt KMinCreateMsgLength = 5;
+const TInt KMinDeleteMsgLength = 3;
+const TInt KMinCreateDestMsgLength = 3;
+const TInt KMinDeleteDestMsgLength = 3;
+const TInt KMinModifyDestMsgLength = 5;
+const TInt KMinSetDefConMsgLength = 3;
+
+// MACROS
+
+// LOCAL CONSTANTS AND MACROS
+_LIT8( KErrorInvalidParameters, "Invalid command parameters" );
+_LIT8( KErrorCreateFailed, "Access Point creation failed" );
+_LIT8( KErrorDeleteFailed, "Access Point deletion failed" );
+_LIT8( KErrorDestCreateFailed, "Destination creation failed" );
+_LIT8( KErrorDestDeleteFailed, "Destination deletion failed" );
+_LIT8( KErrorApAlreadyExists, "Access Point with same name already exists" );
+_LIT8( KErrorApNotFound, "Access Point with given name not found" );
+_LIT8( KErrorConnCloseFailed,
+           "Failed to close a connection using the Access Point" );
+_LIT8( KErrorAddToDestFailed, "Adding to destination failed" );
+_LIT8( KErrorRemoveFromDestFailed, "Removing from destination failed" );
+_LIT8( KErrorDestNotFound, "Destination with given name not found" );
+_LIT8( KErrorSetDefConFailed, "Setting default connection failed" );
+
+// MODULE DATA STRUCTURES
+
+// LOCAL FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CHtiIAPHandler::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+CHtiIAPHandler* CHtiIAPHandler::NewL()
+    {
+    HTI_LOG_FUNC_IN( "CHtiIAPHandler::NewL" );
+    CHtiIAPHandler* self = new (ELeave) CHtiIAPHandler();
+    CleanupStack::PushL ( self );
+    self->ConstructL();
+    CleanupStack::Pop();
+    HTI_LOG_FUNC_OUT( "CHtiIAPHandler::NewL" );
+    return self;
+    }
+
+
+// ----------------------------------------------------------------------------
+// CHtiIAPHandler::CHtiIAPHandler
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// ----------------------------------------------------------------------------
+CHtiIAPHandler::CHtiIAPHandler()
+    {
+    HTI_LOG_FUNC_IN( "CHtiIAPHandler::CHtiIAPHandler" );
+
+    HTI_LOG_FUNC_OUT( "CHtiIAPHandler::CHtiIAPHandler" );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CHtiIAPHandler::~CHtiIAPHandler
+// Destructor.
+// -----------------------------------------------------------------------------
+CHtiIAPHandler::~CHtiIAPHandler()
+    {
+    HTI_LOG_FUNC_IN( "CHtiIAPHandler::~CHtiIAPHandler" );
+
+    for ( TInt i = 0; i < iFields.Count(); i++ )
+        {
+        delete iFields[i].iData;
+        }
+    iFields.Reset();
+    iFields.Close();
+
+    HTI_LOG_FUNC_OUT( "CHtiIAPHandler::~CHtiIAPHandler" );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CHtiIAPHandler::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+void CHtiIAPHandler::ConstructL()
+    {
+    HTI_LOG_FUNC_IN( "CHtiIAPHandler::ConstructL" );
+
+    HTI_LOG_FUNC_OUT( "CHtiIAPHandler::ConstructL" );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CHtiIAPHandler::SetDispatcher
+// Sets the dispatcher pointer.
+// -----------------------------------------------------------------------------
+
+void CHtiIAPHandler::SetDispatcher( MHtiDispatcher* aDispatcher )
+    {
+    HTI_LOG_FUNC_IN( "CHtiIAPHandler::SetDispatcher" );
+    iDispatcher = aDispatcher;
+    HTI_LOG_FUNC_OUT( "CHtiIAPHandler::SetDispatcher" );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CHtiIAPHandler::ProcessMessageL
+// Parses the received message and calls handler functions.
+// -----------------------------------------------------------------------------
+void CHtiIAPHandler::ProcessMessageL( const TDesC8& aMessage,
+    THtiMessagePriority /*aPriority*/ )
+    {
+    HTI_LOG_FUNC_IN( "CHtiIAPHandler::ProcessMessageL" );
+
+    for ( TInt i = 0; i < iFields.Count(); i++ )
+        delete iFields[i].iData;
+    iFields.Reset();
+    iFields.Close();
+    iConnName.Zero();
+    iBearerType = 0;
+
+    // Zero length message and command code validity already checked
+    // in HtiMessagesServicePlugin.
+
+    if ( aMessage[0] == CHtiMessagesServicePlugin::ECreateIAP )
+        {
+        if ( aMessage.Length() < KMinCreateMsgLength )
+            {
+            SendErrorMessageL( KErrArgument, KErrorInvalidParameters );
+            }
+        else
+            {
+            TRAPD( err, HandleCreateIapL( aMessage.Mid( 1 ) ) );
+            if ( err != KErrNone )
+                {
+                SendErrorMessageL( err, KErrorCreateFailed );
+                }
+            }
+        }
+
+    else if ( aMessage[0] == CHtiMessagesServicePlugin::EDeleteIAP )
+        {
+        if ( aMessage.Length() < KMinDeleteMsgLength )
+            {
+            SendErrorMessageL( KErrArgument, KErrorInvalidParameters );
+            }
+        else
+            {
+            TRAPD( err, HandleDeleteIapL( aMessage.Mid( 1 ) ) );
+            if ( err != KErrNone )
+                {
+                SendErrorMessageL( err, KErrorDeleteFailed );
+                }
+            }
+        }
+
+    else if ( aMessage[0] == CHtiMessagesServicePlugin::ECreateDestination )
+        {
+        if ( aMessage.Length() < KMinCreateDestMsgLength )
+            {
+            SendErrorMessageL( KErrArgument, KErrorInvalidParameters );
+            }
+        else
+            {
+            TRAPD( err, HandleCreateDestinationL( aMessage.Mid( 1 ) ) );
+            if ( err != KErrNone )
+                {
+                SendErrorMessageL( err, KErrorDestCreateFailed );
+                }
+            }
+        }
+
+    else if ( aMessage[0] == CHtiMessagesServicePlugin::EDeleteDestination )
+        {
+        if ( aMessage.Length() < KMinDeleteDestMsgLength )
+            {
+            SendErrorMessageL( KErrArgument, KErrorInvalidParameters );
+            }
+        else
+            {
+            TRAPD( err, HandleDeleteDestinationL( aMessage.Mid( 1 ) ) );
+            if ( err != KErrNone )
+                {
+                SendErrorMessageL( err, KErrorDestDeleteFailed );
+                }
+            }
+        }
+
+    else if ( aMessage[0] == CHtiMessagesServicePlugin::EAddToDestination ||
+            aMessage[0] == CHtiMessagesServicePlugin::ERemoveFromDestination )
+        {
+        if ( aMessage.Length() < KMinModifyDestMsgLength )
+            {
+            SendErrorMessageL( KErrArgument, KErrorInvalidParameters );
+            }
+        else
+            {
+            TRAPD( err, ModifyDestinationL( aMessage[0], aMessage.Mid( 1 ) ) );
+            if ( err != KErrNone )
+                {
+                if ( aMessage[0] == CHtiMessagesServicePlugin::EAddToDestination )
+                    {
+                    SendErrorMessageL( err, KErrorAddToDestFailed );
+                    }
+                else
+                    {
+                    SendErrorMessageL( err, KErrorRemoveFromDestFailed );
+                    }
+                }
+            }
+        }
+    else if ( aMessage[0] == CHtiMessagesServicePlugin::ESetDefaultConnection )
+        {
+        if ( aMessage.Length() < KMinSetDefConMsgLength )
+            {
+            SendErrorMessageL( KErrArgument, KErrorInvalidParameters );
+            }
+        else
+            {
+            TRAPD( err, SetDefaultConnectionL( aMessage.Mid( 1 ) ) );
+            if ( err != KErrNone )
+                {
+                SendErrorMessageL( err, KErrorSetDefConFailed );
+                }
+            }
+        }
+
+    HTI_LOG_FUNC_OUT( "CHtiIAPHandler::ProcessMessageL" );
+    }
+
+
+// ----------------------------------------------------------------------------
+// CHtiIAPHandler::HandleCreateIapL
+// Creates new Internet Access Point.
+// ----------------------------------------------------------------------------
+void CHtiIAPHandler::HandleCreateIapL( const TDesC8& aData )
+    {
+    HTI_LOG_FUNC_IN( "CHtiIAPHandler::HandleCreateIapL" );
+
+    TRAPD( err, ParseCreateMessageL( aData ) );
+    if ( err != KErrNone )
+        {
+        SendErrorMessageL( err, KErrorInvalidParameters );
+        return;
+        }
+
+    if ( GetAccessPointUIDL() != KErrNotFound )
+        {
+        SendErrorMessageL( KErrAlreadyExists, KErrorApAlreadyExists );
+        return;
+        }
+
+    MapLegacyFieldIDs();
+    ResolveFieldDataTypes();
+
+    RCmManagerExt cmManager;
+    cmManager.OpenL();
+    CleanupClosePushL( cmManager );
+
+    RCmConnectionMethodExt cm = cmManager.CreateConnectionMethodL( iBearerType );
+    CleanupClosePushL( cm );
+    HTI_LOG_TEXT( "Connection method created" );
+
+    cm.SetStringAttributeL( ECmName, iConnName );
+    HTI_LOG_TEXT( "Name set" );
+
+    TUint32 requestedSeamlessness = 1; // default
+
+    // Set attributes
+    HTI_LOG_FORMAT( "Fields to write: %d", iFields.Count() );
+    for ( TInt i = 0; i < iFields.Count(); i++ )
+        {
+        if ( err != KErrNone ) break;
+
+        HTI_LOG_FORMAT( "Writing field %d", ( i + 1 ) );
+        TApField field = iFields[i];
+        HTI_LOG_FORMAT( "Field ID = %d", field.iId );
+
+        switch ( field.iDataType )
+            {
+            case EDataTypeText:
+                {
+                TRAP( err, cm.SetStringAttributeL( field.iId, *field.iData ) );
+                break;
+                }
+            case EDataTypeBool:
+                {
+                TLex lex( *field.iData );
+                TInt result = 0;
+                lex.Val( result );
+                TRAP( err, cm.SetBoolAttributeL( field.iId, ( TBool ) result ) );
+                break;
+                }
+            case EDataTypeUint:
+                {
+                TLex lex( *field.iData );
+                TUint32 result;
+                err = lex.Val( result, EDecimal );
+                if ( err == KErrNone )
+                    TRAP( err, cm.SetIntAttributeL( field.iId, result ) );
+                if ( field.iId == ECmSeamlessnessLevel )
+                    requestedSeamlessness = result;
+                break;
+                }
+            case EDataTypeText8:
+                {
+                HBufC8* buf8 = HBufC8::NewL( field.iData->Length() );
+                buf8->Des().Copy( *field.iData );
+                TRAP( err, cm.SetString8AttributeL( field.iId, *buf8 ) );
+                delete buf8;
+                buf8 = NULL;
+                break;
+                }
+            default:
+                {
+                HTI_LOG_FORMAT( "Unsupported field type %d", field.iDataType );
+                err = KErrNotSupported;
+                break;
+                }
+            }
+        }
+
+    if ( err != KErrNone )
+        {
+        HTI_LOG_FORMAT( "Error occurred %d", err );
+        User::Leave( err );
+        }
+
+    cm.UpdateL();
+    TUint32 uid = cm.GetIntAttributeL( ECmId );
+    CleanupStack::PopAndDestroy(); // cm
+
+    // The seamlessness value is not always set correctly when the connection
+    // method is created. Have to update seamlessness value separately after
+    // creation.
+    cm = cmManager.ConnectionMethodL( uid );
+    CleanupClosePushL( cm );
+    TUint32 currentSeamlessness = cm.GetIntAttributeL( ECmSeamlessnessLevel );
+    HTI_LOG_FORMAT( "Requested seamlessness = %d", requestedSeamlessness );
+    HTI_LOG_FORMAT( "Current seamlessness = %d", currentSeamlessness );
+    if ( currentSeamlessness != requestedSeamlessness )
+        {
+        cm.SetIntAttributeL( ECmSeamlessnessLevel, requestedSeamlessness );
+        cm.UpdateL();
+        HTI_LOG_TEXT( "Seamlessness value updated" );
+        }
+    CleanupStack::PopAndDestroy(); // cm
+    CleanupStack::PopAndDestroy(); // cmManager
+
+    HTI_LOG_FORMAT( "AP created with uid %d", uid );
+
+    TBuf8<4> idBuf;
+    idBuf.Append( ( TUint8* ) &uid, 4 );
+    SendOkMsgL( idBuf );
+
+    HTI_LOG_FUNC_OUT( "CHtiIAPHandler::HandleCreateIapL" );
+    }
+
+
+// ----------------------------------------------------------------------------
+// CHtiIAPHandler::HandleDeleteIapL
+// Deletes the named Internet Access Point
+// ----------------------------------------------------------------------------
+void CHtiIAPHandler::HandleDeleteIapL( const TDesC8& aData )
+    {
+    HTI_LOG_FUNC_IN( "CHtiIAPHandler::HandleDeleteIapL" );
+    if ( aData.Length() < KMinDeleteMsgLength )
+        {
+        SendErrorMessageL( KErrArgument, KErrorInvalidParameters );
+        return;
+        }
+
+    TInt nameLength = aData[0];
+    if ( nameLength > KMaxConnNameLength ||
+         aData.Length() != ( nameLength + 1 ) )
+        {
+        SendErrorMessageL( KErrArgument, KErrorInvalidParameters );
+        return;
+        }
+
+    iConnName.Copy( aData.Mid( 1, nameLength ) );
+    HTI_LOG_FORMAT( "Searching connection with name: %S", &iConnName );
+    TInt uid = GetAccessPointUIDL();
+
+    if ( uid == KErrNotFound )
+        {
+        SendErrorMessageL( KErrNotFound, KErrorApNotFound );
+        return;
+        }
+
+    RCmManagerExt cmManagerExt;
+    cmManagerExt.OpenL();
+    CleanupClosePushL( cmManagerExt );
+    RCmConnectionMethodExt connMethod = cmManagerExt.ConnectionMethodL( uid );
+    CleanupClosePushL( connMethod );
+    if ( connMethod.GetBoolAttributeL( ECmConnected ) )
+        {
+        HTI_LOG_TEXT( "AP in use - trying to close connections" );
+        TRAPD( err, CloseActiveConnectionsL() );
+        if ( err != KErrNone )
+            {
+            SendErrorMessageL( err, KErrorConnCloseFailed );
+            CleanupStack::PopAndDestroy( 2 ); // connMethod, cmManagerExt
+            return;
+            }
+        }
+
+    HTI_LOG_TEXT( "AP not in use - unlinking from all destinations" );
+    cmManagerExt.RemoveAllReferencesL( connMethod );
+    HTI_LOG_TEXT( "Deleting the AP" );
+    TBool deleted = connMethod.DeleteL(); // returns ETrue if really deleted
+    if ( !deleted )
+        {
+        HTI_LOG_TEXT( "Delete failed" );
+        User::Leave( KErrGeneral );
+        }
+    HTI_LOG_FORMAT( "AP deleted with uid %d", uid );
+    CleanupStack::PopAndDestroy(); // connMethod
+    CleanupStack::PopAndDestroy(); // cmManagerExt
+
+    SendOkMsgL( KNullDesC8 );
+    HTI_LOG_FUNC_OUT( "CHtiIAPHandler::HandleDeleteIapL" );
+    }
+
+
+// ----------------------------------------------------------------------------
+// CHtiIAPHandler::HandleCreateDestinationL
+// Creates a new Destination.
+// ----------------------------------------------------------------------------
+void CHtiIAPHandler::HandleCreateDestinationL( const TDesC8& aData )
+    {
+    HTI_LOG_FUNC_IN( "CHtiIAPHandler::HandleCreateDestinationL" );
+
+    TInt nameLength = aData[0];
+    if ( aData.Length() - 1 != nameLength || nameLength > KMaxConnNameLength )
+        {
+        SendErrorMessageL( KErrArgument, KErrorInvalidParameters );
+        return;
+        }
+
+    RCmManagerExt cmManager;
+    cmManager.OpenL();
+    CleanupClosePushL( cmManager );
+
+    iDestName.Copy( aData.Mid( 1 ) );
+
+    RCmDestinationExt dest = cmManager.CreateDestinationL( iDestName );
+    CleanupClosePushL( dest );
+    dest.UpdateL();
+
+    CleanupStack::PopAndDestroy( 2 ); // dest, cmManager
+    SendOkMsgL( KNullDesC8 );
+
+    HTI_LOG_FUNC_OUT( "CHtiIAPHandler::HandleCreateDestinationL" );
+    }
+
+
+// ----------------------------------------------------------------------------
+// CHtiIAPHandler::HandleDeleteDestinationL
+// Deletes a named Destination.
+// ----------------------------------------------------------------------------
+void CHtiIAPHandler::HandleDeleteDestinationL( const TDesC8& aData )
+    {
+    HTI_LOG_FUNC_IN( "CHtiIAPHandler::HandleDeleteDestinationL" );
+
+    TInt nameLength = aData[0];
+    if ( aData.Length() - 1 != nameLength || nameLength > KMaxConnNameLength )
+        {
+        SendErrorMessageL( KErrArgument, KErrorInvalidParameters );
+        return;
+        }
+
+    iDestName.Copy( aData.Mid( 1 ) );
+    TInt id = GetDestinationIDL( iDestName );
+
+    RCmManagerExt cmManager;
+    cmManager.OpenL();
+    CleanupClosePushL( cmManager );
+
+    RCmDestinationExt dest = cmManager.DestinationL ( id );
+    dest.DeleteLD();
+
+    CleanupStack::PopAndDestroy(); // cmManager
+    SendOkMsgL( KNullDesC8 );
+
+    HTI_LOG_FUNC_OUT( "CHtiIAPHandler::HandleDeleteDestinationL" );
+    }
+
+
+// ----------------------------------------------------------------------------
+// CHtiIAPHandler::ModifyDestinationL
+// Adds or removes IAP to/from a Destination.
+// ----------------------------------------------------------------------------
+void CHtiIAPHandler::ModifyDestinationL( const TInt aCommand, const TDesC8& aData )
+    {
+    HTI_LOG_FUNC_IN( "CHtiIAPHandler::ModifyDestinationL" );
+
+    TInt dataLength = aData.Length();
+    TInt offset = 0;
+    TInt cmNameLength = aData[offset];
+    offset++;
+    if ( dataLength < cmNameLength + 3 || cmNameLength > KMaxConnNameLength )
+        {
+        SendErrorMessageL( KErrArgument, KErrorInvalidParameters );
+        return;
+        }
+    iConnName.Copy( aData.Mid( offset, cmNameLength ) );
+    offset += cmNameLength;
+    TInt destNameLength = aData[offset];
+    offset++;
+    if ( dataLength != cmNameLength + destNameLength + 2 ||
+            destNameLength > KMaxConnNameLength )
+        {
+        SendErrorMessageL( KErrArgument, KErrorInvalidParameters );
+        return;
+        }
+
+    iDestName.Copy( aData.Mid( offset, destNameLength ) );
+
+    TInt cmId = GetAccessPointUIDL();
+    if ( cmId == KErrNotFound )
+        {
+        SendErrorMessageL( KErrNotFound, KErrorApNotFound );
+        return;
+        }
+    TInt destId = GetDestinationIDL( iDestName );
+    if ( destId == KErrNotFound )
+        {
+        SendErrorMessageL( KErrNotFound, KErrorDestNotFound );
+        return;
+        }
+
+    RCmManagerExt cmManager;
+    cmManager.OpenL();
+    CleanupClosePushL( cmManager );
+
+    RCmConnectionMethodExt cm = cmManager.ConnectionMethodL( cmId );
+    CleanupClosePushL( cm );
+    HTI_LOG_TEXT( "Got Connection Method" );
+
+    RCmDestinationExt dest = cmManager.DestinationL( destId );
+    CleanupClosePushL( dest );
+    HTI_LOG_TEXT( "Got Destination" );
+
+    if ( aCommand == CHtiMessagesServicePlugin::EAddToDestination )
+        {
+        dest.AddConnectionMethodL( cm );
+        }
+    else if ( aCommand == CHtiMessagesServicePlugin::ERemoveFromDestination)
+        {
+        dest.RemoveConnectionMethodL( cm );
+        }
+    else
+        {
+        // Programming error
+        User::Panic( _L( "CHtiIAPHandler"), 1 );
+        }
+    dest.UpdateL();
+    HTI_LOG_TEXT( "Destination updated" );
+
+    CleanupStack::PopAndDestroy( 3 ); // dest, cm, cmManager
+    SendOkMsgL( KNullDesC8 );
+
+    HTI_LOG_FUNC_OUT( "CHtiIAPHandler::ModifyDestinationL" );
+    }
+
+
+// ----------------------------------------------------------------------------
+// CHtiIAPHandler::SetDefaultConnectionL
+// Sets the default connection setting.
+// ----------------------------------------------------------------------------
+void CHtiIAPHandler::SetDefaultConnectionL( const TDesC8& aData )
+    {
+    HTI_LOG_FUNC_IN( "CHtiIAPHandler::SetDefaultConnectionL" );
+
+    if ( aData[0] > 3 || aData.Length() != aData[1] + 2 )
+        {
+        User::Leave( KErrArgument );
+        }
+
+    TCmDefConnValue defConnValue;
+    defConnValue.iType = ( TCmDefConnType ) aData[0]; // cmdefconnvalues.h
+    HTI_LOG_FORMAT( "Requested type: %d", defConnValue.iType );
+
+    TInt id = 0;
+    if ( defConnValue.iType == ECmDefConnDestination )
+        {
+        if ( aData[1] == 0 || aData[1] > KMaxConnNameLength )
+            {
+            User::Leave( KErrArgument );
+            }
+        iDestName.Copy( aData.Mid( 2 ) );
+        HTI_LOG_FORMAT( "Destination name: %S", &iDestName );
+        id = GetDestinationIDL( iDestName );
+        if ( id == KErrNotFound )
+            {
+            SendErrorMessageL( KErrNotFound, KErrorDestNotFound );
+            return;
+            }
+        }
+
+    else if ( defConnValue.iType == ECmDefConnConnectionMethod )
+        {
+        if ( aData[1] == 0 || aData[1] > KMaxConnNameLength )
+            {
+            User::Leave( KErrArgument );
+            }
+        iConnName.Copy( aData.Mid( 2 ) );
+        HTI_LOG_FORMAT( "Connection method name: %S", &iConnName );
+        id = GetAccessPointUIDL();
+        if ( id == KErrNotFound )
+            {
+            SendErrorMessageL( KErrNotFound, KErrorApNotFound );
+            return;
+            }
+        }
+
+    defConnValue.iId = id;
+
+    RCmManagerExt cmManager;
+    cmManager.OpenL();
+    CleanupClosePushL( cmManager );
+    cmManager.WriteDefConnL( defConnValue );
+    CleanupStack::PopAndDestroy();
+    SendOkMsgL( KNullDesC8 );
+
+    HTI_LOG_FUNC_OUT( "CHtiIAPHandler::SetDefaultConnectionL" );
+    }
+
+
+// ----------------------------------------------------------------------------
+// CHtiIAPHandler::ParseCreateMessageL
+// Parses the parameters from the create IAP message. Leaves on error.
+// ----------------------------------------------------------------------------
+void CHtiIAPHandler::ParseCreateMessageL( const TDesC8& aData )
+    {
+    HTI_LOG_FUNC_IN( "CHtiIAPHandler::ParseCreateMessageL" );
+
+    TInt dataLength = aData.Length();
+    TInt offset = 0;
+
+    iBearerType = GetBearerUID( aData[offset] );
+    offset++;
+    HTI_LOG_FORMAT( "Bearer type %d", iBearerType );
+    if ( iBearerType == 0 )
+        {
+        User::Leave( KErrArgument );
+        }
+
+    TInt nameLength = aData[offset];
+    offset++;
+    if ( dataLength < ( nameLength + offset + 1 ) ||
+         nameLength > KMaxConnNameLength )
+        {
+        User::Leave( KErrArgument );
+        }
+    iConnName.Copy( aData.Mid( offset, nameLength ) );
+    offset += nameLength;
+    HTI_LOG_FORMAT( "Connection name: %S", &iConnName );
+
+    TInt fieldCount = aData[offset];
+    offset++;
+    HTI_LOG_FORMAT( "Field count %d", fieldCount );
+
+    for ( TInt i = 0; i < fieldCount; i++ )
+        {
+        if ( dataLength < ( offset + 3 ) )
+            {
+            User::Leave( KErrArgument );
+            }
+        HTI_LOG_FORMAT( "Parsing field %d", i + 1 );
+        TApField field;
+        field.iId = aData[offset];
+        offset++;
+        TInt fieldLength = aData[offset];
+        offset++;
+        HTI_LOG_FORMAT( "Field data length %d", fieldLength );
+        if ( fieldLength < 1 || dataLength < ( fieldLength + offset ) )
+            {
+            User::Leave( KErrArgument );
+            }
+        field.iData = HBufC::NewL( fieldLength );
+        field.iData->Des().Copy( aData.Mid( offset, fieldLength ) );
+        offset += fieldLength;
+        HTI_LOG_FORMAT( "Field data: %S", field.iData );
+        field.iDataType = EDataTypeUnknown; // set later
+        User::LeaveIfError( iFields.Append( field ) );
+        }
+
+    if ( offset != dataLength )  // too much data
+        {
+        User::Leave( KErrArgument );
+        }
+
+    HTI_LOG_FUNC_OUT( "CHtiIAPHandler::ParseCreateMessageL" );
+    }
+
+// ----------------------------------------------------------------------------
+// CHtiIAPHandler::GetAccessPointUIDL
+// Gets the UID of Access Point named by iConnName.
+// Returns KErrNotFound if AP not found.
+// ----------------------------------------------------------------------------
+TInt CHtiIAPHandler::GetAccessPointUIDL()
+    {
+    HTI_LOG_FUNC_IN( "CHtiIAPHandler::GetAccessPointUIDL" );
+    TInt uid = KErrNotFound;
+
+    RCmManagerExt cmManager;
+    cmManager.OpenL();
+    CleanupClosePushL( cmManager );
+
+    // Search from uncategorised first
+    RArray<TUint32> array = RArray<TUint32>();
+    cmManager.ConnectionMethodL( array );
+    CleanupClosePushL( array );
+    TInt i = 0;
+    while ( i < array.Count() && uid == KErrNotFound )
+        {
+        RCmConnectionMethodExt cm = cmManager.ConnectionMethodL( array[i] );
+        CleanupClosePushL( cm );
+        HBufC* name = cm.GetStringAttributeL( ECmName );
+        HTI_LOG_FORMAT( "Found name: %S", name );
+        CleanupStack::PushL( name );
+        if ( iConnName.Compare( *name ) == 0 )
+            {
+            uid = cm.GetIntAttributeL( ECmId );
+            HTI_LOG_FORMAT( "Match: UID = %d", uid );
+            }
+        CleanupStack::PopAndDestroy(); // name
+        CleanupStack::PopAndDestroy(); // cm
+        i++;
+        }
+    CleanupStack::PopAndDestroy(); // array
+
+    // If not found from uncategorised, search from all destinations
+    if ( uid == KErrNotFound )
+        {
+        HTI_LOG_TEXT( "Not found from uncategorised" );
+        RArray<TUint32> destIdArray = RArray<TUint32>();
+        cmManager.AllDestinationsL( destIdArray );
+        CleanupClosePushL( destIdArray );
+        i = 0;
+        while ( i < destIdArray.Count() && uid == KErrNotFound )
+            {
+            RCmDestinationExt dest = cmManager.DestinationL( destIdArray[i] );
+            CleanupClosePushL( dest );
+            TInt j = 0;
+            while ( j < dest.ConnectionMethodCount() && uid == KErrNotFound )
+                {
+                HBufC* name = dest.ConnectionMethodL( j ).GetStringAttributeL(
+                        ECmName );
+                CleanupStack::PushL( name );
+                HTI_LOG_FORMAT( "Found name: %S", name );
+                if ( iConnName.Compare( *name ) == 0 )
+                    {
+                    uid = dest.ConnectionMethodL( j ).GetIntAttributeL(
+                            ECmId );
+                    HTI_LOG_FORMAT( "Match: UID = %d", uid );
+                    }
+                CleanupStack::PopAndDestroy(); // name
+                j++;
+                }
+            CleanupStack::PopAndDestroy(); // dest
+            i++;
+            }
+        CleanupStack::PopAndDestroy(); // destIdArray
+        }
+
+    CleanupStack::PopAndDestroy(); // cmManager
+    HTI_LOG_FUNC_OUT( "CHtiIAPHandler::GetAccessPointUIDL" );
+    return uid;
+    }
+
+// ----------------------------------------------------------------------------
+// CHtiIAPHandler::GetDestinationIDL
+// Gets the ID of Destination named by aName.
+// Returns KErrNotFound if Destination is not found.
+// ----------------------------------------------------------------------------
+TInt CHtiIAPHandler::GetDestinationIDL( const TDesC& aName )
+    {
+    HTI_LOG_FUNC_IN( "CHtiIAPHandler::GetDestinationIDL" );
+    HTI_LOG_FORMAT( "Searching Destination %S", &aName );
+
+    RCmManagerExt cmManager;
+    cmManager.OpenL();
+    CleanupClosePushL( cmManager );
+
+    TInt id = KErrNotFound;
+    RArray<TUint32> destIdArray = RArray<TUint32>( 8 );
+    CleanupClosePushL( destIdArray );
+
+    cmManager.AllDestinationsL( destIdArray );
+    TInt i = 0;
+    while ( i < destIdArray.Count() && id == KErrNotFound )
+        {
+        RCmDestinationExt dest = cmManager.DestinationL( destIdArray[i] );
+        CleanupClosePushL( dest );
+        HBufC* destName = dest.NameLC();
+        HTI_LOG_FORMAT( "Found Destination: %S", destName );
+        if ( destName->Compare( aName ) == 0 )
+            {
+            id = dest.Id();
+            HTI_LOG_FORMAT( "Match: ID = %d", id );
+            }
+        CleanupStack::PopAndDestroy( 2 ); // destName, dest
+        i++;
+        }
+
+    CleanupStack::PopAndDestroy( 2 ); // destIdArray, cmManager
+    HTI_LOG_FUNC_OUT( "CHtiIAPHandler::GetDestinationIDL" );
+    return id;
+    }
+
+
+// ----------------------------------------------------------------------------
+// CHtiIAPHandler::CloseActiveConnectionsL
+// Closes connection(s) that are using the Access Point named by iConnName.
+// Leaves if closing fails.
+// ----------------------------------------------------------------------------
+void CHtiIAPHandler::CloseActiveConnectionsL()
+    {
+    HTI_LOG_FUNC_IN( "CHtiIAPHandler::CloseActiveConnectionsL" );
+
+    RConnectionMonitor monitor;
+    monitor.ConnectL();
+    CleanupClosePushL( monitor );
+    HTI_LOG_TEXT( "RConnectionMonitor connected" );
+
+    TUint connCount = 0;
+    TUint subConnCount = 0;
+    TUint connId = 0;
+    //TUint iapId = 0;
+    TName iapName;
+    TRequestStatus status;
+
+    monitor.GetConnectionCount( connCount, status );
+    User::WaitForRequest( status );
+    User::LeaveIfError( status.Int() );
+    HTI_LOG_FORMAT( "Found %d connections", connCount );
+
+    for ( TUint i = 1; i <= connCount; i++ )
+        {
+        HTI_LOG_FORMAT( "Connection %d", i );
+        User::LeaveIfError(
+            monitor.GetConnectionInfo( i, connId, subConnCount ) );
+        HTI_LOG_FORMAT( " Connection ID = %d", connId );
+        HTI_LOG_FORMAT( " Sub connections = %d", subConnCount );
+        /*
+        monitor.GetUintAttribute( connId, 0, KIAPId, iapId, status );
+        User::WaitForRequest( status );
+        User::LeaveIfError( status.Int() );
+        HTI_LOG_FORMAT( " IAP ID = %d", iapId );
+        */
+        monitor.GetStringAttribute( connId, 0, KIAPName, iapName, status );
+        User::WaitForRequest( status );
+        User::LeaveIfError( status.Int() );
+        HTI_LOG_FORMAT( " IAP name = %S", &iapName );
+        if ( iapName.Compare( iConnName ) == 0 )
+            {
+            HTI_LOG_TEXT( " Match: Trying to close this connection" );
+            User::LeaveIfError(
+                monitor.SetBoolAttribute( connId, 0, KConnectionStop, ETrue ) );
+            }
+        }
+
+    CleanupStack::PopAndDestroy(); // monitor
+    HTI_LOG_FUNC_OUT( "CHtiIAPHandler::CloseActiveConnectionsL" );
+    }
+
+// ----------------------------------------------------------------------------
+// CHtiIAPHandler::GetBearerUID
+// Helper function for mapping old TApBearerType value to new bearer type
+// ECom UID.
+// ----------------------------------------------------------------------------
+TUint CHtiIAPHandler::GetBearerUID( const TInt aBearerType )
+    {
+    HTI_LOG_FUNC_IN( "CHtiIAPHandler::GetBearerUID" );
+    TUint uid = 0;
+    switch ( aBearerType )
+        {
+        case 0x01:  // CSD
+            uid = KUidCSDBearerType;
+            break;
+        case 0x02:  // GPRS
+            uid = KUidPacketDataBearerType;
+            break;
+        case 0x04:  // HSCSD
+            uid = KUidHSCSDBearerType;
+            break;
+        case 0x10:  // CDMA
+            uid = KUidPacketDataBearerType;
+            break;
+        case 0x20:  // WLAN
+            uid = KUidWlanBearerType;
+            break;
+        default:
+            break;
+
+        }
+    HTI_LOG_FUNC_OUT( "CHtiIAPHandler::GetBearerUID" );
+    return uid;
+    }
+
+// ----------------------------------------------------------------------------
+// CHtiIAPHandler::MapLegacyFieldIDs
+// Helper function for mapping the old access point field ID numbers to
+// new ones.
+// ----------------------------------------------------------------------------
+void CHtiIAPHandler::MapLegacyFieldIDs()
+    {
+    HTI_LOG_FUNC_IN( "CHtiIAPHandler::MapLegacyFieldIDs" );
+
+    for ( TInt i = 0; i < iFields.Count(); i++ )
+        {
+        TApField field = iFields[i];
+        switch ( field.iId )
+            {
+            case EApWapStartPage:
+                {
+                field.iId = ECmStartPage;
+                break;
+                }
+            case EApIspDefaultTelNumber:
+                {
+                field.iId = EDialDefaultTelNum;
+                break;
+                }
+            case EApIspUseLoginScript:
+                {
+                field.iId = EDialUseLoginScript;
+                break;
+                }
+            case EApIspLoginScript:
+                {
+                field.iId = EDialLoginScript;
+                break;
+                }
+            case EApIspLoginName:
+                {
+                if ( iBearerType == KUidCSDBearerType || iBearerType == KUidHSCSDBearerType )
+                    field.iId = EDialIFAuthName;
+                else if ( iBearerType == KUidPacketDataBearerType )
+                    field.iId = EPacketDataIFAuthName;
+                else
+                    field.iId = ECmIFAuthName;
+                break;
+                }
+            case EApIspLoginPass:
+                {
+                if ( iBearerType == KUidCSDBearerType || iBearerType == KUidHSCSDBearerType )
+                    field.iId = EDialIFAuthPass;
+                else if ( iBearerType == KUidPacketDataBearerType )
+                    field.iId = EPacketDataIFAuthPass;
+                else
+                    field.iId = ECmIFAuthPass;
+                break;
+                }
+            case EApIspIfPromptForAuth:
+                {
+                if ( iBearerType == KUidCSDBearerType || iBearerType == KUidHSCSDBearerType )
+                    field.iId = EDialIFPromptForAuth;
+                else if ( iBearerType == KUidPacketDataBearerType )
+                    field.iId = EPacketDataIFPromptForAuth;
+                else
+                    field.iId = ECmIFPromptForAuth;
+                break;
+                }
+            case EApIspIfCallbackEnabled:
+                {
+                field.iId = EDialIFCallbackEnabled;
+                break;
+                }
+            case EApIspIfCallbackType:
+                {
+                field.iId = EDialIFCallbackType;
+                break;
+                }
+            case EApIspIfCallbackInfo:
+                {
+                field.iId = EDialIFCallbackInfo;
+                break;
+                }
+            case EApIspIPAddr:
+                {
+                if ( iBearerType == KUidCSDBearerType || iBearerType == KUidHSCSDBearerType )
+                    field.iId = EDialIPAddress;
+                else if ( iBearerType == KUidPacketDataBearerType )
+                    field.iId = EPacketDataIPAddr;
+                else if ( iBearerType == KUidWlanBearerType )
+                    field.iId = EWlanIpAddr;
+                else
+                    field.iId = ECmIPAddress;
+                break;
+                }
+            case EApIspIPNameServer1:
+                {
+                if ( iBearerType == KUidCSDBearerType || iBearerType == KUidHSCSDBearerType )
+                    field.iId = EDialIPNameServer1;
+                else if ( iBearerType == KUidPacketDataBearerType )
+                    field.iId = EPacketDataIPNameServer1;
+                else if ( iBearerType == KUidWlanBearerType )
+                    field.iId = EWlanIpNameServer1;
+                else
+                    field.iId = ECmIPNameServer1;
+                break;
+                }
+            case EApIspIPNameServer2:
+                {
+                if ( iBearerType == KUidCSDBearerType || iBearerType == KUidHSCSDBearerType )
+                    field.iId = EDialIPNameServer2;
+                else if ( iBearerType == KUidPacketDataBearerType )
+                    field.iId = EPacketDataIPNameServer2;
+                else if ( iBearerType == KUidWlanBearerType )
+                    field.iId = EWlanIpNameServer2;
+                else
+                    field.iId = ECmIPNameServer2;
+                break;
+                }
+            case EApIspEnableIpHeaderComp:
+                {
+                if ( iBearerType == KUidCSDBearerType || iBearerType == KUidHSCSDBearerType )
+                    field.iId = EDialEnableIPHeaderComp;
+                else if ( iBearerType == KUidPacketDataBearerType )
+                    field.iId = EPacketDataHeaderCompression;
+                break;
+                }
+            case EApIspDisablePlainTextAuth:
+                {
+                if ( iBearerType == KUidCSDBearerType || iBearerType == KUidHSCSDBearerType )
+                    field.iId = EDialDisablePlainTextAuth;
+                else if ( iBearerType == KUidPacketDataBearerType )
+                    field.iId = EPacketDataDisablePlainTextAuth;
+                else
+                    field.iId = ECmDisablePlainTextAuth;
+                break;
+                }
+            case EApIspBearerSpeed:
+                {
+                field.iId = EDialMaxConnSpeed;
+                break;
+                }
+            case EApIspBearerCallTypeIsdn:
+                {
+                field.iId = EDialCallType;
+                break;
+                }
+            case EApIspInitString:
+                {
+                field.iId = EDialInitString;
+                break;
+                }
+            case EApGprsAccessPointName:
+                {
+                field.iId = EPacketDataAPName;
+                break;
+                }
+            case EApGprsPdpType:
+                {
+                field.iId = EPacketDataPDPType;
+                break;
+                }
+            case EApProxyServerAddress:
+                {
+                field.iId = ECmProxyServerName;
+                break;
+                }
+            case EApProxyPortNumber:
+                {
+                field.iId = ECmProxyPortNumber;
+                break;
+                }
+            case EApIP6NameServer1:
+                {
+                if ( iBearerType == KUidCSDBearerType || iBearerType == KUidHSCSDBearerType )
+                    field.iId = EDialIP6NameServer1;
+                else if ( iBearerType == KUidPacketDataBearerType )
+                    field.iId = EPacketDataIPIP6NameServer1;
+                else if ( iBearerType == KUidWlanBearerType )
+                    field.iId = EWlanIp6NameServer1;
+                else
+                    field.iId = ECmIP6NameServer1;
+                break;
+                }
+            case EApIP6NameServer2:
+                {
+                if ( iBearerType == KUidCSDBearerType || iBearerType == KUidHSCSDBearerType )
+                    field.iId = EDialIP6NameServer2;
+                else if ( iBearerType == KUidPacketDataBearerType )
+                    field.iId = EPacketDataIPIP6NameServer2;
+                else if ( iBearerType == KUidWlanBearerType )
+                    field.iId = EWlanIp6NameServer2;
+                else
+                    field.iId = ECmIP6NameServer2;
+                break;
+                }
+            case EApWlanNetworkName:
+                {
+                field.iId = EWlanSSID;
+                break;
+                }
+            case EApWlanNetworkMode:
+                {
+                field.iId = EWlanConnectionMode;
+                break;
+                }
+            case EApWlanSecurityMode:
+                {
+                field.iId = EWlanSecurityMode;
+                break;
+                }
+            case EApSeamlessnessLevel:
+                {
+                field.iId = ECmSeamlessnessLevel;
+                break;
+                }
+            default:
+                break;
+            }
+        iFields[i] = field;
+        }
+
+    HTI_LOG_FUNC_OUT( "CHtiIAPHandler::MapLegacyFieldIDs" );
+    }
+
+// ----------------------------------------------------------------------------
+// CHtiIAPHandler::ResolveFieldDataTypes
+// Helper function for resolving the data types for different AP settings
+// fields based on field ID and bearer type.
+// ----------------------------------------------------------------------------
+void CHtiIAPHandler::ResolveFieldDataTypes()
+    {
+    HTI_LOG_FUNC_IN( "CHtiIAPHandler::ResolveFieldDataTypes" );
+
+    for ( TInt i = 0; i < iFields.Count(); i++ )
+        {
+        if ( iFields[i].iDataType != EDataTypeUnknown ) continue; // already set
+
+        // Common fields
+        switch ( iFields[i].iId )
+            {
+            // String types
+            case ECmStartPage:
+            case ECmProxyServerName:
+            case ECmProxyProtocolName:
+            case ECmProxyExceptions:
+            case ECmIFName:
+            case ECmIFParams:
+            case ECmIFNetworks:
+            case ECmIFAuthName:
+            case ECmIFAuthPass:
+            case ECmIPGateway:
+            case ECmIPAddress:
+            case ECmIPNameServer1:
+            case ECmIPNameServer2:
+            case ECmIP6NameServer1:
+            case ECmIP6NameServer2:
+                iFields[i].iDataType = EDataTypeText;
+                break;
+
+            // Bool types
+            case ECmProtected:
+            case ECmIFPromptForAuth:
+            case ECmIPAddFromServer:
+            case ECmIPDNSAddrFromServer:
+            case ECmIP6DNSAddrFromServer:
+            case ECmEnableLPCExtension:
+            case ECmDisablePlainTextAuth:
+                iFields[i].iDataType = EDataTypeBool;
+                break;
+
+            // Uint types
+            case ECmSeamlessnessLevel:
+            case ECmProxyPortNumber:
+            case ECmIFAuthRetries:
+                iFields[i].iDataType = EDataTypeUint;
+                break;
+
+            default:
+                break;
+            }
+
+        // If it was found from common fields, we can continue to next field
+        if ( iFields[i].iDataType != EDataTypeUnknown ) continue;
+
+        // Check from bearer specific fields.
+        // Different bearers have to be in separate switch-cases because
+        // there are same values in different bearers.
+
+        // Data call fields
+        if ( iBearerType == KUidCSDBearerType ||
+                iBearerType == KUidHSCSDBearerType )
+            {
+            switch ( iFields[i].iId )
+                {
+                // String types
+                case EDialDescription:
+                case EDialDefaultTelNum:
+                case EDialLoginScript:
+                case EDialLoginName:
+                case EDialLoginPassword:
+                case EDialIFParams:
+                case EDialIFNetworks:
+                case EDialIFAuthName:
+                case EDialIFAuthPass:
+                case EDialIPAddress:
+                case EDialIPNetmask:
+                case EDialIPGateway:
+                case EDialIPNameServer1:
+                case EDialIPNameServer2:
+                case EDialIP6NameServer1:
+                case EDialIP6NameServer2:
+                    iFields[i].iDataType = EDataTypeText;
+                    break;
+
+                // Bool types
+                case EDialOut:
+                case EDialDialResolution:
+                case EDialUseLoginScript:
+                case EDialPromptForLogin:
+                case EDialDisplayPCT:
+                case EDialIFPromptForAuth:
+                case EDialIFCallbackEnabled:
+                case EDialIFServerMode:
+                case EDialIPAddressFromServer:
+                case EDialIPDNSAddressFromServer:
+                case EDialIP6DNSAddressFromServer:
+                case EDialEnableIPHeaderComp:
+                case EDialEnableLCPExtension:
+                case EDialDisablePlainTextAuth:
+                case EDialEnableSWComp:
+                case EDialUseEdge:
+                    iFields[i].iDataType = EDataTypeBool;
+                    break;
+
+                // Uint types
+                case EDialCallType:
+                case EDialMaxConnSpeed:
+                case EDialType:
+                case EDialChargeCard:
+                case EDialIFAuthRetries:
+                case EDialIFCallbackType:
+                case EDialCallbackTimeout:
+                case EDialBearerName:
+                case EDialBearerSpeed:
+                case EDialBearerCE:
+                case EDialBearerService:
+                case EDialBearerProtocol:
+                case EDialRLPVersion:
+                case EDialIWFtoMS:
+                case EDialMStoIWF:
+                case EDialAckTimer:
+                case EDialRetransmissionAttempts:
+                case EDialResequencePeriod:
+                case EDialV42Compression:
+                case EDialV42CodeWords:
+                case EDialV42MaxLength:
+                case EHscsdAsymmetry:
+                case EHscsdUserInitUpgrade:
+                    iFields[i].iDataType = EDataTypeUint;
+                    break;
+
+                // 8-bit string types
+                case EDialIFCallbackInfo:
+                case EDialInitString:
+                    iFields[i].iDataType = EDataTypeText8;
+                    break;
+
+                default:
+                    break;
+                }
+            }
+
+        // Packet data fields
+        else if ( iBearerType == KUidPacketDataBearerType )
+            {
+            switch ( iFields[i].iId )
+                {
+                // String types
+                case EPacketDataAPName:
+                case EPacketDataPDPAddress:
+                case EPacketDataIFParams:
+                case EPacketDataIFNetworks:
+                case EPacketDataIFAuthName:
+                case EPacketDataIFAuthPass:
+                case EPacketDataIPNetmask:
+                case EPacketDataIPGateway:
+                case EPacketDataIPAddr:
+                case EPacketDataIPNameServer1:
+                case EPacketDataIPNameServer2:
+                case EPacketDataIPIP6NameServer1:
+                case EPacketDataIPIP6NameServer2:
+                    iFields[i].iDataType = EDataTypeText;
+                    break;
+
+                // Bool types
+                case EPacketDataDataCompression:
+                case EPacketDataHeaderCompression:
+                case EPacketDataUseEdge:
+                case EPacketDataAnonymousAccess:
+                case EPacketDataIFPromptForAuth:
+                case EPacketDataIPAddrFromServer:
+                case EPacketDataIPDNSAddrFromServer:
+                case EPacketDataIPIP6DNSAddrFromServer:
+                case EPacketDataEnableLcpExtension:
+                case EPacketDataDisablePlainTextAuth:
+                case EPacketDataServiceEnableLLMNR:
+                    iFields[i].iDataType = EDataTypeBool;
+                    break;
+
+                // Uint types
+                case EPacketDataPDPType:
+                case EPacketDataIFAuthRetries:
+                case EPacketDataApType:
+                    iFields[i].iDataType = EDataTypeUint;
+                    break;
+
+                default:
+                    break;
+                }
+            }
+
+        // WLAN fields
+        else if ( iBearerType == KUidWlanBearerType )
+            {
+            switch ( iFields[i].iId )
+            {
+                // String types
+                case EWlanIfNetworks:
+                case EWlanIpNetMask:
+                case EWlanIpGateway:
+                case EWlanIpAddr:
+                case EWlanIpNameServer1:
+                case EWlanIpNameServer2:
+                case EWlanIp6NameServer1:
+                case EWlanIp6NameServer2:
+                case EWlanSSID:
+                case EWlanUsedSSID:
+                    iFields[i].iDataType = EDataTypeText;
+                    break;
+
+                // Bool types
+                case EWlanIpAddrFromServer:
+                case EWlanIpDNSAddrFromServer:
+                case EWlanIp6DNSAddrFromServer:
+                case EWlanScanSSID:
+                case EWlanAllowSSIDRoaming:
+                    iFields[i].iDataType = EDataTypeBool;
+                    break;
+
+                // Uint types
+                case EWlanServiceId:
+                case EWlanConnectionMode:
+                case EWlanSecurityMode:
+                case EWlanAuthenticationMode:
+                case EWlanChannelID:
+                    iFields[i].iDataType = EDataTypeUint;
+                    break;
+
+                default:
+                    break;
+                }
+            }
+
+        else
+            {
+            HTI_LOG_TEXT( "Unknown bearer type" )
+            }
+        }
+    HTI_LOG_FUNC_OUT( "CHtiIAPHandler::ResolveFieldDataTypes" );
+    }
+
+
+// ----------------------------------------------------------------------------
+// CHtiIAPHandler::SendOkMsgL
+// Helper function for sending response messages.
+// ----------------------------------------------------------------------------
+void CHtiIAPHandler::SendOkMsgL( const TDesC8& aData )
+    {
+    HTI_LOG_FUNC_IN( "CHtiIAPHandler::SendOkMsgL" );
+    User::LeaveIfNull( iDispatcher );
+    HBufC8* temp = HBufC8::NewL( aData.Length() + 1 );
+    TPtr8 response = temp->Des();
+    response.Append( ( TChar ) CHtiMessagesServicePlugin::EResultOk );
+    response.Append( aData );
+    User::LeaveIfError( iDispatcher->DispatchOutgoingMessage(
+        temp, KHtiMessagesServiceUid ) );
+    HTI_LOG_FUNC_OUT( "CHtiIAPHandler::SendOkMsgL" );
+    }
+
+
+// ----------------------------------------------------------------------------
+// CHtiIAPHandler::SendErrorMessageL
+// Helper function for sending error response messages.
+// ----------------------------------------------------------------------------
+void CHtiIAPHandler::SendErrorMessageL( TInt aError, const TDesC8& aDescription )
+    {
+    HTI_LOG_FUNC_IN( "CHtiIAPHandler::SendErrorMessageL" );
+    User::LeaveIfNull( iDispatcher );
+    User::LeaveIfError( iDispatcher->DispatchOutgoingErrorMessage(
+        aError, aDescription, KHtiMessagesServiceUid ) );
+    HTI_LOG_FUNC_OUT( "CHtiIAPHandler::SendErrorMessageL" );
+    }
+
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiServicePlugins/HtiMessagesServicePlugin/src/HtiMailboxHandler.cpp	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,1198 @@
+/*
+* 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 HTI mailbox settings handling.
+*
+*/
+
+
+// INCLUDE FILES
+#include <cmconnectionmethod.h>
+#include <cmconnectionmethoddef.h>
+#include <cmdestination.h>
+#include <cmmanager.h>
+#include <cemailaccounts.h>
+#include <etelmm.h>
+#include <iapprefs.h>
+#include <imapset.h>
+#include <mtmuibas.h>
+#include <SendUiConsts.h>
+#include <pop3set.h>
+#include <smtpset.h>
+#include <txtrich.h>
+
+#include <HtiDispatcherInterface.h>
+#include <HtiLogging.h>
+#include "HtiMessagesServicePlugin.h"
+#include "HtiMailboxHandler.h"
+
+// EXTERNAL DATA STRUCTURES
+
+// EXTERNAL FUNCTION PROTOTYPES
+
+// CONSTANTS
+const TInt KMinCreateMsgLength = 36;
+const TInt KMinDeleteMsgLength = 3;
+
+const TInt KImeiLength = 15;
+
+const TInt KDefaultImapPortSSL = 993;
+const TInt KDefaultPopPortSSL  = 995;
+const TInt KDefaultSmtpPortSSL = 465;
+
+// MACROS
+
+// LOCAL CONSTANTS AND MACROS
+_LIT8( KErrorInvalidParameters, "Invalid command parameters" );
+_LIT8( KErrorCreateFailed, "Mailbox creation failed" );
+_LIT8( KErrorDeleteFailed, "Mailbox deletion failed" );
+
+#ifdef __WINS__
+_LIT( KWinsImei, "123456789012345" );
+#else
+_LIT( KTsyName, "phonetsy" );
+#endif
+
+// MODULE DATA STRUCTURES
+
+// LOCAL FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CHtiMailboxHandler::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+CHtiMailboxHandler* CHtiMailboxHandler::NewL()
+    {
+    HTI_LOG_FUNC_IN( "CHtiMailboxHandler::NewL" );
+    CHtiMailboxHandler* self = new (ELeave) CHtiMailboxHandler();
+    CleanupStack::PushL ( self );
+    self->ConstructL();
+    CleanupStack::Pop();
+    HTI_LOG_FUNC_OUT( "CHtiMailboxHandler::NewL" );
+    return self;
+    }
+
+
+// ----------------------------------------------------------------------------
+// CHtiMailboxHandler::CHtiMailboxHandler
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// ----------------------------------------------------------------------------
+CHtiMailboxHandler::CHtiMailboxHandler()
+    {
+    HTI_LOG_FUNC_IN( "CHtiMailboxHandler::CHtiMailboxHandler" );
+
+    HTI_LOG_FUNC_OUT( "CHtiMailboxHandler::CHtiMailboxHandler" );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CHtiMailboxHandler::~CHtiMailboxHandler
+// Destructor.
+// -----------------------------------------------------------------------------
+CHtiMailboxHandler::~CHtiMailboxHandler()
+    {
+    HTI_LOG_FUNC_IN( "CHtiMailboxHandler::~CHtiMailboxHandler" );
+    delete iMailboxName;
+    delete iIncomingServer;
+    delete iIncomingApName;
+    delete iIncomingUserName;
+    delete iIncomingPassword;
+    delete iOutgoingServer;
+    delete iOutgoingApName;
+    delete iOutgoingUserName;
+    delete iOutgoingPassword;
+    delete iOwnMailAddress;
+    delete iOwnName;
+    delete iSignatureText;
+    delete iImapFolderPath;
+    HTI_LOG_FUNC_OUT( "CHtiMailboxHandler::~CHtiMailboxHandler" );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CHtiMailboxHandler::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+void CHtiMailboxHandler::ConstructL()
+    {
+    HTI_LOG_FUNC_IN( "CHtiMailboxHandler::ConstructL" );
+
+    HTI_LOG_FUNC_OUT( "CHtiMailboxHandler::ConstructL" );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CHtiMailboxHandler::SetDispatcher
+// Sets the dispatcher pointer.
+// -----------------------------------------------------------------------------
+
+void CHtiMailboxHandler::SetDispatcher( MHtiDispatcher* aDispatcher )
+    {
+    HTI_LOG_FUNC_IN( "CHtiMailboxHandler::SetDispatcher" );
+    iDispatcher = aDispatcher;
+    HTI_LOG_FUNC_OUT( "CHtiMailboxHandler::SetDispatcher" );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CHtiMailboxHandler::ProcessMessageL
+// Parses the received message and calls handler functions.
+// -----------------------------------------------------------------------------
+void CHtiMailboxHandler::ProcessMessageL( const TDesC8& aMessage,
+    THtiMessagePriority /*aPriority*/ )
+    {
+    HTI_LOG_FUNC_IN( "CHtiMailboxHandler::ProcessMessageL" );
+
+    // Zero length message and command code validity already checked
+    // in HtiMessagesServicePlugin.
+
+    if ( aMessage[0] == CHtiMessagesServicePlugin::ECreateMailBox )
+        {
+        if ( aMessage.Length() < KMinCreateMsgLength )
+            {
+            SendErrorMessageL( KErrArgument, KErrorInvalidParameters );
+            }
+        else
+            {
+            iCmManager.OpenL();
+            TRAPD( err, HandleCreateMailboxL(
+                    aMessage.Right( aMessage.Length() - 1 ) ) );
+            if ( err != KErrNone )
+                {
+                if ( err == KErrArgument )
+                    {
+                    SendErrorMessageL( err, KErrorInvalidParameters );
+                    }
+                else
+                    {
+                    HTI_LOG_FORMAT( "Create error %d", err );
+                    SendErrorMessageL( err, KErrorCreateFailed );
+                    }
+                }
+            else
+                {
+                SendOkMsgL( KNullDesC8 );
+                }
+            ResetVariables();
+            }
+        }
+
+    else
+        {
+        if ( aMessage.Length() < KMinDeleteMsgLength )
+            {
+            SendErrorMessageL( KErrArgument, KErrorInvalidParameters );
+            }
+        else
+            {
+            TRAPD( err, HandleDeleteMailboxL(
+                    aMessage.Right( aMessage.Length() - 1 ) ) );
+            if ( err != KErrNone )
+                {
+                HTI_LOG_FORMAT( "Delete error %d", err );
+                SendErrorMessageL( err, KErrorDeleteFailed );
+                }
+            else
+                {
+                SendOkMsgL( KNullDesC8 );
+                }
+            }
+        }
+
+    HTI_LOG_FUNC_OUT( "CHtiMailboxHandler::ProcessMessageL" );
+    }
+
+// ----------------------------------------------------------------------------
+// CHtiMailboxHandler::HandleCreateMailboxL
+// Creates new mailbox.
+// ----------------------------------------------------------------------------
+void CHtiMailboxHandler::HandleCreateMailboxL( const TDesC8& aData )
+    {
+    HTI_LOG_FUNC_IN( "CHtiMailboxHandler::HandleCreateMailboxL" );
+
+    ParseCreateMsgL( aData );
+
+    TSmtpAccount smtpAcc;
+    TInt result = FindSmtpAccount( *iMailboxName, smtpAcc );
+    if ( result != KErrNotFound )
+        {
+        User::Leave( KErrAlreadyExists );
+        }
+
+    CImImap4Settings* imap4Set = new (ELeave) CImImap4Settings;
+    CleanupStack::PushL( imap4Set );
+    CImPop3Settings* pop3Set = new (ELeave) CImPop3Settings;
+    CleanupStack::PushL( pop3Set );
+    CImSmtpSettings* smtpSet = new (ELeave) CImSmtpSettings;
+    CleanupStack::PushL( smtpSet );
+
+    CImIAPPreferences* incomingIapSet = CImIAPPreferences::NewLC();
+    CImIAPPreferences* outgoingIapSet = CImIAPPreferences::NewLC();
+
+    CEmailAccounts* accounts = CEmailAccounts::NewLC();
+    accounts->PopulateDefaultSmtpSettingsL( *smtpSet, *outgoingIapSet );
+    if ( iMailboxType == 0 )  // POP3
+        {
+        accounts->PopulateDefaultPopSettingsL( *pop3Set, *incomingIapSet );
+        }
+    else // IMAP4
+        {
+        accounts->PopulateDefaultImapSettingsL( *imap4Set, *incomingIapSet );
+        }
+
+    // Set access point settings
+    TImIAPChoice imIAPChoice;
+    imIAPChoice.iIAP = 0;
+    imIAPChoice.iDialogPref = ECommDbDialogPrefPrompt;
+
+    if ( iIncomingApName->Length() > 0 )
+        {
+        User::LeaveIfError(
+            imIAPChoice.iIAP = AccessPointUIDL( *iIncomingApName ) );
+        imIAPChoice.iDialogPref = ECommDbDialogPrefDoNotPrompt;
+        HTI_LOG_TEXT( "Incoming IAP user defined" );
+        }
+    incomingIapSet->AddIAPL( imIAPChoice );
+
+    imIAPChoice.iIAP = 0;
+    imIAPChoice.iDialogPref = ECommDbDialogPrefPrompt;
+
+    if ( iOutgoingApName->Length() > 0 )
+        {
+        User::LeaveIfError(
+            imIAPChoice.iIAP = AccessPointUIDL( *iOutgoingApName ) );
+        imIAPChoice.iDialogPref = ECommDbDialogPrefDoNotPrompt;
+        HTI_LOG_TEXT( "Outgoing IAP user defined" );
+        }
+    outgoingIapSet->AddIAPL( imIAPChoice );
+
+    // Set SMTP settings
+    HTI_LOG_TEXT( "Setting SMTP settings" );
+    smtpSet->SetServerAddressL( *iOutgoingServer );
+    smtpSet->SetLoginNameL( *iOutgoingUserName );
+    smtpSet->SetPasswordL( *iOutgoingPassword );
+    smtpSet->SetEmailAddressL( *iOwnMailAddress );
+    smtpSet->SetReplyToAddressL( *iOwnMailAddress );
+    smtpSet->SetEmailAliasL( *iOwnName );
+    if ( iSignatureText->Length() > 0 )
+        {
+        smtpSet->SetAddSignatureToEmail( ETrue );
+        }
+    else
+        {
+        smtpSet->SetAddSignatureToEmail( EFalse );
+        }
+    smtpSet->SetSendCopyToSelf( (TImSMTPSendCopyToSelf) iSendCopyToOwnAddress );
+    smtpSet->SetSendMessageOption( (TImSMTPSendMessageOption) iSendOption );
+    if ( iOutgoingSecurity == 0 )
+        {
+        smtpSet->SetSecureSockets( EFalse );
+        }
+    else
+        {
+        smtpSet->SetSecureSockets( ETrue );
+        if ( iOutgoingSecurity == 1 )
+            {
+            smtpSet->SetSSLWrapper( EFalse );
+            }
+        else // 2 = SSL
+            {
+            smtpSet->SetSSLWrapper( ETrue );
+            }
+        }
+    if ( iOutgoingPort > 0 )
+        {
+        smtpSet->SetPort( (TUint) iOutgoingPort );
+        }
+    else
+        {
+        if ( iOutgoingSecurity == 2 ) // SSL
+            {
+            smtpSet->SetPort( KDefaultSmtpPortSSL );
+            }
+        else
+            {
+            smtpSet->SetPort( KSMTPDefaultPortNumber );
+            }
+        }
+    smtpSet->SetBodyEncoding( EMsgOutboxMIME );
+    smtpSet->SetAddVCardToEmail( EFalse );
+    smtpSet->SetRequestReceipts( EFalse );
+    smtpSet->SetSMTPAuth( ETrue );
+
+    TSmtpAccount smtpAccount;
+    TPopAccount popAccount;
+    TImapAccount imapAccount;
+
+    // Set POP3 settings
+    if ( iMailboxType == 0 )  // POP3
+        {
+        HTI_LOG_TEXT( "Setting POP3 settings" );
+        pop3Set->SetServerAddressL( *iIncomingServer );
+        pop3Set->SetLoginNameL( *iIncomingUserName );
+        pop3Set->SetPasswordL( *iIncomingPassword );
+        pop3Set->SetApop( iAPopSecureLogin );
+        if ( iIncomingSecurity == 0 )
+            {
+            pop3Set->SetSecureSockets( EFalse );
+            }
+        else
+            {
+            pop3Set->SetSecureSockets( ETrue );
+            if ( iIncomingSecurity == 1 )
+                {
+                pop3Set->SetSSLWrapper( EFalse );
+                }
+            else
+                {
+                pop3Set->SetSSLWrapper( ETrue );
+                }
+            }
+        if ( iIncomingPort > 0 )
+            {
+            pop3Set->SetPort( (TUint) iIncomingPort );
+            }
+        else
+            {
+            if ( iIncomingSecurity == 2 ) // SSL
+                {
+                pop3Set->SetPort( KDefaultPopPortSSL );
+                }
+            else
+                {
+                pop3Set->SetPort( KPOP3DefaultPortNumber );
+                }
+            }
+        if ( iRetrievedParts == 0 ) // Only headers
+            {
+            pop3Set->SetGetMailOptions( EGetPop3EmailHeaders );
+            pop3Set->SetPopulationLimitL( -2 ); // -2 = headers only (EmailUtils.h)
+            }
+        else
+            {
+            pop3Set->SetGetMailOptions( EGetPop3EmailMessages );
+            if ( iRetrievedParts == 1 ) // Less than (kb)
+                {
+                pop3Set->SetMaxEmailSize( iRetrieveSizeLimitKb );
+                pop3Set->SetPopulationLimitL( iRetrieveSizeLimitKb );
+                }
+            else
+                {
+                pop3Set->SetPopulationLimitL( -1 ); // -1 = body and attachment (EmailUtils.h)
+                }
+            }
+
+        if ( iEmailsToRetrieve > 0 )
+            {
+            pop3Set->SetInboxSynchronisationLimit( iEmailsToRetrieve );
+            }
+        else
+            {
+            // If limit is not set (zero), retrieves all
+            pop3Set->SetInboxSynchronisationLimit( KErrNotFound );
+            }
+
+        pop3Set->SetAcknowledgeReceipts( EFalse );
+        pop3Set->SetDisconnectedUserMode( ETrue );
+        pop3Set->SetAutoSendOnConnect( ETrue );
+        pop3Set->SetDeleteEmailsWhenDisconnecting( EFalse );
+
+        popAccount = accounts->CreatePopAccountL(
+            *iMailboxName, *pop3Set, *incomingIapSet, EFalse );
+        HTI_LOG_FORMAT( "Created POP3 account %d", popAccount.iPopAccountId );
+        smtpAccount = accounts->CreateSmtpAccountL(
+            popAccount, *smtpSet, *outgoingIapSet, EFalse );
+        HTI_LOG_FORMAT( "Created SMTP account %d", smtpAccount.iSmtpAccountId );
+        }
+
+    // Set IMAP4 settings
+    else
+        {
+        HTI_LOG_TEXT( "Setting IMAP4 settings" );
+        imap4Set->SetServerAddressL( *iIncomingServer );
+        imap4Set->SetLoginNameL( *iIncomingUserName );
+        imap4Set->SetPasswordL( *iIncomingPassword );
+        if ( iIncomingSecurity == 0 )
+            {
+            imap4Set->SetSecureSockets( EFalse );
+            }
+        else
+            {
+            imap4Set->SetSecureSockets( ETrue );
+            if ( iIncomingSecurity == 1 )
+                {
+                imap4Set->SetSSLWrapper( EFalse );
+                }
+            else
+                {
+                imap4Set->SetSSLWrapper( ETrue );
+                }
+            }
+        if ( iIncomingPort > 0 )
+            {
+            imap4Set->SetPort( (TUint) iIncomingPort );
+            }
+        else
+            {
+            if ( iIncomingSecurity == 2 ) // SSL
+                {
+                imap4Set->SetPort( KDefaultImapPortSSL );
+                }
+            else
+                {
+                imap4Set->SetPort( KIMAPDefaultPortNumber );
+                }
+            }
+        if ( iEmailsToRetrieve > 0 )
+            {
+            imap4Set->SetInboxSynchronisationLimit( iEmailsToRetrieve );
+            imap4Set->SetMailboxSynchronisationLimit( iEmailsToRetrieve );
+            }
+        else
+            {
+            // If limit is not set (zero), retrieves all
+            imap4Set->SetInboxSynchronisationLimit( KErrNotFound );
+            imap4Set->SetMailboxSynchronisationLimit( KErrNotFound );
+            }
+
+        imap4Set->SetFolderPathL( *iImapFolderPath );
+
+        imap4Set->SetGetMailOptions( EGetImap4EmailHeaders );
+        imap4Set->SetPartialMailOptionsL( ENoSizeLimits );
+        imap4Set->SetBodyTextSizeLimitL( KMaxTInt );
+        imap4Set->SetAttachmentSizeLimitL( KMaxTInt );
+        imap4Set->SetAcknowledgeReceipts( EFalse );
+        imap4Set->SetDisconnectedUserMode( ETrue );
+        imap4Set->SetSynchronise( EUseLocal );
+        imap4Set->SetSubscribe( EUpdateNeither );
+        imap4Set->SetAutoSendOnConnect( ETrue );
+        imap4Set->SetDeleteEmailsWhenDisconnecting( EFalse );
+        imap4Set->SetImapIdle( ETrue );
+        imap4Set->SetUpdatingSeenFlags( ETrue );
+
+        imapAccount = accounts->CreateImapAccountL(
+            *iMailboxName, *imap4Set, *incomingIapSet, EFalse );
+        HTI_LOG_FORMAT( "Created IMAP4 account %d", imapAccount.iImapAccountId );
+        smtpAccount = accounts->CreateSmtpAccountL(
+            imapAccount, *smtpSet, *outgoingIapSet, EFalse );
+        HTI_LOG_FORMAT( "Created SMTP account %d", smtpAccount.iSmtpAccountId );
+        }
+
+    // Set as default if requested
+     if ( iSetAsDefault )
+        {
+        accounts->SetDefaultSmtpAccountL( smtpAccount );
+        }
+
+    // accounts, outgoingIapSet, incomingIapSet, smtpSet, pop3Set, imap4set
+    CleanupStack::PopAndDestroy( 6 );
+
+    // Get IDs of created incoming mail account
+    TMsvId mailboxId = 0;
+    TUint32 accountId = 0;
+    TUid protocol = TUid::Null();
+    if ( iMailboxType == 0 ) // POP3
+        {
+        mailboxId = popAccount.iPopService;
+        accountId = popAccount.iPopAccountId;
+        protocol.iUid = KSenduiMtmPop3UidValue;
+        }
+
+    else // IMAP4
+        {
+        mailboxId = imapAccount.iImapService;
+        accountId = imapAccount.iImapAccountId;
+        protocol.iUid = KSenduiMtmImap4UidValue;
+        iRetrievedParts = 0;
+        }
+
+    // Get the created mailbox entries
+    HTI_LOG_TEXT( "Opening MSV session" );
+    CMsvSession* session = CMsvSession::OpenSyncL( *this );
+    CleanupStack::PushL( session );
+    HTI_LOG_TEXT( "Getting mailbox MSV entries" );
+    CMsvEntry* incomingEntry = session->GetEntryL( mailboxId );
+    CleanupStack::PushL( incomingEntry );
+    CMsvEntry* outgoingEntry = session->GetEntryL( smtpAccount.iSmtpService );
+    CleanupStack::PushL( outgoingEntry );
+
+    // Store account IDs and device IMEI to entries
+    HTI_LOG_TEXT( "Storing account IDs and IMEI" );
+    TBuf<KImeiLength> phoneImei;
+    GetDeviceImeiL( phoneImei );
+    HTI_LOG_FORMAT( "Got IMEI: %S", &phoneImei );
+    TMsvEntry inTEntry = incomingEntry->Entry();
+    inTEntry.iMtmData2 = accountId;
+    inTEntry.iDescription.Set( phoneImei );
+    incomingEntry->ChangeL( inTEntry );
+    TMsvEntry outTEntry = outgoingEntry->Entry();
+    outTEntry.iMtmData2 = smtpAccount.iSmtpAccountId;
+    outTEntry.iDescription.Set( phoneImei );
+    outgoingEntry->ChangeL( outTEntry );
+
+    // Create the signature text if given
+    if ( iSignatureText->Length() > 0 )
+        {
+        // Get signature store
+        HTI_LOG_TEXT( "Getting signature store" );
+        CMsvStore* store = outgoingEntry->EditStoreL();
+        CleanupStack::PushL( store );
+
+        // Create signarure rich text
+        HTI_LOG_TEXT( "Creating signature CRichText" );
+        CParaFormatLayer* paraFormatLayer = CParaFormatLayer::NewL();
+        CleanupStack::PushL( paraFormatLayer );
+        CCharFormatLayer* charFormatLayer = CCharFormatLayer::NewL();
+        CleanupStack::PushL( charFormatLayer );
+        CRichText* signature = CRichText::NewL( paraFormatLayer,
+                                                charFormatLayer );
+        CleanupStack::PushL( signature );
+        signature->InsertL( 0, *iSignatureText );
+
+        // Store the signature
+        store->StoreBodyTextL( *signature );
+        store->CommitL();
+
+        // signature, charFormatLayer, paraFormatLayer, store
+        CleanupStack::PopAndDestroy( 4 );
+        }
+
+    CleanupStack::PopAndDestroy( 3 ); // outgoingEntry, incomingEntry, session
+    HTI_LOG_FUNC_OUT( "CHtiMailboxHandler::HandleCreateMailboxL" );
+    }
+
+
+// ----------------------------------------------------------------------------
+// CHtiMailboxHandler::HandleDeleteMailboxL
+// Deletes a mailbox.
+// ----------------------------------------------------------------------------
+void CHtiMailboxHandler::HandleDeleteMailboxL( const TDesC8& aData )
+    {
+    HTI_LOG_FUNC_IN( "CHtiMailboxHandler::HandleDeleteMailboxL" );
+
+    // Delete by name - name should be unique
+    TInt nameLength = aData[0];
+    if ( nameLength > KEmailAccountNameSize || nameLength == 0 ||
+         aData.Length() != ( nameLength + 1 ) )
+        {
+        User::Leave( KErrArgument );
+        }
+
+    TBuf<KEmailAccountNameSize> accountName;
+    accountName.Copy( aData.Mid( 1, nameLength ) );
+    HTI_LOG_FORMAT( "Searching account with name: %S", &accountName );
+
+    TSmtpAccount smtpAcc;
+    User::LeaveIfError( FindSmtpAccount( accountName, smtpAcc ) );
+    HTI_LOG_FORMAT( "Found SMTP: %d", smtpAcc.iSmtpAccountId );
+    TMsvId relatedAcc = smtpAcc.iRelatedService;
+
+    CEmailAccounts* accounts = CEmailAccounts::NewLC();
+
+    // Delete the SMTP account
+    accounts->DeleteSmtpAccountL( smtpAcc );
+
+    // Search for related POP & IMAP acconts and delete if found
+    TInt result = KErrNone;
+    TPopAccount popAcc;
+    TRAP( result, accounts->GetPopAccountL( relatedAcc, popAcc ) );
+    if ( result == KErrNone )
+        {
+        HTI_LOG_FORMAT( "Found related POP: %d", popAcc.iPopAccountId );
+        accounts->DeletePopAccountL( popAcc );
+        }
+
+    TImapAccount imapAcc;
+    TRAP( result, accounts->GetImapAccountL( relatedAcc, imapAcc ) );
+    if ( result == KErrNone )
+        {
+        HTI_LOG_FORMAT( "Found related IMAP: %d", imapAcc.iImapAccountId );
+        accounts->DeleteImapAccountL( imapAcc );
+        }
+
+    CleanupStack::PopAndDestroy( 1 ); // accounts
+    HTI_LOG_FUNC_OUT( "CHtiMailboxHandler::HandleDeleteMailboxL" );
+    }
+
+
+// ----------------------------------------------------------------------------
+// CHtiMailboxHandler::ParseCreateMsgL
+// Parses the parameters from the create account message.
+// ----------------------------------------------------------------------------
+void CHtiMailboxHandler::ParseCreateMsgL( const TDesC8& aData )
+    {
+    HTI_LOG_FUNC_IN( "CHtiMailboxHandler::ParseCreateMsgL" );
+    /*  ACCOUNT SETTINGS
+     *   Field                              Size      Values    Mandatory
+     *   ---------------------------------------------------------------------
+     *   Mailbox type                       1 byte    0,1       YES
+     *   Mailbox name length                1 byte    1-30      YES
+     *   Mailbox name                       1-30                YES
+     *   Incoming mail server length        1 byte    3-50      YES
+     *   Incoming mail server               3-50                YES
+     *   Incoming access point name length  1 byte    0-255     YES
+     *   Incoming access point name         0-255               NO
+     *   Incoming user name length          1 byte    0-50      YES
+     *   Incoming user name                 0-50                NO
+     *   Incoming password length           1 byte    0-50      YES
+     *   Incoming password                  0-50                NO
+     *   Incoming security                  1 byte    0,1,2     YES
+     *   Incoming port                      2 bytes   0-999     YES
+     *   A POP secure login                 1 byte    0,1       YES
+     *   Outgoing mail server length        1 byte    1-50      YES
+     *   Outgoing mail server               1-50                YES
+     *   Outgoing access point name length  1 byte    0-255     YES
+     *   Outgoing access point name         0-255               NO
+     *   Outgoing user name length          1 byte    0-50      YES
+     *   Outgoing user name                 0-50                NO
+     *   Outgoing password length           1 byte    0-50      YES
+     *   Outgoing password                  0-50                NO
+     *   Outgoing security                  1 byte    0,1,2     YES
+     *   Outgoing port                      2 bytes   0-999     YES
+     *   Own mail address length            1 byte    1-100     YES
+     *   Own mail address                   1-100               YES
+     *   Own name length                    1 byte    0-100     YES
+     *   Own name                           0-100               NO
+     *   Send message option                1 byte    0,1,2     YES
+     *   Copy to own mail address           1 byte    0,1,2,3   YES
+     *   Signature length                   2 bytes   0-500     YES
+     *   Signature text                     0-500               NO
+     *   New mail indicators                1 byte    0,1       YES
+     *   Retrieved parts                    1 byte    0,1,2     YES
+     *   Retrieve size limit                2 bytes   1-999     YES
+     *   Emails to retrieve                 2 bytes   0-999     YES
+     *   IMAP4 folder path length           1 byte    0-100     YES
+     *   IMAP4 folder path                  0-100               NO
+     *   Automatic update                   1 byte    0,1,2     YES
+     *   Set as default for outgoing mail   1 byte    0,1       YES
+     */
+
+    TInt dataLength = aData.Length();
+    HTI_LOG_FORMAT( "Data length = %d", dataLength );
+    TInt offset = 0;
+    iMailboxType = aData[offset];
+    HTI_LOG_FORMAT( "Mailbox type = %d", iMailboxType );
+    if ( iMailboxType != 0 && iMailboxType != 1 )
+        {
+        User::Leave( KErrArgument );
+        }
+    offset++;
+
+    iMailboxName = ParseStringL( aData, offset );
+    offset += iMailboxName->Length() + 1;
+
+    iIncomingServer = ParseStringL( aData, offset );
+    offset += iIncomingServer->Length() + 1;
+
+
+    iIncomingApName = ParseStringL( aData, offset );
+    offset += iIncomingApName->Length() + 1;
+
+    iIncomingUserName = ParseString8L( aData, offset );
+    offset += iIncomingUserName->Length() + 1;
+
+    iIncomingPassword = ParseString8L( aData, offset );
+    offset += iIncomingPassword->Length() + 1;
+
+    // Check that it's safe to read next 4 bytes
+    if ( offset + 3 >= dataLength )
+        {
+        User::Leave( KErrArgument );
+        }
+
+    iIncomingSecurity = aData[offset];
+    offset++;
+    HTI_LOG_FORMAT( "Incoming security = %d", iIncomingSecurity );
+
+    iIncomingPort = aData[offset] + ( aData[offset+1] << 8 );
+    offset += 2;
+    HTI_LOG_FORMAT( "Incoming port = %d", iIncomingPort );
+
+    iAPopSecureLogin = (TBool) aData[offset];
+    offset++;
+    HTI_LOG_FORMAT( "A POP secure login = %d", iAPopSecureLogin );
+
+    iOutgoingServer = ParseStringL( aData, offset );
+    offset += iOutgoingServer->Length() + 1;
+
+    iOutgoingApName = ParseStringL( aData, offset );
+    offset += iOutgoingApName->Length() + 1;
+
+    iOutgoingUserName = ParseString8L( aData, offset );
+    offset += iOutgoingUserName->Length() + 1;
+
+    iOutgoingPassword = ParseString8L( aData, offset );
+    offset += iOutgoingPassword->Length() + 1;
+
+    // Check that it's safe to read next 3 bytes
+    if ( offset + 2 >= dataLength )
+        {
+        User::Leave( KErrArgument );
+        }
+
+    iOutgoingSecurity = aData[offset];
+    offset++;
+    HTI_LOG_FORMAT( "Outgoing security = %d", iOutgoingSecurity );
+
+    iOutgoingPort = aData[offset] + ( aData[offset+1] << 8 );
+    offset += 2;
+    HTI_LOG_FORMAT( "Outgoing port = %d", iOutgoingPort );
+
+    iOwnMailAddress = ParseStringL( aData, offset );
+    offset += iOwnMailAddress->Length() + 1;
+
+    iOwnName = ParseStringL( aData, offset );
+    offset += iOwnName->Length() + 1;
+
+    // Check that it's safe to read next 2 bytes
+    if ( offset + 1 >= dataLength )
+        {
+        User::Leave( KErrArgument );
+        }
+
+    iSendOption = aData[offset];
+    offset++;
+    HTI_LOG_FORMAT( "Send option = %d", iSendOption );
+
+    iSendCopyToOwnAddress = aData[offset];
+    offset++;
+    HTI_LOG_FORMAT( "Send copy = %d", iSendCopyToOwnAddress );
+
+    iSignatureText = ParseStringL( aData, offset, 2 );
+    offset += iSignatureText->Length() + 2;
+
+    // Check that it's safe to read next 6 bytes
+    if ( offset + 5 >= dataLength )
+        {
+        User::Leave( KErrArgument );
+        }
+
+    iNewMailIndicators = (TBool) aData[offset];
+    offset++;
+    HTI_LOG_FORMAT( "Indicators = %d", iNewMailIndicators );
+
+    iRetrievedParts = aData[offset];
+    offset++;
+    HTI_LOG_FORMAT( "Retrieved parts = %d", iRetrievedParts );
+
+    iRetrieveSizeLimitKb = aData[offset] + ( aData[offset+1] << 8 );
+    offset += 2;
+    HTI_LOG_FORMAT( "Size limit = %d", iRetrieveSizeLimitKb );
+
+    iEmailsToRetrieve = aData[offset] + ( aData[offset+1] << 8 );
+    offset += 2;
+    HTI_LOG_FORMAT( "Emails to retrieve = %d", iEmailsToRetrieve );
+
+    iImapFolderPath = ParseString8L( aData, offset );
+    offset += iImapFolderPath->Length() + 1;
+
+    // Check that it's safe to read next 2 bytes
+    if ( offset + 1 >= dataLength )
+        {
+        User::Leave( KErrArgument );
+        }
+
+    iAutomaticUpdate = aData[offset];
+    offset++;
+    HTI_LOG_FORMAT( "Automatic update = %d", iAutomaticUpdate );
+
+    iSetAsDefault = (TBool) aData[offset];
+    offset++;
+    HTI_LOG_FORMAT( "Set as default = %d", iSetAsDefault );
+
+    HTI_LOG_FORMAT( "Final offset= %d", offset );
+    // Check that there's no extra bytes
+    if ( offset != dataLength )
+        {
+        User::Leave( KErrArgument );
+        }
+
+    // Validate fields - limits based on S60 3.0 mailbox settings UI
+    if ( iMailboxName->Length()      < 1   ||
+         iMailboxName->Length()      > 30  ||
+         iIncomingServer->Length()   < 3   ||    // a.b
+         iIncomingServer->Length()   > 50  ||
+         iOutgoingServer->Length()   < 3   ||    // a.b
+         iOutgoingServer->Length()   > 50  ||
+         iOwnMailAddress->Length()   < 5   ||    // a@b.c
+         iOwnMailAddress->Length()   > 100 ||
+         iIncomingUserName->Length() > 50 ||
+         iIncomingPassword->Length() > 50 ||
+         iOutgoingUserName->Length() > 50 ||
+         iOutgoingPassword->Length() > 50 ||
+         iOwnName->Length()          > 100 ||
+         iSignatureText->Length()    > 500 ||
+         iImapFolderPath->Length()   > 100 ||
+         iIncomingPort               > 999 ||
+         iOutgoingPort               > 999 ||
+         iRetrieveSizeLimitKb        > 999 ||
+         iEmailsToRetrieve           > 999 ||
+         iIncomingSecurity           > 2   ||
+         iOutgoingSecurity           > 2   ||
+         iSendOption                 > 2   ||
+         iSendCopyToOwnAddress       > 3   ||
+         iRetrievedParts             > 2   ||
+         iAutomaticUpdate            > 2      )
+        {
+        User::Leave( KErrArgument );
+        }
+
+    HTI_LOG_FUNC_OUT( "CHtiMailboxHandler::ParseCreateMsgL" );
+    }
+
+
+// ----------------------------------------------------------------------------
+// CHtiMailboxHandler::ParseStringL
+// Helper for parsing one string from the message.
+// ----------------------------------------------------------------------------
+HBufC* CHtiMailboxHandler::ParseStringL( const TDesC8& aData,
+                                         TInt aStrLenOffset,
+                                         TInt aStrLenBytes )
+    {
+    HTI_LOG_FUNC_IN( "CHtiMailboxHandler::ParseStringL" );
+    if ( aStrLenOffset >= aData.Length() ||
+         aStrLenBytes > 2 || aStrLenBytes < 1 )
+        {
+        User::Leave( KErrArgument );
+        }
+    TInt strLen = 0;
+    if ( aStrLenBytes == 1 )
+        {
+        strLen = aData[aStrLenOffset];
+        }
+    else
+        {
+        strLen = aData[aStrLenOffset] + ( aData[aStrLenOffset +1 ] << 8 );
+        }
+
+    if ( aData.Length() <= aStrLenOffset + strLen )
+        {
+        User::Leave( KErrArgument );
+        }
+    HTI_LOG_FORMAT( "String length = %d", strLen );
+    HBufC* result = HBufC::NewL( strLen );
+    result->Des().Copy( aData.Mid( aStrLenOffset + aStrLenBytes, strLen ) );
+    HTI_LOG_FORMAT( "Parsed: %S", result );
+    HTI_LOG_FUNC_OUT( "CHtiMailboxHandler::ParseStringL" );
+    return result;
+    }
+
+
+// ----------------------------------------------------------------------------
+// CHtiMailboxHandler::ParseString8L
+// Helper for parsing one string from the message.
+// ----------------------------------------------------------------------------
+HBufC8* CHtiMailboxHandler::ParseString8L( const TDesC8& aData,
+                                           TInt aStrLenOffset,
+                                           TInt aStrLenBytes )
+    {
+    HTI_LOG_FUNC_IN( "CHtiMailboxHandler::ParseString8L" );
+    if ( aStrLenOffset >= aData.Length() ||
+         aStrLenBytes > 2 || aStrLenBytes < 1  )
+        {
+        User::Leave( KErrArgument );
+        }
+    TInt strLen = 0;
+    if ( aStrLenBytes == 1 )
+        {
+        strLen = aData[aStrLenOffset];
+        }
+    else
+        {
+        strLen = aData[aStrLenOffset] + ( aData[aStrLenOffset + 1] << 8 );
+        }
+    if ( aData.Length() <= aStrLenOffset + strLen )
+        {
+        User::Leave( KErrArgument );
+        }
+    HTI_LOG_FORMAT( "String length = %d", strLen );
+    HBufC8* result = aData.Mid( aStrLenOffset + aStrLenBytes, strLen ).AllocL();
+    HTI_LOG_FORMAT( "Parsed: %S", result );
+    HTI_LOG_FUNC_OUT( "CHtiMailboxHandler::ParseString8L" );
+    return result;
+    }
+
+
+// ----------------------------------------------------------------------------
+// CHtiMailboxHandler::AccessPointUIDL
+// Gets the UID of Access Point named by aApName.
+// Returns KErrNotFound if AP not found.
+// ----------------------------------------------------------------------------
+TInt CHtiMailboxHandler::AccessPointUIDL( const TDesC& aApName )
+    {
+    HTI_LOG_FUNC_IN( "CHtiMailboxHandler::AccessPointUIDL" );
+    TInt iapId = KErrNotFound;
+
+    // Search from uncategorised first
+    RArray<TUint32> array = RArray<TUint32>();
+    iCmManager.ConnectionMethodL( array );
+    CleanupClosePushL( array );
+    TInt i = 0;
+    while ( i < array.Count() && iapId == KErrNotFound )
+        {
+        RCmConnectionMethod cm = iCmManager.ConnectionMethodL( array[i] );
+        CleanupClosePushL( cm );
+        HBufC* name = cm.GetStringAttributeL( CMManager::ECmName );
+        HTI_LOG_FORMAT( "Found name: %S", name );
+        CleanupStack::PushL( name );
+        if ( aApName.Compare( *name ) == 0 )
+            {
+            iapId = cm.GetIntAttributeL( CMManager::ECmId );
+            HTI_LOG_FORMAT( "Match: UID = %d", iapId );
+            }
+        CleanupStack::PopAndDestroy(); // name
+        CleanupStack::PopAndDestroy(); // cm
+        i++;
+        }
+    CleanupStack::PopAndDestroy(); // array
+
+    // If not found from uncategorised, search from all destinations
+    if ( iapId == KErrNotFound )
+        {
+        HTI_LOG_TEXT( "Not found from uncategorised" );
+        RArray<TUint32> destIdArray = RArray<TUint32>();
+        iCmManager.AllDestinationsL( destIdArray );
+        CleanupClosePushL( destIdArray );
+        i = 0;
+        while ( i < destIdArray.Count() && iapId == KErrNotFound )
+            {
+            RCmDestination dest = iCmManager.DestinationL( destIdArray[i] );
+            CleanupClosePushL( dest );
+            TInt j = 0;
+            while ( j < dest.ConnectionMethodCount() && iapId == KErrNotFound )
+                {
+                HBufC* name = dest.ConnectionMethodL( j ).GetStringAttributeL(
+                        CMManager::ECmName );
+                CleanupStack::PushL( name );
+                HTI_LOG_FORMAT( "Found name: %S", name );
+                if ( aApName.Compare( *name ) == 0 )
+                    {
+                    iapId = dest.ConnectionMethodL( j ).GetIntAttributeL(
+                            CMManager::ECmId );
+                    HTI_LOG_FORMAT( "Match: UID = %d", iapId );
+                    }
+                CleanupStack::PopAndDestroy(); // name
+                j++;
+                }
+            CleanupStack::PopAndDestroy(); // dest
+            i++;
+            }
+        CleanupStack::PopAndDestroy(); // destIdArray
+        }
+
+    HTI_LOG_FUNC_OUT( "CHtiMailboxHandler::AccessPointUIDL" );
+    return iapId;
+    }
+
+
+// ----------------------------------------------------------------------------
+// CHtiMailboxHandler::FindSmtpAccount
+// Searches for an SMTP account by name.
+// Returns KErrNone if found, otherwise KErrNotFound or other error.
+// ----------------------------------------------------------------------------
+TInt CHtiMailboxHandler::FindSmtpAccount( const TDesC& aAccountName,
+                                          TSmtpAccount& aAccount )
+    {
+    HTI_LOG_FUNC_IN( "CHtiMailboxHandler::FindSmtpAccount" );
+
+    TInt err = KErrNone;
+    TInt popCount = 0;
+
+    RArray<TSmtpAccount> smtpAccounts;
+    CleanupClosePushL( smtpAccounts );
+    popCount++; // smtpAccounts
+
+    CEmailAccounts* accounts = NULL;
+    TRAP( err, accounts = CEmailAccounts::NewL() );
+
+    if ( err == KErrNone )
+        {
+        CleanupStack::PushL( accounts );
+        popCount++; // accounts
+        TRAP( err, accounts->GetSmtpAccountsL( smtpAccounts ) );
+        }
+
+    if ( err == KErrNone )
+        {
+        TInt count = smtpAccounts.Count();
+        HTI_LOG_FORMAT( "Found %d SMTP accounts", count );
+        err = KErrNotFound;
+        for ( TInt i = 0; i < count; i++ )
+            {
+            aAccount = smtpAccounts[i];
+            HTI_LOG_FORMAT( "Account name: %S", &aAccount.iSmtpAccountName );
+            if ( aAccount.iSmtpAccountName.Compare( aAccountName ) == 0 )
+                {
+                HTI_LOG_FORMAT( "Match - MSV ID %d", aAccount.iSmtpService );
+                err = KErrNone;
+                break;
+                }
+            }
+        }
+
+    CleanupStack::PopAndDestroy( popCount );
+    HTI_LOG_FUNC_OUT( "CHtiMailboxHandler::FindSmtpAccount" );
+    return err;
+    }
+
+
+// ----------------------------------------------------------------------------
+// CHtiMailboxHandler::GetDeviceImeiL()
+// Gets the device IMEI code and stores it to aResult.
+// ----------------------------------------------------------------------------
+//
+void CHtiMailboxHandler::GetDeviceImeiL( TDes& aResult )
+    {
+    if ( aResult.MaxLength() < KImeiLength )
+        {
+        User::Leave( KErrBadDescriptor );
+        }
+#ifdef __WINS__
+    aResult.Copy( KWinsImei );
+#else
+    RTelServer telServer;
+    User::LeaveIfError( telServer.Connect() );
+    CleanupClosePushL( telServer );
+    User::LeaveIfError( telServer.LoadPhoneModule( KTsyName ) );
+
+    TInt phoneCount = 0;
+    User::LeaveIfError( telServer.EnumeratePhones( phoneCount ) );
+    if ( phoneCount < 1 )
+        {
+        User::Leave( KErrNotFound );
+        }
+
+    RTelServer::TPhoneInfo phoneInfo;
+    User::LeaveIfError( telServer.GetPhoneInfo( 0, phoneInfo ) );
+    RMobilePhone mobilePhone;
+    User::LeaveIfError( mobilePhone.Open( telServer, phoneInfo.iName ) );
+    CleanupClosePushL( mobilePhone );
+
+    RMobilePhone::TMobilePhoneIdentityV1 identity;
+    TRequestStatus status;
+    mobilePhone.GetPhoneId( status, identity );
+    User::WaitForRequest( status );
+    User::LeaveIfError( status.Int() );
+
+    aResult.Copy( identity.iSerialNumber );
+    CleanupStack::PopAndDestroy( 2 ); // mobilePhone, telServer
+#endif
+    }
+
+
+// ----------------------------------------------------------------------------
+// CHtiMailboxHandler::ResetVariables
+// Clears the instance variables that store the create message parameters.
+// ----------------------------------------------------------------------------
+void CHtiMailboxHandler::ResetVariables()
+    {
+    HTI_LOG_FUNC_IN( "CHtiMailboxHandler::ResetVariables" );
+    delete iMailboxName;
+    iMailboxName = NULL;
+    delete iIncomingServer;
+    iIncomingServer = NULL;
+    delete iIncomingApName;
+    iIncomingApName = NULL;
+    delete iIncomingUserName;
+    iIncomingUserName = NULL;
+    delete iIncomingPassword;
+    iIncomingPassword = NULL;
+    delete iOutgoingServer;
+    iOutgoingServer = NULL;
+    delete iOutgoingApName;
+    iOutgoingApName = NULL;
+    delete iOutgoingUserName;
+    iOutgoingUserName = NULL;
+    delete iOutgoingPassword;
+    iOutgoingPassword = NULL;
+    delete iOwnMailAddress;
+    iOwnMailAddress = NULL;
+    delete iOwnName;
+    iOwnName = NULL;
+    delete iSignatureText;
+    iSignatureText = NULL;
+    delete iImapFolderPath;
+    iImapFolderPath = NULL;
+
+    iMailboxType          = KErrUnknown;
+    iIncomingSecurity     = KErrUnknown;
+    iIncomingPort         = KErrUnknown;
+    iOutgoingSecurity     = KErrUnknown;
+    iOutgoingPort         = KErrUnknown;
+    iSendOption           = KErrUnknown;
+    iSendCopyToOwnAddress = KErrUnknown;
+    iRetrievedParts       = KErrUnknown;
+    iRetrieveSizeLimitKb  = KErrUnknown;
+    iEmailsToRetrieve     = KErrUnknown;
+    iAutomaticUpdate      = KErrUnknown;
+
+    iAPopSecureLogin   = EFalse;
+    iNewMailIndicators = EFalse;
+    iSetAsDefault      = EFalse;
+
+    iCmManager.Close();
+
+    HTI_LOG_FUNC_OUT( "CHtiMailboxHandler::ResetVariables" );
+    }
+
+
+// ----------------------------------------------------------------------------
+// CHtiMailboxHandler::SendOkMsgL
+// Helper function for sending response messages.
+// ----------------------------------------------------------------------------
+void CHtiMailboxHandler::SendOkMsgL( const TDesC8& aData )
+    {
+    HTI_LOG_FUNC_IN( "CHtiMailboxHandler::SendOkMsgL" );
+    User::LeaveIfNull( iDispatcher );
+    HBufC8* temp = HBufC8::NewL( aData.Length() + 1 );
+    TPtr8 response = temp->Des();
+    response.Append( ( TChar ) CHtiMessagesServicePlugin::EResultOk );
+    response.Append( aData );
+    User::LeaveIfError( iDispatcher->DispatchOutgoingMessage(
+        temp, KHtiMessagesServiceUid ) );
+    HTI_LOG_FUNC_OUT( "CHtiMailboxHandler::SendOkMsgL" );
+    }
+
+
+// ----------------------------------------------------------------------------
+// CHtiMailboxHandler::SendErrorMessageL
+// Helper function for sending error response messages.
+// ----------------------------------------------------------------------------
+void CHtiMailboxHandler::SendErrorMessageL( TInt aError, const TDesC8& aDescription )
+    {
+    HTI_LOG_FUNC_IN( "CHtiMailboxHandler::SendErrorMessageL" );
+    User::LeaveIfNull( iDispatcher );
+    User::LeaveIfError( iDispatcher->DispatchOutgoingErrorMessage(
+        aError, aDescription, KHtiMessagesServiceUid ) );
+    HTI_LOG_FUNC_OUT( "CHtiMailboxHandler::SendErrorMessageL" );
+    }
+
+
+// ----------------------------------------------------------------------------
+// CHtiMailboxHandler::HandleSessionEventL
+// From MMsvSessionObserver.
+// ----------------------------------------------------------------------------
+void CHtiMailboxHandler::HandleSessionEventL( TMsvSessionEvent /*aEvent*/,
+                            TAny* /*aArg1*/, TAny* /*aArg2*/, TAny* /*aArg3*/ )
+    {
+    // HTI_LOG_FUNC_IN( "CHtiMailboxHandler::HandleSessionEventL" );
+
+    // HTI_LOG_FUNC_OUT( "CHtiMailboxHandler::HandleSessionEventL" );
+    }
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiServicePlugins/HtiMessagesServicePlugin/src/HtiMessagesServicePlugin.cpp	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,127 @@
+/*
+* 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:  MessagesServicePlugin implementation
+*
+*/
+
+
+// INCLUDE FILES
+#include "HtiMessagesServicePlugin.h"
+#include "MessageMgmntHandler.h"
+#include "HtiIAPHandler.h"
+#include "HtiMailboxHandler.h"
+#include "HtiMsgSettingsHandler.h"
+
+#include <HtiDispatcherInterface.h>
+#include <HtiLogging.h>
+
+// CONSTANTS
+_LIT8( KErrorMissingCommand, "Command was not given - message was empty" );
+_LIT8( KErrorUnrecognizedCommand, "Unrecognized command" );
+
+// ----------------------------------------------------------------------------
+// Create instance of concrete ECOM interface implementation
+CHtiMessagesServicePlugin* CHtiMessagesServicePlugin::NewL()
+    {
+    CHtiMessagesServicePlugin* self = new (ELeave) CHtiMessagesServicePlugin;
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop();
+    return self;
+    }
+
+// ----------------------------------------------------------------------------
+CHtiMessagesServicePlugin::CHtiMessagesServicePlugin()
+    {
+    }
+
+// ----------------------------------------------------------------------------
+CHtiMessagesServicePlugin::~CHtiMessagesServicePlugin()
+    {
+    HTI_LOG_TEXT( "CHtiMessagesServicePlugin destroy" );
+    delete iMessageHandler;
+    delete iIAPHandler;
+    delete iMailboxHandler;
+    delete iMsgSettingsHandler;
+    }
+
+// ----------------------------------------------------------------------------
+void CHtiMessagesServicePlugin::ConstructL()
+    {
+    HTI_LOG_TEXT( "CHtiMessagesServicePlugin::ConstructL" );
+
+    }
+
+// ----------------------------------------------------------------------------
+void CHtiMessagesServicePlugin::ProcessMessageL( const TDesC8& aMessage,
+    THtiMessagePriority aPriority)
+    {
+    HTI_LOG_FUNC_IN( "CHtiMessagesServicePlugin::ProcessMessageL" );
+    HTI_LOG_FORMAT( "Msg len: %d.", aMessage.Length() );
+
+    if ( aMessage.Length() == 0 )
+        {
+        User::LeaveIfError( iDispatcher->DispatchOutgoingErrorMessage(
+            KErrArgument, KErrorMissingCommand, KHtiMessagesServiceUid ) );
+        return;
+        }
+
+    TUint8 command = aMessage.Ptr()[0];
+
+    if ( command >= EAddSms && command <= EDeleteFolderContent )
+        {
+        if ( !iMessageHandler )
+            {
+            iMessageHandler = CMessageMgmntHandler::NewL();
+            iMessageHandler->SetDispatcher( iDispatcher );
+            }
+        iMessageHandler->ProcessMessageL( aMessage, aPriority );
+        }
+    else if ( command >= ECreateMailBox && command <= EDeleteMailBox  )
+        {
+        if ( !iMailboxHandler )
+            {
+            iMailboxHandler = CHtiMailboxHandler::NewL();
+            iMailboxHandler->SetDispatcher( iDispatcher );
+            }
+        iMailboxHandler->ProcessMessageL( aMessage, aPriority );
+        }
+    else if ( command >= ECreateIAP && command <= ESetDefaultConnection )
+        {
+        if ( !iIAPHandler )
+            {
+            iIAPHandler = CHtiIAPHandler::NewL();
+            iIAPHandler->SetDispatcher( iDispatcher );
+            }
+        iIAPHandler->ProcessMessageL( aMessage, aPriority );
+        }
+
+    else if ( command >= ESetDefaultSmsCenter && command <= ESetMmsSettings )
+        {
+        if ( !iMsgSettingsHandler )
+            {
+            iMsgSettingsHandler = CHtiMsgSettingsHandler::NewL();
+            iMsgSettingsHandler->SetDispatcher( iDispatcher );
+            }
+        iMsgSettingsHandler->ProcessMessageL( aMessage, aPriority );
+        }
+
+    else
+        {
+        User::LeaveIfError( iDispatcher->DispatchOutgoingErrorMessage(
+            KErrArgument, KErrorUnrecognizedCommand, KHtiMessagesServiceUid ) );
+        }
+
+    HTI_LOG_FUNC_OUT( "CHtiMessagesServicePlugin::ProcessMessageL: Done" );
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiServicePlugins/HtiMessagesServicePlugin/src/HtiMsgSettingsHandler.cpp	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,829 @@
+/*
+* 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 message settings handling.
+*
+*/
+
+
+// INCLUDE FILES
+#include "HtiMessagesServicePlugin.h"
+#include "HtiMsgSettingsHandler.h"
+
+#include <HtiDispatcherInterface.h>
+#include <HtiLogging.h>
+
+#include <cmconnectionmethod.h>
+#include <cmconnectionmethoddef.h>
+#include <cmdestination.h>
+#include <cmmanager.h>
+
+#include <csmsaccount.h>
+#include <mmssettings.h>
+#include <smutset.h>
+#include <centralrepository.h>
+
+// EXTERNAL DATA STRUCTURES
+
+// EXTERNAL FUNCTION PROTOTYPES
+
+// CONSTANTS
+const TUid KCRUidSmum = { 0x101F87EF }; // from MessagingInternalCRKeys.h
+
+const TInt KMinSetDefaultSmsCenterLength = 4;
+const TInt KMinDeleteSmsCenterLength     = 2;
+const TInt KMinSetMmsSettingsLength      = 10;
+
+// set SMS settings has a fixed length
+const TInt KSetSmsSettingsLength         = 6;
+
+// message validity times in seconds
+const TInt KValidityTimeMax  = 0;
+const TInt KValidityTime1h   = 3600;
+const TInt KValidityTime6h   = 6 * 3600;
+const TInt KValidityTime24h  = 24 * 3600;
+const TInt KValidityTime3d   = 3 * 24 * 3600;
+const TInt KValidityTime1w   = 7 * 24 * 3600;
+
+// from MmsSettingsDefs.h
+const TInt KMmsUniImageSmallWidth = 640;
+const TInt KMmsUniImageSmallHeight = 480;
+const TInt KMmsUniImageLargeWidth = 1600;
+const TInt KMmsUniImageLargeHeight = 1200;
+
+const TInt KApMaxConnNameLength = 30;
+
+// MACROS
+
+// LOCAL CONSTANTS AND MACROS
+
+_LIT8( KErrorInvalidParameters, "Invalid command parameters" );
+_LIT8( KErrorSetDefaultSmsCenterFailed, "Setting default SMS center failed" );
+_LIT8( KErrorDeleteSmsCenterFailed, "SMS center deletion failed" );
+_LIT8( KErrorSmsCenterAlreadyExists, "SMS center with given name already exists with different number" );
+_LIT8( KErrorSmsCenterNotFound, "SMS center with given name not found" );
+_LIT8( KErrorSetSmsSettingsFailed, "Setting SMS service settings failed" );
+_LIT8( KErrorSetMmsSettingsFailed, "Setting MMS service settings failed" );
+_LIT8( KErrorApNotFound, "Access Point not found" );
+_LIT8( KErrorUnrecognizedCommand, "Unrecognized command" );
+
+// MODULE DATA STRUCTURES
+
+// LOCAL FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CHtiMsgSettingsHandler::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+CHtiMsgSettingsHandler* CHtiMsgSettingsHandler::NewL()
+    {
+    HTI_LOG_FUNC_IN( "CHtiMsgSettingsHandler::NewL" );
+    CHtiMsgSettingsHandler* self = new (ELeave) CHtiMsgSettingsHandler();
+    CleanupStack::PushL ( self );
+    self->ConstructL();
+    CleanupStack::Pop();
+    HTI_LOG_FUNC_OUT( "CHtiMsgSettingsHandler::NewL" );
+    return self;
+    }
+
+
+// ----------------------------------------------------------------------------
+// CHtiMsgSettingsHandler::CHtiMsgSettingsHandler
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// ----------------------------------------------------------------------------
+CHtiMsgSettingsHandler::CHtiMsgSettingsHandler()
+    {
+    HTI_LOG_FUNC_IN( "CHtiMsgSettingsHandler::CHtiMsgSettingsHandler" );
+
+    HTI_LOG_FUNC_OUT( "CHtiMsgSettingsHandler::CHtiMsgSettingsHandler" );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CHtiMsgSettingsHandler::~CHtiMsgSettingsHandler
+// Destructor.
+// -----------------------------------------------------------------------------
+CHtiMsgSettingsHandler::~CHtiMsgSettingsHandler()
+    {
+    HTI_LOG_FUNC_IN( "CHtiMsgSettingsHandler::~CHtiMsgSettingsHandler" );
+
+    HTI_LOG_FUNC_OUT( "CHtiMsgSettingsHandler::~CHtiMsgSettingsHandler" );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CHtiMsgSettingsHandler::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+void CHtiMsgSettingsHandler::ConstructL()
+    {
+    HTI_LOG_FUNC_IN( "CHtiMsgSettingsHandler::ConstructL" );
+
+    HTI_LOG_FUNC_OUT( "CHtiMsgSettingsHandler::ConstructL" );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CHtiMsgSettingsHandler::SetDispatcher
+// Sets the dispatcher pointer.
+// -----------------------------------------------------------------------------
+
+void CHtiMsgSettingsHandler::SetDispatcher( MHtiDispatcher* aDispatcher )
+    {
+    HTI_LOG_FUNC_IN( "CHtiMsgSettingsHandler::SetDispatcher" );
+    iDispatcher = aDispatcher;
+    HTI_LOG_FUNC_OUT( "CHtiMsgSettingsHandler::SetDispatcher" );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CHtiMsgSettingsHandler::ProcessMessageL
+// Parses the received message and calls handler functions.
+// -----------------------------------------------------------------------------
+void CHtiMsgSettingsHandler::ProcessMessageL( const TDesC8& aMessage,
+                                              THtiMessagePriority /*aPriority*/ )
+    {
+    HTI_LOG_FUNC_IN( "CHtiMsgSettingsHandler::ProcessMessageL" );
+
+    // Zero length message and command code validity already checked
+    // in HtiMessagesServicePlugin.
+
+    if ( aMessage[0] == CHtiMessagesServicePlugin::ESetDefaultSmsCenter )
+        {
+        if ( aMessage.Length() < 1 + KMinSetDefaultSmsCenterLength )
+            {
+            SendErrorMessageL( KErrArgument, KErrorInvalidParameters );
+            }
+        else
+            {
+            TRAPD( err, HandleSetDefaultSmsCenterL(
+                    aMessage.Right( aMessage.Length() - 1 ) ) );
+            if ( err != KErrNone )
+                {
+                SendErrorMessageL( err, KErrorSetDefaultSmsCenterFailed );
+                }
+            }
+        }
+
+    else if ( aMessage[0] == CHtiMessagesServicePlugin::EDeleteSmsCenter )
+        {
+        if ( aMessage.Length() < 1 + KMinDeleteSmsCenterLength )
+            {
+            SendErrorMessageL( KErrArgument, KErrorInvalidParameters );
+            }
+        else
+            {
+            TRAPD( err, HandleDeleteSmsCenterL(
+                    aMessage.Right( aMessage.Length() - 1 ) ) );
+            if ( err != KErrNone )
+                {
+                SendErrorMessageL( err, KErrorDeleteSmsCenterFailed );
+                }
+            }
+        }
+
+    else if ( aMessage[0] == CHtiMessagesServicePlugin::ESetSmsSettings )
+        {
+        if ( aMessage.Length() != 1 + KSetSmsSettingsLength )
+            {
+            SendErrorMessageL( KErrArgument, KErrorInvalidParameters );
+            }
+        else
+            {
+            TRAPD( err, HandleSetSmsSettingsL(
+                    aMessage.Right( aMessage.Length() - 1 ) ) );
+            if ( err != KErrNone )
+                {
+                SendErrorMessageL( err, KErrorSetSmsSettingsFailed );
+                }
+            }
+        }
+
+    else if ( aMessage[0] == CHtiMessagesServicePlugin::ESetMmsSettings )
+        {
+        if ( aMessage.Length() < 1 + KMinSetMmsSettingsLength )
+            {
+            SendErrorMessageL( KErrArgument, KErrorInvalidParameters );
+            }
+        else
+            {
+            TRAPD( err, HandleSetMmsSettingsL(
+                    aMessage.Right( aMessage.Length() - 1 ) ) );
+            if ( err != KErrNone )
+                {
+                SendErrorMessageL( err, KErrorSetMmsSettingsFailed );
+                }
+            }
+        }
+
+    else
+        {
+        SendErrorMessageL( KErrArgument, KErrorUnrecognizedCommand );
+        }
+
+    HTI_LOG_FUNC_OUT( "CHtiMsgSettingsHandler::ProcessMessageL" );
+    }
+
+
+// ----------------------------------------------------------------------------
+// CHtiMsgSettingsHandler::HandleSetDefaultSmsCenterL
+// Creates new default SMS center.
+// ----------------------------------------------------------------------------
+void CHtiMsgSettingsHandler::HandleSetDefaultSmsCenterL( const TDesC8& aData )
+    {
+    HTI_LOG_FUNC_IN( "CHtiMsgSettingsHandler::HandleSetDefaultSmsCenterL" );
+
+    TBuf<255> name;
+    TBuf<255> number;
+
+    TInt dataLength = aData.Length();
+    TInt offset = 0;
+    TInt fieldLength = aData[offset];
+    offset++;
+
+    if ( offset + fieldLength > dataLength )
+        {
+        HTI_LOG_TEXT( "Invalid length specified for name" );
+        SendErrorMessageL( KErrArgument, KErrorInvalidParameters );
+        return;
+        }
+    name.Copy( aData.Mid( offset, fieldLength ) );
+    offset += fieldLength;
+    fieldLength = aData[offset];
+    offset++;
+
+    if ( offset + fieldLength > dataLength )
+        {
+        HTI_LOG_TEXT( "Invalid length specified for number" );
+        SendErrorMessageL( KErrArgument, KErrorInvalidParameters );
+        return;
+        }
+    number.Copy( aData.Mid( offset, fieldLength ) );
+
+    HTI_LOG_FORMAT( "SMS center name: %S", &name );
+    HTI_LOG_FORMAT( "SMS center number: %S", &number );
+
+    HTI_LOG_TEXT( "Loading current settings..." );
+    CSmsSettings* smsSettings = CSmsSettings::NewLC();
+    CSmsAccount* smsAccount = CSmsAccount::NewLC();
+    smsAccount->LoadSettingsL( *smsSettings );
+
+    HTI_LOG_TEXT( "Looping through existing SMS centers..." );
+    TInt i = 0;
+    for ( i = 0; i < smsSettings->ServiceCenterCount(); i++ )
+        {
+        CSmsServiceCenter &center = smsSettings->GetServiceCenter( i );
+
+        HTI_LOG_FORMAT( "Found SMS center: %S", &( center.Name() ) );
+
+        if ( center.Name() == name && center.Address() != number )
+            {
+            HTI_LOG_TEXT( "Error, SMS center with given name already exists" );
+            SendErrorMessageL( KErrAlreadyExists, KErrorSmsCenterAlreadyExists );
+            CleanupStack::PopAndDestroy( 2 ); // smsAccount, smsSettings
+            return;
+            }
+        else if ( center.Name() == name && center.Address() == number )
+            {
+            HTI_LOG_TEXT( "The defined SMS center already exists, setting it to default" );
+            smsSettings->SetDefaultServiceCenter( i );
+            smsAccount->SaveSettingsL( *smsSettings );
+
+            CleanupStack::PopAndDestroy( 2 ); // smsAccount, smsSettings
+            SendOkMsgL( KNullDesC8 );
+
+            return;
+            }
+        }
+
+    HTI_LOG_TEXT( "Creating new default SMS center" );
+    smsSettings->AddServiceCenterL( name, number );
+    smsSettings->SetDefaultServiceCenter( i );
+    smsAccount->SaveSettingsL( *smsSettings );
+
+    CleanupStack::PopAndDestroy( 2 ); // smsAccount, smsSettings
+
+    SendOkMsgL( KNullDesC8 );
+
+    HTI_LOG_FUNC_OUT( "CHtiMsgSettingsHandler::HandleSetDefaultSmsCenterL" );
+    }
+
+
+// ----------------------------------------------------------------------------
+// CHtiMsgSettingsHandler::HandleDeleteSmsCenterL
+// Deletes the defined SMS center.
+// ----------------------------------------------------------------------------
+void CHtiMsgSettingsHandler::HandleDeleteSmsCenterL( const TDesC8& aData )
+    {
+    HTI_LOG_FUNC_IN( "CHtiMsgSettingsHandler::HandleDeleteSmsCenterL" );
+
+    TBuf<255> name;
+
+    TInt dataLength = aData.Length();
+    TInt offset = 0;
+    TInt fieldLength = aData[offset];
+    offset++;
+
+    if ( offset + fieldLength > dataLength )
+        {
+        HTI_LOG_TEXT( "Invalid length specified for name" );
+        SendErrorMessageL( KErrArgument, KErrorInvalidParameters );
+        return;
+        }
+    name.Copy( aData.Mid( offset, fieldLength ) );
+
+    HTI_LOG_FORMAT( "SMS center name: %S", &name );
+
+    HTI_LOG_TEXT( "Loading current settings..." );
+    CSmsSettings* smsSettings = CSmsSettings::NewLC();
+    CSmsAccount* smsAccount = CSmsAccount::NewLC();
+    smsAccount->LoadSettingsL( *smsSettings );
+
+    HTI_LOG_TEXT( "Looping through existing SMS centers..." );
+    TInt i = 0;
+    for ( i = 0; i < smsSettings->ServiceCenterCount(); i++ )
+        {
+        CSmsServiceCenter &center = smsSettings->GetServiceCenter( i );
+
+        HTI_LOG_FORMAT( "Found SMS center: %S", &( center.Name() ) );
+
+        if ( center.Name() == name )
+            {
+            HTI_LOG_TEXT( "Name matches, deleting..." );
+            smsSettings->RemoveServiceCenter( i );
+            smsAccount->SaveSettingsL( *smsSettings );
+
+            CleanupStack::PopAndDestroy( 2 ); // smsAccount, smsSettings
+
+            SendOkMsgL( KNullDesC8 );
+            return;
+            }
+        }
+
+    CleanupStack::PopAndDestroy( 2 ); // smsAccount, smsSettings
+
+    SendErrorMessageL( KErrNotFound, KErrorSmsCenterNotFound );
+
+    HTI_LOG_FUNC_OUT( "CHtiMsgSettingsHandler::HandleDeleteSmsCenterL" );
+    }
+
+
+// ----------------------------------------------------------------------------
+// CHtiMsgSettingsHandler::HandleSetSmsSettingsL
+// Sets the SMS service settings.
+// ----------------------------------------------------------------------------
+void CHtiMsgSettingsHandler::HandleSetSmsSettingsL( const TDesC8& aData )
+    {
+    HTI_LOG_FUNC_IN( "CHtiMsgSettingsHandler::HandleSetSmsSettingsL" );
+
+    // extract values
+    TInt offset = 0;
+    TInt characterSupport = aData[offset];
+    offset++;
+    HTI_LOG_FORMAT( "Character support     = %d", characterSupport );
+
+    TBool deliveryReport = aData[offset];
+    offset++;
+    HTI_LOG_FORMAT( "Delivery report       = %d", deliveryReport );
+
+    TInt validityPeriod = aData[offset];
+    offset++;
+    HTI_LOG_FORMAT( "Validity period       = %d", validityPeriod );
+
+    TInt messageConversion = aData[offset];
+    offset++;
+    HTI_LOG_FORMAT( "Message conversion    = %d", messageConversion );
+
+    TInt preferredConnection = aData[offset];
+    offset++;
+    HTI_LOG_FORMAT( "Preferred connection  = %d", preferredConnection );
+
+    TBool replyViaSameCenter = aData[offset];
+    offset++;
+    HTI_LOG_FORMAT( "Reply via same center = %d", replyViaSameCenter );
+
+    // Validate values
+    if ( characterSupport > 1 || validityPeriod > 5 ||
+         messageConversion > 3 || preferredConnection > 1 )
+        {
+        HTI_LOG_TEXT( "Invalid values found" );
+        SendErrorMessageL( KErrArgument, KErrorInvalidParameters );
+        return;
+        }
+
+    HTI_LOG_TEXT( "Loading current settings..." );
+    CSmsSettings* smsSettings = CSmsSettings::NewLC();
+    CSmsAccount* smsAccount = CSmsAccount::NewLC();
+    smsAccount->LoadSettingsL( *smsSettings );
+
+    HTI_LOG_TEXT( "Opening SMS settings Central Repository" );
+    CRepository* cenRep = CRepository::NewLC( KCRUidSmum );
+    HTI_LOG_TEXT( "Setting character support setting to SMS settings Central Repository" );
+    TUint32 KSmumCharSupport = 0x00000008; // from MessagingInternalCRKeys.h
+    switch ( characterSupport )
+        {
+        case 0:
+            cenRep->Set( KSmumCharSupport, ECharSetFull );
+            break;
+        case 1:
+            cenRep->Set( KSmumCharSupport, ECharSetReduced );
+            break;
+        default:
+            User::Leave( KErrArgument );
+            break;
+        }
+    CleanupStack::PopAndDestroy( cenRep );
+    HTI_LOG_TEXT( "SMS settings Central Repository closed" );
+
+    smsSettings->SetDeliveryReport( deliveryReport );
+
+    switch ( validityPeriod )
+        {
+        case 0:
+            smsSettings->SetValidityPeriod( TTimeIntervalMinutes( 0 ) );
+            break;
+        case 1:
+            smsSettings->SetValidityPeriod(
+                TTimeIntervalMinutes( KValidityTime1h / 60 ) );
+            break;
+        case 2:
+            smsSettings->SetValidityPeriod(
+                TTimeIntervalMinutes( KValidityTime6h / 60 ) );
+            break;
+        case 3:
+            smsSettings->SetValidityPeriod(
+                TTimeIntervalMinutes( KValidityTime24h / 60 ) );
+            break;
+        case 4:
+            smsSettings->SetValidityPeriod(
+                TTimeIntervalMinutes( KValidityTime3d / 60 ) );
+            break;
+        case 5:
+            smsSettings->SetValidityPeriod(
+                TTimeIntervalMinutes( KValidityTime1w / 60 ) );
+            break;
+        default:
+            User::Leave( KErrArgument );
+            break;
+        }
+
+    switch ( messageConversion )
+        {
+        case 0:
+            smsSettings->SetMessageConversion( ESmsConvPIDNone );
+            break;
+        case 1:
+            smsSettings->SetMessageConversion( ESmsConvFax );
+            break;
+        case 2:
+            smsSettings->SetMessageConversion( ESmsConvPaging );
+            break;
+        case 3:
+            smsSettings->SetMessageConversion( ESmsConvMail );
+            break;
+        default:
+            User::Leave( KErrArgument );
+            break;
+        }
+
+    switch ( preferredConnection )
+        {
+        case 0:
+            smsSettings->SetSmsBearer( CSmsSettings::ESmsBearerCircuitPreferred );
+            break;
+        case 1:
+            smsSettings->SetSmsBearer( CSmsSettings::ESmsBearerPacketPreferred );
+            break;
+        default:
+            User::Leave( KErrArgument );
+            break;
+        }
+
+    smsSettings->SetReplyPath( replyViaSameCenter );
+
+    HTI_LOG_TEXT( "Saving the settings" );
+    smsAccount->SaveSettingsL( *smsSettings );
+
+    CleanupStack::PopAndDestroy( 2 ); // smsAccount, smsSettings
+
+    SendOkMsgL( KNullDesC8 );
+
+    HTI_LOG_FUNC_OUT( "CHtiMsgSettingsHandler::HandleSetSmsSettingsL" );
+    }
+
+
+// ----------------------------------------------------------------------------
+// CHtiMsgSettingsHandler::HandleSetMmsSettingsL
+// Sets the MMS service settings.
+// ----------------------------------------------------------------------------
+void CHtiMsgSettingsHandler::HandleSetMmsSettingsL( const TDesC8& aData )
+    {
+    HTI_LOG_FUNC_IN( "CHtiMsgSettingsHandler::HandleSetMmsSettingsL" );
+    TInt offset = 0;
+
+    // Get the access point name and search UID for that AP.
+    TInt apNameLength = aData[offset];
+    offset++;
+    if ( apNameLength > KApMaxConnNameLength ||
+         aData.Length() != ( KMinSetMmsSettingsLength + apNameLength - 1 ) )
+        {
+        SendErrorMessageL( KErrArgument, KErrorInvalidParameters );
+        return;
+        }
+
+    TBuf<KApMaxConnNameLength> apName;
+    apName.Copy( aData.Mid( offset, apNameLength ) );
+    offset += apNameLength;
+    HTI_LOG_FORMAT( "Searching AP with name: %S", &apName );
+    TInt apUid = GetAccessPointUIDL( apName );
+    if ( apUid == KErrNotFound )
+        {
+        SendErrorMessageL( KErrNotFound, KErrorApNotFound );
+        return;
+        }
+
+    // Extract other values
+    TMmsCreationMode creationMode = ( TMmsCreationMode ) aData[offset];
+    offset++;
+    HTI_LOG_FORMAT( "creation mode      = %d", creationMode );
+
+    TInt imageSize = aData[offset];
+    offset++;
+    HTI_LOG_FORMAT( "image size         = %d", imageSize );
+
+    TInt receptionMode = aData[offset];
+    offset++;
+    HTI_LOG_FORMAT( "reception mode     = %d", receptionMode );
+
+    TBool receiveAnonymous = aData[offset];
+    offset++;
+    HTI_LOG_FORMAT( "receive anonymous  = %d", receiveAnonymous );
+
+    TBool receiveAdvert = aData[offset];
+    offset++;
+    HTI_LOG_FORMAT( "receive adverts    = %d", receiveAdvert );
+
+    TBool requestDeliveryReport = aData[offset];
+    offset++;
+    HTI_LOG_FORMAT( "request deliv reps = %d", requestDeliveryReport );
+
+    TBool sendDeliveryReport = aData[offset];
+    offset++;
+    HTI_LOG_FORMAT( "send deliv reps    = %d", sendDeliveryReport );
+
+    TInt validityPeriod = aData[offset];
+    offset++;
+    HTI_LOG_FORMAT( "validity period    = %d", validityPeriod );
+
+    // Validate values
+    if ( creationMode > 2 || imageSize > 2 ||
+         receptionMode > 3 || validityPeriod > 5 ||
+         ( creationMode == 0 && imageSize == 2 ) )
+        {
+        HTI_LOG_TEXT( "Invalid values found" );
+        SendErrorMessageL( KErrArgument, KErrorInvalidParameters );
+        return;
+        }
+
+    // Load current settings
+    CMmsSettings* mmsSettings = CMmsSettings::NewL();
+    CleanupStack::PushL( mmsSettings );
+    mmsSettings->LoadSettingsL();
+    HTI_LOG_TEXT( "Settings loaded - now updating" );
+
+    // Update the values
+    if ( mmsSettings->AccessPointCount() > 0 )
+        {
+        mmsSettings->DeleteAccessPointL( 0 );
+        }
+    mmsSettings->AddAccessPointL( apUid, 0 );
+
+    mmsSettings->SetCreationMode( creationMode );
+
+    switch ( imageSize )
+        {
+        case 0:
+            mmsSettings->SetImageWidth( KMmsUniImageSmallWidth );
+            mmsSettings->SetImageHeight( KMmsUniImageSmallHeight );
+            break;
+        case 1:
+            mmsSettings->SetImageWidth( KMmsUniImageLargeWidth );
+            mmsSettings->SetImageHeight( KMmsUniImageLargeHeight );
+            break;
+        default:
+            User::Leave( KErrArgument );
+            break;
+        }
+
+    switch ( receptionMode )
+        {
+        case 0:
+            mmsSettings->SetReceivingModeHome( EMmsReceivingAutomatic );
+            mmsSettings->SetReceivingModeForeign( EMmsReceivingAutomatic );
+            break;
+        case 1:
+            mmsSettings->SetReceivingModeHome( EMmsReceivingAutomatic );
+            mmsSettings->SetReceivingModeForeign( EMmsReceivingManual );
+            break;
+        case 2:
+            mmsSettings->SetReceivingModeHome( EMmsReceivingManual );
+            mmsSettings->SetReceivingModeForeign( EMmsReceivingManual );
+            break;
+        case 3:
+            mmsSettings->SetReceivingModeHome( EMmsReceivingReject );
+            mmsSettings->SetReceivingModeForeign( EMmsReceivingReject );
+            break;
+        default:
+            User::Leave( KErrArgument );
+            break;
+        }
+
+    mmsSettings->SetAcceptAnonymousMessages( receiveAnonymous );
+    mmsSettings->SetAcceptAdvertisementMessages( receiveAdvert );
+
+    if ( requestDeliveryReport )
+        {
+        mmsSettings->SetDeliveryReportWanted( KMmsYes );
+        }
+    else
+        {
+        mmsSettings->SetDeliveryReportWanted( KMmsNo );
+        }
+
+    if ( sendDeliveryReport )
+        {
+        mmsSettings->SetDeliveryReportSendingAllowed( KMmsYes );
+        }
+    else
+        {
+        mmsSettings->SetDeliveryReportSendingAllowed( KMmsNo );
+        }
+
+    switch ( validityPeriod )
+        {
+        case 0:
+            mmsSettings->SetExpiryInterval( KValidityTimeMax );
+            break;
+        case 1:
+            mmsSettings->SetExpiryInterval( KValidityTime1h );
+            break;
+        case 2:
+            mmsSettings->SetExpiryInterval( KValidityTime6h );
+            break;
+        case 3:
+            mmsSettings->SetExpiryInterval( KValidityTime24h );
+            break;
+        case 4:
+            mmsSettings->SetExpiryInterval( KValidityTime3d );
+            break;
+        case 5:
+            mmsSettings->SetExpiryInterval( KValidityTime1w );
+            break;
+        default:
+            User::Leave( KErrArgument );
+            break;
+        }
+
+    // Check validity of updated settings and save if valid.
+    if ( mmsSettings->ValidateSettings() != KErrNone )
+        {
+        HTI_LOG_TEXT( "Settings not valid - won't save" );
+        SendErrorMessageL( KErrArgument, KErrorInvalidParameters );
+        }
+    else
+        {
+        HTI_LOG_TEXT( "Settings valid - now saving" );
+        mmsSettings->SaveSettingsL();
+        SendOkMsgL( KNullDesC8 );
+        }
+
+    CleanupStack::PopAndDestroy(); // mmsSettings
+    HTI_LOG_FUNC_OUT( "CHtiMsgSettingsHandler::HandleSetMmsSettingsL" );
+    }
+
+
+// ----------------------------------------------------------------------------
+// CHtiMsgSettingsHandler::GetAccessPointUIDL
+// Gets the UID of Access Point named by aApName.
+// Returns KErrNotFound if AP not found.
+// ----------------------------------------------------------------------------
+TInt CHtiMsgSettingsHandler::GetAccessPointUIDL( const TDesC& aApName )
+    {
+    HTI_LOG_FUNC_IN( "CHtiMsgSettingsHandler::GetAccessPointUIDL" );
+    TInt uid = KErrNotFound;
+
+    RCmManager cmManager;
+    cmManager.OpenL();
+    CleanupClosePushL( cmManager );
+
+    // Search from uncategorised first
+    RArray<TUint32> array = RArray<TUint32>();
+    cmManager.ConnectionMethodL( array );
+    CleanupClosePushL( array );
+    TInt i = 0;
+    while ( i < array.Count() && uid == KErrNotFound )
+        {
+        RCmConnectionMethod cm = cmManager.ConnectionMethodL( array[i] );
+        CleanupClosePushL( cm );
+        HBufC* name = cm.GetStringAttributeL( CMManager::ECmName );
+        HTI_LOG_FORMAT( "Found name: %S", name );
+        CleanupStack::PushL( name );
+        if ( aApName.Compare( *name ) == 0 )
+            {
+            uid = cm.GetIntAttributeL( CMManager::ECmWapId );
+            HTI_LOG_FORMAT( "Match: UID = %d", uid );
+            }
+        CleanupStack::PopAndDestroy(); // name
+        CleanupStack::PopAndDestroy(); // cm
+        i++;
+        }
+    CleanupStack::PopAndDestroy(); // array
+
+    // If not found from uncategorised, search from all destinations
+    if ( uid == KErrNotFound )
+        {
+        HTI_LOG_TEXT( "Not found from uncategorised" );
+        RArray<TUint32> destIdArray = RArray<TUint32>();
+        cmManager.AllDestinationsL( destIdArray );
+        CleanupClosePushL( destIdArray );
+        i = 0;
+        while ( i < destIdArray.Count() && uid == KErrNotFound )
+            {
+            RCmDestination dest = cmManager.DestinationL( destIdArray[i] );
+            CleanupClosePushL( dest );
+            TInt j = 0;
+            while ( j < dest.ConnectionMethodCount() && uid == KErrNotFound )
+                {
+                HBufC* name = dest.ConnectionMethodL( j ).GetStringAttributeL(
+                        CMManager::ECmName );
+                CleanupStack::PushL( name );
+                HTI_LOG_FORMAT( "Found name: %S", name );
+                if ( aApName.Compare( *name ) == 0 )
+                    {
+                    uid = dest.ConnectionMethodL( j ).GetIntAttributeL(
+                            CMManager::ECmWapId );
+                    HTI_LOG_FORMAT( "Match: UID = %d", uid );
+                    }
+                CleanupStack::PopAndDestroy(); // name
+                j++;
+                }
+            CleanupStack::PopAndDestroy(); // dest
+            i++;
+            }
+        CleanupStack::PopAndDestroy(); // destIdArray
+        }
+
+    CleanupStack::PopAndDestroy(); // cmManager
+
+    HTI_LOG_FUNC_OUT( "CHtiMsgSettingsHandler::GetAccessPointUIDL" );
+    return uid;
+    }
+
+
+// ----------------------------------------------------------------------------
+// CHtiMsgSettingsHandler::SendOkMsgL
+// Helper function for sending response messages.
+// ----------------------------------------------------------------------------
+void CHtiMsgSettingsHandler::SendOkMsgL( const TDesC8& aData )
+    {
+    HTI_LOG_FUNC_IN( "CHtiMsgSettingsHandler::SendOkMsgL" );
+    User::LeaveIfNull( iDispatcher );
+    HBufC8* temp = HBufC8::NewL( aData.Length() + 1 );
+    TPtr8 response = temp->Des();
+    response.Append( ( TChar ) CHtiMessagesServicePlugin::EResultOk );
+    response.Append( aData );
+    User::LeaveIfError( iDispatcher->DispatchOutgoingMessage(
+        temp, KHtiMessagesServiceUid ) );
+    HTI_LOG_FUNC_OUT( "CHtiMsgSettingsHandler::SendOkMsgL" );
+    }
+
+
+// ----------------------------------------------------------------------------
+// CHtiMsgSettingsHandler::SendErrorMessageL
+// Helper function for sending error response messages.
+// ----------------------------------------------------------------------------
+void CHtiMsgSettingsHandler::SendErrorMessageL( TInt aError, const TDesC8& aDescription )
+    {
+    HTI_LOG_FUNC_IN( "CHtiMsgSettingsHandler::SendErrorMessageL" );
+    User::LeaveIfNull( iDispatcher );
+    User::LeaveIfError( iDispatcher->DispatchOutgoingErrorMessage(
+        aError, aDescription, KHtiMessagesServiceUid ) );
+    HTI_LOG_FUNC_OUT( "CHtiMsgSettingsHandler::SendErrorMessageL" );
+    }
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiServicePlugins/HtiMessagesServicePlugin/src/MessageMgmntHandler.cpp	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,2074 @@
+/*
+* 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:  Functional implementation of HtiMessagesServicePlugin service
+*
+*/
+
+
+// INCLUDE FILES
+#include "HtiMessagesServicePlugin.h"
+#include "MessageMgmntHandler.h"
+
+#include <HtiDispatcherInterface.h>
+#include <HtiLogging.h>
+#include <mtclreg.h>
+#include <smscmds.h>
+#include <smtcmtm.h>
+#include <smuthdr.h>
+#include <smsclnt.h>
+#include <utf.h>
+#include <mmsclient.h>
+#include <mmsconst.h>
+#include <miutset.h>
+#include <irmsgtypeuid.h>
+#include <btmsgtypeuid.h>
+#include <biouids.h>
+#include <apgcli.h>
+#include <apmstd.h>
+#include <bautils.h>
+#include <obexclientmtm.h>
+#include <cmsvmimeheaders.h>
+#include <mmsvattachmentmanager.h>
+
+// CONSTANTS
+_LIT8( KErrorMissingCommand,        "Command was not given - message was empty" );
+_LIT8( KErrorUnrecognizedCommand,   "Unrecognized command" );
+_LIT8( KErrorInvalidParameters,     "Invalid command parameters");
+_LIT8( KErrorTooLongSmsBody,        "Too long SMS body" );
+_LIT8( KErrorInvalidId,             "Invalid SMS id parameter" );
+_LIT8( KErrorInvalidFolder,         "Invalid folder parameter" );
+_LIT8( KErrorItemNotFound,          "Item not found" );
+_LIT8( KErrorFailedDelete,          "Failed to delete item" );
+_LIT8( KErrorNotSupported,          "Not supported" );
+_LIT8( KErrorSmsSettingNotDefined,  "SMS settings not defined" );
+_LIT8( KErrorMmsSettingNotDefined,  "MMS settings not defined" );
+_LIT8( KErrorMailboxNotDefined,     "Mailbox not defined" );
+_LIT8( KErrorMsgTypeNotFound,       "Message type module not found" );
+_LIT8( KErrorMsgStoreOpenFailed,    "Could not open message store" );
+_LIT8( KErrorRfsConnectFailed,      "Could not connect to file server session" );
+_LIT8( KErrorAttachmentNotFound,    "Attachment not found" );
+_LIT8( KErrorInvalidFolderForSmartMsg, "Only inbox allowed for smart messages" );
+
+const static TInt KAddSmsCmdMinLength        = 7;
+const static TInt KAddMmsOrEmailCmdMinLength = 8;
+const static TInt KAddObexMsgCmdMinLength    = 6;
+const static TInt KAddSmartMsgCmdMinLength   = 11;
+const static TInt KAddAudioCmdMinLength      = 10;
+
+// ----------------------------------------------------------------------------
+CMessageMgmntHandler* CMessageMgmntHandler::NewL()
+    {
+    HTI_LOG_FUNC_IN( "CMessageMgmntHandler::NewL" );
+    CMessageMgmntHandler* self = new (ELeave) CMessageMgmntHandler();
+    CleanupStack::PushL ( self );
+    self->ConstructL();
+    CleanupStack::Pop();
+    HTI_LOG_FUNC_OUT( "CMessageMgmntHandler::NewL: Done" );
+    return self;
+    }
+
+// ----------------------------------------------------------------------------
+CMessageMgmntHandler::CMessageMgmntHandler()
+    {
+    }
+
+// ----------------------------------------------------------------------------
+CMessageMgmntHandler::~CMessageMgmntHandler()
+    {
+    delete iMtmReg;
+    delete iSession;
+    }
+
+// ----------------------------------------------------------------------------
+void CMessageMgmntHandler::ConstructL()
+    {
+    HTI_LOG_FUNC_IN( "CMessageMgmntHandler::ConstructL" );
+    iSession = CMsvSession::OpenSyncL( *this );
+    iMtmReg = CClientMtmRegistry::NewL( *iSession );
+    HTI_LOG_FUNC_OUT( "CMessageMgmntHandler::ConstructL: Done" );
+    }
+
+// ----------------------------------------------------------------------------
+void CMessageMgmntHandler::SetDispatcher( MHtiDispatcher* aDispatcher )
+    {
+    iDispatcher = aDispatcher;
+    }
+
+// ----------------------------------------------------------------------------
+void CMessageMgmntHandler::ProcessMessageL( const TDesC8& aMessage,
+                                            THtiMessagePriority /*aPriority*/ )
+    {
+    HTI_LOG_FUNC_IN( "CMessageMgmntHandler::ProcessMessageL" );
+    HTI_LOG_FORMAT( "Msg length: %d", aMessage.Length() );
+
+    if ( aMessage.Length() == 0 )
+        {
+        SendErrorMessageL( KErrArgument, KErrorMissingCommand );
+        return;
+        }
+
+    switch ( aMessage[0] )
+        {
+        case CHtiMessagesServicePlugin::EAddSms:
+            HTI_LOG_TEXT( "Add SMS" );
+            HandleCreateSmsL( aMessage.Right( aMessage.Length() - 1 ) );
+            break;
+
+        case CHtiMessagesServicePlugin::EAddMms:
+        case CHtiMessagesServicePlugin::EAddAudioMsg: // special MMS sub type
+            HTI_LOG_TEXT( "Add MMS" );
+            HandleCreateMmsL( aMessage );
+            break;
+
+        case CHtiMessagesServicePlugin::EAddEmail:
+            HTI_LOG_TEXT( "Add Email" );
+            HandleCreateEmailL( aMessage );
+            break;
+
+        case CHtiMessagesServicePlugin::EAddIrMsg:
+            HTI_LOG_TEXT( "Add IR msg" );
+            HandleCreateObexMsgL( aMessage.Right( aMessage.Length() - 1 ),
+                                  TUid::Uid( KUidMsgTypeIrTInt32 ),
+                                  KUidMsgTypeIrUID );
+            break;
+
+        case CHtiMessagesServicePlugin::EAddBtMsg:
+            HTI_LOG_TEXT( "Add BT msg" );
+            HandleCreateObexMsgL( aMessage.Right( aMessage.Length() - 1 ),
+                                  TUid::Uid( KUidMsgTypeBtTInt32 ),
+                                  KUidMsgTypeBt );
+            break;
+
+        case CHtiMessagesServicePlugin::EAddSmartMsg:
+            HTI_LOG_TEXT( "Add smart msg" );
+            HandleCreateSmartMsgL( aMessage.Right( aMessage.Length() - 1 ) );
+            break;
+
+        case CHtiMessagesServicePlugin::EDeleteMessage:
+            HTI_LOG_TEXT( "Delete message" );
+            HandleDeleteMessageL( aMessage.Right( aMessage.Length() - 1 ) );
+            break;
+
+        case CHtiMessagesServicePlugin::EDeleteFolderContent:
+            HTI_LOG_TEXT( "Delete messages" );
+            HandleDeleteMessagesL( aMessage.Right( aMessage.Length() - 1 ) );
+            break;
+
+        default:
+            HTI_LOG_TEXT( "Unknown command" );
+            SendErrorMessageL( KErrUnknown, KErrorUnrecognizedCommand );
+            break;
+        }
+
+    HTI_LOG_FUNC_OUT( "CMessageMgmntHandler::ProcessMessageL: Done" );
+    }
+
+// ----------------------------------------------------------------------------
+void CMessageMgmntHandler::HandleCreateSmsL( const TDesC8& aData )
+    {
+    HTI_LOG_FUNC_IN( "CMessageMgmntHandler::HandleSmsImportFuncL" );
+
+    if ( ValidateAddSmsCommand( aData ) )
+        {
+        TInt position( 0 );
+        HBufC16* fromTo = ExtractDesLC( aData, position, 1 );
+        HBufC16* description = ExtractDesLC( aData, position, 1 );
+        HBufC16* body = ExtractDesLC( aData, position, 2 );
+        TBool isNew = (TBool)aData[position];
+        TBool isUnread = (TBool)aData[position+1];
+        TFolder folder = (TFolder)aData[position+2];
+
+        CSmsClientMtm* smsMtm = NULL;
+        TRAPD( err, smsMtm = ( CSmsClientMtm* )iMtmReg->NewMtmL(
+                KUidMsgTypeSMS ) );
+        if ( err || !smsMtm )
+            {
+            HTI_LOG_TEXT( "SMS message type module not found" );
+            SendErrorMessageL( KErrNotFound, KErrorMsgTypeNotFound );
+            CleanupStack::PopAndDestroy( body );
+            CleanupStack::PopAndDestroy( description );
+            CleanupStack::PopAndDestroy( fromTo );
+            return;
+            }
+        CleanupStack::PushL( smsMtm );
+
+        CMsvEntry* entry = CMsvEntry::NewL( *iSession,
+                                            KMsvGlobalInBoxIndexEntryId,
+                                            TMsvSelectionOrdering() );
+        CleanupStack::PushL( entry );
+
+        // get the default service
+        TMsvId defaultServiceId = 0;
+        TRAP( err, defaultServiceId = smsMtm->DefaultServiceL() );
+        if ( err )
+            {
+            HTI_LOG_FORMAT( "Could not get default service, err: %d", err );
+            SendErrorMessageL( err, KErrorSmsSettingNotDefined );
+            CleanupStack::PopAndDestroy( entry );
+            CleanupStack::PopAndDestroy( smsMtm );
+            CleanupStack::PopAndDestroy( body );
+            CleanupStack::PopAndDestroy( description );
+            CleanupStack::PopAndDestroy( fromTo );
+            return;
+            }
+
+        // map the folder parameter to folder id
+        TMsvId folderId = KMsvGlobalInBoxIndexEntryId;
+        TRAP( err, folderId = MapFolderToIdL( folder ) );
+        if ( err )
+            {
+            HTI_LOG_FORMAT( "Invalid folder: %d", folder );
+            SendErrorMessageL( err, KErrorInvalidFolder );
+            CleanupStack::PopAndDestroy( entry );
+            CleanupStack::PopAndDestroy( smsMtm );
+            CleanupStack::PopAndDestroy( body );
+            CleanupStack::PopAndDestroy( description );
+            CleanupStack::PopAndDestroy( fromTo );
+            return;
+            }
+        entry->SetEntryL( folderId );
+
+        // mtm takes ownership of entry context
+        smsMtm->SetCurrentEntryL( entry );
+        CleanupStack::Pop( entry );
+
+        // create a new message
+        smsMtm->CreateMessageL( defaultServiceId );
+
+        if ( folder == EInbox )
+            {
+            CSmsHeader* smsHeader = &( smsMtm->SmsHeader() );
+            delete smsHeader;
+            smsHeader = NULL;
+            smsHeader = CSmsHeader::NewL( CSmsPDU::ESmsDeliver, smsMtm->Body() );
+            smsHeader->SetFromAddressL( fromTo->Des() );
+            }
+        else
+            {
+            smsMtm->AddAddresseeL( fromTo->Des() );
+
+            // set delivery settings
+            CSmsSettings* sendOptions = CSmsSettings::NewL();
+            CleanupStack::PushL( sendOptions );
+            sendOptions->CopyL( smsMtm->ServiceSettings() );
+            sendOptions->SetDelivery( ESmsDeliveryImmediately );
+
+            CSmsHeader* smsHeader = &( smsMtm->SmsHeader() );
+            smsHeader->SetSmsSettingsL( *sendOptions );
+            CleanupStack::PopAndDestroy( sendOptions );
+            }
+
+
+
+        // set body
+        smsMtm->Body().Reset();
+        smsMtm->Body().InsertL( 0, *body );
+
+        // save the message
+        smsMtm->SaveMessageL();
+
+        // get the entry of the message
+        TMsvEntry tentry = smsMtm->Entry().Entry();
+
+        // set the details field
+        tentry.iDetails.Set( fromTo->Des() );
+
+        // set the description field if it is given.
+        // (with no description the beginning of the message body
+        //  is used as a description)
+        if ( description->Length() > 0 )
+            {
+            tentry.iDescription.Set( description->Des() );
+            }
+
+        // final fine tuning
+        tentry.SetAttachment( EFalse );
+        tentry.iDate.UniversalTime();
+        tentry.SetVisible( ETrue );
+        tentry.SetInPreparation( EFalse );
+        tentry.SetUnread( isUnread );
+        tentry.SetNew( isNew );
+        tentry.SetComplete( ETrue );
+        tentry.SetSendingState( KMsvSendStateWaiting );
+        tentry.iServiceId = defaultServiceId;
+        tentry.iRelatedId = 0;
+        if ( folder == EInbox )
+            {
+            tentry.SetReadOnly( ETrue );
+            }
+
+        smsMtm->Entry().ChangeL( tentry );
+
+        // send the message, if it is in outbox
+        if ( folder == EOutbox )
+            {
+            CMsvEntrySelection* selection = new (ELeave) CMsvEntrySelection;
+            CleanupStack::PushL( selection );
+            selection->AppendL( tentry.Id() );
+
+            TBuf8<1> dummyParameter;
+            CMsvOperationWait* waiter = CMsvOperationWait::NewLC();
+            CMsvOperation* op = smsMtm->InvokeAsyncFunctionL(
+                    ESmsMtmCommandScheduleCopy, *selection,
+                    dummyParameter, waiter->iStatus );
+            CleanupStack::PushL( op );
+            waiter->Start();
+            CActiveScheduler::Start();
+            CleanupStack::PopAndDestroy( op );
+            CleanupStack::PopAndDestroy( waiter );
+            CleanupStack::PopAndDestroy( selection );
+            }
+
+        CleanupStack::PopAndDestroy( smsMtm );
+        CleanupStack::PopAndDestroy( body );
+        CleanupStack::PopAndDestroy( description );
+        CleanupStack::PopAndDestroy( fromTo );
+
+        TInt32 id = tentry.Id();
+        TBuf8<8> idStr;
+        idStr.Copy( ( TUint8* )( &id ), sizeof( id ) );
+        SendOkMsgL( idStr );
+        }
+
+    HTI_LOG_FUNC_OUT("CMessageMgmntHandler::HandleSmsImportFuncL: Done");
+    }
+
+// ----------------------------------------------------------------------------
+void CMessageMgmntHandler::HandleCreateMmsL( const TDesC8& aData )
+    {
+    HTI_LOG_FUNC_IN( "CMessageMgmntHandler::HandleCreateMmsL" );
+
+    if ( !ValidateAddMmsOrAddEmailCommand( aData ) )
+        {
+        // Error message has been sent from validation method.
+        return;
+        }
+
+    // parse the parameters
+    TInt position( 0 );
+    TInt cmdCode = aData[position];
+    position++;
+    HBufC16* fromTo = ExtractDesLC( aData, position, 1 );
+    HBufC16* description = ExtractDesLC( aData, position, 1 );
+    HBufC8* body = NULL;
+    if ( cmdCode == CHtiMessagesServicePlugin::EAddMms )
+        {
+        body = ExtractDes8LC( aData, position, 2 );
+        }
+    else // Audio msg does not have body text
+        {
+        body = HBufC8::NewLC( 0 );
+        }
+    HBufC16* attPath = ExtractDesLC( aData, position, 1 );
+    TBool isNew = (TBool)aData[position];
+    TBool isUnread = (TBool)aData[position+1];
+    TFolder folder = (TFolder)aData[position+2];
+    TInt extraAttNum;
+    position += 3;
+    TInt len = aData.Length();
+    if( aData.Length() > position )
+        {
+        extraAttNum = (TInt)aData[position];
+        }
+    else
+        {
+        extraAttNum = 0;
+        }
+    position++;
+
+    HTI_LOG_TEXT( "Creating MMS Client MTM" );
+    CMmsClientMtm* mmsMtm = NULL;
+    TRAPD( err , mmsMtm = ( CMmsClientMtm* )iMtmReg->NewMtmL(
+            KUidMsgTypeMultimedia ) );
+    if ( err || !mmsMtm )
+        {
+        HTI_LOG_TEXT( "MMS message type module not found" );
+        SendErrorMessageL( KErrNotFound, KErrorMsgTypeNotFound );
+        CleanupStack::PopAndDestroy( attPath );
+        CleanupStack::PopAndDestroy( body );
+        CleanupStack::PopAndDestroy( description );
+        CleanupStack::PopAndDestroy( fromTo );
+        return;
+        }
+    CleanupStack::PushL( mmsMtm );
+
+    HTI_LOG_TEXT( "Creating MMS Client MTM" );
+    CMsvEntry* entry = CMsvEntry::NewL( *iSession,
+                                        KMsvGlobalInBoxIndexEntryId,
+                                        TMsvSelectionOrdering() );
+    CleanupStack::PushL( entry );
+
+    // get the default service
+    TMsvId defaultServiceId = 0;
+    TRAP( err, defaultServiceId = mmsMtm->DefaultServiceL() );
+    if ( err )
+        {
+        HTI_LOG_FORMAT( "Could not get default service, err: %d", err );
+        SendErrorMessageL( err, KErrorMmsSettingNotDefined );
+        CleanupStack::PopAndDestroy( entry );
+        CleanupStack::PopAndDestroy( mmsMtm );
+        CleanupStack::PopAndDestroy( attPath );
+        CleanupStack::PopAndDestroy( body );
+        CleanupStack::PopAndDestroy( description );
+        CleanupStack::PopAndDestroy( fromTo );
+        return;
+        }
+
+    // map the folder parameter to folder id
+    TMsvId folderId = KMsvGlobalInBoxIndexEntryId;
+    TRAP( err, folderId = MapFolderToIdL( folder ) );
+    if ( err )
+        {
+        HTI_LOG_FORMAT( "Invalid folder: %d", folder );
+        SendErrorMessageL( err, KErrorInvalidFolder );
+        CleanupStack::PopAndDestroy( entry );
+        CleanupStack::PopAndDestroy( mmsMtm );
+        CleanupStack::PopAndDestroy( attPath );
+        CleanupStack::PopAndDestroy( body );
+        CleanupStack::PopAndDestroy( description );
+        CleanupStack::PopAndDestroy( fromTo );
+        return;
+        }
+    entry->SetEntryL( folderId );
+
+    // mtm takes ownership of entry context
+    mmsMtm->SetCurrentEntryL( entry );
+    CleanupStack::Pop( entry );
+
+    HTI_LOG_TEXT( "Creating MMS..." );
+    mmsMtm->CreateMessageL( defaultServiceId );
+    mmsMtm->SetMessageClass( EMmsClassPersonal );
+    mmsMtm->SetExpiryInterval( 86400 );
+    mmsMtm->SetDeliveryTimeInterval( 0 );
+    mmsMtm->SetMessagePriority( EMmsPriorityNormal );
+    mmsMtm->SetSenderVisibility( EMmsMaximumSenderVisibility );
+    mmsMtm->SetDeliveryReport( EMmsDeliveryReportNo );
+    mmsMtm->SetReadReply( EMmsReadReplyYes );
+
+    if ( description->Length() > 0 )
+        {
+        mmsMtm->SetSubjectL( description->Des() );
+        }
+
+    if ( folder == EInbox )
+        {
+        mmsMtm->SetSenderL( fromTo->Des() );
+        }
+    else
+        {
+        mmsMtm->AddAddresseeL( fromTo->Des() );
+        }
+
+    // get an access to the message store
+    HTI_LOG_TEXT( "Getting message store..." );
+    CMsvStore* store = NULL;
+    TRAP( err, store = entry->EditStoreL() );
+    if ( err )
+        {
+        HTI_LOG_FORMAT( "Could not get access to message store, err: %d", err );
+        SendErrorMessageL( err, KErrorMsgStoreOpenFailed );
+        CleanupStack::PopAndDestroy( mmsMtm );
+        CleanupStack::PopAndDestroy( attPath );
+        CleanupStack::PopAndDestroy( body );
+        CleanupStack::PopAndDestroy( description );
+        CleanupStack::PopAndDestroy( fromTo );
+        return;
+        }
+    CleanupStack::PushL( store );
+
+    MMsvAttachmentManager& attachMan = store->AttachmentManagerL();
+    // set body attachment only for normal MMS - audio message doesn't have body
+    if ( cmdCode == CHtiMessagesServicePlugin::EAddMms )
+        {
+        // Set the message body as attachment
+        // Use UTF-8 as charset because MMS created with MMS editor seems to
+        // save text attachments also as UTF-8.
+        HTI_LOG_TEXT( "Setting body..." );
+        CMsvMimeHeaders* mimeHeaders = CMsvMimeHeaders::NewL();
+        CleanupStack::PushL( mimeHeaders );
+        mimeHeaders->SetContentTypeL( _L8( "text" ) );
+        mimeHeaders->SetContentSubTypeL( _L8( "plain" ) );
+        mimeHeaders->SetMimeCharset( KMmsUtf8 );
+        mimeHeaders->SetSuggestedFilenameL( _L( "body.txt" ) );
+
+        // ownership of bodyAttachment will be transferred
+        CMsvAttachment* bodyAttachment = CMsvAttachment::NewL(
+                CMsvAttachment::EMsvFile );
+        CleanupStack::PushL( bodyAttachment );
+        bodyAttachment->SetAttachmentNameL( _L( "body.txt" ) );
+        bodyAttachment->SetMimeTypeL( _L8( "text/plain" ) );
+        mimeHeaders->StoreL( *bodyAttachment );
+
+        RFile textFile;
+        CleanupClosePushL( textFile );
+        CWaiter* waiter = CWaiter::NewLC();
+        attachMan.CreateAttachmentL( _L( "body.txt" ), textFile,
+                bodyAttachment, waiter->iStatus );
+        waiter->StartAndWait();
+        CleanupStack::PopAndDestroy( waiter );
+
+        // write the UTF-8 body data to attachment file
+        textFile.Write( *body );
+        CleanupStack::PopAndDestroy(); // textFile
+        CleanupStack::Pop( bodyAttachment ); // ownership transfered
+        CleanupStack::PopAndDestroy( mimeHeaders );
+        }
+
+    // get the entry of the message
+    TMsvEntry tentry = mmsMtm->Entry().Entry();
+
+    // set the details field
+    tentry.iDetails.Set( *fromTo );
+
+    // set the description field
+    if ( description->Length() > 0 )
+        {
+        tentry.iDescription.Set( description->Left( KMmsMaxDescription ) );
+        }
+    else
+        {
+        TBuf<KMmsMaxDescription> descr;
+        CnvUtfConverter::ConvertToUnicodeFromUtf8( descr, *body );
+        tentry.iDescription.Set( descr );
+        }
+
+    // if this is audio message, set the bio type uid
+    if ( cmdCode == CHtiMessagesServicePlugin::EAddAudioMsg )
+        {
+        tentry.iBioType = KUidMsgSubTypeMmsAudioMsg.iUid;
+        }
+
+    // handle attachment
+    TBool attachmentsExist = EFalse;
+	if ( attPath->Length() > 0 )
+		{
+		HTI_LOG_TEXT( "Handling attachment..." );
+		// check that attachment exists
+		RFs fsSession;
+		if ( fsSession.Connect() != KErrNone )
+			{
+			HTI_LOG_FORMAT( "Error in connecting to file server session: %d", err );
+			SendErrorMessageL( KErrCouldNotConnect, KErrorRfsConnectFailed );
+			CleanupStack::PopAndDestroy( store );
+			CleanupStack::PopAndDestroy( mmsMtm );
+			CleanupStack::PopAndDestroy( attPath );
+			CleanupStack::PopAndDestroy( body );
+			CleanupStack::PopAndDestroy( description );
+			CleanupStack::PopAndDestroy( fromTo );
+			return;
+			}
+
+		TBool fileExists = BaflUtils::FileExists( fsSession, attPath->Des() );
+		fsSession.Close();
+		if ( !fileExists )
+			{
+			HTI_LOG_TEXT( "Attachment file not found" );
+			SendErrorMessageL( KErrPathNotFound, KErrorAttachmentNotFound );
+			store->RevertL();
+			CleanupStack::PopAndDestroy( store );
+			CleanupStack::PopAndDestroy( mmsMtm );
+			CleanupStack::PopAndDestroy( attPath );
+			CleanupStack::PopAndDestroy( body );
+			CleanupStack::PopAndDestroy( description );
+			CleanupStack::PopAndDestroy( fromTo );
+			return;
+			}
+		else
+			{
+			// save the attachment
+			TParse parser;
+			parser.Set( *attPath, NULL, NULL);
+			TFileName shortFileName = parser.NameAndExt();
+
+			// get the mime type
+			RApaLsSession ls;
+			User::LeaveIfError( ls.Connect() );
+			CleanupClosePushL( ls );
+			TUid appUid;
+			TDataType dataType;
+			ls.AppForDocument( *attPath, appUid, dataType );
+			CleanupStack::PopAndDestroy(); // ls
+			TPtrC8 mimeType = dataType.Des8();
+
+			// attachment settings
+			// ownership of attachment will be transferred
+			CMsvAttachment* attachment = CMsvAttachment::NewL(
+					CMsvAttachment::EMsvFile );
+			attachment->SetAttachmentNameL( shortFileName );
+			attachment->SetMimeTypeL( mimeType );
+
+			// save
+			CWaiter* waiter = CWaiter::NewLC();
+			attachMan.AddAttachmentL( *attPath, attachment, waiter->iStatus );
+			waiter->StartAndWait();
+			CleanupStack::PopAndDestroy( waiter );
+			attachmentsExist = ETrue;
+			}
+		}
+
+    do
+		{
+		HBufC16* attPath2;
+       if(extraAttNum-- > 0)
+            {
+            attPath2 = ExtractDesLC( aData, position, 1 );
+            }
+        else
+            {
+            break;
+            }
+
+		if ( attPath2->Length() > 0 )
+			{
+			HTI_LOG_TEXT( "Handling attachment..." );
+			// check that attachment exists
+			RFs fsSession;
+			if ( fsSession.Connect() != KErrNone )
+				{
+				HTI_LOG_FORMAT( "Error in connecting to file server session: %d", err );
+				SendErrorMessageL( KErrCouldNotConnect, KErrorRfsConnectFailed );
+				CleanupStack::PopAndDestroy( store );
+				CleanupStack::PopAndDestroy( mmsMtm );
+				CleanupStack::PopAndDestroy( attPath );
+				CleanupStack::PopAndDestroy( body );
+				CleanupStack::PopAndDestroy( description );
+				CleanupStack::PopAndDestroy( fromTo );
+				CleanupStack::PopAndDestroy( attPath2 );
+				return;
+				}
+	
+			TBool fileExists = BaflUtils::FileExists( fsSession, attPath2->Des() );
+			fsSession.Close();
+			if ( !fileExists )
+				{
+				HTI_LOG_TEXT( "Attachment file not found" );
+				SendErrorMessageL( KErrPathNotFound, KErrorAttachmentNotFound );
+				store->RevertL();
+				CleanupStack::PopAndDestroy( store );
+				CleanupStack::PopAndDestroy( mmsMtm );
+				CleanupStack::PopAndDestroy( attPath );
+				CleanupStack::PopAndDestroy( body );
+				CleanupStack::PopAndDestroy( description );
+				CleanupStack::PopAndDestroy( fromTo );
+				CleanupStack::PopAndDestroy( attPath2 );
+				return;
+				}
+			else
+				{
+				// save the attachment
+				TParse parser;
+				parser.Set( *attPath2, NULL, NULL);
+				TFileName shortFileName = parser.NameAndExt();
+	
+				// get the mime type
+				RApaLsSession ls;
+				User::LeaveIfError( ls.Connect() );
+				CleanupClosePushL( ls );
+				TUid appUid;
+				TDataType dataType;
+				ls.AppForDocument( *attPath2, appUid, dataType );
+				CleanupStack::PopAndDestroy(); // ls
+				TPtrC8 mimeType = dataType.Des8();
+	
+				// attachment settings
+				// ownership of attachment will be transferred
+				CMsvAttachment* attachment = CMsvAttachment::NewL(
+						CMsvAttachment::EMsvFile );
+				attachment->SetAttachmentNameL( shortFileName );
+				attachment->SetMimeTypeL( mimeType );
+	
+				// save
+				CWaiter* waiter = CWaiter::NewLC();
+				attachMan.AddAttachmentL( *attPath2, attachment, waiter->iStatus );
+				waiter->StartAndWait();
+				CleanupStack::PopAndDestroy( waiter );
+				attachmentsExist = ETrue;
+				}
+
+			CleanupStack::PopAndDestroy( attPath2 );
+			}
+		} while(ETrue);
+    // save the changes made to the message store
+    store->CommitL();
+    CleanupStack::PopAndDestroy( store );
+
+    // save the message
+    mmsMtm->SaveMessageL();
+
+    // final fine tuning
+    tentry.SetAttachment( attachmentsExist );
+    tentry.iDate.UniversalTime();
+    tentry.SetVisible( ETrue );
+    tentry.SetInPreparation( EFalse );
+    if ( folder == EDrafts )
+        {
+        tentry.SetReadOnly( EFalse );
+        }
+    else
+        {
+        tentry.SetReadOnly( ETrue );
+        }
+    tentry.SetUnread( isUnread );
+    tentry.SetNew( isNew );
+    tentry.SetComplete( ETrue );
+    tentry.SetSendingState( KMsvSendStateWaiting );
+    tentry.iServiceId = defaultServiceId;
+    tentry.iRelatedId = 0;
+    tentry.iMtmData1 = KMmsMessageMRetrieveConf | KMmsMessageMobileTerminated;
+
+    mmsMtm->Entry().ChangeL( tentry );
+
+    HTI_LOG_TEXT( "MMS created and ready" );
+
+    // send the message, if it is in outbox
+    if ( folder == EOutbox )
+        {
+        HTI_LOG_TEXT( "MMS is in Outbox, sending it..." );
+
+        CMsvEntrySelection* selection = new (ELeave) CMsvEntrySelection;
+        CleanupStack::PushL( selection );
+        selection->AppendL( tentry.Id() );
+
+        CMsvOperationWait* waiter = CMsvOperationWait::NewLC();
+        CMsvOperation* op = mmsMtm->SendL( *selection,
+                                           waiter->iStatus,
+                                           tentry.iDate );
+        CleanupStack::PushL( op );
+        waiter->Start();
+        CActiveScheduler::Start();
+        CleanupStack::PopAndDestroy( op );
+        CleanupStack::PopAndDestroy( waiter );
+        CleanupStack::PopAndDestroy( selection );
+        }
+
+    HTI_LOG_TEXT( "Cleaning up" );
+    CleanupStack::PopAndDestroy( mmsMtm );
+    CleanupStack::PopAndDestroy( attPath );
+    CleanupStack::PopAndDestroy( body );
+    CleanupStack::PopAndDestroy( description );
+    CleanupStack::PopAndDestroy( fromTo );
+
+    // send the message id back
+    TInt32 id = tentry.Id();
+    TBuf8<8> idStr;
+    idStr.Copy( ( TUint8* )( &id ), sizeof( id ) );
+    SendOkMsgL( idStr );
+
+    HTI_LOG_FUNC_OUT("CMessageMgmntHandler::HandleCreateMmsL: Done");
+    }
+
+
+// ----------------------------------------------------------------------------
+void CMessageMgmntHandler::HandleCreateEmailL( const TDesC8& aData )
+    {
+    HTI_LOG_FUNC_IN( "CMessageMgmntHandler::HandleCreateEmailL" );
+
+    if ( ValidateAddMmsOrAddEmailCommand( aData ) )
+        {
+        // parse the parameters
+        TInt position( 1 ); // position 0 is command code
+        HBufC16* fromTo = ExtractDesLC( aData, position, 1 );
+        HBufC16* description = ExtractDesLC( aData, position, 1 );
+        HBufC16* body = ExtractDesLC( aData, position, 2 );
+        HBufC16* attPath = ExtractDesLC( aData, position, 1 );
+        TBool isNew = (TBool)aData[position];
+        TBool isUnread = (TBool)aData[position+1];
+        TFolder folder = (TFolder)aData[position+2];
+	    TInt extraAttNum;
+	    position += 3;
+	    TInt len = aData.Length();
+	    if( aData.Length() > position )
+	        {
+	        extraAttNum = (TInt)aData[position];
+	        }
+	    else
+	        {
+	        extraAttNum = 0;
+	        }
+	    position++;
+
+        HTI_LOG_TEXT( "Creating SMTP Client MTM" );
+        CSmtpClientMtm* smtpMtm = NULL;
+        TRAPD( err, smtpMtm = ( CSmtpClientMtm* )iMtmReg->NewMtmL(
+                KUidMsgTypeSMTP ) );
+        if ( err || !smtpMtm )
+            {
+            HTI_LOG_TEXT( "SMTP message type module not found" );
+            SendErrorMessageL( KErrNotFound, KErrorMsgTypeNotFound );
+            CleanupStack::PopAndDestroy( attPath );
+            CleanupStack::PopAndDestroy( body );
+            CleanupStack::PopAndDestroy( description );
+            CleanupStack::PopAndDestroy( fromTo );
+            return;
+            }
+        CleanupStack::PushL( smtpMtm );
+
+        HTI_LOG_TEXT( "Creating a new CMsvEntry" );
+        CMsvEntry* entry = CMsvEntry::NewL( *iSession,
+                                            KMsvGlobalInBoxIndexEntryId,
+                                            TMsvSelectionOrdering() );
+        CleanupStack::PushL( entry );
+
+        // get the default service
+        HTI_LOG_TEXT( "Getting the default service" );
+        TMsvId defaultServiceId = 0;
+        TRAP( err, defaultServiceId = smtpMtm->DefaultServiceL() );
+        if ( err )
+            {
+            HTI_LOG_FORMAT( "Could not get default service, err: %d", err );
+            SendErrorMessageL( err, KErrorMailboxNotDefined );
+            CleanupStack::PopAndDestroy( entry );
+            CleanupStack::PopAndDestroy( smtpMtm );
+            CleanupStack::PopAndDestroy( attPath );
+            CleanupStack::PopAndDestroy( body );
+            CleanupStack::PopAndDestroy( description );
+            CleanupStack::PopAndDestroy( fromTo );
+            return;
+            }
+
+        // map the folder parameter to folder id
+        HTI_LOG_TEXT( "Mapping the folder parameter to folder id" );
+        TMsvId folderId = KMsvGlobalInBoxIndexEntryId;
+        TRAP( err, folderId = MapFolderToIdL( folder ) );
+        if ( err )
+            {
+            HTI_LOG_FORMAT( "Invalid folder: %d", folder );
+            SendErrorMessageL( err, KErrorInvalidFolder );
+            CleanupStack::PopAndDestroy( entry );
+            CleanupStack::PopAndDestroy( smtpMtm );
+            CleanupStack::PopAndDestroy( attPath );
+            CleanupStack::PopAndDestroy( body );
+            CleanupStack::PopAndDestroy( description );
+            CleanupStack::PopAndDestroy( fromTo );
+            return;
+            }
+        entry->SetEntryL( folderId );
+
+        // mtm takes ownership of entry context
+        smtpMtm->SetCurrentEntryL( entry );
+        CleanupStack::Pop( entry );
+
+        // create a message and set subject and body
+        smtpMtm->CreateMessageL( defaultServiceId );
+        smtpMtm->SetSubjectL( description->Des() );
+        smtpMtm->Body().Reset();
+        smtpMtm->Body().InsertL( 0, body->Des() );
+
+        // get the entry of the message
+        TMsvEntry tentry = smtpMtm->Entry().Entry();
+
+        // add addressee
+        smtpMtm->AddAddresseeL( fromTo->Des() );
+        tentry.iDetails.Set( fromTo->Des() );
+
+        // If creating to Inbox use other than KUidMsgTypeSMTP so that the
+        // mail displays "from" field and not "to" field.
+        if ( folder == EInbox )
+            {
+            tentry.iMtm = KUidMsgTypeIMAP4;
+            }
+
+        // set the description field same as the message subject
+        tentry.iDescription.Set( description->Des() );
+
+        // save the changes done above
+        smtpMtm->Entry().ChangeL( tentry );
+
+        // get an access to the message store
+        CMsvStore* store = entry->EditStoreL();
+        CleanupStack::PushL( store );
+        CImHeader* header = CImHeader::NewLC();
+        header->RestoreL( *store );
+        TUint charset = header->Charset();
+        CleanupStack::PopAndDestroy( header );
+        CleanupStack::PopAndDestroy( store );
+
+        // handle attachment
+        TBool attachmentsExist = EFalse;
+        if ( attPath->Length() > 0 )
+            {
+            // check that attachment exists
+            RFs fsSession;
+            if ( fsSession.Connect() != KErrNone )
+                {
+                HTI_LOG_FORMAT( "Error in connecting to file server session: %d", err );
+                SendErrorMessageL( KErrCouldNotConnect, KErrorRfsConnectFailed );
+                CleanupStack::PopAndDestroy( smtpMtm );
+                CleanupStack::PopAndDestroy( attPath );
+                CleanupStack::PopAndDestroy( body );
+                CleanupStack::PopAndDestroy( description );
+                CleanupStack::PopAndDestroy( fromTo );
+                return;
+                }
+            CleanupClosePushL( fsSession );
+
+            TBool fileExists = BaflUtils::FileExists( fsSession, attPath->Des() );
+            if ( !fileExists )
+                {
+                HTI_LOG_TEXT( "Attachment file not found" );
+                SendErrorMessageL( KErrPathNotFound, KErrorAttachmentNotFound );
+                CleanupStack::PopAndDestroy(); // fsSession
+                CleanupStack::PopAndDestroy( smtpMtm );
+                CleanupStack::PopAndDestroy( attPath );
+                CleanupStack::PopAndDestroy( body );
+                CleanupStack::PopAndDestroy( description );
+                CleanupStack::PopAndDestroy( fromTo );
+                return;
+                }
+            else
+                {
+                // get the mime type
+                HTI_LOG_TEXT( "Getting the attachment's mime type" );
+                RApaLsSession ls;
+                User::LeaveIfError( ls.Connect() );
+                TUid appUid;
+                TDataType dataType;
+                ls.AppForDocument( *attPath, appUid, dataType );
+                TPtrC8 mimeType = dataType.Des8();
+
+                HTI_LOG_TEXT( "Adding the attachment" );
+                CWaiter* waiter = CWaiter::NewLC();
+                smtpMtm->AddAttachmentL( attPath->Des(), mimeType, charset,
+                        waiter->iStatus );
+                waiter->StartAndWait();
+                CleanupStack::PopAndDestroy( waiter );
+                HTI_LOG_TEXT( "Attachment added succesfully" );
+                ls.Close();
+                attachmentsExist = ETrue;
+                }
+
+            CleanupStack::PopAndDestroy(); // fsSession
+            }
+
+		do
+			{
+			HBufC16* attPath2;
+			if(extraAttNum-- > 0)
+	            {
+	            attPath2 = ExtractDesLC( aData, position, 1 );
+	            }
+	        else
+	            {
+	            break;
+	            }
+            // check that attachment exists
+            RFs fsSession;
+            if ( fsSession.Connect() != KErrNone )
+                {
+                HTI_LOG_FORMAT( "Error in connecting to file server session: %d", err );
+                SendErrorMessageL( KErrCouldNotConnect, KErrorRfsConnectFailed );
+                CleanupStack::PopAndDestroy( smtpMtm );
+                CleanupStack::PopAndDestroy( attPath );
+                CleanupStack::PopAndDestroy( body );
+                CleanupStack::PopAndDestroy( description );
+                CleanupStack::PopAndDestroy( fromTo );
+                CleanupStack::PopAndDestroy( attPath2 );
+                return;
+                }
+            CleanupClosePushL( fsSession );
+
+            TBool fileExists = BaflUtils::FileExists( fsSession, attPath2->Des() );
+            if ( !fileExists )
+                {
+                HTI_LOG_TEXT( "Attachment file not found" );
+                SendErrorMessageL( KErrPathNotFound, KErrorAttachmentNotFound );
+                CleanupStack::PopAndDestroy(); // fsSession
+                CleanupStack::PopAndDestroy( smtpMtm );
+                CleanupStack::PopAndDestroy( attPath );
+                CleanupStack::PopAndDestroy( body );
+                CleanupStack::PopAndDestroy( description );
+                CleanupStack::PopAndDestroy( fromTo );
+                CleanupStack::PopAndDestroy( attPath2 );
+                return;
+                }
+            else
+                {
+                // get the mime type
+                HTI_LOG_TEXT( "Getting the attachment's mime type" );
+                RApaLsSession ls;
+                User::LeaveIfError( ls.Connect() );
+                TUid appUid;
+                TDataType dataType;
+                ls.AppForDocument( *attPath2, appUid, dataType );
+                TPtrC8 mimeType = dataType.Des8();
+
+                HTI_LOG_TEXT( "Adding the attachment" );
+                CWaiter* waiter = CWaiter::NewLC();
+                smtpMtm->AddAttachmentL( attPath2->Des(), mimeType, charset,
+                        waiter->iStatus );
+                waiter->StartAndWait();
+                CleanupStack::PopAndDestroy( waiter );
+                HTI_LOG_TEXT( "Attachment added succesfully" );
+                ls.Close();
+                attachmentsExist = ETrue;
+                }
+
+            CleanupStack::PopAndDestroy(); // fsSession
+			CleanupStack::PopAndDestroy( attPath2 );
+		} while(ETrue);
+
+        // save the message
+        smtpMtm->SaveMessageL();
+
+        // final fine tuning
+        TMsvEmailEntry temailEntry = static_cast<TMsvEmailEntry>( tentry );
+        temailEntry.SetMessageFolderType( EFolderTypeUnknown );
+        temailEntry.SetDisconnectedOperation( ENoDisconnectedOperations );
+        temailEntry.SetEncrypted( EFalse );
+        temailEntry.SetSigned( EFalse );
+        temailEntry.SetVCard( EFalse );
+        temailEntry.SetVCalendar( EFalse );
+        temailEntry.SetReceipt( EFalse );
+        temailEntry.SetMHTMLEmail( EFalse );
+        temailEntry.SetBodyTextComplete( ETrue );
+        temailEntry.SetAttachment( attachmentsExist );
+        temailEntry.iDate.UniversalTime();
+        temailEntry.SetVisible( ETrue );
+        temailEntry.SetInPreparation( EFalse );
+        temailEntry.SetSendingState( KMsvSendStateWaiting );
+        temailEntry.SetUnread( isUnread );
+        temailEntry.SetNew( isNew );
+        temailEntry.SetComplete( ETrue );
+        temailEntry.iServiceId = defaultServiceId;
+        temailEntry.iRelatedId = 0;
+
+        smtpMtm->Entry().ChangeL( temailEntry );
+
+        // get an access to the message store
+        store = entry->EditStoreL();
+        CleanupStack::PushL( store );
+
+        // set email header info
+        header = CImHeader::NewLC();
+        header->RestoreL( *store );
+        header->SetSubjectL( description->Des() );
+        header->SetFromL( fromTo->Des() );
+        header->SetReceiptAddressL( fromTo->Des() );
+        header->StoreL( *store );
+        store->CommitL();
+        CleanupStack::PopAndDestroy( header );
+        CleanupStack::PopAndDestroy( store );
+
+        // send the message, if it is in outbox
+        if ( folder == EOutbox )
+            {
+            HTI_LOG_TEXT( "E-Mail was created in outbox, marking it to be sent on next connection" );
+
+            CMsvEntrySelection* selection = new (ELeave) CMsvEntrySelection;
+            CleanupStack::PushL( selection );
+            selection->AppendL( temailEntry.Id() );
+
+            TBuf8<1> dummyParameter;
+            CMsvOperationActiveSchedulerWait* waiter =
+                    CMsvOperationActiveSchedulerWait::NewLC();
+            CMsvOperation* op = smtpMtm->InvokeAsyncFunctionL(
+                    KSMTPMTMSendOnNextConnection, *selection,
+                    dummyParameter, waiter->iStatus );
+            CleanupStack::PushL( op );
+            waiter->Start();
+            CleanupStack::PopAndDestroy( op );
+            CleanupStack::PopAndDestroy( waiter );
+            CleanupStack::PopAndDestroy( selection );
+            }
+
+        HTI_LOG_TEXT( "Cleaning up" );
+        CleanupStack::PopAndDestroy( smtpMtm );
+        CleanupStack::PopAndDestroy( attPath );
+        CleanupStack::PopAndDestroy( body );
+        CleanupStack::PopAndDestroy( description );
+        CleanupStack::PopAndDestroy( fromTo );
+
+        // send the message id back
+        TInt32 id = tentry.Id();
+        TBuf8<8> idStr;
+        idStr.Copy( ( TUint8* )( &id ), sizeof( id ) );
+        SendOkMsgL( idStr );
+        }
+
+    HTI_LOG_FUNC_OUT("CMessageMgmntHandler::HandleCreateEmailL: Done");
+    }
+
+// ----------------------------------------------------------------------------
+void CMessageMgmntHandler::HandleCreateObexMsgL( const TDesC8& aData,
+                                                 TUid aMtmUid,
+                                                 TUid aMsgTypeUid )
+    {
+    HTI_LOG_FUNC_IN( "CMessageMgmntHandler::HandleCreateObexMsgL" );
+
+    if ( ValidateAddObexMsgCommand( aData ) )
+        {
+        // parse the parameters
+        TInt position( 0 );
+        HBufC16* fromTo = ExtractDesLC( aData, position, 1 );
+        HBufC16* description = ExtractDesLC( aData, position, 1 );
+        HBufC16* attPath = ExtractDesLC( aData, position, 1 );
+        TBool isNew = (TBool)aData[position];
+        TBool isUnread = (TBool)aData[position+1];
+        TFolder folder = (TFolder)aData[position+2];
+
+        // Adding Obex messages to the outbox is not allowed
+        if ( folder == EOutbox )
+            {
+            HTI_LOG_TEXT( "Outbox not supported with Obex messages" );
+            SendErrorMessageL( KErrNotSupported, KErrorNotSupported );
+            CleanupStack::PopAndDestroy( attPath );
+            CleanupStack::PopAndDestroy( description );
+            CleanupStack::PopAndDestroy( fromTo );
+            return;
+            }
+
+        CObexClientMtm* obexMtm = NULL;
+        TRAPD( err, obexMtm = ( CObexClientMtm* )iMtmReg->NewMtmL( aMtmUid ) );
+        if ( err || !obexMtm )
+            {
+            HTI_LOG_TEXT( "Obex message type module not found" );
+            SendErrorMessageL( KErrNotFound, KErrorMsgTypeNotFound );
+            CleanupStack::PopAndDestroy( attPath );
+            CleanupStack::PopAndDestroy( description );
+            CleanupStack::PopAndDestroy( fromTo );
+            return;
+            }
+        CleanupStack::PushL( obexMtm );
+
+        CMsvEntry* entry = CMsvEntry::NewL( *iSession,
+                                            KMsvGlobalInBoxIndexEntryId,
+                                            TMsvSelectionOrdering() );
+        CleanupStack::PushL( entry );
+
+        TMsvId defaultServiceId = 0;
+
+        // map the folder parameter to folder id
+        TMsvId folderId = KMsvGlobalInBoxIndexEntryId;
+        TRAP( err, folderId = MapFolderToIdL( folder ) );
+        if ( err )
+            {
+            HTI_LOG_FORMAT( "Invalid folder: %d", folder );
+            SendErrorMessageL( err, KErrorInvalidFolder );
+            CleanupStack::PopAndDestroy( entry );
+            CleanupStack::PopAndDestroy( obexMtm );
+            CleanupStack::PopAndDestroy( attPath );
+            CleanupStack::PopAndDestroy( description );
+            CleanupStack::PopAndDestroy( fromTo );
+            return;
+            }
+        entry->SetEntryL( folderId );
+
+        // mtm takes ownership of entry context
+        obexMtm->SetCurrentEntryL( entry );
+        CleanupStack::Pop( entry );
+
+        // create a new message
+        obexMtm->CreateMessageL( defaultServiceId );
+
+        // get the entry of the message
+        TMsvEntry tentry = obexMtm->Entry().Entry();
+
+        // set subject
+        obexMtm->SetSubjectL( description->Des() );
+        tentry.iDescription.Set( description->Des() );
+
+        // set body, must be empty for obex messages
+        obexMtm->Body().Reset();
+
+        // set the details field and
+        tentry.iDetails.Set( fromTo->Des() );
+
+        // set mtm
+        tentry.iMtm = aMtmUid;
+        tentry.iType = KUidMsvMessageEntry;
+        tentry.iServiceId = KMsvUnknownServiceIndexEntryId;
+
+        // save the changes done above
+        obexMtm->Entry().ChangeL( tentry );
+
+        // save the message
+        obexMtm->SaveMessageL();
+
+        // final fine tuning
+        tentry.iDate.HomeTime();
+        tentry.SetVisible( ETrue );
+        tentry.SetInPreparation( EFalse );
+        tentry.SetUnread( isUnread );
+        tentry.SetNew( isNew );
+        tentry.SetComplete( ETrue );
+        obexMtm->Entry().ChangeL( tentry );
+
+        // handle attachment
+        if ( attPath->Length() > 0 )
+            {
+            // check that attachment exists
+            RFs fsSession;
+            if ( fsSession.Connect() != KErrNone )
+                {
+                HTI_LOG_FORMAT( "Error in connecting to file server session: %d", err );
+                SendErrorMessageL( KErrCouldNotConnect, KErrorRfsConnectFailed );
+                CleanupStack::PopAndDestroy( obexMtm );
+                CleanupStack::PopAndDestroy( attPath );
+                CleanupStack::PopAndDestroy( description );
+                CleanupStack::PopAndDestroy( fromTo );
+                return;
+                }
+
+            TBool fileExists = BaflUtils::FileExists( fsSession, attPath->Des() );
+            fsSession.Close();
+            if ( !fileExists )
+                {
+                HTI_LOG_TEXT( "Attachment file not found" );
+                SendErrorMessageL( KErrPathNotFound, KErrorAttachmentNotFound );
+                CleanupStack::PopAndDestroy( obexMtm );
+                CleanupStack::PopAndDestroy( attPath );
+                CleanupStack::PopAndDestroy( description );
+                CleanupStack::PopAndDestroy( fromTo );
+                return;
+                }
+            else
+                {
+                // create a new entry for the attachment
+                TMsvEntry attachTEntry;
+                attachTEntry.iType = KUidMsvAttachmentEntry;
+                attachTEntry.iServiceId = KMsvUnknownServiceIndexEntryId;
+                attachTEntry.iMtm = aMsgTypeUid; //save as bt message
+
+                entry->CreateL( attachTEntry );
+
+                CMsvEntry* attachEntry = iSession->GetEntryL( attachTEntry.Id() );
+                obexMtm->SetCurrentEntryL( attachEntry );
+
+                // get source file
+                TFileName sourceFileName = attPath->Des();
+
+                // get the mime type
+                RApaLsSession ls;
+                User::LeaveIfError( ls.Connect() );
+                CleanupClosePushL<RApaLsSession>(ls);
+                TUid appUid;
+                TDataType mimeType;
+                ls.AppForDocument( sourceFileName, appUid, mimeType );
+                CleanupStack::PopAndDestroy(); //ls
+
+                CWaiter* waiter = CWaiter::NewLC();
+
+                // add an attachment to the current message entry
+                obexMtm->AddAttachmentL( sourceFileName, mimeType.Des8(), 0,
+                        waiter->iStatus );
+                waiter->StartAndWait();
+                CleanupStack::PopAndDestroy( waiter );
+                }
+            }
+
+        CleanupStack::PopAndDestroy( obexMtm );
+        CleanupStack::PopAndDestroy( attPath );
+        CleanupStack::PopAndDestroy( description );
+        CleanupStack::PopAndDestroy( fromTo );
+
+        // send the message id back
+        TInt32 id = tentry.Id();
+        TBuf8<8> idStr;
+        idStr.Copy( ( TUint8* )( &id ), sizeof( id ) );
+        SendOkMsgL( idStr );
+        }
+
+    HTI_LOG_FUNC_OUT("CMessageMgmntHandler::HandleCreateObexMsgL: Done");
+    }
+
+
+// ----------------------------------------------------------------------------
+void CMessageMgmntHandler::HandleCreateSmartMsgL( const TDesC8& aData )
+    {
+    HTI_LOG_FUNC_IN( "CMessageMgmntHandler::HandleCreateSmartMsgL" );
+
+    if ( ValidateAddSmartMsgCommand( aData ) )
+        {
+        TInt position( 0 );
+        HBufC16* fromTo = ExtractDesLC( aData, position, 1 );
+        HBufC16* description = ExtractDesLC( aData, position, 1 );
+        HBufC16* body = ExtractDesLC( aData, position, 2 );
+        TBool isNew = (TBool)aData[position];
+        TBool isUnread = (TBool)aData[position+1];
+        TFolder folder = (TFolder)aData[position+2];
+        TInt bioUidValue =   aData[position+3] +
+                           ( aData[position+4] << 8 ) +
+                           ( aData[position+5] << 16 ) +
+                           ( aData[position+6] << 24 );
+
+
+        // Smart messages can be created only to inbox.
+        // For sending smart messages, create a normal SMS with smart message
+        // content as a body and send it.
+        if ( folder != EInbox )
+            {
+            HTI_LOG_TEXT( "Invalid folder specified for smart message" );
+            SendErrorMessageL( KErrArgument, KErrorInvalidFolderForSmartMsg );
+            CleanupStack::PopAndDestroy( body );
+            CleanupStack::PopAndDestroy( description );
+            CleanupStack::PopAndDestroy( fromTo );
+            return;
+
+            }
+
+        CSmsClientMtm* smsMtm = NULL;
+        TRAPD( err, smsMtm = ( CSmsClientMtm* )iMtmReg->NewMtmL( KUidMsgTypeSMS ) );
+        if ( err || !smsMtm )
+            {
+            HTI_LOG_TEXT( "SMS message type module not found" );
+            SendErrorMessageL( KErrNotFound, KErrorMsgTypeNotFound );
+            CleanupStack::PopAndDestroy( body );
+            CleanupStack::PopAndDestroy( description );
+            CleanupStack::PopAndDestroy( fromTo );
+            return;
+            }
+        CleanupStack::PushL( smsMtm );
+
+        CMsvEntry* entry = CMsvEntry::NewL( *iSession,
+                KMsvGlobalInBoxIndexEntryId, TMsvSelectionOrdering() );
+        CleanupStack::PushL( entry );
+
+        // get the default service
+        TMsvId defaultServiceId = 0;
+        TRAP( err, defaultServiceId = smsMtm->DefaultServiceL() );
+        if ( err )
+            {
+            HTI_LOG_FORMAT( "Could not get default service, err: %d", err );
+            SendErrorMessageL( err, KErrorSmsSettingNotDefined );
+            CleanupStack::PopAndDestroy( entry );
+            CleanupStack::PopAndDestroy( smsMtm );
+            CleanupStack::PopAndDestroy( body );
+            CleanupStack::PopAndDestroy( description );
+            CleanupStack::PopAndDestroy( fromTo );
+            return;
+            }
+
+        // no need for folder mapping, since only inbox allowed for smart messages
+        TMsvId folderId = KMsvGlobalInBoxIndexEntryId;
+        entry->SetEntryL( folderId );
+
+        // mtm takes ownership of entry context
+        smsMtm->SetCurrentEntryL( entry );
+        CleanupStack::Pop( entry );
+
+        // create a new message
+        smsMtm->CreateMessageL( defaultServiceId );
+
+        // update the message header
+        CSmsHeader* smsHeader = &( smsMtm->SmsHeader() );
+        delete smsHeader;
+        smsHeader = NULL;
+        smsHeader = CSmsHeader::NewL( CSmsPDU::ESmsSubmit, smsMtm->Body() );
+        smsHeader->SetFromAddressL( fromTo->Des() );
+
+        // set body, the actual BIO message content
+        smsMtm->Body().Reset();
+        smsMtm->Body().InsertL( 0, body->Des() );
+
+        // get the entry of the message
+        TMsvEntry tentry = smsMtm->Entry().Entry();
+
+        // set BIO message type specific data
+        tentry.iBioType = bioUidValue;
+        smsMtm->BioTypeChangedL( TUid::Uid( bioUidValue ) );
+
+        // set details field
+        tentry.iDetails.Set( fromTo->Des() );
+
+        // set the description field
+        tentry.iDescription.Set( description->Des() );
+
+        // set correct MTM type
+        tentry.iMtm= KUidBIOMessageTypeMtm;
+
+        // final fine tuning
+        tentry.SetAttachment( EFalse );
+        tentry.iDate.UniversalTime();
+        tentry.SetVisible( ETrue );
+        tentry.SetInPreparation( EFalse );
+        tentry.SetUnread( isUnread );
+        tentry.SetNew( isNew );
+        tentry.SetComplete( ETrue );
+        tentry.SetSendingState( KMsvSendStateWaiting );
+        tentry.iServiceId = defaultServiceId;
+        tentry.iRelatedId = 0;
+
+        // save the changes done above
+        smsMtm->Entry().ChangeL( tentry );
+
+        // save the message
+        smsMtm->SaveMessageL();
+
+        CleanupStack::PopAndDestroy( smsMtm );
+        CleanupStack::PopAndDestroy( body );
+        CleanupStack::PopAndDestroy( description );
+        CleanupStack::PopAndDestroy( fromTo );
+
+        TInt32 id = tentry.Id();
+        TBuf8<8> idStr;
+        idStr.Copy( ( TUint8* )( &id ), sizeof( id ) );
+        SendOkMsgL( idStr );
+        }
+
+    HTI_LOG_FUNC_OUT("CMessageMgmntHandler::HandleCreateSmartMsgL: Done");
+    }
+
+
+// ----------------------------------------------------------------------------
+void CMessageMgmntHandler::HandleDeleteMessageL( const TDesC8& aData )
+    {
+    HTI_LOG_FUNC_IN( "CMessageMgmntHandler::HandleDeleteMessageL" );
+
+    if ( aData.Length() != 4 )
+        {
+        HTI_LOG_TEXT( "CMessageMgmntHandler: Error: wrong length of data" );
+        SendErrorMessageL( KErrArgument, KErrorInvalidId );
+        return;
+        }
+
+    TMsvId entryId =   aData[0] +
+                     ( aData[1] << 8 ) +
+                     ( aData[2] << 16 ) +
+                     ( aData[3] << 24 );
+    HTI_LOG_FORMAT( "CMessageMgmntHandler: Deleting one message, id: %d", entryId );
+    TMsvEntry entry;
+    TMsvId service;
+    User::LeaveIfError( iSession->GetEntry( entryId, service, entry ) );
+
+    CMsvEntry* parentCEntry = iSession->GetEntryL( entry.Parent() );
+    CleanupStack::PushL( parentCEntry );
+    TRAPD( err, parentCEntry->DeleteL( entry.Id() ) );
+    CleanupStack::PopAndDestroy( parentCEntry );
+
+    if ( err == KErrNone )
+        {
+        SendOkMsgL( KNullDesC8 );
+        }
+    else if ( err == KErrNotFound )
+        {
+        SendErrorMessageL( err, KErrorItemNotFound );
+        }
+    else
+        {
+        SendErrorMessageL( err, KErrorFailedDelete );
+        }
+
+    HTI_LOG_FUNC_OUT("CMessageMgmntHandler::HandleDeleteMessageL: Done");
+    }
+
+// ----------------------------------------------------------------------------
+void CMessageMgmntHandler::HandleDeleteMessagesL( const TDesC8& aData )
+    {
+    HTI_LOG_FUNC_IN( "CMessageMgmntHandler::HandleDeleteMessagesFuncL" );
+
+    if ( aData.Length() != 2 )
+        {
+        HTI_LOG_TEXT( "CMessageMgmntHandler: Error: wrong length of data" );
+        SendErrorMessageL( KErrArgument, KErrorInvalidFolder );
+        return;
+        }
+
+    if ( aData[0] == EAllFolders )
+        {
+        HandleDeleteFromAllFoldersL( (TMessageType)aData[1] );
+        }
+    else if ( aData[1] == EAllMessageTypes )
+        {
+        HandleDeleteAllMessageTypesL( (TFolder)aData[0] );
+        }
+    else
+        {
+        HandleDeleteFromFolderByTypeL( (TFolder)aData[0],
+                                       (TMessageType)aData[1] );
+        }
+
+    SendOkMsgL( KNullDesC8 );
+    HTI_LOG_FUNC_OUT("CMessageMgmntHandler::HandleDeleteMessagesFuncL: Done");
+    }
+
+// ----------------------------------------------------------------------------
+void CMessageMgmntHandler::HandleDeleteFromAllFoldersL( TMessageType aType )
+    {
+    HTI_LOG_FUNC_IN( "CMessageMgmntHandler::HandleDeleteFromAllFoldersL" );
+
+    if ( aType == EAllMessageTypes )
+        {
+        for ( TInt i = 1; i < ENumberOfFolders; i++ )
+            {
+            HandleDeleteAllMessageTypesL( (TFolder)i );
+            }
+        }
+    else
+        {
+        for ( TInt i = 1; i < ENumberOfFolders; i++ )
+            {
+            HandleDeleteFromFolderByTypeL( (TFolder)i, aType );
+            }
+        }
+
+    HTI_LOG_FUNC_OUT("CMessageMgmntHandler::HandleDeleteFromAllFoldersL: Done");
+    }
+
+// ----------------------------------------------------------------------------
+void CMessageMgmntHandler::HandleDeleteAllMessageTypesL( TFolder aFolder )
+    {
+    HTI_LOG_FUNC_IN( "CMessageMgmntHandler::HandleDeleteAllMessageTypesL" );
+
+    if ( aFolder == EAllFolders )
+        {
+        for ( TInt i = 1; i < ENumberOfMessageTypes; i++ )
+            {
+            HandleDeleteFromAllFoldersL( (TMessageType)i );
+            }
+        }
+    else
+        {
+        for ( TInt i = 1; i < ENumberOfMessageTypes; i++ )
+            {
+            HandleDeleteFromFolderByTypeL( aFolder, (TMessageType)i );
+            }
+        }
+
+    HTI_LOG_FUNC_OUT("CMessageMgmntHandler::HandleDeleteAllMessageTypesL: Done");
+    }
+
+// ----------------------------------------------------------------------------
+void CMessageMgmntHandler::HandleDeleteFromFolderByTypeL( TFolder aFolder,
+                                                          TMessageType aType )
+    {
+    HTI_LOG_FUNC_IN( "CMessageMgmntHandler::HandleDeleteFromFolderByTypeL" );
+
+    TMsvId folderId = MapFolderToIdL( aFolder );
+    TUid msgTypeUid = MapMessageTypeToUidL( aType );
+
+    HTI_LOG_TEXT( "Deleting messages..." );
+    HTI_LOG_FORMAT( "Folder: %d", aFolder );
+    HTI_LOG_FORMAT( "Message type: %d", aType );
+
+    CMsvEntry* folder = CMsvEntry::NewL( *iSession,
+                                         folderId,
+                                         TMsvSelectionOrdering() );
+    CleanupStack::PushL( folder );
+    CMsvEntrySelection* sel = folder->ChildrenWithMtmL( msgTypeUid );
+
+    CleanupStack::PushL( sel );
+    HTI_LOG_FORMAT( "Found %d matching items", sel->Count() );
+
+    for ( TInt i = 0; i < sel->Count(); i++ )
+        {
+        TMsvId entryId = sel->At( i );
+        TMsvEntry entry;
+        TMsvId service;
+        User::LeaveIfError( iSession->GetEntry( entryId, service, entry ) );
+        if ( ( aType == EAudioMessage && entry.iBioType != KUidMsgSubTypeMmsAudioMsg.iUid ) ||
+                ( aType == EMMS && entry.iBioType == KUidMsgSubTypeMmsAudioMsg.iUid ) )
+            {
+            // do not delete audio messages when MMS deletion
+            // requested and vice versa
+            continue;
+            }
+        CMsvEntry* parentCEntry = iSession->GetEntryL( entry.Parent() );
+        CleanupStack::PushL( parentCEntry );
+        parentCEntry->DeleteL( entry.Id() );
+        CleanupStack::PopAndDestroy( parentCEntry );
+        }
+
+    CleanupStack::PopAndDestroy( sel );
+    CleanupStack::PopAndDestroy( folder );
+
+    if ( aType == EEmail )
+        {
+        HandleDeleteFromFolderByTypeL( aFolder, EEmailPOP3 );
+        HandleDeleteFromFolderByTypeL( aFolder, EEmailIMAP4 );
+        }
+
+    HTI_LOG_FUNC_OUT("CMessageMgmntHandler::HandleDeleteFromFolderByTypeL: Done");
+    }
+
+// ----------------------------------------------------------------------------
+void CMessageMgmntHandler::SendOkMsgL( const TDesC8& aData )
+    {
+    HTI_LOG_FUNC_IN("CMessageMgmntHandler::SendOkMsgL: Starting");
+
+    User::LeaveIfNull( iDispatcher );
+
+    HBufC8* temp = HBufC8::NewL( aData.Length() + 1 );
+    TPtr8 response = temp->Des();
+    response.Append( (TChar) CHtiMessagesServicePlugin::EResultOk );
+    response.Append( aData );
+    User::LeaveIfError( iDispatcher->DispatchOutgoingMessage(
+        temp, KHtiMessagesServiceUid ) );
+
+    HTI_LOG_FUNC_OUT("CMessageMgmntHandler::SendOkMsgL: Done");
+    }
+
+// ----------------------------------------------------------------------------
+void CMessageMgmntHandler::SendErrorMessageL( TInt aError,
+                                              const TDesC8& aDescription )
+    {
+    HTI_LOG_FUNC_IN("CMessageMgmntHandler::SendErrorMessageL: Starting");
+    User::LeaveIfNull( iDispatcher );
+    User::LeaveIfError( iDispatcher->DispatchOutgoingErrorMessage(
+        aError, aDescription, KHtiMessagesServiceUid ) );
+    HTI_LOG_FUNC_OUT("CMessageMgmntHandler::SendErrorMessageL: Done");
+    }
+
+// ----------------------------------------------------------------------------
+TBool CMessageMgmntHandler::ValidateAddSmsCommand( const TDesC8& aData )
+    {
+    if ( aData.Length() < KAddSmsCmdMinLength )
+        {
+        HTI_LOG_TEXT( "ValidateAddSmsCommand: Error: missing data" );
+        SendErrorMessageL( KErrArgument, KErrorInvalidParameters );
+        return EFalse;
+        }
+
+    TInt offset = 0;
+    TInt fromLength = aData[offset];
+
+    offset = 1 + fromLength;
+    if ( offset > aData.Length() - 1 )
+        {
+        HTI_LOG_TEXT( "ValidateAddSmsCommand: Error: wrong length of data" );
+        SendErrorMessageL( KErrArgument, KErrorInvalidParameters );
+        return EFalse;
+        }
+    TInt descrLength = aData[offset];
+
+    offset = offset + 1 + descrLength;
+    if ( offset > aData.Length() - 2 ) // body length in two bytes
+        {
+        HTI_LOG_TEXT( "ValidateAddSmsCommand: Error: wrong length of data" );
+        SendErrorMessageL( KErrArgument, KErrorInvalidParameters );
+        return EFalse;
+        }
+    TInt bodyLength = aData[offset] + ( aData[offset+1] << 8 );
+
+    TInt wholeLength = 1 + fromLength +
+                       1 + descrLength +
+                       2 + bodyLength +
+                       1 + // is new
+                       1 + // is unread
+                       1;  // folder
+
+    if ( wholeLength != aData.Length() )
+        {
+        HTI_LOG_TEXT( "ValidateAddSmsCommand: Error: wrong length of data" );
+        SendErrorMessageL( KErrArgument, KErrorInvalidParameters );
+        return EFalse;
+        }
+
+    if ( bodyLength > 160 )
+        {
+        HTI_LOG_TEXT( "ValidateAddSmsCommand: Error: too long SMS body" );
+        SendErrorMessageL( KErrOverflow, KErrorTooLongSmsBody );
+        return EFalse;
+        }
+
+    return ETrue;
+    }
+
+
+// ----------------------------------------------------------------------------
+TBool CMessageMgmntHandler::ValidateAddMmsOrAddEmailCommand( const TDesC8& aData )
+    {
+    HTI_LOG_FUNC_IN( "CMessageMgmntHandler::ValidateAddMmsOrAddEmailCommand" );
+    if ( aData.Length() < KAddMmsOrEmailCmdMinLength + 1 ) // +1 = cmd code
+        {
+        HTI_LOG_TEXT( "Error: missing data" );
+        SendErrorMessageL( KErrArgument, KErrorInvalidParameters );
+        return EFalse;
+        }
+
+    if ( aData[0] == CHtiMessagesServicePlugin::EAddAudioMsg &&
+            aData.Length() < KAddAudioCmdMinLength + 1 ) // +1 = cmd code
+        {
+        HTI_LOG_TEXT( "ValidateAddMmsOrAddEmailCommand: Error: missing data" );
+        SendErrorMessageL( KErrArgument, KErrorInvalidParameters );
+        return EFalse;
+        }
+
+    TInt offset = 0;
+    TInt cmdCode = aData[offset];
+    offset++;
+    TInt fromToLength = aData[offset];
+    fromToLength++; // the length byte
+
+    offset = offset + fromToLength;
+    if ( offset > aData.Length() - 1 )
+        {
+        HTI_LOG_TEXT( "Error: wrong length of data" );
+        SendErrorMessageL( KErrArgument, KErrorInvalidParameters );
+        return EFalse;
+        }
+    TInt descrLength = aData[offset];
+    descrLength++; // the length byte
+
+    offset = offset + descrLength;
+    TInt bodyLength = 0;
+    if ( cmdCode != CHtiMessagesServicePlugin::EAddAudioMsg )
+        {
+        if ( offset > aData.Length() - 2 ) // body length in two bytes
+            {
+            HTI_LOG_TEXT( "Error: wrong length of data" );
+            SendErrorMessageL( KErrArgument, KErrorInvalidParameters );
+            return EFalse;
+            }
+        bodyLength = aData[offset] + ( aData[offset+1] << 8 );
+        bodyLength += 2; // the body length bytes
+        }
+
+    offset = offset + bodyLength;
+    if ( offset > aData.Length() - 1 )
+        {
+        HTI_LOG_TEXT( ": wrong length of data" );
+        SendErrorMessageL( KErrArgument, KErrorInvalidParameters );
+        return EFalse;
+        }
+    TInt attPathLength = aData[offset];
+    if ( attPathLength == 0 && cmdCode == CHtiMessagesServicePlugin::EAddAudioMsg )
+        {
+        // attachment (the audio) is mandatory for audio message
+        HTI_LOG_TEXT( "Error: missing attachment" );
+        SendErrorMessageL( KErrArgument, KErrorInvalidParameters );
+        return EFalse;
+        }
+    attPathLength++; // the length byte
+
+    TInt wholeLength = 1 + // command code
+                       fromToLength + descrLength +  bodyLength + attPathLength +
+                       1 + // is new
+                       1 + // is unread
+                       1;  // folder
+
+    TInt extraAttPathLength = 0;
+    TInt extraAttNum = 0;
+    TInt extraNumLen = 0;
+    if( wholeLength < aData.Length() )
+    	{
+    	offset = wholeLength;
+        extraAttNum = aData[offset];
+        offset ++;
+
+        extraNumLen = 1;
+
+	    while( offset < aData.Length() && extraAttNum > 0)
+	    	{
+	        extraAttPathLength += aData[offset];
+	        extraAttPathLength ++;
+	        extraAttNum --;
+	        offset += 1 + aData[offset];
+	    	}
+	    }
+
+	wholeLength += extraNumLen + extraAttPathLength;
+	
+    if ( wholeLength != aData.Length() )
+        {
+        HTI_LOG_TEXT( "Error: wrong length of data (wholeLength)" );
+        HTI_LOG_FORMAT( "Expected: %d", wholeLength );
+        HTI_LOG_FORMAT( "Was:      %d", aData.Length() );
+        SendErrorMessageL( KErrArgument, KErrorInvalidParameters );
+        return EFalse;
+        }
+
+    return ETrue;
+    }
+
+
+// ----------------------------------------------------------------------------
+TBool CMessageMgmntHandler::ValidateAddObexMsgCommand( const TDesC8& aData )
+    {
+    if ( aData.Length() < KAddObexMsgCmdMinLength )
+        {
+        HTI_LOG_TEXT( "ValidateAddObexMsgCommand: Error: missing data" );
+        SendErrorMessageL( KErrArgument, KErrorInvalidParameters );
+        return EFalse;
+        }
+
+    TInt offset = 0;
+    TInt fromToLength = aData[offset];
+
+    offset = 1 + fromToLength;
+    if ( offset > aData.Length() - 1 )
+        {
+        HTI_LOG_TEXT( "ValidateAddObexMsgCommand: Error: wrong length of data" );
+        SendErrorMessageL( KErrArgument, KErrorInvalidParameters );
+        return EFalse;
+        }
+    TInt descrLength = aData[offset];
+
+    offset = offset + 1 + descrLength;
+    if ( offset > aData.Length() - 1 )
+        {
+        HTI_LOG_TEXT( "ValidateAddObexMsgCommand: Error: wrong length of data" );
+        SendErrorMessageL( KErrArgument, KErrorInvalidParameters );
+        return EFalse;
+        }
+    TInt attPathLength = aData[offset];
+
+    TInt wholeLength = 1 + fromToLength +
+                       1 + descrLength +
+                       1 + attPathLength +
+                       1 + // is new
+                       1 + // is unread
+                       1;  // folder
+
+    if ( wholeLength != aData.Length() )
+        {
+        HTI_LOG_TEXT( "ValidateAddObexMsgCommand: Error: wrong length of data" );
+        SendErrorMessageL( KErrArgument, KErrorInvalidParameters );
+        return EFalse;
+        }
+
+    return ETrue;
+    }
+
+// ----------------------------------------------------------------------------
+TBool CMessageMgmntHandler::ValidateAddSmartMsgCommand( const TDesC8& aData )
+    {
+    if ( aData.Length() < KAddSmartMsgCmdMinLength )
+        {
+        HTI_LOG_TEXT( "ValidateAddSmartMsgCommand: Error: missing data" );
+        SendErrorMessageL( KErrArgument, KErrorInvalidParameters );
+        return EFalse;
+        }
+
+    TInt offset = 0;
+    TInt fromToLength = aData[offset];
+
+    offset = 1 + fromToLength;
+    if ( offset > aData.Length() - 1 )
+        {
+        HTI_LOG_TEXT( "ValidateAddSmartMsgCommand: Error: wrong length of data" );
+        SendErrorMessageL( KErrArgument, KErrorInvalidParameters );
+        return EFalse;
+        }
+    TInt descrLength = aData[offset];
+
+    offset = offset + 1 + descrLength;
+    if ( offset > aData.Length() - 2 ) // body length in two bytes
+        {
+        HTI_LOG_TEXT( "ValidateAddSmartMsgCommand: Error: wrong length of data" );
+        SendErrorMessageL( KErrArgument, KErrorInvalidParameters );
+        return EFalse;
+        }
+    TInt bodyLength = aData[offset] + ( aData[offset+1] << 8 );
+
+    TInt wholeLength = 1 + fromToLength +
+                       1 + descrLength +
+                       2 + bodyLength +
+                       1 + // is new
+                       1 + // is unread
+                       1 + // folder
+                       4;  // biomessage uid
+
+    if ( wholeLength != aData.Length() )
+        {
+        HTI_LOG_TEXT( "ValidateAddSmartMsgCommand: Error: wrong length of data" );
+        SendErrorMessageL( KErrArgument, KErrorInvalidParameters );
+        return EFalse;
+        }
+
+    return ETrue;
+    }
+
+
+// ----------------------------------------------------------------------------
+// Extracts UTF-8 data, converts it to Unicode and returns as 16-bit descriptor.
+// Within aData, read descriptor from aPosition:
+//  - first bytes tell the size of data for UTF8 formatted data
+//  - next bytes are the data as indicated by the size
+//  - position is finally set to the end of UTF8 data area
+// ----------------------------------------------------------------------------
+HBufC16* CMessageMgmntHandler::ExtractDesLC( const TDesC8& aUtf8Data,
+                                             TInt& aPosition,
+                                             TInt aSizeBytes )
+    {
+    HTI_LOG_FUNC_IN( "CMessageMgmntHandler::ExtractDesLC" );
+    TInt length = 0;
+    for ( TInt i = 0; i < aSizeBytes; i++ )
+        {
+        length += ( aUtf8Data[aPosition+i] << ( i * 8 ) );
+        }
+
+    if ( length < 0 ||
+         length > aUtf8Data.Mid( aPosition ).Length() )
+        {
+        User::Leave( KErrBadDescriptor );
+        }
+
+    HBufC16* result = NULL;
+
+    if ( length > 0 )
+        {
+        result = CnvUtfConverter::ConvertToUnicodeFromUtf8L(
+            aUtf8Data.Mid( aPosition + aSizeBytes, length ) );
+        HTI_LOG_TEXT( "ExtractDesLC: Conversion to Unicode done" );
+        CleanupStack::PushL( result );
+        }
+
+    else
+        {
+        result = HBufC16::NewLC( 0 );
+        }
+
+    aPosition += ( aSizeBytes + length );
+
+    HTI_LOG_FUNC_OUT( "CMessageMgmntHandler::ExtractDesLC" );
+    return result;
+    }
+
+
+// ----------------------------------------------------------------------------
+// Extracts UTF-8 data to 8-bit descriptor without doing any conversions.
+// ----------------------------------------------------------------------------
+HBufC8* CMessageMgmntHandler::ExtractDes8LC( const TDesC8& aUtf8Data,
+                                             TInt& aPosition,
+                                             TInt aSizeBytes )
+    {
+    HTI_LOG_FUNC_IN( "CMessageMgmntHandler::ExtractDes8LC" );
+    TInt length = 0;
+    for ( TInt i = 0; i < aSizeBytes; i++ )
+        {
+        length += ( aUtf8Data[aPosition+i] << ( i * 8 ) );
+        }
+
+    if ( length < 0 ||
+         length > aUtf8Data.Mid( aPosition ).Length() )
+        {
+        User::Leave( KErrBadDescriptor );
+        }
+
+    HBufC8* result = HBufC8::NewLC( length );
+
+    if ( length > 0 )
+        {
+        result->Des().Copy( aUtf8Data.Mid( aPosition + aSizeBytes, length ) );
+        }
+
+    aPosition += ( aSizeBytes + length );
+
+    HTI_LOG_FUNC_OUT( "CMessageMgmntHandler::ExtractDes8LC" );
+    return result;
+    }
+
+
+// ----------------------------------------------------------------------------
+TMsvId CMessageMgmntHandler::MapFolderToIdL( TFolder aFolder )
+    {
+    TMsvId id = 0;
+
+    switch ( aFolder )
+        {
+        case EInbox:  { id = KMsvGlobalInBoxIndexEntryId;   break; }
+        case EDrafts: { id = KMsvDraftEntryId;              break; }
+        case ESent:   { id = KMsvSentEntryId;               break; }
+        case EOutbox: { id = KMsvGlobalOutBoxIndexEntryId;  break; }
+        default:      { User::Leave( KErrArgument );        break; }
+        }
+
+    return id;
+    }
+
+// ----------------------------------------------------------------------------
+TUid CMessageMgmntHandler::MapMessageTypeToUidL( TMessageType aType )
+    {
+    TUid uid = { 0 };
+
+    switch ( aType )
+        {
+        case ESMS:          { uid = KUidMsgTypeSMS;            break; }
+        case EAudioMessage: // fall through - audio msg is MMS sub type
+        case EMMS:          { uid = KUidMsgTypeMultimedia;     break; }
+        case ESmartMessage: { uid = KUidBIOMessageTypeMtm;     break; }
+        case EEmail:        { uid = KUidMsgTypeSMTP;           break; }
+        case EEmailPOP3:    { uid = KUidMsgTypePOP3;           break; }
+        case EEmailIMAP4:   { uid = KUidMsgTypeIMAP4;          break; }
+        case EIrMessage:    { uid = KUidMsgTypeIrUID;          break; }
+        case EBtMessage:    { uid = KUidMsgTypeBt;             break; }
+        default:            { User::Leave( KErrArgument );     break; }
+        }
+
+    return uid;
+    }
+
+// ----------------------------------------------------------------------------
+void CMessageMgmntHandler::HandleSessionEventL( TMsvSessionEvent /*aEvent*/,
+                                                TAny* /*aArg1*/,
+                                                TAny* /*aArg2*/,
+                                                TAny* /*aArg3*/ )
+    {
+    }
+
+
+
+// ----------------------------------------------------------------------------
+CWaiter* CWaiter::NewL( TInt aPriority )
+    {
+    CWaiter* self = new(ELeave) CWaiter( aPriority );
+    return self;
+    }
+
+// ----------------------------------------------------------------------------
+CWaiter* CWaiter::NewLC( TInt aPriority )
+    {
+    CWaiter* self = new(ELeave) CWaiter( aPriority );
+    CleanupStack::PushL( self );
+    return self;
+    }
+
+// ----------------------------------------------------------------------------
+CWaiter::CWaiter( TInt aPriority ) : CActive( aPriority )
+    {
+    CActiveScheduler::Add( this );
+    }
+
+// ----------------------------------------------------------------------------
+CWaiter::~CWaiter()
+    {
+    Cancel();
+    }
+
+// ----------------------------------------------------------------------------
+void CWaiter::StartAndWait()
+    {
+    iStatus = KRequestPending;
+    SetActive();
+    iWait.Start();
+    }
+
+// ----------------------------------------------------------------------------
+TInt CWaiter::Result() const
+    {
+    return iResult;
+    }
+
+// ----------------------------------------------------------------------------
+void CWaiter::RunL()
+    {
+    iResult = iStatus.Int();
+    iWait.AsyncStop();
+    }
+
+// ----------------------------------------------------------------------------
+void CWaiter::DoCancel()
+    {
+    iResult = KErrCancel;
+    if ( iStatus == KRequestPending )
+        {
+        TRequestStatus* status = &iStatus;
+        User::RequestComplete( status, KErrCancel );
+        }
+
+    iWait.AsyncStop();
+    }
+
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiServicePlugins/HtiMessagesServicePlugin/src/proxy.cpp	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,37 @@
+/*
+* 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 proxy for HtiMessagesServicePlugin service plugin dll
+*
+*/
+
+
+// INCLUDE FILES
+#include "HtiMessagesServicePlugin.h"
+
+#include <e32std.h>
+#include <ecom/implementationproxy.h>
+
+// Provides a key value pair table, this is used to identify
+// the correct construction function for the requested interface.
+const TImplementationProxy ImplementationTable[] =
+    {
+    IMPLEMENTATION_PROXY_ENTRY( 0x200212C6,  CHtiMessagesServicePlugin::NewL )
+    };
+
+// Function used to return an instance of the proxy table.
+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/htiui/HtiServicePlugins/HtiPIMServicePlugin/data/200212C3.rss	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,50 @@
+/*
+* 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:  Resource definitions for Personal data (vCard, vCalendar)
+*                service ECOM plugin.
+*
+*/
+
+
+// INCLUDES
+#include <ecom/registryinfo.rh>
+
+
+//  RESOURCE DEFINITIONS
+RESOURCE REGISTRY_INFO theInfo
+    {
+    // UID for the DLL
+    dll_uid = 0x200212C3;
+    // Declare array of interface info
+    interfaces =
+        {
+        INTERFACE_INFO
+            {
+            // UID of interface that is implemented
+            interface_uid = 0x1020DEB7;
+            implementations =
+                {
+                IMPLEMENTATION_INFO
+                    {
+                    implementation_uid = 0x200212C4;
+                    version_no         = 1;
+                    display_name       = "Personal information manager service";
+                    default_data       = "PIM";
+                    opaque_data        = "";
+                    }
+                };
+            }
+        };
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiServicePlugins/HtiPIMServicePlugin/group/HtiNpdHlp.mmp	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,40 @@
+/*
+* 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 description file for HtiNpdHlp
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+TARGET      HtiNpdHlp.exe
+TARGETTYPE  exe
+UID         0x1000008d 0x200212D5
+
+VENDORID    0x101FB657
+
+CAPABILITY      ALL -TCB
+
+SOURCE          ../src/HtiNpdHlp.cpp
+APP_LAYER_SYSTEMINCLUDE
+
+LIBRARY     euser.lib
+LIBRARY     efsrv.lib
+LIBRARY     cone.lib
+LIBRARY     npdlib.lib
+LIBRARY     flogger.lib
+
+SMPSAFE
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiServicePlugins/HtiPIMServicePlugin/group/HtiPIMServicePlugin.mmp	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,60 @@
+/*
+* 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 implementation of PIM service
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+TARGET          HtiPIMServicePlugin.dll
+TARGETTYPE      PLUGIN
+
+// ECom Dll recognition UID followed by the unique UID for this dll
+UID             0x10009D8D 0x200212C3
+
+VENDORID        0x101FB657
+
+CAPABILITY      ALL -TCB
+
+SOURCEPATH      ../src
+SOURCE          proxy.cpp
+SOURCE          HtiPIMServicePlugin.cpp
+SOURCE          PIMHandler.cpp
+SOURCE          HtiBookmarkHandler.cpp 
+SOURCE          HtiSimDirHandler.cpp
+
+USERINCLUDE     ../inc
+APP_LAYER_SYSTEMINCLUDE
+
+START RESOURCE  ../data/200212C3.rss
+TARGET          HtiPIMServicePlugin.rsc
+END
+
+LIBRARY         cmmanager.lib
+LIBRARY         apgrfx.lib
+LIBRARY         calinterimapi.lib
+LIBRARY         charconv.lib
+LIBRARY         ecom.lib
+LIBRARY         estor.lib
+LIBRARY         euser.lib
+LIBRARY         favouritesengine.lib
+LIBRARY         ws32.lib
+LIBRARY         flogger.lib
+LIBRARY         cntmodel.lib
+LIBRARY			etelmm.lib
+LIBRARY			etel.lib 
+SMPSAFE
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiServicePlugins/HtiPIMServicePlugin/group/bld.inf	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,28 @@
+/*
+* 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 file for HtiPIMServicePlugin
+*
+*/
+#include "../../../symbian_version.hrh"
+
+PRJ_PLATFORMS
+
+PRJ_EXPORTS
+
+PRJ_MMPFILES
+HtiPIMServicePlugin.mmp
+#if ( SYMBIAN_VERSION_SUPPORT < SYMBIAN_4 )
+HtiNpdHlp.mmp
+#endif
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiServicePlugins/HtiPIMServicePlugin/inc/HtiBookmarkHandler.h	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,122 @@
+/*
+* 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:  Class that handles browser bookmark creation and deletion.
+*
+*/
+
+
+#ifndef HTIBOOKMARKHANDLER_H
+#define HTIBOOKMARKHANDLER_H
+
+// INCLUDES
+#include <e32std.h>
+#include <favouriteslimits.h>
+#include <favouritessession.h>
+#include <HtiServicePluginInterface.h>
+
+// CONSTANTS
+const TInt KApMaxConnNameLength = 30;
+
+// MACROS
+
+// DATA TYPES
+
+// FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+// CLASS DECLARATION
+
+/**
+*  Class that handles browser bookmark creation and deletion.
+*/
+class CHtiBookmarkHandler : public CBase
+    {
+    public:
+
+        /**
+        * Two-phased constructor.
+        */
+        static CHtiBookmarkHandler* NewL();
+
+        /**
+        * Called when there is a message to be processed by this service.
+        * @param aMessage message body destinated to the servive
+        * @param aPriority message priority
+        */
+        void ProcessMessageL( const TDesC8& aMessage,
+            THtiMessagePriority aPriority );
+
+        /**
+        * Indicates whether this handler is ready to receive
+        * a new message or if it's busy processing previous message.
+        * @return ETrue if processing, EFalse if ready for new request
+        */
+        TBool IsBusy();
+
+        /**
+        * Destructor.
+        */
+        virtual ~CHtiBookmarkHandler();
+
+        /**
+        * Sets the dispatcher to send outgoing messages to.
+        * @param aDispatcher pointer to dispatcher instance
+        */
+        void SetDispatcher( MHtiDispatcher* aDispatcher );
+
+    private: // constructors
+
+        /**
+        * C++ default constructor.
+        */
+        CHtiBookmarkHandler();
+
+        /**
+        * 2nd phase constructor.
+        */
+        void ConstructL();
+
+    private: // helpers
+
+        void HandleCreateBookmarkL();
+        void HandleDeleteBookmarkL();
+        void ParseCreateMessageL( const TDesC8& aMessage );
+        void ParseDeleteMessageL( const TDesC8& aMessage );
+        TInt ExtractStringL( const TDesC8& aMessage, TInt aOffset,
+                             TInt aLengthBytes, TInt aMinLength,
+                             TInt aMaxLength, TDes& aResult );
+        TInt GetFolderUidL( const TDesC& aFolderName );
+        TInt GetApUidL( const TDesC& aApName );
+        void SendOkMsgL( const TDesC8& aData );
+        void SendErrorMessageL( TInt aError, const TDesC8& aDescription );
+
+    private: // data
+
+        // Pointer to the dispatcher (referenced)
+        MHtiDispatcher* iDispatcher;
+
+        // Session to the favourites engine
+        RFavouritesSession iFavSession;
+
+        // The parsed parameter values from the command messages
+        TBuf<KFavouritesMaxName>     iFolderName;
+        TBuf<KFavouritesMaxName>     iBookmarkName;
+        TBuf<KApMaxConnNameLength>   iApName;
+        TBuf<KFavouritesMaxUserName> iUserName;
+        TBuf<KFavouritesMaxPassword> iPassword;
+        HBufC*                       iUrl;
+    };
+
+#endif // HTIBOOKMARKHANDLER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiServicePlugins/HtiPIMServicePlugin/inc/HtiPIMServicePlugin.h	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,109 @@
+/*
+* 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 ECOM plug-in service interface. Provides
+*                PIM service (vCard & vCalendar import).
+*
+*/
+
+
+#ifndef CHTIPIMSERVICEPLUGIN_H
+#define CHTIPIMSERVICEPLUGIN_H
+
+// INCLUDES
+#include <HtiServicePluginInterface.h>
+#include <w32std.h>
+
+// CONSTANTS
+const TInt KPIMServiceUidValue = 0x10210CCD; // ECOM Implementation UID
+const TUid KPIMServiceUid = { KPIMServiceUidValue };
+
+// FORWARD DECLARATIONS
+class CPIMHandler;
+class CHtiBookmarkHandler;
+class CHtiSimDirHandler;
+// CLASS DECLARATION
+
+/**
+* Implementation of ECOM plug-in service interface.
+*/
+class CHtiPIMServicePlugin : public CHTIServicePluginInterface
+    {
+    public:
+
+        enum TCommand
+            {
+            EImportVCard            = 0x01,
+            EImportVCalendar        = 0x02,
+
+            EDeleteContact          = 0x03,
+            EDeleteCalendar         = 0x04,
+
+            ENotepadAddMemo         = 0x05,
+            ENotepadAddMemoFromFile = 0x06,
+            ENotepadDeleteAll       = 0x07,
+
+            EOpenCalendarFile       = 0x08,
+            EListCalendarFiles      = 0x09,
+            
+            ESimCardInfo            = 0x10,
+            EImportSimContact       = 0x11,
+            EDeleteSimContact       = 0x12,
+
+            ECreateBookmark         = 0x1A,
+            EDeleteBookmark         = 0x1B,
+
+            EResultOk               = 0xFF // only for response message
+            };
+
+    public:
+
+        static CHtiPIMServicePlugin* NewL();
+
+        // Interface implementation
+
+        /**
+        * From CHTIServicePluginInterface
+        * Called by the HTI Framework when sending message to this service.
+        * @param aMessage message body destinated to a servive
+        * @param aPriority message priority
+        */
+        void ProcessMessageL( const TDesC8& aMessage,
+            THtiMessagePriority aPriority );
+
+        /**
+        * From CHTIServicePluginInterface
+        * Indicates to HTI Framework whether the plugin is ready to process
+        * a new message or if it's busy processing previous message.
+        * @return ETrue if processing, EFalse if ready for new request
+        */
+        TBool IsBusy();
+
+
+    protected:
+
+        CHtiPIMServicePlugin();
+        void ConstructL();
+
+        virtual ~CHtiPIMServicePlugin();
+
+    private:
+
+        CPIMHandler* iPimHandler;
+        CHtiBookmarkHandler* iBookmarkHandler;
+        CHtiSimDirHandler* iSimDirHandler;
+        };
+
+#endif // CHTIPIMSERVICEPLUGIN_H
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiServicePlugins/HtiPIMServicePlugin/inc/HtiSimDirHandler.h	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +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:  Class that handles SIM card contacts creation and deletion
+*                using the new Virtual Phonebook API
+*
+*/
+
+
+#ifndef HTISIMDIRHANDLER_H
+#define HTISIMDIRHANDLER_H
+
+
+// INCLUDES
+
+#include <HtiServicePluginInterface.h>
+#include <etelmm.h>
+
+// CONSTANTS
+
+// MACROS
+
+// DATA TYPES
+
+// FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+// CLASS DECLARATION
+
+/**
+*  Class that handles SIM card contacts creation and deletion using the
+*  new Virtual Phonebook API.
+*/
+class CHtiSimDirHandler : public CBase
+    {
+    public:
+
+    enum TContactFieldType
+        {
+        ENameField        = 0x01,
+        ESecondNameField  = 0x02,
+        EPhoneNumberField = 0x03,
+        EEMailField       = 0x04,
+        EAdditNumberField = 0x05
+        };
+
+    public:
+
+        /**
+        * Two-phased constructor.
+        */
+        static CHtiSimDirHandler* NewL();
+
+        /**
+        * Called when there is a message to be processed by this service.
+        * @param aMessage message body destinated to the servive
+        * @param aPriority message priority
+        */
+        void ProcessMessageL( const TDesC8& aMessage,
+            THtiMessagePriority aPriority );
+
+        /**
+        * Indicates whether this handler is ready to receive
+        * a new message or if it's busy processing previous message.
+        * @return ETrue if processing, EFalse if ready for new request
+        */
+        TBool IsBusy();
+
+        /**
+        * Destructor.
+        */
+        virtual ~CHtiSimDirHandler();
+
+        /**
+        * Sets the dispatcher to send outgoing messages to.
+        * @param aDispatcher pointer to dispatcher instance
+        */
+        void SetDispatcher( MHtiDispatcher* aDispatcher );
+
+    private: // constructors
+
+        /**
+        * C++ default constructor.
+        */
+        CHtiSimDirHandler();
+
+        /**
+        * 2nd phase constructor.
+        */
+        void ConstructL();
+
+    private: // helpers
+
+        void HandleSimCardInfoL(const TDesC8& aData);
+        void HandleSimContactImportL(const TDesC8& aData);
+        void HandleSimContactDeleteL(const TDesC8& aData);
+
+        TBool CheckImportMsg(const TDesC8& aData);
+
+        void SendOkMsgL( const TDesC8& aData );
+        void SendErrorMessageL( TInt aError, const TDesC8& aDescription );
+
+    private: // data
+
+        // Pointer to the dispatcher (referenced)
+        MHtiDispatcher* iDispatcher;
+
+        // Flag indicating if service is busy processing a request
+        TBool iIsBusy;
+        
+        RTelServer iEtelServer;
+        RMobilePhone iEtelPhone;
+        RMobilePhoneBookStore iEtelStore;
+
+        TBool iStoreIsOpen;
+    };
+
+#endif // HTISIMDIRHANDLER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiServicePlugins/HtiPIMServicePlugin/inc/PIMHandler.h	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,91 @@
+/*
+* 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:  Functional implentation of PIM service.
+*
+*/
+
+
+#ifndef CPIMHANDLER_H
+#define CPIMHANDLER_H
+
+// INCLUDES
+#include <e32base.h>
+#include <s32mem.h>
+#include <HtiServicePluginInterface.h>
+#include <calprogresscallback.h>
+
+// CONSTANTS
+
+// FORWARD DECLARATIONS
+class CCalSession;
+
+// CLASS DECLARATION
+
+/**
+*  Functional implentation of PIM service.
+*/
+class CPIMHandler : public CBase,
+                    public MCalProgressCallBack
+    {
+    public:
+
+        static CPIMHandler* NewL();
+
+        // Interface implementation
+        void ProcessMessageL( const TDesC8& aMessage,
+            THtiMessagePriority aPriority );
+
+        TBool IsBusy();
+
+        virtual ~CPIMHandler();
+
+        void SetDispatcher( MHtiDispatcher* aDispatcher );
+      
+
+        // From MCalProgressCallBack
+
+        void Progress( TInt aPercentageCompleted );
+        void Completed( TInt aError );
+        TBool NotifyProgress();
+
+    private:
+
+        CPIMHandler();
+        void ConstructL();
+
+    private: // helpers
+
+        void HandleVCardImportFuncL( const TDesC8& aData );
+        void HandleVCalendarImportFuncL( const TDesC8& aData );
+        void HandleContactDeleteFuncL( const TDesC8& aData );
+        void HandleCalendarDeleteFuncL( const TDesC8& aData );
+        void HandleOpenCalendarFileL( const TDesC8& aData );
+        void HandleListCalendarFilesL();
+        void HandleNotepadAddMemoFuncL( const TDesC8& aData );
+        void HandleNotepadAddMemoFromFileFuncL( const TDesC8& aData );
+        void HandleNotepadDeleteAllFuncL();
+        
+        void SendOkMsgL( const TDesC8& aData );
+        void SendNotepadOkMsgL( CHtiPIMServicePlugin::TCommand aCommand );
+        void SendErrorMessageL( TInt aError, const TDesC8& aDescription );
+
+    private: // data
+        TBool                 iIsBusy;
+        MHtiDispatcher*       iDispatcher; // referenced
+        CActiveSchedulerWait* iWaiter;
+        TInt                  iEntryViewErr;
+        CCalSession*          iCalSession;
+    };
+
+#endif // CPIMHANDLER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiServicePlugins/HtiPIMServicePlugin/src/HtiBookmarkHandler.cpp	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,702 @@
+/*
+* 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 browser bookmark handling.
+*
+*/
+
+
+// INCLUDE FILES
+#include "HtiBookmarkHandler.h"
+#include "HtiPIMServicePlugin.h"
+
+#include <cmconnectionmethod.h>
+#include <cmconnectionmethoddef.h>
+#include <cmdestination.h>
+#include <cmmanager.h>
+
+#include <favouritesitem.h>
+#include <favouritesitemlist.h>
+#include <favouritesdb.h>
+#include <favouritesfile.h>
+#include <favouriteswapap.h>
+
+#include <HtiDispatcherInterface.h>
+#include <HtiLogging.h>
+
+// EXTERNAL DATA STRUCTURES
+
+// EXTERNAL FUNCTION PROTOTYPES
+
+// CONSTANTS
+
+// MACROS
+
+// LOCAL CONSTANTS AND MACROS
+_LIT8( KErrorUnrecognizedCommand, "Unrecognized command" );
+_LIT8( KErrorInvalidParameters, "Invalid command parameters" );
+_LIT8( KErrorCreateFailed, "Bookmark creation failed" );
+_LIT8( KErrorDeleteFailed, "Bookmark deletion failed" );
+_LIT8( KErrorBookmarkNotFound, "Bookmark not found" );
+_LIT8( KErrorFolderNotFound, "Folder not found" );
+_LIT8( KErrorApNotFound, "Access point not found" );
+_LIT8( KErrorFolderSearchFailed, "Error when searching folder" );
+_LIT8( KErrorApSearchFailed, "Error when searching access point" );
+
+const TInt KCreateMessageMinLength = 10;
+const TInt KDeleteMessageMinLength = 3;
+
+// MODULE DATA STRUCTURES
+
+// LOCAL FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CHtiBookmarkHandler::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+CHtiBookmarkHandler* CHtiBookmarkHandler::NewL()
+    {
+    HTI_LOG_FUNC_IN( "CHtiBookmarkHandler::NewL" );
+    CHtiBookmarkHandler* self = new ( ELeave ) CHtiBookmarkHandler();
+    CleanupStack::PushL ( self );
+    self->ConstructL();
+    CleanupStack::Pop();
+    HTI_LOG_FUNC_OUT( "CHtiBookmarkHandler::NewL" );
+    return self;
+    }
+
+
+// ----------------------------------------------------------------------------
+// CHtiBookmarkHandler::CHtiBookmarkHandler
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// ----------------------------------------------------------------------------
+CHtiBookmarkHandler::CHtiBookmarkHandler()
+    {
+    HTI_LOG_FUNC_IN( "CHtiBookmarkHandler::CHtiBookmarkHandler" );
+    HTI_LOG_FUNC_OUT( "CHtiBookmarkHandler::CHtiBookmarkHandler" );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CHtiBookmarkHandler::~CHtiBookmarkHandler
+// Destructor.
+// -----------------------------------------------------------------------------
+CHtiBookmarkHandler::~CHtiBookmarkHandler()
+    {
+    HTI_LOG_FUNC_IN( "CHtiBookmarkHandler::~CHtiBookmarkHandler" );
+    delete iUrl;
+    iFavSession.Close();
+    HTI_LOG_FUNC_OUT( "CHtiBookmarkHandler::~CHtiBookmarkHandler" );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CHtiBookmarkHandler::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+void CHtiBookmarkHandler::ConstructL()
+    {
+    HTI_LOG_FUNC_IN( "CHtiBookmarkHandler::ConstructL" );
+    User::LeaveIfError( iFavSession.Connect() );
+    HTI_LOG_FUNC_OUT( "CHtiBookmarkHandler::ConstructL" );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CHtiBookmarkHandler::SetDispatcher
+// Sets the dispatcher pointer.
+// -----------------------------------------------------------------------------
+
+void CHtiBookmarkHandler::SetDispatcher( MHtiDispatcher* aDispatcher )
+    {
+    HTI_LOG_FUNC_IN( "CHtiBookmarkHandler::SetDispatcher" );
+    iDispatcher = aDispatcher;
+    HTI_LOG_FUNC_OUT( "CHtiBookmarkHandler::SetDispatcher" );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CHtiBookmarkHandler::ProcessMessageL
+// Parses the received message and calls handler functions.
+// -----------------------------------------------------------------------------
+void CHtiBookmarkHandler::ProcessMessageL( const TDesC8& aMessage,
+    THtiMessagePriority /*aPriority*/ )
+    {
+    HTI_LOG_FUNC_IN( "CHtiBookmarkHandler::ProcessMessageL" );
+    // Zero legth of aMessage tested already in CHtiPIMServicePlugin.
+    // Other sanity checks must be done here.
+    if ( aMessage[0] == CHtiPIMServicePlugin::ECreateBookmark )
+        {
+        TRAPD( err, ParseCreateMessageL( aMessage ) );
+        if ( err != KErrNone )
+            {
+            SendErrorMessageL( KErrArgument, KErrorInvalidParameters );
+            }
+        else
+            {
+            TRAP( err, HandleCreateBookmarkL() );
+            if ( err != KErrNone )
+                {
+                SendErrorMessageL( err, KErrorCreateFailed );
+                }
+            }
+        }
+
+    else if ( aMessage[0] == CHtiPIMServicePlugin::EDeleteBookmark )
+        {
+        TRAPD( err, ParseDeleteMessageL( aMessage ) );
+        if ( err != KErrNone )
+            {
+            SendErrorMessageL( KErrArgument, KErrorInvalidParameters );
+            }
+        else
+            {
+            TRAP( err, HandleDeleteBookmarkL() );
+            if ( err != KErrNone )
+                {
+                SendErrorMessageL( err, KErrorDeleteFailed );
+                }
+            }
+        }
+
+    else
+        {
+        SendErrorMessageL( KErrArgument, KErrorUnrecognizedCommand );
+        }
+    HTI_LOG_FUNC_OUT( "CHtiBookmarkHandler::ProcessMessageL" );
+    }
+
+
+// ----------------------------------------------------------------------------
+// CHtiBookmarkHandler::IsBusy
+// Returns the status whether this handler is busy processing a request.
+// ----------------------------------------------------------------------------
+TBool CHtiBookmarkHandler::IsBusy()
+    {
+    // Never busy if ProcessMessageL has completed.
+    return EFalse;
+    }
+
+
+// ----------------------------------------------------------------------------
+// CHtiBookmarkHandler::HandleCreateBookmarkL
+// Handles the bookmark and/or folder creation command.
+// ----------------------------------------------------------------------------
+void CHtiBookmarkHandler::HandleCreateBookmarkL()
+    {
+    HTI_LOG_FUNC_IN( "CHtiBookmarkHandler::HandleCreateBookmarkL" );
+    TInt err = KErrNone;
+    // If folder given, get the UID if it exists
+    TInt folderUid = KFavouritesRootUid;
+    if ( iFolderName.Length() > 0 )
+        {
+        TRAP( err, folderUid = GetFolderUidL( iFolderName ) );
+        if ( err != KErrNone )
+            {
+            SendErrorMessageL( err, KErrorFolderSearchFailed );
+            return;
+            }
+        }
+    HTI_LOG_FORMAT( "Folder UID = %d", folderUid );
+
+    // If access point given, search the UID. It's an error if AP is not found.
+    TInt apUid = KErrNotFound;
+    if ( iApName.Length() > 0 )
+        {
+        TRAP( err, apUid = GetApUidL( iApName ) );
+        if ( err != KErrNone )
+            {
+            SendErrorMessageL( err, KErrorApSearchFailed );
+            return;
+            }
+        if ( apUid == KErrNotFound )
+            {
+            SendErrorMessageL( KErrNotFound, KErrorApNotFound );
+            return;
+            }
+        }
+
+    RFavouritesDb db;
+    User::LeaveIfError( db.Open( iFavSession, KBrowserBookmarks ) );
+    CleanupClosePushL<RFavouritesDb>( db );
+
+    TInt itemsCreated = 0;
+    // If folder was given but was not found, create the folder first.
+    if ( iFolderName.Length() > 0 && folderUid == KErrNotFound )
+        {
+        CFavouritesItem* folder = CFavouritesItem::NewLC();
+        folder->SetType( CFavouritesItem::EFolder );
+        folder->SetParentFolder( KFavouritesRootUid ) ;
+        folder->SetNameL( iFolderName );
+
+        HTI_LOG_TEXT( "Adding the folder item to DB" );
+        err = db.Add( *folder, EFalse );
+        HTI_LOG_FORMAT( "Add returned %d", err );
+        if ( err != KErrNone )
+            {
+            User::Leave( err );
+            }
+        folderUid = folder->Uid();
+        HTI_LOG_FORMAT( "New folder UID = %d", folderUid );
+        CleanupStack::PopAndDestroy(); // folder
+        itemsCreated++;
+        }
+
+    // Now create the actual bookmark item
+    CFavouritesItem* item = CFavouritesItem::NewLC();
+    item->SetType( CFavouritesItem::EItem );
+    item->SetParentFolder( folderUid ) ;
+    item->SetNameL( iBookmarkName );
+    item->SetUrlL( *iUrl );
+    if ( apUid != KErrNotFound )
+        {
+        TFavouritesWapAp favAp;
+        favAp.SetApId(  ( TUint32 ) apUid );
+        item->SetWapAp( favAp );
+        }
+    if ( iUserName.Length() > 0 )
+        {
+        item->SetUserNameL( iUserName );
+        }
+    if ( iPassword.Length() > 0 )
+        {
+        item->SetPasswordL( iPassword );
+        }
+
+    HTI_LOG_TEXT( "Adding the bookmark item to DB" );
+    err = db.Add( *item, EFalse );
+    HTI_LOG_FORMAT( "Add returned %d", err );
+    if ( err )
+        {
+        User::Leave( err );
+        }
+    HTI_LOG_FORMAT( "Bookmark UID = %d", item->Uid() );
+    CleanupStack::PopAndDestroy(); // item
+    itemsCreated++;
+
+    CleanupStack::PopAndDestroy(); // db
+
+    TBuf8<1> response;
+    response.Append( itemsCreated );
+    SendOkMsgL( response );
+
+    HTI_LOG_FUNC_OUT( "CHtiBookmarkHandler::HandleCreateBookmarkL" );
+    }
+
+
+// ----------------------------------------------------------------------------
+// CHtiBookmarkHandler::HandleDeleteBookmarkL
+// Handles the bookmark and/or folder deletion.
+// ----------------------------------------------------------------------------
+void CHtiBookmarkHandler::HandleDeleteBookmarkL()
+    {
+    HTI_LOG_FUNC_IN( "CHtiBookmarkHandler::HandleDeleteBookmarkL" );
+    TInt err = KErrNone;
+    // If folder given, get the UID if it exists.
+    // It is an error if the given folder does not exist.
+    TInt folderUid = KFavouritesRootUid;
+    if ( iFolderName.Length() > 0 )
+        {
+        TRAP( err, folderUid = GetFolderUidL( iFolderName ) );
+        if ( err != KErrNone )
+            {
+            SendErrorMessageL( err, KErrorFolderSearchFailed );
+            return;
+            }
+        if ( folderUid == KErrNotFound )
+            {
+            SendErrorMessageL( KErrNotFound, KErrorFolderNotFound );
+            return;
+            }
+        }
+    HTI_LOG_FORMAT( "Folder UID = %d", folderUid );
+
+    RFavouritesDb db;
+    User::LeaveIfError( db.Open( iFavSession, KBrowserBookmarks ) );
+    CleanupClosePushL<RFavouritesDb>( db );
+
+    CArrayFixFlat<TInt>* deleteList = new ( ELeave ) CArrayFixFlat<TInt>( 10 );
+    CleanupStack::PushL( deleteList );
+    if ( iBookmarkName.Length() > 0 )
+        {
+        // Get the UID of bookmark item matching to iBookmarkName
+        // It is an error if nothing found.
+        CFavouritesItemList* items = new ( ELeave ) CFavouritesItemList();
+        CleanupStack::PushL( items );
+        User::LeaveIfError( db.GetAll( *items, folderUid,
+            CFavouritesItem::EItem ) );
+        TInt uid = KErrNotFound;
+        TInt itemCount = items->Count();
+        HTI_LOG_FORMAT( "Found %d items", itemCount );
+        TInt i = 0;
+        while ( uid == KErrNotFound && i < itemCount )
+            {
+            if ( ( *items )[i]->Name().CompareF( iBookmarkName ) == 0 )
+                {
+                uid = ( *items )[i]->Uid();
+                }
+            i++;
+            }
+        CleanupStack::PopAndDestroy(); // items
+        HTI_LOG_FORMAT( "Matching item UID: %d", uid );
+        if ( uid == KErrNotFound )
+            {
+            SendErrorMessageL( KErrNotFound, KErrorBookmarkNotFound );
+            CleanupStack::PopAndDestroy( 2 ); // deleteList, db
+            return;
+            }
+        else
+            {
+            deleteList->AppendL( uid );
+            }
+        }
+    else
+        {
+        // We are deleting a folder (whose UID we already have) or deleting all.
+        if ( folderUid != KFavouritesRootUid )
+            {
+            deleteList->AppendL( folderUid );
+            }
+        else
+            {
+            // We don't have folder or bookmark name - deleting all
+            User::LeaveIfError( db.GetUids( *deleteList, KFavouritesRootUid ) );
+            HTI_LOG_FORMAT( "Found %d matching items", deleteList->Count() );
+            }
+        }
+
+    TInt beginningCount = KErrNotFound;
+    User::LeaveIfError( db.Count( beginningCount ) );
+    HTI_LOG_FORMAT( "Items in DB before delete: %d", beginningCount );
+
+    // Start deleting
+    TInt deleteCount = 0;
+    for ( TInt i = 0; i < deleteList->Count(); i++ )
+        {
+        HTI_LOG_FORMAT( "Deleting with UID %d", ( *deleteList )[i] );
+        err = db.Delete( ( *deleteList )[i] );
+        HTI_LOG_FORMAT( "Delete returned %d", err );
+        if ( err == KErrNone )
+            {
+            deleteCount++;
+            }
+        if ( err != KErrNone && err != KErrAccessDenied )
+            {
+            HTI_LOG_TEXT( "Unexpected error when deleting - leaving" );
+            User::Leave( err );
+            }
+        }
+
+    TInt endingCount = KErrNotFound;
+    User::LeaveIfError( db.Count( endingCount ) );
+    HTI_LOG_FORMAT( "Items in DB after delete: %d", endingCount );
+
+    CleanupStack::PopAndDestroy( 2 ); // deleteList, db
+
+    TBuf8<1> response;
+    response.Append( beginningCount - endingCount );
+    SendOkMsgL( response );
+
+    HTI_LOG_FUNC_OUT( "CHtiBookmarkHandler::HandleDeleteBookmarkL" );
+    }
+
+
+// ----------------------------------------------------------------------------
+// CHtiBookmarkHandler::ParseCreateMessageL
+// Extracts the parameters from a create bookmark message.
+// ----------------------------------------------------------------------------
+void CHtiBookmarkHandler::ParseCreateMessageL( const TDesC8& aMessage )
+    {
+    HTI_LOG_FUNC_IN( "CHtiBookmarkHandler::ParseCreateMessageL" );
+    TInt length = aMessage.Length();
+    HTI_LOG_FORMAT( "CreateBookmark message length = %d", length );
+
+    if ( length < KCreateMessageMinLength )
+        {
+        User::Leave( KErrArgument );
+        }
+
+    // Extract folder name
+    TInt offset = 1; // skip the command code in position 0
+    offset = ExtractStringL( aMessage, offset, 1, 0, KFavouritesMaxName,
+                             iFolderName );
+    HTI_LOG_FORMAT( "Folder name: %S", &iFolderName );
+
+    // Extract bookmark name
+    offset = ExtractStringL( aMessage, offset, 1, 1, KFavouritesMaxName,
+                             iBookmarkName );
+    HTI_LOG_FORMAT( "Bookmark name: %S", &iBookmarkName );
+
+    // Extract URL
+    delete iUrl;
+    iUrl = NULL;
+    iUrl = HBufC::NewL( KFavouritesMaxUrl );
+    TPtr urlPtr = iUrl->Des();
+    offset = ExtractStringL( aMessage, offset, 2, 1, KFavouritesMaxUrl,
+                             urlPtr );
+    HTI_LOG_FORMAT( "URL: %S", iUrl );
+
+    // Extract AP name
+    offset = ExtractStringL( aMessage, offset, 1, 0, KApMaxConnNameLength,
+                             iApName );
+    HTI_LOG_FORMAT( "AP name: %S", &iApName );
+
+    // Extract user name
+    offset = ExtractStringL( aMessage, offset, 1, 0, KFavouritesMaxUserName,
+                             iUserName );
+    HTI_LOG_FORMAT( "User name: %S", &iUserName );
+
+    // Extract password
+    offset = ExtractStringL( aMessage, offset, 1, 0, KFavouritesMaxPassword,
+                             iPassword );
+    HTI_LOG_FORMAT( "Password: %S", &iPassword );
+
+    // Check that there's no extra data
+    if ( offset != length  )
+        {
+        User::Leave( KErrArgument );
+        }
+
+    HTI_LOG_FUNC_OUT( "CHtiBookmarkHandler::ParseCreateMessageL" );
+    }
+
+
+// ----------------------------------------------------------------------------
+// CHtiBookmarkHandler::ParseDeleteMessageL
+// Extracts the parameters from a delete bookmark message.
+// ----------------------------------------------------------------------------
+void CHtiBookmarkHandler::ParseDeleteMessageL( const TDesC8& aMessage )
+    {
+    HTI_LOG_FUNC_IN( "CHtiBookmarkHandler::ParseDeleteMessageL" );
+    TInt length = aMessage.Length();
+    HTI_LOG_FORMAT( "DeleteBookmark message length = %d", length );
+
+    if ( length < KDeleteMessageMinLength )
+        {
+        User::Leave( KErrArgument );
+        }
+
+    // Extract folder name
+    TInt offset = 1; // skip the command code in position 0
+    offset = ExtractStringL( aMessage, offset, 1, 0, KFavouritesMaxName,
+                             iFolderName );
+    HTI_LOG_FORMAT( "Folder name: %S", &iFolderName );
+
+    // Extract bookmark name
+    offset = ExtractStringL( aMessage, offset, 1, 0, KFavouritesMaxName,
+                             iBookmarkName );
+    HTI_LOG_FORMAT( "Bookmark name: %S", &iBookmarkName );
+
+    HTI_LOG_FUNC_OUT( "CHtiBookmarkHandler::ParseDeleteMessageL" );
+    }
+
+
+// ----------------------------------------------------------------------------
+// CHtiBookmarkHandler::ExtractStringL
+// Extract one string from the given message. Leaves on syntax errors.
+// ----------------------------------------------------------------------------
+TInt CHtiBookmarkHandler::ExtractStringL( const TDesC8& aMessage, TInt aOffset,
+        TInt aLengthBytes, TInt aMinLength, TInt aMaxLength, TDes& aResult )
+    {
+    HTI_LOG_FUNC_IN( "CHtiBookmarkHandler::ExtractStringL" );
+    __ASSERT_ALWAYS( aResult.MaxLength() >= aMaxLength,
+                     User::Panic( _L( "HtiPimAssert" ), 1 ) );
+    __ASSERT_ALWAYS( aLengthBytes > 0, User::Panic( _L( "HtiPimAssert" ), 2 ) );
+
+    TInt length = aMessage.Length();
+    if ( length < aOffset + 1 )
+        {
+        User::Leave( KErrArgument );
+        }
+    TInt parseLength = aMessage[aOffset];
+    aOffset++;
+    if ( aLengthBytes > 1 )
+        {
+        for ( TInt i = 1; i < aLengthBytes; i++ )
+            {
+            parseLength += aMessage[aOffset] << ( i * 8 );
+            aOffset++;
+            }
+        }
+    HTI_LOG_FORMAT( "Parse length = %d", parseLength );
+    if ( parseLength < aMinLength  || parseLength > aMaxLength ||
+         parseLength + aOffset > length )
+        {
+        User::Leave( KErrArgument );
+        }
+    else
+        {
+        aResult.Copy( aMessage.Mid( aOffset, parseLength ) );
+        aOffset += parseLength;
+        }
+    HTI_LOG_FUNC_OUT( "CHtiBookmarkHandler::ExtractStringL" );
+    return aOffset;
+    }
+
+
+// ----------------------------------------------------------------------------
+// CHtiBookmarkHandler::GetFolderUidL
+// Finds the UID of the named folder if it exists.
+// ----------------------------------------------------------------------------
+TInt CHtiBookmarkHandler::GetFolderUidL( const TDesC& aFolderName )
+    {
+    HTI_LOG_FUNC_IN( "CHtiBookmarkHandler::GetFolderUidL" );
+    HTI_LOG_FORMAT( "Searching folder %S", &aFolderName );
+    RFavouritesDb db;
+    User::LeaveIfError( db.Open( iFavSession, KBrowserBookmarks ) );
+    CleanupClosePushL<RFavouritesDb>( db );
+
+    /* Doing the name matching ourselves 'cause giving the name match pattern
+     * parameter to GetAll or GetUids methods crashes the favourites server.
+     */
+    CFavouritesItemList* folders = new ( ELeave ) CFavouritesItemList();
+    CleanupStack::PushL( folders );
+    User::LeaveIfError( db.GetAll( *folders, KFavouritesNullUid,
+        CFavouritesItem::EFolder ) );
+    TInt uid = KErrNotFound;
+    TInt folderCount = folders->Count();
+    HTI_LOG_FORMAT( "Found %d folders", folderCount );
+    TInt i = 0;
+    while ( uid == KErrNotFound && i < folderCount )
+        {
+        if ( ( *folders )[i]->Name().CompareF( aFolderName ) == 0 )
+            {
+            uid = ( *folders )[i]->Uid();
+            }
+        i++;
+        }
+
+    CleanupStack::PopAndDestroy( 2 ); // folders, db
+    HTI_LOG_FORMAT( "Matching UID: %d", uid );
+    HTI_LOG_FUNC_OUT( "CHtiBookmarkHandler::GetFolderUidL" );
+    return uid;
+    }
+
+
+// ----------------------------------------------------------------------------
+// CHtiBookmarkHandler::GetApUidL
+// Gets the WAP Access Point ID of access point named by iConnName.
+// Favourites item needs the WAP ID for identifying access point.
+// Returns KErrNotFound if AP not found.
+// ----------------------------------------------------------------------------
+TInt CHtiBookmarkHandler::GetApUidL( const TDesC& aApName )
+    {
+    HTI_LOG_FUNC_IN( "CHtiBookmarkHandler::GetApUidL" );
+    TInt uid = KErrNotFound;
+
+    RCmManager cmManager;
+    cmManager.OpenL();
+    CleanupClosePushL( cmManager );
+
+    // Search from uncategorised first
+    RArray<TUint32> array = RArray<TUint32>();
+    cmManager.ConnectionMethodL( array );
+    CleanupClosePushL( array );
+    TInt i = 0;
+    while ( i < array.Count() && uid == KErrNotFound )
+        {
+        RCmConnectionMethod cm = cmManager.ConnectionMethodL( array[i] );
+        CleanupClosePushL( cm );
+        HBufC* name = cm.GetStringAttributeL( CMManager::ECmName );
+        HTI_LOG_FORMAT( "Found name: %S", name );
+        CleanupStack::PushL( name );
+        if ( aApName.Compare( *name ) == 0 )
+            {
+            uid = cm.GetIntAttributeL( CMManager::ECmWapId );
+            HTI_LOG_FORMAT( "Match: UID = %d", uid );
+            }
+        CleanupStack::PopAndDestroy(); // name
+        CleanupStack::PopAndDestroy(); // cm
+        i++;
+        }
+    CleanupStack::PopAndDestroy(); // array
+
+    // If not found from uncategorised, search from all destinations
+    if ( uid == KErrNotFound )
+        {
+        HTI_LOG_TEXT( "Not found from uncategorised" );
+        RArray<TUint32> destIdArray = RArray<TUint32>();
+        cmManager.AllDestinationsL( destIdArray );
+        CleanupClosePushL( destIdArray );
+        i = 0;
+        while ( i < destIdArray.Count() && uid == KErrNotFound )
+            {
+            RCmDestination dest = cmManager.DestinationL( destIdArray[i] );
+            CleanupClosePushL( dest );
+            TInt j = 0;
+            while ( j < dest.ConnectionMethodCount() && uid == KErrNotFound )
+                {
+                HBufC* name = dest.ConnectionMethodL( j ).GetStringAttributeL(
+                        CMManager::ECmName );
+                CleanupStack::PushL( name );
+                HTI_LOG_FORMAT( "Found name: %S", name );
+                if ( aApName.Compare( *name ) == 0 )
+                    {
+                    uid = dest.ConnectionMethodL( j ).GetIntAttributeL(
+                            CMManager::ECmWapId );
+                    HTI_LOG_FORMAT( "Match: UID = %d", uid );
+                    }
+                CleanupStack::PopAndDestroy(); // name
+                j++;
+                }
+            CleanupStack::PopAndDestroy(); // dest
+            i++;
+            }
+        CleanupStack::PopAndDestroy(); // destIdArray
+        }
+
+    CleanupStack::PopAndDestroy(); // cmManager
+    HTI_LOG_FUNC_OUT( "CHtiBookmarkHandler::GetApUidL" );
+    return uid;
+    }
+
+
+// ----------------------------------------------------------------------------
+// CHtiBookmarkHandler::SendOkMsgL
+// Helper function for sending response messages.
+// ----------------------------------------------------------------------------
+void CHtiBookmarkHandler::SendOkMsgL( const TDesC8& aData )
+    {
+    HTI_LOG_FUNC_IN( "CHtiBookmarkHandler::SendOkMsgL" );
+    User::LeaveIfNull( iDispatcher );
+    HBufC8* temp = HBufC8::NewL( aData.Length() + 1 );
+    TPtr8 response = temp->Des();
+    response.Append( ( TChar ) CHtiPIMServicePlugin::EResultOk );
+    response.Append( aData );
+    User::LeaveIfError( iDispatcher->DispatchOutgoingMessage(
+        temp, KPIMServiceUid ) );
+    HTI_LOG_FUNC_OUT( "CHtiBookmarkHandler::SendOkMsgL" );
+    }
+
+
+// ----------------------------------------------------------------------------
+// CHtiBookmarkHandler::SendErrorMessageL
+// Helper function for sending error response messages.
+// ----------------------------------------------------------------------------
+void CHtiBookmarkHandler::SendErrorMessageL( TInt aError,
+        const TDesC8& aDescription )
+    {
+    HTI_LOG_FUNC_IN( "CHtiBookmarkHandler::SendErrorMessageL" );
+    User::LeaveIfNull( iDispatcher );
+    User::LeaveIfError( iDispatcher->DispatchOutgoingErrorMessage(
+        aError, aDescription, KPIMServiceUid ) );
+    HTI_LOG_FUNC_OUT( "CHtiBookmarkHandler::SendErrorMessageL" );
+    }
+
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiServicePlugins/HtiPIMServicePlugin/src/HtiNpdHlp.cpp	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,237 @@
+/*
+* 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:  HtiNpdHlp implementation.
+*
+*/
+
+
+// INCLUDE FILES
+#include <e32base.h>
+#include <NpdApi.h>
+#include <eikenv.h>
+
+
+#ifdef __ENABLE_LOGGING__
+
+#include <flogger.h>
+_LIT( KLogFolder, "hti" );
+_LIT( KLogFile,   "HtiNpdHlp.txt" );
+
+#define HTI_LOG_TEXT(a1) {_LIT(temp, a1); RFileLogger::Write(KLogFolder, KLogFile, EFileLoggingModeAppend, temp);}
+#define HTI_LOG_DES(a1) {RFileLogger::Write(KLogFolder, KLogFile, EFileLoggingModeAppend, a1);}
+#define HTI_LOG_FORMAT(a1,a2) {_LIT(temp, a1); RFileLogger::WriteFormat(KLogFolder, KLogFile, EFileLoggingModeAppend, temp, (a2));}
+
+_LIT8(KFuncIn, "-=> %S");
+_LIT8(KFuncOut, "<=- %S");
+
+#define HTI_LOG_FUNC_IN(a1) {_LIT8(temp, a1); RFileLogger::WriteFormat(KLogFolder, KLogFile, EFileLoggingModeAppend, KFuncIn, &temp);}
+#define HTI_LOG_FUNC_OUT(a1) {_LIT8(temp, a1); RFileLogger::WriteFormat(KLogFolder, KLogFile, EFileLoggingModeAppend, KFuncOut, &temp);}
+
+#else   // !__ENABLE_LOGGING__
+
+#define HTI_LOG_TEXT(a1)
+#define HTI_LOG_DES(a1)
+#define HTI_LOG_FORMAT(a1,a2)
+#define HTI_LOG_FUNC_IN(a1)
+#define HTI_LOG_FUNC_OUT(a1)
+
+#endif // __ENABLE_LOGGING__
+
+// CONSTANTS
+_LIT( KHtiNpdHlp, "HtiNpdHlp" );
+
+_LIT( KCmdAddMemo,         "AddMemo" );
+_LIT( KCmdAddMemoFromFile, "AddMemoFromFile" );
+_LIT( KCmdDeleteAll,       "DeleteAll" );
+
+_LIT( KNotepadDatabaseFile, "c:\\Private\\100012a5\\DBS_101F8878_Notepad.dat" );
+
+// MACROS
+
+// LOCAL CONSTANTS AND MACROS
+
+// MODULE DATA STRUCTURES
+
+// LOCAL FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+// ============================ LOCAL FUNCTIONS ===============================
+void HandleAddMemoL( TLex& aParser )
+    {
+    HTI_LOG_FUNC_IN( "HandleAddMemoL" );
+
+    aParser.SkipSpace();
+    TPtrC text = aParser.Remainder();
+
+    if ( text.Length() == 0 )
+        {
+        HTI_LOG_TEXT( "missing text arg" );
+        User::Leave(KErrArgument);
+        }
+
+    // NOTE: We need to create CCoeEnv to make CNotepadApi work.
+    // This also creates a new cleaupstack so we need to destory
+    // CCoeEnv's cleanupstack before leaving to make our cleanupstack
+    // the topmost stack
+
+    CCoeEnv* env = new CCoeEnv;
+    TRAPD( err, env->ConstructL() );
+    if ( err )
+        {
+        HTI_LOG_FORMAT( "CEikonEnv::ConstructL err %d", err );
+        User::Leave( err );
+        }
+
+    TRAP( err, CNotepadApi::AddContentL( text ) );
+    if ( err )
+        {
+        HTI_LOG_FORMAT( "CNotepadApi::AddContentL err %d", err );
+        env->DestroyEnvironment();
+        User::Leave( err );
+        }
+
+    env->DestroyEnvironment();
+
+    HTI_LOG_FUNC_OUT( "HandleAddMemoL" );
+    }
+
+
+void HandleAddMemoFromFileL( TLex& aParser )
+    {
+    HTI_LOG_FUNC_IN( "HandleAddMemoFromFileL" );
+
+    aParser.SkipSpaceAndMark();
+    aParser.SkipCharacters();
+    if ( aParser.TokenLength() <= 0 )
+        {
+        User::Leave(KErrArgument);
+        }
+
+    TPtrC filename = aParser.MarkedToken();
+
+    /*
+    NOTE: Maybe will add this later
+
+    aParser.SkipSpaceAndMark();
+    aParser.SkipCharacters();
+
+    TPtrC encoding = KNullDesC;
+    if ( aParser.TokenLength() > 0 )
+        {
+        encoding.Set( aParser.MarkedToken() );
+        }
+    */
+
+    CCoeEnv* env = new CCoeEnv;
+    TRAPD( err, env->ConstructL() );
+    if ( err )
+        {
+        HTI_LOG_FORMAT( "CEikonEnv::ConstructL err %d", err );
+        User::Leave( err );
+        }
+
+    TRAP( err, CNotepadApi::SaveFileAsMemoL( filename ) );
+    if ( err )
+        {
+        HTI_LOG_FORMAT( "CNotepadApi::SaveFileAsMemoL err %d", err );
+        env->DestroyEnvironment();
+        User::Leave( err );
+        }
+
+    env->DestroyEnvironment();
+
+    HTI_LOG_FUNC_OUT( "HandleAddMemoFromFileL" );
+    }
+
+void HandleDeleteAllL()
+    {
+    HTI_LOG_FUNC_IN( "HandleDeleteAllL" );
+    TInt err = KErrNone;
+    RFs fs;
+    err = fs.Connect();
+    if ( err == KErrNone )
+        {
+        err = fs.Delete( KNotepadDatabaseFile );
+        fs.Close();
+        }
+    if ( err != KErrNone && err != KErrNotFound )
+        {
+        HTI_LOG_FORMAT( "Notepad database delete failed %d", err );
+        User::Leave( err );
+        }
+    HTI_LOG_FUNC_OUT( "HandleDeleteAllL" );
+    }
+
+
+LOCAL_C TInt StartL()
+    {
+    HTI_LOG_FUNC_IN( "StartL" );
+    TInt cmdLen = User::CommandLineLength();
+    HBufC* cmdLine = HBufC::NewLC( cmdLen );
+    TPtr ptCmdLine = cmdLine->Des();
+    User::CommandLine( ptCmdLine );
+
+    HTI_LOG_DES( *cmdLine );
+
+    //parse command line
+    TLex parser( *cmdLine );
+    parser.SkipCharacters();
+
+    if ( parser.TokenLength() <= 0 )
+        {
+        HTI_LOG_TEXT( "missing arguments" );
+        User::Leave( KErrArgument );
+        }
+
+
+    TPtrC cmd = parser.MarkedToken();
+
+    if ( cmd == KCmdAddMemo )
+        {
+        HandleAddMemoL( parser );
+        }
+    else if ( cmd == KCmdAddMemoFromFile )
+        {
+        HandleAddMemoFromFileL( parser );
+        }
+    else if ( cmd == KCmdDeleteAll )
+        {
+        HandleDeleteAllL();
+        }
+    else
+        {
+        HTI_LOG_TEXT( "Unknown argument" );
+        User::Leave( KErrArgument );
+        }
+
+    CleanupStack::PopAndDestroy(); // cmdLine
+    HTI_LOG_FUNC_OUT( "StartL" );
+    return KErrNone;
+    }
+
+
+GLDEF_C TInt E32Main()
+    {
+    __UHEAP_MARK;
+    CTrapCleanup* cleanup = CTrapCleanup::New();
+    User::RenameThread( KHtiNpdHlp );
+    TRAPD( err, StartL() );
+    delete cleanup;
+   __UHEAP_MARKEND;
+    return err;
+    }
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiServicePlugins/HtiPIMServicePlugin/src/HtiPIMServicePlugin.cpp	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,126 @@
+/*
+* 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:  PIMServicePlugin implementation
+*
+*/
+
+
+// INCLUDE FILES
+#include "HtiPIMServicePlugin.h"
+#include "PIMHandler.h"
+#include "HtiBookmarkHandler.h"
+#include "HtiSimDirHandler.h"
+#include <HtiDispatcherInterface.h>
+#include <HtiLogging.h>
+
+// CONSTANTS
+_LIT8( KErrorMissingCommand, "Missing command" );
+
+// ----------------------------------------------------------------------------
+// Create instance of concrete ECOM interface implementation
+CHtiPIMServicePlugin* CHtiPIMServicePlugin::NewL()
+    {
+    CHtiPIMServicePlugin* self = new (ELeave) CHtiPIMServicePlugin;
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop();
+    return self;
+    }
+
+// ----------------------------------------------------------------------------
+CHtiPIMServicePlugin::CHtiPIMServicePlugin()
+    {
+    }
+
+// ----------------------------------------------------------------------------
+CHtiPIMServicePlugin::~CHtiPIMServicePlugin()
+    {
+    HTI_LOG_TEXT("CHtiPIMServicePlugin destroy");
+    delete iPimHandler;
+    delete iBookmarkHandler;
+    delete iSimDirHandler;
+    }
+
+// ----------------------------------------------------------------------------
+void CHtiPIMServicePlugin::ConstructL()
+    {
+    HTI_LOG_TEXT("CHtiPIMServicePlugin::ConstructL");
+    }
+
+// ----------------------------------------------------------------------------
+void CHtiPIMServicePlugin::ProcessMessageL( const TDesC8& aMessage,
+    THtiMessagePriority aPriority )
+    {
+    HTI_LOG_FUNC_IN( "CHtiPIMServicePlugin::ProcessMessageL" );
+    HTI_LOG_FORMAT( "Msg len: %d.", aMessage.Length() );
+
+    if ( aMessage.Length() == 0 )
+        {
+        User::LeaveIfError( iDispatcher->DispatchOutgoingErrorMessage(
+            KErrArgument, KErrorMissingCommand, KPIMServiceUid ) );
+        return;
+        }
+
+    TUint8 aCommand = aMessage.Ptr()[0];
+    if ( aCommand < ESimCardInfo )
+        {
+        if ( iPimHandler == NULL )
+            {
+            iPimHandler = CPIMHandler::NewL();
+            iPimHandler->SetDispatcher( iDispatcher );
+            }
+        iPimHandler->ProcessMessageL( aMessage, aPriority );
+        }
+    else if ( aCommand < ECreateBookmark )
+        {
+        if ( iSimDirHandler == NULL )
+            {
+            iSimDirHandler = CHtiSimDirHandler::NewL();
+            iSimDirHandler->SetDispatcher( iDispatcher );
+            }
+        iSimDirHandler->ProcessMessageL( aMessage, aPriority );
+        }
+    else
+        {
+        if ( iBookmarkHandler == NULL )
+            {
+            iBookmarkHandler = CHtiBookmarkHandler::NewL();
+            iBookmarkHandler->SetDispatcher( iDispatcher );
+            }
+        iBookmarkHandler->ProcessMessageL( aMessage, aPriority );
+        }
+
+    HTI_LOG_FUNC_OUT( "CHtiPIMServicePlugin::ProcessMessageL" );
+    }
+
+
+// ----------------------------------------------------------------------------
+TBool CHtiPIMServicePlugin::IsBusy()
+    {
+    if ( iPimHandler )
+        {
+        return iPimHandler->IsBusy();
+        }
+
+    if ( iBookmarkHandler )
+        {
+        return iBookmarkHandler->IsBusy();
+        }
+    
+    if( iSimDirHandler)
+        {
+        return iSimDirHandler->IsBusy();
+        }
+    return EFalse;
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiServicePlugins/HtiPIMServicePlugin/src/HtiSimDirHandler.cpp	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,530 @@
+/*
+ * 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 SIM card contacts handling using the new
+ *                Virtual Phonebook API
+ *
+ */
+
+// INCLUDE FILES
+#include "HtiSimDirHandler.h"
+#include "HtiPIMServicePlugin.h"
+
+#include <HtiDispatcherInterface.h>
+#include <HtiLogging.h>
+
+#include <mmtsy_names.h>
+#include <mpbutil.h> 
+// EXTERNAL DATA STRUCTURES
+
+// EXTERNAL FUNCTION PROTOTYPES
+
+// CONSTANTS
+const TInt KSimInfoResponseLength = 12;
+const TInt KOneSimContactBufferSize = 512;
+// MACROS
+// LOCAL CONSTANTS AND MACROS
+_LIT8( KErrorUnrecognizedCommand, "Unrecognized command" );
+_LIT8( KErrorInvalidParameters, "Invalid command parameters" );
+_LIT8( KErrorImportFailed, "Contact import failed" );
+_LIT8( KErrorDeleteFailed, "Failed to delete contact" );
+_LIT8( KErrorSimCardInfoFailed, "Failed to get SIM card info" );
+_LIT8( KErrorFieldNotSupported, "Field is not supported");
+_LIT8( KErrorFieldTooBig, "Filed is too long");
+//_LIT8( KErrorSimStoreOpenFailed, "Failed to open SIM contact store" );
+//_LIT8( KErrorSimStoreUnavailable, "SIM contact store unavailable" );
+//_LIT8( KErrorContactOperationFailed, "SIM contact operation failed" );
+
+// MODULE DATA STRUCTURES
+
+// LOCAL FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CHtiSimDirHandler::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+CHtiSimDirHandler* CHtiSimDirHandler::NewL()
+    {
+    HTI_LOG_FUNC_IN( "CHtiSimDirHandler::NewL" );
+    CHtiSimDirHandler* self = new (ELeave) CHtiSimDirHandler();
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    CleanupStack::Pop();
+    HTI_LOG_FUNC_OUT( "CHtiSimDirHandler::NewL" );
+    return self;
+    }
+
+// ----------------------------------------------------------------------------
+// CHtiSimDirHandler::CHtiSimDirHandler
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// ----------------------------------------------------------------------------
+CHtiSimDirHandler::CHtiSimDirHandler() :
+    iIsBusy(EFalse), iStoreIsOpen(EFalse)
+    {
+    HTI_LOG_FUNC_IN( "CHtiSimDirHandler::CHtiSimDirHandler" );
+
+    HTI_LOG_FUNC_OUT( "CHtiSimDirHandler::CHtiSimDirHandler" );
+    }
+
+// -----------------------------------------------------------------------------
+// CHtiSimDirHandler::~CHtiSimDirHandler
+// Destructor.
+// -----------------------------------------------------------------------------
+CHtiSimDirHandler::~CHtiSimDirHandler()
+    {
+    HTI_LOG_FUNC_IN( "CHtiSimDirHandler::~CHtiSimDirHandler" );
+    iEtelStore.Close();
+    iEtelPhone.Close();
+    iEtelServer.Close();
+    HTI_LOG_FUNC_OUT( "CHtiSimDirHandler::~CHtiSimDirHandler" );
+    }
+
+// -----------------------------------------------------------------------------
+// CHtiSimDirHandler::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+void CHtiSimDirHandler::ConstructL()
+    {
+    HTI_LOG_FUNC_IN( "CHtiSimDirHandler::ConstructL" );
+
+    HTI_LOG_FUNC_OUT( "CHtiSimDirHandler::ConstructL" );
+    }
+
+// -----------------------------------------------------------------------------
+// CHtiSimDirHandler::SetDispatcher
+// Sets the dispatcher pointer.
+// -----------------------------------------------------------------------------
+
+void CHtiSimDirHandler::SetDispatcher(MHtiDispatcher* aDispatcher)
+    {
+    HTI_LOG_FUNC_IN( "CHtiSimDirHandler::SetDispatcher" );
+    iDispatcher = aDispatcher;
+    HTI_LOG_FUNC_OUT( "CHtiSimDirHandler::SetDispatcher" );
+    }
+
+// -----------------------------------------------------------------------------
+// CHtiSimDirHandler::ProcessMessageL
+// Parses the received message and calls handler functions.
+// -----------------------------------------------------------------------------
+void CHtiSimDirHandler::ProcessMessageL(const TDesC8& aMessage,
+        THtiMessagePriority /*aPriority*/)
+    {
+    HTI_LOG_FUNC_IN( "CHtiSimDirHandler::ProcessMessageL" );
+
+    if (iStoreIsOpen == EFalse)
+        {
+        User::LeaveIfError(iEtelServer.Connect());
+        User::LeaveIfError(iEtelServer.LoadPhoneModule(KMmTsyModuleName));
+        User::LeaveIfError(iEtelPhone.Open(iEtelServer, KMmTsyPhoneName));
+        User::LeaveIfError(iEtelStore.Open(iEtelPhone, KETelIccAdnPhoneBook));
+        HTI_LOG_TEXT( "SIM card open" );
+        iStoreIsOpen = ETrue;
+        }
+
+    if (iIsBusy)
+        {
+        HTI_LOG_TEXT( "HtiSimDirHandler is busy - leaving" );
+        User::Leave(KErrInUse);
+        }
+
+    // Will be set to EFalse in the SendOkMsgL or SendErrorMessageL methods.
+    iIsBusy = ETrue;
+
+    // Zero legth of aMessage tested already in CHtiPIMServicePlugin.
+    // Other sanity checks must be done here.
+    TInt err = KErrNone;
+    TUint8 command = aMessage.Ptr()[0];
+    switch (command)
+        {
+        case CHtiPIMServicePlugin::ESimCardInfo:
+            {
+            TRAP(err ,HandleSimCardInfoL(aMessage.Right(aMessage.Length() - 1)));
+            break;
+            }
+        case CHtiPIMServicePlugin::EImportSimContact:
+            {
+            TRAP(err ,HandleSimContactImportL(aMessage.Right(aMessage.Length() - 1)));
+            break;
+            }
+        case CHtiPIMServicePlugin::EDeleteSimContact:
+            {
+            TRAP(err ,HandleSimContactDeleteL(aMessage.Right(aMessage.Length() - 1)));
+            break;
+            }
+        default:
+            {
+            SendErrorMessageL(KErrArgument, KErrorUnrecognizedCommand);
+            return;
+            }
+        }
+
+    if (err != KErrNone)
+        {
+        iIsBusy = EFalse;
+        User::Leave(err);
+        } 
+    HTI_LOG_FUNC_OUT( "CHtiSimDirHandler::ProcessMessageL" );
+    }
+
+// -----------------------------------------------------------------------------
+// CHtiSimDirHandler::IsBusy
+// -----------------------------------------------------------------------------
+//
+TBool CHtiSimDirHandler::IsBusy()
+    {
+    return iIsBusy;
+    }
+
+// ----------------------------------------------------------------------------
+// CHtiSimDirHandler::HandleSimCardInfoL
+// Gets information about the SIM card.
+// ----------------------------------------------------------------------------
+void CHtiSimDirHandler::HandleSimCardInfoL(const TDesC8& aData)
+    {
+    HTI_LOG_FUNC_IN( "CHtiSimDirHandler::HandleSimCardInfoL" );
+    if (aData.Length() != 0)
+        {
+        HTI_LOG_TEXT( "CHtiSimDirHandler: wrong length of data" );
+        SendErrorMessageL(KErrArgument, KErrorInvalidParameters);
+        return;
+        }
+
+    RMobilePhoneBookStore::TMobilePhoneBookInfoV5 etelStoreInfo;
+    RMobilePhoneBookStore::TMobilePhoneBookInfoV5Pckg etelStoreInfoPckg(etelStoreInfo);
+    
+    TRequestStatus requestStatus;
+    iEtelStore.GetInfo(requestStatus, (TDes8&) etelStoreInfoPckg);
+    User::WaitForRequest(requestStatus);
+    if (requestStatus.Int() != KErrNone)
+        {
+        HTI_LOG_TEXT( "CHtiSimDirHandler: Failed to get SIM card info" );
+        SendErrorMessageL(requestStatus.Int(), KErrorSimCardInfoFailed);
+        return;
+        }
+
+    // Create and send response message
+    TBuf8<KSimInfoResponseLength> reply;
+    reply.Append(etelStoreInfo.iMaxSecondNames > 0 ? etelStoreInfo.iMaxSecondNames : 0);
+    reply.Append(etelStoreInfo.iMaxAdditionalNumbers > 0 ? etelStoreInfo.iMaxAdditionalNumbers : 0);
+    reply.Append(etelStoreInfo.iMaxEmailAddr > 0 ? etelStoreInfo.iMaxEmailAddr : 0);
+    reply.Append(etelStoreInfo.iMaxTextLength > 0 ? etelStoreInfo.iMaxTextLength : 0);
+    reply.Append(etelStoreInfo.iMaxNumLength > 0 ? etelStoreInfo.iMaxNumLength : 0);
+    reply.Append(etelStoreInfo.iMaxTextLengthSecondName > 0 ? 
+        etelStoreInfo.iMaxTextLengthSecondName : 0);
+    reply.Append(etelStoreInfo.iMaxNumLengthAdditionalNumber > 0?
+        etelStoreInfo.iMaxNumLengthAdditionalNumber : 0);
+    reply.Append(etelStoreInfo.iMaxTextLengthEmailAddr > 0 ? etelStoreInfo.iMaxTextLengthEmailAddr : 0);
+    reply.Append( ( TUint8* ) ( &etelStoreInfo.iTotalEntries ), 2 );
+    reply.Append( ( TUint8* ) ( &etelStoreInfo.iUsedEntries ), 2 );
+    SendOkMsgL(reply);
+    HTI_LOG_FUNC_OUT( "CHtiSimDirHandler::HandleSimCardInfoL" );
+    }
+
+// ----------------------------------------------------------------------------
+// CHtiSimDirHandler::HandleSimContactImportL
+// Imports the contact to SIM card.
+// ----------------------------------------------------------------------------
+void CHtiSimDirHandler::HandleSimContactImportL(const TDesC8& aData)
+    {
+    HTI_LOG_FUNC_IN( "CHtiSimDirHandler::HandleSimContactImportL" );
+    
+    if(CheckImportMsg(aData) == EFalse)
+        {
+        return;
+        }
+    
+    RBuf8 buffer;
+    buffer.CreateL(KOneSimContactBufferSize);
+    CleanupClosePushL(buffer);
+    CPhoneBookBuffer* pbBuffer = new (ELeave) CPhoneBookBuffer();
+    CleanupStack::PushL(pbBuffer);
+    pbBuffer->Set(&buffer);
+
+    //add new enty tag
+    User::LeaveIfError(pbBuffer->AddNewEntryTag());
+
+    TInt offset = 0;
+    TInt fieldCount = aData[offset];
+    offset++;
+
+    for (TInt i = 0; i < fieldCount; i++)
+        {
+        HTI_LOG_FORMAT( "Processing field %d", i + 1 );
+
+        TContactFieldType type = (TContactFieldType) aData[offset];
+        offset++;
+        TInt fieldLength = aData[offset];
+        offset++;
+        HBufC* fieldData = HBufC::NewLC(fieldLength);
+        fieldData->Des().Copy(aData.Mid(offset, fieldLength));
+        switch (type)
+            {
+            case ENameField:
+                User::LeaveIfError(pbBuffer->PutTagAndValue(
+                        RMobilePhoneBookStore::ETagPBText, fieldData->Des()));
+                break;
+            case ESecondNameField:
+                User::LeaveIfError(pbBuffer->PutTagAndValue(
+                        RMobilePhoneBookStore::ETagPBSecondName,
+                        fieldData->Des()));
+                break;
+            case EPhoneNumberField:
+                User::LeaveIfError(
+                        pbBuffer->PutTagAndValue(
+                                RMobilePhoneBookStore::ETagPBNumber,
+                                fieldData->Des()));
+                break;
+            case EEMailField:
+                User::LeaveIfError(pbBuffer->PutTagAndValue(
+                        RMobilePhoneBookStore::ETagPBEmailAddress,
+                        fieldData->Des()));
+                break;
+            case EAdditNumberField:
+                User::LeaveIfError(pbBuffer->AddNewNumberTag());
+                User::LeaveIfError(
+                        pbBuffer->PutTagAndValue(
+                                RMobilePhoneBookStore::ETagPBNumber,
+                                fieldData->Des()));
+                break;
+            default:
+                HTI_LOG_FORMAT( "Unknown field type %d", type );
+                User::Leave(KErrArgument);
+                break;
+            }
+        CleanupStack::PopAndDestroy(); // fieldData
+        offset += fieldLength;
+        }
+    
+    // save contact into sim card
+    TInt index = -1;
+    TRequestStatus status;
+    //store the entry in the first free location and then return 
+    //this location within index when it completes the request
+    iEtelStore.Write(status, buffer, index);
+    User::WaitForRequest(status);
+    if(status.Int() != KErrNone)
+        {
+        HTI_LOG_TEXT("Failed to add SIM contact");
+        SendErrorMessageL( status.Int(), KErrorImportFailed );
+        }
+    else
+        {
+        HTI_LOG_TEXT( "SIM contact added" );
+        TBuf8<4> idBuf;
+        idBuf.Append( ( TUint8* ) &index, 4 );
+        SendOkMsgL( idBuf );
+        }
+    CleanupStack::PopAndDestroy(2); // buffer, pbBuffer
+
+    HTI_LOG_FUNC_OUT( "CHtiSimDirHandler::HandleSimContactImportL" );
+    }
+
+// ----------------------------------------------------------------------------
+// CHtiSimDirHandler::HandleSimContactDeleteL
+// Creates a contact view containing the contacts to be deleted.
+// ----------------------------------------------------------------------------
+void CHtiSimDirHandler::HandleSimContactDeleteL(const TDesC8& aData)
+    {
+    HTI_LOG_FUNC_IN( "CHtiSimDirHandler::HandleSimContactDeleteL" );
+    TInt dataLength = aData.Length();
+    if ( dataLength != 0 && dataLength != 4 )
+        {
+        HTI_LOG_TEXT( "CHtiSimDirHandler: Wrong length of data" )
+        SendErrorMessageL( KErrArgument, KErrorInvalidParameters );
+        return;
+        }
+    
+    TRequestStatus status;
+    if (dataLength == 0) //delete all
+        {
+        iEtelStore.DeleteAll(status);
+        HTI_LOG_TEXT("Delete all SIM contacts");
+        }
+    else //delete one contact with given id
+        {
+        TInt id = aData[0] + (aData[1] << 8) + (aData[2] << 16) + (aData[3]
+                << 24);
+        HTI_LOG_FORMAT( "Delete SIM contact with id %d", id );
+        iEtelStore.Delete(status, id);
+        }
+    
+    User::WaitForRequest(status);
+    if(status.Int() != KErrNone)
+        {
+        HTI_LOG_TEXT("Failed to delete contact(s)");
+        SendErrorMessageL( status.Int(), KErrorDeleteFailed );
+        }
+    else
+        {
+        HTI_LOG_TEXT("SIM contact(s) deleted");
+        SendOkMsgL( KNullDesC8 );
+        }
+    HTI_LOG_FUNC_OUT( "CHtiSimDirHandler::HandleSimContactDeleteL" );
+    }
+
+// ----------------------------------------------------------------------------
+// CHtiSimDirHandler::CheckImportMsg
+// Validates the syntax of import contact message.
+// ----------------------------------------------------------------------------
+TBool CHtiSimDirHandler::CheckImportMsg(const TDesC8& aData)
+    {
+    HTI_LOG_FUNC_IN( "CHtiSimDirHandler::CheckImportMsg" );
+    // Import command syntax:
+    //   amount of fields     (1 byte)   __
+    //   type of field        (1 byte)     |
+    //   length of data field (1 byte)     | repeated <amount of fields> times
+    //   field data           (variable) __|
+
+    TInt length = aData.Length();
+    if (length < 4) // min length 4 bytes
+        {
+        HTI_LOG_FORMAT( "Message too short %d", length );
+        SendErrorMessageL( KErrArgument, KErrorInvalidParameters );
+        return EFalse;
+        }
+
+    RMobilePhoneBookStore::TMobilePhoneBookInfoV5 etelStoreInfo;
+    RMobilePhoneBookStore::TMobilePhoneBookInfoV5Pckg etelStoreInfoPckg(etelStoreInfo);
+    
+    TRequestStatus requestStatus;
+    iEtelStore.GetInfo(requestStatus, (TDes8&) etelStoreInfoPckg);
+    User::WaitForRequest(requestStatus);
+    if (requestStatus.Int() != KErrNone)
+        {
+        HTI_LOG_TEXT( "CHtiSimDirHandler: Failed to get SIM card info" );
+        SendErrorMessageL(requestStatus.Int(), KErrorSimCardInfoFailed);
+        return EFalse;
+        }
+    TInt offset = 0;
+    TInt fieldCount = aData[offset];
+    HTI_LOG_FORMAT( "Fields %d", fieldCount );
+    if (fieldCount < 1) // must be at least one field
+        {
+        SendErrorMessageL( KErrArgument, KErrorInvalidParameters );
+        return EFalse;
+        }
+
+    offset++;
+    TInt fieldsFound = 0;
+    while (offset < length)
+        {
+        fieldsFound++;
+        TContactFieldType fieldType = (TContactFieldType) aData[offset];
+        HTI_LOG_FORMAT( "Field type %d", fieldType );
+        TInt maxLength = 0;
+        if(fieldType == ENameField)
+            {
+            maxLength = etelStoreInfo.iMaxTextLength;
+            }
+        else if(fieldType == ESecondNameField)
+            {
+            maxLength = etelStoreInfo.iMaxTextLengthSecondName;
+            }
+        else if(fieldType == EPhoneNumberField)
+            {
+            maxLength = etelStoreInfo.iMaxNumLength;
+            }
+        else if(fieldType == EEMailField)
+            {
+            maxLength = etelStoreInfo.iMaxTextLengthEmailAddr;
+            }
+        else if(fieldType == EAdditNumberField)
+            {
+            maxLength = etelStoreInfo.iMaxNumLengthAdditionalNumber;
+            }
+        else
+            {
+            HTI_LOG_TEXT("Unknown field type");
+            SendErrorMessageL( KErrArgument, KErrorInvalidParameters );
+            return EFalse; // invalid field type
+            }
+        
+        if(maxLength <= 0)
+            {
+            HTI_LOG_TEXT("Field not supported");
+            SendErrorMessageL(KErrArgument, KErrorFieldNotSupported);
+            return EFalse;
+            }
+
+        offset++; // the type of field byte
+        if (offset >= length)
+            {
+            SendErrorMessageL( KErrArgument, KErrorInvalidParameters );
+            return EFalse;
+            }
+        TInt fieldLength = aData[offset];
+        HTI_LOG_FORMAT( "Field length %d", fieldLength );
+        if (fieldLength < 1)
+            {
+            SendErrorMessageL( KErrArgument, KErrorInvalidParameters );
+            return EFalse; // Field data can not be empty
+            }
+        else if(fieldLength > maxLength)
+            {
+            HTI_LOG_TEXT("The length of field is too long");
+            SendErrorMessageL( KErrArgument, KErrorFieldTooBig );
+            return EFalse;
+            }
+        offset++; // advance over the length of data byte
+        offset += fieldLength; // and the field data
+        }
+
+    if (offset == length && fieldsFound == fieldCount)
+        {
+        HTI_LOG_TEXT( "Message OK" );
+        return ETrue;
+        }
+    
+    SendErrorMessageL( KErrArgument, KErrorInvalidParameters );
+    return EFalse;
+    }
+
+// ----------------------------------------------------------------------------
+// CHtiSimDirHandler::SendOkMsgL
+// Helper function for sending response messages.
+// ----------------------------------------------------------------------------
+void CHtiSimDirHandler::SendOkMsgL(const TDesC8& aData)
+    {
+    HTI_LOG_FUNC_IN( "CHtiSimDirHandler::SendOkMsgL" );
+    iIsBusy = EFalse; // Done with the current request
+    User::LeaveIfNull(iDispatcher);
+    HBufC8* temp = HBufC8::NewL(aData.Length() + 1);
+    TPtr8 response = temp->Des();
+    response.Append((TChar) CHtiPIMServicePlugin::EResultOk);
+    response.Append(aData);
+    User::LeaveIfError(iDispatcher->DispatchOutgoingMessage(temp,
+            KPIMServiceUid));
+    HTI_LOG_FUNC_OUT( "CHtiSimDirHandler::SendOkMsgL" );
+    }
+
+// ----------------------------------------------------------------------------
+// CHtiSimDirHandler::SendErrorMessageL
+// Helper function for sending error response messages.
+// ----------------------------------------------------------------------------
+void CHtiSimDirHandler::SendErrorMessageL(TInt aError,
+        const TDesC8& aDescription)
+    {
+    HTI_LOG_FUNC_IN( "CHtiSimDirHandler::SendErrorMessageL" );
+    iIsBusy = EFalse; // Done with the current request
+    User::LeaveIfNull(iDispatcher);
+    User::LeaveIfError(iDispatcher->DispatchOutgoingErrorMessage(aError,
+            aDescription, KPIMServiceUid));
+    HTI_LOG_FUNC_OUT( "CHtiSimDirHandler::SendErrorMessageL" );
+    }
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiServicePlugins/HtiPIMServicePlugin/src/PIMHandler.cpp	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,782 @@
+/*
+* 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:  Functional implementation of PIM service (for vCalendar, vCard)
+*
+*/
+
+
+// INCLUDE FILES
+#include "../../../symbian_version.hrh"
+
+#include "HtiPIMServicePlugin.h"
+#include "PIMHandler.h"
+
+#include <HtiDispatcherInterface.h>
+#include <HtiLogging.h>
+
+#include <utf.h>
+#include <calcommon.h>
+#include <calsession.h>
+#include <calentryview.h>
+
+#include <cntdb.h> 
+#include <cntitem.h> 
+#include <cntfldst.h> 
+#include <cntvcard.h> 
+#include <cntfilt.h> 
+#include <caldataexchange.h> 
+#include <caldataformat.h> 
+
+// CONSTANTS
+_LIT8( KErrorUnrecognizedCommand, "Unrecognized command" );
+_LIT8( KErrorCalendarFileFormat, "Invalid format of calendar file name");
+_LIT8( KErrorVCardImportFailed, "vCard import failed" );
+_LIT8( KErrorVCalendarImportFailed, "vCalendar import failed" );
+_LIT8( KErrorMissingVCalendar, "Missing vCalendar object" );
+_LIT8( KErrorMissingVCard, "Missing vCard object" );
+_LIT8( KErrorInvalidId, "Invalid ID parameter" );
+_LIT8( KErrorItemNotFound, "Item not found" );
+_LIT8( KErrorFailedDelete, "Failed to delete item" );
+_LIT8( KErrorFailedDeleteAll, "Failed to delete all items" );
+_LIT8( KErrorFailedOpenCalendar, "Failed to open calendar file");
+//_LIT8( KErrorFailedOpenContact, "Failed to open contact database");
+
+
+
+_LIT( KDefaultAgendaFile, "" ); // A default file is opened if fileName is KNullDesC
+
+#if ( SYMBIAN_VERSION_SUPPORT < SYMBIAN_4 )  
+_LIT8( KErrorMissingText, "Text parameter missing" );
+_LIT8( KErrorMissingFilepath, "Filepath parameter missing" );
+_LIT8( KErrorNotepadAddMemoFailed, "Notepad add memo failed" );
+_LIT8( KErrorNotepadAddMemoFromFileFailed, "Notepad add memo from file failed" );
+_LIT8( KErrorNotepadDeleteAllFailed, "Notepad delete all failed" );
+
+_LIT( KHtiNpdHlpExe,       "HtiNpdHlp.exe" );
+_LIT( KCmdAddMemo,         "AddMemo" );
+_LIT( KCmdAddMemoFromFile, "AddMemoFromFile" );
+_LIT( KCmdDeleteAll,       "DeleteAll" );
+_LIT( KCmdDelim,           " " );
+#else
+_LIT8( KErrorNotepadNotSupported, "Notepad not supported" );
+#endif
+
+// ----------------------------------------------------------------------------
+CPIMHandler* CPIMHandler::NewL()
+    {
+    HTI_LOG_FUNC_IN( "CPIMHandler::NewL" );
+    CPIMHandler* self = new (ELeave) CPIMHandler();
+    CleanupStack::PushL ( self );
+    self->ConstructL();
+    CleanupStack::Pop();
+    HTI_LOG_FUNC_OUT( "CPIMHandler::Done" );
+    return self;
+    }
+
+// ----------------------------------------------------------------------------
+CPIMHandler::CPIMHandler():iIsBusy( EFalse ), iEntryViewErr( KErrNone ),
+        iCalSession(NULL)
+    {
+    }
+
+// ----------------------------------------------------------------------------
+CPIMHandler::~CPIMHandler()
+    {
+    HTI_LOG_TEXT( "CPIMHandler destroy" );
+    HTI_LOG_TEXT( "Deleting iCalSession");
+    delete iCalSession;
+    HTI_LOG_TEXT( "Deleting iWaiter" );
+    delete iWaiter;
+    }
+
+// ----------------------------------------------------------------------------
+void CPIMHandler::ConstructL()
+    {
+    HTI_LOG_TEXT( "CPIMHandler::ConstructL" );
+    iWaiter = new ( ELeave ) CActiveSchedulerWait;
+    }
+
+// ----------------------------------------------------------------------------
+void CPIMHandler::SetDispatcher( MHtiDispatcher* aDispatcher )
+    {
+    iDispatcher = aDispatcher;
+    }
+
+// ----------------------------------------------------------------------------
+void CPIMHandler::ProcessMessageL( const TDesC8& aMessage,
+    THtiMessagePriority /*aPriority*/ )
+    {
+    HTI_LOG_FUNC_IN( "CPIMHandler::ProcessMessageL" );
+
+    iIsBusy = ETrue;
+    TInt err = KErrNone;
+
+    // Zero legth of aMessage tested already in CHtiPIMServicePlugin.
+    // Other sanity checks must be done here.
+
+    TUint8 command = aMessage.Ptr()[0];
+    switch ( command )
+        {
+        case CHtiPIMServicePlugin::EImportVCard:
+            {
+            TRAP( err, HandleVCardImportFuncL(
+                    aMessage.Right( aMessage.Length() - 1 ) ) );
+            break;
+            }
+        case CHtiPIMServicePlugin::EImportVCalendar:
+            {
+            TRAP( err, HandleVCalendarImportFuncL(
+                    aMessage.Right( aMessage.Length() - 1 ) ) );
+            break;
+            }
+        case CHtiPIMServicePlugin::EDeleteContact:
+            {
+            TRAP( err, HandleContactDeleteFuncL(
+                    aMessage.Right( aMessage.Length() - 1 ) ) );
+            break;
+            }
+        case CHtiPIMServicePlugin::EDeleteCalendar:
+            {
+            TRAP( err, HandleCalendarDeleteFuncL(
+                    aMessage.Right( aMessage.Length() - 1 ) ) );
+            break;
+            }
+        case CHtiPIMServicePlugin::EOpenCalendarFile:
+            {
+            TRAP( err, HandleOpenCalendarFileL(
+                    aMessage.Right( aMessage.Length() - 1 )));
+            break;
+            }
+        case CHtiPIMServicePlugin::EListCalendarFiles:
+            {
+            TRAP( err, HandleListCalendarFilesL());
+            break;
+            }
+        case CHtiPIMServicePlugin::ENotepadAddMemo:
+            {
+            TRAP( err, HandleNotepadAddMemoFuncL( aMessage.Mid( 1 ) ) );
+            break;
+            }
+        case CHtiPIMServicePlugin::ENotepadAddMemoFromFile:
+            {
+            TRAP( err, HandleNotepadAddMemoFromFileFuncL( aMessage.Mid( 1 ) ) );
+            break;
+            }
+        case CHtiPIMServicePlugin::ENotepadDeleteAll:
+            {
+            TRAP( err, HandleNotepadDeleteAllFuncL() );
+            break;
+            }
+        default:
+            {
+            TRAP( err, SendErrorMessageL(
+                    KErrArgument, KErrorUnrecognizedCommand ) );
+            break;
+            }
+        }
+
+    if ( err != KErrNone )
+        {
+        iIsBusy = EFalse;
+        User::Leave( err );
+        }
+
+    HTI_LOG_FUNC_OUT( "CPIMHandler::ProcessMessageL: Done" );
+    }
+
+// ----------------------------------------------------------------------------
+TBool CPIMHandler::IsBusy()
+    {
+    return iIsBusy;
+    }
+
+// ----------------------------------------------------------------------------
+void CPIMHandler::HandleOpenCalendarFileL( const TDesC8& aData )
+    {
+    HTI_LOG_FUNC_IN( "CPIMHandler::HandleOpenCalendarFileL" );
+    
+    // check the format, the correct format is DriveLetter:FileName
+    if (aData.Length() != 0)
+        {
+        if(aData.Length() < 3 || aData[1] != ':'||
+                !(aData[0] >= 'a' && aData[0] <= 'z' || aData[0] >= 'A' && aData[0] <= 'Z'))
+            {
+            SendErrorMessageL( KErrArgument, KErrorCalendarFileFormat );
+            return;
+            }
+        }
+    
+    delete iCalSession;
+    iCalSession = NULL;
+    
+    // Open iCalSession
+    HTI_LOG_TEXT("Open calendar session");
+    iCalSession = CCalSession::NewL();
+    TBuf<KMaxFileName + 2> calFile;
+    calFile.Copy(aData);
+    TRAPD(err, iCalSession->OpenL(calFile));
+    if(err == KErrNone)
+        {
+        HTI_LOG_TEXT("Calendar session open");
+        SendOkMsgL( KNullDesC8 );
+        }
+    else
+        {
+        HTI_LOG_TEXT("Failed to open calendar file");
+        SendErrorMessageL( err, KErrorFailedOpenCalendar );
+        delete iCalSession;
+        iCalSession = NULL;
+        }
+    HTI_LOG_FUNC_OUT( "CPIMHandler::HandleOpenCalendarFileL: Done" );
+    }
+
+// ----------------------------------------------------------------------------
+void CPIMHandler::HandleListCalendarFilesL()
+    {
+    HTI_LOG_FUNC_IN( "CPIMHandler::HandleListCalendarFiles" );
+    
+    CCalSession* calSession = CCalSession::NewL();
+    CleanupStack::PushL(calSession);
+    HTI_LOG_TEXT("List all calendar files");
+    CDesCArray* calFiles = calSession->ListCalFilesL();
+    
+    if(calFiles == NULL) //No calendar files
+        {
+        TBuf8<2> reply;
+        reply.AppendFill(0, 2);
+        SendOkMsgL(reply);
+        CleanupStack::PopAndDestroy(); // calSession
+        return;
+        }
+    
+    CleanupStack::PushL(calFiles);
+    TInt count = calFiles->Count();
+    
+    // files count + file count * (file name length + max file name + driver letter + ':')
+    TInt bufSize = 2 + count * (2 + KMaxFileName + 1 + 1);
+    CBufFlat* calListBuf = CBufFlat::NewL( bufSize );
+    CleanupStack::PushL(calListBuf);
+    
+    HBufC8* calArray = HBufC8::NewLC( bufSize );
+    TPtr8 calArrayPtr = calArray->Des();
+    
+    calArrayPtr.Append((TUint8*)(&count), 2);
+    TInt pos = 0;
+    calListBuf->ExpandL(pos, 2);
+    calListBuf->Write(pos, *calArray, 2);
+    calArrayPtr.Zero();
+    pos += 2;
+    
+    for(int i = 0; i < count; ++i)
+        {
+        TInt len = calFiles->MdcaPoint(i).Length();
+        calArrayPtr.Append((TUint8*)(&len), 2);
+        calArrayPtr.Append(calFiles->MdcaPoint(i));
+        calListBuf->ExpandL(pos, calArray->Length());
+        calListBuf->Write(pos,*calArray, calArray->Length());
+        pos += calArray->Length();
+        calArrayPtr.Zero();
+        }
+    SendOkMsgL( calListBuf->Ptr( 0 ) );
+    CleanupStack::PopAndDestroy(4); //calArray, calListBuf, calFiles, calSession;    
+    HTI_LOG_FUNC_OUT( "CPIMHandler::HandleListCalendarFiles: Done" );
+    }
+
+// ----------------------------------------------------------------------------
+void CPIMHandler::HandleVCardImportFuncL( const TDesC8& aData )
+    {
+    HTI_LOG_FUNC_IN( "CPIMHandler::HandleVCardImportFuncL" );
+    if ( aData.Length() == 0 )
+        {
+        SendErrorMessageL( KErrArgument, KErrorMissingVCard );
+        return;
+        }
+    
+    CContactDatabase* contactDatabase = CContactDatabase::OpenL();
+    HTI_LOG_TEXT( "CPIMHandler: Contact database open" );
+    CleanupStack::PushL(contactDatabase);
+    
+    CBufFlat* buffer = CBufFlat::NewL(aData.Length());
+    CleanupStack::PushL(buffer);
+    buffer->ExpandL(0, aData.Length());
+    buffer->Ptr(0).Copy(aData.Right(aData.Length()));
+    RBufReadStream readStream;
+    readStream.Open(*buffer, 0);
+    CleanupClosePushL<RBufReadStream>( readStream );
+    
+    // Imports vCard
+    TBool success = EFalse;
+    TUid format = TUid::Uid(KUidVCardConvDefaultImpl);
+    CArrayPtr<CContactItem>* contacts = NULL;
+    TRAPD(err,contacts = contactDatabase->ImportContactsL(format, readStream, success, 
+            CContactDatabase::EImportSingleContact | CContactDatabase::ETTFormat));
+    CleanupStack::PushL(contacts);
+    if(err != KErrNone || success == EFalse || contacts == NULL || contacts->Count() == 0)
+        {
+        HTI_LOG_TEXT("Failed to import vCard");
+        SendErrorMessageL( err, KErrorVCardImportFailed );
+        }
+    else
+        {
+        // Returns the imported contact id 
+        TInt32 entryId = contacts->At(0)->Id();
+        TBuf8<4> idBuf;
+        idBuf.Append( ( TUint8* ) &entryId, 4 );
+        HTI_LOG_TEXT("vCard imported");
+        SendOkMsgL( idBuf );
+        }
+    
+    contacts->ResetAndDestroy();
+    
+    CleanupStack::PopAndDestroy(4); // contacts, readStream, buffer, contactDatabase
+    HTI_LOG_FUNC_OUT( "CPIMHandler::HandleVCardImportFuncL: Done" );
+    }
+
+// ----------------------------------------------------------------------------
+void CPIMHandler::HandleVCalendarImportFuncL( const TDesC8& aData )
+    {
+    HTI_LOG_FUNC_IN( "CPIMHandler::HandleVCalendarImportFuncL" );
+
+    if ( aData.Length() == 0 )
+        {
+        HTI_LOG_TEXT( "CPIMHandler::HandleVCalendarImportFuncL: Error: length of data is zero" )
+        SendErrorMessageL( KErrArgument, KErrorMissingVCalendar );
+        return;
+        }
+
+    CBufFlat* buffer = CBufFlat::NewL( aData.Length() );
+    CleanupStack::PushL(buffer);
+    buffer->ExpandL( 0, aData.Length() );
+    buffer->Ptr( 0 ).Copy( aData );
+    RBufReadStream readStream;
+    readStream.Open( *buffer, 0 );
+    CleanupClosePushL( readStream );
+
+    if(iCalSession == NULL)
+        {
+        HTI_LOG_TEXT( "CPIMHandler: Open default calendar file" );
+        iCalSession = CCalSession::NewL();
+        iCalSession->OpenL( KDefaultAgendaFile );
+        HTI_LOG_TEXT( "CPIMHandler: Calendar session open" );
+        }
+
+    CCalDataExchange* importer = CCalDataExchange::NewL(*iCalSession);
+    CleanupStack::PushL( importer );
+    HTI_LOG_TEXT( "CPIMHandler: Calendar importer created" );
+
+    RPointerArray<CCalEntry> entryArray;
+    CleanupClosePushL( entryArray );
+
+    TInt err = KErrNone;
+    TInt size = 0;
+    // Import as VCalendar
+    TRAP( err, importer->ImportL( KUidVCalendar, readStream, entryArray ) );
+    HTI_LOG_FORMAT( "ImportL return value %d", err );
+    size = entryArray.Count();
+    HTI_LOG_FORMAT( "Import VCalendarL imported %d entries", size );
+    TCalLocalUid uniqueId = 0;
+    TInt success = 0;
+    if ( size > 0 )
+        {
+        CCalEntryView* entryView = CCalEntryView::NewL( *iCalSession, *this );
+        iWaiter->Start();
+        CleanupStack::PushL(entryView);
+        if ( iEntryViewErr == KErrNone )
+            {
+            TRAP( err, entryView->StoreL( entryArray, success ) );
+            HTI_LOG_FORMAT( "StoreL return value %d", err );
+            HTI_LOG_FORMAT( "Successfully stored %d entries", success );
+            uniqueId = entryArray[0]->LocalUidL();
+            }
+        CleanupStack::PopAndDestroy();
+        }
+    entryArray.ResetAndDestroy();
+    CleanupStack::PopAndDestroy(); // entryArray
+
+    if ( err == KErrNone && success > 0 )
+        {
+        HTI_LOG_TEXT("vCalendar imported");
+        TBuf8<8> uniqueIdStr;
+        uniqueIdStr.Copy( ( TUint8* ) ( &uniqueId ), sizeof( uniqueId ) );
+        SendOkMsgL( uniqueIdStr );
+        }
+    else
+        {
+        HTI_LOG_TEXT("Failed to import vCalendar");
+        if ( err == KErrNone ) 
+            {
+            err = KErrGeneral;
+            }
+        SendErrorMessageL( err, KErrorVCalendarImportFailed );
+        }
+
+    CleanupStack::PopAndDestroy( 3 ); // buffer, readStream, importer
+    HTI_LOG_FUNC_OUT( "CPIMHandler::HandleVCalendarImportFuncL: Done" );
+    }
+
+// ----------------------------------------------------------------------------
+void CPIMHandler::HandleContactDeleteFuncL( const TDesC8& aData )
+    {
+    HTI_LOG_FUNC_IN( "CPIMHandler::HandleContactDeleteFuncL" );
+    TInt dataLength = aData.Length();
+    if ( dataLength != 0 && dataLength != 4 )
+        {
+        HTI_LOG_TEXT( "CPIMHandler: Error: wrong length of data" )
+        SendErrorMessageL( KErrArgument, KErrorInvalidId );
+        return;
+        }
+    CContactDatabase* contactDatabase = CContactDatabase::OpenL();
+    HTI_LOG_TEXT( "CPIMHandler: Contact database open" );
+    CleanupStack::PushL(contactDatabase);
+    
+    if(dataLength == 0)   // delete all contacts
+        {
+        //const CContactIdArray* array = iContactDatabase->SortedItemsL();
+        CCntFilter *filter = CCntFilter::NewLC();
+        filter->SetContactFilterTypeCard(ETrue);
+        filter->SetContactFilterTypeGroup(EFalse);
+        contactDatabase->FilterDatabaseL(*filter);
+        TRAPD(err, contactDatabase->DeleteContactsL(*filter->iIds));
+        CleanupStack::PopAndDestroy();
+        if(err == KErrNone)
+            {
+            HTI_LOG_TEXT("All contacts deleted");
+            SendOkMsgL( KNullDesC8 );
+            }
+        else
+            {
+            HTI_LOG_TEXT("Failed to delete all contacts");
+            SendErrorMessageL( err, KErrorFailedDeleteAll );
+            }
+        }
+    else  // delete one contact by id
+        {
+        TUint id = aData[0] + ( aData[1] << 8 )
+                + ( aData[2] << 16 )
+                + ( aData[3] << 24 );
+        TRAPD(err, contactDatabase->DeleteContactL(id));
+        
+        if(err == KErrNone)
+            {
+            HTI_LOG_TEXT("Contact deleted");
+            SendOkMsgL( KNullDesC8 );
+            }
+        else
+            {
+            HTI_LOG_TEXT("Failed to delete contact");
+            SendErrorMessageL( err, KErrorFailedDelete );
+            }
+        }
+    
+    CleanupStack::PopAndDestroy();
+    HTI_LOG_FUNC_OUT( "CPIMHandler::HandleContactDeleteFuncL" );
+    }
+
+// ----------------------------------------------------------------------------
+void CPIMHandler::HandleCalendarDeleteFuncL( const TDesC8& aData )
+    {
+    HTI_LOG_FUNC_IN( "CPIMHandler::HandleVCalendarDeleteFuncL" );
+
+    TInt dataLength = aData.Length();
+    if ( dataLength != 0 && dataLength != 4 )
+        {
+        HTI_LOG_TEXT( "CPIMHandler: Error: wrong length of data" )
+        SendErrorMessageL( KErrArgument, KErrorInvalidId );
+        return;
+        }
+
+
+    if(iCalSession == NULL)
+        {
+        HTI_LOG_TEXT( "CPIMHandler: Open default calendar file" );
+        iCalSession = CCalSession::NewL();
+        iCalSession->OpenL( KDefaultAgendaFile );
+        HTI_LOG_TEXT( "CPIMHandler: Calendar session open" );
+        }
+
+    HTI_LOG_TEXT( "CPIMHandler: Creating entry view" );
+    CCalEntryView* entryView = CCalEntryView::NewL( *iCalSession, *this );
+    iWaiter->Start();
+    CleanupStack::PushL(entryView);
+    if ( iEntryViewErr != KErrNone )
+        {
+        User::Leave( iEntryViewErr );
+        }
+
+    // If dataLength is 0, no ID given, delete all calendar entries
+    if ( dataLength == 0 )
+        {
+        HTI_LOG_TEXT( "CPIMHandler: Deleting all calendar entries" );
+        TCalTime minTime;
+        TCalTime maxTime;
+        minTime.SetTimeUtcL( TCalTime::MinTime() );
+        maxTime.SetTimeUtcL( TCalTime::MaxTime() );
+        CalCommon::TCalTimeRange timeRange( minTime, maxTime );
+        TRAPD( err, entryView->DeleteL( timeRange,
+                CalCommon::EIncludeAll, *this ) );
+        iWaiter->Start();
+        if ( err == KErrNone && iEntryViewErr == KErrNone )
+            {
+            HTI_LOG_TEXT("All calendar entries deleted");
+            SendOkMsgL( KNullDesC8 );
+            }
+        else
+            {
+            HTI_LOG_TEXT("Failed to delete all calendar entries");
+            SendErrorMessageL( KErrGeneral, KErrorFailedDeleteAll );
+            }
+        }
+
+    // If id given, delete only calendar entry having that id
+    else
+        {
+        TCalLocalUid id = aData[0] + ( aData[1] << 8 )
+                             + ( aData[2] << 16 )
+                             + ( aData[3] << 24 );
+        HTI_LOG_FORMAT( "CPIMHandler: Deleting one calendar entry %d", id );
+        CCalEntry* entryToDelete = NULL;
+        TRAPD( err, entryToDelete = entryView->FetchL( id ) );
+
+        if ( err || entryToDelete == NULL )
+            {
+            HTI_LOG_TEXT( "CPIMHandler: Calendar entry not found" );
+            SendErrorMessageL( KErrNotFound, KErrorItemNotFound );
+            }
+        else
+            {
+            CleanupStack::PushL( entryToDelete );
+            TRAP( err, entryView->DeleteL( *entryToDelete ) );
+            if ( err == KErrNone )
+                {
+                HTI_LOG_TEXT("calendar entrie deleted");
+                SendOkMsgL( KNullDesC8 );
+                }
+            else
+                {
+                HTI_LOG_TEXT( "Failed to delete calendar entry" )
+                SendErrorMessageL( KErrGeneral, KErrorFailedDelete );
+                }
+            CleanupStack::PopAndDestroy( entryToDelete );
+            }
+        }
+    CleanupStack::PopAndDestroy(); //entryView;
+    HTI_LOG_FUNC_OUT( "CPIMHandler::HandleVCalendarDeleteFuncL" );
+    }
+
+#if ( SYMBIAN_VERSION_SUPPORT < SYMBIAN_4 )  
+TInt CallNpdHlp( const TDesC& aCmd )
+    {
+    HTI_LOG_FUNC_IN( "CallNpdHlp" );
+
+    RProcess HtiNpdHlp;
+    TInt err = HtiNpdHlp.Create( KHtiNpdHlpExe, aCmd );
+    if ( err )
+        {
+        HTI_LOG_FORMAT( "Could not create HtiNpdHlp.Exe process %d", err );
+        return err;
+        }
+
+    TRequestStatus status;
+    HtiNpdHlp.Logon( status );
+    HtiNpdHlp.Resume();
+    User::WaitForRequest( status );
+    if ( status.Int() != KErrNone )
+        {
+        HTI_LOG_FORMAT( "status     %d", status.Int() );
+        HTI_LOG_FORMAT( "ExitReason %d", HtiNpdHlp.ExitReason() );
+        HTI_LOG_FORMAT( "ExitType   %d", HtiNpdHlp.ExitType() );
+        HtiNpdHlp.Close();
+        return status.Int();
+        }
+
+    HtiNpdHlp.Close();
+
+    HTI_LOG_FUNC_OUT( "CallNpdHlp" );
+    return KErrNone;
+    }
+#endif
+
+// ----------------------------------------------------------------------------
+void CPIMHandler::HandleNotepadAddMemoFuncL( const TDesC8& aData )
+    {
+    HTI_LOG_FUNC_IN( "CPIMHandler::HandleNotepadAddMemoFuncL" );
+#if ( SYMBIAN_VERSION_SUPPORT < SYMBIAN_4 ) 
+    if ( aData.Length() < 1 )
+        {
+        SendErrorMessageL( KErrArgument, KErrorMissingText );
+        return;
+        }
+
+    // convert text from TDesC8 -> TDesC
+    // expecting the input TDesC8 contains UTF-8 data
+    HBufC* text = CnvUtfConverter::ConvertToUnicodeFromUtf8L( aData );
+    HTI_LOG_TEXT( "CPIMHandler: Conversion to Unicode done" );
+    CleanupStack::PushL( text );
+
+    HBufC* cmd = HBufC::NewLC( KCmdAddMemo().Length() + 1 + ( *text ).Length() );
+    cmd->Des().Copy( KCmdAddMemo );
+    cmd->Des().Append( KCmdDelim );
+    cmd->Des().Append( *text );
+
+    TInt err = CallNpdHlp( *cmd );
+    if ( err )
+        {
+        SendErrorMessageL( err, KErrorNotepadAddMemoFailed );
+        }
+    else
+        {
+        SendNotepadOkMsgL( CHtiPIMServicePlugin::ENotepadAddMemo );
+        }
+
+    CleanupStack::PopAndDestroy( 2 ); // text, cmd
+#else
+    SendErrorMessageL(KErrNotSupported, KErrorNotepadNotSupported);
+#endif   
+    HTI_LOG_FUNC_OUT( "CPIMHandler::HandleNotepadAddMemoFuncL" );
+    }
+
+// ----------------------------------------------------------------------------
+void CPIMHandler::HandleNotepadAddMemoFromFileFuncL( const TDesC8& aData )
+    {
+    HTI_LOG_FUNC_IN( "CPIMHandler::HandleNotepadAddMemoFromFileFuncL" );
+#if ( SYMBIAN_VERSION_SUPPORT < SYMBIAN_4 ) 
+    if ( aData.Length() < 1 )
+        {
+        SendErrorMessageL( KErrArgument, KErrorMissingFilepath );
+        return;
+        }
+
+    // convert filename from TDesC8 -> TDesC
+    // expecting the input TDesC8 contains UTF-8 data
+    HBufC* filename = CnvUtfConverter::ConvertToUnicodeFromUtf8L( aData );
+    HTI_LOG_TEXT( "CPIMHandler: Conversion to Unicode done" );
+    CleanupStack::PushL( filename );
+
+    HBufC* cmd = HBufC::NewLC( KCmdAddMemoFromFile().Length() + 1 + ( *filename ).Length() );
+    cmd->Des().Copy( KCmdAddMemoFromFile );
+    cmd->Des().Append( KCmdDelim );
+    cmd->Des().Append( *filename );
+
+    TInt err = CallNpdHlp( *cmd );
+    if ( err )
+        {
+        SendErrorMessageL( err, KErrorNotepadAddMemoFromFileFailed );
+        }
+    else
+        {
+        SendNotepadOkMsgL( CHtiPIMServicePlugin::ENotepadAddMemoFromFile );
+        }
+
+    CleanupStack::PopAndDestroy( 2 ); // filename, cmd
+#else
+    SendErrorMessageL(KErrNotSupported, KErrorNotepadNotSupported);
+#endif 
+    HTI_LOG_FUNC_OUT( "CPIMHandler::HandleNotepadAddMemoFromFileFuncL" );
+    }
+
+// ----------------------------------------------------------------------------
+void CPIMHandler::HandleNotepadDeleteAllFuncL()
+    {
+    HTI_LOG_FUNC_IN( "CPIMHandler::HandleNotepadDeleteAllFuncL" );
+#if ( SYMBIAN_VERSION_SUPPORT < SYMBIAN_4 ) 
+    TInt err = CallNpdHlp( KCmdDeleteAll() );
+    if ( err )
+        {
+        SendErrorMessageL( err, KErrorNotepadDeleteAllFailed );
+        }
+    else
+        {
+        SendNotepadOkMsgL( CHtiPIMServicePlugin::ENotepadDeleteAll );
+        }
+#else
+    SendErrorMessageL(KErrNotSupported, KErrorNotepadNotSupported);
+#endif 
+    HTI_LOG_FUNC_OUT( "CPIMHandler::HandleNotepadDeleteAllFuncL" );
+    }
+
+// ----------------------------------------------------------------------------
+void CPIMHandler::SendNotepadOkMsgL( CHtiPIMServicePlugin::TCommand aCommand )
+    {
+    HTI_LOG_FUNC_IN( "CPIMHandler::SendNotepadOkMsgL" );
+    TBuf8<1> msg;
+    msg.Append( aCommand );
+    User::LeaveIfError( iDispatcher->DispatchOutgoingMessage(
+                        msg.AllocL(), KPIMServiceUid ) );
+    iIsBusy = EFalse;
+    HTI_LOG_FUNC_OUT( "CPIMHandler::SendNotepadOkMsgL" );
+    }
+
+// ----------------------------------------------------------------------------
+void CPIMHandler::SendOkMsgL( const TDesC8& aData )
+    {
+    HTI_LOG_FUNC_IN( "CPIMHandler::SendOkMsgL: Starting" );
+
+    User::LeaveIfNull( iDispatcher );
+
+    HBufC8* temp = HBufC8::NewL( aData.Length() + 1 );
+    TPtr8 response = temp->Des();
+    response.Append( ( TChar ) CHtiPIMServicePlugin::EResultOk );
+    response.Append( aData );
+    User::LeaveIfError( iDispatcher->DispatchOutgoingMessage(
+        temp, KPIMServiceUid ) );
+    iIsBusy = EFalse;
+    HTI_LOG_FUNC_OUT( "CPIMHandler::SendOkMsgL: Done" );
+    }
+
+// ----------------------------------------------------------------------------
+void CPIMHandler::SendErrorMessageL( TInt aError, const TDesC8& aDescription )
+    {
+    HTI_LOG_FUNC_IN( "CPIMHandler::SendErrorMessageL: Starting" );
+    User::LeaveIfNull( iDispatcher );
+    User::LeaveIfError( iDispatcher->DispatchOutgoingErrorMessage(
+        aError, aDescription, KPIMServiceUid ) );
+    iIsBusy = EFalse;
+    HTI_LOG_FUNC_OUT( "CPIMHandler::SendErrorMessageL: Done" );
+    }
+
+// ----------------------------------------------------------------------------
+// CPIMHandler::Progress
+// Called during calendar entry view creation and operations.
+// Called only if NotifyProgress returns ETrue.
+// From MCalProgressCallBack
+// ----------------------------------------------------------------------------
+void CPIMHandler::Progress( TInt /*aProgress*/ )
+    {
+    }
+
+// ----------------------------------------------------------------------------
+// CPIMHandler::Completed
+// Called on completion of calendar entry view creation and operations
+// From MCalProgressCallBack
+// ----------------------------------------------------------------------------
+void CPIMHandler::Completed( TInt aError )
+    {
+    HTI_LOG_FUNC_IN( "CPIMHandler::Completed" );
+    HTI_LOG_FORMAT( "Completed with error code %d", aError );
+    iEntryViewErr = aError;
+    iWaiter->AsyncStop();
+    HTI_LOG_FUNC_OUT( "CPIMHandler::Completed" );
+    }
+
+// ----------------------------------------------------------------------------
+// CPIMHandler::NotifyProgress
+// Returns whether or not progress notification is required
+// From MCalProgressCallBack
+// ----------------------------------------------------------------------------
+TBool CPIMHandler::NotifyProgress()
+    {
+    HTI_LOG_FUNC_IN( "CPIMHandler::NotifyProgress" );
+    HTI_LOG_FUNC_OUT( "CPIMHandler::NotifyProgress" );
+    return EFalse; // Don't notify about progress
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiServicePlugins/HtiPIMServicePlugin/src/proxy.cpp	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,37 @@
+/*
+* 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 proxy for PIM service plugin dll
+*
+*/
+
+
+// INCLUDE FILES
+#include "HtiPIMServicePlugin.h"
+
+#include <e32std.h>
+#include <ecom/implementationproxy.h>
+
+// Provides a key value pair table, this is used to identify
+// the correct construction function for the requested interface.
+const TImplementationProxy ImplementationTable[] =
+    {
+    IMPLEMENTATION_PROXY_ENTRY( 0x200212C4, CHtiPIMServicePlugin::NewL )
+    };
+
+// Function used to return an instance of the proxy table.
+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/htiui/HtiServicePlugins/HtiScreenshotServicePlugin/data/1020DEC2.rss	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,48 @@
+/*
+* 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:  Resource definitions for screenshot service ECOM plugin.
+*
+*/
+
+
+// INCLUDES
+#include <ecom/registryinfo.rh>
+
+//  RESOURCE DEFINITIONS
+RESOURCE REGISTRY_INFO theInfo
+    {
+    // UID for the DLL
+    dll_uid = 0x1020DEC2;
+    // Declare array of interface info
+    interfaces =
+        {
+        INTERFACE_INFO
+            {
+            // UID of interface that is implemented
+            interface_uid = 0x1020DEB7;
+            implementations =
+                {
+                IMPLEMENTATION_INFO
+                    {
+                    implementation_uid = 0x1020DEC3;
+                    version_no         = 1;
+                    display_name       = "Screenshot service";
+                    default_data       = "SCREEN";
+                    opaque_data        = "";
+                    }
+                };
+            }
+        };
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiServicePlugins/HtiScreenshotServicePlugin/group/HtiScreenshotServicePlugin.mmp	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,64 @@
+/*
+* 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:  HTI service plugin for taking screenshot.
+*
+*/
+
+
+#include <platform_paths.hrh>
+#include "../../../symbian_version.hrh"
+
+TARGET          HtiScreenshotServicePlugin.dll
+TARGETTYPE      PLUGIN
+
+// ECom Dll recognition UID followed by the unique UID for this dll
+UID             0x10009D8D 0x1020DEC2
+
+VENDORID        0x101FB657
+
+CAPABILITY      ALL -TCB
+
+SOURCEPATH      ../src
+SOURCE          proxy.cpp
+SOURCE          HtiScreenshotServicePlugin.cpp
+SOURCE          HtiTextRcg.cpp
+
+USERINCLUDE     ../inc
+APP_LAYER_SYSTEMINCLUDE
+
+START RESOURCE  ../data/1020DEC2.rss
+TARGET          HtiScreenshotServicePlugin.rsc
+END
+
+#if ( SYMBIAN_VERSION_SUPPORT < SYMBIAN_4 )
+LIBRARY         alfclient.lib
+#endif
+LIBRARY         avkon.lib
+LIBRARY         bitgdi.lib
+LIBRARY         ecom.lib
+LIBRARY         efsrv.lib
+LIBRARY         egul.lib
+LIBRARY         euser.lib
+LIBRARY         ezlib.lib
+LIBRARY         fbscli.lib
+LIBRARY         gdi.lib
+LIBRARY         hal.lib
+LIBRARY         imageconversion.lib
+LIBRARY         ws32.lib
+LIBRARY         flogger.lib
+LIBRARY         apgrfx.lib
+
+SMPSAFE
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiServicePlugins/HtiScreenshotServicePlugin/group/bld.inf	Wed Aug 25 15:45:01 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:  Build information file for HtiScreenshotServicePlugin
+*
+*/
+
+
+PRJ_PLATFORMS
+
+PRJ_EXPORTS
+
+PRJ_MMPFILES
+HtiScreenshotServicePlugin.mmp
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiServicePlugins/HtiScreenshotServicePlugin/inc/HtiScreenshotServicePlugin.h	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,265 @@
+/*
+* 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 ECOM plug-in service interface. Provides
+*                screenshot service.
+*
+*/
+
+
+#ifndef SCREENSHOOTPLUGIN_H
+#define SCREENSHOOTPLUGIN_H
+
+// INCLUDES
+#include <HtiServicePluginInterface.h>
+#include <w32std.h>
+#include <f32file.h>
+#include "HtiTextRcg.h"
+
+
+// FORWARD DECLARATIONS
+class CImageEncoder;
+
+
+// CLASS DECLARATIONS
+class MICLObserver
+    {
+public:
+    virtual void ICLComplete( TInt anError) = 0;
+    };
+
+class CICLHandler : public CActive
+    {
+public:
+    CICLHandler(CImageEncoder* aService, MICLObserver* anObserver);
+    ~CICLHandler();
+
+    void Start();
+
+protected: //from CActive
+    void RunL();
+    void DoCancel();
+    //TInt RunError(TInt aError);
+
+protected:
+    MICLObserver* iObserver;
+    CImageEncoder* iService;
+    };
+
+
+
+
+
+class MSeriesShotTimerObserver
+    {
+public:
+    virtual void TimerExpired( TInt aId ) = 0;
+    };
+
+
+
+class CSeriesShotTimer : public CTimer
+    {
+public:
+    static CSeriesShotTimer* NewL(MSeriesShotTimerObserver* aObserver,
+                                 TInt aId,
+                                 TTimeIntervalMicroSeconds32 aTime);
+    ~CSeriesShotTimer();
+    void Start();
+
+protected:
+    void ConstructL();
+    CSeriesShotTimer(MSeriesShotTimerObserver* aObserver,
+                    TInt aId,
+                    TTimeIntervalMicroSeconds32 aTime);
+public: // from CTimer
+    void RunL();
+
+private:
+    MSeriesShotTimerObserver* iObserver;
+    TInt iId;
+    TTimeIntervalMicroSeconds32 iTime;
+    };
+
+
+class MSeriesShotObserver
+    {
+public:
+    virtual void SeriesShotCompletedL( HBufC8* aMsg ) = 0;
+    virtual TBool StartShotL(TRect aRegion, TDisplayMode aDisplayMode, TDesC8 &aMimeType) = 0;
+    };
+
+
+class CHtiScreenshotServicePlugin; // forward declaration
+
+class CSeriesShot : public CBase,
+                    public MSeriesShotTimerObserver
+    {
+    enum TTimerType
+        {
+        EDuration,
+        EInterval
+        };
+public:
+    static CSeriesShot* NewL( MSeriesShotObserver* aServicePluginObserver );
+    CSeriesShot( MSeriesShotObserver* aServicePluginObserver );
+    virtual ~CSeriesShot();
+
+    void StartL( TTimeIntervalMicroSeconds32 aDuration,
+                 TTimeIntervalMicroSeconds32 aInterval,
+                 TDisplayMode aDisplayMode,
+                 TRect aRegion,
+                 TPtrC8 aMime);
+    TBool IsOngoing();
+    void SaveImage( TDesC8* aImage, TBool isCompressed );
+    void TriggerNewShot();
+    void Cancel();
+    void EncodeCompleted();
+    HBufC8* ConstructCompletedMessageL();
+
+protected:
+    void ConstructL();
+    void ClearShots();
+    void GetMIMEExtension(TDesC8 &aMime, TDes &aExt);
+
+public: // from MSeriesShotTimerObserver
+    void TimerExpired(TInt aId);
+
+private:
+    MSeriesShotObserver* iServicePluginObserver;
+    CSeriesShotTimer* iDurationTimer;
+    CSeriesShotTimer* iIntervalTimer;
+    TDisplayMode iDisplayMode;
+    TInt iIndex;
+    RFs iFs;
+    TBool isEncoding;
+    TBuf8<30> iMimeType;
+    TBuf<10>  iExtension;
+    TRect iRegion;
+    };
+
+
+
+class CHtiScreenshotServicePlugin : public CHTIServicePluginInterface,
+                                    public MICLObserver,
+                                    public MSeriesShotObserver
+    {
+public:
+
+    static CHtiScreenshotServicePlugin* NewL();
+
+    // Interface implementation
+    TBool IsBusy();
+    void ProcessMessageL(const TDesC8& aMessage, THtiMessagePriority aPriority);
+    void NotifyMemoryChange( TInt aAvailableMemory );
+
+    // Observer implementation
+    void ICLComplete( TInt anError); // from MICLObserver
+    void SeriesShotCompletedL( HBufC8* aMsg ); // from MSeriesShotObserver
+    TBool StartShotL(TRect aRegion, TDisplayMode aDisplayMode, TDesC8 &aMimeType); // from MSeriesShotObserver
+
+protected:
+
+    void ProcessTextRcgMessageL(const TDesC8& aMessage);
+    void ProcessTextBitmapMessageL(const TDesC8& aMessage);
+
+    void SendTextRecgReplyL(const TBool aResult, const TRect& aLocation,
+                            const TInt aFontIndex);
+
+
+    /**
+    * Selects fonts based on predefined platform-dependent strategy
+    *
+    */
+    TBool RecognizeTextL(const TDesC& aText,
+                        TRect& aResult,
+                        TInt& aFontIndex);
+
+    /**
+    * Extracts string from incoming request and convert it to unicode
+    * for non-unicode request
+    * aResult should have enough length
+    * Function returns either offset for a next parameter in aRequest
+    * or some symbian error code
+    */
+    TInt ParseString( const TDesC8& aRequest,
+                        TInt anOffset,
+                        TBool aUnicode,
+                        TDes& aResult);
+
+    void CopyUnicode( TDes & aTo, const TDesC8& aFrom );
+
+    /**
+    * Extract from request font description (font name, height, style)
+    */
+    TInt ParseFontSpec( const TDesC8& aRequest,
+                        TInt anOffset,
+                        TBool aUnicode,
+                        TFontSpec& aResult);
+
+    CWsScreenDevice* GetScreenDeviceL();
+
+    void CreateBitmapL( TRect& aRegion, TDisplayMode aMode = ENone);
+
+    void SelectEncoder( const TUid aEncoderUid );
+
+    //encode iScreen
+    void EncodeBitmapL(const TDesC8& aImageTypeMIME = KNullDesC8);
+
+    inline TInt ParseInt16( const TUint8* aStart );
+    inline TInt ParseInt32( const TUint8* aStart );
+
+    /**
+    * Compress content of iEncodedBitmap descriptor
+    */
+    TInt Compress();
+
+    CHtiScreenshotServicePlugin();
+    void ConstructL();
+
+    virtual ~CHtiScreenshotServicePlugin();
+
+    //void InitFontCache();
+
+    TBool IsMIMETypeSupported(TDesC8 &aMime);
+    
+    void SetScreenNumber(TInt aScreenNumber);
+    
+    void HandleRotateScreen(const TDesC8& aData);
+protected:
+    CFbsBitmap* iScreen; //raw screen bitmap
+    HBufC8* iEncodedBitmap; //ready to send
+
+    RWsSession iWs;
+    CWsScreenDevice* iScreenDevice;
+
+    CImageEncoder* iBitmapEncoder;
+    CICLHandler* iICLHandler;
+
+    TBool iCompress;
+
+    //text recognition algorithms
+    CHtiTextRcg iTextRcg;
+    //fonts to use for recognition
+    RArray<TFontSpec> iFontCache;
+
+    // Series shot implementation
+    CSeriesShot*    iSeriesShot;
+
+    // Members for deltacapture
+    TBool       iDeltaCapture;
+    CFbsBitmap* iPreviousBitmap;
+    TRect       iDeltaRect;
+    };
+
+#endif // SCREENSHOOTPLUGIN_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiServicePlugins/HtiScreenshotServicePlugin/inc/HtiTextRcg.h	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,178 @@
+/*
+* 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:  Text recognition algorithm implementation.
+*
+*/
+
+
+#ifndef __HTI_TEXT_RCG_
+#define __HTI_TEXT_RCG_
+
+#include <fbs.h>
+#include <gulfont.h>
+#include <e32math.h>
+
+const TInt KDefaultAvgDiffMin = 50;
+const TInt KDefaultFgSSMin = 50;
+const TInt KDefaultFgAvgDiffMin = 5; //in "pure" (not AA) pixels
+const TInt KWorstCase = 0xFF;
+const TInt KSuccessThresold = 50;
+const TInt KNormCoefAcc = 2;
+
+const TInt KDefaultFGAAmount = 5;
+const TInt KDefaultBGAAmount = 10;
+
+const TInt KFgPatternColor = 0x00; //black
+const TInt KBgPatternColor = 0xff; //white
+
+TInt CompareTPoint(const TPoint& aP1,const TPoint& aP2);
+
+enum THtiTextRecgHints
+    {
+    EHintNone = 0,
+    EHintEdge = 1
+    };
+
+/**
+* The class implements text recognition algorithm on screenshots
+* based on system fonts
+*
+*/
+class CHtiTextRcg : public CBase
+{
+public:
+    CHtiTextRcg();
+    virtual ~CHtiTextRcg();
+
+    void SetHint(TInt aHint);
+
+    TBool RecognizeTextL(CFbsBitmap* aScreenshot,
+                        const TDesC& aText,
+                        const CFont* aFont,
+                        TRect& aResult);
+
+    /**
+    * aResult will contain the coordinates of the found text
+    *  Return 0 if match is perfect, 255 if text was not found
+    * return value from 0 to 255 means some error, the lower it is the better match
+    *
+    */
+    //brute force optim
+    TInt RecognizeAAL(CFbsBitmap* aScreenshot,const TDesC& aText, const CFont* aFont, TRect& aResult);
+    //brute force clean optim
+    TInt RecognizeBinL(CFbsBitmap* aScreenshot,const TDesC& aText, const CFont* aFont, TRect& aResult);
+
+    //static image processing routines
+    //convert image to 256-greyscale
+    static CFbsBitmap* ColorDownL(CFbsBitmap * aBitmap);
+    //generates bitmap of the text using the font given
+
+    static CFbsBitmap* GetTextBitmapL( const TDesC& aText,
+                            const CFont* fontUsed,
+                            const TInt aLength = KMaxTInt );
+
+    static CFbsBitmap* GetTextBitmapL( const TDesC& aText,
+                            const CFont* fontUsed,
+                            TRgb aForeground,
+                            TRgb aBackground,
+                            TDisplayMode aDisplayMode,
+                            const TInt aLength = KMaxTInt );
+
+    //calculates min max of a greyscale bitmap in question
+    static void MinMax(CFbsBitmap * aBitmap, TInt& aMin, TInt& aMax);
+
+    /**
+    * use FGA and BGA to speed-up comparation
+    * this function only returns 255 or 0
+    * Analyses only min and max colors
+    */
+    TInt ImageDiffBinSampleL(CFbsBitmap * aBitmap1, TPoint aOrigin1,
+                 CFbsBitmap * aBitmap2);
+
+    /**
+    * Iterations like in Diff5 but metrics from Diff6
+    * Used for full word checking if Diff6 is 0 for a letter
+    * this function only returns 255 or 0
+    */
+    TInt ImageDiffBinFullL(CFbsBitmap * aBitmap1, TPoint aOrigin1,
+                 CFbsBitmap * aBitmap2);
+
+    /**
+    * use FGA and BGA to speed-up comparation and AA pixels
+    */
+    TInt ImageDiffAASampleL(CFbsBitmap * aBitmap1, TPoint aOrigin1,
+                 CFbsBitmap * aBitmap2);
+
+    /**
+    * Iterations like in Diff5 but metrics from Diff6/DiffAASample
+    * Used for full word checking if Diff6 is 0 for a letter
+    */
+    TInt ImageDiffAAFullL(CFbsBitmap * aBitmap1, TPoint aOrigin1,
+                 CFbsBitmap * aBitmap2);
+
+    /*
+    * Analyze pattern and fills in FGA and BGA sets
+    * Return ETrue if pattern is valid (non empty)
+    */
+    TBool AnalyzePatternL(CFbsBitmap * aPattern);
+
+private:
+    //algorithm parameters
+    //minimal abs avarage difference beetwen foreground and background
+    TInt iAvgDiffMin;
+    //minimal SS for foreground, with plain color should be 0
+    TInt iFgSSMin;
+    /**
+    * minimal avg diff for foreground, used in Diff3
+    */
+    TInt iFgAvgDiffMin;
+
+    //TInt64 iSeed;
+
+    //following vars set by AnalyzePatternL
+    TInt iFGAAmount;
+    TInt iBGAAmount;
+    //foreground assesment point set
+    RArray<TPoint> iFGASet;
+    //background assesment point set
+    RArray<TPoint> iBGASet;
+
+    //font color in reference image
+    TInt iMaskFgColor;//
+    //background color in reference image
+    TInt iMaskBgColor;//
+
+    //used for AA algorithm
+    //set in Sample function and used in Full function
+    //for optimization
+    TInt iTestFgColor;
+    TInt iTestBgColor;
+
+    // normalization coeff to compare test image with mask directly
+    // |iMaskFgColor-iMaskBgColor|*NormCoefAcc)/|iTestFgColor-iTestBgColor|
+    // where NormCoefAcc multiplyer is used to increase accuracy (all ints)
+    // and is implemented as shif by KNormCoefAcc bits
+    // back shift is performed after color is multiplied by iTestNormCoef
+    TInt iTestNormCoef;
+
+    /**
+    * Current recognition method
+    * Changed by SetHint
+    */
+    TInt iCurrentStrategy;
+};
+
+#endif //__HTI_TEXT_RCG_
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiServicePlugins/HtiScreenshotServicePlugin/src/HtiScreenshotServicePlugin.cpp	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,2559 @@
+/*
+* 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:  SysInfoPlugin implementation
+*
+*/
+
+
+// INCLUDE FILES
+#include "../../../symbian_version.hrh"
+
+
+#include "HtiScreenshotServicePlugin.h"
+#include <HtiDispatcherInterface.h>
+#include <HtiLogging.h>
+
+#include <imageconversion.h>
+#include <ezcompressor.h>
+#include <hal.h>
+
+#include <AknLayoutConfig.h>
+#include <apgtask.h> 
+#include <AknCapServerDefs.h>
+
+#if ( SYMBIAN_VERSION_SUPPORT < SYMBIAN_4 )
+#include <alf/alfdrawer.h>
+#endif
+
+// CONSTANTS
+const static TUid KScreenshotServiceUid = {0x1020DEC3};
+
+enum TScreenCommands
+    {
+    // Normal screencapture
+    ECmdScreen                = 0x01,
+    ECmdScreenRegion          = 0x02,
+    ECmdScreenZip             = 0x03,
+    ECmdScreenRegionZip       = 0x04,
+
+    // Text recognition
+    ECmdTextRcg               = 0x10,
+    ECmdTextRcg_u             = 0x11,
+
+    // Text bitmap
+    ECmdTextBitmap            = 0x12,
+    ECmdTextBitmap_u          = 0x13,
+
+    // Screencapture in series
+    ECmdScreenSeries          = 0x21,
+    ECmdScreenRegionSeries    = 0x22,
+    ECmdScreenZipSeries       = 0x23,
+    ECmdScreenRegionZipSeries = 0x24,
+
+    // Selects the screen to use
+    ECmdSelectScreen          = 0x30,
+
+    // Gets the current screen size and orientation
+    ECmdScreenMode            = 0x3A,
+    
+    // Rotates the screen to portrait or landscape
+    ECmdRotateScreen          = 0x3B,
+
+    // Screencapture on updated part of screen only
+    ECmdDeltaCaptureMask           = 0x80,
+    ECmdDeltaScreen                = 0x81,
+    ECmdDeltaScreenRegion          = 0x82,
+    ECmdDeltaScreenZip             = 0x83,
+    ECmdDeltaScreenRegionZip       = 0x84,
+    ECmdDeltaScreenReset           = 0x85
+    //ECmdDeltaScreenSeries          = 0xA1,
+    //ECmdDeltaScreenRegionSeries    = 0xA2,
+    //ECmdDeltaScreenZipSeries       = 0xA3,
+    //ECmdDeltaScreenRegionZipSeries = 0xA4
+    };
+
+enum TScreenResponse
+    {
+    ERspOk = 0xF0,
+    ERspNotFound = 0xF1
+    };
+
+enum THtiFontAttributes
+    {
+    EHtiFontAttBold = 0x01,
+    EHtiFontAttItalic = 0x02,
+    EHtiFontAttNotAA = 0x04,
+    EHtiFontAttPrintPositionFlag = 0x08,
+    EHtiFontAttPrintPositionValue = 0x10
+    };
+
+const static TInt KHtiFontAttSuperscriptValue = 0;
+const static TInt KHtiFontAttSubscriptValue = 1;
+
+//1 byte for cmd and 2*4 for 4 coordinates
+const static TInt KMinScreenRegionCmdLength = 9;
+const static TInt KScreenDisplayOffset = 1;
+const static TInt KScreenMIMEOffset = KScreenDisplayOffset + 1;
+const static TInt KScreenScreenNumber = KScreenMIMEOffset + 8;
+const static TInt KRegionDisplayOffset = KMinScreenRegionCmdLength;
+const static TInt KRegionMIMEOffset = KRegionDisplayOffset + 1;
+const static TInt KRegionScreenNumber = KRegionMIMEOffset + 8;
+
+const static TInt KSeriesDurationOffset = 1;
+const static TInt KSeriesIntervalOffset = KSeriesDurationOffset + 4;
+const static TInt KSeriesDisplayOffset = KSeriesIntervalOffset + 4;
+const static TInt KSeriesMIMEOffset = KSeriesDisplayOffset + 1;
+const static TInt KSeriesScreenNumber = KSeriesMIMEOffset + 8;
+const static TInt KMinSeriesCmdLength = KSeriesMIMEOffset;
+
+const static TInt KRegionSeriesTlX = KSeriesDisplayOffset + 1;
+const static TInt KRegionSeriesTlY = KRegionSeriesTlX + 2;
+const static TInt KRegionSeriesBlX = KRegionSeriesTlY + 2;
+const static TInt KRegionSeriesBlY = KRegionSeriesBlX + 2;
+const static TInt KRegionSeriesMIMEOffset = KRegionSeriesBlY + 2;
+const static TInt KRegionSeriesScreenNumber = KRegionSeriesMIMEOffset + 8;
+const static TInt KMinRegionSeriesCmdLength = KRegionSeriesMIMEOffset;
+
+const static TInt KDeltaResetCmdLength = 1;
+const static TInt KScreenModeCmdLength = 1;
+
+const static TInt KScreenNrOffset = 1;
+const static TInt KSelectScreenCmdLength = 2;
+const static TInt KRotateScreenCmdLength = 2;
+
+_LIT( KSeriesShotPath, "c:\\Hti\\SeriesShot\\" );
+
+//errors' descriptions
+_LIT8( KErrDescrInvalid, "invalid arguments" );
+_LIT8( KErrDescrInvalidMode, "invalid color mode" );
+_LIT8( KErrDescrRegiontEmpty, "region is empty" );
+_LIT8( KErrDescrRegionNotNormailized, "region is not normalized" );
+_LIT8( KErrDescrRegionOutOfScreen, "region is out of screen" );
+_LIT8( KErrDescrUnknownCommand, "unknown command" );
+_LIT8( KErrDescrFailedConvert, "failed to convert to image format" );
+_LIT8( KErrDescrFailedCompress, "failed to compress" );
+_LIT8( KErrDescrMIMENotSupported, "MIME type not supported" );
+_LIT8( KErrDescrScreenNotSupported, "screen not supported" );
+
+_LIT( KScreenshotPanic, "Screenshot plug-in invalid state" );
+
+//_LIT(KS60Sans, "Series 60 Sans");
+//_LIT(KS60SansTitleBold, "Series 60 Sans TitleSmBd");
+
+//const TInt KFonHeighMin = 110;
+//const TInt KFonHeighMax = 190;
+/*
+// ----------------------------------------------------------------------------
+void CHtiScreenshotServicePlugin::InitFontCache()
+    {
+    //temporary
+    //just put harcoded data
+    //should be either external file or auto-defined based on logical fonts
+    //or some test app
+    TFontSpec fs;
+    fs.iFontStyle.SetBitmapType(EAntiAliasedGlyphBitmap);
+    //primary font
+    fs.iTypeface.iName = KS60Sans;
+    fs.iHeight = 161;
+    fs.iFontStyle.SetStrokeWeight(EStrokeWeightBold);
+    iFontCache.Append(fs);
+
+    fs.iFontStyle.SetStrokeWeight(EStrokeWeightNormal);
+
+    //Series 60 Sans TitleSmBd, 183
+    fs.iTypeface.iName = KS60SansTitleBold;
+    fs.iHeight = 183;
+    iFontCache.Append(fs);
+
+    //Series 60 Sans TitleSmBd, 172
+    fs.iTypeface.iName = KS60SansTitleBold;
+    fs.iHeight = 172;
+    iFontCache.Append(fs);
+
+    //Series 60 Sans,           122
+    fs.iTypeface.iName = KS60Sans;
+    fs.iHeight = 122;
+    iFontCache.Append(fs);
+    //Series 60 Sans,           116
+    fs.iTypeface.iName = KS60Sans;
+    fs.iHeight = 116;
+    iFontCache.Append(fs);
+
+    //Series 60 Sans TitleSmBd, 138
+    fs.iTypeface.iName = KS60SansTitleBold;
+    fs.iHeight = 138;
+    iFontCache.Append(fs);
+    }
+*/
+
+// ----------------------------------------------------------------------------
+TInt ImageDifferenceL( CFbsBitmap* aImage1, CFbsBitmap* aImage2,
+                       CFbsBitmap* &aResult, TRect &aRect )
+    {
+    HTI_LOG_TEXT( "ImageDifferenceL()" );
+
+    // By default return coordinates of the full image
+    aRect = TRect( 0, 0, aImage2->SizeInPixels().iWidth,
+                  aImage2->SizeInPixels().iHeight );
+
+//1. check that aImage1 and aImage2 are valid and can be compared
+    if ( aImage1 == NULL || aImage2 == NULL )
+        {
+        HTI_LOG_TEXT( "return KErrArgument" );
+        return KErrArgument;
+        }
+
+    if ( aImage1->SizeInPixels() != aImage2->SizeInPixels() )
+        {
+        HTI_LOG_TEXT( "return KErrGeneral (size)" );
+        return KErrGeneral;
+        }
+
+    if ( aImage1->DisplayMode() != aImage2->DisplayMode() )
+        {
+        HTI_LOG_TEXT( "return KErrGeneral (displaymode)" );
+        return KErrGeneral;
+        }
+
+
+//2. iterate through images from each border and compare to findout outline for diff region
+    TSize orgSize = aImage1->SizeInPixels();
+
+    TBitmapUtil srcBmpIterator1( aImage1 );
+    TBitmapUtil srcBmpIterator2( aImage2 );
+
+    srcBmpIterator1.Begin( TPoint( 0, 0 ) );
+    srcBmpIterator2.Begin( TPoint( 0, 0 ), srcBmpIterator1 );
+
+    TRect diffOutline = TRect( -1, -1, -1, -1 );
+
+    //2.1 top border iteration
+    TPoint c( 0,0 );
+    for ( ; c.iY < orgSize.iHeight && diffOutline.iTl.iY == -1; ++c.iY )
+        {
+        c.iX = 0;
+        srcBmpIterator1.SetPos( c );
+        srcBmpIterator2.SetPos( c );
+        for ( ; c.iX < orgSize.iWidth && diffOutline.iTl.iY == -1; ++c.iX )
+            {
+            if ( srcBmpIterator1.GetPixel() != srcBmpIterator2.GetPixel() )
+                {
+                diffOutline.iTl.iY = c.iY;
+                }
+
+            srcBmpIterator1.IncXPos();
+            srcBmpIterator2.IncXPos();
+            }
+        }
+
+    //2.2 bottom iteration
+    c.SetXY( 0, orgSize.iHeight - 1 );
+    for ( ; c.iY >= diffOutline.iTl.iY && diffOutline.iBr.iY == -1; --c.iY )
+        {
+        c.iX = 0;
+        srcBmpIterator1.SetPos( c );
+        srcBmpIterator2.SetPos( c );
+        for (; c.iX < orgSize.iWidth && diffOutline.iBr.iY == -1; ++c.iX )
+            {
+            if ( srcBmpIterator1.GetPixel() != srcBmpIterator2.GetPixel() )
+                {
+                diffOutline.iBr.iY = c.iY;
+                }
+
+            srcBmpIterator1.IncXPos();
+            srcBmpIterator2.IncXPos();
+            }
+        }
+
+    //2.3 left, goes in vertical lines
+    c.SetXY( 0, diffOutline.iTl.iY );
+    for ( ; c.iX < orgSize.iWidth && diffOutline.iTl.iX == -1; ++c.iX )
+        {
+        c.iY = diffOutline.iTl.iY;
+        srcBmpIterator1.SetPos( c );
+        srcBmpIterator2.SetPos( c );
+        for ( ; c.iY <= diffOutline.iBr.iY && diffOutline.iTl.iX == -1; ++c.iY )
+
+            {
+            if ( srcBmpIterator1.GetPixel() != srcBmpIterator2.GetPixel() )
+                {
+                diffOutline.iTl.iX = c.iX;
+                }
+
+            srcBmpIterator1.IncYPos();
+            srcBmpIterator2.IncYPos();
+            }
+        }
+    //2.4 right, goes in vertical lines
+    c.SetXY( orgSize.iWidth - 1, diffOutline.iTl.iY );
+    for ( ; c.iX >= diffOutline.iTl.iX && diffOutline.iBr.iX == -1; --c.iX )
+        {
+        c.iY = diffOutline.iTl.iY;
+        srcBmpIterator1.SetPos( c );
+        srcBmpIterator2.SetPos( c );
+        for ( ; c.iY <= diffOutline.iBr.iY && diffOutline.iBr.iX == -1; ++c.iY )
+
+            {
+            if ( srcBmpIterator1.GetPixel() != srcBmpIterator2.GetPixel() )
+                {
+                diffOutline.iBr.iX = c.iX;
+                }
+
+            srcBmpIterator1.IncYPos();
+            srcBmpIterator2.IncYPos();
+            }
+        }
+    srcBmpIterator2.End();
+    srcBmpIterator1.End();
+
+    //3. if there is some diff create CFbsBitmap in aResult and copy outlined image from aImage2
+    if ( diffOutline.iTl.iX == -1 &&
+         diffOutline.iTl.iY == -1 &&
+         diffOutline.iBr.iX == -1 &&
+         diffOutline.iBr.iY == -1 )
+        {
+        // No difference found
+        aRect = TRect( 0, 0, 0, 0 );
+        HTI_LOG_TEXT( "return KErrNotFound" );
+        return KErrNotFound;
+        }
+
+    aRect = diffOutline;
+
+    HTI_LOG_FORMAT( "Tlx - %d", aRect.iTl.iX );
+    HTI_LOG_FORMAT( "Tly - %d", aRect.iTl.iY );
+    HTI_LOG_FORMAT( "Bty - %d", aRect.iBr.iX );
+    HTI_LOG_FORMAT( "Bry - %d", aRect.iBr.iY );
+
+    // The bottom right co-ordinate is not included in the rectange
+    // (see TRect documentation) so we need to stretch the rectange
+    // for BitBlt to get the correct sized image.
+
+    TRect captureRect( diffOutline.iTl.iX, diffOutline.iTl.iY,
+                       diffOutline.iBr.iX + 1, diffOutline.iBr.iY + 1 );
+
+    aResult = new (ELeave) CFbsBitmap();
+    User::LeaveIfError( aResult->Create( captureRect.Size(), aImage2->DisplayMode() ) );
+    CleanupStack::PushL( aResult );
+
+    CFbsBitmapDevice* bmpDevice = CFbsBitmapDevice::NewL( aResult );
+    CleanupStack::PushL( bmpDevice );
+
+    CFbsBitGc* bmpCtx;
+    bmpDevice->CreateContext( bmpCtx );
+    bmpCtx->BitBlt( TPoint( 0, 0 ), aImage2, captureRect );
+
+    delete bmpCtx;
+    bmpCtx = NULL;
+
+    CleanupStack::PopAndDestroy(); // bmpDevice
+    CleanupStack::Pop(); // aResult
+
+    HTI_LOG_TEXT( "return KErrNone" );
+    return KErrNone;
+    }
+
+// ----------------------------------------------------------------------------
+CICLHandler::CICLHandler( CImageEncoder* aService, MICLObserver* anObserver ):
+    CActive( EPriorityStandard ),
+    iObserver( anObserver ),
+    iService( aService )
+    {
+    CActiveScheduler::Add( this );
+    }
+
+// ----------------------------------------------------------------------------
+CICLHandler::~CICLHandler()
+    {
+    Cancel();
+    }
+
+// ----------------------------------------------------------------------------
+void CICLHandler::Start()
+    {
+    SetActive();
+    }
+
+// ----------------------------------------------------------------------------
+void CICLHandler::RunL()
+    {
+    iObserver->ICLComplete( iStatus.Int() );
+    }
+
+// ----------------------------------------------------------------------------
+void CICLHandler::DoCancel()
+    {
+    iService->Cancel();
+    }
+
+/*
+// ----------------------------------------------------------------------------
+TInt CICLHandler::RunError(TInt aError)
+    {
+
+    }
+*/
+
+// ----------------------------------------------------------------------------
+// Create instance of concrete ECOM interface implementation
+CHtiScreenshotServicePlugin* CHtiScreenshotServicePlugin::NewL()
+    {
+    CHtiScreenshotServicePlugin* self = new (ELeave) CHtiScreenshotServicePlugin;
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop();
+    return self;
+    }
+
+// ----------------------------------------------------------------------------
+// Constructor
+CHtiScreenshotServicePlugin::CHtiScreenshotServicePlugin():
+    iScreen( NULL ),
+    iEncodedBitmap( NULL ),
+    iScreenDevice( NULL ),
+    iBitmapEncoder( NULL ),
+    iICLHandler( NULL ),
+    iCompress( EFalse ),
+    iDeltaCapture( EFalse ),
+    iPreviousBitmap( NULL )
+    {
+    }
+
+// ----------------------------------------------------------------------------
+CHtiScreenshotServicePlugin::~CHtiScreenshotServicePlugin()
+    {
+    HTI_LOG_FUNC_IN( "~CHtiScreenshotServicePlugin" );
+
+    iFontCache.Close();
+
+    delete iScreen;
+    delete iEncodedBitmap;
+
+    delete iICLHandler;
+    delete iBitmapEncoder;
+
+    delete iScreenDevice;
+
+    delete iSeriesShot;
+
+    if ( iPreviousBitmap )
+        delete iPreviousBitmap;
+
+    iWs.Close();
+    HTI_LOG_FUNC_OUT( "~CHtiScreenshotServicePlugin" );
+    }
+
+// ----------------------------------------------------------------------------
+// Second phase construction.
+void CHtiScreenshotServicePlugin::ConstructL()
+    {
+    HTI_LOG_FUNC_IN( "CHtiScreenshotServicePlugin::ConstructL" );
+    User::LeaveIfError( iWs.Connect() );
+
+    iScreenDevice = new ( ELeave ) CWsScreenDevice( iWs );
+    User::LeaveIfError( iScreenDevice->Construct() );
+
+    //InitFontCache();
+
+    iSeriesShot = CSeriesShot::NewL( this );
+
+    iPreviousBitmap = new ( ELeave ) CFbsBitmap;
+
+    //SelectEncoder( KImageTypeBMPUid );
+    HTI_LOG_FUNC_OUT( "CHtiScreenshotServicePlugin::ConstructL" );
+    }
+
+// ----------------------------------------------------------------------------
+TBool CHtiScreenshotServicePlugin::IsBusy()
+    {
+    if ( iICLHandler )
+        {
+        return iICLHandler->IsActive();
+        }
+
+    if ( iSeriesShot->IsOngoing() )
+        {
+        return ETrue;
+        }
+
+    return iEncodedBitmap != NULL;
+    }
+
+// ----------------------------------------------------------------------------
+inline TInt CHtiScreenshotServicePlugin::ParseInt16( const TUint8* aStart )
+    {
+    return aStart[0] + (aStart[1]<<8);
+    }
+
+// ----------------------------------------------------------------------------
+inline TInt CHtiScreenshotServicePlugin::ParseInt32( const TUint8* aStart )
+    {
+    return aStart[0] + (aStart[1]<<8) + (aStart[2]<<16) + (aStart[3]<<24);
+    }
+
+// ----------------------------------------------------------------------------
+void CHtiScreenshotServicePlugin::SendTextRecgReplyL(
+                                    const TBool aResult,
+                                    const TRect& aLocation,
+                                    const TInt aFontIndex)
+    {
+    HTI_LOG_FUNC_IN( "SendTextRecgReplyL" );
+    HBufC8* sendMsg = HBufC8::NewL( 10 );
+    CleanupStack::PushL( sendMsg );
+    if ( aResult )
+        {
+        sendMsg->Des().Append( ERspOk );
+        TUint16 co = aLocation.iTl.iX;
+        sendMsg->Des().Append( (TUint8*)(&co), 2 );
+        co = aLocation.iTl.iY;
+        sendMsg->Des().Append( (TUint8*)(&co), 2 );
+        co = aLocation.iBr.iX;
+        sendMsg->Des().Append( (TUint8*)(&co), 2 );
+        co = aLocation.iBr.iY;
+        sendMsg->Des().Append( (TUint8*)(&co), 2 );
+        sendMsg->Des().Append( (TUint8)aFontIndex );
+        }
+    else
+        {
+        sendMsg->Des().Append( ERspNotFound );
+        sendMsg->Des().AppendFill( 0, 5 );
+        }
+
+    User::LeaveIfError( iDispatcher->DispatchOutgoingMessage(
+                            sendMsg,
+                            KScreenshotServiceUid) );
+
+    CleanupStack::Pop();
+    HTI_LOG_FUNC_OUT( "SendTextRecgReplyL" );
+    }
+
+// ----------------------------------------------------------------------------
+void CHtiScreenshotServicePlugin::CopyUnicode( TDes & aTo, const TDesC8& aFrom )
+{
+    HTI_LOG_FUNC_IN( "CHtiScreenshotServicePlugin::CopyUnicode" );
+    //aTo.Copy( reinterpret_cast<const TUint16*>(aFrom.Ptr()), aFrom.Length() );
+    TInt len = aFrom.Length()>>1;
+    aTo.SetLength( len );
+    for ( TInt i = 0; i < len; ++i )
+    {
+        aTo[i] = (TUint16)aFrom[i<<1] + (((TUint16)aFrom[(i<<1)+1])<<8);
+    }
+    HTI_LOG_FUNC_OUT( "CHtiScreenshotServicePlugin::CopyUnicode" );
+}
+
+// ----------------------------------------------------------------------------
+TInt CHtiScreenshotServicePlugin::ParseString( const TDesC8& aRequest,
+                                        TInt anOffset,
+                                        TBool aUnicode,
+                                        TDes& aResult)
+    {
+    HTI_LOG_FUNC_IN( "CHtiScreenshotServicePlugin::ParseString" );
+    //validate parameters
+    //if offset outside the string return empty string
+    if ( anOffset >= aRequest.Size() )
+        {
+        return anOffset;
+        }
+
+    TInt len = aRequest[ anOffset ];
+    HTI_LOG_FORMAT( "len %d", len );
+
+    if ( len> aResult.MaxLength() )
+        {
+        return KErrBadDescriptor;
+        }
+
+    TInt nextOffset = ( aUnicode ? len * 2 : len ) + anOffset + 1;
+    HTI_LOG_FORMAT( "nextOffset %d", nextOffset );
+    HTI_LOG_FORMAT( "reqSize %d", aRequest.Size() );
+    if ( nextOffset > aRequest.Size() )
+        {
+        return KErrArgument;
+        }
+
+    if ( aUnicode )
+        {
+        //const TUint8* ptr = aRequest.Mid( anOffset + 1, len * 2 ).Ptr();
+        //aResult.Copy( (const TUint16*)ptr, len );
+        CopyUnicode( aResult, aRequest.Mid( anOffset + 1, len * 2 ) );
+        }
+    else
+        {
+        aResult.Copy( aRequest.Mid( anOffset + 1, len ) );
+        }
+
+    HTI_LOG_FUNC_OUT( "CHtiScreenshotServicePlugin::ParseString" );
+    return nextOffset;
+    }
+
+// ----------------------------------------------------------------------------
+TInt CHtiScreenshotServicePlugin::ParseFontSpec( const TDesC8& aRequest,
+                    TInt anOffset,
+                    TBool aUnicode,
+                    TFontSpec& aResult)
+    {
+    if ( anOffset >= aRequest.Size() )
+        {
+        return KErrArgument;
+        }
+
+    //get font name
+    TPtr tn = aResult.iTypeface.iName.Des();
+    TInt offset = ParseString( aRequest,
+                    anOffset,
+                    aUnicode,
+                    tn );
+
+    if ( offset > anOffset )
+        {
+        HTI_LOG_DES(aResult.iTypeface.iName);
+        //check that we have valid descr
+        if ( offset + 2 <= aRequest.Size() )
+            {
+            aResult.iHeight = ParseInt16( aRequest.Ptr() + offset );
+            HTI_LOG_FORMAT( "font height %d", aResult.iHeight );
+            //check style byte
+            TUint8 style = aRequest[ offset + 2 ];
+            HTI_LOG_FORMAT( "style %d", style );
+
+            //stroke bit
+            if ( style & EHtiFontAttBold )
+                {
+                aResult.iFontStyle.SetStrokeWeight(EStrokeWeightBold);
+                }
+            else
+                {
+                aResult.iFontStyle.SetStrokeWeight(EStrokeWeightNormal);
+                }
+            //posture
+            if ( style & EHtiFontAttItalic )
+                {
+                aResult.iFontStyle.SetPosture(EPostureItalic);
+                }
+            else
+                {
+                aResult.iFontStyle.SetPosture(EPostureUpright);
+                }
+            //bitmap glyph type
+            if ( style & EHtiFontAttNotAA )
+                {
+                aResult.iFontStyle.SetBitmapType( EMonochromeGlyphBitmap );
+                }
+            else
+                {
+                aResult.iFontStyle.SetBitmapType( EAntiAliasedGlyphBitmap );
+                }
+            //print position
+            if ( style & EHtiFontAttPrintPositionFlag )
+                {
+                TInt printPos = style & EHtiFontAttPrintPositionValue;
+                if ( printPos == KHtiFontAttSuperscriptValue )
+                    {
+                    aResult.iFontStyle.SetPrintPosition( EPrintPosSuperscript );
+                    }
+                else if ( printPos == KHtiFontAttSubscriptValue )
+                    {
+                    aResult.iFontStyle.SetPrintPosition( EPrintPosSubscript );
+                    }
+                }
+            else
+                {
+                aResult.iFontStyle.SetPrintPosition( EPrintPosNormal );
+                }
+            return offset + 3;
+            }
+        else
+            {
+            return KErrArgument;
+            }
+        }
+    else
+        {
+        return offset<0?offset:KErrArgument;
+        }
+    }
+
+// ----------------------------------------------------------------------------
+void CHtiScreenshotServicePlugin::ProcessTextRcgMessageL(
+                                    const TDesC8& aMessage)
+    {
+    HTI_LOG_FUNC_IN( "CHtiScreenshotServicePlugin::ProcessTextRcgMessageL" );
+    TBool unicode = aMessage[0] & 0x1;
+
+    TBuf<0xFF> text;
+
+    TInt offset = ParseString(aMessage, 1, unicode, text);
+
+    HTI_LOG_FORMAT( "offset %d ", offset );
+    if ( offset > 1 )
+        {
+        HTI_LOG_DES(text);
+
+        if ( offset + 1 < aMessage.Size() )
+            {
+            TInt numOfFonts = aMessage[ offset ];
+            HTI_LOG_FORMAT( "num of fonts %d", numOfFonts );
+            iFontCache.Reset();
+            TInt nextOffset  = offset + 1;
+            for ( TInt i = 0; i < numOfFonts; ++i )
+                {
+                TFontSpec fontSpec;
+                nextOffset = ParseFontSpec(aMessage,
+                                            nextOffset,
+                                            unicode,
+                                            fontSpec);
+                if ( nextOffset < 0 )
+                    {
+                    iDispatcher->DispatchOutgoingErrorMessage(
+                        nextOffset,
+                        KErrDescrInvalid,
+                        KScreenshotServiceUid);
+                    return;
+                    }
+                else
+                    {
+                    iFontCache.Append( fontSpec );
+                    }
+                }
+
+            //parameters parsing END
+            //get screenshot
+            TRect empty;
+            CreateBitmapL( empty, ENone );
+
+            //call text rcg routines
+            TInt fontIndex;
+            TRect resultRect;
+
+            //recognize text using fonts from iFontCache
+            TBool result = RecognizeTextL( text, resultRect, fontIndex );
+
+            SendTextRecgReplyL( result, resultRect, fontIndex );
+
+            delete iScreen;
+            iScreen = NULL;
+            }
+        else
+            {
+            //no fonts data
+            iDispatcher->DispatchOutgoingErrorMessage(
+                        KErrArgument,
+                        KErrDescrInvalid,
+                        KScreenshotServiceUid);
+
+            }
+        }
+    else if ( offset == 1 )
+        {
+        //empty text
+        iDispatcher->DispatchOutgoingErrorMessage(
+                        KErrArgument,
+                        KErrDescrInvalid,
+                        KScreenshotServiceUid);
+        }
+    else
+        {
+        //error
+        iDispatcher->DispatchOutgoingErrorMessage(
+                        offset,
+                        KErrDescrInvalid,
+                        KScreenshotServiceUid);
+        }
+    HTI_LOG_FUNC_OUT( "CHtiScreenshotServicePlugin::ProcessTextRcgMessageL" );
+    }
+
+// ----------------------------------------------------------------------------
+void CHtiScreenshotServicePlugin::ProcessTextBitmapMessageL(
+                                    const TDesC8& aMessage)
+    {
+    HTI_LOG_FUNC_IN( "CHtiScreenshotServicePlugin::ProcessTextBitmapMessageL" );
+    TBool unicode = aMessage[0] & 0x1;
+
+    TDisplayMode displayMode = ENone;
+    //check display
+    if ( aMessage.Size() > KScreenDisplayOffset )
+        {
+        displayMode = (TDisplayMode)aMessage[KScreenDisplayOffset];
+        if ( displayMode >= EColorLast )
+            {
+            iDispatcher->DispatchOutgoingErrorMessage(
+                            KErrArgument,
+                            KErrDescrInvalidMode,
+                            KScreenshotServiceUid);
+            return;
+            }
+        }
+
+    //check mime
+    TPtrC8 mime;
+    if ( aMessage[KScreenMIMEOffset] > 0 &&
+        ( aMessage[KScreenMIMEOffset] + KScreenMIMEOffset+1 ) < aMessage.Size() )
+        {
+        mime.Set( aMessage.Mid(KScreenMIMEOffset+1, aMessage[KScreenMIMEOffset] ) );
+        if ( !IsMIMETypeSupported( mime ) )
+            {
+            iDispatcher->DispatchOutgoingErrorMessage(
+                            KErrArgument,
+                            KErrDescrMIMENotSupported,
+                            KScreenshotServiceUid);
+            return;
+            }
+        }
+    else if ( aMessage[KScreenMIMEOffset] != 0 )
+        {
+        iDispatcher->DispatchOutgoingErrorMessage(
+                        KErrArgument,
+                        KErrDescrInvalidMode,
+                        KScreenshotServiceUid);
+        return;
+        }
+
+    TBuf<0xFF> text;
+    TInt preTextOffset = KScreenMIMEOffset + aMessage[KScreenMIMEOffset] + 1;
+    TInt offset = ParseString( aMessage, preTextOffset, unicode, text );
+
+    HTI_LOG_FORMAT( "offset %d ", offset );
+    if ( offset == preTextOffset )
+        {
+        //empty text
+        iDispatcher->DispatchOutgoingErrorMessage(
+                        KErrArgument,
+                        KErrDescrInvalid,
+                        KScreenshotServiceUid);
+        }
+    else if ( offset < preTextOffset )
+        {
+        //error
+        iDispatcher->DispatchOutgoingErrorMessage(
+                        offset,
+                        KErrDescrInvalid,
+                        KScreenshotServiceUid);
+        }
+
+    HTI_LOG_DES(text);
+    TFontSpec fontSpec;
+    offset = ParseFontSpec(aMessage,
+                            offset,
+                            unicode,
+                            fontSpec);
+    if ( offset < 0 )
+        {
+        iDispatcher->DispatchOutgoingErrorMessage(
+            offset,
+            KErrDescrInvalid,
+            KScreenshotServiceUid);
+
+        return;
+        }
+
+    //check colors
+    HTI_LOG_TEXT( "check colors" );
+    if ( offset + 2*4 != aMessage.Size() )
+        {
+        iDispatcher->DispatchOutgoingErrorMessage(
+            offset,
+            KErrDescrInvalid,
+            KScreenshotServiceUid);
+        return;
+        }
+
+    //extract colors
+    TUint32 fgColor = ParseInt32( aMessage.Ptr() + offset );
+    TUint32 bgColor = ParseInt32( aMessage.Ptr() + offset + 4 );
+    HTI_LOG_FORMAT( "FG color %d", fgColor );
+    HTI_LOG_FORMAT( "BG color %d", bgColor );
+
+    //END parsing
+    //generate and return bitmap
+    CFont* useFont;
+
+    User::LeaveIfError( iScreenDevice->GetNearestFontToDesignHeightInPixels(
+                            useFont, fontSpec ) );
+
+    TDisplayMode dm = displayMode==ENone || displayMode==0?
+                                        iScreenDevice->DisplayMode():
+                                        displayMode;
+
+
+    delete iScreen;
+    iScreen = NULL;
+    iScreen = CHtiTextRcg::GetTextBitmapL(
+                            text,
+                            useFont,
+                            TRgb( fgColor ),
+                            TRgb( bgColor ),
+                            dm );
+
+    iScreenDevice->ReleaseFont( useFont );
+
+    //Encode iBitmap
+    iCompress = EFalse;
+    if ( mime.Length() == 0 )
+        {
+        EncodeBitmapL(); //use default encoder BMP
+        }
+    else
+        {
+        HTI_LOG_DES( mime );
+        EncodeBitmapL( mime );
+        }
+
+    HTI_LOG_FUNC_OUT( "CHtiScreenshotServicePlugin::ProcessTextBitmapMessageL" );
+    }
+
+/*
+// ----------------------------------------------------------------------------
+TBool CHtiScreenshotServicePlugin::RecognizeTextAllL(
+                        const TDesC& aText,
+                        TPoint& aResult)
+    {
+    HTI_LOG_FUNC_IN( "CHtiScreenshotServicePlugin::RecognizeTextAllL" );
+
+    TSize screenRect = iScreenDevice->SizeInPixels();
+    TInt nofTF = iScreenDevice->NumTypefaces();
+    HTI_LOG_FORMAT( "Number of typefaces %d", nofTF );
+    TBool returnValue = EFalse;
+    for ( TInt i = 0; i < nofTF; ++i )
+        {
+        TTypefaceSupport tf;
+        iScreenDevice->TypefaceSupport(tf, i);
+
+        HTI_LOG_DES(tf.iTypeface.iName);
+
+        if ( tf.iIsScalable )
+            {
+            //iterate throuh heighes
+
+            HTI_LOG_FORMAT( "num of heighs %d", tf.iNumHeights );
+            HTI_LOG_FORMAT( "min h in tw %d", tf.iMinHeightInTwips );
+            HTI_LOG_FORMAT( "max h in tw %d", tf.iMaxHeightInTwips );
+            HTI_LOG_FORMAT( "scalable %d", tf.iIsScalable );
+
+            HTI_LOG_TEXT( "-----------------------" );
+
+            TInt minHeight = Max(tf.iMinHeightInTwips, KFonHeighMin );
+            TInt maxHeight = Min(tf.iMaxHeightInTwips, KFonHeighMax );
+
+            if ( minHeight > maxHeight )
+                {
+                continue;
+                }
+
+            for ( TInt v = 0; v < 2; ++v )
+                {
+                TInt lastFontHeight = 0;
+                for ( TInt fh = minHeight; fh <= maxHeight; ++fh )
+                    {
+                    TFontSpec fs( tf.iTypeface.iName, fh );
+                    fs.iFontStyle.SetBitmapType( EAntiAliasedGlyphBitmap );
+                    switch ( v )
+                        {
+                        case 1:
+                            {
+                            fs.iFontStyle.SetStrokeWeight(EStrokeWeightBold);
+                            HTI_LOG_TEXT( "BOLD" );
+                            }
+                            break;
+                        default:
+                            {
+                            HTI_LOG_TEXT( "DEFAULT" );
+                            }
+                        }
+                    HTI_LOG_FORMAT( "hh  %d", fh );
+
+                    CFont* useFont = NULL;
+
+                    iScreenDevice->GetNearestFontToDesignHeightInTwips(useFont, fs);
+
+                    if ( screenRect.iHeight < useFont->HeightInPixels() ||
+                         screenRect.iWidth < useFont->MaxNormalCharWidthInPixels()
+                        )
+                        {
+                        break;
+                        }
+
+                    if ( useFont->HeightInPixels() == lastFontHeight )
+                        {
+                        continue;
+                        }
+
+
+                    lastFontHeight = useFont->HeightInPixels();
+
+                    returnValue = iTextRcg.RecognizeTextL(
+                                                iScreen,
+                                                aText,
+                                                useFont,
+                                                aResult);
+                    //HTI_LOG_TEXT( "ReleaseFont" );
+                    iScreenDevice->ReleaseFont(useFont);
+
+                    if ( returnValue )
+                        {
+                        HTI_LOG_TEXT( "Found" );
+                        HTI_LOG_DES( aText );
+                        HTI_LOG_DES( tf.iTypeface.iName );
+                        HTI_LOG_FORMAT( "Font height in twips %d", fh );
+                        HTI_LOG_FORMAT( "X %d", aResult.iX );
+                        HTI_LOG_FORMAT( "Y %d", aResult.iY );
+                        return returnValue;
+                        }
+                    }
+                }
+            }
+        else
+            {//non scal. font
+            TFontSpec fs( tf.iTypeface.iName,0 ); //height doesn't matter for
+                                                //not scalable font
+
+            CFont* useFont = NULL;
+            //HTI_LOG_TEXT( "GetFont" );
+            iScreenDevice->GetNearestFontToDesignHeightInTwips( useFont, fs );
+
+            returnValue = iTextRcg.RecognizeTextL(
+                                        iScreen,
+                                        aText,
+                                        useFont,
+                                        aResult );
+            //HTI_LOG_TEXT( "ReleaseFont" );
+            iScreenDevice->ReleaseFont( useFont );
+
+            if ( returnValue )
+                {
+                HTI_LOG_TEXT( "Found" );
+                HTI_LOG_DES( aText );
+                HTI_LOG_DES(tf.iTypeface.iName );
+                HTI_LOG_FORMAT( "X %d", aResult.iX );
+                HTI_LOG_FORMAT( "Y %d", aResult.iY );
+                return returnValue;
+                }
+            }
+        }
+
+    //
+
+    HTI_LOG_FUNC_OUT( "CHtiScreenshotServicePlugin::RecognizeTextAllL" );
+    //return returnValue;
+    return EFalse;
+    }
+*/
+
+// ----------------------------------------------------------------------------
+TBool CHtiScreenshotServicePlugin::RecognizeTextL(
+                        const TDesC& aText,
+                        TRect& aResult,
+                        TInt& aFontIndex)
+    {
+    HTI_LOG_FUNC_IN( "CHtiScreenshotServicePlugin::RecognizeTextL" );
+
+    TSize screenRect = iScreenDevice->SizeInPixels();
+    TInt cacheSize = iFontCache.Count();
+    HTI_LOG_FORMAT( "Cache size %d", cacheSize );
+
+    TBool returnValue = EFalse;
+    for ( TInt i = 0; i < cacheSize; ++i )
+        {
+        CFont* useFont = NULL;
+
+        User::LeaveIfError(iScreenDevice->GetNearestFontToDesignHeightInPixels(
+                                useFont, iFontCache[i] ) );
+        if ( iFontCache[i].iFontStyle.BitmapType()==EAntiAliasedGlyphBitmap )
+            {
+            iTextRcg.SetHint( EHintEdge );
+            }
+        else
+            {
+            iTextRcg.SetHint( EHintNone );
+            }
+
+        //check that font in valid size
+        if ( screenRect.iHeight < useFont->HeightInPixels() ||
+             screenRect.iWidth < useFont->MaxNormalCharWidthInPixels()
+            )
+            {
+            break;
+            }
+
+        returnValue = iTextRcg.RecognizeTextL( iScreen, aText, useFont,
+                aResult );
+
+        iScreenDevice->ReleaseFont( useFont );
+
+        if ( returnValue )
+            {
+            HTI_LOG_FORMAT( "Found! fontIndex %d", i );
+            HTI_LOG_DES( aText );
+            HTI_LOG_DES( iFontCache[i].iTypeface.iName );
+            HTI_LOG_FORMAT( "TL X %d", aResult.iTl.iX );
+            HTI_LOG_FORMAT( "TL Y %d", aResult.iTl.iY );
+            HTI_LOG_FORMAT( "BR X %d", aResult.iBr.iX );
+            HTI_LOG_FORMAT( "BR Y %d", aResult.iBr.iY );
+            aFontIndex = i;
+            return returnValue;
+            }
+        }
+
+    HTI_LOG_FUNC_OUT( "CHtiScreenshotServicePlugin::RecognizeTextL" );
+    return EFalse;
+    }
+
+/*
+TBool CHtiScreenshotServicePlugin::RecognizeTextL(
+                        const TDesC& aText,
+                        const TDesC& aTypeface,
+                        TPoint& aResult)
+    {
+    HTI_LOG_FUNC_IN( "RecognizeTextL typeface" );
+    //const CFont* fontUsed = NULL;// AknLayoutUtils::FontFromName(aTypeface);
+    CFont* useFont = NULL;
+    TFontSpec fs(aTypeface, 0);
+
+    iScreenDevice->GetNearestFontInTwips(useFont, fs);
+
+    TBool returnValue = iTextRcg.RecognizeTextL(iScreen, aText, useFont, aResult);
+
+HTI_LOG_FUNC_OUT( "RecognizeTextL" );
+    return returnValue;
+}
+*/
+
+// ----------------------------------------------------------------------------
+void CHtiScreenshotServicePlugin::ProcessMessageL(const TDesC8& aMessage,
+                THtiMessagePriority /*aPriority*/)
+    {
+    HTI_LOG_FUNC_IN( "CHtiScreenshotServicePlugin::ProcessMessage");
+
+    if ( iICLHandler )
+        {
+        if ( iICLHandler->IsActive() || iEncodedBitmap)
+            {
+            User::Leave( KErrInUse );
+            }
+        }
+
+    if ( iSeriesShot->IsOngoing() )
+        User::Leave( KErrInUse );
+
+    // update the current screen mode
+    TPixelsAndRotation currentPixelsAndRotation;
+    iScreenDevice->GetScreenModeSizeAndRotation(
+            iScreenDevice->CurrentScreenMode(), currentPixelsAndRotation );
+    iScreenDevice->SetScreenSizeAndRotation( currentPixelsAndRotation );
+
+    if ( aMessage.Length() > 0 )
+        {
+        // set/reset delta capture status
+        iDeltaCapture = ( aMessage[0] & ECmdDeltaCaptureMask ) ? ETrue : EFalse;
+        if ( iDeltaCapture )
+            {
+            HTI_LOG_TEXT( "DeltaCapture ETrue" );
+            }
+
+        //if text recogn call separate handler
+        if ( aMessage[0] == ECmdTextRcg ||
+             aMessage[0] == ECmdTextRcg_u )
+            {
+            ProcessTextRcgMessageL( aMessage );
+            return;
+            }
+        else if ( aMessage[0] == ECmdTextBitmap ||
+                  aMessage[0] == ECmdTextBitmap_u )
+            {
+            ProcessTextBitmapMessageL( aMessage );
+            return;
+            }
+
+        iCompress = ( aMessage[0] == ECmdScreenZip ) ||
+                    ( aMessage[0] == ECmdScreenRegionZip ) ||
+                    ( aMessage[0] == ECmdScreenZipSeries ) ||
+                    ( aMessage[0] == ECmdScreenRegionZipSeries ) ||
+                    ( aMessage[0] == ECmdDeltaScreenZip ) ||
+                    ( aMessage[0] == ECmdDeltaScreenRegionZip );
+
+        HTI_LOG_FORMAT( "cmd 0x%x", aMessage[0] );
+        TPtrC8 mime;
+
+        switch ( aMessage[0] )
+            {
+            case ECmdScreen:
+            case ECmdScreenZip:
+            case ECmdDeltaScreen:
+            case ECmdDeltaScreenZip:
+                {
+                TRect empty;
+                TDisplayMode displayMode = ENone;
+                //check display
+                if ( aMessage.Length() > KScreenDisplayOffset )
+                    {
+                    displayMode = ( TDisplayMode ) aMessage[KScreenDisplayOffset];
+                    if ( displayMode >= EColorLast )
+                        {
+                        iDispatcher->DispatchOutgoingErrorMessage(
+                                        KErrArgument,
+                                        KErrDescrInvalidMode,
+                                        KScreenshotServiceUid );
+                        return;
+                        }
+                    }
+
+                bool screenNumberSet = false;
+                //check screen number
+                if ( (aMessage.Length() > KScreenScreenNumber) && 
+                        ((aMessage[aMessage.Length()-1] == 0) || (aMessage[aMessage.Length()-1] == 1)))
+                    {
+                    TInt screenNumber = aMessage[aMessage.Length()-1];
+                    HTI_LOG_FORMAT( "set screen number: %d", screenNumber );
+                    screenNumberSet = true;
+                    TInt screens;
+                    TInt ret = HAL::Get(HAL::EDisplayNumberOfScreens, screens);
+                    if(ret)
+                        {
+                        HTI_LOG_FORMAT( "HAL::Get failed %d", ret );
+                        User::Leave(ret);
+                        }
+                    HTI_LOG_FORMAT( "HAL::Get number of screens %d", screens );
+                    if( ( screenNumber>screens-1 ) || ( screenNumber<0 ) )
+                        {
+                        iDispatcher->DispatchOutgoingErrorMessage(
+                                KErrArgument, KErrDescrScreenNotSupported, KScreenshotServiceUid);
+                        return;
+                        }
+                    SetScreenNumber(screenNumber);
+                    }
+
+                CreateBitmapL( empty, displayMode );
+
+                //check mime
+                if ( aMessage.Length() > KScreenMIMEOffset )
+                    {
+                    if(screenNumberSet)
+                        {
+                        mime.Set( aMessage.Mid( KScreenMIMEOffset, aMessage.Length()-1-KScreenMIMEOffset ) );
+                        }
+                    else
+                        {
+                        mime.Set( aMessage.Mid( KScreenMIMEOffset ) );
+                        }
+                    if ( !IsMIMETypeSupported( mime ) )
+                        {
+                        iDispatcher->DispatchOutgoingErrorMessage(
+                                        KErrArgument,
+                                        KErrDescrMIMENotSupported,
+                                        KScreenshotServiceUid );
+                        return;
+                        }
+                    }
+                }              
+                break;
+
+            case ECmdScreenRegion:
+            case ECmdScreenRegionZip:
+            case ECmdDeltaScreenRegion:
+            case ECmdDeltaScreenRegionZip:
+                {
+                //check screen number
+                bool screenNumberSet = false;
+                if ( (aMessage.Length() > KRegionScreenNumber) && 
+                        ((aMessage[aMessage.Length()-1] == 0) || (aMessage[aMessage.Length()-1] == 1)))
+                    {
+                    TInt screenNumber = aMessage[aMessage.Length()-1];
+                    screenNumberSet = true;
+                    TInt screens;
+                    TInt ret = HAL::Get(HAL::EDisplayNumberOfScreens, screens);
+                    if(ret)
+                        {
+                        HTI_LOG_FORMAT( "HAL::Get failed %d", ret );
+                        User::Leave(ret);
+                        }
+                    HTI_LOG_FORMAT( "HAL::Get number of screens %d", screens );
+                    if( ( screenNumber>screens-1 ) || ( screenNumber<0 ) )
+                        {
+                        iDispatcher->DispatchOutgoingErrorMessage(
+                                KErrArgument, KErrDescrScreenNotSupported, KScreenshotServiceUid);
+                        return;
+                        }
+                    SetScreenNumber(screenNumber);
+                    }
+
+                if ( aMessage.Length() >= KMinScreenRegionCmdLength )
+                    {
+                    TRect region;
+                    const TUint8* ptr = aMessage.Ptr();
+                    region.iTl.iX = ParseInt16( ptr + 1 );
+                    region.iTl.iY = ParseInt16( ptr + 3 );
+                    region.iBr.iX = ParseInt16( ptr + 5 );
+                    region.iBr.iY = ParseInt16( ptr + 7 );
+
+                    //check empty and normmalizaed
+                    if ( !region.IsNormalized() )
+                        {
+                        iDispatcher->DispatchOutgoingErrorMessage(
+                                        KErrArgument,
+                                        KErrDescrRegionNotNormailized,
+                                        KScreenshotServiceUid );
+                        return;
+                        }
+
+                    if ( region.IsEmpty() )
+                        {
+                        iDispatcher->DispatchOutgoingErrorMessage(
+                                        KErrArgument,
+                                        KErrDescrRegiontEmpty,
+                                        KScreenshotServiceUid );
+                        return;
+                        }
+
+                    TRect screenRect;
+                    screenRect.iBr = iScreenDevice->SizeInPixels().AsPoint();
+                    screenRect.iBr.iX++; //TRect::Contains() omitts
+                    screenRect.iBr.iY++; //right bottom rows
+
+                    TDisplayMode displayMode = ENone;
+                    if ( aMessage.Length() > KRegionDisplayOffset )
+                        {
+                        displayMode = ( TDisplayMode ) aMessage[KRegionDisplayOffset];
+                        if ( displayMode >= EColorLast )
+                            {
+                            iDispatcher->DispatchOutgoingErrorMessage(
+                                            KErrArgument,
+                                            KErrDescrInvalidMode,
+                                            KScreenshotServiceUid );
+                            return;
+                            }
+                        }
+
+                    if ( screenRect.Contains( region.iTl ) &&
+                         screenRect.Contains( region.iBr ) )
+                        {
+                        CreateBitmapL( region, displayMode );
+                        }
+                    else
+                        {
+                        iDispatcher->DispatchOutgoingErrorMessage(
+                                        KErrArgument,
+                                        KErrDescrRegionOutOfScreen,
+                                        KScreenshotServiceUid );
+                        return;
+                        }
+                    
+                    //check mime
+                    if ( aMessage.Length() > KRegionMIMEOffset )
+                        {
+                        if(!screenNumberSet)
+                            {
+                            mime.Set( aMessage.Mid( KRegionMIMEOffset ) );
+                            }
+                        else
+                            {
+                            mime.Set( aMessage.Mid( KRegionMIMEOffset, aMessage.Length()-1-KRegionMIMEOffset ) );
+                            }
+                        if ( !IsMIMETypeSupported( mime ) )
+                            {
+                            iDispatcher->DispatchOutgoingErrorMessage(
+                                            KErrArgument,
+                                            KErrDescrMIMENotSupported,
+                                            KScreenshotServiceUid );
+                            return;
+                            }
+                        }
+
+                    }
+                else
+                    {
+                    iDispatcher->DispatchOutgoingErrorMessage(
+                                    KErrArgument,
+                                    KErrDescrInvalid,
+                                    KScreenshotServiceUid );
+                    return;
+                    }
+                }
+                break;
+
+            case ECmdScreenSeries:
+            case ECmdScreenZipSeries:
+                {
+                if ( aMessage.Length() < KMinSeriesCmdLength )
+                    {
+                    iDispatcher->DispatchOutgoingErrorMessage(
+                                    KErrArgument,
+                                    KErrDescrInvalid,
+                                    KScreenshotServiceUid );
+                    return;
+                    }
+                
+                bool screenNumberSet = false;
+                if ( (aMessage.Length() > KSeriesScreenNumber) && 
+                        ((aMessage[aMessage.Length()-1] == 0) || (aMessage[aMessage.Length()-1] == 1)) )
+                    {
+                    TInt screenNumber = aMessage[aMessage.Length()-1];
+                    screenNumberSet = true;
+                    TInt screens;
+                    TInt ret = HAL::Get(HAL::EDisplayNumberOfScreens, screens);
+                    if(ret)
+                        {
+                        HTI_LOG_FORMAT( "HAL::Get failed %d", ret );
+                        User::Leave(ret);
+                        }
+                    HTI_LOG_FORMAT( "HAL::Get number of screens %d", screens );
+                    if( ( screenNumber>screens-1 ) || ( screenNumber<0 ) )
+                        {
+                        iDispatcher->DispatchOutgoingErrorMessage(
+                                KErrArgument, KErrDescrScreenNotSupported, KScreenshotServiceUid);
+                        return;
+                        }
+                    SetScreenNumber(screenNumber);
+                    }
+
+                TInt duration = ParseInt32( aMessage.Ptr() + KSeriesDurationOffset );
+                TInt interval = ParseInt32( aMessage.Ptr() + KSeriesIntervalOffset );
+
+                TDisplayMode displayMode = ( TDisplayMode ) aMessage[KSeriesDisplayOffset];
+                if ( displayMode >= EColorLast )
+                    {
+                    iDispatcher->DispatchOutgoingErrorMessage(
+                                    KErrArgument,
+                                    KErrDescrInvalidMode,
+                                    KScreenshotServiceUid );
+                    return;
+                    }
+                
+                if ( aMessage.Length() > KSeriesMIMEOffset )
+                    {
+                    if(screenNumberSet)
+                        {
+                        mime.Set( aMessage.Mid( KSeriesMIMEOffset, aMessage.Length()-1-KSeriesMIMEOffset ) );
+                        }
+                    else
+                        {
+                        mime.Set( aMessage.Mid( KSeriesMIMEOffset ) );
+                        }
+                    if ( !IsMIMETypeSupported( mime ) )
+                        {
+                        iDispatcher->DispatchOutgoingErrorMessage(
+                                        KErrArgument,
+                                        KErrDescrMIMENotSupported,
+                                        KScreenshotServiceUid );
+                        return;
+                        }
+                    }
+
+                TRect empty;
+                iSeriesShot->StartL( duration, interval, displayMode, empty, mime );
+                }
+                return;
+
+            case ECmdScreenRegionSeries:
+            case ECmdScreenRegionZipSeries:
+                {
+                bool screenNumberSet = false;
+                if ( (aMessage.Length() > KRegionSeriesScreenNumber) && 
+                        ((aMessage[aMessage.Length()-1] == 0) || (aMessage[aMessage.Length()-1] == 1)) )
+                    {
+                    TInt screenNumber = aMessage[aMessage.Length()-1];
+                    screenNumberSet = true;
+                    TInt screens;
+                    TInt ret = HAL::Get(HAL::EDisplayNumberOfScreens, screens);
+                    if(ret)
+                        {
+                        HTI_LOG_FORMAT( "HAL::Get failed %d", ret );
+                        User::Leave(ret);
+                        }
+                    HTI_LOG_FORMAT( "HAL::Get number of screens %d", screens );
+                    if( ( screenNumber>screens-1 ) || ( screenNumber<0 ) )
+                        {
+                        iDispatcher->DispatchOutgoingErrorMessage(
+                                KErrArgument, KErrDescrScreenNotSupported, KScreenshotServiceUid);
+                        return;
+                        }
+                    SetScreenNumber(screenNumber);
+                    }
+
+                if ( aMessage.Length() < KMinRegionSeriesCmdLength )
+                    {
+                    iDispatcher->DispatchOutgoingErrorMessage(
+                                    KErrArgument,
+                                    KErrDescrInvalid,
+                                    KScreenshotServiceUid);
+                    return;
+                    }
+                TInt duration = ParseInt32( aMessage.Ptr() + KSeriesDurationOffset );
+                TInt interval = ParseInt32( aMessage.Ptr() + KSeriesIntervalOffset );
+
+                TDisplayMode displayMode = ( TDisplayMode ) aMessage[KSeriesDisplayOffset];
+                if ( displayMode >= EColorLast )
+                    {
+                    iDispatcher->DispatchOutgoingErrorMessage(
+                                    KErrArgument,
+                                    KErrDescrInvalidMode,
+                                    KScreenshotServiceUid );
+                    return;
+                    }
+
+                TRect region;
+                const TUint8* ptr = aMessage.Ptr();
+                region.iTl.iX = ParseInt16( ptr + KRegionSeriesTlX );
+                region.iTl.iY = ParseInt16( ptr + KRegionSeriesTlY );
+                region.iBr.iX = ParseInt16( ptr + KRegionSeriesBlX );
+                region.iBr.iY = ParseInt16( ptr + KRegionSeriesBlY );
+
+                //check empty and normmalizaed
+                if ( !region.IsNormalized() )
+                    {
+                    iDispatcher->DispatchOutgoingErrorMessage(
+                                    KErrArgument,
+                                    KErrDescrRegionNotNormailized,
+                                    KScreenshotServiceUid );
+                    return;
+                    }
+
+                if ( region.IsEmpty() )
+                    {
+                    iDispatcher->DispatchOutgoingErrorMessage(
+                                    KErrArgument,
+                                    KErrDescrRegiontEmpty,
+                                    KScreenshotServiceUid );
+                    return;
+                    }
+
+                TRect screenRect;
+                screenRect.iBr = iScreenDevice->SizeInPixels().AsPoint();
+                screenRect.iBr.iX++; //TRect::Contains() omitts
+                screenRect.iBr.iY++; //right bottom rows
+
+                if ( !screenRect.Contains( region.iTl ) ||
+                     !screenRect.Contains( region.iBr ) )
+                    {
+                    iDispatcher->DispatchOutgoingErrorMessage(
+                                    KErrArgument,
+                                    KErrDescrRegionOutOfScreen,
+                                    KScreenshotServiceUid );
+                    return;
+                    }
+                
+                if ( aMessage.Length() > KRegionSeriesMIMEOffset )
+                    {
+                    if(screenNumberSet)
+                        {
+                        mime.Set( aMessage.Mid( KRegionSeriesMIMEOffset, aMessage.Length()-1-KRegionSeriesMIMEOffset ) );
+                        }
+                    else
+                        {
+                        mime.Set( aMessage.Mid( KRegionSeriesMIMEOffset ) );
+                        }
+                    if ( !IsMIMETypeSupported( mime ) )
+                        {
+                        iDispatcher->DispatchOutgoingErrorMessage(
+                                        KErrArgument,
+                                        KErrDescrMIMENotSupported,
+                                        KScreenshotServiceUid );
+                        return;
+                        }
+                    }
+
+                iSeriesShot->StartL( duration, interval, displayMode, region, mime );
+                }
+                return;
+
+            case ECmdSelectScreen:
+                {
+                if ( aMessage.Length() != KSelectScreenCmdLength )
+                    {
+                    iDispatcher->DispatchOutgoingErrorMessage(
+                                    KErrArgument,
+                                    KErrDescrInvalid,
+                                    KScreenshotServiceUid );
+                    return;
+                    }
+
+                TInt screenNr = aMessage[KScreenNrOffset];
+
+                TInt screens;
+                TInt ret=HAL::Get( HAL::EDisplayNumberOfScreens, screens );
+                if ( ret )
+                    {
+                    HTI_LOG_FORMAT( "HAL::Get failed %d", ret );
+                    User::Leave( ret );
+                    }
+
+
+                if ( ( screenNr > screens - 1 ) || ( screenNr < 0 ) )
+                    {
+                    iDispatcher->DispatchOutgoingErrorMessage(
+                                    KErrArgument,
+                                    KErrDescrScreenNotSupported,
+                                    KScreenshotServiceUid );
+                    return;
+                    }
+
+
+                HTI_LOG_FORMAT( "Number of screens %d", screens );
+                HTI_LOG_FORMAT( "Setting to screen index %d", screenNr );
+
+                // Clear the previous delta bitmap to avoid error
+                iPreviousBitmap->Reset();
+
+                // delete old screendevice and create a new one
+                delete iScreenDevice;
+                iScreenDevice = NULL;
+                iScreenDevice = new ( ELeave ) CWsScreenDevice( iWs );
+                User::LeaveIfError( iScreenDevice->Construct( screenNr ) );
+
+                TBuf8<1> okMsg;
+                okMsg.Append( ECmdSelectScreen );
+                iDispatcher->DispatchOutgoingMessage(
+                    okMsg.AllocL(), KScreenshotServiceUid );
+                }
+                return;
+
+            case ECmdDeltaScreenReset:
+                {
+                if ( aMessage.Length() != KDeltaResetCmdLength )
+                    {
+                    iDispatcher->DispatchOutgoingErrorMessage(
+                                    KErrArgument,
+                                    KErrDescrInvalid,
+                                    KScreenshotServiceUid );
+                    return;
+                    }
+
+                iPreviousBitmap->Reset();
+                TBuf8<1> okMsg;
+                okMsg.Append( ECmdDeltaScreenReset );
+                iDispatcher->DispatchOutgoingMessage(
+                    okMsg.AllocL(), KScreenshotServiceUid );
+                }
+                return;
+
+            case ECmdScreenMode:
+                {
+                if ( aMessage.Length() != KScreenModeCmdLength )
+                    {
+                    iDispatcher->DispatchOutgoingErrorMessage(
+                                    KErrArgument,
+                                    KErrDescrInvalid,
+                                    KScreenshotServiceUid );
+                    return;
+                    }
+
+                TInt focusScreen = iWs.GetFocusScreen();
+                TPixelsAndRotation sizeAndRotation;
+                TDisplayMode mode = ENone;
+                TInt thisScreen = iScreenDevice->GetScreenNumber();
+                iScreenDevice->GetDefaultScreenSizeAndRotation( sizeAndRotation );
+                mode = iScreenDevice->DisplayMode();
+
+                HTI_LOG_FORMAT( "This screen   = %d", thisScreen );
+                HTI_LOG_FORMAT( "Screen width  = %d", sizeAndRotation.iPixelSize.iWidth );
+                HTI_LOG_FORMAT( "Screen height = %d", sizeAndRotation.iPixelSize.iHeight );
+                HTI_LOG_FORMAT( "Rotation      = %d", sizeAndRotation.iRotation );
+                HTI_LOG_FORMAT( "Display mode  = %d", mode );
+                HTI_LOG_FORMAT( "Focus screen  = %d", focusScreen );
+                TBuf8<8> respMsg;
+                respMsg.Append( thisScreen );
+                respMsg.Append( ( TUint8* )( &( sizeAndRotation.iPixelSize.iWidth ) ), 2 );
+                respMsg.Append( ( TUint8* )( &( sizeAndRotation.iPixelSize.iHeight ) ), 2 );
+                respMsg.Append( sizeAndRotation.iRotation );
+                respMsg.Append( mode );
+                respMsg.Append( focusScreen );
+                iDispatcher->DispatchOutgoingMessage(
+                    respMsg.AllocL(), KScreenshotServiceUid );
+                }
+                return;
+           case ECmdRotateScreen:
+               {
+               if (aMessage.Length() != KRotateScreenCmdLength)
+                   {
+                   iDispatcher->DispatchOutgoingErrorMessage(KErrArgument,
+                           KErrDescrInvalid, KScreenshotServiceUid);
+                   return;
+                   }
+               HandleRotateScreen(aMessage.Right(aMessage.Length() -1));
+               return;
+               }
+            default:
+                //Error: unknown command
+                iDispatcher->DispatchOutgoingErrorMessage(
+                                KErrArgument,
+                                KErrDescrUnknownCommand,
+                                KScreenshotServiceUid );
+                return;
+            } // switch
+
+        //Encode iBitmap
+        if ( mime.Length() == 0 )
+            {
+            EncodeBitmapL(); //use default encoder BMP
+            }
+        else
+            {
+            HTI_LOG_DES( mime );
+            EncodeBitmapL( mime );
+            }
+        }
+    else
+        {
+        //error: empty request
+        iDispatcher->DispatchOutgoingErrorMessage(
+                        KErrArgument,
+                        KErrDescrUnknownCommand,
+                        KScreenshotServiceUid );
+        }
+
+    HTI_LOG_FUNC_OUT( "HtiScreenshotServicePlugin::ProcessMessage" );
+    }
+
+// ----------------------------------------------------------------------------
+void CHtiScreenshotServicePlugin::HandleRotateScreen(const TDesC8& aData)
+    {
+    HTI_LOG_FUNC_IN( "CHtiScreenshotServicePlugin::HandleRotateScreen" );
+             
+    TInt orientation = aData[0];
+    if (orientation > 1 || orientation < 0)
+        {
+        iDispatcher->DispatchOutgoingErrorMessage(KErrArgument,
+                KErrDescrInvalid, KScreenshotServiceUid);
+        return;
+        }
+
+    TBool isLandScape = orientation;
+
+    RWsSession ws;
+    User::LeaveIfError(ws.Connect());
+    CWsScreenDevice* screenDevice = new (ELeave) CWsScreenDevice(ws);
+    CleanupStack::PushL(screenDevice);
+    User::LeaveIfError(screenDevice->Construct());
+    TSize currentScreenSize = screenDevice->SizeInPixels();
+
+    TBool needsRotating = ETrue;
+    if (currentScreenSize.iWidth > currentScreenSize.iHeight && isLandScape)
+        {
+        // we are already in landscape 
+        HTI_LOG_TEXT("The screen are already in landscape.");
+        needsRotating = EFalse;
+        }
+    if (currentScreenSize.iWidth < currentScreenSize.iHeight
+            && (!isLandScape))
+        {
+        // we are already in portrait 
+        HTI_LOG_TEXT("The screen are already in portrait.");
+        needsRotating = EFalse;
+        }
+
+    CAknLayoutConfig* layoutConfigPtr = CAknLayoutConfig::NewL();
+    CleanupStack::PushL(layoutConfigPtr);
+
+    CAknLayoutConfig& layoutConfig = *layoutConfigPtr;
+
+    const CAknLayoutConfig::THardwareStateArray& hwStates =
+            layoutConfig.HardwareStates();
+    const CAknLayoutConfig::TScreenModeArray& screenModes =
+            layoutConfig.ScreenModes();
+
+    TInt newHwStateIndex = KErrNotFound;
+
+    // lets select alternate state from current
+    TSize newScreenSize;
+    if (needsRotating)
+        {
+        newScreenSize = TSize(currentScreenSize.iHeight,
+                currentScreenSize.iWidth);
+        HTI_LOG_FORMAT("Rotate the screen to the new width %d", newScreenSize.iWidth);
+        HTI_LOG_FORMAT("Rotate the screen to the new height %d", newScreenSize.iHeight);
+        }
+    else // basicly select current state again to ensure correct mode is informed to akncapserver
+        {
+        newScreenSize = TSize(currentScreenSize.iWidth,
+                currentScreenSize.iHeight);
+        }
+
+    for (TInt i = 0; i < hwStates.Count(); i++)
+        {
+        const CAknLayoutConfig::THardwareState hwState = hwStates.At(i);
+
+        const CAknLayoutConfig::TScreenMode normal = screenModes.Find(
+                hwState.ScreenMode());
+
+        if (normal.SizeInPixels() == newScreenSize)
+            {
+            newHwStateIndex = i;
+            break;
+            }
+        }
+
+    if (newHwStateIndex >= 0)
+        {
+        const CAknLayoutConfig::THardwareState newHwState = hwStates.At(
+                newHwStateIndex);
+        TApaTaskList taskList(ws);
+        TApaTask aknCapsrvTask = taskList.FindApp(KAknCapServerUid);
+        TInt keyCode = newHwState.KeyCode();
+        HTI_LOG_FORMAT( "Send key code %d to akncapserver", keyCode );
+        aknCapsrvTask.SendKey(keyCode, 0);
+        }
+
+    TBuf8<1> okMsg;
+    okMsg.Append(0);
+    iDispatcher->DispatchOutgoingMessage(okMsg.AllocL(),
+            KScreenshotServiceUid);
+
+    CleanupStack::PopAndDestroy(layoutConfigPtr);
+    CleanupStack::PopAndDestroy(screenDevice);
+    ws.Close();
+             
+    HTI_LOG_FUNC_OUT( "CHtiScreenshotServicePlugin::HandleRotateScreen" );
+    }
+// ----------------------------------------------------------------------------
+void CHtiScreenshotServicePlugin::CreateBitmapL( TRect& aRegion,
+                                                 TDisplayMode aMode )
+    {
+    HTI_LOG_FUNC_IN( "CreateBitmapL" );
+    //create bitmap
+    TSize imageSize = aRegion.IsEmpty() ? iScreenDevice->SizeInPixels() :
+                        aRegion.Size();
+
+    TDisplayMode displayMode = aMode == ENone ?
+                                        iScreenDevice->DisplayMode() : aMode;
+
+    delete iScreen;//in case ICLComplete was not called
+    iScreen = NULL;
+    iScreen = new( ELeave ) CFbsBitmap;
+    User::LeaveIfError( iScreen->Create( imageSize, displayMode ) );
+
+	TInt err = KErrNone;
+	TRect region;
+    if ( aRegion.IsEmpty() )
+        {
+        err = iScreenDevice->CopyScreenToBitmap( iScreen );
+		region = imageSize;
+        }
+    else
+        {
+        err = iScreenDevice->CopyScreenToBitmap( iScreen, aRegion );
+		region = aRegion;
+        }
+    if (err == KErrNoMemory)
+	    {
+		HTI_LOG_TEXT( "screenshot in camera mode" );
+#if ( SYMBIAN_VERSION_SUPPORT < SYMBIAN_4 )
+		err = CAlfDrawer::FallbackCopyScreenToBitmap(*iScreenDevice, iScreen, region);
+#endif
+		}
+
+    if ( iDeltaCapture )
+        {
+        HTI_LOG_TEXT( "DeltaCapture enabled" );
+
+
+        CFbsBitmap* differenceBitmap = NULL;
+        TInt err = ImageDifferenceL( iPreviousBitmap,
+                                     iScreen,
+                                     differenceBitmap,
+                                     iDeltaRect );
+
+        iPreviousBitmap->Reset();
+        iPreviousBitmap->Duplicate( iScreen->Handle() );
+
+        if ( err == KErrNone )
+            {
+            delete iScreen;
+            iScreen = differenceBitmap;
+            }
+        else if ( err == KErrNotFound )
+            {
+            delete iScreen;
+            iScreen = NULL;
+
+            if ( !iSeriesShot->IsOngoing() )
+                {
+                // Nothing has changed on the screen.
+                // Send just iDeltaRect coordidates
+                HBufC8* buf = HBufC8::NewL( 4 * 2 ); // 2 bytes for each coordinate
+                buf->Des().SetLength( 4 * 2 );
+                TUint16* ptr = (TUint16*) buf->Des().Ptr();
+                ptr[0] = (TUint16) iDeltaRect.iTl.iX;
+                ptr[1] = (TUint16) iDeltaRect.iTl.iY;
+                ptr[2] = (TUint16) iDeltaRect.iBr.iX;
+                ptr[3] = (TUint16) iDeltaRect.iBr.iY;
+                // Response also sent in ICLComplete
+                iDispatcher->DispatchOutgoingMessage( buf, KScreenshotServiceUid );
+                }
+            }
+        }
+
+    HTI_LOG_FUNC_OUT( "CreateBitmapL" );
+    }
+/*
+
+// ----------------------------------------------------------------------------
+void CleanupRArray( TAny* object )
+    {
+    ((RImageTypeDescriptionArray*)object)->ResetAndDestroy();
+    }
+
+// ----------------------------------------------------------------------------
+void CHtiScreenshotServicePlugin::SelectEncoder( const TUid aEncoderUid )
+    {
+    //select encoder
+    RImageTypeDescriptionArray imageTypeArray;
+    CImageEncoder::GetImageTypesL( imageTypeArray );
+    CleanupStack::PushL( TCleanupItem(CleanupRArray, &imageTypeArray) );
+
+    //select specified encoder
+    TBool found = EFalse;
+    for ( TInt i = 0; i < imageTypeArray.Count(); ++i )
+        {
+        if ( imageTypeArray[i]->ImageType() == aEncoderUid )
+            {
+            iImageEncoderType = imageTypeArray[i]->ImageType();
+            iImageEncoderSubtype = imageTypeArray[i]->SubType();
+            found = ETrue;
+            }
+        }
+
+    if ( !found )
+        {
+        User::Leave( KErrNotFound );
+        }
+    CleanupStack::PopAndDestroy(); //imageTypeArray
+    }
+*/
+
+// ----------------------------------------------------------------------------
+TBool CHtiScreenshotServicePlugin::IsMIMETypeSupported(TDesC8 &aMime)
+    {
+    HTI_LOG_DES(aMime);
+    RFileExtensionMIMETypeArray array;
+    CImageEncoder::GetFileTypesL(array);
+    for ( TInt i = 0; i < array.Count(); i++ )
+        {
+        if ( array[i]->MIMEType() == aMime )
+            {
+            HTI_LOG_TEXT( "MIME supported" );
+            array.ResetAndDestroy();
+            return ETrue;
+            }
+        }
+    HTI_LOG_TEXT( "MIME not supported" );
+    array.ResetAndDestroy();
+    return EFalse;
+    }
+
+
+// ----------------------------------------------------------------------------
+void CHtiScreenshotServicePlugin::EncodeBitmapL(const TDesC8& aImageTypeMIME )
+    {
+    HTI_LOG_FUNC_IN( "EncodeBitmapL" );
+    delete iBitmapEncoder;
+    iBitmapEncoder = NULL;
+    delete iICLHandler;
+    iICLHandler = NULL;
+
+    if ( iScreen )
+        {
+        HTI_LOG_TEXT( "create encoder" );
+        if ( aImageTypeMIME  == KNullDesC8 )
+            {
+            iBitmapEncoder = CImageEncoder::DataNewL( iEncodedBitmap,
+                                        CImageEncoder::EOptionNone,
+                                        KImageTypeBMPUid);//,
+                                        //iImageEncoderSubtype);
+            }
+        else
+            {
+            iBitmapEncoder = CImageEncoder::DataNewL( iEncodedBitmap,
+                                        aImageTypeMIME);
+            }
+
+        HTI_LOG_TEXT( "create CICLHandler" );
+        iICLHandler = new(ELeave) CICLHandler( iBitmapEncoder, this );
+        iBitmapEncoder->Convert( &(iICLHandler->iStatus), *iScreen );
+
+        HTI_LOG_TEXT( "CICLHandler start");
+        iICLHandler->Start();
+        }
+    else
+        {
+        HTI_LOG_TEXT( "Nothing to encode" );
+        }
+
+    HTI_LOG_FUNC_OUT( "EncodeBitmapL" );
+    }
+
+// ----------------------------------------------------------------------------
+TInt CHtiScreenshotServicePlugin::Compress()
+    {
+    __ASSERT_ALWAYS(iEncodedBitmap!=NULL,User::Panic(KScreenshotPanic, KErrGeneral));
+    TInt err = KErrNone;
+    HBufC8* zippedTemp = NULL;
+
+    HTI_LOG_FORMAT( "image size %d", iEncodedBitmap->Size() );
+    TInt numOfSteps = 4;
+    TInt comprBufferIncrease = iEncodedBitmap->Size()/numOfSteps;
+
+    //straight way to handle cases
+    //when compressed data larger than uncompressed
+    //try until buffer for compr. data twice bigger than original data
+    for ( TInt i = 0; i < numOfSteps; ++i )
+        {
+        delete zippedTemp;
+        TRAP( err, zippedTemp = HBufC8::NewL( iEncodedBitmap->Size() +
+                                              i*comprBufferIncrease ) );
+        if ( err == KErrNone )
+            {
+            //try to zip
+            HTI_LOG_TEXT( "try to zip" );
+            TPtr8 zippedTempPtr = zippedTemp->Des();
+            TRAP( err, CEZCompressor::CompressL( zippedTempPtr,
+                                                 *iEncodedBitmap ) );
+            if ( err == KErrNone || err != KEZlibErrBuf )
+                {
+                break;
+                }
+            }
+        else
+            {
+            break;
+            }
+        }
+
+    if ( err == KErrNone )
+        {
+        delete iEncodedBitmap;
+        iEncodedBitmap = zippedTemp;
+        }
+    else
+        {
+        HTI_LOG_FORMAT( "compre error %d", err );
+        delete zippedTemp;
+        }
+
+    return err;
+    }
+
+// ----------------------------------------------------------------------------
+void CHtiScreenshotServicePlugin::ICLComplete( TInt anError)
+    {
+    HTI_LOG_FUNC_IN( "ICLComplete" );
+
+    //delete what we dont need right away
+    delete iBitmapEncoder;
+    iBitmapEncoder = NULL;
+    delete iICLHandler;
+    iICLHandler = NULL;
+
+
+    if ( anError==KErrNone )
+        {
+        TInt err = KErrNone;
+
+
+        //compress
+        if ( iCompress )
+            {
+            HTI_LOG_TEXT( "compress" );
+            err = Compress();
+            }
+
+        //send
+        if ( err == KErrNone )
+            {
+
+            if ( !iSeriesShot->IsOngoing() )
+                {
+                // Not a series shot
+
+                if ( iDeltaCapture )
+                    {
+                    // DeltaCapture on
+
+                    // If we have encoded the bitmap then we
+                    // also have some difference in the bitmap
+
+                    HTI_LOG_TEXT( "Sending image with coordinates..." );
+
+                    HBufC8* buf = HBufC8::NewL( (4*2) + iEncodedBitmap->Size() );
+                    buf->Des().SetLength(4*2);
+                    TUint16* ptr = (TUint16*) buf->Des().Ptr();
+                    ptr[0] = (TUint16) iDeltaRect.iTl.iX;
+                    ptr[1] = (TUint16) iDeltaRect.iTl.iY;
+                    ptr[2] = (TUint16) iDeltaRect.iBr.iX;
+                    ptr[3] = (TUint16) iDeltaRect.iBr.iY;
+
+                    buf->Des().Append(*iEncodedBitmap);
+
+                    delete iEncodedBitmap;
+                    iEncodedBitmap = NULL;
+
+                    // Response also sent in CreateBitmapL
+                    err = iDispatcher->DispatchOutgoingMessage(buf,
+                                            KScreenshotServiceUid);
+                    }
+                else
+                    {
+                    // Normal case
+                    HTI_LOG_TEXT( "Sending image..." );
+                    err = iDispatcher->DispatchOutgoingMessage(iEncodedBitmap,
+                                            KScreenshotServiceUid);
+                    }
+
+                if (  err == KErrNoMemory )
+                    {
+                    HTI_LOG_TEXT( "wait for memory" );
+                    iDispatcher->AddMemoryObserver( this );
+                    }
+                else if ( err == KErrNone )
+                    {
+                    iEncodedBitmap = NULL;
+                    }
+                else //just drop
+                    {
+                    HTI_LOG_TEXT( "ERROR: Impossible to send image" );
+                    delete iEncodedBitmap;
+                    iEncodedBitmap = NULL;
+                    }
+                }
+            }
+        else
+            {
+            iSeriesShot->Cancel();
+            iDispatcher->DispatchOutgoingErrorMessage(
+                    err,
+                    KErrDescrFailedCompress,
+                    KScreenshotServiceUid);
+            delete iEncodedBitmap;
+            iEncodedBitmap = NULL;
+            }
+        }
+    else
+        {
+        iSeriesShot->Cancel();
+        iDispatcher->DispatchOutgoingErrorMessage(
+                        anError,
+                        KErrDescrFailedConvert,
+                        KScreenshotServiceUid);
+        delete iEncodedBitmap;
+        iEncodedBitmap = NULL;
+        }
+
+    if ( iSeriesShot->IsOngoing() )
+        {
+        iSeriesShot->SaveImage( iEncodedBitmap, iCompress );
+        delete iEncodedBitmap;
+        iEncodedBitmap = NULL;
+
+        // Check if there's still more to do
+        if ( iSeriesShot->IsOngoing() )
+            {
+            iSeriesShot->TriggerNewShot();
+            }
+        else
+            {
+            // - No, timer still active
+            // SeriesShot can complete here and in CSeriesShot::TimerExpired
+            SeriesShotCompletedL(iSeriesShot->ConstructCompletedMessageL());
+            }
+        }
+
+    HTI_LOG_FUNC_OUT( "ICLComplete" );
+    }
+
+// ----------------------------------------------------------------------------
+void CHtiScreenshotServicePlugin::NotifyMemoryChange( TInt aAvailableMemory )
+    {
+    if ( iEncodedBitmap )
+        {
+        if ( aAvailableMemory>= iEncodedBitmap->Size() )
+            {
+            TInt err = iDispatcher->DispatchOutgoingMessage(iEncodedBitmap,
+                                KScreenshotServiceUid);
+
+            if ( err == KErrNone)
+                {
+                iEncodedBitmap = NULL;
+                iDispatcher->RemoveMemoryObserver( this );
+                }
+            else if ( err != KErrNoMemory )
+                {
+                delete iEncodedBitmap;
+                iEncodedBitmap = NULL;
+                iDispatcher->RemoveMemoryObserver( this );
+                }
+            }
+        }
+    else
+        {
+        //some error, should not be called
+        iDispatcher->RemoveMemoryObserver(this);
+        }
+    }
+
+// ----------------------------------------------------------------------------
+void CHtiScreenshotServicePlugin::SeriesShotCompletedL(HBufC8* aMsg)
+    {
+    HTI_LOG_FUNC_IN( "CHtiScreenshotServicePlugin::SeriesShotCompletedL" );
+    User::LeaveIfError( iDispatcher->DispatchOutgoingMessage(
+                        aMsg,
+                        KScreenshotServiceUid) );
+    HTI_LOG_FUNC_OUT( "CHtiScreenshotServicePlugin::SeriesShotCompletedL" );
+    }
+
+// ----------------------------------------------------------------------------
+TBool CHtiScreenshotServicePlugin::StartShotL(TRect aRegion, TDisplayMode aDisplayMode, TDesC8 &aMimeType)
+    {
+    HTI_LOG_FUNC_IN( "CHtiScreenshotServicePlugin::StartShot" );
+    CreateBitmapL( aRegion, aDisplayMode );
+
+    if ( aMimeType.Length()==0 )
+        EncodeBitmapL(); //use default encoder BMP
+    else
+        EncodeBitmapL( aMimeType );
+
+    HTI_LOG_FUNC_OUT( "CHtiScreenshotServicePlugin::StartShot" );
+    return iScreen ? ETrue : EFalse;
+    }
+
+// ----------------------------------------------------------------------------
+void CHtiScreenshotServicePlugin::SetScreenNumber(TInt aScreenNumber)
+    {
+    HTI_LOG_FUNC_IN("CHtiScreenshotServicePlugin::SetScreenNumber");
+    TInt currentScreen = iScreenDevice->GetScreenNumber();
+    HTI_LOG_FORMAT("current screen: %d", currentScreen);
+    HTI_LOG_FORMAT("new screen number: %d", aScreenNumber);
+    if(aScreenNumber == currentScreen)
+        {
+        return;
+        }
+
+    // Clear the previous delta bitmap to avoid error
+    iPreviousBitmap->Reset();
+    //delete old screendevice and create a new one
+    delete iScreenDevice;
+    iScreenDevice = NULL;
+    iScreenDevice = new (ELeave) CWsScreenDevice(iWs);
+    User::LeaveIfError(iScreenDevice->Construct(aScreenNumber));
+    HTI_LOG_FUNC_OUT("CHtiScreenshotServicePlugin::SetScreenNumber");
+    }
+
+// ----------------------------------------------------------------------------
+CSeriesShot* CSeriesShot::NewL( MSeriesShotObserver* aServicePlugin )
+    {
+    HTI_LOG_FUNC_IN( "CSeriesShot::NewL" );
+    CSeriesShot* self = new (ELeave) CSeriesShot( aServicePlugin );
+    CleanupStack::PushL (self);
+    self->ConstructL();
+    CleanupStack::Pop();
+    HTI_LOG_FUNC_OUT( "CSeriesShot::NewL" );
+    return self;
+    }
+
+// ----------------------------------------------------------------------------
+void CSeriesShot::ConstructL()
+    {
+    User::LeaveIfError(iFs.Connect());
+    }
+
+// ----------------------------------------------------------------------------
+CSeriesShot::CSeriesShot( MSeriesShotObserver* aServicePluginObserver ):
+    iServicePluginObserver( aServicePluginObserver ),
+    iDurationTimer( NULL ),
+    iIntervalTimer( NULL ),
+    isEncoding( EFalse )
+    {
+    }
+
+// ----------------------------------------------------------------------------
+CSeriesShot::~CSeriesShot()
+    {
+    Cancel();
+    iFs.Close();
+    }
+
+// ----------------------------------------------------------------------------
+void CSeriesShot::ClearShots()
+    {
+    HTI_LOG_FUNC_IN( "CSeriesShot::ClearShots" );
+
+    iFs.MkDirAll( KSeriesShotPath );
+
+    // Delete all files
+    TFileName files;
+    files.Append( KSeriesShotPath );
+    files.Append( _L( "*.*" ) );
+    HTI_LOG_DES(files);
+
+
+    CFileMan *fileman = CFileMan::NewL( iFs );
+    TInt err = fileman->Delete( files );
+    HTI_LOG_FORMAT( "delete %d", err );
+    if ( err != KErrNotFound )
+        User::LeaveIfError( err );
+    delete fileman;
+
+
+    HTI_LOG_FUNC_OUT( "CSeriesShot::ClearShots" );
+    }
+
+// ----------------------------------------------------------------------------
+void CSeriesShot::StartL( TTimeIntervalMicroSeconds32 aDuration,
+                         TTimeIntervalMicroSeconds32 aInterval,
+                         TDisplayMode aDisplayMode,
+                         TRect aRegion,
+                         TPtrC8 aMime )
+    {
+    HTI_LOG_FUNC_IN( "CSeriesShot::StartL" );
+    HTI_LOG_FORMAT( "Duration      : %d microseconds", aDuration.Int() );
+    HTI_LOG_FORMAT( "Interval      : %d microseconds", aInterval.Int() );
+    HTI_LOG_FORMAT( "Displaymode   : %d", aDisplayMode );
+    HTI_LOG_FORMAT( "TopLeft X     : %d", aRegion.iTl.iX );
+    HTI_LOG_FORMAT( "TopLeft Y     : %d", aRegion.iTl.iY );
+    HTI_LOG_FORMAT( "BottomRight X : %d", aRegion.iBr.iX );
+    HTI_LOG_FORMAT( "BottomRight Y : %d", aRegion.iBr.iY );
+
+    iDisplayMode = aDisplayMode;
+    iRegion = aRegion;
+    iIndex = 0;
+
+    iMimeType.Zero();
+    iMimeType.Append( aMime );
+    HTI_LOG_DES( iMimeType );
+
+#ifdef __ENABLE_LOGGING__
+    HTI_LOG_TEXT( "Supported MIME types:" );
+    RFileExtensionMIMETypeArray array;
+    CImageEncoder::GetFileTypesL( array );
+    for ( TInt i = 0; i < array.Count(); i++ )
+        HTI_LOG_DES( array[i]->MIMEType() );
+    array.ResetAndDestroy();
+#endif
+
+    iExtension.Zero();
+    if ( iMimeType.Length() == 0 )
+        iExtension.Append( _L( ".bmp" ) );
+    else
+        GetMIMEExtension( iMimeType, iExtension );
+
+    ClearShots();
+
+    iDurationTimer = CSeriesShotTimer::NewL( this, EDuration, aDuration );
+    iIntervalTimer = CSeriesShotTimer::NewL( this, EInterval, aInterval );
+    iDurationTimer->Start();
+    TimerExpired( EInterval ); // trigger first shot immidietly
+
+    HTI_LOG_FUNC_OUT( "CSeriesShot::StartL" );
+    }
+
+void CSeriesShot::TimerExpired( TInt aId )
+    {
+    HTI_LOG_FUNC_IN( "CSeriesShot::TimerExpired" );
+    switch ( aId )
+        {
+        case EDuration:
+            HTI_LOG_TEXT( "EDuration" );
+
+            delete iDurationTimer;
+            iDurationTimer = NULL;
+
+            if ( iIntervalTimer ) // I'm paranoid
+                {
+                delete iIntervalTimer;
+                iIntervalTimer = NULL;
+                }
+            // SeriesShot can complete here and in CHtiScreenshotServicePlugin::ICLComplete
+            if ( isEncoding == EFalse )
+                iServicePluginObserver->SeriesShotCompletedL( ConstructCompletedMessageL() );
+
+            break;
+
+        case EInterval:
+            HTI_LOG_TEXT( "EInterval" );
+
+            isEncoding = iServicePluginObserver->StartShotL( iRegion, iDisplayMode, iMimeType );
+
+            break;
+
+        default:
+            break;
+        }
+    HTI_LOG_FUNC_OUT( "CSeriesShot::TimerExpired" );
+    }
+
+// ----------------------------------------------------------------------------
+TBool CSeriesShot::IsOngoing()
+    {
+    // It still might be encoding when duration timer has expired
+    return ( iDurationTimer || isEncoding ) ? ETrue : EFalse;
+    }
+
+// ----------------------------------------------------------------------------
+void CSeriesShot::SaveImage( TDesC8* aImage, TBool isCompressed )
+    {
+    HTI_LOG_FUNC_IN( "CSeriesShot::SaveImage" );
+
+    isEncoding = EFalse;
+
+    TFileName filename( KSeriesShotPath );
+    filename.AppendFormat( _L( "%04d" ), iIndex );
+    iIndex++;
+    filename.Append( iExtension );
+    if ( isCompressed )
+        filename.Append( _L( "z" ) );
+    HTI_LOG_DES( filename );
+
+    RFile file;
+    User::LeaveIfError( file.Create( iFs, filename, EFileWrite ) );
+    User::LeaveIfError( file.Write( *aImage ) );
+    file.Close();
+
+    HTI_LOG_FUNC_IN( "CSeriesShot::SaveImage" );
+    }
+
+// ----------------------------------------------------------------------------
+void CSeriesShot::TriggerNewShot()
+    {
+    if ( iDurationTimer )
+        iIntervalTimer->Start();
+    }
+
+// ----------------------------------------------------------------------------
+void CSeriesShot::Cancel()
+    {
+    if ( iDurationTimer )
+        {
+        delete iDurationTimer;
+        iDurationTimer = NULL;
+        }
+    if ( iIntervalTimer )
+        {
+        delete iIntervalTimer;
+        iIntervalTimer = NULL;
+        }
+    ClearShots();
+    }
+
+// ----------------------------------------------------------------------------
+void CSeriesShot::EncodeCompleted()
+    {
+    isEncoding = EFalse;
+    }
+
+// ----------------------------------------------------------------------------
+void CSeriesShot::GetMIMEExtension( TDesC8 &aMime, TDes &aExt )
+    {
+    RFileExtensionMIMETypeArray array;
+    CImageEncoder::GetFileTypesL( array );
+    for ( TInt i = 0; i < array.Count(); i++ )
+        {
+        if ( array[i]->MIMEType() == aMime )
+            aExt.Append( array[i]->FileExtension() );
+        }
+    array.ResetAndDestroy();
+
+    if ( aExt == KNullDesC ) // should not happen
+        aExt.Append( _L( ".xxx" ) );
+    }
+
+// ----------------------------------------------------------------------------
+HBufC8* CSeriesShot::ConstructCompletedMessageL()
+    {
+    HTI_LOG_FUNC_IN( "CSeriesShot::ConstructCompletedMessageL" );
+    // Serialshot completed send ok message.
+
+    CDir* dir = NULL;
+    User::LeaveIfError( iFs.GetDir(
+        KSeriesShotPath, KEntryAttNormal, ESortByName, dir ) );
+
+    TInt msgSize = 0;
+
+    if ( dir->Count() == 0 )
+        {
+        HTI_LOG_TEXT( "No shots found! Leaving..." );
+        User::Leave( KErrNotFound );
+        }
+
+    for ( TInt i = 0; i < dir->Count(); i++ )
+        {
+        msgSize += 1; // for length field
+        msgSize += KSeriesShotPath().Length();
+        msgSize += (*dir)[i].iName.Length();
+        }
+
+    HBufC8* msg = HBufC8::NewL( msgSize );
+
+    for ( TInt i = 0; i < dir->Count(); i++ )
+        {
+        msg->Des().Append( KSeriesShotPath().Length() + (*dir)[i].iName.Length() );
+        msg->Des().Append( KSeriesShotPath );
+        msg->Des().Append( (*dir)[i].iName );
+        }
+
+    delete dir;
+
+    HTI_LOG_FUNC_OUT( "CSeriesShot::ConstructCompletedMessageL" );
+    return msg;
+    }
+
+// ----------------------------------------------------------------------------
+CSeriesShotTimer* CSeriesShotTimer::NewL( MSeriesShotTimerObserver* aObserver,
+                                        TInt aId,
+                                        TTimeIntervalMicroSeconds32 aTime )
+    {
+    HTI_LOG_FUNC_IN( "CSeriesShotTimer::NewL" );
+    CSeriesShotTimer* self = new (ELeave) CSeriesShotTimer( aObserver, aId, aTime );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop();
+    HTI_LOG_FUNC_OUT( "CSeriesShotTimer::NewL" );
+    return self;
+    }
+
+// ----------------------------------------------------------------------------
+void CSeriesShotTimer::ConstructL()
+    {
+    HTI_LOG_FUNC_IN( "CSeriesShotTimer::ConstructL" );
+    CTimer::ConstructL();
+    if ( !IsAdded() ) // CTimer should add it but it seems that it does NOT!
+        {
+        CActiveScheduler::Add( this );
+        }
+    HTI_LOG_FUNC_OUT( "CSeriesShotTimer::ConstructL" );
+    }
+
+// ----------------------------------------------------------------------------
+CSeriesShotTimer::CSeriesShotTimer( MSeriesShotTimerObserver* aObserver,
+                                  TInt aId,
+                                  TTimeIntervalMicroSeconds32 aTime ):
+    CTimer( EPriorityStandard ),
+    iObserver( aObserver ),
+    iId( aId ),
+    iTime( aTime )
+    {
+    }
+
+// ----------------------------------------------------------------------------
+CSeriesShotTimer::~CSeriesShotTimer()
+    {
+    }
+
+// ----------------------------------------------------------------------------
+void CSeriesShotTimer::RunL()
+    {
+    iObserver->TimerExpired( iId );
+    }
+
+// ----------------------------------------------------------------------------
+void CSeriesShotTimer::Start()
+    {
+    HTI_LOG_FORMAT( "Start CSeriesShotTimer : %d microseconds", iTime.Int() );
+    After( iTime );
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiServicePlugins/HtiScreenshotServicePlugin/src/HtiTextRcg.cpp	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,955 @@
+/*
+* 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:  Text recognition algorithm implementation.
+*
+*/
+
+
+#include "HtiTextRcg.h"
+#include <HtiLogging.h>
+
+const static TInt KDefaultStrategy = EHintEdge;
+
+TInt CompareTPoint(const TPoint& aP1,const TPoint& aP2)
+    {
+    //this functions is used only to avoid equal points when creating FGA or BGA
+    //so only equality of points is important, order doesnt matter
+    if ( aP1.iY == aP2.iY )
+        return aP1.iX - aP2.iX;
+    return aP1.iY - aP2.iY;
+    }
+
+CHtiTextRcg::CHtiTextRcg()
+    {
+    iAvgDiffMin = KDefaultAvgDiffMin;
+    //minimal SS for foreground, with plain color should be 0
+    iFgSSMin = KDefaultFgSSMin;
+    iFgAvgDiffMin = KDefaultFgAvgDiffMin;
+
+    iFGAAmount = KDefaultFGAAmount;
+    iBGAAmount = KDefaultBGAAmount;
+
+    SetHint(KDefaultStrategy);
+    }
+
+CHtiTextRcg::~CHtiTextRcg()
+    {
+    iFGASet.Close();
+    iBGASet.Close();
+    }
+
+void CHtiTextRcg::SetHint(TInt aHint)
+    {
+    //selects strategy and algorithm parameters
+    switch ( aHint )
+        {
+        case EHintEdge:
+            {
+            //AA strategy
+            iCurrentStrategy = EHintEdge;
+            }
+            break;
+        case EHintNone:
+        default:
+            {
+            //default strategy
+            iCurrentStrategy = EHintNone;
+            }
+        }
+    }
+
+
+TBool CHtiTextRcg::RecognizeTextL(CFbsBitmap* aScreenshot,
+                        const TDesC& aText,
+                        const CFont* aFont,
+                        TRect& aResult)
+    {
+HTI_LOG_FUNC_IN("RecognizeTextL");
+    TInt returnValue = KWorstCase;
+
+    CFbsBitmap* gray = ColorDownL(aScreenshot);
+    CleanupStack::PushL(gray);
+
+    switch ( iCurrentStrategy )
+        {
+        case EHintEdge:
+            {
+            returnValue = RecognizeAAL(gray,aText, aFont, aResult);
+            }
+            break;
+        case EHintNone:
+        default:
+            {
+            returnValue = RecognizeBinL(gray,aText, aFont, aResult);
+            }
+        }
+
+    CleanupStack::PopAndDestroy(gray);
+HTI_LOG_FUNC_OUT("RecognizeTextL");
+    return returnValue < KSuccessThresold;
+    }
+
+TInt CHtiTextRcg::RecognizeBinL(CFbsBitmap* aScreenshot,
+                            const TDesC& aText,
+                            const CFont* aFont,
+                            TRect& aResult)
+{
+    HTI_LOG_FUNC_IN("RecognizeBinL");
+    CFbsBitmap* searchFirstLetter = GetTextBitmapL(aText, aFont, 1);
+    CleanupStack::PushL(searchFirstLetter);
+    HTI_LOG_FORMAT("pattern size w %d", searchFirstLetter->SizeInPixels().iWidth);
+    HTI_LOG_FORMAT("pattern size h %d", searchFirstLetter->SizeInPixels().iHeight);
+
+    if ( !AnalyzePatternL(searchFirstLetter) )
+        {
+        CleanupStack::PopAndDestroy(searchFirstLetter);
+        return KWorstCase;
+        }
+    CFbsBitmap* searchText = GetTextBitmapL(aText, aFont);
+    CleanupStack::PushL(searchText);
+
+      //search range (0,0) - (reg.Size() - searchText.SizeInPixels)
+    TPoint end(aScreenshot->SizeInPixels().iWidth, aScreenshot->SizeInPixels().iHeight);
+    end -= searchText->SizeInPixels();
+    end += TPoint(1,1);
+
+    //search itself
+    for ( TPoint p( 0, 0 ); p.iY < end.iY; p.iY++ )
+        {
+        for ( p.iX = 0; p.iX < end.iX; p.iX++ )
+            {
+            TInt t = ImageDiffBinSampleL(aScreenshot, p, searchFirstLetter);
+            if ( t == 0 )
+                {
+                //check full word
+                TInt wordD = ImageDiffBinFullL(aScreenshot, p, searchText);
+                if ( wordD == 0 )
+                    {
+                    aResult.iTl.iX = p.iX;
+                    aResult.iTl.iY = p.iY;
+                    aResult.SetSize(searchText->SizeInPixels());
+                    CleanupStack::PopAndDestroy(searchText);
+                    CleanupStack::PopAndDestroy(searchFirstLetter);
+                    HTI_LOG_FUNC_OUT("RecognizeBinL");
+                    return 0;
+                    }
+                }
+            }
+        }
+    CleanupStack::PopAndDestroy(searchText);
+    CleanupStack::PopAndDestroy(searchFirstLetter);
+
+    HTI_LOG_FUNC_OUT("RecognizeBinL");
+    return KWorstCase;
+}
+
+
+TInt CHtiTextRcg::RecognizeAAL(CFbsBitmap* aScreenshot,
+                            const TDesC& aText,
+                            const CFont* aFont,
+                            TRect& aResult)
+{
+    HTI_LOG_FUNC_IN("RecognizeAAL");
+    CFbsBitmap* searchFirstLetter = GetTextBitmapL(aText, aFont, 1);
+    CleanupStack::PushL(searchFirstLetter);
+    if ( !AnalyzePatternL(searchFirstLetter) )
+        {
+        CleanupStack::PopAndDestroy(searchFirstLetter);
+        return KWorstCase;
+        }
+
+    CFbsBitmap* searchText = GetTextBitmapL(aText, aFont);
+    CleanupStack::PushL(searchText);
+
+
+    //search range (0,0) - (reg.Size() - searchText.SizeInPixels)
+    TPoint end(aScreenshot->SizeInPixels().iWidth, aScreenshot->SizeInPixels().iHeight);
+    end -= searchText->SizeInPixels();
+    end += TPoint(1,1);
+
+    //search itself
+    TInt min = KSuccessThresold;
+    TInt wordMin = KSuccessThresold;
+
+    for ( TPoint p( 0, 0 ); p.iY < end.iY; p.iY++ )
+        {
+        for ( p.iX = 0; p.iX < end.iX; p.iX++ )
+            {
+            TInt t = ImageDiffAASampleL(aScreenshot, p, searchFirstLetter);
+            if ( t < min )
+                {
+                //check full word
+                TInt wordD = ImageDiffAAFullL(aScreenshot, p, searchText);
+                if ( wordD < wordMin )
+                    {
+                    wordMin = wordD;
+                    min = t;
+                    aResult.iTl.iX = p.iX;
+                    aResult.iTl.iY = p.iY;
+                    aResult.SetSize(searchText->SizeInPixels());
+                    if ( wordMin == 0 )
+                        {
+                        CleanupStack::PopAndDestroy(searchText);
+                        CleanupStack::PopAndDestroy(searchFirstLetter);
+                        HTI_LOG_FUNC_OUT("RecognizeAAL");
+                        return 0;
+                        }
+                    }
+                }
+            }
+        }
+
+    CleanupStack::PopAndDestroy(searchText);
+    CleanupStack::PopAndDestroy(searchFirstLetter);
+
+    HTI_LOG_FUNC_OUT("RecognizeAAL");
+
+    return wordMin;
+}
+
+TBool CHtiTextRcg::AnalyzePatternL(CFbsBitmap * aPattern)
+{
+    HTI_LOG_FUNC_IN("AnalyzePatternL");
+    if ( aPattern->SizeInPixels().iWidth == 0 ||
+         aPattern->SizeInPixels().iHeight == 0 )
+        {
+        return EFalse;
+        }
+    //points are selected as follow
+    //take pair of FG-BG points which located next to each other
+    MinMax(aPattern,
+           iMaskFgColor, //min, black font
+           iMaskBgColor);//max, white bg
+
+    if ( iMaskFgColor == iMaskBgColor ) //pattern is empty
+        {
+        return EFalse;
+        }
+
+    TLinearOrder<TPoint> pointOrder(CompareTPoint);
+    TSize borders = aPattern->SizeInPixels();
+    iFGASet.Reset();
+    iBGASet.Reset();
+
+    TBitmapUtil bmpIterator(aPattern);
+    //lock bitmap
+    bmpIterator.Begin( TPoint(0,0));
+
+    //first take center lines and find take at least two pairs
+    //vertical1
+    TPoint startPoint(borders.iWidth/2, 0);
+    bmpIterator.SetPos(startPoint);
+
+    TInt lastColor = bmpIterator.GetPixel()&0xff;
+    TInt lastColorPos = 0;
+    bmpIterator.IncYPos();
+    TInt i=1;
+    TInt found = 0;
+
+    while ( found < 2 && i < borders.iHeight )
+        {
+        TInt c = bmpIterator.GetPixel()&0xff;
+
+        if ( lastColor != c )
+            {
+            if ( c == iMaskFgColor )
+                {
+                iFGASet.InsertInOrder(TPoint(startPoint.iX, i), pointOrder);
+                iBGASet.InsertInOrder(TPoint(startPoint.iX, lastColorPos), pointOrder);
+                lastColor = c;
+                lastColorPos = i;
+                ++found;
+                }
+            else if ( c == iMaskBgColor )
+                {
+                iBGASet.InsertInOrder(TPoint(startPoint.iX, i), pointOrder);
+                iFGASet.InsertInOrder(TPoint(startPoint.iX, lastColorPos), pointOrder);
+                lastColor = c;
+                lastColorPos = i;
+                ++found;
+                }
+            }
+        else
+            {
+            lastColorPos = i;
+            }
+
+        ++i;
+        bmpIterator.IncYPos();
+        }
+
+    //horizontal1
+    startPoint.SetXY(0,borders.iHeight/2);
+    bmpIterator.SetPos(startPoint);
+    lastColor = bmpIterator.GetPixel()&0xff;
+    bmpIterator.IncXPos();
+    i=1;
+    found = 0;
+    lastColorPos = 0;
+
+    while ( found < 2 && i < borders.iWidth )
+        {
+        TInt c = bmpIterator.GetPixel()&0xff;
+
+        if ( lastColor != c )
+            {
+            if ( c == iMaskFgColor )
+                {
+                iFGASet.InsertInOrder(TPoint(i, startPoint.iY), pointOrder);
+                iBGASet.InsertInOrder(TPoint(lastColorPos, startPoint.iY), pointOrder);
+                lastColor = c;
+                lastColorPos = i;
+                ++found;
+                }
+            else if ( c == iMaskBgColor )
+                {
+                iBGASet.InsertInOrder(TPoint(i, startPoint.iY), pointOrder);
+                iFGASet.InsertInOrder(TPoint(lastColorPos, startPoint.iY), pointOrder);
+                lastColor = c;
+                lastColorPos = i;
+                ++found;
+                }
+            }
+        else
+            {
+            lastColorPos = i;
+            }
+        ++i;
+        bmpIterator.IncXPos();
+        }
+
+    //unlock bitmap
+    bmpIterator.End();
+
+    iFGAAmount = iFGASet.Count();
+    iBGAAmount = iBGASet.Count();
+
+    HTI_LOG_FUNC_OUT("AnalyzePatternL");
+    return ETrue;
+
+}
+
+TInt CHtiTextRcg::ImageDiffAASampleL(CFbsBitmap * aBitmap1, TPoint aOrigin1,
+                 CFbsBitmap * aBitmap2)
+    {
+
+    if (iFGASet.Count()==0 || iBGASet.Count()==0)
+        return KWorstCase;
+
+    TSize aSize = aBitmap2->SizeInPixels();
+
+    //straight average difference
+    TBitmapUtil bmpIterator1(aBitmap1);
+    TBitmapUtil bmpIterator2(aBitmap2);
+
+    bmpIterator1.Begin( aOrigin1 );
+
+    //1. check FGA points are equal
+    bmpIterator1.SetPos( aOrigin1 + iFGASet[0]);
+    iTestFgColor = bmpIterator1.GetPixel()&0xff;
+
+    for ( TInt i = 1; i < iFGAAmount;++i )
+        {
+        bmpIterator1.SetPos( aOrigin1 + iFGASet[i]);
+        TInt c = bmpIterator1.GetPixel()&0xff;
+        if ( Abs(c-iTestFgColor) > iFgAvgDiffMin )
+            {
+            bmpIterator2.End();
+            bmpIterator1.End();
+            return KWorstCase;
+            }
+        }
+    // if we are here all FGA points are equal to colorFGA
+    //2. check that avg BGA point value is not equal to colorFGA
+    iTestBgColor = 0;
+    for ( TInt i = 0; i < iBGAAmount; ++i )
+        {
+        bmpIterator1.SetPos( aOrigin1 + iBGASet[i]);
+        iTestBgColor += bmpIterator1.GetPixel()&0xff;
+        }
+    iTestBgColor /= iBGAAmount;
+    //if difference is too small leave with false
+    if ( Abs(iTestBgColor-iTestFgColor) <  iAvgDiffMin )
+        {
+        bmpIterator2.End();
+        bmpIterator1.End();
+        return KWorstCase;
+        }
+
+    //all checking based on FGA and BGA are correct, chance to have match
+    //3. calculate sum of diff between colorFGA and ALL FG points
+    bmpIterator1.End();
+    bmpIterator1.Begin( aOrigin1 );
+    bmpIterator2.Begin( TPoint(0,0), bmpIterator1 );
+
+    TInt nofF = 0;
+    TInt sum = 0;
+    TBool iterFlag = EFalse;
+
+    TInt rowDelta = 2;
+    TInt columnDelta = 1;
+
+    TBool intellFlagBG;
+    iTestNormCoef = (Abs(iMaskFgColor-iMaskBgColor)<<KNormCoefAcc)/Abs(iTestFgColor-iTestBgColor);
+
+    for ( TInt i = 0; i < aSize.iHeight; i += rowDelta )
+        {
+        intellFlagBG = EFalse;
+        for ( TInt j = 0; j < aSize.iWidth; j += columnDelta )
+            {
+            TInt c1 = (bmpIterator1.GetPixel())&0xff;
+            TInt c2 = (bmpIterator2.GetPixel())&0xff;
+
+            if ( c2 != iMaskBgColor ) // if foreground
+                {
+                if ( c2 == iMaskFgColor ) //should be "pure" FG
+                    {
+                        if (  Abs( c1 - iTestFgColor ) > iFgAvgDiffMin )
+                        {
+                            bmpIterator2.End();
+                            bmpIterator1.End();
+                            return KWorstCase;
+                        }
+                        intellFlagBG = ETrue;
+                    }
+                else if ( intellFlagBG ) // AA pixels
+                    {
+                    //calculate diff. in relative diff in aa pixel
+                    //in mask and searh image
+                    //based on assumtion that aa pixels color
+                    // relative to fg color should correlate
+                    TInt normD = (Abs(c1-iTestFgColor)*iTestNormCoef)>>KNormCoefAcc;
+                    sum += Abs(Abs(iMaskFgColor-c2) - normD );
+
+                    ++nofF;
+                    intellFlagBG = EFalse;
+
+                    }
+                }
+            for ( TInt l = 0; l < columnDelta; l++ )
+                {
+                if ( iterFlag )
+                    {
+                    bmpIterator1.DecXPos();
+                    bmpIterator2.DecXPos();
+                    }
+                else
+                    {
+                    bmpIterator1.IncXPos();
+                    bmpIterator2.IncXPos();
+                    }
+                }
+            }
+
+        for ( int k = 0; k < rowDelta; k++ )
+        {
+            bmpIterator1.IncYPos();
+            bmpIterator2.IncYPos();
+        }
+        for ( int l = 0; l < columnDelta; l++ )
+            {
+            if ( iterFlag )
+                {
+                bmpIterator1.IncXPos();
+                bmpIterator2.IncXPos();
+                }
+            else
+                {
+                bmpIterator1.DecXPos();
+                bmpIterator2.DecXPos();
+                }
+            }
+        iterFlag = !iterFlag;
+        }
+
+
+    bmpIterator2.End();
+    bmpIterator1.End();
+
+    if ( nofF == 0 )
+        {
+        return 0;
+        }
+    return sum / nofF;
+    }
+
+
+TInt CHtiTextRcg::ImageDiffAAFullL(CFbsBitmap * aBitmap1, TPoint aOrigin1,
+                 CFbsBitmap * aBitmap2)
+    {
+    TSize aSize = aBitmap2->SizeInPixels();
+    //straight average difference
+    TBitmapUtil bmpIterator1(aBitmap1);
+    TBitmapUtil bmpIterator2(aBitmap2);
+
+    bmpIterator1.Begin( aOrigin1 );
+    bmpIterator2.Begin( TPoint(0,0), bmpIterator1 );
+
+    TInt nofF = 0;
+    TInt sumF = 0;
+    TBool intellFlagBG;
+    TBool iterFlag = EFalse;
+    TInt rowDelta = 2;
+    TInt columnDelta = 1;
+
+    for ( TInt i = 0; i < aSize.iHeight; i += rowDelta )
+        {
+        intellFlagBG = EFalse;
+        for ( TInt j = 0; j < aSize.iWidth; j += columnDelta )
+            {
+            TInt c1 = ( bmpIterator1.GetPixel() ) & 0xff;
+            TInt c2 = ( bmpIterator2.GetPixel() ) & 0xff;
+
+            if ( c2 != iMaskBgColor ) // if foreground
+                {
+                if ( c2 == iMaskFgColor ) //should be pure FG
+                    {
+                        if (  Abs(c1 - iTestFgColor) > iFgAvgDiffMin )
+                        {
+                            bmpIterator2.End();
+                            bmpIterator1.End();
+                            return KWorstCase;
+                        }
+                        intellFlagBG = ETrue;
+                    }
+                else if ( intellFlagBG ) // AA pixels
+                    {
+                    //calculate diff. in relative diff in aa pixel
+                    //in mask and searh image
+                    //based on assumtion that aa pixels color
+                    // relative to fg color should correlate
+                    TInt normD = (Abs(c1-iTestFgColor)*iTestNormCoef)>>KNormCoefAcc;
+                    sumF += Abs(Abs(iMaskFgColor-c2) - normD );
+
+                    ++nofF;
+                    intellFlagBG = EFalse;
+                    }
+                }
+            for ( TInt l = 0; l < columnDelta; l++ )
+                {
+                if ( iterFlag )
+                    {
+                    bmpIterator1.DecXPos();
+                    bmpIterator2.DecXPos();
+                    }
+                else
+                    {
+                    bmpIterator1.IncXPos();
+                    bmpIterator2.IncXPos();
+                    }
+                }
+            }
+
+        for ( TInt k = 0; k < rowDelta; k++ )
+        {
+            bmpIterator1.IncYPos();
+            bmpIterator2.IncYPos();
+        }
+        for ( TInt l = 0; l < columnDelta; l++ )
+            {
+            if ( iterFlag )
+                {
+                bmpIterator1.IncXPos();
+                bmpIterator2.IncXPos();
+                }
+            else
+                {
+                bmpIterator1.DecXPos();
+                bmpIterator2.DecXPos();
+                }
+            }
+        iterFlag = !iterFlag;
+        }
+    bmpIterator2.End();
+    bmpIterator1.End();
+
+    if ( nofF == 0 )
+        return 0;
+
+    return sumF/nofF;
+    }
+
+TInt CHtiTextRcg::ImageDiffBinSampleL(CFbsBitmap * aBitmap1, TPoint aOrigin1,
+                 CFbsBitmap * aBitmap2)
+    {
+    TSize aSize = aBitmap2->SizeInPixels();
+    if ( iFGASet.Count() == 0 || iBGASet.Count() == 0 )
+        return KWorstCase;
+
+    //straight average difference
+    TBitmapUtil bmpIterator1(aBitmap1);
+    TBitmapUtil bmpIterator2(aBitmap2);
+
+    bmpIterator1.Begin( aOrigin1 );
+
+    //1. check FGA points are equal
+    bmpIterator1.SetPos( aOrigin1 + iFGASet[0]);
+    TInt colorFGA = bmpIterator1.GetPixel()&0xff;
+
+    for ( TInt i = 1; i < iFGAAmount; ++i )
+        {
+        bmpIterator1.SetPos( aOrigin1 + iFGASet[i] );
+        TInt c = bmpIterator1.GetPixel()&0xff;
+        if ( c != colorFGA )
+            {
+            bmpIterator2.End();
+            bmpIterator1.End();
+            return KWorstCase;
+            }
+        }
+    // if we are here all FGA points are equal to colorFGA
+    //2. check that avg BGA point value is not equal to colorFGA
+    TInt avgColorBGA = 0;
+    for ( TInt i = 0; i < iBGAAmount; ++i )
+        {
+        bmpIterator1.SetPos( aOrigin1 + iBGASet[i] );
+        avgColorBGA += bmpIterator1.GetPixel() & 0xff;
+        }
+    avgColorBGA /= iBGAAmount;
+    //if difference is too small leave with false
+    if ( Abs(avgColorBGA-colorFGA) <  iAvgDiffMin )
+        {
+        bmpIterator2.End();
+        bmpIterator1.End();
+        return KWorstCase;
+        }
+
+    //all checking based on FGA and BGA are correct, chance to have math
+    //3. calculate sum of diff between colorFGA and ALL FG points
+    bmpIterator1.End();
+    bmpIterator1.Begin( aOrigin1 );
+    bmpIterator2.Begin( TPoint(0,0), bmpIterator1 );
+
+    TBool iterFlag = EFalse;
+
+    TInt rowDelta = 1;
+    TInt columnDelta = 1;
+
+    for ( TInt i = 0; i < aSize.iHeight; i += rowDelta )
+        {
+        for ( TInt j = 0; j < aSize.iWidth; j += columnDelta )
+            {
+            TInt c1 = ( bmpIterator1.GetPixel() ) & 0xff;
+            TInt c2 = ( bmpIterator2.GetPixel() ) & 0xff;
+
+            if ( c2 == iMaskFgColor ) // if foreground
+            {
+                if ( colorFGA != c1 )
+                {
+                    bmpIterator2.End();
+                    bmpIterator1.End();
+                    return KWorstCase;
+                }
+            }
+            for ( TInt l = 0; l < columnDelta; l++ )
+                {
+                if ( iterFlag )
+                    {
+                    bmpIterator1.DecXPos();
+                    bmpIterator2.DecXPos();
+                    }
+                else
+                    {
+                    bmpIterator1.IncXPos();
+                    bmpIterator2.IncXPos();
+                    }
+                }
+            }
+
+        for ( TInt k = 0; k < rowDelta; k++ )
+        {
+            bmpIterator1.IncYPos();
+            bmpIterator2.IncYPos();
+        }
+        for ( TInt l = 0; l < columnDelta; l++ )
+            {
+            if ( iterFlag )
+                {
+                bmpIterator1.IncXPos();
+                bmpIterator2.IncXPos();
+                }
+            else
+                {
+                bmpIterator1.DecXPos();
+                bmpIterator2.DecXPos();
+                }
+            }
+        iterFlag = !iterFlag;
+        }
+
+
+    bmpIterator2.End();
+    bmpIterator1.End();
+
+    return 0;
+    }
+
+TInt CHtiTextRcg::ImageDiffBinFullL(CFbsBitmap * aBitmap1, TPoint aOrigin1,
+                 CFbsBitmap * aBitmap2)
+    {
+    TSize aSize = aBitmap2->SizeInPixels();
+    //straight average difference
+    TBitmapUtil bmpIterator1(aBitmap1);
+    TBitmapUtil bmpIterator2(aBitmap2);
+
+    bmpIterator1.Begin( aOrigin1 );
+    bmpIterator2.Begin( TPoint(0,0), bmpIterator1 );
+
+    //TInt nofF = 0;
+    TInt nofB = 0;
+
+    TInt sumB = 0;
+    //TInt sumF = 0;
+    TBool intellFlagBG;
+    TBool iterFlag = EFalse;
+    TInt rowDelta = 1;
+    TInt columnDelta = 1;
+    TInt fgColor = -1;
+    for ( TInt i = 0; i < aSize.iHeight; i += rowDelta )
+        {
+        intellFlagBG = EFalse;
+        for ( TInt j = 0; j < aSize.iWidth; j += columnDelta )
+            {
+            TInt c1 = ( bmpIterator1.GetPixel() ) & 0xff;
+            TInt c2 = ( bmpIterator2.GetPixel() ) & 0xff;
+
+            if ( c2 == iMaskFgColor ) // if FG
+            {
+                if ( c1 != fgColor )
+                    {
+                    if ( fgColor != -1 )
+                        {
+                        //failed
+                        bmpIterator2.End();
+                        bmpIterator1.End();
+                        return KWorstCase;
+                        }
+                    else
+                        {
+                        fgColor = c1; //init fgColor
+                        }
+                    }
+                intellFlagBG = ETrue;
+            }
+            else if ( c2 == iMaskBgColor && intellFlagBG )
+            {
+                sumB += c1;
+                ++nofB;
+                intellFlagBG = EFalse;
+            }
+            for ( TInt l = 0; l < columnDelta; l++ )
+                {
+                if ( iterFlag )
+                    {
+                    bmpIterator1.DecXPos();
+                    bmpIterator2.DecXPos();
+                    }
+                else
+                    {
+                    bmpIterator1.IncXPos();
+                    bmpIterator2.IncXPos();
+                    }
+                }
+            }
+
+        for ( TInt k = 0; k < rowDelta; k++ )
+        {
+            bmpIterator1.IncYPos();
+            bmpIterator2.IncYPos();
+        }
+        for ( TInt l = 0; l < columnDelta; l++ )
+            {
+            if ( iterFlag )
+                {
+                bmpIterator1.IncXPos();
+                bmpIterator2.IncXPos();
+                }
+            else
+                {
+                bmpIterator1.DecXPos();
+                bmpIterator2.DecXPos();
+                }
+            }
+        iterFlag = !iterFlag;
+        }
+    bmpIterator2.End();
+    bmpIterator1.End();
+
+    if ( nofB == 0 ) //something wrong, should be some BG
+        return KWorstCase;
+
+    TInt avgB = sumB / ( nofB );
+
+    if ( Abs( fgColor - avgB ) < iAvgDiffMin )
+        {
+        return KWorstCase;
+        }
+
+    return 0;
+    }
+
+void CHtiTextRcg::MinMax(CFbsBitmap * aBitmap, TInt& aMin, TInt& aMax)
+    {
+    //straight average difference
+    TSize aSize = aBitmap->SizeInPixels();
+    TBitmapUtil bmpIterator(aBitmap);
+
+    bmpIterator.Begin( TPoint(0,0) );
+
+    aMin = KMaxTInt;
+    aMax = -1;
+    for ( TInt i = 0; i < aSize.iHeight; ++i )
+        {
+        for ( TInt j = 0; j < aSize.iWidth; ++j )
+            {
+            TInt c = ( bmpIterator.GetPixel() ) & 0xff;
+
+            if ( c < aMin )
+                {
+                aMin = c;
+                }
+            else if ( c > aMax )
+                {
+                aMax = c;
+                }
+
+            if ( i & 1 )
+                {
+                bmpIterator.DecXPos();
+                }
+            else
+                {
+                bmpIterator.IncXPos();
+                }
+            }
+        bmpIterator.IncYPos();
+
+        if ( i & 1 )
+            {
+            bmpIterator.IncXPos();
+            }
+        else
+            {
+            bmpIterator.DecXPos();
+            }
+        }
+
+    bmpIterator.End();
+    }
+
+CFbsBitmap* CHtiTextRcg::ColorDownL( CFbsBitmap * aBitmap )
+    {
+    TSize bmpSize = aBitmap->SizeInPixels();
+    CFbsBitmap* result = new ( ELeave )  CFbsBitmap();
+    User::LeaveIfError( result->Create( bmpSize, EGray256 ) );
+
+    TBitmapUtil srcBmpIterator( aBitmap );
+    TBitmapUtil resultBmpIterator( result );
+
+    srcBmpIterator.Begin( TPoint( 0, 0 ) );
+    resultBmpIterator.Begin( TPoint( 0, 0 ), srcBmpIterator );
+
+    TPoint point( 0, 0 );
+    for ( point.iY = 0; point.iY < bmpSize.iHeight; ++point.iY )
+        {
+        point.iX = 0;
+        srcBmpIterator.SetPos( point );
+        resultBmpIterator.SetPos( point );
+        for ( ; point.iX < bmpSize.iWidth; ++point.iX )
+            {
+            TUint32 c = srcBmpIterator.GetPixel();
+            TRgb col( c );
+            resultBmpIterator.SetPixel( col.Gray256() );
+            srcBmpIterator.IncXPos();
+            resultBmpIterator.IncXPos();
+            }
+        }
+
+    resultBmpIterator.End();
+    srcBmpIterator.End();
+
+    return result;
+    }
+
+CFbsBitmap* CHtiTextRcg::GetTextBitmapL( const TDesC& aText,
+                                         const CFont* fontUsed,
+                                         const TInt aLength )
+    {
+    return GetTextBitmapL( aText, fontUsed, KRgbBlack, KRgbWhite,
+            EGray256, aLength );
+    }
+
+
+
+CFbsBitmap* CHtiTextRcg::GetTextBitmapL( const TDesC& aText,
+                                    const CFont* fontUsed,
+                                    TRgb aForeground,
+                                    TRgb aBackground,
+                                    TDisplayMode aDisplayMode,
+                                    const TInt aLength )
+{
+    HTI_LOG_FUNC_IN( "CHtiTextRcg::GetTextBitmapL" )
+    // Measure the text to get needed bitmap size and baseline point
+    CFont::TMeasureTextOutput output;
+    TInt reqWidth = fontUsed->MeasureText( aText, NULL, &output );
+    reqWidth = Max( reqWidth, output.iBounds.Width() );
+
+    // If only partial text requested, calculate new width but keep the
+    // height (and baseline) as it needs to be the same as for the full text
+    // for the text recognition to work.
+    if ( aLength < aText.Length() )
+        {
+        CFont::TMeasureTextOutput partialOutput;
+        reqWidth = fontUsed->MeasureText( aText.Left( aLength ), NULL,
+                &partialOutput );
+        reqWidth = Max( reqWidth, partialOutput.iBounds.Width() );
+        }
+
+    TSize bmpSize( reqWidth, output.iBounds.Height() );
+    HTI_LOG_FORMAT( "Bitmap width = %d", bmpSize.iWidth );
+    HTI_LOG_FORMAT( "Bitmap height = %d", bmpSize.iHeight );
+
+    // Create the bitmap
+    CFbsBitmap* result = new ( ELeave ) CFbsBitmap();
+    User::LeaveIfError( result->Create( bmpSize, aDisplayMode ) );
+
+    CFbsBitGc* bitmapContext = NULL;
+    CFbsBitmapDevice* bitmapDevice = CFbsBitmapDevice::NewL( result );
+    CleanupStack::PushL( bitmapDevice );
+    User::LeaveIfError( bitmapDevice->CreateContext( bitmapContext ) );
+    CleanupStack::PushL( bitmapContext );
+    bitmapContext->SetBrushColor( aBackground );
+    bitmapContext->Clear();
+    bitmapContext->UseFont( fontUsed );
+    bitmapContext->SetPenColor( aForeground );
+
+    // Set the baseline point and draw the text
+    TPoint pos( 0, bmpSize.iHeight - output.iBounds.iBr.iY );
+    HTI_LOG_FORMAT( "Baseline Y = %d", pos.iY );
+    if ( aLength < aText.Length() )
+        {
+        bitmapContext->DrawText( aText.Left( aLength ), pos );
+        }
+    else
+        {
+        bitmapContext->DrawText( aText, pos );
+        }
+
+    CleanupStack::PopAndDestroy( 2 );
+    HTI_LOG_FUNC_OUT( "CHtiTextRcg::GetTextBitmapL" )
+    return result;
+}
+
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiServicePlugins/HtiScreenshotServicePlugin/src/proxy.cpp	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,37 @@
+/*
+* 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 proxy for screenshot service plugin dll
+*
+*/
+
+
+// INCLUDES
+#include "HtiScreenshotServicePlugin.h"
+
+#include <e32std.h>
+#include <ecom/implementationproxy.h>
+
+
+const TImplementationProxy ImplementationTable[] =
+    {
+        IMPLEMENTATION_PROXY_ENTRY(0x1020DEC3, CHtiScreenshotServicePlugin::NewL)
+    };
+
+// Function used to return an instance of the proxy table.
+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/htiui/HtiServicePlugins/HtiSysInfoServicePlugin/data/10210CC6.rss	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,49 @@
+/*
+* 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:  Resource definitions for system info service ECOM plugin.
+*
+*/
+
+
+// INCLUDES
+#include <ecom/registryinfo.rh>
+
+
+// RESOURCE DEFINITIONS
+RESOURCE REGISTRY_INFO theInfo
+    {
+    // UID for the DLL
+    dll_uid = 0x10210CC6;
+    // Declare array of interface info
+    interfaces =
+        {
+        INTERFACE_INFO
+            {
+            // UID of interface that is implemented
+            interface_uid = 0x1020DEB7;
+            implementations =
+                {
+                IMPLEMENTATION_INFO
+                    {
+                    implementation_uid = 0x10210CC7;
+                    version_no         = 1;
+                    display_name       = "SysInfo service";
+                    default_data       = "SysInfo";
+                    opaque_data        = "";
+                    }
+                };
+            }
+        };
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiServicePlugins/HtiSysInfoServicePlugin/group/HtiSysInfoServicePlugin.mmp	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,72 @@
+/*
+* 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:  HTI service plugin for getting system information from device.
+*
+*/
+
+
+#include <platform_paths.hrh>
+#include "../../../symbian_version.hrh"
+
+TARGET          HtiSysInfoServicePlugin.dll
+TARGETTYPE      PLUGIN
+
+// ECom Dll recognition UID followed by the unique UID for this dll
+UID             0x10009D8D 0x10210CC6
+
+VENDORID        0x101FB657
+
+CAPABILITY      ALL -TCB
+
+SOURCEPATH      ../src
+SOURCE          proxy.cpp
+SOURCE          HtiSysInfoServicePlugin.cpp
+SOURCE          HtiLightsController.cpp
+SOURCE          HtiPropertySubscriber.cpp
+
+USERINCLUDE     ../inc
+APP_LAYER_SYSTEMINCLUDE
+
+START RESOURCE  ../data/10210CC6.rss
+TARGET          HtiSysInfoServicePlugin.rsc
+END
+
+#if ( SYMBIAN_VERSION_SUPPORT < SYMBIAN_4 )
+LIBRARY         avkon.lib
+#endif
+
+LIBRARY         aknskinsrv.lib
+LIBRARY         bafl.lib
+LIBRARY         btdevice.lib
+LIBRARY         btmanclient.lib
+LIBRARY         btengsettings.lib
+LIBRARY         c32.lib
+LIBRARY         centralrepository.lib
+LIBRARY         customapi.lib
+LIBRARY         drmserverinterfaces.lib
+LIBRARY         ecom.lib
+LIBRARY         efsrv.lib
+LIBRARY         etel.lib
+LIBRARY         etelmm.lib
+LIBRARY         euser.lib
+LIBRARY         hal.lib
+LIBRARY         hwrmlightclient.lib
+LIBRARY         sysutil.lib
+LIBRARY         tzclient.lib
+LIBRARY         flogger.lib
+LIBRARY	        featmgr.lib // Chinese support
+
+SMPSAFE
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiServicePlugins/HtiSysInfoServicePlugin/group/bld.inf	Wed Aug 25 15:45:01 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:  Build information file for HtiSysInfoServicePlugin
+*
+*/
+
+
+PRJ_PLATFORMS
+
+PRJ_EXPORTS
+
+PRJ_MMPFILES
+HtiSysInfoServicePlugin.mmp
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiServicePlugins/HtiSysInfoServicePlugin/inc/HtiLightsController.h	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,101 @@
+/*
+* 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:  For controlling S60 device lights.
+*                Helper for SysInfoServicePlugin.
+*
+*/
+
+
+#ifndef HTILIGHTSCONTROLLER_H
+#define HTILIGHTSCONTROLLER_H
+
+// INCLUDES
+#include <e32base.h>
+#include <hwrmlight.h>
+
+// FORWARD DECLARATIONS
+class MHtiDispatcher;
+
+// CLASS DECLARATION
+/**
+* For controlling S60 device lights. Helper class for SysInfoServicePlugin.
+*/
+class CHtiLightsController : public CBase,
+                             public MHWRMLightObserver
+    {
+public:
+
+    static CHtiLightsController* NewL( MHtiDispatcher* aDispatcher );
+
+    /**
+    * Called by the plugin when there is a message to be processed by
+    * the lights controller.
+    * @param aMessage message body destinated to the servive
+    * @param aReply on return contains the reply message (OK response)
+    */
+    void ProcessMessageL( const TDesC8& aMessage, TDes8& aReply );
+
+    ~CHtiLightsController();
+
+    // from MHWRMLightObserver
+    void LightStatusChanged( TInt aTarget,
+                             CHWRMLight::TLightStatus aStatus );
+
+protected:
+
+    CHtiLightsController( MHtiDispatcher* aDispatcher );
+    void ConstructL();
+
+private: // private helper methods
+
+    void HandleLightStatusL( const TDesC8& aMessage );
+    void HandleLightOnL( const TDesC8& aMessage );
+    void HandleLightOffL( const TDesC8& aMessage );
+    void HandleLightBlinkL( const TDesC8& aMessage );
+
+
+private: // private data
+
+    // The message dispatcher interface for dispatching error messages.
+    MHtiDispatcher* iDispatcher;
+
+    // The reply message to dispatch.
+    TBuf8<4> iReply;
+
+    // Light client session.
+    CHWRMLight* iLight;
+
+    // The latest command
+    TInt iCommand;
+
+    // The light target bitmask of latest call
+    TInt iTarget;
+
+    // The duration given in latest call
+    TInt iDuration;
+
+    // The lights on duration given in latest blink lights call
+    TInt iOnDuration;
+
+    // The lights off duration given in latest blink lights call
+    TInt iOffDuration;
+
+    // The intensity value of latest call
+    TInt iIntensity;
+
+    // The fade value of latest call
+    TBool iFade;
+    };
+
+#endif // HTILIGHTSCONTROLLER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiServicePlugins/HtiSysInfoServicePlugin/inc/HtiPropertySubscriber.h	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,54 @@
+/*
+* 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:  For controlling S60 device lights.
+*                Subscribes to a property to monitor changes in it.
+*
+*/
+
+
+#ifndef HTIPROPERTYSUBSCRIBER_H
+#define HTIPROPERTYSUBSCRIBER_H
+
+// INCLUDES
+#include <e32base.h>
+#include <e32property.h>
+
+// FORWARD DECLARATIONS
+
+// CLASS DECLARATION
+/**
+* Subscribes to a property to monitor changes in it.
+*/
+class CHtiPropertySubscriber : public CActive
+    {
+    public:
+        CHtiPropertySubscriber( TCallBack aCallBack, RProperty& aProperty );
+        ~CHtiPropertySubscriber();
+
+    public: // New functions
+        void Subscribe();
+        void Unsubscribe();
+
+    private: // from CActive
+        void RunL();
+        void DoCancel();
+
+    private: // data
+        TCallBack   iCallBack;
+        RProperty&  iProperty;
+    };
+
+#endif // HTIPROPERTYSUBSCRIBER_H
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiServicePlugins/HtiSysInfoServicePlugin/inc/HtiSysInfoServicePlugin.h	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,184 @@
+/*
+* 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 ECOM plug-in service interface. Provides
+*                system info service.
+*
+*/
+
+
+#ifndef HTISYSINFOPLUGIN_H
+#define HTISYSINFOPLUGIN_H
+
+// INCLUDES
+#include "../../../symbian_version.hrh"
+
+#include <e32property.h>
+#include <f32file.h>
+#include <HtiServicePluginInterface.h>
+
+// FORWARD DECLARATIONS
+class CHtiLightsController;
+class CHtiPropertySubscriber;
+class CMGXFileManager;
+class CMGXFileNotificationHandler;
+class MDesCArray;
+
+// CLASS DECLARATION
+/**
+* System info service plugin.
+*/
+class CHtiSysInfoServicePlugin : public CHTIServicePluginInterface
+    {
+    public:
+
+        static CHtiSysInfoServicePlugin* NewL();
+
+        // Interface implementation
+        void ProcessMessageL( const TDesC8& aMessage,
+                              THtiMessagePriority aPriority );
+
+        void NotifyMemoryChange( TInt aAvailableMemory );
+
+#if ( SYMBIAN_VERSION_SUPPORT < SYMBIAN_4 )
+        static TInt HandleAllowSSPropertyChange( TAny* aPtr );
+#endif
+
+    protected:
+
+        CHtiSysInfoServicePlugin();
+        void ConstructL();
+        virtual ~CHtiSysInfoServicePlugin();
+
+
+    private: // private helper methods
+
+        void HandleGetHalAttrL( const TDesC8& aMessage );
+        void HandleGetImeiL( const TDesC8& aMessage );
+        void HandleGetSwVersionL( const TDesC8& aMessage );
+        void HandleGetLangVersionL( const TDesC8& aMessage );
+        void HandleGetSwLangVersionL( const TDesC8& aMessage );
+        void HandleGetUserAgentStringL( const TDesC8& aMessage );
+        void HandleGetFreeRamL( const TDesC8& aMessage );
+        void HandleGetUsedRamL( const TDesC8& aMessage );
+        void HandleGetTotalRamL( const TDesC8& aMessage );
+        void HandleEatRamL( const TDesC8& aMessage );
+        void HandleReleaseRamL( const TDesC8& aMessage );
+        void HandleGetFreeDiskSpaceL( const TDesC8& aMessage );
+        void HandleGetUsedDiskSpaceL( const TDesC8& aMessage );
+        void HandleGetTotalDiskSpaceL( const TDesC8& aMessage );
+        void HandleEatDiskSpaceL( const TDesC8& aMessage );
+        void HandleReleaseDiskSpaceL( const TDesC8& aMessage );
+        void HandleSetHomeTimeL( const TDesC8& aMessage );
+        void HandleGetHomeTimeL( const TDesC8& aMessage );
+        void HandleLightsCommandL( const TDesC8& aMessage );
+        void HandleScreenSaverCommandL( const TDesC8& aMessage );
+        void HandleScreenSaverTimeoutCommandL( const TDesC8& aMessage );
+        void HandleNetworkModeCommandL( const TDesC8& aMessage );
+        void HandleIrActivateCommandL( const TDesC8& aMessage );
+        void HandleBtPowerCommandL( const TDesC8& aMessage );
+        void HandleBtSettingsCommandL( const TDesC8& aMessage );
+        void HandleBtDeletePairingsL( const TDesC8& aMessage );
+        void HandleKeyLockToggleL( const TDesC8& aMessage );
+        void HandleAutoKeyGuardTimeL( const TDesC8& aMessage );
+        void HandleEmptyDrmRightsDbL( const TDesC8& aMessage );
+        void HandleBatteryStatusL( const TDesC8& aMessage );
+        void HandleSignalStrengthL( const TDesC8& aMessage );
+        void HandleSetDateTimeFormatL( const TDesC8& aMessage );
+        void HandleHsdpaCommandL( const TDesC8& aMessage );
+        void HandleUpdateMediaGalleryL( const TDesC8& aMessage );
+        void HandleActivateSkinL( const TDesC8& aMessage );
+        void HandleSetLanguageL( const TDesC8& aMessage );
+
+        void SetDefaultNumberModeL(TInt aMode, TInt aNbrModeType);
+        void ParseTimeDataL( const TDesC8& aTimeData, TTime& aResult );
+        TInt CleanUpTempFiles();
+        TBool CanTurnBluetoothOnL( const TBool aUseForce );
+        TInt CreatFileToEatDiskSpace( TFileName aPath, TInt64 aSpaceToEat  );
+
+    private: // private data
+        RFs iFs;
+        CFileMan* iFileMan;
+        HBufC8* iMemEater;
+        HBufC8* iReply;
+        CHtiLightsController* iLightsController;
+        CHtiPropertySubscriber* iAllowSSSubscriber;
+#if ( SYMBIAN_VERSION_SUPPORT < SYMBIAN_4 )
+        TInt iAllowSSValue;
+        RProperty iAllowSSProperty;
+        TBool iAllowSSPropertyAttached;
+#endif
+        TBool iGalleryUpdateSupported;
+    };
+
+
+// CLASS DECLARATION
+/**
+*  Helper class to wait the async requests.
+*/
+class CAsyncWaiter : public CActive
+    {
+    public:
+        static CAsyncWaiter* NewL( TInt aPriority = EPriorityStandard );
+        static CAsyncWaiter* NewLC( TInt aPriority = EPriorityStandard );
+        ~CAsyncWaiter();
+
+        void StartAndWait();
+        TInt Result() const;
+
+    private:
+        CAsyncWaiter( TInt aPriority );
+
+        // from CActive
+        void RunL();
+        void DoCancel();
+
+    private:
+        CActiveSchedulerWait* iWait;
+        TInt iResult;
+        
+    };
+
+
+// CLASS DECLARATION
+/**
+*  Copied from MGXFileManagerFactory.h
+*/
+class MGXFileManagerFactory
+    {
+    public:
+        static CMGXFileManager* NewFileManagerL( RFs& aFs );
+        static CMGXFileNotificationHandler* NewFileNotificationHandlerL();
+    };
+
+
+// CLASS DECLARATION
+/**
+*  Copied from CMGXFileManager.h
+*/
+class CMGXFileManager : public CBase
+    {
+    public:
+        virtual TBool SuccessFileNameL( const TDesC& aFileName,
+                                        TDriveNumber aDrive ) = 0;
+        virtual void UpdateL() = 0;
+        virtual void UpdateL( const TDesC& aFullPath ) = 0;
+        virtual void UpdateL( const TDesC& aOldName,
+                              const TDesC& aNewName ) = 0;
+        virtual void UpdateL( const MDesCArray& aFileNameArray ) = 0;
+    };
+
+
+#endif // HTISYSINFOPLUGIN_H
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiServicePlugins/HtiSysInfoServicePlugin/src/HtiLightsController.cpp	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,405 @@
+/*
+* 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 for controlling S60 device lights.
+*
+*/
+
+
+// INCLUDE FILES
+#include <HtiDispatcherInterface.h>
+#include <HtiLogging.h>
+#include "HtiLightsController.h"
+
+// CONSTANTS
+const static TUid KSysInfoServiceUid = { 0x10210CC7 };
+
+const static TInt KLightStatusCmdLength = 2;
+const static TInt KLightOnCmdLength     = 6;
+const static TInt KLightOffCmdLength    = 5;
+const static TInt KLightBlinkCmdLength  = 9;
+
+enum TSysInfoLightControlCommand
+    {
+    ELightStatus = 0x30,
+    ELightOn =     0x31,
+    ELightOff =    0x32,
+    ELightBlink =  0x33
+    };
+
+_LIT8( KErrDescrArgument,     "Invalid argument" );
+_LIT8( KErrDescrLightOn,      "LightOn failed" );
+_LIT8( KErrDescrLightOff,     "LightOff failed" );
+_LIT8( KErrDescrLightBlink,   "LightBlink failed" );
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CHtiLightsController::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CHtiLightsController* CHtiLightsController::NewL( MHtiDispatcher* aDispatcher )
+    {
+    CHtiLightsController* self = new (ELeave) CHtiLightsController(
+                                                  aDispatcher );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop();
+    return self;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CHtiLightsController::CHtiLightsController
+// C++ default constructor.
+// -----------------------------------------------------------------------------
+//
+CHtiLightsController::CHtiLightsController(
+        MHtiDispatcher* aDispatcher ):iDispatcher( aDispatcher ),
+                                      iCommand( 0 ),
+                                      iTarget( 0 ),
+                                      iDuration( 0 ),
+                                      iOnDuration( 0 ),
+                                      iOffDuration( 0 ),
+                                      iIntensity( 0 ),
+                                      iFade( EFalse )
+    {
+    }
+
+
+// -----------------------------------------------------------------------------
+// CHtiLightsController::~CHtiLightsController()
+// Destructor
+// -----------------------------------------------------------------------------
+//
+CHtiLightsController::~CHtiLightsController()
+    {
+    HTI_LOG_TEXT("CHtiLightsController destroy");
+    delete iLight;
+    }
+
+// Second phase construction
+void CHtiLightsController::ConstructL()
+    {
+    HTI_LOG_TEXT("CHtiLightsController::ConstructL");
+    iLight = CHWRMLight::NewL( this );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CHtiLightsController::ProcessMessageL
+// Called by the plugin when there is a message to be processed by
+// the lights controller.
+// -----------------------------------------------------------------------------
+//
+void CHtiLightsController::ProcessMessageL( const TDesC8& aMessage,
+                                            TDes8& aReply )
+    {
+    HTI_LOG_FUNC_IN( "CHtiLightsController::ProcessMessageL" );
+
+    iCommand = aMessage[0];
+    iReply.Zero();
+
+    switch ( iCommand )
+        {
+        case ELightStatus:
+            {
+            HTI_LOG_TEXT( "ELightStatus" );
+            HandleLightStatusL( aMessage );
+            break;
+            }
+
+        case ELightOn:
+            {
+            HTI_LOG_TEXT( "ELightOn" );
+            HandleLightOnL( aMessage );
+            break;
+            }
+
+        case ELightOff:
+            {
+            HTI_LOG_TEXT( "ELightOff" );
+            HandleLightOffL( aMessage );
+            break;
+            }
+
+        case ELightBlink:
+            {
+            HTI_LOG_TEXT( "ELightBlink" );
+            HandleLightBlinkL( aMessage );
+            break;
+            }
+
+        default:
+            {
+            // If comes here it's an error from caller.
+            User::Leave( KErrArgument );
+            }
+        }
+
+    aReply.Copy( iReply );
+
+    HTI_LOG_FUNC_OUT("CHtiLightsController::ProcessMessageL");
+    }
+
+
+// -----------------------------------------------------------------------------
+// CHtiLightsController::HandleLightStatusL
+// Gets the status of the given light target.
+// Returns "Not supported" for S60 2.x
+// -----------------------------------------------------------------------------
+//
+void CHtiLightsController::HandleLightStatusL( const TDesC8& aMessage )
+    {
+    HTI_LOG_FUNC_IN( "CHtiLightsController::HandleLightStatusL" );
+
+    if ( aMessage.Length() != KLightStatusCmdLength )
+        {
+        iDispatcher->DispatchOutgoingErrorMessage(
+            KErrArgument, KErrDescrArgument, KSysInfoServiceUid );
+        }
+
+    else
+        {
+        iTarget = aMessage[1];
+        iReply.Append( iLight->LightStatus( iTarget ) );
+        }
+    HTI_LOG_FUNC_OUT( "CHtiLightsController::HandleLightStatusL" );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CHtiLightsController::HandleLightOnL
+// Turns on light with specified parameters.
+// For S60 2.x just turns on lights forever, parameters are ignored.
+// -----------------------------------------------------------------------------
+//
+void CHtiLightsController::HandleLightOnL( const TDesC8& aMessage )
+    {
+    HTI_LOG_FUNC_IN( "CHtiLightsController::HandleLightOnL" );
+
+    if ( aMessage.Length() != KLightOnCmdLength )
+        {
+        iDispatcher->DispatchOutgoingErrorMessage(
+            KErrArgument, KErrDescrArgument, KSysInfoServiceUid );
+        return;
+        }
+
+    // parse values from message
+    iTarget    = aMessage[1];
+    iDuration  = aMessage[2] + ( aMessage[3] << 8 );
+    iIntensity = aMessage[4];
+    iFade      = (TBool)aMessage[5];
+
+    TInt err = KErrNone;
+
+    // normalize possibly abnormal values
+    if ( iIntensity < KHWRMLightMinIntensity )
+        iIntensity = KHWRMDefaultIntensity;
+
+    if ( iIntensity > KHWRMLightMaxIntensity )
+        iIntensity = KHWRMLightMaxIntensity;
+
+    if ( iDuration < 1 ) iDuration = KHWRMInfiniteDuration;
+
+    // shoot
+    TRAP( err, iLight->LightOnL( iTarget, iDuration, iIntensity, iFade ) );
+
+    if ( err )
+        {
+        iDispatcher->DispatchOutgoingErrorMessage(
+            err, KErrDescrLightOn, KSysInfoServiceUid );
+        }
+
+    else
+        {
+        iReply.Append( 0 );
+        }
+
+    HTI_LOG_FUNC_OUT( "CHtiLightsController::HandleLightOnL ");
+    }
+
+
+// -----------------------------------------------------------------------------
+// CHtiLightsController::HandleLightOffL
+// Turns off light with specified parameters.
+// Returns "Not supported" for S60 2.x
+// -----------------------------------------------------------------------------
+//
+void CHtiLightsController::HandleLightOffL( const TDesC8& aMessage )
+    {
+    HTI_LOG_FUNC_IN( "CHtiLightsController::HandleLightOffL" );
+
+    if ( aMessage.Length() != KLightOffCmdLength )
+        {
+        iDispatcher->DispatchOutgoingErrorMessage(
+            KErrArgument, KErrDescrArgument, KSysInfoServiceUid );
+        return;
+        }
+
+    // parse values from message
+    iTarget   = aMessage[1];
+    iDuration = aMessage[2] + ( aMessage[3] << 8 );
+    iFade     = (TBool)aMessage[4];
+
+    // normalize possibly abnormal values
+    if ( iDuration < 1 ) iDuration = KHWRMInfiniteDuration;
+
+    // shoot
+    TRAPD( err, iLight->LightOffL( iTarget, iDuration, iFade ) );
+
+    if ( err )
+        {
+        iDispatcher->DispatchOutgoingErrorMessage(
+            err, KErrDescrLightOff, KSysInfoServiceUid );
+        }
+
+    else
+        {
+        iReply.Append( 0 );
+        }
+    HTI_LOG_FUNC_OUT( "CHtiLightsController::HandleLightOffL" );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CHtiLightsController::HandleLightBlinkL
+// Blinks light with specified parameters.
+// Returns "Not supported" for S60 2.x
+// -----------------------------------------------------------------------------
+//
+void CHtiLightsController::HandleLightBlinkL( const TDesC8& aMessage )
+    {
+    HTI_LOG_FUNC_IN( "CHtiLightsController::HandleLightBlinkL" );
+
+    if ( aMessage.Length() != KLightBlinkCmdLength )
+        {
+        iDispatcher->DispatchOutgoingErrorMessage(
+            KErrArgument, KErrDescrArgument, KSysInfoServiceUid );
+        return;
+        }
+
+    // parse values from message
+    iTarget      = aMessage[1];
+    iDuration    = aMessage[2] + ( aMessage[3] << 8 );
+    iOnDuration  = aMessage[4] + ( aMessage[5] << 8 );
+    iOffDuration = aMessage[6] + ( aMessage[7] << 8 );
+    iIntensity   = aMessage[8];
+
+    // normalize possibly abnormal values
+    if ( iIntensity < KHWRMLightMinIntensity )
+        iIntensity = KHWRMDefaultIntensity;
+
+    if ( iIntensity > KHWRMLightMaxIntensity )
+        iIntensity = KHWRMLightMaxIntensity;
+
+    if ( iDuration < 1 ) iDuration = KHWRMInfiniteDuration;
+
+    if ( iOnDuration < 1 || iOffDuration < 1 )
+        {
+        iOnDuration = KHWRMDefaultCycleTime;
+        iOffDuration = KHWRMDefaultCycleTime;
+        }
+
+    // shoot
+    TRAPD( err, iLight->LightBlinkL(
+            iTarget, iDuration, iOnDuration, iOffDuration, iIntensity ) );
+
+    if ( err )
+        {
+        iDispatcher->DispatchOutgoingErrorMessage(
+            err, KErrDescrLightBlink, KSysInfoServiceUid );
+        }
+
+    else
+        {
+        iReply.Append( 0 );
+        }
+    HTI_LOG_FUNC_OUT( "CHtiLightsController::HandleLightBlinkL" );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CHtiLightsController::LightStatusChanged
+// Called when status of any light target changes.
+// If infinite duration is requested, restores the state back to what was
+// last requested.
+// This method does not exist for S60 2.x
+// -----------------------------------------------------------------------------
+//
+void CHtiLightsController::LightStatusChanged( TInt aTarget,
+                                     CHWRMLight::TLightStatus aStatus )
+    {
+    HTI_LOG_FORMAT( "Light status changed for target %d", aTarget );
+    HTI_LOG_FORMAT( "New status = %d", aStatus );
+    HTI_LOG_FORMAT( "Current target = %d", iTarget );
+
+    TInt target = aTarget & iTarget;
+    if ( !target )
+        {
+        HTI_LOG_TEXT( "Not interested about the target" );
+        return;
+        }
+
+    HTI_LOG_TEXT( "Matches current target" );
+
+    if ( iDuration != KHWRMInfiniteDuration )
+        {
+        return;
+        }
+
+    if ( ( aStatus == CHWRMLight::ELightOn && iCommand == ELightOn ) ||
+         ( aStatus == CHWRMLight::ELightOff && iCommand == ELightOff ) ||
+         ( aStatus == CHWRMLight::ELightBlink && iCommand == ELightBlink ) )
+        {
+        HTI_LOG_TEXT( "Status already OK" );
+        return;
+        }
+
+    HTI_LOG_TEXT( "Infinite duration wanted - restore light status" );
+    switch ( iCommand )
+        {
+        case ELightOn:
+            {
+            // Ignore error
+            TRAPD( err, iLight->LightOnL(
+                    target, iDuration, iIntensity, iFade ) );
+            HTI_LOG_FORMAT( "LightOnL return code %d", err );
+            err = err; // to get rid of compiler warning for non-logging
+            break;
+            }
+        case ELightOff:
+            {
+            // Ignore error
+            TRAPD( err, iLight->LightOffL( target, iDuration, iFade ) );
+            HTI_LOG_FORMAT( "LightOffL return code %d", err );
+            err = err; // to get rid of compiler warning for non-logging
+            break;
+            }
+        case ELightBlink:
+            {
+            // Ignore error
+            TRAPD( err, iLight->LightBlinkL(
+                    target, iDuration, iOnDuration,
+                    iOffDuration, iIntensity ) );
+            HTI_LOG_FORMAT( "LightBlinkL return code %d", err );
+            err = err; // to get rid of compiler warning for non-logging
+            break;
+            }
+        default:
+            break;
+        }
+    }
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiServicePlugins/HtiSysInfoServicePlugin/src/HtiPropertySubscriber.cpp	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,100 @@
+/*
+* 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 for controlling S60 device lights.
+*
+*/
+
+
+// INCLUDE FILES
+#include <HtiLogging.h>
+#include "HtiPropertySubscriber.h"
+
+// CONSTANTS
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CHtiPropertySubscriber::CHtiPropertySubscriber
+// -----------------------------------------------------------------------------
+//
+CHtiPropertySubscriber::CHtiPropertySubscriber( TCallBack aCallBack,
+    RProperty& aProperty) : CActive( EPriorityNormal ),
+                            iCallBack( aCallBack ),
+                            iProperty( aProperty )
+    {
+    HTI_LOG_TEXT( "CHtiPropertySubscriber construct" );
+    CActiveScheduler::Add( this );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CHtiPropertySubscriber::~CHtiPropertySubscriber
+// -----------------------------------------------------------------------------
+//
+CHtiPropertySubscriber::~CHtiPropertySubscriber()
+    {
+    HTI_LOG_TEXT( "CHtiPropertySubscriber destroy" );
+    Cancel();
+    }
+
+
+// -----------------------------------------------------------------------------
+// CHtiPropertySubscriber::Subscribe
+// -----------------------------------------------------------------------------
+//
+void CHtiPropertySubscriber::Subscribe()
+    {
+    if ( !IsActive() )
+        {
+        iProperty.Subscribe( iStatus );
+        SetActive();
+        }
+    }
+
+
+// -----------------------------------------------------------------------------
+// CHtiPropertySubscriber::Unsubscribe
+// -----------------------------------------------------------------------------
+//
+void CHtiPropertySubscriber::Unsubscribe()
+    {
+    Cancel();
+    }
+
+
+// -----------------------------------------------------------------------------
+// CHtiPropertySubscriber::RunL
+// -----------------------------------------------------------------------------
+//
+void CHtiPropertySubscriber::RunL()
+    {
+    if ( iStatus.Int() == KErrNone )
+        {
+        iCallBack.CallBack();
+        Subscribe();
+        }
+    }
+
+
+// -----------------------------------------------------------------------------
+// CHtiPropertySubscriber::DoCancel
+// -----------------------------------------------------------------------------
+//
+void CHtiPropertySubscriber::DoCancel()
+    {
+    iProperty.Cancel();
+    }
+
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiServicePlugins/HtiSysInfoServicePlugin/src/HtiSysInfoServicePlugin.cpp	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,3207 @@
+/*
+* 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:  SysInfoPlugin implementation
+*
+*/
+
+
+// INCLUDE FILES
+#include "HtiSysInfoServicePlugin.h"
+#include "HtiLightsController.h"
+#include "HtiPropertySubscriber.h"
+#include <HtiDispatcherInterface.h>
+#include <HtiLogging.h>
+
+#if ( SYMBIAN_VERSION_SUPPORT < SYMBIAN_4 )
+#include <aknkeylock.h>
+#include <ScreensaverInternalPSKeys.h>
+#endif
+
+#include <AknSkinsInternalCRKeys.h>
+#include <AknsSkinUID.h>
+#include <AknsSrvClient.h>
+#include <AknFepInternalCRKeys.h>
+#include <AknFepGlobalEnums.h> //For chinese input modes
+#include <CommonEngineDomainCRKeys.h>
+#include <featmgr.h>
+#include <bautils.h>
+#include <btengsettings.h>
+#include <btengdomaincrkeys.h>
+#include <bt_subscribe.h>
+#include <btmanclient.h>
+#include <centralrepository.h>
+#include <CoreApplicationUIsSDKCRKeys.h>
+#include <DRMRightsClient.h>
+#include <e32property.h>
+#include <etel.h>
+#include <etelmm.h>
+#include <hal.h>
+#include <ir_sock.h>
+#include <mmtsy_names.h>
+#include <rmmcustomapi.h>
+#include <hwrmpowerstatesdkpskeys.h>
+#include <settingsinternalcrkeys.h>
+#include <sysutil.h>
+#include <tz.h>
+
+// CONSTANTS
+const static TUid KSysInfoServiceUid = { 0x10210CC7 };
+
+// from irinternalpskey.h
+const static TUid KPSUidIrdaActivation = { 0x2000276D };
+
+const TInt KTimeDataLength = 7;
+const TInt KMaxBtNameLength = 30;
+const TInt KDateTimeFormatCmdLength = 6;
+
+const TInt KFepChineseInputModeLength = 10;
+
+_LIT( KTempFilePath, "\\" );
+_LIT( KTempFileName, "HtiTempFile.tmp" );
+_LIT( KMatchFileName, "HtiTempFile.tmp*" );
+_LIT( KDateSeparatorChars, ".:/-" );
+_LIT( KTimeSeparatorChars, ".:" );
+
+_LIT8( KErrDescrArgument, "Invalid argument" );
+_LIT8( KErrDescrNotSupported, "Command not supported" );
+_LIT8( KErrDescrHAL, "Error retrieving HAL attribute" );
+_LIT8( KErrDescrAttOutOfRange, "HAL attribute argument is out of range" );
+_LIT8( KErrDescrFreeRAM, "Error retrieving the amount of free RAM" );
+_LIT8( KErrDescrTotalRAM, "Error retrieving the amount of total RAM" );
+_LIT8( KErrDescrAllocRAM, "Error allocating RAM" );
+_LIT8( KErrDescrInvalidRAM, "Requested free RAM larger than currently free" );
+_LIT8( KErrDescrVolInfo, "Error retrieving volume info" );
+_LIT8( KErrDescrNotEnoughSpace, "Not enough disk space" );
+_LIT8( KErrDescrCreateTempFile, "Error creating temp file" );
+_LIT8( KErrDescrSetSizeTempFile, "Error allocating size for temp file" );
+_LIT8( KErrDescrDeleteTempFile, "Error deleting temp file" );
+_LIT8( KErrDescrSysUtil, "SysUtil failed" );
+_LIT8( KErrDescrSetTime, "Setting time failed" );
+_LIT8( KErrDescrDateTimeFormat, "Setting date and time formats failed" );
+_LIT8( KErrDescrSetLanguage, "Setting language failed");
+_LIT8( KErrDescrGetNetworkModes, "Getting network modes failed" );
+_LIT8( KErrDescrSetNetworkMode, "Setting network mode failed" );
+_LIT8( KErrDescrIrActivation, "IR activation failed" );
+_LIT8( KErrDescrGetBtPower, "Getting BT power state failed" );
+_LIT8( KErrDescrSetBtPower, "Setting BT power state failed" );
+_LIT8( KErrDescrBtOnDenied, "Turning BT on not allowed (Offline mode)" );
+_LIT8( KErrDescrBtOffDenied, "Turning BT off not allowed (active connections)" );
+_LIT8( KErrDescrBtSettings, "Bluetooth settings failed" );
+_LIT8( KErrDescrBtDeletePairings, "Deleting Bluetooth pairing(s) failed" );
+#if ( SYMBIAN_VERSION_SUPPORT < SYMBIAN_4 )
+_LIT8( KErrDescrKeyLock, "Key lock toggle failed" );
+_LIT8( KErrDescrScreenSaver, "Setting screen saver state failed" );
+_LIT8( KErrDescrInvalidSSTimeout, "Invalid screen saver timeout value" );
+_LIT8( KErrDescrSSTimeoutFailed, "Setting screen saver timeout failed" );
+#endif
+_LIT8( KErrDescrInvalidTime, "Auto key guard time value too large (max 3600)" );
+_LIT8( KErrDescrAutoKeyGuardFailed, "Setting auto key guard time failed" );
+_LIT8( KErrDescrDrmDbConnect, "DRM DB connect failed." );
+_LIT8( KErrDescrDrmDbDelete,  "DRM DB delete failed." );
+_LIT8( KErrDescrBatteryLevel, "Getting battery level failed." );
+_LIT8( KErrDescrChargingStatus, "Getting charging status failed." );
+_LIT8( KErrDescrSignalStrength, "Getting signal strength failed." );
+_LIT8( KErrDescrMGUpdate, "Update Media Gallery failed" );
+_LIT8( KErrDescrActivateSkin, "Activating Skin failed" );
+
+enum TSysInfoCommand
+    {
+    ESysInfoHAL =             0x01,
+    ESysInfoIMEI=             0x02,
+    ESysInfoSWVersion =       0x03,
+    ESysInfoLangVersion =     0x04,
+    ESysInfoSWLangVersion =   0x05,
+    ESysInfoUserAgent =       0x06,
+    EFreeRAM =                0x07,
+    EUsedRAM =                0x08,
+    ETotalRAM =               0x09,
+    EEatRAM =                 0x0A,
+    EReleaseRAM =             0x0B,
+    EFreeDiskSpace =          0x0C,
+    EUsedDiskSpace =          0x0D,
+    ETotalDiskSize =          0x0E,
+    EEatDiskSpace =           0x0F,
+    EReleaseDiskSpace =       0x10,
+
+    ESysInfoSetHomeTime =     0x20,
+    ESysInfoGetHomeTime =     0x21,
+    ESetDateTimeFormat =      0x22,
+    
+    ESetLanguage =            0x25,
+
+    ELightStatus =            0x30,
+    ELightOn =                0x31,
+    ELightOff =               0x32,
+    ELightBlink =             0x33,
+    ELightRelease =           0x3A,
+
+    EScreenSaverDisable =     0x40,
+    EScreenSaverEnable  =     0x41,
+    EScreenSaverTimeout =     0x42,
+
+    ENetworkModeGet =         0x50,
+    ENetworkModeSet =         0x51,
+    ENetworkModeSetNoReboot = 0x52,
+    EHsdpaSet =               0x53,
+
+    EIrActivate =             0x5A,
+    EBtPower =                0x5B,
+    EBtSettings =             0x5C,
+    EBtDeletePairings =       0x5D,
+
+    EKeylockToggle =          0x60,
+    EAutoKeyGuardTime =       0x61,
+
+    EEmtpyDrmRightsDb =       0x65,
+
+    EBatteryStatus =          0x70,
+    ESignalStrength =         0x71,
+
+    EUpdateMediaGallery =     0x7A,
+
+    EActivateSkin =           0x80
+    };
+
+enum TGSNumberModes
+    {
+    EGSNbrModeLatin, EGSNbrModeArabic = 1, EGSNbrModeIndic = 1
+    };
+
+// Number mode type
+enum TGSNumberModeType
+    {
+    EGSNbrModeTypeArabic, EGSNbrModeTypeIndic, EGSNbrModeTypeEasternArabic
+    // for Urdu & Farsi languages
+    };
+
+//------------------------------------------------------------------------------
+// Create instance of concrete ECOM interface implementation
+//------------------------------------------------------------------------------
+CHtiSysInfoServicePlugin* CHtiSysInfoServicePlugin::NewL()
+    {
+    CHtiSysInfoServicePlugin* self = new (ELeave) CHtiSysInfoServicePlugin;
+    CleanupStack::PushL (self);
+    self->ConstructL();
+    CleanupStack::Pop();
+    return self;
+    }
+
+//------------------------------------------------------------------------------
+// Constructor
+//------------------------------------------------------------------------------
+CHtiSysInfoServicePlugin::CHtiSysInfoServicePlugin():
+    iMemEater( NULL ), iReply( NULL ), iGalleryUpdateSupported( ETrue )
+    {
+#if ( SYMBIAN_VERSION_SUPPORT < SYMBIAN_4 )
+        iAllowSSValue = -1;
+        iAllowSSPropertyAttached = EFalse;
+#endif
+    }
+
+//------------------------------------------------------------------------------
+// Destructor
+//------------------------------------------------------------------------------
+CHtiSysInfoServicePlugin::~CHtiSysInfoServicePlugin()
+    {
+    HTI_LOG_TEXT( "CHtiSysInfoServicePlugin destroy" );
+    delete iMemEater;
+    delete iReply;
+
+    CleanUpTempFiles();
+    delete iFileMan;
+    iFs.Close();
+    delete iLightsController;
+
+    if ( iAllowSSSubscriber )
+        {
+        iAllowSSSubscriber->Unsubscribe();
+        }
+#if ( SYMBIAN_VERSION_SUPPORT < SYMBIAN_4 )
+    iAllowSSProperty.Close();
+#endif 
+    delete iAllowSSSubscriber;
+    
+    FeatureManager::UnInitializeLib();
+    }
+
+//------------------------------------------------------------------------------
+// Second phase construction
+//------------------------------------------------------------------------------
+void CHtiSysInfoServicePlugin::ConstructL()
+    {
+    HTI_LOG_TEXT( "CHtiSysInfoServicePlugin::ConstructL" );
+    User::LeaveIfError( iFs.Connect() );
+    iFileMan = CFileMan::NewL( iFs );
+    
+    FeatureManager::InitializeLibL();
+    }
+
+//------------------------------------------------------------------------------
+// CHtiSysInfoServicePlugin::ProcessMessageL
+//------------------------------------------------------------------------------
+void CHtiSysInfoServicePlugin::ProcessMessageL(const TDesC8& aMessage,
+                                THtiMessagePriority /*aPriority*/)
+    {
+    HTI_LOG_FUNC_IN( "CHtiSysInfoServicePlugin::ProcessMessage" );
+    HTI_LOG_FORMAT( "Message length: %d", aMessage.Length() );
+
+    if ( aMessage.Length() > 0 )
+        {
+        HTI_LOG_FORMAT( "Command: %d", aMessage[0] );
+
+        switch ( aMessage[0] )
+            {
+            case ESysInfoHAL:
+                {
+                HTI_LOG_TEXT( "ESysInfoHAL" );
+                HandleGetHalAttrL( aMessage );
+                }
+                break;
+            case ESysInfoIMEI:
+                {
+                HTI_LOG_TEXT( "ESysInfoIMEI" );
+                HandleGetImeiL( aMessage );
+                }
+                break;
+            case ESysInfoSWVersion:
+                {
+                HTI_LOG_TEXT( "ESysInfoSWVersion" );
+                HandleGetSwVersionL( aMessage );
+                }
+                break;
+            case ESysInfoLangVersion:
+                {
+                HTI_LOG_TEXT( "ESysInfoLangVersion" );
+                HandleGetLangVersionL( aMessage );
+                }
+                break;
+            case ESysInfoSWLangVersion:
+                {
+                HTI_LOG_TEXT( "ESysInfoSWLangVersion" );
+                HandleGetSwLangVersionL( aMessage );
+                }
+                break;
+            case ESysInfoUserAgent:
+                {
+                HTI_LOG_TEXT( "ESysInfoUserAgent" );
+                HandleGetUserAgentStringL( aMessage );
+                }
+                break;
+            case EFreeRAM:
+                {
+                HTI_LOG_TEXT( "EFreeRAM" );
+                HandleGetFreeRamL( aMessage );
+                }
+                break;
+            case EUsedRAM:
+                {
+                HTI_LOG_TEXT( "EUsedRAM" );
+                HandleGetUsedRamL( aMessage );
+                }
+                break;
+            case ETotalRAM:
+                {
+                HTI_LOG_TEXT( "ETotalRAM" );
+                HandleGetTotalRamL( aMessage );
+                }
+                break;
+            case EEatRAM:
+                {
+                HTI_LOG_TEXT( "EEatRAM" );
+                HandleEatRamL( aMessage );
+                }
+                break;
+            case EReleaseRAM:
+                {
+                HTI_LOG_TEXT( "EReleaseRAM" );
+                HandleReleaseRamL( aMessage );
+                }
+                break;
+            case EFreeDiskSpace:
+                {
+                HTI_LOG_TEXT( "EFreeDiskSpace" );
+                HandleGetFreeDiskSpaceL( aMessage );
+                }
+                break;
+            case EUsedDiskSpace:
+                {
+                HTI_LOG_TEXT( "EUsedDiskSpace" );
+                HandleGetUsedDiskSpaceL( aMessage );
+                }
+                break;
+            case ETotalDiskSize:
+                {
+                HTI_LOG_TEXT( "ETotalDiskSize" );
+                HandleGetTotalDiskSpaceL( aMessage );
+                }
+                break;
+            case EEatDiskSpace:
+                {
+                HTI_LOG_TEXT( "EEatDiskSpace" );
+                HandleEatDiskSpaceL( aMessage );
+                }
+                break;
+            case EReleaseDiskSpace:
+                {
+                HTI_LOG_TEXT( "EReleaseDiskSpace" );
+                HandleReleaseDiskSpaceL( aMessage );
+                }
+                break;
+            case ESysInfoSetHomeTime:
+                {
+                HTI_LOG_TEXT( "ESysInfoSetHomeTime" );
+                HandleSetHomeTimeL( aMessage );
+                }
+                break;
+            case ESysInfoGetHomeTime:
+                {
+                HTI_LOG_TEXT( "ESysInfoGetHomeTime" );
+                HandleGetHomeTimeL( aMessage );
+                }
+                break;
+            case ESetDateTimeFormat:
+                {
+                HTI_LOG_TEXT( "ESetDateTimeFormat" );
+                HandleSetDateTimeFormatL( aMessage );
+                }
+                break;
+            case ESetLanguage:
+                {
+                HTI_LOG_TEXT("ESetLanguage");
+                HandleSetLanguageL( aMessage);
+                }
+                break;
+            case ELightStatus:
+            case ELightOn:
+            case ELightOff:
+            case ELightBlink:
+            case ELightRelease:
+                {
+                HTI_LOG_TEXT( "ELight*" );
+                HandleLightsCommandL( aMessage );
+                }
+                break;
+            case EScreenSaverDisable:
+            case EScreenSaverEnable:
+                {
+                HTI_LOG_TEXT( "EScreenSaver*" );
+                HandleScreenSaverCommandL( aMessage );
+                }
+                break;
+            case EScreenSaverTimeout:
+                {
+                HTI_LOG_TEXT( "EScreenSaverTimeout" );
+                HandleScreenSaverTimeoutCommandL( aMessage );
+                }
+                break;
+            case ENetworkModeSet:
+            case ENetworkModeSetNoReboot:
+            case ENetworkModeGet:
+                {
+                HTI_LOG_TEXT( "ENetworkMode*" );
+                HandleNetworkModeCommandL( aMessage );
+                }
+                break;
+            case EHsdpaSet:
+                {
+                HTI_LOG_TEXT( "EHsdpaSet" );
+                HandleHsdpaCommandL( aMessage );
+                }
+                break;
+            case EIrActivate:
+                {
+                HTI_LOG_TEXT( "EIrActivate" );
+                HandleIrActivateCommandL( aMessage );
+                }
+                break;
+            case EBtPower:
+                {
+                HTI_LOG_TEXT( "EBtPower" );
+                HandleBtPowerCommandL( aMessage );
+                }
+                break;
+            case EBtSettings:
+                {
+                HTI_LOG_TEXT( "EBtSettings" );
+                HandleBtSettingsCommandL( aMessage );
+                }
+                break;
+            case EBtDeletePairings:
+                {
+                HTI_LOG_TEXT( "EBtDeletePairings" );
+                HandleBtDeletePairingsL( aMessage );
+                }
+                break;
+            case EKeylockToggle:
+                {
+                HTI_LOG_TEXT( "EKeylockToggle" );
+                HandleKeyLockToggleL( aMessage );
+                }
+                break;
+            case EAutoKeyGuardTime:
+                {
+                HTI_LOG_TEXT( "EAutoKeyGuardTime" );
+                HandleAutoKeyGuardTimeL( aMessage );
+                }
+                break;
+            case EEmtpyDrmRightsDb:
+                {
+                HTI_LOG_TEXT( "EEmtpyDrmRightsDb" );
+                HandleEmptyDrmRightsDbL( aMessage );
+                }
+                break;
+            case EBatteryStatus:
+                {
+                HTI_LOG_TEXT( "EBatteryStatus" );
+                HandleBatteryStatusL( aMessage );
+                }
+                break;
+            case ESignalStrength:
+                {
+                HTI_LOG_TEXT( "ESignalStrength" );
+                HandleSignalStrengthL( aMessage );
+                }
+                break;
+            case EUpdateMediaGallery:
+                {
+                HTI_LOG_TEXT( "EUpdateMediaGallery" );
+                HandleUpdateMediaGalleryL( aMessage );
+                }
+                break;
+            case EActivateSkin:
+                {
+                HTI_LOG_TEXT( "EActivateSkin" );
+                HandleActivateSkinL( aMessage );
+                }
+                break;
+            default:
+                {
+                iDispatcher->DispatchOutgoingErrorMessage(
+                    KErrArgument,
+                    KErrDescrNotSupported,
+                    KSysInfoServiceUid );
+                }
+            }
+        }
+
+    else // aMessage.Length() > 0
+        {
+        iDispatcher->DispatchOutgoingErrorMessage(
+            KErrArgument,
+            KErrDescrArgument,
+            KSysInfoServiceUid);
+        }
+
+    if ( iReply )
+        {
+        TInt err = iDispatcher->DispatchOutgoingMessage( iReply,
+                                                         KSysInfoServiceUid );
+        if ( err == KErrNoMemory )
+            {
+            HTI_LOG_TEXT( "KErrNoMemory" );
+            iDispatcher->AddMemoryObserver( this );
+            }
+        else
+            {
+            iReply = NULL;
+            }
+        }
+
+    HTI_LOG_FUNC_OUT( "CHtiSysInfoServicePlugin::ProcessMessage" );
+    }
+
+//------------------------------------------------------------------------------
+// CHtiSysInfoServicePlugin::NotifyMemoryChange
+//------------------------------------------------------------------------------
+void CHtiSysInfoServicePlugin::NotifyMemoryChange( TInt aAvailableMemory )
+    {
+
+    if ( iReply )
+        {
+        if ( aAvailableMemory >= iReply->Size() )
+            {
+            TInt err = iDispatcher->DispatchOutgoingMessage(
+                iReply, KSysInfoServiceUid );
+
+            if ( err == KErrNone )
+                {
+                iReply = NULL;
+                iDispatcher->RemoveMemoryObserver( this );
+                }
+            else if ( err != KErrNoMemory ) //some other error
+                {
+                delete iReply;
+                iReply = NULL;
+                iDispatcher->RemoveMemoryObserver( this );
+                }
+            }
+        }
+    else
+        {
+        // some error, should not be called
+        iDispatcher->RemoveMemoryObserver( this );
+        }
+    }
+
+#if ( SYMBIAN_VERSION_SUPPORT < SYMBIAN_4 )
+//------------------------------------------------------------------------------
+// CHtiSysInfoServicePlugin::HandleAllowSSPropertyChange
+//------------------------------------------------------------------------------
+TInt CHtiSysInfoServicePlugin::HandleAllowSSPropertyChange( TAny* aPtr )
+    {
+    HTI_LOG_TEXT( "Allow SS property was changed" );
+    TInt newValue = -1;
+    TInt wantedValue =
+        STATIC_CAST( CHtiSysInfoServicePlugin*, aPtr )->iAllowSSValue;
+    RProperty::Get( KPSUidScreenSaver,
+                    KScreenSaverAllowScreenSaver, newValue );
+    HTI_LOG_FORMAT( "New value is %d", newValue );
+
+    TInt err = KErrNone;
+    if ( newValue == 0 && wantedValue == 1 )
+        {
+        HTI_LOG_TEXT( "Restoring the SS disabled value" );
+        err = RProperty::Set( KPSUidScreenSaver,
+                              KScreenSaverAllowScreenSaver, wantedValue );
+        }
+    return err;
+    }
+
+#endif
+/*
+ * Private helper methods
+ */
+
+//------------------------------------------------------------------------------
+// CHtiSysInfoServicePlugin::HandleGetHalAttrL
+//------------------------------------------------------------------------------
+void CHtiSysInfoServicePlugin::HandleGetHalAttrL( const TDesC8& aMessage )
+    {
+    // check the message length
+    if ( aMessage.Length() != 5 )
+        {
+        iDispatcher->DispatchOutgoingErrorMessage(
+            KErrArgument,
+            KErrDescrArgument,
+            KSysInfoServiceUid );
+        return;
+        }
+
+    TInt att =  aMessage[1] +
+              ( aMessage[2] << 8  ) +
+              ( aMessage[3] << 16 ) +
+              ( aMessage[4] << 24 );
+
+    // check that requested HAL attribute is valid
+    if ( att < 0 || att >= HALData::ENumHalAttributes )
+        {
+        iDispatcher->DispatchOutgoingErrorMessage(
+            KErrArgument,
+            KErrDescrAttOutOfRange,
+            KSysInfoServiceUid);
+        return;
+        }
+
+    // get the HAL attribute
+    TInt result;
+    TInt err = HAL::Get( ( HALData::TAttribute ) att, result );
+    if ( err )
+        {
+        iDispatcher->DispatchOutgoingErrorMessage(
+            err,
+            KErrDescrHAL,
+            KSysInfoServiceUid );
+        }
+    else
+        {
+        iReply = HBufC8::NewL( 4 );
+        iReply->Des().Append( ( TUint8* )( &result ), 4 );
+        }
+    }
+
+//------------------------------------------------------------------------------
+// CHtiSysInfoServicePlugin::HandleGetImeiL
+//------------------------------------------------------------------------------
+void CHtiSysInfoServicePlugin::HandleGetImeiL( const TDesC8& aMessage )
+    {
+    HTI_LOG_FUNC_IN( "CHtiSysInfoServicePlugin::HandleGetImeiL" );
+
+    if ( aMessage.Length() != 1 )
+        {
+        iDispatcher->DispatchOutgoingErrorMessage( KErrArgument,
+            KErrDescrArgument, KSysInfoServiceUid );
+        return;
+        }
+
+#if !defined (__WINS__) // no IMEI in emulator
+    RTelServer server;
+    User::LeaveIfError( server.Connect() );
+    CleanupClosePushL( server );
+    User::LeaveIfError( server.LoadPhoneModule( KMmTsyModuleName ) );
+
+    RTelServer::TPhoneInfo info;
+    TInt ret = KErrNotSupported;
+    TInt count;
+
+    RMobilePhone mobilePhone;
+
+    User::LeaveIfError( server.EnumeratePhones( count ) );
+
+    for ( TInt i = 0; i < count; i++ )
+        {
+        ret = server.GetPhoneInfo( i, info );
+        if ( ret == KErrNone )
+            {
+            User::LeaveIfError( mobilePhone.Open( server, info.iName ) );
+            CleanupClosePushL( mobilePhone );
+            break;
+            }
+        }
+
+    TRequestStatus status;
+    RMobilePhone::TMobilePhoneIdentityV1 identity;
+
+    mobilePhone.GetPhoneId( status, identity );
+    User::WaitForRequest( status );
+
+    CleanupStack::PopAndDestroy(); // mobilePhone
+
+    server.UnloadPhoneModule( KMmTsyModuleName );
+    CleanupStack::PopAndDestroy(); // server
+
+    iReply = HBufC8::NewL( identity.iSerialNumber.Length() );
+    iReply->Des().Copy( identity.iSerialNumber );
+
+#else // __WINS__
+    // no IMEI in emulator
+    iDispatcher->DispatchOutgoingErrorMessage( KErrNotSupported,
+        KErrDescrNotSupported, KSysInfoServiceUid );
+#endif // __WINS__
+    HTI_LOG_FUNC_OUT( "CHtiSysInfoServicePlugin::HandleGetImeiL" );
+    }
+
+//------------------------------------------------------------------------------
+// CHtiSysInfoServicePlugin::HandleGetSwVersionL
+//------------------------------------------------------------------------------
+void CHtiSysInfoServicePlugin::HandleGetSwVersionL( const TDesC8& aMessage )
+    {
+    if ( aMessage.Length() != 1 )
+        {
+        iDispatcher->DispatchOutgoingErrorMessage(
+            KErrArgument,
+            KErrDescrArgument,
+            KSysInfoServiceUid);
+        return;
+        }
+
+    TBuf<KSysUtilVersionTextLength> reply16;
+    TInt err = SysUtil::GetSWVersion( reply16 );
+    if ( err )
+        {
+        iDispatcher->DispatchOutgoingErrorMessage(
+            err,
+            KErrDescrSysUtil,
+            KSysInfoServiceUid );
+        }
+    else
+        {
+        iReply = HBufC8::NewL( reply16.Size() );
+        iReply->Des().Append( ( TUint8* )reply16.Ptr(), reply16.Size() );
+        }
+    }
+
+//------------------------------------------------------------------------------
+// CHtiSysInfoServicePlugin::HandleGetLangVersionL
+//------------------------------------------------------------------------------
+void CHtiSysInfoServicePlugin::HandleGetLangVersionL( const TDesC8& aMessage )
+    {
+    if ( aMessage.Length() != 1 )
+        {
+        iDispatcher->DispatchOutgoingErrorMessage(
+            KErrArgument,
+            KErrDescrArgument,
+            KSysInfoServiceUid );
+        return;
+        }
+
+    TBuf<KSysUtilVersionTextLength> reply16;
+    TInt err = SysUtil::GetLangVersion( reply16 );
+    if ( err )
+        {
+        iDispatcher->DispatchOutgoingErrorMessage(
+            err,
+            KErrDescrSysUtil,
+            KSysInfoServiceUid );
+        }
+    else
+        {
+        iReply = HBufC8::NewL( reply16.Size() );
+        iReply->Des().Append( ( TUint8* )reply16.Ptr(), reply16.Size() );
+        }
+    }
+
+//------------------------------------------------------------------------------
+// CHtiSysInfoServicePlugin::HandleGetSwLangVersionL
+//------------------------------------------------------------------------------
+void CHtiSysInfoServicePlugin::HandleGetSwLangVersionL( const TDesC8& aMessage )
+    {
+    if ( aMessage.Length() != 1 )
+        {
+        iDispatcher->DispatchOutgoingErrorMessage(
+            KErrArgument,
+            KErrDescrArgument,
+            KSysInfoServiceUid);
+        return;
+        }
+
+    TBuf<KSysUtilVersionTextLength> reply16;
+    TInt err = SysUtil::GetLangSWVersion( reply16 );
+    if ( err )
+        {
+        iDispatcher->DispatchOutgoingErrorMessage(
+            err,
+            KErrDescrSysUtil,
+            KSysInfoServiceUid );
+        }
+    else
+        {
+        iReply = HBufC8::NewL( reply16.Size() );
+        iReply->Des().Append( ( TUint8* )reply16.Ptr(), reply16.Size() );
+        }
+    }
+
+//------------------------------------------------------------------------------
+// CHtiSysInfoServicePlugin::HandleGetUserAgentStringL
+//------------------------------------------------------------------------------
+void CHtiSysInfoServicePlugin::HandleGetUserAgentStringL(
+        const TDesC8& aMessage )
+    {
+    aMessage.Length(); // get rid of compiler warning
+    iDispatcher->DispatchOutgoingErrorMessage(
+        KErrNotSupported,
+        KErrDescrNotSupported,
+        KSysInfoServiceUid);
+    }
+
+//------------------------------------------------------------------------------
+// CHtiSysInfoServicePlugin::HandleGetFreeRamL
+//------------------------------------------------------------------------------
+void CHtiSysInfoServicePlugin::HandleGetFreeRamL( const TDesC8& aMessage )
+    {
+    if ( aMessage.Length() != 1 )
+        {
+        iDispatcher->DispatchOutgoingErrorMessage(
+            KErrArgument,
+            KErrDescrArgument,
+            KSysInfoServiceUid );
+        return;
+        }
+
+    User::CompressAllHeaps();
+    TInt result;
+    TInt err = HAL::Get( HALData::EMemoryRAMFree, result );
+    if ( err )
+        {
+        iDispatcher->DispatchOutgoingErrorMessage(
+            err,
+            KErrDescrFreeRAM,
+            KSysInfoServiceUid );
+        }
+    else
+        {
+        iReply = HBufC8::NewL( 4 );
+        iReply->Des().Append( ( TUint8* )( &result ), 4 );
+        }
+    }
+
+//------------------------------------------------------------------------------
+// CHtiSysInfoServicePlugin::HandleGetUsedRamL
+//------------------------------------------------------------------------------
+void CHtiSysInfoServicePlugin::HandleGetUsedRamL( const TDesC8& aMessage )
+    {
+    if ( aMessage.Length() != 1 )
+        {
+        iDispatcher->DispatchOutgoingErrorMessage(
+            KErrArgument,
+            KErrDescrArgument,
+            KSysInfoServiceUid);
+        return;
+        }
+
+    User::CompressAllHeaps();
+
+    TInt totalRam;
+    TInt freeRam;
+    TInt usedRam;
+
+    // first get the total RAM...
+    TInt err = HAL::Get( HALData::EMemoryRAM, totalRam );
+    if ( err != KErrNone )
+        {
+        iDispatcher->DispatchOutgoingErrorMessage(
+            err,
+            KErrDescrTotalRAM,
+            KSysInfoServiceUid );
+        return;
+        }
+
+    // ...then get the free RAM
+    err = HAL::Get( HALData::EMemoryRAMFree, freeRam );
+    if ( err )
+        {
+        iDispatcher->DispatchOutgoingErrorMessage(
+            err,
+            KErrDescrFreeRAM,
+            KSysInfoServiceUid );
+        return;
+        }
+
+    // calculate used RAM from total and free RAM
+    usedRam = totalRam - freeRam;
+    iReply = HBufC8::NewL( 4 );
+    iReply->Des().Append( ( TUint8* )( &usedRam ), 4 );
+    }
+
+//------------------------------------------------------------------------------
+// CHtiSysInfoServicePlugin::HandleGetTotalRamL
+//------------------------------------------------------------------------------
+void CHtiSysInfoServicePlugin::HandleGetTotalRamL( const TDesC8& aMessage )
+    {
+    if ( aMessage.Length() != 1 )
+        {
+        iDispatcher->DispatchOutgoingErrorMessage(
+            KErrArgument,
+            KErrDescrArgument,
+            KSysInfoServiceUid);
+        return;
+        }
+
+    User::CompressAllHeaps();
+
+    TInt result;
+    TInt err = HAL::Get( HALData::EMemoryRAM, result );
+    if ( err )
+        {
+        iDispatcher->DispatchOutgoingErrorMessage(
+            err,
+            KErrDescrTotalRAM,
+            KSysInfoServiceUid );
+        }
+    else
+        {
+        iReply = HBufC8::NewL( 4 );
+        iReply->Des().Append( ( TUint8* )( &result ), 4 );
+        }
+    }
+
+//------------------------------------------------------------------------------
+// CHtiSysInfoServicePlugin::HandleEatRamL
+//------------------------------------------------------------------------------
+void CHtiSysInfoServicePlugin::HandleEatRamL( const TDesC8& aMessage )
+    {
+    if ( aMessage.Length() != 5 )
+        {
+        iDispatcher->DispatchOutgoingErrorMessage(
+            KErrArgument,
+            KErrDescrArgument,
+            KSysInfoServiceUid );
+        return;
+        }
+
+    // get the amount of memory to be left free from the message
+    TInt memLeftFree =  aMessage[1] +
+                      ( aMessage[2] << 8  ) +
+                      ( aMessage[3] << 16 ) +
+                      ( aMessage[4] << 24 );
+
+    // if there's a previous memory eater, delete it
+    if ( iMemEater != NULL )
+        {
+        delete iMemEater;
+        iMemEater = NULL;
+        }
+
+    User::CompressAllHeaps();
+
+    // get the current free memory
+    TInt memFree;
+    TInt err = HAL::Get( HALData::EMemoryRAMFree, memFree );
+    if ( err )
+        {
+        iDispatcher->DispatchOutgoingErrorMessage(
+            err,
+            KErrDescrFreeRAM,
+            KSysInfoServiceUid );
+        return;
+        }
+
+    // try to eat the memory
+    TInt memToBeEaten = memFree - memLeftFree;
+
+    if ( memToBeEaten < 0 )
+        {
+        iDispatcher->DispatchOutgoingErrorMessage(
+                KErrUnderflow,
+                KErrDescrInvalidRAM,
+                KSysInfoServiceUid );
+        return;
+        }
+
+    TRAP( err, iMemEater = HBufC8::NewL( memToBeEaten ) );
+    if ( err )
+        {
+        iDispatcher->DispatchOutgoingErrorMessage(
+            err,
+            KErrDescrAllocRAM,
+            KSysInfoServiceUid );
+        return;
+        }
+
+    // get the amount of memory left
+    err = HAL::Get( HALData::EMemoryRAMFree, memFree );
+    if ( err )
+        {
+        iDispatcher->DispatchOutgoingErrorMessage(
+            err,
+            KErrDescrFreeRAM,
+            KSysInfoServiceUid );
+        return;
+        }
+
+    // send the amount of memory back
+    iReply = HBufC8::NewL( 4 );
+    iReply->Des().Append( ( TUint8* )( &memFree ), 4 );
+    }
+
+//------------------------------------------------------------------------------
+// CHtiSysInfoServicePlugin::HandleReleaseRamL
+//------------------------------------------------------------------------------
+void CHtiSysInfoServicePlugin::HandleReleaseRamL( const TDesC8& aMessage )
+    {
+    if ( aMessage.Length() != 1 )
+        {
+        iDispatcher->DispatchOutgoingErrorMessage(
+            KErrArgument,
+            KErrDescrArgument,
+            KSysInfoServiceUid );
+        return;
+        }
+
+    // if there's a memory eater, delete it
+    if ( iMemEater != NULL )
+        {
+        delete iMemEater;
+        iMemEater = NULL;
+        }
+
+    User::CompressAllHeaps();
+
+    // query the amount of memory and send it back
+    TInt memFree;
+    TInt err = HAL::Get( HALData::EMemoryRAMFree, memFree );
+    if ( err )
+        {
+        iDispatcher->DispatchOutgoingErrorMessage(
+            err,
+            KErrDescrHAL,
+            KSysInfoServiceUid );
+        }
+    else
+        {
+        iReply = HBufC8::NewL( 4 );
+        iReply->Des().Append( ( TUint8* )( &memFree ), 4 );
+        }
+    }
+
+//------------------------------------------------------------------------------
+// CHtiSysInfoServicePlugin::HandleGetFreeDiskSpaceL
+//------------------------------------------------------------------------------
+void CHtiSysInfoServicePlugin::HandleGetFreeDiskSpaceL( const TDesC8& aMessage )
+    {
+    if ( aMessage.Length() != 2 )
+        {
+        iDispatcher->DispatchOutgoingErrorMessage(
+            KErrArgument,
+            KErrDescrArgument,
+            KSysInfoServiceUid);
+        return;
+        }
+
+    TInt drive;
+    RFs::CharToDrive( TChar( aMessage[1] ), drive );
+    TVolumeInfo volInfo;
+    TInt err = iFs.Volume( volInfo, drive );
+
+    if ( err )
+        {
+        iDispatcher->DispatchOutgoingErrorMessage(
+            err,
+            KErrDescrVolInfo,
+            KSysInfoServiceUid );
+        }
+    else
+        {
+        iReply = HBufC8::NewL( 8 );
+        iReply->Des().Append( ( TUint8* )( &volInfo.iFree ), 8 );
+        }
+    }
+
+//------------------------------------------------------------------------------
+// CHtiSysInfoServicePlugin::HandleGetUsedDiskSpaceL
+//------------------------------------------------------------------------------
+void CHtiSysInfoServicePlugin::HandleGetUsedDiskSpaceL( const TDesC8& aMessage )
+    {
+    if ( aMessage.Length() != 2 )
+        {
+        iDispatcher->DispatchOutgoingErrorMessage(
+            KErrArgument,
+            KErrDescrArgument,
+            KSysInfoServiceUid);
+        return;
+        }
+
+    TInt drive;
+    RFs::CharToDrive( TChar( aMessage[1] ), drive );
+    TVolumeInfo volInfo;
+    TInt err = iFs.Volume( volInfo, drive );
+
+    if ( err )
+        {
+        iDispatcher->DispatchOutgoingErrorMessage(
+            err,
+            KErrDescrVolInfo,
+            KSysInfoServiceUid );
+        }
+    else
+        {
+        TInt64 used = volInfo.iSize - volInfo.iFree;
+        iReply = HBufC8::NewL( 8 );
+        iReply->Des().Append( ( TUint8* )( &used ), 8 );
+        }
+    }
+
+//------------------------------------------------------------------------------
+// CHtiSysInfoServicePlugin::HandleGetTotalDiskSpaceL
+//------------------------------------------------------------------------------
+void CHtiSysInfoServicePlugin::HandleGetTotalDiskSpaceL(
+        const TDesC8& aMessage )
+    {
+    if ( aMessage.Length() != 2 )
+        {
+        iDispatcher->DispatchOutgoingErrorMessage(
+            KErrArgument,
+            KErrDescrArgument,
+            KSysInfoServiceUid);
+        return;
+        }
+
+    TInt drive;
+    RFs::CharToDrive( TChar( aMessage[1] ), drive );
+    TVolumeInfo volInfo;
+    TInt err = iFs.Volume( volInfo, drive );
+
+    if ( err )
+        {
+        iDispatcher->DispatchOutgoingErrorMessage(
+            err,
+            KErrDescrVolInfo,
+            KSysInfoServiceUid );
+        }
+    else
+        {
+        iReply = HBufC8::NewL( 8 );
+        iReply->Des().Append( ( TUint8* )( &volInfo.iSize ), 8 );
+        }
+    }
+
+//------------------------------------------------------------------------------
+// CHtiSysInfoServicePlugin::HandleEatDiskSpaceL
+//------------------------------------------------------------------------------
+void CHtiSysInfoServicePlugin::HandleEatDiskSpaceL( const TDesC8& aMessage )
+    {
+    HTI_LOG_FUNC_IN( "CHtiSysInfoServicePlugin::HandleEatDiskSpaceL" );
+    
+    if ( aMessage.Length() != 10 )
+        {
+        iDispatcher->DispatchOutgoingErrorMessage(
+            KErrArgument,
+            KErrDescrArgument,
+            KSysInfoServiceUid );
+        HTI_LOG_FUNC_OUT( "CHtiSysInfoServicePlugin::HandleEatDiskSpaceL" );
+        return;
+        }
+
+    TFileName commonpath;
+    commonpath.Append( aMessage[1] );
+    commonpath.Append( _L( ":" ) );
+    commonpath.Append( KTempFilePath );
+    commonpath.Append( KTempFileName );
+    TFileName path;
+        
+    // get free disk space
+    TInt drive;
+    RFs::CharToDrive( TChar( aMessage[1] ), drive );
+    TVolumeInfo volInfo;
+    TInt err = iFs.Volume( volInfo, drive );
+    if ( err )
+        {
+        iDispatcher->DispatchOutgoingErrorMessage(
+            err,
+            KErrDescrVolInfo,
+            KSysInfoServiceUid );
+        HTI_LOG_FUNC_OUT( "CHtiSysInfoServicePlugin::HandleEatDiskSpaceL" );
+        return;
+        }
+
+    // calculate how much we must eat the disk space
+    TInt64 temp1 = aMessage[2] +
+                 ( aMessage[3] << 8  ) +
+                 ( aMessage[4] << 16 ) +
+                 ( aMessage[5] << 24 );
+    TInt64 temp2 = aMessage[6] +
+                 ( aMessage[7] << 8  ) +
+                 ( aMessage[8] << 16 ) +
+                 ( aMessage[9] << 24 );
+
+    TInt64 spaceLeftFree = temp1 + ( temp2 << 32) ;
+    TInt64 spaceToEat = volInfo.iFree - spaceLeftFree;
+
+    HTI_LOG_FORMAT( "Disk space to eat: %Ld", spaceToEat );
+
+    // check that there is enough free disk space
+    if ( spaceToEat < 0 )
+        {
+        iDispatcher->DispatchOutgoingErrorMessage(
+            KErrDiskFull,
+            KErrDescrNotEnoughSpace,
+            KSysInfoServiceUid );
+        HTI_LOG_FUNC_OUT( "CHtiSysInfoServicePlugin::HandleEatDiskSpaceL" );
+        return;
+        }
+
+    // check if scaceToEat is greater than KMaxTInt
+    //  --> it must be eaten in several chunks
+    //  --> not yet supported.
+
+    TInt64 size;
+    for(TInt i=1;  spaceToEat>0; i++)
+        {
+        path.Zero();
+        path.Copy(commonpath);
+        path.AppendNum(i);
+        if ( BaflUtils::FileExists( iFs, path ) )
+            {
+            continue;
+            }
+        
+        if(spaceToEat > KMaxTInt)  
+            size=KMaxTInt;
+        else
+            size=spaceToEat;
+        
+        err = CreatFileToEatDiskSpace(path, size);
+        if(err)
+            { 
+            HTI_LOG_FUNC_OUT( "CHtiSysInfoServicePlugin::HandleEatDiskSpaceL CreateFile Fail" );
+            return;  
+            }        
+        
+        iFs.Volume( volInfo, drive );
+        HTI_LOG_FORMAT( "current free space: %Ld", volInfo.iFree );
+        spaceToEat = volInfo.iFree - spaceLeftFree;           
+        }
+
+    // all ok, send the remaining disk size back
+    iReply = HBufC8::NewL( 8 );
+    iReply->Des().Append( ( TUint8* )( &volInfo.iFree ), 8 );
+    HTI_LOG_FUNC_OUT( "CHtiSysInfoServicePlugin::HandleEatDiskSpaceL" );
+    }
+
+TInt CHtiSysInfoServicePlugin::CreatFileToEatDiskSpace( TFileName aPath, TInt64 aSpaceToEat  )
+    {
+    HTI_LOG_FUNC_IN( "CHtiSysInfoServicePlugin::CreatFileToEatDiskSpace" );
+    
+    HTI_LOG_FORMAT( "Create file: %S", &aPath );
+    HTI_LOG_FORMAT( "file size %Ld", aSpaceToEat );
+    
+    // create a temp file
+    RFile diskEater;
+    TInt err = diskEater.Replace( iFs, aPath, EFileWrite );
+    if ( err )
+        {
+        iDispatcher->DispatchOutgoingErrorMessage(
+            err,
+            KErrDescrCreateTempFile,
+            KSysInfoServiceUid );
+        HTI_LOG_FUNC_OUT( "CHtiSysInfoServicePlugin::CreatFileToEatDiskSpace Replace error" );
+        return err;
+        }
+    
+    // set the size for temp file
+    err = diskEater.SetSize( I64LOW( aSpaceToEat ) );
+    if ( err )
+        {
+        iDispatcher->DispatchOutgoingErrorMessage(
+            err,
+            KErrDescrSetSizeTempFile,
+            KSysInfoServiceUid );
+        diskEater.Close();
+        HTI_LOG_FUNC_OUT( "CHtiSysInfoServicePlugin::CreatFileToEatDiskSpace SetSize error" );
+        return err;
+        }
+    diskEater.Close();
+    HTI_LOG_FUNC_OUT( "CHtiSysInfoServicePlugin::CreatFileToEatDiskSpace" );
+    return 0;
+    }
+
+//------------------------------------------------------------------------------
+// CHtiSysInfoServicePlugin::HandleReleaseDiskSpaceL
+//------------------------------------------------------------------------------
+void CHtiSysInfoServicePlugin::HandleReleaseDiskSpaceL( const TDesC8& aMessage )
+    {
+    HTI_LOG_FUNC_IN( "CHtiSysInfoServicePlugin::HandleReleaseDiskSpaceL" );
+    if ( aMessage.Length() != 2 )
+        {
+        iDispatcher->DispatchOutgoingErrorMessage(
+            KErrArgument,
+            KErrDescrArgument,
+            KSysInfoServiceUid);
+        HTI_LOG_FUNC_OUT( "CHtiSysInfoServicePlugin::HandleReleaseDiskSpaceL" );
+        return;
+        }
+
+    TFileName path;
+    path.Append( aMessage[1] );
+    path.Append( _L( ":" ) );
+    path.Append(KTempFilePath);
+    path.Append(KMatchFileName);
+    TInt err = iFileMan->Delete(path);
+    if ( err )
+        {
+        iDispatcher->DispatchOutgoingErrorMessage(
+                err,
+                KErrDescrDeleteTempFile,
+                KSysInfoServiceUid );
+        HTI_LOG_FUNC_OUT( "CHtiSysInfoServicePlugin::HandleReleaseDiskSpaceL" );
+        return;
+        } 
+    
+    // query the free disk space
+    TInt drive;
+    RFs::CharToDrive( TChar( aMessage[1] ), drive );
+    TVolumeInfo volInfo;
+    err = iFs.Volume( volInfo, drive );
+    if ( err )
+        {
+        iDispatcher->DispatchOutgoingErrorMessage(
+            err,
+            KErrDescrVolInfo,
+            KSysInfoServiceUid );
+        HTI_LOG_FUNC_OUT( "CHtiSysInfoServicePlugin::HandleReleaseDiskSpaceL" );
+        return;
+        }
+
+    // all ok, send the free disk space back
+    iReply = HBufC8::NewL( 8 );
+    iReply->Des().Append( ( TUint8* )( &volInfo.iFree ), 8 );
+
+    HTI_LOG_FUNC_OUT( "CHtiSysInfoServicePlugin::HandleReleaseDiskSpaceL" );
+    }
+
+//------------------------------------------------------------------------------
+// CHtiSysInfoServicePlugin::HandleSetHomeTimeL
+//------------------------------------------------------------------------------
+void CHtiSysInfoServicePlugin::HandleSetHomeTimeL( const TDesC8& aMessage )
+    {
+    TTime time;
+    TRAPD( err, ParseTimeDataL( aMessage.Mid( 1 ), time ) );
+    if ( err )
+        {
+        iDispatcher->DispatchOutgoingErrorMessage( err,
+                               KErrDescrArgument,
+                               KSysInfoServiceUid);
+        return;
+        }
+
+    // User::SetHomeTime() does not work correctly with daylight saving time
+    // in S60 3.0 - have to use time zone server instead.
+    RTz tzServer;
+    err = tzServer.Connect();
+    if ( err == KErrNone )
+        {
+        err = tzServer.SetHomeTime( time );
+        }
+    tzServer.Close();
+
+    if ( err )
+        {
+        iDispatcher->DispatchOutgoingErrorMessage( err,
+                               KErrDescrSetTime,
+                               KSysInfoServiceUid);
+        return;
+        }
+
+    iReply = HBufC8::NewL( 1 );
+    iReply->Des().Append( 0 );
+    }
+
+//------------------------------------------------------------------------------
+// CHtiSysInfoServicePlugin::HandleGetHomeTimeL
+//------------------------------------------------------------------------------
+void CHtiSysInfoServicePlugin::HandleGetHomeTimeL( const TDesC8& aMessage )
+    {
+    if ( aMessage.Length() != 1 )
+        {
+        iDispatcher->DispatchOutgoingErrorMessage(
+            KErrArgument,
+            KErrDescrArgument,
+            KSysInfoServiceUid );
+
+        return;
+        }
+
+    TTime time;
+    time.HomeTime();
+    TDateTime dateTime = time.DateTime();
+    TUint year = dateTime.Year();
+    iReply = HBufC8::NewL( KTimeDataLength );
+    iReply->Des().Append( (TUint8*)(&year), 2 );
+    iReply->Des().Append( dateTime.Month() + 1 );
+    iReply->Des().Append( dateTime.Day() + 1 );
+    iReply->Des().Append( dateTime.Hour() );
+    iReply->Des().Append( dateTime.Minute() );
+    iReply->Des().Append( dateTime.Second() );
+    }
+
+
+//------------------------------------------------------------------------------
+// CHtiSysInfoServicePlugin::HandleSetDateTimeFormatL
+//------------------------------------------------------------------------------
+void CHtiSysInfoServicePlugin::HandleSetDateTimeFormatL( const TDesC8& aMessage )
+    {
+    HTI_LOG_FUNC_IN( "CHtiSysInfoServicePlugin::HandleSetDateTimeFormatL" );
+
+    if ( aMessage.Length() != KDateTimeFormatCmdLength )
+        {
+        iDispatcher->DispatchOutgoingErrorMessage( KErrArgument,
+            KErrDescrArgument, KSysInfoServiceUid );
+        return;
+        }
+
+    // Parse values from message
+    TDateFormat dateFormat = STATIC_CAST( TDateFormat, aMessage[1] );
+    TChar dateSepar = aMessage[2];
+    TTimeFormat timeFormat = STATIC_CAST( TTimeFormat, aMessage[3] );
+    TChar timeSepar = aMessage[4];
+    TClockFormat clockFormat = STATIC_CAST( TClockFormat, aMessage[5] );
+
+    HTI_LOG_FORMAT( "Date format   : %d", dateFormat );
+    HTI_LOG_FORMAT( "Date separator: %c", aMessage[2] );
+    HTI_LOG_FORMAT( "Time format   : %d", timeFormat );
+    HTI_LOG_FORMAT( "Time separator: %c", aMessage[4] );
+    HTI_LOG_FORMAT( "Clock format  : %d", clockFormat );
+
+    // Check validity of values
+    if ( dateFormat < EDateAmerican || dateFormat > EDateJapanese ||
+         timeFormat < ETime12 || timeFormat > ETime24 ||
+         clockFormat < EClockAnalog || clockFormat > EClockDigital ||
+         KDateSeparatorChars().Locate( dateSepar ) == KErrNotFound ||
+         KTimeSeparatorChars().Locate( timeSepar ) == KErrNotFound )
+        {
+        iDispatcher->DispatchOutgoingErrorMessage( KErrArgument,
+            KErrDescrArgument, KSysInfoServiceUid );
+        return;
+        }
+
+    // Set the values
+    TLocale locale;
+    locale.SetDateFormat( dateFormat );
+    locale.SetDateSeparator( dateSepar, 1 );
+    locale.SetDateSeparator( dateSepar, 2 );
+    locale.SetTimeFormat( timeFormat );
+    locale.SetTimeSeparator( timeSepar, 1 );
+    locale.SetTimeSeparator( timeSepar, 2 );
+    locale.SetClockFormat( clockFormat );
+    TInt err = locale.Set();
+
+    if ( err != KErrNone )
+        {
+        iDispatcher->DispatchOutgoingErrorMessage( err,
+            KErrDescrDateTimeFormat, KSysInfoServiceUid );
+        }
+    else
+        {
+        iReply = HBufC8::NewL( 1 );
+        iReply->Des().Append( 0 );
+        }
+
+    HTI_LOG_FUNC_OUT( "CHtiSysInfoServicePlugin::HandleSetDateTimeFormatL" );
+    }
+
+
+//------------------------------------------------------------------------------
+// CHtiSysInfoServicePlugin::HandleLightsCommandL
+//------------------------------------------------------------------------------
+void CHtiSysInfoServicePlugin::HandleLightsCommandL( const TDesC8& aMessage )
+    {
+    if ( aMessage[0] == ELightRelease )
+        {
+        if ( aMessage.Length() != 1 )
+            {
+            iDispatcher->DispatchOutgoingErrorMessage(
+                KErrArgument,
+                KErrDescrArgument,
+                KSysInfoServiceUid);
+            }
+
+        else
+            {
+            HTI_LOG_TEXT( "ELightRelease" );
+            delete iLightsController;
+            iLightsController = NULL;
+            iReply = HBufC8::NewL( 1 );
+            iReply->Des().Append( 0 );
+            }
+        }
+
+    else
+        {
+        if ( !iLightsController )
+            {
+            HTI_LOG_TEXT( "Creating lights controller" );
+            iLightsController = CHtiLightsController::NewL(
+                                    iDispatcher );
+            }
+        TBuf8<4> reply;
+        iLightsController->ProcessMessageL( aMessage, reply );
+        if ( reply.Length() > 0 )
+            {
+            iReply = HBufC8::NewL( reply.Length() );
+            iReply->Des().Copy( reply );
+            }
+        }
+    }
+
+//------------------------------------------------------------------------------
+// CHtiSysInfoServicePlugin::HandleScreenSaverCommandL
+//------------------------------------------------------------------------------
+void CHtiSysInfoServicePlugin::HandleScreenSaverCommandL(
+                                    const TDesC8& aMessage )
+    {
+    HTI_LOG_FUNC_IN(
+            "CHtiSysInfoServicePlugin::HandleScreenSaverCommandL" );
+#if ( SYMBIAN_VERSION_SUPPORT < SYMBIAN_4 ) 
+    if ( aMessage.Length() != 1 )
+        {
+        iDispatcher->DispatchOutgoingErrorMessage(
+            KErrArgument,
+            KErrDescrArgument,
+            KSysInfoServiceUid);
+        return;
+        }
+
+    if ( aMessage[0] == EScreenSaverDisable ) iAllowSSValue = 1;
+    else if ( aMessage[0] == EScreenSaverEnable ) iAllowSSValue = 0;
+    else User::Leave( KErrArgument );
+
+    HTI_LOG_FORMAT( "Setting allow screen saver state %d", iAllowSSValue );
+
+    TInt err = KErrNone;
+
+    if ( !iAllowSSPropertyAttached )
+        {
+        HTI_LOG_TEXT( "Attaching to KScreenSaverAllowScreenSaver property" );
+        err = iAllowSSProperty.Attach(
+                KPSUidScreenSaver, KScreenSaverAllowScreenSaver );
+
+        if ( err )
+            {
+            iDispatcher->DispatchOutgoingErrorMessage(
+                err, KErrDescrScreenSaver, KSysInfoServiceUid );
+            return;
+            }
+
+        iAllowSSPropertyAttached = ETrue;
+        }
+
+    if ( iAllowSSValue == 1 )
+        {
+        iAllowSSProperty.Set( iAllowSSValue ); // ignore error
+        // Screen saver disabled. We want to keep it disabled, so
+        // subscribe to the property to get notified about changes in it.
+        if ( !iAllowSSSubscriber )
+            {
+            iAllowSSSubscriber = new (ELeave) CHtiPropertySubscriber(
+                TCallBack( HandleAllowSSPropertyChange, this ),
+                iAllowSSProperty );
+            iAllowSSSubscriber->Subscribe();
+            }
+        }
+
+    else  // iAllowSSValue == 0
+        {
+        // Enabling screen saver. Cancel possible subscription so
+        // other applications can control the property.
+        if ( iAllowSSSubscriber )
+            {
+            iAllowSSSubscriber->Unsubscribe();
+            }
+        iAllowSSProperty.Set( iAllowSSValue ); // ignore error
+        iAllowSSProperty.Close();
+        iAllowSSPropertyAttached = EFalse;
+        delete iAllowSSSubscriber;
+        iAllowSSSubscriber = NULL;
+        }
+
+    iReply = HBufC8::NewL( 1 );
+    iReply->Des().Append( 0 );
+#else
+    iDispatcher->DispatchOutgoingErrorMessage(KErrArgument,
+            KErrDescrNotSupported, KSysInfoServiceUid);
+#endif 
+    HTI_LOG_FUNC_OUT(
+                "CHtiSysInfoServicePlugin::HandleScreenSaverCommandL" );
+    }
+
+//------------------------------------------------------------------------------
+// CHtiSysInfoServicePlugin::HandleScreenSaverTimeoutCommandL
+//------------------------------------------------------------------------------
+void CHtiSysInfoServicePlugin::HandleScreenSaverTimeoutCommandL(
+                                    const TDesC8& aMessage )
+    {
+    HTI_LOG_FUNC_IN(
+            "CHtiSysInfoServicePlugin::HandleScreenSaverTimeoutCommandL" );
+#if ( SYMBIAN_VERSION_SUPPORT < SYMBIAN_4 )
+    if ( aMessage.Length() != 2 )
+        {
+        iDispatcher->DispatchOutgoingErrorMessage(
+            KErrArgument,
+            KErrDescrArgument,
+            KSysInfoServiceUid);
+        return;
+        }
+
+    TInt time = aMessage[1];
+    HTI_LOG_FORMAT( "Requested timeout %d", time );
+    if ( time < 5 )
+        {
+        iDispatcher->DispatchOutgoingErrorMessage( KErrArgument,
+            KErrDescrInvalidSSTimeout, KSysInfoServiceUid );
+        return;
+        }
+
+    CRepository* persRep = CRepository::NewL( KCRUidPersonalizationSettings );
+    TInt err = persRep->Set( KSettingsScreenSaverPeriod, time );
+
+    if ( err == KErrNone )
+        {
+        iReply = HBufC8::NewL( 1 );
+        iReply->Des().Append( 0 );
+        }
+
+    else
+        {
+        iDispatcher->DispatchOutgoingErrorMessage( err,
+            KErrDescrSSTimeoutFailed, KSysInfoServiceUid );
+        }
+
+    delete persRep;
+#else
+    iDispatcher->DispatchOutgoingErrorMessage(KErrArgument,
+            KErrDescrNotSupported, KSysInfoServiceUid);
+#endif 
+    HTI_LOG_FUNC_OUT(
+        "CHtiSysInfoServicePlugin::HandleScreenSaverTimeoutCommandL" );
+    }
+
+//------------------------------------------------------------------------------
+// CHtiSysInfoServicePlugin::HandleNetworkModeCommandL
+//------------------------------------------------------------------------------
+void CHtiSysInfoServicePlugin::HandleNetworkModeCommandL( const TDesC8& aMessage )
+{
+    HTI_LOG_FUNC_IN( "CHtiSysInfoServicePlugin::HandleNetworkModeCommandL" );
+
+    TInt err = StartC32();
+    if ( ( err != KErrNone ) && ( err != KErrAlreadyExists ) )
+        {
+        HTI_LOG_FORMAT( "StartC32 failed %d", err );
+        User::Leave( err );
+        }
+
+    // Connect to telephony server
+    RTelServer telServer;
+    err = telServer.Connect();
+    if ( err != KErrNone )
+        {
+        HTI_LOG_FORMAT( "RTelServer::Connect() failed %d", err );
+        User::Leave( err );
+        }
+    CleanupClosePushL( telServer );
+
+    // load phonetsy
+    err = telServer.LoadPhoneModule( KMmTsyModuleName );
+    if ( err != KErrNone )
+        {
+        HTI_LOG_FORMAT( "RTelServer::LoadPhoneModule() failed %d", err );
+        User::Leave( err );
+        }
+
+    // get phones
+    TInt noOfPhones;
+    err = telServer.EnumeratePhones( noOfPhones );
+    if ( err != KErrNone )
+        {
+        HTI_LOG_FORMAT( "RTelServer::EnumeratePhones() failed %d", err );
+        User::Leave( err );
+        }
+
+    if ( noOfPhones == 0 )
+        {
+        HTI_LOG_TEXT( "No phones found" );
+        User::Leave( KErrNotFound );
+        }
+
+    HTI_LOG_FORMAT( "noOfPhones %d", noOfPhones );
+
+    RTelServer::TPhoneInfo phoneInfo;
+    for ( TInt i = 0; i < noOfPhones; i++ )
+        {
+        TName phoneTsy;
+        telServer.GetTsyName( i, phoneTsy );
+        HTI_LOG_DES( phoneTsy );
+
+        err = telServer.GetPhoneInfo( i, phoneInfo );
+        if ( err != KErrNone )
+            {
+            HTI_LOG_FORMAT( "RTelServer::GetPhoneInfo() %d", i );
+            HTI_LOG_FORMAT( "failed %d", err );
+            User::Leave( err );
+            }
+        HTI_LOG_DES( phoneInfo.iName );
+        }
+
+    // open phone
+    RMobilePhone phone;
+    err = phone.Open( telServer, phoneInfo.iName );
+    if ( err != KErrNone )
+        {
+        HTI_LOG_FORMAT( "RMobilePhone::Open() failed %d", err );
+        User::Leave( err );
+        }
+    CleanupClosePushL( phone );
+
+    err = phone.Initialise();
+    if ( err != KErrNone )
+        {
+        HTI_LOG_FORMAT( "RMobilePhone::Initialise() failed %d", err );
+        User::Leave( err );
+        }
+
+    // Open customapi
+    RMmCustomAPI customAPI;
+    err = customAPI.Open( phone );
+    if ( err != KErrNone )
+        {
+        HTI_LOG_FORMAT( "RMmCustomAPI::Open() %d", err );
+        User::LeaveIfError( err );
+        }
+    CleanupClosePushL( customAPI );
+
+    switch ( aMessage[0] )
+    {
+    case ENetworkModeGet:
+        {
+        HTI_LOG_TEXT( "ENetworkModeGet" );
+        TUint32 networkModes = 0;
+        err = customAPI.GetCurrentSystemNetworkModes( networkModes );
+        if ( err )
+            {
+            HTI_LOG_FORMAT(
+                    "RMmCustomAPI::GetCurrentSystemNetworkModes() failed %d",
+                    err );
+            User::LeaveIfError(
+                iDispatcher->DispatchOutgoingErrorMessage(
+                        err,
+                        KErrDescrGetNetworkModes,
+                        KSysInfoServiceUid ) );
+            }
+        else
+            {
+            HTI_LOG_FORMAT( "networkModes 0x%x", networkModes );
+            TBuf8<5> okMsg;
+            okMsg.Append( ENetworkModeGet );
+            okMsg.Append( (TUint8*) &networkModes, 4 );
+            iReply = okMsg.AllocL();
+            }
+        }
+        break;
+
+    case ENetworkModeSet:
+        HTI_LOG_TEXT( "ENetworkModeSet" );
+        if ( aMessage.Length() != 5 )
+            {
+            HTI_LOG_TEXT( "KErrArgument" );
+            User::LeaveIfError(
+                iDispatcher->DispatchOutgoingErrorMessage(
+                        KErrArgument,
+                        KErrDescrArgument,
+                        KSysInfoServiceUid ) );
+            }
+        else
+            {
+            TUint32 mode = aMessage[1] + ( aMessage[2] << 8 ) +
+                           ( aMessage[3] << 16 ) + ( aMessage[4] << 24 );
+
+            HTI_LOG_FORMAT( "SetSystemNetworkMode 0x%x", mode );
+            err = customAPI.SetSystemNetworkMode(
+                    ( RMmCustomAPI::TNetworkModeCaps ) mode );
+            if ( err )
+                {
+                HTI_LOG_FORMAT(
+                        "RMmCustomAPI::SetSystemNetworkMode() failed %d", err );
+                iDispatcher->DispatchOutgoingErrorMessage(
+                    err,
+                    KErrDescrSetNetworkMode,
+                    KSysInfoServiceUid );
+                }
+            else
+                {
+                iDispatcher->ShutdownAndRebootDeviceL();
+                }
+            }
+        break;
+
+    case ENetworkModeSetNoReboot:
+        {
+        HTI_LOG_TEXT( "ENetworkModeSetNoReboot" );
+        if ( aMessage.Length() != 5 )
+            {
+            HTI_LOG_TEXT( "KErrArgument" );
+            User::LeaveIfError(
+                iDispatcher->DispatchOutgoingErrorMessage(
+                        KErrArgument,
+                        KErrDescrArgument,
+                        KSysInfoServiceUid ) );
+            }
+        else
+            {
+            TUint32 mode = aMessage[1] + ( aMessage[2] << 8 ) +
+                           ( aMessage[3] << 16 ) + ( aMessage[4] << 24 );
+
+            HTI_LOG_FORMAT( "SetSystemNetworkMode 0x%x", mode );
+            err = customAPI.SetSystemNetworkMode(
+                    ( RMmCustomAPI::TNetworkModeCaps ) mode );
+            if ( err )
+                {
+                HTI_LOG_FORMAT(
+                        "RMmCustomAPI::SetSystemNetworkMode() failed %d", err );
+                iDispatcher->DispatchOutgoingErrorMessage(
+                    err,
+                    KErrDescrSetNetworkMode,
+                    KSysInfoServiceUid );
+                }
+            else
+                {
+                iReply = HBufC8::NewL( 1 );
+                iReply->Des().Append( 0 );
+                }
+            }
+        break;
+        }
+
+    default:
+        break;
+    }
+
+    CleanupStack::PopAndDestroy( 3 ); // telServer, phone, customAPI
+    HTI_LOG_FUNC_OUT( "CHtiSysInfoServicePlugin::HandleNetworkModeCommandL" );
+}
+
+//------------------------------------------------------------------------------
+// CHtiSysInfoServicePlugin::HandleIrActivateCommandL
+//------------------------------------------------------------------------------
+void CHtiSysInfoServicePlugin::HandleIrActivateCommandL( const TDesC8& aMessage )
+    {
+    HTI_LOG_FUNC_IN( "CHtiSysInfoServicePlugin::HandleIrActivateCommandL" );
+
+    // Message validation
+    if ( aMessage.Length() != 1 )
+        {
+        iDispatcher->DispatchOutgoingErrorMessage(
+            KErrArgument,
+            KErrDescrArgument,
+            KSysInfoServiceUid );
+        return;
+        }
+
+    TInt irStatus = -1;
+    TInt err = RProperty::Get( KIrdaPropertyCategory, KIrdaStatus, irStatus );
+    if ( err != KErrNone || irStatus < TIrdaStatusCodes::EIrLoaded
+                         || irStatus > TIrdaStatusCodes::EIrDisconnected )
+        {
+        // values from irinternalpskey.h
+        err = RProperty::Set( KPSUidIrdaActivation, 1, 1 );
+        if ( err != KErrNone )
+            {
+            iDispatcher->DispatchOutgoingErrorMessage(
+                err, KErrDescrIrActivation, KSysInfoServiceUid );
+            }
+        else
+            {
+            // Activation OK
+            iReply = HBufC8::NewL( 1 );
+            iReply->Des().Append( 0 );
+            }
+        }
+    else
+        {
+        // Already active - just send a message
+        iReply = HBufC8::NewL( 1 );
+        iReply->Des().Append( 1 );
+        }
+
+     HTI_LOG_FUNC_OUT( "CHtiSysInfoServicePlugin::HandleIrActivateCommandL" );
+    }
+
+//------------------------------------------------------------------------------
+// CHtiSysInfoServicePlugin::HandleBtPowerCommandL
+//------------------------------------------------------------------------------
+void CHtiSysInfoServicePlugin::HandleBtPowerCommandL( const TDesC8& aMessage )
+    {
+    HTI_LOG_FUNC_IN( "CHtiSysInfoServicePlugin::HandleBtPowerCommandL" );
+
+    // Message validation
+    if ( aMessage.Length() != 3 )
+        {
+        iDispatcher->DispatchOutgoingErrorMessage(
+            KErrArgument,
+            KErrDescrArgument,
+            KSysInfoServiceUid );
+        return;
+        }
+
+    TInt err = KErrNone;
+    TBool setBtOn = aMessage[1];
+    TBool useForce = aMessage[2];
+    TBool isBtOn = EFalse;
+
+    TBTPowerStateValue powerState = EBTPowerOff;
+    CBTEngSettings* btSettings = CBTEngSettings::NewLC();
+    err = btSettings->GetPowerState( powerState );
+    if ( err == KErrNone && powerState == EBTPowerOn )
+        {
+        isBtOn = ETrue;
+        }
+
+    if ( err )
+        {
+        HTI_LOG_FORMAT( "GetPowerState error %d", err );
+        CleanupStack::PopAndDestroy(); // btSettings
+        iDispatcher->DispatchOutgoingErrorMessage( err, KErrDescrGetBtPower,
+                                                   KSysInfoServiceUid );
+        return;
+        }
+    HTI_LOG_FORMAT( "Current BT power state %d", isBtOn );
+    HTI_LOG_FORMAT( "Requested BT power state %d", setBtOn );
+
+    if ( setBtOn == isBtOn )
+        {
+        // Already in requested state - just send message
+        CleanupStack::PopAndDestroy(); // btSettings
+        iReply = HBufC8::NewL( 1 );
+        iReply->Des().Append( 1 );
+        }
+
+    else
+        {
+        if ( setBtOn && !CanTurnBluetoothOnL( useForce ) )
+            {
+            iDispatcher->DispatchOutgoingErrorMessage( KErrAccessDenied,
+                KErrDescrBtOnDenied, KSysInfoServiceUid );
+            return;
+            }
+
+
+        if ( !setBtOn )
+            {
+            // If we are setting BT off, do checks for active connections.
+            TInt connCount = 0;
+            // Ignore error.
+            // If we cannot query, we act like there's no active connections.
+            RProperty::Get( KPropertyUidBluetoothCategory,
+                            KPropertyKeyBluetoothGetPHYCount,
+                            connCount );
+            // Check if there's Bluetooth audio accessory connected
+            TBool isBtAacConnected = EFalse;
+
+            // If there are connections, force flag is required in the
+            // command to turn BT off.
+            if ( ( connCount || isBtAacConnected ) && !useForce )
+                {
+                iDispatcher->DispatchOutgoingErrorMessage( KErrInUse,
+                    KErrDescrBtOffDenied, KSysInfoServiceUid );
+                CleanupStack::PopAndDestroy(); // btMcm/btSettings
+                return;
+                }
+            }
+
+        if ( setBtOn )
+            {
+            err = btSettings->SetPowerState( EBTPowerOn );
+            }
+        else
+            {
+            err = btSettings->SetPowerState( EBTPowerOff );
+            }
+
+        if ( err != KErrNone )
+            {
+            HTI_LOG_FORMAT( "CBTMCMSettings::SetPowerState error %d", err );
+            iDispatcher->DispatchOutgoingErrorMessage( err, KErrDescrSetBtPower,
+                                                       KSysInfoServiceUid );
+            }
+        else
+            {
+            iReply = HBufC8::NewL( 1 );
+            iReply->Des().Append( 0 );
+            }
+        CleanupStack::PopAndDestroy(); // btSettings
+        }
+    HTI_LOG_FUNC_OUT( "CHtiSysInfoServicePlugin::HandleBtPowerCommandL" );
+    }
+
+//------------------------------------------------------------------------------
+// CHtiSysInfoServicePlugin::HandleBtSettingsCommandL
+//------------------------------------------------------------------------------
+void CHtiSysInfoServicePlugin::HandleBtSettingsCommandL( const TDesC8& aMessage )
+    {
+    HTI_LOG_FUNC_IN( "CHtiSysInfoServicePlugin::HandleBtSettingsCommandL" );
+
+    // Message validation
+    if ( aMessage.Length() < 4 )
+        {
+        iDispatcher->DispatchOutgoingErrorMessage(
+            KErrArgument,
+            KErrDescrArgument,
+            KSysInfoServiceUid );
+        return;
+    }
+    TInt btNameLength = aMessage[3];
+    if ( btNameLength > KMaxBtNameLength ||
+         aMessage.Length() != ( btNameLength + 4 ) )
+        {
+        iDispatcher->DispatchOutgoingErrorMessage(
+            KErrArgument,
+            KErrDescrArgument,
+            KSysInfoServiceUid );
+        return;
+        }
+
+    TBTVisibilityMode visibilityMode = EBTVisibilityModeGeneral;
+    if ( aMessage[1] == 0 )
+        {
+        visibilityMode = EBTVisibilityModeHidden;
+        }
+    HTI_LOG_FORMAT( "Visibility mode = %d", visibilityMode );
+
+    TInt sapMode = 1;  // EBTSapEnabled
+    if ( aMessage[2] == 0 )
+        {
+        sapMode = 0;   // EBTSapDisabled
+        }
+    HTI_LOG_FORMAT( "SAP mode = %d", sapMode );
+
+    TBuf<KMaxBtNameLength> btName;
+    if ( btNameLength > 0 )
+        {
+        btName.Copy( aMessage.Mid( 4, btNameLength ) );
+        }
+    HTI_LOG_FORMAT( "BT name = %S", &btName );
+
+    TInt err = KErrNone;
+    CBTEngSettings* btSettings = CBTEngSettings::NewLC();
+    HTI_LOG_TEXT( "CBTEngSettings::NewLC done" );
+
+    HTI_LOG_TEXT( "Setting visibility mode" );
+    err = btSettings->SetVisibilityMode( visibilityMode );
+    if ( err == KErrNone )
+        {
+        HTI_LOG_TEXT( "Setting SAP mode" );
+        // CenRep UID and key value from btengprivatecrkeys.h
+        // const TUid KCRUidBTEngPrivateSettings = { 0x10204DAC }
+        // const TUint32 KBTSapEnabled  = 0x00000003
+        CRepository* btEngRep = CRepository::NewL( TUid::Uid( 0x10204DAC ) );
+        err = btEngRep->Set( 0x00000003, sapMode );
+        delete btEngRep;
+        btEngRep = NULL;
+        }
+    if ( err == KErrNone && btName.Length() > 0 )
+        {
+        HTI_LOG_TEXT( "Setting BT name" );
+        err = btSettings->SetLocalName( btName );
+        }
+
+    if ( err == KErrNone )
+        {
+        HTI_LOG_TEXT( "All set successfully" );
+        iReply = HBufC8::NewL( 1 );
+        iReply->Des().Append( 0 );
+        }
+    else
+        {
+        HTI_LOG_FORMAT( "Error %d", err );
+        iDispatcher->DispatchOutgoingErrorMessage(
+            err,
+            KErrDescrBtSettings,
+            KSysInfoServiceUid );
+        }
+
+    CleanupStack::PopAndDestroy(); // btSettings
+    HTI_LOG_FUNC_OUT( "CHtiSysInfoServicePlugin::HandleBtSettingsCommandL" );
+    }
+
+//------------------------------------------------------------------------------
+// CHtiSysInfoServicePlugin::HandleBtDeletePairingsL
+//------------------------------------------------------------------------------
+void CHtiSysInfoServicePlugin::HandleBtDeletePairingsL( const TDesC8& aMessage )
+    {
+    HTI_LOG_FUNC_IN( "CHtiSysInfoServicePlugin::HandleBtDeletePairingsL" );
+
+    // Message validation
+    if ( aMessage.Length() < 3 )
+        {
+        iDispatcher->DispatchOutgoingErrorMessage(
+            KErrArgument,
+            KErrDescrArgument,
+            KSysInfoServiceUid );
+        return;
+        }
+
+    TInt btNameLength = aMessage[2];
+    if ( btNameLength > KMaxBluetoothNameLen ||
+         aMessage.Length() != ( btNameLength + 3 ) )
+        {
+        iDispatcher->DispatchOutgoingErrorMessage(
+            KErrArgument,
+            KErrDescrArgument,
+            KSysInfoServiceUid );
+        return;
+        }
+
+    // Message parsing
+    TBool closeConnections = aMessage[1];
+    HTI_LOG_FORMAT( "Close connections = %d", closeConnections );
+    TBTDeviceName8 btName8;
+    if ( btNameLength > 0 )
+        {
+        btName8.Copy( aMessage.Mid( 3, btNameLength ) );
+        }
+    HTI_LOG_FORMAT( "BT name = %S",
+        &( BTDeviceNameConverter::ToUnicodeL( btName8 ) ) );
+
+    // Action
+    TInt deleteCount = 0;
+    TInt err = KErrNone;
+    RBTRegServ regServ;
+    RBTRegistry registry;
+    User::LeaveIfError( regServ.Connect() );
+    CleanupClosePushL( regServ );
+    User::LeaveIfError( registry.Open( regServ ) );
+    CleanupClosePushL( registry );
+    TBTRegistrySearch searchPattern;
+    searchPattern.FindBonded();
+
+    TRequestStatus status;
+    registry.CreateView( searchPattern, status );
+    User::WaitForRequest( status );
+    err = status.Int();
+    HTI_LOG_FORMAT( "RBTRegistry::CreateView returned %d", err );
+
+    if ( err > 0 )
+        {
+        CBTRegistryResponse* response = CBTRegistryResponse::NewL( registry );
+        CleanupStack::PushL( response );
+        HTI_LOG_TEXT( "Creating AsyncWaiter" );
+        CAsyncWaiter* waiter = CAsyncWaiter::NewLC();
+        HTI_LOG_TEXT( "Calling response->Start()" );
+        response->Start( waiter->iStatus );
+        HTI_LOG_TEXT( "Calling waiter->StartAndWait()" );
+        waiter->StartAndWait();
+        err = waiter->Result();
+        CleanupStack::PopAndDestroy( waiter );
+
+        if ( err == KErrNone )
+            {
+            RBTDeviceArray results = response->Results();
+            TInt count = results.Count();
+            for ( TInt i = 0; i < count; i++ )
+                {
+                HTI_LOG_FORMAT( "Device %d", i + 1 );
+                CBTDevice* device = results[i];
+                if ( btNameLength == 0 ||
+                     device->DeviceName().Match( btName8 ) != KErrNotFound )
+                    {
+                    HTI_LOG_TEXT( "Name qualifies for deletion" );
+                    registry.UnpairDevice( device->BDAddr(), status );
+                    User::WaitForRequest( status );
+                    err = status.Int();
+                    if ( err == KErrNone )
+                        {
+                        deleteCount++; // one deletion successfully done
+                        }
+                    }
+                if ( err != KErrNone )
+                    {
+                    // Break out if any failure occurs - the command has not
+                    // been able to do what it is expected to do.
+                    break;
+                    }
+                }
+            }
+        CleanupStack::PopAndDestroy( response );
+        }
+
+    CleanupStack::PopAndDestroy( &registry );
+    CleanupStack::PopAndDestroy( &regServ );
+
+    // Create OK response or send error
+    if ( err == KErrNone )
+        {
+        HTI_LOG_FORMAT( "%d pairings deleted successfully", deleteCount );
+        iReply = HBufC8::NewL( 1 );
+        iReply->Des().Append( deleteCount );
+        }
+    else
+        {
+        HTI_LOG_FORMAT( "Error %d", err );
+        iDispatcher->DispatchOutgoingErrorMessage(
+            err,
+            KErrDescrBtDeletePairings,
+            KSysInfoServiceUid );
+        }
+
+    HTI_LOG_FUNC_OUT( "CHtiSysInfoServicePlugin::HandleBtDeletePairingsL" );
+    }
+
+//------------------------------------------------------------------------------
+// CHtiSysInfoServicePlugin::HandleKeyLockToggleL
+//------------------------------------------------------------------------------
+void CHtiSysInfoServicePlugin::HandleKeyLockToggleL( const TDesC8& aMessage )
+    {
+    HTI_LOG_FUNC_IN( "CHtiSysInfoServicePlugin::HandleKeyLockToggleL" );
+#if ( SYMBIAN_VERSION_SUPPORT < SYMBIAN_4 ) 
+    if ( aMessage.Length() != 3 )
+        {
+        iDispatcher->DispatchOutgoingErrorMessage( KErrArgument,
+            KErrDescrArgument, KSysInfoServiceUid );
+        return;
+        }
+
+    RAknKeyLock keyLock;
+    User::LeaveIfError( keyLock.Connect() );
+    HTI_LOG_TEXT( "RAknKeyLock connect OK" );
+
+    TBool isKeyLockOn = keyLock.IsKeyLockEnabled();
+    HTI_LOG_FORMAT( "Keylock status = %d", isKeyLockOn );
+
+    TBool requested = aMessage[1];
+    HTI_LOG_FORMAT( "Requested status = %d", requested );
+
+    if ( requested == isKeyLockOn )
+        {
+        // Already in requested state - just send message
+        iReply = HBufC8::NewL( 1 );
+        iReply->Des().Append( 1 );
+        }
+
+    else
+        {
+        TBool showNote = aMessage[2];
+        HTI_LOG_FORMAT( "Note request = %d", showNote );
+        if ( requested )
+            {
+            if ( showNote )
+                {
+                keyLock.EnableKeyLock();
+                }
+            else
+                {
+                keyLock.EnableWithoutNote();
+                }
+            }
+        else
+            {
+            if ( showNote )
+                {
+                keyLock.DisableKeyLock();
+                }
+            else
+                {
+                keyLock.DisableWithoutNote();
+                }
+            }
+        User::After( 500000 );
+        isKeyLockOn = keyLock.IsKeyLockEnabled();
+        HTI_LOG_FORMAT( "New keylock status = %d", isKeyLockOn );
+        if ( isKeyLockOn == requested )
+            {
+            iReply = HBufC8::NewL( 1 );
+            iReply->Des().Append( 0 );
+            }
+        else
+            {
+            iDispatcher->DispatchOutgoingErrorMessage( KErrGeneral,
+                KErrDescrKeyLock, KSysInfoServiceUid );
+            }
+        }
+
+    keyLock.Close();
+#else
+    iDispatcher->DispatchOutgoingErrorMessage(KErrArgument,
+            KErrDescrNotSupported, KSysInfoServiceUid);
+#endif    
+    HTI_LOG_FUNC_OUT( "CHtiSysInfoServicePlugin::HandleKeyLockToggleL" );
+    }
+
+//------------------------------------------------------------------------------
+// CHtiSysInfoServicePlugin::HandleAutoKeyGuardTimeL
+//------------------------------------------------------------------------------
+void CHtiSysInfoServicePlugin::HandleAutoKeyGuardTimeL( const TDesC8& aMessage )
+    {
+
+    HTI_LOG_FUNC_IN( "CHtiSysInfoServicePlugin::HandleAutoKeyGuardTimeL" );
+
+    if ( aMessage.Length() != 3 )
+        {
+        iDispatcher->DispatchOutgoingErrorMessage( KErrArgument,
+            KErrDescrArgument, KSysInfoServiceUid );
+        return;
+        }
+
+    TInt time = aMessage[1] + ( aMessage[2] << 8 );
+    HTI_LOG_FORMAT( "Requested auto key guard time %d", time );
+    if ( time > 3600 )
+        {
+        iDispatcher->DispatchOutgoingErrorMessage( KErrArgument,
+            KErrDescrInvalidTime, KSysInfoServiceUid );
+        return;
+        }
+
+    CRepository* secRep = CRepository::NewL( KCRUidSecuritySettings );
+    TInt err = secRep->Set( KSettingsAutomaticKeyguardTime, time );
+
+    if ( err == KErrNone )
+        {
+        iReply = HBufC8::NewL( 1 );
+        iReply->Des().Append( 0 );
+        }
+
+    else
+        {
+        iDispatcher->DispatchOutgoingErrorMessage( err,
+            KErrDescrAutoKeyGuardFailed, KSysInfoServiceUid );
+        }
+
+    delete secRep;
+
+    HTI_LOG_FUNC_OUT( "CHtiSysInfoServicePlugin::HandleAutoKeyGuardTimeL" );
+    }
+
+
+//------------------------------------------------------------------------------
+// CHtiSysInfoServicePlugin::HandleEmptyDrmRightsDbL
+//------------------------------------------------------------------------------
+void CHtiSysInfoServicePlugin::HandleEmptyDrmRightsDbL( const TDesC8& aMessage )
+    {
+    HTI_LOG_FUNC_IN( "CHtiSysInfoServicePlugin::HandleEmptyDrmRightsDbL" );
+
+    if ( aMessage.Length() != 1 )
+        {
+        iDispatcher->DispatchOutgoingErrorMessage( KErrArgument,
+            KErrDescrArgument, KSysInfoServiceUid );
+        return;
+        }
+
+    RDRMRightsClient rightsClient;
+    TInt err = rightsClient.Connect();
+
+    if ( err != KErrNone )
+        {
+        HTI_LOG_FORMAT( "RDRMRightsClient connect failed %d", err );
+        iDispatcher->DispatchOutgoingErrorMessage( err,
+            KErrDescrDrmDbConnect, KSysInfoServiceUid );
+        }
+
+    else
+        {
+        HTI_LOG_TEXT( "RDRMRightsClient connect OK, clearing DB..." );
+        err = rightsClient.DeleteAll();
+        if ( err == KErrNone )
+            {
+            HTI_LOG_TEXT( "DB cleared OK" );
+            iReply = HBufC8::NewL( 1 );
+            iReply->Des().Append( 0 );
+            }
+        else
+            {
+            HTI_LOG_FORMAT( "DB clear failed %d", err );
+            iDispatcher->DispatchOutgoingErrorMessage( err,
+                KErrDescrDrmDbDelete, KSysInfoServiceUid );
+            }
+        rightsClient.Close();
+        }
+
+    HTI_LOG_FUNC_OUT( "CHtiSysInfoServicePlugin::HandleEmptyDrmRightsDbL" );
+    }
+
+
+//------------------------------------------------------------------------------
+// CHtiSysInfoServicePlugin::HandleBatteryStatusL
+//------------------------------------------------------------------------------
+void CHtiSysInfoServicePlugin::HandleBatteryStatusL( const TDesC8& aMessage )
+    {
+    HTI_LOG_FUNC_IN( "CHtiSysInfoServicePlugin::HandleBatteryStatusL" );
+
+    if ( aMessage.Length() != 1 )
+        {
+        iDispatcher->DispatchOutgoingErrorMessage( KErrArgument,
+            KErrDescrArgument, KSysInfoServiceUid );
+        return;
+        }
+
+    TInt err = KErrNone;
+    TInt batteryLevel = EBatteryLevelUnknown;
+    TInt chargingStatus = EChargingStatusError;
+
+    err = RProperty::Get( KPSUidHWRMPowerState,
+                          KHWRMBatteryLevel, batteryLevel );
+    HTI_LOG_FORMAT( "Battery level = %d", batteryLevel );
+    if ( err != KErrNone || batteryLevel == EBatteryLevelUnknown )
+        {
+        if ( err == KErrNone ) err = KErrGeneral;
+        iDispatcher->DispatchOutgoingErrorMessage( err,
+            KErrDescrBatteryLevel, KSysInfoServiceUid );
+        return;
+        }
+
+    err = RProperty::Get( KPSUidHWRMPowerState,
+                          KHWRMChargingStatus, chargingStatus );
+    HTI_LOG_FORMAT( "Charging status = %d", chargingStatus );
+    if ( err != KErrNone || chargingStatus == EChargingStatusError )
+        {
+        if ( err == KErrNone ) err = KErrGeneral;
+        iDispatcher->DispatchOutgoingErrorMessage( err,
+            KErrDescrChargingStatus, KSysInfoServiceUid );
+        return;
+        }
+
+    iReply = HBufC8::NewL( 2 );
+    iReply->Des().Append( batteryLevel );
+    iReply->Des().Append( chargingStatus );
+
+    HTI_LOG_FUNC_OUT( "CHtiSysInfoServicePlugin::HandleBatteryStatusL" );
+    }
+
+
+//------------------------------------------------------------------------------
+// CHtiSysInfoServicePlugin::HandleSignalStrengthL
+//------------------------------------------------------------------------------
+void CHtiSysInfoServicePlugin::HandleSignalStrengthL( const TDesC8& aMessage )
+    {
+    HTI_LOG_FUNC_IN( "CHtiSysInfoServicePlugin::HandleSignalStrengthL" );
+
+    if ( aMessage.Length() != 1 )
+        {
+        iDispatcher->DispatchOutgoingErrorMessage( KErrArgument,
+            KErrDescrArgument, KSysInfoServiceUid );
+        return;
+        }
+
+#if defined(__WINS__)
+    iDispatcher->DispatchOutgoingErrorMessage( KErrNotSupported,
+        KErrDescrNotSupported, KSysInfoServiceUid );
+#else
+    TInt err = KErrNone;
+    TInt popCount = 0;
+    RTelServer server;
+    err = server.Connect();
+
+    if ( err == KErrNone )
+        {
+        HTI_LOG_TEXT( "Connected to RTelServer" );
+        CleanupClosePushL( server );
+        popCount++;
+        err = server.LoadPhoneModule( KMmTsyModuleName );
+        if ( err == KErrAlreadyExists ) err = KErrNone; // ok if already loaded
+        }
+
+    RMobilePhone mobilePhone;
+
+    if ( err == KErrNone )
+        {
+        HTI_LOG_TEXT( "Phone module loaded" );
+        err = mobilePhone.Open( server, KMmTsyPhoneName );
+        }
+
+    TInt8  signalBars;
+    TInt32 signalStrength;
+
+    if ( err == KErrNone )
+        {
+        HTI_LOG_TEXT( "RMobilePhone open" );
+        CleanupClosePushL( mobilePhone );
+        popCount++;
+        TRequestStatus status;
+        mobilePhone.GetSignalStrength( status, signalStrength, signalBars );
+        User::WaitForRequest( status );
+        HTI_LOG_FORMAT( "GetSignalStrength return value %d", status.Int() );
+        err = status.Int();
+        }
+
+    if ( err == KErrNone )
+        {
+        HTI_LOG_FORMAT( "Signal bars = %d", signalBars );
+        HTI_LOG_FORMAT( "Signal strength = %d", signalStrength );
+        iReply = HBufC8::NewL( 1 );
+        iReply->Des().Append( signalBars );
+        }
+
+    else
+        {
+        iDispatcher->DispatchOutgoingErrorMessage( err,
+            KErrDescrSignalStrength, KSysInfoServiceUid );
+        }
+
+    if ( popCount > 0 )
+        {
+        CleanupStack::PopAndDestroy( popCount );
+        }
+#endif // __WINS__
+    HTI_LOG_FUNC_OUT( "CHtiSysInfoServicePlugin::HandleSignalStrengthL" );
+    }
+
+
+//------------------------------------------------------------------------------
+// CHtiSysInfoServicePlugin::HandleHsdpaCommandL
+//------------------------------------------------------------------------------
+void CHtiSysInfoServicePlugin::HandleHsdpaCommandL( const TDesC8& aMessage )
+    {
+    HTI_LOG_FUNC_IN( "CHtiSysInfoServicePlugin::HandleHsdpaCommandL" );
+
+    if ( aMessage.Length() != 2 )
+        {
+        iDispatcher->DispatchOutgoingErrorMessage( KErrArgument,
+            KErrDescrArgument, KSysInfoServiceUid );
+        return;
+        }
+    TBool enableHsdpa = aMessage[1];
+
+    RTelServer telServer;
+    RMmCustomAPI customAPI;
+    RMobilePhone mobilePhone;
+    User::LeaveIfError( telServer.Connect() );
+    CleanupClosePushL( telServer );
+    User::LeaveIfError( mobilePhone.Open( telServer, KMmTsyPhoneName ) );
+    CleanupClosePushL( mobilePhone );
+    User::LeaveIfError( customAPI.Open( mobilePhone ) );
+    CleanupClosePushL( customAPI );
+
+    // Get current HSDPA status
+    TBool isHsdpaEnabled = EFalse;
+    TRequestStatus status;
+    RMmCustomAPI::THSxPAStatus hSxPAStatus;
+    customAPI.ReadHSxPAStatus( status, hSxPAStatus );
+    User::WaitForRequest( status );
+    HTI_LOG_FORMAT( "Reading HSxPA status returned %d", status.Int() );
+    User::LeaveIfError( status.Int() );
+    if ( hSxPAStatus == RMmCustomAPI::EHSxPAEnabled )
+        {
+        isHsdpaEnabled = ETrue;
+        }
+
+    HTI_LOG_FORMAT( "Current HSDPA status   = %d", isHsdpaEnabled );
+    HTI_LOG_FORMAT( "Requested HSDPA status = %d", enableHsdpa );
+
+    if ( isHsdpaEnabled == enableHsdpa )
+        {
+        // Already in requested state - just send message
+        iReply = HBufC8::NewL( 1 );
+        iReply->Des().Append( 1 );
+        }
+
+    else
+        {
+        // Try to change status
+        if ( enableHsdpa )
+            {
+            hSxPAStatus = RMmCustomAPI::EHSxPAEnabled;
+            }
+        else
+            {
+            hSxPAStatus = RMmCustomAPI::EHSxPADisabled;
+            }
+        customAPI.WriteHSxPAStatus( status, hSxPAStatus );
+        User::WaitForRequest( status );
+        HTI_LOG_FORMAT( "Writing HSxPA status returned %d", status.Int() );
+        User::LeaveIfError( status.Int() );
+        iReply = HBufC8::NewL( 1 );
+        iReply->Des().Append( 0 );
+        }
+
+    CleanupStack::PopAndDestroy( 3 ); // mobilePhone, customAPI, telServer
+
+    HTI_LOG_FUNC_OUT( "CHtiSysInfoServicePlugin::HandleHsdpaCommandL" );
+    }
+
+//------------------------------------------------------------------------------
+// CHtiSysInfoServicePlugin::HandleUpdateMediaGalleryL()
+//------------------------------------------------------------------------------
+void CHtiSysInfoServicePlugin::HandleUpdateMediaGalleryL(
+        const TDesC8& aMessage )
+    {
+    HTI_LOG_FUNC_IN( "CHtiSysInfoServicePlugin::HandleUpdateMediaGalleryL" );
+
+    if ( !iGalleryUpdateSupported )
+        {
+        HTI_LOG_TEXT( "Media Gallery update not supported" );
+        iDispatcher->DispatchOutgoingErrorMessage( KErrNotSupported,
+                KErrDescrNotSupported, KSysInfoServiceUid );
+        return;
+        }
+
+    if ( aMessage.Length() < 2 )
+        {
+        iDispatcher->DispatchOutgoingErrorMessage( KErrArgument,
+            KErrDescrArgument, KSysInfoServiceUid );
+        return;
+        }
+    TInt filePathLength = aMessage[1];
+    // Check that given file path length is valid: Index 0 is the
+    // command code, index 1 is the path length -> hence the + 2
+    if ( aMessage.Length() != filePathLength + 2 )
+        {
+        iDispatcher->DispatchOutgoingErrorMessage( KErrArgument,
+                KErrDescrArgument, KSysInfoServiceUid );
+        return;
+        }
+
+    // Try to load the Media File API DLL
+    TInt err = KErrNone;
+    RLibrary galleryUpdaterDLL;
+    err = galleryUpdaterDLL.Load( _L( "MGXMediaFileAPI.dll" ) );
+    if ( err == KErrNotFound )  // DLL does not exist
+        {
+        HTI_LOG_TEXT( "MGXMediaFileAPI.dll file not found" );
+        iGalleryUpdateSupported = EFalse;
+        iDispatcher->DispatchOutgoingErrorMessage( KErrNotSupported,
+                KErrDescrNotSupported, KSysInfoServiceUid );
+        return;
+        }
+    User::LeaveIfError( err ); // Some other error in loading the DLL
+
+    // DLL loaded successfully
+    CleanupClosePushL( galleryUpdaterDLL );
+
+    // Construct the CMGXFileManager object from the DLL
+    typedef CMGXFileManager* ( *TNewFileManagerFunc )( RFs& aFs );
+    TNewFileManagerFunc newFileManFunc =
+            ( TNewFileManagerFunc ) galleryUpdaterDLL.Lookup( 1 );
+    if ( newFileManFunc == NULL )
+        {
+        HTI_LOG_TEXT( "Function not found from DLL" );
+        iGalleryUpdateSupported = EFalse;
+        User::Leave( KErrNotSupported );
+        }
+
+    CMGXFileManager* mgManager = NULL;
+    TRAP( err, mgManager = newFileManFunc( iFs ) );
+    HTI_LOG_FORMAT( "NewFileManagerL returned %d", err );
+    User::LeaveIfError( err );
+    User::LeaveIfNull( mgManager );
+    CleanupStack::PushL( mgManager );
+
+    if ( filePathLength > 0 )
+        {
+        TBuf<KMaxFileName> path;
+        path.Copy( aMessage.Mid( 2 ) );
+        HTI_LOG_FORMAT( "Updating file %S to gallery", &path );
+        TRAP( err, mgManager->UpdateL( path ) );
+        }
+    else
+        {
+        HTI_LOG_TEXT( "Updating all files to gallery" );
+        TRAP( err, mgManager->UpdateL() );
+        }
+
+    if ( err != KErrNone )
+        {
+        HTI_LOG_FORMAT( "Gallery update failed with %d", err );
+        iDispatcher->DispatchOutgoingErrorMessage( err, KErrDescrMGUpdate,
+                KSysInfoServiceUid );
+        }
+
+    CleanupStack::PopAndDestroy( 2 ); // mgManager, galleryUpdaterDLL
+    iReply = HBufC8::NewL( 1 );
+    iReply->Des().Append( 0 );
+    HTI_LOG_FUNC_OUT( "CHtiSysInfoServicePlugin::HandleUpdateMediaGalleryL" );
+    }
+
+//------------------------------------------------------------------------------
+// CHtiSysInfoServicePlugin::HandleActivateSkinL()
+//------------------------------------------------------------------------------
+void CHtiSysInfoServicePlugin::HandleActivateSkinL( const TDesC8& aMessage )
+    {
+    HTI_LOG_FUNC_IN( "CHtiSysInfoServicePlugin::HandleActivateSkinL" );
+
+    // Must be at least command code + name length byte
+    if ( aMessage.Length() < 2 || aMessage.Length() != aMessage[1] + 2 )
+        {
+        iDispatcher->DispatchOutgoingErrorMessage( KErrArgument,
+                KErrDescrArgument, KSysInfoServiceUid );
+        return;
+        }
+
+    TFileName skinName;
+    if ( aMessage[1] > 0 )
+        {
+        skinName.Copy( aMessage.Mid( 2 ) );
+        }
+    HTI_LOG_FORMAT( "Skin name: %S", &skinName );
+
+    // Check if we got full path to skn file
+    TParse fileParse;
+    fileParse.Set( skinName, NULL, NULL );
+    TBool isFullPath = fileParse.DrivePresent() && fileParse.PathPresent() &&
+            fileParse.NamePresent() && fileParse.ExtPresent();
+    HTI_LOG_FORMAT( "Is full path = %d", isFullPath );
+
+    // Check current skin
+    TAknsPkgIDBuf pidBuf;
+    TInt currentSkinLocation; // TAknSkinSrvSkinPackageLocation
+    CRepository* repository =
+            CRepository::NewL( KCRUidPersonalisation );
+    CleanupStack::PushL( repository );
+    repository->Get( KPslnActiveSkinUid, pidBuf );
+    repository->Get( KPslnActiveSkinLocation, currentSkinLocation );
+    TAknsPkgID currentSkinPid;
+    currentSkinPid.SetFromDesL( pidBuf );
+    HTI_LOG_FORMAT( "Current skin pkg ID buf = %S", &pidBuf );
+    HTI_LOG_FORMAT( "Current skin location = %d", currentSkinLocation );
+
+    // Connect to the skins server
+    RAknsSrvSession skinsSession;
+    User::LeaveIfError( skinsSession.Connect() );
+    CleanupClosePushL( skinsSession );
+
+    // Resolve the ID for the requested skin
+    TAknsPkgID requestedSkinPid = KAknsNullPkgID;
+    TInt requestedSkinLocation = EAknsSrvPhone;
+
+    if ( skinName.Length() == 0 )
+        {
+        // Default skin requested - resolve default skin ID
+        // Use KAknsPIDS60DefaultSkin if nothing else found from CenRep
+        requestedSkinPid.Set( KAknsPIDS60DefaultSkin );
+        TAknsPkgID defaultSkin = KAknsNullPkgID;
+        TAknsPkgIDBuf defaultPidBuf;
+        TInt ret = repository->Get( KPslnDefaultSkinUID, defaultPidBuf );
+        if ( ret != KErrNone || defaultPidBuf.Length() == 0 )
+            {
+            HTI_LOG_TEXT( "KPslnDefaultSkinUID not found" );
+            TInt defaultID = 0;
+            ret = repository->Get( KPslnDefaultSkinID, defaultID );
+            if ( ret == KErrNone && defaultID != 0 )
+                {
+                HTI_LOG_FORMAT( "KPslnDefaultSkinID found: %d", defaultID );
+                defaultSkin.Set( TUid::Uid( defaultID ) );
+                }
+            }
+        else
+            {
+            HTI_LOG_FORMAT( "KPslnDefaultSkinUID found: %S", &defaultPidBuf );
+            TLex lexer( defaultPidBuf );
+            TPtrC pidToken( lexer.NextToken() );
+            TUint pid = 0;
+            TUint timeStamp = 0;
+            // as hex UID is 8 characters
+            // as decimal UID is 9 or 10 characters
+            if ( pidToken.Length() == 8 )
+                {
+                ret = TLex( pidToken ).Val( pid, EHex ); // value is in hex
+                }
+            else
+                {
+                ret = TLex( pidToken ).Val( pid ); // value is in decimal
+                }
+            if ( ret == KErrNone )
+                {
+                TPtrC stampToken( lexer.NextToken() );
+                // Timestamp doesn't exist if PID is an UID
+                if ( stampToken.Length() )
+                    {
+                    if ( stampToken.Length() == 8 )
+                        {
+                        // value is in hex
+                        ret = TLex( stampToken ).Val( timeStamp, EHex );
+                        }
+                    else
+                        {
+                        // value is decimal
+                        ret = TLex( stampToken ).Val( timeStamp );
+                        }
+                    }
+                }
+            if ( ret == KErrNone )
+                {
+                // We have found some valid values.
+                // Timestamp is 0 if pid is UID value
+                HTI_LOG_FORMAT( "PID %d", pid );
+                HTI_LOG_FORMAT( "Timestamp %d", timeStamp );
+                defaultSkin.Set( timeStamp, pid );
+                }
+            }
+        // Did we find something from CenRep
+        if ( defaultSkin != KAknsNullPkgID )
+            {
+            requestedSkinPid.Set( defaultSkin );
+            }
+        }
+
+    else
+        {
+        // We have skin name - try to find it
+        CArrayPtr<CAknsSrvSkinInformationPkg>* skinInfoArray =
+                skinsSession.EnumerateSkinPackagesL( EAknsSrvAll );
+        HTI_LOG_FORMAT( "Skins found: %d", skinInfoArray->Count() );
+        TInt i = 0;
+        for ( ; i < skinInfoArray->Count(); i++ )
+            {
+            if ( isFullPath )
+                {
+                if ( skinName.CompareF(
+                        skinInfoArray->At( i )->FullName() ) == 0 )
+                    {
+                    requestedSkinPid = skinInfoArray->At( i )->PID();
+                    }
+                }
+            else
+                {
+                if ( skinName.CompareF( skinInfoArray->At( i )->Name() ) == 0 )
+                    {
+                    requestedSkinPid = skinInfoArray->At( i )->PID();
+                    }
+                }
+            if ( requestedSkinPid != KAknsNullPkgID )
+                {
+                // Requested skin was found - check the location
+                TUint16 drive = ( skinInfoArray->At( i )->Directory() )[0];
+                if (  drive == 'E' || drive == 'e' )
+                    {
+                    requestedSkinLocation = EAknsSrvMMC;
+                    }
+                else
+                    {
+                    requestedSkinLocation = EAknsSrvPhone;
+                    }
+                break;
+                }
+            }
+        skinInfoArray->ResetAndDestroy(); // not needed anymore
+        delete skinInfoArray;
+        skinInfoArray = NULL;
+        }
+
+    if ( requestedSkinPid != KAknsNullPkgID )
+        {
+        // Do we need to change skin
+        if ( requestedSkinPid != currentSkinPid )
+            {
+            HTI_LOG_FORMAT( "Activating skin %d", requestedSkinPid.iNumber );
+            TInt err = skinsSession.SetAllDefinitionSets( requestedSkinPid );
+            HTI_LOG_FORMAT( "Activation returned %d", err );
+            if ( err == KErrNone )
+                {
+                TAknsPkgIDBuf newPidBuf;
+                requestedSkinPid.CopyToDes( newPidBuf );
+                err = repository->Set( KPslnActiveSkinUid, newPidBuf );
+                HTI_LOG_FORMAT( "Set KPslnActiveSkinUid returned %d", err );
+                if ( err == KErrNone &&
+                        requestedSkinLocation != currentSkinLocation )
+                    {
+                    err = repository->Set(
+                            KPslnActiveSkinLocation, requestedSkinLocation );
+                    HTI_LOG_FORMAT( "Set KPslnActiveSkinLocation returned %d",
+                            err );
+                    }
+                if ( err == KErrNone )
+                    {
+                    // Send OK message
+                    iReply = HBufC8::NewL( 1 );
+                    iReply->Des().Append( 0 ); // 0 means OK
+                    }
+                }
+            if ( err != KErrNone )
+                {
+                HTI_LOG_FORMAT( "Skin activation failed with %d", err );
+                iDispatcher->DispatchOutgoingErrorMessage( err,
+                        KErrDescrActivateSkin, KSysInfoServiceUid );
+                }
+            }
+        else
+            {
+            // Requested skin already active - just send message
+            HTI_LOG_TEXT( "Already active - no need to change" );
+            iReply = HBufC8::NewL( 1 );
+            iReply->Des().Append( 1 );  // 1 means "already active"
+            }
+        }
+
+    else
+        {
+        // Skin was not found
+        HTI_LOG_TEXT( "Skin was not found" );
+        iDispatcher->DispatchOutgoingErrorMessage( KErrNotFound,
+                KErrDescrActivateSkin, KSysInfoServiceUid );
+        }
+
+    CleanupStack::PopAndDestroy( 2 ); // skinsSession, repository
+
+    HTI_LOG_FUNC_OUT( "CHtiSysInfoServicePlugin::HandleActivateSkinL" );
+    }
+
+//------------------------------------------------------------------------------
+// CHtiSysInfoServicePlugin::HandleSetLanguageL
+//------------------------------------------------------------------------------
+void CHtiSysInfoServicePlugin::HandleSetLanguageL( const TDesC8& aMessage )
+    {
+    HTI_LOG_FUNC_IN( "CHtiSysInfoServicePlugin::HandleSetLanguageL" );
+    if ( aMessage.Length() != 3 )
+        {
+        iDispatcher->DispatchOutgoingErrorMessage( KErrArgument,
+                KErrDescrArgument, KSysInfoServiceUid );
+        return;
+        }
+    
+    TInt language = aMessage[1] + ( aMessage[2] << 8 );
+    if(language < 0)
+        {
+        iDispatcher->DispatchOutgoingErrorMessage( KErrArgument,
+                KErrDescrSetLanguage, KSysInfoServiceUid );
+        return;
+        }
+    HTI_LOG_FORMAT( "Set language to %d", language );
+    
+    // Never set Language code 0 to HAL
+    if (language != 0)
+        {
+        User::LeaveIfError(HAL::Set(HAL::ELanguageIndex, language));
+        }
+    
+    CRepository* commonEngineRepository = CRepository::NewL(
+            KCRUidCommonEngineKeys);
+    CleanupStack::PushL(commonEngineRepository);
+    
+    User::LeaveIfError(commonEngineRepository->Set(KGSDisplayTxtLang, language));
+
+    CleanupStack::PopAndDestroy();
+
+    TBool nbrModeSaved = EFalse;
+    if (language == ELangArabic || User::Language() == ELangArabic)
+        {
+        //numberMode = EGSNumberModeArabicIndic;
+        SetDefaultNumberModeL(EGSNbrModeArabic, EGSNbrModeTypeArabic);
+        nbrModeSaved = ETrue;
+        }
+    else if ((language == ELangUrdu || User::Language() == ELangUrdu)
+            || (language == ELangFarsi || User::Language() == ELangFarsi))
+        {
+        //numberMode = EGSNumberModeEasternArabicIndic;
+        SetDefaultNumberModeL(EGSNbrModeLatin, EGSNbrModeTypeEasternArabic);
+        nbrModeSaved = ETrue;
+        }
+    else if (language == ELangHindi || User::Language() == ELangHindi
+            || language == ELangMarathi || User::Language() == ELangMarathi)
+        {
+        //numberMode = EGSNumberModeIndic;
+        SetDefaultNumberModeL(EGSNbrModeLatin, EGSNbrModeTypeIndic);
+        nbrModeSaved = ETrue;
+        }
+
+    //if number mode is not set above, then set it to Latin with respective
+    //number mode types. This part might be executed when Automatic is
+    //selected and the SIM card does not support the language.
+    if (!nbrModeSaved)
+        {
+        TInt nbrModeType = EGSNbrModeTypeIndic;
+        if (language == ELangArabic || User::Language() == ELangArabic)
+            {
+            nbrModeType = EGSNbrModeTypeArabic;
+            }
+        else if ((language == ELangUrdu || User::Language() == ELangUrdu)
+                || (language == ELangFarsi || User::Language() == ELangFarsi))
+            {
+            nbrModeType = EGSNbrModeTypeEasternArabic;
+            }
+
+        //EGSNumberModeLatin is true in both cases;
+        SetDefaultNumberModeL(EGSNbrModeLatin, nbrModeType);
+        }
+    
+    // Change input language
+    CRepository* aknFepRepository = CRepository::NewL( KCRUidAknFep );
+    CleanupStack::PushL(aknFepRepository);
+    User::LeaveIfError(  aknFepRepository->Set( KAknFepInputTxtLang,
+                                                language ));
+    // Change input method for Chinese variants
+    if( FeatureManager::FeatureSupported( KFeatureIdChinese ) )
+        {
+        TBuf<KFepChineseInputModeLength> conversion;
+        if( language == ELangPrcChinese )
+            {
+            conversion.Num( EPinyin, EHex );
+            User::LeaveIfError( aknFepRepository->Set( KAknFepChineseInputMode, conversion ) );
+            }
+        else if( language == ELangHongKongChinese )
+            {
+            conversion.Num( EStroke, EHex );
+            User::LeaveIfError( aknFepRepository->Set( KAknFepChineseInputMode, conversion ) );
+            }
+        else if( language == ELangTaiwanChinese )
+            {
+            conversion.Num( EZhuyin, EHex );
+            User::LeaveIfError( aknFepRepository->Set( KAknFepChineseInputMode, conversion ) );
+            }
+        }
+    CleanupStack::PopAndDestroy();
+    
+    iReply = HBufC8::NewL( 1 );
+    iReply->Des().Append( 0 );
+    HTI_LOG_FUNC_OUT( "CHtiSysInfoServicePlugin::HandleSetLanguageL" );
+    }
+
+void CHtiSysInfoServicePlugin::SetDefaultNumberModeL(TInt aMode, TInt aNbrModeType)
+    {
+
+    CRepository* localeRepository = CRepository::NewL(KCRUidLocaleSettings);
+    CleanupStack::PushL(localeRepository);
+    if (aNbrModeType == EGSNbrModeTypeArabic || aNbrModeType
+            == EGSNbrModeTypeEasternArabic)
+        {
+        localeRepository->Set(KSettingsDefaultNumberMode, aMode);
+        }
+    else
+        {
+        localeRepository->Set(KSettingsIndicDefaultNumberMode, aMode);
+        }
+    CleanupStack::PopAndDestroy();
+
+    TLocale locale;
+    if (aMode == EGSNbrModeLatin)
+        {
+        locale.SetDigitType(EDigitTypeWestern);
+        }
+    else
+        {
+        //if aMode <> EGSNbrModeLatin, then it should be either latin or arabic. However
+        //as EGSNbrModeArabic and EGsNbrModeIndic both have a value = 1, we can't use
+        //that constant for below comparison. Hence, need to depend on the 2nd param.
+        switch (aNbrModeType)
+            {
+            case EGSNbrModeTypeArabic:
+                locale.SetDigitType(EDigitTypeArabicIndic);
+                break;
+            case EGSNbrModeTypeIndic:
+                locale.SetDigitType(EDigitTypeDevanagari);
+                break;
+            case EGSNbrModeTypeEasternArabic:
+                locale.SetDigitType(EDigitTypeEasternArabicIndic);
+                break;
+            default:
+                break;
+            }
+        }
+
+    locale.Set();
+    }
+//------------------------------------------------------------------------------
+// CHtiSysInfoServicePlugin::ParseTimeDataL
+//------------------------------------------------------------------------------
+void CHtiSysInfoServicePlugin::ParseTimeDataL( const TDesC8& aTimeData,
+                                               TTime& aResult )
+    {
+    /*
+      aTimeData =
+        bytes 0 - 1 = year
+                  2 = month
+                  3 = day
+                  4 = hour
+                  5 = minute
+                  6 = second
+    */
+    if ( aTimeData.Length() != KTimeDataLength )
+        {
+        User::Leave( KErrBadDescriptor );
+        }
+
+    TInt year   = aTimeData[0] + ( aTimeData[1] << 8 );
+    TInt month  = aTimeData[2];
+    TInt day    = aTimeData[3];
+    TInt hour   = aTimeData[4];
+    TInt minute = aTimeData[5];
+    TInt second = aTimeData[6];
+
+    TDateTime dateTime;
+    User::LeaveIfError( dateTime.Set(
+        year, TMonth( month - 1 ), day - 1, hour, minute, second, 0 ) );
+    aResult = dateTime;
+    }
+
+//------------------------------------------------------------------------------
+// CHtiSysInfoServicePlugin::CleanUpTempFiles
+//------------------------------------------------------------------------------
+TInt CHtiSysInfoServicePlugin::CleanUpTempFiles()
+    {
+    HTI_LOG_FUNC_IN( "CHtiSysInfoServicePlugin::CleanUpTempFiles" );
+    TFindFile finder( iFs );
+    CDir* dir = NULL;
+    TInt err = finder.FindWildByDir(KMatchFileName, KTempFilePath, dir);
+    TInt safeDeleteCount = 0;
+    while ( err == KErrNone && safeDeleteCount < 20)
+        {
+        safeDeleteCount++;
+        TFileName path;
+        path.Copy(finder.File());
+        HTI_LOG_FORMAT( "found file: %S", &path );
+        TInt ret = iFileMan->Delete(path);
+        delete dir;
+        dir = NULL;
+        if(ret != KErrNone)
+            {
+            break;
+            }
+        err = finder.FindWildByDir(KMatchFileName, KTempFilePath, dir);
+        }
+    HTI_LOG_FUNC_OUT("CHtiSysInfoServicePlugin::CleanUpTempFiles");
+    return KErrNone;
+    }
+
+//------------------------------------------------------------------------------
+// CHtiSysInfoServicePlugin::CanTurnBluetoothOnL
+//------------------------------------------------------------------------------
+TBool CHtiSysInfoServicePlugin::CanTurnBluetoothOnL( const TBool aUseForce )
+    {
+    HTI_LOG_FUNC_IN("CHtiSysInfoServicePlugin::CanTurnBluetoothOnL");
+    TInt isInNetwork = 0;
+    CRepository* repository = CRepository::NewL( KCRUidCoreApplicationUIs );
+    repository->Get( KCoreAppUIsNetworkConnectionAllowed, isInNetwork );
+    HTI_LOG_FORMAT( "isInNetwork = %d", isInNetwork );
+    delete repository;
+
+    if ( isInNetwork )
+        {
+        return ETrue;
+        }
+
+    // Phone is offline - check if it's allowed to turn BT on.
+
+    // If the force flag was not set in command, we won't turn BT on in offline.
+    if ( !aUseForce )
+        {
+        return EFalse;
+        }
+
+    // Check if it's possible to turn BT on in offline mode.
+    TInt btOfflineEnabled = 0;
+    CRepository* repository2 = CRepository::NewL( KCRUidBluetoothEngine );
+    repository2->Get( KBTEnabledInOffline, btOfflineEnabled );
+    HTI_LOG_FORMAT( "btOfflineEnabled = %d", btOfflineEnabled );
+    delete repository2;
+
+    if ( btOfflineEnabled )
+        {
+        return ETrue;
+        }
+    HTI_LOG_FUNC_OUT("CHtiSysInfoServicePlugin::CanTurnBluetoothOnL");
+    return EFalse;
+    }
+
+
+// ----------------------------------------------------------------------------
+CAsyncWaiter* CAsyncWaiter::NewL( TInt aPriority )
+    {
+    CAsyncWaiter* self = new(ELeave) CAsyncWaiter( aPriority );
+    return self;
+    }
+
+// ----------------------------------------------------------------------------
+CAsyncWaiter* CAsyncWaiter::NewLC( TInt aPriority )
+    {
+    CAsyncWaiter* self = new ( ELeave ) CAsyncWaiter( aPriority );
+    CleanupStack::PushL( self );
+    return self;
+    }
+
+// ----------------------------------------------------------------------------
+CAsyncWaiter::CAsyncWaiter( TInt aPriority ) : CActive( aPriority )
+    {
+    iWait = new CActiveSchedulerWait();
+    CActiveScheduler::Add( this );
+    }
+
+// ----------------------------------------------------------------------------
+CAsyncWaiter::~CAsyncWaiter()
+    {
+    Cancel();
+    delete iWait;
+    }
+
+// ----------------------------------------------------------------------------
+void CAsyncWaiter::StartAndWait()
+    {
+    HTI_LOG_FUNC_IN( "CAsyncWaiter::StartAndWait" );
+    iStatus = KRequestPending;
+    SetActive();
+    iWait->Start();
+    HTI_LOG_FUNC_OUT( "CAsyncWaiter::StartAndWait" );
+    }
+
+// ----------------------------------------------------------------------------
+TInt CAsyncWaiter::Result() const
+    {
+    return iResult;
+    }
+
+// ----------------------------------------------------------------------------
+void CAsyncWaiter::RunL()
+    {
+    HTI_LOG_FUNC_IN( "CAsyncWaiter::RunL" );
+    iResult = iStatus.Int();
+    iWait->AsyncStop();
+    HTI_LOG_FUNC_OUT( "CAsyncWaiter::RunL" );
+    }
+
+// ----------------------------------------------------------------------------
+void CAsyncWaiter::DoCancel()
+    {
+    iResult = KErrCancel;
+    if ( iStatus == KRequestPending )
+        {
+        TRequestStatus* status = &iStatus;
+        User::RequestComplete( status, KErrCancel );
+        }
+    iWait->AsyncStop();
+    }
+
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiServicePlugins/HtiSysInfoServicePlugin/src/proxy.cpp	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,37 @@
+/*
+* 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 proxy for systen info service plugin dll
+*
+*/
+
+
+// INCLUDES
+#include "HtiSysInfoServicePlugin.h"
+
+#include <e32std.h>
+#include <ecom/implementationproxy.h>
+
+// Provides a key value pair table, this is used to identify
+// the correct construction function for the requested interface.
+const TImplementationProxy ImplementationTable[] =
+    {
+        IMPLEMENTATION_PROXY_ENTRY(0x10210CC7,  CHtiSysInfoServicePlugin::NewL)
+    };
+
+// Function used to return an instance of the proxy table.
+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/htiui/HtiStartupWait/bwins/HtiStartupWaitu.def	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,3 @@
+EXPORTS
+	?NewStartupWait@@YAPAVCHtiStartupWait@@XZ @ 1 NONAME ; class CHtiStartupWait * NewStartupWait(void)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiStartupWait/eabi/HtiStartupWaitu.def	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,3 @@
+EXPORTS
+	_Z14NewStartupWaitv @ 1 NONAME
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiStartupWait/group/HtiStartupWait.mmp	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,42 @@
+/*
+* 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:  DLL implementing the MHtiStartupWaitInterface
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+TARGET          HtiStartupWait.dll
+TARGETTYPE      dll
+
+UID             0x1020DEB9 0x200212DE
+
+VENDORID        0x101FB657
+
+CAPABILITY      ALL -TCB
+
+SOURCEPATH      ../src
+SOURCE          HtiStartupWait.cpp
+
+USERINCLUDE     ../inc
+APP_LAYER_SYSTEMINCLUDE
+
+LIBRARY         euser.lib
+LIBRARY         hal.lib
+LIBRARY         flogger.lib
+
+SMPSAFE
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiStartupWait/group/bld.inf	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,27 @@
+/*
+* 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 file for HtiStartupWait
+*
+*/
+
+
+PRJ_PLATFORMS
+
+PRJ_EXPORTS
+
+PRJ_MMPFILES
+HtiStartupWait.mmp
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiStartupWait/inc/HtiStartupWait.h	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,49 @@
+/*
+* 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:  CHtiStartupWait class declaration.
+*
+*/
+
+
+#ifndef __HTISTARTUPWAIT_H
+#define __HTISTARTUPWAIT_H
+
+//  INCLUDES
+#include <e32std.h>
+#include <HtiStartupWaitInterface.h>
+
+// CONSTANTS
+
+// MACROS
+
+// DATA TYPES
+
+// FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+// CLASS DECLARATION
+
+/**
+*
+*/
+NONSHARABLE_CLASS(CHtiStartupWait) : public MHtiStartupWaitInterface
+    {
+    public: // from MHtiStartupWaitInterface
+        virtual TInt WaitForStartup( TInt aMaxWaitTime );
+    };
+
+#endif // __HTISTARTUPWAIT_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiStartupWait/src/HtiStartupWait.cpp	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,88 @@
+/*
+* 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:  HtiStartupWait implementation
+*
+*/
+
+
+// INCLUDE FILES
+#include "HtiStartupWait.h"
+#include <HtiLogging.h>
+#include <e32property.h>
+#include <hal.h>
+#include <startupdomainpskeys.h>
+
+// CONSTANTS
+const TInt KStateCheckInterval  = 3000000; // microseconds
+
+// LOCAL CONSTANTS AND MACROS
+
+// MODULE DATA STRUCTURES
+
+// LOCAL FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+
+// ============================= LOCAL FUNCTIONS ===============================
+
+// ----------------------------------------------------------------------------
+EXPORT_C CHtiStartupWait* NewStartupWait()
+    {
+    return new ( ELeave ) CHtiStartupWait();
+
+    }
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// ----------------------------------------------------------------------------
+TInt CHtiStartupWait::WaitForStartup( TInt aMaxWaitTime )
+    {
+    TInt err = KErrNone;
+
+    // Not relying on TTime as the time might change during OS startup.
+    // Counting the time from nano ticks.
+    TInt nTickPeriod;
+    HAL::Get( HAL::ENanoTickPeriod, nTickPeriod );
+    HTI_LOG_FORMAT( "ENanoTickPeriod = %d", nTickPeriod );
+
+    TUint32 startTime = User::NTickCount();
+    TInt secsFromStart = 0;
+
+    TInt state = ESwStateStartingUiServices; // TPSGlobalSystemState
+    RProperty::Get( KPSUidStartup, KPSGlobalSystemState, state );
+    while ( state != ESwStateNormalRfOn && state != ESwStateNormalRfOff &&
+            secsFromStart < aMaxWaitTime )
+        {
+        HTI_LOG_FORMAT(
+            "HTI waiting for device to start: TPSGlobalSystemState = %d",
+            state );
+        User::After( KStateCheckInterval );
+        secsFromStart =
+            ( User::NTickCount() - startTime ) * nTickPeriod / 1000000;
+        HTI_LOG_FORMAT( "Seconds from start %d", secsFromStart );
+        RProperty::Get( KPSUidStartup, KPSGlobalSystemState, state );
+        }
+
+    if ( secsFromStart >= aMaxWaitTime )
+        {
+        HTI_LOG_TEXT( "Max wait time exceeded" );
+        err = KErrTimedOut;
+        }
+
+    return err;
+    }
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiTcbHlp/group/HtiTcbHlp.mmp	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,40 @@
+/*
+* 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 description file for HtiFileHlp
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+TARGET          HtiTcbHlp.exe
+TARGETTYPE      EXE
+UID             0x1000008d 0x2003161E
+
+VENDORID        0x101FB657
+
+CAPABILITY      ALL
+
+SOURCEPATH      ../src
+SOURCE          HtiTcbHlp.cpp
+
+APP_LAYER_SYSTEMINCLUDE
+
+LIBRARY         euser.lib
+LIBRARY         efsrv.lib
+LIBRARY     	sisregistryclient.lib
+
+SMPSAFE
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiTcbHlp/group/bld.inf	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,32 @@
+/*
+* 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 file for HtiFileHlp
+*
+*/
+
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+PRJ_TESTEXPORTS
+
+PRJ_MMPFILES
+HtiTcbHlp.mmp
+
+PRJ_TESTMMPFILES
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiTcbHlp/src/HtiTcbHlp.cpp	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,150 @@
+/*
+* 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:  HtiFileHlp implementation. This exe is used for file operations
+*                to TCB folders (requiring capability ALL).
+*
+*/
+
+
+// INCLUDE FILES
+#include "../../symbian_version.hrh"
+#include <e32std.h>
+#include <swi/sisregistrysession.h>
+
+// CONSTANTS
+_LIT( KTcbHlpName, "HtiTcbHlp" );
+
+_LIT( KCmdAppRegInfo,           "AppRegInfo");
+_LIT( KCmdAppRegInfo_Add,       "add" );
+_LIT( KCmdAppRegInfo_Remove,    "remove" );
+
+_LIT( KDelimiter, "|" );
+// MACROS
+
+// LOCAL CONSTANTS AND MACROS
+
+// MODULE DATA STRUCTURES
+
+// LOCAL FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+// ============================ LOCAL FUNCTIONS ===============================
+
+#if ( SYMBIAN_VERSION_SUPPORT >= SYMBIAN_4 )
+LOCAL_C void HandleAppRegFileInfoL(const TDesC& aAppRegFile, TBool aAdded)
+    {
+    Swi::RSisRegistrySession regSession;
+    User::LeaveIfError( regSession.Connect() );
+    CleanupClosePushL( regSession );
+    if(aAdded)
+        {
+        regSession.AddAppRegInfoL(aAppRegFile);
+        }
+    else
+        {
+        regSession.RemoveAppRegInfoL(aAppRegFile);
+        }
+    CleanupStack::PopAndDestroy(1);
+    }
+#endif
+
+LOCAL_C TInt StartL()
+    {
+    TInt cmdLen = User::CommandLineLength();
+
+    HBufC* cmdLine = HBufC::NewLC( cmdLen );
+    TPtr ptCmdLine = cmdLine->Des();
+    User::CommandLine( ptCmdLine );
+
+    TInt paramStart = 0;
+    TInt paramEnd = 0;
+
+    // Take first parameter (the command)
+    paramEnd = cmdLine->Find( KDelimiter );
+    if ( paramEnd <= paramStart )
+        {
+        User::Leave( KErrArgument );
+        }
+    TPtrC cmd = cmdLine->Mid( paramStart, paramEnd - paramStart );
+    
+    if(cmd == KCmdAppRegInfo)
+        {
+#if ( SYMBIAN_VERSION_SUPPORT >= SYMBIAN_4 )
+        // Take the next parameter either until next delimiter or
+        // the rest of the command line.
+        paramStart = paramEnd + 1;
+        paramEnd = cmdLine->Mid( paramStart ).Find( KDelimiter ) + paramStart;
+        if ( paramEnd < paramStart )
+            {
+            // No delimiter found - this is the last parameter
+            paramEnd = cmdLen;
+            }
+    
+        TPtrC param1 = cmdLine->Mid( paramStart, paramEnd - paramStart );
+    
+        paramStart = paramEnd + 1;
+        if ( paramStart >= cmdLen )
+            {
+            User::Leave( KErrArgument );
+            }
+    
+        if ( param1 == KCmdAppRegInfo_Add )
+            {
+            TPtrC param2 = cmdLine->Mid( paramStart );
+            HandleAppRegFileInfoL( param2, ETrue );
+            }
+        else if ( param1 == KCmdAppRegInfo_Remove )
+            {
+            TPtrC param2 = cmdLine->Mid( paramStart );
+            HandleAppRegFileInfoL( param2, EFalse );
+            }
+        else
+            {
+            User::Leave( KErrArgument );
+            }
+#endif
+        }
+    else
+        {
+        User::Leave( KErrArgument );
+        }
+
+    CleanupStack::PopAndDestroy(); // cmdLine
+
+    return KErrNone;
+    }
+
+GLDEF_C TInt E32Main()
+    {
+    __UHEAP_MARK;
+
+    CTrapCleanup* cleanup = CTrapCleanup::New();
+    CActiveScheduler* scheduler = new ( ELeave ) CActiveScheduler;
+    CActiveScheduler::Install( scheduler );
+
+    User::RenameThread( KTcbHlpName );
+
+    TRAPD( error, StartL() );
+
+    delete scheduler;
+    delete cleanup;
+    __UHEAP_MARKEND;
+
+    //__ASSERT_ALWAYS( !error, User::Panic( KTcbHlpName, error ) );
+    return error;
+    }
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/group/bld.inf	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,66 @@
+/*
+* 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 file for building
+*               HTI UI layer components.
+*                
+*
+*/
+
+#include <platform_paths.hrh>
+#include "../symbian_version.hrh"
+
+PRJ_EXPORTS
+#if ( SYMBIAN_VERSION_SUPPORT < SYMBIAN_4 )
+../rom/htiui.iby        CORE_IBY_EXPORT_PATH(tools,htiui.iby)
+#else
+../rom/htiui_10_1.iby   CORE_IBY_EXPORT_PATH(tools,htiui.iby)
+#endif
+
+// Service plugins
+#include "../HtiServicePlugins/HtiAppServicePlugin/group/bld.inf"
+#include "../HtiServicePlugins/HtiAudioServicePlugin/group/bld.inf"
+#include "../HtiServicePlugins/HtiCameraServicePlugin/group/bld.inf"
+#include "../HtiServicePlugins/HtiKeyEventServicePlugin/group/bld.inf"
+#include "../HtiServicePlugins/HtiMessagesServicePlugin/group/bld.inf"
+#include "../HtiServicePlugins/HtiPIMServicePlugin/group/bld.inf"
+#include "../HtiServicePlugins/HtiScreenshotServicePlugin/group/bld.inf"
+#include "../HtiServicePlugins/HtiSysInfoServicePlugin/group/bld.inf"
+
+// Backup fake DLL used by HtiFtpServicePlugin
+#include "../HtiServicePlugins/HtiFtpBackupFake/group/bld.inf"
+
+// Device rebooter
+#include "../HtiDeviceReboot/group/bld.inf"
+
+// Startup wait DLL
+#include "../HtiStartupWait/group/bld.inf"
+
+// Hti tcb help application
+#include "../HtiTcbHlp/group/bld.inf"
+
+// HTI Admin UI application
+#if ( SYMBIAN_VERSION_SUPPORT < SYMBIAN_4 )
+#include "../HtiAdmin/group/bld.inf"
+#endif
+
+// Build stub SIS
+PRJ_EXTENSIONS
+#ifdef MARM
+START EXTENSION app-services/buildstubsis
+OPTION SRCDIR ../sis
+OPTION SISNAME HTI_stub
+END
+#endif
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/group/hti_stub_sis.mk	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,58 @@
+#
+# 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: Makefile for creating HTI stub SIS for ROM image.
+#                
+
+
+TARGETDIR=$(EPOCROOT)EPOC32\Data\Z\System\Install
+
+SISNAME=HTI_stub
+PKGNAME=HTI_stub
+
+$(TARGETDIR) :
+	@perl -S emkdir.pl "$(TARGETDIR)"
+
+do_nothing :
+	rem do_nothing
+
+SISFILE=$(TARGETDIR)\$(SISNAME).sis
+
+$(SISFILE) : ..\sis\$(PKGNAME).pkg
+	makesis -s $? $@
+
+#
+# The targets invoked by bld...
+#
+
+MAKMAKE : do_nothing
+
+RESOURCE : do_nothing
+
+SAVESPACE : do_nothing
+
+BLD : do_nothing
+
+FREEZE : do_nothing
+
+LIB : do_nothing
+
+CLEANLIB : do_nothing
+
+FINAL : $(TARGETDIR) $(SISFILE)
+
+CLEAN :
+	-erase $(SISFILE)
+
+RELEASABLES :
+	@echo $(SISFILE)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/htiui.pro	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,20 @@
+#
+# 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 = subdirs
+SUBDIRS += HtiAdminQt/HtiAdmin.pro 
+BLD_INF_RULES.prj_extensions += "$${LITERAL_HASH}include \"group/bld.inf\""  
+BLD_INF_RULES.prj_extensions += "prj_extensions"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/rom/htiui.iby	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,60 @@
+/*
+* 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: Specifies HTI UI layer components for ROM image
+*
+*/
+
+#ifndef __HTIUI_IBY__
+#define __HTIUI_IBY__
+
+// HtiAdmin application
+S60_APP_EXE(HtiAdmin)
+#ifdef S60_UPGRADABLE_APP_REG_RSC
+  S60_UPGRADABLE_APP_REG_RSC(HtiAdmin)
+#else
+  S60_APP_AIF_RSC(HtiAdmin)
+#endif
+S60_APP_RESOURCE(HtiAdmin)
+
+// Test service plug-ins
+ECOM_PLUGIN(HtiAudioServicePlugin.dll,HtiAudioServicePlugin.rsc)
+ECOM_PLUGIN(HtiCameraServicePlugin.dll,HtiCameraServicePlugin.rsc)
+ECOM_PLUGIN(HtiKeyEventServicePlugin.dll,HtiKeyEventServicePlugin.rsc)
+ECOM_PLUGIN(HtiMessagesServicePlugin.dll,HtiMessagesServicePlugin.rsc)
+ECOM_PLUGIN(HtiPIMServicePlugin.dll,HtiPIMServicePlugin.rsc)
+ECOM_PLUGIN(HtiScreenshotServicePlugin.dll,HtiScreenshotServicePlugin.rsc)
+ECOM_PLUGIN(HtiSysInfoServicePlugin.dll,HtiSysInfoServicePlugin.rsc)
+
+// Test service plug-in extension
+file=ABI_DIR\BUILD_DIR\HtiAppControl.dll            SHARED_LIB_DIR\HtiAppControl.dll
+
+// Backup fake DLL used by HtiFtpServicePlugin
+file=ABI_DIR\BUILD_DIR\HtiFtpBackupFake.dll         SHARED_LIB_DIR\HtiFtpBackupFake.dll
+
+// Notepad helper
+file=ABI_DIR\BUILD_DIR\HtiNpdHlp.exe                SHARED_LIB_DIR\HtiNpdHlp.exe
+
+// Device rebooter
+file=ABI_DIR\BUILD_DIR\HtiDeviceRebootUI.exe       SHARED_LIB_DIR\HtiDeviceRebootUI.exe
+
+// Startup wait DLL
+file=ABI_DIR\BUILD_DIR\HtiStartupWait.dll           SHARED_LIB_DIR\HtiStartupWait.dll
+
+// Tcb helper
+file=ABI_DIR\BUILD_DIR\HtiTcbHlp.exe                SHARED_LIB_DIR\HtiTcbHlp.exe
+
+// Stub SIS
+data=ZSYSTEM\Install\HTI_stub.sis                   system\install\HTI_stub.sis
+
+#endif // __HTIUI_IBY__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/rom/htiui_10_1.iby	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,55 @@
+/*
+* 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: Specifies HTI UI layer components for ROM image
+*
+*/
+
+#ifndef __HTIUI_IBY__
+#define __HTIUI_IBY__
+
+
+// HtiAdmin application
+S60_APP_EXE(HtiAdmin)
+data=DATAZ_\Resource\apps\HtiAdmin.rsc                      Resource\Apps\HtiAdmin.rsc
+data=ZPRIVATE\10003a3f\import\apps\HtiAdmin_reg.rsc         private\10003a3f\import\apps\HtiAdmin_reg.rsc
+
+
+// Test service plug-ins
+ECOM_PLUGIN(HtiAudioServicePlugin.dll,HtiAudioServicePlugin.rsc)
+ECOM_PLUGIN(HtiCameraServicePlugin.dll,HtiCameraServicePlugin.rsc)
+ECOM_PLUGIN(HtiKeyEventServicePlugin.dll,HtiKeyEventServicePlugin.rsc)
+ECOM_PLUGIN(HtiMessagesServicePlugin.dll,HtiMessagesServicePlugin.rsc)
+ECOM_PLUGIN(HtiPIMServicePlugin.dll,HtiPIMServicePlugin.rsc)
+ECOM_PLUGIN(HtiScreenshotServicePlugin.dll,HtiScreenshotServicePlugin.rsc)
+ECOM_PLUGIN(HtiSysInfoServicePlugin.dll,HtiSysInfoServicePlugin.rsc)
+
+// Test service plug-in extension
+file=ABI_DIR\BUILD_DIR\HtiAppControl.dll            SHARED_LIB_DIR\HtiAppControl.dll
+
+// Backup fake DLL used by HtiFtpServicePlugin
+file=ABI_DIR\BUILD_DIR\HtiFtpBackupFake.dll         SHARED_LIB_DIR\HtiFtpBackupFake.dll
+
+// Device rebooter
+file=ABI_DIR\BUILD_DIR\HtiDeviceRebootUI.exe       SHARED_LIB_DIR\HtiDeviceRebootUI.exe
+
+// Startup wait DLL
+file=ABI_DIR\BUILD_DIR\HtiStartupWait.dll           SHARED_LIB_DIR\HtiStartupWait.dll
+
+// Tcb helper
+file=ABI_DIR\BUILD_DIR\HtiTcbHlp.exe                SHARED_LIB_DIR\HtiTcbHlp.exe
+
+// Stub SIS
+data=ZSYSTEM\Install\HTI_stub.sis                   system\install\HTI_stub.sis
+
+#endif // __HTIUI_IBY__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/sis/HTI_S60-10_1.pkg	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,119 @@
+;
+; 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: Installation file for HTI
+
+
+; Languages
+&EN
+
+; Using UID of HtiFramework project
+#{"HTI"},(0x1020DEB6),2,27,0
+
+; Series60 product id for S60 5.2
+[0x20022E6D], 0, 0, 0, {"Series60ProductID"}
+
+; Localised Vendor name
+%{"Nokia"}
+
+; Unique Vendor name
+:"Nokia"
+
+; Install files
+
+; HtiCfg library
+"\epoc32\release\armv5\urel\HtiCfg.dll"                          - "!:\sys\bin\HtiCfg.dll"
+
+; HtiAdmin
+"\epoc32\release\armv5\urel\HtiAdmin.exe"                        - "!:\sys\bin\HtiAdmin.exe"
+"\epoc32\data\Z\Resource\apps\HtiAdmin.rsc"                      - "!:\Resource\Apps\HtiAdmin.rsc"
+"\epoc32\data\Z\private\10003a3f\import\apps\HtiAdmin_reg.rsc"          - "!:\private\10003a3f\import\apps\HtiAdmin_reg.rsc"
+
+; Serial comm module
+"\epoc32\data\Z\Resource\Plugins\HtiSerialCommEcomPlugin.rsc"    - "!:\Resource\Plugins\HtiSerialCommEcomPlugin.rsc"
+"\epoc32\release\armv5\urel\HtiSerialCommEcomPlugin.dll"         - "!:\sys\bin\HtiSerialCommEcomPlugin.dll"
+
+; BtSerial comm module
+"\epoc32\release\armv5\urel\HtiBtSerialComHelper.dll"            - "!:\sys\bin\HtiBtSerialComHelper.dll"
+"\epoc32\release\armv5\urel\HtiBtCommServer.dll"                 - "!:\sys\bin\HtiBtCommServer.dll"
+"\epoc32\release\armv5\urel\HtiBtCommInterface.dll"              - "!:\sys\bin\HtiBtCommInterface.dll"
+"\epoc32\data\Z\Resource\Plugins\HtiBtCommEcomPlugin.rsc"        - "!:\Resource\Plugins\HtiBtCommEcomPlugin.rsc"
+"\epoc32\release\armv5\urel\HtiBtCommEcomPlugin.dll"             - "!:\sys\bin\HtiBtCommEcomPlugin.dll"
+
+; IPComm module
+"\epoc32\release\armv5\urel\HtiIPCommServer.exe"                 - "!:\sys\bin\HtiIPCommServer.exe"
+"\epoc32\release\armv5\urel\HtiIPCommServerClient.dll"           - "!:\sys\bin\HtiIPCommServerClient.dll"
+"\epoc32\data\Z\Resource\Plugins\HtiIPCommEcomPlugin.rsc"        - "!:\Resource\Plugins\HtiIPCommEcomPlugin.rsc"
+"\epoc32\release\armv5\urel\HtiIPCommEcomPlugin.dll"             - "!:\sys\bin\HtiIPCommEcomPlugin.dll"
+
+; USB serial comm module
+"\epoc32\data\Z\Resource\Plugins\HtiUsbSerialCommEcomPlugin.rsc" - "!:\Resource\Plugins\HtiUsbSerialCommEcomPlugin.rsc"
+"\epoc32\release\armv5\urel\HtiUsbSerialCommEcomPlugin.dll"      - "!:\sys\bin\HtiUsbSerialCommEcomPlugin.dll"
+
+; Test service plug-ins
+"\epoc32\release\armv5\urel\HtiEchoServicePlugin.dll"            - "!:\sys\bin\HtiEchoServicePlugin.dll"
+"\epoc32\data\Z\Resource\Plugins\HtiEchoServicePlugin.rsc"       - "!:\Resource\Plugins\HtiEchoServicePlugin.rsc"
+"\epoc32\release\armv5\urel\HtiKeyEventServicePlugin.dll"        - "!:\sys\bin\HtiKeyEventServicePlugin.dll"
+"\epoc32\data\Z\Resource\Plugins\HtiKeyEventServicePlugin.rsc"   - "!:\Resource\Plugins\HtiKeyEventServicePlugin.rsc"
+"\epoc32\release\armv5\urel\HtiScreenshotServicePlugin.dll"      - "!:\sys\bin\HtiScreenshotServicePlugin.dll"
+"\epoc32\data\Z\Resource\Plugins\HtiScreenshotServicePlugin.rsc" - "!:\Resource\Plugins\HtiScreenshotServicePlugin.rsc"
+"\epoc32\release\armv5\urel\HtiFtpServicePlugin.dll"             - "!:\sys\bin\HtiFtpServicePlugin.dll"
+"\epoc32\data\Z\Resource\Plugins\HtiFtpServicePlugin.rsc"        - "!:\Resource\Plugins\HtiFtpServicePlugin.rsc"
+"\epoc32\release\armv5\urel\HtiAppServicePlugin.dll"             - "!:\sys\bin\HtiAppServicePlugin.dll"
+"\epoc32\data\Z\Resource\Plugins\HtiAppServicePlugin.rsc"        - "!:\Resource\Plugins\HtiAppServicePlugin.rsc"
+"\epoc32\release\armv5\urel\HtiAppControl.dll"                   - "!:\sys\bin\HtiAppControl.dll"
+"\epoc32\release\armv5\urel\HtiStifTfServicePlugin.dll"          - "!:\sys\bin\HtiStifTfServicePlugin.dll"
+"\epoc32\data\Z\Resource\Plugins\HtiStifTfServicePlugin.rsc"     - "!:\Resource\Plugins\HtiStifTfServicePlugin.rsc"
+"\epoc32\release\armv5\urel\HtiSysInfoServicePlugin.dll"         - "!:\sys\bin\HtiSysInfoServicePlugin.dll"
+"\epoc32\data\Z\Resource\Plugins\HtiSysInfoServicePlugin.rsc"    - "!:\Resource\Plugins\HtiSysInfoServicePlugin.rsc"
+"\epoc32\release\armv5\urel\HtiAudioServicePlugin.dll"           - "!:\sys\bin\HtiAudioServicePlugin.dll"
+"\epoc32\data\Z\Resource\Plugins\HtiAudioServicePlugin.rsc"      - "!:\Resource\Plugins\HtiAudioServicePlugin.rsc"
+"\epoc32\release\armv5\urel\HtiMessagesServicePlugin.dll"        - "!:\sys\bin\HtiMessagesServicePlugin.dll"
+"\epoc32\data\Z\Resource\Plugins\HtiMessagesServicePlugin.rsc"   - "!:\Resource\Plugins\HtiMessagesServicePlugin.rsc"
+"\epoc32\release\armv5\urel\HtiPIMServicePlugin.dll"             - "!:\sys\bin\HtiPIMServicePlugin.dll"
+"\epoc32\data\Z\Resource\Plugins\HtiPIMServicePlugin.rsc"        - "!:\Resource\Plugins\HtiPIMServicePlugin.rsc"
+"\epoc32\release\armv5\urel\HtiIpProxyServicePlugin.dll"         - "!:\sys\bin\HtiIpProxyServicePlugin.dll"
+"\epoc32\data\Z\Resource\Plugins\HtiIpProxyServicePlugin.rsc"    - "!:\Resource\Plugins\HtiIpProxyServicePlugin.rsc"
+"\epoc32\release\armv5\urel\HtiCameraServicePlugin.dll"          - "!:\sys\bin\HtiCameraServicePlugin.dll"
+"\epoc32\data\Z\Resource\Plugins\HtiCameraServicePlugin.rsc"     - "!:\Resource\Plugins\HtiCameraServicePlugin.rsc"
+
+; File helper with capability ALL - for file operations to TCB folders
+"\epoc32\release\armv5\urel\HtiFileHlp.exe"                      - "!:\sys\bin\HtiFileHlp.exe"
+
+; Tcb helper with capability ALL - for operations which need TCB capability
+"\epoc32\release\armv5\urel\HtiTcbHlp.exe"                      - "!:\sys\bin\HtiTcbHlp.exe"
+
+; Backup fake DLL used by HtiFtpServicePlugin
+"\epoc32\release\armv5\urel\HtiFtpBackupFake.dll"                - "!:\sys\bin\HtiFtpBackupFake.dll"
+
+; HTI watchdog
+"\epoc32\release\armv5\urel\HtiWatchDog.exe"                     - "!:\sys\bin\HtiWatchDog.exe"
+
+; HTI Restart
+"\epoc32\release\armv5\urel\HtiRestart.exe"                      - "!:\sys\bin\HtiRestart.exe"
+
+; HTI device reboot
+"\epoc32\release\armv5\urel\HtiDeviceRebootUI.exe"               - "!:\sys\bin\HtiDeviceRebootUI.exe"
+
+; HTI Framework
+"\epoc32\release\armv5\urel\HTIFramework.exe"                    - "!:\sys\bin\HTIFramework.exe"
+
+; AutoStart recogniser plug-in
+"\epoc32\release\armv5\urel\HtiAutoStart.dll"                    - "!:\sys\bin\HtiAutoStart.dll"
+"\epoc32\data\Z\Resource\Plugins\HtiAutoStart.rsc"               - "!:\Resource\Plugins\HtiAutoStart.rsc"
+
+; HTI startup wait
+"\epoc32\release\armv5\urel\HtiStartupWait.dll"                  - "!:\sys\bin\HtiStartupWait.dll"
+
+; Startup list resource file for starting HTIFramework.exe in device boot
+;"\epoc32\data\Z\private\101f875a\import\1020deb6.rsc"            - "c:\private\101f875a\import\[1020deb6].rsc"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/sis/HTI_S60-52.pkg	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,122 @@
+;
+; 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: Installation file for HTI
+
+
+; Languages
+&EN
+
+; Using UID of HtiFramework project
+#{"HTI"},(0x1020DEB6),2,27,0
+
+; Series60 product id for S60 5.2
+[0x20022E6D], 0, 0, 0, {"Series60ProductID"}
+
+; Localised Vendor name
+%{"Nokia"}
+
+; Unique Vendor name
+:"Nokia"
+
+; Install files
+
+; HtiCfg library
+"\epoc32\release\armv5\urel\HtiCfg.dll"                          - "!:\sys\bin\HtiCfg.dll"
+
+; HtiAdmin
+"\epoc32\release\armv5\urel\HtiAdmin.exe"                        - "!:\sys\bin\HtiAdmin.exe"
+"\epoc32\data\Z\Resource\apps\HtiAdmin.rsc"                      - "!:\Resource\Apps\HtiAdmin.rsc"
+"\epoc32\data\Z\private\10003a3f\apps\HtiAdmin_reg.rsc"          - "!:\private\10003a3f\import\apps\HtiAdmin_reg.rsc"
+
+; Serial comm module
+"\epoc32\data\Z\Resource\Plugins\HtiSerialCommEcomPlugin.rsc"    - "!:\Resource\Plugins\HtiSerialCommEcomPlugin.rsc"
+"\epoc32\release\armv5\urel\HtiSerialCommEcomPlugin.dll"         - "!:\sys\bin\HtiSerialCommEcomPlugin.dll"
+
+; BtSerial comm module
+"\epoc32\release\armv5\urel\HtiBtSerialComHelper.dll"            - "!:\sys\bin\HtiBtSerialComHelper.dll"
+"\epoc32\release\armv5\urel\HtiBtCommServer.dll"                 - "!:\sys\bin\HtiBtCommServer.dll"
+"\epoc32\release\armv5\urel\HtiBtCommInterface.dll"              - "!:\sys\bin\HtiBtCommInterface.dll"
+"\epoc32\data\Z\Resource\Plugins\HtiBtCommEcomPlugin.rsc"        - "!:\Resource\Plugins\HtiBtCommEcomPlugin.rsc"
+"\epoc32\release\armv5\urel\HtiBtCommEcomPlugin.dll"             - "!:\sys\bin\HtiBtCommEcomPlugin.dll"
+
+; IPComm module
+"\epoc32\release\armv5\urel\HtiIPCommServer.exe"                 - "!:\sys\bin\HtiIPCommServer.exe"
+"\epoc32\release\armv5\urel\HtiIPCommServerClient.dll"           - "!:\sys\bin\HtiIPCommServerClient.dll"
+"\epoc32\data\Z\Resource\Plugins\HtiIPCommEcomPlugin.rsc"        - "!:\Resource\Plugins\HtiIPCommEcomPlugin.rsc"
+"\epoc32\release\armv5\urel\HtiIPCommEcomPlugin.dll"             - "!:\sys\bin\HtiIPCommEcomPlugin.dll"
+
+; USB serial comm module
+"\epoc32\data\Z\Resource\Plugins\HtiUsbSerialCommEcomPlugin.rsc" - "!:\Resource\Plugins\HtiUsbSerialCommEcomPlugin.rsc"
+"\epoc32\release\armv5\urel\HtiUsbSerialCommEcomPlugin.dll"      - "!:\sys\bin\HtiUsbSerialCommEcomPlugin.dll"
+
+; Test service plug-ins
+"\epoc32\release\armv5\urel\HtiEchoServicePlugin.dll"            - "!:\sys\bin\HtiEchoServicePlugin.dll"
+"\epoc32\data\Z\Resource\Plugins\HtiEchoServicePlugin.rsc"       - "!:\Resource\Plugins\HtiEchoServicePlugin.rsc"
+"\epoc32\release\armv5\urel\HtiKeyEventServicePlugin.dll"        - "!:\sys\bin\HtiKeyEventServicePlugin.dll"
+"\epoc32\data\Z\Resource\Plugins\HtiKeyEventServicePlugin.rsc"   - "!:\Resource\Plugins\HtiKeyEventServicePlugin.rsc"
+"\epoc32\release\armv5\urel\HtiScreenshotServicePlugin.dll"      - "!:\sys\bin\HtiScreenshotServicePlugin.dll"
+"\epoc32\data\Z\Resource\Plugins\HtiScreenshotServicePlugin.rsc" - "!:\Resource\Plugins\HtiScreenshotServicePlugin.rsc"
+"\epoc32\release\armv5\urel\HtiFtpServicePlugin.dll"             - "!:\sys\bin\HtiFtpServicePlugin.dll"
+"\epoc32\data\Z\Resource\Plugins\HtiFtpServicePlugin.rsc"        - "!:\Resource\Plugins\HtiFtpServicePlugin.rsc"
+"\epoc32\release\armv5\urel\HtiAppServicePlugin.dll"             - "!:\sys\bin\HtiAppServicePlugin.dll"
+"\epoc32\data\Z\Resource\Plugins\HtiAppServicePlugin.rsc"        - "!:\Resource\Plugins\HtiAppServicePlugin.rsc"
+"\epoc32\release\armv5\urel\HtiAppControl.dll"                   - "!:\sys\bin\HtiAppControl.dll"
+"\epoc32\release\armv5\urel\HtiStifTfServicePlugin.dll"          - "!:\sys\bin\HtiStifTfServicePlugin.dll"
+"\epoc32\data\Z\Resource\Plugins\HtiStifTfServicePlugin.rsc"     - "!:\Resource\Plugins\HtiStifTfServicePlugin.rsc"
+"\epoc32\release\armv5\urel\HtiSysInfoServicePlugin.dll"         - "!:\sys\bin\HtiSysInfoServicePlugin.dll"
+"\epoc32\data\Z\Resource\Plugins\HtiSysInfoServicePlugin.rsc"    - "!:\Resource\Plugins\HtiSysInfoServicePlugin.rsc"
+"\epoc32\release\armv5\urel\HtiAudioServicePlugin.dll"           - "!:\sys\bin\HtiAudioServicePlugin.dll"
+"\epoc32\data\Z\Resource\Plugins\HtiAudioServicePlugin.rsc"      - "!:\Resource\Plugins\HtiAudioServicePlugin.rsc"
+"\epoc32\release\armv5\urel\HtiMessagesServicePlugin.dll"        - "!:\sys\bin\HtiMessagesServicePlugin.dll"
+"\epoc32\data\Z\Resource\Plugins\HtiMessagesServicePlugin.rsc"   - "!:\Resource\Plugins\HtiMessagesServicePlugin.rsc"
+"\epoc32\release\armv5\urel\HtiPIMServicePlugin.dll"             - "!:\sys\bin\HtiPIMServicePlugin.dll"
+"\epoc32\data\Z\Resource\Plugins\HtiPIMServicePlugin.rsc"        - "!:\Resource\Plugins\HtiPIMServicePlugin.rsc"
+"\epoc32\release\armv5\urel\HtiIpProxyServicePlugin.dll"         - "!:\sys\bin\HtiIpProxyServicePlugin.dll"
+"\epoc32\data\Z\Resource\Plugins\HtiIpProxyServicePlugin.rsc"    - "!:\Resource\Plugins\HtiIpProxyServicePlugin.rsc"
+"\epoc32\release\armv5\urel\HtiCameraServicePlugin.dll"          - "!:\sys\bin\HtiCameraServicePlugin.dll"
+"\epoc32\data\Z\Resource\Plugins\HtiCameraServicePlugin.rsc"     - "!:\Resource\Plugins\HtiCameraServicePlugin.rsc"
+
+; Helper to add notepad memos
+"\epoc32\release\armv5\urel\HtiNpdHlp.exe"                       - "!:\sys\bin\HtiNpdHlp.exe"
+
+; File helper with capability ALL - for file operations to TCB folders
+"\epoc32\release\armv5\urel\HtiFileHlp.exe"                      - "!:\sys\bin\HtiFileHlp.exe"
+
+; Tcb helper with capability ALL - for operations which need TCB capability
+"\epoc32\release\armv5\urel\HtiTcbHlp.exe"                      - "!:\sys\bin\HtiTcbHlp.exe"
+
+; Backup fake DLL used by HtiFtpServicePlugin
+"\epoc32\release\armv5\urel\HtiFtpBackupFake.dll"                - "!:\sys\bin\HtiFtpBackupFake.dll"
+
+; HTI watchdog
+"\epoc32\release\armv5\urel\HtiWatchDog.exe"                     - "!:\sys\bin\HtiWatchDog.exe"
+
+; HTI Restart
+"\epoc32\release\armv5\urel\HtiRestart.exe"                      - "!:\sys\bin\HtiRestart.exe"
+
+; HTI device reboot
+"\epoc32\release\armv5\urel\HtiDeviceRebootUI.exe"               - "!:\sys\bin\HtiDeviceRebootUI.exe"
+
+; HTI Framework
+"\epoc32\release\armv5\urel\HTIFramework.exe"                    - "!:\sys\bin\HTIFramework.exe"
+
+; AutoStart recogniser plug-in
+"\epoc32\release\armv5\urel\HtiAutoStart.dll"                    - "!:\sys\bin\HtiAutoStart.dll"
+"\epoc32\data\Z\Resource\Plugins\HtiAutoStart.rsc"               - "!:\Resource\Plugins\HtiAutoStart.rsc"
+
+; HTI startup wait
+"\epoc32\release\armv5\urel\HtiStartupWait.dll"                  - "!:\sys\bin\HtiStartupWait.dll"
+
+; Startup list resource file for starting HTIFramework.exe in device boot
+;"\epoc32\data\Z\private\101f875a\import\1020deb6.rsc"            - "c:\private\101f875a\import\[1020deb6].rsc"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/sis/HTI_S60_Upgrade-10_1.pkg	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,119 @@
+;
+; 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: Installation file for HTI
+
+
+; Languages
+&EN
+
+; Using UID of HtiFramework project
+#{"HTI"},(0x1020DEB6),2,27,0,TYPE=SA,RU
+
+; Series60 product id for S60 5.2
+[0x20022E6D], 0, 0, 0, {"Series60ProductID"}
+
+; Localised Vendor name
+%{"Nokia"}
+
+; Unique Vendor name
+:"Nokia"
+
+; Install files
+
+; HtiCfg library
+"\epoc32\release\armv5\urel\HtiCfg.dll"                          - "!:\sys\bin\HtiCfg.dll"
+
+; HtiAdmin
+"\epoc32\release\armv5\urel\HtiAdmin.exe"                        - "!:\sys\bin\HtiAdmin.exe"
+"\epoc32\data\Z\Resource\apps\HtiAdmin.rsc"                      - "!:\Resource\Apps\HtiAdmin.rsc"
+"\epoc32\data\Z\private\10003a3f\import\apps\HtiAdmin_reg.rsc"          - "!:\private\10003a3f\import\apps\HtiAdmin_reg.rsc"
+
+; Serial comm module
+"\epoc32\data\Z\Resource\Plugins\HtiSerialCommEcomPlugin.rsc"    - "!:\Resource\Plugins\HtiSerialCommEcomPlugin.rsc"
+"\epoc32\release\armv5\urel\HtiSerialCommEcomPlugin.dll"         - "!:\sys\bin\HtiSerialCommEcomPlugin.dll"
+
+; BtSerial comm module
+"\epoc32\release\armv5\urel\HtiBtSerialComHelper.dll"            - "!:\sys\bin\HtiBtSerialComHelper.dll"
+"\epoc32\release\armv5\urel\HtiBtCommServer.dll"                 - "!:\sys\bin\HtiBtCommServer.dll"
+"\epoc32\release\armv5\urel\HtiBtCommInterface.dll"              - "!:\sys\bin\HtiBtCommInterface.dll"
+"\epoc32\data\Z\Resource\Plugins\HtiBtCommEcomPlugin.rsc"        - "!:\Resource\Plugins\HtiBtCommEcomPlugin.rsc"
+"\epoc32\release\armv5\urel\HtiBtCommEcomPlugin.dll"             - "!:\sys\bin\HtiBtCommEcomPlugin.dll"
+
+; IPComm module
+"\epoc32\release\armv5\urel\HtiIPCommServer.exe"                 - "!:\sys\bin\HtiIPCommServer.exe"
+"\epoc32\release\armv5\urel\HtiIPCommServerClient.dll"           - "!:\sys\bin\HtiIPCommServerClient.dll"
+"\epoc32\data\Z\Resource\Plugins\HtiIPCommEcomPlugin.rsc"        - "!:\Resource\Plugins\HtiIPCommEcomPlugin.rsc"
+"\epoc32\release\armv5\urel\HtiIPCommEcomPlugin.dll"             - "!:\sys\bin\HtiIPCommEcomPlugin.dll"
+
+; USB serial comm module
+"\epoc32\data\Z\Resource\Plugins\HtiUsbSerialCommEcomPlugin.rsc" - "!:\Resource\Plugins\HtiUsbSerialCommEcomPlugin.rsc"
+"\epoc32\release\armv5\urel\HtiUsbSerialCommEcomPlugin.dll"      - "!:\sys\bin\HtiUsbSerialCommEcomPlugin.dll"
+
+; Test service plug-ins
+"\epoc32\release\armv5\urel\HtiEchoServicePlugin.dll"            - "!:\sys\bin\HtiEchoServicePlugin.dll"
+"\epoc32\data\Z\Resource\Plugins\HtiEchoServicePlugin.rsc"       - "!:\Resource\Plugins\HtiEchoServicePlugin.rsc"
+"\epoc32\release\armv5\urel\HtiKeyEventServicePlugin.dll"        - "!:\sys\bin\HtiKeyEventServicePlugin.dll"
+"\epoc32\data\Z\Resource\Plugins\HtiKeyEventServicePlugin.rsc"   - "!:\Resource\Plugins\HtiKeyEventServicePlugin.rsc"
+"\epoc32\release\armv5\urel\HtiScreenshotServicePlugin.dll"      - "!:\sys\bin\HtiScreenshotServicePlugin.dll"
+"\epoc32\data\Z\Resource\Plugins\HtiScreenshotServicePlugin.rsc" - "!:\Resource\Plugins\HtiScreenshotServicePlugin.rsc"
+"\epoc32\release\armv5\urel\HtiFtpServicePlugin.dll"             - "!:\sys\bin\HtiFtpServicePlugin.dll"
+"\epoc32\data\Z\Resource\Plugins\HtiFtpServicePlugin.rsc"        - "!:\Resource\Plugins\HtiFtpServicePlugin.rsc"
+"\epoc32\release\armv5\urel\HtiAppServicePlugin.dll"             - "!:\sys\bin\HtiAppServicePlugin.dll"
+"\epoc32\data\Z\Resource\Plugins\HtiAppServicePlugin.rsc"        - "!:\Resource\Plugins\HtiAppServicePlugin.rsc"
+"\epoc32\release\armv5\urel\HtiAppControl.dll"                   - "!:\sys\bin\HtiAppControl.dll"
+"\epoc32\release\armv5\urel\HtiStifTfServicePlugin.dll"          - "!:\sys\bin\HtiStifTfServicePlugin.dll"
+"\epoc32\data\Z\Resource\Plugins\HtiStifTfServicePlugin.rsc"     - "!:\Resource\Plugins\HtiStifTfServicePlugin.rsc"
+"\epoc32\release\armv5\urel\HtiSysInfoServicePlugin.dll"         - "!:\sys\bin\HtiSysInfoServicePlugin.dll"
+"\epoc32\data\Z\Resource\Plugins\HtiSysInfoServicePlugin.rsc"    - "!:\Resource\Plugins\HtiSysInfoServicePlugin.rsc"
+"\epoc32\release\armv5\urel\HtiAudioServicePlugin.dll"           - "!:\sys\bin\HtiAudioServicePlugin.dll"
+"\epoc32\data\Z\Resource\Plugins\HtiAudioServicePlugin.rsc"      - "!:\Resource\Plugins\HtiAudioServicePlugin.rsc"
+"\epoc32\release\armv5\urel\HtiMessagesServicePlugin.dll"        - "!:\sys\bin\HtiMessagesServicePlugin.dll"
+"\epoc32\data\Z\Resource\Plugins\HtiMessagesServicePlugin.rsc"   - "!:\Resource\Plugins\HtiMessagesServicePlugin.rsc"
+"\epoc32\release\armv5\urel\HtiPIMServicePlugin.dll"             - "!:\sys\bin\HtiPIMServicePlugin.dll"
+"\epoc32\data\Z\Resource\Plugins\HtiPIMServicePlugin.rsc"        - "!:\Resource\Plugins\HtiPIMServicePlugin.rsc"
+"\epoc32\release\armv5\urel\HtiIpProxyServicePlugin.dll"         - "!:\sys\bin\HtiIpProxyServicePlugin.dll"
+"\epoc32\data\Z\Resource\Plugins\HtiIpProxyServicePlugin.rsc"    - "!:\Resource\Plugins\HtiIpProxyServicePlugin.rsc"
+"\epoc32\release\armv5\urel\HtiCameraServicePlugin.dll"          - "!:\sys\bin\HtiCameraServicePlugin.dll"
+"\epoc32\data\Z\Resource\Plugins\HtiCameraServicePlugin.rsc"     - "!:\Resource\Plugins\HtiCameraServicePlugin.rsc"
+
+; File helper with capability ALL - for file operations to TCB folders
+"\epoc32\release\armv5\urel\HtiFileHlp.exe"                      - "!:\sys\bin\HtiFileHlp.exe"
+
+; Tcb helper with capability ALL - for operations which need TCB capability
+"\epoc32\release\armv5\urel\HtiTcbHlp.exe"                       - "!:\sys\bin\HtiTcbHlp.exe"
+
+; Backup fake DLL used by HtiFtpServicePlugin
+"\epoc32\release\armv5\urel\HtiFtpBackupFake.dll"                - "!:\sys\bin\HtiFtpBackupFake.dll"
+
+; HTI watchdog
+"\epoc32\release\armv5\urel\HtiWatchDog.exe"                     - "!:\sys\bin\HtiWatchDog.exe"
+
+; HTI Restart
+"\epoc32\release\armv5\urel\HtiRestart.exe"                      - "!:\sys\bin\HtiRestart.exe"
+
+; HTI device reboot
+"\epoc32\release\armv5\urel\HtiDeviceRebootUI.exe"               - "!:\sys\bin\HtiDeviceRebootUI.exe"
+
+; HTI Framework
+"\epoc32\release\armv5\urel\HTIFramework.exe"                    - "!:\sys\bin\HTIFramework.exe"
+
+; AutoStart recogniser plug-in
+"\epoc32\release\armv5\urel\HtiAutoStart.dll"                    - "!:\sys\bin\HtiAutoStart.dll"
+"\epoc32\data\Z\Resource\Plugins\HtiAutoStart.rsc"               - "!:\Resource\Plugins\HtiAutoStart.rsc"
+
+; HTI startup wait
+"\epoc32\release\armv5\urel\HtiStartupWait.dll"                  - "!:\sys\bin\HtiStartupWait.dll"
+
+; Startup list resource file for starting HTIFramework.exe in device boot
+;"\epoc32\data\Z\private\101f875a\import\1020deb6.rsc"            - "c:\private\101f875a\import\[1020deb6].rsc"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/sis/HTI_S60_Upgrade-52.pkg	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,122 @@
+;
+; 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: Installation file for HTI
+
+
+; Languages
+&EN
+
+; Using UID of HtiFramework project
+#{"HTI"},(0x1020DEB6),2,27,0,TYPE=SA,RU
+
+; Series60 product id for S60 5.2
+[0x20022E6D], 0, 0, 0, {"Series60ProductID"}
+
+; Localised Vendor name
+%{"Nokia"}
+
+; Unique Vendor name
+:"Nokia"
+
+; Install files
+
+; HtiCfg library
+"\epoc32\release\armv5\urel\HtiCfg.dll"                          - "!:\sys\bin\HtiCfg.dll"
+
+; HtiAdmin
+"\epoc32\release\armv5\urel\HtiAdmin.exe"                        - "!:\sys\bin\HtiAdmin.exe"
+"\epoc32\data\Z\Resource\apps\HtiAdmin.rsc"                      - "!:\Resource\Apps\HtiAdmin.rsc"
+"\epoc32\data\Z\private\10003a3f\apps\HtiAdmin_reg.rsc"          - "!:\private\10003a3f\import\apps\HtiAdmin_reg.rsc"
+
+; Serial comm module
+"\epoc32\data\Z\Resource\Plugins\HtiSerialCommEcomPlugin.rsc"    - "!:\Resource\Plugins\HtiSerialCommEcomPlugin.rsc"
+"\epoc32\release\armv5\urel\HtiSerialCommEcomPlugin.dll"         - "!:\sys\bin\HtiSerialCommEcomPlugin.dll"
+
+; BtSerial comm module
+"\epoc32\release\armv5\urel\HtiBtSerialComHelper.dll"            - "!:\sys\bin\HtiBtSerialComHelper.dll"
+"\epoc32\release\armv5\urel\HtiBtCommServer.dll"                 - "!:\sys\bin\HtiBtCommServer.dll"
+"\epoc32\release\armv5\urel\HtiBtCommInterface.dll"              - "!:\sys\bin\HtiBtCommInterface.dll"
+"\epoc32\data\Z\Resource\Plugins\HtiBtCommEcomPlugin.rsc"        - "!:\Resource\Plugins\HtiBtCommEcomPlugin.rsc"
+"\epoc32\release\armv5\urel\HtiBtCommEcomPlugin.dll"             - "!:\sys\bin\HtiBtCommEcomPlugin.dll"
+
+; IPComm module
+"\epoc32\release\armv5\urel\HtiIPCommServer.exe"                 - "!:\sys\bin\HtiIPCommServer.exe"
+"\epoc32\release\armv5\urel\HtiIPCommServerClient.dll"           - "!:\sys\bin\HtiIPCommServerClient.dll"
+"\epoc32\data\Z\Resource\Plugins\HtiIPCommEcomPlugin.rsc"        - "!:\Resource\Plugins\HtiIPCommEcomPlugin.rsc"
+"\epoc32\release\armv5\urel\HtiIPCommEcomPlugin.dll"             - "!:\sys\bin\HtiIPCommEcomPlugin.dll"
+
+; USB serial comm module
+"\epoc32\data\Z\Resource\Plugins\HtiUsbSerialCommEcomPlugin.rsc" - "!:\Resource\Plugins\HtiUsbSerialCommEcomPlugin.rsc"
+"\epoc32\release\armv5\urel\HtiUsbSerialCommEcomPlugin.dll"      - "!:\sys\bin\HtiUsbSerialCommEcomPlugin.dll"
+
+; Test service plug-ins
+"\epoc32\release\armv5\urel\HtiEchoServicePlugin.dll"            - "!:\sys\bin\HtiEchoServicePlugin.dll"
+"\epoc32\data\Z\Resource\Plugins\HtiEchoServicePlugin.rsc"       - "!:\Resource\Plugins\HtiEchoServicePlugin.rsc"
+"\epoc32\release\armv5\urel\HtiKeyEventServicePlugin.dll"        - "!:\sys\bin\HtiKeyEventServicePlugin.dll"
+"\epoc32\data\Z\Resource\Plugins\HtiKeyEventServicePlugin.rsc"   - "!:\Resource\Plugins\HtiKeyEventServicePlugin.rsc"
+"\epoc32\release\armv5\urel\HtiScreenshotServicePlugin.dll"      - "!:\sys\bin\HtiScreenshotServicePlugin.dll"
+"\epoc32\data\Z\Resource\Plugins\HtiScreenshotServicePlugin.rsc" - "!:\Resource\Plugins\HtiScreenshotServicePlugin.rsc"
+"\epoc32\release\armv5\urel\HtiFtpServicePlugin.dll"             - "!:\sys\bin\HtiFtpServicePlugin.dll"
+"\epoc32\data\Z\Resource\Plugins\HtiFtpServicePlugin.rsc"        - "!:\Resource\Plugins\HtiFtpServicePlugin.rsc"
+"\epoc32\release\armv5\urel\HtiAppServicePlugin.dll"             - "!:\sys\bin\HtiAppServicePlugin.dll"
+"\epoc32\data\Z\Resource\Plugins\HtiAppServicePlugin.rsc"        - "!:\Resource\Plugins\HtiAppServicePlugin.rsc"
+"\epoc32\release\armv5\urel\HtiAppControl.dll"                   - "!:\sys\bin\HtiAppControl.dll"
+"\epoc32\release\armv5\urel\HtiStifTfServicePlugin.dll"          - "!:\sys\bin\HtiStifTfServicePlugin.dll"
+"\epoc32\data\Z\Resource\Plugins\HtiStifTfServicePlugin.rsc"     - "!:\Resource\Plugins\HtiStifTfServicePlugin.rsc"
+"\epoc32\release\armv5\urel\HtiSysInfoServicePlugin.dll"         - "!:\sys\bin\HtiSysInfoServicePlugin.dll"
+"\epoc32\data\Z\Resource\Plugins\HtiSysInfoServicePlugin.rsc"    - "!:\Resource\Plugins\HtiSysInfoServicePlugin.rsc"
+"\epoc32\release\armv5\urel\HtiAudioServicePlugin.dll"           - "!:\sys\bin\HtiAudioServicePlugin.dll"
+"\epoc32\data\Z\Resource\Plugins\HtiAudioServicePlugin.rsc"      - "!:\Resource\Plugins\HtiAudioServicePlugin.rsc"
+"\epoc32\release\armv5\urel\HtiMessagesServicePlugin.dll"        - "!:\sys\bin\HtiMessagesServicePlugin.dll"
+"\epoc32\data\Z\Resource\Plugins\HtiMessagesServicePlugin.rsc"   - "!:\Resource\Plugins\HtiMessagesServicePlugin.rsc"
+"\epoc32\release\armv5\urel\HtiPIMServicePlugin.dll"             - "!:\sys\bin\HtiPIMServicePlugin.dll"
+"\epoc32\data\Z\Resource\Plugins\HtiPIMServicePlugin.rsc"        - "!:\Resource\Plugins\HtiPIMServicePlugin.rsc"
+"\epoc32\release\armv5\urel\HtiIpProxyServicePlugin.dll"         - "!:\sys\bin\HtiIpProxyServicePlugin.dll"
+"\epoc32\data\Z\Resource\Plugins\HtiIpProxyServicePlugin.rsc"    - "!:\Resource\Plugins\HtiIpProxyServicePlugin.rsc"
+"\epoc32\release\armv5\urel\HtiCameraServicePlugin.dll"          - "!:\sys\bin\HtiCameraServicePlugin.dll"
+"\epoc32\data\Z\Resource\Plugins\HtiCameraServicePlugin.rsc"     - "!:\Resource\Plugins\HtiCameraServicePlugin.rsc"
+
+; Helper to add notepad memos
+"\epoc32\release\armv5\urel\HtiNpdHlp.exe"                       - "!:\sys\bin\HtiNpdHlp.exe"
+
+; File helper with capability ALL - for file operations to TCB folders
+"\epoc32\release\armv5\urel\HtiFileHlp.exe"                      - "!:\sys\bin\HtiFileHlp.exe"
+
+; Tcb helper with capability ALL - for operations which need TCB capability
+"\epoc32\release\armv5\urel\HtiTcbHlp.exe"                       - "!:\sys\bin\HtiTcbHlp.exe"
+
+; Backup fake DLL used by HtiFtpServicePlugin
+"\epoc32\release\armv5\urel\HtiFtpBackupFake.dll"                - "!:\sys\bin\HtiFtpBackupFake.dll"
+
+; HTI watchdog
+"\epoc32\release\armv5\urel\HtiWatchDog.exe"                     - "!:\sys\bin\HtiWatchDog.exe"
+
+; HTI Restart
+"\epoc32\release\armv5\urel\HtiRestart.exe"                      - "!:\sys\bin\HtiRestart.exe"
+
+; HTI device reboot
+"\epoc32\release\armv5\urel\HtiDeviceRebootUI.exe"               - "!:\sys\bin\HtiDeviceRebootUI.exe"
+
+; HTI Framework
+"\epoc32\release\armv5\urel\HTIFramework.exe"                    - "!:\sys\bin\HTIFramework.exe"
+
+; AutoStart recogniser plug-in
+"\epoc32\release\armv5\urel\HtiAutoStart.dll"                    - "!:\sys\bin\HtiAutoStart.dll"
+"\epoc32\data\Z\Resource\Plugins\HtiAutoStart.rsc"               - "!:\Resource\Plugins\HtiAutoStart.rsc"
+
+; HTI startup wait
+"\epoc32\release\armv5\urel\HtiStartupWait.dll"                  - "!:\sys\bin\HtiStartupWait.dll"
+
+; Startup list resource file for starting HTIFramework.exe in device boot
+;"\epoc32\data\Z\private\101f875a\import\1020deb6.rsc"            - "c:\private\101f875a\import\[1020deb6].rsc"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/sis/HTI_stub.pkg	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,116 @@
+;
+; 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: Installation file for HTI stub SIS
+
+
+; Languages
+&EN
+
+; Using UID of HtiFramework project
+#{"HTI"},(0x1020DEB6),2,27,0
+
+; Localised Vendor name
+%{"Nokia"}
+
+; Unique Vendor name
+:"Nokia"
+
+; Install files
+
+; HtiCfg library
+""- "z:\sys\bin\HtiCfg.dll"
+
+; HtiAdmin
+""- "z:\sys\bin\HtiAdmin.exe"
+""- "z:\Resource\Apps\HtiAdmin.rsc"
+""- "z:\private\10003a3f\import\apps\HtiAdmin_reg.rsc"
+
+; Serial comm module
+""- "z:\Resource\Plugins\HtiSerialCommEcomPlugin.rsc"
+""- "z:\sys\bin\HtiSerialCommEcomPlugin.dll"
+
+; BtSerial comm module
+""- "z:\sys\bin\HtiBtSerialComHelper.dll"
+""- "z:\sys\bin\HtiBtCommServer.dll"
+""- "z:\sys\bin\HtiBtCommInterface.dll"
+""- "z:\Resource\Plugins\HtiBtCommEcomPlugin.rsc"
+""- "z:\sys\bin\HtiBtCommEcomPlugin.dll"
+
+; IPComm module
+""- "z:\sys\bin\HtiIPCommServer.exe"
+""- "z:\sys\bin\HtiIPCommServerClient.dll"
+""- "z:\Resource\Plugins\HtiIPCommEcomPlugin.rsc"
+""- "z:\sys\bin\HtiIPCommEcomPlugin.dll"
+
+; USB serial comm module
+""- "z:\Resource\Plugins\HtiUsbSerialCommEcomPlugin.rsc"
+""- "z:\sys\bin\HtiUsbSerialCommEcomPlugin.dll"
+
+; Test service plug-ins
+""- "z:\sys\bin\HtiEchoServicePlugin.dll"
+""- "z:\Resource\Plugins\HtiEchoServicePlugin.rsc"
+""- "z:\sys\bin\HtiKeyEventServicePlugin.dll"
+""- "z:\Resource\Plugins\HtiKeyEventServicePlugin.rsc"
+""- "z:\sys\bin\HtiScreenshotServicePlugin.dll"
+""- "z:\Resource\Plugins\HtiScreenshotServicePlugin.rsc"
+""- "z:\sys\bin\HtiFtpServicePlugin.dll"
+""- "z:\Resource\Plugins\HtiFtpServicePlugin.rsc"
+""- "z:\sys\bin\HtiAppServicePlugin.dll"
+""- "z:\Resource\Plugins\HtiAppServicePlugin.rsc"
+""- "z:\sys\bin\HtiAppControl.dll"
+""- "z:\sys\bin\HtiStifTfServicePlugin.dll"
+""- "z:\Resource\Plugins\HtiStifTfServicePlugin.rsc"
+""- "z:\sys\bin\HtiSysInfoServicePlugin.dll"
+""- "z:\Resource\Plugins\HtiSysInfoServicePlugin.rsc"
+""- "z:\sys\bin\HtiAudioServicePlugin.dll"
+""- "z:\Resource\Plugins\HtiAudioServicePlugin.rsc"
+""- "z:\sys\bin\HtiMessagesServicePlugin.dll"
+""- "z:\Resource\Plugins\HtiMessagesServicePlugin.rsc"
+""- "z:\sys\bin\HtiPIMServicePlugin.dll"
+""- "z:\Resource\Plugins\HtiPIMServicePlugin.rsc"
+""- "z:\sys\bin\HtiIpProxyServicePlugin.dll"
+""- "z:\Resource\Plugins\HtiIpProxyServicePlugin.rsc"
+""- "z:\sys\bin\HtiCameraServicePlugin.dll"
+""- "z:\Resource\Plugins\HtiCameraServicePlugin.rsc"
+
+; Helper to add notepad memos
+""- "z:\sys\bin\HtiNpdHlp.exe"
+
+; File helper with capability ALL - for file operations to TCB folders
+""- "z:\sys\bin\HtiFileHlp.exe"
+
+; Tcb helper with capability ALL - for operations which need TCB capability
+""- "z:\sys\bin\HtiTcbHlp.exe"
+
+; Backup fake DLL used by HtiFtpServicePlugin
+""- "z:\sys\bin\HtiFtpBackupFake.dll"
+
+; HTI watchdog
+""- "z:\sys\bin\HtiWatchDog.exe"
+
+; HTI Restart
+""- "z:\sys\bin\HtiRestart.exe"
+
+; HTI device reboot
+""- "z:\sys\bin\HtiDeviceRebootUI.exe"
+
+; HTI Framework
+""- "z:\sys\bin\HtiFramework.exe"
+
+; AutoStart recogniser plug-in
+""- "z:\sys\bin\HtiAutoStart.dll"
+""- "z:\Resource\Plugins\HtiAutoStart.rsc"
+
+; HTI startup wait
+""- "z:\sys\bin\HtiStartupWait.dll"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/symbian_version.hrh	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,43 @@
+/*
+* 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: Symbian version configuration file 
+*
+*/
+
+#ifndef __SYMBIAN_VERSION_HRH
+#define __SYMBIAN_VERSION_HRH
+
+// S60 and Symbian version number enumeration definitions
+
+#define S60_30                                              30
+#define S60_31                                              31
+#define S60_32                                              32
+#define S60_50                                              50
+#define S60_51                                              91
+#define S60_52                                              92
+#define SYMBIAN_1                                           50
+#define SYMBIAN_2                                           91
+#define SYMBIAN_3                                           92
+#define SYMBIAN_4                                           101
+
+
+/**
+ * Defines the S60 or Symbian version used by this component. This flag can be
+ * used to variate the source code based on the SDK in use. The value of the
+ * flag should be always changed to reflect the current build environment.
+ */
+#define SYMBIAN_VERSION_SUPPORT                              SYMBIAN_3
+
+
+#endif  // __SYMBIAN_VERSION_HRH
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/layers.sysdef.xml	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,17 @@
+<?xml version="1.0"?>
+<!DOCTYPE SystemDefinition SYSTEM "sysdef_1_4_0.dtd" [
+  <!ENTITY layer_real_source_path "sf/app/testtools" >
+]>
+
+<SystemDefinition name="testtools" schema="1.4.0">
+  <systemModel>
+    <layer name="app_layer">
+      <module name="htiui">
+        <unit unitID="testtools.htiui" mrp="" bldFile="&layer_real_source_path;/htiui/group" name="htiui" />
+      </module>
+      <module name="stifui">
+        <unit unitID="testtools.stifui" mrp="" bldFile="&layer_real_source_path;/stifui/avkon/group" name="stifui" />
+      </module>
+    </layer>
+  </systemModel>
+</SystemDefinition>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/avkon/group/ReleaseNote.txt	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,47 @@
+========================================================================
+RELEASE NOTE FOR STIF UI - STIF_201028 (7.3.37)
+SUPPORTING SERIES 60 3.0 ->
+========================================================================
+
+Product Description:
+====================
+STIF UI is Series 60 UI application for STIF project.
+STIF is a test harness for testing Symbian & S60 non-UI components.
+This widely used test framework can be used for both test case implementation and test cases execution.
+
+Features :
+=========
+- Easy to use
+- Multiple test cases can be executed concurrently.
+
+
+Enhancements:
+=============
+N/A
+
+
+New Features:
+=============
+N/A
+
+
+System Requirements:
+====================
+Basic Requirements:
+- S60/Symbian OS development environment installed 
+
+- stif project needs to be compiled/installed before stifui can be used
+
+
+Compatibility Issues:
+=====================
+N/A 
+
+Known Issues:
+===========
+If problems with compilation appears (missing platform_paths.hrh file error message), 
+please use EnvPatcher.pl script from stif/envpatcher folder to fix environment. 
+
+
+Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+All rights reserved.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/avkon/group/bld.inf	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,46 @@
+/*
+* 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: bld.inf Toplevel build information for STIF UI
+*
+*/
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+// Specify the platforms your component needs to be built for here.
+// If not specified all platforms can be built.
+
+// Note that if you want to build STIF to GCCE platform, GCCE must be
+// specified separately - it is not part of default platforms.
+// DEFAULT GCCE
+
+	DEFAULT
+
+
+PRJ_EXPORTS
+// This is added in order to export iby files automaticly in 5.0 env
+	../rom/Stifui.iby     CORE_IBY_EXPORT_PATH(tools,Stifui.iby)
+
+PRJ_TESTEXPORTS
+
+PRJ_MMPFILES
+	// StifUI
+	#include "../stifui/group/bld.inf"
+
+	// UiTestServerStarter
+	#include "../uitestserverstarter/group/bld.inf"
+
+
+// End of File
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/avkon/rom/Stifui.iby	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,47 @@
+/*
+* 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: Stifui.iby file specifies needed STIF and STIF UI 
+* and UITetsServerstarter components for ROM image
+*
+*/
+
+#ifndef __STIF_UI_IBY__
+#define __STIF_UI_IBY__
+
+S60_APP_EXE(Stifui)
+
+#ifdef S60_UPGRADABLE_APP_REG_RSC
+  S60_UPGRADABLE_APP_REG_RSC(Stifui)
+#else
+  S60_APP_AIF_RSC(Stifui)
+#endif
+
+S60_APP_RESOURCE(Stifui)
+
+S60_APP_EXE(UITestServerStarter)
+
+#ifdef S60_UPGRADABLE_APP_REG_RSC
+  S60_UPGRADABLE_APP_REG_RSC(UITestServerStarter)
+#else
+  S60_APP_AIF_RSC(UITestServerStarter)
+#endif
+
+
+S60_APP_RESOURCE(UITestServerStarter)
+
+// Note: before creating image, copy Stifui_31_Stub.sis from \stifui\sis\ to \epoc32\data\Z\system\install\
+data=ZSYSTEM\install\Stifui_31_Stub.sis    System\Install\Stifui_31_Stub.sis
+
+#endif
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/avkon/sis/Stifui.pkg	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,67 @@
+;
+; 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: Installation file for STIF UI
+;
+
+; Languages
+&EN
+
+; Package header, uid is the Stifui's uid
+#{"STIF UI"},(0x1028311D),0,1,0,TYPE=SA
+
+; Series60 product id for S60 3.0
+[0x101F7961], 0, 0, 0, {"Series60ProductID"}
+
+; Localised Vendor name
+%{"Nokia"}
+
+; Unique Vendor name
+:"Nokia"
+
+; Logo
+; None
+
+; Package signature - Optional
+; None
+
+; Start of Package body
+
+; Condition blocks
+; None
+
+; Options list
+; None
+
+; Install files
+
+   ;// Note: STIF needs to be installed before STIF UI can be used
+
+  "\epoc32\release\armv5\udeb\Stifui.exe"-"!:\Sys\Bin\Stifui.exe"
+  "\epoc32\data\z\private\10003a3f\apps\Stifui_reg.rsc"-"!:\Private\10003a3f\import\apps\Stifui_reg.rsc"
+  "\epoc32\data\z\Resource\apps\Stifui.rsc"-"!:\Resource\apps\Stifui.rsc"
+
+  "\epoc32\release\armv5\udeb\UITestServerStarter.exe"-"!:\Sys\Bin\UITestServerStarter.exe"
+  "\epoc32\data\z\private\10003a3f\apps\UITestServerStarter_reg.rsc"-"!:\Private\10003a3f\import\apps\UITestServerStarter_reg.rsc"
+  "\epoc32\data\z\Resource\apps\UITestServerStarter.rsc"-"!:\Resource\apps\UITestServerStarter.rsc"  
+
+; Embedded SIS 
+; None
+
+; End of Package body
+
+; PKG dependencies
+; None
+
+; PKG capabilities
+; None
\ No newline at end of file
Binary file stifui/avkon/sis/Stifui_31.sis has changed
Binary file stifui/avkon/sis/Stifui_31_Stub.SIS has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/avkon/stifui/data/Stifui.rss	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,2057 @@
+/*
+* 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 file defines StifUI resources.
+*
+*/
+
+//	RESOURCE IDENTIFIER
+NAME	STIF // 4 letter ID
+
+//	INCLUDES
+
+#include <eikon.rh>
+#include "Stifui.hrh"
+#include "Stifui_loc.hrh"
+#include <avkon.rsg>
+#include <avkon.rh>
+#include <avkon.mbg>
+#include <avkon.hrh>
+#include <CommonDialogs.hrh> // Enumerations of memory selection, file selection, save etc dialogs
+#include <CommonDialogs.rh> // Resource structures of memory selection, file selection, save etc dialogs
+#if defined (__S60_)
+    #include <data_caging_paths_strings.hrh>
+#endif
+#include <appinfo.rh>
+
+//	CONSTANTS  
+
+
+//	MACROS	
+
+
+//	RESOURCE DEFINITIONS 
+
+RESOURCE RSS_SIGNATURE { }
+
+RESOURCE TBUF { buf="STIF UI"; }
+
+RESOURCE EIK_APP_INFO
+	{
+	status_pane = r_appui_status_pane;
+	}
+
+STRUCT STRING 
+    { 
+	BUF text;
+    }
+
+
+//  RESOURCE DEFINITIONS 
+//-----------------------------------------------------------------------------
+//	 
+// r_appui_hotkeys
+// ?description
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE HOTKEYS r_appui_hotkeys
+	{
+	control=
+		{
+		HOTKEY { command=EAknCmdExit; key='e'; }
+		};
+	}
+
+
+// APPUI
+//-----------------------------------------------------------------------------
+//	 
+//	  r_appui_status_pane
+//	  Applications status panel.
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE STATUS_PANE_APP_MODEL r_appui_status_pane
+	{
+	panes=
+		{
+		//SPANE_PANE
+		//	{
+		//	id = EEikStatusPaneUidNavi;
+		//	//type = EEikCtLabel;
+		//	//type = EAknCtTitlePane;
+		//	type = EAknCtNaviPane;
+		//	//resource = r_appui_statuspane_text;
+		//	resource = r_appui_navi_decorator;
+		//	},
+		SPANE_PANE
+			{
+			id = EEikStatusPaneUidTitle;
+			type = EAknCtTitlePane;
+			resource = r_appui_overriden_app_name;
+			}
+		//SPANE_PANE
+		//	{
+		//	id = EEikStatusPaneUidContext;
+		//	type = EAknCtContextPane;
+		//	resource = ;
+		//	}
+		};
+	}
+
+//-----------------------------------------------------------------------------
+//	 
+//	  r_appui_status_pane
+//	  Status panel text.
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE LABEL r_appui_statuspane_text
+    {
+    txt = "STIF UI";
+    }
+
+//-----------------------------------------------------------------------------
+//	 
+//	  r_appui_overriden_app_name
+//	  Application name.
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE TITLE_PANE r_appui_overriden_app_name
+	{
+	txt = qtn_app_caption_string;
+	}
+
+//-----------------------------------------------------------------------------
+//	 
+//	  r_appui_navi_decorator
+//	  ?description
+//
+//-----------------------------------------------------------------------------
+//
+/*
+RESOURCE NAVI_DECORATOR r_appui_navi_decorator
+	{
+	type = ENaviDecoratorControlTabGroup;
+	control = TAB_GROUP
+		{
+		tab_width = EAknTabWidthWithTwoTabs;  // two tabs
+		active = 0;
+		tabs = {
+			TAB
+				{
+				id = ETestCaseMenuTab; // from application hrh
+				txt = qtn_testcase_menu_tab;
+				},
+			TAB
+				{
+				id = ETestModulesMenuTab; // from application hrh
+				txt = qtn_testmodules_menu_tab;
+				},
+			TAB
+				{
+				id = ETestSetsMenuTab; // from application hrh
+				txt = qtn_testsets_menu_tab;
+				}
+			};
+		};
+	}
+*/
+
+// MAIN MENU
+//-----------------------------------------------------------------------------
+//	 
+//	  r_appui_mainmenuview
+//	  Mainmenu view.
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE AVKON_VIEW r_appui_mainmenuview
+	{
+	menubar=r_appui_menubar_mainmenuview;  
+	cba=R_AVKON_SOFTKEYS_OPTIONS_EXIT;
+	}
+
+//-----------------------------------------------------------------------------
+//	 
+//	  r_appui_menubar_mainmenuview
+//	  Main menu menubar.
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE MENU_BAR r_appui_menubar_mainmenuview
+	{
+	titles=
+		{
+		MENU_TITLE 
+				{ 
+				menu_pane=r_appui_mainmenuview_menu;
+				}
+		};
+	}
+
+//-----------------------------------------------------------------------------
+//	 
+//	  r_appui_mainmenuview_menu
+//	  Main menu options menu.
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE MENU_PANE r_appui_mainmenuview_menu
+	{
+	items=
+		{
+		MENU_ITEM 
+				{ 
+				command= EAknCmdOpen; 
+				txt = "Open"; 
+				},
+			MENU_ITEM
+				{
+				command = ECmdShowAbout;
+				txt = "About";
+				},
+        	MENU_ITEM 
+				{
+				command = EAknSoftkeyExit;   
+				txt = "Exit";
+				}
+		};
+	}
+
+//-----------------------------------------------------------------------------
+//
+//	  r_main_menu_listbox
+//	  ListBox( Single )
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE LISTBOX r_main_menu_listbox
+	{
+	array_id = r_main_menu_items;
+	flags = EAknListBoxSelectionList;
+	}
+
+//-----------------------------------------------------------------------------
+//
+//	  r_main_menu_items
+//	  Items array for Main Menu
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE ARRAY r_main_menu_items
+	{
+	items =
+		{
+		LBUF
+			{
+			txt = qtn_mainmenulist_test_cases;
+			},
+		LBUF
+			{
+			txt = qtn_mainmenulist_modules;
+			},
+		LBUF
+			{
+			txt = qtn_mainmenulist_test_sets;
+			}
+		};
+	}
+
+
+
+// TEST CASES MENU
+//-----------------------------------------------------------------------------
+//	 
+//	  r_appui_testcasemenuview
+//	  Test case menu view.
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE AVKON_VIEW r_appui_testcasemenuview
+	{
+	menubar=r_appui_menubar_testcasemenuview;
+	cba=R_AVKON_SOFTKEYS_OPTIONS_BACK;
+	}
+
+//-----------------------------------------------------------------------------
+//	 
+//	  r_appui_menubar_testcasemenuview
+//	  Test case view menubar.
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE MENU_BAR r_appui_menubar_testcasemenuview
+	  {
+	titles=
+		{
+		MENU_TITLE 
+				{ 
+				menu_pane=r_appui_testcasemenuview_menu;
+				}
+		};
+
+	  }
+
+//-----------------------------------------------------------------------------
+//	 
+//	  r_appui_testcasemenuview_menu
+//	  Testcase view options menu.
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE MENU_PANE r_appui_testcasemenuview_menu
+	{
+	items=
+		{
+		MENU_ITEM 
+				{ 
+				command= EAknCmdOpen; 
+				txt = "Open"; 
+				},
+        	MENU_ITEM 
+				{
+				command = EAknSoftkeyExit;   
+				txt = "Exit";
+				}
+		};
+	}
+
+//-----------------------------------------------------------------------------
+//
+//	  r_testcase_menu_listbox
+//	  ListBox( Single )
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE LISTBOX r_testcase_menu_listbox
+	{
+	array_id = r_testcase_menu_items;
+	flags = EAknListBoxSelectionList;
+	}
+
+//-----------------------------------------------------------------------------
+//
+//	  r_testcase_menu_items
+//	  Items array for Test Case Menu
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE ARRAY r_testcase_menu_items
+	{
+	items =
+		{
+		LBUF
+			{
+			txt = qtn_testcasemenu_startcase; // "\tStart Case(s)";
+			},
+		LBUF
+			{
+			txt = qtn_testcasemenu_startedcases; // "\tStarted Cases";
+			}
+		};
+	}
+
+
+
+// START CASES
+//-----------------------------------------------------------------------------
+//	 
+//	  r_appui_startcasesview
+//	  Startcases view.
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE AVKON_VIEW r_appui_startcasesview
+	{
+	hotkeys=r_appui_hotkeys;
+	menubar=r_appui_menubar_startcasesview;  
+	cba=R_AVKON_SOFTKEYS_OPTIONS_BACK;	  
+	}
+
+//-----------------------------------------------------------------------------
+//	 
+//	  r_appui_menubar_startcasesview
+//	  Startcases view menubar.
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE MENU_BAR r_appui_menubar_startcasesview
+	{
+	titles=
+		{
+		MENU_TITLE 
+				{ 
+				menu_pane=r_appui_startcasesview_menu;
+				//menu_pane=R_AVKON_MENUPANE_MARKABLE_LIST;
+				}
+		};
+	}
+
+//-----------------------------------------------------------------------------
+//	 
+//	  r_appui_loadtestsetview_menu
+//	  loadtestset view options menu.
+//
+//-----------------------------------------------------------------------------
+RESOURCE MENU_PANE r_appui_loadtestsetview_menu
+	{
+	items= 
+		{
+		MENU_ITEM 
+			{ 
+			command=EAknCmdOpen; 
+			txt = qtn_start; 
+			},
+		MENU_ITEM 
+			{ 
+			command=EEikCmdExit; 
+			txt = qtn_exit; 
+			}
+		};
+	}
+//-----------------------------------------------------------------------------
+//	 
+//	  r_appui_loadtestsetview
+//	  Started cases view.
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE AVKON_VIEW r_appui_loadtestsetview
+	{
+	//hotkeys=r_appui_hotkeys;
+	menubar=r_appui_menubar_startedcasesmenuview;  
+	cba=R_AVKON_SOFTKEYS_OPTIONS_BACK;	  
+	}
+
+//-----------------------------------------------------------------------------
+//	 
+//	  r_appui_menubar_startedcasesmenuview
+//	  Started cases menubar.
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE MENU_BAR r_appui_menubar_loadtestsetview
+	  {
+	titles=
+		{
+		MENU_TITLE 
+				{ 
+				menu_pane=r_appui_loadtestsetview_menu;
+				}
+		};
+
+	  }
+
+//-----------------------------------------------------------------------------
+//	 
+//	  r_appui_startcasesview_menu
+//	  Startcases view options menu.
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE MENU_PANE r_appui_startcasesview_menu
+	{
+	items=
+		{
+		MENU_ITEM
+		    {
+		    command = ECmdFilterMenu;
+		    txt = qtn_filter_menu;
+		    cascade = r_appui_filtermenu;
+		    },
+		/*
+		MENU_ITEM 
+			{ 
+			command=ECmdFilterByModule; 
+			txt = qtn_filter_by_modules; 
+			cascade = r_appui_filterbymodules_menu; 
+			},
+		MENU_ITEM 
+			{ 
+			command=ECmdFilterByTestCaseFile; 
+			txt = qtn_filter_by_test_case_file;
+			cascade = r_appui_filter_by_testcasefile_menu; 
+			},
+		MENU_ITEM 
+			{ 
+			command=ECmdNOFiltering; 
+			txt = qtn_no_filtering; 
+			},
+		*/
+		MENU_ITEM 
+			{ 
+			command=ECmdMarkMenu;
+		    txt = qtn_markmenu_title; 
+		    cascade = r_appui_markunmark_menu;
+		    },
+		MENU_ITEM 
+			{ 
+			command=ECmdStartCases; 
+			txt = qtn_start_test_cases; 
+			},
+		MENU_ITEM 
+			{ 
+			command=EEikCmdExit; 
+			txt = qtn_exit; 
+			}
+		};
+	}
+
+
+
+// STARTED CASES
+//-----------------------------------------------------------------------------
+//	 
+//	  r_appui_startedcasesmenuview
+//	  Started cases view.
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE AVKON_VIEW r_appui_startedcasesmenuview
+	{
+	//hotkeys=r_appui_hotkeys;
+	menubar=r_appui_menubar_startedcasesmenuview;  
+	cba=R_AVKON_SOFTKEYS_OPTIONS_BACK;	  
+	}
+
+//-----------------------------------------------------------------------------
+//	 
+//	  r_appui_menubar_startedcasesmenuview
+//	  Started cases menubar.
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE MENU_BAR r_appui_menubar_startedcasesmenuview
+	  {
+	titles=
+		{
+		MENU_TITLE 
+				{ 
+				menu_pane=r_appui_startedcasesmenuview_menu;
+				}
+		};
+
+	  }
+
+//-----------------------------------------------------------------------------
+//	 
+//	  r_appui_startedcasesmenuview_menu
+//	  Started cases view options menu.
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE MENU_PANE r_appui_startedcasesmenuview_menu
+	{
+	items=
+		{
+		MENU_ITEM 
+				{ 
+				command= EAknCmdOpen; 
+				txt = "Open"; 
+				},
+        	MENU_ITEM 
+				{
+				command = EAknSoftkeyExit;   
+				txt = "Exit";
+				}
+		};
+	}
+
+//-----------------------------------------------------------------------------
+//
+//	  r_started_cases_menu_listbox
+//	  ListBox( Single )
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE LISTBOX r_started_cases_menu_listbox
+	{
+	array_id = r_startedcases_menu_items;
+	flags = EAknListBoxSelectionList;
+	}
+
+
+
+//-----------------------------------------------------------------------------
+//
+//	  r_startedcases_menu_items
+//	  Items array for Test Case Menu
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE ARRAY r_startedcases_menu_items
+	{
+	items =
+		{
+		LBUF
+			{
+			txt = qtn_startedcases_allcases;
+			},
+		LBUF
+			{
+			txt = qtn_startedcases_ongoing;
+			},
+		LBUF
+			{
+			txt = qtn_startedcases_paused;
+			},
+		LBUF
+			{
+			txt = qtn_startedcases_passed;
+			},
+		LBUF
+			{
+			txt = qtn_startedcases_failed;
+			},
+		LBUF
+			{
+			txt = qtn_startedcases_crashed_aborted;
+			},
+		LBUF
+			{
+			txt = qtn_startedcases_statistics;
+			}
+		};
+	}
+
+
+
+// SHOW STARTED CASES
+//-----------------------------------------------------------------------------
+//	 
+//	  r_appui_showstartedcasesview
+//	  Show started cases view.
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE AVKON_VIEW r_appui_showstartedcasesview
+	{
+	hotkeys=r_appui_hotkeys;
+	menubar=r_appui_menubar_showstartedcasesview;  
+	cba=R_AVKON_SOFTKEYS_OPTIONS_BACK;	  
+	}
+
+//-----------------------------------------------------------------------------
+//	 
+//	  r_appui_menubar_showstartedcasesview
+//	  Show started cases view menubar.
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE MENU_BAR r_appui_menubar_showstartedcasesview
+	{
+	titles=
+		{
+		MENU_TITLE 
+				{ 
+				menu_pane=r_appui_showstartedcasesview_menu;
+				}
+		};
+	}
+
+//-----------------------------------------------------------------------------
+//	 
+//	  r_appui_showstartedcasesview_menu
+//	  Show started cases view options menu.
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE MENU_PANE r_appui_showstartedcasesview_menu
+	{
+	items=
+		{
+		MENU_ITEM 
+			{ 
+			command=ECmdViewOutput; 
+			txt = qtn_view_output; 
+			},
+		MENU_ITEM
+		    {
+		    command = ECmdFilterMenu;
+		    txt = qtn_filter_menu;
+		    cascade = r_appui_filtermenu;
+		    },
+		MENU_ITEM
+		    { 
+			command=ECmdShowSetMenu;
+			txt = qtn_testcase_control_menu;
+			cascade = r_testcase_control_submenu;
+			},
+		MENU_ITEM 
+		    { 
+			command=EEikCmdExit; 
+			txt = qtn_exit; 
+			}
+			
+        /*
+		MENU_ITEM 
+				{ 
+				command=ECmdPauseTestCase; 
+				txt = qtn_pause_testcase; 
+				},
+		MENU_ITEM 
+				{ 
+				command=ECmdResumeTestCase; 
+				txt = qtn_resume_testcase; 
+				},
+		MENU_ITEM 
+				{ 
+				command=ECmdAbortTestCase; 
+				txt = qtn_abort_testcase; 
+				},
+        */
+        
+        /*
+		MENU_ITEM 
+				{ 
+				command=ECmdFilterByModule; 
+				txt = qtn_filter_by_modules; 
+				cascade = r_appui_filterbymodules_menu; 
+				},
+		MENU_ITEM 
+				{ 
+				command=ECmdFilterByTestCaseFile; 
+				txt = qtn_filter_by_test_case_file;
+				cascade = r_appui_filter_by_testcasefile_menu; 
+				},
+		MENU_ITEM 
+				{ 
+				command=ECmdNOFiltering; 
+				txt = qtn_no_filtering; 
+				},
+		*/
+		
+		/*
+		MENU_ITEM 
+				{ 
+				command=ECmdRemoveExecution; 
+				txt = qtn_remove_execution; 
+				},
+		MENU_ITEM 
+				{ 
+				command=ECmdRemoveAllExecutions; 
+				txt = qtn_remove_all_executions; 
+				},
+	    */
+
+		};
+	}
+
+
+// STATISTICS VIEW
+//-----------------------------------------------------------------------------
+//	 
+//	  r_appui_statisticsview
+//	  Statistics view.
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE AVKON_VIEW r_appui_statisticsview
+	{
+	menubar= r_appui_menubar_statisticsview;
+	cba=R_AVKON_SOFTKEYS_OPTIONS_BACK;	  
+	}
+
+//-----------------------------------------------------------------------------
+//	 
+//	  r_appui_menubar_statisticsview
+//	  Statistics view menubar.
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE MENU_BAR r_appui_menubar_statisticsview
+	{
+	titles=
+		{
+		MENU_TITLE 
+			{ 
+			menu_pane=r_appui_statisticsview_menu; 
+			}
+		};
+	}
+
+//-----------------------------------------------------------------------------
+//	 
+//	  r_appui_statisticsview_menu
+//	  Statistics view options menu.
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE MENU_PANE r_appui_statisticsview_menu
+	{
+	items=
+		{
+		MENU_ITEM 
+			{ 
+			command=ECmdFilterByModule; 
+			txt = qtn_filter_by_modules; 
+			cascade = r_appui_filterbymodules_menu; 
+			},
+		MENU_ITEM 
+			{ 
+			command=ECmdFilterByTestCaseFile; 
+			txt = qtn_filter_by_test_case_file;
+			cascade = r_appui_filter_by_testcasefile_menu; 
+			},
+		MENU_ITEM 
+			{ 
+			command=ECmdNOFiltering; 
+			txt = qtn_no_filtering; 
+			},
+
+		MENU_ITEM 
+			{ 
+			command=EEikCmdExit; 
+			txt = qtn_exit; 
+			}
+		};
+	}
+
+
+// TESTCASE OUTPUT VIEW
+//-----------------------------------------------------------------------------
+//	 
+//	  r_appui_testcaseoutputview
+//	  Testcase output view.
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE AVKON_VIEW r_appui_testcaseoutputview
+	{
+	hotkeys=r_appui_hotkeys;
+	menubar=r_appui_menubar_testcaseoutputview;  
+	cba=R_AVKON_SOFTKEYS_OPTIONS_BACK;	  
+	}
+
+//-----------------------------------------------------------------------------
+//	 
+//	  r_appui_menubar_testcaseoutputview
+//	  Testcase output view menub bar.
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE MENU_BAR r_appui_menubar_testcaseoutputview
+	{
+	titles=
+		{
+		MENU_TITLE 
+			{ 
+			menu_pane=r_appui_testcaseoutputview_menu; 
+			}
+		};
+	}
+
+//-----------------------------------------------------------------------------
+//	 
+//	  r_appui_testcaseoutputview_menu
+//	  Testcase output view options menu.
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE MENU_PANE r_appui_testcaseoutputview_menu
+	{
+	items=
+		{
+		MENU_ITEM 
+			{ 
+			command=ECmdPauseTestCase; 
+			txt = qtn_pause_testcase; 
+			},
+		MENU_ITEM 
+			{ 
+			command=ECmdResumeTestCase; 
+			txt = qtn_resume_testcase; 
+			},
+		MENU_ITEM 
+			{ 
+			command=ECmdAbortTestCase; 
+			txt = qtn_abort_testcase; 
+			},
+		MENU_ITEM 
+			{ 
+			command=EEikCmdExit; 
+			txt = qtn_exit; 
+			}
+		};
+	}
+
+
+
+// MODULES MENU
+//-----------------------------------------------------------------------------
+//	 
+//	  r_appui_testmodulesmenuview
+//	  Test modules menu view.
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE AVKON_VIEW r_appui_testmodulesmenuview
+	{
+	hotkeys=r_appui_hotkeys;
+	menubar=r_appui_menubar_testmodulesmenuview;  
+	cba=R_AVKON_SOFTKEYS_OPTIONS_BACK;	  
+	}
+
+//-----------------------------------------------------------------------------
+//	 
+//	  r_appui_menubar_testmodulesmenuview
+//	  Test modules view menubar.
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE MENU_BAR r_appui_menubar_testmodulesmenuview
+	{
+	titles=
+		{
+		MENU_TITLE 
+			{ 
+			menu_pane=r_appui_testmodulesmenuview_menu; 
+			}
+		};
+	}
+
+//-----------------------------------------------------------------------------
+//	 
+//	  r_appui_testmodulesmenuview_menu
+//	  Testmodules view options menu.
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE MENU_PANE r_appui_testmodulesmenuview_menu
+	{
+	items=
+		{
+		// MENU_ITEM 
+		//	{ 
+		//	command=ECmdOpenModule; 
+		//	txt = qtn_open_module; 
+		//	},
+		MENU_ITEM 
+			{ 
+			command=ECmdAddModule; 
+			txt = qtn_add_module; 
+			},
+		MENU_ITEM 
+			{ 
+			command=ECmdRemoveModule; 
+			txt = qtn_remove_module; 
+			},
+	        MENU_ITEM 
+			{ 
+			command=EAknCmdExit; 
+			txt = qtn_exit; 
+			}
+		};
+	}
+
+//-----------------------------------------------------------------------------
+//	  r_testmodules_menu_listbox
+//	  ListBox( Single )
+//
+//-----------------------------------------------------------------------------
+//
+/*
+RESOURCE LISTBOX r_testmodules_menu_listbox
+	{
+	array_id = r_testmodules_menu_items;
+	flags = EAknListBoxSelectionList;
+	}
+*/
+
+//-----------------------------------------------------------------------------
+//	  r_testmodules_menu_items
+//	  Items array for Test Case Menu
+//
+//-----------------------------------------------------------------------------
+//
+/*
+RESOURCE ARRAY r_testmodules_menu_items
+	{
+	items =
+		{
+		LBUF
+			{
+			txt = "\tModule1";
+			},
+		LBUF
+			{
+			txt = "\tModule2";
+			}
+		};
+	}
+*/
+
+
+// TEST SET BASE
+//-----------------------------------------------------------------------------
+//	 
+//	  r_appui_testsetbasemenuview
+//	  Testset base menu view.
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE AVKON_VIEW r_appui_testsetbasemenuview
+	{
+	menubar=r_appui_menubar_testsetbasemenuview;
+	cba=R_AVKON_SOFTKEYS_OPTIONS_BACK;
+	}
+
+//-----------------------------------------------------------------------------
+//	 
+//	  r_appui_menubar_testsetbasemenuview
+//	  Testset base menu view menubar.
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE MENU_BAR r_appui_menubar_testsetbasemenuview
+	  {
+	titles=
+		{
+		MENU_TITLE 
+				{ 
+				menu_pane=r_appui_testsetbasemenuview_menu;
+				}
+		};
+
+	  }
+
+//-----------------------------------------------------------------------------
+//	 
+//	  r_appui_testsetbasemenuview_menu
+//	  Testset base menu view options menu.
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE MENU_PANE r_appui_testsetbasemenuview_menu
+	{
+	items=
+		{
+		MENU_ITEM 
+				{ 
+				command= ECmdCreateTestSet; 
+				txt = "Create test set";
+				},
+		MENU_ITEM 
+				{ 
+				command= ECmdLoadTestSet; 
+				txt = "Load test set";
+				},
+        	MENU_ITEM 
+				{
+				command = EAknSoftkeyExit;   
+				txt = "Exit";
+				}
+		};
+	}
+
+//-----------------------------------------------------------------------------
+//
+//	  r_testsetbase_menu_listbox
+//	  ListBox( Single )
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE LISTBOX r_testsetbase_menu_listbox
+	{
+	array_id = r_testsetbase_menu_items;
+	flags = EAknListBoxSelectionList;
+	}
+
+
+
+//-----------------------------------------------------------------------------
+//
+//	  r_testsetbase_menu_items
+//	  Items array for Test Sets Base Menu
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE ARRAY r_testsetbase_menu_items
+	{
+	items =
+		{
+		LBUF
+			{
+			txt = qtn_testsetbasemenu_createtestset;
+			},
+		LBUF
+			{
+			txt = qtn_testsetbasemenu_loadtestset;
+			}
+		};
+	}
+
+
+// TESTSET MENU
+//-----------------------------------------------------------------------------
+//	 
+//	  r_appui_testsetmenuview
+//	  Test set menu view.
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE AVKON_VIEW r_appui_testsetmenuview
+	{
+	menubar=r_appui_menubar_testsetmenuview;
+	cba=R_AVKON_SOFTKEYS_OPTIONS_BACK;
+	}
+
+//-----------------------------------------------------------------------------
+//	 
+//	  r_appui_menubar_testsetmenuview
+//	  Test set menu view menubar.
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE MENU_BAR r_appui_menubar_testsetmenuview
+	  {
+	titles=
+		{
+		MENU_TITLE 
+				{ 
+				menu_pane=r_appui_testsetmenuview_menu;
+				}
+		};
+
+	  }
+
+//-----------------------------------------------------------------------------
+//	 
+//	  r_appui_testsetmenuview_menu
+//	  Test set menu view options menu.
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE MENU_PANE r_appui_testsetmenuview_menu
+	{
+	items=
+		{
+		MENU_ITEM 
+				{ 
+				command= ECmdStartTestSet; 
+				txt = "Start testing";
+				},
+		MENU_ITEM 
+				{ 
+				command= ECmdShowStartedTestSet; 
+				txt = "View started cases";
+				},				
+		MENU_ITEM 
+				{ 
+				command= ECmdSaveTestSet; 
+				txt = "Save test set"; 
+				},
+		MENU_ITEM 
+				{ 
+				command= ECmdInsertTestCases; 
+				txt = "Insert test case(s)";
+				},
+		MENU_ITEM 
+				{ 
+				command= ECmdRemoveTestCases; 
+				txt = "Remove test case"; 
+				},
+        MENU_ITEM 
+				{
+				command = EAknSoftkeyExit;   
+				txt = "Exit";
+				}
+		};
+	}
+
+//-----------------------------------------------------------------------------
+//
+//	  r_testset_menu_listbox
+//	  ListBox( Single )
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE LISTBOX r_testset_menu_listbox
+	{
+	array_id = r_testset_menu_items;
+	flags = EAknListBoxSelectionList;
+	}
+
+
+
+//-----------------------------------------------------------------------------
+//
+//	  r_testset_menu_items
+//	  Items array for Test Sets Menu
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE ARRAY r_testset_menu_items
+	{
+	items =
+		{
+		LBUF
+			{
+			txt = "";
+			}			
+		};
+	}
+
+
+// TESTSET STARTED CASES
+//-----------------------------------------------------------------------------
+//	 
+//	  r_test_set_startedcasesview
+//	  Test set started cases view.
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE AVKON_VIEW r_testset_startedcasesview
+	{
+	//hotkeys=r_appui_hotkeys;
+	menubar=r_testset_menubar_startedcasesview;  
+	cba=R_AVKON_SOFTKEYS_OPTIONS_BACK;	  
+	}
+
+//-----------------------------------------------------------------------------
+//	 
+//	  r_test_set_menubar_startedcasesview
+//	  Test set started cases view menubar.
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE MENU_BAR r_testset_menubar_startedcasesview
+	{
+	titles=
+		{
+		MENU_TITLE 
+				{ 
+				menu_pane=r_testset_startedcasesview_menu;
+				}
+		};
+	}
+
+//-----------------------------------------------------------------------------
+//	 
+//	  r_testset_startedcasesview_menu
+//	  Test set started cases view options menu.
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE MENU_PANE r_testset_startedcasesview_menu
+	{
+	items=
+		{
+		MENU_ITEM
+				{
+				txt = qtn_testset_started_menu;
+				cascade = r_testset_startedcases_submenu;
+				},
+		MENU_ITEM 
+				{ 
+				command=ECmdViewOutput; 
+				txt = qtn_view_output; 
+				},
+        MENU_ITEM 
+				{ 
+				command=ECmdShowSetMenu;
+				txt = qtn_testcase_control_menu;
+				cascade = r_testcase_control_submenu;
+				},
+		MENU_ITEM 
+				{ 
+				command=EEikCmdExit; 
+				txt = qtn_exit; 
+				}
+		};
+	}
+
+//-----------------------------------------------------------------------------
+//	 
+//	  r_testset_startedcases_submenu
+//	  Test set started cases view sub menu.
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE MENU_PANE r_testset_startedcases_submenu
+	{
+	items=
+		{
+		MENU_ITEM
+				{
+				command = ECmdShowAllStartedCases;
+				txt = qtn_testset_started_allcases;
+				},
+		MENU_ITEM
+				{
+				command = ECmdShowOngoingCases;
+				txt = qtn_testset_started_ongoing;
+				},
+		MENU_ITEM
+				{
+				command = ECmdShowPausedCases;
+				txt = qtn_testset_started_paused;
+				},
+		MENU_ITEM
+				{
+				command = ECmdShowPassedCases;
+				txt = qtn_testset_started_passed;
+				},
+		MENU_ITEM
+				{
+				command = ECmdShowFailedCases;
+				txt = qtn_testset_started_failed;
+				},
+		MENU_ITEM
+				{
+				command = ECmdShowCrashedAbortedCases;
+				txt = qtn_testset_started_crashed_aborted;
+				}
+		};
+	}
+
+
+// TESTSET INSERT CASES
+//-----------------------------------------------------------------------------
+//	 
+//	  r_insert_testcases_view
+//	  Insert test cases view.
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE AVKON_VIEW r_insert_testcases_view
+	{
+	//hotkeys=r_appui_hotkeys;
+	menubar=r_insert_testcases_menubar;  
+	cba=R_AVKON_SOFTKEYS_OPTIONS_CANCEL;	  
+	}
+
+//-----------------------------------------------------------------------------
+//	 
+//	  r_insert_testcases_menubar
+//	  Insert test cases view menubar.
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE MENU_BAR r_insert_testcases_menubar
+	{
+	titles=
+		{
+		MENU_TITLE 
+				{ 
+				menu_pane=r_insert_testcases_menu;
+				}
+		};
+	}
+
+//-----------------------------------------------------------------------------
+//	 
+//	  r_insert_testcases_menu
+//	  Insert test cases view options menu.
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE MENU_PANE r_insert_testcases_menu
+	{
+	items=
+		{
+		MENU_ITEM 
+			{ 
+			command=ECmdInsertSelectedCases;
+			txt = qtn_testsetinsert_add_selected; 
+			},
+        MENU_ITEM
+		    {
+		    command = ECmdFilterMenu;
+		    txt = qtn_filter_menu;
+		    cascade = r_appui_filtermenu;
+		    },
+		MENU_ITEM 
+			{ 
+			command=ECmdMarkMenu;
+		    txt = qtn_markmenu_title; 
+		    cascade = r_appui_markunmark_menu;
+		    },
+		MENU_ITEM 
+			{ 
+			command=EEikCmdExit; 
+			txt = qtn_exit; 
+			}
+		};
+	}
+
+
+
+// GENERAL
+// MARKMENU
+//-----------------------------------------------------------------------------
+//	 
+//	  r_appui_markunmark_menu
+//	  Submenu for marking items.
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE MENU_PANE r_appui_markunmark_menu
+	{
+	items=
+		{
+		MENU_ITEM 
+			{ 
+			command=EAknCmdMark; 
+			txt = qtn_markmenu_mark; 
+			},
+		MENU_ITEM 
+			{ 
+			command=EAknCmdUnmark; 
+			txt = qtn_markmenu_unmark; 
+			},
+		MENU_ITEM 
+			{ 
+			command=EAknMarkAll; 
+			txt = qtn_markmenu_markall; 
+			},
+		MENU_ITEM 
+			{ 
+			command=EAknUnmarkAll; 
+			txt = qtn_markmenu_unmarkall; 
+			}
+		};
+	}
+
+// TEST CASE CONTROL
+//-----------------------------------------------------------------------------
+//	 
+//	  r_testset_stertedcases_setmenu
+//	  Test set started cases view set menu.
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE MENU_PANE r_testcase_control_submenu
+	{
+	items=
+		{
+		MENU_ITEM 
+				{ 
+				command=ECmdPauseTestCase; 
+				txt = qtn_pause_testcase; 
+				},
+		MENU_ITEM 
+				{ 
+				command=ECmdResumeTestCase; 
+				txt = qtn_resume_testcase; 
+				},
+		MENU_ITEM 
+				{ 
+				command=ECmdAbortTestCase; 
+				txt = qtn_abort_testcase; 
+				}
+		};
+	}
+
+// FILTERING			
+//-----------------------------------------------------------------------------
+//	 
+//	  r_appui_filtermenu
+//	  MenuPane for Filter submenu.
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE MENU_PANE r_appui_filtermenu
+	{
+	items=
+		{
+		MENU_ITEM 
+			{ 
+			command=ECmdFilterByModule; 
+			txt = qtn_filter_by_modules; 
+			cascade = r_appui_filterbymodules_menu; 
+			},
+		MENU_ITEM 
+			{ 
+			command=ECmdFilterByTestCaseFile; 
+			txt = qtn_filter_by_test_case_file;
+			cascade = r_appui_filter_by_testcasefile_menu; 
+			},
+		MENU_ITEM 
+			{ 
+			command=ECmdNOFiltering; 
+			txt = qtn_no_filtering; 
+			}
+	    };
+	}
+
+//-----------------------------------------------------------------------------
+//	 
+//	  r_appui_filterbymodules_menu
+//	  MenuPane for Filter submenu.
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE MENU_PANE r_appui_filterbymodules_menu
+	{
+	items=
+		{
+		// items (modules) are added dynamically when
+		// Filter by module submenu is opened
+		};
+	}
+
+//-----------------------------------------------------------------------------
+//	 
+//	  r_appui_filter_by_testcasefile_menu
+//	  MenuPane for Filter submenu.
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE MENU_PANE r_appui_filter_by_testcasefile_menu
+	{
+	items=
+		{
+		// Items (testcase files are added dynamically when
+		// Filter by testcase file menu is opened
+		};
+	}
+
+
+// DIALOGS
+// START TEST CASES
+//-----------------------------------------------------------------------------
+//	 
+//	  r_start_testcase_list_query
+//	  Query dialog for starting single test case.
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE AVKON_LIST_QUERY r_start_testcase_list_query
+	{
+	flags = EGeneralQueryFlags;
+	softkeys = R_AVKON_SOFTKEYS_OK_CANCEL;
+	items = 
+		{
+		DLG_LINE   //AVKON_LIST_QUERY_DLG_LINE
+			{
+			type = EAknCtListQueryControl;
+			id = EListQueryControl;
+			control = AVKON_LIST_QUERY_CONTROL
+				{
+				listtype = EAknCtSinglePopupMenuListBox;
+				listbox = LISTBOX		//AVKON_LIST_QUERY_LIST
+					{
+					flags = EAknListBoxMenuList;
+					height = 3;
+					width = 3;
+					array_id = r_start_testcase_listbox_item_array;
+					};
+				heading = qtn_starting_test_case;
+				};
+			}
+		};
+	}
+
+//-----------------------------------------------------------------------------
+//	 
+//	  r_start_testcase_listbox_item_array
+//	  Listbox items in query dialog for starting single test case.
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE ARRAY r_start_testcase_listbox_item_array
+	{
+	items =
+		{
+		LBUF { txt = qtn_start_test; },
+		LBUF { txt = qtn_start_test_output; }
+		};
+	}
+
+//-----------------------------------------------------------------------------
+//	 
+//	  r_start_multiple_testcases_list_query
+//	  Query dialog for starting multiple test cases.
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE AVKON_LIST_QUERY r_start_multiple_testcases_list_query
+	{
+	flags = EGeneralQueryFlags;
+	softkeys = R_AVKON_SOFTKEYS_OK_CANCEL;
+	items = 
+		{
+		DLG_LINE   //AVKON_LIST_QUERY_DLG_LINE
+			{
+			type = EAknCtListQueryControl;
+			id = EListQueryControl;
+			control = AVKON_LIST_QUERY_CONTROL
+				{
+				listtype = EAknCtSinglePopupMenuListBox;
+				listbox = LISTBOX		//AVKON_LIST_QUERY_LIST
+					{
+					flags = EAknListBoxMenuList;
+					height = 3;
+					width = 3;
+					array_id = r_start_multiple_testcases_listbox_item_array;
+					};
+				heading = qtn_starting_test_cases;
+				};
+			}
+		};
+	}
+
+//-----------------------------------------------------------------------------
+//	 
+//	  r_start_multiple_testcases_listbox_item_array
+//	  Listbox items in query dialog for starting single test case.
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE ARRAY r_start_multiple_testcases_listbox_item_array
+	{
+	items =
+		{
+		LBUF { txt = qtn_start_tests_parallel; },
+		LBUF { txt = qtn_start_tests_serial; }
+		};
+	}
+
+//-----------------------------------------------------------------------------
+//	 
+//	  r_general_confirmation_dialog
+//	  General confirmation dialog with empty label.
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE DIALOG r_general_confirmation_dialog
+	{
+	flags = EGeneralQueryFlags;
+	buttons = R_AVKON_SOFTKEYS_YES_NO;
+	items = 
+		{
+		DLG_LINE
+			{
+			type = EAknCtQuery;
+			id = EGeneralQuery;
+			control = AVKON_CONFIRMATION_QUERY
+				{
+				layout = EConfirmationQueryLayout;
+        		label = "";
+				};
+			}
+		};
+
+	} 
+
+//-----------------------------------------------------------------------------
+//	 
+//    r_stifui_about_dialog
+//	  "About" dialog
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE DIALOG r_stifui_about_dialog
+{
+    flags = EGeneralQueryFlags | EEikDialogFlagNoBorder | EEikDialogFlagNoShadow;
+    buttons = R_AVKON_SOFTKEYS_OK_EMPTY;
+    items=
+    {
+        DLG_LINE
+        {
+            type = EAknCtPopupHeadingPane;
+            id = EAknMessageQueryHeaderId;
+            control = AVKON_HEADING
+            {
+                label = "About STIF";
+                headinglayout = R_AVKON_WML_SIGN_QUERY_HEADING_PANE;
+            };
+        },
+        DLG_LINE
+        {
+            type = EAknCtMessageQuery;
+            id = EAknMessageQueryContentId;
+            control = AVKON_MESSAGE_QUERY
+            {
+                
+            };
+        }
+    };
+}
+
+//-----------------------------------------------------------------------------
+//	 
+//	  r_memory_selection_dialog
+//	  Selection dialog for selectiong either C or E drive.
+//        Not yet used.
+//
+//-----------------------------------------------------------------------------
+//
+/*
+RESOURCE MEMORYSELECTIONDIALOG r_memory_selection_dialog
+	{
+	title = "Choose memory:";
+	softkey_1 = "Ok";
+	softkey_2 = "Cancel";
+	locations = 
+		{
+		LOCATION { root_path = "C:\\"; },
+		LOCATION { root_path = "E:\\";  //default_folder = "TestFramework\\";
+                 }
+		};
+	}
+*/
+
+//-----------------------------------------------------------------------------
+//	 
+//	  r_file_selection_dialog
+//	  Fileselection dialog.
+//        Not yet used.
+//
+//-----------------------------------------------------------------------------
+//
+/*
+RESOURCE FILESELECTIONDIALOG r_file_selection_dialog
+	{
+	title = "Select-a-file:";
+	root_path = "C:\\";
+	filters =
+		{
+		FILTER
+			{
+			filter_type = EAttributeFilter; //EAttributeFilter;
+			filter_style = EExclusiveFilter; //EExclusiveFilter;
+			filter_data = 
+				{
+				"SH",
+				"R"
+				}; // Excludes system, hidden and read-only attributes
+			}
+		};
+	}
+*/
+    
+
+// APPLICATION NAVIPANEL TITLES
+//-----------------------------------------------------------------------------
+//	 
+//	  r_navititle_main
+//	  Main menu title.
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE NAVI_LABEL r_navititle_main
+	{
+	txt = qtn_navi_main;
+	}
+
+//-----------------------------------------------------------------------------
+//	 
+//	  r_navititle_testcases
+//	  Test cases menu title.
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE NAVI_LABEL r_navititle_testcases
+	{
+	txt = qtn_navi_testcases;
+	}
+
+//-----------------------------------------------------------------------------
+//	 
+//	  r_navititle_startcases
+//	  Startcases menu title.
+//
+//-----------------------------------------------------------------------------
+//	
+RESOURCE NAVI_LABEL r_navititle_startcases
+	{
+	txt = qtn_navi_startcases;
+	}
+
+//-----------------------------------------------------------------------------
+//	 
+//	  r_navititle_loadtestset
+//	  Startcases menu title.
+//
+//-----------------------------------------------------------------------------
+//	
+RESOURCE NAVI_LABEL r_navititle_loadtestset
+	{
+	txt = qtn_navi_load_test_set;
+	}
+
+
+//-----------------------------------------------------------------------------
+//	 
+//	  r_navititle_startedcases
+//	  Started cases menu title.
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE NAVI_LABEL r_navititle_startedcases
+	{
+	txt = qtn_navi_startedcases;
+	}
+
+//-----------------------------------------------------------------------------
+//	 
+//	  r_navititle_testcase_output
+//	  Test case output view title.
+//
+//-----------------------------------------------------------------------------
+//	
+RESOURCE NAVI_LABEL r_navititle_testcase_output
+	{
+	txt = qtn_navi_testcase_output;
+	}
+
+//-----------------------------------------------------------------------------
+//	 
+//	  r_navititle_modules
+//	  Modules menu title.
+//
+//-----------------------------------------------------------------------------
+//	
+RESOURCE NAVI_LABEL r_navititle_modules
+	{
+	txt = qtn_navi_modules;
+	}
+
+//-----------------------------------------------------------------------------
+//	 
+//	  r_navititle_testset_base
+//	  Testset base menu title.
+//
+//-----------------------------------------------------------------------------
+//	
+RESOURCE NAVI_LABEL r_navititle_testset_base
+	{
+	txt = qtn_navi_testset_base;
+	}
+
+//-----------------------------------------------------------------------------
+//	 
+//	  r_navititle_testset
+//	  Testset menu title.
+//
+//-----------------------------------------------------------------------------
+//	
+RESOURCE NAVI_LABEL r_navititle_testset
+	{
+	txt = qtn_navi_testset;
+	}
+
+//-----------------------------------------------------------------------------
+//	 
+//	  r_navititle_testset_insert
+//	  Testset insert menu title.
+//
+//-----------------------------------------------------------------------------
+//	
+RESOURCE NAVI_LABEL r_navititle_testset_insert
+	{
+	txt = qtn_navi_testset_insert;
+	}
+
+//-----------------------------------------------------------------------------
+//	 
+//	  r_navititle_started
+//	  Started cases view menu title.
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE NAVI_LABEL r_navititle_started
+	{
+	txt = qtn_navi_started;
+	}
+
+//-----------------------------------------------------------------------------
+//	 
+//	  r_navititle_started_all
+//	  All started cases view menu title.
+//
+//-----------------------------------------------------------------------------
+//	
+RESOURCE NAVI_LABEL r_navititle_started_all
+	{
+	txt = qtn_navi_started_all;
+	}
+
+//-----------------------------------------------------------------------------
+//	 
+//	  r_navititle_started_ongoing
+//	  Ongoing cases view menu title.
+//
+//-----------------------------------------------------------------------------
+//	
+RESOURCE NAVI_LABEL r_navititle_started_ongoing
+	{
+	txt = qtn_navi_started_ongoing;
+	}
+
+//-----------------------------------------------------------------------------
+//	 
+//	  r_navititle_started_paused
+//	  Paused cases view menu title.
+//
+//-----------------------------------------------------------------------------
+//	
+RESOURCE NAVI_LABEL r_navititle_started_paused
+	{
+	txt = qtn_navi_started_paused;
+	}
+
+//-----------------------------------------------------------------------------
+//	 
+//	  r_navititle_started_passed
+//	  Passed cases view menu title.
+//
+//-----------------------------------------------------------------------------
+//	
+RESOURCE NAVI_LABEL r_navititle_started_passed
+	{
+	txt = qtn_navi_started_passed;
+	}
+
+//-----------------------------------------------------------------------------
+//	 
+//	  r_navititle_started_failed
+//	  Failed cases view menu title.
+//
+//-----------------------------------------------------------------------------
+//	
+RESOURCE NAVI_LABEL r_navititle_started_failed
+	{
+	txt = qtn_navi_started_failed;
+	}
+
+//-----------------------------------------------------------------------------
+//	 
+//	  r_navititle_started_crashed_aborted
+//	  Crashed cases view menu title.
+//
+//-----------------------------------------------------------------------------
+//	
+RESOURCE NAVI_LABEL r_navititle_started_crashed_aborted
+	{
+	txt = qtn_navi_started_crashed_aborted;
+	}
+
+//-----------------------------------------------------------------------------
+//	 
+//	  r_navititle_started_stats
+//	  Statistics view menu title.
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE NAVI_LABEL r_navititle_started_stats
+	{
+	txt = qtn_navi_started_stats;
+	}
+
+
+// RESOURCE TEXTS
+//-----------------------------------------------------------------------------
+//	 
+//	  r_insert_confirmation_question
+//	  Insert test cases confirmation query text.
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE STRING r_insert_confirmation_question
+	{
+	text = qtn_insert_confirmation;
+	}
+
+//-----------------------------------------------------------------------------
+//	 
+//	  r_insert_nocases_text
+//	  Infomsg text to inform user that there´s no test cases selected when 
+//    trying to insert test cases.
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE STRING r_insert_nocases_text
+	{
+	text = qtn_insert_none_selected;
+	}
+	
+//-----------------------------------------------------------------------------
+//	 
+//	  r_insert_confirmation_question
+//	  Overwrite existing test set confirmation query text.
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE STRING r_overwrite_testset_question
+	{
+	text = qtn_owerwrite_testset_confirmation;
+	}
+
+//-----------------------------------------------------------------------------
+//	 
+//	  r_insert_confirmation_question
+//	  Save test set confirmation query text.
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE STRING r_save_testset_question
+	{
+	text = qtn_save_testset_confirmation;
+	}
+
+//-----------------------------------------------------------------------------
+//	 
+//	  r_insert_confirmation_question
+//	  Loading test set failed text.
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE STRING r_load_testset_failed
+	{
+	text = qtn_load_testset_errornote;
+	}
+
+	
+// TEST CASE STATES
+RESOURCE STRING r_testcase_state_running
+	{
+	text = qtn_testcase_state_running;
+	}
+
+RESOURCE STRING r_testcase_state_passed
+	{
+	text = qtn_testcase_state_passed;
+	}
+
+RESOURCE STRING r_testcase_state_failed
+	{
+	text = qtn_testcase_state_failed;
+	}
+
+RESOURCE STRING r_testcase_state_crashed_aborted
+	{
+	text = qtn_testcase_state_crashed_aborted;
+	}
+	
+RESOURCE STRING r_testcase_state_unknown
+	{
+	text = qtn_testcase_state_unknown;
+	}
+
+RESOURCE LOCALISABLE_APP_INFO r_stifui_localisable_app_info
+    {
+    short_caption = qtn_app_short_caption_string;
+    caption_and_icon = 
+    CAPTION_AND_ICON_INFO
+        {
+        caption = qtn_app_caption_string;
+        };
+    }	
+			
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/avkon/stifui/data/Stifui_reg.rss	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,37 @@
+/*
+* 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 file defines StifUI resources.
+*
+*/
+
+#include <Stifui.rsg>
+#include <appinfo.rh>
+#if defined (__S60_)
+  #include <data_caging_paths_strings.hrh>
+#endif
+
+UID2 KUidAppRegistrationResourceFile
+UID3 0x1028311D
+
+RESOURCE APP_REGISTRATION_INFO
+    {
+    app_file = "Stifui";
+    localisable_resource_file = APP_RESOURCE_DIR"\\Stifui";
+    localisable_resource_id = R_STIFUI_LOCALISABLE_APP_INFO;
+    group_name = "RnD Tools";
+    }
+
+// End of File
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/avkon/stifui/group/Stifui.mmp	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,123 @@
+/*
+* 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: STIFUI MMP file.
+*
+*/
+
+#include <platform_paths.hrh>
+
+SMPSAFE
+
+TARGET 			Stifui.exe
+TARGETTYPE 		exe
+UID             0x100039ce 0x1028311D 
+VENDORID	    0x101FB657
+SECUREID        0x102073DC
+CAPABILITY      AllFiles SwEvent CommDD
+
+START RESOURCE  ../data/Stifui.rss
+	HEADER
+	TARGETPATH  resource/apps
+END 
+
+SOURCEPATH      ../data
+START RESOURCE  ./Stifui_reg.rss
+	DEPENDS stifui.rsg
+	TARGETPATH  /private/10003a3f/apps
+END
+
+SOURCEPATH ../src
+
+
+SOURCE  AppUIApp.cpp 
+SOURCE  AppUIAppUi.cpp
+SOURCE  AppUIDocument.cpp
+SOURCE  View.cpp
+SOURCE  Container.cpp
+SOURCE  UIStoreHandler.cpp
+
+SOURCE  MainMenuView.cpp
+SOURCE  MainMenuContainer.cpp
+
+SOURCE  TestCaseMenuView.cpp
+SOURCE  TestCaseMenuContainer.cpp
+
+SOURCE  StartCasesView.cpp
+SOURCE  StartCasesContainer.cpp
+
+SOURCE  StartedCasesMenuView.cpp
+SOURCE  StartedCasesMenuContainer.cpp
+
+SOURCE  ShowStartedCasesView.cpp
+SOURCE  ShowStartedCasesContainer.cpp
+
+SOURCE  TestCaseOutputView.cpp
+SOURCE  TestCaseOutputContainer.cpp
+
+SOURCE  Testmodulesmenuview.cpp
+SOURCE  TestModulesMenuContainer.cpp
+
+SOURCE	StatisticsView.cpp
+SOURCE	StatisticsContainer.cpp
+
+SOURCE  TestSetBaseMenuView.cpp
+SOURCE  TestSetBaseMenuContainer.cpp
+
+SOURCE  TestSetMenuView.cpp
+SOURCE  TestSetMenuContainer.cpp
+
+SOURCE  TestSetInsertMenuView.cpp
+SOURCE  TestSetInsertMenuContainer.cpp
+
+SOURCE  TestSetStartedCasesView.cpp
+SOURCE  TestSetStartedCasesContainer.cpp
+
+//SOURCE  MenuListBox.cpp
+
+SOURCE  MenuListBox.cpp CreatedTestSetMenuContainer.cpp CreatedTestSetMenuView.cpp
+
+USERINCLUDE ../inc
+
+APP_LAYER_SYSTEMINCLUDE
+
+LIBRARY euser.lib
+LIBRARY apparc.lib
+LIBRARY cone.lib
+LIBRARY eikcore.lib 
+
+LIBRARY eikcoctl.lib
+LIBRARY avkon.lib
+
+LIBRARY stiftestengine.lib
+LIBRARY stiftestinterface.lib
+LIBRARY bafl.lib
+LIBRARY eikctl.lib 		// For adding icons
+LIBRARY StifTFwIf.lib 
+LIBRARY efsrv.lib
+
+LIBRARY egul.lib
+LIBRARY aknskins.lib
+LIBRARY aknicon.lib
+
+START WINS      
+// ?wins_specific_information
+END
+
+START MARM
+// ?marm_specific_information
+END
+ 
+EPOCHEAPSIZE    0x10000 0x500000
+EPOCSTACKSIZE   32768
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/avkon/stifui/group/bld.inf	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,41 @@
+/*
+* 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: bld.inf build information for STIF UI.
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+// Specify the platforms your component needs to be built for here.
+// ARM4 not supported in SDK
+	
+	DEFAULT
+
+
+PRJ_EXPORTS
+// None
+
+PRJ_TESTEXPORTS
+// None
+
+PRJ_MMPFILES
+	
+	Stifui.mmp
+
+PRJ_TESTMMPFILES
+// None
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/avkon/stifui/inc/AppUIApp.h	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,56 @@
+/*
+* 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 file contains CAppUIApp class declaration.
+*
+*/
+
+#ifndef APPUIAPP_H
+#define APPUIAPP_H
+
+// INCLUDES
+#include <aknapp.h>
+
+// CONSTANTS
+// UID of the application
+const TUid KUidAppUI = { 0x1028311D };
+
+// CLASS DECLARATION
+
+/**
+* CAppUIApp application class.
+* Provides factory to create concrete document object.
+* 
+*/
+class CAppUIApp : public CAknApplication
+    {
+    
+    public: // Functions from base classes
+    private:
+
+        /**
+        * From CApaApplication, creates CAppUIDocument document object.
+        * @return A pointer to the created document object.
+        */
+        CApaDocument* CreateDocumentL();
+        
+        /**
+        * From CApaApplication, returns application's UID (KUidAppUI).
+        * @return The value of KUidAppUI.
+        */
+        TUid AppDllUid() const;
+    };
+
+#endif
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/avkon/stifui/inc/AppUIAppUi.h	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,222 @@
+/*
+* 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 file contains CAppUIAppUi class declaration.
+*
+*/
+
+#ifndef APPUIAPPUI_H
+#define APPUIAPPUI_H
+
+// INCLUDES
+#include <eikapp.h>
+#include <e32std.h>
+#include <aknViewAppUi.h>
+#include <akntabgrp.h>
+#include <aknnavide.h>
+#include <StifLogger.h>
+#include "Stifui.hrh"
+
+//#include "UIStoreIf.h"             
+//#include "UIStore.h"               
+//#include "UIEngine.h"              
+//#include "SettingServerClient.h"   
+
+#include <stifinternal/UIStoreIf.h>
+#include <stifinternal/UIStore.h>
+#include <stifinternal/UIEngine.h>
+#include <SettingServerClient.h>
+
+#include "UIStoreHandler.h"
+
+
+// FORWARD DECLARATIONS
+class CAppUIContainer;
+class CUIStoreHandler;
+
+// CONSTANTS
+//const ?type ?constant_var = ?constant;
+_LIT( KDefaultPathAndIni, "C:\\TestFramework\\TestFramework.ini" );
+
+// CLASS DECLARATION
+
+
+/**
+ * Class contains static methods for calling different
+ * types of message dialog boxes.
+ */
+class TMessageBoxUtil 
+	{
+	public:
+	
+	    /**
+	     * Display message that executed funtion is not implemented yet.
+	     */      
+		static void ShowNotImplementedYetL();
+
+	    /**
+	     * Display error note.
+	     * @param aMessage Error message to display.
+	     */      
+		static void ShowErrorNoteL( const TDesC& aMessage );
+	};
+
+
+/**
+* Application UI class.
+* Provides support for the following features:
+* - EIKON control architecture
+* - view architecture
+* - status pane
+* 
+*/
+class CAppUIAppUi : public CAknViewAppUi
+    {
+    public:  // Constructors and destructor
+
+        /**
+        * Symbian OS default constructor.
+        */      
+        void ConstructL();
+
+        /**
+        * Destructor.
+        */      
+        ~CAppUIAppUi();
+
+    public: // New functions
+
+        /**
+        * Returns pointer to UIStoreHandler object, 
+        * which handles test cases and test modules.
+        * @return UIStoreHandler to CData object
+        */
+        CUIStore* UIStoreHandler();
+
+        /**
+        * Shows outputs of the test case.
+        * @param aTestCase Pointer to started test case.
+        */
+        void ShowTestCaseOutput(CStartedTestCase* aTestCase);
+
+        /**
+        * Receives output update notification from CData.
+        * @param aTestCase Pointer to started test case.
+        * @param aStatus Status.
+        */
+        void OutputUpdateL( CStartedTestCase* aTestCase, TInt aStatus );
+        
+		/**
+        * Sets pointer to selected test case for viewing output.
+        * @param aStartedCase Pointer to started test case.
+        */
+        void SetStartedTestCase( CStartedTestCase* aStartedCase );   
+         
+        /**
+        * Returns pointer to started test case for viewing output.
+        * @return Poiner to started test case.
+        */
+		CStartedTestCase* GetStartedTestCase( ); 
+		
+		/**
+		 * Saves position of focus of any specific view
+		 * @param aViewId ID of view under which the position will be stored
+		 * @param aPosition is a number to be stored
+		 */
+		void SaveFocusPosition(TAppUIViewNumber aViewId, TInt aPosition);
+		
+		/**
+		 * Used to retrieve previous focus position in a specific view
+		 * @param aViewId - ID of view that the position should be retrieved for
+		 * @return the previous focus position
+		 */
+		TInt GetFocusPosition(TAppUIViewNumber aViewId);
+		
+
+    public: // Functions from base classes
+
+    private:
+        /**
+        * Initializes menu pane.
+        * @param aResourceId Menu pane resource ID.
+        * @param aMenuPane Menu pane pointer.
+        */
+        void DynInitMenuPaneL(TInt aResourceId,CEikMenuPane* aMenuPane);
+
+    private:
+        /**
+        * From CEikAppUi, takes care of command handling.
+        * @param aCommand command to be handled
+        */
+        void HandleCommandL(TInt aCommand);
+
+        /**
+        * From CEikAppUi, handles key events.
+        * @param aKeyEvent Event to handled.
+        * @param aType Type of the key event. 
+        * @return Response code (EKeyWasConsumed, EKeyWasNotConsumed). 
+        */
+        virtual TKeyResponse HandleKeyEventL(
+            const TKeyEvent& aKeyEvent,TEventCode aType);
+
+    private: //Data
+        CUIStoreHandler*                iUIStoreHandler;
+        CStartedTestCase*               iStartedTestCase;
+        TInt                            iPreviousView; // For Back function
+        
+        RArray<TInt>					iPreviousFocusPosition;	
+        // used to store positions in different views
+        
+        TBool							iPreviousPositionListValid; 
+        // used to mark validity of iPreviousFocusPosition array
+		
+    public: //Data
+        
+        /**
+        * Pointer to logger.
+        */
+        CStifLogger*                        iLogger;
+        
+        /**
+        * Mode of view started cases.
+        */
+        TInt /*enum TShowStartedCasesMode*/ iShowStartedCasesMode;
+        
+        /**
+        * Index of started test set.
+        */
+		TInt								iStartedTestSet;
+		
+	    /**
+        * Handle to Setting server.
+        */	
+		RSettingServer                      iSettingServer;
+		
+    public:     // Friend classes
+
+    protected:  // Friend classes
+
+    private:    // Friend classes
+                
+        // For iExecutedTestCaseCount moving
+        friend class CStartCasesView;
+        friend class CStatisticsView;
+        friend class CTestCaseOutputView;
+        friend class CTestSetInsertMenuView;
+        friend class CTestSetMenuView;
+
+    };
+
+#endif
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/avkon/stifui/inc/AppUIDocument.h	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,71 @@
+/*
+* 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 file contains CAppUIDocument class declaration.
+*
+*/
+
+#ifndef APPUIDOCUMENT_H
+#define APPUIDOCUMENT_H
+
+// INCLUDES
+#include <AknDoc.h>
+   
+// CONSTANTS
+
+// FORWARD DECLARATIONS
+class  CEikAppUi;
+
+// CLASS DECLARATION
+
+/**
+*  CAppUIDocument application class.
+*/
+class CAppUIDocument : public CAknDocument
+    {
+    public: // Constructors and destructor
+        /**
+        * Two-phased constructor.
+        */
+        static CAppUIDocument* NewL(CEikApplication& aApp);
+
+        /**
+        * Destructor.
+        */
+        virtual ~CAppUIDocument();
+
+    public: // New functions
+
+    protected:  // New functions
+
+    protected:  // Functions from base classes
+
+    private:
+
+        /**
+        * Symbian OS default constructor.
+        */
+        CAppUIDocument(CEikApplication& aApp);
+        void ConstructL();
+
+    private:
+
+        /**
+        * From CEikDocument, create CAppUIAppUi "App UI" object.
+        */
+        CEikAppUi* CreateAppUiL();
+    };
+
+#endif
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/avkon/stifui/inc/Container.h	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,275 @@
+/*
+* 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 file contains CTestCaseListBoxModel class
+* declaration
+*
+*/
+
+#ifndef CCONTAINER_H
+#define CCONTAINER_H
+
+#include <e32std.h>
+// Define *.mbm file name.
+_LIT(KListMbmFileName, "\\Resource\\Apps\\Stifui.mbm");
+
+// INCLUDES
+#include "View.h"
+
+#include <coecntrl.h>
+#include <eiklbo.h>     //  MEikListBoxObserver
+#include <bamdesca.h>   //  MDesCArray
+#include <aknsfld.h>
+
+//#include "RRefArray.h"        
+//#include "UIEngine.h"         
+//#include "UIStoreIf.h"        
+//#include "UIStoreContainer.h" 
+
+#include <stifinternal/RRefArray.h>
+#include <stifinternal/UIEngine.h>
+#include <stifinternal/UIStoreIf.h>
+#include <stifinternal/UIStoreContainer.h>
+   
+// FORWARD DECLARATIONS
+class CEikTextListBox;
+class CDesC16Array;
+
+//class CTestSetInsertMenuView;
+class CEikColumnListBox;
+class CStartedTestCase;
+
+class CUIStoreHandler;
+class CUIStore;
+class CUIStoreIf;
+class CUIEngineContainer;
+class CUIEngine;
+
+// CLASS DECLARATION
+
+class CTestCaseListBoxModel : public CBase, public MDesCArray
+    {
+    public:
+        /**
+        * Destructor.
+        */
+        ~CTestCaseListBoxModel();
+        
+        /**
+        * Two-phased constructor.
+        * @param aTestCasesInView Array of test cases in view.
+        * @return Pointer to created list box model.
+        */
+        static CTestCaseListBoxModel* NewL(
+            RPointerArray<CTestInfo>* aTestCasesInView);
+
+    public: // Functions from base classes
+    
+        /**
+        * Returns the number of descriptor elements in the array.
+        * @return The number of descriptor elements.
+        */
+        virtual TInt MdcaCount() const;
+        
+        /**
+        * Indexes into a descriptor array.
+        * @param aIndex The position of the descriptor element within the
+        *               array. The position is relative to zero; i.e. zero
+        *               implies the first descriptor element in the array. 
+        *               This value must be non-negative and less than the 
+        *               number of descriptors currently within the array 
+        *               otherwise the operator panics with 
+        *               EArrayIndexOutOfRange. 
+        * @return A non-modifiable pointer descriptor representing the 
+        *         descriptor element located at position aIndex within 
+        *         the array.
+        */
+        virtual TPtrC MdcaPoint( TInt aIndex ) const;
+    protected:
+        /**
+        * Symbian OS two phased constructor.
+        * Completes the construction of the object.
+        */
+        void ConstructL();
+    
+    protected: //data
+        RPointerArray<CTestInfo>*   iTestCasesInView;
+        HBufC*                      iBuffer;
+        
+    private: //data
+        
+    };
+    
+/**
+*  CContainer  container control class.
+*  
+*/
+class CContainer : public CCoeControl
+    {
+    public: // Constructors and destructor
+        
+        /**
+        * Symbian OS default constructor.
+        * @param aRect Frame rectangle for container.
+        */
+        void ConstructL();
+
+        /**
+        * Destructor.
+        */
+        ~CContainer();
+
+    public: // New functions
+    
+        /**
+        * Show only testcases which are defined is specified module.
+        * @param aModuleName Module which test cases are shown.
+        */
+        virtual void FilterCasesByModuleL(TName aModuleName);
+        
+        /**
+        * Show only testcases which are defined in specified test case file.
+        * @param aTestCaseFileName Test cases file name.
+        */
+        virtual void FilterCasesByTCFileNameL(TFileName aTestCaseFileName);
+        
+        /**
+        * Remove possible filtering of test cases -> show all test cases.
+        */
+        virtual void NoFilteringL();
+        
+        /**
+        * Returns pointers to selected test cases.
+        * @param aSelectedTestCases Currently selected test case.
+        */
+        virtual void SelectedTestCases(RPointerArray<CTestInfo>& aSelectedTestCases);
+
+        /**
+        * Returns pointers to currently (in list box) selected test cases info.
+        * @return Currently selected test case info.
+        */
+        virtual CTestInfo* SelectedTestCaseInfo();
+        
+        /**
+        * Returns pointers to selected test cases info.
+        * @param aIndex test case index
+        * @return Currently selected test case info.
+        */
+        virtual CTestInfo* TestCaseInfo( TInt aIndex );
+        
+        /**
+        * Sets graphic icon using listbox as CEikColumnListBox.
+        * @param aListBox Pointer to list box.
+        */
+        virtual void SetGraphicIconL( CEikColumnListBox* aListBox );
+
+        /**
+        * Appends graphics data.
+        * @param aIcons Pointer array of icons.
+        */
+        virtual void GraphicIconL( CArrayPtr<CGulIcon>* aIcons );
+        
+        /**
+        * Gets the index number of the current item in the view.
+        * @return Index number of the current item.
+        */
+        virtual TInt CurrentItemIndex();
+        
+        /**
+        * Sets the current item.
+        * @param aIndex Index of the item to make current.
+        */
+        virtual void SetCurrentItemIndex(TInt aCurrentTestCase);
+		
+		/**
+		* Inline function for getting pointer to list box.
+		* @return Pointer to list box.
+		*/
+		virtual inline CEikListBox* ListBox() { return (CEikListBox*)iListBox; };
+		
+		
+		
+		/**
+		* Processes user commands.
+		* @param aCommand ID of the command to respond to.
+		*/
+		virtual void ProcessCommandL( TInt  aCommand );
+		
+		/**
+		* Processes user commands.
+		* @param aCommand ID of the command to respond to.
+		*/
+		virtual void SelectionListProcessCommandL( TInt  aCommand );
+		
+		/**
+		* Handles mark commands.
+		* @param aCommand ID of the command to respond to.
+		*/
+		virtual void HandleMarkCommandL( TInt aCommand );
+		
+		
+		
+    public: // Functions from base classes
+
+    private: // Functions from base classes
+
+        /**
+        * From CoeControl,SizeChanged.
+        * Called by framework when the view size is changed.
+        */
+        virtual void SizeChanged();
+
+
+
+
+        /**
+        * From CoeControl,CountComponentControls.
+        * Gets a count of the component controls of this list box control.
+        * This information is used for DrawNow().
+        */
+        virtual TInt CountComponentControls() const;
+
+        /**
+        * From CCoeControl,ComponentControl.
+        * Gets a pointer to the specified component control.
+        * @param aIndex Index of the component control to look up.
+        * @return The control at aIndex.
+        */
+        virtual CCoeControl* ComponentControl(TInt aIndex) const;
+
+
+
+        /**
+        * From CCoeControl,Draw.
+        * Draw a control, called by window server.
+        * @param aRect The region of the control to be redrawn. Co-ordinates
+        *              are relative to the control's origin (top left corner).
+        */
+        virtual void Draw(const TRect& aRect) const;
+        
+    protected: //data
+        
+        CView*                          iParentView;
+        CEikColumnListBox*              iListBox;
+        //CEikTextListBox*                iListBox;
+        CTestCaseListBoxModel*          iListBoxModel;
+        RPointerArray<CTestInfo>        iTestCasesInView;
+        CUIStore*                       iUIStore;
+                        
+    private: //data
+        
+    };
+
+#endif // CTestSetInsertMenuContainer_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/avkon/stifui/inc/CreatedTestSetMenuContainer.h	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,126 @@
+/*
+* 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 file contains CCreatedTestSetMenuContainer
+* class declaration.
+*
+*/
+
+#ifndef CREATETESTSETMENUCONTAINER_H
+#define CREATETESTSETMENUCONTAINER_H
+
+// INCLUDES
+#include "Container.h"
+
+#include <coecntrl.h>
+#include <eiklbo.h> // MEikListBoxObserver
+#include <bamdesca.h> // MDesCArray
+#include <aknsfld.h>
+
+#include <stifinternal/RRefArray.h>
+#include <stifinternal/UIEngine.h>
+#include <stifinternal/UIStoreIf.h>
+#include <stifinternal/UIStoreContainer.h>
+   
+// FORWARD DECLARATIONS
+class CEikTextListBox;
+class CDesC16Array;
+
+class CCreatedTestSetMenuView;
+class CEikColumnListBox;
+class CStartedTestCase;
+
+class CUIStoreHandler;
+class CUIStore;
+class CUIStoreIf;
+class CUIEngineContainer;
+class CUIEngine;
+
+// CLASS DECLARATION
+/**
+*  CCreatedTestSetMenuContainer  container control class.
+*  
+*/
+class CCreatedTestSetMenuContainer : public CContainer//public CCoeControl /*, MEikListBoxObserver */ /* MCoeControlObserver */
+    {
+    public: // Constructors and destructor
+        
+        /**
+        * Symbian OS default constructor.
+        * @param aRect Frame rectangle for container.
+        */
+        void ConstructL(const TRect& aRect, MEikListBoxObserver* aListBoxObserver);
+
+        /**
+        * Destructor.
+        */
+        ~CCreatedTestSetMenuContainer();
+
+    public: // New functions
+        
+        /**
+         * Stores current position of focus of iListBox to the CAppUiAppUi object
+         */
+        void SaveActiveLine();
+        
+    public: // Functions from base classes
+
+    private: // Functions from base classes
+
+        /**
+        * From CoeControl,SizeChanged.
+        * Called by framework when the view size is changed.
+        */
+        void SizeChanged();
+
+        /**
+        * From CoeControl,CountComponentControls.
+        * Gets a count of the component controls of this list box control.
+        * This information is used for DrawNow().
+        */
+        TInt CountComponentControls() const;
+
+        /**
+        * From CCoeControl,ComponentControl.
+        * Gets a pointer to the specified component control.
+        * @param aIndex Index of the component control to look up.
+        * @return The control at aIndex.
+        */
+        CCoeControl* ComponentControl(TInt aIndex) const;
+
+        /**
+        * From CCoeControl,Draw.
+        * Draw a control, called by window server.
+        * @param aRect The region of the control to be redrawn. Co-ordinates
+        *              are relative to the control's origin (top left corner).
+        */
+        void Draw(const TRect& aRect) const;
+        
+        /**
+        * From CCoeControl,OfferKeyEventL
+        * Handles key events.
+        * @param aKeyEvent The key event.
+        * @param aType The type of key event.
+        * @return Indicates whether or not the key event was used 
+        *         by this control.
+        */
+		TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType);
+		        
+    private: //data
+        
+        CCreatedTestSetMenuView*            iParentView;
+    };
+
+#endif // CREATETESTSETMENUCONTAINER_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/avkon/stifui/inc/CreatedTestSetMenuView.h	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,120 @@
+/*
+* 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 file contains CCreatedTestSetMenuView class
+* declaration.
+*
+*/
+
+#ifndef CREATEDTESTSETSETMENUVIEW_H
+#define CREATEDTESTSETSETMENUVIEW_H
+
+// INCLUDES
+#include "View.h"
+#include <eiklbo.h> // MEikListBoxObserver
+#include <aknnavide.h> 
+
+
+// CONSTANTS
+
+// FORWARD DECLARATIONS
+class CCreatedTestSetMenuContainer;
+
+
+// CLASS DECLARATION
+
+/**
+*  CTestCaseMenuView view class.
+* 
+*/
+class CCreatedTestSetMenuView : public CView, public MEikListBoxObserver //CAknView
+    {
+    public: // Constructors and destructor
+
+        /**
+        * Symbian OS default constructor.
+        */
+        void ConstructL();
+
+        /**
+        * Destructor.
+        */
+        ~CCreatedTestSetMenuView();
+
+    public: // Functions from base classes
+        
+        /**
+        * Returns view´s id.
+        * @return View id.
+        */
+        TUid Id() const;
+
+        /**
+        * Handles a command.
+        * @param aCommand A command ID.
+        */
+        void HandleCommandL( TInt aCommand );
+
+        /**
+        * Handles client rect changes.
+        */
+        void HandleClientRectChange();
+
+        /**
+        * Handles a list box event.
+        * @param aListBox A pointer to list box.
+        * @param aEventType Type of list box event.
+        */
+        void HandleListBoxEventL(CEikListBox* aListBox, TListBoxEvent aEventType);
+
+    public: // New functions
+        
+     
+
+    private:
+
+        /**
+        * Initializes view when activated.
+        * @param aPrevViewId Id of the previous view (not used).
+        * @param aCustomMessageId Custom message id (not used).
+        * @param aCustomMessage Custom message (not used).
+        */
+        void DoActivateL(const TVwsViewId& aPrevViewId,TUid aCustomMessageId,
+            const TDesC8& aCustomMessage);
+
+        /**
+        * Deactivates view.
+        */
+        void DoDeactivate();
+
+    
+    private: // New functions
+        
+        /**
+        * Checks listbox selections and launches 
+        * query dialog to start test cases.
+        * @param aListBox Pointer to listbox.
+        */
+        void CheckListBoxSelectionsL(CEikListBox* aListBox);
+
+    private: // Data
+        CAknNavigationDecorator*    iNaviDecorator;
+        CCreatedTestSetMenuContainer*       iContainer;
+        TInt                        iCurrentTestCase;
+        TBufC<50>                   iCurrentTestSet;
+        TBool                       iSaveNeeded;
+    };
+
+#endif //CREATEDTESTSETSETMENUVIEW_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/avkon/stifui/inc/MainMenuContainer.h	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,127 @@
+/*
+* 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 file contains CMainMenuContainer class definition.
+*
+*/
+
+#ifndef CMAINMENUCONTAINER_H
+#define CMAINMENUCONTAINER_H
+
+// INCLUDES
+#include <coecntrl.h>
+#include <eiklbo.h>
+
+   
+// FORWARD DECLARATIONS
+class CEikTextListBox;
+
+// CLASS DECLARATION
+
+/**
+*  CMainMenuContainer  container control class.
+*  
+*/
+class CMainMenuContainer : public CCoeControl, public MEikListBoxObserver /* MCoeControlObserver */
+    {
+    public: // Constructors and destructor
+        
+        /**
+        * Symbian OS default constructor.
+        * @param aRect Frame rectangle for container.
+        */
+        void ConstructL(const TRect& aRect);
+
+        /**
+        * Destructor.
+        */
+        ~CMainMenuContainer();
+
+    public: // New functions
+    
+        /**
+        * Get currently selected items index.
+        * @return Current item index.
+        */		
+		TInt GetActiveLine();   
+		
+		/**
+		 * Makes the iListBox store its focus position to CAppUiAppUi object
+		 */
+		void SaveActiveLine();
+
+    public: // Functions from base classes
+   
+        /**
+        * Method HandleSelectedListItemL handles valix index.
+        * @param aIndex Current item index.
+        */
+        void HandleSelectedListItemL( TInt aIndex );    
+
+    private: // Functions from base classes
+
+        /**
+        * From CoeControl,SizeChanged.
+        * Called by framework when the view size is changed.
+        */
+        void SizeChanged();
+
+        /**
+        * From CoeControl,CountComponentControls.
+        * @return Number of controls indside this container.
+        */
+        TInt CountComponentControls() const;
+
+        /**
+        * From CCoeControl,ComponentControl.
+        * Gets the specified component of a compound control.
+        * @param aIndex The index of the control to get.
+        * @return The component control with an index of aIndex.
+        */
+        CCoeControl* ComponentControl(TInt aIndex) const;
+
+        /**
+        * From CCoeControl,Draw.
+        * Draw a control, called by window server.
+        * @param aRect The region of the control to be redrawn. Co-ordinates 
+        *              are relative to the control's origin (top left corner).
+        */
+        void Draw(const TRect& aRect) const;
+
+        /**
+        * Handles list box events.
+        * @param aListBox The originating list box. 
+        * @param aEventType A code for the event. Further information may be
+        *                   obtained by accessing the list box itself.
+        */
+		void HandleListBoxEventL(CEikListBox* aListBox,TListBoxEvent aEventType);
+
+        /**
+        * From CCoeControl,OfferKeyEventL
+        * Handles key events.
+        * @param aKeyEvent The key event.
+        * @param aType The type of key event.
+        * @return Indicates whether or not the key event was used 
+        *         by this control.
+        */
+		TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType);
+		
+        
+    private: //data
+        
+		CEikTextListBox*    iListBox;
+    };
+
+#endif
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/avkon/stifui/inc/MainMenuView.h	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,94 @@
+/*
+* 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 file contains CMainMenuView class declaration.
+*
+*/
+
+#ifndef MAINMENUVIEW_H
+#define MAINMENUVIEW_H
+
+// INCLUDES
+#include "View.h"
+#include <aknnavide.h> 
+
+// CONSTANTS
+// UID of view
+const TUid KMainMenuViewId = {1};
+
+// FORWARD DECLARATIONS
+class CMainMenuContainer;
+
+// CLASS DECLARATION
+
+/**
+*  CMainMenuView view class.
+* 
+*/
+class CMainMenuView : public CView //CAknView
+    {
+    public: // Constructors and destructor
+
+        /**
+        * Symbian OS default constructor.
+        */
+        void ConstructL();
+
+        /**
+        * Destructor.
+        */
+        ~CMainMenuView();
+
+    public: // Functions from base classes
+        
+        /**
+        * Returns view´s id.
+        * @return View id.
+        */
+        TUid Id() const;
+
+        /**
+        * Handles a command.
+        * @param aCommand A command ID.
+        */
+        void HandleCommandL( TInt aCommand );
+
+        /**
+        * Handles client rect changes.
+        */
+        void HandleClientRectChange();
+
+    private:
+        
+        /**
+        * Initializes view when activated.
+        * @param aPrevViewId Id of the previous view (not used).
+        * @param aCustomMessageId Custom message id (not used).
+        * @param aCustomMessage Custom message (not used).
+        */
+        void DoActivateL(const TVwsViewId& aPrevViewId,TUid aCustomMessageId,
+            const TDesC8& aCustomMessage);
+
+        /**
+        * Deactivates view.
+        */
+        void DoDeactivate();
+
+    private: // Data
+        CMainMenuContainer*         iContainer;
+        CAknNavigationDecorator*    iNaviDecorator;
+    };
+
+#endif
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/avkon/stifui/inc/MenuListBox.h	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,77 @@
+/*
+* 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 file contains CMenuListBox class declaration.
+*
+*/
+
+#ifndef MENULISTBOX_H_
+#define MENULISTBOX_H_
+
+// INCLUDES
+#include <eiktxlbx.h>
+#include "Stifui.hrh"
+#include "AppUIAppUi.h"
+#include <aknview.h>
+#include <aknlists.h>
+
+// CONSTANTS
+
+// FORWARD DECLARATIONS
+
+// CLASS DECLARATION
+
+/**
+*  CMenuListBox class. Has ability to store and retrieve previous focus position
+*/
+class CMenuListBox : public CAknSingleStyleListBox
+    {
+    public: // Constructors and destructor
+
+        static CMenuListBox* NewL(TAppUIViewNumber aViewId);
+        
+        /**
+        * Destructor.
+        */
+        virtual ~CMenuListBox();
+        
+        /**
+         * Sets focus on last chosen position
+         */
+        void SetPreviousFocus();
+        
+        /**
+         * Saves position of focus to CAppUiAppUi object
+         */
+        void SaveFocusPosition();
+        
+    private: // Constructors and destructor
+    
+    	CMenuListBox(TAppUIViewNumber aViewId);
+    	
+    	/**
+        * Symbian OS default constructor.
+        */
+        void ConstructL();
+
+    public: // Functions from base classes
+
+    private:
+
+    private: // Data
+    	const TAppUIViewNumber	iViewId;
+    };
+
+#endif /*MENULISTBOX_H_*/
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/avkon/stifui/inc/ShowStartedCasesContainer.h	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,252 @@
+/*
+* 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 file contains CStartedTestsListBoxModel class
+* declaration.
+*
+*/
+
+#ifndef CSHOWSTARTEDCASESCONTAINER_H
+#define CSHOWSTARTEDCASESCONTAINER_H
+
+// INCLUDES
+#include "Container.h"
+
+#include <coecntrl.h>
+#include <eiklbo.h>
+#include <bamdesca.h> // MDesCArray
+
+//#include "RRefArray.h" 
+#include <stifinternal/RRefArray.h>
+
+// CONSTANTS
+
+// FORWARD DECLARATIONS
+class CEikTextListBox;
+class CAknSingleGraphicStyleListBox;
+class CDesC16ArrayFlat;
+class CStartedTestCase;
+class CUIStore;
+
+// CLASS DECLARATION
+
+class CStartedTestsListBoxModel : public CTestCaseListBoxModel //public CBase, public MDesCArray
+    {
+    public:
+        /**
+        * Destructor.
+        */
+        ~CStartedTestsListBoxModel();
+        
+        /**
+        * Two-phased constructor.
+        * @param aTestsInView Array of test cases in view.
+        * @return Pointer to created list box model.
+        */
+        static CStartedTestsListBoxModel* NewL(
+                            RRefArray<CStartedTestCase>* aTestsInView);
+
+    public: // Functions from base classes
+        
+        /**
+        * Returns the number of descriptor elements in the array.
+        * @return The number of descriptor elements.
+        */
+        TInt MdcaCount() const;
+        
+        /**
+        * Indexes into a descriptor array.
+        * @param aIndex The position of the descriptor element within the
+        *               array. The position is relative to zero; i.e. zero
+        *               implies the first descriptor element in the array. 
+        *               This value must be non-negative and less than the 
+        *               number of descriptors currently within the array 
+        *               otherwise the operator panics with 
+        *               EArrayIndexOutOfRange. 
+        * @return A non-modifiable pointer descriptor representing the 
+        *         descriptor element located at position aIndex within 
+        *         the array.
+        */
+        TPtrC MdcaPoint(TInt aIndex) const;
+
+    private:
+
+        /**
+        * Symbian OS two phased constructor.
+        * Completes the construction of the object.
+        */
+        void ConstructL();
+
+    private: //data
+        RRefArray<CStartedTestCase>*        iTestCasesInView;
+    };
+
+/**
+*  CShowStartedCasesContainer  container control class.
+*  
+*/
+class CShowStartedCasesContainer : public CContainer //public CCoeControl /*, MEikListBoxObserver */ /* MCoeControlObserver */
+    {
+    public: // Constructors and destructor
+        
+        /**
+        * Symbian OS default constructor.
+        * @param aRect Frame rectangle for container.
+        * @return Observer for list box.
+        */
+        void ConstructL(const TRect& aRect, MEikListBoxObserver* aListBoxObserver);
+
+        /**
+        * Destructor.
+        */
+        ~CShowStartedCasesContainer();
+
+    public: // New functions
+        
+        /**
+        * Show only testcases which are defined is specified module.
+        * @param aModuleName Module which test cases are shown.
+        */
+        void FilterCasesByModuleL(TName aModuleName);
+        
+        /**
+        * Show only testcases which are defined in specified test case file.
+        * @param aTestCaseFileName Test cases file name.
+        */
+        void FilterCasesByTCFileNameL(TFileName aTestCaseFileName);
+        
+        /**
+        * Remove possible filtering of test cases -> show all test cases.
+        */
+        void NoFilteringL();
+        
+        /**
+        * Returns reference to currently selected test case in view (listbox).
+        * @return Currently selected test case.
+        */
+        CStartedTestCase* SelectedTestCase();
+        
+        /**
+        * Constructs list box model without any filtering.
+        */
+        void ConstructListBoxModelL();
+        
+        /**
+        * Draws the list box.
+        */
+        void DrawListBox();
+        
+        /**
+        * Returns count of test cases in view.
+        * @return Count of test cases in view.
+        */
+        TInt TestsInViewCount();
+        
+        /**
+        * Handles the addition of an item to the model.
+        */
+        void HandleItemAdditionL();
+        
+        /**
+        * Handles the removal of an item from the model.
+        */
+        void HandleItemRemovalL();
+        
+        /**
+        * Returns pointer to currently selected test case.
+        * @param Current test case.
+        */
+        CStartedTestCase* CurrentTestCase();
+        
+        /**
+        * Sets the current item.
+        * @param aIndex Index of the item to make current.
+        */
+        void SetCurrentItemIndex(TInt aIndex);
+        
+        /**
+        * Resets the selection indices, top and current item indices,
+        * the selection, and the horizontal scroll offset of this list box.
+        * This function does not redraw the list box.
+        */
+        void ResetListBox();
+        
+        /**
+        * Removes items from list box.
+        */
+        void RemoveSelectedExecutionsL();
+        
+        /**
+        * Removes all started test cases from list box.
+        */
+        void RemoveAllExecutionsInViewL();
+        
+        /**
+         * Stores current position of focus of iListBox to the CAppUiAppUi object
+         */
+        void SaveActiveLine();
+
+    private: // New functions
+
+    public: // Functions from base classes
+
+    private: // Functions from base classes
+
+        /**
+        * From CoeControl,SizeChanged.
+        * Called by framework when the view size is changed.
+        */
+        void SizeChanged();
+
+        /**
+        * From CoeControl,CountComponentControls.
+        * Gets a count of the component controls of this list box control.
+        * This information is used for DrawNow().
+        */
+        TInt CountComponentControls() const;
+
+        /**
+        * From CCoeControl,ComponentControl.
+        * Gets a pointer to the specified component control.
+        * @param aIndex Index of the component control to look up.
+        * @return The control at aIndex.
+        */
+        CCoeControl* ComponentControl(TInt aIndex) const;
+
+        /**
+        * From CCoeControl,Draw.
+        * Draw a control, called by window server.
+        * @param aRect The region of the control to be redrawn. Co-ordinates
+        *              are relative to the control's origin (top left corner).
+        */
+        void Draw(const TRect& aRect) const;
+
+        /**
+        * From CCoeControl,OfferKeyEventL
+        * Handles key events.
+        * @param aKeyEvent The key event.
+        * @param aType The type of key event.
+        * @return Indicates whether or not the key event was used 
+        *         by this control.
+        */
+		TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType);
+	
+    private: //data
+        
+        CStartedTestsListBoxModel*  iListBoxModel;    
+        RRefArray<CStartedTestCase> iStartedTestsPtrs;
+    };
+
+#endif // CSHOWSTARTEDCASESCONTAINER_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/avkon/stifui/inc/ShowStartedCasesView.h	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,130 @@
+/*
+* 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 file contains CShowStartedCasesView class 
+* declaration.
+*
+*/
+
+#ifndef SHOWSTARTEDCASESVIEW_H
+#define SHOWSTARTEDCASESVIEW_H
+
+// INCLUDES
+#include "View.h"
+#include <eiklbo.h>     // MEikListBoxObserver
+#include <aknnavide.h>  //CAknNavigationDecorator
+
+// CONSTANTS
+
+// FORWARD DECLARATIONS
+class CShowStartedCasesContainer;
+
+// CLASS DECLARATION
+
+/**
+*  CShowStartedCasesView view class.
+* 
+*/
+class CShowStartedCasesView : public CView, public MEikListBoxObserver
+    {
+    public: // Constructors and destructor
+
+        /**
+        * Symbian OS default constructor.
+        */
+        void ConstructL();
+
+        /**
+        * Destructor.
+        */
+        ~CShowStartedCasesView();
+
+    public: // Functions from base classes
+        
+        /**
+        * Returns view´s id.
+        * @return View id.
+        */
+        TUid Id() const;
+
+        /**
+        * Handles a command.
+        * @param aCommand A command ID.
+        */
+        void HandleCommandL( TInt aCommand );
+
+        /**
+        * Handles client rect changes.
+        */
+        void HandleClientRectChange();
+
+        /**
+        * Handles a list box event.
+        * @param aListBox A pointer to list box (not used).
+        * @param aEventType Type of list box event.
+        */
+        void HandleListBoxEventL(CEikListBox* /*aListBox*/, TListBoxEvent aEventType);
+
+    public: // New functions
+        
+        /**
+        * Handles status changes of test cases in view.
+        */
+        void TestCaseStateChangedL();
+        
+        /**
+        * Handles call to view test case´s output data.
+        */
+        void ViewTestCaseOutputL();
+
+    private:
+    
+        /**
+        * Initializes view when activated.
+        * @param aPrevViewId Id of the previous view (not used).
+        * @param aCustomMessageId Custom message id (not used).
+        * @param aCustomMessage Custom message (not used).
+        */
+        void DoActivateL(const TVwsViewId& aPrevViewId,TUid aCustomMessageId,
+            const TDesC8& aCustomMessage);
+
+        /**
+        * Deactivates view.
+        */
+        void DoDeactivate();
+
+        /** From MEikMenuObserver
+        * Initializes menu pane.
+        * @param aResourceId Menu pane resource ID
+        * @param aMenuPane Menu pane pointer
+        */
+        void DynInitMenuPaneL(TInt aResourceId,CEikMenuPane* aMenuPane);
+        
+        /**
+        * Refreshes view name shown in the navi pane.
+        */
+        void RefreshNaviTitleL();
+
+    private: // Data
+        CShowStartedCasesContainer* iContainer;
+        CAknNavigationDecorator*    iNaviDecorator;
+        TName                       iFilterModule;
+        TFileName                   iFilterTestCaseFile;
+        TInt                        iSelectedTestCase; // Which testcase was 
+                                                       // selected when view 
+                                                       // was active earlier.
+    };
+
+#endif //SHOWSTARTEDCASESVIEW_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/avkon/stifui/inc/StartCasesContainer.h	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,131 @@
+/*
+* 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 file contains CStartCasesContainer class 
+* declaration.
+*
+*/
+
+#ifndef CSTARTCASESCONTAINER_H
+#define CSTARTCASESCONTAINER_H
+
+// INCLUDES
+#include "Container.h"
+
+#include <coecntrl.h>
+#include <eiklbo.h> // MEikListBoxObserver
+#include <bamdesca.h> // MDesCArray
+#include <aknsfld.h>
+
+//#include "RRefArray.h"        
+//#include "UIEngine.h"         
+//#include "UIStoreIf.h"        
+//#include "UIStoreContainer.h" 
+
+#include <stifinternal/RRefArray.h>
+#include <stifinternal/UIEngine.h>
+#include <stifinternal/UIStoreIf.h>
+#include <stifinternal/UIStoreContainer.h>
+   
+// FORWARD DECLARATIONS
+class CEikTextListBox;
+class CDesC16Array;
+
+class CStartCasesView;
+class CEikColumnListBox;
+class CStartedTestCase;
+
+class CUIStoreHandler;
+class CUIStore;
+class CUIStoreIf;
+class CUIEngineContainer;
+class CUIEngine;
+
+// CLASS DECLARATION
+/**
+*  CStartCasesContainer  container control class.
+*  
+*/
+class CStartCasesContainer : public CContainer//public CCoeControl /*, MEikListBoxObserver */ /* MCoeControlObserver */
+    {
+    public: // Constructors and destructor
+        
+        /**
+        * Symbian OS default constructor.
+        * @param aRect Frame rectangle for container.
+        */
+        void ConstructL(const TRect& aRect, MEikListBoxObserver* aListBoxObserver);
+
+        /**
+        * Destructor.
+        */
+        ~CStartCasesContainer();
+
+    public: // New functions
+        
+        /**
+         * Stores current position of focus of iListBox to the CAppUiAppUi object
+         */
+        void SaveActiveLine();
+        
+    public: // Functions from base classes
+
+    private: // Functions from base classes
+
+        /**
+        * From CoeControl,SizeChanged.
+        * Called by framework when the view size is changed.
+        */
+        void SizeChanged();
+
+        /**
+        * From CoeControl,CountComponentControls.
+        * Gets a count of the component controls of this list box control.
+        * This information is used for DrawNow().
+        */
+        TInt CountComponentControls() const;
+
+        /**
+        * From CCoeControl,ComponentControl.
+        * Gets a pointer to the specified component control.
+        * @param aIndex Index of the component control to look up.
+        * @return The control at aIndex.
+        */
+        CCoeControl* ComponentControl(TInt aIndex) const;
+
+        /**
+        * From CCoeControl,Draw.
+        * Draw a control, called by window server.
+        * @param aRect The region of the control to be redrawn. Co-ordinates
+        *              are relative to the control's origin (top left corner).
+        */
+        void Draw(const TRect& aRect) const;
+        
+        /**
+        * From CCoeControl,OfferKeyEventL
+        * Handles key events.
+        * @param aKeyEvent The key event.
+        * @param aType The type of key event.
+        * @return Indicates whether or not the key event was used 
+        *         by this control.
+        */
+		TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType);
+		        
+    private: //data
+        
+        CStartCasesView*            iParentView;
+    };
+
+#endif // CSTARTCASESCONTAINER_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/avkon/stifui/inc/StartCasesView.h	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,132 @@
+/*
+* 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 file contains CStartCasesView class declaration.
+*
+*/
+
+#ifndef STARTCASESVIEW_H
+#define STARTCASESVIEW_H
+
+// INCLUDES
+#include "View.h"
+#include <eiklbo.h> // MEikListBoxObserver
+#include <aknnavide.h> 
+
+
+// CONSTANTS
+
+// FORWARD DECLARATIONS
+class CStartCasesContainer;
+
+
+// CLASS DECLARATION
+
+/**
+*  CTestCaseMenuView view class.
+* 
+*/
+class CStartCasesView : public CView, public MEikListBoxObserver //CAknView
+    {
+    public: // Constructors and destructor
+
+        /**
+        * Symbian OS default constructor.
+        */
+        void ConstructL();
+
+        /**
+        * Destructor.
+        */
+        ~CStartCasesView();
+
+    public: // Functions from base classes
+        
+        /**
+        * Returns view´s id.
+        * @return View id.
+        */
+        TUid Id() const;
+
+        /**
+        * Handles a command.
+        * @param aCommand A command ID.
+        */
+        void HandleCommandL( TInt aCommand );
+
+        /**
+        * Handles client rect changes.
+        */
+        void HandleClientRectChange();
+
+        /**
+        * Handles a list box event.
+        * @param aListBox A pointer to list box.
+        * @param aEventType Type of list box event.
+        */
+        void HandleListBoxEventL(CEikListBox* aListBox, TListBoxEvent aEventType);
+
+    public: // New functions
+        
+        /** 
+        * Starts test case.
+        */
+        void StartTestCaseL();
+        
+        /**
+        * Starts multiple test cases.
+        * @param aSelectedÍndexes Indexes of selected test cases.
+        */
+        void StartTestCasesL( RArray<TInt> aSelectedIndexes );
+
+    private:
+
+        /**
+        * Initializes view when activated.
+        * @param aPrevViewId Id of the previous view (not used).
+        * @param aCustomMessageId Custom message id (not used).
+        * @param aCustomMessage Custom message (not used).
+        */
+        void DoActivateL(const TVwsViewId& aPrevViewId,TUid aCustomMessageId,
+            const TDesC8& aCustomMessage);
+
+        /**
+        * Deactivates view.
+        */
+        void DoDeactivate();
+
+        /**
+        * Initializes menu pane.
+        * @param aResourceId Menu pane resource ID.
+        * @param aMenuPane Menu pane pointer.
+        */
+        void DynInitMenuPaneL(TInt aResourceId,CEikMenuPane* aMenuPane);
+    
+    private: // New functions
+        
+        /**
+        * Checks listbox selections and launches 
+        * query dialog to start test cases.
+        * @param aListBox Pointer to listbox.
+        */
+        void CheckListBoxSelectionsL(CEikListBox* aListBox);
+
+    private: // Data
+        CAknNavigationDecorator*    iNaviDecorator;
+        CStartCasesContainer*       iContainer;
+        TInt                        iCurrentTestCase;
+    };
+
+#endif //STARTCASESVIEW_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/avkon/stifui/inc/StartedCasesMenuContainer.h	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,130 @@
+/*
+* 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 file contains CStartedCasesMenuContainer class
+* declaration.
+*
+*/
+
+#ifndef CSTARTEDCASESMENUCONTAINER_H
+#define CSTARTEDCASESMENUCONTAINER_H
+
+// INCLUDES
+#include <coecntrl.h>
+#include <eiklbo.h>
+
+   
+// FORWARD DECLARATIONS
+class CEikTextListBox;
+
+// CLASS DECLARATION
+
+/**
+*  CStartedCasesMenuContainer  container control class.
+*  
+*/
+class CStartedCasesMenuContainer : public CCoeControl , public MEikListBoxObserver  /* MCoeControlObserver */
+    {
+    public: // Constructors and destructor
+        
+        /**
+        * Symbian OS default constructor.
+        * @param aRect Frame rectangle for container.
+        */
+        void ConstructL(const TRect& aRect );
+
+        /**
+        * Destructor.
+        */
+        ~CStartedCasesMenuContainer();
+
+    public: // New functions
+    
+        /**
+        * Get currently selected items index.
+        * @return Current item index.
+        */			
+		TInt GetActiveLine();   
+
+        /**
+         * Stores current position of focus of iListBox to the CAppUiAppUi object
+         */
+		void SaveActiveLine();
+		
+    public: // Functions from base classes
+    
+        /**
+        * Method HandleSelectedListItemL handles valix index.
+        * @param        TInt aIndex
+        * @return       nothing
+        */
+        void HandleSelectedListItemL( TInt aIndex );        
+
+    private: // Functions from base classes
+        
+        /**
+        * From CoeControl,SizeChanged.
+        * Called by framework when the view size is changed.
+        */
+        void SizeChanged();
+
+        /**
+        * From CoeControl,CountComponentControls.
+        * Gets a count of the component controls of this list box control.
+        * This information is used for DrawNow().
+        */
+        TInt CountComponentControls() const;
+
+        /**
+        * From CCoeControl,ComponentControl.
+        * Gets a pointer to the specified component control.
+        * @param aIndex Index of the component control to look up.
+        * @return The control at aIndex.
+        */
+        CCoeControl* ComponentControl(TInt aIndex) const;
+
+        /**
+        * From CCoeControl,Draw.
+        * Draw a control, called by window server.
+        * @param aRect The region of the control to be redrawn. Co-ordinates
+        *              are relative to the control's origin (top left corner).
+        */
+        void Draw(const TRect& aRect) const;
+       
+        /**
+        * Handles list box events.
+        * @param aListBox The originating list box. 
+        * @param aEventType A code for the event. Further information may be
+        *                   obtained by accessing the list box itself.
+        */
+        void HandleListBoxEventL(CEikListBox* aListBox,TListBoxEvent aEventType);
+
+        /**
+        * From CCoeControl,OfferKeyEventL
+        * Handles key events.
+        * @param aKeyEvent The key event.
+        * @param aType The type of key event.
+        * @return Indicates whether or not the key event was used 
+        *         by this control.
+        */
+		TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType);
+		
+        
+    private: //data
+        
+		CEikTextListBox*    iListBox;
+    };
+
+#endif // CSTARTEDCASESMENUCONTAINER_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/avkon/stifui/inc/StartedCasesMenuView.h	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,95 @@
+/*
+* 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 file contains CStartedCasesMenuView class
+* declaration.
+*
+*/
+
+#ifndef STARTEDCASESMENUVIEW_H
+#define STARTEDCASESMENUVIEW_H
+
+// INCLUDES
+#include <eiklbo.h> // MEikListBoxObserver
+#include <aknnavide.h> 
+#include "View.h"
+
+
+// CONSTANTS
+
+// FORWARD DECLARATIONS
+class CStartedCasesMenuContainer;
+
+// CLASS DECLARATION
+
+/**
+*  CStartedCasesMenuView view class.
+* 
+*/
+class CStartedCasesMenuView : public CView
+    {
+    public: // Constructors and destructor
+
+        /**
+        * Symbian OS default constructor.
+        */
+        void ConstructL();
+
+        /**
+        * Destructor.
+        */
+        ~CStartedCasesMenuView();
+
+    public: // Functions from base classes
+        
+        /**
+        * Returns view´s id.
+        * @return View id.
+        */
+        TUid Id() const;
+
+        /**
+        * Handles a command.
+        * @param aCommand A command ID.
+        */
+        void HandleCommandL( TInt aCommand );
+
+        /**
+        * Handles client rect changes.
+        */
+        void HandleClientRectChange();
+
+    private:
+
+        /**
+        * Initializes view when activated.
+        * @param aPrevViewId Id of the previous view (not used).
+        * @param aCustomMessageId Custom message id (not used).
+        * @param aCustomMessage Custom message (not used).
+        */
+        void DoActivateL(const TVwsViewId& aPrevViewId,TUid aCustomMessageId,
+            const TDesC8& aCustomMessage);
+
+        /**
+        * Deactivates view.
+        */
+        void DoDeactivate();
+
+    private: // Data
+        CAknNavigationDecorator*    iNaviDecorator;
+        CStartedCasesMenuContainer* iContainer;
+    };
+
+#endif
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/avkon/stifui/inc/StatisticsContainer.h	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,115 @@
+/*
+* 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 file contains CStatisticsContainer class
+* declaration.
+*
+*/
+
+#ifndef CSTATISTICSCONTAINER_H
+#define CSTATISTICSCONTAINER_H
+
+// INCLUDES
+#include "Container.h"
+
+#include <coecntrl.h>
+#include <eiklbo.h>     // MEikListBoxObserver
+#include <bamdesca.h>   // MDesCArray
+#include <aknsfld.h>
+
+// FORWARD DECLARATIONS
+class CEikTextListBox;
+class CDesC16Array;
+
+class CStartCasesView;
+class CEikColumnListBox;
+
+// CLASS DECLARATION
+/**
+*  StatisticsContainer container control class.
+*  
+*/
+class CStatisticsContainer : public CContainer//public CCoeControl /*, MEikListBoxObserver */ /* MCoeControlObserver */
+    {
+    public: // Constructors and destructor
+        
+        /**
+        * Symbian OS default constructor.
+        * @param aRect Frame rectangle for container.
+        */
+        void ConstructL(const TRect& aRect, MEikListBoxObserver* aListBoxObserver);
+
+        /**
+        * Destructor.
+        */
+        ~CStatisticsContainer();
+
+    public: // New functions
+
+        /**
+         * Stores current position of focus of iListBox to the CAppUiAppUi object
+         */
+        void SaveActiveLine();
+
+    public: // Functions from base classes
+
+    private: // Functions from base classes
+
+        /**
+        * From CoeControl,SizeChanged.
+        * Called by framework when the view size is changed.
+        */
+        void SizeChanged();
+
+        /**
+        * From CoeControl,CountComponentControls.
+        * Gets a count of the component controls of this list box control.
+        * This information is used for DrawNow().
+        */
+        TInt CountComponentControls() const;
+
+        /**
+        * From CCoeControl,ComponentControl.
+        * Gets a pointer to the specified component control.
+        * @param aIndex Index of the component control to look up.
+        * @return The control at aIndex.
+        */
+        CCoeControl* ComponentControl(TInt aIndex) const;
+
+        /**
+        * From CCoeControl,Draw.
+        * Draw a control, called by window server.
+        * @param aRect The region of the control to be redrawn. Co-ordinates
+        *              are relative to the control's origin (top left corner).
+        */
+        void Draw(const TRect& aRect) const;
+
+        /**
+        * From CCoeControl,OfferKeyEventL
+        * Handles key events.
+        * @param aKeyEvent The key event.
+        * @param aType The type of key event.
+        * @return Indicates whether or not the key event was used 
+        *         by this control.
+        */
+		TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType);
+		        
+    private: //data
+        
+        CStartCasesView*            iParentView;
+        CDesC16ArrayFlat*           iTestCaseArray;
+    };
+
+#endif // CSTATISTICSCONTAINER_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/avkon/stifui/inc/StatisticsView.h	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,115 @@
+/*
+* 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 file contains CStatisticsView class declaration.
+*
+*/
+
+#ifndef STATISTICSVIEW_H
+#define STATISTICSVIEW_H
+
+// INCLUDES
+#include "View.h"
+#include <eiklbo.h> // MEikListBoxObserver
+
+// CONSTANTS
+
+// FORWARD DECLARATIONS
+class CStatisticsContainer;
+
+// CLASS DECLARATION
+
+/**
+*  CTestCaseMenuView view class.
+* 
+*/
+class CStatisticsView : public CView, public MEikListBoxObserver //CAknView
+    {
+    public: // Constructors and destructor
+
+        /**
+        * Symbian OS default constructor.
+        */
+        void ConstructL();
+
+        /**
+        * Destructor.
+        */
+        ~CStatisticsView();
+
+    public: // Functions from base classes
+        
+        /**
+        * Returns view´s id.
+        * @return View id.
+        */
+        TUid Id() const;
+
+        /**
+        * Handles a command.
+        * @param aCommand A command ID.
+        */
+        void HandleCommandL( TInt aCommand );
+
+        /**
+        * Handles client rect changes.
+        */
+        void HandleClientRectChange();
+
+        /**
+        * Handles a list box event.
+        * @param aListBox A pointer to list box.
+        * @param aEventType Type of list box event.
+        */
+        void HandleListBoxEventL(CEikListBox* aListBox, TListBoxEvent aEventType);
+
+    public: // New functions
+
+        /** 
+        * Starts test case.
+        */
+        void StartTestCasesL();
+
+    private:
+
+        /**
+        * Initializes view when activated.
+        * @param aPrevViewId Id of the previous view (not used).
+        * @param aCustomMessageId Custom message id (not used).
+        * @param aCustomMessage Custom message (not used).
+        */
+        void DoActivateL(const TVwsViewId& aPrevViewId,TUid aCustomMessageId,
+            const TDesC8& aCustomMessage);
+
+        /**
+        * Deactivates view.
+        */
+        void DoDeactivate();
+
+        /** From MEikMenuObserver
+        * Initializes menu pane.
+        * @param aResourceId Menu pane resource ID
+        * @param aMenuPane Menu pane pointer
+        */
+        void DynInitMenuPaneL(TInt aResourceId,CEikMenuPane* aMenuPane);
+
+
+    private: // Data
+        CAknNavigationDecorator*    iNaviDecorator;
+        CStatisticsContainer*       iContainer;
+        TInt                        iCurrentTestCase;
+    };
+
+#endif //STATISTICSVIEW_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/avkon/stifui/inc/Stifui.hrh	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,113 @@
+/*
+* 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: Const definitions file.
+*
+*/
+
+#ifndef STIF_UI_HRH
+#define STIF_UI_HRH
+
+enum TAppUICommandIds
+    {
+    EAppUIGoBack = 1,
+    EAppUIGoToMainMenu,
+    EAppUIGoToTestCaseMenu,
+    EAppUIGoToModulesMenu,
+    EAppUIGoToTestSetsMenu,
+	ECmdGoToStartCasesView,
+	ECmdGoToStartedCasesView,
+    ECmdShowStartedTestSet,
+    ECmdCreateTestSet,
+    ECmdLoadTestSet,
+    ECmdStartTestSet,
+    ECmdSaveTestSet,
+    ECmdInsertTestCases,
+    ECmdRemoveTestCases,
+	ECmdFilterCases,
+	ECmdMarkMenu,
+    ECmdInsertSelectedCases,
+    ECmdShowSetMenu,
+	ECmdStartCases,
+	ECmdShowAllStartedCases,
+	ECmdShowOngoingCases,
+	ECmdShowPassedCases,
+	ECmdShowFailedCases,
+	ECmdShowPausedCases,
+	ECmdShowCrashedAbortedCases,
+	ECmdShowStatistics,
+    ECmdViewOutput,
+	ECmdPauseTestCase,
+	ECmdResumeTestCase,
+	ECmdAbortTestCase,
+	ECmdRemoveExecution,
+	ECmdRemoveAllExecutions,
+	ECmdOpenModule,
+	ECmdAddModule,
+	ECmdRemoveModule,
+    ECmdFilterMenu,
+    ECmdShowAbout,
+	ECmdFilterByModule = 0x1000,
+	ECmdFilterByTestCaseFile = 0x2000,
+	ECmdNOFiltering = 0x3000,
+	ECmdGoToTestSetView
+    };
+
+
+enum TAppUITabViewId
+    {
+	ETestCaseMenuTab = 1,
+    ETestModulesMenuTab,
+    ETestSetsMenuTab
+    };
+ 
+// Application view ids.
+enum TAppUIViewNumber
+	{
+    EMainMenuViewId = 1,
+    ETestCaseMenuViewId,
+    EStartCaseMenuViewId,
+    EStartedCasesMenuViewId,
+    ETestModulesMenuViewId,
+    ETestSetBaseMenuViewId,
+    ETestSetMenuViewId,
+    ETestSetInsertMenuViewId,
+    ETestSetStartedCasesViewId,
+    ETestSetsMenuViewId, /*???*/
+    EShowStartedCasesViewId,
+    EShowStatisticsViewId,
+	ETestCaseOutputViewId,
+	EStatisticsViewId,
+	ECreatedTestSetMenuViewId
+	};
+
+enum TPanic
+    {
+    EModuleIndexOutOfBound,
+    EShowCasesOutOfSync
+    };
+
+enum TShowStartedCasesMode
+    {
+    EShowAllStartedCases,
+    EShowOngoingCases,
+    EShowPausedCases,
+    EShowPassedCases,
+    EShowFailedCases,
+    EShowCrashedAbortedCases,
+    EShowStatistics
+    };
+
+#endif      // STIF_UI_HRH
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/avkon/stifui/inc/Stifui_loc.hrh	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,144 @@
+/*
+* 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 file contains localized strings.
+*
+*/
+
+// LOCALISATION STRINGS
+
+//#define qtn_testcase_menu_tab           "Cases"
+//#define qtn_testmodules_menu_tab        "Modules"
+//#define qtn_testsets_menu_tab           "Sets"
+
+// Main menu
+#define qtn_mainmenulist_test_cases     "\tTest Cases"
+#define qtn_mainmenulist_modules        "\tModules"
+#define qtn_mainmenulist_test_sets      "\tTest Sets"
+
+// Test cases menu
+#define qtn_testcasemenu_startcase      "\tStart Case(s)"
+#define qtn_testcasemenu_startedcases   "\tStarted Cases"
+
+// Started cases menu
+#define qtn_startedcases_allcases       "\tAll Started Cases"
+#define qtn_startedcases_ongoing        "\tOngoing Cases"
+#define qtn_startedcases_paused         "\tPaused Cases"
+#define qtn_startedcases_passed         "\tPassed Cases"
+#define qtn_startedcases_failed         "\tFailed Cases"
+#define qtn_startedcases_crashed_aborted        "\tCrashed/Aborted Cases"
+#define qtn_startedcases_statistics     "\tStatistics"
+
+// Modules menu
+#define qtn_open_module                 "Open module"
+#define qtn_add_module                  "Load all module(s)"
+#define qtn_remove_module               "Remove module"
+
+// Test set menu.
+#define qtn_testsetbasemenu_createtestset	"\tCreate test set"
+#define qtn_testsetbasemenu_loadtestset		"\tLoad test set"
+#define qtn_owerwrite_testset_confirmation	"Test set already created. Do you want to overwrite it?"
+#define qtn_save_testset_confirmation       "Save current test?"//changes for STIF-451
+#define qtn_load_testset_errornote          "Error loading test set."
+
+#define qtn_testsetinsert_add_selected  "Add selected"
+#define qtn_insert_confirmation			"Add selected test case(s) to test set?"
+#define qtn_insert_none_selected        "No test cases selected."
+
+#define qtn_testset_started_menu        "Show"
+#define qtn_testset_set_menu            "Set"
+
+#define qtn_testset_started_allcases    "Started Cases"
+#define qtn_testset_started_ongoing     "Ongoing Cases"
+#define qtn_testset_started_paused      "Paused Cases"
+#define qtn_testset_started_passed      "Passed Cases"
+#define qtn_testset_started_failed      "Failed Cases"
+#define qtn_testset_started_crashed_aborted     "Crashed/Aborted Cases"
+
+#define qtn_filter_test_cases           "Filter"
+#define qtn_by_module                   "By module"
+#define qtn_by_testcasefile             "By test case file"
+
+// Test case operations and menu texts
+#define qtn_markmenu_title				"Mark/Unmark"
+#define qtn_markmenu_mark				"Mark"
+#define qtn_markmenu_unmark				"Unmark"
+#define qtn_markmenu_markall			"Mark All"
+#define qtn_markmenu_unmarkall			"Unmark All"
+#define qtn_mark_test_case              "Mark"
+#define qtn_unmark_test_case            "Unmark"
+
+#define qtn_filter_menu                 "Filtering"
+#define qtn_filter_by_modules 		    "Filter by module"
+#define qtn_filter_by_test_case_file 	"Filter by test case file"
+#define qtn_no_filtering 		        "No filtering"
+
+
+//#define qtn_remove_execution            "Remove execution"
+//#define qtn_remove_all_executions       "Remove all executions"
+#define qtn_testcase_control_menu       "Test case control"
+#define qtn_view_output                 "View ouput of case"
+#define qtn_pause_testcase              "Pause"
+#define qtn_resume_testcase             "Resume"
+#define qtn_abort_testcase              "Abort"
+
+#define qtn_exit                        "Exit"
+
+// Start test cases queries.
+#define qtn_start_test_cases            "Start Case(s)"
+#define qtn_starting_test_case          "Start test?"
+#define qtn_starting_test_cases         "Start tests?"
+
+#define qtn_start                       "Start"
+#define qtn_start_and_view_output       "Start and view output"
+
+#define qtn_start_test					"Start"
+#define qtn_start_test_output			"Start&view output"
+#define qtn_start_tests_parallel		"Parallel"
+#define qtn_start_tests_serial			"Sequential"
+
+// example caption strings for app
+#define qtn_app_caption_string          "STIF UI"
+#define qtn_appui_demo              	"Demo"
+
+#define qtn_app_short_caption_string    "STIF UI"
+
+// Navipanel titles
+#define qtn_navi_load_test_set			"Load Test Set"
+#define qtn_navi_main					"Main menu"
+#define qtn_navi_testcases				"Test cases menu"
+#define qtn_navi_startcases				"Start cases"
+#define qtn_navi_startedcases			"Started cases"
+#define qtn_navi_testcase_output		"Test case output"
+#define qtn_navi_modules				"Modules menu"
+#define qtn_navi_testset_base			"Test set menu"
+#define qtn_navi_testset				"Test set"
+#define qtn_navi_testset_insert			"Insert test case"
+
+#define qtn_navi_started    			"Started cases"
+#define qtn_navi_started_all			"All started cases"
+#define qtn_navi_started_ongoing		"Ongoing cases"
+#define qtn_navi_started_paused			"Paused cases"
+#define qtn_navi_started_passed			"Passed cases"
+#define qtn_navi_started_failed			"Failed cases"
+#define qtn_navi_started_crashed_aborted		"Crashed/Aborted cases"
+#define qtn_navi_started_stats			"Statistics"
+
+// Test case states
+#define qtn_testcase_state_running      "Running"
+#define qtn_testcase_state_passed       "Passed"
+#define qtn_testcase_state_failed       "Failed"
+#define qtn_testcase_state_crashed_aborted      "Crashed/Aborted"
+#define qtn_testcase_state_unknown      "Undefined state!"
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/avkon/stifui/inc/TestCaseMenuContainer.h	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +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: This file contains CTestCaseMenuContainer class 
+* declaration.
+*
+*/
+
+#ifndef CTESTCASEMENUCONTAINER_H
+#define CTESTCASEMENUCONTAINER_H
+
+// INCLUDES
+#include <coecntrl.h>
+#include <eiklbo.h>
+
+   
+// FORWARD DECLARATIONS
+class CEikTextListBox;
+
+// CLASS DECLARATION
+
+/**
+*  CTestCaseMenuContainer  container control class.
+*  
+*/
+class CTestCaseMenuContainer : public CCoeControl, public MEikListBoxObserver  /* MCoeControlObserver */
+    {
+    public: // Constructors and destructor
+        
+        /**
+        * Symbian OS default constructor.
+        * @param aRect Frame rectangle for container.
+        */
+        void ConstructL(const TRect& aRect);
+
+        /**
+        * Destructor.
+        */
+        ~CTestCaseMenuContainer();
+
+    public: // New functions
+
+        /**
+        * Get currently selected items index.
+        * @return Current item index.
+        */	
+		TInt GetActiveLine();
+		
+        /**
+         * Stores current position of focus of iListBox to the CAppUiAppUi object
+         */
+		void SaveActiveLine();
+    
+    public: // Functions from base classes
+     
+        /**
+        * Method HandleSelectedListItemL handles valix index.
+        * @param        TInt aIndex
+        * @return       nothing
+        */
+        void HandleSelectedListItemL( TInt aIndex );      
+
+    private: // Functions from base classes
+
+        /**
+        * From CoeControl,SizeChanged.
+        * Called by framework when the view size is changed.
+        */
+        void SizeChanged();
+
+        /**
+        * From CoeControl,CountComponentControls.
+        * Gets a count of the component controls of this list box control.
+        * This information is used for DrawNow().
+        */
+        TInt CountComponentControls() const;
+
+        /**
+        * From CCoeControl,ComponentControl.
+        * Gets a pointer to the specified component control.
+        * @param aIndex Index of the component control to look up.
+        * @return The control at aIndex.
+        */
+        CCoeControl* ComponentControl(TInt aIndex) const;
+
+        /**
+        * From CCoeControl,Draw.
+        * Draw a control, called by window server.
+        * @param aRect The region of the control to be redrawn. Co-ordinates
+        *              are relative to the control's origin (top left corner).
+        */
+        void Draw(const TRect& aRect) const;
+       
+        /**
+        * Handles list box events.
+        * @param aListBox The originating list box. 
+        * @param aEventType A code for the event. Further information may be
+        *                   obtained by accessing the list box itself.
+        */
+        void HandleListBoxEventL(CEikListBox* aListBox,TListBoxEvent aEventType);
+
+        /**
+        * From CCoeControl,OfferKeyEventL
+        * Handles key events.
+        * @param aKeyEvent The key event.
+        * @param aType The type of key event.
+        * @return Indicates whether or not the key event was used 
+        *         by this control.
+        */
+		TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType);
+		        
+    private: //data
+        
+		CEikTextListBox*    iListBox;
+    };
+
+#endif // CTESTCASEMENUCONTAINER_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/avkon/stifui/inc/TestCaseMenuView.h	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,96 @@
+/*
+* 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 file contains CTestCaseMenuView class 
+* declaration.
+*
+*/
+
+#ifndef TESTCASEMENUVIEW_H
+#define TESTCASEMENUVIEW_H
+
+// INCLUDES
+#include "View.h"
+#include <aknnavide.h> 
+
+
+// CONSTANTS
+// UID of view
+const TUid KTestCaseMenuViewId = {2};
+
+// FORWARD DECLARATIONS
+class CTestCaseMenuContainer;
+
+// CLASS DECLARATION
+
+/**
+*  CTestCaseMenuView view class.
+* 
+*/
+class CTestCaseMenuView : public CView //CAknView
+    {
+    public: // Constructors and destructor
+
+        /**
+        * Symbian OS default constructor.
+        */
+        void ConstructL();
+
+        /**
+        * Destructor.
+        */
+        ~CTestCaseMenuView();
+
+    public: // Functions from base classes
+        
+        /**
+        * Returns view´s id.
+        * @return View id.
+        */
+        TUid Id() const;
+
+        /**
+        * Handles a command.
+        * @param aCommand A command ID.
+        */
+        void HandleCommandL( TInt aCommand );
+
+        /**
+        * Handles client rect changes.
+        */
+        void HandleClientRectChange();
+
+    private:
+
+        /**
+        * Initializes view when activated.
+        * @param aPrevViewId Id of the previous view (not used).
+        * @param aCustomMessageId Custom message id (not used).
+        * @param aCustomMessage Custom message (not used).
+        */
+        void DoActivateL(const TVwsViewId& aPrevViewId,TUid aCustomMessageId,
+            const TDesC8& aCustomMessage);
+
+        /**
+        * Deactivates view.
+        */
+        void DoDeactivate();
+        
+    private: // Data
+        CAknNavigationDecorator*    iNaviDecorator;
+        CTestCaseMenuContainer*     iContainer;
+    };
+
+#endif
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/avkon/stifui/inc/TestCaseOutputContainer.h	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,184 @@
+/*
+* 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 file contains CTestOutputListBoxModel class
+* declaration.
+*
+*/
+
+#ifndef TESTCASEOUTPUTCONTAINER_H
+#define TESTCASEOUTPUTCONTAINER_H
+
+// INCLUDES
+#include <coecntrl.h>
+#include <eiklbo.h>
+#include <bamdesca.h>   // MDesCArray
+
+// #include "RRefArray.h"  
+#include <stifinternal/RRefArray.h>
+
+
+// Define *.mbm file name.
+_LIT(KMbmFileName, "\\Resource\\Apps\\Stifui.mbm");
+
+// FORWARD DECLARATIONS
+class CEikTextListBox;
+class CAknSingleGraphicStyleListBox;
+class CDesC16ArrayFlat;
+class CStartedTestCase;
+
+class CUIStore;
+
+// CLASS DECLARATION
+
+class CTestOutputListBoxModel : public CBase, public MDesCArray
+    {
+    public:
+        /**
+        * Destructor.
+        */
+        ~CTestOutputListBoxModel();
+        
+        /**
+        * Two-phased constructor.
+        * @param aStartedTestCase Pointer to started test case.
+        * @return Pointer to created list box model.
+        */
+        static CTestOutputListBoxModel* NewL(CStartedTestCase* aStartedTestCase);
+
+    public: // Functions from base classes
+    
+        /**
+        * Returns the number of descriptor elements in the array.
+        * @return The number of descriptor elements.
+        */
+        TInt MdcaCount() const;
+        
+        /**
+        * Indexes into a descriptor array.
+        * @param aIndex The position of the descriptor element within the
+        *               array. The position is relative to zero; i.e. zero
+        *               implies the first descriptor element in the array. 
+        *               This value must be non-negative and less than the 
+        *               number of descriptors currently within the array 
+        *               otherwise the operator panics with 
+        *               EArrayIndexOutOfRange. 
+        * @return A non-modifiable pointer descriptor representing the 
+        *         descriptor element located at position aIndex within 
+        *         the array.
+        */
+        TPtrC MdcaPoint(TInt aIndex) const;
+
+    private:
+        /**
+        * Symbian OS two phased constructor.
+        * Completes the construction of the object.
+        */
+        void ConstructL();
+
+    private: //data
+        CStartedTestCase* iStartedTestCase;
+        HBufC*            iBuffer;
+
+    };
+
+/**
+*  CTestCaseOutputContainer  container control class.
+*  
+*/
+class CTestCaseOutputContainer : public CCoeControl, public MEikListBoxObserver /* MCoeControlObserver */
+    {
+    public: // Constructors and destructor
+        
+        /**
+        * Symbian OS default constructor.
+        * @param aRect Frame rectangle for container.
+        */
+        //void ConstructL(const TRect& aRect, TInt aExecutedTestCaseCount );
+        void ConstructL(const TRect& aRect, CStartedTestCase* aStartedTestCase );
+
+        /**
+        * Destructor.
+        */
+        ~CTestCaseOutputContainer();
+
+    public: // New functions
+        /**
+        * Handles addition of item to list box.
+        */
+        void OutputUpdateL();
+
+    private:
+
+    public: // Functions from base classes
+
+    private: // Functions from base classes
+    
+        /**
+        * From CoeControl,SizeChanged.
+        * Called by framework when the view size is changed.
+        */
+        void SizeChanged();
+
+        /**
+        * From CoeControl,CountComponentControls.
+        * Gets a count of the component controls of this list box control.
+        * This information is used for DrawNow().
+        */
+        TInt CountComponentControls() const;
+
+        /**
+        * From CCoeControl,ComponentControl.
+        * Gets a pointer to the specified component control.
+        * @param aIndex Index of the component control to look up.
+        * @return The control at aIndex.
+        */
+        CCoeControl* ComponentControl(TInt aIndex) const;
+
+        /**
+        * From CCoeControl,Draw.
+        * Draw a control, called by window server.
+        * @param aRect The region of the control to be redrawn. Co-ordinates
+        *              are relative to the control's origin (top left corner).
+        */
+        void Draw(const TRect& aRect) const;
+       
+        /**
+        * Handles list box events.
+        * @param aListBox The originating list box. 
+        * @param aEventType A code for the event. Further information may be
+        *                   obtained by accessing the list box itself.
+        */
+        void HandleListBoxEventL(CEikListBox* aListBox,TListBoxEvent aEventType);
+
+        /**
+        * From CCoeControl,OfferKeyEventL
+        * Handles key events.
+        * @param aKeyEvent The key event.
+        * @param aType The type of key event.
+        * @return Indicates whether or not the key event was used 
+        *         by this control.
+        */
+		TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType);
+        
+    private: //data
+        
+        CEikTextListBox*            iListBox;
+        CTestOutputListBoxModel*    iListBoxModel;
+        CUIStore*                   iUIStore;
+
+    };
+
+#endif // TESTCASEOUTPUTCONTAINER_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/avkon/stifui/inc/TestCaseOutputView.h	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,122 @@
+/*
+* 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 file contains CTestCaseOutputView class 
+* declaration.
+*
+*/
+
+#ifndef TESTCASEOUTPUTVIEW_H
+#define TESTCASEOUTPUTVIEW_H
+
+// INCLUDES
+#include "View.h"
+#include <aknnavide.h> 
+
+
+// CONSTANTS
+
+// FORWARD DECLARATIONS
+class CTestCaseOutputContainer;
+
+// CLASS DECLARATION
+
+/**
+*  CTestCaseOutputView view class.
+* 
+*/
+class CTestCaseOutputView : public CView
+    {
+    public: // Constructors and destructor
+
+        /**
+        * Symbian OS default constructor.
+        */
+        void ConstructL();
+
+        /**
+        * Destructor.
+        */
+        ~CTestCaseOutputView();
+
+    public: // Functions from base classes
+        
+        /**
+        * Returns view´s id.
+        * @return View id.
+        */
+        TUid Id() const;
+
+        /**
+        * Handles a command.
+        * @param aCommand A command ID.
+        */
+        void HandleCommandL( TInt aCommand );
+
+        /**
+        * Handles client rect changes.
+        */
+        void HandleClientRectChange();
+
+    public: // New functions
+        
+        /**
+        * Receives output update notification from AppUI
+        * @param aTestCase A pointer to started test case.
+        */
+        void OutputUpdateL( CStartedTestCase* aTestCase );
+
+        /**
+        * Prints test case state to title pane
+        */
+        void PrintTestCaseStateL();
+
+        /**
+        * Handles test case state changed notification
+        */
+        void TestCaseStateChangedL();
+
+    private:
+
+        /**
+        * Initializes view when activated.
+        * @param aPrevViewId Id of the previous view (not used).
+        * @param aCustomMessageId Custom message id (not used).
+        * @param aCustomMessage Custom message (not used).
+        */
+        void DoActivateL(const TVwsViewId& aPrevViewId,TUid aCustomMessageId,
+            const TDesC8& aCustomMessage);
+
+        /**
+        * Deactivates view.
+        */
+        void DoDeactivate();
+
+        /** From MEikMenuObserver
+        * Initializes menu pane.
+        * @param aResourceId Menu pane resource ID
+        * @param aMenuPane Menu pane pointer
+        */
+        void DynInitMenuPaneL(TInt aResourceId,CEikMenuPane* aMenuPane);
+
+
+    private: // Data
+        CAknNavigationDecorator*    iNaviDecorator;
+        CTestCaseOutputContainer*   iContainer;
+        CStartedTestCase* 			iCurrentTestCase;
+
+    };
+
+#endif //SHOWSTARTEDCASESVIEW_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/avkon/stifui/inc/TestModulesMenuContainer.h	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,169 @@
+/*
+* 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 file contains CTestModulesListBoxModel class 
+* declaration.
+*
+*/
+
+#ifndef CTESTMODULESMENUCONTAINER_H
+#define CTESTMODULESMENUCONTAINER_H
+
+// INCLUDES
+#include <coecntrl.h>
+#include <eiklbo.h>
+
+// #include "RRefArray.h" 
+#include <stifinternal/RRefArray.h>
+
+// FORWARD DECLARATIONS
+class CEikTextListBox;
+class CUIStore;
+
+// CLASS DECLARATION
+class CTestModulesListBoxModel : public CBase, public MDesCArray
+    {
+    public:
+        /**
+        * Destructor.
+        */
+        ~CTestModulesListBoxModel();
+
+        /**
+        * Two-phased constructor.
+        * @param aTestModules Array of test modules names.
+        * @return Pointer to created list box model.
+        */
+        static CTestModulesListBoxModel* NewL(RRefArray<TDesC> aTestModules);
+
+    public: // Functions from base classes
+    
+        /**
+        * Returns the number of descriptor elements in the array.
+        * @return The number of descriptor elements.
+        */
+        TInt MdcaCount() const;
+        
+        /**
+        * Indexes into a descriptor array.
+        * @param aIndex The position of the descriptor element within the
+        *               array. The position is relative to zero; i.e. zero
+        *               implies the first descriptor element in the array. 
+        *               This value must be non-negative and less than the 
+        *               number of descriptors currently within the array 
+        *               otherwise the operator panics with 
+        *               EArrayIndexOutOfRange. 
+        * @return A non-modifiable pointer descriptor representing the 
+        *         descriptor element located at position aIndex within 
+        *         the array.
+        */
+        TPtrC MdcaPoint(TInt aIndex) const;
+
+    private:
+        /**
+        * Symbian OS two phased constructor.
+        * Completes the construction of the object.
+        */
+        void ConstructL();
+
+    private: //data
+        RRefArray<TDesC>            iTestModules;
+        HBufC*                      iBuffer;
+    };
+
+/**
+*  CTestModulesMenuContainer  container control class.
+*  
+*/
+class CTestModulesMenuContainer : public CCoeControl
+    {
+    public: // Constructors and destructor
+        
+        /**
+        * Symbian OS default constructor.
+        * @param aRect Frame rectangle for container.
+        */
+        void ConstructL(const TRect& aRect, MEikListBoxObserver* aListBoxObserver);
+
+        /**
+        * Destructor.
+        */
+        ~CTestModulesMenuContainer();
+
+    public: // New functions
+
+        /**
+        * Gets the index number of the current item in the view.
+        * @return Index number of the current item.
+        */
+        TInt CurrentItemIndex();
+
+    public: // New functions
+    	
+	    /**
+	     * Stores current position of focus of iListBox to the CAppUiAppUi object
+	     */
+    	void SaveActiveLine();
+
+    private: // Functions from base classes
+
+       /**
+        * From CoeControl,SizeChanged.
+        * Called by framework when the view size is changed.
+        */
+        void SizeChanged();
+
+        /**
+        * From CoeControl,CountComponentControls.
+        * Gets a count of the component controls of this list box control.
+        * This information is used for DrawNow().
+        */
+        TInt CountComponentControls() const;
+
+        /**
+        * From CCoeControl,ComponentControl.
+        * Gets a pointer to the specified component control.
+        * @param aIndex Index of the component control to look up.
+        * @return The control at aIndex.
+        */
+        CCoeControl* ComponentControl(TInt aIndex) const;
+
+        /**
+        * From CCoeControl,Draw.
+        * Draw a control, called by window server.
+        * @param aRect The region of the control to be redrawn. Co-ordinates
+        *              are relative to the control's origin (top left corner).
+        */
+        void Draw(const TRect& aRect) const;
+
+        /**
+        * From CCoeControl,OfferKeyEventL
+        * Handles key events.
+        * @param aKeyEvent The key event.
+        * @param aType The type of key event.
+        * @return Indicates whether or not the key event was used 
+        *         by this control.
+        */
+		TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType);
+        
+    private: //data
+        
+		CEikTextListBox*            iListBox;
+        CTestModulesListBoxModel*   iListBoxModel;
+        CUIStore*                   iUIStore;
+        RRefArray<TDesC>            iModules;
+    };
+
+#endif // CTESTMODULESMENUCONTAINER_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/avkon/stifui/inc/TestModulesMenuView.h	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,108 @@
+/*
+* 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 file contains CTestModulesMenuView class
+* declaration.
+*
+*/
+
+#ifndef TESTMODULEMENUVIEW_H
+#define TESTMODULEMENUVIEW_H
+
+// INCLUDES
+#include "View.h"
+#include <eiklbo.h> // MEikListBoxObserver
+#include <aknnavide.h> 
+
+// CONSTANTS
+
+// FORWARD DECLARATIONS
+class CTestModulesMenuContainer;
+
+// CLASS DECLARATION
+
+/**
+*  CTestModulesMenuView view class.
+* 
+*/
+class CTestModulesMenuView : public CView, public MEikListBoxObserver
+    {
+    public: // Constructors and destructor
+
+        /**
+        * Symbian OS default constructor.
+        */
+        void ConstructL();
+
+        /**
+        * Destructor.
+        */
+        ~CTestModulesMenuView();
+
+    public: // Functions from base classes
+        
+         /**
+        * Returns view´s id.
+        * @return View id.
+        */
+        TUid Id() const;
+
+        /**
+        * Handles a command.
+        * @param aCommand A command ID.
+        */
+        void HandleCommandL( TInt aCommand );
+
+        /**
+        * Handles client rect changes.
+        */
+        void HandleClientRectChange();
+
+        /**
+        * Handles a list box event.
+        * @param aListBox A pointer to list box (not used).
+        * @param aEventType Type of list box event.
+        */
+        void HandleListBoxEventL(CEikListBox* /*aListBox*/, TListBoxEvent aEventType);
+        
+        /**
+        * Initializes menu pane.
+        * @param aResourceId Menu pane resource ID.
+        * @param aMenuPane Menu pane pointer.
+        */
+        void DynInitMenuPaneL(TInt aResourceId, CEikMenuPane* aMenuPane);
+
+    private:
+
+        /**
+        * Initializes view when activated.
+        * @param aPrevViewId Id of the previous view (not used).
+        * @param aCustomMessageId Custom message id (not used).
+        * @param aCustomMessage Custom message (not used).
+        */
+        void DoActivateL(const TVwsViewId& aPrevViewId,TUid aCustomMessageId,
+            const TDesC8& aCustomMessage);
+
+        /**
+        * Deactivates view.
+        */
+        void DoDeactivate();
+
+    private: // Data
+        CAknNavigationDecorator*    iNaviDecorator;
+        CTestModulesMenuContainer*  iContainer;
+    };
+
+#endif // TESTMODULEMENUVIEW_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/avkon/stifui/inc/TestSetBaseMenuContainer.h	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,124 @@
+/*
+* 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 file contains CTestSetBaseMenuContainer 
+* class declaration.
+*
+*/
+
+#ifndef CTestSetBaseMenuContainer_H
+#define CTestSetBaseMenuContainer_H
+
+// INCLUDES
+#include <coecntrl.h>
+#include <eiklbo.h>
+
+   
+// FORWARD DECLARATIONS
+//class CEikLabel;        // for example labels
+class CEikTextListBox;
+
+// CLASS DECLARATION
+
+/**
+*  CTestSetBaseMenuContainer  container control class.
+*  
+*/
+class CTestSetBaseMenuContainer : public CCoeControl
+    {
+    public: // Constructors and destructor
+        
+        /**
+        * Symbian OS default constructor.
+        * @param aRect Frame rectangle for container.
+        * @return Observer for list box.
+        */
+        void ConstructL(const TRect& aRect, MEikListBoxObserver* aListBoxObserver);
+
+        /**
+        * Destructor.
+        */
+        ~CTestSetBaseMenuContainer();
+
+    public: // New functions
+
+        /**
+        * Get currently selected items index.
+        * @return Current item index.
+        */		
+		TInt GetActiveLine();    
+		
+        /**
+         * Stores current position of focus of iListBox to the CAppUiAppUi object
+         */
+		void SaveActiveLine();
+    
+    public: // Functions from base classes
+     
+        /**
+        * Method HandleSelectedListItemL handles valix index.
+        * @param        TInt aIndex
+        * @return       nothing
+        */
+        void HandleSelectedListItemL( TInt aIndex );      
+
+    private: // Functions from base classes
+
+        /**
+        * From CoeControl,SizeChanged.
+        * Called by framework when the view size is changed.
+        */
+        void SizeChanged();
+
+        /**
+        * From CoeControl,CountComponentControls.
+        * Gets a count of the component controls of this list box control.
+        * This information is used for DrawNow().
+        */
+        TInt CountComponentControls() const;
+
+        /**
+        * From CCoeControl,ComponentControl.
+        * Gets a pointer to the specified component control.
+        * @param aIndex Index of the component control to look up.
+        * @return The control at aIndex.
+        */
+        CCoeControl* ComponentControl(TInt aIndex) const;
+
+        /**
+        * From CCoeControl,Draw.
+        * Draw a control, called by window server.
+        * @param aRect The region of the control to be redrawn. Co-ordinates
+        *              are relative to the control's origin (top left corner).
+        */
+        void Draw(const TRect& aRect) const;
+
+        /**
+        * From CCoeControl,OfferKeyEventL
+        * Handles key events.
+        * @param aKeyEvent The key event.
+        * @param aType The type of key event.
+        * @return Indicates whether or not the key event was used 
+        *         by this control.
+        */
+		TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType);
+		
+        
+    private: //data
+        
+		CEikTextListBox*    iListBox;
+    };
+
+#endif // CTestSetBaseMenuContainer_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/avkon/stifui/inc/TestSetBaseMenuView.h	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,101 @@
+/*
+* 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 file contains CTestSetBaseMenuView class declaration.
+*
+*/
+
+#ifndef TESTSETBASEMENUVIEW_H
+#define TESTSETBASEMENUVIEW_H
+
+// INCLUDES
+#include "View.h"
+#include <eiklbo.h> // MEikListBoxObserver
+#include <aknnavide.h> 
+
+
+// CONSTANTS
+
+// FORWARD DECLARATIONS
+class CTestSetBaseMenuContainer;
+
+// CLASS DECLARATION
+
+/**
+*  CTestSetBaseMenuView view class.
+* 
+*/
+class CTestSetBaseMenuView : public CView, public MEikListBoxObserver
+    {
+    public: // Constructors and destructor
+
+        /**
+        * Symbian OS default constructor.
+        */
+        void ConstructL();
+
+        /**
+        * Destructor.
+        */
+        ~CTestSetBaseMenuView();
+
+    public: // Functions from base classes
+        
+        /**
+        * Returns view´s id.
+        * @return View id.
+        */
+        TUid Id() const;
+
+        /**
+        * Handles a command.
+        * @param aCommand A command ID.
+        */
+        void HandleCommandL( TInt aCommand );
+
+        /**
+        * Handles client rect changes.
+        */
+        void HandleClientRectChange();
+
+        /**
+        * Handles a list box event.
+        * @param aListBox A pointer to list box.
+        * @param aEventType Type of list box event.
+        */
+        void HandleListBoxEventL(CEikListBox* aListBox, TListBoxEvent aEventType);
+
+    private:
+
+        /**
+        * Initializes view when activated.
+        * @param aPrevViewId Id of the previous view (not used).
+        * @param aCustomMessageId Custom message id (not used).
+        * @param aCustomMessage Custom message (not used).
+        */
+        void DoActivateL(const TVwsViewId& aPrevViewId,TUid aCustomMessageId,
+            const TDesC8& aCustomMessage);
+
+        /**
+        * Deactivates view.
+        */
+        void DoDeactivate();
+
+    private: // Data
+        CAknNavigationDecorator*    iNaviDecorator;
+        CTestSetBaseMenuContainer*  iContainer;
+    };
+
+#endif
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/avkon/stifui/inc/TestSetInsertMenuContainer.h	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,133 @@
+/*
+* 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 file contains CTestSetInsertMenuContainer 
+* class definition.
+*
+*/
+
+#ifndef TESTSETINSERTMENUCONTAINER_H
+#define TESTSETINSERTMENUCONTAINER_H
+
+// INCLUDES
+#include "Container.h"
+
+#include <coecntrl.h>
+#include <eiklbo.h>     // MEikListBoxObserver
+#include <bamdesca.h>   // MDesCArray
+#include <aknsfld.h>
+
+//#include "RRefArray.h"        
+//#include "UIEngine.h"         
+//#include "UIStoreIf.h"        
+//#include "UIStoreContainer.h" 
+
+#include <stifinternal/RRefArray.h>
+#include <stifinternal/UIEngine.h>
+#include <stifinternal/UIStoreIf.h>
+#include <stifinternal/UIStoreContainer.h>
+
+
+   
+// FORWARD DECLARATIONS
+class CEikTextListBox;
+class CDesC16Array;
+
+class CTestSetInsertMenuView;
+class CEikColumnListBox;
+class CStartedTestCase;
+
+class CUIStoreHandler;
+class CUIStore;
+class CUIStoreIf;
+class CUIEngineContainer;
+class CUIEngine;
+
+// CLASS DECLARATION
+/**
+*  CTestSetInsertMenuContainer  container control class.
+*  
+*/
+class CTestSetInsertMenuContainer : public CContainer //public CCoeControl /*, MEikListBoxObserver */ /* MCoeControlObserver */
+    {
+    public: // Constructors and destructor
+        
+        /**
+        * Symbian OS default constructor.
+        * @param aRect Frame rectangle for container.
+        */
+        void ConstructL(const TRect& aRect, MEikListBoxObserver* aListBoxObserver);
+
+        /**
+        * Destructor.
+        */
+        ~CTestSetInsertMenuContainer();
+
+    public: // New functions
+        
+        /**
+         * Stores current position of focus of iListBox to the CAppUiAppUi object
+         */
+        void SaveActiveLine();
+        
+    public: // Functions from base classes
+
+    private: // Functions from base classes
+
+        /**
+        * From CoeControl,SizeChanged.
+        * Called by framework when the view size is changed.
+        */
+        void SizeChanged();
+
+        /**
+        * From CoeControl,CountComponentControls.
+        * Gets a count of the component controls of this list box control.
+        * This information is used for DrawNow().
+        */
+        TInt CountComponentControls() const;
+
+        /**
+        * From CCoeControl,ComponentControl.
+        * Gets a pointer to the specified component control.
+        * @param aIndex Index of the component control to look up.
+        * @return The control at aIndex.
+        */
+        CCoeControl* ComponentControl(TInt aIndex) const;
+
+        /**
+        * From CCoeControl,Draw.
+        * Draw a control, called by window server.
+        * @param aRect The region of the control to be redrawn. Co-ordinates
+        *              are relative to the control's origin (top left corner).
+        */
+        void Draw(const TRect& aRect) const;
+        
+        /**
+        * From CCoeControl,OfferKeyEventL
+        * Handles key events.
+        * @param aKeyEvent The key event.
+        * @param aType The type of key event.
+        * @return Indicates whether or not the key event was used 
+        *         by this control.
+        */
+		TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType);
+         
+    private: //data
+        
+        CTestSetInsertMenuView*         iParentView;
+    };
+
+#endif // CTestSetInsertMenuContainer_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/avkon/stifui/inc/TestSetInsertMenuView.h	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,123 @@
+/*
+* 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  file contains CTestSetInsertMenuView class 
+* declaration.
+*
+*/
+
+#ifndef TESTSETINSERTMENUVIEW_H
+#define TESTSETINSERTMENUVIEW_H
+
+// INCLUDES
+#include "View.h"
+#include <eiklbo.h> // MEikListBoxObserver
+#include <aknnavide.h> 
+
+// CONSTANTS
+
+// FORWARD DECLARATIONS
+class CTestSetInsertMenuContainer;
+
+
+// CLASS DECLARATION
+
+/**
+*  CTestCaseMenuView view class.
+* 
+*/
+class CTestSetInsertMenuView : public CView, public MEikListBoxObserver //CAknView
+    {
+    public: // Constructors and destructor
+
+        /**
+        * Symbian OS default constructor.
+        */
+        void ConstructL();
+
+        /**
+        * Destructor.
+        */
+        ~CTestSetInsertMenuView();
+
+    public: // Functions from base classes
+        
+        /**
+        * Returns view´s id.
+        * @return View id.
+        */
+        TUid Id() const;
+
+        /**
+        * Handles a command.
+        * @param aCommand A command ID.
+        */
+        void HandleCommandL( TInt aCommand );
+
+        /**
+        * Handles client rect changes.
+        */
+        void HandleClientRectChange();
+
+        /**
+        * Handles a list box event.
+        * @param aListBox A pointer to list box.
+        * @param aEventType Type of list box event.
+        */
+        void HandleListBoxEventL(CEikListBox* aListBox, TListBoxEvent aEventType);
+
+    public: // New functions
+        
+        /**
+        * Adds selected test cases to the current test set.
+        * @param aSelectedIndexes Indexes of selected test cases.
+        */
+        void AddCasesToTestSet( RArray<TInt> aSelectedIndexes );
+
+    private:
+
+        /**
+        * Initializes view when activated.
+        * @param aPrevViewId Id of the previous view (not used).
+        * @param aCustomMessageId Custom message id (not used).
+        * @param aCustomMessage Custom message (not used).
+        */
+        void DoActivateL(const TVwsViewId& aPrevViewId,TUid aCustomMessageId,
+            const TDesC8& aCustomMessage);
+
+        /**
+        * Deactivates view.
+        */
+        void DoDeactivate();
+
+        /**
+        * Initializes menu pane.
+        * @param aResourceId Menu pane resource ID.
+        * @param aMenuPane Menu pane pointer.
+        */
+        void DynInitMenuPaneL(TInt aResourceId,CEikMenuPane* aMenuPane);
+               
+        /**
+        * Show confirmation dialog for inserting test cases.
+        */
+        void ShowInsertCasesDialogL();
+
+    private: // Data
+        CAknNavigationDecorator*        iNaviDecorator;
+        CTestSetInsertMenuContainer*    iContainer;
+        TInt                            iCurrentTestCase;
+    };
+
+#endif //TestSetInsertMenuView_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/avkon/stifui/inc/TestSetMenuContainer.h	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,209 @@
+/*
+* 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 file contains CTestSetMenuContainer class 
+* declaration.
+*
+*/
+
+#ifndef TestSetMenuContainer_H
+#define TestSetMenuContainer_H
+
+// INCLUDES
+#include <coecntrl.h>
+#include <eiklbo.h>     // MEikListBoxObserver
+#include <bamdesca.h>   // MDesCArray
+#include <aknsfld.h>
+
+//#include "RRefArray.h"        
+//#include "UIEngine.h"         
+//#include "UIStoreIf.h"        
+//#include "UIStoreContainer.h" 
+
+#include <stifinternal/RRefArray.h>
+#include <stifinternal/UIEngine.h>
+#include <stifinternal/UIStoreIf.h>
+#include <stifinternal/UIStoreContainer.h>
+   
+// FORWARD DECLARATIONS
+class CEikTextListBox;
+class CDesC16Array;
+
+class CTestSetMenuView;
+class CEikColumnListBox;
+class CTestCaseListBoxModel;
+
+class CUIStoreHandler;
+class CUIStore;
+class CUIStoreIf;
+class CUIEngineContainer;
+class CUIEngine;
+
+// CLASS DECLARATION
+/**
+*  CTestSetMenuContainer  container control class.
+*  
+*/
+class CTestSetMenuContainer : public CCoeControl /*, MEikListBoxObserver */ /* MCoeControlObserver */
+    {
+    public: // Constructors and destructor
+        
+        /**
+        * Symbian OS default constructor.
+        * @param aRect Frame rectangle for container.
+        */
+        void ConstructL(const TRect& aRect, MEikListBoxObserver* aListBoxObserver);
+
+        /**
+        * Destructor.
+        */
+        ~CTestSetMenuContainer();
+
+    public: // New functions
+        /**
+        * Show only testcases which are defined is specified module.
+        * @param aModuleName Module which test cases are shown.
+        */
+        void FilterCasesByModuleL(TName aModuleName);
+        
+        /**
+        * Show only testcases which are defined in specified test case file.
+        * @param aTestCaseFileName Test cases file name.
+        */
+        void FilterCasesByTCFileNameL(TFileName aTestCaseFileName);
+        
+        /**
+        * Remove possible filtering of test cases -> show all test cases.
+        */
+        void NoFilteringL();
+        
+        /**
+        * Returns pointers to selected test cases.
+        * @param aSelectedTestCases Currently selected test case.
+        */
+        void SelectedTestCases(RPointerArray<CTestInfo>& aSelectedTestCases);
+
+        /**
+        * Sets graphic icon using listbox as CEikColumnListBox.
+        * @param aListBox Pointer to list box.
+        */
+        void SetGraphicIconL( CEikColumnListBox* aListBox );
+
+        /**
+        * Appends graphics data.
+        * @param aIcons Pointer array of icons.
+        */
+        void GraphicIconL( CArrayPtr<CGulIcon>* aIcons );
+        
+        /**
+        * Gets the index number of the current item in the view.
+        * @return Index number of the current item.
+        */
+        TInt CurrentItemIndex();
+        
+        /**
+        * Sets the current item.
+        * @param aIndex Index of the item to make current.
+        */
+        void SetCurrentItemIndex(TInt aCurrentTestCase);
+		
+		/**
+		* Inline function for getting pointer to list box.
+		* @return Pointer to list box.
+		*/
+		inline CEikListBox* ListBox() { return (CEikListBox*)iListBox; };
+		
+		/**
+		* Processes user commands.
+		* @param aCommand ID of the command to respond to.
+		*/
+		void ProcessCommandL( TInt  aCommand );
+		
+		/**
+		* Processes user commands.
+		* @param aCommand ID of the command to respond to.
+		*/
+		void SelectionListProcessCommandL( TInt  aCommand );
+		
+		/**
+		* Handles mark commands.
+		* @param aCommand ID of the command to respond to.
+		*/
+		void HandleMarkCommandL( TInt aCommand );
+        
+        /**
+		* Removes items from list box.
+		* @param aSelected Indexes of removed items.
+		*/
+		void RemoveListBoxItemL( TInt aSelected );
+		
+        /**
+         * Stores current position of focus of iListBox to the CAppUiAppUi object
+         */
+		void SaveActiveLine();
+		
+    public: // Functions from base classes
+
+    private: // Functions from base classes
+
+        /**
+        * From CoeControl,SizeChanged.
+        * Called by framework when the view size is changed.
+        */
+        void SizeChanged();
+
+        /**
+        * From CoeControl,CountComponentControls.
+        * Gets a count of the component controls of this list box control.
+        * This information is used for DrawNow().
+        */
+        TInt CountComponentControls() const;
+
+        /**
+        * From CCoeControl,ComponentControl.
+        * Gets a pointer to the specified component control.
+        * @param aIndex Index of the component control to look up.
+        * @return The control at aIndex.
+        */
+        CCoeControl* ComponentControl(TInt aIndex) const;
+
+        /**
+        * From CCoeControl,Draw.
+        * Draw a control, called by window server.
+        * @param aRect The region of the control to be redrawn. Co-ordinates
+        *              are relative to the control's origin (top left corner).
+        */
+        void Draw(const TRect& aRect) const;
+        
+        /**
+        * From CCoeControl,OfferKeyEventL
+        * Handles key events.
+        * @param aKeyEvent The key event.
+        * @param aType The type of key event.
+        * @return Indicates whether or not the key event was used 
+        *         by this control.
+        */
+		TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType);
+        
+    private: //data
+        
+        CTestSetMenuView*           iParentView;
+        CEikColumnListBox*          iListBox;
+        CTestCaseListBoxModel*      iListBoxModel;
+        RPointerArray<CTestInfo>    iTestCasesInView;
+        CUIStore*                   iUIStore;
+    };
+
+#endif // CTestSetMenuContainer_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/avkon/stifui/inc/TestSetMenuView.h	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,167 @@
+/*
+* 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 file contains CTestSetMenuView class declaration.
+*
+*/
+
+#ifndef TESTSETMENUVIEW_H
+#define TESTSETMENUVIEW_H
+
+// INCLUDES
+#include "View.h"
+#include <eiklbo.h> // MEikListBoxObserver
+#include <aknnavide.h> 
+
+// CONSTANTS
+
+// FORWARD DECLARATIONS
+class CTestSetMenuContainer;
+
+// CLASS DECLARATION
+/**
+*  CTestCaseMenuView view class.
+*/
+class CTestSetMenuView : public CView, public MEikListBoxObserver
+    {
+    public: // Constructors and destructor
+
+        /**
+        * Symbian OS default constructor.
+        */
+        void ConstructL();
+
+        /**
+        * Destructor.
+        */
+        ~CTestSetMenuView();
+
+    public: // Functions from base classes
+        
+        /**
+        * Returns view´s id.
+        * @return View id.
+        */
+        TUid Id() const;
+
+        /**
+        * Handles a command.
+        * @param aCommand A command ID.
+        */
+        void HandleCommandL( TInt aCommand );
+
+        /**
+        * Handles client rect changes.
+        */
+        void HandleClientRectChange();
+    
+    public: // From MEikListBoxObserver
+        
+        /**
+        * Handles list box event.
+        * @param aListBox Pointer to list box.
+        * @param aEventType List box event.
+        */
+        void HandleListBoxEventL(CEikListBox* aListBox, 
+            TListBoxEvent aEventType);
+                
+    public: // New functions
+        
+        /**
+        * Starts all cases in active test set.
+        */
+        void StartTestSetL();
+        
+        /**
+        * Removes selected test cases from active test set.
+        */
+        void RemoveSelectedTestCasesL();
+        
+        /**
+        * Creates new test set.
+        * @param aTestSetName Name of the test set.
+        * @return Symbian OS error code.
+.       */
+        TInt CreateTestSetL( const TDesC& aTestSetName );
+        
+        /**
+        * Loads saved test set.
+        * @param aTestSetName Name of the test set.
+        * @return Symbian OS error code.
+        */
+        TInt LoadTestSetL( const TDesC& aTestSetName );
+        
+        /**
+        * Saves current test set.
+        * @return Symbian OS error code.
+        */
+        TInt SaveCurrentTestSetL();
+        
+        /**
+        * Removes current test set.
+        * @return Symbian OS error code.
+        */
+        TInt RemoveActiveTestSet();
+        
+        /**
+        * Get name of the current test set.
+        * @return Name of the current test set.
+        */
+        inline const TDesC& CurrentTestSet()
+            { return iCurrentTestSet; }
+        
+        /**
+        * Set save needed flag.
+        */
+        inline void SetSaveNeeded( TBool aSave )
+            { iSaveNeeded = aSave; }
+                
+    private: // From AknView
+
+        /**
+        * Initializes view when activated.
+        * @param aPrevViewId Id of the previous view (not used).
+        * @param aCustomMessageId Custom message id (not used).
+        * @param aCustomMessage Custom message (not used).
+        */
+        void DoActivateL(const TVwsViewId& aPrevViewId,TUid aCustomMessageId,
+            const TDesC8& aCustomMessage);
+
+        /**
+        * Deactivates view.
+        */
+        void DoDeactivate();
+
+    private: // From MEikMenuObserver
+        
+        /**
+        * Initializes menu pane.
+        * @param aResourceId Menu pane resource ID.
+        * @param aMenuPane Menu pane pointer.
+        */
+        void DynInitMenuPaneL(TInt aResourceId,CEikMenuPane* aMenuPane);
+
+    private: // Data
+        CAknNavigationDecorator*    iNaviDecorator;
+        CTestSetMenuContainer*      iContainer;
+        CUIStore*                   iUIStore;
+        TInt                        iCurrentTestCase;
+        TInt                        iTestSetIndex;
+        TBuf<50>                    iCurrentTestSet;
+        TBool                       iSaveNeeded;
+        
+    };
+
+#endif // TESTSETMENUVIEW_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/avkon/stifui/inc/TestSetStartedCasesContainer.h	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,193 @@
+/*
+* 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 file contains CTestSetStartedCasesContainer
+* class declaration.
+*
+*/
+
+#ifndef TESTSETSTARTEDCASESCONTAINER_H
+#define TESTSETSTARTEDCASESCONTAINER_H
+
+// INCLUDES
+#include <coecntrl.h>
+#include <eiklbo.h>
+#include <bamdesca.h> // MDesCArray
+
+//#include "RRefArray.h" 
+#include <stifinternal/RRefArray.h>
+
+
+// Define *.mbm file name.
+_LIT(KMbmFileName, "\\Resource\\Apps\\Stifui.mbm");
+
+// FORWARD DECLARATIONS
+class CEikTextListBox;
+class CAknSingleGraphicStyleListBox;
+class CDesC16ArrayFlat;
+class CStartedTestCase;
+
+class CUIStore;
+class CStartedTestsListBoxModel;
+
+// CLASS DECLARATION
+
+/**
+*  CTestSetStartedCasesContainer  container control class.
+*  
+*/
+class CTestSetStartedCasesContainer : public CCoeControl /*, MEikListBoxObserver */ /* MCoeControlObserver */
+    {
+    public: // Constructors and destructor
+        
+        /**
+        * Symbian OS default constructor.
+        * @param aRect Frame rectangle for container.
+        */
+        void ConstructL(const TRect& aRect, MEikListBoxObserver* aListBoxObserver);
+
+        /**
+        * Destructor.
+        */
+        ~CTestSetStartedCasesContainer();
+
+    public: // New functions
+    
+        /**
+        * Returns reference to currently selected test case in view (listbox).
+        * @return Currently selected test case.
+        */
+        CStartedTestCase* SelectedTestCase();
+        
+        /**
+        * Constructs list box model.
+        */
+        void ConstructListBoxModelL();
+        
+        /**
+        * Draws the list box.
+        */
+        void DrawListBox();
+        
+        /**
+        * Returns count of test cases in view.
+        * @return Count of test cases in view.
+        */
+        TInt TestsInViewCount();
+        
+        /**
+        * Handles the addition of an item to the model.
+        */
+        void HandleItemAdditionL();
+        
+        /**
+        * Handles the removal of an item from the model.
+        */
+        void HandleItemRemovalL();
+        
+        /**
+        * Returns pointer to currently selected test case.
+        * @param Current test case.
+        */
+        CStartedTestCase* CurrentTestCase();
+        
+        /**
+        * Gets the index number of the current item in the view.
+        * @return Index number of the current item.
+        */
+        TInt CurrentItemIndex();
+        
+        /**
+        * Sets the current item.
+        * @param aIndex Index of the item to make current.
+        */
+        void SetCurrentItemIndex(TInt aIndex);
+        
+        /**
+        * Resets the selection indices, top and current item indices,
+        * the selection, and the horizontal scroll offset of this list box.
+        * This function does not redraw the list box.
+        */
+        void ResetListBox();
+        
+        /**
+        * Removes items from list box.
+        */
+        void RemoveSelectedExecutionsL();
+        
+        /**
+        * Removes all started test cases from list box.
+        */
+        void RemoveAllExecutionsInViewL();
+        
+        /**
+         * Stores current position of focus of iListBox to the CAppUiAppUi object
+         */
+        void SaveActiveLine();
+
+    private: // New functions
+
+    public: // Functions from base classes
+
+    private: // Functions from base classes
+    
+        /**
+        * From CoeControl,SizeChanged.
+        * Called by framework when the view size is changed.
+        */
+        void SizeChanged();
+
+        /**
+        * From CoeControl,CountComponentControls.
+        * Gets a count of the component controls of this list box control.
+        * This information is used for DrawNow().
+        */
+        TInt CountComponentControls() const;
+
+        /**
+        * From CCoeControl,ComponentControl.
+        * Gets a pointer to the specified component control.
+        * @param aIndex Index of the component control to look up.
+        * @return The control at aIndex.
+        */
+        CCoeControl* ComponentControl(TInt aIndex) const;
+
+        /**
+        * From CCoeControl,Draw.
+        * Draw a control, called by window server.
+        * @param aRect The region of the control to be redrawn. Co-ordinates
+        *              are relative to the control's origin (top left corner).
+        */
+        void Draw(const TRect& aRect) const;
+
+        /**
+        * From CCoeControl,OfferKeyEventL
+        * Handles key events.
+        * @param aKeyEvent The key event.
+        * @param aType The type of key event.
+        * @return Indicates whether or not the key event was used 
+        *         by this control.
+        */
+		TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType);
+	    
+    private: //data
+        
+        CEikTextListBox*            iListBox;
+        CStartedTestsListBoxModel*  iListBoxModel;    
+        RRefArray<CStartedTestCase> iStartedTestsPtrs;
+        CUIStore*                   iUIStore;
+    };
+
+#endif // CTestSetStartedCasesCONTAINER_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/avkon/stifui/inc/TestSetStartedCasesView.h	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,130 @@
+/*
+* 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 file contains CTestSetStartedCasesView class
+* declaration.
+*
+*/
+
+#ifndef TESTSETSTARTEDCASESVIEW_H
+#define TESTSETSTARTEDCASESVIEW_H
+
+// INCLUDES
+#include "View.h"
+#include <eiklbo.h> // MEikListBoxObserver
+#include <aknnavide.h> //CAknNavigationDecorator
+
+// CONSTANTS
+
+// FORWARD DECLARATIONS
+class CTestSetStartedCasesContainer;
+
+// CLASS DECLARATION
+
+/**
+*  CTestSetStartedCasesView view class.
+* 
+*/
+class CTestSetStartedCasesView : public CView, public MEikListBoxObserver
+    {
+    public: // Constructors and destructor
+
+        /**
+        * Symbian OS default constructor.
+        */
+        void ConstructL();
+
+        /**
+        * Destructor.
+        */
+        ~CTestSetStartedCasesView();
+
+    public: // Functions from base classes
+        
+        /**
+        * Returns view´s id.
+        * @return View id.
+        */
+        TUid Id() const;
+
+        /**
+        * Handles a command.
+        * @param aCommand A command ID.
+        */
+        void HandleCommandL( TInt aCommand );
+
+        /**
+        * Handles client rect changes.
+        */
+        void HandleClientRectChange();
+
+        /**
+        * Handles a list box event.
+        * @param aListBox A pointer to list box (not used).
+        * @param aEventType Type of list box event.
+        */
+        void HandleListBoxEventL(CEikListBox* /*aListBox*/, TListBoxEvent aEventType);
+
+    public: // New functions
+        
+        /**
+        * Handles status changes of test cases in view.
+        */
+        void TestCaseStateChangedL();
+        
+        /**
+        * Handles call to view test case´s output data.
+        */
+        void ViewTestCaseOutputL();
+
+    private:
+
+        /**
+        * Initializes view when activated.
+        * @param aPrevViewId Id of the previous view (not used).
+        * @param aCustomMessageId Custom message id (not used).
+        * @param aCustomMessage Custom message (not used).
+        */
+        void DoActivateL(const TVwsViewId& aPrevViewId,TUid aCustomMessageId,
+            const TDesC8& aCustomMessage);
+
+        /**
+        * Deactivates view.
+        */
+        void DoDeactivate();
+
+        /**
+        * Initializes menu pane.
+        * @param aResourceId Menu pane resource ID.
+        * @param aMenuPane Menu pane pointer.
+        */
+        void DynInitMenuPaneL(TInt aResourceId,CEikMenuPane* aMenuPane);
+        
+        /**
+        * Refreshes view name shown in the navi pane.
+        */
+        void RefreshNaviTitleL();
+
+    private: // Data
+        CAknNavigationDecorator*    iNaviDecorator;
+        CTestSetStartedCasesContainer* iContainer;
+        TName                       iFilterModule;
+        TFileName                   iFilterTestCaseFile;
+        TInt                        iSelectedTestCase;  // Which testcase was 
+                                                        // selected when view 
+                                                        // was active earlier.
+    };
+
+#endif //TestSetStartedCasesVIEW_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/avkon/stifui/inc/UIStoreHandler.h	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,135 @@
+/*
+* 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 file contains CUIStoreHandler class declaration.
+*
+*/
+
+#ifndef UISTOREHANDLER_H
+#define UISTOREHANDLER_H
+
+//  INCLUDES
+//#include "UIStoreIf.h"  
+//#include "UIStore.h"   
+//#include "UIEngine.h"  
+
+#include <stifinternal/UIStoreIf.h>
+#include <stifinternal/UIStore.h>
+#include <stifinternal/UIEngine.h>
+
+#include "AppUIAppUi.h"
+
+// CONSTANTS
+// None
+
+// MACROS
+// None
+
+// DATA TYPES
+// None
+
+// FUNCTION PROTOTYPES
+// None
+
+// FORWARD DECLARATIONS
+// None
+
+// CLASS DECLARATION
+// None
+class CAppUIAppUi;
+
+// DESCRIPTION
+// CUIStoreHandler is a STIF Test Framework Series60 UI class.
+// CUIStoreHandler's methods purpose is to offer handle to UI Engine.
+// Because multible inheritance in not allowed in SOS we cannot 
+// inheritance CUIStore class direct so we use this class.
+
+class CUIStoreHandler 
+            :public CUIStoreIf
+    {
+    public:     // Enumerations
+
+    private:    // Enumerations
+
+    public:     // Constructors and destructor
+
+        /**
+        * Two-phased constructor.
+        * @param aAppUIAppUI Pointer to application ui.
+        * @return Pointer to UIStoreHandler.
+        */
+        static CUIStoreHandler* NewL( CAppUIAppUi* aAppUIAppUI );
+
+        /**
+        * Destructor.
+        */
+        ~CUIStoreHandler();
+
+    public:     // New functions
+
+        /**
+        * C++ default constructor.
+        * @param aAppUIAppUI Pointer to application ui.
+        */
+        CUIStoreHandler( CAppUIAppUi* aAppUIAppUI );
+
+        /**
+        * Receives output update notify from started test case.
+        * Checks if that test case is currently in output view then
+        * sends notification to AppUI which handles notification onward.
+        * @param aTestCase
+        * @param aStatus
+        */
+        void Update( CStartedTestCase* aTestCase, TInt aStatus );
+
+    public:     // Functions from base classes
+
+    protected:  // New functions
+
+    protected:  // Functions from base classes
+
+    private:
+
+        /**
+        * By default Symbian OS constructor is private.
+        */
+        void ConstructL();
+
+    public:     // Data
+
+        /**
+        * Returns the AppUI of the application
+        * @return Pointer to the Application UI.
+        */
+        CAppUIAppUi* iAppUIAppUI;
+        
+        /**
+        * Counter for executed test cases
+        */
+        TInt iExecutedTestCaseCount;
+
+    protected:  // Data
+
+    private:    // Data
+
+    public:     // Friend classes
+
+    protected:  // Friend classes
+
+    private:    // Friend classes
+
+    };
+
+#endif      // UISTOREHANDLER_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/avkon/stifui/inc/View.h	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,101 @@
+/*
+* 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 file contains CView class declaration.
+*
+*/
+
+#ifndef VIEW_H
+#define VIEW_H
+
+// INCLUDES
+#include <aknview.h>
+
+//#include "UIStoreIf.h" 
+#include <stifinternal/UIStoreIf.h>
+
+// CONSTANTS
+
+// FORWARD DECLARATIONS
+//class CMainMenuContainer;
+
+// CLASS DECLARATION
+
+/**
+*  CMainMenuView view class.
+* 
+*/
+class CView : public CAknView
+    {
+    public: // Constructors and destructor
+
+        /**
+        * Symbian OS default constructor.
+        */
+        void ConstructL();
+
+        /**
+        * Destructor.
+        */
+        ~CView();
+
+    public: // Functions from base classes
+        
+        /**
+        * Returns view´s id.
+        * @return View id.
+        */
+        virtual TUid Id() const;
+
+        /**
+        * Handles a command.
+        * @param aCommand A command ID.
+        */
+        virtual void HandleCommandL( TInt aCommand );
+
+        /**
+        * Handles client rect changes.
+        */
+        virtual void HandleClientRectChange();
+        
+    private:
+
+        /**
+        * Initializes view when activated.
+        * @param aPrevViewId Id of the previous view (not used).
+        * @param aCustomMessageId Custom message id (not used).
+        * @param aCustomMessage Custom message (not used).
+        */
+        virtual void DoActivateL(const TVwsViewId& aPrevViewId,TUid aCustomMessageId,
+            const TDesC8& aCustomMessage);
+
+        /**
+        * Deactivates view.
+        */
+        virtual void DoDeactivate();
+
+    protected: // Data
+        
+        /**
+        * Pointer to UI Store.
+        */
+        CUIStore*     iUIStore;
+		
+		
+    private: // Data
+
+    };
+
+#endif // VIEW_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/avkon/stifui/inc/version.h	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,31 @@
+/*
+* 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 file contains STIF UI version declaration.
+*
+*/
+
+#ifndef VERSION_H_
+#define VERSION_H_
+
+#define STIFUI_MAJOR_VERSION 7
+#define STIFUI_MINOR_VERSION 3
+#define STIFUI_BUILD_VERSION 37
+
+#define STIFUI_REL_DATE "13th July 2010"
+
+#define TO_UNICODE(text) _L(text) 
+
+#endif /*VERSION_H_*/
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/avkon/stifui/src/AppUIApp.cpp	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,70 @@
+/*
+* 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 file contains CAppUIApp class definition.
+*
+*/
+
+// INCLUDE FILES
+#include    "AppUIApp.h"
+#include    "AppUIDocument.h"
+
+// ================= MEMBER FUNCTIONS =======================
+
+// ---------------------------------------------------------
+// CSTIFAppUIApp::AppDllUid()
+// Returns application UID
+// ---------------------------------------------------------
+//
+TUid CAppUIApp::AppDllUid() const
+    {
+    return KUidAppUI;
+    }
+
+   
+// ---------------------------------------------------------
+// CSTIFAppUIApp::CreateDocumentL()
+// Creates CSTIFAppUIDocument object
+// ---------------------------------------------------------
+//
+CApaDocument* CAppUIApp::CreateDocumentL()
+    {
+    return CAppUIDocument::NewL( *this );
+    }
+
+// ================= OTHER EXPORTED FUNCTIONS ==============
+//
+
+	#include <eikstart.h>
+	// ---------------------------------------------------------
+	// NewApplication() 
+	// Exported function
+	// Returns: CApaApplication: 
+	// ---------------------------------------------------------
+	//
+	LOCAL_C CApaApplication* NewApplication()
+		{
+		return new CAppUIApp;
+		}
+	// ---------------------------------------------------------
+	// E32Main() 
+	// EXE Entry point
+	// Returns: KErrNone: No error
+	// ---------------------------------------------------------
+	//
+	GLDEF_C TInt E32Main()
+		{
+		return EikStart::RunApplication(NewApplication);
+		}
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/avkon/stifui/src/AppUIAppUi.cpp	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,698 @@
+/*
+* 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 file contains TMessageBoxUtil class definition.
+*
+*/
+
+// INCLUDE FILES
+#include "AppUIAppUi.h"
+
+#include "MainMenuView.h"
+#include "TestCaseMenuView.h"
+#include "StartCasesView.h"
+#include "TestModulesMenuView.h"
+#include "StartedCasesMenuView.h"
+#include "ShowStartedCasesView.h"
+#include "TestCaseOutputView.h"
+#include "StatisticsView.h"
+#include "TestSetBaseMenuView.h"
+#include "TestSetMenuView.h"
+#include "TestSetInsertMenuView.h"
+#include "TestSetStartedCasesView.h"
+#include <aknmessagequerydialog.h> 
+#include "version.h"
+
+#include "CreatedTestSetMenuView.h"
+
+#include <Stifui.rsg>
+#include "Stifui.hrh"
+
+
+#include <StifTestInterface.h>
+
+#include <aknnotewrappers.h>
+#include <StringLoader.h>
+
+_LIT( KTestSet, "DefaultSet" );
+
+static const TInt KCopyrightChar = 169;
+
+// ----------------------------------------------------------
+// CMessageBoxUtil::ShowNotImplementedYetL
+// Displays message that executed funtion is not implemented yet.
+// ----------------------------------------------------------
+//
+void TMessageBoxUtil::ShowNotImplementedYetL()
+    {
+    _LIT(message, "Not implemented yet");
+    CAknInformationNote* informationNote = new (ELeave) CAknInformationNote;
+    informationNote->ExecuteLD(message);
+    }
+
+// ----------------------------------------------------------
+// Display error note.
+// @param aMessage Error message to display.
+// ----------------------------------------------------------
+//
+void TMessageBoxUtil::ShowErrorNoteL( const TDesC& aMessage )
+	{
+	CAknErrorNote* errorNote = new (ELeave) CAknErrorNote(ETrue);
+	// set timeout to 5 sec	
+	errorNote->SetTimeout( (CAknNoteDialog::TTimeout)5000000 );
+	errorNote->ExecuteLD( aMessage );
+	}
+
+// ================= MEMBER FUNCTIONS =======================
+//
+// ----------------------------------------------------------
+// CAppUIAppUi::ConstructL()
+// ?implementation_description
+// ----------------------------------------------------------
+//
+void CAppUIAppUi::ConstructL()
+    {
+    TInt error(0);
+
+    BaseConstructL( EAknEnableSkin );
+
+    // connection to setting server needs to be open as long as STIF Series 60 UI APP is alive
+    TInt ret = iSettingServer.Connect();
+    if ( ret != KErrNone )
+        {
+        User::Leave( ret );
+        }
+    
+    iLogger = CStifLogger::NewL( _L("E\x3a\\"), _L("stif_tfw_ui"),
+                                CStifLogger::ETxt, CStifLogger::EFile,
+                                ETrue, EFalse, ETrue, EFalse, EFalse );
+
+    iLogger->Log( _L("--- UI log starts ---") );
+    iLogger->Log( _L(" ") );
+    iLogger->Log( _L("appui: ConstructL") );
+
+	// Create CData object which handles all test cases data and running of them
+    iUIStoreHandler = CUIStoreHandler::NewL( this );
+    
+    // CUIStore open 
+    error = UIStoreHandler()->Open( KDefaultPathAndIni );
+    if ( KErrNone != error )
+    	{
+    	User::Leave( error );
+    	}
+
+    CMainMenuView* mainMenuView = new (ELeave) CMainMenuView;
+    CleanupStack::PushL( mainMenuView );
+    mainMenuView->ConstructL();
+    AddViewL( mainMenuView );      // transfer ownership to CAknViewAppUi
+    CleanupStack::Pop();    // MainMenuView
+
+    iLogger->Log(_L("appui:mainview "));
+
+    CCreatedTestSetMenuView* testCreatedTestSetMenuView = new (ELeave) CCreatedTestSetMenuView;
+        CleanupStack::PushL( testCreatedTestSetMenuView );
+       testCreatedTestSetMenuView->ConstructL();
+        AddViewL( testCreatedTestSetMenuView );      // transfer ownership to CAknViewAppUi
+        CleanupStack::Pop();    // testCaseMenuView
+    CTestCaseMenuView* testCaseMenuView = new (ELeave) CTestCaseMenuView;
+    CleanupStack::PushL( testCaseMenuView );
+    testCaseMenuView->ConstructL();
+    AddViewL( testCaseMenuView );      // transfer ownership to CAknViewAppUi
+    CleanupStack::Pop();    // testCaseMenuView
+
+    iLogger->Log(_L("appui:caseview "));
+
+    CStartCasesView* startCasesView = new (ELeave) CStartCasesView;
+    CleanupStack::PushL( startCasesView );
+    startCasesView->ConstructL();
+    AddViewL( startCasesView );      // transfer ownership to CAknViewAppUi
+    CleanupStack::Pop();    // startCasesView
+
+    iLogger->Log(_L("appui:startcaseview "));
+
+    CStartedCasesMenuView* startedCasesMenuView = new (ELeave) CStartedCasesMenuView;
+    CleanupStack::PushL( startedCasesMenuView );
+    startedCasesMenuView->ConstructL();
+    AddViewL( startedCasesMenuView );      // transfer ownership to CAknViewAppUi
+    CleanupStack::Pop();    // startedCasesMenuView
+
+    iLogger->Log(_L("appui:started cases view created"));
+
+    CShowStartedCasesView* showStartedCasesView = new (ELeave) CShowStartedCasesView;
+    CleanupStack::PushL( showStartedCasesView );
+    showStartedCasesView->ConstructL();
+    AddViewL( showStartedCasesView );      // transfer ownership to CAknViewAppUi
+    CleanupStack::Pop();    // showStartedCasesView
+
+    iLogger->Log(_L("appui: show started cases view created"));
+
+    CTestCaseOutputView* testCaseOutputView = new (ELeave) CTestCaseOutputView;
+    CleanupStack::PushL( testCaseOutputView );
+    testCaseOutputView->ConstructL();
+    AddViewL( testCaseOutputView );      // transfer ownership to CAknViewAppUi
+    CleanupStack::Pop();    // testCaseOutputView
+
+    iLogger->Log(_L("appui: test case output view created"));
+
+    CTestModulesMenuView* testModulesMenuView = new (ELeave) CTestModulesMenuView;
+    CleanupStack::PushL( testModulesMenuView );
+    testModulesMenuView->ConstructL();
+    AddViewL( testModulesMenuView );      // transfer ownership to CAknViewAppUi
+    CleanupStack::Pop();    // testModulesMenuView
+
+    iLogger->Log(_L("appui:modulesview "));
+
+    CStatisticsView* statisticsMenuView = new (ELeave) CStatisticsView;
+    CleanupStack::PushL( statisticsMenuView );
+    statisticsMenuView->ConstructL();
+    AddViewL( statisticsMenuView );      // transfer ownership to CAknViewAppUi
+    CleanupStack::Pop();    // statisticsMenuView
+
+    iLogger->Log(_L("appui:modulesview "));
+
+	//
+	CTestSetBaseMenuView* testSetBaseMenuView = new (ELeave) CTestSetBaseMenuView;
+    CleanupStack::PushL( testSetBaseMenuView );
+    testSetBaseMenuView->ConstructL();
+    AddViewL( testSetBaseMenuView );      // transfer ownership to CAknViewAppUi
+    CleanupStack::Pop();    // testSetBaseMenuView
+
+    iLogger->Log(_L("appui:testsetsbaseview "));
+    
+    CTestSetMenuView* testSetMenuView = new (ELeave) CTestSetMenuView;
+    CleanupStack::PushL( testSetMenuView );
+    testSetMenuView->ConstructL();
+    AddViewL( testSetMenuView );      // transfer ownership to CAknViewAppUi
+    CleanupStack::Pop();    // testSetMenuView
+
+    iLogger->Log(_L("appui:testsetsview "));
+	
+	CTestSetInsertMenuView* testSetInsertMenuView = new (ELeave) CTestSetInsertMenuView;
+    CleanupStack::PushL( testSetInsertMenuView );
+    testSetInsertMenuView->ConstructL();
+    AddViewL( testSetInsertMenuView );      // transfer ownership to CAknViewAppUi
+    CleanupStack::Pop();    // testSetInsertMenuView
+   	
+   	iLogger->Log(_L("appui:testsetinsertview "));
+   	
+   	CTestSetStartedCasesView* testSetStartedCasesView = new (ELeave) CTestSetStartedCasesView;
+    CleanupStack::PushL( testSetStartedCasesView );
+    testSetStartedCasesView->ConstructL();
+    AddViewL( testSetStartedCasesView );      // transfer ownership to CAknViewAppUi
+    CleanupStack::Pop();    // testSetStartedCasesView
+
+    iLogger->Log(_L("appui:testsetStartedCasesView "));
+    
+
+    SetDefaultViewL( *mainMenuView );
+
+    iLogger->Log(_L("appui:setdefview "));
+    
+    iStartedTestCase = NULL;
+    iStartedTestSet = -1;
+    
+    iPreviousPositionListValid = ETrue;
+    }
+
+// ----------------------------------------------------
+// CAppUIAppUi::~CAppUIAppUi()
+// Destructor
+// Frees reserved resources
+// ----------------------------------------------------
+//
+CAppUIAppUi::~CAppUIAppUi()
+    {
+    
+    if ( iLogger )
+    {
+    iLogger->Log( _L(" ") );
+    iLogger->Log( _L("--- UI log ends ---") );    	
+    }
+
+    delete iLogger;
+    iSettingServer.Close();
+    UIStoreHandler()->Close();
+    delete iUIStoreHandler;
+    
+    // Closing of array of positions of focus in various menus
+    iPreviousFocusPosition.Close();
+    // iPreviousFocusPosition is no longer valid and cannot be used any more
+    iPreviousPositionListValid = EFalse;
+    //RemoveView(EMainMenuViewId);
+    }
+
+// ------------------------------------------------------------------------------
+// CAppUIAppUi::Data( )
+// Just returns pointer to CUIStore object, which is created by CAppUIAppUi
+// ------------------------------------------------------------------------------
+//
+CUIStore* CAppUIAppUi::UIStoreHandler()
+    {
+    return &iUIStoreHandler->UIStore();
+
+    }
+
+// ------------------------------------------------------------------------------
+// CAppUIAppUi::::DynInitMenuPaneL(TInt aResourceId,CEikMenuPane* aMenuPane)
+//  This function is called by the EIKON framework just before it displays
+//  a menu pane. Its default implementation is empty, and by overriding it,
+//  the application can set the state of menu items dynamically according
+//  to the state of application data.
+// ------------------------------------------------------------------------------
+//
+void CAppUIAppUi::DynInitMenuPaneL(
+    TInt /*aResourceId*/,CEikMenuPane* /*aMenuPane*/)
+    {
+
+    }
+
+// ----------------------------------------------------
+// CAppUIAppUi::HandleKeyEventL(
+//     const TKeyEvent& aKeyEvent,TEventCode /*aType*/)
+// ?implementation_description
+// ----------------------------------------------------
+//
+TKeyResponse CAppUIAppUi::HandleKeyEventL(
+    const TKeyEvent& aKeyEvent,TEventCode /*aType*/)
+    {
+	TInt currentView;
+
+	if ( iView )
+	{
+    currentView = (iView->Id()).iUid;
+ 			
+    
+    switch ( aKeyEvent.iCode )
+        {
+        case EKeyLeftArrow:
+			{
+			switch ( currentView )
+				{
+				case ETestModulesMenuViewId:
+					{
+                    HandleCommandL( EAppUIGoToTestCaseMenu );
+					break;
+					}
+				case ETestSetBaseMenuViewId:
+					{
+                    HandleCommandL( EAppUIGoToModulesMenu );
+					ActivateLocalViewL(TUid::Uid(ETestModulesMenuViewId));
+					break;
+					}
+                }
+            break;
+			}
+        case EKeyRightArrow:
+			{
+			switch ( currentView )
+				{
+				case ETestCaseMenuViewId:
+					{
+                    HandleCommandL( EAppUIGoToModulesMenu ); // TestCaseMenu --> TestModuleMenu
+					ActivateLocalViewL(TUid::Uid(ETestModulesMenuViewId));
+					break;
+					}
+				case ETestModulesMenuViewId:
+					{
+					HandleCommandL( EAppUIGoToTestSetsMenu );
+					ActivateLocalViewL(TUid::Uid(ETestSetBaseMenuViewId));
+					break;
+					}
+				case ETestSetsMenuViewId:
+					{
+					break;
+					}
+
+				}
+            break;
+			}
+
+        default:
+			{
+            return EKeyWasNotConsumed;
+            //break; 
+			}
+        }
+	}
+
+    return EKeyWasConsumed;
+
+    }
+
+// ----------------------------------------------------
+// CAppUIAppUi::HandleCommandL(TInt aCommand)
+// ?implementation_description
+// ----------------------------------------------------
+//
+void CAppUIAppUi::HandleCommandL(TInt aCommand)
+    {
+	TInt currentView, newView;
+    TInt error(0);
+    
+    currentView = (iView->Id()).iUid;
+
+    switch ( aCommand )
+        {
+        case EEikCmdExit:
+        case EAknSoftkeyExit:
+            {
+            PrepareToExit();
+            Exit();
+			newView = currentView;
+            break;
+            }
+        case EAppUIGoBack:
+            {
+			switch ( currentView )
+				{
+				case ETestCaseMenuViewId:
+					{
+					newView = EMainMenuViewId;  // Test Cases Menu --> Main Menu
+					break;
+					}
+				case EStartCaseMenuViewId:
+					{
+					newView = ETestCaseMenuViewId; // Start Cases Menu --> Test Cases Menu
+                    //iTabGroup->SetActiveTabByIndex(0);
+					break;
+					}
+				case ETestModulesMenuViewId:
+					{
+					newView = EMainMenuViewId; // Test Modules Menu --> Main Menu
+					break;
+					}
+				case EStartedCasesMenuViewId:
+					{
+					newView = ETestCaseMenuViewId; // Started Cases Menu --> Test Case Menu
+					break;
+					}
+				case EShowStartedCasesViewId:
+					{
+					newView = EStartedCasesMenuViewId; // Show started cases --> Started Cases Menu
+					break;
+					}
+				case ETestCaseOutputViewId:
+					{
+                    newView = iPreviousView; // Test case output view --> previous view
+					break;
+					}
+				case EStatisticsViewId:
+					{
+                    newView = EStartedCasesMenuViewId; // Statistic view --> Started Cases Menu
+					break;
+					}
+				case ETestSetBaseMenuViewId:
+					{
+					newView = EMainMenuViewId;  // Test Sets Base Menu --> Main Menu
+					break;
+					}
+				case ETestSetMenuViewId:
+					{
+					newView = ETestSetBaseMenuViewId;  // Test Sets Menu --> Test Sets Base Menu
+					break;
+					}
+				case ETestSetInsertMenuViewId:
+					{
+					newView = ETestSetMenuViewId;  // Test Set Insert Menu --> Test Sets Menu
+					break;
+					}
+				case ETestSetStartedCasesViewId:
+					{
+					newView = ETestSetMenuViewId;  // Test Set Started Cases Menu --> Test Sets Menu
+					break;
+					}
+				default:
+					{
+					newView = currentView; // Back does not work. This should not happen ever
+					break;
+					}
+				}
+            break;
+			}
+		case EAppUIGoToMainMenu:
+			{
+			newView = EMainMenuViewId;
+			break;
+			}
+		case EAppUIGoToTestCaseMenu:
+			{
+			newView = ETestCaseMenuViewId;
+			break;
+			}
+		case ECmdGoToStartCasesView:
+			{
+			newView = EStartCaseMenuViewId;
+			break;
+			}
+		case ECmdGoToStartedCasesView:
+			{
+			newView = EStartedCasesMenuViewId;
+			break;
+			}
+		case EAppUIGoToModulesMenu:
+			{
+			newView = ETestModulesMenuViewId;
+            //iTabGroup->SetActiveTabByIndex(1);
+			break;
+			}
+		case EAppUIGoToTestSetsMenu:
+			{
+            newView = ETestSetBaseMenuViewId;
+            
+            //ShowNotImplementedYet();
+            //newView = currentView;
+			break;
+			}
+        case ECmdCreateTestSet:
+	        {
+	        CTestSetMenuView* testSetMenu = (CTestSetMenuView*)View( TUid::Uid(ETestSetMenuViewId) );
+	        error = testSetMenu->CreateTestSetL( KTestSet );
+	        if ( KErrNone == error ||  KErrAlreadyExists == error)
+	            {
+	            newView = ETestSetInsertMenuViewId;
+	            currentView = ETestSetMenuViewId; // Store previous view for Back function
+	            }
+	        else
+	            {
+	            newView = ETestSetMenuViewId;
+	            }
+            break;
+    	    }
+    	case ECmdLoadTestSet:
+	        {
+	        newView = ECreatedTestSetMenuViewId; /*ETestSetBaseMenuViewId;*/
+	        break;
+			}
+    	case ECmdGoToTestSetView:
+    		{
+
+    		newView = ETestSetMenuViewId; 
+    		break;
+    		}
+        case ECmdInsertTestCases:
+	        {
+    		newView = ETestSetInsertMenuViewId;
+    		break;
+        	}
+        case ECmdShowStartedTestSet:
+	        {
+    		newView = ETestSetStartedCasesViewId;
+    		iShowStartedCasesMode = EShowAllStartedCases;
+    		break;
+        	}
+        case ECmdShowAllStartedCases:
+            newView = EShowStartedCasesViewId;
+            iShowStartedCasesMode = EShowAllStartedCases;
+			break;
+        case ECmdShowOngoingCases:
+            newView = EShowStartedCasesViewId;
+            iShowStartedCasesMode = EShowOngoingCases;
+        	break;
+        case ECmdShowPassedCases:
+            newView = EShowStartedCasesViewId;
+            iShowStartedCasesMode = EShowPassedCases;
+			break;
+        case ECmdShowPausedCases:
+            newView = EShowStartedCasesViewId;
+            iShowStartedCasesMode = EShowPausedCases;
+			break;
+        case ECmdShowFailedCases:
+            newView = EShowStartedCasesViewId;
+            iShowStartedCasesMode = EShowFailedCases;
+			break;
+        case ECmdShowCrashedAbortedCases:
+            newView = EShowStartedCasesViewId;
+            iShowStartedCasesMode = EShowCrashedAbortedCases;
+			break;
+        case ECmdShowStatistics:
+            newView = EStatisticsViewId;
+			break;
+        case ECmdViewOutput:
+            newView = ETestCaseOutputViewId;
+            break;
+        case ECmdShowAbout:
+        	{
+        	CAknMessageQueryDialog* dlg = new (ELeave) CAknMessageQueryDialog;
+        	TBuf<200> version;
+        	version.Format(_L("STIF UI - Version %d.%d.%d - "), STIFUI_MAJOR_VERSION, STIFUI_MINOR_VERSION, STIFUI_BUILD_VERSION);
+        	version.Append(TO_UNICODE(STIFUI_REL_DATE));
+        	version.Append(_L("\n"));
+        	
+        	TInt stifMajorV;
+        	TInt stifMinorV;
+        	TInt stifBuildV;
+        	TBuf<30> relDate;
+        	TStifUtil::STIFVersion(stifMajorV, stifMinorV, stifBuildV, relDate);
+        	
+        	TBuf<40> stifVersion;
+        	stifVersion.Format(_L("STIF - Version %d.%d.%d - "), stifMajorV, stifMinorV, stifBuildV);
+        	stifVersion.Append(relDate);
+        	stifVersion.Append(_L("\n"));
+        	
+        	version.Append(stifVersion);
+        	
+        	version.Append(_L("Copyright "));
+			version.Append( KCopyrightChar );
+			version.Append(_L(" 2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved."));
+        	
+        	dlg->SetMessageText(version);
+        	dlg->ExecuteLD(R_STIFUI_ABOUT_DIALOG);
+        	newView = currentView;
+        	break;
+        	}
+        default:
+			{
+            TMessageBoxUtil::ShowNotImplementedYetL();
+			newView = currentView;
+            break;
+			}
+        }
+
+	if( newView != currentView )
+		{
+        iPreviousView = currentView; // Store previous view for Back function
+		ActivateLocalViewL( TUid::Uid(newView) );
+
+		/*switch ( newView )
+			{
+			case EMainMenuViewId:
+            case EStartedCasesMenuViewId:
+            case EStartCaseMenuViewId:
+            case ETestCaseOutputViewId:
+				{
+		        //StatusPane()->SwitchLayoutL(R_AVKON_STATUS_PANE_LAYOUT_USUAL);
+                //iTabGroup->DimTab (ETestCaseMenuTab, ETrue);
+                //iTabGroup->DimTab (ETestModulesMenuTab, ETrue);
+                //iTabGroup->DimTab (ETestSetsMenuTab, ETrue);
+
+                //StatusPane()->SwitchLayoutL(R_AVKON_STATUS_PANE_LAYOUT_EMPTY);
+				//StatusPane()->SwitchLayoutL(R_AVKON_STATUS_PANE_LAYOUT_IDLE);
+				break;
+				}
+			case ETestCaseMenuViewId:
+			case ETestModulesMenuViewId:
+			case ETestSetsMenuViewId:
+				{
+				//StatusPane()->SwitchLayoutL(R_AVKON_STATUS_PANE_LAYOUT_USUAL);
+                //iTabGroup->DimTab (ETestCaseMenuTab, EFalse);
+                //iTabGroup->DimTab (ETestModulesMenuTab, EFalse);
+                //iTabGroup->DimTab (ETestSetsMenuTab, EFalse);
+                break;
+				}
+			default:
+				{
+                break;
+				}
+			}*/
+		}
+
+    }
+
+/**
+* Receives output update notification from UI Storehandler
+* @param
+* @return
+*/
+void CAppUIAppUi::OutputUpdateL( CStartedTestCase* aTestCase, TInt /* aStatus */ )
+    {
+    if( iView->Id().iUid == ETestCaseOutputViewId )
+        {
+        ( ( CTestCaseOutputView* )iView )->OutputUpdateL( aTestCase );
+        }
+    else if( iView->Id().iUid == EShowStartedCasesViewId )
+        {
+        ( ( CShowStartedCasesView* )iView )->TestCaseStateChangedL();
+        }
+    else if( iView->Id().iUid == ETestCaseOutputViewId )
+        {
+        ( ( CTestCaseOutputView* )iView )->TestCaseStateChangedL();
+        }
+    }
+  
+/**
+* Sets index of selected test case for viewing test case output
+* @param
+* @return
+*/    
+void CAppUIAppUi::SetStartedTestCase( CStartedTestCase* aStartedTestCase )
+    {
+    iStartedTestCase = aStartedTestCase;
+    }    
+  
+/**
+* Returns index of selected test case for viewing test case output
+* @param
+* @return
+*/    
+CStartedTestCase* CAppUIAppUi::GetStartedTestCase( )
+    {
+    return iStartedTestCase;
+    }        
+
+/**
+ * Stores focus position of focus from a specyfic view to iPreviousFocusPosition object.
+ * Value is than used to retrieve previous position of focus in the menu
+ * @param aViewId - identification of view
+ * @param aPosition - value to store for a specyfic view
+ */
+void CAppUIAppUi::SaveFocusPosition(TAppUIViewNumber aViewId, TInt aPosition)
+	{
+	if(!iPreviousPositionListValid)
+		{
+		return;
+		}
+	for(TInt counter = iPreviousFocusPosition.Count(); counter <= aViewId; counter++)
+		{
+		iPreviousFocusPosition.Append(0);
+		}
+	iPreviousFocusPosition[aViewId] = aPosition;
+	}
+
+/**
+ * Restores focus position of focus for a specyfic view from iPreviousFocusPosition object.
+ * @param aViewId - identification of view
+ * @return - previous position of focus in the requested view
+ */
+TInt CAppUIAppUi::GetFocusPosition(TAppUIViewNumber aViewId)
+	{
+	if(iPreviousFocusPosition.Count() > aViewId)
+		{
+		return iPreviousFocusPosition[aViewId];
+		}
+	else
+		{
+		return KErrNotFound;
+		}
+	}
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/avkon/stifui/src/AppUIDocument.cpp	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,62 @@
+/*
+* 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 file contains CAppUIDocument class definition.
+*
+*/
+
+// INCLUDE FILES
+#include "AppUIDocument.h"
+#include "AppUIAppUi.h"
+
+// ================= MEMBER FUNCTIONS =======================
+
+// constructor
+CAppUIDocument::CAppUIDocument(CEikApplication& aApp)
+: CAknDocument(aApp)    
+    {
+    }
+
+// destructor
+CAppUIDocument::~CAppUIDocument()
+    {
+    }
+
+// Symbian OS default constructor can leave.
+void CAppUIDocument::ConstructL()
+    {
+    }
+
+// Two-phased constructor.
+CAppUIDocument* CAppUIDocument::NewL(
+        CEikApplication& aApp)     // CAppUIApp reference
+    {
+    CAppUIDocument* self = new (ELeave) CAppUIDocument( aApp );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop();
+
+    return self;
+    }
+    
+// ----------------------------------------------------
+// CAppUIDocument::CreateAppUiL()
+// constructs CAppUIAppUi
+// ----------------------------------------------------
+//
+CEikAppUi* CAppUIDocument::CreateAppUiL()
+    {
+    return new (ELeave) CAppUIAppUi;
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/avkon/stifui/src/Container.cpp	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,444 @@
+/*
+* 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 file contains CTestCaseListBoxModel class
+* definition.
+*
+*/
+
+// INCLUDE FILES
+#include <aknlists.h>  // ListBox
+#include <AknIconArray.h> // CAknIconArray
+#include <aknnotewrappers.h>
+
+#include <eikclbd.h> //  CColumnListBoxData
+
+#include "Container.h"
+#include <Stifui.rsg>
+#include "Stifui.hrh"
+#include "AppUIAppUi.h"
+
+
+// ================= MEMBER FUNCTIONS =======================
+// ----------------------------------------------------------------------------
+// CTestCaseListBoxModel::NewL
+// 
+// Two-phased constructor.
+// ----------------------------------------------------------------------------
+//
+
+CTestCaseListBoxModel* CTestCaseListBoxModel::NewL(RPointerArray<CTestInfo>* aTestCasesInView)
+    {
+    CTestCaseListBoxModel* self = new ( ELeave ) CTestCaseListBoxModel();
+    CleanupStack::PushL( self );
+    self->iBuffer = HBufC::NewL( 130 );
+    self->iTestCasesInView = aTestCasesInView;
+    CleanupStack::Pop();
+    return self;
+    }
+
+// ----------------------------------------------------------------------------
+// CTestCaseListBoxModel::ConstructL
+// 
+// Symbian OS two phased constructor.
+// ----------------------------------------------------------------------------
+//
+
+void CTestCaseListBoxModel::ConstructL()
+    {
+    //iBuffer = HBufC::NewLC( KMaxInfoName + KMaxName + 2 );
+    }
+
+// ----------------------------------------------------------------------------
+// CTestCaseListBoxModel::~CTestCaseListBoxModel
+// 
+// Destructor.
+// ----------------------------------------------------------------------------
+//
+CTestCaseListBoxModel::~CTestCaseListBoxModel()
+    {
+    delete iBuffer;
+    }
+
+// ----------------------------------------------------------------------------
+// CTestCaseListBoxModel::MdcaCount
+// 
+// Returns the number of descriptor elements in the array.
+// ----------------------------------------------------------------------------
+//
+
+TInt CTestCaseListBoxModel::MdcaCount() const
+    {
+    return iTestCasesInView->Count();
+    }
+
+// ----------------------------------------------------------------------------
+// CTestCaseListBoxModel::MdcaPoint
+// 
+// Indexes into a descriptor array.
+// ----------------------------------------------------------------------------
+//
+TPtrC CTestCaseListBoxModel::MdcaPoint(TInt aIndex) const
+    {
+    CTestInfo* testCasePtr = (*iTestCasesInView)[aIndex];
+    TPtr buffer( iBuffer->Des() );
+    buffer.Zero();
+    buffer.Append(_L("\t"));
+    buffer.Append(testCasePtr->TestCaseTitle() );
+    return *iBuffer;
+    }
+
+// ================= MEMBER FUNCTIONS =======================
+// ----------------------------------------------------------------------------
+// CContainer::ConstructL
+// 
+// Symbian OS two phased constructor.
+// ----------------------------------------------------------------------------
+//
+void CContainer::ConstructL()
+    {
+    }
+
+// ----------------------------------------------------------------------------
+// CContainer::~CContainer
+// 
+// Destructor.
+// ----------------------------------------------------------------------------
+//
+CContainer::~CContainer()
+    {
+    iTestCasesInView.Close(); // does not delete objects whose pointers are contained in the array
+    delete iListBox;
+    }
+
+
+// ----------------------------------------------------------------------------
+// CContainer::SetGraphicIconL
+// 
+// Sets graphic icon using listbox as CEikColumnListBox.
+// ----------------------------------------------------------------------------
+//
+void CContainer::SetGraphicIconL( CEikColumnListBox* aListBox )
+	{
+	    if ( aListBox )
+	        {
+	        // Creates gul icon.
+	        CAknIconArray* iconArray = new(ELeave) CAknIconArray(1);
+	        CleanupStack::PushL( iconArray );
+	        
+	        GraphicIconL( iconArray ); // Appends graphic data.
+	        
+	        // Sets graphics as ListBox icon.
+	        aListBox->ItemDrawer()->ColumnData()->SetIconArray( iconArray );
+	        
+	        CleanupStack::Pop();
+	        }
+	    }
+
+// ----------------------------------------------------------------------------
+// CContainer::CurrentItemIndex
+// 
+// Returns current item index in list box.
+// ----------------------------------------------------------------------------
+//
+TInt CContainer::CurrentItemIndex()
+    {
+    return iListBox->CurrentItemIndex();
+    }
+
+// ----------------------------------------------------------------------------
+// CContainer::SetCurrentItemIndex
+// 
+// Sets current item index in list box.
+// ----------------------------------------------------------------------------
+//
+void CContainer::SetCurrentItemIndex(TInt aCurrentTestCase)
+    {
+    iListBox->SetCurrentItemIndexAndDraw(aCurrentTestCase);
+    }
+
+// ----------------------------------------------------------------------------
+// CContainer::GraphicIconL
+// 
+// Appends graphics data.
+// ----------------------------------------------------------------------------
+//
+void CContainer::GraphicIconL( CArrayPtr<CGulIcon>* aIcons )
+    {
+    if ( aIcons )
+            {
+            CFbsBitmap* markBitmap = NULL;
+            CFbsBitmap* markBitmapMask = NULL;
+    	
+            TRgb defaultColor;
+            defaultColor = CEikonEnv::Static()->Color(EColorControlText);
+    	
+            AknsUtils::CreateColorIconL(AknsUtils::SkinInstance(),
+            		KAknsIIDQgnIndiMarkedAdd,
+            		KAknsIIDQsnIconColors,
+            		EAknsCIQsnIconColorsCG13,
+            		markBitmap,
+            		markBitmapMask,
+            		AknIconUtils::AvkonIconFileName(),
+            		EMbmAvkonQgn_indi_marked_add,
+            		EMbmAvkonQgn_indi_marked_add_mask,
+            		defaultColor );
+            
+            CGulIcon* markIcon = CGulIcon::NewL(markBitmap,markBitmapMask);
+            aIcons->AppendL(markIcon); 
+            }
+        }
+
+
+// ----------------------------------------------------------------------------
+// CContainer::SizeChanged
+// 
+// Called by framework when the view size is changed.
+// ----------------------------------------------------------------------------
+//
+void CContainer::SizeChanged()
+    {
+    if ( iListBox )
+		{
+		iListBox->SetRect( Rect() ); // Sets rectangle of listbox.
+		}
+    }
+
+// ----------------------------------------------------------------------------
+// CContainer::CountComponentControls
+// 
+// Gets a count of the component controls of this list box control.
+// ----------------------------------------------------------------------------
+//
+TInt CContainer::CountComponentControls() const
+    {
+    return 1; // return nbr of controls inside this container
+    }
+
+// ----------------------------------------------------------------------------
+// CContainer::ComponentControl
+// 
+// Gets a pointer to the specified component control.
+// ----------------------------------------------------------------------------
+//
+CCoeControl* CContainer::ComponentControl(TInt aIndex) const
+    {
+    switch ( aIndex )
+        {
+		case 0: 
+			return iListBox;
+        default:
+            return NULL;
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// CContainer::Draw
+// 
+// Draw a control, called by window server.
+// ----------------------------------------------------------------------------
+//
+void CContainer::Draw(const TRect& /*aRect*/) const
+    {
+    // CWindowGc& gc = SystemGc();
+    }
+
+// ----------------------------------------------------------------------------
+// CContainer::SelectedTestCases
+// 
+// Returns pointers to selected test cases.
+// ----------------------------------------------------------------------------
+//
+void CContainer::SelectedTestCases
+                            (RPointerArray<CTestInfo>& aSelectedTestCases)
+    {
+    TInt selectedItemIdx = iListBox->CurrentItemIndex();
+    if ( ( selectedItemIdx >= 0 ) && ( iTestCasesInView.Count() > selectedItemIdx ) )
+        {
+        aSelectedTestCases.Append( iTestCasesInView[ selectedItemIdx ] );    
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// CContainer::SelectedTestCaseInfo
+// 
+// Returns pointers to currently selected (in list box) test cases info.
+// ----------------------------------------------------------------------------
+//
+CTestInfo* CContainer::SelectedTestCaseInfo()
+    {
+    TInt selectedItemIdx = iListBox->CurrentItemIndex();
+    if ( ( selectedItemIdx >= 0 ) && ( iTestCasesInView.Count() > selectedItemIdx ) )
+        {
+        return iTestCasesInView[ selectedItemIdx ];
+        }
+    return NULL;
+    }
+
+// ----------------------------------------------------------------------------
+// CContainer::TestCaseInfo
+// 
+// Returns pointers to selected test cases info.
+// ----------------------------------------------------------------------------
+//
+CTestInfo* CContainer::TestCaseInfo( TInt aIndex )
+    {
+    if ( ( aIndex >=0 ) && ( iTestCasesInView.Count() > aIndex ) )
+        {
+        return iTestCasesInView[ aIndex ];
+        }
+    return NULL;
+    }
+    
+// ----------------------------------------------------------------------------
+// CContainer::HandleMarkCommandL
+// 
+// Handles mark commands.
+// ----------------------------------------------------------------------------
+//
+void CContainer::HandleMarkCommandL( TInt aCommand )
+	{
+	if (iListBox)
+		{
+		AknSelectionService::HandleMarkableListProcessCommandL( aCommand, iListBox );		
+		}
+	}
+
+// ----------------------------------------------------------------------------
+// CContainer::ProcessCommandL
+// 
+// Processes user commands.
+// ----------------------------------------------------------------------------
+//
+void CContainer::ProcessCommandL( TInt  aCommand )
+	{
+	AknSelectionService::HandleMarkableListProcessCommandL( aCommand, iListBox );
+    }
+    
+// ----------------------------------------------------------------------------
+// CContainer::SelectionListProcessCommandL
+// 
+// Processes user commands.
+// ----------------------------------------------------------------------------
+//     
+void CContainer::SelectionListProcessCommandL( TInt  aCommand )
+	{
+	AknSelectionService::HandleSelectionListProcessCommandL( aCommand, iListBox );
+    }
+    
+// ----------------------------------------------------------------------------
+// CContainer::FilterCasesByModuleL
+// 
+// Show only testcases which are defined is specified module.
+// ----------------------------------------------------------------------------
+//
+void CContainer::FilterCasesByModuleL( TName aModuleName )
+    {
+    iTestCasesInView.Reset(); // Clear testCasesInView pointer array
+   
+    RRefArray<CTestInfo> allCases;
+    TInt ret = iUIStore->TestCases( allCases );
+    if( KErrNone != ret )
+        {
+        ((CAppUIAppUi*)iCoeEnv->AppUi())->iLogger->Log(_L("FilterCasesByModuleL(): iUIStore->TestCases() fails"));
+        allCases.Reset();
+        allCases.Close();
+        User::Leave( ret );
+        }
+    const TInt KTestCaseCount = allCases.Count();
+    for( TInt i=0; i < KTestCaseCount; i++ )
+        {
+        if ( allCases[i].ModuleName() == aModuleName )
+            {
+            iTestCasesInView.Append( &( allCases[i] ) );
+            }
+        }
+    allCases.Reset();
+    allCases.Close();
+
+    iListBox->Reset();
+    iListBox->DrawNow();
+    }
+
+// ----------------------------------------------------------------------------
+// CContainer::FilterCasesByTCFileNameL
+// 
+// Show only testcases which are defined is specified test case file.
+// ----------------------------------------------------------------------------
+//
+void CContainer::FilterCasesByTCFileNameL( 
+                                                TFileName aTestCaseFileName )
+    {
+
+    iTestCasesInView.Reset(); // Clear testCasesInView pointer array
+  
+    RRefArray<CTestInfo> allCases;
+    TInt ret = iUIStore->TestCases( allCases );
+    if( KErrNone != ret )
+        {
+        ((CAppUIAppUi*)iCoeEnv->AppUi())->iLogger->Log(_L("FilterCasesByModuleL(): iUIStore->TestCases() fails"));
+        allCases.Reset();
+        allCases.Close();
+        User::Leave( ret );
+        }
+    const TInt KTestCaseCount = allCases.Count();
+    for( TInt i=0; i < KTestCaseCount; i++ )
+        {
+        if ( allCases[i].TestCaseFile() == aTestCaseFileName )
+            {
+            iTestCasesInView.Append( &( allCases[i] ) );
+            }
+        }
+
+    allCases.Reset();
+    allCases.Close();
+
+    iListBox->Reset();
+    iListBox->DrawNow();
+    }
+
+// ----------------------------------------------------------------------------
+// CContainer::NoFilteringL
+// 
+// Remove possible filtering of test cases -> show all test cases.
+// ----------------------------------------------------------------------------
+//
+void CContainer::NoFilteringL()
+    {
+    iTestCasesInView.Reset(); // Clear testCasesInView pointer array
+
+    RRefArray<CTestInfo> allCases;
+    TInt ret = iUIStore->TestCases( allCases );
+    if( KErrNone != ret )
+        {
+        ((CAppUIAppUi*)iCoeEnv->AppUi())->iLogger->Log(_L("FilterCasesByModuleL(): iUIStore->TestCases() fails"));
+        allCases.Reset();
+        allCases.Close();
+        User::Leave( ret );
+        }
+    const TInt KTestCaseCount = allCases.Count();
+
+    // Add all cases to iTestCasesInView pointer array
+    for( TInt i=0; i < KTestCaseCount; i++ )
+        {
+        iTestCasesInView.Append( &( allCases[i] ) );
+        }
+
+    allCases.Reset();
+    allCases.Close();
+
+    iListBox->Reset();
+    iListBox->DrawNow();
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/avkon/stifui/src/CreatedTestSetMenuContainer.cpp	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,210 @@
+/*
+* 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 fiole contains CreatedTestSetMenuContainer class
+* definition.
+*
+*/
+
+// INCLUDE FILES
+#include <aknlists.h>   // ListBox
+#include <AknIconArray.h> // CAknIconArray
+#include <aknnotewrappers.h>
+
+#include <eikclbd.h> // CColumnListBoxData
+
+#include "CreatedTestSetMenuContainer.h"
+#include "StartCasesView.h"
+#include <Stifui.rsg>
+#include "Stifui.hrh"
+#include "AppUIAppUi.h"
+
+#include "Container.h"
+#include "MenuListBox.h"
+
+
+// ================= MEMBER FUNCTIONS =======================
+// ----------------------------------------------------------------------------
+// CreatedTestSetMenuContainer::ConstructL
+// 
+// Symbian OS two phased constructor.
+// ----------------------------------------------------------------------------
+//
+void CCreatedTestSetMenuContainer::ConstructL(const TRect& aRect, MEikListBoxObserver* aListBoxObserver)
+    {
+    ((CAppUIAppUi*)iCoeEnv->AppUi())->iLogger->Log(_L("CCreatedTestSetMenuContainer: ConstructL"));
+
+	iParentView = (CCreatedTestSetMenuView*)aListBoxObserver;
+    CreateWindowL();
+
+    iUIStore = ( (CAppUIAppUi*)iCoeEnv->AppUi() )->UIStoreHandler();
+
+    iTestCasesInView.Reset();
+    
+	iListBox = CMenuListBox::NewL(ECreatedTestSetMenuViewId);
+	iListBox->SetContainerWindowL( *this );
+	iListBox->SetListBoxObserver( aListBoxObserver /*this*/ ); // 
+    iListBox->ConstructL(this, EAknListBoxMarkableList /*EAknListBoxSelectionList*/);
+
+    ((CAppUIAppUi*)iCoeEnv->AppUi())->iLogger->Log(_L("CCreatedTestSetMenuContainer: ListBox constructed"));
+
+    //Create Scroller control for ListBox and set its visibility
+    iListBox->CreateScrollBarFrameL(ETrue);
+    iListBox->ScrollBarFrame()->SetScrollBarVisibilityL(CEikScrollBarFrame::EOff,CEikScrollBarFrame::EAuto);
+	iListBox->ItemDrawer()->ColumnData()->EnableMarqueeL( ETrue );
+
+    if ( iUIStore )
+        {
+        CDesCArray* items = static_cast<CDesCArray*> (iListBox->Model()->ItemTextArray());
+        
+        //Create list of available Test Set
+        RRefArray<TDesC>    allSet;      
+        RRefArray<CTestInfo> allCases;
+        TInt ret = iUIStore->GetTestSetsList( allSet );
+        if( KErrNone != ret )
+            {
+            ((CAppUIAppUi*)iCoeEnv->AppUi())->iLogger->Log(_L("iUIStore->GetTestSetsList() fails"));
+            allSet.Reset();
+            allSet.Close();
+            User::Leave( ret );
+            }
+
+        const TInt KTestCaseCount = allSet.Count();
+        for (TInt i=0; i <KTestCaseCount; i++)
+            {
+            _LIT(KItemFromat, "0\t%S\t\t");
+     
+           RBuf tmp;
+           tmp.Create(allSet[i].Length() + 6);
+           tmp.Format( KItemFromat, &allSet[i] );
+           items->AppendL( tmp );
+           tmp.Close();
+           }
+       ((CAppUIAppUi*)iCoeEnv->AppUi())->iLogger->Log(_L("CCreatedTestSetMenuContainer: ListBox model"));         
+       iListBox->Model()->SetOwnershipType(ELbmOwnsItemArray);
+       iListBox->HandleItemAdditionL();
+ 
+        allSet.Reset();
+        allSet.Close();
+        }
+    else
+        {
+        User::Leave( KErrGeneral );
+        }
+
+    // Creates graphic.
+    SetGraphicIconL( iListBox );
+       ((CAppUIAppUi*)iCoeEnv->AppUi())->iLogger->Log(_L("CCreatedTestSetMenuContainer: icons created"));
+
+    iListBox->ActivateL();
+    ((CMenuListBox*)iListBox)->SetPreviousFocus();
+
+    SetRect(aRect);
+    ActivateL();
+    }
+
+// ----------------------------------------------------------------------------
+//CreatedTestSetMenuContainer::~CStartCasesContainer
+// 
+// Destructor
+// ----------------------------------------------------------------------------
+//
+CCreatedTestSetMenuContainer::~CCreatedTestSetMenuContainer()
+    {
+    }
+
+// ----------------------------------------------------------------------------
+// CreatedTestSetMenuContainer::SizeChanged
+// 
+// Called by framework when the view size is changed.
+// ----------------------------------------------------------------------------
+//
+void CCreatedTestSetMenuContainer::SizeChanged()
+    {
+    
+    if ( iListBox )
+		{
+		iListBox->SetRect( Rect() ); // Sets rectangle of listbox.
+		}
+    }
+
+// ----------------------------------------------------------------------------
+//CreatedTestSetMenuContainer::CountComponentControls
+// 
+// Gets a count of the component controls of this list box control.
+// ----------------------------------------------------------------------------
+//
+TInt CCreatedTestSetMenuContainer::CountComponentControls() const
+    {
+    return 1; // return nbr of controls inside this container
+    }
+
+// ----------------------------------------------------------------------------
+// CreatedTestSetMenuContainer::ComponentControl
+// 
+// Gets a pointer to the specified component control.
+// ----------------------------------------------------------------------------
+//
+CCoeControl* CCreatedTestSetMenuContainer::ComponentControl(TInt aIndex) const
+    {
+    switch ( aIndex )
+        {
+		case 0: 
+			return iListBox;
+        default:
+            return NULL;
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// CreatedTestSetMenuContainer::Draw
+// 
+// Draw a control, called by window server.
+// ----------------------------------------------------------------------------
+//
+void CCreatedTestSetMenuContainer::Draw(const TRect& /*aRect*/) const
+    {
+    }
+
+// ----------------------------------------------------------------------------
+// CreatedTestSetMenuContainer::OfferKeyEventL
+// 
+// Handles key events.
+// ----------------------------------------------------------------------------
+//
+TKeyResponse CCreatedTestSetMenuContainer::OfferKeyEventL(
+	const TKeyEvent& aKeyEvent, TEventCode aType )
+    {
+	if (iListBox)
+		{
+	
+		return iListBox->OfferKeyEventL( aKeyEvent, aType );
+		}
+	else
+		{
+		return EKeyWasNotConsumed;
+		}
+    }
+
+// ----------------------------------------------------------------------------
+// CreatedTestSetMenuContainer:::SaveActiveLine
+//
+// Makes the iListBox member save its focus position
+// ----------------------------------------------------------------------------
+//
+void CCreatedTestSetMenuContainer::SaveActiveLine()
+	{
+	((CMenuListBox*)iListBox)->SaveFocusPosition();
+	}
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/avkon/stifui/src/CreatedTestSetMenuView.cpp	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,197 @@
+/*
+* 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 file contains CStartCasesView class definition.
+*
+*/
+
+// INCLUDE FILES
+#include  <eikmenub.h>
+#include  <aknViewAppUi.h>
+#include  <aknlistquerydialog.h> 
+#include  <barsread.h>	//TResourceReader
+#include  <Stifui.rsg>
+#include  "CreatedTestSetMenuView.h"
+#include  "CreatedTestSetMenuContainer.h"
+#include  "AppUIAppUi.h"
+#include  "Stifui.hrh" 
+#include "TestSetMenuView.h"
+
+
+// ================= MEMBER FUNCTIONS =======================
+// ----------------------------------------------------------------------------
+// CStartCasesView::ConstructL
+// 
+// Symbian OS two-phased constructor.
+// ----------------------------------------------------------------------------
+//
+void CCreatedTestSetMenuView::ConstructL()
+    {
+    CView::ConstructL();  
+    BaseConstructL(R_APPUI_LOADTESTSETVIEW);
+    iCurrentTestCase = 0;
+
+    }
+
+// ----------------------------------------------------------------------------
+// CreatedTestSetMenuView::~CStartCasesView
+// 
+// Destructor
+// ----------------------------------------------------------------------------
+//
+CCreatedTestSetMenuView::~CCreatedTestSetMenuView()
+    {
+    if ( iContainer )
+        {
+        AppUi()->RemoveFromViewStack( *this, iContainer );
+        delete iContainer;
+        }
+    delete iNaviDecorator;
+    iNaviDecorator = NULL;
+    }
+
+// ----------------------------------------------------------------------------
+// CreatedTestSetMenuView::Id
+// 
+// Returns view´s id.
+// ----------------------------------------------------------------------------
+//
+TUid CCreatedTestSetMenuView::Id() const
+    {
+    return TUid::Uid(ECreatedTestSetMenuViewId);
+
+    }
+
+// ----------------------------------------------------------------------------
+// CreatedTestSetMenuView::HandleCommandL
+// 
+// Handles a command.
+// ----------------------------------------------------------------------------
+//
+void CCreatedTestSetMenuView::HandleCommandL(TInt aCommand)
+    {   
+    switch ( aCommand )
+            {
+            case EAknSoftkeyBack:
+                {
+                AppUi()->HandleCommandL(EAppUIGoToTestSetsMenu);
+                break;
+                }
+    		case EAknCmdOpen:
+    			{
+    		   		HandleListBoxEventL(iContainer->ListBox(), EEventEnterKeyPressed);	
+    			break;
+    			}
+            default:
+                {
+                AppUi()->HandleCommandL( aCommand );
+                break;
+                }
+            }
+
+    }
+
+// ----------------------------------------------------------------------------
+//CreatedTestSetMenuView::HandleClientRectChange
+// 
+// Handles client rect changes.
+// ----------------------------------------------------------------------------
+//
+void CCreatedTestSetMenuView::HandleClientRectChange()
+    {
+    if ( iContainer )
+        {
+        iContainer->SetRect( ClientRect() );
+        }
+
+    }
+
+// ----------------------------------------------------------------------------
+// CreatedTestSetMenuView::DoActivateL
+// 
+// Initializes view when activated.
+// ----------------------------------------------------------------------------
+//
+void CCreatedTestSetMenuView::DoActivateL(
+   const TVwsViewId& /*aPrevViewId*/,TUid /*aCustomMessageId*/,
+   const TDesC8& /*aCustomMessage*/)
+    {
+    if (!iContainer)
+        {
+        ((CAppUIAppUi*)AppUi())->iLogger->Log(_L("CreatedTestSetMenuView: DoActivateL"));
+        iContainer = new (ELeave) CCreatedTestSetMenuContainer;
+        iContainer->SetMopParent(this);
+        iContainer->ConstructL( ClientRect(), this );
+           ((CAppUIAppUi*)AppUi())->iLogger->Log(_L("CreatedTestSetMenuView: container constructed"));
+        AppUi()->AddToStackL( *this, iContainer );
+        }
+
+    iContainer->SetCurrentItemIndex(iCurrentTestCase);
+    
+    CEikStatusPane* sp=iEikonEnv->AppUiFactory()->StatusPane();
+	CAknNavigationControlContainer* np= (CAknNavigationControlContainer *)sp->ControlL(TUid::Uid(EEikStatusPaneUidNavi));
+	
+	TResourceReader reader;
+	iCoeEnv->CreateResourceReaderLC(reader,R_NAVITITLE_LOADTESTSET);
+	iNaviDecorator = np->CreateNavigationLabelL( reader );
+	CleanupStack::PopAndDestroy(); // resource reader
+	np->PushL(*iNaviDecorator);
+
+    }
+
+// ----------------------------------------------------------------------------
+// CreatedTestSetMenuView::DoDeactivate
+// 
+// Deactivates view.
+// ----------------------------------------------------------------------------
+//
+void CCreatedTestSetMenuView::DoDeactivate()
+    {
+    if ( iContainer )
+        {
+        iContainer->SaveActiveLine();
+        AppUi()->RemoveFromViewStack( *this, iContainer );
+        delete iContainer;
+        iContainer = NULL;
+        }
+    delete iNaviDecorator;
+    iNaviDecorator = NULL;
+    }
+
+
+// ----------------------------------------------------------------------------
+// CreatedTestSetMenuView::HandleListBoxEventL
+// 
+// Handles listbox events.
+// ----------------------------------------------------------------------------
+//
+void CCreatedTestSetMenuView::HandleListBoxEventL( CEikListBox* aListBox, 
+    TListBoxEvent aEventType )
+	{
+	if (  aEventType == MEikListBoxObserver::EEventEnterKeyPressed    )
+		{
+	 	// Checking with item from list was selected	
+		CTextListBoxModel* tmp = (CTextListBoxModel*)aListBox->Model();
+		TPtrC item = tmp->ItemText(aListBox->CurrentItemIndex());
+		// Geting propper format of item from list (ex. 2008_8_10_13_16.set ). 
+		TPtrC substracted(item.Left(item.Length()-2));
+		substracted.Set(substracted.Right(substracted.Length()-2));
+		// Creating new view containing 		
+       	CTestSetMenuView* testSetMenu = (CTestSetMenuView*)AppUi()->View( TUid::Uid(ETestSetMenuViewId) ); 
+       	User::LeaveIfError( testSetMenu->LoadTestSetL( substracted ) );
+		AppUi()->HandleCommandL(ECmdGoToTestSetView);		
+        }
+ 
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/avkon/stifui/src/MainMenuContainer.cpp	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,217 @@
+/*
+* 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 file contains CMainMenuContainer class
+* definition.
+*
+*/
+
+// INCLUDE FILES
+#include <aknlists.h>  // ListBox
+
+#include <barsread.h> // for TResourceReader
+
+#include <aknnotewrappers.h>
+
+#include "MainMenuContainer.h"
+#include "Stifui.hrh"
+#include <Stifui.rsg>
+#include "MenuListBox.h"
+
+// ================= MEMBER FUNCTIONS =======================
+
+// ---------------------------------------------------------
+// CMainMenuContainer::ConstructL
+// 
+// Symbian OS two phased constructor
+// ---------------------------------------------------------
+//
+void CMainMenuContainer::ConstructL(const TRect& aRect)
+    {
+    CreateWindowL();
+
+	iListBox = CMenuListBox::NewL(EMainMenuViewId);
+	iListBox->SetContainerWindowL( *this );
+	TResourceReader reader;
+	iCoeEnv->CreateResourceReaderLC( reader, R_MAIN_MENU_LISTBOX );
+	iListBox->SetListBoxObserver( this );
+	iListBox->ConstructFromResourceL( reader );
+	CleanupStack::PopAndDestroy(); // resource stuffs. 
+	iListBox->ActivateL(); // Sets control as ready to be drawn
+	
+	// retrieve previous position of focus for this view/continer and set focus to this value
+	((CMenuListBox*)iListBox)->SetPreviousFocus();
+
+    SetRect(aRect);
+    ActivateL();
+    }
+
+
+// ---------------------------------------------------------
+// CMainMenuContainer::~CMainMenuContainer
+//
+// Destructor
+// ---------------------------------------------------------
+//
+CMainMenuContainer::~CMainMenuContainer()
+    {
+	if( iListBox )
+		{
+		delete iListBox;
+		iListBox = NULL;
+		}
+	}
+
+// ---------------------------------------------------------
+// CMainMenuContainer::SizeChanged
+// 
+// Called by framework when the view size is changed
+// ---------------------------------------------------------
+//
+void CMainMenuContainer::SizeChanged()
+    {
+    if ( iListBox )
+		{
+		iListBox->SetRect( Rect() ); // Sets rectangle of listbox.
+		}
+    }
+
+// ---------------------------------------------------------
+// CMainMenuContainer::CountComponentControls
+//
+// Returns number of controls indside this container.
+// ---------------------------------------------------------
+//
+TInt CMainMenuContainer::CountComponentControls() const
+    {
+    return 1;
+    }
+
+// ---------------------------------------------------------
+// CMainMenuContainer::ComponentControl
+// 
+// Gets the specified component of a compound control.
+// ---------------------------------------------------------
+//
+CCoeControl* CMainMenuContainer::ComponentControl(TInt aIndex) const
+    {
+    switch ( aIndex )
+        {
+		case 0: 
+			return iListBox;
+        default:
+            return NULL;
+        }
+    }
+
+// ---------------------------------------------------------
+// CMainMenuContainer::Draw
+// 
+// Draw a control, called by window server.
+// ---------------------------------------------------------
+//
+void CMainMenuContainer::Draw(const TRect& /*aRect*/) const
+    {
+    }
+
+// ---------------------------------------------------------
+// CMainMenuContainer::HandleListBoxEventL
+//
+// Handles list box events.
+// ---------------------------------------------------------
+//
+void CMainMenuContainer::HandleListBoxEventL(CEikListBox* aListBox, TListBoxEvent aEventType)
+	{
+
+	if ( ( aEventType == EEventEnterKeyPressed ) || ( aEventType == EEventItemDoubleClicked ) )
+		{	
+        HandleSelectedListItemL( aListBox->CurrentItemIndex() );
+		}
+
+	}
+	
+// ----------------------------------------------------------------------------
+// CMainMenuContainer::HandleSelectedListItemL
+//
+// Method HandleSelectedListItemL handles valix index.
+// ----------------------------------------------------------------------------
+//
+void CMainMenuContainer::HandleSelectedListItemL( TInt aIndex )
+	{	 
+		TInt selection = aIndex;
+        
+        // Change active view.
+	    switch ( selection )
+        {
+		    case 0:
+				( (CEikAppUi*)iCoeEnv->AppUi() )->HandleCommandL(EAppUIGoToTestCaseMenu);
+				break;
+			case 1:
+				( (CEikAppUi*)iCoeEnv->AppUi() )->HandleCommandL(EAppUIGoToModulesMenu);
+				break;
+			case 2: 
+				( (CEikAppUi*)iCoeEnv->AppUi() )->HandleCommandL(EAppUIGoToTestSetsMenu);
+				break;
+	        default:
+				break;
+		}
+	}
+
+// ---------------------------------------------------------
+// CMainMenuContainer::OfferKeyEventL
+// 
+// Handles key events.
+// ---------------------------------------------------------
+//
+TKeyResponse CMainMenuContainer::OfferKeyEventL(
+	const TKeyEvent& aKeyEvent, TEventCode aType)
+{
+	if (aType != EEventKey)
+	{
+		return EKeyWasNotConsumed;
+	}
+
+	// Offers key events to list box
+	if (iListBox)
+	{
+		return iListBox->OfferKeyEventL( aKeyEvent, aType );
+	}
+	else
+	{
+		return EKeyWasNotConsumed;
+	}
+}
+
+// ----------------------------------------------------------------------------
+// CMainMenuContainer:::GetActiveLine
+//
+// Get currently selected items index.
+// ----------------------------------------------------------------------------
+//
+TInt CMainMenuContainer::GetActiveLine()
+	{
+	return iListBox->CurrentItemIndex();
+	}
+
+// ----------------------------------------------------------------------------
+// CMainMenuContainer:::SaveActiveLine
+//
+// Makes the iListBox member save its focus position
+// ----------------------------------------------------------------------------
+//
+void CMainMenuContainer::SaveActiveLine()
+	{
+	((CMenuListBox*)iListBox)->SaveFocusPosition();
+	}
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/avkon/stifui/src/MainMenuView.cpp	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,161 @@
+/*
+* 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 file contains CMainMenuView class definition.
+*
+*/
+
+// INCLUDE FILES
+#include  <aknViewAppUi.h>
+#include  <barsread.h>	//TResourceReader
+#include  <Stifui.rsg>
+#include  "MainMenuView.h"
+#include  "MainMenuContainer.h" 
+#include  "Stifui.hrh"
+#include  "AppUIAppUi.h"
+
+
+// ================= MEMBER FUNCTIONS =======================
+
+// ---------------------------------------------------------
+// CMainMenuView::ConstructL
+// 
+// Symbian OS two-phased constructor
+// ---------------------------------------------------------
+//
+void CMainMenuView::ConstructL()
+    {
+    BaseConstructL( R_APPUI_MAINMENUVIEW );
+    }
+
+// ---------------------------------------------------------
+// CMainMenuView::~CMainMenuView
+// 
+// Destructor
+// ---------------------------------------------------------
+//
+CMainMenuView::~CMainMenuView()
+    {
+    if ( iContainer )
+        {
+        AppUi()->RemoveFromViewStack( *this, iContainer );
+        delete iContainer;
+        iContainer = NULL;
+        }
+    delete iNaviDecorator;
+    iNaviDecorator = NULL;
+    }
+
+// ---------------------------------------------------------
+// TUid CMainMenuView::Id
+// 
+// Returns view´s id.
+// ---------------------------------------------------------
+//
+TUid CMainMenuView::Id() const
+    {
+    return TUid::Uid(EMainMenuViewId); //KMainMenuViewId;
+    }
+
+// ---------------------------------------------------------
+// CMainMenuView::HandleCommandL
+// 
+// Handles a command.
+// ---------------------------------------------------------
+//
+void CMainMenuView::HandleCommandL(TInt aCommand)
+    {   
+    switch ( aCommand )
+        {
+        case EAknSoftkeyBack:
+            {
+            AppUi()->HandleCommandL(EEikCmdExit);
+            break;
+            }
+		case EAknCmdOpen:
+			{
+			TInt a = iContainer->GetActiveLine();
+			iContainer->HandleSelectedListItemL( a );
+			}
+			break;              
+        default:
+            {
+            AppUi()->HandleCommandL( aCommand );
+            break;
+            }
+        }
+    }
+
+// ---------------------------------------------------------
+// CMainMenuView::HandleClientRectChange
+//
+// Handles client rect changes.
+// ---------------------------------------------------------
+//
+void CMainMenuView::HandleClientRectChange()
+    {
+    if ( iContainer )
+        {
+        iContainer->SetRect( ClientRect() );
+        }
+    }
+
+// ---------------------------------------------------------
+// CMainMenuView::DoActivateL
+//
+// Initializes view when activated.
+// ---------------------------------------------------------
+//
+void CMainMenuView::DoActivateL(
+   const TVwsViewId& /*aPrevViewId*/,TUid /*aCustomMessageId*/,
+   const TDesC8& /*aCustomMessage*/)
+    {
+    if (!iContainer)
+        {
+        iContainer = new (ELeave) CMainMenuContainer;
+        iContainer->SetMopParent(this);
+        iContainer->ConstructL( ClientRect() );
+        AppUi()->AddToStackL( *this, iContainer );
+        } 
+
+    CEikStatusPane* sp=iEikonEnv->AppUiFactory()->StatusPane();
+    CAknNavigationControlContainer* np= (CAknNavigationControlContainer *)sp->ControlL(TUid::Uid(EEikStatusPaneUidNavi));
+		
+	TResourceReader reader;
+	iCoeEnv->CreateResourceReaderLC(reader,R_NAVITITLE_MAIN);
+	iNaviDecorator = np->CreateNavigationLabelL( reader );
+	CleanupStack::PopAndDestroy(); // resource reader
+	
+	np->PushL(*iNaviDecorator);
+   }
+
+// ---------------------------------------------------------
+// CAppUIView::DoDeactivate
+// 
+// Deactivates view.
+// ---------------------------------------------------------
+//
+void CMainMenuView::DoDeactivate()
+    {
+    if ( iContainer )
+        {
+        iContainer->SaveActiveLine();
+        AppUi()->RemoveFromViewStack( *this, iContainer );
+        delete iContainer;
+        iContainer = NULL;
+        }
+    delete iNaviDecorator;
+    iNaviDecorator = NULL;
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/avkon/stifui/src/MenuListBox.cpp	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,110 @@
+/*
+* 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 file contains CMenuListBox class definition.
+*
+*/
+
+// INCLUDE FILES
+#include "MenuListBox.h"
+#include <aknview.h>
+
+// ================= MEMBER FUNCTIONS =======================
+// ---------------------------------------------------------
+// CMainMenuView::CMenuListBox
+// 
+// c++ constructor
+// ---------------------------------------------------------
+//
+CMenuListBox::CMenuListBox(TAppUIViewNumber aViewId) 
+	: CAknSingleStyleListBox(), iViewId(aViewId)
+	{
+	}
+
+// ---------------------------------------------------------
+// CMenuListBox::ConstructL
+// 
+// Symbian OS two-phased constructor
+// ---------------------------------------------------------
+//
+void CMenuListBox::ConstructL()
+	{
+	
+	}
+
+// ---------------------------------------------------------
+// CMenuListBox::~CMenuListBox
+// 
+// Destructor
+// ---------------------------------------------------------
+//
+CMenuListBox::~CMenuListBox()
+	{
+
+	}
+
+// ---------------------------------------------------------
+// CMenuListBox::NewL
+// 
+// Symbian OS public constructor
+// @param aViewId - id of view to identify position in array where focus position will be saved to
+// or retrieved from
+//
+// @return - pointer to an instance of CMenuListBOx
+// ---------------------------------------------------------
+//
+CMenuListBox* CMenuListBox::NewL(TAppUIViewNumber aViewId)
+	{
+	CMenuListBox* self = new(ELeave) CMenuListBox(aViewId);
+	CleanupStack::PushL(self);
+	self->ConstructL();
+	CleanupStack::Pop(self);
+	return self;
+	}
+
+// ---------------------------------------------------------
+// CMenuListBox::SaveFocusPosition
+// 
+// Saves current focus position to CAppUiAppUi object
+// ---------------------------------------------------------
+//
+void CMenuListBox::SaveFocusPosition()
+	{
+	((CAppUIAppUi*)iCoeEnv->AppUi())->SaveFocusPosition(iViewId, this->CurrentItemIndex());
+	}
+
+// ---------------------------------------------------------
+// CMenuListBox::SetPreviousFocus
+// 
+// Retrieves previous focus position from CAppUiAppUi object and sets focus
+// to that position
+// ---------------------------------------------------------
+//
+void CMenuListBox::SetPreviousFocus()
+	{
+	TInt previousPosition = ((CAppUIAppUi*)iCoeEnv->AppUi())->GetFocusPosition(iViewId);
+	if(previousPosition != KErrNotFound)
+		{
+		if(previousPosition < this->Model()->NumberOfItems() && previousPosition != 0)
+			{
+			this->SetCurrentItemIndex(previousPosition);
+			}
+		if(previousPosition >= this->Model()->NumberOfItems()) 
+			{
+			this->SetCurrentItemIndex(0); // setting current item to first element if pervious position is grater then current. 
+			}
+		this->SetTopItemIndex(0);
+		}
+	}
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/avkon/stifui/src/ShowStartedCasesContainer.cpp	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,646 @@
+/*
+* 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 file contains CStartedTestsListBoxModel class
+* definition.
+*
+*/
+
+// INCLUDE FILES
+
+#include <aknlists.h>  // ListBox
+#include <AknIconArray.h>  // CAknIconArray
+#include <badesca.h> // CDesCArray
+#include <eikclbd.h> // CColumnListBoxData
+#include <aknnotewrappers.h>
+
+#include <Stifui.rsg>
+
+//#include "UIStoreIf.h"         
+//#include "UIStore.h"            
+//#include "UIEngine.h"           
+//#include "UIEngineContainer.h"  
+
+#include <stifinternal/UIStoreIf.h>
+#include <stifinternal/UIStore.h>
+#include <stifinternal/UIEngine.h>
+#include <stifinternal/UIEngineContainer.h>
+
+#include "ShowStartedCasesContainer.h"
+
+#include "Stifui.hrh"
+#include "AppUIAppUi.h"
+#include "MenuListBox.h"
+
+
+// ================= MEMBER FUNCTIONS =======================
+// ---------------------------------------------------------
+// CStartedTestsListBoxModel::NewL
+// 
+// Symbian OS two phased constructor
+// ---------------------------------------------------------
+//
+CStartedTestsListBoxModel* CStartedTestsListBoxModel::NewL 
+            ( RRefArray<CStartedTestCase>* aTestCasesInView )
+    {
+    CStartedTestsListBoxModel* self = new ( ELeave ) CStartedTestsListBoxModel();
+    CleanupStack::PushL( self );
+    self->iBuffer = HBufC::NewL( 130 );
+    self->iTestCasesInView = aTestCasesInView;
+    CleanupStack::Pop();
+    return self;
+
+    }
+
+// ---------------------------------------------------------
+// CStartedTestsListBoxModel::ConstructL
+// 
+// Symbian OS two phased constructor
+// Completes the construction of the object.
+// ---------------------------------------------------------
+//
+
+void CStartedTestsListBoxModel::ConstructL()
+    {
+    }
+
+// ---------------------------------------------------------
+// CStartedTestsListBoxModel::~CStartedTestsListBoxModel
+// 
+// Destructor
+// ---------------------------------------------------------
+//
+
+CStartedTestsListBoxModel::~CStartedTestsListBoxModel()
+    {
+    }
+
+// ---------------------------------------------------------
+// CStartedTestsListBoxModel::MdcaCount
+// 
+// Returns the number of descriptor elements in the array.
+// ---------------------------------------------------------
+//
+
+TInt CStartedTestsListBoxModel::MdcaCount() const
+    {
+    return iTestCasesInView->Count();
+
+    }
+
+// ---------------------------------------------------------
+// CStartedTestsListBoxModel::MdcaPoint
+// 
+// Indexes into a descriptor array.
+// ---------------------------------------------------------
+//
+TPtrC CStartedTestsListBoxModel::MdcaPoint(TInt aIndex) const
+    {
+    TPtr buffer( iBuffer->Des() );
+    buffer.Zero();
+    switch ( (*iTestCasesInView)[aIndex].Status() )
+        {
+        case CUIStoreIf::EStatusRunning:
+            {
+            if( (*iTestCasesInView)[aIndex].UIEngineContainer().State() ==
+                CUIEngineContainer::ERunning )
+                {
+                buffer.Append(_L("Running\t"));
+                }
+            else
+                {
+                buffer.Append(_L("Paused\t"));
+                }
+            break;
+            }
+        case CUIStoreIf::EStatusPassed:
+            {
+            buffer.Append(_L("Passed\t"));
+            break;
+            }
+        case CUIStoreIf::EStatusFailed:
+            {
+            buffer.Append(_L("Failed\t"));
+            break;
+            }
+        /*case ECrashed:
+            buffer.Append(_L("Crashed\t"));
+            break;*/
+        case CUIStoreIf::EStatusAborted:
+        	{
+            buffer.Append(_L("Aborted\t"));
+            break;
+        	}
+        default:
+        	{
+            if((*iTestCasesInView)[aIndex].Status() & CUIStoreIf::EStatusPassed)
+            	{
+            	buffer.Append(_L("Passed\t"));
+            	}
+        	else if((*iTestCasesInView)[aIndex].Status() & CUIStoreIf::EStatusFailed)
+            	{
+            	buffer.Append(_L("Failed\t"));
+            	}
+        	else if((*iTestCasesInView)[aIndex].Status() & CUIStoreIf::EStatusAborted)
+            	{
+            	buffer.Append(_L("Aborted\t"));
+            	}
+        	else if((*iTestCasesInView)[aIndex].Status() & CUIStoreIf::EStatusCrashed)
+	        	{
+	            buffer.Append(_L("Crashed\t"));
+	        	}
+        	else
+        		{
+        		buffer.Append(_L("\t"));
+        		}
+        	break;
+        	}
+        }
+        
+    buffer.Append((*iTestCasesInView)[aIndex].TestInfo().TestCaseTitle() );
+    
+    return *iBuffer;
+    
+    }
+
+
+
+// ---------------------------------------------------------
+// CShowStartedCasesContainer::ConstructL
+// 
+// Symbian OS two phased constructor
+// ---------------------------------------------------------
+//
+void CShowStartedCasesContainer::ConstructL(const TRect& aRect, MEikListBoxObserver* aListBoxObserver)
+    {
+    CreateWindowL();
+
+    iUIStore = ( (CAppUIAppUi*)iCoeEnv->AppUi() )->UIStoreHandler();
+
+    const TInt KSelectedMode = ((CAppUIAppUi*)iCoeEnv->AppUi())->iShowStartedCasesMode;
+    
+    if(KSelectedMode == EShowOngoingCases || KSelectedMode == EShowPausedCases
+    		|| KSelectedMode == EShowCrashedAbortedCases  || KSelectedMode == EShowAllStartedCases)
+    	{
+    	iListBox = new (ELeave) CAknSingleHeadingStyleListBox();
+    	}
+    else
+    	{
+    	iListBox = CMenuListBox::NewL(EShowStartedCasesViewId); //CAknSingleStyleListBox();
+    	}
+	iListBox->SetContainerWindowL( *this );
+	iListBox->SetListBoxObserver( aListBoxObserver );
+    iListBox->ConstructL(this, EAknListBoxSelectionList);
+
+    //Create Scroller control for ListBox and set its visibility
+    iListBox->CreateScrollBarFrameL(ETrue);
+    iListBox->ScrollBarFrame()->SetScrollBarVisibilityL(CEikScrollBarFrame::EOff,CEikScrollBarFrame::EAuto);
+	iListBox->ItemDrawer()->ColumnData()->EnableMarqueeL( ETrue );
+
+    if ( iUIStore )
+        {
+        ConstructListBoxModelL();
+        iListBoxModel = CStartedTestsListBoxModel::NewL( &iStartedTestsPtrs );
+        iListBox->Model()->SetItemTextArray(iListBoxModel);
+        }
+    else
+        {
+        //User::Leave( syy?? )
+        }
+	iListBox->ActivateL();
+	if(KSelectedMode != EShowOngoingCases && KSelectedMode != EShowPausedCases
+	    	&& KSelectedMode != EShowCrashedAbortedCases  && KSelectedMode != EShowAllStartedCases)
+		{
+		((CMenuListBox*)iListBox)->SetPreviousFocus();
+		}
+
+    SetRect(aRect);
+    ActivateL();
+
+    }
+
+// ---------------------------------------------------------
+// CShowStartedCasesContainer::ConstructListBoxModelL
+// 
+// Constructs list box model without any filtering.
+// ---------------------------------------------------------
+//
+void CShowStartedCasesContainer::ConstructListBoxModelL()
+    {
+    TInt ret( 0 );
+    RRefArray<CStartedTestCase> startedTestCases;
+    ret = iUIStore->StartedTestCases( startedTestCases );
+    if( KErrNone != ret )
+        {
+        startedTestCases.Reset();
+        startedTestCases.Close();
+        User::Leave( ret );
+        }
+    CleanupClosePushL( startedTestCases ); // Closes the handle
+
+    const TInt KStartedCaseCount = startedTestCases.Count();
+
+    iStartedTestsPtrs.Reset(); // Remove all pointers (does not delete objects)
+
+    const TInt KSelectedMode = ((CAppUIAppUi*)iCoeEnv->AppUi())->iShowStartedCasesMode;
+
+    // Loop through all started cases
+    for( TInt i=0; i < KStartedCaseCount; i++ )
+        {
+        switch ( KSelectedMode )
+            {
+            case EShowAllStartedCases:
+                {
+                iStartedTestsPtrs.Append( startedTestCases[i] );
+                break;
+                }
+            case EShowOngoingCases:
+                {
+                // Note: PAUSE IS ALSO RUNNIN STATUS
+                if ( startedTestCases[i].Status() & CUIStoreIf::EStatusRunning )
+                    {
+                    iStartedTestsPtrs.Append(startedTestCases[i]);
+                    }
+                break;
+                }
+            case EShowPassedCases:
+                {
+                if ( startedTestCases[i].Status() & CUIStoreIf::EStatusPassed )
+                    {
+                    iStartedTestsPtrs.Append( startedTestCases[i] );
+                    }
+                break;
+                }
+            case EShowPausedCases:
+                {
+                if ( startedTestCases[i].Status() & CUIStoreIf::EStatusRunning )
+                    {
+                    if( startedTestCases[i].UIEngineContainer().State() == CUIEngineContainer::EPaused )
+                        {
+                        iStartedTestsPtrs.Append( startedTestCases[i] );
+                        }
+                    }
+                break;
+                }
+            case EShowFailedCases:
+                {
+                if ( startedTestCases[i].Status() & CUIStoreIf::EStatusFailed )
+                    {
+                    iStartedTestsPtrs.Append( startedTestCases[i] );
+                    }
+                break;
+                }
+            case EShowCrashedAbortedCases:
+                {
+                if ( startedTestCases[i].Status() & CUIStoreIf::EStatusAborted 
+                		|| startedTestCases[i].Status() & CUIStoreIf::EStatusCrashed)
+                    {
+                    iStartedTestsPtrs.Append( startedTestCases[i] );
+                    }
+                break;
+                }
+            }
+        }
+    startedTestCases.Reset();
+    startedTestCases.Close();
+
+    CleanupStack::PopAndDestroy(); // startedTestCases
+
+    }
+
+// ---------------------------------------------------------
+// CShowStartedCasesContainer::~CShowStartedCasesContainer
+// 
+// Destructor
+// ---------------------------------------------------------
+//
+CShowStartedCasesContainer::~CShowStartedCasesContainer()
+    {
+    iStartedTestsPtrs.Close(); // does not delete objects whose pointers are contained in the array
+    }
+
+// ---------------------------------------------------------
+// CShowStartedCasesContainer::SizeChanged
+// 
+// Called by framework when the view size is changed
+// ---------------------------------------------------------
+//
+void CShowStartedCasesContainer::SizeChanged()
+    {
+    if ( iListBox )
+		{
+		iListBox->SetRect( Rect() ); // Sets rectangle of listbox.
+		}
+    }
+
+// ---------------------------------------------------------
+// CShowStartedCasesContainer::CountComponentControls
+//
+// Gets a count of the component controls of this list box control.
+// ---------------------------------------------------------
+//
+TInt CShowStartedCasesContainer::CountComponentControls() const
+    {
+    return 1; // return nbr of controls inside this container
+    }
+
+// ---------------------------------------------------------
+// CShowStartedCasesContainer::ComponentControl
+//
+// Gets a pointer to the specified component control.
+// ---------------------------------------------------------
+//
+CCoeControl* CShowStartedCasesContainer::ComponentControl(TInt aIndex) const
+    {
+    switch ( aIndex )
+        {
+		case 0: 
+			return iListBox;
+        default:
+            return NULL;
+        }
+    }
+
+// ---------------------------------------------------------
+// CShowStartedCasesContainer::Draw
+// 
+// Draw a control, called by window server.
+// ---------------------------------------------------------
+//
+void CShowStartedCasesContainer::Draw(const TRect& /*aRect*/) const
+    {
+    }
+
+// ---------------------------------------------------------
+// CShowStartedCasesContainer::OfferKeyEventL
+// 
+// Handles key events.
+// ---------------------------------------------------------
+//
+TKeyResponse CShowStartedCasesContainer::OfferKeyEventL(
+	const TKeyEvent& aKeyEvent, TEventCode aType)
+    {
+	if (aType != EEventKey)
+	    {
+		return EKeyWasNotConsumed;
+	    }
+
+	if (iListBox)
+		{
+		return iListBox->OfferKeyEventL( aKeyEvent, aType );
+		}
+	else
+		{
+		return EKeyWasNotConsumed;
+		}
+		
+	}
+	
+// ---------------------------------------------------------
+// CShowStartedCasesContainer::SelectedTestCase
+// 
+// Returns reference to currently selected test case in view (listbox).
+// ---------------------------------------------------------
+//
+CStartedTestCase* CShowStartedCasesContainer::SelectedTestCase()
+    {
+    if ( iStartedTestsPtrs.Count() > 0 )
+        {
+        return &(iStartedTestsPtrs[ iListBox->CurrentItemIndex() ]);
+        }
+    else
+        {
+        return NULL;
+        }
+    }
+
+// ---------------------------------------------------------
+// CShowStartedCasesContainer::DrawListBox
+// 
+// Refresh ListBox, if aSelectedTestCase is still found from ListBox
+// it is set as selected test case.
+// ---------------------------------------------------------
+//
+void CShowStartedCasesContainer::DrawListBox()
+    {
+    if ( iListBox )
+        {
+        iListBox->DrawNow();
+        }
+
+    }
+
+// ---------------------------------------------------------
+// CShowStartedCasesContainer::HandleItemAdditionL
+// 
+// Refresh ListBox after new item was added to listbox model.
+// ---------------------------------------------------------
+//
+void CShowStartedCasesContainer::HandleItemAdditionL()
+    {
+    iListBox->HandleItemAdditionL();
+
+    }
+
+
+// ---------------------------------------------------------
+// CShowStartedCasesContainer::HandleItemRemovalL
+// 
+// Refresh ListBox after item is removed from listbox model.
+// ---------------------------------------------------------
+//
+void CShowStartedCasesContainer::HandleItemRemovalL()
+    {
+    iListBox->HandleItemRemovalL();
+
+    // HandleItemRemovalL "loses selection" if current item is removed
+    // -> we have to check it and set one item as current item to make it possible for
+    // user to select one item from items left after remove
+    if ( iListBox->CurrentItemIndex() == -1 ) // No item selected
+        if ( ((CStartedTestsListBoxModel*)iListBox->Model())->MdcaCount() > 0 ) // there are items
+            SetCurrentItemIndex(0);
+
+    }
+
+// ---------------------------------------------------------
+// CShowStartedCasesContainer::TestsInViewCount
+// 
+// Returns count of test cases in view.
+// ---------------------------------------------------------
+//
+TInt CShowStartedCasesContainer::TestsInViewCount()
+    {
+    return ((CStartedTestsListBoxModel*)iListBox->Model())->MdcaCount();
+
+    }
+    
+// ---------------------------------------------------------
+// CShowStartedCasesContainer::CurrentTestCase
+// 
+// Returns pointer to currently selected test case.
+// ---------------------------------------------------------
+//
+CStartedTestCase* CShowStartedCasesContainer::CurrentTestCase()
+    {
+    return &iStartedTestsPtrs[ iListBox->CurrentItemIndex() ];
+    }
+
+// ---------------------------------------------------------
+// CShowStartedCasesContainer::SetCurrentItemIndex
+// 
+// Sets the current item.
+// ---------------------------------------------------------
+//
+void CShowStartedCasesContainer::SetCurrentItemIndex(TInt aIndex)
+    {
+    TInt itemCount = ((CStartedTestsListBoxModel*)iListBox->Model())->MdcaCount();
+    if ( aIndex < itemCount )
+        {
+        iListBox->SetCurrentItemIndex(aIndex);
+        }
+    else
+        {
+        iListBox->SetCurrentItemIndex(itemCount);
+        }
+
+    }
+
+// ---------------------------------------------------------
+// CShowStartedCasesContainer::ResetListBox
+// 
+// Resets the selection indices, top and current item indices,
+// the selection, and the horizontal scroll offset of this list box.
+// This function does not redraw the list box.
+// ---------------------------------------------------------
+//
+void CShowStartedCasesContainer::ResetListBox()
+    {
+    iListBox->Reset();
+
+    }
+
+// ---------------------------------------------------------
+// CShowStartedCasesContainer::RemoveSelectedExecutionsL
+// 
+// Removes items from list box.
+// ---------------------------------------------------------
+//
+void CShowStartedCasesContainer::RemoveSelectedExecutionsL()
+    {
+    TInt indexOfRemovedExecution = 0;
+    iStartedTestsPtrs.Remove(indexOfRemovedExecution);
+    HandleItemRemovalL();
+
+    }
+
+// ---------------------------------------------------------
+// CShowStartedCasesContainer::RemoveAllExecutionsInViewL
+// 
+// Removes all started test cases from list box.
+// ---------------------------------------------------------
+//
+void CShowStartedCasesContainer::RemoveAllExecutionsInViewL()
+    {
+    iStartedTestsPtrs.Reset(); // Empties the array, does not delete the objects whose pointers are contained in the array
+    HandleItemRemovalL();
+    }
+
+// ----------------------------------------------------------------------------
+// CContainer::FilterCasesByModuleL
+// 
+// Show only testcases which are defined is specified module.
+// ----------------------------------------------------------------------------
+//
+void CShowStartedCasesContainer::FilterCasesByModuleL(TName aModuleName)
+    {
+    //First the list box model have to be reconstructed to make sure that all
+    //possible earlier filtering does not affect
+    ConstructListBoxModelL();
+    
+    TInt i;
+    const TInt KCurrentShowedCaseCount = iStartedTestsPtrs.Count();
+
+    for ( i = KCurrentShowedCaseCount-1; i >= 0; i-- )
+        {
+        RRefArray<CStartedTestCase> startedTestCases;
+        TInt ret = iUIStore->StartedTestCases( startedTestCases );
+        if( ret != KErrNone )
+            {
+            startedTestCases.Reset();
+            startedTestCases.Close();
+            }
+        if ( startedTestCases[i].TestInfo().ModuleName() != aModuleName )
+            {
+            iStartedTestsPtrs.Remove(i); // delete pointer to CStartedTestCase
+            }
+        startedTestCases.Reset();
+        startedTestCases.Close();
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// CContainer::FilterCasesByTCFileNameL
+// 
+// Show only testcases which are defined is specified test case file.
+// ----------------------------------------------------------------------------
+//
+void CShowStartedCasesContainer::FilterCasesByTCFileNameL(TFileName aTestCaseFileName)
+    {
+
+    //First the list box model have to be reconstructed to make sure that all
+    //possible earlier filtering does not affect
+    ConstructListBoxModelL();
+
+    const TInt KCurrentShowedCaseCount = iStartedTestsPtrs.Count();
+
+    for ( TInt i = KCurrentShowedCaseCount-1; i >= 0; i-- )
+        {
+        RRefArray<CStartedTestCase> startedTestCases;
+        TInt ret = iUIStore->StartedTestCases( startedTestCases );
+        if( ret != KErrNone )
+            {
+            startedTestCases.Reset();
+            startedTestCases.Close();
+            }
+        if ( startedTestCases[i].TestInfo().TestCaseFile() != aTestCaseFileName )
+            {
+            iStartedTestsPtrs.Remove(i); // delete pointer to CStartedTestCase
+            }
+        startedTestCases.Reset();
+        startedTestCases.Close();
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// CContainer::NoFilteringL
+// 
+// Remove possible filtering of test cases -> show all test cases.
+// ----------------------------------------------------------------------------
+//
+void CShowStartedCasesContainer::NoFilteringL()
+    {
+    ConstructListBoxModelL();
+    }
+
+// ----------------------------------------------------------------------------
+// CShowStartedCasesContainer:::SaveActiveLine
+//
+// Makes the iListBox member save its focus position
+// ----------------------------------------------------------------------------
+//
+void CShowStartedCasesContainer::SaveActiveLine()
+	{
+	((CMenuListBox*)iListBox)->SaveFocusPosition();
+	}
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/avkon/stifui/src/ShowStartedCasesView.cpp	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,668 @@
+/*
+* 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 file contains CShowStartedCasesView class
+* definition.
+*
+*/
+
+// INCLUDE FILES
+#include  <eikmenub.h>
+#include  <aknViewAppUi.h>
+#include  <barsread.h>	//TResourceReader
+#include  <Stifui.rsg>
+
+//#include  "UIEngineContainer.h"  
+#include <stifinternal/UIEngineContainer.h>
+
+#include  "Stifui.hrh" 
+#include  "ShowStartedCasesView.h"
+#include  "ShowStartedCasesContainer.h"
+#include  "AppUIAppUi.h"
+
+// ================= MEMBER FUNCTIONS =======================
+
+// ----------------------------------------------------------------------------
+// CShowStartedCasesView::ConstructL
+// 
+// Symbian OS two-phased constructor
+// ----------------------------------------------------------------------------
+//
+void CShowStartedCasesView::ConstructL()
+    {
+    CView::ConstructL();
+    BaseConstructL( R_APPUI_SHOWSTARTEDCASESVIEW );
+    iFilterModule.Zero();
+    iFilterTestCaseFile.Zero();
+    iSelectedTestCase=0;
+    iNaviDecorator = NULL;
+    }
+
+// ----------------------------------------------------------------------------
+// CShowStartedCasesView::~CShowStartedCasesView()
+// 
+// Destructor
+// ----------------------------------------------------------------------------
+//
+CShowStartedCasesView::~CShowStartedCasesView()
+    {
+    if ( iContainer )
+        {
+        AppUi()->RemoveFromViewStack( *this, iContainer );
+        delete iContainer;
+        }
+    delete iNaviDecorator;
+    iNaviDecorator = NULL;
+    }
+
+// ----------------------------------------------------------------------------
+// TUid CShowStartedCasesView::Id()
+// 
+// Returns view´s id.
+// ----------------------------------------------------------------------------
+//
+TUid CShowStartedCasesView::Id() const
+    {
+    return TUid::Uid(EShowStartedCasesViewId);
+    }
+
+// ----------------------------------------------------------------------------
+// CShowStartedCasesView::HandleCommandL(TInt aCommand)
+// 
+// Handles a command.
+// ----------------------------------------------------------------------------
+//
+void CShowStartedCasesView::HandleCommandL(TInt aCommand)
+    {   
+    if ( aCommand >= ECmdFilterByModule && aCommand < ECmdFilterByTestCaseFile )
+        {
+        TInt moduleNumber = aCommand - ECmdFilterByModule;
+        RRefArray<TDesC> testModules;
+        TInt ret = ((CAppUIAppUi*)AppUi())->UIStoreHandler()->Modules( testModules );
+        if( KErrNone != ret )
+            {
+            testModules.Reset();
+            testModules.Close();
+            User::Leave( ret );
+            }
+        iFilterModule = testModules[moduleNumber];
+            
+        iFilterTestCaseFile.Zero();
+        
+        iContainer->FilterCasesByModuleL(iFilterModule);
+        //iContainer->ResetListBox();
+        //iContainer->DrawListBox();
+        
+        testModules.Reset();
+        testModules.Close();
+
+        return;
+        }
+
+    else if ( aCommand >= ECmdFilterByTestCaseFile && aCommand < ECmdNOFiltering )
+        {
+        TInt testCaseFileNumber = aCommand - ECmdFilterByTestCaseFile;
+        RRefArray<TDesC> testCaseFiles;
+        TInt ret = ((CAppUIAppUi*)AppUi())->UIStoreHandler()->TestCaseFiles( testCaseFiles );
+        if( KErrNone != ret )
+            {
+            testCaseFiles.Reset();
+            testCaseFiles.Close();
+            User::Leave( ret );
+            }
+
+        iFilterTestCaseFile = testCaseFiles[ testCaseFileNumber ];
+        iFilterModule.Zero();
+        //iContainer->FilterCasesByTCFileNameL(testCaseFileName);
+        iContainer->FilterCasesByTCFileNameL(iFilterTestCaseFile);
+        iContainer->ResetListBox();
+        iContainer->DrawListBox();
+
+        testCaseFiles.Reset();
+        testCaseFiles.Close();
+
+        return;
+        }
+
+    else if ( aCommand == ECmdNOFiltering )
+        {
+        iFilterModule.Zero();
+        iFilterTestCaseFile.Zero();
+        iContainer->NoFilteringL();
+        iContainer->ResetListBox();
+        iContainer->DrawListBox();
+        return;
+        }
+
+    // Handle rest possible commands
+    switch ( aCommand )
+        {
+        case ECmdViewOutput:
+            {
+            ViewTestCaseOutputL();
+            break;
+            }
+        case ECmdRemoveExecution:
+            {
+            iContainer->RemoveSelectedExecutionsL();
+            break;
+            }
+        case ECmdRemoveAllExecutions:
+            {
+            iContainer->RemoveAllExecutionsInViewL();
+            break;
+            }
+        case ECmdPauseTestCase:
+            {
+            TInt index = iContainer->CurrentItemIndex();
+            RRefArray<CStartedTestCase> runningTestCases;
+            TShowStartedCasesMode currentMode = (TShowStartedCasesMode)((CAppUIAppUi*)iCoeEnv->AppUi())->iShowStartedCasesMode;
+			TInt ret = KErrNone;
+			if(currentMode == EShowAllStartedCases)
+				ret = iUIStore->StartedTestCases(runningTestCases, CUIStoreIf::EStatusAll);
+			else if(currentMode == EShowOngoingCases)
+				ret = iUIStore->StartedTestCases(runningTestCases, CUIStoreIf::EStatusRunning);
+ 			if( KErrNone != ret )
+ 			    {
+ 			    User::Leave( ret );
+ 			    }
+ 			runningTestCases[index].UIEngineContainer().PauseTest();
+ 			runningTestCases.Close();
+            break;
+            }
+        case ECmdResumeTestCase:
+            {
+            TInt index = iContainer->CurrentItemIndex();
+            RRefArray<CStartedTestCase> runningTestCases;
+            TShowStartedCasesMode currentMode = (TShowStartedCasesMode)((CAppUIAppUi*)iCoeEnv->AppUi())->iShowStartedCasesMode;
+			TInt ret = KErrNone;
+			if(currentMode == EShowAllStartedCases)
+				ret = iUIStore->StartedTestCases(runningTestCases, CUIStoreIf::EStatusAll);
+			else if(currentMode == EShowOngoingCases || currentMode == EShowPausedCases)
+				ret = iUIStore->StartedTestCases(runningTestCases, CUIStoreIf::EStatusRunning);
+ 			if( KErrNone != ret )
+ 			    {
+ 			    User::Leave( ret );
+ 			    }
+ 			TInt testCaseToControl = 0;
+ 			if(currentMode == EShowAllStartedCases || currentMode == EShowOngoingCases)
+				{
+				testCaseToControl = index;
+				}
+			else if(currentMode == EShowPausedCases)
+				{
+				TInt pausedTestCasesCounter = 0;
+				for(int i = 0; i < runningTestCases.Count(); i++)
+					{
+					if(runningTestCases[i].UIEngineContainer().State() == CUIEngineContainer::EPaused)
+						{
+						if(pausedTestCasesCounter == index)
+							{
+							testCaseToControl = i;
+							break;
+							}
+						pausedTestCasesCounter++;
+						}
+					}
+				}
+ 			
+ 			runningTestCases[testCaseToControl].UIEngineContainer().ResumeTest();
+ 			runningTestCases.Close();
+            break;
+            }
+        case ECmdAbortTestCase:
+            { 
+			TInt index = iContainer->CurrentItemIndex();
+			RRefArray<CStartedTestCase> runningTestCases;
+			TShowStartedCasesMode currentMode = (TShowStartedCasesMode)((CAppUIAppUi*)iCoeEnv->AppUi())->iShowStartedCasesMode;
+			TInt ret = KErrNone;
+			if(currentMode == EShowAllStartedCases)
+				ret = iUIStore->StartedTestCases(runningTestCases, CUIStoreIf::EStatusAll);
+			else if(currentMode == EShowOngoingCases || currentMode == EShowPausedCases)
+				ret = iUIStore->StartedTestCases(runningTestCases, CUIStoreIf::EStatusRunning);
+				
+			if( KErrNone != ret )
+			    {
+			    User::Leave( ret );
+			    }
+			TInt testCaseToControl = 0;
+			
+			if(currentMode == EShowAllStartedCases || currentMode == EShowOngoingCases)
+				{
+				testCaseToControl = index;
+				}
+			else if(currentMode == EShowPausedCases)
+				{
+				TInt pausedTestCasesCounter = 0;
+				for(int i = 0; i < runningTestCases.Count(); i++)
+					{
+					if(runningTestCases[i].UIEngineContainer().State() == CUIEngineContainer::EPaused)
+						{
+						if(pausedTestCasesCounter == index)
+							{
+							testCaseToControl = i;
+							break;
+							}
+						pausedTestCasesCounter++;
+						}
+					}
+				}
+			
+			runningTestCases[testCaseToControl].UIEngineContainer().CancelTest();
+			runningTestCases.Close();
+            break;
+            }
+        case EAknSoftkeyOk:
+            {
+            iEikonEnv->InfoMsg( _L("TestCase Menu ok") );
+            break;
+            }
+        case EAknSoftkeyBack:
+            {
+            // Remove possible filterings so that they does not affect when coming again to this view
+            iFilterModule.Zero();
+            iFilterTestCaseFile.Zero();
+            iSelectedTestCase=0; //Reset selected test case information
+            AppUi()->HandleCommandL(EAppUIGoBack);
+            break;
+            }
+        default:
+            {
+            AppUi()->HandleCommandL( aCommand );
+            break;
+            }
+        }
+
+    }
+
+// ----------------------------------------------------------------------------
+// CShowStartedCasesView::HandleListBoxEventL
+// 
+// Handles listbox events.
+// ----------------------------------------------------------------------------
+//
+void CShowStartedCasesView::HandleListBoxEventL(CEikListBox* /*aListBox*/, TListBoxEvent aEventType)
+	{
+	if ( ( aEventType == EEventEnterKeyPressed ) || ( aEventType == EEventItemDoubleClicked ) )
+		{
+        ViewTestCaseOutputL();
+        }
+
+    }
+
+// ----------------------------------------------------------------------------
+// CShowStartedCasesView::ViewTestCaseOutputL
+// 
+// Shows outputs of test case which is selected in Container.
+// ----------------------------------------------------------------------------
+//
+void CShowStartedCasesView::ViewTestCaseOutputL()
+	{
+    iSelectedTestCase = iContainer->CurrentItemIndex();
+    
+    // Sets index  of selected test case to AppUi
+    //( ( CAppUIAppUi* )AppUi() )->SetTestCaseIndex( iSelectedTestCase );
+    ( ( CAppUIAppUi* )AppUi() )->SetStartedTestCase( iContainer->CurrentTestCase() );
+    
+    AppUi()->HandleCommandL(ECmdViewOutput);
+    }
+
+
+// ----------------------------------------------------------------------------
+// CShowStartedCasesView::HandleClientRectChange()
+// 
+// Handles client rect changes.
+// ----------------------------------------------------------------------------
+//
+void CShowStartedCasesView::HandleClientRectChange()
+    {
+    if ( iContainer )
+        {
+        iContainer->SetRect( ClientRect() );
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// CShowStartedCasesView::DoActivateL
+// 
+// Initializes view when activated.
+// ----------------------------------------------------------------------------
+//
+void CShowStartedCasesView::DoActivateL(
+   const TVwsViewId& /*aPrevViewId*/,TUid /*aCustomMessageId*/,
+   const TDesC8& /*aCustomMessage*/)
+    {
+    if (!iContainer)
+        {
+        iContainer = new (ELeave) CShowStartedCasesContainer;
+        iContainer->SetMopParent(this);
+        iContainer->ConstructL( ClientRect(), this );
+        AppUi()->AddToStackL( *this, iContainer );
+        } 
+
+    // Check if filtering by module or by test case file is selected
+    if ( iFilterModule.Length() )
+        {
+        iContainer->FilterCasesByModuleL(iFilterModule);
+        }
+    else if ( iFilterTestCaseFile.Length() )
+        {
+        iContainer->FilterCasesByTCFileNameL(iFilterTestCaseFile);
+        }
+    if ( iSelectedTestCase )
+        iContainer->SetCurrentItemIndex(iSelectedTestCase);
+    
+    RefreshNaviTitleL();
+    
+    iContainer->DrawListBox();
+   }
+
+
+// ----------------------------------------------------------------------------
+// CShowStartedCasesView::RefreshNaviTitle
+// 
+// Refreshes view name shown in the navi pane.
+// ----------------------------------------------------------------------------
+//
+void CShowStartedCasesView::RefreshNaviTitleL()
+    {
+    CEikStatusPane* sp=iEikonEnv->AppUiFactory()->StatusPane();
+	CAknNavigationControlContainer* np= (CAknNavigationControlContainer *)sp->ControlL(TUid::Uid(EEikStatusPaneUidNavi));
+	TResourceReader reader;
+
+    switch ( ((CAppUIAppUi*)iCoeEnv->AppUi())->iShowStartedCasesMode )
+        {
+        case EShowAllStartedCases:
+            iCoeEnv->CreateResourceReaderLC(reader,R_NAVITITLE_STARTED_ALL);
+            break;
+        case EShowOngoingCases:
+            iCoeEnv->CreateResourceReaderLC(reader,R_NAVITITLE_STARTED_ONGOING);
+            break;
+        case EShowPausedCases:
+            iCoeEnv->CreateResourceReaderLC(reader,R_NAVITITLE_STARTED_PAUSED);
+            break;
+        case EShowPassedCases:
+            iCoeEnv->CreateResourceReaderLC(reader,R_NAVITITLE_STARTED_PASSED);
+            break;
+        case EShowFailedCases:
+            iCoeEnv->CreateResourceReaderLC(reader,R_NAVITITLE_STARTED_FAILED);
+            break;
+        case EShowCrashedAbortedCases:
+            iCoeEnv->CreateResourceReaderLC(reader,R_NAVITITLE_STARTED_CRASHED_ABORTED);
+            break;
+        default:
+            iCoeEnv->CreateResourceReaderLC(reader,R_NAVITITLE_TESTSET);
+            break;
+        }
+    delete iNaviDecorator;
+    iNaviDecorator = NULL;        
+    iNaviDecorator = np->CreateNavigationLabelL( reader );
+	CleanupStack::PopAndDestroy(); // resource reader
+	np->PushL(*iNaviDecorator);
+    }
+    
+    
+// ----------------------------------------------------------------------------
+// CShowStartedCasesView::DoDeactivate
+// 
+// Deactivates view.
+// ----------------------------------------------------------------------------
+//
+void CShowStartedCasesView::DoDeactivate()
+    {
+    if ( iContainer )
+        {
+        TInt mode = ((CAppUIAppUi*)iCoeEnv->AppUi())->iShowStartedCasesMode;
+        if(mode != EShowOngoingCases && mode != EShowPausedCases
+		    	&& mode != EShowCrashedAbortedCases  && mode != EShowAllStartedCases)
+        	{
+        	iContainer->SaveActiveLine();
+        	}
+        AppUi()->RemoveFromViewStack( *this, iContainer );
+        delete iContainer;
+        iContainer = NULL;        
+        }
+    delete iNaviDecorator;
+    iNaviDecorator = NULL;
+
+    }
+
+
+// ----------------------------------------------------------------------------
+// CShowStartedCasesView::DynInitMenuPaneL
+// 
+// Initializes menu pane.
+// ----------------------------------------------------------------------------
+//
+void CShowStartedCasesView::DynInitMenuPaneL(
+    TInt aResourceId, CEikMenuPane* aMenuPane)
+    {
+    // options menu
+    if ( R_APPUI_SHOWSTARTEDCASESVIEW_MENU == aResourceId )
+        {
+        CStartedTestCase* startedTestCase = iContainer->SelectedTestCase();
+        if ( NULL != startedTestCase )
+            {
+            aMenuPane->SetItemDimmed( ECmdFilterMenu, EFalse );
+            switch ( startedTestCase->Status() )
+                {
+                // test case running
+                case CUIStoreIf::EStatusRunning:
+                    {
+                    switch ( startedTestCase->UIEngineContainer().State() )
+                        {
+                        case CUIEngineContainer::ERunning:
+                        case CUIEngineContainer::EPaused:
+                            {
+                            aMenuPane->SetItemDimmed( ECmdShowSetMenu, EFalse );
+                            break;
+                            }
+                        //case CUIEngineContainer::ENotStarted:
+                        //case CUIEngineContainer::EExecuted:
+                        //case CUIEngineContainer::EFinished:
+                        default:
+                            {
+                            aMenuPane->SetItemDimmed( ECmdShowSetMenu, ETrue );
+                            }
+                        }
+                    break;
+                    }
+                        
+                // test case not running
+                //case CUIStoreIf::EStatusPassed:
+                //case CUIStoreIf::EStatusFailed:
+                //case CUIStoreIf::EStatusAborted:
+                //case CUIStoreIf::EStatusExecuted
+                default:
+                    {
+                    aMenuPane->SetItemDimmed( ECmdShowSetMenu, ETrue );
+                    }
+                }
+            }
+        else
+            {
+            //aMenuPane->SetItemDimmed( ECmdFilterMenu, ETrue );
+            aMenuPane->SetItemDimmed( ECmdViewOutput, ETrue );
+            aMenuPane->SetItemDimmed( ECmdShowSetMenu, ETrue );
+            }
+        }
+
+    // test case control menu
+    if ( R_TESTCASE_CONTROL_SUBMENU == aResourceId )
+        {
+        CStartedTestCase* startedTestCase = iContainer->SelectedTestCase();
+        
+        if ( NULL != startedTestCase )
+            {
+            if ( startedTestCase->Status() == CUIStoreIf::EStatusRunning )
+                {
+                switch ( startedTestCase->UIEngineContainer().State() )
+                    {
+                    case CUIEngineContainer::ERunning:
+                        {
+                        aMenuPane->SetItemDimmed( ECmdResumeTestCase, ETrue );
+                        aMenuPane->SetItemDimmed( ECmdPauseTestCase, EFalse );
+                        aMenuPane->SetItemDimmed( ECmdAbortTestCase, EFalse );
+                        break;
+                        }
+                    case CUIEngineContainer::EPaused:
+                        {
+                        aMenuPane->SetItemDimmed( ECmdResumeTestCase, EFalse );
+                        aMenuPane->SetItemDimmed( ECmdPauseTestCase, ETrue );
+                        aMenuPane->SetItemDimmed( ECmdAbortTestCase, EFalse );
+                        break;
+                        }
+                    //case CUIEngineContainer::ENotStarted:
+                    //case CUIEngineContainer::EExecuted:
+                    //case CUIEngineContainer::EFinished:
+                    default:
+                        {
+                        aMenuPane->SetItemDimmed( ECmdResumeTestCase, ETrue );
+                        aMenuPane->SetItemDimmed( ECmdPauseTestCase, ETrue );
+                        aMenuPane->SetItemDimmed( ECmdAbortTestCase, ETrue );
+                        break;
+                        }
+                    }
+                }
+            else
+                {
+                aMenuPane->SetItemDimmed( ECmdResumeTestCase, ETrue );
+                aMenuPane->SetItemDimmed( ECmdPauseTestCase, ETrue );
+                aMenuPane->SetItemDimmed( ECmdAbortTestCase, ETrue );
+                }
+            }
+        else
+            {
+            aMenuPane->SetItemDimmed( ECmdResumeTestCase, ETrue );
+            aMenuPane->SetItemDimmed( ECmdPauseTestCase, ETrue );
+            aMenuPane->SetItemDimmed( ECmdAbortTestCase, ETrue );
+            }
+        }
+
+    // Test modules are added to filter by test module submenu if the submenu is opened
+    if (R_APPUI_FILTERBYMODULES_MENU == aResourceId)
+        {
+        RRefArray<TDesC> testModules;
+        TInt ret = ((CAppUIAppUi*)AppUi())->UIStoreHandler()->Modules( testModules );
+        if( KErrNone != ret )
+            {
+            testModules.Reset();
+            testModules.Close();
+            User::Leave( ret );
+            }        
+        TInt moduleCount = testModules.Count();
+
+        TInt i;
+        CEikMenuPaneItem::SData item;
+
+        item.iCommandId = ECmdFilterByModule;
+        item.iFlags = 0;
+        item.iCascadeId = 0;
+
+        for (i = 0; i < moduleCount; i++)
+            {
+            item.iText = testModules[i];
+            aMenuPane->AddMenuItemL(item);
+            item.iCommandId++; // command IDs 0x1000 - 0x1FFF are reserved for modules in hrh file
+            }
+        
+        testModules.Reset();
+        testModules.Close();
+
+        }
+
+    // Test case files are added to filter by test case file submenu if the submenu is opened
+    if (R_APPUI_FILTER_BY_TESTCASEFILE_MENU == aResourceId)
+        {
+        RRefArray<TDesC> testCaseFiles;
+        TInt ret = ((CAppUIAppUi*)AppUi())->UIStoreHandler()->TestCaseFiles( testCaseFiles );
+        if( KErrNone != ret )
+            {
+            testCaseFiles.Reset();
+            testCaseFiles.Close();
+            User::Leave( ret );
+            }        
+        TInt testCaseFileCount = testCaseFiles.Count();
+
+        TInt i;
+        CEikMenuPaneItem::SData item;
+
+        item.iCommandId = ECmdFilterByTestCaseFile;
+        item.iFlags = 0;
+        item.iCascadeId = 0;
+
+        for (i = 0; i < testCaseFileCount; i++)
+            {
+            item.iText = testCaseFiles[i];
+            // If there´s no test case file, don´t add item to menu.
+            if ( testCaseFiles[i].Length() > 0 )
+                {
+                aMenuPane->AddMenuItemL(item);
+                }
+            item.iCommandId++; // command IDs 0x2000 - 0x2FFF are reserved for test case files in hrh file
+            }
+        
+        testCaseFiles.Reset();
+        testCaseFiles.Close();
+
+        }
+
+    }
+
+// ----------------------------------------------------------------------------
+// CShowStartedCasesView::TestCaseStateChangedL
+// 
+// Handles status changes of test cases in view.
+// ----------------------------------------------------------------------------
+//
+void CShowStartedCasesView::TestCaseStateChangedL()
+    {
+    if ( iContainer )
+        {
+
+        //CStartedTestCase* currentlySelectedTest = iContainer->SelectedTestCase();
+
+        TInt numOfTestsInViewBeforeStateChange = iContainer->TestsInViewCount();
+
+            //((CStartedTestsListBoxModel*)iContainer->iListBox->Model())->MdcaCount();
+
+        iContainer->ConstructListBoxModelL();
+
+        // Check if filtering by module or by test case file is selected
+        if ( iFilterModule.Length() )
+            {
+            iContainer->FilterCasesByModuleL(iFilterModule);
+            }
+        else if ( iFilterTestCaseFile.Length() )
+            {
+            iContainer->FilterCasesByTCFileNameL(iFilterTestCaseFile);
+            }
+
+        TInt numOfTestsInViewAfterStateChange = iContainer->TestsInViewCount();
+            //((CStartedTestsListBoxModel*)iContainer->iListBox->Model())->MdcaCount();
+
+        if ( numOfTestsInViewAfterStateChange >= numOfTestsInViewBeforeStateChange )
+            iContainer->HandleItemAdditionL();
+        else
+            iContainer->HandleItemRemovalL();
+        
+        if(iContainer->CurrentItemIndex() < 0)
+        	{
+        	iContainer->SetCurrentItemIndex(0);
+        	}
+        iContainer->DrawListBox();
+
+        }
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/avkon/stifui/src/StartCasesContainer.cpp	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,227 @@
+/*
+* 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 file contains CStartCasesContainer class 
+* definition
+*
+*/
+
+// INCLUDE FILES
+#include <aknlists.h>   // ListBox
+#include <AknIconArray.h> // CAknIconArray
+#include <aknnotewrappers.h>
+
+#include <eikclbd.h> // CColumnListBoxData
+
+#include "StartCasesContainer.h"
+#include "StartCasesView.h"
+#include <Stifui.rsg>
+#include "Stifui.hrh"
+#include "AppUIAppUi.h"
+
+#include "Container.h"
+#include "MenuListBox.h"
+
+
+// ================= MEMBER FUNCTIONS =======================
+// ----------------------------------------------------------------------------
+// CStartCasesContainer::ConstructL
+// 
+// Symbian OS two phased constructor.
+// ----------------------------------------------------------------------------
+//
+void CStartCasesContainer::ConstructL(const TRect& aRect, MEikListBoxObserver* aListBoxObserver)
+    {
+    ((CAppUIAppUi*)iCoeEnv->AppUi())->iLogger->Log(_L("StartCasesContainer: ConstructL"));
+
+	iParentView = (CStartCasesView*)aListBoxObserver;
+    CreateWindowL();
+
+    iUIStore = ( (CAppUIAppUi*)iCoeEnv->AppUi() )->UIStoreHandler();
+
+    iTestCasesInView.Reset();
+        //((CAppUIAppUi*)iCoeEnv->AppUi())->iLogger->Log(_L("StartCasesContainer: iTCInV Reset"));
+    
+	iListBox = CMenuListBox::NewL(EStartCaseMenuViewId);
+	iListBox->SetContainerWindowL( *this );
+	iListBox->SetListBoxObserver( aListBoxObserver /*this*/ ); // jos peritty MEikListBoxObserver:sta
+    iListBox->ConstructL(this, EAknListBoxMarkableList /*EAknListBoxSelectionList*/);
+
+    ((CAppUIAppUi*)iCoeEnv->AppUi())->iLogger->Log(_L("StartCasesContainer: ListBox constructed"));
+
+    //Create Scroller control for ListBox and set its visibility
+    iListBox->CreateScrollBarFrameL(ETrue);
+    iListBox->ScrollBarFrame()->SetScrollBarVisibilityL(CEikScrollBarFrame::EOff,CEikScrollBarFrame::EAuto);
+	iListBox->ItemDrawer()->ColumnData()->EnableMarqueeL( ETrue );
+
+    if ( iUIStore )
+        {
+        RRefArray<CTestInfo> allCases;
+        TInt ret = iUIStore->TestCases( allCases );
+        if( KErrNone != ret )
+            {
+            ((CAppUIAppUi*)iCoeEnv->AppUi())->iLogger->Log(_L("iUIStore->TestCases() fails"));
+            allCases.Reset();
+            allCases.Close();
+            User::Leave( ret );
+            }
+
+        const TInt KTestCaseCount = allCases.Count();
+        for (TInt i=0; i < KTestCaseCount; i++)
+            {
+            ret = iTestCasesInView.Append( &allCases[i] );
+            if( ret != KErrNone )
+            	{
+            	((CAppUIAppUi*)iCoeEnv->AppUi())->iLogger->Log(_L("Test case append fails with: %d"), ret );
+    			User::Leave( ret );
+	            }
+            }
+
+        iListBoxModel = CTestCaseListBoxModel::NewL(&iTestCasesInView);
+             ((CAppUIAppUi*)iCoeEnv->AppUi())->iLogger->Log(_L("StartCasesContainer: ListBox model"));
+
+        iListBox->Model()->SetItemTextArray(iListBoxModel);
+             ((CAppUIAppUi*)iCoeEnv->AppUi())->iLogger->Log(_L("StartCasesContainer: ListBox model set"));
+
+        allCases.Reset();
+        allCases.Close();
+        }
+    else
+        {
+        User::Leave( KErrGeneral );
+        }
+
+    // Creates graphic.
+    SetGraphicIconL( iListBox );
+       ((CAppUIAppUi*)iCoeEnv->AppUi())->iLogger->Log(_L("StartCasesContainer: icons created"));
+
+    iListBox->ActivateL();
+    ((CMenuListBox*)iListBox)->SetPreviousFocus();
+
+    SetRect(aRect);
+    ActivateL();
+    }
+
+// ----------------------------------------------------------------------------
+// CStartCasesContainer::~CStartCasesContainer
+// 
+// Destructor
+// ----------------------------------------------------------------------------
+//
+CStartCasesContainer::~CStartCasesContainer()
+    {
+    }
+
+// ----------------------------------------------------------------------------
+// CStartCasesContainer::SizeChanged
+// 
+// Called by framework when the view size is changed.
+// ----------------------------------------------------------------------------
+//
+void CStartCasesContainer::SizeChanged()
+    {
+    if ( iListBox )
+		{
+		iListBox->SetRect( Rect() ); // Sets rectangle of listbox.
+		}
+    }
+
+// ----------------------------------------------------------------------------
+// CStartCasesContainer::CountComponentControls
+// 
+// Gets a count of the component controls of this list box control.
+// ----------------------------------------------------------------------------
+//
+TInt CStartCasesContainer::CountComponentControls() const
+    {
+    return 1; // return nbr of controls inside this container
+    }
+
+// ----------------------------------------------------------------------------
+// CStartCasesContainer::ComponentControl
+// 
+// Gets a pointer to the specified component control.
+// ----------------------------------------------------------------------------
+//
+CCoeControl* CStartCasesContainer::ComponentControl(TInt aIndex) const
+    {
+    switch ( aIndex )
+        {
+		case 0: 
+			return iListBox;
+        default:
+            return NULL;
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// CStartCasesContainer::Draw
+// 
+// Draw a control, called by window server.
+// ----------------------------------------------------------------------------
+//
+void CStartCasesContainer::Draw(const TRect& /*aRect*/) const
+    {
+    }
+
+// ----------------------------------------------------------------------------
+// CStartCasesContainer::OfferKeyEventL
+// 
+// Handles key events.
+// ----------------------------------------------------------------------------
+//
+TKeyResponse CStartCasesContainer::OfferKeyEventL(
+	const TKeyEvent& aKeyEvent, TEventCode aType )
+    {
+	if (aType != EEventKey)
+	    {
+		return EKeyWasNotConsumed;
+	    }
+
+	if (iListBox)
+		{
+		//if multiple items selected
+		if ( iListBox->SelectionIndexes()->Count() > 0 )
+			{
+			TUint mask = 0x40488;
+			
+			//if event is enter key,
+			//don´t send it to listbox
+			if ( aKeyEvent.iScanCode == 0xa7 
+				&& ( aKeyEvent.iModifiers & mask ) == 0 )
+				{
+				iParentView->HandleListBoxEventL( iListBox, MEikListBoxObserver::EEventEnterKeyPressed );
+				return EKeyWasConsumed;	
+				}
+			}
+			
+		return iListBox->OfferKeyEventL( aKeyEvent, aType );
+		}
+	else
+		{
+		return EKeyWasNotConsumed;
+		}
+    }
+
+// ----------------------------------------------------------------------------
+// CStartCasesContainer:::SaveActiveLine
+//
+// Makes the iListBox member save its focus position
+// ----------------------------------------------------------------------------
+//
+void CStartCasesContainer::SaveActiveLine()
+	{
+	((CMenuListBox*)iListBox)->SaveFocusPosition();
+	}
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/avkon/stifui/src/StartCasesView.cpp	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,457 @@
+/*
+* 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 file contains CStartCasesView class definition.
+*
+*/
+
+// INCLUDE FILES
+#include  <eikmenub.h>
+#include  <aknViewAppUi.h>
+#include  <aknlistquerydialog.h> 
+#include  <barsread.h>	//TResourceReader
+#include  <Stifui.rsg>
+#include  "StartCasesView.h"
+#include  "StartCasesContainer.h"
+#include  "AppUIAppUi.h"
+#include  "Stifui.hrh" 
+
+
+// ================= MEMBER FUNCTIONS =======================
+// ----------------------------------------------------------------------------
+// CStartCasesView::ConstructL
+// 
+// Symbian OS two-phased constructor.
+// ----------------------------------------------------------------------------
+//
+void CStartCasesView::ConstructL()
+    {
+    CView::ConstructL();
+    BaseConstructL( R_APPUI_STARTCASESVIEW );
+    iCurrentTestCase = 0;
+
+    }
+
+// ----------------------------------------------------------------------------
+// CStartCasesView::~CStartCasesView
+// 
+// Destructor
+// ----------------------------------------------------------------------------
+//
+CStartCasesView::~CStartCasesView()
+    {
+    if ( iContainer )
+        {
+        AppUi()->RemoveFromViewStack( *this, iContainer );
+        delete iContainer;
+        }
+    delete iNaviDecorator;
+    iNaviDecorator = NULL;
+    }
+
+// ----------------------------------------------------------------------------
+// CStartCasesView::Id
+// 
+// Returns view´s id.
+// ----------------------------------------------------------------------------
+//
+TUid CStartCasesView::Id() const
+    {
+    return TUid::Uid(EStartCaseMenuViewId);
+
+    }
+
+// ----------------------------------------------------------------------------
+// CStartCasesView::HandleCommandL
+// 
+// Handles a command.
+// ----------------------------------------------------------------------------
+//
+void CStartCasesView::HandleCommandL(TInt aCommand)
+    {   
+    if ( aCommand >= ECmdFilterByModule && aCommand < ECmdFilterByTestCaseFile ) // 0x1000 - 0x1FFF
+        {
+        TInt moduleNumber = aCommand - ECmdFilterByModule;
+        RRefArray<TDesC> allModules;
+        TInt ret = ((CAppUIAppUi*)AppUi())->UIStoreHandler()->Modules( allModules );
+        if( KErrNone != ret )
+            {
+            allModules.Reset();
+            allModules.Close();
+            User::Leave( ret );
+            }
+        TName moduleName = allModules[ moduleNumber ];
+
+        iContainer->FilterCasesByModuleL( moduleName );
+
+        allModules.Reset();
+        allModules.Close();
+        }
+	else if ( aCommand >= ECmdFilterByTestCaseFile && aCommand < ECmdNOFiltering )
+        {
+        TInt testCaseFileNumber = aCommand - ECmdFilterByTestCaseFile;
+        RRefArray<TDesC> allTestCases;
+        TInt ret = ((CAppUIAppUi*)AppUi())->UIStoreHandler()->TestCaseFiles( allTestCases );
+        if( KErrNone != ret )
+            {
+            allTestCases.Reset();
+            allTestCases.Close();
+            User::Leave( ret );
+            }
+        TFileName testCaseFileName = allTestCases[ testCaseFileNumber ];
+
+        iContainer->FilterCasesByTCFileNameL( testCaseFileName );
+
+        allTestCases.Reset();
+        allTestCases.Close();
+        }
+	else if ( aCommand == ECmdNOFiltering )
+        {
+        iContainer->NoFilteringL();
+        }
+    else if ( aCommand == EAknCmdMark || aCommand == EAknCmdUnmark 
+    	|| aCommand == EAknMarkAll || aCommand == EAknUnmarkAll )
+    	{
+    	iContainer->HandleMarkCommandL( aCommand );
+    	}
+    else
+	    {
+ 	    switch ( aCommand )
+	        {
+	        case ECmdStartCases:
+	            {
+	            CheckListBoxSelectionsL( iContainer->ListBox() );
+	            break;
+	            }
+	        case EAknSoftkeyBack:
+	            {
+	            iCurrentTestCase = 0;
+	            AppUi()->HandleCommandL(EAppUIGoBack);
+	            break;
+	            }
+	        default:
+	            {
+	            AppUi()->HandleCommandL( aCommand );
+	            break;
+	            }
+	        }
+	    }
+
+    }
+
+// ----------------------------------------------------------------------------
+// CStartCasesView::HandleClientRectChange
+// 
+// Handles client rect changes.
+// ----------------------------------------------------------------------------
+//
+void CStartCasesView::HandleClientRectChange()
+    {
+    if ( iContainer )
+        {
+        iContainer->SetRect( ClientRect() );
+        }
+
+    }
+
+// ----------------------------------------------------------------------------
+// CStartCasesView::DoActivateL
+// 
+// Initializes view when activated.
+// ----------------------------------------------------------------------------
+//
+void CStartCasesView::DoActivateL(
+   const TVwsViewId& /*aPrevViewId*/,TUid /*aCustomMessageId*/,
+   const TDesC8& /*aCustomMessage*/)
+    {
+    if (!iContainer)
+        {
+        ((CAppUIAppUi*)AppUi())->iLogger->Log(_L("StartCasesView: DoActivateL"));
+        iContainer = new (ELeave) CStartCasesContainer;
+        iContainer->SetMopParent(this);
+        iContainer->ConstructL( ClientRect(), this );
+           ((CAppUIAppUi*)AppUi())->iLogger->Log(_L("StartCasesView: container constructed"));
+        AppUi()->AddToStackL( *this, iContainer );
+        }
+
+    iContainer->SetCurrentItemIndex(iCurrentTestCase);
+    
+    CEikStatusPane* sp=iEikonEnv->AppUiFactory()->StatusPane();
+	CAknNavigationControlContainer* np= (CAknNavigationControlContainer *)sp->ControlL(TUid::Uid(EEikStatusPaneUidNavi));
+	
+	TResourceReader reader;
+	iCoeEnv->CreateResourceReaderLC(reader,R_NAVITITLE_STARTCASES);
+	iNaviDecorator = np->CreateNavigationLabelL( reader );
+	CleanupStack::PopAndDestroy(); // resource reader
+	np->PushL(*iNaviDecorator);
+
+    }
+
+// ----------------------------------------------------------------------------
+// CStartCasesView::DoDeactivate
+// 
+// Deactivates view.
+// ----------------------------------------------------------------------------
+//
+void CStartCasesView::DoDeactivate()
+    {
+    if ( iContainer )
+        {
+        iContainer->SaveActiveLine();
+        AppUi()->RemoveFromViewStack( *this, iContainer );
+        delete iContainer;
+        iContainer = NULL;
+        }
+    delete iNaviDecorator;
+    iNaviDecorator = NULL;
+    }
+
+
+// ----------------------------------------------------------------------------
+// CStartCasesView::DynInitMenuPaneL
+// 
+// Initializes menu pane.
+// ----------------------------------------------------------------------------
+//
+void CStartCasesView::DynInitMenuPaneL(
+    TInt aResourceId, CEikMenuPane* aMenuPane)
+    {
+
+    // Test modules are added to filter by test module submenu if the submenu is opened
+    if (R_APPUI_FILTERBYMODULES_MENU == aResourceId)
+        {
+        RRefArray<TDesC> modules;
+        TInt ret = ((CAppUIAppUi*)AppUi())->UIStoreHandler()->Modules( modules );
+        if( KErrNone != ret )
+            {
+            modules.Reset();
+            modules.Close();
+            User::Leave( ret );
+            }
+
+        TInt moduleCount = modules.Count();
+        
+        TInt i;
+        CEikMenuPaneItem::SData item;
+
+        item.iCommandId = ECmdFilterByModule;
+        item.iFlags = 0;
+        item.iCascadeId = 0;
+
+        for (i = 0; i < moduleCount; i++)
+            {
+            //item.iText = modules[i].iModuleName;
+            item.iText.Copy( modules[i].Left( item.iText.MaxLength() ) ) ;
+            aMenuPane->AddMenuItemL(item);
+            item.iCommandId++; // command IDs 0x1000 - 0x1FFF are reserved for modules in hrh file
+            }
+        
+        modules.Reset();
+        modules.Close();
+
+        }
+
+    // Test case files are added to filter by test case file submenu if the submenu is opened
+    if (R_APPUI_FILTER_BY_TESTCASEFILE_MENU == aResourceId)
+        {
+        RRefArray<TDesC> testCaseFiles;
+        TInt ret = ((CAppUIAppUi*)AppUi())->UIStoreHandler()->TestCaseFiles( testCaseFiles );
+        if( KErrNone != ret )
+            {
+            testCaseFiles.Reset();
+            testCaseFiles.Close();
+            User::Leave( ret );
+            }
+
+        TInt testCaseFileCount = testCaseFiles.Count();
+
+        TInt i;
+        CEikMenuPaneItem::SData item;
+
+        item.iCommandId = ECmdFilterByTestCaseFile;
+        item.iFlags = 0;
+        item.iCascadeId = 0;
+
+        for (i = 0; i < testCaseFileCount; i++)
+            {
+            item.iText.Copy( testCaseFiles[i].Left( item.iText.MaxLength() ) );
+            // If there´s no test case file, don´t add item to menu.
+            if ( testCaseFiles[i].Length() > 0 )
+                {
+                aMenuPane->AddMenuItemL(item);
+                }
+            item.iCommandId++; // command IDs 0x2000 - 0x2FFF are reserved for test case files in hrh file
+            }
+        
+        testCaseFiles.Reset();
+        testCaseFiles.Close();
+        }
+
+    }
+
+// ----------------------------------------------------------------------------
+// CStartCasesView::HandleListBoxEventL
+// 
+// Handles listbox events.
+// ----------------------------------------------------------------------------
+//
+void CStartCasesView::HandleListBoxEventL( CEikListBox* aListBox, 
+    TListBoxEvent aEventType )
+	{
+	if ( ( aEventType == EEventEnterKeyPressed ) || ( aEventType == EEventItemDoubleClicked ) )
+		{
+		CheckListBoxSelectionsL( aListBox );
+        }
+        
+    }
+
+// ----------------------------------------------------------------------------
+// CStartCasesView::CheckListBoxSelectionsL
+// 
+// Checks listbox selections and launches query dialog to start test cases.
+// ----------------------------------------------------------------------------
+//
+void CStartCasesView::CheckListBoxSelectionsL( CEikListBox* aListBox )
+    {
+    TInt i(0);
+	TInt count = aListBox->SelectionIndexes()->Count();
+
+	RArray<TInt> selectedIndices;
+	CleanupClosePushL( selectedIndices );
+
+	if ( count > 0 )
+	{
+		for( i = 0; i < count; i++ )
+			{
+			selectedIndices.InsertInOrder( 
+			    (*aListBox->SelectionIndexes())[i] );
+			}
+	}
+	
+	// Check count of selected items.
+	if ( count == 1 )
+		{
+		iCurrentTestCase = selectedIndices[0];
+       	StartTestCaseL();
+		}
+	else if (count > 1)
+		{
+       	StartTestCasesL( selectedIndices );	
+		}
+	else
+		{
+		iCurrentTestCase = iContainer->CurrentItemIndex();
+       	StartTestCaseL();	
+		}
+
+    CleanupStack::PopAndDestroy();
+    
+    }
+    
+// ----------------------------------------------------------------------------
+// CStartCasesView::StartTestCaseL
+// 
+// Starts test case which is selected in containers list box.
+// First shows a list query if user wants just start test case or
+// if he wants to start test case and view test case output.
+// ----------------------------------------------------------------------------
+//
+void CStartCasesView::StartTestCaseL()
+    {
+    TInt selectedItem(0);
+    CAknListQueryDialog* startDialog = new (ELeave) CAknListQueryDialog(&selectedItem);
+    if ( startDialog->ExecuteLD(R_START_TESTCASE_LIST_QUERY) )
+        {
+        CTestInfo* testCaseInfo = iContainer->SelectedTestCaseInfo();
+
+        User::LeaveIfNull( testCaseInfo );
+        
+        TInt testCaseIndex( 0 );
+
+        TInt ret = ((CAppUIAppUi*)AppUi())->UIStoreHandler()->StartTestCase( *testCaseInfo, testCaseIndex );
+      
+        if( KErrNone != ret )
+            {
+            User::Leave( ret );
+            }
+
+        // Increment the counter value
+        ((CAppUIAppUi*)AppUi())->iUIStoreHandler->iExecutedTestCaseCount++;
+     
+        if ( selectedItem == 1 ) // if view output was selected
+            {
+            CStartedTestCase* startedCase = 
+                &((CAppUIAppUi*)AppUi())->UIStoreHandler()->StartedTestCaseL( 
+                testCaseIndex );
+            ((CAppUIAppUi*)AppUi())->SetStartedTestCase( startedCase );
+                
+            AppUi()->HandleCommandL( ECmdViewOutput );
+
+            }
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// CStartCasesView::StartTestCasesL
+// 
+// Starts multiple test cases which are selected in containers list box.
+// Shows a list query if user wants to start cases parallel or sequential.
+// ----------------------------------------------------------------------------
+//
+void CStartCasesView::StartTestCasesL( RArray<TInt> aSelectedIndexes )
+    {
+    _LIT( KTempSet, "TempSet");
+    TInt selectedItem(0);
+    TInt i(0);
+    TInt ret(0);
+    
+    CAknListQueryDialog* startDialog = new (ELeave) CAknListQueryDialog(&selectedItem);
+    if ( startDialog->ExecuteLD(R_START_MULTIPLE_TESTCASES_LIST_QUERY) )
+    	{
+    	ret = ((CAppUIAppUi*)AppUi())->UIStoreHandler()->CreateTestSet( KTempSet );
+    	
+        User::LeaveIfError( ret );
+        
+        for( i = 0; i < aSelectedIndexes.Count(); i++ )
+        	{
+            CTestInfo* testCaseInfo = iContainer->TestCaseInfo( aSelectedIndexes[i] );
+            User::LeaveIfNull( testCaseInfo );
+        
+    		ret = ((CAppUIAppUi*)AppUi())->UIStoreHandler()->AddToTestSet( KTempSet, *testCaseInfo );
+    		if( KErrNone != ret )
+    			{
+    			User::Leave( ret );
+    			}
+    		// Increment the counter value
+        	((CAppUIAppUi*)AppUi())->iUIStoreHandler->iExecutedTestCaseCount++;
+	        }
+	    
+	    //start cases
+	    if ( selectedItem == 0 )
+	    	{
+			ret = ((CAppUIAppUi*)AppUi())->UIStoreHandler()->StartTestSet( 
+		        ((CAppUIAppUi*)AppUi())->UIStoreHandler()->TestSetL( KTempSet ),
+				i, CStartedTestSet::ESetParallel);
+		    }
+	    else if (selectedItem == 1)
+		    {
+	    	ret = ((CAppUIAppUi*)AppUi())->UIStoreHandler()->StartTestSet(
+	    	    ((CAppUIAppUi*)AppUi())->UIStoreHandler()->TestSetL( KTempSet ),
+	    	    i, CStartedTestSet::ESetSequential);
+	    	}
+
+        ret = ((CAppUIAppUi*)AppUi())->UIStoreHandler()->RemoveTestSet( KTempSet );
+    	}
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/avkon/stifui/src/StartedCasesMenuContainer.cpp	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,233 @@
+/*
+* 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 file contains CStartedCasesMenuContainer
+* class definition.
+*
+*/
+
+// INCLUDE FILES
+#include "StartedCasesMenuContainer.h"
+#include "Stifui.hrh"
+#include <Stifui.rsg>
+
+#include <aknlists.h>  //ListBox
+#include <barsread.h> // for TResourceReader
+
+#include <aknnotewrappers.h>
+
+#include "MenuListBox.h"
+
+
+// ================= MEMBER FUNCTIONS =======================
+// ----------------------------------------------------------------------------
+// CStartedCasesMenuContainer::ConstructL
+// 
+// Symbian OS default constructor.
+// ----------------------------------------------------------------------------
+//
+void CStartedCasesMenuContainer::ConstructL(
+                    const TRect& aRect )
+    {
+    CreateWindowL();
+
+	iListBox = CMenuListBox::NewL(EStartedCasesMenuViewId);
+	iListBox->SetContainerWindowL( *this );
+	TResourceReader reader;
+	iCoeEnv->CreateResourceReaderLC( reader, R_STARTED_CASES_MENU_LISTBOX );
+	iListBox->SetListBoxObserver( this ); // jos peritty MEikListBoxObserver:sta
+	//iListBox->SetObserver( this /*iMainMenuObserver*/ ); //jos peritty MCoeControlObserver:sta
+	iListBox->ConstructFromResourceL( reader );
+    CleanupStack::PopAndDestroy(); // resource stuffs. 
+
+    //Create Scroller control for ListBox and set its visibility
+    iListBox->CreateScrollBarFrameL(ETrue);
+    iListBox->ScrollBarFrame()->SetScrollBarVisibilityL(CEikScrollBarFrame::EOff,CEikScrollBarFrame::EAuto);
+
+    ((CMenuListBox*)iListBox)->SetPreviousFocus();
+	iListBox->ActivateL();
+
+    SetRect(aRect);
+    ActivateL();
+    }
+
+// Destructor
+CStartedCasesMenuContainer::~CStartedCasesMenuContainer()
+    {
+    if ( iListBox )
+		{    
+    	iListBox->Reset();
+    	delete iListBox;
+        }	
+    }
+
+// ----------------------------------------------------------------------------
+// CStartedCasesMenuContainer::SizeChanged
+// 
+// Called by framework when the view size is changed.
+// ----------------------------------------------------------------------------
+//
+void CStartedCasesMenuContainer::SizeChanged()
+    {
+    if ( iListBox )
+		{
+		iListBox->SetRect( Rect() ); // Sets rectangle of listbox.
+		}
+    }
+
+// ----------------------------------------------------------------------------
+// CStartedCasesMenuContainer::CountComponentControls
+// 
+// Gets a count of the component controls of this list box control.
+// ----------------------------------------------------------------------------
+//
+TInt CStartedCasesMenuContainer::CountComponentControls() const
+    {
+    return 1; // return nbr of controls inside this container
+    }
+
+// ----------------------------------------------------------------------------
+// CStartedCasesMenuContainer::ComponentControl
+// 
+// Gets a pointer to the specified component control.
+// ----------------------------------------------------------------------------
+//
+CCoeControl* CStartedCasesMenuContainer::ComponentControl(TInt aIndex) const
+    {
+    switch ( aIndex )
+        {
+		case 0: 
+			return iListBox;
+        default:
+            return NULL;
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// CStartedCasesMenuContainer::Draw
+// 
+// Draw a control, called by window server.
+// ----------------------------------------------------------------------------
+//
+void CStartedCasesMenuContainer::Draw(const TRect& /*aRect*/) const
+    {
+    // CWindowGc& gc = SystemGc();
+    }
+
+// ----------------------------------------------------------------------------
+// CStartedCasesMenuContainer::HandleListBoxEventL
+// 
+// Handles list box events.
+// ----------------------------------------------------------------------------
+//
+void CStartedCasesMenuContainer::HandleListBoxEventL(
+                                CEikListBox* aListBox,
+                                TListBoxEvent aEventType )
+	{
+
+	if ( ( aEventType == EEventEnterKeyPressed ) || ( aEventType == EEventItemDoubleClicked ) )
+		{
+		    HandleSelectedListItemL( aListBox->CurrentItemIndex() );
+		}
+	}
+
+
+
+// ----------------------------------------------------------------------------
+// CStartedCasesMenuContainer::HandleSelectedListItemL
+// 
+// Method HandleSelectedListItemL handles valid index.
+// ----------------------------------------------------------------------------
+//
+void CStartedCasesMenuContainer::HandleSelectedListItemL( TInt aIndex )
+	{	 
+		TInt selection = aIndex;
+
+	    switch ( selection )
+			{
+            case 0: ( (CEikAppUi*)iCoeEnv->AppUi() )->HandleCommandL(ECmdShowAllStartedCases);
+				break;
+            case 1:	( (CEikAppUi*)iCoeEnv->AppUi() )->HandleCommandL(ECmdShowOngoingCases);
+				break;
+            case 2: ( (CEikAppUi*)iCoeEnv->AppUi() )->HandleCommandL(ECmdShowPausedCases);
+				break;
+            case 3: ( (CEikAppUi*)iCoeEnv->AppUi() )->HandleCommandL(ECmdShowPassedCases);
+				break;
+            case 4: ( (CEikAppUi*)iCoeEnv->AppUi() )->HandleCommandL(ECmdShowFailedCases);
+				break;
+            case 5: ( (CEikAppUi*)iCoeEnv->AppUi() )->HandleCommandL(ECmdShowCrashedAbortedCases);
+				break;
+            case 6: ( (CEikAppUi*)iCoeEnv->AppUi() )->HandleCommandL(ECmdShowStatistics);
+				break;
+	        default:
+				break;
+			}
+	}	
+
+// ----------------------------------------------------------------------------
+// CStartedCasesMenuContainer::OfferKeyEventL
+// 
+// Handles key events.
+// ----------------------------------------------------------------------------
+//
+TKeyResponse CStartedCasesMenuContainer::OfferKeyEventL(
+	const TKeyEvent& aKeyEvent, TEventCode aType)
+    {
+	if (aType != EEventKey)
+	    {
+		return EKeyWasNotConsumed;
+	    }
+
+    switch ( aKeyEvent.iCode )
+        {
+        case EKeyLeftArrow:
+        case EKeyRightArrow:
+			{   /* Left ja right key eventit valitetaan AppUille joka hoitaa siirtymisen toisiin nakymiin */
+			return EKeyWasNotConsumed;
+            //break;
+            }
+        default:
+			{
+			//Muut Key eventit valitetaan listboxille, joka hoitaa ne
+			if (iListBox)
+				{
+				return iListBox->OfferKeyEventL( aKeyEvent, aType );
+				}
+			}
+        }
+    return EKeyWasNotConsumed;        
+    }
+
+// ----------------------------------------------------------------------------
+// CStartedCasesMenuContainer::GetActiveLine
+// 
+// Get currently selected items index.
+// ----------------------------------------------------------------------------
+//
+TInt CStartedCasesMenuContainer::GetActiveLine()
+	{
+	return iListBox->CurrentItemIndex();
+	}
+
+// ----------------------------------------------------------------------------
+// CStartedCasesMenuContainer:::SaveActiveLine
+//
+// Makes the iListBox member save its focus position
+// ----------------------------------------------------------------------------
+//
+void CStartedCasesMenuContainer::SaveActiveLine()
+	{
+	((CMenuListBox*)iListBox)->SaveFocusPosition();
+	}
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/avkon/stifui/src/StartedCasesMenuView.cpp	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,159 @@
+/*
+* 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 file contains CStartedCasesMenuView class
+* definition.
+*
+*/
+
+// INCLUDE FILES
+#include  <aknViewAppUi.h>
+#include  <barsread.h>	//TResourceReader
+#include  <Stifui.rsg>
+#include  "StartedCasesMenuView.h"
+#include  "StartedCasesMenuContainer.h"
+#include  "Stifui.hrh" 
+#include  "AppUIAppUi.h"
+
+// ================= MEMBER FUNCTIONS =======================
+// ----------------------------------------------------------------------------
+// CStartedCasesMenuView::ConstructL
+// 
+// Symbian OS two-phased constructor.
+// ----------------------------------------------------------------------------
+//
+void CStartedCasesMenuView::ConstructL()
+    {
+    CView::ConstructL();
+    BaseConstructL( R_APPUI_STARTEDCASESMENUVIEW );
+    }
+
+// ----------------------------------------------------------------------------
+// CStartedCasesMenuView::~CStartedCasesMenuView
+// 
+// Destructor.
+// ----------------------------------------------------------------------------
+//
+CStartedCasesMenuView::~CStartedCasesMenuView()
+    {
+    if ( iContainer )
+        {
+        AppUi()->RemoveFromViewStack( *this, iContainer );
+        delete iContainer;
+        }
+    delete iNaviDecorator;
+    iNaviDecorator = NULL;
+    }
+
+// ----------------------------------------------------------------------------
+// CStartedCasesMenuView::Id
+// 
+// Returns view´s id.
+// ----------------------------------------------------------------------------
+//
+TUid CStartedCasesMenuView::Id() const
+    {
+    return TUid::Uid(EStartedCasesMenuViewId); //KTestCaseMenuViewId;
+    }
+
+// ----------------------------------------------------------------------------
+// CStartedCasesMenuView::HandleCommandL
+// 
+// Handles a command.
+// ----------------------------------------------------------------------------
+//
+void CStartedCasesMenuView::HandleCommandL(TInt aCommand)
+    {   
+    switch ( aCommand )
+        {
+        case EAknSoftkeyBack:
+            {
+            AppUi()->HandleCommandL(EAppUIGoBack);
+            break;
+            }
+		case EAknCmdOpen:
+			{
+			TInt a = iContainer->GetActiveLine();
+			iContainer->HandleSelectedListItemL( a );
+			}
+			break;              
+        default:
+            {
+            AppUi()->HandleCommandL( aCommand );
+            break;
+            }
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// CStartedCasesMenuView::HandleClientRectChange
+// 
+// Handles client rect changes.
+// ----------------------------------------------------------------------------
+//
+void CStartedCasesMenuView::HandleClientRectChange()
+    {
+    if ( iContainer )
+        {
+        iContainer->SetRect( ClientRect() );
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// CStartedCasesMenuView::DoActivateL
+// 
+// Initializes view when activated.
+// ----------------------------------------------------------------------------
+//
+void CStartedCasesMenuView::DoActivateL(
+   const TVwsViewId& /*aPrevViewId*/,TUid /*aCustomMessageId*/,
+   const TDesC8& /*aCustomMessage*/)
+    {
+    if (!iContainer)
+        {
+        iContainer = new (ELeave) CStartedCasesMenuContainer;
+        iContainer->SetMopParent(this);
+        iContainer->ConstructL( ClientRect() );
+        AppUi()->AddToStackL( *this, iContainer );
+        } 
+        
+    CEikStatusPane* sp=iEikonEnv->AppUiFactory()->StatusPane();
+	CAknNavigationControlContainer* np= (CAknNavigationControlContainer *)sp->ControlL(TUid::Uid(EEikStatusPaneUidNavi));
+	
+	TResourceReader reader;
+	iCoeEnv->CreateResourceReaderLC(reader,R_NAVITITLE_STARTEDCASES);
+	iNaviDecorator = np->CreateNavigationLabelL( reader );
+	CleanupStack::PopAndDestroy(); // resource reader
+	np->PushL(*iNaviDecorator);
+   }
+
+// ----------------------------------------------------------------------------
+// CStartedCasesMenuView::DoDeactivate
+// 
+// Deactivates view.
+// ----------------------------------------------------------------------------
+//
+void CStartedCasesMenuView::DoDeactivate()
+    {
+    if ( iContainer )
+        {
+        iContainer->SaveActiveLine();
+        AppUi()->RemoveFromViewStack( *this, iContainer );
+        delete iContainer;
+        iContainer = NULL;
+        }
+    delete iNaviDecorator;
+    iNaviDecorator = NULL;
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/avkon/stifui/src/StatisticsContainer.cpp	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,297 @@
+/*
+* 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 file contains CStatisticsContainer class 
+* definition.
+*
+*/
+
+// INCLUDE FILES
+#include <aknlists.h>  // ListBox 
+#include <AknIconArray.h> // CAknIconArray
+#include <aknnotewrappers.h>
+
+#include <eikclbd.h> // CColumnListBoxData
+
+#include <Stifui.rsg>
+
+//#include "UIStoreIf.h"         
+//#include "UIStore.h"            
+//#include "UIEngine.h"           
+//#include "UIEngineContainer.h"  
+
+#include <stifinternal/UIStoreIf.h>
+#include <stifinternal/UIStore.h>
+#include <stifinternal/UIEngine.h>
+#include <stifinternal/UIEngineContainer.h>
+
+#include "StatisticsContainer.h"
+#include "Stifui.hrh"
+#include "AppUIAppUi.h"
+
+#include "MenuListBox.h"
+
+
+// ================= MEMBER FUNCTIONS =======================
+// ----------------------------------------------------------------------------
+// CStatisticsContainer::ConstructL
+// 
+// Symbian OS two phased constructor.
+// ----------------------------------------------------------------------------
+//
+void CStatisticsContainer::ConstructL( const TRect& aRect, 
+                                        MEikListBoxObserver* aListBoxObserver )
+    {
+
+    ((CAppUIAppUi*)iCoeEnv->AppUi())->iLogger->Log(
+                            _L("StatisticsContainer: ConstructL"));
+
+    CreateWindowL();
+
+    iUIStore = ( (CAppUIAppUi*)iCoeEnv->AppUi() )->UIStoreHandler();
+
+    //iTestCasesInView.Reset();
+        //((CAppUIAppUi*)iCoeEnv->AppUi())->iLogger->Log(_L("StatisticsContainer: iTCInV Reset"));
+    
+	iListBox = CMenuListBox::NewL(EStatisticsViewId);
+	iListBox->SetContainerWindowL( *this );
+	iListBox->SetListBoxObserver( aListBoxObserver /*this*/ ); // jos peritty MEikListBoxObserver:sta
+    iListBox->ConstructL(this, EAknListBoxMarkableList /*EAknListBoxSelectionList*/);
+
+    ((CAppUIAppUi*)iCoeEnv->AppUi())->iLogger->Log(_L("StatisticsContainer: ListBox constructed"));
+
+    //Create Scroller control for ListBox and set its visibility
+    iListBox->CreateScrollBarFrameL(ETrue);
+    iListBox->ScrollBarFrame()->SetScrollBarVisibilityL(CEikScrollBarFrame::EOff,CEikScrollBarFrame::EAuto);
+
+    if ( iUIStore )
+        {
+        //RRefArray<CStartedTestCase> allStarted;
+        RRefArray<CStartedTestCase> allStarted;
+        TInt ret = iUIStore->StartedTestCases( allStarted );
+        if( KErrNone != ret )
+            {
+            allStarted.Reset();
+            allStarted.Close();
+            User::Leave( ret );
+            }
+        TInt count = allStarted.Count();
+        // TInt notstarted( 0 );
+        TInt ongoing( 0 );
+        TInt passed( 0 );
+        TInt failed( 0 );
+        TInt other( 0 );
+        //TInt aborted( 0 );
+        // TInt paused( 0 );
+        //TInt crashed( 0 );
+        //TInt executed( 0 );
+        // TInt state( 0 );
+
+        for( TInt a = 0; a < count; a++ )
+            {
+            switch ( allStarted[a].Status() )
+                {
+                case CUIStoreIf::EStatusRunning:
+                    {
+                    ongoing++;
+                    break;
+                    }
+                case CUIStoreIf::EStatusExecuted | CUIStoreIf::EStatusPassed:
+                    {
+                    passed++;
+                    break;
+                    }
+                case CUIStoreIf::EStatusExecuted |CUIStoreIf::EStatusFailed:
+                    {
+                    failed++;
+                    break;
+                    }
+                //case CUIStoreIf::EStatusAborted:
+                //    {
+                //    aborted++;
+                //    break;
+                //    }
+                /*case ECrashed:
+                    {
+                    crashed++;
+                    break;
+                    }
+                */
+                /*case EExecuted:
+                    {
+                    executed++;
+                    break;
+                    }
+                */
+                default:
+                    {
+                    other++;
+                    break;
+                    }
+                }
+            }
+
+        allStarted.Reset();
+        allStarted.Close();
+
+        iTestCaseArray = new (ELeave) CDesC16ArrayFlat(6);
+        iTestCaseArray->Reset();
+
+        HBufC* tmpHBuf = HBufC::NewL( 40 );
+        TPtr buffer( tmpHBuf->Des() );
+
+        buffer = ( _L("\t") );
+        buffer.AppendNum( ongoing );
+        buffer.Append( _L(" Running") );
+        iTestCaseArray->AppendL( buffer );
+
+        buffer = ( _L("\t") );
+        buffer.AppendNum( passed );
+        buffer.Append( _L(" Passed") );
+        iTestCaseArray->AppendL( buffer );
+
+        buffer = ( _L("\t") );
+        buffer.AppendNum( failed );
+        buffer.Append( _L(" Failed") );
+        iTestCaseArray->AppendL( buffer );
+
+        buffer = ( _L("\t") );
+        buffer.AppendNum( other );
+        buffer.Append( _L(" Crashed/Aborted") );
+        iTestCaseArray->AppendL( buffer );
+
+        delete tmpHBuf;
+
+        iListBox->Model()->SetItemTextArray( iTestCaseArray );
+             ((CAppUIAppUi*)iCoeEnv->AppUi())->iLogger->Log(_L("StatisticsContainer: ListBox model set"));
+        }
+    else
+        {
+        //User::Leave( syy?? )
+        }
+
+    // Creates graphic.
+    //SetGraphicIconL( iListBox );
+    //   ((CAppUIAppUi*)iCoeEnv->AppUi())->iLogger->Log(_L("StatisticsContainer: icons created"));
+
+    iListBox->ActivateL();
+    ((CMenuListBox*)iListBox)->SetPreviousFocus();
+
+    SetRect(aRect);
+    ActivateL();
+
+    }
+
+// ----------------------------------------------------------------------------
+// CStatisticsContainer::~CStatisticsContainer
+// 
+// Destructor.
+// ----------------------------------------------------------------------------
+//
+CStatisticsContainer::~CStatisticsContainer()
+    {
+    //iTestCasesInView.Close(); // does not delete objects whose pointers are contained in the array
+    //delete iListBox;
+    }
+
+// ----------------------------------------------------------------------------
+// CStatisticsContainer::SizeChanged
+// 
+// Called by framework when the view size is changed.
+// ----------------------------------------------------------------------------
+//
+void CStatisticsContainer::SizeChanged()
+    {
+    if ( iListBox )
+		{
+		iListBox->SetRect( Rect() ); // Sets rectangle of listbox.
+		}
+    }
+
+// ----------------------------------------------------------------------------
+// CStatisticsContainer::CountComponentControls
+// 
+// Gets a count of the component controls of this list box control.
+// ----------------------------------------------------------------------------
+//
+TInt CStatisticsContainer::CountComponentControls() const
+    {
+    return 1; // return nbr of controls inside this container
+    }
+
+// ----------------------------------------------------------------------------
+// CStatisticsContainer::ComponentControl
+// 
+// Gets a pointer to the specified component control.
+// ----------------------------------------------------------------------------
+//
+
+CCoeControl* CStatisticsContainer::ComponentControl(TInt aIndex) const
+    {
+    switch ( aIndex )
+        {
+		case 0: 
+			return iListBox;
+        default:
+            return NULL;
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// CStatisticsContainer::Draw
+// 
+// Draw a control, called by window server.
+// ----------------------------------------------------------------------------
+//
+void CStatisticsContainer::Draw(const TRect& /*aRect*/) const
+    {
+    // CWindowGc& gc = SystemGc();
+    }
+
+// ----------------------------------------------------------------------------
+// CStatisticsContainer::OfferKeyEventL
+// 
+// Handles key events.
+// ----------------------------------------------------------------------------
+//
+TKeyResponse CStatisticsContainer::OfferKeyEventL(
+	const TKeyEvent& aKeyEvent, TEventCode aType)
+    {
+	if (aType != EEventKey)
+	{
+		return EKeyWasNotConsumed;
+	}
+
+	if (iListBox)
+		{
+		return iListBox->OfferKeyEventL( aKeyEvent, aType );
+		}
+	else
+		{
+		return EKeyWasNotConsumed;
+		}
+
+    }
+
+// ----------------------------------------------------------------------------
+// CStatisticsContainer::SaveActiveLine
+//
+// Makes the iListBox member save its focus position
+// ----------------------------------------------------------------------------
+//
+void CStatisticsContainer::SaveActiveLine()
+	{
+	((CMenuListBox*)iListBox)->SaveFocusPosition();
+	}
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/avkon/stifui/src/StatisticsView.cpp	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,350 @@
+/*
+* 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 file contains CStatisticsView class 
+* definition.
+*
+*/
+
+// INCLUDE FILES
+#include  <eikmenub.h>
+#include  <aknViewAppUi.h>
+#include  <aknlistquerydialog.h> 
+#include  <barsread.h>	//TResourceReader
+#include  <Stifui.rsg>
+#include  "AppUIAppUi.h"
+#include  "Stifui.hrh" 
+#include  "StatisticsView.h"
+#include  "StatisticsContainer.h"
+
+// ================= MEMBER FUNCTIONS =======================
+// ----------------------------------------------------------------------------
+// CStatisticsView::ConstructL
+// 
+// Symbian OS two-phased constructor.
+// ----------------------------------------------------------------------------
+//
+void CStatisticsView::ConstructL()
+    {
+    CView::ConstructL();
+    BaseConstructL( R_APPUI_STATISTICSVIEW );
+    iCurrentTestCase = 0;
+    }
+
+// ----------------------------------------------------------------------------
+// CStatisticsView::~CStatisticsView
+// 
+// Destructor.
+// ----------------------------------------------------------------------------
+//
+CStatisticsView::~CStatisticsView()
+    {
+    if ( iContainer )
+        {
+        AppUi()->RemoveFromViewStack( *this, iContainer );
+        delete iContainer;
+        }
+    delete iNaviDecorator;
+    iNaviDecorator = NULL;
+    }
+
+// ----------------------------------------------------------------------------
+// CStatisticsView::Id
+// 
+// Returns view´s id.
+// ----------------------------------------------------------------------------
+//
+TUid CStatisticsView::Id() const
+    {
+    return TUid::Uid(EStatisticsViewId);
+    }
+
+// ----------------------------------------------------------------------------
+// CStatisticsView::HandleCommandL
+// 
+// Handles a command.
+// ----------------------------------------------------------------------------
+//
+void CStatisticsView::HandleCommandL(TInt aCommand)
+    {   
+    if ( aCommand >= ECmdFilterByModule && aCommand < ECmdFilterByTestCaseFile ) // 0x1000 - 0x1FFF
+        {
+        TInt moduleNumber = aCommand - ECmdFilterByModule;
+
+        RRefArray<TDesC> moduleName;
+        TInt ret = ((CAppUIAppUi*)AppUi())->UIStoreHandler()->Modules( moduleName );
+        if( KErrNone != ret )
+            {
+            moduleName.Reset();
+            moduleName.Close();
+            User::Leave( ret );
+            }
+        //iFilterModule = testModules[moduleNumber];
+
+        iContainer->FilterCasesByModuleL( moduleName[moduleNumber] );
+
+        moduleName.Reset();
+        moduleName.Close();
+
+        return;
+        }
+
+    if ( aCommand >= ECmdFilterByTestCaseFile && aCommand < ECmdNOFiltering )
+        {
+        TInt testCaseFileNumber = aCommand - ECmdFilterByTestCaseFile;
+        RRefArray<TDesC> testCaseFileName;
+        TInt ret = ((CAppUIAppUi*)AppUi())->UIStoreHandler()->TestCaseFiles( testCaseFileName );
+        if( KErrNone != ret )
+            {
+            testCaseFileName.Reset();
+            testCaseFileName.Close();
+            User::Leave( ret );
+            }
+
+        iContainer->FilterCasesByTCFileNameL( testCaseFileName[testCaseFileNumber] );
+
+        testCaseFileName.Reset();
+        testCaseFileName.Close();
+
+        return;
+        }
+
+    if ( aCommand == ECmdNOFiltering )
+        {
+        iContainer->NoFilteringL();
+        return;
+        }
+
+    switch ( aCommand )
+        {
+        case ECmdStartCases:
+            {
+            iCurrentTestCase = iContainer->CurrentItemIndex();
+            StartTestCasesL();
+            break;
+            }
+        case EAknSoftkeyBack:
+            {
+            AppUi()->HandleCommandL( EAppUIGoBack );
+            break;
+            }
+        default:
+            {
+            AppUi()->HandleCommandL( aCommand );
+            break;
+            }
+        }
+
+    }
+
+// ----------------------------------------------------------------------------
+// CStatisticsView::HandleClientRectChange
+// 
+// Handles client rect changes.
+// ----------------------------------------------------------------------------
+//
+void CStatisticsView::HandleClientRectChange()
+    {
+    if ( iContainer )
+        {
+        iContainer->SetRect( ClientRect() );
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// CStatisticsView::DoActivateL
+// 
+// Initializes view when activated.
+// ----------------------------------------------------------------------------
+//
+void CStatisticsView::DoActivateL(
+   const TVwsViewId& /*aPrevViewId*/,TUid /*aCustomMessageId*/,
+   const TDesC8& /*aCustomMessage*/)
+    {
+    if (!iContainer)
+        {
+           ((CAppUIAppUi*)AppUi())->iLogger->Log(_L("StatisticsView: DoActivateL"));
+        //message = _L("eng.open ret:");
+        //message.AppendNum( ret , EDecimal );
+        //AppUi()->iLogger->Log( message );
+        iContainer = new (ELeave) CStatisticsContainer;
+        iContainer->SetMopParent(this);
+        iContainer->ConstructL( ClientRect(), this );
+           ((CAppUIAppUi*)AppUi())->iLogger->Log(_L("StatisticsView: container constructed"));
+        AppUi()->AddToStackL( *this, iContainer );
+        }
+    iContainer->SetCurrentItemIndex(iCurrentTestCase);
+	
+	CEikStatusPane* sp=iEikonEnv->AppUiFactory()->StatusPane();
+	CAknNavigationControlContainer* np= (CAknNavigationControlContainer *)sp->ControlL(TUid::Uid(EEikStatusPaneUidNavi));
+	
+	TResourceReader reader;
+	iCoeEnv->CreateResourceReaderLC(reader,R_NAVITITLE_STARTED_STATS);
+	iNaviDecorator = np->CreateNavigationLabelL( reader );
+	CleanupStack::PopAndDestroy(); // resource reader
+	np->PushL(*iNaviDecorator);
+    }
+
+// ----------------------------------------------------------------------------
+// CStatisticsView::DoDeactivate
+// 
+// Deactivates view.
+// ----------------------------------------------------------------------------
+//
+void CStatisticsView::DoDeactivate()
+    {
+    if ( iContainer )
+        {
+        iContainer->SaveActiveLine();
+        AppUi()->RemoveFromViewStack( *this, iContainer );
+        delete iContainer;
+        iContainer = NULL;
+        }
+    delete iNaviDecorator;
+    iNaviDecorator = NULL;
+    }
+
+// ----------------------------------------------------------------------------
+// CStatisticsView::DynInitMenuPaneL
+// 
+// Initializes menu pane.
+// ----------------------------------------------------------------------------
+//
+void CStatisticsView::DynInitMenuPaneL(
+    TInt aResourceId, CEikMenuPane* aMenuPane)
+    {
+
+    // Test modules are added to filter by test module submenu if the submenu is opened
+    if (R_APPUI_FILTERBYMODULES_MENU == aResourceId)
+        {
+        RRefArray<TDesC> modules;
+        TInt ret = ((CAppUIAppUi*)AppUi())->UIStoreHandler()->Modules( modules );
+        if( KErrNone != ret )
+            {
+            modules.Reset();
+            modules.Close();
+            User::Leave( ret );
+            }
+
+        TInt moduleCount = modules.Count();
+        
+        TInt i;
+        CEikMenuPaneItem::SData item;
+
+        item.iCommandId = ECmdFilterByModule;
+        item.iFlags = 0;
+        item.iCascadeId = 0;
+
+        for (i = 0; i < moduleCount; i++)
+            {
+            item.iText = modules[i];
+            aMenuPane->AddMenuItemL(item);
+            item.iCommandId++; // command IDs 0x1000 - 0x1FFF are reserved for modules in hrh file
+            }
+        
+        modules.Reset();
+        modules.Close();
+        }
+
+    // Test case files are added to filter by test case file submenu if the submenu is opened
+    if (R_APPUI_FILTER_BY_TESTCASEFILE_MENU == aResourceId)
+        {
+        RRefArray<TDesC> testCaseFiles;
+        TInt ret = ((CAppUIAppUi*)AppUi())->UIStoreHandler()->TestCaseFiles( testCaseFiles );
+        if( KErrNone != ret )
+            {
+            testCaseFiles.Reset();
+            testCaseFiles.Close();
+            User::Leave( ret );
+            }
+
+        TInt testCaseFileCount = testCaseFiles.Count();
+
+        TInt i;
+        CEikMenuPaneItem::SData item;
+
+        item.iCommandId = ECmdFilterByTestCaseFile;
+        item.iFlags = 0;
+        item.iCascadeId = 0;
+
+        for (i = 0; i < testCaseFileCount; i++)
+            {
+            item.iText = testCaseFiles[i];
+            aMenuPane->AddMenuItemL(item);
+            item.iCommandId++; // command IDs 0x2000 - 0x2FFF are reserved for test case files in hrh file
+            }
+
+        testCaseFiles.Reset();
+        testCaseFiles.Close();
+        }
+
+    }
+
+// ----------------------------------------------------------------------------
+// CStatisticsView::HandleListBoxEventL
+// 
+// Handles a list box event.
+// ----------------------------------------------------------------------------
+//
+void CStatisticsView::HandleListBoxEventL(CEikListBox* /*aListBox*/, TListBoxEvent aEventType)
+	{
+	if ( ( aEventType == EEventEnterKeyPressed ) || ( aEventType == EEventItemDoubleClicked ) )
+		{
+        //iCurrentTestCase = aListBox->CurrentItemIndex();
+        //iCurrentTestCase = iContainer->CurrentItemIndex();
+        //StartTestCases();
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// CStatisticsView::StartTestCases
+// 
+// Starts test case(s) which is selected in containers list box.
+// First shows a list query if user wants just start test case or
+// if he wants to start test case and view test case output.
+// ----------------------------------------------------------------------------
+//
+void CStatisticsView::StartTestCasesL()
+    {
+    TInt selectedItem(0);
+    CAknListQueryDialog* startDialog = new (ELeave) CAknListQueryDialog(&selectedItem);
+    if ( startDialog->ExecuteLD(R_START_TESTCASE_LIST_QUERY) )
+        {
+        RRefArray<CTestInfo> testInfo;
+        TInt ret = ((CAppUIAppUi*)AppUi())->UIStoreHandler()->TestCases( testInfo );
+        if( KErrNone != ret )
+            {
+            testInfo.Reset();
+            testInfo.Close();
+            User::Leave( ret );
+            }
+        TInt testCaseNumber = testInfo[0].TestCaseNum();
+        TInt testCaseIndex( 0 );
+
+        //CUIEngineContainer* container = NULL;
+        ret = ((CAppUIAppUi*)AppUi())->UIStoreHandler()->StartTestCase( testInfo[testCaseNumber], testCaseIndex );
+        if( KErrNone != ret )
+            {
+            User::Leave( ret );
+            }
+        testInfo.Reset();
+        testInfo.Close();
+
+        // Increment the counter value
+        ((CAppUIAppUi*)AppUi())->iUIStoreHandler->iExecutedTestCaseCount++;
+
+        }
+
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/avkon/stifui/src/TestCaseMenuContainer.cpp	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,224 @@
+/*
+* 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 file contains CTestCaseMenuContainer class
+* definition.
+*
+*/
+
+// INCLUDE FILES
+#include "TestCaseMenuContainer.h"
+#include "Stifui.hrh"
+#include <Stifui.rsg>
+
+#include <aknlists.h>  //ListBox
+#include <barsread.h> // for TResourceReader
+
+#include <aknnotewrappers.h>
+
+#include "MenuListBox.h"
+
+
+// ================= MEMBER FUNCTIONS =======================
+// ----------------------------------------------------------------------------
+// CTestCaseMenuContainer::ConstructL
+// 
+// Symbian OS two phased constructor.
+// ----------------------------------------------------------------------------
+//
+void CTestCaseMenuContainer::ConstructL(const TRect& aRect)
+    {
+    CreateWindowL();
+     
+	iListBox = CMenuListBox::NewL(ETestCaseMenuViewId);
+	iListBox->SetContainerWindowL( *this );
+	TResourceReader reader;
+	iCoeEnv->CreateResourceReaderLC( reader, R_TESTCASE_MENU_LISTBOX );
+	iListBox->SetListBoxObserver( this );
+	iListBox->ConstructFromResourceL( reader );
+	CleanupStack::PopAndDestroy(); // resource stuffs. 
+
+    // Create Scroller control for ListBox and set its visibility
+    // !!! Not needed yet because there are only two items in list box.
+    // If items are added later, scroller may be taken to use
+    //iListBox->CreateScrollBarFrameL(ETrue);
+    //iListBox->ScrollBarFrame()->SetScrollBarVisibilityL(CEikScrollBarFrame::EOff,CEikScrollBarFrame::EAuto);
+    
+    iListBox->ActivateL();
+    ((CMenuListBox*)iListBox)->SetPreviousFocus();
+    
+    SetRect(aRect);
+    ActivateL();
+    }
+
+// Destructor
+CTestCaseMenuContainer::~CTestCaseMenuContainer()
+    {
+    if ( iListBox )
+		{
+		iListBox->Reset();
+    	delete iListBox;
+    	}	
+    }
+
+// ----------------------------------------------------------------------------
+// CTestCaseMenuContainer::SizeChanged
+// 
+// Called by framework when the view size is changed.
+// ----------------------------------------------------------------------------
+//
+void CTestCaseMenuContainer::SizeChanged()
+    {
+    if ( iListBox )
+		{
+		iListBox->SetRect( Rect() ); // Sets rectangle of listbox.
+		}
+    }
+
+// ----------------------------------------------------------------------------
+// CTestCaseMenuContainer::CountComponentControls
+// 
+// Gets a count of the component controls of this list box control.
+// ----------------------------------------------------------------------------
+//
+TInt CTestCaseMenuContainer::CountComponentControls() const
+    {
+    return 1; // return nbr of controls inside this container
+    }
+
+// ----------------------------------------------------------------------------
+// CTestCaseMenuContainer::ComponentControl
+// 
+// Gets a pointer to the specified component control.
+// ----------------------------------------------------------------------------
+//
+CCoeControl* CTestCaseMenuContainer::ComponentControl(TInt aIndex) const
+    {
+    switch ( aIndex )
+        {
+		case 0: 
+			return iListBox;
+        default:
+            return NULL;
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// CTestCaseMenuContainer::Draw
+// 
+// Draw a control, called by window server.
+// ----------------------------------------------------------------------------
+//
+void CTestCaseMenuContainer::Draw(const TRect& /*aRect*/) const
+    {
+    // CWindowGc& gc = SystemGc();
+    }
+
+
+// ----------------------------------------------------------------------------
+// CTestCaseMenuContainer::HandleListBoxEventL
+// 
+// Handles list box events.
+// ----------------------------------------------------------------------------
+//
+void CTestCaseMenuContainer::HandleListBoxEventL(CEikListBox* aListBox, TListBoxEvent aEventType)
+	{
+	if ( ( aEventType == EEventEnterKeyPressed ) || ( aEventType == EEventItemDoubleClicked ) )
+		{
+		    HandleSelectedListItemL( aListBox->CurrentItemIndex() );
+
+		}	
+
+	}
+	
+// ----------------------------------------------------------------------------
+// CTestCaseMenuContainer::HandleSelectedListItemL
+// 
+// Method HandleSelectedListItemL handles valid index.
+// ----------------------------------------------------------------------------
+//
+void CTestCaseMenuContainer::HandleSelectedListItemL( TInt aIndex )
+	{	 
+		TInt selection = aIndex;
+
+	    switch ( selection )
+			{
+		    case 0:
+				//Vaihda StartCasesView aktiiviseksi
+				( (CEikAppUi*)iCoeEnv->AppUi() )->HandleCommandL(ECmdGoToStartCasesView);
+				break;
+			case 1:
+				( (CEikAppUi*)iCoeEnv->AppUi() )->HandleCommandL(ECmdGoToStartedCasesView);
+				break;
+	        default:
+				break;
+			}
+	}	
+
+// ----------------------------------------------------------------------------
+// CTestCaseMenuContainer::OfferKeyEventL
+// 
+// Handles key events.
+// ----------------------------------------------------------------------------
+//
+TKeyResponse CTestCaseMenuContainer::OfferKeyEventL(
+	const TKeyEvent& aKeyEvent, TEventCode aType)
+    {
+	if (aType != EEventKey)
+    	{
+		return EKeyWasNotConsumed;
+	    }
+
+    switch ( aKeyEvent.iCode )
+        {
+        case EKeyLeftArrow:
+        case EKeyRightArrow:
+			{   /* Left ja right key eventit valitetaan AppUille joka hoitaa siirtymisen toisiin nakymiin */
+			return EKeyWasNotConsumed;
+            //break;
+            }
+        default:
+			{
+			//Muut Key eventit valitetaan listboxille, joka hoitaa ne
+			if (iListBox)
+				{
+				return iListBox->OfferKeyEventL( aKeyEvent, aType );
+				}
+			}
+        }     
+    return EKeyWasNotConsumed;        
+}
+
+// ----------------------------------------------------------------------------
+// CTestCaseMenuContainer::GetActiveLine
+// 
+// Get currently selected items index.
+// ----------------------------------------------------------------------------
+//
+TInt CTestCaseMenuContainer::GetActiveLine()
+	{
+	return iListBox->CurrentItemIndex();
+	}
+
+// ----------------------------------------------------------------------------
+// CTestCaseMenuContainer::SaveActiveLine
+//
+// Makes the iListBox member save its focus position
+// ----------------------------------------------------------------------------
+//
+void CTestCaseMenuContainer::SaveActiveLine()
+	{
+	((CMenuListBox*)iListBox)->SaveFocusPosition();
+	}
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/avkon/stifui/src/TestCaseMenuView.cpp	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,165 @@
+/*
+* 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 file contains CTestCaseMenuView class
+* definition.
+*
+*/
+
+// INCLUDE FILES
+#include  <aknViewAppUi.h>
+#include  <barsread.h>	//TResourceReader
+#include  <Stifui.rsg>
+#include  "TestCaseMenuView.h"
+#include  "TestCaseMenuContainer.h"
+#include  "Stifui.hrh" 
+#include  "AppUIAppUi.h" // loggerin kayttoa varten, muuten ei tarvittaisi
+
+// ================= MEMBER FUNCTIONS =======================
+// ----------------------------------------------------------------------------
+// CTestCaseMenuView::ConstructL
+// 
+// Symbian OS two phased constructor.
+// ----------------------------------------------------------------------------
+//
+void CTestCaseMenuView::ConstructL()
+    {
+    CView::ConstructL();
+    BaseConstructL( R_APPUI_TESTCASEMENUVIEW );
+    }
+
+// ----------------------------------------------------------------------------
+// CTestCaseMenuView::~CTestCaseMenuView
+// 
+// Destructor.
+// ----------------------------------------------------------------------------
+//
+CTestCaseMenuView::~CTestCaseMenuView()
+    {
+    if ( iContainer )
+        {
+        AppUi()->RemoveFromViewStack( *this, iContainer );
+        delete iContainer;
+        iContainer = NULL;
+        }
+    delete iNaviDecorator;
+    iNaviDecorator = NULL;
+    }
+
+// ----------------------------------------------------------------------------
+// CTestCaseMenuView::Id
+// 
+// Returns view´s id.
+// ----------------------------------------------------------------------------
+//
+TUid CTestCaseMenuView::Id() const
+    {
+    return TUid::Uid(ETestCaseMenuViewId); //KTestCaseMenuViewId;
+    }
+
+// ----------------------------------------------------------------------------
+// CTestCaseMenuView::HandleCommandL
+// 
+// Handles a command.
+// ----------------------------------------------------------------------------
+//
+void CTestCaseMenuView::HandleCommandL(TInt aCommand)
+    {   
+    switch ( aCommand )
+        {
+        case EAknSoftkeyBack:
+            {
+            AppUi()->HandleCommandL(EAppUIGoBack);
+            break;
+            }
+		case EAknCmdOpen:
+			{
+			TInt a = iContainer->GetActiveLine();
+			iContainer->HandleSelectedListItemL( a );
+			}
+			break;             
+        default:
+            {
+            AppUi()->HandleCommandL( aCommand );
+            break;
+            }
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// CTestCaseMenuView::HandleClientRectChange
+// 
+// Handles client rect changes.
+// ----------------------------------------------------------------------------
+//
+void CTestCaseMenuView::HandleClientRectChange()
+    {
+    if ( iContainer )
+        {
+        iContainer->SetRect( ClientRect() );
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// CTestCaseMenuView::DoActivateL
+// 
+// Initializes view when activated.
+// ----------------------------------------------------------------------------
+//
+void CTestCaseMenuView::DoActivateL(
+   const TVwsViewId& /*aPrevViewId*/,TUid /*aCustomMessageId*/,
+   const TDesC8& /*aCustomMessage*/)
+    {
+    if (!iContainer)
+        {
+        ((CAppUIAppUi*)AppUi())->iLogger->Log(_L("TestCaseMenu: DoActivateL"));
+        //message = _L("eng.open ret:");
+        //message.AppendNum( ret , EDecimal );
+        //AppUi->iLogger->Log( message );
+        iContainer = new (ELeave) CTestCaseMenuContainer;
+        iContainer->SetMopParent(this);
+        iContainer->ConstructL( ClientRect() );
+        ((CAppUIAppUi*)AppUi())->iLogger->Log(_L("TestCaseMenu: container constructed"));
+        AppUi()->AddToStackL( *this, iContainer );
+        } 
+    
+    CEikStatusPane* sp=iEikonEnv->AppUiFactory()->StatusPane();
+	CAknNavigationControlContainer* np= (CAknNavigationControlContainer *)sp->ControlL(TUid::Uid(EEikStatusPaneUidNavi));
+	
+	TResourceReader reader;
+	iCoeEnv->CreateResourceReaderLC(reader,R_NAVITITLE_TESTCASES);
+	iNaviDecorator = np->CreateNavigationLabelL( reader );
+	CleanupStack::PopAndDestroy(); // resource reader
+	np->PushL(*iNaviDecorator);
+   }
+
+// ----------------------------------------------------------------------------
+// CTestCaseMenuView::DoDeactivate
+// 
+// Deactivates view.
+// ----------------------------------------------------------------------------
+//
+void CTestCaseMenuView::DoDeactivate()
+    {
+    if ( iContainer )
+        {
+        iContainer->SaveActiveLine();
+        AppUi()->RemoveFromViewStack( *this, iContainer );
+        delete iContainer;
+        iContainer = NULL;         
+        }  
+    delete iNaviDecorator;
+    iNaviDecorator = NULL;      
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/avkon/stifui/src/TestCaseOutputContainer.cpp	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,328 @@
+/*
+* 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 file contains CTestCaseOutputContainer class
+* definition.
+*
+*/
+
+// INCLUDE FILES
+#include "TestCaseOutputContainer.h"
+#include <Stifui.rsg>
+#include "Stifui.hrh"
+#include "AppUIAppUi.h"
+
+#include <aknlists.h>  // ListBox
+#include <AknIconArray.h>  // CAknIconArray
+#include <badesca.h> // CDesCArray
+#include <eikclbd.h> // CColumnListBoxData
+#include <aknnotewrappers.h>
+
+//#include "UIStoreIf.h"         
+//#include "UIStore.h"            
+//#include "UIEngine.h"           
+//#include "UIEngineContainer.h"  
+
+#include <stifinternal/UIStoreIf.h>
+#include <stifinternal/UIStore.h>
+#include <stifinternal/UIEngine.h>
+#include <stifinternal/UIEngineContainer.h>
+
+#include "MenuListBox.h"
+
+//#include <gdi.h>
+
+
+// ================= MEMBER FUNCTIONS =======================
+// ----------------------------------------------------------------------------
+// CTestCaseOutputContainer::ConstructL
+// 
+// Symbian OS two phased constructor.
+// ----------------------------------------------------------------------------
+//
+void CTestCaseOutputContainer::ConstructL(const TRect& aRect, CStartedTestCase* aStartedTestCase ) //TInt aExecutedTestCaseCount )
+    {
+    CreateWindowL();
+
+    iUIStore = ( (CAppUIAppUi*)iCoeEnv->AppUi() )->UIStoreHandler();
+    
+	iListBox = CMenuListBox::NewL(ETestCaseOutputViewId);
+	iListBox->SetContainerWindowL( *this );
+	iListBox->SetListBoxObserver( this );
+    iListBox->ConstructL(this, EAknListBoxSelectionList);
+
+    //Create Scroller control for ListBox and set its visibility
+    iListBox->CreateScrollBarFrameL(ETrue);
+    iListBox->ScrollBarFrame()->SetScrollBarVisibilityL(CEikScrollBarFrame::EOff,CEikScrollBarFrame::EAuto);
+    
+    if( iUIStore )
+        {
+        iListBoxModel = CTestOutputListBoxModel::NewL( aStartedTestCase );
+        iListBox->Model()->SetItemTextArray( iListBoxModel );
+        }
+    else
+        {
+        //User::Leave( syy?? )
+        }
+	iListBox->ActivateL();
+	((CMenuListBox*)iListBox)->SetPreviousFocus();
+
+    SetRect(aRect);
+    ActivateL();
+
+    }
+
+// ----------------------------------------------------------------------------
+// CTestCaseOutputContainer::~CTestCaseOutputContainer
+// 
+// Destructor.
+// ----------------------------------------------------------------------------
+//
+CTestCaseOutputContainer::~CTestCaseOutputContainer()
+    {
+    // Discard and destroy the font
+    //CWindowGc* listBoxGc = iListBox->View()->ItemDrawer()->Gc();
+    //listBoxGc->DiscardFont();
+
+    //CWindowGc& gc = SystemGc();
+    //gc.DiscardFont();
+    
+    //iCoeEnv->ScreenDevice()->ReleaseFont(iListBoxFont);
+
+    delete iListBox;
+    }
+
+// ----------------------------------------------------------------------------
+// CTestCaseOutputContainer::SizeChanged
+// 
+// Called by framework when the view size is changed.
+// ----------------------------------------------------------------------------
+//
+void CTestCaseOutputContainer::SizeChanged()
+    {
+    if ( iListBox )
+		{
+		iListBox->SetRect( Rect() ); // Sets rectangle of listbox.
+		}
+    }
+
+// ----------------------------------------------------------------------------
+// CTestCaseOutputContainer::CountComponentControls
+// 
+// Gets a count of the component controls of this list box control.
+// ----------------------------------------------------------------------------
+//
+TInt CTestCaseOutputContainer::CountComponentControls() const
+    {
+    return 1; // return nbr of controls inside this container
+    }
+
+// ----------------------------------------------------------------------------
+// CTestCaseOutputContainer::ComponentControl
+// 
+// Gets a pointer to the specified component control.
+// ----------------------------------------------------------------------------
+//
+CCoeControl* CTestCaseOutputContainer::ComponentControl(TInt aIndex) const
+    {
+    switch ( aIndex )
+        {
+		case 0: 
+			return iListBox;
+        default:
+            return NULL;
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// CTestCaseOutputContainer::Draw
+// 
+// Draw a control, called by window server.
+// ----------------------------------------------------------------------------
+//
+void CTestCaseOutputContainer::Draw(const TRect& /*aRect*/) const
+    {
+    // CWindowGc& gc = SystemGc();
+    }
+
+// ----------------------------------------------------------------------------
+// CTestCaseOutputContainer::HandleListBoxEventL
+// 
+// Handles list box events.
+// ----------------------------------------------------------------------------
+//
+void CTestCaseOutputContainer::HandleListBoxEventL(CEikListBox* /*aListBox*/, TListBoxEvent aEventType)
+	{
+	if ( ( aEventType == EEventEnterKeyPressed ) || ( aEventType == EEventItemDoubleClicked ) )
+		{
+        //TBuf<200> outputLine;
+        //CAknNoteDialog* outputLineNote = new (ELeave) CAknNoteDialog;
+        //outputLineNote->SetTextL( iListBoxModel->MdcaPoint(iListBox->CurrentItemIndex()) );
+        //outputLineNote->RunDlgLD();
+
+
+
+        //CAknInformationNote* informationNote = new (ELeave) CAknInformationNote;
+        //informationNote->SetTextL( iListBoxModel->MdcaPoint(iListBox->CurrentItemIndex()) );
+		//informationNote->SetTextPluralityL( ETrue );
+        //informationNote->SetTextL( _L("Number of cases: %d") );
+        //informationNote->SetTextNumberL( count );
+        //informationNote->ExecuteLD();
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// CTestCaseOutputContainer::OfferKeyEventL
+// 
+// Handles key events.
+// ----------------------------------------------------------------------------
+//
+TKeyResponse CTestCaseOutputContainer::OfferKeyEventL(
+	const TKeyEvent& aKeyEvent, TEventCode aType)
+{
+	if (aType != EEventKey)
+	{
+		return EKeyWasNotConsumed;
+	}
+
+	if (iListBox)
+		{
+		return iListBox->OfferKeyEventL( aKeyEvent, aType );
+		}
+	else
+		{
+		return EKeyWasNotConsumed;
+		}
+
+    /*
+    switch ( aKeyEvent.iCode )
+        {
+        case EKeyLeftArrow:
+        case EKeyRightArrow:
+			{ */  /* Left ja right key eventit valitetaan AppUille joka hoitaa siirtymisen toisiin nakymiin */
+    /*			return EKeyWasNotConsumed;
+            break;
+            }
+        default:
+			{
+			//Muut Key eventit valitetaan listboxille, joka hoitaa ne
+			if (iListBox)
+				{
+				return iListBox->OfferKeyEventL( aKeyEvent, aType );
+				}
+			else
+				{
+				return EKeyWasNotConsumed;
+				}
+            break;
+			}
+        }*/
+}
+
+// ----------------------------------------------------------------------------
+// CTestCaseOutputContainer::OutputUpdateL
+// 
+// Handles addition of item to list box.
+// ----------------------------------------------------------------------------
+//
+void CTestCaseOutputContainer::OutputUpdateL()
+    {
+    if ( iListBox )
+        {
+        iListBox->HandleItemAdditionL();
+        iListBox->DrawNow();
+        }
+    }
+
+
+// ================= MEMBER FUNCTIONS =======================
+
+// ----------------------------------------------------------------------------
+// CTestOutputListBoxModel::NewL
+// 
+// Two-phased constructor.
+// ----------------------------------------------------------------------------
+//
+CTestOutputListBoxModel* CTestOutputListBoxModel::NewL(CStartedTestCase* aStartedTestCase /*, HBufC* aBuffer*/)
+    {
+
+    CTestOutputListBoxModel* self = new ( ELeave ) CTestOutputListBoxModel();
+    CleanupStack::PushL( self );
+    //self->ConstructL();
+    //self->iBuffer = aBuffer;
+    self->iBuffer = HBufC::NewL( 150 );
+    self->iStartedTestCase = aStartedTestCase;
+    CleanupStack::Pop();
+    return self;
+
+    }
+
+// ----------------------------------------------------------------------------
+// CTestOutputListBoxModel::ConstructL
+// 
+// Symbian OS two phased constructor.
+// Completes the construction of the object.
+// ----------------------------------------------------------------------------
+//
+void CTestOutputListBoxModel::ConstructL()
+    {
+    //iBuffer = HBufC::NewLC( KMaxInfoName + KMaxName + 2 );
+    }
+
+// ----------------------------------------------------------------------------
+// CTestOutputListBoxModel::~CTestCaseOutputContainer
+// 
+// Destructor.
+// ----------------------------------------------------------------------------
+//
+CTestOutputListBoxModel::~CTestOutputListBoxModel()
+    {
+    delete iBuffer;
+    }
+
+// ----------------------------------------------------------------------------
+// CTestOutputListBoxModel::MdcaCount
+// 
+// Returns the number of descriptor elements in the array.
+// ----------------------------------------------------------------------------
+//
+TInt CTestOutputListBoxModel::MdcaCount() const
+    {
+
+    TInt rows = iStartedTestCase->PrintArray().Count();
+    return rows;
+
+    }
+
+// ----------------------------------------------------------------------------
+// CTestOutputListBoxModel::MdcaPoint
+// 
+// Indexes into a descriptor array.
+// ----------------------------------------------------------------------------
+//
+TPtrC CTestOutputListBoxModel::MdcaPoint(TInt aIndex) const
+    {
+    const RPointerArray<CTestProgress> printArray = iStartedTestCase->PrintArray();
+
+    TPtr buffer( iBuffer->Des() );
+    buffer.Zero();
+    buffer.Append(_L("\t"));
+    buffer.Append(printArray[aIndex]->iDescription);
+    buffer.Append(_L(" "));
+    buffer.Append(printArray[aIndex]->iText);
+    
+    return *iBuffer;
+
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/avkon/stifui/src/TestCaseOutputView.cpp	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,380 @@
+/*
+* 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 file contains CTestCaseOutputView class 
+* definition.
+*
+*/
+
+// INCLUDE FILES
+#include  <eikmenub.h>
+#include  <aknViewAppUi.h>
+#include  <akntitle.h>
+#include  <barsread.h>	//TResourceReader
+#include  <Stifui.rsg>
+
+//#include "UIStoreIf.h"         
+//#include "UIStore.h"            
+//#include "UIEngine.h"           
+//#include "UIEngineContainer.h"  
+
+#include <stifinternal/UIStoreIf.h>
+#include <stifinternal/UIStore.h>
+#include <stifinternal/UIEngine.h>
+#include <stifinternal/UIEngineContainer.h>
+
+#include  "TestCaseOutputView.h"
+#include  "TestCaseOutputContainer.h"
+#include  "AppUIAppUi.h"
+#include  "Stifui.hrh" 
+
+// ================= MEMBER FUNCTIONS =======================
+// ----------------------------------------------------------------------------
+// CTestCaseOutputView::ConstructL
+// 
+// Symbian OS two-phased constructor.
+// ----------------------------------------------------------------------------
+//
+void CTestCaseOutputView::ConstructL()
+    {
+    CView::ConstructL();
+    BaseConstructL( R_APPUI_TESTCASEOUTPUTVIEW );
+    }
+
+// ----------------------------------------------------------------------------
+// CTestCaseOutputView::~CTestCaseOutputView
+// 
+// Destructor.
+// ----------------------------------------------------------------------------
+//
+CTestCaseOutputView::~CTestCaseOutputView()
+    {
+    if ( iContainer )
+        {
+        AppUi()->RemoveFromViewStack( *this, iContainer );
+        delete iContainer;
+        }
+    delete iNaviDecorator;
+    iNaviDecorator = NULL;
+    
+    iCurrentTestCase = NULL;
+    }
+
+// ----------------------------------------------------------------------------
+// CTestCaseOutputView::Id
+// 
+// Returns view´s id.
+// ----------------------------------------------------------------------------
+//
+TUid CTestCaseOutputView::Id() const
+    {
+    return TUid::Uid(ETestCaseOutputViewId);
+    }
+
+// ----------------------------------------------------------------------------
+// CTestCaseOutputView::HandleCommandL
+// 
+// Handles a command.
+// ----------------------------------------------------------------------------
+//
+void CTestCaseOutputView::HandleCommandL(TInt aCommand)
+    {   
+    switch ( aCommand )
+        {
+        case EAknSoftkeyBack:
+            {
+            AppUi()->HandleCommandL(EAppUIGoBack);
+            break;
+            }
+        case ECmdPauseTestCase:
+            {
+            /*
+            TInt index( 0 );
+			index = ( ( CAppUIAppUi* )AppUi() )->GetTestCaseIndex();
+             CStartedTestCase* startedTestCase = NULL;
+             TRAPD( ret, startedTestCase = &iUIStore->StartedTestCaseL( index ) );
+             if( ret != KErrNone )
+                 {
+                 // Leave
+                 }
+            */
+            CStartedTestCase* startedTestCase = 
+                ( ( CAppUIAppUi* )AppUi() )->GetStartedTestCase();
+            startedTestCase->UIEngineContainer().PauseTest(); 
+            break;
+            }
+        case ECmdResumeTestCase:
+            {
+            /*
+            TInt index( 0 );
+			index = ( ( CAppUIAppUi* )AppUi() )->GetTestCaseIndex();
+             CStartedTestCase* startedTestCase = NULL;
+             TRAPD( ret, startedTestCase = &iUIStore->StartedTestCaseL( index ) );
+             if( ret != KErrNone )
+                 {
+                 // Leave
+                 }
+            */
+            CStartedTestCase* startedTestCase = 
+                ( ( CAppUIAppUi* )AppUi() )->GetStartedTestCase();
+            startedTestCase->UIEngineContainer().ResumeTest();            
+            break;
+            }
+        case ECmdAbortTestCase:
+            {
+            /*
+            TInt index( 0 );
+			index = ( ( CAppUIAppUi* )AppUi() )->GetTestCaseIndex();
+             CStartedTestCase* startedTestCase = NULL;
+             TRAPD( ret, startedTestCase = &iUIStore->StartedTestCaseL( index ) );
+             if( ret != KErrNone )
+                 {
+                 // Leave
+                 }
+            */
+            CStartedTestCase* startedTestCase = 
+                ( ( CAppUIAppUi* )AppUi() )->GetStartedTestCase();
+            startedTestCase->UIEngineContainer().CancelTest();             
+            break;
+            }
+        default:
+            {
+            AppUi()->HandleCommandL( aCommand );
+            break;
+            }
+        }
+
+    }
+
+// ----------------------------------------------------------------------------
+// CTestCaseOutputView::HandleClientRectChange
+// 
+// Handles client rect changes.
+// ----------------------------------------------------------------------------
+//
+void CTestCaseOutputView::HandleClientRectChange()
+    {
+    if ( iContainer )
+        {
+        iContainer->SetRect( ClientRect() );
+        }
+
+    }
+
+// ----------------------------------------------------------------------------
+// CTestCaseOutputView::DoActivateL
+// 
+// Initializes view when activated.
+// ----------------------------------------------------------------------------
+//
+void CTestCaseOutputView::DoActivateL(
+   const TVwsViewId& /*aPrevViewId*/,TUid /*aCustomMessageId*/,
+   const TDesC8& /*aCustomMessage*/)
+    {
+    if (!iContainer)
+        {
+        iContainer = new (ELeave) CTestCaseOutputContainer;
+        iContainer->SetMopParent(this);
+
+        iCurrentTestCase = ( ( CAppUIAppUi* )AppUi() )->GetStartedTestCase();
+        iContainer->ConstructL( ClientRect(), iCurrentTestCase );
+        
+        AppUi()->AddToStackL( *this, iContainer );
+        }
+    PrintTestCaseStateL();
+	
+	CEikStatusPane* sp=iEikonEnv->AppUiFactory()->StatusPane();
+	CAknNavigationControlContainer* np= (CAknNavigationControlContainer *)sp->ControlL(TUid::Uid(EEikStatusPaneUidNavi));
+	
+	TResourceReader reader;
+	iCoeEnv->CreateResourceReaderLC(reader,R_NAVITITLE_TESTCASE_OUTPUT);
+	iNaviDecorator = np->CreateNavigationLabelL( reader );
+	CleanupStack::PopAndDestroy(); // resource reader
+	np->PushL(*iNaviDecorator);
+	
+    }
+
+// ----------------------------------------------------------------------------
+// CTestCaseOutputView::DoDeactivate
+// 
+// Deactivates view.
+// ----------------------------------------------------------------------------
+//
+void CTestCaseOutputView::DoDeactivate()
+    {
+    if ( iContainer )
+        {
+        AppUi()->RemoveFromViewStack( *this, iContainer );
+        delete iContainer;
+        iContainer = NULL;
+        }
+    
+    CEikStatusPane* sp=iEikonEnv->AppUiFactory()->StatusPane();
+    // Because DoDeactivate method can't leave we must 
+    // catch unexpected leaves.
+	TInt ret = KErrNone;
+    TRAP( ret,
+    CAknTitlePane* tp=(CAknTitlePane*)sp->ControlL(TUid::Uid(EEikStatusPaneUidTitle));
+    if ( tp != NULL )
+    	{
+    	tp->SetTextToDefaultL(); // Set application name.
+    	}
+    ); // TRAPD end
+    
+    delete iNaviDecorator;
+    iNaviDecorator = NULL;
+    
+    iCurrentTestCase = NULL;
+
+    }
+
+// ----------------------------------------------------------------------------
+// CTestCaseOutputView::DynInitMenuPaneL
+// 
+// Initializes menu pane.
+// ----------------------------------------------------------------------------
+//
+void CTestCaseOutputView::DynInitMenuPaneL(
+    TInt aResourceId, CEikMenuPane* aMenuPane)
+    {
+    CStartedTestCase* startedTestCase = 
+        ( ( CAppUIAppUi* )AppUi() )->GetStartedTestCase();
+
+    if (R_APPUI_TESTCASEOUTPUTVIEW_MENU == aResourceId)
+        {
+  
+        if ( startedTestCase->Status() == CUIStoreIf::EStatusRunning )
+            {
+            if( startedTestCase->UIEngineContainer().State() == CUIEngineContainer::ENotStarted )
+                {
+                aMenuPane->SetItemDimmed( ECmdPauseTestCase, ETrue );
+                aMenuPane->SetItemDimmed( ECmdResumeTestCase, ETrue );
+                aMenuPane->SetItemDimmed( ECmdAbortTestCase, ETrue );
+                }
+            else if( startedTestCase->UIEngineContainer().State() == CUIEngineContainer::ERunning )
+                {
+                aMenuPane->SetItemDimmed( ECmdResumeTestCase, ETrue );
+                aMenuPane->SetItemDimmed( ECmdPauseTestCase, EFalse );
+                }
+            else if( startedTestCase->UIEngineContainer().State() == CUIEngineContainer::EPaused )
+                {
+                aMenuPane->SetItemDimmed( ECmdPauseTestCase, ETrue );
+                aMenuPane->SetItemDimmed( ECmdResumeTestCase, EFalse );
+                }
+            else if( startedTestCase->UIEngineContainer().State() == CUIEngineContainer::EExecuted )
+                {
+                aMenuPane->SetItemDimmed( ECmdPauseTestCase, ETrue );
+                aMenuPane->SetItemDimmed( ECmdResumeTestCase, ETrue );
+                aMenuPane->SetItemDimmed( ECmdAbortTestCase, ETrue );
+                }
+            else if( startedTestCase->UIEngineContainer().State() == CUIEngineContainer::EFinished )
+                {
+                aMenuPane->SetItemDimmed( ECmdPauseTestCase, ETrue );
+                aMenuPane->SetItemDimmed( ECmdResumeTestCase, ETrue );
+                aMenuPane->SetItemDimmed( ECmdAbortTestCase, ETrue );
+                }
+                                                                                     
+            }
+		else
+            {
+            aMenuPane->SetItemDimmed( ECmdPauseTestCase, ETrue );
+            aMenuPane->SetItemDimmed( ECmdResumeTestCase, ETrue );
+            aMenuPane->SetItemDimmed( ECmdAbortTestCase, ETrue );
+            }
+        }
+        
+    }
+
+// ----------------------------------------------------------------------------
+// CTestCaseOutputView::OutputUpdate
+// 
+// Receives output update notification from AppUI.
+// ----------------------------------------------------------------------------
+//
+void CTestCaseOutputView::OutputUpdateL( CStartedTestCase* /*aTestCase*/ )
+    {
+    PrintTestCaseStateL();
+    iContainer->OutputUpdateL();
+
+    }
+
+// ----------------------------------------------------------------------------
+// CTestCaseOutputView::TestCaseStateChangedL
+// 
+// Receives test case state changed notification from AppUI.
+// ----------------------------------------------------------------------------
+//
+void CTestCaseOutputView::TestCaseStateChangedL()
+    {
+    PrintTestCaseStateL();
+    iContainer->OutputUpdateL();
+
+    }
+
+// ----------------------------------------------------------------------------
+// CTestCaseOutputView::PrintTestCaseState
+// 
+// Prints test case state to title pane.
+// ----------------------------------------------------------------------------
+//
+void CTestCaseOutputView::PrintTestCaseStateL()
+    {
+    TBuf<50> statusMessage;
+    CEikStatusPane* sp=iEikonEnv->AppUiFactory()->StatusPane();
+    CAknTitlePane* tp=(CAknTitlePane*)sp->ControlL(TUid::Uid(EEikStatusPaneUidTitle));
+
+    if ( iCurrentTestCase != NULL )
+        {
+        TUint status = iCurrentTestCase->Status();
+
+        if( status & CUIStoreIf::EStatusRunning )
+            {
+            CEikonEnv::Static()->ReadResource( statusMessage,
+                R_TESTCASE_STATE_RUNNING );
+            }
+        else if( status & CUIStoreIf::EStatusExecuted && 
+                            status & CUIStoreIf::EStatusPassed )
+            {
+            CEikonEnv::Static()->ReadResource( statusMessage, 
+                R_TESTCASE_STATE_PASSED );
+            }
+        else if( status & CUIStoreIf::EStatusExecuted && 
+                            status & CUIStoreIf::EStatusFailed )
+            {
+            CEikonEnv::Static()->ReadResource( statusMessage, 
+                R_TESTCASE_STATE_FAILED );
+            }
+        else if( status & CUIStoreIf::EStatusAborted )
+            {
+            CEikonEnv::Static()->ReadResource( statusMessage, 
+                R_TESTCASE_STATE_CRASHED_ABORTED );
+            }
+        else if( status & CUIStoreIf::EStatusCrashed )
+            {
+            CEikonEnv::Static()->ReadResource( statusMessage, 
+                R_TESTCASE_STATE_CRASHED_ABORTED );
+            }
+        else
+            {
+            CEikonEnv::Static()->ReadResource( statusMessage, 
+                R_TESTCASE_STATE_UNKNOWN );
+            }
+        
+        tp->SetTextL( statusMessage );
+        tp->DrawNow();
+
+        }
+
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/avkon/stifui/src/TestModulesMenuContainer.cpp	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,310 @@
+/*
+* 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 file contains CTestModulesListBoxModel class
+* definition.
+*
+*/
+
+// INCLUDE FILES
+#include <aknlists.h>  // ListBox
+#include <barsread.h> // for TResourceReader
+#include <aknnotewrappers.h>
+
+#include "Stifui.hrh"
+#include <Stifui.rsg>
+
+//#include "UIStoreIf.h"         
+//#include "UIStore.h"            
+//#include "UIEngine.h"           
+//#include "UIEngineContainer.h"  
+
+#include <stifinternal/UIStoreIf.h>
+#include <stifinternal/UIStore.h>
+#include <stifinternal/UIEngine.h>
+#include <stifinternal/UIEngineContainer.h>
+
+#include "TestModulesMenuContainer.h"
+#include "AppUIAppUi.h"
+
+#include "MenuListBox.h"
+
+// ================= MEMBER FUNCTIONS =======================
+// ----------------------------------------------------------------------------
+// CTestModulesListBoxModel::NewL
+// 
+// Two-phased constructor.
+// ----------------------------------------------------------------------------
+//
+CTestModulesListBoxModel* CTestModulesListBoxModel::NewL(RRefArray<TDesC> aTestModules)
+    {
+
+    CTestModulesListBoxModel* self = new ( ELeave ) CTestModulesListBoxModel();
+    CleanupStack::PushL( self );
+    self->iBuffer = HBufC::NewL( 130 );
+    self->iTestModules = aTestModules;
+    CleanupStack::Pop();
+    return self;
+
+    }
+
+// ----------------------------------------------------------------------------
+// CTestModulesListBoxModel::ConstructL
+// 
+// Symbian OS two phased constructor.
+// Completes the construction of the object.
+// ----------------------------------------------------------------------------
+//
+void CTestModulesListBoxModel::ConstructL()
+    {
+    //iBuffer = HBufC::NewLC( KMaxInfoName + KMaxName + 2 );
+
+    }
+
+// ----------------------------------------------------------------------------
+// CTestModulesListBoxModel::~CTestCaseOutputView
+// 
+// Destructor.
+// ----------------------------------------------------------------------------
+//
+CTestModulesListBoxModel::~CTestModulesListBoxModel()
+    {
+    delete iBuffer;
+    
+    }
+
+// ----------------------------------------------------------------------------
+// CTestModulesListBoxModel::MdcaCount
+// 
+// Returns the number of descriptor elements in the array.
+// ----------------------------------------------------------------------------
+//
+TInt CTestModulesListBoxModel::MdcaCount() const
+    {
+    return iTestModules.Count();
+    }
+
+// ----------------------------------------------------------------------------
+// CTestModulesListBoxModel::MdcaPoint
+// 
+// Indexes into a descriptor array.
+// ----------------------------------------------------------------------------
+//
+TPtrC CTestModulesListBoxModel::MdcaPoint(TInt aIndex) const
+    {
+    TPtrC testModule = (iTestModules)[aIndex];
+    TPtr buffer( iBuffer->Des() );
+    buffer.Zero();
+
+    buffer.Append(_L("\t"));
+    buffer.Append( testModule );
+    
+    return *iBuffer;
+    
+    }
+
+// ----------------------------------------------------------------------------
+// CTestModulesMenuContainer::ConstructL
+// 
+// Symbian OS two phased constructor.
+// ----------------------------------------------------------------------------
+//
+void CTestModulesMenuContainer::ConstructL(const TRect& aRect, MEikListBoxObserver* aListBoxObserver)
+    {
+    _LIT( KErrMessage, "Error loading modules! Check Test engine log.");
+    CreateWindowL();
+
+  	iListBox = CMenuListBox::NewL(ETestModulesMenuViewId);
+	iListBox->SetContainerWindowL( *this );
+	iListBox->SetListBoxObserver( aListBoxObserver /*this*/ ); // jos peritty MEikListBoxObserver:sta
+    iListBox->ConstructL(this, EAknListBoxSelectionList /*EAknListBoxMarkableList*/ );
+        ((CAppUIAppUi*)iCoeEnv->AppUi())->iLogger->Log(_L("StartCasesContainer: ListBox constructed"));
+
+    //Create Scroller control for ListBox and set its visibility
+    iListBox->CreateScrollBarFrameL(ETrue);
+    iListBox->ScrollBarFrame()->SetScrollBarVisibilityL(CEikScrollBarFrame::EOff,CEikScrollBarFrame::EAuto);
+
+    iUIStore = ( (CAppUIAppUi*)iCoeEnv->AppUi() )->UIStoreHandler();
+
+    if( iUIStore )
+        {
+        /*const CFixedFlatArray<TTestInfo>& allCases = iData->AllCases();
+        const TInt KTestCaseCount = allCases.Count();
+        for (TInt i=0; i < KTestCaseCount; i++)
+            {
+            iTestCasesInView.Append(&(allCases[i]));
+            } */
+
+        //RRefArray<TDesC> modules;
+        TInt ret = iUIStore->Modules( iModules );
+        if( ret != KErrNone )
+            {
+             //iModules.Reset();
+             //iModules.Close();
+			TMessageBoxUtil::ShowErrorNoteL( KErrMessage );
+            }
+       
+        iListBoxModel = CTestModulesListBoxModel::NewL( iModules );
+        ((CAppUIAppUi*)iCoeEnv->AppUi())->iLogger->Log(_L("StartCasesContainer: ListBox model"));
+
+
+         iListBox->Model()->SetItemTextArray(iListBoxModel);
+        ((CAppUIAppUi*)iCoeEnv->AppUi())->iLogger->Log(_L("StartCasesContainer: ListBox model set"));
+        
+        }
+    else
+        {
+        // General error becouse UIStore should be opened in AppUI when
+        // program starts.
+        User::Leave( KErrGeneral );
+        }
+
+    iListBox->ActivateL();
+    ((CMenuListBox*)iListBox)->SetPreviousFocus();
+    SetRect(aRect);
+    ActivateL();
+    }
+
+// ----------------------------------------------------------------------------
+// CTestModulesMenuContainer::~CTestCaseOutputView
+// 
+// Destructor.
+// ----------------------------------------------------------------------------
+//
+CTestModulesMenuContainer::~CTestModulesMenuContainer()
+    {
+    
+		iModules.Reset();
+        iModules.Close();
+
+	if( iListBox )
+		{
+		delete iListBox;
+		iListBox = NULL;
+		}
+		
+	}
+
+// ----------------------------------------------------------------------------
+// CTestModulesMenuContainer::SizeChanged
+// 
+// Called by framework when the view size is changed.
+// ----------------------------------------------------------------------------
+//
+void CTestModulesMenuContainer::SizeChanged()
+    {
+    if ( iListBox )
+		{
+		iListBox->SetRect( Rect() ); // Sets rectangle of listbox.
+		}
+
+    }
+
+// ----------------------------------------------------------------------------
+// CTestModulesMenuContainer::CountComponentControls
+// 
+// Gets a count of the component controls of this list box control.
+// ----------------------------------------------------------------------------
+//
+TInt CTestModulesMenuContainer::CountComponentControls() const
+    {
+    return 1; // return nbr of controls inside this container
+
+    }
+
+// ----------------------------------------------------------------------------
+// CTestModulesMenuContainer::ComponentControl
+// 
+// Gets a pointer to the specified component control.
+// ----------------------------------------------------------------------------
+//
+CCoeControl* CTestModulesMenuContainer::ComponentControl(TInt aIndex) const
+    {
+    switch ( aIndex )
+        {
+		case 0: 
+			return iListBox;
+        default:
+            return NULL;
+        }
+
+    }
+
+// ----------------------------------------------------------------------------
+// CTestModulesMenuContainer::Draw
+// 
+// Draw a control, called by window server.
+// ----------------------------------------------------------------------------
+//
+void CTestModulesMenuContainer::Draw(const TRect& /*aRect*/) const
+    {
+    }
+
+// ----------------------------------------------------------------------------
+// CTestModulesMenuContainer::OfferKeyEventL
+// 
+// Handles key events.
+// ----------------------------------------------------------------------------
+//
+TKeyResponse CTestModulesMenuContainer::OfferKeyEventL(
+	const TKeyEvent& aKeyEvent, TEventCode aType)
+    {
+	if (aType != EEventKey)
+	    {
+		return EKeyWasNotConsumed;
+	    }
+
+    switch ( aKeyEvent.iCode )
+        {
+        case EKeyLeftArrow:
+        case EKeyRightArrow:
+			{   /* Left ja right key eventit valitetaan AppUille joka hoitaa siirtymisen toisiin nakymiin */
+			return EKeyWasNotConsumed;
+            //break;
+            }
+        default:
+			{
+			//Muut Key eventit valitetaan listboxille, joka hoitaa ne
+			if (iListBox)
+				{
+				return iListBox->OfferKeyEventL( aKeyEvent, aType );
+				}
+			}
+        }
+    return EKeyWasNotConsumed;
+    }
+
+// ----------------------------------------------------------------------------
+// CTestModulesMenuContainer::CurrentItemIndex
+// 
+// Returns current item index in list box.
+// ----------------------------------------------------------------------------
+//
+TInt CTestModulesMenuContainer::CurrentItemIndex()
+    {
+    return iListBox->CurrentItemIndex();
+
+    }
+
+// ----------------------------------------------------------------------------
+// CTestModulesMenuContainer::SaveActiveLine
+//
+// Makes the iListBox member save its focus position
+// ----------------------------------------------------------------------------
+//
+void CTestModulesMenuContainer::SaveActiveLine()
+	{
+	((CMenuListBox*)iListBox)->SaveFocusPosition();
+	}
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/avkon/stifui/src/TestSetBaseMenuContainer.cpp	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,189 @@
+/*
+* 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 file contains CTestSetBaseMenuContainer class 
+* definition.
+*
+*/
+
+// INCLUDE FILES
+#include "TestSetBaseMenuContainer.h"
+#include "Stifui.hrh"
+
+#include <Stifui.rsg>
+
+#include <aknlists.h>  //ListBox
+#include <barsread.h> // for TResourceReader
+
+#include <aknnotewrappers.h>
+
+#include "MenuListBox.h"
+
+
+// ================= MEMBER FUNCTIONS =======================
+// ----------------------------------------------------------------------------
+// CTestSetBaseMenuContainer::ConstructL
+// 
+// Symbian OS two phased constructor.
+// ----------------------------------------------------------------------------
+//
+void CTestSetBaseMenuContainer::ConstructL(const TRect& aRect, MEikListBoxObserver* aListBoxObserver)
+    {
+    CreateWindowL();
+     
+	iListBox = CMenuListBox::NewL(ETestSetMenuViewId);
+	iListBox->SetContainerWindowL( *this );
+	TResourceReader reader;
+	iCoeEnv->CreateResourceReaderLC( reader, R_TESTSETBASE_MENU_LISTBOX );
+	iListBox->SetListBoxObserver( aListBoxObserver );
+	iListBox->ConstructFromResourceL( reader );
+	CleanupStack::PopAndDestroy(); // resource stuffs. 
+
+    // Create Scroller control for ListBox and set its visibility
+    // !!! Not needed yet because there are only two items in list box.
+    // If items are added later, scroller may be taken to use
+    //iListBox->CreateScrollBarFrameL(ETrue);
+    //iListBox->ScrollBarFrame()->SetScrollBarVisibilityL(CEikScrollBarFrame::EOff,CEikScrollBarFrame::EAuto);
+    
+    iListBox->ActivateL();
+    ((CMenuListBox*)iListBox)->SetPreviousFocus();
+    
+    SetRect(aRect);
+    ActivateL();
+    }
+
+// ----------------------------------------------------------------------------
+// CTestSetBaseMenuContainer::~CTestSetBaseMenuContainer
+// 
+// Destructor.
+// ----------------------------------------------------------------------------
+//
+CTestSetBaseMenuContainer::~CTestSetBaseMenuContainer()
+    {
+    if ( iListBox )
+		{
+		iListBox->Reset();
+    	delete iListBox;
+    	}	
+    }
+
+// ----------------------------------------------------------------------------
+// CTestSetBaseMenuContainer::SizeChanged
+// 
+// Called by framework when the view size is changed.
+// ----------------------------------------------------------------------------
+//
+void CTestSetBaseMenuContainer::SizeChanged()
+    {
+    if ( iListBox )
+		{
+		iListBox->SetRect( Rect() ); // Sets rectangle of listbox.
+		}
+    }
+
+// ----------------------------------------------------------------------------
+// CTestSetBaseMenuContainer::CountComponentControls
+// 
+// Gets a count of the component controls of this list box control.
+// ----------------------------------------------------------------------------
+//
+TInt CTestSetBaseMenuContainer::CountComponentControls() const
+    {
+    return 1; // return nbr of controls inside this container
+    }
+
+// ----------------------------------------------------------------------------
+// CTestSetBaseMenuContainer::ComponentControl
+// 
+// Gets a pointer to the specified component control.
+// ----------------------------------------------------------------------------
+//
+CCoeControl* CTestSetBaseMenuContainer::ComponentControl(TInt aIndex) const
+    {
+    switch ( aIndex )
+        {
+		case 0: 
+			return iListBox;
+        default:
+            return NULL;
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// CTestSetBaseMenuContainer::Draw
+// 
+// Draw a control, called by window server.
+// ----------------------------------------------------------------------------
+//
+void CTestSetBaseMenuContainer::Draw(const TRect& /*aRect*/) const
+    {
+    // CWindowGc& gc = SystemGc();
+    }
+
+// ----------------------------------------------------------------------------
+// CTestSetBaseMenuContainer::OfferKeyEventL
+// 
+// Handles key events..
+// ----------------------------------------------------------------------------
+//
+TKeyResponse CTestSetBaseMenuContainer::OfferKeyEventL(
+	const TKeyEvent& aKeyEvent, TEventCode aType)
+    {
+	if (aType != EEventKey)
+	{
+		return EKeyWasNotConsumed;
+	}
+	
+    switch ( aKeyEvent.iCode )
+        {
+        case EKeyLeftArrow:
+        case EKeyRightArrow:
+			{   /* Left ja right key eventit valitetaan AppUille joka hoitaa siirtymisen toisiin nakymiin */
+			return EKeyWasNotConsumed;
+            //break;
+            }
+        default:
+			{
+			//Muut Key eventit valitetaan listboxille, joka hoitaa ne
+			if (iListBox)
+				{
+				return iListBox->OfferKeyEventL( aKeyEvent, aType );
+				}
+	    	}
+        }     
+    return EKeyWasNotConsumed;        
+}
+
+// ----------------------------------------------------------------------------
+// CTestSetBaseMenuContainer::GetActiveLine
+// 
+// Get currently selected items index.
+// ----------------------------------------------------------------------------
+//
+TInt CTestSetBaseMenuContainer::GetActiveLine()
+	{
+	return iListBox->CurrentItemIndex();
+	}
+
+// ----------------------------------------------------------------------------
+// CTestSetBaseMenuContainer::SaveActiveLine
+//
+// Makes the iListBox member save its focus position
+// ----------------------------------------------------------------------------
+//
+void CTestSetBaseMenuContainer::SaveActiveLine()
+	{
+	((CMenuListBox*)iListBox)->SaveFocusPosition();
+	}
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/avkon/stifui/src/TestSetBaseMenuView.cpp	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,200 @@
+/*
+* 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 file contains CTestSetBaseMenuView class
+* definition.
+*
+*/
+
+// INCLUDE FILES
+#include  <aknViewAppUi.h>
+#include  <aknlists.h> 
+#include  <barsread.h>	//TResourceReader
+#include  <Stifui.rsg>
+#include  "TestSetBaseMenuView.h"
+#include  "TestSetBaseMenuContainer.h"
+#include  "Stifui.hrh" 
+#include  "AppUIAppUi.h" // loggerin kayttoa varten, muuten ei tarvittaisi
+
+// ================= MEMBER FUNCTIONS =======================
+
+// ---------------------------------------------------------
+// CTestSetBaseMenuView::ConstructL
+// 
+// Symbian OS two-phased constructor.
+// ---------------------------------------------------------
+//
+void CTestSetBaseMenuView::ConstructL()
+    {
+    CView::ConstructL();
+    BaseConstructL( R_APPUI_TESTSETBASEMENUVIEW );
+    }
+
+// ----------------------------------------------------------------------------
+// CTestSetBaseMenuView::~CTestSetBaseMenuView
+// 
+// Destructor.
+// ----------------------------------------------------------------------------
+//
+CTestSetBaseMenuView::~CTestSetBaseMenuView()
+    {
+    if ( iContainer )
+        {
+        AppUi()->RemoveFromViewStack( *this, iContainer );
+        delete iContainer;
+        iContainer = NULL;
+        }
+    delete iNaviDecorator;
+    iNaviDecorator = NULL;
+    }
+
+// ----------------------------------------------------------------------------
+// CTestSetBaseMenuView::Id
+// 
+// Returns view´s id.
+// ----------------------------------------------------------------------------
+//
+TUid CTestSetBaseMenuView::Id() const
+    {
+    return TUid::Uid(ETestSetBaseMenuViewId); //KTestSetBaseMenuViewId;
+    }
+
+// ----------------------------------------------------------------------------
+// CTestSetBaseMenuView::HandleCommandL
+// 
+// Handles a command.
+// ----------------------------------------------------------------------------
+//
+void CTestSetBaseMenuView::HandleCommandL(TInt aCommand)
+    {   
+    switch ( aCommand )
+        {
+        case EAknSoftkeyBack:
+            {
+            AppUi()->HandleCommandL(EAppUIGoBack);
+            break;
+            }
+		case EAknCmdOpen:
+			{
+			break;
+			}
+		case ECmdCreateTestSet:
+            {
+            AppUi()->HandleCommandL(ECmdCreateTestSet);
+            break;
+            }
+		case ECmdLoadTestSet:
+            {
+            AppUi()->HandleCommandL(ECmdLoadTestSet);
+            break;
+            }
+        default:
+            {
+            AppUi()->HandleCommandL( aCommand );
+            break;
+            }
+        }
+    }
+
+
+// ----------------------------------------------------------------------------
+// CTestSetBaseMenuView::HandleListBoxEventL
+// 
+// Handles a list box event.
+// ----------------------------------------------------------------------------
+//
+void CTestSetBaseMenuView::HandleListBoxEventL(CEikListBox* aListBox, TListBoxEvent aEventType)
+	{
+	if ( ( aEventType == EEventEnterKeyPressed ) || ( aEventType == EEventItemDoubleClicked ) )
+		{
+	    switch ( aListBox->CurrentItemIndex() )
+			{
+		    case 0:
+		    	HandleCommandL( ECmdCreateTestSet );
+				break;
+			case 1:
+				HandleCommandL( ECmdLoadTestSet );
+				break;
+			}
+		}
+	}
+	
+		
+// ----------------------------------------------------------------------------
+// CTestSetBaseMenuView::HandleClientRectChange
+// 
+// Handles client rect changes.
+// ----------------------------------------------------------------------------
+//
+void CTestSetBaseMenuView::HandleClientRectChange()
+    {
+    if ( iContainer )
+        {
+        iContainer->SetRect( ClientRect() );
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// CTestSetBaseMenuView::DoActivateL
+// 
+// Initializes view when activated.
+// ----------------------------------------------------------------------------
+//
+void CTestSetBaseMenuView::DoActivateL(
+   const TVwsViewId& /*aPrevViewId*/,TUid /*aCustomMessageId*/,
+   const TDesC8& /*aCustomMessage*/)
+    {
+    if (!iContainer)
+        {
+        ((CAppUIAppUi*)AppUi())->iLogger->Log(_L("TestSetBaseMenu: DoActivateL"));
+        //message = _L("eng.open ret:");
+        //message.AppendNum( ret , EDecimal );
+        //AppUi->iLogger->Log( message );
+        iContainer = new (ELeave) CTestSetBaseMenuContainer;
+        iContainer->SetMopParent(this);
+        iContainer->ConstructL( ClientRect(), this );
+        ((CAppUIAppUi*)AppUi())->iLogger->Log(_L("TestSetBaseMenu: container constructed"));
+        AppUi()->AddToStackL( *this, iContainer );
+        } 
+	
+    CEikStatusPane* sp=iEikonEnv->AppUiFactory()->StatusPane();
+	CAknNavigationControlContainer* np= (CAknNavigationControlContainer *)sp->ControlL(TUid::Uid(EEikStatusPaneUidNavi));
+	
+	TResourceReader reader;
+	iCoeEnv->CreateResourceReaderLC(reader,R_NAVITITLE_TESTSET_BASE);
+	iNaviDecorator = np->CreateNavigationLabelL( reader );
+	CleanupStack::PopAndDestroy(); // resource reader
+	np->PushL(*iNaviDecorator);
+
+   }
+
+// ----------------------------------------------------------------------------
+// CTestSetBaseMenuView::DoDeactivate
+// 
+// Deactivates view.
+// ----------------------------------------------------------------------------
+//
+void CTestSetBaseMenuView::DoDeactivate()
+    {
+    if ( iContainer )
+        {
+        iContainer->SaveActiveLine();
+        AppUi()->RemoveFromViewStack( *this, iContainer );
+        delete iContainer;
+        iContainer = NULL;         
+        }    
+    delete iNaviDecorator;
+    iNaviDecorator = NULL;    
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/avkon/stifui/src/TestSetInsertMenuContainer.cpp	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,224 @@
+/*
+* 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 file contains CTestSetInsertMenuContainer class
+* definition.
+*
+*/
+
+// INCLUDE FILES 
+#include <aknlists.h>  // ListBox
+#include <AknIconArray.h> // CAknIconArray
+#include <aknnotewrappers.h>
+
+#include <eikclbd.h> // CColumnListBoxData
+
+#include "TestSetInsertMenuContainer.h"
+#include "TestSetInsertMenuView.h"
+#include <Stifui.rsg>
+#include "Stifui.hrh"
+#include "AppUIAppUi.h"
+
+#include "MenuListBox.h"
+
+
+// ================= MEMBER FUNCTIONS =======================
+// ----------------------------------------------------------------------------
+// CTestSetInsertMenuContainer::ConstructL
+// 
+// Symbian OS two phased constructor.
+// ----------------------------------------------------------------------------
+//
+void CTestSetInsertMenuContainer::ConstructL(const TRect& aRect, MEikListBoxObserver* aListBoxObserver)
+    {
+    ((CAppUIAppUi*)iCoeEnv->AppUi())->iLogger->Log(_L("TestSetInsertMenuContainer: ConstructL"));
+
+	iParentView = (CTestSetInsertMenuView*)aListBoxObserver;
+    CreateWindowL();
+
+    iUIStore = ( (CAppUIAppUi*)iCoeEnv->AppUi() )->UIStoreHandler();
+
+    iTestCasesInView.Reset();
+        //((CAppUIAppUi*)iCoeEnv->AppUi())->iLogger->Log(_L("TestSetInsertMenuContainer: iTCInV Reset"));
+    
+	iListBox = CMenuListBox::NewL(ETestSetInsertMenuViewId);
+	iListBox->SetContainerWindowL( *this );
+	iListBox->SetListBoxObserver( aListBoxObserver /*this*/ ); // jos peritty MEikListBoxObserver:sta
+    iListBox->ConstructL(this, EAknListBoxMarkableList /*EAknListBoxSelectionList*/);
+
+    ((CAppUIAppUi*)iCoeEnv->AppUi())->iLogger->Log(_L("TestSetInsertMenuContainer: ListBox constructed"));
+
+    //Create Scroller control for ListBox and set its visibility
+    iListBox->CreateScrollBarFrameL(ETrue);
+    iListBox->ScrollBarFrame()->SetScrollBarVisibilityL(CEikScrollBarFrame::EOff,CEikScrollBarFrame::EAuto);
+    iListBox->ItemDrawer()->ColumnData()->EnableMarqueeL( ETrue );
+
+    if ( iUIStore )
+        {
+        RRefArray<CTestInfo> allCases;
+        TInt ret = iUIStore->TestCases( allCases );
+        if( KErrNone != ret )
+            {
+            ((CAppUIAppUi*)iCoeEnv->AppUi())->iLogger->Log(_L("iUIStore->TestCases() fails"));
+            allCases.Reset();
+            allCases.Close();
+            User::Leave( ret );
+            }
+
+        const TInt KTestCaseCount = allCases.Count();
+        for (TInt i=0; i < KTestCaseCount; i++)
+            {
+            iTestCasesInView.Append( &allCases[i] );
+            }
+
+        iListBoxModel = CTestCaseListBoxModel::NewL(&iTestCasesInView);
+             ((CAppUIAppUi*)iCoeEnv->AppUi())->iLogger->Log(_L("TestSetInsertMenuContainer: ListBox model"));
+
+        iListBox->Model()->SetItemTextArray(iListBoxModel);
+             ((CAppUIAppUi*)iCoeEnv->AppUi())->iLogger->Log(_L("TestSetInsertMenuContainer: ListBox model set"));
+
+        allCases.Reset();
+        allCases.Close();
+        }
+    else
+        {
+        //User::Leave( syy?? )
+        }
+
+    // Creates graphic.
+    SetGraphicIconL( iListBox );
+       ((CAppUIAppUi*)iCoeEnv->AppUi())->iLogger->Log(_L("TestSetInsertMenuContainer: icons created"));
+
+    iListBox->ActivateL();
+    ((CMenuListBox*)iListBox)->SetPreviousFocus();
+
+    SetRect(aRect);
+    ActivateL();
+    }
+
+// ----------------------------------------------------------------------------
+// CTestSetInsertMenuContainer::~CTestSetInsertMenuContainer
+// 
+// Destructor.
+// ----------------------------------------------------------------------------
+//
+CTestSetInsertMenuContainer::~CTestSetInsertMenuContainer()
+    {
+    //iTestCasesInView.Close(); // does not delete objects whose pointers are contained in the array
+    //delete iListBox;
+    }
+
+// ----------------------------------------------------------------------------
+// CTestSetInsertMenuContainer::SizeChanged
+// 
+// Called by framework when the view size is changed.
+// ----------------------------------------------------------------------------
+//
+void CTestSetInsertMenuContainer::SizeChanged()
+    {
+    if ( iListBox )
+		{
+		iListBox->SetRect( Rect() ); // Sets rectangle of listbox.
+		}
+    }
+
+// ----------------------------------------------------------------------------
+// CTestSetInsertMenuContainer::CountComponentControls
+// 
+// Gets a count of the component controls of this list box control.
+// ----------------------------------------------------------------------------
+//
+TInt CTestSetInsertMenuContainer::CountComponentControls() const
+    {
+    return 1; // return nbr of controls inside this container
+    }
+
+// ----------------------------------------------------------------------------
+// CTestSetInsertMenuContainer::ComponentControl
+// 
+// Gets a pointer to the specified component control.
+// ----------------------------------------------------------------------------
+//
+CCoeControl* CTestSetInsertMenuContainer::ComponentControl(TInt aIndex) const
+    {
+    switch ( aIndex )
+        {
+		case 0: 
+			return iListBox;
+        default:
+            return NULL;
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// CTestSetInsertMenuContainer::Draw
+// 
+// Draw a control, called by window server.
+// ----------------------------------------------------------------------------
+//
+void CTestSetInsertMenuContainer::Draw(const TRect& /*aRect*/) const
+    {
+    // CWindowGc& gc = SystemGc();
+    }
+
+// ----------------------------------------------------------------------------
+// CTestSetInsertMenuContainer::OfferKeyEventL
+// 
+// Handles key events.
+// ----------------------------------------------------------------------------
+//
+TKeyResponse CTestSetInsertMenuContainer::OfferKeyEventL(
+	const TKeyEvent& aKeyEvent, TEventCode aType )
+    {
+	if (aType != EEventKey)
+	    {
+		return EKeyWasNotConsumed;
+	    }
+
+	if (iListBox)
+		{
+		//if multiple items selected
+		if ( iListBox->SelectionIndexes()->Count() > 0 )
+			{
+			TUint mask = 0x40488;
+			
+			//if event is enter key,
+			//don´t send it to listbox
+			if ( aKeyEvent.iScanCode == 0xa7 
+				&& ( aKeyEvent.iModifiers & mask ) == 0 )
+				{
+				iParentView->HandleListBoxEventL( iListBox, MEikListBoxObserver::EEventEnterKeyPressed );
+				return EKeyWasConsumed;	
+				}
+			}
+			
+		return iListBox->OfferKeyEventL( aKeyEvent, aType );
+		}
+	else
+		{
+		return EKeyWasNotConsumed;
+		}
+    }
+
+// ----------------------------------------------------------------------------
+// CTestSetInsertMenuContainer::SaveActiveLine
+//
+// Makes the iListBox member save its focus position
+// ----------------------------------------------------------------------------
+//
+void CTestSetInsertMenuContainer::SaveActiveLine()
+	{
+	((CMenuListBox*)iListBox)->SaveFocusPosition();
+	}
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/avkon/stifui/src/TestSetInsertMenuView.cpp	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,399 @@
+/*
+* 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 file contains CTestSetInsertMenuView class
+* definition.
+*
+*/
+
+// INCLUDE FILES
+#include  <eikmenub.h>
+#include  <aknViewAppUi.h>
+#include  <aknlistquerydialog.h> 
+#include  <aknnotewrappers.h>
+#include  <barsread.h>	//TResourceReader
+#include  <Stifui.rsg>
+#include  "TestSetInsertMenuView.h"
+#include  "TestSetInsertMenuContainer.h"
+#include  "TestSetMenuView.h"
+#include  "AppUIAppUi.h"
+#include  "Stifui.hrh" 
+
+
+// ================= MEMBER FUNCTIONS =======================
+// ----------------------------------------------------------------------------
+// CTestSetInsertMenuView::ConstructL
+// 
+// Symbian OS two-phased constructor.
+// ----------------------------------------------------------------------------
+//
+void CTestSetInsertMenuView::ConstructL()
+    {
+    CView::ConstructL();
+    BaseConstructL(  R_INSERT_TESTCASES_VIEW );
+    iCurrentTestCase = 0;
+
+    }
+
+// ----------------------------------------------------------------------------
+// CTestSetInsertMenuView::~CTestSetInsertMenuView
+// 
+// Destructor.
+// ----------------------------------------------------------------------------
+//
+CTestSetInsertMenuView::~CTestSetInsertMenuView()
+    {
+    if ( iContainer )
+        {
+        AppUi()->RemoveFromViewStack( *this, iContainer );
+        delete iContainer;
+        }
+    delete iNaviDecorator;
+    iNaviDecorator = NULL;
+    }
+
+// ----------------------------------------------------------------------------
+// CTestSetInsertMenuView::Id
+// 
+// Returns view´s id.
+// ----------------------------------------------------------------------------
+//
+TUid CTestSetInsertMenuView::Id() const
+    {
+    return TUid::Uid(ETestSetInsertMenuViewId);
+
+    }
+
+// ----------------------------------------------------------------------------
+// CTestSetInsertMenuView::HandleCommandL
+// 
+// Handles a command.
+// ----------------------------------------------------------------------------
+//
+void CTestSetInsertMenuView::HandleCommandL(TInt aCommand)
+    {   
+    if ( aCommand >= ECmdFilterByModule && aCommand < ECmdFilterByTestCaseFile ) // 0x1000 - 0x1FFF
+        {
+        TInt moduleNumber = aCommand - ECmdFilterByModule;
+        RRefArray<TDesC> allModules;
+        TInt ret = ((CAppUIAppUi*)AppUi())->UIStoreHandler()->Modules( allModules );
+        if( KErrNone != ret )
+            {
+            allModules.Reset();
+            allModules.Close();
+            User::Leave( ret );
+            }
+        TName moduleName = allModules[ moduleNumber ];
+
+        iContainer->FilterCasesByModuleL( moduleName );
+
+        allModules.Reset();
+        allModules.Close();
+        }
+	else if ( aCommand >= ECmdFilterByTestCaseFile && aCommand < ECmdNOFiltering )
+        {
+        TInt testCaseFileNumber = aCommand - ECmdFilterByTestCaseFile;
+        RRefArray<TDesC> allTestCases;
+        TInt ret = ((CAppUIAppUi*)AppUi())->UIStoreHandler()->TestCaseFiles( allTestCases );
+        if( KErrNone != ret )
+            {
+            allTestCases.Reset();
+            allTestCases.Close();
+            User::Leave( ret );
+            }
+        TFileName testCaseFileName = allTestCases[ testCaseFileNumber ];
+
+        iContainer->FilterCasesByTCFileNameL( testCaseFileName );
+
+        allTestCases.Reset();
+        allTestCases.Close();
+        }
+	else if ( aCommand == ECmdNOFiltering )
+        {
+        iContainer->NoFilteringL();
+        }
+    else if ( aCommand == EAknCmdMark || aCommand == EAknCmdUnmark 
+    	|| aCommand == EAknMarkAll || aCommand == EAknUnmarkAll )
+    	{
+    	iContainer->HandleMarkCommandL( aCommand );
+    	}
+    else
+	    {
+ 	    switch ( aCommand )
+	        {
+	        case ECmdInsertSelectedCases:
+	            {
+                ShowInsertCasesDialogL();
+	            break;
+	            }
+	        case EAknSoftkeyCancel:
+	            {
+	            //iCurrentTestCase = 0;
+	            ( (CEikAppUi*)iCoeEnv->AppUi() )->HandleCommandL(EAppUIGoToTestSetsMenu);
+	            break;
+	            }
+	        default:
+	            {
+	            AppUi()->HandleCommandL( aCommand );
+	            break;
+	            }
+	        }
+	    }
+
+    }
+
+// ----------------------------------------------------------------------------
+// CTestSetInsertMenuView::HandleClientRectChange
+// 
+// Handles client rect changes.
+// ----------------------------------------------------------------------------
+//
+void CTestSetInsertMenuView::HandleClientRectChange()
+    {
+    if ( iContainer )
+        {
+        iContainer->SetRect( ClientRect() );
+        }
+
+    }
+
+// ----------------------------------------------------------------------------
+// CTestSetInsertMenuView::DoActivateL
+// 
+// Initializes view when activated.
+// ----------------------------------------------------------------------------
+//
+void CTestSetInsertMenuView::DoActivateL(
+   const TVwsViewId& /*aPrevViewId*/,TUid /*aCustomMessageId*/,
+   const TDesC8& /*aCustomMessage*/)
+    {
+    if (!iContainer)
+        {
+           ((CAppUIAppUi*)AppUi())->iLogger->Log(_L("TestSetInsertMenuView: DoActivateL"));
+        //message = _L("eng.open ret:");
+        //message.AppendNum( ret , EDecimal );
+        //AppUi()->iLogger->Log( message );
+        iContainer = new (ELeave) CTestSetInsertMenuContainer;
+        iContainer->SetMopParent(this);
+        iContainer->ConstructL( ClientRect(), this );
+           ((CAppUIAppUi*)AppUi())->iLogger->Log(_L("TestSetInsertMenuView: container constructed"));
+        AppUi()->AddToStackL( *this, iContainer );
+        }
+   
+   //testing
+    iContainer->SetCurrentItemIndex(iCurrentTestCase);
+	
+	CEikStatusPane* sp=iEikonEnv->AppUiFactory()->StatusPane();
+	CAknNavigationControlContainer* np= (CAknNavigationControlContainer *)sp->ControlL(TUid::Uid(EEikStatusPaneUidNavi));
+	
+	TResourceReader reader;
+	iCoeEnv->CreateResourceReaderLC(reader,R_NAVITITLE_TESTSET_INSERT);
+	iNaviDecorator = np->CreateNavigationLabelL( reader );
+	CleanupStack::PopAndDestroy(); // resource reader
+	np->PushL(*iNaviDecorator);
+    }
+
+// ----------------------------------------------------------------------------
+// CTestSetInsertMenuView::DoDeactivate
+// 
+// Deactivates view.
+// ----------------------------------------------------------------------------
+//
+void CTestSetInsertMenuView::DoDeactivate()
+    {
+    if ( iContainer )
+        {
+        iContainer->SaveActiveLine();
+        AppUi()->RemoveFromViewStack( *this, iContainer );
+        delete iContainer;
+        iContainer = NULL;
+        }
+    delete iNaviDecorator;
+    iNaviDecorator = NULL;
+    }
+
+// ----------------------------------------------------------------------------
+// CTestSetInsertMenuView::DynInitMenuPaneL
+// 
+// Initializes menu pane.
+// ----------------------------------------------------------------------------
+//
+void CTestSetInsertMenuView::DynInitMenuPaneL(
+    TInt aResourceId, CEikMenuPane* aMenuPane)
+    {
+
+    // Test modules are added to filter by test module submenu if the submenu is opened
+    if (R_APPUI_FILTERBYMODULES_MENU == aResourceId)
+        {
+        RRefArray<TDesC> modules;
+        TInt ret = ((CAppUIAppUi*)AppUi())->UIStoreHandler()->Modules( modules );
+        if( KErrNone != ret )
+            {
+            modules.Reset();
+            modules.Close();
+            User::Leave( ret );
+            }
+
+        TInt moduleCount = modules.Count();
+        
+        TInt i;
+        CEikMenuPaneItem::SData item;
+
+        item.iCommandId = ECmdFilterByModule;
+        item.iFlags = 0;
+        item.iCascadeId = 0;
+
+        for (i = 0; i < moduleCount; i++)
+            {
+            //item.iText = modules[i].iModuleName;
+            item.iText = modules[i];
+            aMenuPane->AddMenuItemL(item);
+            item.iCommandId++; // command IDs 0x1000 - 0x1FFF are reserved for modules in hrh file
+            }
+        
+        modules.Reset();
+        modules.Close();
+
+        }
+
+    // Test case files are added to filter by test case file submenu if the submenu is opened
+    if (R_APPUI_FILTER_BY_TESTCASEFILE_MENU == aResourceId)
+        {
+        RRefArray<TDesC> testCaseFiles;
+        TInt ret = ((CAppUIAppUi*)AppUi())->UIStoreHandler()->TestCaseFiles( testCaseFiles );
+        if( KErrNone != ret )
+            {
+            testCaseFiles.Reset();
+            testCaseFiles.Close();
+            User::Leave( ret );
+            }
+
+        TInt testCaseFileCount = testCaseFiles.Count();
+
+        TInt i;
+        CEikMenuPaneItem::SData item;
+
+        item.iCommandId = ECmdFilterByTestCaseFile;
+        item.iFlags = 0;
+        item.iCascadeId = 0;
+
+        for (i = 0; i < testCaseFileCount; i++)
+            {
+            item.iText = testCaseFiles[i];
+            aMenuPane->AddMenuItemL(item);
+            item.iCommandId++; // command IDs 0x2000 - 0x2FFF are reserved for test case files in hrh file
+            }
+        }
+
+    }
+
+// ----------------------------------------------------------------------------
+// CTestSetInsertMenuView::HandleListBoxEventL
+// 
+// Handles listbox events.
+// ----------------------------------------------------------------------------
+//
+void CTestSetInsertMenuView::HandleListBoxEventL(CEikListBox* /*aListBox*/, TListBoxEvent aEventType)
+	{
+
+	if ( ( aEventType == EEventEnterKeyPressed ) || ( aEventType == EEventItemDoubleClicked ) )
+		{
+        ShowInsertCasesDialogL();
+		}
+		
+	}
+
+// ----------------------------------------------------------------------------
+// CTestSetInsertMenuView::ShowInsertCasesDialogL
+// 
+// Show confirmation dialog for inserting test cases.
+// ----------------------------------------------------------------------------
+//
+void CTestSetInsertMenuView::ShowInsertCasesDialogL()
+    {
+    TInt i(0);
+    TBuf<50> message;
+    CEikListBox* listBox = iContainer->ListBox();
+	TInt count = listBox->SelectionIndexes()->Count();
+	
+	if ( count > 0 )
+	    {
+    	CEikonEnv::Static()->ReadResource( message, R_INSERT_CONFIRMATION_QUESTION );
+    		
+    	CAknQueryDialog * dlg = CAknQueryDialog::NewL(CAknQueryDialog::ENoTone);
+    	if ( dlg->ExecuteLD( R_GENERAL_CONFIRMATION_DIALOG, message ) )
+    		{
+    		CEikListBox* newListBox = iContainer->ListBox();
+		    TInt newCount = newListBox->SelectionIndexes()->Count();
+    		RArray<TInt> selectedIndices;
+		    CleanupClosePushL( selectedIndices );
+		    if ( newCount > 0 )
+    			{
+    			for( i = 0; i < newCount; i++ )
+	    			{
+    				selectedIndices.InsertInOrder( (*newListBox->SelectionIndexes())[i] );
+		    		}	
+    				
+	    		AddCasesToTestSet( selectedIndices );
+	    		// Test cases added, set save needed flag to true.
+		    	((CTestSetMenuView*)AppUi()->View( 
+		    	    TUid::Uid(ETestSetMenuViewId) ))->SetSaveNeeded(ETrue);
+			    }
+    		CleanupStack::PopAndDestroy();
+	    	
+		    // Test cases added -> go to test set menu
+    		AppUi()->HandleCommandL(EAppUIGoBack);
+	    	}
+	    }
+	else
+	    {
+	    CAknWarningNote* dialog = new(ELeave)CAknWarningNote();
+	    CEikonEnv::Static()->ReadResource( message, R_INSERT_NOCASES_TEXT );
+	    dialog->ExecuteLD(message);
+	    }
+	    
+    }
+
+// ----------------------------------------------------------------------------
+// CTestSetInsertMenuView::AddCasesToTestSet
+// 
+// Adds selected test cases to the current test set.
+// ----------------------------------------------------------------------------
+//
+void CTestSetInsertMenuView::AddCasesToTestSet( RArray<TInt> aSelectedIndexes )
+	{
+	TInt ret(0);
+	TInt i(0);
+	RRefArray<CTestInfo> allCases;
+	CTestSetMenuView* testSetMenuView = 
+    	(CTestSetMenuView*)((CAppUIAppUi*)AppUi())->View( TUid::Uid(ETestSetMenuViewId) );
+
+	ret = ((CAppUIAppUi*)AppUi())->UIStoreHandler()->TestCases(allCases);
+    
+	for ( i = 0; i < aSelectedIndexes.Count(); i++ )
+		{
+		ret = ((CAppUIAppUi*)AppUi())->UIStoreHandler()->AddToTestSet( 
+    		testSetMenuView->CurrentTestSet(),
+   			allCases[ aSelectedIndexes[i] ] );
+		}    
+    if( ret != KErrNone )		
+        {
+        RDebug::Print( _L("AddCasesToTestSet failed with value: %d"), ret );
+        }
+    
+	allCases.Reset();
+	allCases.Close();
+
+	}
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/avkon/stifui/src/TestSetMenuContainer.cpp	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,486 @@
+/*
+* 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 file contains CTestSetMenuContainer class 
+* definition.
+*
+*/
+
+// INCLUDE FILES
+#include <aknlists.h>  // ListBox
+#include <AknIconArray.h> // CAknIconArray
+#include <aknnotewrappers.h>
+
+#include <eikclbd.h> // CColumnListBoxData
+
+#include "TestSetMenuContainer.h"
+#include "TestSetMenuView.h"
+#include "StartCasesContainer.h"
+#include <Stifui.rsg>
+#include "Stifui.hrh"
+#include "AppUIAppUi.h"
+
+#include "MenuListBox.h"
+
+
+// ================= MEMBER FUNCTIONS =======================
+// ----------------------------------------------------------------------------
+// CTestSetMenuContainer::ConstructL
+// 
+// Symbian OS two phased constructor.
+// ----------------------------------------------------------------------------
+//
+void CTestSetMenuContainer::ConstructL(const TRect& aRect, MEikListBoxObserver* aListBoxObserver)
+    {
+    ((CAppUIAppUi*)iCoeEnv->AppUi())->iLogger->Log(_L("TestSetMenuContainer: ConstructL"));
+
+	iParentView = (CTestSetMenuView*)aListBoxObserver;
+    CreateWindowL();
+
+    iUIStore = ( (CAppUIAppUi*)iCoeEnv->AppUi() )->UIStoreHandler();
+
+    iTestCasesInView.Reset();
+        //((CAppUIAppUi*)iCoeEnv->AppUi())->iLogger->Log(_L("TestSetMenuContainer: iTCInV Reset"));
+    
+	iListBox = CMenuListBox::NewL(ETestSetMenuViewId);
+	iListBox->SetContainerWindowL( *this );
+	iListBox->SetListBoxObserver( aListBoxObserver /*this*/ ); // jos peritty MEikListBoxObserver:sta
+    iListBox->ConstructL(this, EAknListBoxMarkableList /*EAknListBoxSelectionList*/);
+
+    ((CAppUIAppUi*)iCoeEnv->AppUi())->iLogger->Log(_L("TestSetMenuContainer: ListBox constructed"));
+
+    //Create Scroller control for ListBox and set its visibility
+    iListBox->CreateScrollBarFrameL(ETrue);
+    iListBox->ScrollBarFrame()->SetScrollBarVisibilityL(CEikScrollBarFrame::EOff,CEikScrollBarFrame::EAuto);
+    iListBox->ItemDrawer()->ColumnData()->EnableMarqueeL( ETrue );
+    iListBox->Model()->SetOwnershipType(ELbmOwnsItemArray);
+                     iListBox->HandleItemAdditionL();   
+
+    if ( iUIStore )
+        {
+        //RRefArray<const CTestInfo> allCases;
+        //CTestSetInfo* testSetInfo;
+        //IMPORT_C const CTestSetInfo& TestSetL( const TDesC& aSetName  );
+        
+        TPtrC ptr = iParentView->CurrentTestSet();
+        
+        const CTestSetInfo* testSetInfo = 
+        	&iUIStore->TestSetL( ptr );
+        
+        //inline const RRefArray<const CTestInfo>& TestCases() const
+   		const RRefArray<const CTestInfo>* allCases = &testSetInfo->TestCases();
+        
+        /*if( ret != KErrNone )
+            {
+            ((CAppUIAppUi*)iCoeEnv->AppUi())->iLogger->Log(_L("iUIStore->TestCases() fails"));
+            // Leave
+            }
+		*/
+
+        const TInt KTestCaseCount = allCases->Count();
+        for (TInt i=0; i < KTestCaseCount; i++)
+            {
+            iTestCasesInView.Append( &allCases->operator[](i) );
+            }
+
+        iListBoxModel = CTestCaseListBoxModel::NewL(&iTestCasesInView);
+             ((CAppUIAppUi*)iCoeEnv->AppUi())->iLogger->Log(_L("TestSetMenuContainer: ListBox model"));
+
+        iListBox->Model()->SetItemTextArray(iListBoxModel);
+             ((CAppUIAppUi*)iCoeEnv->AppUi())->iLogger->Log(_L("TestSetMenuContainer: ListBox model set"));
+
+        }
+    else
+        {
+        //User::Leave( syy?? )
+        }
+
+    // Creates graphic.
+    SetGraphicIconL( iListBox );
+       ((CAppUIAppUi*)iCoeEnv->AppUi())->iLogger->Log(_L("TestSetMenuContainer: icons created"));
+
+    iListBox->ActivateL();
+    ((CMenuListBox*)iListBox)->SetPreviousFocus();
+
+    SetRect(aRect);
+    ActivateL();
+    }
+
+// ----------------------------------------------------------------------------
+// CTestSetMenuContainer::SetGraphicIconL
+// 
+// Sets graphic icon using listbox as CEikColumnListBox.
+// ----------------------------------------------------------------------------
+//
+void CTestSetMenuContainer::SetGraphicIconL( CEikColumnListBox* aListBox )
+    {
+	if ( aListBox )
+        {
+        // Creates gul icon.
+        CAknIconArray* iconArray = new(ELeave) CAknIconArray(1);
+        CleanupStack::PushL( iconArray );
+        
+        GraphicIconL( iconArray ); // Appends graphic data.
+        
+        // Sets graphics as ListBox icon.
+        aListBox->ItemDrawer()->ColumnData()->SetIconArray( iconArray );
+        
+        CleanupStack::Pop();
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// CTestSetMenuContainer::CurrentItemIndex
+// 
+// Returns current item index in list box.
+// ----------------------------------------------------------------------------
+//
+TInt CTestSetMenuContainer::CurrentItemIndex()
+    {
+    return iListBox->CurrentItemIndex();
+    }
+
+// ----------------------------------------------------------------------------
+// CTestSetMenuContainer::SetCurrentItemIndex
+// 
+// Sets current item index in list box.
+// ----------------------------------------------------------------------------
+//
+void CTestSetMenuContainer::SetCurrentItemIndex(TInt aCurrentTestCase)
+    {
+    iListBox->SetCurrentItemIndexAndDraw(aCurrentTestCase);
+    }
+
+// ----------------------------------------------------------------------------
+// CTestSetMenuContainer::GraphicIconL
+// 
+// Appends graphics data.
+// ----------------------------------------------------------------------------
+//
+void CTestSetMenuContainer::GraphicIconL( CArrayPtr<CGulIcon>* aIcons )
+    {
+    if ( aIcons )
+        {
+        CFbsBitmap* markBitmap = NULL;
+        CFbsBitmap* markBitmapMask = NULL;
+	
+        TRgb defaultColor;
+        defaultColor = CEikonEnv::Static()->Color(EColorControlText);
+	
+        AknsUtils::CreateColorIconL(AknsUtils::SkinInstance(),
+        		KAknsIIDQgnIndiMarkedAdd,
+        		KAknsIIDQsnIconColors,
+        		EAknsCIQsnIconColorsCG13,
+        		markBitmap,
+        		markBitmapMask,
+        		AknIconUtils::AvkonIconFileName(),
+        		EMbmAvkonQgn_indi_marked_add,
+        		EMbmAvkonQgn_indi_marked_add_mask,
+        		defaultColor );
+        
+        CGulIcon* markIcon = CGulIcon::NewL(markBitmap,markBitmapMask);
+        aIcons->AppendL(markIcon); 
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// CTestSetMenuContainer::~CTestSetMenuContainer
+// 
+// Destructor.
+// ----------------------------------------------------------------------------
+//
+CTestSetMenuContainer::~CTestSetMenuContainer()
+    {
+    iTestCasesInView.Close(); // does not delete objects whose pointers are contained in the array
+    delete iListBox;
+    }
+
+// ----------------------------------------------------------------------------
+// CTestSetMenuContainer::SizeChanged
+// 
+// Called by framework when the view size is changed.
+// ----------------------------------------------------------------------------
+//
+void CTestSetMenuContainer::SizeChanged()
+    {
+    if ( iListBox )
+		{
+		iListBox->SetRect( Rect() ); // Sets rectangle of listbox.
+		}
+    }
+
+// ----------------------------------------------------------------------------
+// CTestSetMenuContainer::CountComponentControls
+// 
+// Gets a count of the component controls of this list box control.
+// ----------------------------------------------------------------------------
+//
+TInt CTestSetMenuContainer::CountComponentControls() const
+    {
+    return 1; // return nbr of controls inside this container
+    }
+
+// ----------------------------------------------------------------------------
+// CTestSetMenuContainer::ComponentControl
+// 
+// Gets a pointer to the specified component control.
+// ----------------------------------------------------------------------------
+//
+CCoeControl* CTestSetMenuContainer::ComponentControl(TInt aIndex) const
+    {
+    switch ( aIndex )
+        {
+		case 0: 
+			return iListBox;
+        default:
+            return NULL;
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// CTestSetMenuContainer::Draw
+// 
+// Draw a control, called by window server.
+// ----------------------------------------------------------------------------
+//
+void CTestSetMenuContainer::Draw(const TRect& /*aRect*/) const
+    {
+    // CWindowGc& gc = SystemGc();
+    }
+
+// ----------------------------------------------------------------------------
+// CTestSetMenuContainer::SelectedTestCases
+// 
+// Returns pointers to selected test cases.
+// ----------------------------------------------------------------------------
+//
+void CTestSetMenuContainer::SelectedTestCases
+                            (RPointerArray<CTestInfo>& aSelectedTestCases)
+    {
+    aSelectedTestCases.Append( iTestCasesInView[iListBox->CurrentItemIndex()] );
+    }
+
+// ----------------------------------------------------------------------------
+// CTestSetMenuContainer::OfferKeyEventL
+// 
+// Handles key events.
+// ----------------------------------------------------------------------------
+//
+TKeyResponse CTestSetMenuContainer::OfferKeyEventL(
+	const TKeyEvent& aKeyEvent, TEventCode aType )
+    {
+	if (aType != EEventKey)
+	    {
+		return EKeyWasNotConsumed;
+	    }
+
+	if (iListBox)
+		{
+		//if multiple items selected
+		if ( iListBox->SelectionIndexes()->Count() > 0 )
+			{
+			TUint mask = 0x40488;
+			
+			//if event is enter key,
+			//don´t send it to listbox
+			if ( aKeyEvent.iScanCode == 0xa7 
+				&& ( aKeyEvent.iModifiers & mask ) == 0 )
+				{
+				iParentView->HandleListBoxEventL( iListBox, MEikListBoxObserver::EEventEnterKeyPressed );
+				return EKeyWasConsumed;	
+				}
+			}
+			
+		return iListBox->OfferKeyEventL( aKeyEvent, aType );
+		}
+	else
+		{
+		return EKeyWasNotConsumed;
+		}
+    }
+    
+// ----------------------------------------------------------------------------
+// CTestSetMenuContainer::HandleMarkCommandL
+// 
+// Handles mark commands.
+// ----------------------------------------------------------------------------
+//
+void CTestSetMenuContainer::HandleMarkCommandL( TInt aCommand )
+	{
+	if (iListBox)
+		{
+		AknSelectionService::HandleMarkableListProcessCommandL( aCommand, iListBox );		
+		}
+	}
+
+// ----------------------------------------------------------------------------
+// CTestSetMenuContainer::ProcessCommandL
+// 
+// Processes user commands.
+// ----------------------------------------------------------------------------
+//
+void CTestSetMenuContainer::ProcessCommandL( TInt  aCommand )
+	{
+	AknSelectionService::HandleMarkableListProcessCommandL( aCommand, iListBox );
+    }
+    
+// ----------------------------------------------------------------------------
+// CTestSetMenuContainer::SelectionListProcessCommandL
+// 
+// Processes user commands.
+// ----------------------------------------------------------------------------
+//    
+void CTestSetMenuContainer::SelectionListProcessCommandL( TInt  aCommand )
+	{
+	AknSelectionService::HandleSelectionListProcessCommandL( aCommand, iListBox );
+    }
+    
+// ----------------------------------------------------------------------------
+// CTestSetMenuContainer::FilterCasesByModuleL
+// 
+// Show only testcases which are defined is specified module.
+// ----------------------------------------------------------------------------
+//
+void CTestSetMenuContainer::FilterCasesByModuleL( TName aModuleName )
+    {
+    iTestCasesInView.Reset(); // Clear testCasesInView pointer array
+   
+    RRefArray<CTestInfo> allCases;
+    TInt ret = iUIStore->TestCases( allCases );
+    if( KErrNone != ret )
+        {
+        ((CAppUIAppUi*)iCoeEnv->AppUi())->iLogger->Log(_L("FilterCasesByModuleL(): iUIStore->TestCases() fails"));
+        allCases.Reset();
+        allCases.Close();
+        User::Leave( ret );
+        }
+    const TInt KTestCaseCount = allCases.Count();
+    for( TInt i=0; i < KTestCaseCount; i++ )
+        {
+        if ( allCases[i].ModuleName() == aModuleName )
+            {
+            iTestCasesInView.Append( &( allCases[i] ) );
+            }
+        }
+    allCases.Reset();
+    allCases.Close();
+
+    iListBox->Reset();
+    iListBox->DrawNow();
+    }
+
+// ----------------------------------------------------------------------------
+// CTestSetMenuContainer::FilterCasesByTCFileNameL
+// 
+// Show only testcases which are defined is specified test case file.
+// ----------------------------------------------------------------------------
+//
+void CTestSetMenuContainer::FilterCasesByTCFileNameL( 
+                                                TFileName aTestCaseFileName )
+    {
+
+    iTestCasesInView.Reset(); // Clear testCasesInView pointer array
+  
+    RRefArray<CTestInfo> allCases;
+    TInt ret = iUIStore->TestCases( allCases );
+    if( KErrNone != ret )
+        {
+        ((CAppUIAppUi*)iCoeEnv->AppUi())->iLogger->Log(_L("FilterCasesByModuleL(): iUIStore->TestCases() fails"));
+        allCases.Reset();
+        allCases.Close();
+        User::Leave( ret );
+        }
+    const TInt KTestCaseCount = allCases.Count();
+    for( TInt i=0; i < KTestCaseCount; i++ )
+        {
+        if ( allCases[i].TestCaseFile() == aTestCaseFileName )
+            {
+            iTestCasesInView.Append( &( allCases[i] ) );
+            }
+        }
+
+    allCases.Reset();
+    allCases.Close();
+
+    iListBox->Reset();
+    iListBox->DrawNow();
+    }
+
+// ----------------------------------------------------------------------------
+// CTestSetMenuContainer::NoFilteringL
+// 
+// Remove possible filtering of test cases -> show all test cases.
+// ----------------------------------------------------------------------------
+//
+void CTestSetMenuContainer::NoFilteringL()
+    {
+    iTestCasesInView.Reset(); // Clear testCasesInView pointer array
+
+    RRefArray<CTestInfo> allCases;
+    TInt ret = iUIStore->TestCases( allCases );
+    if( KErrNone != ret )
+        {
+        ((CAppUIAppUi*)iCoeEnv->AppUi())->iLogger->Log(_L("FilterCasesByModuleL(): iUIStore->TestCases() fails"));
+        allCases.Reset();
+        allCases.Close();
+        User::Leave( ret );
+        }
+    const TInt KTestCaseCount = allCases.Count();
+
+    // Add all cases to iTestCasesInView pointer array
+    for( TInt i=0; i < KTestCaseCount; i++ )
+        {
+        iTestCasesInView.Append( &( allCases[i] ) );
+        }
+
+    allCases.Reset();
+    allCases.Close();
+
+    iListBox->Reset();
+    iListBox->DrawNow();
+    }
+
+// ----------------------------------------------------------------------------
+// CTestSetMenuContainer::RemoveListBoxItemsL
+// 
+// Removes items from list box.
+// ----------------------------------------------------------------------------
+//
+void CTestSetMenuContainer::RemoveListBoxItemL( TInt aSelected )
+	{
+	TInt currentItem(0);
+    TBool remCurr(EFalse);
+	
+	currentItem = iListBox->CurrentItemIndex();
+	if( aSelected == currentItem )
+	    {
+	    remCurr = ETrue;
+	    }
+	    
+	iTestCasesInView.Remove( aSelected );
+	AknListBoxUtils::HandleItemRemovalAndPositionHighlightL(iListBox, aSelected, remCurr);
+	 iListBox->HandleItemAdditionL();
+	}
+
+// ----------------------------------------------------------------------------
+// CTestSetMenuContainer::SaveActiveLine
+//
+// Makes the iListBox member save its focus position
+// ----------------------------------------------------------------------------
+//	
+void CTestSetMenuContainer::SaveActiveLine()
+	{
+	((CMenuListBox*)iListBox)->SaveFocusPosition();
+	}
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/avkon/stifui/src/TestSetMenuView.cpp	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,553 @@
+/*
+* 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 file contains CTestSetMenuView class ddefinition.
+*
+*/
+
+// INCLUDE FILES
+#include  <eikmenub.h>
+#include  <aknViewAppUi.h>
+#include  <aknlistquerydialog.h> 
+#include  <aknnotewrappers.h>
+#include  <barsread.h>              //TResourceReader
+#include  <Stifui.rsg>
+#include  "TestSetMenuView.h"
+#include  "TestSetMenuContainer.h"
+#include  "AppUIAppUi.h"
+#include  "Stifui.hrh" 
+
+
+
+// ================= MEMBER FUNCTIONS =========================================
+// ----------------------------------------------------------------------------
+// CTestSetMenuView::ConstructL
+// 
+// Symbian OS two-phased constructor.
+// ----------------------------------------------------------------------------
+//
+void CTestSetMenuView::ConstructL()
+    {
+    CView::ConstructL();
+    BaseConstructL( R_APPUI_TESTSETMENUVIEW );
+    iCurrentTestCase = 0;
+    iSaveNeeded = ETrue;
+    iUIStore = ( (CAppUIAppUi*)iCoeEnv->AppUi() )->UIStoreHandler();
+    }
+
+// ----------------------------------------------------------------------------
+// CTestSetMenuView::~CTestSetMenuView
+// 
+// Destructor.
+// ----------------------------------------------------------------------------
+//
+CTestSetMenuView::~CTestSetMenuView()
+    {
+    if ( iContainer )
+        {
+        AppUi()->RemoveFromViewStack( *this, iContainer );
+        delete iContainer;
+        }
+    delete iNaviDecorator;
+    iNaviDecorator = NULL;
+    }
+
+// ----------------------------------------------------------------------------
+// CTestSetMenuView::Id
+// 
+// Returns view´s id.
+// ----------------------------------------------------------------------------
+//
+TUid CTestSetMenuView::Id() const
+    {
+    return TUid::Uid(ETestSetMenuViewId);
+    }
+
+// ----------------------------------------------------------------------------
+// CTestSetMenuView::HandleCommandL
+// 
+// Handles a command.
+// ----------------------------------------------------------------------------
+//
+void CTestSetMenuView::HandleCommandL(TInt aCommand)
+    {   
+    if ( aCommand == EAknCmdMark || aCommand == EAknCmdUnmark 
+        || aCommand == EAknMarkAll || aCommand == EAknUnmarkAll )
+        {
+        iContainer->HandleMarkCommandL( aCommand );
+        }
+    else
+        {
+        switch ( aCommand )
+            {
+            case ECmdStartTestSet:
+                {
+                const CTestSetInfo& testSetInfo = 
+                    iUIStore->TestSetL( iCurrentTestSet );
+                const RRefArray<const CTestInfo>* allCases = 
+                    &testSetInfo.TestCases();
+                
+                TInt testCaseCount = allCases->Count();
+                if (testCaseCount > 0 )
+                    {
+                    StartTestSetL();
+                    }
+                break;
+                }
+            case ECmdShowStartedTestSet:
+                {
+                AppUi()->HandleCommandL(ECmdShowStartedTestSet);
+                break;
+                }
+            case ECmdSaveTestSet:
+                {
+                SaveCurrentTestSetL();
+                break;
+                }
+            case ECmdInsertTestCases:
+                {
+                // iSaveNeeded is set from 
+                // CTestSetInsertMenuView::ShowInsertCasesDialog()
+                //iSaveNeeded = ETrue;
+                AppUi()->HandleCommandL(ECmdInsertTestCases);
+                break;
+                }
+            case ECmdRemoveTestCases:
+                {
+                RemoveSelectedTestCasesL();
+                break;
+                }
+            case EAknSoftkeyBack:
+                {
+                //iCurrentTestCase = 0;
+               // AppUi()->HandleCommandL(ECmdLoadTestSet/*EAppUIGoToTestSetsMenu*/);
+                //( (CEikAppUi*)iCoeEnv->AppUi() )->HandleCommandL(EAppUIGoToTestSetsMenu);
+                SaveCurrentTestSetL();
+                break;
+                }
+            default:
+                {
+                AppUi()->HandleCommandL( aCommand );
+                break;
+                }
+            }
+        }
+
+    }
+
+// ----------------------------------------------------------------------------
+// CTestSetMenuView::HandleClientRectChange
+// 
+// Handles client rect changes.
+// ----------------------------------------------------------------------------
+//
+void CTestSetMenuView::HandleClientRectChange()
+    {
+    if ( iContainer )
+        {
+        iContainer->SetRect( ClientRect() );
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// CTestSetMenuView::DoActivateL
+// 
+// Initializes view when activated.
+// ----------------------------------------------------------------------------
+//
+void CTestSetMenuView::DoActivateL(
+   const TVwsViewId& /*aPrevViewId*/,TUid /*aCustomMessageId*/,
+   const TDesC8& /*aCustomMessage*/)
+    {
+    if (!iContainer)
+        {
+        ((CAppUIAppUi*)AppUi())->iLogger->Log( 
+            _L("TestSetMenuView: DoActivateL") );
+        iContainer = new (ELeave) CTestSetMenuContainer;
+        iContainer->SetMopParent(this);
+        iContainer->ConstructL( ClientRect(), this );
+        ((CAppUIAppUi*)AppUi())->iLogger->Log( 
+            _L("TestSetMenuView: container constructed") );
+        AppUi()->AddToStackL( *this, iContainer );
+        }
+   
+    //testing
+    iContainer->SetCurrentItemIndex(iCurrentTestCase);
+    
+    CEikStatusPane* sp=iEikonEnv->AppUiFactory()->StatusPane();
+    CAknNavigationControlContainer* np = 
+        (CAknNavigationControlContainer *)sp->ControlL(
+        TUid::Uid(EEikStatusPaneUidNavi));
+    
+    TResourceReader reader;
+    iCoeEnv->CreateResourceReaderLC(reader,R_NAVITITLE_TESTSET );
+    iNaviDecorator = np->CreateNavigationLabelL( reader );
+    CleanupStack::PopAndDestroy(); // resource reader
+    np->PushL(*iNaviDecorator);
+
+    }
+
+// ----------------------------------------------------------------------------
+// CTestSetMenuView::DoDeactivate
+// 
+// Deactivates view.
+// ----------------------------------------------------------------------------
+//
+void CTestSetMenuView::DoDeactivate()
+    {
+    if ( iContainer )
+        {
+        iContainer->SaveActiveLine();
+        AppUi()->RemoveFromViewStack( *this, iContainer );
+        delete iContainer;
+        iContainer = NULL;
+        }
+    delete iNaviDecorator;
+    iNaviDecorator = NULL;
+    }
+
+
+// ----------------------------------------------------------------------------
+// CTestSetMenuView::DynInitMenuPaneL
+// 
+// Initializes menu pane.
+// ----------------------------------------------------------------------------
+//
+void CTestSetMenuView::DynInitMenuPaneL(
+    TInt aResourceId, CEikMenuPane* aMenuPane)
+    {
+
+    // Test modules are added to filter by test module submenu 
+    // if the submenu is opened
+    if (R_APPUI_FILTERBYMODULES_MENU == aResourceId)
+        {
+        RRefArray<TDesC> modules;
+        TInt ret = iUIStore->Modules( modules );
+        if( KErrNone != ret )
+            {
+            modules.Reset();
+            modules.Close();
+            User::Leave( ret );
+            }
+
+        TInt moduleCount = modules.Count();
+        
+        TInt i;
+        CEikMenuPaneItem::SData item;
+
+        item.iCommandId = ECmdFilterByModule;
+        item.iFlags = 0;
+        item.iCascadeId = 0;
+
+        for (i = 0; i < moduleCount; i++)
+            {
+            item.iText = modules[i];
+            aMenuPane->AddMenuItemL(item);
+            item.iCommandId++; // Command IDs 0x1000 - 0x1FFF are reserved
+                               // for modules in hrh file.
+            }
+        
+        modules.Reset();
+        modules.Close();
+        }
+
+    // Test case files are added to filter by test case file submenu
+    // if the submenu is opened.
+    if (R_APPUI_FILTER_BY_TESTCASEFILE_MENU == aResourceId)
+        {
+        RRefArray<TDesC> testCaseFiles;
+        TInt ret = iUIStore->TestCaseFiles( testCaseFiles );
+        if( KErrNone != ret )
+            {
+            testCaseFiles.Reset();
+            testCaseFiles.Close();
+            User::Leave( ret );
+            }
+
+        TInt testCaseFileCount = testCaseFiles.Count();
+
+        TInt i;
+        CEikMenuPaneItem::SData item;
+
+        item.iCommandId = ECmdFilterByTestCaseFile;
+        item.iFlags = 0;
+        item.iCascadeId = 0;
+
+        for (i = 0; i < testCaseFileCount; i++)
+            {
+            item.iText = testCaseFiles[i];
+            aMenuPane->AddMenuItemL(item);
+            item.iCommandId++; // Command IDs 0x2000 - 0x2FFF are reserved for
+                               // test case files in hrh file.
+            }
+        }
+        
+    }
+
+// ----------------------------------------------------------------------------
+// CTestSetMenuView::HandleListBoxEventL
+// 
+// Handles listbox events.
+// ----------------------------------------------------------------------------
+//
+void CTestSetMenuView::HandleListBoxEventL(CEikListBox* /*aListBox*/, 
+    TListBoxEvent aEventType)
+    {
+
+    if ( ( aEventType == EEventEnterKeyPressed ) || ( aEventType == EEventItemDoubleClicked ) )
+        {
+        const CTestSetInfo& testSetInfo = 
+            iUIStore->TestSetL( iCurrentTestSet );
+        const RRefArray<const CTestInfo>* allCases = &testSetInfo.TestCases();
+
+        TInt testCaseCount = allCases->Count();
+           if (testCaseCount > 0 )
+            {
+            StartTestSetL();
+            }
+        }
+   }
+ 
+// ----------------------------------------------------------------------------
+// CTestSetMenuView::CreateTestSet
+// 
+// Creates new test set.
+// ----------------------------------------------------------------------------
+//
+TInt CTestSetMenuView::CreateTestSetL( const TDesC& aTestSetName )
+    {
+    TInt error = 0;
+    TBuf<100> message;
+    
+    _LIT(KPath, "c:\\TestFramework\\");
+    RFs fs;
+    User::LeaveIfError(fs.Connect());
+    CleanupClosePushL(fs);
+    TEntry entry;
+    // we check if the c:\testframework directory exists
+    // It is mandatory for this dir to exist if we want to save a test set.
+    // This dir must be localised on the C drive of the device
+    if(fs.Entry(KPath, entry) != KErrNone)
+    	{	// if the dir does not exist 
+    	TInt err = fs.MkDirAll(KPath);	// we create it
+    	if(err != KErrNone)
+    		{	// if of any reason it was impossible to create the dir - inform user about it
+	    	CAknInformationNote* note = new (ELeave) CAknInformationNote(ETrue);
+	    	note->ExecuteLD( _L("Could not create c:\\TestFramework dir!") );
+    		}
+    	}
+    CleanupStack::PopAndDestroy(&fs);	// close and remove RFs object 
+    
+    error = iUIStore->LoadTestSet( aTestSetName );
+    
+    // If testset is either active or already created and saved.
+ /*   if ( KErrNone == error)// || KErrAlreadyExists == error )
+        {
+        CEikonEnv::Static()->ReadResource( message, 
+            R_OVERWRITE_TESTSET_QUESTION );
+        CAknQueryDialog * dlg = 
+            CAknQueryDialog::NewL(CAknQueryDialog::ENoTone);
+        // Confirm overwrite
+        if ( dlg->ExecuteLD( R_GENERAL_CONFIRMATION_DIALOG, message ) )
+            {
+            error = iUIStore->RemoveTestSet( aTestSetName );
+            error = iUIStore->CreateTestSet( aTestSetName );
+            if ( error == KErrNone )
+                {
+                iCurrentTestSet = aTestSetName;
+                iSaveNeeded = ETrue;
+                }
+            }
+        // Else load saved default test set
+        else
+            {
+            iSaveNeeded = EFalse;
+            iCurrentTestSet = aTestSetName;
+            error = KErrAlreadyExists;
+            }
+        }
+    else if ( KErrNotFound == error )
+        {
+        error = iUIStore->CreateTestSet( aTestSetName );
+        if ( KErrNone == error )
+            {
+            iCurrentTestSet = aTestSetName;
+            iSaveNeeded = ETrue;
+            }
+        }
+    else if ( KErrPathNotFound == error )
+          {
+          error = iUIStore->CreateTestSet( aTestSetName );
+          iCurrentTestSet = aTestSetName;
+          iSaveNeeded = EFalse;
+          }
+    else
+        {
+        ((CAppUIAppUi*)AppUi())->iLogger->Log(_L("Test set creation fails with error: %d"), error );
+        CAknInformationNote* informationNote = new (ELeave) CAknInformationNote(ETrue);
+        informationNote->ExecuteLD( _L("UNDEFINED ERROR!") );
+        }*/
+    
+    error = iUIStore->CreateTestSet( aTestSetName );
+    iCurrentTestSet = aTestSetName;
+    iSaveNeeded = ETrue;
+    return error;
+    }
+
+// ----------------------------------------------------------------------------
+// CTestSetMenuView::LoadTestSetL
+// 
+// Loads saved test set.
+// ----------------------------------------------------------------------------
+//
+TInt CTestSetMenuView::LoadTestSetL( const TDesC& aTestSetName )
+    {
+    TInt error = 0;
+    TBuf<100> message;
+    error = iUIStore->LoadTestSet( aTestSetName );
+    if ( KErrNone == error || KErrAlreadyExists == error )
+        {
+        iCurrentTestSet = aTestSetName;
+        iSaveNeeded = EFalse;
+        }
+    else
+        {
+        CEikonEnv::Static()->ReadResource( message, 
+            R_LOAD_TESTSET_FAILED );
+        
+        CAknInformationNote* informationNote = new (ELeave) CAknInformationNote(ETrue);
+        informationNote->ExecuteLD(message);
+        }
+    
+    return error;
+    }
+
+// ----------------------------------------------------------------------------
+// CTestSetMenuView::SaveCurrentTestSet
+// 
+// Saves current test set.
+// ----------------------------------------------------------------------------
+//
+TInt CTestSetMenuView::SaveCurrentTestSetL()
+    {
+    TInt error = 0;
+    TBuf<100> message;
+    
+    CEikonEnv::Static()->ReadResource( message, 
+        R_SAVE_TESTSET_QUESTION );
+        
+    CAknQueryDialog * dlg = 
+        CAknQueryDialog::NewL(CAknQueryDialog::ENoTone);
+    
+   if ( dlg->ExecuteLD( R_GENERAL_CONFIRMATION_DIALOG, message ) )
+       {
+        error = iUIStore->SaveTestSet2( iCurrentTestSet );
+        iSaveNeeded = EFalse;
+        
+      }
+   AppUi()->HandleCommandL(EAppUIGoBack);
+
+    return error;
+    }
+
+// ----------------------------------------------------------------------------
+// CTestSetMenuView::RemoveActiveTestSet
+// 
+// Removes current test set.
+// ----------------------------------------------------------------------------
+//
+TInt CTestSetMenuView::RemoveActiveTestSet()
+    {
+    TInt error = 0;
+    
+    error = iUIStore->RemoveTestSet( iCurrentTestSet );
+    
+    return error;
+    }
+
+// ----------------------------------------------------------------------------
+// CTestSetMenuView::StartTestSetL
+// 
+// Shows confirmation dialog and verify if user really want to start test set.
+// ----------------------------------------------------------------------------
+//
+void CTestSetMenuView::StartTestSetL()
+    {
+    _LIT( KErrorStartingTestSet, 
+        "TestSetMenuView: StartTestSetL() fails (%d)" );
+    
+    TInt ret(KErrNone);
+    TInt index(0);
+    TInt selectedItem(0);
+    
+    // Default mode is parallel.
+    CStartedTestSet::TSetType mode = CStartedTestSet::ESetParallel;
+    
+    CAknListQueryDialog* startDialog = 
+        new (ELeave) CAknListQueryDialog(&selectedItem);
+    
+    // Show confirmation dialog.
+    if ( startDialog->ExecuteLD(R_START_MULTIPLE_TESTCASES_LIST_QUERY) )
+        {
+        index = ((CAppUIAppUi*)AppUi())->iStartedTestSet;
+        // Check mode
+        if ( 1 == selectedItem )
+            {
+            mode = CStartedTestSet::ESetSequential;
+            }
+        
+        // Start test set cases.
+        ret = iUIStore->StartTestSet( 
+            iUIStore->TestSetL( iCurrentTestSet ), index, mode );
+            
+        if ( ret != KErrNone )
+            {
+            ((CAppUIAppUi*)AppUi())->iStartedTestSet = -1;
+            ((CAppUIAppUi*)AppUi())->iLogger->Log( 
+                KErrorStartingTestSet, ret );
+            }
+        else
+            {
+            ((CAppUIAppUi*)AppUi())->iStartedTestSet = index;
+            }
+        }
+        
+    }
+   
+// ----------------------------------------------------------------------------
+// CTestSetMenuView::RemoveSelectedTestCasesL
+// 
+// Removes marked test cases from test set.
+// ----------------------------------------------------------------------------
+//
+void CTestSetMenuView::RemoveSelectedTestCasesL()
+    {
+    TInt positionToRemove(0);
+    
+    const CTestSetInfo& testSetInfo = iUIStore->TestSetL( iCurrentTestSet );
+    const RRefArray<const CTestInfo>* allCases = &testSetInfo.TestCases();
+    CEikListBox* listBox = iContainer->ListBox();
+
+    iSaveNeeded = ETrue;
+    positionToRemove = listBox->CurrentItemIndex();
+    // Remove selected test case from test set.
+    TInt ret = iUIStore->RemoveFromTestSet(iCurrentTestSet, allCases->operator[](positionToRemove));
+    iContainer->RemoveListBoxItemL(positionToRemove);
+    
+    if( ret != KErrNone )
+        {
+        RDebug::Print( _L("RemoveFromTestSet failed with value: %d"), ret );
+        }
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/avkon/stifui/src/TestSetStartedCasesContainer.cpp	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,465 @@
+/*
+* 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 file contains CTestSetStartedCasesContainer 
+* class definition.
+*
+*/
+
+// INCLUDE FILES
+
+#include <aknlists.h>  // ListBox
+#include <AknIconArray.h>  // CAknIconArray
+#include <badesca.h> // CDesCArray
+#include <eikclbd.h> // CColumnListBoxData
+#include <aknnotewrappers.h>
+
+#include <Stifui.rsg>
+
+//#include "UIStoreIf.h"         
+//#include "UIStore.h"            
+//#include "UIEngine.h"           
+//#include "UIEngineContainer.h"  
+
+#include <stifinternal/UIStoreIf.h>
+#include <stifinternal/UIStore.h>
+#include <stifinternal/UIEngine.h>
+#include <stifinternal/UIEngineContainer.h>
+
+#include "TestSetStartedCasesContainer.h"
+#include "ShowStartedCasesContainer.h"
+#include "Stifui.hrh"
+#include "AppUIAppUi.h"
+
+#include "MenuListBox.h"
+
+// ================= MEMBER FUNCTIONS =======================
+// ----------------------------------------------------------------------------
+// CTestSetStartedCasesContainer::ConstructL
+// 
+// Symbian OS two phased constructor.
+// ----------------------------------------------------------------------------
+//
+void CTestSetStartedCasesContainer::ConstructL(const TRect& aRect, MEikListBoxObserver* aListBoxObserver)
+    {
+    CreateWindowL();
+
+    iUIStore = ( (CAppUIAppUi*)iCoeEnv->AppUi() )->UIStoreHandler();
+    
+	iListBox = CMenuListBox::NewL(ETestSetStartedCasesViewId); /*CAknSingleStyleListBox();*/
+	iListBox->SetContainerWindowL( *this );
+	iListBox->SetListBoxObserver( aListBoxObserver );
+    iListBox->ConstructL(this, EAknListBoxSelectionList);
+
+    //Create Scroller control for ListBox and set its visibility
+    iListBox->CreateScrollBarFrameL(ETrue);
+    iListBox->ScrollBarFrame()->SetScrollBarVisibilityL(CEikScrollBarFrame::EOff,CEikScrollBarFrame::EAuto);
+
+    if ( iUIStore )
+        {
+        
+        iListBoxModel = CStartedTestsListBoxModel::NewL( &iStartedTestsPtrs );
+        iListBox->Model()->SetItemTextArray(iListBoxModel);
+        ConstructListBoxModelL();
+        iListBox->Model()->SetOwnershipType(ELbmOwnsItemArray);
+        iListBox->HandleItemAdditionL();
+
+        }
+    else
+        {
+        //User::Leave( syy?? )
+        }
+	iListBox->ActivateL();
+	((CMenuListBox*)iListBox)->SetPreviousFocus();
+
+    SetRect(aRect);
+    ActivateL();
+
+    }
+
+// ----------------------------------------------------------------------------
+// CTestSetStartedCasesContainer::ConstructListBoxModelL
+// 
+// Constructs list box model without any filtering.
+// ----------------------------------------------------------------------------
+//
+void CTestSetStartedCasesContainer::ConstructListBoxModelL()
+    {
+    TInt items(0);
+    TInt index = ((CAppUIAppUi*)iCoeEnv->AppUi())->iStartedTestSet;
+    
+    // Check if there is started test sets and if there is,
+    // show test set´s info.
+    if ( index != -1 )
+        {
+        const RRefArray<CStartedTestCase>* startedTestCases;
+        CStartedTestSet* startedTestSet =
+     	    &iUIStore->StartedTestSetL( index );
+        startedTestCases = &startedTestSet->TestCases();
+        
+        const TInt KStartedCaseCount = startedTestCases->Count();
+
+        items = iStartedTestsPtrs.Count();
+        iStartedTestsPtrs.Reset(); // Remove all pointers (does not delete objects)
+        iListBox->HandleItemRemovalL();
+        
+        const TInt KSelectedMode = ((CAppUIAppUi*)iCoeEnv->AppUi())->iShowStartedCasesMode;
+        
+        // Loop through all started cases
+        for( TInt i=0; i < KStartedCaseCount; i++ )
+            {
+            switch ( KSelectedMode )
+                {
+                case EShowAllStartedCases:
+                    {
+                    iStartedTestsPtrs.Append( startedTestCases->operator[](i) );
+                    break;
+                    }
+                case EShowOngoingCases:
+                    {
+                    // Note: PAUSE IS ALSO RUNNIN STATUS
+                    if ( startedTestCases->operator[](i).Status() & CUIStoreIf::EStatusRunning )
+                        {
+                        iStartedTestsPtrs.Append( startedTestCases->operator[](i) );
+                        }
+                    break;
+                    }
+                case EShowPassedCases:
+                    {
+                    if ( startedTestCases->operator[](i).Status() & CUIStoreIf::EStatusPassed )
+                        {
+                        iStartedTestsPtrs.Append( startedTestCases->operator[](i) );
+                        }
+                    break;
+                    }
+                case EShowPausedCases:
+                    {
+                    if ( startedTestCases->operator[](i).Status() & CUIStoreIf::EStatusRunning )
+                        {
+                        if( startedTestCases->operator[](i).UIEngineContainer().State() == CUIEngineContainer::EPaused )
+                            {
+                            iStartedTestsPtrs.Append( startedTestCases->operator[](i) );
+                            }
+                        }
+                    break;
+                    }
+                case EShowFailedCases:
+                    {
+                    if ( startedTestCases->operator[](i).Status() & CUIStoreIf::EStatusFailed )
+                        {
+                        iStartedTestsPtrs.Append( startedTestCases->operator[](i) );
+                        }
+                    break;
+                    }
+                case EShowCrashedAbortedCases:
+                    {
+                    if ( startedTestCases->operator[](i).Status() & CUIStoreIf::EStatusAborted
+                    		||
+                    	 startedTestCases->operator[](i).Status() & CUIStoreIf::EStatusCrashed)
+                        {
+                        iStartedTestsPtrs.Append( startedTestCases->operator[](i) );
+                        }
+                    break;
+                    }
+                }
+        }   
+
+        if ( items < iStartedTestsPtrs.Count() )
+            {
+            iListBox->HandleItemAdditionL();
+            }
+        else
+            {
+            iListBox->HandleItemRemovalL();
+            }
+           
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// CTestSetStartedCasesContainer::~CTestSetStartedCasesContainer
+// 
+// Destructor.
+// ----------------------------------------------------------------------------
+//
+CTestSetStartedCasesContainer::~CTestSetStartedCasesContainer()
+    {
+    delete iListBox;
+    
+    iStartedTestsPtrs.Close(); // does not delete objects whose pointers are contained in the array
+    
+    }
+
+// ----------------------------------------------------------------------------
+// CTestSetStartedCasesContainer::SizeChanged
+// 
+// Called by framework when the view size is changed.
+// ----------------------------------------------------------------------------
+//
+void CTestSetStartedCasesContainer::SizeChanged()
+    {
+    if ( iListBox )
+		{
+		iListBox->SetRect( Rect() ); // Sets rectangle of listbox.
+		}
+    }
+
+// ----------------------------------------------------------------------------
+// CTestSetStartedCasesContainer::CountComponentControls
+// 
+// Gets a count of the component controls of this list box control.
+// ----------------------------------------------------------------------------
+//
+TInt CTestSetStartedCasesContainer::CountComponentControls() const
+    {
+    return 1; // return nbr of controls inside this container
+    }
+
+// ----------------------------------------------------------------------------
+// CTestSetStartedCasesContainer::ComponentControl
+// 
+// Gets a pointer to the specified component control.
+// ----------------------------------------------------------------------------
+//
+CCoeControl* CTestSetStartedCasesContainer::ComponentControl(TInt aIndex) const
+    {
+    switch ( aIndex )
+        {
+		case 0: 
+			return iListBox;
+        default:
+            return NULL;
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// CTestSetStartedCasesContainer::Draw
+// 
+// Draw a control, called by window server.
+// ----------------------------------------------------------------------------
+//
+void CTestSetStartedCasesContainer::Draw(const TRect& /*aRect*/) const
+    {
+    // CWindowGc& gc = SystemGc();
+    }
+
+// ----------------------------------------------------------------------------
+// CTestSetStartedCasesContainer::OfferKeyEventL
+// 
+// Handles key events.
+// ----------------------------------------------------------------------------
+//
+TKeyResponse CTestSetStartedCasesContainer::OfferKeyEventL(
+	const TKeyEvent& aKeyEvent, TEventCode aType)
+    {
+    if (aType != EEventKey)
+    {
+		return EKeyWasNotConsumed;
+	}
+
+	if (iListBox)
+		{
+		return iListBox->OfferKeyEventL( aKeyEvent, aType );
+		}
+	else
+		{
+		return EKeyWasNotConsumed;
+		}
+
+    }
+
+// ----------------------------------------------------------------------------
+// CTestSetStartedCasesContainer::SelectedTestCase
+// 
+// Returns reference to currently selected test case in view (listbox).
+// ----------------------------------------------------------------------------
+//
+CStartedTestCase* CTestSetStartedCasesContainer::SelectedTestCase()
+    {
+    if ( iStartedTestsPtrs.Count() > 0 )
+        {
+        return &(iStartedTestsPtrs[ iListBox->CurrentItemIndex() ]);
+        }
+    else
+        {
+        return NULL;
+        }
+/*
+    //if ( iListBox->ItemExists(0)  ) // Check that list box is not empty
+    if ( ((CStartedTestsListBoxModel*)iListBox->Model())->MdcaCount()  ) // Check that list box is not empty
+        {
+        return &(iStartedTestsPtrs[ iListBox->CurrentItemIndex() ]);
+        }
+    else
+        {
+        return NULL;
+        }
+*/
+    }
+
+// ----------------------------------------------------------------------------
+// CTestSetStartedCasesContainer::DrawListBox
+// 
+// Draws the list box.
+// ----------------------------------------------------------------------------
+//
+void CTestSetStartedCasesContainer::DrawListBox()
+    {
+    if ( iListBox )
+        {
+        iListBox->DrawNow();
+        }
+
+    }
+
+// ----------------------------------------------------------------------------
+// CTestSetStartedCasesContainer::HandleItemAdditionL
+// 
+// Handles the addition of an item to the model.
+// ----------------------------------------------------------------------------
+//
+void CTestSetStartedCasesContainer::HandleItemAdditionL()
+    {
+    iListBox->HandleItemAdditionL();
+
+    }
+
+// ----------------------------------------------------------------------------
+// CTestSetStartedCasesContainer::HandleItemRemovalL
+// 
+// Handles the removal of an item from the model.
+// ----------------------------------------------------------------------------
+//
+void CTestSetStartedCasesContainer::HandleItemRemovalL()
+    {
+    //TInt itemIndexBeforeRemoval = iListBox->CurrentItemIndex();
+
+    iListBox->HandleItemRemovalL();
+
+    // HandleItemRemovalL "loses selection" if current item is removed
+    // -> we have to check it and set one item as current item to make it possible for
+    // user to select one item from items left after remove
+    if ( iListBox->CurrentItemIndex() == -1 ) // No item selected
+        if ( ((CStartedTestsListBoxModel*)iListBox->Model())->MdcaCount() > 0 ) // there are items
+            SetCurrentItemIndex(0);
+
+    }
+
+// ----------------------------------------------------------------------------
+// CTestSetStartedCasesContainer::TestsInViewCount
+// 
+// Returns count of test cases in view.
+// ----------------------------------------------------------------------------
+//
+TInt CTestSetStartedCasesContainer::TestsInViewCount()
+    {
+    return ((CStartedTestsListBoxModel*)iListBox->Model())->MdcaCount();
+
+    }
+
+// ----------------------------------------------------------------------------
+// CTestSetStartedCasesContainer::CurrentTestCase
+// 
+// Returns pointer to currently selected test case.
+// ----------------------------------------------------------------------------
+//
+CStartedTestCase* CTestSetStartedCasesContainer::CurrentTestCase()
+    {
+    return &iStartedTestsPtrs[ iListBox->CurrentItemIndex() ];
+    }
+
+// ----------------------------------------------------------------------------
+// CTestSetStartedCasesContainer::CurrentItemIndex
+// 
+// Gets the index number of the current item in the view.
+// ----------------------------------------------------------------------------
+//
+TInt CTestSetStartedCasesContainer::CurrentItemIndex()
+    {
+    return iListBox->CurrentItemIndex();
+
+    }
+
+// ----------------------------------------------------------------------------
+// CTestSetStartedCasesContainer::SetCurrentItemIndex
+// 
+// Sets the current item.
+// ----------------------------------------------------------------------------
+//
+void CTestSetStartedCasesContainer::SetCurrentItemIndex(TInt aIndex)
+    {
+    TInt itemCount = ((CStartedTestsListBoxModel*)iListBox->Model())->MdcaCount();
+    if ( aIndex < itemCount )
+        {
+        iListBox->SetCurrentItemIndex(aIndex);
+        }
+    else
+        {
+        iListBox->SetCurrentItemIndex(itemCount);
+        }
+
+    }
+
+// ----------------------------------------------------------------------------
+// CTestSetStartedCasesContainer::ResetListBox
+// 
+// Resets the selection indices, top and current item indices,
+// the selection, and the horizontal scroll offset of this list box.
+// This function does not redraw the list box.
+// ----------------------------------------------------------------------------
+//
+void CTestSetStartedCasesContainer::ResetListBox()
+    {
+    iListBox->Reset();
+
+    }
+
+// ----------------------------------------------------------------------------
+// CTestSetStartedCasesContainer::RemoveSelectedExecutionsL
+// 
+// Removes items from list box.
+// ----------------------------------------------------------------------------
+//
+void CTestSetStartedCasesContainer::RemoveSelectedExecutionsL()
+    {
+    TInt indexOfRemovedExecution = 0;
+    iStartedTestsPtrs.Remove(indexOfRemovedExecution);
+    HandleItemRemovalL();
+
+    }
+
+// ----------------------------------------------------------------------------
+// CTestSetStartedCasesContainer::RemoveAllExecutionsInViewL
+// 
+// Removes all started test cases from list box.
+// ----------------------------------------------------------------------------
+//
+void CTestSetStartedCasesContainer::RemoveAllExecutionsInViewL()
+    {
+    iStartedTestsPtrs.Reset(); //Empties the array, does not delete the objects whose pointers are contained in the array
+    HandleItemRemovalL();
+
+    }
+
+// ----------------------------------------------------------------------------
+// CTestSetStartedCasesContainer::SaveActiveLine
+//
+// Makes the iListBox member save its focus position
+// ----------------------------------------------------------------------------
+//	
+void CTestSetStartedCasesContainer::SaveActiveLine()
+	{
+	((CMenuListBox*)iListBox)->SaveFocusPosition();
+	}
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/avkon/stifui/src/TestSetStartedCasesView.cpp	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,485 @@
+/*
+* 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 file contains CTestSetStartedCasesView class
+* definition.
+*
+*/
+
+// INCLUDE FILES
+#include  <eikmenub.h>
+#include  <aknViewAppUi.h>
+#include  <barsread.h>	//TResourceReader
+#include  <Stifui.rsg>
+
+//#include  "UIEngineContainer.h"  
+#include <stifinternal/UIEngineContainer.h>
+
+#include  "Stifui.hrh" 
+
+#include  "TestSetStartedCasesView.h"
+#include  "TestSetStartedCasesContainer.h"
+#include  "AppUIAppUi.h"
+
+// ================= MEMBER FUNCTIONS =======================
+// ----------------------------------------------------------------------------
+// CTestSetStartedCasesView::ConstructL
+// 
+// Symbian OS two-phased constructor.
+// ----------------------------------------------------------------------------
+//
+void CTestSetStartedCasesView::ConstructL()
+    {
+    CView::ConstructL();
+    BaseConstructL( R_TESTSET_STARTEDCASESVIEW );
+    iFilterModule.Zero();
+    iFilterTestCaseFile.Zero();
+    iSelectedTestCase=0;
+    iNaviDecorator = NULL;
+    }
+
+// ----------------------------------------------------------------------------
+// CTestSetStartedCasesView::~CTestSetStartedCasesView
+// 
+// Destructor.
+// ----------------------------------------------------------------------------
+//
+CTestSetStartedCasesView::~CTestSetStartedCasesView()
+    {
+    if ( iContainer )
+        {
+        AppUi()->RemoveFromViewStack( *this, iContainer );
+        delete iContainer;
+        }
+    delete iNaviDecorator;
+    iNaviDecorator = NULL;
+    }
+
+// ----------------------------------------------------------------------------
+// CTestSetStartedCasesView::Id
+// 
+// Returns view´s id.
+// ----------------------------------------------------------------------------
+//
+TUid CTestSetStartedCasesView::Id() const
+    {
+    return TUid::Uid(ETestSetStartedCasesViewId);
+    }
+
+// ----------------------------------------------------------------------------
+// CTestSetStartedCasesView::HandleCommandL
+// 
+// Handles a command.
+// ----------------------------------------------------------------------------
+//
+void CTestSetStartedCasesView::HandleCommandL(TInt aCommand)
+    {   
+	TBool refreshListBox = EFalse;
+    // Handle rest possible commands
+    switch ( aCommand )
+        {
+        case ECmdShowAllStartedCases:
+            {
+            ((CAppUIAppUi*)iCoeEnv->AppUi())->iShowStartedCasesMode = EShowAllStartedCases;
+            refreshListBox = ETrue;
+            break;
+            }
+        case ECmdShowOngoingCases:
+            {
+            ((CAppUIAppUi*)iCoeEnv->AppUi())->iShowStartedCasesMode = EShowOngoingCases;
+            refreshListBox = ETrue;
+            break;
+            }
+        case ECmdShowPausedCases:
+            {
+            ((CAppUIAppUi*)iCoeEnv->AppUi())->iShowStartedCasesMode = EShowPausedCases;
+            refreshListBox = ETrue;
+            break;
+            }
+        case ECmdShowPassedCases:
+            {
+            ((CAppUIAppUi*)iCoeEnv->AppUi())->iShowStartedCasesMode = EShowPassedCases;
+            refreshListBox = ETrue;
+            break;
+            }
+        case ECmdShowFailedCases:
+            {
+            ((CAppUIAppUi*)iCoeEnv->AppUi())->iShowStartedCasesMode = EShowFailedCases;
+            refreshListBox = ETrue;
+            break;
+            }
+        case ECmdShowCrashedAbortedCases:
+            {
+            ((CAppUIAppUi*)iCoeEnv->AppUi())->iShowStartedCasesMode = EShowCrashedAbortedCases;
+            refreshListBox = ETrue;
+            break;
+            }
+        case ECmdShowStatistics:
+            {
+            //EShowStatistics
+            TMessageBoxUtil::ShowNotImplementedYetL();
+            break;
+            }
+        case ECmdViewOutput:
+            {
+            ViewTestCaseOutputL();
+            break;
+            }
+        case ECmdPauseTestCase:
+            {
+            CStartedTestCase* startedTestCase = iContainer->SelectedTestCase();
+            if ( NULL != startedTestCase )
+                {
+                startedTestCase->UIEngineContainer().PauseTest();
+                }
+            break;
+            }
+        case ECmdResumeTestCase:
+            {
+            CStartedTestCase* startedTestCase = iContainer->SelectedTestCase();
+            if ( NULL != startedTestCase )
+                {
+                startedTestCase->UIEngineContainer().ResumeTest();
+                }
+            break;
+            }
+        case ECmdAbortTestCase:
+            {
+            CStartedTestCase* startedTestCase = iContainer->SelectedTestCase();
+            if ( NULL != startedTestCase )
+                {
+                startedTestCase->UIEngineContainer().CancelTest();
+                }
+            break;
+            }
+        case EAknSoftkeyOk:
+            {
+            iEikonEnv->InfoMsg( _L("TestCase Menu ok") );
+            break;
+            }
+        case EAknSoftkeyBack:
+            {
+            // Remove possible filterings so that they does not affect when coming again to this view
+            iFilterModule.Zero();
+            iFilterTestCaseFile.Zero();
+            iSelectedTestCase=0; //Reset selected test case information
+            AppUi()->HandleCommandL(EAppUIGoBack);
+            break;
+            }
+        default:
+            {
+            AppUi()->HandleCommandL( aCommand );
+            break;
+            }
+        }
+        
+        if ( refreshListBox )
+        	{
+        	RefreshNaviTitleL();
+        	iContainer->ConstructListBoxModelL();
+        	iContainer->DrawListBox();
+        	}
+
+    }
+    
+
+// ----------------------------------------------------------------------------
+// CTestSetStartedCasesView::RefreshNaviTitleL
+// 
+// Refreshes view name shown in the navi pane.
+// ----------------------------------------------------------------------------
+//
+void CTestSetStartedCasesView::RefreshNaviTitleL()
+    {
+    CEikStatusPane* sp=iEikonEnv->AppUiFactory()->StatusPane();
+	CAknNavigationControlContainer* np= (CAknNavigationControlContainer *)sp->ControlL(TUid::Uid(EEikStatusPaneUidNavi));
+	TResourceReader reader;
+
+    switch ( ((CAppUIAppUi*)iCoeEnv->AppUi())->iShowStartedCasesMode )
+        {
+        case EShowAllStartedCases:
+            iCoeEnv->CreateResourceReaderLC(reader,R_NAVITITLE_STARTED);
+            break;
+        case EShowOngoingCases:
+            iCoeEnv->CreateResourceReaderLC(reader,R_NAVITITLE_STARTED_ONGOING);
+            break;
+        case EShowPausedCases:
+            iCoeEnv->CreateResourceReaderLC(reader,R_NAVITITLE_STARTED_PAUSED);
+            break;
+        case EShowPassedCases:
+            iCoeEnv->CreateResourceReaderLC(reader,R_NAVITITLE_STARTED_PASSED);
+            break;
+        case EShowFailedCases:
+            iCoeEnv->CreateResourceReaderLC(reader,R_NAVITITLE_STARTED_FAILED);
+            break;
+        case EShowCrashedAbortedCases:
+            iCoeEnv->CreateResourceReaderLC(reader,R_NAVITITLE_STARTED_CRASHED_ABORTED);
+            break;
+        default:
+            iCoeEnv->CreateResourceReaderLC(reader,R_NAVITITLE_TESTSET);
+            break;
+        }
+    delete iNaviDecorator;
+    iNaviDecorator = NULL;        
+    iNaviDecorator = np->CreateNavigationLabelL( reader );
+	CleanupStack::PopAndDestroy(); // resource reader
+	np->PushL(*iNaviDecorator);
+    }
+
+// ----------------------------------------------------------------------------
+// CTestSetStartedCasesView::HandleListBoxEventL
+// 
+// Handles listbox events.
+// ----------------------------------------------------------------------------
+//
+void CTestSetStartedCasesView::HandleListBoxEventL(CEikListBox* /*aListBox*/, TListBoxEvent aEventType)
+	{
+	if ( ( aEventType == EEventEnterKeyPressed ) || ( aEventType == EEventItemDoubleClicked ) )
+		{
+        ViewTestCaseOutputL();
+        }
+
+    }
+
+// ----------------------------------------------------------------------------
+// CTestSetStartedCasesView::ViewTestCaseOutput
+// 
+// Shows outputs of test case which is selected in Container.
+// ----------------------------------------------------------------------------
+//
+void CTestSetStartedCasesView::ViewTestCaseOutputL()
+	{
+    iSelectedTestCase = iContainer->CurrentItemIndex();
+    
+    // Sets index  of selected test case to AppUi
+    ( ( CAppUIAppUi* )AppUi() )->SetStartedTestCase( iContainer->CurrentTestCase() );
+    
+    AppUi()->HandleCommandL(ECmdViewOutput);
+    }
+
+// ----------------------------------------------------------------------------
+// CTestSetStartedCasesView::HandleClientRectChange
+// 
+// Handles client rect changes.
+// ----------------------------------------------------------------------------
+//
+void CTestSetStartedCasesView::HandleClientRectChange()
+    {
+    if ( iContainer )
+        {
+        iContainer->SetRect( ClientRect() );
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// CTestSetStartedCasesView::DoActivateL
+// 
+// Initializes view when activated.
+// ----------------------------------------------------------------------------
+//
+void CTestSetStartedCasesView::DoActivateL(
+   const TVwsViewId& /*aPrevViewId*/,TUid /*aCustomMessageId*/,
+   const TDesC8& /*aCustomMessage*/)
+    {
+    if (!iContainer)
+        {
+        iContainer = new (ELeave) CTestSetStartedCasesContainer;
+        iContainer->SetMopParent(this);
+        iContainer->ConstructL( ClientRect(), this );
+        AppUi()->AddToStackL( *this, iContainer );
+        } 
+
+    if ( iSelectedTestCase )
+        iContainer->SetCurrentItemIndex(iSelectedTestCase);
+
+    iContainer->DrawListBox();
+    
+    RefreshNaviTitleL();
+   }
+
+// ----------------------------------------------------------------------------
+// CTestSetStartedCasesView::DoDeactivate
+// 
+// Deactivates view.
+// ----------------------------------------------------------------------------
+//
+void CTestSetStartedCasesView::DoDeactivate()
+    {
+    if ( iContainer )
+        {
+        iContainer->SaveActiveLine();
+        AppUi()->RemoveFromViewStack( *this, iContainer );
+        delete iContainer;
+        iContainer = NULL;        
+        }
+    delete iNaviDecorator;
+    iNaviDecorator = NULL;
+    }
+
+// ----------------------------------------------------------------------------
+// CTestSetStartedCasesView::DynInitMenuPaneL
+// 
+// Initializes menu pane.
+// ----------------------------------------------------------------------------
+//
+void CTestSetStartedCasesView::DynInitMenuPaneL(
+    TInt aResourceId, CEikMenuPane* aMenuPane)
+    {
+
+    // options menu
+    if ( R_TESTSET_STARTEDCASESVIEW_MENU == aResourceId )
+        {
+        CStartedTestCase* startedTestCase = iContainer->SelectedTestCase();
+        if ( NULL != startedTestCase )
+            {
+            switch ( startedTestCase->Status() )
+                {
+                // test case running
+                case CUIStoreIf::EStatusRunning:
+                    {
+                    switch ( startedTestCase->UIEngineContainer().State() )
+                        {
+                        case CUIEngineContainer::ERunning:
+                        case CUIEngineContainer::EPaused:
+                            {
+                            aMenuPane->SetItemDimmed( ECmdShowSetMenu, EFalse );
+                            break;
+                            }
+                        //case CUIEngineContainer::ENotStarted:
+                        //case CUIEngineContainer::EExecuted:
+                        //case CUIEngineContainer::EFinished:
+                        default:
+                            {
+                            aMenuPane->SetItemDimmed( ECmdShowSetMenu, ETrue );
+                            }
+                        }
+                    break;
+                    }
+                        
+                // test case not running
+                //case CUIStoreIf::EStatusPassed:
+                //case CUIStoreIf::EStatusFailed:
+                //case CUIStoreIf::EStatusAborted:
+                //case CUIStoreIf::EStatusExecuted
+                default:
+                    {
+                    aMenuPane->SetItemDimmed( ECmdShowSetMenu, ETrue );
+                    }
+                }
+            }
+        else
+            {
+            aMenuPane->SetItemDimmed( ECmdViewOutput, ETrue );
+            aMenuPane->SetItemDimmed( ECmdShowSetMenu, ETrue );
+            }
+        }
+
+    // test case control menu
+    if ( R_TESTCASE_CONTROL_SUBMENU == aResourceId )
+        {
+        CStartedTestCase* startedTestCase = iContainer->SelectedTestCase();
+        
+        if ( NULL != startedTestCase )
+            {
+            if ( startedTestCase->Status() == CUIStoreIf::EStatusRunning )
+                {
+                switch ( startedTestCase->UIEngineContainer().State() )
+                    {
+                    case CUIEngineContainer::ERunning:
+                        {
+                        aMenuPane->SetItemDimmed( ECmdResumeTestCase, ETrue );
+                        aMenuPane->SetItemDimmed( ECmdPauseTestCase, EFalse );
+                        aMenuPane->SetItemDimmed( ECmdAbortTestCase, EFalse );
+                        break;
+                        }
+                    case CUIEngineContainer::EPaused:
+                        {
+                        aMenuPane->SetItemDimmed( ECmdResumeTestCase, EFalse );
+                        aMenuPane->SetItemDimmed( ECmdPauseTestCase, ETrue );
+                        aMenuPane->SetItemDimmed( ECmdAbortTestCase, EFalse );
+                        break;
+                        }
+                    //case CUIEngineContainer::ENotStarted:
+                    //case CUIEngineContainer::EExecuted:
+                    //case CUIEngineContainer::EFinished:
+                    default:
+                        {
+                        aMenuPane->SetItemDimmed( ECmdResumeTestCase, ETrue );
+                        aMenuPane->SetItemDimmed( ECmdPauseTestCase, ETrue );
+                        aMenuPane->SetItemDimmed( ECmdAbortTestCase, ETrue );
+                        break;
+                        }
+                    }
+                }
+            else
+                {
+                aMenuPane->SetItemDimmed( ECmdResumeTestCase, ETrue );
+                aMenuPane->SetItemDimmed( ECmdPauseTestCase, ETrue );
+                aMenuPane->SetItemDimmed( ECmdAbortTestCase, ETrue );
+                }
+            }
+        else
+            {
+            aMenuPane->SetItemDimmed( ECmdResumeTestCase, ETrue );
+            aMenuPane->SetItemDimmed( ECmdPauseTestCase, ETrue );
+            aMenuPane->SetItemDimmed( ECmdAbortTestCase, ETrue );
+            }
+        }
+            
+    }
+
+// ----------------------------------------------------------------------------
+// CTestSetStartedCasesView::TestCaseStateChangedL
+// 
+// Handles status changes of test cases in view.
+// ----------------------------------------------------------------------------
+//
+void CTestSetStartedCasesView::TestCaseStateChangedL()
+    {
+    if ( iContainer )
+        {
+
+        //CStartedTestCase* currentlySelectedTest = iContainer->SelectedTestCase();
+
+        TInt numOfTestsInViewBeforeStateChange = iContainer->TestsInViewCount();
+
+            //((CStartedTestsListBoxModel*)iContainer->iListBox->Model())->MdcaCount();
+
+        iContainer->ConstructListBoxModelL();
+
+        // Check if filtering by module or by test case file is selected
+        /*
+        if ( iFilterModule.Length() )
+            {
+            iContainer->FilterCasesByModuleL(iFilterModule);
+            }
+        else if ( iFilterTestCaseFile.Length() )
+            {
+            iContainer->FilterCasesByTCFileNameL(iFilterTestCaseFile);
+            }
+        */
+
+        TInt numOfTestsInViewAfterStateChange = iContainer->TestsInViewCount();
+            //((CStartedTestsListBoxModel*)iContainer->iListBox->Model())->MdcaCount();
+
+        if ( numOfTestsInViewAfterStateChange >= numOfTestsInViewBeforeStateChange )
+            iContainer->HandleItemAdditionL();
+        else
+            iContainer->HandleItemRemovalL();
+
+        iContainer->DrawListBox();
+
+        }
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/avkon/stifui/src/Testmodulesmenuview.cpp	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,279 @@
+/*
+* 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 file contains CTestModulesMenuView class 
+* definition.
+*
+*/
+
+// INCLUDE FILES
+#include  <aknViewAppUi.h>
+#include  <Stifui.rsg>
+
+#include  <barsread.h>	//TResourceReader
+#include  "TestModulesMenuView.h"
+#include  "TestModulesMenuContainer.h"
+#include  "Stifui.hrh"
+
+#include "AppUIAppUi.h" // For ShowNotImplementedYet() method
+
+// ================= MEMBER FUNCTIONS =======================
+// ----------------------------------------------------------------------------
+// CTestModulesMenuView::ConstructL
+// 
+// Symbian OS two-phased constructor.
+// ----------------------------------------------------------------------------
+//
+void CTestModulesMenuView::ConstructL()
+    {
+    CView::ConstructL();
+    BaseConstructL( R_APPUI_TESTMODULESMENUVIEW );
+    }
+
+// ----------------------------------------------------------------------------
+// CTestModulesMenuView::~CTestCaseOutputView
+// 
+// Destructor.
+// ----------------------------------------------------------------------------
+//
+CTestModulesMenuView::~CTestModulesMenuView()
+    {
+    if ( iContainer )
+        {
+        AppUi()->RemoveFromViewStack( *this, iContainer );
+        delete iContainer;
+        iContainer = NULL;
+        }
+    delete iNaviDecorator;
+    iNaviDecorator = NULL;
+    }
+
+// ----------------------------------------------------------------------------
+// CTestModulesMenuView::Id
+// 
+// Returns view´s id.
+// ----------------------------------------------------------------------------
+//
+TUid CTestModulesMenuView::Id() const
+    {
+    return TUid::Uid(ETestModulesMenuViewId); //KTestCaseMenuViewId;
+    }
+
+// ----------------------------------------------------------------------------
+// CTestModulesMenuView::HandleCommandL
+// 
+// Handles a command.
+// ----------------------------------------------------------------------------
+//
+void CTestModulesMenuView::HandleCommandL(TInt aCommand)
+    {   
+    switch ( aCommand )
+        {
+        case EAknSoftkeyOk:
+            {
+            iEikonEnv->InfoMsg( _L("TestCase Menu ok") );
+            break;
+            }
+        case EAknSoftkeyBack:
+            {
+            AppUi()->HandleCommandL(EAppUIGoBack);
+            break;
+            }
+        // Next is removed from Stifui.rss file in 
+        // RESOURCE MENU_PANE r_appui_testmodulesmenuview_menu's
+        // items section. If want back to use remeve comment there
+        //case ECmdOpenModule:
+        //    {
+            //TFileName fileName;
+            //AknCommonDialogs::RunSelectDlgLD (fileName,
+            //                                  R_MEMORY_SELECTION_DIALOG,
+            //                                  R_FILE_SELECTION_DIALOG
+            //
+            //);
+        //    ShowNotImplementedYet();
+        //    break;
+        //    }
+        case ECmdAddModule:
+            {
+            TInt ret = ((CAppUIAppUi*)AppUi())->UIStoreHandler()->LoadAllModules();
+            if( KErrNone != ret )
+                {
+                iEikonEnv->InfoMsg( _L("Module adding fails!") );
+                break;
+                }
+
+            AppUi()->HandleCommandL( EAppUIGoBack );
+            //ShowNotImplementedYet();
+            break;
+            }
+        case ECmdRemoveModule:
+            {
+            TInt moduleNumber = iContainer->CurrentItemIndex();
+            RRefArray<TDesC> allModules;
+            TInt ret = ((CAppUIAppUi*)AppUi())->UIStoreHandler()->Modules( allModules );
+            if( KErrNone != ret )
+                {
+                allModules.Reset();
+                allModules.Close();
+                User::Leave( ret );
+                }
+            // No modules exist...break...
+            if( allModules.Count() == 0 )
+                {
+                iEikonEnv->InfoMsg( _L("No modules available!") );
+                allModules.Reset();
+                allModules.Close();
+                break;
+                }
+            // Module found...remove module...
+            ret = ((CAppUIAppUi*)AppUi())->UIStoreHandler()->RemoveTestModule(
+                                        allModules[ moduleNumber ] );
+            if( KErrNone != ret )
+                {
+                User::Leave( ret );
+                }
+            allModules.Reset();
+            allModules.Close();
+
+            //iContainer->UpdateView();
+            AppUi()->HandleCommandL( EAppUIGoBack );
+            //ShowNotImplementedYet();
+            break;
+            }
+        default:
+            {
+            AppUi()->HandleCommandL( aCommand );
+            break;
+            }
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// CTestModulesMenuView::DynInitMenuPaneL
+// 
+// Initializes menu pane.
+// ----------------------------------------------------------------------------
+//
+void CTestModulesMenuView::DynInitMenuPaneL(TInt aResourceId, CEikMenuPane* /* aMenuPane */)
+    {
+
+    if (R_APPUI_TESTMODULESMENUVIEW_MENU == aResourceId)
+        {
+        /*switch ( iData->StartedCaseInOutputView()->State() )
+            {
+            case ENotStarted:
+                {
+                aMenuPane->SetItemDimmed( ECmdOpenModule, ETrue );
+                aMenuPane->SetItemDimmed( ECmdAddModule, ETrue );
+                aMenuPane->SetItemDimmed( ECmdRemoveModule, ETrue );
+                break;
+                }
+            case ERunning:
+                {
+                aMenuPane->SetItemDimmed( ECmdResumeTestCase, ETrue );
+                break;
+                }
+            case EPaused:
+                {
+                aMenuPane->SetItemDimmed( ECmdPauseTestCase, ETrue );
+                break;
+                }
+            case EPassed:
+            case EFailed:
+            case EAborted:
+            case EExecuted:
+                {
+                aMenuPane->SetItemDimmed( ECmdPauseTestCase, ETrue );
+                aMenuPane->SetItemDimmed( ECmdResumeTestCase, ETrue );
+                aMenuPane->SetItemDimmed( ECmdAbortTestCase, ETrue );
+                break;
+                }
+            }*/
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// CTestModulesMenuView::HandleClientRectChange
+// 
+// Handles client rect changes.
+// ----------------------------------------------------------------------------
+//
+void CTestModulesMenuView::HandleClientRectChange()
+    {
+    if ( iContainer )
+        {
+        iContainer->SetRect( ClientRect() );
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// CTestModulesMenuView::HandleListBoxEventL
+// 
+// Handles listbox events.
+// ----------------------------------------------------------------------------
+//
+void CTestModulesMenuView::HandleListBoxEventL(CEikListBox* /*aListBox*/, TListBoxEvent aEventType)
+	{
+	if ( ( aEventType == EEventEnterKeyPressed ) || ( aEventType == EEventItemDoubleClicked ) )
+		{
+        // Open or edit test module or ???
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// CTestModulesMenuView::DoActivateL
+// 
+// Initializes view when activated.
+// ----------------------------------------------------------------------------
+//
+void CTestModulesMenuView::DoActivateL(
+   const TVwsViewId& /*aPrevViewId*/,TUid /*aCustomMessageId*/,
+   const TDesC8& /*aCustomMessage*/)
+    {
+    if (!iContainer)
+        {
+        iContainer = new (ELeave) CTestModulesMenuContainer;
+        iContainer->SetMopParent(this);
+        iContainer->ConstructL( ClientRect(), this);
+        AppUi()->AddToStackL( *this, iContainer );
+        } 
+    CEikStatusPane* sp=iEikonEnv->AppUiFactory()->StatusPane();
+	CAknNavigationControlContainer* np= (CAknNavigationControlContainer *)sp->ControlL(TUid::Uid(EEikStatusPaneUidNavi));
+	
+	TResourceReader reader;
+	iCoeEnv->CreateResourceReaderLC(reader,R_NAVITITLE_MODULES);
+	iNaviDecorator = np->CreateNavigationLabelL( reader );
+	CleanupStack::PopAndDestroy(); // resource reader
+	np->PushL(*iNaviDecorator);
+   }
+
+// ----------------------------------------------------------------------------
+// CTestModulesMenuView::DoDeactivate
+// 
+// Deactivates view.
+// ----------------------------------------------------------------------------
+//
+void CTestModulesMenuView::DoDeactivate()
+    {
+    if ( iContainer )
+        {
+        iContainer->SaveActiveLine();
+        AppUi()->RemoveFromViewStack( *this, iContainer );
+        delete iContainer;
+        iContainer = NULL;
+        }
+    delete iNaviDecorator;
+    iNaviDecorator = NULL;
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/avkon/stifui/src/UIStoreHandler.cpp	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,140 @@
+/*
+* 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 module contains implementation of 
+* CUIStoreHandler class member functions.
+*
+*/
+
+// INCLUDE FILES
+#include "UIStoreHandler.h"
+
+// EXTERNAL DATA STRUCTURES
+// None
+
+// EXTERNAL FUNCTION PROTOTYPES  
+// None
+
+// CONSTANTS
+// None
+
+// MACROS
+// None
+
+// LOCAL CONSTANTS AND MACROS
+// None
+
+// MODULE DATA STRUCTURES
+// None
+
+// LOCAL FUNCTION PROTOTYPES
+// None
+
+// FORWARD DECLARATIONS
+// None
+class CUIStore;
+
+// ==================== LOCAL FUNCTIONS =======================================
+// None
+
+// ================= MEMBER FUNCTIONS =========================================
+// ----------------------------------------------------------------------------
+// CUIStoreHandler::CUIStoreHandler
+// 
+// Default constructor.
+// C++ default constructor can NOT contain any code, that might leave.
+// ----------------------------------------------------------------------------
+//
+CUIStoreHandler::CUIStoreHandler( CAppUIAppUi* aAppUIAppUI ) :
+    iAppUIAppUI( aAppUIAppUI ),
+    iExecutedTestCaseCount( 0 )
+    {
+
+    }
+
+// ----------------------------------------------------------------------------
+// CUIStoreHandler::ConstructL
+// 
+// Symbian OS second phase constructor.
+// Symbian OS default constructor can leave.
+// ----------------------------------------------------------------------------
+//
+void CUIStoreHandler::ConstructL()
+    {
+    CUIStoreIf::ConstructL();
+
+    }
+
+// ----------------------------------------------------------------------------
+// CUIStoreHandler::NewL
+// 
+// Two-phased constructor.
+// ----------------------------------------------------------------------------
+//
+CUIStoreHandler* CUIStoreHandler::NewL( CAppUIAppUi* aAppUIAppUI )
+    {
+    // Create CUIStoreHandler object uistorehandler
+    CUIStoreHandler* uistorehandler = new (ELeave) CUIStoreHandler( aAppUIAppUI );
+
+    CleanupStack::PushL( uistorehandler );
+    uistorehandler->ConstructL();
+    CleanupStack::Pop( uistorehandler );
+
+    return uistorehandler;
+
+    }
+
+// ----------------------------------------------------------------------------
+// CUIStoreHandler::~CUIStoreHandler
+// 
+// Destructor.
+// ----------------------------------------------------------------------------
+//
+CUIStoreHandler::~CUIStoreHandler()
+    {
+
+    }
+
+// ----------------------------------------------------------------------------
+// CUIStoreHandler::Update
+// 
+// Receives output update notify from started test case.
+// Checks if that test case is currently in output view then
+// sends notification to AppUI which handles notification onward.
+// ----------------------------------------------------------------------------
+//
+void CUIStoreHandler::Update( CStartedTestCase* aTestCase, TInt aStatus )
+    {
+	_LIT( KErrorMsg, "Error during output update" );
+    TRAPD(err,iAppUIAppUI->OutputUpdateL( aTestCase, aStatus ));
+	if ( err != KErrNone )
+		{
+		RDebug::Print( KErrorMsg );
+		}
+
+        //iAppUi->OutputUpdate();
+    //if( aStatus == EPrintUpdate )
+    //    {
+        //iAppUIAppUI->OutputUpdate( aTestCase );
+    //    }
+    //else
+    //    {
+        //iAppUIAppUI->TestCaseStateChanged();
+    //    }
+
+    }
+
+// ================= OTHER EXPORTED FUNCTIONS =================================
+// None
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/avkon/stifui/src/View.cpp	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,100 @@
+/*
+* 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 file contains CView class definition.
+*
+*/
+
+// INCLUDE FILES
+#include  <aknViewAppUi.h>
+#include  <Stifui.rsg>
+#include  "AppUIAppUi.h"
+#include  "View.h"
+
+
+// ================= MEMBER FUNCTIONS =======================
+// ----------------------------------------------------------------------------
+// CView::ConstructL
+// 
+// Symbian OS two-phased constructor.
+// ----------------------------------------------------------------------------
+//
+void CView::ConstructL()
+    {
+    iUIStore = ( (CAppUIAppUi*)AppUi() )->UIStoreHandler();
+    }
+
+// ----------------------------------------------------------------------------
+// CView::~CView
+// 
+// Destructor.
+// ----------------------------------------------------------------------------
+//
+CView::~CView()
+    {
+    }
+
+// ----------------------------------------------------------------------------
+// CView::Id
+// 
+// Returns view´s id.
+// ----------------------------------------------------------------------------
+//
+TUid CView::Id() const
+    {
+    return TUid::Uid(0);
+    }
+
+// ----------------------------------------------------------------------------
+// CView::HandleCommandL
+// 
+// Handles a command.
+// ----------------------------------------------------------------------------
+//
+void CView::HandleCommandL(TInt /*aCommand*/)
+    {   
+    }
+
+// ----------------------------------------------------------------------------
+// CView::HandleClientRectChange
+// 
+// Handles client rect changes.
+// ----------------------------------------------------------------------------
+//
+void CView::HandleClientRectChange()
+    {
+    }
+
+// ----------------------------------------------------------------------------
+// CView::DoActivateL
+// 
+// Initializes view when activated.
+// ----------------------------------------------------------------------------
+//
+void CView::DoActivateL(
+   const TVwsViewId& /*aPrevViewId*/,TUid /*aCustomMessageId*/,
+   const TDesC8& /*aCustomMessage*/ )
+	{
+	}
+
+// ----------------------------------------------------------------------------
+// CView::DoDeactivate
+// 
+// Deactivates view.
+// ----------------------------------------------------------------------------
+//
+void CView::DoDeactivate()
+    {
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/avkon/uitestserverstarter/data/UITestServerStarter.rls	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,23 @@
+/*
+* 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 file contains name of uitestserverstarter.
+*
+*/
+
+//  LOCALISATION STRINGS
+
+// Caption string for app.
+#define qtn_caption_string "UITestServerStarter"
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/avkon/uitestserverstarter/data/UITestServerStarter.rss	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,136 @@
+/*
+* 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 file defines UITestServerStarter resources.
+*
+*/
+
+//  RESOURCE IDENTIFIER
+NAME UITE	// 4 letter ID
+
+
+//  INCLUDES
+#include <eikon.rh>
+#include <avkon.rsg>
+#include <avkon.rh>
+#include <appinfo.rh>
+#include "UITestServerStarter.hrh"
+#include "UITestServerStarter.rls"
+
+//  RESOURCE DEFINITIONS
+// -----------------------------------------------------------------------------
+//
+//	Define the resource file signature
+//	This resource should be empty.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE RSS_SIGNATURE
+	{
+	}
+
+// -----------------------------------------------------------------------------
+//
+//	Default Document Name
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_default_document_name
+	{
+	buf="UITE";
+	}
+
+// -----------------------------------------------------------------------------
+//
+//	Define default menu and CBA key.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE EIK_APP_INFO
+	{
+	//menubar = r_menubar;
+	cba = R_AVKON_SOFTKEYS_EXIT;
+	}
+
+
+// -----------------------------------------------------------------------------
+//
+//   r_menubar
+//   Main menubar
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE MENU_BAR r_menubar
+	{
+	titles =
+		{
+		MENU_TITLE { menu_pane = r_menu; }
+		};
+	}
+
+
+// -----------------------------------------------------------------------------
+//
+//   r_menu
+//   Menu for "Options"
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE MENU_PANE r_menu
+	{
+	items =
+		{
+		MENU_ITEM
+				{
+				command = EAknSoftkeyExit;
+				txt = qtn_exit;
+				}
+		};
+	}
+
+// -----------------------------------------------------------------------------
+//
+// About dialog resource.
+//
+// -----------------------------------------------------------------------------
+//
+// None
+
+// -----------------------------------------------------------------------------
+//
+// Resources for messages.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF32 r_caption_string { buf=qtn_caption_string; }
+
+// ---------------------------------------------------------------------------- 
+//
+// r_localisable_app_info
+//
+// ---------------------------------------------------------------------------- 
+//
+RESOURCE LOCALISABLE_APP_INFO r_localisable_app_info
+	{
+	short_caption = qtn_caption_string;
+	caption_and_icon = 
+	CAPTION_AND_ICON_INFO
+		{
+		caption = qtn_caption_string;
+
+		number_of_icons = 1;
+	   	icon_file = "\\resource\\apps\\UITestServerStarter.mif";
+		};
+	}
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/avkon/uitestserverstarter/data/UITestServerStarter_reg.rss	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,34 @@
+/*
+* 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 file defines UITestServerStarter resources.
+*
+*/
+
+#include "UITestServerStarter.hrh"
+#include "UITestServerStarter.rls"
+#include <appinfo.rh>
+#include <UITestServerStarter.rsg>
+
+UID2 KUidAppRegistrationResourceFile
+UID3 _UID3
+
+RESOURCE APP_REGISTRATION_INFO
+	{
+	app_file="UITestServerStarter";
+//	localisable_resource_file =  qtn_loc_resource_file_1;
+//	localisable_resource_id = R_LOCALISABLE_APP_INFO;
+	hidden=KAppIsHidden;
+	embeddability=KAppNotEmbeddable;
+	}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/avkon/uitestserverstarter/group/UITestServerStarter.mmp	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,87 @@
+/*
+* 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: MMP file of UITestServerStarter.
+*
+*/
+
+#include <platform_paths.hrh>
+
+SMPSAFE
+
+TARGET			UITestServerStarter.exe
+TARGETTYPE		exe
+UID		  		0x100039CE 0x2000F8E8
+VENDORID		0x101FB657
+SECUREID		0x2000F8E8
+CAPABILITY		ALL -TCB
+
+START RESOURCE	../data/UITestServerStarter.rss
+	HEADER
+	TARGETPATH resource/apps
+END
+
+SOURCEPATH		../data
+START RESOURCE	UITestServerStarter_reg.rss
+	DEPENDS uitestserverstarter.rsg
+	TARGETPATH		/private/10003a3f/apps
+END
+
+SOURCEPATH		../src
+
+SOURCE			TestServerThreadStarter.cpp
+SOURCE			UITestServerStarter.cpp 
+SOURCE			UITestServerStarterAppView.cpp
+SOURCE			UITestServerStarterAppUi.cpp
+SOURCE			AknUiEnvProxy.cpp
+SOURCE			EventUtil.cpp
+SOURCE			UITestServerStarterApplication.cpp
+SOURCE			UITestServerStarterDocument.cpp
+SOURCE			UITestServerStarterAppContainer.cpp
+
+USERINCLUDE ../inc
+
+APP_LAYER_SYSTEMINCLUDE
+
+LIBRARY		   euser.lib
+LIBRARY		   apparc.lib
+LIBRARY		   cone.lib
+LIBRARY		   eikcore.lib
+LIBRARY		   avkon.lib
+LIBRARY		   commonengine.lib
+LIBRARY		   efsrv.lib 
+LIBRARY		   estor.lib
+LIBRARY        aknnotify.lib
+LIBRARY        hlplch.lib
+LIBRARY        apgrfx.lib 
+LIBRARY        ws32.lib
+LIBRARY        aknskins.lib 
+LIBRARY        aknskinsrv.lib
+
+LIBRARY         stiftestserver.lib
+
+START WINS      
+// ?wins_specific_information
+END
+
+START MARM
+// ?marm_specific_information
+END
+
+/* Test Server requires large stack. In case of change update also thread creation parameters
+   in "void CTestServerThreadStarter::RunL" method.
+*/
+EPOCSTACKSIZE   40960
+EPOCHEAPSIZE 	0x001000 0x400000
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/avkon/uitestserverstarter/group/bld.inf	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,40 @@
+/*
+* 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: bld.inf build information for UITestServerStarter.
+*
+*/
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+// Specify the platforms your component needs to be built for here.
+// ARM4 not supported in SDK
+
+	DEFAULT
+
+
+PRJ_EXPORTS
+// None
+
+PRJ_TESTEXPORTS
+// None
+
+PRJ_MMPFILES
+	
+	UITestServerStarter.mmp
+
+PRJ_TESTMMPFILES
+// None
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/avkon/uitestserverstarter/inc/AknUiEnvProxy.h	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,166 @@
+/*
+* 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 file contains the header file of the Akn UI 
+* Proxy class implementations.
+*
+*/
+
+#ifndef AKNUIENVPROXY_H_
+#define AKNUIENVPROXY_H_
+
+//  INCLUDES
+#include <stifinternal/UiEnvProxy.h>
+
+// CONSTANTS
+// None
+
+// MACROS
+// None
+
+// DATA TYPES
+// None
+
+// FUNCTION PROTOTYPES
+// None
+
+// FORWARD DECLARATIONS
+class CUITestServerStarterAppUi;
+
+// CLASS DECLARATION
+
+// DESCRIPTION
+// Akn implementation of UI Proxy interface.
+class CAknUiEnvProxy: public CUiEnvProxy
+	{
+	public: // Enumerations
+	    // None
+	
+	private: // Enumerations
+	    // None
+	
+	public:  // Constructors and destructor
+	    /**
+	    * C++ destructor.
+	    */
+	    ~CAknUiEnvProxy();
+	
+	public: // New functions
+	    /**
+	    * NewL is first phase of two-phased constructor.
+	    */		
+		static CAknUiEnvProxy* NewL( CUITestServerStarterAppUi* aAppUi );
+		
+    public: // Functions from base classes
+
+		/**
+		 * Parses key code.
+		 */
+		virtual TInt ParseKeyCode( const TDesC& aKeyCodeName, TUint& aKeyCode ) const;
+	
+		/**
+		 * Parses key scan code.
+		 */
+		virtual TInt ParseKeyScanCode( const TDesC& aKeyScanCodeName, TInt& aKeyScanCode ) const;
+	
+		/**
+		 * Parses key modifier.
+		 */
+		virtual TInt ParseModifier( const TDesC& aModifierName, TUint& aModifier ) const;
+	    
+		/**
+		 * Parse pointer event type
+		 */
+		virtual TInt ParsePointerEventType( const TDesC& aPointerEventTypeName, TUint& aPointerEventType ) const;
+
+		/**
+		 * Brings UI control container to foreground.
+		 */
+		virtual void BringToForeground();
+
+		/**
+		 * Sends UI control container to background.
+		 */
+		virtual void SendToBackground();
+
+		/**
+		 * Sends local key event to UI control.
+		 */
+		virtual void PressKeyL( TRequestStatus* aStatus, TUint aKeyCode, TInt aKeyScanCode = 0, 
+				   TUint aKeyModifiers = 0, TInt aKeyRepeats = 0 );
+
+		/**
+		 * Sends global key event to UI control.
+		 */
+		virtual void PressKeyL( TUint aKeyCode, TInt aKeyScanCode = 0, 
+				   TUint aKeyModifiers = 0, TInt aKeyRepeats = 0 );
+
+		/**
+		 * Sends text to UI control.
+		 */
+		virtual void TypeTextL( TRequestStatus* aStatus, const TDesC& aText );
+
+		/**
+		 * Sends global text to UI control.
+		 */
+		virtual void TypeTextL( const TDesC& aText );
+		
+		/**
+		 * Send pointer event
+		 */
+		virtual void SendPointerEventL( TUint aType, const TPoint& aPosition );		
+		
+		/**
+		 * Send local pointer event
+		 */
+		virtual void SendPointerEventL( TRequestStatus* aStatus, TUint aType, const TPoint& aPosition );
+		
+    protected:	// New functions
+        // None
+        
+    protected:	// Functions from base classes
+        // None
+        
+    private:	// New functions
+	    /**
+	    * C++ default constructor.
+	    */
+		CAknUiEnvProxy();
+    
+	    /**
+	    * By default Symbian OS constructor is private.
+	    */
+    	void ConstructL( CUITestServerStarterAppUi* aAppUi );
+    
+	public:		//Data
+	    // None
+        
+	protected:	// Data
+        // None
+        
+    private:	// Data
+    	CUITestServerStarterAppUi* iAppUi;	// Pointer to AppUi
+		
+    public:		// Friend classes
+        // None
+
+    protected:	// Friend classes
+        // None
+
+    private:	// Friend classes
+        // None
+};
+
+#endif // AKNUIENVPROXY_H_
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/avkon/uitestserverstarter/inc/EventUtil.h	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,115 @@
+/*
+* 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 file contains TEventUtil class declaration.
+*
+*/
+
+#ifndef EVENTUTIL_H_
+#define EVENTUTIL_H_
+
+//  INCLUDES
+#include <e32base.h>
+
+// CONSTANTS
+// None
+
+// MACROS
+// None
+
+// DATA TYPES
+// None
+
+// FUNCTION PROTOTYPES
+// None
+
+// FORWARD DECLARATIONS
+// None
+
+// CLASS DECLARATION
+
+// DESCRIPTION
+// Utility class for key codes parsing.
+class TEventUtil
+    {
+    private: // Enumerations
+    	// none
+
+    public: // Enumerations
+		enum TCustomPointerEventType { EButton1 = 1000, EButton2, EButton3 };
+    
+    public: // Constructors and destructor
+
+    public: // Constructors and destructor
+
+    public: // New functions
+    	/**
+    	 * Returns descriptive key code name.
+    	 */
+        static TPtrC GetKeyCodeName( TUint aKeyCode );
+        
+        /**
+         * Parses key code.
+         */ 
+        static TInt ParseKeyCode( const TDesC& aKeyCodeName, TUint& aKeyCode );
+
+		/**
+		 * Returns descriptive key scan code name.
+		 */
+        static TPtrC GetKeyScanCodeName( TInt aKeyScanCode );
+        
+        /**
+         * Parses key scan code.
+         */
+        static TInt ParseKeyScanCode( const TDesC& aKeyScanCodeName, TInt& aKeyScanCode );
+
+        /**
+         * Returns descriptive key modifier name.
+         */
+        static TPtrC GetModifierName( TUint aModifier );
+        
+        /**
+         * Parses key modifier.
+         */
+        static TInt ParseModifier( const TDesC& aModifierName, TUint& aModifier );
+        
+        /**
+         * Parses pointer event type.
+         */
+        static TInt ParsePointerEventType( const TDesC& aPointerEventTypeName, TUint& aPointerEventType );
+
+    public: // Functions from base classes
+
+    protected:  // New functions
+
+    protected:  // Functions from base classes
+
+    private:    // New functions
+
+    public:     // Data
+
+    protected:  // Data
+
+    private:    // Data
+
+    public:     // Friend classes
+
+    protected:  // Friend classes
+
+    private:    // Friend classes
+
+    };
+
+#endif /*EVENTUTIL_H_*/
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/avkon/uitestserverstarter/inc/TestServerThreadStarter.h	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,132 @@
+/*
+* 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 file contains the header file of the 
+* TestServerThreadStarter class.
+*
+*/
+
+
+#ifndef TESTSERVERTHREADSTARTER_H_
+#define TESTSERVERTHREADSTARTER_H_
+
+//  INCLUDES
+#include "e32base.h"
+
+
+// CONSTANTS
+// None
+
+// MACROS
+// None
+
+// DATA TYPES
+// None
+
+// FUNCTION PROTOTYPES
+// None
+
+// FORWARD DECLARATIONS
+class CTestThreadContainerRunnerFactory;
+
+// CLASS DECLARATION
+
+// DESCRIPTION
+// Class used to create thread in which testserver execution code is placed.
+class CTestServerThreadStarter: public CActive
+	{
+	public: // Enumerations
+	    // None
+	
+	private: // Enumerations
+	    // None
+	
+	public:  // Constructors and destructor
+	    /**
+	    * C++ destructor.
+	    */
+		~CTestServerThreadStarter();
+	
+	public: // New functions
+	    /**
+	    * NewL is first phase of two-phased constructor.
+	    */		
+		static CTestServerThreadStarter* NewL();
+	
+		/**
+		 * Performs testserver execution request.
+		 */
+		TInt RunTestServerThread( CTestThreadContainerRunnerFactory* aTestThreadContainerRunnerFactory );
+	public: // Functions from base classes
+		/**
+		 * RunL derived from CActive handles the completed requests.
+		 */
+		void RunL();
+		
+		/**
+		 * DoCancel derived from CActive handles the Cancel.
+		 */
+		void DoCancel();
+
+    protected:	// New functions
+        // None
+        
+    protected:	// Functions from base classes
+        // None
+        
+    private:	// New functions
+    	/**
+    	 * Thread function in which testserver execution code is placed.
+    	 */
+		static TInt TestServerStarterThreadFunction( TAny* aParameters );
+	    
+		/**
+	    * C++ default constructor.
+	    */
+		CTestServerThreadStarter();
+
+	    /**
+	    * By default Symbian OS constructor is private.
+	    */
+		void ConstructL();		
+	
+	public:		//Data
+	    // None
+        
+	protected:	// Data
+        // None
+        
+    private:	// Data
+		RTimer iTimer;	// Timer which complets testserver execution request
+		CTestThreadContainerRunnerFactory* iTestThreadContainerRunnerFactory; 	// Pointer to test thread container
+																				// runner factory passed as a parameter
+																				// to function which executes testserver
+		TThreadId iMainThreadId;	// UITestServerStarter main thread id 
+		TInt iReturnCode;			// TestServer execution return code
+		RSemaphore iServerThreadStartedSemaphore;	// Semaphore which indicates that testserver execution thread
+													// was successfully created		
+    public:		// Friend classes
+        // None
+
+    protected:	// Friend classes
+        // None
+
+    private:	// Friend classes
+        // None
+	};
+
+
+
+#endif // TESTSERVERTHREADSTARTER_H_
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/avkon/uitestserverstarter/inc/UITestServerStarter.hrh	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,25 @@
+/*
+* 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 file contains UID3 definition.
+*
+*/
+
+#ifndef __UITESTSERVERSTARTER_HRH__
+#define __UITESTSERVERSTARTER_HRH__
+
+#define _UID3 0x2000F8E8
+
+#endif // __UITESTSERVERSTARTER_HRH__
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/avkon/uitestserverstarter/inc/UITestServerStarterAppContainer.h	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,138 @@
+/*
+* 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 file contains the header file of the 
+* UITestServerStarter AppUi container class.
+*
+*/
+
+#ifndef UITESTSERVERSTARTERAPPCONTAINER_H_
+#define UITESTSERVERSTARTERAPPCONTAINER_H_
+
+//  INCLUDES
+#include <coecntrl.h>
+#include <coemop.h>
+
+
+// CONSTANTS
+// None
+
+// MACROS
+// None
+
+// DATA TYPES
+// None
+
+// FUNCTION PROTOTYPES
+// None
+
+// FORWARD DECLARATIONS
+class CAknsBasicBackgroundControlContext;
+
+// CLASS DECLARATION
+
+// DESCRIPTION
+// UITestServerStarter standard AppUi container class.
+class CUITestServerStarterAppContainer: public CCoeControl
+	{
+	public: // Enumerations
+	    // None
+	
+	private: // Enumerations
+	    // None
+	
+	public:  // Constructors and destructor
+		/**
+		 * Virtual Destructor.
+		 */
+		~CUITestServerStarterAppContainer();
+
+	private:  // Constructors and destructor
+		/**
+		 * C++ default constructor.
+		 */
+		CUITestServerStarterAppContainer();
+
+		/**
+		 * Perform the second phase construction of a
+		 * CUITestServerStarterAppView object.
+		 */
+		void ConstructL( const TRect& aRect );
+		
+	public: // New functions
+		/**
+		 * Two-phased constructor.
+		 * Create a CUITestServerStarterAppContainer object, which will draw itself to aRect.
+		 */
+		static CUITestServerStarterAppContainer* NewL( const TRect& aRect );
+
+		/**
+		* Two-phased constructor.
+		* Create a CUITestServerStarterAppContainer object, which will draw itself
+		*/
+		static CUITestServerStarterAppContainer* NewLC( const TRect& aRect );
+
+		
+		/**
+		 * This function is used to allow controls to ask their owners 
+		 * for access to other objects that they own
+		 */
+		TTypeUid::Ptr MopSupplyObject( TTypeUid aId );
+	public: // Functions from base classes
+		// None
+	
+    protected:	// New functions
+        // None
+        
+    protected:	// Functions from base classes
+        // None
+        
+    private:	// New functions
+    	// None
+
+    private:	// Functions from base classes
+    
+    	/**
+    	 * Draws the control
+    	 */
+        void Draw( const TRect& aRect ) const;
+        
+        /**
+         * Responds to changes to the size and position of the 
+         * contents of this control
+         */
+        void SizeChanged();
+    
+        //void HandleResourceChange( TInt aType );
+	public:		//Data
+	    // None
+        
+	protected:	// Data
+        // None
+        
+    private:	// Data
+    	CAknsBasicBackgroundControlContext* iBgContext; // Skin background object context pointer
+		
+    public:		// Friend classes
+        // None
+
+    protected:	// Friend classes
+        // None
+
+    private:	// Friend classes
+        // None
+	};
+
+#endif /*UITESTSERVERSTARTERAPPCONTAINER_H_*/
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/avkon/uitestserverstarter/inc/UITestServerStarterAppUi.h	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,172 @@
+/*
+* 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 file contains the header file of the 
+* UITestServerStarter AppUi class
+*
+*/
+
+#ifndef UITESTSERVERSTARTERAPPUI_H_
+#define UITESTSERVERSTARTERAPPUI_H_
+
+//  INCLUDES
+#include <aknViewAppUi.h> 
+
+// CONSTANTS
+// None
+
+// MACROS
+// None
+
+// DATA TYPES
+// None
+
+// FUNCTION PROTOTYPES
+// None
+
+// FORWARD DECLARATIONS
+class CUITestServerStarterAppView;
+
+// CLASS DECLARATION
+
+// DESCRIPTION
+// UITestServerStarter AppUi class
+class CUITestServerStarterAppUi : public CAknViewAppUi
+	{
+	public: // Enumerations
+	    // None
+	
+	private: // Enumerations
+		/**
+		 * Currently handled event type.
+		 */
+		enum TEventType { 
+			ENone,		// None 
+			EPressKey,  // Press key event
+			ETypeText, 	// Type text event
+			EPointerEvent, // Pointer event
+			};
+	
+	public:  // Constructors and destructor
+		/**
+		 * C++ default constructor. This needs to be public due to
+		 * the way the framework constructs the AppUi
+		 */
+		CUITestServerStarterAppUi();
+	
+		/**
+		 * Virtual Destructor.
+		 */
+		virtual ~CUITestServerStarterAppUi();
+	
+	public: // New functions
+		/**
+		 * ConstructL.
+		 * 2nd phase constructor.
+		 */
+		void ConstructL();
+
+		/**
+	     * Prepares AppUi to recive type text event
+	     */	
+		virtual void PrepareToTypeText( TInt aTextLength );
+	
+		/**
+	     * Prepares AppUi to recive key press event
+	     */	
+		virtual void PrepareToPressKey();			
+
+		/**
+	     * Prepares AppUi to recive pointer event
+	     */	
+		virtual void PrepareToPointerEvent();			
+		
+		/**
+	     * Notifies that key press event was recived.
+	     */	
+		virtual void KeyPressHandled();
+	
+		/**
+	     * Notifies that text type event was recived.
+	     */	
+		virtual void TextTypeHandled();
+		
+		/**
+	     * Notifies that pointer event was recived.
+	     */	
+		virtual void PointerEventHandled();
+		
+		/**
+	     * Requests notification when key press event is handled.
+	     */	
+		virtual void NotifyAboutHandledKeyPress( TRequestStatus* aStatus );
+	
+		/**
+	     * Requests notification when text type event is handled.
+	     */	
+		virtual void NotifyAboutHandledTextType( TRequestStatus* aStatus );	
+
+		/**
+	     * Requests notification when pointer event is handled.
+	     */	
+		virtual void NotifyAboutHandledPointerEvent( TRequestStatus* aStatus );	
+
+	public: // Functions from base classes
+		/**
+	     * Overwritten version of CCoeAppUi::HandleWsEventL() method.
+	     */	
+		void HandleWsEventL( const TWsEvent& aEvent, CCoeControl* aDestination );
+
+    protected:	// New functions
+        // None
+        
+    protected:	// Functions from base classes
+        // None
+        
+    private:	// New functions
+    	// None
+
+    private: 	// Functions from base classes
+		/**
+		 * From CEikAppUi, HandleCommandL.
+		 * Takes care of command handling.
+		 * @param aCommand Command to be handled.
+		 */
+		void HandleCommandL( TInt aCommand );
+	        
+	public:		//Data
+	    // None
+        
+	protected:	// Data
+        // None
+        
+    private:	// Data
+		CUITestServerStarterAppView* iAppView;	// The application view owned by CUITestServerStarterAppUi		
+		TRequestStatus* iEventStatus;	// Pointer to request statuc which is completed when 
+										// selected event is handled.		
+		TEventType iEventType;	// Currently handled event type;		
+		TInt iTypeTextLength;	// Length of text send by typetext testscripter keyword
+		
+    public:		// Friend classes
+        // None
+
+    protected:	// Friend classes
+        // None
+
+    private:	// Friend classes
+        // None
+	};
+
+#endif // UITESTSERVERSTARTERAPPUI_H_
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/avkon/uitestserverstarter/inc/UITestServerStarterAppView.h	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,142 @@
+/*
+* 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 file contains the header file of the 
+* UITestServerStarter AppUi view class.
+*
+*/
+
+#ifndef UITESTSERVERSTARTERAPPVIEW_H_
+#define UITESTSERVERSTARTERAPPVIEW_H_
+
+//  INCLUDES
+#include <aknview.h>
+
+// CONSTANTS
+// None
+
+// MACROS
+// None
+
+// DATA TYPES
+// None
+
+// FUNCTION PROTOTYPES
+// None
+
+// FORWARD DECLARATIONS
+class CUITestServerStarterAppContainer;
+
+// CLASS DECLARATION
+
+// DESCRIPTION
+// UITestServerStarter standard AppUi view class.
+class CUITestServerStarterAppView : public CAknView
+	{
+	public: // Enumerations
+	    // None
+	
+	private: // Enumerations
+	    // None
+	
+	public:  // Constructors and destructor
+		/**
+		 * Virtual Destructor.
+		 */
+		virtual ~CUITestServerStarterAppView();
+	
+	private:  // Constructors and destructor
+
+		/**
+		 * Perform the second phase construction of a
+		 * CUITestServerStarterAppView object.
+		 */
+		void ConstructL();
+
+		/**
+		 * C++ default constructor.
+		 */
+		CUITestServerStarterAppView();
+	
+	public: // New functions
+		/**
+		 * Two-phased constructor.
+		 * Create a CUITestServerStarterAppView object.
+		 */
+		static CUITestServerStarterAppView* NewL();
+	
+		/**
+		* Two-phased constructor.
+		* Create a CUITestServerStarterAppView object
+		*/
+		static CUITestServerStarterAppView* NewLC();
+
+	public: // Functions from base classes
+	    /**
+	    * Return Uid
+	    */
+	    TUid Id() const;
+	
+	    /**
+	    * Handle Commands
+	    */
+	    void HandleCommandL(TInt aCommand);
+	
+	    /**
+	    * Handle size changes
+	    */
+	    void HandleClientRectChange();
+		
+    protected:	// New functions
+        // None
+        
+    protected:	// Functions from base classes
+        // None
+        
+    private:	// New functions
+    	// None
+
+    private:	// Functions from base classes
+	    /**
+	    * From AknView, Activates view
+	    */
+	    void DoActivateL(const TVwsViewId& aPrevViewId,TUid aCustomMessageId,
+	        const TDesC8& aCustomMessage);
+	
+	    /**
+	    * From AknView, Deactivates view
+	    */
+	    void DoDeactivate();
+    
+	public:		//Data
+	    // None
+        
+	protected:	// Data
+        // None
+        
+    private:	// Data
+    	CUITestServerStarterAppContainer* iContainer; // View container
+		
+    public:		// Friend classes
+        // None
+
+    protected:	// Friend classes
+        // None
+
+    private:	// Friend classes
+        // None
+	};
+
+#endif // UITESTSERVERSTARTERAPPVIEW_H_
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/avkon/uitestserverstarter/inc/UITestServerStarterApplication.h	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,113 @@
+/*
+* 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 file contains the header file of the 
+* CUITestServerStarterApplication class.
+*
+*/
+
+#ifndef UITESTSERVERSTARTERAPPLICATION_H_
+#define UITESTSERVERSTARTERAPPLICATION_H_
+
+
+//  INCLUDES
+#include <aknapp.h>
+#include "UITestServerStarter.hrh"
+
+// CONSTANTS
+
+// UID for the application;
+const TUid KUidUITestServerStarterApp =
+	{
+	_UID3
+	};
+
+const TUid KMainViewId = { 1982 };
+// CLASS DECLARATION
+
+// CLASS DECLARATION
+// DESCRIPTION
+/**
+ * UITestServerStarterApplication application class.
+ * Provides factory to create concrete document object.
+ * An instance of CUITestServerStarterApplication is the application part of the
+ * AVKON application framework for the CUITestServerStarterApplication application.
+ */
+class CUITestServerStarterApplication : public CAknApplication
+	{
+	public: // Enumerations
+	    // None
+	
+	private: // Enumerations
+	    // None
+	
+	public:  // Constructors and destructor
+	    /**
+	    * C++ destructor.
+	    */
+	
+	public:
+	// Functions from base classes
+	
+	/**
+	 * From CApaApplication, AppDllUid.
+	 * @return Application's UID (KUidUITestServerStarterApplication).
+	 */
+	TUid AppDllUid () const;
+	
+	protected: // Functions from base classes
+	
+	/**
+	 * From CApaApplication, CreateDocumentL.
+	 * Creates CUITestServerStarterDocument document object. The returned
+	 * pointer in not owned by the CUITestServerStarterApplication object.
+	 * @return A pointer to the created document object.
+	 */
+	CApaDocument* CreateDocumentL ();
+	
+	virtual void PreDocConstructL();
+	
+	
+    protected:	// New functions
+        // None
+        
+    protected:	// Functions from base classes
+        // None	
+	
+    private:	// New functions
+    	// None
+	
+	public:		//Data
+	    // None
+        
+	protected:	// Data
+        // None
+        
+    private:	// Data
+    	// None
+			
+	public:		// Friend classes
+		// None
+	
+	protected:	// Friend classes
+		// None
+	
+	private:	// Friend classes
+		// None		
+	};
+
+
+
+#endif /*UITESTSERVERSTARTERAPPLICATION_H_*/
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/avkon/uitestserverstarter/inc/UITestServerStarterDocument.h	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,146 @@
+/*
+* 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 file contains the header file of the 
+* UITestServerStarter Document class.
+*
+*/
+
+#ifndef UITESTSERVERSTARTERDOCUMENT_H_
+#define UITESTSERVERSTARTERDOCUMENT_H_
+
+//  INCLUDES
+#include <AknDoc.h>
+
+// CONSTANTS
+// None
+
+// MACROS
+// None
+
+// DATA TYPES
+// None
+
+// FUNCTION PROTOTYPES
+// None
+
+// FORWARD DECLARATIONS
+class CUITestServerStarterAppUi;
+class CEikApplication;
+
+// CLASS DECLARATION
+
+// DESCRIPTION
+/**
+ * CClockTestDocument application class.
+ * An instance of class CClockTestDocument is the Document part of the
+ * AVKON application framework for the ClockTest example application.
+ */
+class CUITestServerStarterDocument : public CAknDocument
+	{
+	public: // Enumerations
+	    // None
+	
+	private: // Enumerations
+	    // None
+
+	private:  // Constructors and destructor
+		// None
+	public: // New functions
+	
+	/**
+	 * NewL.
+	 * Two-phased constructor.
+	 * Construct a CUITestServerStarterDocument for the AVKON application aApp
+	 * using two phase construction, and return a pointer
+	 * to the created object.
+	 * @param aApp Application creating this document.
+	 * @return A pointer to the created instance of CUITestServerStarterDocument.
+	 */
+	static CUITestServerStarterDocument* NewL (CEikApplication& aApp);
+	
+	/**
+	 * NewLC.
+	 * Two-phased constructor.
+	 * Construct a CUITestServerStarterDocument for the AVKON application aApp
+	 * using two phase construction, and return a pointer
+	 * to the created object.
+	 * @param aApp Application creating this document.
+	 * @return A pointer to the created instance of CUITestServerStarterDocument.
+	 */
+	static CUITestServerStarterDocument* NewLC (CEikApplication& aApp);
+	
+	/**
+	 * ~CUITestServerStarterDocument
+	 * Virtual Destructor.
+	 */
+	virtual ~CUITestServerStarterDocument();
+	
+	public: // Functions from base classes
+	
+		/**
+		 * CreateAppUiL
+		 * From CEikDocument, CreateAppUiL.
+		 * Create a CUITestServerStarterAppUi object and return a pointer to it.
+		 * The object returned is owned by the Uikon framework.
+		 * @return Pointer to created instance of AppUi.
+		 */
+		CEikAppUi* CreateAppUiL ();
+	
+    protected:	// New functions
+        // None
+        
+    protected:	// Functions from base classes
+        // None
+
+    private:	// New functions
+	
+		/**
+		 * ConstructL
+		 * 2nd phase constructor.
+		 */
+		void ConstructL ();
+		
+		/**
+		 * CUITestServerStarterDocument.
+		 * C++ default constructor.
+		 * @param aApp Application creating this document.
+		 */
+		CUITestServerStarterDocument( CEikApplication& aApp );
+    
+	private:	// Functions from base classes
+        // None    
+    
+	public:		//Data
+	    // None
+        
+	protected:	// Data
+        // None
+        
+    private:	// Data
+        // None
+		
+    public:		// Friend classes
+        // None
+
+    protected:	// Friend classes
+        // None
+
+    private:	// Friend classes
+        // None	
+	};
+
+
+#endif /*UITESTSERVERSTARTERDOCUMENT_H_*/
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/avkon/uitestserverstarter/src/AknUiEnvProxy.cpp	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,683 @@
+/*
+* 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 module contains the implementation of 
+* CAknUiEnvProxy class member functions.
+*
+*/
+
+// INCLUDE FILES
+#include "AknUiEnvProxy.h"
+#include "UITestServerStarterAppUi.h"
+#include "EventUtil.h"
+
+#include <coeaui.h>
+#include <eikenv.h>
+#include <apgtask.h>
+#include <w32std.h>
+
+// EXTERNAL DATA STRUCTURES
+// None
+
+// EXTERNAL FUNCTION PROTOTYPES  
+// None
+
+// CONSTANTS
+// None
+
+// MACROS
+// None
+
+// LOCAL CONSTANTS AND MACROS
+// None
+
+// MODULE DATA STRUCTURES
+// None
+
+// LOCAL FUNCTION PROTOTYPES
+// None
+
+// FORWARD DECLARATIONS
+// None
+
+// ================= MEMBER FUNCTIONS =========================================
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CAknUiEnvProxy
+
+     Method: NewL
+
+     Description: NewL is first phase of two-phased constructor.
+
+     NewL is first phase of two-phased constructor.
+
+     Parameters: CUITestServerStarterAppUi* aAppUi: in: Pointer to CUITestServerStarterAppUi.
+     
+     Return Values: Pointer to new CAknUiEnvProxy object.
+
+     Errors/Exceptions: Leaves if new or ConstructL leaves.
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+CAknUiEnvProxy* CAknUiEnvProxy::NewL( CUITestServerStarterAppUi* aAppUi )
+	{
+	CAknUiEnvProxy* self = new(ELeave)CAknUiEnvProxy();
+	CleanupStack::PushL( self );
+	self->ConstructL( aAppUi );
+	CleanupStack::Pop( self );
+	return self;
+	}
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CAknUiEnvProxy
+
+     Method: ConstructL
+
+     Description: ConstructL is second phase of two-phased constructor.
+
+     Performs construction of CAknUiEnvProxy object.
+
+     Parameters: CUITestServerStarterAppUi* aAppUi: in: Pointer to CUITestServerStarterAppUi.
+     
+     Return Values: None.
+
+     Errors/Exceptions: None.
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+void CAknUiEnvProxy::ConstructL( CUITestServerStarterAppUi* aAppUi )
+	{	
+	iAppUi = aAppUi;
+	}
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CAknUiEnvProxy
+
+     Method: BringToForeground
+
+     Description: Brings UI component container to foreground.
+
+     Brings UI component container to foreground. 
+
+     Parameters: None.
+     
+     Return Values: None.
+
+     Errors/Exceptions: None.
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+void CAknUiEnvProxy::BringToForeground()
+	{
+	TApaTask task( CCoeEnv::Static()->WsSession() );
+	task.SetWgId( CCoeEnv::Static()->RootWin().Identifier() );
+	task.BringToForeground();	
+	}
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CAknUiEnvProxy
+
+     Method: SendToBackground
+
+     Description: Sends UI component container to background.
+
+     Sends UI component container to background.
+
+     Parameters: None.
+     
+     Return Values: None.
+
+     Errors/Exceptions: None.
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+void CAknUiEnvProxy::SendToBackground(  )
+	{
+	TApaTask task( CCoeEnv::Static()->WsSession() );
+	task.SetWgId( CCoeEnv::Static()->RootWin().Identifier() ); 
+	task.SendToBackground();		
+	}
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CAknUiEnvProxy
+
+     Method: PressKeyL
+
+     Description: Sends local key press event to UI component.
+
+     Sends key press event to UI component. UI component must be first added to 
+     AppUi stack to be able to recive this key event. 
+
+     Parameters: TRequestStatus* aStatus: out: Pointer to request status used to notify that
+     										   key event was recived.
+     			 TUint aKeyCode: in: Key code.
+     			 TInt aKeyScanCode: in: Key scan code.
+     			 TUint aKeyModifiers: in: Key modifiers
+     			 TInt aKeyRepeats: in: Key press repeats count.
+     
+     Return Values: None.
+
+     Errors/Exceptions: Leaves if some error occurs during key event sending.
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+void CAknUiEnvProxy::PressKeyL( TRequestStatus* aStatus, TUint aKeyCode, TInt aKeyScanCode, 
+							   TUint aKeyModifiers, TInt aKeyRepeats )
+	{
+	// Fill key event structure
+	TWsEvent wsEvent;
+	wsEvent.SetType(EEventKey);
+	TKeyEvent* keyEvent = wsEvent.Key();
+	keyEvent->iCode = aKeyCode;
+	keyEvent->iScanCode = aKeyScanCode;
+	keyEvent->iModifiers = aKeyModifiers;
+	keyEvent->iRepeats = aKeyRepeats;
+		
+	// Send info to AppUi that we are going to send key event
+	iAppUi->PrepareToPressKey();
+	
+	RWsSession& wsSession = CCoeEnv::Static()->WsSession();
+	TInt wgId = CCoeEnv::Static()->RootWin().Identifier();	
+	// Send key event
+	TInt ret = wsSession.SendEventToWindowGroup( wgId, wsEvent );
+	User::LeaveIfError( ret );
+	
+	wsSession.Flush();
+	
+	// Request notification when key press is handled
+	*aStatus = KRequestPending;
+	iAppUi->NotifyAboutHandledKeyPress( aStatus );
+	}
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CAknUiEnvProxy
+
+     Method: PressKeyL
+
+     Description: Sends global key press event to UI component.
+
+     Sends key press event to UI component which is currently focuused. 
+
+     Parameters: TUint aKeyCode: in: Key code.
+     			 TInt aKeyScanCode: in: Key scan code.
+     			 TUint aKeyModifiers: in: Key modifiers
+     			 TInt aKeyRepeats: in: Key press repeats count.
+     
+     Return Values: None.
+
+     Errors/Exceptions: Leaves if some error occurs during key event sending.
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+void CAknUiEnvProxy::PressKeyL( TUint aKeyCode, TInt aKeyScanCode, 
+							   TUint aKeyModifiers, TInt aKeyRepeats )
+	{	
+	// Fill key event structure
+	TWsEvent wsEvent;
+	wsEvent.SetType(EEventKey);
+	TKeyEvent* keyEvent = wsEvent.Key();
+	keyEvent->iCode = aKeyCode;
+	keyEvent->iScanCode = aKeyScanCode;
+	keyEvent->iModifiers = aKeyModifiers;
+	keyEvent->iRepeats = aKeyRepeats;
+		
+	RWsSession& wsSession = CCoeEnv::Static()->WsSession();	
+	TInt wgId = wsSession.GetFocusWindowGroup();	
+	TInt ret = wsSession.SendEventToWindowGroup( wgId, wsEvent );	
+	User::LeaveIfError( ret );
+	wsSession.Flush();
+	}
+
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CAknUiEnvProxy
+
+     Method: TypeTextL
+
+     Description: Sends text to UI component.
+
+     Sends text to UI component. UI component must be first added to 
+     AppUi stack to be able to recive this key event. 
+
+     Parameters: TRequestStatus* aStatus: out: Pointer to request status used to notify that
+     										   key event was recived.
+    			 TPtrC aText: in: Text which will be send to UI component. 
+     
+     Return Values: None.
+
+     Errors/Exceptions: Leaves if some error occurs during key event sending.
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+void CAknUiEnvProxy::TypeTextL( TRequestStatus* aStatus, const TDesC& aText )
+	{
+	TLex textParser( aText );
+
+	// Send info to AppUi that we are going to send text
+	iAppUi->PrepareToTypeText( aText.Length() );
+	
+	TInt wgId = CCoeEnv::Static()->RootWin().Identifier();
+	RWsSession& wsSession = CCoeEnv::Static()->WsSession();
+
+	TChar character = 0;
+	while ( ( character = textParser.Get() ) != 0 )
+		{
+		// Fill key event structure
+		TWsEvent wsEvent;
+		wsEvent.SetType(EEventKey);
+		TKeyEvent* keyEvent = wsEvent.Key();
+		keyEvent->iCode = character;
+		keyEvent->iScanCode = 0;
+		keyEvent->iModifiers = 0;
+		keyEvent->iRepeats = 0;
+		
+		// Send single character from text to UI component
+		TInt ret = wsSession.SendEventToWindowGroup( wgId, wsEvent );
+		User::LeaveIfError( ret );
+		wsSession.Flush();
+		}
+		
+	// Request notification when send text is recived
+	*aStatus = KRequestPending;
+	iAppUi->NotifyAboutHandledTextType( aStatus );	
+	}
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CAknUiEnvProxy
+
+     Method: TypeTextL
+
+     Description: Sends global text to UI component.
+
+     Sends global text to UI component. UI component must be focused to receive that event. 
+
+     Parameters: TPtrC aText: in: Text which will be send to UI component. 
+     
+     Return Values: None.
+
+     Errors/Exceptions: None.
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+void CAknUiEnvProxy::TypeTextL( const TDesC& aText )
+	{
+	TLex textParser( aText );
+
+	RWsSession& wsSession = CCoeEnv::Static()->WsSession();
+	TInt wgId = wsSession.GetFocusWindowGroup();
+
+	TChar character = 0;	
+	while ( ( character = textParser.Get() ) != 0 )
+		{
+		// Fill key event structure
+		TWsEvent wsEvent;
+		wsEvent.SetType(EEventKey);
+		TKeyEvent* keyEvent = wsEvent.Key();
+		keyEvent->iCode = character;
+		keyEvent->iScanCode = 0;
+		keyEvent->iModifiers = 0;
+		keyEvent->iRepeats = 0;
+		
+		// Send single character from text to UI component
+		TInt ret = wsSession.SendEventToWindowGroup( wgId, wsEvent );			
+		User::LeaveIfError( ret );
+		wsSession.Flush();
+		}
+	}
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CAknUiEnvProxy
+
+     Method: SendPointerEventL
+
+     Description: Send pointer event
+
+     Send pointer event.
+
+     Parameters: TUint aType: in: KEvent type.
+     			 const TPoint& aPosition: in: Position.
+     			      
+     Return Values: None.
+
+     Errors/Exceptions: None.
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+void CAknUiEnvProxy::SendPointerEventL( TUint aType, const TPoint& aPosition )
+	{
+	RWsSession& wsSession = CCoeEnv::Static()->WsSession();
+	TRawEvent pointerEvent;
+
+	if ( aType < TEventUtil::EButton1 ) {
+		pointerEvent.Set( ( TRawEvent::TType )aType, aPosition.iX, aPosition.iY );
+		wsSession.SimulateRawEvent( pointerEvent );
+		} 
+	else if ( ( aType >= TEventUtil::EButton1 ) && ( aType <= TEventUtil::EButton3 ) )
+		{
+		TRawEvent pointerEventDown;
+		TRawEvent pointerEventUp;
+		
+		switch ( aType )
+			{
+			case TEventUtil::EButton1:
+				{
+				pointerEventDown.Set( TRawEvent::EButton1Down, aPosition.iX, aPosition.iY );
+				pointerEventUp.Set( TRawEvent::EButton1Up, aPosition.iX, aPosition.iY );
+				}
+				break;
+			case TEventUtil::EButton2:
+				{
+				pointerEventDown.Set( TRawEvent::EButton2Down, aPosition.iX, aPosition.iY );
+				pointerEventUp.Set( TRawEvent::EButton2Up, aPosition.iX, aPosition.iY );
+				}
+				break;
+			case TEventUtil::EButton3:
+				{
+				pointerEventDown.Set( TRawEvent::EButton3Down, aPosition.iX, aPosition.iY );
+				pointerEventUp.Set( TRawEvent::EButton3Up, aPosition.iX, aPosition.iY );
+				}
+				break;
+			default:
+				User::Leave( KErrArgument );
+			}
+		wsSession.SimulateRawEvent( pointerEventDown );
+		wsSession.Flush();
+		wsSession.SimulateRawEvent( pointerEventUp );
+		wsSession.Flush();
+		}
+	else
+		{
+		User::Leave( KErrArgument );
+		}	
+	}
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CAknUiEnvProxy
+
+     Method: SendPointerEventL
+
+     Description: Send pointer event
+
+     Send pointer event.
+
+     Parameters: TRequestStatus* aStatus: in: Pointer to request status used to notify that
+     										  pointer event was recived.
+     			 TUint aType: in: KEvent type.
+     			 const TPoint& aPosition: in: Position.
+     			      
+     Return Values: None.
+
+     Errors/Exceptions: None.
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+void CAknUiEnvProxy::SendPointerEventL( TRequestStatus* aStatus, TUint aType, const TPoint& aPosition )
+	{
+	RWsSession& wsSession = CCoeEnv::Static()->WsSession();
+
+	if ( aType < TEventUtil::EButton1 ) {
+		TRawEvent pointerEvent;
+		pointerEvent.Set( ( TRawEvent::TType )aType, aPosition.iX, aPosition.iY );
+		// Send info to AppUi that we are going to send key event
+		iAppUi->PrepareToPointerEvent();
+		wsSession.SimulateRawEvent( pointerEvent );
+		// Request notification when key press is handled
+		*aStatus = KRequestPending;
+		iAppUi->NotifyAboutHandledPointerEvent( aStatus );	
+		} 
+	else if ( ( aType >= TEventUtil::EButton1 ) && ( aType <= TEventUtil::EButton3 ) )
+		{
+		TRawEvent pointerEventDown;
+		TRawEvent pointerEventUp;
+		switch ( aType )
+			{
+			case TEventUtil::EButton1:
+				{
+				pointerEventDown.Set( TRawEvent::EButton1Down, aPosition.iX, aPosition.iY );
+				pointerEventUp.Set( TRawEvent::EButton1Up, aPosition.iX, aPosition.iY );
+				}
+				break;
+			case TEventUtil::EButton2:
+				{
+				pointerEventDown.Set( TRawEvent::EButton2Down, aPosition.iX, aPosition.iY );
+				pointerEventUp.Set( TRawEvent::EButton2Up, aPosition.iX, aPosition.iY );
+				}
+				break;
+			case TEventUtil::EButton3:
+				{
+				pointerEventDown.Set( TRawEvent::EButton3Down, aPosition.iX, aPosition.iY );
+				pointerEventUp.Set( TRawEvent::EButton3Up, aPosition.iX, aPosition.iY );
+				}
+				break;
+			default:
+				User::Leave( KErrArgument );
+			}
+		
+			CCoeEnv::Static()->RootWin().SimulatePointerEvent( pointerEventDown );
+			wsSession.Flush();
+			
+			// Send info to AppUi that we are going to send key event
+			iAppUi->PrepareToPointerEvent();
+	
+			CCoeEnv::Static()->RootWin().SimulatePointerEvent( pointerEventUp );
+			wsSession.Flush();
+	
+			// Request notification when key press is handled
+			*aStatus = KRequestPending;
+			iAppUi->NotifyAboutHandledPointerEvent( aStatus );	
+		} 
+	else
+		{
+		User::Leave( KErrArgument );
+		}
+	}
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CAknUiEnvProxy
+
+     Method: ParseKeyCode
+
+     Description: Parses key code.
+
+     Parses key code.
+
+     Parameters: TDesC& aKeyCodeName: in: Key code name.
+     			 TUint& aKeyCode: out: Parsed key code.
+     
+     Return Values: KErrNone if no error occures during parsing.
+
+     Errors/Exceptions: None.
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+TInt CAknUiEnvProxy::ParseKeyCode( const TDesC& aKeyCodeName, TUint& aKeyCode ) const
+	{
+	return TEventUtil::ParseKeyCode( aKeyCodeName, aKeyCode );
+	}
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CAknUiEnvProxy
+
+     Method: ParseKeyScanCode
+
+     Description: Parses key scan code.
+
+     Parses key scan code.
+
+     Parameters: TDesC& aKeyScanCodeName: in: Key scan code name.
+     			 TUint& aKeyScanCode: out: Parsed key scan code.
+     
+     Return Values: KErrNone if no error occures during parsing.
+
+     Errors/Exceptions: None.
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+TInt CAknUiEnvProxy::ParseKeyScanCode( const TDesC& aKeyScanCodeName, TInt& aKeyScanCode ) const
+	{
+	return TEventUtil::ParseKeyScanCode( aKeyScanCodeName, aKeyScanCode );
+	}
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CAknUiEnvProxy
+
+     Method: ParseModifier
+
+     Description: Parses key modifier.
+
+     Parses key modifier.
+
+     Parameters: TDesC& aModifierName: in: Key modifier.
+     			 TUint& aModifier: out: Parsed key modifier.
+     
+     Return Values: KErrNone if no error occures during parsing.
+
+     Errors/Exceptions: None.
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+TInt CAknUiEnvProxy::ParseModifier( const TDesC& aModifierName, TUint& aModifier ) const
+	{
+	return TEventUtil::ParseModifier( aModifierName, aModifier );
+	}
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CAknUiEnvProxy
+
+     Method: ParsePointerEventType
+
+     Description: Parses pointer event type.
+
+     Parses key modifier.
+
+     Parameters: const TDesC& aPointerEventTypeName: in: Pointer event type.
+     			 TUint& aModifier: out: Parsed pointer event type.
+     
+     Return Values: KErrNone if no error occures during parsing.
+
+     Errors/Exceptions: None.
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+TInt CAknUiEnvProxy::ParsePointerEventType( const TDesC& aPointerEventTypeName, TUint& aPointerEventType ) const
+	{
+	return TEventUtil::ParsePointerEventType( aPointerEventTypeName, aPointerEventType );
+	}
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CAknUiEnvProxy
+
+     Method: CAknUiEnvProxy
+
+     Description: C++ constructor.
+
+     C++ constructor.
+
+     Parameters: None
+     
+     Return Values: None
+
+     Errors/Exceptions: None
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+CAknUiEnvProxy::CAknUiEnvProxy()
+	{	
+	}
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CAknUiEnvProxy
+
+     Method: ~CAknUiEnvProxy
+
+     Description: C++ destructor.
+
+     C++ destructor.
+
+     Parameters: None
+     
+     Return Values: None
+
+     Errors/Exceptions: None
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+CAknUiEnvProxy::~CAknUiEnvProxy()
+	{	
+	}
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/avkon/uitestserverstarter/src/EventUtil.cpp	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,1100 @@
+/*
+* 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 module contains the implementation of 
+* CAknUiEnvProxy class member functions.
+*
+*/
+
+// INCLUDE FILES
+#include "EventUtil.h"
+#include <e32def.h>
+#include <e32keys.h>
+#include <w32std.h>
+
+// EXTERNAL DATA STRUCTURES
+// None
+
+// EXTERNAL FUNCTION PROTOTYPES  
+// None
+
+// CONSTANTS
+// None
+
+// MACROS
+
+/**
+ * Key code names definition macro
+ */
+#define DefineKeyCodeNames( varName ) 			\
+	static TText* const varName[] =				\
+        {										\
+        (TText*)L"ekeynull",			\
+        (TText*)L"ekeybell",			\
+        (TText*)L"ekeybackspace",		\
+        (TText*)L"ekeytab",				\
+        (TText*)L"ekeylinefeed",		\
+        (TText*)L"ekeyverticaltab",		\
+        (TText*)L"ekeyformfeed",		\
+        (TText*)L"ekeyenter",			\
+        (TText*)L"ekeyescape",			\
+        (TText*)L"ekeyspace",			\
+        (TText*)L"ekeydelete",			\
+        (TText*)L"ekeyprintscreen",		\
+        (TText*)L"ekeypause",			\
+        (TText*)L"ekeyhome",			\
+        (TText*)L"ekeyend",				\
+        (TText*)L"ekeypageup",			\
+        (TText*)L"ekeypagedown",		\
+        (TText*)L"ekeyinsert",			\
+        (TText*)L"ekeyleftarrow",		\
+        (TText*)L"ekeyrightarrow",		\
+        (TText*)L"ekeyuparrow",			\
+        (TText*)L"ekeydownarrow",		\
+        (TText*)L"ekeyleftshift",		\
+        (TText*)L"ekeyrightshift",		\
+        (TText*)L"ekeyleftalt",			\
+        (TText*)L"ekeyrightalt",		\
+        (TText*)L"ekeyleftctrl",		\
+        (TText*)L"ekeyrightctrl",		\
+        (TText*)L"ekeyleftfunc",		\
+        (TText*)L"ekeyrightfunc",		\
+        (TText*)L"ekeycapslock",		\
+        (TText*)L"ekeynumlock",			\
+        (TText*)L"ekeyscrolllock",		\
+        (TText*)L"ekeyf1",				\
+        (TText*)L"ekeyf2",				\
+        (TText*)L"ekeyf3",				\
+        (TText*)L"ekeyf4",				\
+        (TText*)L"ekeyf5",				\
+        (TText*)L"ekeyf6",				\
+        (TText*)L"ekeyf7",				\
+        (TText*)L"ekeyf8",				\
+        (TText*)L"ekeyf9",				\
+        (TText*)L"ekeyf10",				\
+        (TText*)L"ekeyf11",				\
+        (TText*)L"ekeyf12",				\
+        (TText*)L"ekeyf13",				\
+        (TText*)L"ekeyf14",				\
+        (TText*)L"ekeyf15",				\
+        (TText*)L"ekeyf16",				\
+        (TText*)L"ekeyf17",				\
+        (TText*)L"ekeyf18",				\
+        (TText*)L"ekeyf19",				\
+        (TText*)L"ekeyf20",				\
+        (TText*)L"ekeyf21",				\
+        (TText*)L"ekeyf22",				\
+        (TText*)L"ekeyf23",				\
+        (TText*)L"ekeyf24",				\
+        (TText*)L"ekeyoff",				\
+        (TText*)L"ekeyinccontrast",		\
+        (TText*)L"ekeydeccontrast",		\
+        (TText*)L"ekeybacklighton",		\
+        (TText*)L"ekeybacklightoff",	\
+        (TText*)L"ekeybacklighttoggle",	\
+        (TText*)L"ekeysliderdown",		\
+        (TText*)L"ekeysliderup",		\
+        (TText*)L"ekeymenu",			\
+        (TText*)L"ekeydictaphoneplay",	\
+        (TText*)L"ekeydictaphonestop",	\
+        (TText*)L"ekeydictaphonerecord",\
+        (TText*)L"ekeyhelp",			\
+        (TText*)L"ekeydial",			\
+        (TText*)L"ekeyscreendimension0",\
+        (TText*)L"ekeyscreendimension1",\
+        (TText*)L"ekeyscreendimension2",\
+        (TText*)L"ekeyscreendimension3",\
+        (TText*)L"ekeyincvolume",		\
+        (TText*)L"ekeydecvolume",		\
+        (TText*)L"ekeydevice0",			\
+        (TText*)L"ekeydevice1",			\
+        (TText*)L"ekeydevice2",			\
+        (TText*)L"ekeydevice3",			\
+        (TText*)L"ekeydevice4",			\
+        (TText*)L"ekeydevice5",			\
+        (TText*)L"ekeydevice6",			\
+        (TText*)L"ekeydevice7",			\
+        (TText*)L"ekeydevice8",			\
+        (TText*)L"ekeydevice9",			\
+        (TText*)L"ekeydevicea",			\
+        (TText*)L"ekeydeviceb",			\
+        (TText*)L"ekeydevicec",			\
+        (TText*)L"ekeydeviced",			\
+        (TText*)L"ekeydevicee",			\
+        (TText*)L"ekeydevicef",			\
+        (TText*)L"ekeyapplication0",	\
+        (TText*)L"ekeyapplication1",	\
+        (TText*)L"ekeyapplication2",	\
+        (TText*)L"ekeyapplication3",	\
+        (TText*)L"ekeyapplication4",	\
+        (TText*)L"ekeyapplication5",	\
+        (TText*)L"ekeyapplication6",	\
+        (TText*)L"ekeyapplication7",	\
+        (TText*)L"ekeyapplication8",	\
+        (TText*)L"ekeyapplication9",	\
+        (TText*)L"ekeyapplicationa",	\
+        (TText*)L"ekeyapplicationb",	\
+        (TText*)L"ekeyapplicationc",	\
+        (TText*)L"ekeyapplicationd",	\
+        (TText*)L"ekeyapplicatione",	\
+        (TText*)L"ekeyapplicationf",	\
+        (TText*)L"ekeyyes",				\
+        (TText*)L"ekeyno",				\
+        (TText*)L"ekeyincbrightness",	\
+        (TText*)L"ekeydecbrightness",	\
+        (TText*)L"ekeykeyboardextend",	\
+        (TText*)L"ekeydevice10",		\
+        (TText*)L"ekeydevice11",		\
+        (TText*)L"ekeydevice12",		\
+        (TText*)L"ekeydevice13",		\
+        (TText*)L"ekeydevice14",		\
+        (TText*)L"ekeydevice15",		\
+        (TText*)L"ekeydevice16",		\
+        (TText*)L"ekeydevice17",		\
+        (TText*)L"ekeydevice18",		\
+        (TText*)L"ekeydevice19",		\
+        (TText*)L"ekeydevice1a",		\
+        (TText*)L"ekeydevice1b",		\
+        (TText*)L"ekeydevice1c",		\
+        (TText*)L"ekeydevice1d",		\
+        (TText*)L"ekeydevice1e",		\
+        (TText*)L"ekeydevice1f",		\
+        (TText*)L"ekeyapplication10",	\
+        (TText*)L"ekeyapplication11",	\
+        (TText*)L"ekeyapplication12",	\
+        (TText*)L"ekeyapplication13",	\
+        (TText*)L"ekeyapplication14",	\
+        (TText*)L"ekeyapplication15",	\
+        (TText*)L"ekeyapplication16",	\
+        (TText*)L"ekeyapplication17",	\
+        (TText*)L"ekeyapplication18",	\
+        (TText*)L"ekeyapplication19",	\
+        (TText*)L"ekeyapplication1a",	\
+        (TText*)L"ekeyapplication1b",	\
+        (TText*)L"ekeyapplication1c",	\
+        (TText*)L"ekeyapplication1d",	\
+        (TText*)L"ekeyapplication1e",	\
+        (TText*)L"ekeyapplication1f",	\
+        }
+
+/**
+ * Key codes definition macro
+ */
+#define DefineKeyCodes( varName )		\
+	static TUint const varName[] = 		\
+		{								\
+        (TUint)EKeyNull,				\
+        (TUint)EKeyBell,				\
+        (TUint)EKeyBackspace,			\
+        (TUint)EKeyTab,					\
+        (TUint)EKeyLineFeed,			\
+        (TUint)EKeyVerticalTab,			\
+        (TUint)EKeyFormFeed,			\
+        (TUint)EKeyEnter,				\
+        (TUint)EKeyEscape,				\
+        (TUint)EKeySpace,				\
+        (TUint)EKeyDelete,				\
+        (TUint)EKeyPrintScreen,			\
+        (TUint)EKeyPause,				\
+        (TUint)EKeyHome,				\
+        (TUint)EKeyEnd,					\
+        (TUint)EKeyPageUp,				\
+        (TUint)EKeyPageDown,			\
+        (TUint)EKeyInsert,				\
+        (TUint)EKeyLeftArrow,			\
+        (TUint)EKeyRightArrow,			\
+        (TUint)EKeyUpArrow,				\
+        (TUint)EKeyDownArrow,			\
+        (TUint)EKeyLeftShift,			\
+        (TUint)EKeyRightShift,			\
+        (TUint)EKeyLeftAlt,				\
+        (TUint)EKeyRightAlt,			\
+        (TUint)EKeyLeftCtrl,			\
+        (TUint)EKeyRightCtrl,			\
+        (TUint)EKeyLeftFunc,			\
+        (TUint)EKeyRightFunc,			\
+        (TUint)EKeyCapsLock,			\
+        (TUint)EKeyNumLock,				\
+        (TUint)EKeyScrollLock,			\
+        (TUint)EKeyF1,					\
+        (TUint)EKeyF2,					\
+        (TUint)EKeyF3,					\
+        (TUint)EKeyF4,					\
+        (TUint)EKeyF5,					\
+        (TUint)EKeyF6,					\
+        (TUint)EKeyF7,					\
+        (TUint)EKeyF8,					\
+        (TUint)EKeyF9,					\
+        (TUint)EKeyF10,					\
+        (TUint)EKeyF11,					\
+        (TUint)EKeyF12,					\
+        (TUint)EKeyF13,					\
+        (TUint)EKeyF14,					\
+        (TUint)EKeyF15,					\
+        (TUint)EKeyF16,					\
+        (TUint)EKeyF17,					\
+        (TUint)EKeyF18,					\
+        (TUint)EKeyF19,					\
+        (TUint)EKeyF20,					\
+        (TUint)EKeyF21,					\
+        (TUint)EKeyF22,					\
+        (TUint)EKeyF23,					\
+        (TUint)EKeyF24,					\
+        (TUint)EKeyOff,					\
+        (TUint)EKeyIncContrast,			\
+        (TUint)EKeyDecContrast,			\
+        (TUint)EKeyBacklightOn,			\
+        (TUint)EKeyBacklightOff,		\
+        (TUint)EKeyBacklightToggle,		\
+        (TUint)EKeySliderDown,			\
+        (TUint)EKeySliderUp,			\
+        (TUint)EKeyMenu,				\
+        (TUint)EKeyDictaphonePlay,		\
+        (TUint)EKeyDictaphoneStop,		\
+        (TUint)EKeyDictaphoneRecord,	\
+        (TUint)EKeyHelp,				\
+        (TUint)EKeyDial,				\
+        (TUint)EKeyScreenDimension0,	\
+        (TUint)EKeyScreenDimension1,	\
+        (TUint)EKeyScreenDimension2,	\
+        (TUint)EKeyScreenDimension3,	\
+        (TUint)EKeyIncVolume,			\
+        (TUint)EKeyDecVolume,			\
+        (TUint)EKeyDevice0,				\
+        (TUint)EKeyDevice1,				\
+        (TUint)EKeyDevice2,				\
+        (TUint)EKeyDevice3,				\
+        (TUint)EKeyDevice4,				\
+        (TUint)EKeyDevice5,				\
+        (TUint)EKeyDevice6,				\
+        (TUint)EKeyDevice7,				\
+        (TUint)EKeyDevice8,				\
+        (TUint)EKeyDevice9,				\
+        (TUint)EKeyDeviceA,				\
+        (TUint)EKeyDeviceB,				\
+        (TUint)EKeyDeviceC,				\
+        (TUint)EKeyDeviceD,				\
+        (TUint)EKeyDeviceE,				\
+        (TUint)EKeyDeviceF,				\
+        (TUint)EKeyApplication0,		\
+        (TUint)EKeyApplication1,		\
+        (TUint)EKeyApplication2,		\
+        (TUint)EKeyApplication3,		\
+        (TUint)EKeyApplication4,		\
+        (TUint)EKeyApplication5,		\
+        (TUint)EKeyApplication6,		\
+        (TUint)EKeyApplication7,		\
+        (TUint)EKeyApplication8,		\
+        (TUint)EKeyApplication9,		\
+        (TUint)EKeyApplicationA,		\
+        (TUint)EKeyApplicationB,		\
+        (TUint)EKeyApplicationC,		\
+        (TUint)EKeyApplicationD,		\
+        (TUint)EKeyApplicationE,		\
+        (TUint)EKeyApplicationF,		\
+        (TUint)EKeyYes,					\
+        (TUint)EKeyNo,					\
+        (TUint)EKeyIncBrightness,		\
+        (TUint)EKeyDecBrightness,		\
+        (TUint)EKeyKeyboardExtend,		\
+        (TUint)EKeyDevice10,			\
+        (TUint)EKeyDevice11,			\
+        (TUint)EKeyDevice12,			\
+        (TUint)EKeyDevice13,			\
+        (TUint)EKeyDevice14,			\
+        (TUint)EKeyDevice15,			\
+        (TUint)EKeyDevice16,			\
+        (TUint)EKeyDevice17,			\
+        (TUint)EKeyDevice18,			\
+        (TUint)EKeyDevice19,			\
+        (TUint)EKeyDevice1A,			\
+        (TUint)EKeyDevice1B,			\
+        (TUint)EKeyDevice1C,			\
+        (TUint)EKeyDevice1D,			\
+        (TUint)EKeyDevice1E,			\
+        (TUint)EKeyDevice1F,			\
+        (TUint)EKeyApplication10,		\
+        (TUint)EKeyApplication11,		\
+        (TUint)EKeyApplication12,		\
+        (TUint)EKeyApplication13,		\
+        (TUint)EKeyApplication14,		\
+        (TUint)EKeyApplication15,		\
+        (TUint)EKeyApplication16,		\
+        (TUint)EKeyApplication17,		\
+        (TUint)EKeyApplication18,		\
+        (TUint)EKeyApplication19,		\
+        (TUint)EKeyApplication1A,		\
+        (TUint)EKeyApplication1B,		\
+        (TUint)EKeyApplication1C,		\
+        (TUint)EKeyApplication1D,		\
+        (TUint)EKeyApplication1E,		\
+        (TUint)EKeyApplication1F,		\
+		}
+
+/**
+ * Key scan code names definition macro.
+ */
+#define DefineKeyScanCodeNames( varName ) 			\
+	static TText* const varName[] =					\
+        {											\
+        (TText*)L"estdkeynull",						\
+        (TText*)L"estdkeybackspace",				\
+        (TText*)L"estdkeytab",						\
+        (TText*)L"estdkeyenter",					\
+        (TText*)L"estdkeyescape",					\
+        (TText*)L"estdkeyspace",					\
+        (TText*)L"estdkeyprintscreen",				\
+        (TText*)L"estdkeypause",					\
+        (TText*)L"estdkeyhome",						\
+        (TText*)L"estdkeyend",						\
+        (TText*)L"estdkeypageup",					\
+        (TText*)L"estdkeypagedown",					\
+        (TText*)L"estdkeyinsert",					\
+        (TText*)L"estdkeydelete",					\
+        (TText*)L"estdkeyleftarrow",				\
+        (TText*)L"estdkeyrightarrow",				\
+        (TText*)L"estdkeyuparrow",					\
+        (TText*)L"estdkeydownarrow",				\
+        (TText*)L"estdkeyleftshift",				\
+        (TText*)L"estdkeyrightshift",				\
+        (TText*)L"estdkeyleftalt",					\
+        (TText*)L"estdkeyrightalt",					\
+        (TText*)L"estdkeyleftctrl",					\
+        (TText*)L"estdkeyrightctrl",				\
+        (TText*)L"estdkeyleftfunc",					\
+        (TText*)L"estdkeyrightfunc",				\
+        (TText*)L"estdkeycapslock",					\
+        (TText*)L"estdkeynumlock",					\
+        (TText*)L"estdkeyscrolllock",				\
+        (TText*)L"estdkeyf1",						\
+        (TText*)L"estdkeyf2",						\
+        (TText*)L"estdkeyf3",						\
+        (TText*)L"estdkeyf4",						\
+        (TText*)L"estdkeyf5",						\
+        (TText*)L"estdkeyf6",						\
+        (TText*)L"estdkeyf7",						\
+        (TText*)L"estdkeyf8",						\
+        (TText*)L"estdkeyf9",						\
+        (TText*)L"estdkeyf10",						\
+        (TText*)L"estdkeyf11",						\
+        (TText*)L"estdkeyf12",						\
+        (TText*)L"estdkeyf13",						\
+        (TText*)L"estdkeyf14",						\
+        (TText*)L"estdkeyf15",						\
+        (TText*)L"estdkeyf16",						\
+        (TText*)L"estdkeyf17",						\
+        (TText*)L"estdkeyf18",						\
+        (TText*)L"estdkeyf19",						\
+        (TText*)L"estdkeyf20",						\
+        (TText*)L"estdkeyf21",						\
+        (TText*)L"estdkeyf22",						\
+        (TText*)L"estdkeyf23",						\
+        (TText*)L"estdkeyf24",						\
+        (TText*)L"estdkeyxxx",						\
+        (TText*)L"estdkeycomma",					\
+        (TText*)L"estdkeyfullstop",					\
+        (TText*)L"estdkeyforwardslash",				\
+        (TText*)L"estdkeybackslash",				\
+        (TText*)L"estdkeysemicolon",				\
+        (TText*)L"estdkeysinglequote",				\
+        (TText*)L"estdkeyhash",						\
+        (TText*)L"estdkeysquarebracketleft",		\
+        (TText*)L"estdkeysquarebracketright",		\
+        (TText*)L"estdkeyminus",					\
+        (TText*)L"estdkeyequals",					\
+        (TText*)L"estdkeynkpforwardslash",			\
+        (TText*)L"estdkeynkpasterisk",				\
+        (TText*)L"estdkeynkpminus",					\
+        (TText*)L"estdkeynkpplus",					\
+        (TText*)L"estdkeynkpenter",					\
+        (TText*)L"estdkeynkp1",						\
+        (TText*)L"estdkeynkp2",						\
+        (TText*)L"estdkeynkp3",						\
+        (TText*)L"estdkeynkp4",						\
+        (TText*)L"estdkeynkp5",						\
+        (TText*)L"estdkeynkp6",						\
+        (TText*)L"estdkeynkp7",						\
+        (TText*)L"estdkeynkp8",						\
+        (TText*)L"estdkeynkp9",						\
+        (TText*)L"estdkeynkp0",						\
+        (TText*)L"estdkeynkpfullstop",				\
+        (TText*)L"estdkeymenu",						\
+        (TText*)L"estdkeybacklighton",				\
+        (TText*)L"estdkeybacklightoff",				\
+        (TText*)L"estdkeybacklighttoggle",			\
+        (TText*)L"estdkeyinccontrast",				\
+        (TText*)L"estdkeydeccontrast",				\
+        (TText*)L"estdkeysliderdown",				\
+        (TText*)L"estdkeysliderup",					\
+        (TText*)L"estdkeydictaphoneplay",			\
+        (TText*)L"estdkeydictaphonestop",			\
+        (TText*)L"estdkeydictaphonerecord",			\
+        (TText*)L"estdkeyhelp",						\
+        (TText*)L"estdkeyoff",						\
+        (TText*)L"estdkeydial",						\
+        (TText*)L"estdkeyincvolume",				\
+        (TText*)L"estdkeydecvolume",				\
+        (TText*)L"estdkeydevice0",					\
+        (TText*)L"estdkeydevice1",					\
+        (TText*)L"estdkeydevice2",					\
+        (TText*)L"estdkeydevice3",					\
+        (TText*)L"estdkeydevice4",					\
+        (TText*)L"estdkeydevice5",					\
+        (TText*)L"estdkeydevice6",					\
+        (TText*)L"estdkeydevice7",					\
+        (TText*)L"estdkeydevice8",					\
+        (TText*)L"estdkeydevice9",					\
+        (TText*)L"estdkeydevicea",					\
+        (TText*)L"estdkeydeviceb",					\
+        (TText*)L"estdkeydevicec",					\
+        (TText*)L"estdkeydeviced",					\
+        (TText*)L"estdkeydevicee",					\
+        (TText*)L"estdkeydevicef",					\
+        (TText*)L"estdkeyapplication0",				\
+        (TText*)L"estdkeyapplication1",				\
+        (TText*)L"estdkeyapplication2",				\
+        (TText*)L"estdkeyapplication3",				\
+        (TText*)L"estdkeyapplication4",				\
+        (TText*)L"estdkeyapplication5",				\
+        (TText*)L"estdkeyapplication6",				\
+        (TText*)L"estdkeyapplication7",				\
+        (TText*)L"estdkeyapplication8",				\
+        (TText*)L"estdkeyapplication9",				\
+        (TText*)L"estdkeyapplicationa",				\
+        (TText*)L"estdkeyapplicationb",				\
+        (TText*)L"estdkeyapplicationc",				\
+        (TText*)L"estdkeyapplicationd",				\
+        (TText*)L"estdkeyapplicatione",				\
+        (TText*)L"estdkeyapplicationf",				\
+        (TText*)L"estdkeyyes",						\
+        (TText*)L"estdkeyno",						\
+        (TText*)L"estdkeyincbrightness",			\
+        (TText*)L"estdkeydecbrightness",			\
+        (TText*)L"estdkeykeyboardextend",			\
+        (TText*)L"estdkeydevice10",					\
+        (TText*)L"estdkeydevice11",					\
+        (TText*)L"estdkeydevice12",					\
+        (TText*)L"estdkeydevice13",					\
+        (TText*)L"estdkeydevice14",					\
+        (TText*)L"estdkeydevice15",					\
+        (TText*)L"estdkeydevice16",					\
+        (TText*)L"estdkeydevice17",					\
+        (TText*)L"estdkeydevice18",					\
+        (TText*)L"estdkeydevice19",					\
+        (TText*)L"estdkeydevice1a",					\
+        (TText*)L"estdkeydevice1b",					\
+        (TText*)L"estdkeydevice1c",					\
+        (TText*)L"estdkeydevice1d",					\
+        (TText*)L"estdkeydevice1e",					\
+        (TText*)L"estdkeydevice1f",					\
+        (TText*)L"estdkeyapplication10",			\
+        (TText*)L"estdkeyapplication11",			\
+        (TText*)L"estdkeyapplication12",			\
+        (TText*)L"estdkeyapplication13",			\
+        (TText*)L"estdkeyapplication14",			\
+        (TText*)L"estdkeyapplication15",			\
+        (TText*)L"estdkeyapplication16",			\
+        (TText*)L"estdkeyapplication17",			\
+        (TText*)L"estdkeyapplication18",			\
+        (TText*)L"estdkeyapplication19",			\
+        (TText*)L"estdkeyapplication1a",			\
+        (TText*)L"estdkeyapplication1b",			\
+        (TText*)L"estdkeyapplication1c",			\
+        (TText*)L"estdkeyapplication1d",			\
+        (TText*)L"estdkeyapplication1e",			\
+        (TText*)L"estdkeyapplication1f",			\
+        }
+
+/**
+ * Key scan codes definition macro.
+ */
+#define DefineKeyScanCodes( varName )		\
+	static TUint const varName[] = 			\
+		{									\
+        (TUint)EStdKeyNull,					\
+        (TUint)EStdKeyBackspace,			\
+        (TUint)EStdKeyTab,					\
+        (TUint)EStdKeyEnter,				\
+        (TUint)EStdKeyEscape,				\
+        (TUint)EStdKeySpace,				\
+        (TUint)EStdKeyPrintScreen,			\
+        (TUint)EStdKeyPause,				\
+        (TUint)EStdKeyHome,					\
+        (TUint)EStdKeyEnd,					\
+        (TUint)EStdKeyPageUp,				\
+        (TUint)EStdKeyPageDown,				\
+        (TUint)EStdKeyInsert,				\
+        (TUint)EStdKeyDelete,				\
+        (TUint)EStdKeyLeftArrow,			\
+        (TUint)EStdKeyRightArrow,			\
+        (TUint)EStdKeyUpArrow,				\
+        (TUint)EStdKeyDownArrow,			\
+        (TUint)EStdKeyLeftShift,			\
+        (TUint)EStdKeyRightShift,			\
+        (TUint)EStdKeyLeftAlt,				\
+        (TUint)EStdKeyRightAlt,				\
+        (TUint)EStdKeyLeftCtrl,				\
+        (TUint)EStdKeyRightCtrl,			\
+        (TUint)EStdKeyLeftFunc,				\
+        (TUint)EStdKeyRightFunc,			\
+        (TUint)EStdKeyCapsLock,				\
+        (TUint)EStdKeyNumLock,				\
+        (TUint)EStdKeyScrollLock,			\
+        (TUint)EStdKeyF1,					\
+        (TUint)EStdKeyF2,					\
+        (TUint)EStdKeyF3,					\
+        (TUint)EStdKeyF4,					\
+        (TUint)EStdKeyF5,					\
+        (TUint)EStdKeyF6,					\
+        (TUint)EStdKeyF7,					\
+        (TUint)EStdKeyF8,					\
+        (TUint)EStdKeyF9,					\
+        (TUint)EStdKeyF10,					\
+        (TUint)EStdKeyF11,					\
+        (TUint)EStdKeyF12,					\
+        (TUint)EStdKeyF13,					\
+        (TUint)EStdKeyF14,					\
+        (TUint)EStdKeyF15,					\
+        (TUint)EStdKeyF16,					\
+        (TUint)EStdKeyF17,					\
+        (TUint)EStdKeyF18,					\
+        (TUint)EStdKeyF19,					\
+        (TUint)EStdKeyF20,					\
+        (TUint)EStdKeyF21,					\
+        (TUint)EStdKeyF22,					\
+        (TUint)EStdKeyF23,					\
+        (TUint)EStdKeyF24,					\
+        (TUint)EStdKeyXXX,					\
+        (TUint)EStdKeyComma,				\
+        (TUint)EStdKeyFullStop,				\
+        (TUint)EStdKeyForwardSlash,			\
+        (TUint)EStdKeyBackSlash,			\
+        (TUint)EStdKeySemiColon,			\
+        (TUint)EStdKeySingleQuote,			\
+        (TUint)EStdKeyHash,					\
+        (TUint)EStdKeySquareBracketLeft,	\
+        (TUint)EStdKeySquareBracketRight,	\
+        (TUint)EStdKeyMinus,				\
+        (TUint)EStdKeyEquals,				\
+        (TUint)EStdKeyNkpForwardSlash,		\
+        (TUint)EStdKeyNkpAsterisk,			\
+        (TUint)EStdKeyNkpMinus,				\
+        (TUint)EStdKeyNkpPlus,				\
+        (TUint)EStdKeyNkpEnter,				\
+        (TUint)EStdKeyNkp1,					\
+        (TUint)EStdKeyNkp2,					\
+        (TUint)EStdKeyNkp3,					\
+        (TUint)EStdKeyNkp4,					\
+        (TUint)EStdKeyNkp5,					\
+        (TUint)EStdKeyNkp6,					\
+        (TUint)EStdKeyNkp7,					\
+        (TUint)EStdKeyNkp8,					\
+        (TUint)EStdKeyNkp9,					\
+        (TUint)EStdKeyNkp0,					\
+        (TUint)EStdKeyNkpFullStop,			\
+        (TUint)EStdKeyMenu,					\
+        (TUint)EStdKeyBacklightOn,			\
+        (TUint)EStdKeyBacklightOff,			\
+        (TUint)EStdKeyBacklightToggle,		\
+        (TUint)EStdKeyIncContrast,			\
+        (TUint)EStdKeyDecContrast,			\
+        (TUint)EStdKeySliderDown,			\
+        (TUint)EStdKeySliderUp,				\
+        (TUint)EStdKeyDictaphonePlay,		\
+        (TUint)EStdKeyDictaphoneStop,		\
+        (TUint)EStdKeyDictaphoneRecord,		\
+        (TUint)EStdKeyHelp,					\
+        (TUint)EStdKeyOff,					\
+        (TUint)EStdKeyDial,					\
+        (TUint)EStdKeyIncVolume,			\
+        (TUint)EStdKeyDecVolume,			\
+        (TUint)EStdKeyDevice0,				\
+        (TUint)EStdKeyDevice1,				\
+        (TUint)EStdKeyDevice2,				\
+        (TUint)EStdKeyDevice3,				\
+        (TUint)EStdKeyDevice4,				\
+        (TUint)EStdKeyDevice5,				\
+        (TUint)EStdKeyDevice6,				\
+        (TUint)EStdKeyDevice7,				\
+        (TUint)EStdKeyDevice8,				\
+        (TUint)EStdKeyDevice9,				\
+        (TUint)EStdKeyDeviceA,				\
+        (TUint)EStdKeyDeviceB,				\
+        (TUint)EStdKeyDeviceC,				\
+        (TUint)EStdKeyDeviceD,				\
+        (TUint)EStdKeyDeviceE,				\
+        (TUint)EStdKeyDeviceF,				\
+        (TUint)EStdKeyApplication0,			\
+        (TUint)EStdKeyApplication1,			\
+        (TUint)EStdKeyApplication2,			\
+        (TUint)EStdKeyApplication3,			\
+        (TUint)EStdKeyApplication4,			\
+        (TUint)EStdKeyApplication5,			\
+        (TUint)EStdKeyApplication6,			\
+        (TUint)EStdKeyApplication7,			\
+        (TUint)EStdKeyApplication8,			\
+        (TUint)EStdKeyApplication9,			\
+        (TUint)EStdKeyApplicationA,			\
+        (TUint)EStdKeyApplicationB,			\
+        (TUint)EStdKeyApplicationC,			\
+        (TUint)EStdKeyApplicationD,			\
+        (TUint)EStdKeyApplicationE,			\
+        (TUint)EStdKeyApplicationF,			\
+        (TUint)EStdKeyYes,					\
+        (TUint)EStdKeyNo,					\
+        (TUint)EStdKeyIncBrightness,		\
+        (TUint)EStdKeyDecBrightness,		\
+        (TUint)EStdKeyKeyboardExtend,		\
+        (TUint)EStdKeyDevice10,				\
+        (TUint)EStdKeyDevice11,				\
+        (TUint)EStdKeyDevice12,				\
+        (TUint)EStdKeyDevice13,				\
+        (TUint)EStdKeyDevice14,				\
+        (TUint)EStdKeyDevice15,				\
+        (TUint)EStdKeyDevice16,				\
+        (TUint)EStdKeyDevice17,				\
+        (TUint)EStdKeyDevice18,				\
+        (TUint)EStdKeyDevice19,				\
+        (TUint)EStdKeyDevice1A,				\
+        (TUint)EStdKeyDevice1B,				\
+        (TUint)EStdKeyDevice1C,				\
+        (TUint)EStdKeyDevice1D,				\
+        (TUint)EStdKeyDevice1E,				\
+        (TUint)EStdKeyDevice1F,				\
+        (TUint)EStdKeyApplication10,		\
+        (TUint)EStdKeyApplication11,		\
+        (TUint)EStdKeyApplication12,		\
+        (TUint)EStdKeyApplication13,		\
+        (TUint)EStdKeyApplication14,		\
+        (TUint)EStdKeyApplication15,		\
+        (TUint)EStdKeyApplication16,		\
+        (TUint)EStdKeyApplication17,		\
+        (TUint)EStdKeyApplication18,		\
+        (TUint)EStdKeyApplication19,		\
+        (TUint)EStdKeyApplication1A,		\
+        (TUint)EStdKeyApplication1B,		\
+        (TUint)EStdKeyApplication1C,		\
+        (TUint)EStdKeyApplication1D,		\
+        (TUint)EStdKeyApplication1E,		\
+        (TUint)EStdKeyApplication1F,		\
+        }
+
+/**
+ * Key modifier names definition macro.
+ */
+#define DefineModifiers( varName )			\
+	static TUint const varName[] = 			\
+		{									\
+        (TUint)EModifierAutorepeatable,		\
+        (TUint)EModifierKeypad,				\
+        (TUint)EModifierLeftAlt,			\
+        (TUint)EModifierRightAlt,			\
+        (TUint)EModifierAlt,				\
+        (TUint)EModifierLeftCtrl,			\
+        (TUint)EModifierRightCtrl,			\
+        (TUint)EModifierCtrl,				\
+        (TUint)EModifierLeftShift,			\
+        (TUint)EModifierRightShift,			\
+        (TUint)EModifierShift,				\
+        (TUint)EModifierLeftFunc,			\
+        (TUint)EModifierRightFunc,			\
+        (TUint)EModifierFunc,				\
+        (TUint)EModifierCapsLock,			\
+        (TUint)EModifierNumLock,			\
+        (TUint)EModifierScrollLock,			\
+        (TUint)EModifierKeyUp,				\
+        (TUint)EModifierSpecial,			\
+        (TUint)EModifierDoubleClick,		\
+        (TUint)EModifierPureKeycode,		\
+        (TUint)EModifierKeyboardExtend,		\
+        (TUint)EModifierCancelRotation,		\
+        (TUint)EModifierRotateBy90,			\
+        (TUint)EModifierRotateBy180,		\
+        (TUint)EModifierRotateBy270,		\
+        (TUint)EModifierPointer3DButton1,	\
+        (TUint)EModifierPointer3DButton2,	\
+        (TUint)EModifierPointer3DButton3,	\
+        (TUint)EAllModifiers,				\
+    }
+
+/**
+ * Key modifiers definition macro.
+ */
+#define DefineModifierNames( varName ) 				\
+	static TText* const varName[] =					\
+        {											\
+        (TText*)L"estdkeynull",						\
+        (TText*)L"emodifierautorepeatable",			\
+        (TText*)L"emodifierkeypad",					\
+        (TText*)L"emodifierleftalt",				\
+        (TText*)L"emodifierrightalt",				\
+        (TText*)L"emodifieralt",					\
+        (TText*)L"emodifierleftctrl",				\
+        (TText*)L"emodifierrightctrl",				\
+        (TText*)L"emodifierctrl",					\
+        (TText*)L"emodifierleftshift",				\
+        (TText*)L"emodifierrightshift",				\
+        (TText*)L"emodifiershift",					\
+        (TText*)L"emodifierleftfunc",				\
+        (TText*)L"emodifierrightfunc",				\
+        (TText*)L"emodifierfunc",					\
+        (TText*)L"emodifiercapslock",				\
+        (TText*)L"emodifiernumlock",				\
+        (TText*)L"emodifierscrolllock",				\
+        (TText*)L"emodifierkeyup",					\
+        (TText*)L"emodifierspecial",				\
+        (TText*)L"emodifierdoubleclick",			\
+        (TText*)L"emodifierpurekeycode",			\
+        (TText*)L"emodifierkeyboardextend",			\
+        (TText*)L"emodifiercancelrotation",			\
+        (TText*)L"emodifierrotateby90",				\
+        (TText*)L"emodifierrotateby180",			\
+        (TText*)L"emodifierrotateby270",			\
+        (TText*)L"emodifierpointer3dbutton1",		\
+        (TText*)L"emodifierpointer3dbutton2",		\
+        (TText*)L"emodifierpointer3dbutton3",		\
+        (TText*)L"eallmodifiers",					\
+        }
+        
+
+/**
+ * Pointer event type names definition macro
+ */
+#define DefinePointerEventTypeNames( varName ) 			\
+	static TText* const varName[] =						\
+        {												\
+        (TText*)L"epointermove",						\
+        (TText*)L"epointerswitchon",							\
+        (TText*)L"ebutton1down",						\
+        (TText*)L"ebutton1up",							\
+        (TText*)L"ebutton2down",						\
+        (TText*)L"ebutton2up",							\
+        (TText*)L"ebutton3down",						\
+        (TText*)L"ebutton3up",							\
+        (TText*)L"ebutton1",							\
+        (TText*)L"ebutton2",							\
+        (TText*)L"ebutton3",							\
+        }
+
+/**
+ * Pointer event type codes definition macro.
+ */
+#define DefinePointerEventTypes( varName )					\
+	static TInt const varName[] = 							\
+		{													\
+        (TUint)TRawEvent::EPointerMove,						\
+        (TUint)TRawEvent::EPointerSwitchOn,					\
+        (TUint)TRawEvent::EButton1Down,						\
+        (TUint)TRawEvent::EButton1Up,						\
+        (TUint)TRawEvent::EButton2Down,						\
+        (TUint)TRawEvent::EButton2Up,						\
+        (TUint)TRawEvent::EButton3Down,						\
+        (TUint)TRawEvent::EButton3Up,						\
+        (TUint)TEventUtil::EButton1,						\
+        (TUint)TEventUtil::EButton2,						\
+        (TUint)TEventUtil::EButton3,						\
+		}
+
+// LOCAL CONSTANTS AND MACROS
+// None
+
+// MODULE DATA STRUCTURES
+// None
+
+// LOCAL FUNCTION PROTOTYPES
+// None
+
+// FORWARD DECLARATIONS
+// None
+
+// ================= MEMBER FUNCTIONS =========================================
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: TEventUtil
+
+     Method: GetKeyCodeName
+
+     Description: Gets key name.
+
+     Returns selected key name. 
+
+     Parameters: TUint aKeyCode: out: Key code.
+     
+     Return Values: Key name.
+
+     Errors/Exceptions: None.
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+TPtrC TEventUtil::GetKeyCodeName( TUint aKeyCode )
+	{
+	DefineKeyCodeNames( keyCodeNames );
+	DefineKeyCodes( keyCodes );
+	int keyCodeNamesCount = (sizeof( keyCodeNames )/sizeof(TText*));
+	
+	for ( int i = 0; i < keyCodeNamesCount; i++ ) {
+		if ( keyCodes[ i ] == aKeyCode ) 
+			{
+			return keyCodeNames[ i ];
+			}
+	}
+
+	return NULL;
+	}
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: TEventUtil
+
+     Method: GetKeyScanCodeName
+
+     Description: Gets key scan code name.
+
+     Returns selected key scan code name. 
+
+     Parameters: TUint aKeyCode: out: Key scan code.
+     
+     Return Values: Key scan code name.
+
+     Errors/Exceptions: None.
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+TPtrC TEventUtil::GetKeyScanCodeName( TInt aKeyScanCode )
+	{	
+	DefineKeyScanCodeNames( keyScanCodeNames );
+	DefineKeyScanCodes( keyScanCodes );
+	int keyScanCodeNamesCount = (sizeof( keyScanCodeNames )/sizeof(TText*));
+	
+	for ( int i = 0; i < keyScanCodeNamesCount; i++ ) {
+		if ( keyScanCodes[ i ] == (TUint)aKeyScanCode ) 
+			{
+			return keyScanCodeNames[ i ];
+			}
+	}
+	
+	return NULL;
+	}
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: TEventUtil
+
+     Method: GetModifierName
+
+     Description: Gets key modifier name.
+
+     Returns selected key modifier name. 
+
+     Parameters: TUint aModifier: out: Key modifier.
+     
+     Return Values: Key modifier name.
+
+     Errors/Exceptions: None.
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+TPtrC TEventUtil::GetModifierName( TUint aModifier )
+	{
+	DefineModifierNames( modifierNames );
+	DefineModifiers( modifiers );
+	int modifierNamesCount = (sizeof( modifierNames )/sizeof(TText*));
+	
+	for ( int i = 0; i < modifierNamesCount; i++ ) {
+		if ( modifiers[ i ] == aModifier ) 
+			{
+			return modifierNames[ i ];
+			}
+	}
+	
+	return NULL;	
+	}
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: TEventUtil
+
+     Method: ParseKeyCode
+
+     Description: Parses key code.
+
+     Parses key code. 
+
+     Parameters: TDesC& aKeyCodeName: in: Key code name.
+     			 TUint& aKeyCode: out: Parsed key code.
+     
+     Return Values: KErrNone if key code was parsed successfuly, 
+     				KErrNotFound in other case.
+
+     Errors/Exceptions: None.
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+TInt TEventUtil::ParseKeyCode( const TDesC& aKeyCodeName, TUint& aKeyCode )
+	{
+	DefineKeyCodeNames( keyCodeNames );
+	DefineKeyCodes( keyCodes );
+	int keyCodeNamesCount = (sizeof( keyCodeNames )/sizeof(TText*));
+	
+	TBuf<64> keyCodeNameLowerCase( aKeyCodeName );
+	keyCodeNameLowerCase.LowerCase();
+	for ( int i = 0; i < keyCodeNamesCount; i++ ) {
+		if ( TPtrC( keyCodeNames[ i ] ).Compare( keyCodeNameLowerCase ) == 0 ) 
+			{
+			aKeyCode = keyCodes[ i ];
+			return KErrNone;
+			}
+	}
+	
+	return KErrNotFound;
+	}
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: TEventUtil
+
+     Method: ParseKeyScanCode
+
+     Description: Parses key scan code.
+
+     Parses key scan code. 
+
+     Parameters: TDesC& aKeyScanCodeName: in: Key scan code name.
+     			 TUint& aKeyScanCode: out: Parsed key scan code.
+     
+     Return Values: KErrNone if key scan code was parsed successfuly, 
+     				KErrNotFound in other case.
+
+     Errors/Exceptions: None.
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+TInt TEventUtil::ParseKeyScanCode( const TDesC& aKeyScanCodeName, TInt& aKeyScanCode )
+	{
+	DefineKeyScanCodeNames( keyScanCodeNames );
+	DefineKeyScanCodes( keyScanCodes );
+	int keyScanCodeNamesCount = (sizeof( keyScanCodeNames )/sizeof(TText*));
+	
+	TBuf<64> keyScanCodeNameLowerCase( aKeyScanCodeName );
+	keyScanCodeNameLowerCase.LowerCase();
+	for ( int i = 0; i < keyScanCodeNamesCount; i++ ) {
+		if ( TPtrC( keyScanCodeNames[ i ] ).Compare( keyScanCodeNameLowerCase ) == 0 )
+			{
+			aKeyScanCode = keyScanCodes[ i ];
+			return KErrNone;
+			}
+	}
+	
+	return KErrNotFound;
+	}
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: TEventUtil
+
+     Method: ParseModifier
+
+     Description: Parses key modifier.
+
+     Parses key modifier. 
+
+     Parameters: TDesC& aModifierName: in: Key modifier name.
+     			 TUint& aModifier: out: Parsed key modifier.
+     
+     Return Values: KErrNone if key modifier was parsed successfuly, 
+     				KErrNotFound in other case.
+
+     Errors/Exceptions: None.
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+TInt TEventUtil::ParseModifier( const TDesC& aModifierName, TUint& aModifier )
+	{
+	DefineModifierNames( modifierNames );
+	DefineModifiers( modifiers );
+	int modifierNamesCount = (sizeof( modifierNames )/sizeof(TText*));
+	
+	TBuf<64> modifierNameLowerCase( aModifierName );
+	modifierNameLowerCase.LowerCase();
+	for ( int i = 0; i < modifierNamesCount; i++ ) {
+		if ( TPtrC( modifierNames[ i ] ).Compare( modifierNameLowerCase ) == 0 )
+			{
+			aModifier = modifiers[ i ];
+			return KErrNone;
+			}
+	}
+	
+	return KErrNotFound;	
+	}
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CAknUiEnvProxy
+
+     Method: ParsePointerEventType
+
+     Description: Parses pointer event type.
+
+     Parses key modifier.
+
+     Parameters: const TDesC& aPointerEventTypeName: in: Pointer event type.
+     			 TUint& aModifier: out: Parsed pointer event type.
+     
+     Return Values: KErrNone if no error occures during parsing.
+
+     Errors/Exceptions: None.
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+TInt TEventUtil::ParsePointerEventType( const TDesC& aPointerEventTypeName, TUint& aPointerEventType )
+	{
+	DefinePointerEventTypeNames( pointerEventTypeNames );
+	DefinePointerEventTypes( pointerEventTypes );
+	int pointerEventTypeNamesCount = (sizeof( pointerEventTypeNames )/sizeof(TText*));
+	
+	TBuf<64> pointerEventTypeNamesLowerCase( aPointerEventTypeName );
+	pointerEventTypeNamesLowerCase.LowerCase();
+	for ( int i = 0; i < pointerEventTypeNamesCount; i++ ) {
+		if ( TPtrC( pointerEventTypeNames[ i ] ).Compare( pointerEventTypeNamesLowerCase ) == 0 )
+			{
+			aPointerEventType = pointerEventTypes[ i ];
+			return KErrNone;
+			}
+	}
+	
+	return KErrNotFound;	
+	}
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/avkon/uitestserverstarter/src/TestServerThreadStarter.cpp	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,393 @@
+/*
+* 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 module contains the implementation of 
+* CTestServerThreadStarter class member functions.
+*
+*/
+
+// INCLUDE FILES
+#include "TestServerThreadStarter.h"
+#include <stifinternal/TestServerClient.h>
+
+// EXTERNAL DATA STRUCTURES
+// None
+
+// EXTERNAL FUNCTION PROTOTYPES  
+// None
+
+// CONSTANTS
+// None
+
+// MACROS
+// None
+
+/**
+ * CTestServerThreadStarter thread heap size.
+ */
+const TUint KDefaultHeapSize = 0x10000;     // 64 K
+
+/**
+ * CTestServerThreadStarter thread max heap size.
+ */
+const TUint KMaxHeapSize     = 0x20000;     // 128 K 
+
+// LOCAL CONSTANTS AND MACROS
+// None
+
+// MODULE DATA STRUCTURES
+// None
+
+// LOCAL FUNCTION PROTOTYPES
+// None
+
+// FORWARD DECLARATIONS
+// None
+
+
+// ================= MEMBER FUNCTIONS =========================================
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestServerThreadStarter
+
+     Method: TestServerStarterThreadFunction
+
+     Description: CTestServerThreadStarter thread function.
+
+	 CTestServerThreadStarter thread function in which testserver creation code
+	 is executed.
+
+     Parameters: TAny* aParameters: in: Pointer to CTestServerThreadStarter object
+     
+     Return Values: None.
+
+     Errors/Exceptions: None.
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+TInt CTestServerThreadStarter::TestServerStarterThreadFunction( TAny* aParameters )
+	{
+	RDebug::Printf( "UITESTING: CTestServerThreadStarter::TestServerStarterThreadFunction" );
+    
+    CTestServerThreadStarter* testServerStarter = (CTestServerThreadStarter*)aParameters;
+    TThreadId mainThreadId = testServerStarter->iMainThreadId;
+    CTestThreadContainerRunnerFactory* testThreadContainerRunnerFactory = 
+    	testServerStarter->iTestThreadContainerRunnerFactory;
+    
+   	// Signal that all needed data is copied and main thread can continue its execution 
+    testServerStarter->iServerThreadStartedSemaphore.Signal();
+    	
+    // Get module name from command line
+	const TInt length = User().CommandLineLength();
+
+    HBufC* cmdLine = HBufC::New( length );
+    
+    if ( cmdLine == NULL )
+        {
+        return KErrNoMemory;
+        }
+
+    TPtr moduleName = cmdLine->Des();
+
+	User().CommandLine( moduleName );
+
+    RDebug::Print(_L("CTestServerThreadStarter::TestServerStarterThreadFunction() Received data [%S]"), &moduleName);
+
+    // Extract semaphore name passed in data
+    TInt index = moduleName.Find(_L(" "));
+    RDebug::Print(_L("CTestServerThreadStarter::TestServerStarterThreadFunction() Space separator found at position [%d]"), index);
+    TPtrC semaphoreName = moduleName.Mid(index + 1);
+    moduleName = moduleName.Left(index);
+
+    RDebug::Print(_L("CTestServerThreadStarter::TestServerStarterThreadFunction() Extracted module name [%S] and sempahore name [%S]"), &moduleName, &semaphoreName);
+
+    // Open start-up synchronization semaphore
+    RSemaphore startup;
+    RDebug::Print(_L(" Openingstart-up semaphore"));
+    //TName semaphoreName = _L("startupSemaphore");
+    //semaphoreName.Append( moduleName );
+    
+    TInt res = startup.OpenGlobal(semaphoreName);
+    RDebug::Print(_L("Opening result %d"), res);    
+
+
+    TFileName serverName;
+    TInt r = StartNewServer ( moduleName, serverName, EFalse, startup, true, testThreadContainerRunnerFactory );
+
+    if ( r ==   KErrAlreadyExists )
+        {        
+        // Ok, server was already started
+        RDebug::Print(_L("UI TestServer already started, signaling semaphore and exiting"));
+        startup.Signal();        
+
+        delete cmdLine;
+
+        return KErrNone;
+        }
+    else
+        {       
+        RDebug::Print(_L("UI TestServer is finished, code %d"), r);
+        }
+
+    delete cmdLine;
+    
+    //delete testThreadContainerRunnerFactory;
+    testThreadContainerRunnerFactory = NULL;
+    
+    // Kill main thread to end UITestServerStarter application
+    // when testserver is finished    
+    RThread mainThread;
+    TInt ret = mainThread.Open( mainThreadId );
+	if( ret != KErrNone )
+		{
+		User::Panic( _L("ThreadHandleOpenError"), ret );
+		}
+    mainThread.Kill( KErrNone );
+    
+    return r;	
+	}
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestServerThreadStarter
+
+     Method: NewL
+
+     Description: NewL is first phase of two-phased constructor.
+
+	 NewL is first phase of two-phased constructor.
+
+     Parameters: None.
+     
+     Return Values: Pointer to new CTestServerThreadStarter object.
+
+     Errors/Exceptions: Leaves if new or ConstructL leaves.
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+CTestServerThreadStarter* CTestServerThreadStarter::NewL( )
+	{
+	CTestServerThreadStarter* self = new(ELeave) CTestServerThreadStarter();
+	CleanupStack::PushL( self );
+	self->ConstructL();
+	CleanupStack::Pop( self );
+	return self;
+	}
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestServerThreadStarter
+
+     Method: CTestServerThreadStarter
+
+     Description: Default constructor.
+
+	 Default constructor.
+
+     Parameters: None.
+     
+     Return Values: None.
+
+     Errors/Exceptions: None.
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+CTestServerThreadStarter::CTestServerThreadStarter()
+:CActive( EPriorityNormal )
+	{
+	}
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestServerThreadStarter
+
+     Method: NewL
+
+     Description: Default destructor.
+
+	 Default destructor.
+
+     Parameters: None.
+     
+     Return Values: None.
+
+     Errors/Exceptions: None.
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+CTestServerThreadStarter::~CTestServerThreadStarter()
+	{
+	Cancel();
+	iTimer.Close();
+	}
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestServerThreadStarter
+
+     Method: ConstructL
+
+     Description: Second phase of two-phased constructor.
+
+	 Second phase of two-phased constructor.
+
+     Parameters: None.
+     
+     Return Values: None.
+
+     Errors/Exceptions: None.
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+void CTestServerThreadStarter::ConstructL()
+	{
+	TInt ret = iTimer.CreateLocal();
+	if ( ret != KErrNone )
+		{
+		User::Leave( ret );
+		}
+
+	CActiveScheduler::Add( this );
+	}
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestServerThreadStarter
+
+     Method: RunTestServerThread
+
+     Description: Starts-up testserver.
+
+	 Starts-up testserver.
+
+     Parameters: None.
+     
+     Return Values: KErrNone when there was no error.
+
+     Errors/Exceptions: None.
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+TInt CTestServerThreadStarter::RunTestServerThread( CTestThreadContainerRunnerFactory* aTestThreadContainerRunnerFactory )
+	{
+	if ( IsActive() )
+		{
+		User::Panic( _L("E32USER-CBase"), 42 );
+		}
+		
+	TInt ret = iServerThreadStartedSemaphore.CreateLocal( 0 );
+	if ( ret != KErrNone )
+		{
+		User::Leave( ret );
+		}
+	
+	iTestThreadContainerRunnerFactory = aTestThreadContainerRunnerFactory;
+	iMainThreadId = RThread().Id();
+	iReturnCode = KErrNone;
+	
+	iStatus = KRequestPending;
+
+	SetActive();
+	iTimer.After( iStatus, 0 );
+	
+	return KErrNone;
+	}
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestServerThreadStarter
+
+     Method: RunL
+
+     Description: RunL derived from CActive handles the completed requests.
+
+	 RunL derived from CActive handles the completed requests.
+
+     Parameters: None.
+     
+     Return Values: None.
+
+     Errors/Exceptions: Leaves if one of the called method leavs.
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+void CTestServerThreadStarter::RunL()
+	{
+	RThread testServerStarterThread;	
+	TInt ret = testServerStarterThread.Create( _L("testserverstarterthread"), 
+			TestServerStarterThreadFunction, 10 * KDefaultStackSize, 10 * KDefaultHeapSize, 10 * KMaxHeapSize, this );
+	
+	User::LeaveIfError( ret );
+		
+	testServerStarterThread.Resume();	
+	testServerStarterThread.Close();
+	
+	iServerThreadStartedSemaphore.Wait();
+	iServerThreadStartedSemaphore.Close();
+	
+	// Delete CTestServerThreadStarter after testserver is started
+	delete this;
+	}
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CTestServerThreadStarter
+
+     Method: DoCancel
+
+     Description: DoCancel derived from CActive handles the Cancel.
+
+	 DoCancel derived from CActive handles the Cancel.
+
+     Parameters: None.
+     
+     Return Values: None.
+
+     Errors/Exceptions: None.
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+void CTestServerThreadStarter::DoCancel()
+	{
+	if ( IsActive() )
+		{
+		iTimer.Cancel();
+		}
+	}
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/avkon/uitestserverstarter/src/UITestServerStarter.cpp	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,73 @@
+/*
+* 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 module contains the implementation of application  
+* main function.
+*
+*/
+
+// INCLUDE FILES
+#include <eikstart.h>
+#include "UITestServerStarterAppUi.h"
+#include "UITestServerStarterApplication.h"
+#include <eikenv.h>
+
+// EXTERNAL DATA STRUCTURES
+// None
+
+// EXTERNAL FUNCTION PROTOTYPES  
+// None
+
+// CONSTANTS
+// None
+
+// MACROS
+// None
+
+// LOCAL CONSTANTS AND MACROS
+// None
+
+// MODULE DATA STRUCTURES
+// None
+
+// LOCAL FUNCTION PROTOTYPES
+// None
+
+// FORWARD DECLARATIONS
+// None
+
+/**
+ * Application factory function.
+ */
+LOCAL_C CApaApplication* NewApplication()
+	{
+	return new CUITestServerStarterApplication;
+	}
+
+// ================= MEMBER FUNCTIONS =========================================
+/**
+ * Application main function.
+ */
+GLDEF_C TInt E32Main()
+	{
+	
+	RDebug::Printf( "UITESTING: UITestServerStarter - E32Main" );
+	
+	TInt ret = EikStart::RunApplication( NewApplication );
+	
+    RDebug::Printf( "UITESTING: UITestServerStarter - E32Main End" );
+    
+    return ret;
+	}
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/avkon/uitestserverstarter/src/UITestServerStarterAppContainer.cpp	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,290 @@
+/*
+* 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 module contains the implementation of 
+* CUITestServerStarterAppContainer class member functions.
+*
+*/
+
+// INCLUDE FILES
+#include "UITestServerStarterAppContainer.h"
+#include <AknsDrawUtils.h>
+#include <AknsBasicBackgroundControlContext.h>
+#include <AknDef.h>
+#include <AknUtils.h> 
+
+// EXTERNAL DATA STRUCTURES
+// None
+
+// EXTERNAL FUNCTION PROTOTYPES  
+// None
+
+// CONSTANTS
+// None
+
+// MACROS
+// None
+
+// LOCAL CONSTANTS AND MACROS
+// None
+
+// MODULE DATA STRUCTURES
+// None
+
+// LOCAL FUNCTION PROTOTYPES
+// None
+
+// FORWARD DECLARATIONS
+// None
+
+
+// ================= MEMBER FUNCTIONS =========================================
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CUITestServerStarterAppContainer
+
+     Method: NewL
+
+     Description: NewL is first phase of two-phased constructor.
+
+     NewL is first phase of two-phased constructor.
+
+     Parameters: const TRect& aRect: container rectangle.
+     
+     Return Values: Pointer to new CUITestServerStarterAppContainer object.
+
+     Errors/Exceptions: Leave if one of the called functions leaves.
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+CUITestServerStarterAppContainer* CUITestServerStarterAppContainer::NewL( const TRect& aRect )
+	{
+	CUITestServerStarterAppContainer* self = NewLC( aRect );
+	CleanupStack::Pop( self );
+	return self;
+	}
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CUITestServerStarterAppContainer
+
+     Method: NewLC
+
+     Description: NewL is first phase of two-phased constructor.
+
+     NewL is first phase of two-phased constructor.
+
+     Parameters: const TRect& aRect: container rect
+     
+     Return Values: Pointer to new CUITestServerStarterAppContainer object.
+
+     Errors/Exceptions: Leave if one of the called functions leaves.
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+CUITestServerStarterAppContainer* CUITestServerStarterAppContainer::NewLC( const TRect& aRect )
+	{
+	CUITestServerStarterAppContainer* self = 
+		new(ELeave)CUITestServerStarterAppContainer;
+	CleanupStack::PushL( self );
+	self->ConstructL( aRect );
+	return self;
+	}
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CUITestServerStarterAppContainer
+
+     Method: CUITestServerStarterAppContainer
+
+     Description: C++ constructor.
+
+     C++ constructor.
+
+     Parameters: None
+     
+     Return Values: None
+
+     Errors/Exceptions: None
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+CUITestServerStarterAppContainer::CUITestServerStarterAppContainer()
+	{	
+	}
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CUITestServerStarterAppContainer
+
+     Method: CUITestServerStarterAppContainer
+
+     Description: C++ destructor.
+
+     C++ destructor.
+
+     Parameters: None
+     
+     Return Values: None
+
+     Errors/Exceptions: None
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+CUITestServerStarterAppContainer::~CUITestServerStarterAppContainer()
+	{
+	delete iBgContext;
+	}
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CUITestServerStarterAppContainer
+
+     Method: ConstructL
+
+     Description: ConstructL is second phase of two-phased constructor.
+
+     ConstructL is second phase of two-phased constructor.
+
+     Parameters: const TRect& aRect: container rectangle.
+     
+     Return Values: None
+
+     Errors/Exceptions: Leave if one of the called functions leaves.
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+void CUITestServerStarterAppContainer::ConstructL( const TRect& aRect )
+	{
+	CreateWindowL();
+	
+	iBgContext = CAknsBasicBackgroundControlContext::NewL( KAknsIIDQsnBgAreaMain, aRect, ETrue );	
+	
+	SetRect( aRect );
+	ActivateL();
+	}
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CUITestServerStarterAppContainer
+
+     Method: Draw
+
+     Description: Draws the control.
+
+     Draws the control.
+
+     Parameters: const TRect& aRect: rectangle which should be redrawn.
+     
+     Return Values: None
+
+     Errors/Exceptions: None
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+void CUITestServerStarterAppContainer::Draw( const TRect& aRect ) const
+	{
+	// Get the standard graphics context 
+	CWindowGc& gc = SystemGc();
+
+	// Redraw the background using the default skin
+	MAknsSkinInstance* skin = AknsUtils::SkinInstance();
+	MAknsControlContext* controlContext = AknsDrawUtils::ControlContext( this );
+	AknsDrawUtils::Background( skin, controlContext, this, gc, aRect );	
+	}
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CUITestServerStarterAppContainer
+
+     Method: SizeChanged
+
+     Description: Responds to changes to the size and position of the contents of this control
+
+     Responds to changes to the size and position of the 
+     contents of this control
+
+     Parameters: None
+     
+     Return Values: None
+
+     Errors/Exceptions: None
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+void CUITestServerStarterAppContainer::SizeChanged()
+	{
+	if ( iBgContext )
+		{
+		iBgContext->SetRect( Rect() );
+		if ( &Window() )
+			{
+			iBgContext->SetParentPos( PositionRelativeToScreen() );
+			}
+		}
+	}
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CUITestServerStarterAppContainer
+
+     Method: MopSupplyObject
+
+     Description: This function is used to allow controls to ask their owners for access to other objects that they own
+
+     This function is used to allow controls to ask their owners 
+	 for access to other objects that they own
+	 
+     Parameters: TTypeUid aId: requested object type id.
+     
+     Return Values: Pointer to requested object.
+
+     Errors/Exceptions: None
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+TTypeUid::Ptr CUITestServerStarterAppContainer::MopSupplyObject( TTypeUid aId )
+	{
+	if ( iBgContext )
+		{
+		return MAknsControlContext::SupplyMopObject( aId, iBgContext );
+		}
+	return CCoeControl::MopSupplyObject( aId );
+	}
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/avkon/uitestserverstarter/src/UITestServerStarterAppUi.cpp	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,510 @@
+/*
+* 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 module contains the implementation of 
+* CUITestServerStarterAppUi class member functions.
+*
+*/
+
+// INCLUDE FILES
+#include <avkon.hrh>
+#include <aknmessagequerydialog.h>
+#include <aknnotewrappers.h>
+#include <StringLoader.h>
+#include <f32file.h>
+#include <s32file.h>
+#include <hlplch.h>
+
+#include <UITestServerStarter.rsg>
+
+#include "UITestServerStarter.hrh"
+#include "UITestServerStarterAppUi.h"
+#include "UITestServerStarterAppView.h"
+
+#include "TestServerThreadStarter.h"
+#include <stifinternal/TestThreadContainerRunnerFactory.h>
+#include "AknUiEnvProxy.h"
+
+// EXTERNAL DATA STRUCTURES
+// None
+
+// EXTERNAL FUNCTION PROTOTYPES  
+// None
+
+// CONSTANTS
+// None
+
+// MACROS
+// None
+
+// LOCAL CONSTANTS AND MACROS
+// None
+
+// MODULE DATA STRUCTURES
+// None
+
+// LOCAL FUNCTION PROTOTYPES
+// None
+
+// FORWARD DECLARATIONS
+// None
+
+// ================= MEMBER FUNCTIONS =========================================
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CUITestServerStarterAppUi
+
+     Method: ConstructL
+
+     Description: ConstructL is second phase of two-phased constructor.
+
+     ConstructL is second phase of two-phased constructor.
+
+     Parameters: None
+     
+     Return Values: None.
+
+     Errors/Exceptions: Leaves if one of called functions leave.
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+void CUITestServerStarterAppUi::ConstructL()
+	{
+	RDebug::Printf( "UITESTING: CUITestServerStarterAppUi::ConstructL - Begin" );
+
+	// Initialise app UI with standard value.
+	BaseConstructL( ENoAppResourceFile || CAknAppUi::EAknEnableSkin );
+
+	CEikonEnv::Static()->DisableExitChecks( true );
+	
+	// Create view object
+	iAppView = CUITestServerStarterAppView::NewL();
+	
+	AddViewL( iAppView );
+	SetDefaultViewL( *iAppView );
+		
+	CAknUiEnvProxy* uiEnvProxy = CAknUiEnvProxy::NewL( this );
+	
+	CTestThreadContainerRunnerFactory* testThreadContainerRunnerFactory = 
+		CTestThreadContainerRunnerFactory::NewL( RThread().Id(), CActiveScheduler::Current(), uiEnvProxy );
+	
+	RDebug::Printf( "UITESTING: CUITestServerStarterAppUi::ConstructL - Starting TestServer" );
+	CTestServerThreadStarter* testServerThreadStarter = CTestServerThreadStarter::NewL( );
+	testServerThreadStarter->RunTestServerThread( testThreadContainerRunnerFactory );
+		
+	RDebug::Printf( "UITESTING: CUITestServerStarterAppUi::ConstructL - Move to background" );
+	
+	TApaTask task( CCoeEnv::Static()->WsSession() );
+	task.SetWgId( CCoeEnv::Static()->RootWin().Identifier() ); 
+	task.SendToBackground();
+	
+	RDebug::Printf( "UITESTING: CUITestServerStarterAppUi::ConstructL - End" );
+	}
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CUITestServerStarterAppUi
+
+     Method: CUITestServerStarterAppUi
+
+     Description: C++ default constructor can NOT contain any code, that might leave.
+
+     C++ default constructor can NOT contain any code, that might leave.
+
+     Parameters: None.
+     
+     Return Values: None.
+
+     Errors/Exceptions: None.
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+CUITestServerStarterAppUi::CUITestServerStarterAppUi()
+	{
+	// No implementation required
+	}
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CUITestServerStarterAppUi
+
+     Method: ~CUITestServerStarterAppUi
+
+     Description: C++ destructor.
+
+     C++ destructor.
+
+     Parameters: None.
+     
+     Return Values: None.
+
+     Errors/Exceptions: None.
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+CUITestServerStarterAppUi::~CUITestServerStarterAppUi()
+	{
+	// No implementation required
+	}
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CUITestServerStarterAppUi
+
+     Method: HandleCommandL
+
+     Description: Handles user commands.
+
+     Derived from CCoeAppUi. Handles user commands.
+
+     Parameters: TInt aCommand: in: User command code.
+     
+     Return Values: None.
+
+     Errors/Exceptions: None.
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+void CUITestServerStarterAppUi::HandleCommandL( TInt )
+	{
+	// No implementation required
+	}
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CUITestServerStarterAppUi
+
+     Method: HandleWsEventL
+
+     Description: Handles window server event.
+
+     Derived from CCoeAppUi. Handles window server event.
+
+     Parameters: const TWsEvent& aEvent: in: Event.
+     			 CCoeControl* aDestination: in: Destination control.
+     
+     Return Values: None.
+
+     Errors/Exceptions: None.
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+void CUITestServerStarterAppUi::HandleWsEventL( const TWsEvent& aEvent, CCoeControl* aDestination )
+	{	
+	CAknAppUi::HandleWsEventL( aEvent, aDestination );
+
+	if ( ( aEvent.Type() == EEventKey ) )
+		{
+		switch( iEventType )
+			{
+			case EPressKey:
+				{
+				if ( iEventStatus != NULL )
+					{
+					KeyPressHandled();					
+					}
+				}
+				break;
+			case ETypeText:
+				{
+				iTypeTextLength--;
+				if ( ( iEventStatus != NULL ) && ( iTypeTextLength == 0 ) )
+					{
+					TextTypeHandled();
+					}
+				}
+				break;
+			default: 
+			    // Do nothing
+			    break;
+			}
+		}
+	else if ( aEvent.Type() == EEventPointer )
+		{
+		if ( iEventType == EPointerEvent )
+			{
+			PointerEventHandled();
+			}		
+		}
+	}
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CUITestServerStarterAppUi
+
+     Method: PrepareToTypeText
+
+     Description: Prepares AppUi to recive type text event
+
+     Prepares AppUi to recive type text event
+
+     Parameters: TInt aTextLength: in: Text length.
+     
+     Return Values: None.
+
+     Errors/Exceptions: None.
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+void CUITestServerStarterAppUi::PrepareToTypeText( TInt aTextLength )
+	{
+	iTypeTextLength = aTextLength;
+	iEventType = ETypeText;
+	}
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CUITestServerStarterAppUi
+
+     Method: PrepareToPressKey
+
+     Description: Prepares AppUi to recive key press event
+
+     Prepares AppUi to recive key press event
+
+     Parameters: None.
+     
+     Return Values: None.
+
+     Errors/Exceptions: None.
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+void CUITestServerStarterAppUi::PrepareToPressKey()
+	{
+	iEventType = EPressKey;
+	}
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CUITestServerStarterAppUi
+
+     Method: PrepareToPointerEvent
+
+     Description: Prepares AppUi to recive pointer event
+
+     Prepares AppUi to recive key press event
+
+     Parameters: None.
+     
+     Return Values: None.
+
+     Errors/Exceptions: None.
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+void CUITestServerStarterAppUi::PrepareToPointerEvent()
+	{
+	iEventType = EPointerEvent;
+	}
+
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CUITestServerStarterAppUi
+
+     Method: KeyPressHandled
+
+     Description: Sends notification that key press was handled.
+
+     Notifies client that key press was handled.
+
+     Parameters: None.
+     
+     Return Values: None.
+
+     Errors/Exceptions: None.
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+void CUITestServerStarterAppUi::KeyPressHandled()
+	{
+	if ( ( iEventType == EPressKey ) && ( iEventStatus != NULL ) && ( iEventType == EPressKey ) )
+		{
+		iEventType = ENone;
+		User::RequestComplete( iEventStatus, KErrNone );
+		iEventStatus = NULL;
+		}
+	}
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CUITestServerStarterAppUi
+
+     Method: TextTypeHandled
+
+     Description: Sends notification that type text was handled.
+
+     Notifies client that type text was handled.
+
+     Parameters: None.
+     
+     Return Values: None.
+
+     Errors/Exceptions: None.
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+void CUITestServerStarterAppUi::TextTypeHandled()
+	{
+	if ( ( iEventType == ETypeText ) && ( iEventStatus != NULL ) && ( iEventType == ETypeText ) )
+		{
+		iEventType = ENone;
+		iTypeTextLength = 0;
+		User::RequestComplete( iEventStatus, KErrNone );
+		iEventStatus = NULL;
+		}
+	}
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CUITestServerStarterAppUi
+
+     Method: PointerEventHandled
+
+     Description: Sends notification that pointer event was handled.
+
+     Notifies client that pointer event was handled.
+
+     Parameters: None.
+     
+     Return Values: None.
+
+     Errors/Exceptions: None.
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+void CUITestServerStarterAppUi::PointerEventHandled()
+	{
+	if ( ( iEventType == EPointerEvent ) && ( iEventStatus != NULL ) )
+		{
+		iEventType = ENone;
+		User::RequestComplete( iEventStatus, KErrNone );
+		iEventStatus = NULL;
+		}
+	}
+
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CUITestServerStarterAppUi
+
+     Method: NotifyAboutHandledKeyPress
+
+     Description: Requests notification of press key completion.
+
+     Requests notification of press key completion.
+
+     Parameters: TRequestStatus* aStatus: in: Request status pointer.
+     
+     Return Values: None.
+
+     Errors/Exceptions: None.
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+void CUITestServerStarterAppUi::NotifyAboutHandledKeyPress( TRequestStatus* aStatus )
+	{
+	iEventStatus = aStatus;
+	}
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CUITestServerStarterAppUi
+
+     Method: NotifyAboutHandledTextType
+
+     Description: Requests notification when text type event is handled.
+
+     Requests notification when text type event is handled.
+
+     Parameters: TRequestStatus* aStatus: in: Request status pointer.
+     
+     Return Values: None.
+
+     Errors/Exceptions: None.
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+void CUITestServerStarterAppUi::NotifyAboutHandledTextType( TRequestStatus* aStatus )
+	{
+	iEventStatus = aStatus;
+	}
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CUITestServerStarterAppUi
+
+     Method: NotifyAboutHandledPointerEvent
+
+     Description: Requests notification when pointer event is handled.
+
+     Requests notification when pointer event is handled.
+
+     Parameters: TRequestStatus* aStatus: in: Request status pointer.
+     
+     Return Values: None.
+
+     Errors/Exceptions: None.
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+void CUITestServerStarterAppUi::NotifyAboutHandledPointerEvent( TRequestStatus* aStatus )
+	{
+	iEventStatus = aStatus;
+	}
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/avkon/uitestserverstarter/src/UITestServerStarterAppView.cpp	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,345 @@
+/*
+* 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 module contains the 
+* implementation of CUITestServerStarterAppView class member 
+* functions.
+*
+*/
+
+// INCLUDE FILES
+#include <coemain.h>
+#include <aknViewAppUi.h> 
+#include "UITestServerStarterAppView.h"
+#include "UITestServerStarterApplication.h"
+#include "UITestServerStarterAppContainer.h"
+
+// EXTERNAL DATA STRUCTURES
+// None
+
+// EXTERNAL FUNCTION PROTOTYPES  
+// None
+
+// CONSTANTS
+// None
+
+// MACROS
+// None
+
+// LOCAL CONSTANTS AND MACROS
+// None
+
+// MODULE DATA STRUCTURES
+// None
+
+// LOCAL FUNCTION PROTOTYPES
+// None
+
+// FORWARD DECLARATIONS
+// None
+
+
+// ================= MEMBER FUNCTIONS =========================================
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CUITestServerStarterAppView
+
+     Method: NewL
+
+     Description: NewL is first phase of two-phased constructor.
+
+     NewL is first phase of two-phased constructor.
+
+     Parameters: None
+     
+     Return Values: Pointer to new CUITestServerStarterAppView object.
+
+     Errors/Exceptions: Leave if one of the called functions leaves.
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+CUITestServerStarterAppView* CUITestServerStarterAppView::NewL()
+	{
+	CUITestServerStarterAppView* self = CUITestServerStarterAppView::NewLC();
+	CleanupStack::Pop( self );
+	return self;
+	}
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CUITestServerStarterAppView
+
+     Method: NewLC
+
+     Description: NewL is first phase of two-phased constructor.
+
+     NewL is first phase of two-phased constructor.
+
+     Parameters: None
+     
+     Return Values: Pointer to new CUITestServerStarterAppView object.
+
+     Errors/Exceptions: Leave if one of the called functions leaves.
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+CUITestServerStarterAppView* CUITestServerStarterAppView::NewLC()
+	{
+	CUITestServerStarterAppView* self = new ( ELeave ) CUITestServerStarterAppView;
+	CleanupStack::PushL( self );
+	self->ConstructL();
+	return self;
+	}
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CUITestServerStarterAppView
+
+     Method: ConstructL
+
+     Description: ConstructL is second phase of two-phased constructor.
+
+     ConstructL is second phase of two-phased constructor.
+
+     Parameters: None
+     
+     Return Values: None
+
+     Errors/Exceptions: Leave if one of the called functions leaves.
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+void CUITestServerStarterAppView::ConstructL()
+	{
+	BaseConstructL( 0 );
+	}
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CUITestServerStarterAppView
+
+     Method: CUITestServerStarterAppView
+
+     Description: C++ constructor.
+
+     C++ constructor.
+
+     Parameters: None
+     
+     Return Values: None
+
+     Errors/Exceptions: None
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+CUITestServerStarterAppView::CUITestServerStarterAppView()
+	{
+	// No implementation required
+	}
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CUITestServerStarterAppView
+
+     Method: CUITestServerStarterAppView
+
+     Description: C++ destructor.
+
+     C++ destructor.
+
+     Parameters: None
+     
+     Return Values: None
+
+     Errors/Exceptions: None
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+CUITestServerStarterAppView::~CUITestServerStarterAppView()
+	{
+    if ( iContainer )
+        {
+        AppUi()->RemoveFromViewStack( *this, iContainer );
+        }
+
+    delete iContainer;
+	}
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CUITestServerStarterAppView
+
+     Method: Id
+
+     Description: Returns view Uid.
+
+     Returns view Uid.
+
+     Parameters: None
+     
+     Return Values: View Uid
+
+     Errors/Exceptions: None
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+TUid CUITestServerStarterAppView::Id() const
+	{
+	return KMainViewId;	
+	}
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CUITestServerStarterAppView
+
+     Method: HandleCommandL
+
+     Description: Handle Commands.
+
+     Handle Commands.
+
+     Parameters: TInt aCommand: command id
+     
+     Return Values: None
+
+     Errors/Exceptions: None
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+void CUITestServerStarterAppView::HandleCommandL( TInt aCommand )
+    {   
+    AppUi()->HandleCommandL( aCommand );
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CUITestServerStarterAppView
+
+     Method: HandleClientRectChange
+
+     Description: Handle size changes.
+
+     Handle size changes.
+
+     Parameters: None
+     
+     Return Values: None
+
+     Errors/Exceptions: None
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+void CUITestServerStarterAppView::HandleClientRectChange()
+    {
+    if ( iContainer )
+        {
+        iContainer->SetRect( ClientRect() );
+        }
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CUITestServerStarterAppView
+
+     Method: DoActivateL
+
+     Description: From AknView, Activates view.
+
+     From AknView, Activates view.
+
+     Parameters: const TVwsViewId& aPrevViewId: previouse view id
+     			 TUid aCustomMessageId: custom message id
+   				 const TDesC8& aCustomMessage: custom message data
+     
+     Return Values: None
+
+     Errors/Exceptions: None
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+void CUITestServerStarterAppView::DoActivateL(
+   const TVwsViewId& /*aPrevViewId*/, TUid /*aCustomMessageId*/,
+   const TDesC8& /*aCustomMessage*/)
+    {
+    if ( !iContainer )
+        {
+        // Create view container
+        iContainer = CUITestServerStarterAppContainer::NewL( ClientRect() );
+        iContainer->SetMopParent( this );
+        // Add container to view stack
+        AppUi()->AddToStackL( *this, iContainer );
+        } 
+   }
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CUITestServerStarterAppView
+
+     Method: DoDeactivate
+
+     Description: From AknView, Deactivates view.
+
+     From AknView, Deactivates view.
+
+     Parameters: None
+     
+     Return Values: None
+
+     Errors/Exceptions: None
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+void CUITestServerStarterAppView::DoDeactivate()
+    {
+    if ( iContainer )
+        {
+        // Remove container from view stack
+        AppUi()->RemoveFromViewStack( *this, iContainer );
+        }
+    
+    // Delete container since it's not longer needed.
+    delete iContainer;
+    iContainer = NULL;
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/avkon/uitestserverstarter/src/UITestServerStarterApplication.cpp	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,131 @@
+/*
+* 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 module contains the implementation of 
+* CUITestServerStarterApplication class member functions.
+*
+*/
+
+// INCLUDE FILES
+#include "UITestServerStarter.hrh"
+#include "UITestServerStarterDocument.h"
+#include "UITestServerStarterApplication.h"
+
+// EXTERNAL DATA STRUCTURES
+// None
+
+// EXTERNAL FUNCTION PROTOTYPES  
+// None
+
+// CONSTANTS
+// None
+
+// MACROS
+// None
+
+// LOCAL CONSTANTS AND MACROS
+// None
+
+// MODULE DATA STRUCTURES
+// None
+
+// LOCAL FUNCTION PROTOTYPES
+// None
+
+// FORWARD DECLARATIONS
+// None
+
+
+// ================= MEMBER FUNCTIONS =========================================
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CUITestServerStarterApplication
+
+     Method: CreateDocumentL 
+
+     Creates CUITestServerStarterDocument document object.
+
+	 Creates CUITestServerStarterDocument document object. The returned
+	 pointer in not owned by the CUITestServerStarterApplication object.
+
+     Parameters: None
+     
+     Return Values: A pointer to the created document object.
+
+     Errors/Exceptions: None.
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+CApaDocument* CUITestServerStarterApplication::CreateDocumentL ()
+	{
+	return (static_cast<CApaDocument*> (CUITestServerStarterDocument::NewL ( *this) ) );
+	}
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CUITestServerStarterApplication
+
+     Method: AppDllUid
+
+     Gets application Uid
+
+	 Gets application Uid
+
+     Parameters: None
+     
+     Return Values: Application Uid.
+
+     Errors/Exceptions: None.
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+TUid CUITestServerStarterApplication::AppDllUid() const
+	{
+	return KUidUITestServerStarterApp;
+	}
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: PreDocConstructL
+
+     Method: AppDllUid
+
+     Preconstructs document.
+
+     Preconstructs document.
+
+     Parameters: None
+     
+     Return Values: None
+
+     Errors/Exceptions: None.
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+void CUITestServerStarterApplication::PreDocConstructL()
+	{
+	// This call allow us to run multiple instances of UI application in same time.
+	CEikApplication::PreDocConstructL();
+	}
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/avkon/uitestserverstarter/src/UITestServerStarterDocument.cpp	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,214 @@
+/*
+* 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 module contains the implementation of 
+* CUITestServerStarterDocument class member functions.
+*
+*/
+
+// INCLUDE FILES
+#include "UITestServerStarterAppUi.h"
+#include "UITestServerStarterDocument.h"
+
+
+// EXTERNAL DATA STRUCTURES
+// None
+
+// EXTERNAL FUNCTION PROTOTYPES  
+// None
+
+// CONSTANTS
+// None
+
+// MACROS
+// None
+
+// LOCAL CONSTANTS AND MACROS
+// None
+
+// MODULE DATA STRUCTURES
+// None
+
+// LOCAL FUNCTION PROTOTYPES
+// None
+
+// FORWARD DECLARATIONS
+// None
+
+
+// ================= MEMBER FUNCTIONS =========================================
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CUITestServerStarterDocument
+
+     Method: NewL
+
+     Description: NewL is first phase of two-phased constructor.
+
+     NewL is first phase of two-phased constructor.
+
+     Parameters: CEikApplication& aApp: in: Reference to application..
+     
+     Return Values: Pointer to new CUITestServerStarterDocument object.
+
+     Errors/Exceptions: Leave if one of the called functions leaves.
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+CUITestServerStarterDocument* CUITestServerStarterDocument::NewL( CEikApplication& aApp )
+	{
+	CUITestServerStarterDocument* self = NewLC (aApp);
+	CleanupStack::Pop (self);
+	return self;
+	}
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CUITestServerStarterDocument
+
+     Method: NewLC
+
+     Description: NewL is first phase of two-phased constructor.
+
+     NewL is first phase of two-phased constructor.
+
+     Parameters: CEikApplication& aApp: in: Reference to application.
+     
+     Return Values: Pointer to new CUITestServerStarterDocument object.
+
+     Errors/Exceptions: Leave if one of the called functions leaves.
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+CUITestServerStarterDocument* CUITestServerStarterDocument::NewLC (CEikApplication& aApp)
+	{
+	CUITestServerStarterDocument* self = new ( ELeave ) CUITestServerStarterDocument( aApp );
+
+	CleanupStack::PushL (self);
+	self->ConstructL ();
+	return self;
+	}
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CUITestServerStarterDocument
+
+     Method: ConstructL
+
+     Description: This is second phase of two-phased constructor.
+
+     This is second phase of two-phased constructor.
+
+     Parameters: None.
+     
+     Return Values: None.
+
+     Errors/Exceptions: None.
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+void CUITestServerStarterDocument::ConstructL()
+	{
+	// No implementation required
+	}
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CUITestServerStarterDocument
+
+     Method: CUITestServerStarterDocument
+
+     Description: Constructor.
+
+     Constructor.
+
+     Parameters: None.
+     
+     Return Values: None.
+
+     Errors/Exceptions: None.
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+CUITestServerStarterDocument::CUITestServerStarterDocument( CEikApplication& aApp ) :
+	CAknDocument(aApp)
+	{
+	// No implementation required
+	}
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CUITestServerStarterDocument
+
+     Method: ~CUITestServerStarterDocument
+
+     Description: Destructor.
+
+     Destructor.
+
+     Parameters: None.
+     
+     Return Values: None.
+
+     Errors/Exceptions: None.
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+CUITestServerStarterDocument::~CUITestServerStarterDocument ()
+	{
+	// No implementation required
+	}
+
+/*
+-------------------------------------------------------------------------------
+
+     Class: CUITestServerStarterDocument
+
+     Method: CreateAppUiL
+
+     Description: Creates AppUi object.
+
+     Creates AppUi object.
+
+     Parameters: None.
+     
+     Return Values: Pointer to AppUi object.
+
+     Errors/Exceptions: None.
+
+     Status: Draft
+    
+-------------------------------------------------------------------------------
+*/
+CEikAppUi* CUITestServerStarterDocument::CreateAppUiL ()
+	{
+	return ( static_cast <CEikAppUi*>( new ( ELeave ) CUITestServerStarterAppUi ) );
+	}
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/qt/ReleaseNote.txt	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,45 @@
+========================================================================
+RELEASE NOTE FOR STFUI_201028 (7.3.37)
+========================================================================
+
+Product Description:
+====================
+STFUI is Series QT UI application for STF/STIF project.
+STF/STIF is a test harness for testing Symbian components.
+This widely used test framework can be used for both test case implementation and test cases execution.
+
+Features :
+=========
+- Easy to use
+- Multiple test cases can be executed concurrently.
+
+
+Enhancements:
+=============
+N/A
+
+
+New Features:
+=============
+N/A
+
+
+System Requirements:
+====================
+Basic Requirements:
+
+- StifQtUI project is written by QT C++ and Symbian C++.
+- It should be compiled by QT for S60 4.6.0 under proper S60 SDK.
+
+You can get QT for S60 from: http://qt.nokia.com/downloads/downloads
+
+- stif project needs to be compiled/installed before stifui can be used
+
+
+Compatibility Issues:
+=====================
+N/A 
+
+
+Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+All rights reserved.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/qt/inc/cstfcase.h	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,65 @@
+/*
+* 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: QT C++ based Class.
+*              CSTFCase used to describe a test case.
+*
+*/
+#ifndef CSTFCASE_H
+#define CSTFCASE_H
+#include "QString"
+
+enum TSTFCaseRunningType
+    {
+    Sequentially = 0,
+    Parallel    
+    };
+
+enum TSTFCaseStatusType
+    {
+    EStatusRunning  = 0x00000001,
+    EStatusExecuted = 0x00000002,
+    EStatusPassed   = 0x00000004,
+    EStatusFailed   = 0x00000008,
+    EStatusAborted  = 0x00000010,
+    EStatusCrashed  = 0x00000020,
+    EStatusAll      = 0x000000ff,    
+    };
+
+class CSTFCase
+{
+public:
+    CSTFCase()    {isActive = true; caseIndex=-1;}
+    CSTFCase(QString name, int index)    {caseName = name; caseIndex = index; isActive = true;}
+
+public:
+    QString& Name(){return caseName;}
+    int Index(){return caseIndex;}
+    bool IsActive(){return isActive;}
+    QString& ModuleName() {return moduleName;}
+
+public:
+    void SetName(const QString name){caseName = name; }
+    void SetIndex(const int index){caseIndex = index;}
+    void SetActive(const bool active) {isActive = active;}
+    void SetModuleName(const QString name){moduleName = name;}
+
+private:
+    QString caseName;
+    int caseIndex;
+    bool isActive;
+    QString moduleName;
+};
+#endif // CSTFCASE_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/qt/inc/cstfmodule.h	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,52 @@
+/*
+* 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: QT C++ based Class.
+*              CSTFModule used to describe a test module.
+*
+*/
+#ifndef CSTFMODULE_H
+#define CSTFMODULE_H
+#include "QString"
+
+class CSTFModule
+{
+public:
+    CSTFModule(){isActive = true;}
+    CSTFModule(QString name, QString inifile, QString cfgfile)
+    {moduleName = name; iniFile = inifile; configFile = cfgfile; isActive = true;}
+
+public:
+    QString& Name(){return moduleName;}
+    QString& IniFile(){return iniFile;}
+    QString& ConfigFile(){return configFile;}
+    bool IsActive(){return isActive;}
+    
+
+public:
+    void SetName(const QString& name){moduleName = name; }
+    void SetIniFile(const QString& inifile){iniFile = inifile;}
+    void SetConfigFile(const QString& cfgfile){configFile = cfgfile;}
+    void SetActive(const bool active) {isActive = active;}
+
+private:
+    QString moduleName;
+    QString iniFile;
+    QString configFile;
+    bool isActive;
+
+
+};
+#endif // CSTFMODULE_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/qt/inc/dlgoutput.h	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,70 @@
+/*
+* 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: QT C++ based Class.
+*              DlgOutput is a QT based dialog.
+*              Used to display case execution output and control the test case (pause/resume/abort).
+*
+*/
+#ifndef DLGOUTPUT_H_
+#define DLGOUTPUT_H_
+
+#include <QDialog>
+#include <QHash>
+#include "istfqtuicontroller.h"
+
+
+QT_BEGIN_NAMESPACE
+class QTabWidget;
+class QGridLayout;
+class QPlainTextEdit;
+class QPushButton;
+QT_END_NAMESPACE
+
+class DlgOutput : public QDialog, public IStfEventListener {
+    Q_OBJECT
+
+public:
+    DlgOutput(IStfQtUIController* ctl, QWidget *parent = 0);
+    ~DlgOutput();
+    
+private:
+    void CreateItem(QString index, QString item);
+    void CloseItem(QString index);
+    void ShowMessage(QString index, QString msg);
+    
+private://implement IStfEventListener
+    void OnGetMessage(const QString& ){};
+    void OnSetListChanged(){};
+    void OnCaseOutputChanged(const IStfEventListener::CaseOutputCommand& cmd, const QString& index, const QString& msg);
+    
+private slots:
+    void on_btnPause_clicked();
+    void on_btnAbort_clicked();
+    void on_btnClose_clicked();
+    
+    
+private:
+    IStfQtUIController* controller;
+    QTabWidget* tabMain;
+    QPushButton* btnPause;
+    QPushButton* btnAbort;
+    QPushButton* btnClose;
+    QHash<QString , QPlainTextEdit*> tabList;
+    
+};
+
+
+#endif /* DLGOUTPUT_H_ */
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/qt/inc/dlgrepeatrun.h	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,64 @@
+/*
+* 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: QT C++ based Class.
+*/
+
+#ifndef DLGREPEATRUN_H_
+#define DLGREPEATRUN_H_
+#include <QDialog>
+#include <QLineEdit>
+
+QT_BEGIN_NAMESPACE
+class QTabWidget;
+class QGridLayout;
+class QRadioButton;
+class QPushButton;
+QT_END_NAMESPACE
+
+class DlgRepeatRun : public QDialog {    
+    Q_OBJECT
+    
+public:
+    DlgRepeatRun(QWidget *parent = 0);
+    inline bool isRepeatInfinitely() {return isInfinite;};
+    inline int  GetLoopTimes() {return loopTimes;};
+    
+    
+private:
+    void SetupUI();
+    
+private:
+    QPushButton* btnOk;
+    QPushButton* btnCancel;
+    QLineEdit* lineEdit;
+    QRadioButton* rdoLoopInfinitely;
+    QRadioButton* rdoGiveLoopTimes;
+    
+    int loopTimes;
+    bool isInfinite;
+    
+private slots:
+    //on button clicked
+    void on_btnOk_clicked();
+    void on_btnCancel_clicked();
+    
+    //on check box state changed
+    void on_rdoLoopInfinitely_stateChanged(bool checked);
+    void on_rdoGiveLoopTimes_stateChanged(bool checked);
+    
+    };
+
+#endif /* DLGREPEATRUN_H_ */
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/qt/inc/dlgsetselector.h	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,66 @@
+/*
+* 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: QT C++ based Class.
+*              DlgSetSelector is a QT based dialog.
+*              Used to display available test set for select to add cases into.
+*
+*/
+#ifndef DLGSETSELECTOR_H_
+#define DLGSETSELECTOR_H_
+
+#include <QDialog>
+#include <QList>
+
+QT_BEGIN_NAMESPACE
+class QGridLayout;
+class QPushButton;
+class QRadioButton;
+class QListWidget;
+QT_END_NAMESPACE
+
+class DlgSetSelector : public QDialog {
+    Q_OBJECT
+
+public:
+    DlgSetSelector(QList<QString> setList, QWidget *parent = 0);
+    
+public:
+    inline QString SelectName(){return selectName;}
+    
+private:
+    void SetupUI();
+    
+private slots:
+    void on_btnOk_clicked();
+    void on_btnCancel_clicked();
+    void on_radio1Selection_Changed(bool checked);
+    void on_radio2Selection_Changed(bool checked);
+    
+private:
+    QString selectName;
+    
+    QRadioButton* rdoNewSet;
+    QRadioButton* rdoOldSet;
+    QListWidget* lstSet;
+    QPushButton* btnOk;
+    QPushButton* btnCancel;
+    QList<QString> setList;
+    
+    
+};
+
+
+#endif /* DLGSETSELECTOR_H_ */
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/qt/inc/dlgsetting.h	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,60 @@
+/*
+* 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: QT C++ based Class.
+*/
+
+#ifndef DLGSETTING_H_
+#define DLGSETTING_H_
+#include <QDialog>
+#include "uisetting.h"
+
+
+QT_BEGIN_NAMESPACE
+class QTabWidget;
+class QGridLayout;
+class QCheckBox;
+class QPushButton;
+class QLabel;
+class QLineEdit;
+QT_END_NAMESPACE
+
+class DlgSetting : public QDialog {    
+    Q_OBJECT
+    
+public:
+    DlgSetting(UiSetting* settingObj, QWidget *parent = 0);
+    
+private:
+    void SetupUI();
+    
+private:
+    QPushButton* btnOk;
+    QPushButton* btnCancel;
+    QCheckBox* chkShowoutput;
+    QLabel* lblFilter;
+    QLineEdit* ledFilter;
+    QCheckBox* chkFilterCaseSens;
+    
+private slots:
+    void on_btnOk_clicked();
+    void on_btnCancel_clicked();
+    
+private:
+    UiSetting* setting;
+    
+    };
+
+#endif /* DLGSETTING_H_ */
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/qt/inc/frmmain.h	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,205 @@
+/*
+* 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: QT C++ based Class.
+*              frmMain is a QT based Window.
+*              Used to display STF executor main GUI.
+*
+*/
+#ifndef FRMMAIN_H
+#define FRMMAIN_H
+
+#include <QMainWindow>
+#include <QtGui>
+#include "istfqtuicontroller.h"
+#include "istfqtuimodel.h"
+#include "dlgoutput.h"
+#include "uisetting.h"
+#include "dlgsetting.h"
+#include "dlgsetselector.h"
+#include "uiversion.h"
+#include "dlgrepeatrun.h"
+
+QT_BEGIN_NAMESPACE
+class QAction;
+class QLabel;
+class QMenu;
+class QTabWidget;
+class QWidget;
+class QPushButton;
+class QComboBox;
+class QPlainTextEdit;
+class QTreeWidget;
+class QTreeWidgetItem;
+class QListWidget;
+class QCheckBox;
+class QMessageBox;
+class QFileDialog;
+QT_END_NAMESPACE
+
+
+
+class FrmMain : public QMainWindow, public IStfEventListener, public IStifModelEventListener
+{
+    Q_OBJECT
+
+public:
+    FrmMain();
+    ~FrmMain();
+    
+    
+public: //Implement IStfEventListener
+    void OnGetMessage(const QString& aMessage);
+    void OnSetListChanged();
+    void OnCaseOutputChanged(const IStfEventListener::CaseOutputCommand& cmd, const QString& index, const QString& msg);
+
+    
+public: //Implement IStifModelEventListener
+    void OnCaseStatisticChanged() ;
+    void OnRunningCaseChanged() ;
+    
+protected:
+    void paintEvent(QPaintEvent *event);
+    
+protected slots:
+    void onTabWidgetSelectIndexChanged();
+
+
+private:
+    void createMenus();
+    void LoadSubMenu();
+    void load();
+    void loadContent();
+    void loadModuleList();
+    void loadSetList();
+    void loadStatistic();
+    QList<CSTFCase> getSelectedCases();
+    void reloadStatisticItem(QString name, QTreeWidgetItem* item, TSTFCaseStatusType type);
+    void setSetting();
+    void startRunning();
+    void setItemClicked(QTreeWidgetItem* item);
+    
+private:
+    IStfQtUIController* controller;
+    IStfQtUIModel* model;
+    DlgOutput* dlgOutput;
+    UiSetting* uiSetting; 
+    bool layoutType;
+    QTreeWidgetItem* lastItemSelected;
+    QString currentFilter;
+    QString currentFilterCaseSens;
+
+private: //UI Components
+    QWidget* centerWidget;
+    QGridLayout *mainLayout;
+    QGroupBox *groupBox;
+    
+    //menus and actions
+    QMenu *operateMenu;
+    //output panel
+    QPlainTextEdit *txtOutput;
+    //tab control.
+    QTabWidget *tabWidget;
+    QWidget *tabCase;
+    QWidget *tabSet;
+    QWidget *tabStarted;
+    QWidget *tabStatistic;
+
+    //Cases Tab
+    QTreeWidget *treeModuleList;
+    
+    //Statistic Tab
+    QTreeWidget *treeStatistic;
+    QTreeWidgetItem *executedItems;
+    QTreeWidgetItem *passedItems;
+    QTreeWidgetItem *failedItems;
+    QTreeWidgetItem *abortedItems;
+    QTreeWidgetItem *crashedItems;
+        
+    
+    //Set Tab
+    QComboBox *cboSetList;
+    QListWidget *lstSetCases;
+
+    //Started Tab
+    QListWidget *lstStartedCases;
+    QPushButton *btnPauseCase;
+    QPushButton *btnAbortCase;
+    QPushButton *btnShowOutput;
+
+    //menu actions
+    QAction *actExit;
+    QAction *actAbout;
+
+    //cases actoins
+    QAction *actOpenFile;
+    QAction *actRunCaseSeq;
+    QAction *actRunCasePar;
+    QAction *actReapeatRunSeq;
+    QAction *actAddtoSet;
+    QAction *actSelectAll;
+    QAction *actExpandAll;
+    QAction *actCollapseAll;
+    QAction *actSetting;
+    QMenu *menuRunCase; 
+    //sets actions
+    QAction *actRunSetSeq;
+    QAction *actRunSetPar;
+    QAction *actNewSet;
+    QAction *actDelSet;
+    QMenu *menuRunSet;
+    //running actions.
+    QAction *actPause;
+    QAction *actAbort;
+    QAction *actOutput;
+    
+    //statistics actions
+    QAction *actClearStatistics;
+
+private slots:
+    void on_cboSetList_currentIndexChanged(QString );
+    
+    void on_actAbout_triggered();    
+    void on_actOpenFile_triggered();
+    void on_actRunCaseSeq_triggered();
+    void on_actRunCasePar_triggered();
+    void on_actReapeatRunSeq_triggered();
+    void on_actAddtoSet_triggered();
+    void on_actSelectAll_triggered();
+    void on_actExpandAll_triggered();
+    void on_actCollapseAll_triggered();
+    void on_actExpand_triggered();
+    void on_actCollapse_triggered();
+    void on_actSetting_triggered();
+        
+    void on_actRunSetSeq_triggered();
+    void on_actRunSetPar_triggered();
+    void on_actNewSet_triggered();
+    void on_actDelSet_triggered();
+    void on_actPause_triggered();
+    void on_actAbort_triggered();
+    void on_actOutput_triggered();
+    void on_actClearStatistics_triggered();
+    void on_treeModuleList_itemClicked(QTreeWidgetItem* item, int column);
+
+    
+        
+    
+
+
+
+};
+
+#endif // FrmMain_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/qt/inc/istfqtuicontroller.h	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,86 @@
+/*
+* 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: QT C++ based Class.
+*              IStfQtUIController is interface of appliction controller.
+*              IStfEventListener is interface of Stf view observer.
+*
+*/
+#ifndef ISTFQTUICONTROLLER_H
+#define ISTFQTUICONTROLLER_H
+#include "cstfmodule.h"
+#include "cstfcase.h"
+#include <QList>
+#include "istfqtuimodel.h"
+
+class IStfEventListener
+{
+public:
+    enum CaseOutputCommand
+        {
+        ECreate,
+        EOutput,
+        EClose
+        };
+public:
+    virtual void OnGetMessage(const QString& aMessage) = 0;
+    virtual void OnSetListChanged() = 0;
+    virtual void OnCaseOutputChanged(const IStfEventListener::CaseOutputCommand& cmd, const QString& index, const QString& msg) = 0;
+};
+
+class IStfQtUIController
+{
+public:
+    inline virtual ~IStfQtUIController(){}
+    //for cases
+    virtual bool OpenEngineIniFile(const QString& fileName) = 0;
+    virtual QList<QString> GetModuleList() = 0;
+    virtual QList<QString> GetCaseListByModule(const QString& moduleName) = 0;
+    virtual CSTFCase GetCase(const QString& moduleName, const int index) = 0;
+    virtual void RunCases(const QList<CSTFCase>& caseList, const TSTFCaseRunningType& type) = 0;
+    virtual void RepeatRunCases(const QList<CSTFCase>& aCaseList, const bool aIsLoopInfinitely, const int aLoopTimes = 1) = 0;
+    virtual bool AddCaseToSet(const QList<CSTFCase>& aCase, const QString& setName) = 0;
+    
+    //for set
+    virtual QList<QString> GetSetList() = 0;
+    virtual QList<QString> GetCaseListBySet(const QString& setName) = 0;
+    virtual bool CreateSet(QString& setName) = 0;
+    virtual bool DeleteSet(const QString& setName) = 0;
+    virtual void RunSets(const QString& setName, const TSTFCaseRunningType& type) = 0;
+    
+    //for Started
+    virtual void PauseCase() = 0;
+    virtual void ResumeCase() = 0;
+    virtual void AbortCase() = 0;
+    virtual CSTFCase GetRunningCase(int index) = 0;
+    virtual bool ShowOutput() = 0;
+    virtual void SetShowOutput(bool isShow) = 0;
+    
+    //for staticstic
+    virtual QList<CSTFCase> GetCasesByStatus(const TSTFCaseStatusType& type) = 0;
+    
+    //listener
+    virtual void AddStfEventListener(IStfEventListener* listener) = 0;
+    virtual void RemoveStfEventListener(IStfEventListener* listener) = 0;
+    
+    //for repeat execution setting
+    virtual void InitRepeatSetting(const bool aIsLoopInfinitely, const int aLoopTimes) = 0;
+    virtual void ResetRepeatSetting() = 0;
+
+};
+
+
+
+#endif // ISTFQTUICONTROLLER_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/qt/inc/istfqtuimodel.h	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,57 @@
+/*
+* 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: QT C++ based Class.
+*              IStfQtUIModel is interface of appliction data model.
+*              IStifModelEventListener is used to listen event from data model.
+*
+*/
+#ifndef ISTFQTUIMODEL_H
+#define ISTFQTUIMODEL_H
+
+#include "cstfcase.h"
+#include "cstfmodule.h"
+#include <UIStoreIf.h>
+#include <UIStore.h>
+#include <UIEngine.h>
+
+class IStifModelEventListener
+    {    
+public:
+    virtual void OnCaseStatisticChanged() = 0; 
+    virtual void OnRunningCaseChanged() = 0;
+    };
+
+class IStfQtUIModel
+{  
+public:
+    inline virtual ~IStfQtUIModel(){}
+    virtual void ClearCasesStatus() = 0;
+    virtual QList<CSTFCase> GetCasesByStatus(const TSTFCaseStatusType& type) = 0;
+    virtual void AddRunningCase(const CStartedTestCase* startedCase, const CSTFCase& stfCase) = 0;
+    virtual void RemoveRunningCase(const CStartedTestCase* startedCase) = 0;
+    virtual void AddCaseByStatus(const TSTFCaseStatusType& type, const CSTFCase& aCase) = 0;
+    virtual CSTFCase GetRunningCase(const CStartedTestCase* startedCase) = 0;
+    virtual void PauseCase() = 0;
+    virtual void ResumeCase() = 0;
+    virtual void AbortCase() = 0;
+    
+    virtual void AddStifModelEventListener(IStifModelEventListener* listener) = 0;
+    virtual void RemoveStifModelEventListener(IStifModelEventListener* listener) = 0;
+    
+
+};
+
+#endif // ISTFQTUIMODEL_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/qt/inc/stfqtuicontroller.h	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,105 @@
+/*
+* 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: QT C++ based Class.
+*              Application's controller.
+*
+*/
+#ifndef STFQTUICONTROLLER_H_
+#define STFQTUICONTROLLER_H_
+
+#include "istfqtuicontroller.h"
+#include "istfqtuimodel.h"
+#include "stifexecutor.h"
+
+class StfQtUIController : public IStfQtUIController, public IStifCaseUpdateListener
+    {
+public:
+    StfQtUIController(IStfQtUIModel* aModel);
+    ~StfQtUIController();
+public: //Implement IStfQtUIController.
+    //for cases
+
+    bool OpenEngineIniFile(const QString& fileName);
+    QList<QString> GetModuleList();
+    QList<QString> GetCaseListByModule(const QString& moduleName);
+    CSTFCase GetCase(const QString& moduleName, const int index);
+    void RunCases(const QList<CSTFCase>& caseList, const TSTFCaseRunningType& type);
+    void RepeatRunCases(const QList<CSTFCase>& aCaseList, const bool aIsLoopInfinitely, const int aLoopTimes = 1);
+    bool AddCaseToSet(const QList<CSTFCase>& aCase, const QString& setName);
+    
+    //for set
+    QList<QString> GetSetList();
+    QList<QString> GetCaseListBySet(const QString& setName);
+    bool CreateSet(QString& setName);
+    bool DeleteSet(const QString& setName);
+    void RunSets(const QString& setName, const TSTFCaseRunningType& type);
+    
+    //for Started
+    void PauseCase();
+    void ResumeCase();
+    void AbortCase();
+    bool ShowOutput();
+    CSTFCase GetRunningCase(int index);
+    void SetShowOutput(bool isShow);
+    
+    //for staticstic
+    QList<CSTFCase> GetCasesByStatus(const TSTFCaseStatusType& type);
+    
+    //listener
+    void AddStfEventListener(IStfEventListener* listener);
+    void RemoveStfEventListener(IStfEventListener* listener);
+    
+    //for repeat execution setting
+    void InitRepeatSetting(const bool aIsLoopInfinitely, const int aLoopTimes);
+    void ResetRepeatSetting();
+
+public://implement IStifCaseUpdateListener
+    void OnGetCaseUpdated(CStartedTestCase* aCase, CSTFCase& stfcase, int flags);
+    void OnGetCaseOutput(CStartedTestCase* aCase, QString& msg);
+    
+private: //Fire event
+    void FireOnGetOutput(QString message);
+    void FireOnSetListChanged();
+    void FireOnCaseOutputChanged(IStfEventListener::CaseOutputCommand cmd, int index, QString msg);
+    
+private:
+    // help methods
+    CSTFModule GetModuleByName(const QString& moduleName);
+    // Repeat execution cases
+    void Execution();
+    
+private:
+    CStifExecutor* executor;
+    IStfQtUIModel* model;
+    QList<IStfEventListener*> listenerList;
+    bool isShowOutput;
+    
+    // repeat run case related member 
+    // repeat execution case list   
+    QList<CSTFCase> repeatRunCaseList;
+    // current position of the case list
+    int iCurrentRunPos;
+    // is loop infinitely
+    bool isLoopInfinitely;
+    // loop times
+    int loopTimes;
+    
+    };
+
+
+
+
+#endif /* STFQTUICONTROLLER_H_ */
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/qt/inc/stfqtuimodel.h	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,60 @@
+/*
+* 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: QT C++ based Class.
+*              application data model.
+*
+*/
+#include "istfqtuimodel.h"
+#include "stifexecutor.h"
+#include <QHash>
+
+class StfQtUIModel : public IStfQtUIModel
+    {
+public:
+    StfQtUIModel();
+    virtual ~StfQtUIModel();
+public://implement IStfQtUIModel
+    void ClearCasesStatus();
+    QList<CSTFCase> GetCasesByStatus(const TSTFCaseStatusType& type);
+    void AddRunningCase(const CStartedTestCase* startedCase, const CSTFCase& stfCase);
+    void RemoveRunningCase(const CStartedTestCase* startedCase);
+    void AddCaseByStatus(const TSTFCaseStatusType& type, const CSTFCase& aCase);
+    void AddStifModelEventListener(IStifModelEventListener* listener);
+    void RemoveStifModelEventListener(IStifModelEventListener* listener);
+    CSTFCase GetRunningCase(const CStartedTestCase* startedCase);
+    void PauseCase();
+    void ResumeCase();
+    void AbortCase();
+    
+private:
+    void FireOnCaseStatisticChangedEvent();
+    void FireOnRunningCaseChangedEvent();
+    
+private:
+    QList<IStifModelEventListener*> listenerList;
+    QList<CSTFCase> executedCaseList;
+    QList<CSTFCase> passedCaseList;
+    QList<CSTFCase> failedCaseList;
+    QList<CSTFCase> abortCaseList;
+    QList<CSTFCase> crashedCaseList;
+    QHash<const CStartedTestCase*, CSTFCase> runningCaseList;
+    
+    
+    
+    
+    
+    
+    };
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/qt/inc/stifexecutor.h	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,80 @@
+/*
+* 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: QT C++ and Symbian C++ combination Class.
+*              Call STIF UI engine and UI interface to perform test operation.
+*              All the public methods are QT C++ based object.
+*
+*/
+#ifndef STIFEXECUTOR_H_
+#define STIFEXECUTOR_H_
+
+#include "cstfcase.h"
+#include "cstfmodule.h"
+#include <UIStoreIf.h>
+#include <UIStore.h>
+#include <UIEngine.h>
+#include <QList>
+#include <StifLogger.h>
+
+class IStifCaseUpdateListener
+    {
+public:
+    virtual void OnGetCaseUpdated(CStartedTestCase* aCase,CSTFCase& stfcase, int flags) = 0;
+    virtual void OnGetCaseOutput(CStartedTestCase* aCase, QString& msg) = 0;
+    };
+
+
+class CStifExecutor : public CUIStoreIf 
+    {
+public:
+    CStifExecutor();
+    ~CStifExecutor();
+public: 
+    void AddStifCaseUpdateListener(IStifCaseUpdateListener* listener);
+    void RemoveStifCaseUpdateListener(IStifCaseUpdateListener* listener);
+    bool OpenIniFile(const QString& filename);
+    QList<CSTFModule> GetModuleList();
+    QList<CSTFCase> GetCaseList(const QString& moduleName);
+    void ExecuteSingleCase(const QString& moduleName, int caseIndex);
+    QList<QString> GetSetList();
+    QList<CSTFCase> GetCaseListFromSet(const QString& setName);
+    bool CreateSet(const QString& setName);
+    bool SaveSet(QString& setName);
+    bool RemoveSet(const QString& setName);
+    bool AddtoSet(const QString& setName, CSTFCase& caseInfo);
+    void ExecuteSet(const QString& SetName, const int startIndex, const TSTFCaseRunningType type);
+    
+public://implement CUIStoreIf 
+     void Update( CStartedTestCase* aTestCase,
+                          TInt aFlags);
+     
+public:
+     TPtrC QString2TPtrC(const QString& aString);
+     QString TDesC2QString(const TDesC& des);
+     //CTestInfo* GetTestInfo(CSTFCase aCase);
+     
+private:
+     bool LogResult(const TInt result,const QString str);
+private:
+   QList<IStifCaseUpdateListener*> *listenerList;
+   HBufC*  iBuffer;
+   // Pointer to logger
+   CStifLogger * iLog;
+    };
+
+
+
+#endif /* STIFEXECUTOR_H_ */
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/qt/inc/uisetting.h	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,48 @@
+/*
+* 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: QT C++ based Class.
+*/
+
+#ifndef UISETTING_H_
+#define UISETTING_H_
+#include <QHash>
+
+const QString KShowOutput = "showoutput";
+const QString KStyleSheet = "StyleSheet";
+const QString KFilter = "filter";
+const QString KFilterCaseSens = "filtercasesens";
+
+class UiSetting
+    {
+public:
+    UiSetting();
+    ~UiSetting();
+    
+public:
+    QString ReadSetting(const QString& item);
+    void SetSetting(const QString& item,const QString& value);
+    
+private:
+    bool load();
+    bool save();
+    void loadDefault();
+    QString getDefaultValue(const QString& item);
+    
+private:
+    QHash<QString, QString> settingList;
+    };
+
+#endif /* UISETTING_H_ */
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/qt/inc/uiversion.h	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,28 @@
+/*
+* 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: QT C++ based Class.
+*              frmMain is a QT based Window.
+*              Used to display STF executor main GUI.
+*
+*/
+
+#ifndef UIVERSION_H_
+#define UIVERSION_H_
+
+const QString QtUIVersion = "v1.1.1";
+const QString QtUIName = "STFUI";
+
+#endif /* UIVERSION_H_ */
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/qt/inc/version.h	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,31 @@
+/*
+* 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: STIF version declaration
+*
+*/
+
+#ifndef VERSION_H_
+#define VERSION_H_
+
+#define STIF_MAJOR_VERSION 7
+#define STIF_MINOR_VERSION 3
+#define STIF_BUILD_VERSION 36
+
+#define STIF_REL_DATE "29th June 2010"
+
+#define TO_UNICODE(text) _L(text) 
+
+#endif /*VERSION_H_*/
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/qt/qss/coffee.qss	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,326 @@
+QWidget {
+	background-color: cornsilk;
+}
+
+QMessageBox {
+	background-color: cornsilk;
+	border-width: 2px;
+	border-style: solid;
+    border-color: darkkhaki;
+    padding: 3px;
+    font-size:12px;
+    font: bold;
+}
+
+QDialog {
+	background-color: cornsilk;
+	border-width: 2px;
+	border-style: solid;
+    border-color: darkkhaki;
+    font-size:12px;
+    font: bold;
+}
+
+QInputDialog {
+	background-color: cornsilk;
+	border-width: 2px;
+	border-style: solid;
+    border-color: darkkhaki;
+    font-size:12px;
+    font: bold;
+}
+
+
+/*QPushButton*/
+QPushButton {
+    color: #0a214c;
+    background-color: palegoldenrod;
+    border-width: 2px;
+    border-color: darkkhaki;
+    border-style: solid;
+    border-radius: 5;
+    padding: 3px;
+    min-width: 100px;
+    min-height: 32px;
+    max-width: 100px;
+    max-height: 32px;
+    font-size:16px;
+    font: bold;
+}
+
+QPushButton:hover {
+   background-color: khaki;
+}
+
+QPushButton:pressed {
+    padding-left: 2px;
+    padding-top: 2px;
+    background-color: #d0d67c;
+}
+
+
+QPushButton::disabled {
+	color: #ffffff;
+}
+
+QRadioButton {
+    font: bold;
+    font-size: 14px;
+    border: none;
+    padding: 0;
+    background-color: cornsilk;
+    color: black; 
+    background-color: cornsilk;
+    selection-color: #0a214c; 
+    selection-background-color: #C19A6B;
+}
+
+QRadioButton:focus {
+	color:black;
+	background-color: cornsilk;
+}
+
+QRadioButton:selected {
+    background-color: cornsilk;
+    color:black;
+}
+
+QRadioButton:pressed {
+    background-color: cornsilk;
+    color:black;
+}
+
+
+/*QTabQWidget*/
+QTabWidget::pane { /* The tab widget frame */
+    border-top: 2px solid #C2C7CB;
+}
+
+QTabWidget::tab-bar {
+    left: 5px; /* move to the right by 5px */
+}
+
+/* Style the tab using the tab sub-control. Note that
+    it reads QTabBar _not_ QTabWidget */
+QTabBar::tab {
+    background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,
+                                stop: 0 #E1E1E1, stop: 0.4 #DDDDDD,
+                                stop: 0.5 #D8D8D8, stop: 1.0 #D3D3D3);
+    border: 2px solid #C4C4C3;
+    border-bottom-color: #C2C7CB; /* same as the pane color */
+    border-top-left-radius: 4px;
+    border-top-right-radius: 4px;
+    /*min-width: 5ex;*/
+    padding: 2px;
+    color: #0a214c;
+    font-size:15px;
+}
+
+QTabBar::tab:selected, QTabBar::tab:hover {
+    background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,
+                                stop: 0 #fafafa, stop: 0.4 #f4f4f4,
+                                stop: 0.5 #e7e7e7, stop: 1.0 #fafafa);
+}
+
+QTabBar::tab:selected {
+    border-color: #9B9B9B;
+    border-bottom-color: #C2C7CB; /* same as pane color */
+    font: bold;
+    font-size:15px;
+}
+
+QTabBar::tab:!selected {
+    margin-top: 2px; /* make non-selected tabs look smaller */
+    font: bold;
+    font-size:14px;
+}
+
+/* make use of negative margins for overlapping tabs */
+QTabBar::tab:selected {
+    /* expand/overlap to the left and right by 4px */
+    /*
+    margin-left: -4px;
+    margin-right: -4px;
+    */
+}
+
+QTabBar::tab:first:selected {
+    margin-left: 0; /* the first selected tab has nothing to overlap with on the left */
+}
+
+QTabBar::tab:last:selected {
+    margin-right: 0; /* the last selected tab has nothing to overlap with on the right */
+}
+
+QTabBar::tab:only-one {
+    margin: 0; /* if there is only one tab, we don't want overlapping margins */
+}
+
+
+/* QLabel */
+QLabel {
+    font: bold;
+    font-size: 14px;
+    border: none;
+    padding: 0;
+    background: none;
+    color: black;
+    
+}
+
+/* QLabel */
+QCheckBox {
+    font: bold;
+    font-size: 14px;
+    border: none;
+    padding: 0;
+    background-color: cornsilk;
+    color: black; 
+    background-color: cornsilk;
+    selection-color: #0a214c; 
+    selection-background-color: #C19A6B;
+}
+
+QCheckBox::focus {
+	color:black;
+	background-color: cornsilk;
+}
+
+QCheckBox:selected {
+    background-color: cornsilk;
+    color:black;
+}
+
+QCheckBox:pressed {
+    background-color: cornsilk;
+    color:black;
+}
+
+
+QFrame {
+	background-color: cornsilk;
+}
+
+QLineEdit, QPlainTextEdit {
+	background-color: cornsilk;
+    border-width: 1px;
+    padding: 1px;
+    border-style: solid;
+    border-color: darkkhaki;
+    border-radius: 3px;
+    color:black;
+    font-size:14px;
+}
+
+QLineEdit:focus, QPlainTextEdit:focus {
+    border-width: 3px;
+    padding: 0px;
+}
+
+/*QComboBox*/
+
+QComboBox {
+    background-color: cornsilk;
+    selection-color: #0a214c; 
+    selection-background-color: #C19A6B;
+    color:black;
+    font-size:20px;
+    border-width: 1px;
+    padding: 1px;
+    border-style: solid;
+    border-color: darkkhaki;
+}
+
+/*QGroupBox*/
+QGroupBox {
+	background-color: cornsilk;
+	margin-top: 2ex;
+	border: 2px solid gray;
+	border-radius: 5px;
+	
+
+}
+
+QGroupBox::title {
+	subcontrol-origin: margin;
+	padding: 0 3px;
+	color:black;
+	font-size:14px;
+	background-color: cornsilk;
+}
+
+
+/*QTreeWidget*/
+
+QTreeWidget {
+    color: brown;
+	show-decoration-selected: 1;
+	border-width: 1px;
+    padding: 1px;
+    border-style: solid;
+    border-color: darkkhaki;
+    border-radius: 3px;
+    background-color: cornsilk;
+    selection-color: #0a214c; 
+    selection-background-color: #C19A6B;
+}
+
+QHeaderView {
+	color : black;
+	border-width: 1px;
+	padding: 1px;
+    border-style: solid;
+    border-color: darkkhaki;
+    border-radius: 3px;
+    background-color: khaki;
+}
+
+QHeaderView::section {
+	color : black;
+	border-width: 0px;
+	padding: 0px;
+    border-style: none;
+    background-color: palegoldenrod;
+}
+
+
+QTreeWidget::item{
+	height:35px;
+	font-size:20px;
+}
+
+QTreeWidget::item:hover{
+	background-color: wheat;
+}
+
+QListView {
+    color: brown;
+    show-decoration-selected: 1;
+    border-width: 1px;
+    padding: 1px;
+    border-style: solid;
+    border-color: darkkhaki;
+    border-radius: 3px;
+    background-color: cornsilk;
+    selection-color: #0a214c; 
+    selection-background-color: #C19A6B;
+    font-size:16px;
+}
+
+QListView::item:hover {
+    background-color: wheat;
+}
+
+QListView::disabled {
+	color: #ffffff;
+	background-color: gray;
+}
+
+QListView::item {
+	height:30px;
+}
+
+QErrorMessage::text {
+	color: black;
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/qt/resource/StfQtUI.qrc	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,5 @@
+<RCC>
+<qresource prefix="/">
+<file>../qss/coffee.qss</file>
+</qresource>
+</RCC>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/qt/rom/stfui.iby	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,28 @@
+/*
+* 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: Stifui.iby file specifies needed STIF and STIF UI 
+* and UITetsServerstarter components for ROM image
+*
+*/
+
+#ifndef __STIF_UI_IBY__
+#define __STIF_UI_IBY__
+
+S60_APP_EXE(stfui)
+S60_APP_RESOURCE(stfui)
+data=\epoc32\data\Z\private\10003a3f\import\Apps\stfui_reg.rsc   \private\10003a3f\import\apps\stfui_reg.rsc
+
+
+#endif
+// End of File
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/qt/sis/stifqtui.pkg	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,27 @@
+; stifqtui_armv5_urel.pkg generated by qmake at 2010-05-31T09:56:39
+; This file is generated by qmake and should not be modified by the user
+;
+
+; Language
+&EN
+
+; SIS header: name, uid, version
+#{"STFUI"},(0x2002BCA0),1,0,0
+
+; Localised Vendor name
+%{"Nokia, Qt Software"}
+
+; Unique Vendor name
+:"Nokia, Qt Software"
+
+; Dependencies
+[0x101F7961],0,0,0,{"S60ProductID"}
+[0x102032BE],0,0,0,{"S60ProductID"}
+[0x102752AE],0,0,0,{"S60ProductID"}
+[0x1028315F],0,0,0,{"S60ProductID"}
+(0x2001E61C), 4, 5, 2, {"QtLibs pre-release"}
+
+; Executable and default resource files
+"/epoc32/release/armv5/urel/STFUI.exe"    - "!:\sys\bin\STFUI.exe"
+"/epoc32/data/z/resource/apps/STFUI.rsc"    - "!:\resource\apps\STFUI.rsc"
+"/epoc32/data/z/private/10003a3f/import/apps/STFUI_reg.rsc"    - "!:\private\10003a3f\import\apps\STFUI_reg.rsc"
Binary file stifui/qt/sis/stifqtui.sis has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/qt/src/dlgoutput.cpp	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,142 @@
+/*
+ * 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: QT C++ based Class.
+ * 
+ */
+#include "dlgoutput.h"
+#include <QtGui>
+
+DlgOutput::DlgOutput(IStfQtUIController* ctl, QWidget *parent) :
+    QDialog(parent), controller(ctl)
+    {
+    QGridLayout *mainLayout = new QGridLayout(this);
+    this->setLayout(mainLayout);
+    this->setContextMenuPolicy(Qt::NoContextMenu);
+
+    tabMain = new QTabWidget(this);
+    tabMain->setContextMenuPolicy(Qt::NoContextMenu);
+
+    QWidget *toolWidget = new QWidget(this);
+    toolWidget->setContextMenuPolicy(Qt::NoContextMenu);
+    QGridLayout *toolLayout = new QGridLayout(this);
+    toolWidget->setLayout(toolLayout);
+    btnPause = new QPushButton(tr("Pause"), toolWidget);
+    btnPause->setContextMenuPolicy(Qt::NoContextMenu);
+    QObject::connect(btnPause, SIGNAL(clicked()), this,
+            SLOT(on_btnPause_clicked()));
+    btnAbort = new QPushButton(tr("Abort"), toolWidget);
+    btnAbort->setContextMenuPolicy(Qt::NoContextMenu);
+    QObject::connect(btnAbort, SIGNAL(clicked()), this,
+            SLOT(on_btnAbort_clicked()));
+    
+    btnClose = new QPushButton(tr("Hide"), toolWidget);
+    btnClose->setContextMenuPolicy(Qt::NoContextMenu);
+    QObject::connect(btnClose, SIGNAL(clicked()), this,
+            SLOT(on_btnClose_clicked()));
+    toolLayout->addWidget(btnPause, 0, 0);
+    toolLayout->addWidget(btnAbort, 0, 1);
+    toolLayout->addWidget(btnClose, 0, 2);
+        
+
+    mainLayout->addWidget(toolWidget, 0, 0);
+    mainLayout->addWidget(tabMain, 1, 0);
+    controller->AddStfEventListener(this);
+    }
+
+DlgOutput::~DlgOutput()
+    {
+    controller->RemoveStfEventListener(this);
+    }
+
+void DlgOutput::CreateItem(QString index, QString item)
+    {
+    QPlainTextEdit* edit = new QPlainTextEdit(this);
+    edit->setContextMenuPolicy(Qt::NoContextMenu);
+    tabMain->addTab(edit, item);
+    tabList.insert(index, edit);
+    }
+
+void DlgOutput::CloseItem(QString index)
+    {
+    delete tabList.value(index);
+    tabList.remove(index);
+    if (tabMain->count() == 0)
+        {
+        this->close();
+        }
+    }
+
+void DlgOutput::ShowMessage(QString index, QString msg)
+    {
+    if(tabList.contains(index))
+        {
+        tabList.value(index)->setPlainText(msg);    
+        }
+    else
+        {
+//        bool ok;
+//        CSTFCase acase = controller->GetRunningCase(index.toInt(&ok, 10));
+//        CreateItem(index, acase.Name());
+//        ShowMessage(index, msg);
+        }
+    }
+
+void DlgOutput::on_btnPause_clicked()
+    {
+    if (btnPause->text() == "Pause")
+        {
+        controller->PauseCase();
+        btnPause->setText(tr("Resume"));
+        }
+    else
+        {
+        controller->ResumeCase();
+        btnPause->setText(tr("Pause"));
+        }
+    }
+
+void DlgOutput::on_btnAbort_clicked()
+    {
+    controller->AbortCase();
+    }
+
+void DlgOutput::on_btnClose_clicked()
+    {
+    controller->SetShowOutput(false);
+    this->close();
+    }
+
+void DlgOutput::OnCaseOutputChanged(const IStfEventListener::CaseOutputCommand& cmd,
+        const QString& index, const QString& msg)
+    {
+    if(controller->ShowOutput() && this->isVisible() == false)
+        {
+        this->showMaximized();
+        }
+    switch (cmd)
+        {
+        case IStfEventListener::ECreate:
+            CreateItem(index, msg);
+            break;
+        case IStfEventListener::EClose:
+            CloseItem(index);
+            break;
+        default:
+            ShowMessage(index, msg);
+            break;
+        }
+
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/qt/src/dlgrepeatrun.cpp	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,133 @@
+/*
+ * 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: QT C++ based Class.
+ * 
+ */
+
+#include "dlgrepeatrun.h"
+#include <QtGui>
+
+DlgRepeatRun::DlgRepeatRun(QWidget *parent)
+    : QDialog(parent),
+      loopTimes(0),
+      isInfinite(true)
+    {
+    SetupUI();
+    }
+
+void DlgRepeatRun::SetupUI()
+    {
+    this->setContextMenuPolicy(Qt::NoContextMenu);
+    QGridLayout *mainLayout = new QGridLayout(this);
+    this->setLayout(mainLayout);
+    
+    //nullWidget is just place holder for better looking.
+    QWidget *nullWidget = new QWidget(this);
+    nullWidget->setMinimumHeight(30);
+    mainLayout->addWidget(nullWidget, 0, 0);
+    
+    // check box LoopInfinitely
+    rdoLoopInfinitely = new QRadioButton(this);
+    rdoLoopInfinitely->setMinimumHeight(40);
+    rdoLoopInfinitely->setText(tr("Repeat infinitely."));
+    rdoLoopInfinitely->setChecked(Qt::Checked);
+    QObject::connect(rdoLoopInfinitely, SIGNAL(clicked(bool)), this,
+                SLOT(on_rdoLoopInfinitely_stateChanged(bool)));
+    
+
+    // check box LoopTime
+    rdoGiveLoopTimes = new QRadioButton(this);
+    rdoGiveLoopTimes->setMinimumHeight(40);
+    rdoGiveLoopTimes->setText(tr("Give loop times:"));
+    rdoGiveLoopTimes->setChecked(Qt::Unchecked);
+    QObject::connect(rdoGiveLoopTimes, SIGNAL(clicked(bool)), this,
+                SLOT(on_rdoGiveLoopTimes_stateChanged(bool)));
+    
+    // lineEdit, 
+    QValidator *validator = new QIntValidator(1, 999999, this); 
+    lineEdit = new QLineEdit(this);
+    lineEdit->setValidator(validator);
+    lineEdit->setMinimumHeight(40);
+    lineEdit->setMaxLength(6);
+    lineEdit->setMaximumWidth(60);
+    lineEdit->setEchoMode(QLineEdit::NoEcho);
+    lineEdit->setReadOnly(true);
+    
+    // add check box and lineEdit to layout. 
+    QWidget *toolWidgetForLoopTimes = new QWidget(this);
+    QGridLayout *toolLayoutForLoopTimes = new QGridLayout(this);
+    toolWidgetForLoopTimes->setLayout(toolLayoutForLoopTimes);
+    toolLayoutForLoopTimes->addWidget(rdoLoopInfinitely, 0, 0);
+    toolLayoutForLoopTimes->addWidget(rdoGiveLoopTimes, 1, 0);
+    toolLayoutForLoopTimes->addWidget(lineEdit, 1, 1);
+    mainLayout->addWidget(toolWidgetForLoopTimes, 1, 0);
+    
+    // add button
+    QWidget *toolWidgetForButtons = new QWidget(this);
+    QGridLayout *toolLayoutForButtons = new QGridLayout(this);
+    toolWidgetForButtons->setLayout(toolLayoutForButtons);
+    btnOk = new QPushButton(tr("Ok"), toolWidgetForButtons);
+    QObject::connect(btnOk, SIGNAL(clicked()), this,
+            SLOT(on_btnOk_clicked()));
+    btnCancel = new QPushButton(tr("Cancel"), toolWidgetForButtons);
+    QObject::connect(btnCancel, SIGNAL(clicked()), this,
+            SLOT(on_btnCancel_clicked()));
+    toolLayoutForButtons->addWidget(btnOk, 0, 0);
+    toolLayoutForButtons->addWidget(btnCancel, 0, 1);
+    mainLayout->addWidget(toolWidgetForButtons, 2, 0);
+    }
+
+void DlgRepeatRun::on_btnOk_clicked()
+    {
+    if(!isRepeatInfinitely())
+        {
+        loopTimes = lineEdit->text().toInt();
+        if (loopTimes < 0)
+            {
+            loopTimes = 0;
+            }
+        }
+    else
+        {
+        loopTimes = 0;
+        }
+    this->accept();
+    }
+
+void DlgRepeatRun::on_btnCancel_clicked()
+    {
+    this->reject();    
+    }
+
+void DlgRepeatRun::on_rdoLoopInfinitely_stateChanged(bool checked)
+    {
+    if(checked)
+        {
+        isInfinite = true;
+        lineEdit->setEchoMode(QLineEdit::NoEcho);
+        lineEdit->setReadOnly(true);
+        }
+    }
+
+void DlgRepeatRun::on_rdoGiveLoopTimes_stateChanged(bool checked)
+    {
+    if(checked)
+        {
+        isInfinite = false;
+        lineEdit->setEchoMode(QLineEdit::Normal); 
+        lineEdit->setReadOnly(false);
+        }
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/qt/src/dlgsetselector.cpp	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,116 @@
+/*
+ * 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: QT C++ based Class.
+ * 
+ */
+
+#include "dlgsetselector.h"
+#include <QtGui>
+
+DlgSetSelector::DlgSetSelector(QList<QString> list, QWidget* parent):
+        QDialog(parent), selectName(""), setList(list)
+    {
+    SetupUI();
+    }
+
+void DlgSetSelector::SetupUI()
+    {
+     QGridLayout *mainLayout = new QGridLayout(this);
+     this->setLayout(mainLayout);
+     this->setContextMenuPolicy(Qt::NoContextMenu);
+     
+     rdoNewSet = new QRadioButton(this);
+     rdoNewSet->setChecked(true);
+     rdoNewSet->setText(tr("Create a new Set"));
+     QObject::connect(rdoNewSet, SIGNAL(clicked(bool)), this, 
+             SLOT(on_radio1Selection_Changed(bool)));
+     rdoOldSet = new QRadioButton(this);
+     rdoOldSet->setChecked(false);
+     rdoOldSet->setText(tr("Select a exist set:"));
+     QObject::connect(rdoOldSet, SIGNAL(clicked(bool)), this, 
+             SLOT(on_radio2Selection_Changed(bool)));
+     
+     lstSet = new QListWidget(this);
+     for(int i=0;i<setList.count();i++)
+         {
+         lstSet->addItem(setList[i]);
+         }
+     lstSet->setEnabled(false);
+     
+     QWidget *toolWidget = new QWidget(this);
+     toolWidget->setContextMenuPolicy(Qt::NoContextMenu);
+     QGridLayout *toolLayout = new QGridLayout(this);
+     toolWidget->setLayout(toolLayout);
+     btnOk = new QPushButton(tr("Ok"), toolWidget);
+     btnOk->setContextMenuPolicy(Qt::NoContextMenu);
+     QObject::connect(btnOk, SIGNAL(clicked()), this,
+             SLOT(on_btnOk_clicked()));
+     btnCancel = new QPushButton(tr("Cancel"), toolWidget);
+     btnCancel->setContextMenuPolicy(Qt::NoContextMenu);
+     QObject::connect(btnCancel, SIGNAL(clicked()), this,
+             SLOT(on_btnCancel_clicked()));
+     toolLayout->addWidget(btnOk, 0, 0);
+     toolLayout->addWidget(btnCancel, 0, 1);
+         
+
+     mainLayout->addWidget(rdoNewSet, 0, 0);
+     mainLayout->addWidget(rdoOldSet, 1, 0);
+     mainLayout->addWidget(lstSet, 2, 0);
+            
+     mainLayout->addWidget(toolWidget, 3, 0);
+     this->showMaximized();
+     
+    }
+void DlgSetSelector::on_radio1Selection_Changed(bool /* checked */)
+    {
+    lstSet->setEnabled(false);
+    }
+
+
+void DlgSetSelector::on_radio2Selection_Changed(bool checked)
+    {
+    lstSet->setEnabled(true);
+    if(checked)
+        {
+        if(setList.count() == 0)
+            {
+            rdoNewSet->setChecked(true);
+            }
+        else
+            {
+            lstSet->setCurrentRow(0);
+            }
+        }
+    
+    }
+
+void DlgSetSelector::on_btnOk_clicked()
+    {
+    if(rdoOldSet->isChecked())
+        {
+        selectName = lstSet->selectedItems()[0]->text();
+        }
+    else
+        {
+        selectName = "";
+        }
+    this->accept();
+    }
+
+void DlgSetSelector::on_btnCancel_clicked()
+    {
+    this->reject();
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/qt/src/dlgsetting.cpp	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,91 @@
+/*
+ * 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: QT C++ based Class.
+ * 
+ */
+
+#include "dlgsetting.h"
+#include <QtGui>
+
+DlgSetting::DlgSetting(UiSetting* settingObj, QWidget *parent)
+    : QDialog(parent), setting(settingObj)
+    {
+    SetupUI();
+    }
+
+void DlgSetting::SetupUI()
+    {
+    this->setContextMenuPolicy(Qt::NoContextMenu);
+    QGridLayout *mainLayout = new QGridLayout(this);
+    this->setLayout(mainLayout);
+    
+    chkShowoutput = new QCheckBox(this);
+    chkShowoutput->setText(tr("Show output in execution."));
+    chkShowoutput->setChecked(setting->ReadSetting(KShowOutput) == "true");
+    
+    lblFilter = new QLabel(this);
+    lblFilter->setText(tr("Filter for displayed titles."));
+    ledFilter = new QLineEdit(this);
+    ledFilter->setFrame(true);
+    ledFilter->setText(setting->ReadSetting(KFilter));
+    chkFilterCaseSens = new QCheckBox(this);
+    chkFilterCaseSens->setText(tr("Filter is case sensitive."));
+    chkFilterCaseSens->setChecked(setting->ReadSetting(KFilterCaseSens) == "true");
+    
+    QWidget *toolWidget = new QWidget(this);
+    QGridLayout *toolLayout = new QGridLayout(this);
+    
+    toolWidget->setLayout(toolLayout);
+    btnOk = new QPushButton(tr("Ok"), toolWidget);
+    QObject::connect(btnOk, SIGNAL(clicked()), this,
+            SLOT(on_btnOk_clicked()));
+    btnCancel = new QPushButton(tr("Cancel"), toolWidget);
+    QObject::connect(btnCancel, SIGNAL(clicked()), this,
+            SLOT(on_btnCancel_clicked()));
+    toolLayout->addWidget(btnOk, 0, 0);
+    toolLayout->addWidget(btnCancel, 0, 1);
+
+    QWidget *nullWidget = new QWidget(this);
+    nullWidget->setMinimumHeight(30);
+    
+    mainLayout->addWidget(nullWidget, 0, 0);
+    mainLayout->addWidget(chkShowoutput, 1, 0);
+    mainLayout->addWidget(lblFilter, 3, 0);
+    mainLayout->addWidget(ledFilter, 4, 0);
+    mainLayout->addWidget(chkFilterCaseSens, 5, 0);
+    mainLayout->addWidget(toolWidget, 7, 0); 
+    
+    }
+
+void DlgSetting::on_btnOk_clicked()
+    {
+    if(chkShowoutput->checkState() == Qt::Checked)
+        {
+        setting->SetSetting(KShowOutput, "true");
+        }
+    else
+        {
+        setting->SetSetting(KShowOutput, "false");    
+        }
+    setting->SetSetting(KFilter, ledFilter->text());
+    setting->SetSetting(KFilterCaseSens, (chkFilterCaseSens->checkState() == Qt::Checked) ? ("true") : ("false"));
+    this->accept();
+    }
+
+void DlgSetting::on_btnCancel_clicked()
+    {
+    this->reject();
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/qt/src/frmmain.cpp	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,1160 @@
+/*
+ * 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: QT C++ based Class.
+ *              
+ */
+#include <QtGui>
+#include "frmmain.h"
+#include "stfqtuicontroller.h"
+#include "stfqtuimodel.h"
+#include <QList>
+#include "version.h"
+#include <QCursor>
+#include <QDesktopWidget>
+
+const QString SELECTITEMHEADER = " * ";
+const QString UNSELECTITEMHEADER = "   ";
+
+FrmMain::FrmMain()
+    {
+    lastItemSelected = NULL;
+    uiSetting = new UiSetting();
+    createMenus();
+    load();
+    LoadSubMenu();
+    
+    QFile file(uiSetting->ReadSetting(KStyleSheet));
+    bool rst = file.open(QFile::ReadOnly);    
+    if(rst)
+        {
+        QString styleSheet = QLatin1String(file.readAll());    
+        qApp->setStyleSheet(styleSheet);    
+        }
+        
+    model = new StfQtUIModel();
+    model->AddStifModelEventListener(this);
+    controller = new StfQtUIController(model);
+    controller->AddStfEventListener(this);
+    loadContent();
+    dlgOutput = new DlgOutput(controller);
+    setSetting();
+    }
+
+FrmMain::~FrmMain()
+    {
+    model->AbortCase();
+    controller->RemoveStfEventListener(this);
+    model->RemoveStifModelEventListener(this);
+    
+    //lastItemSelected does not own any memory, don't need to delete.
+    lastItemSelected = NULL;
+    delete uiSetting;
+    delete dlgOutput;
+    delete controller;
+    delete model;
+    }
+
+void FrmMain::paintEvent(QPaintEvent* event)
+    {
+    
+    if(mainLayout != NULL)
+        {
+        QDesktopWidget* desktop = QApplication::desktop();
+        QRect rect = desktop->screenGeometry(0);
+        bool temp = false;
+        if(rect.height() > rect.width())
+            {
+            temp = true;
+            }
+        
+        if(temp != layoutType)
+            {
+            mainLayout->removeWidget(tabWidget);
+            mainLayout->removeWidget(groupBox);
+            if(temp)
+                {
+                mainLayout->addWidget(tabWidget, 0, 0);
+                mainLayout->addWidget(groupBox, 1, 0, Qt::AlignBottom);
+                mainLayout->setRowStretch(0,4);
+                mainLayout->setRowStretch(1,1);
+                }
+            else
+                {
+                mainLayout->addWidget(tabWidget, 0, 0);
+                mainLayout->addWidget(groupBox, 0, 1);//Qt::AlignRight
+                //groupBox->setFixedSize(60,0);
+                mainLayout->setColumnStretch(0,1);
+                mainLayout->setColumnStretch(1,1);
+                }
+            layoutType = temp;
+            
+            }
+        
+        }
+    event->accept();
+    }
+
+void FrmMain::setSetting()
+    {
+    controller->SetShowOutput(uiSetting->ReadSetting(KShowOutput) == "true");    
+    // Apply filter changes
+    QString newFilter = uiSetting->ReadSetting(KFilter);
+    QString newFilterCaseSens = uiSetting->ReadSetting(KFilterCaseSens); 
+    if(currentFilter != newFilter || currentFilterCaseSens != newFilterCaseSens)
+        {
+        // Store new filter for further use
+        currentFilter = newFilter;
+        currentFilterCaseSens = newFilterCaseSens;
+        
+        // Create and setup regular expression for wildcard searching
+        QRegExp filter;
+        filter.setPattern((newFilter == "") ? ("*") : (tr("*") + newFilter + tr("*")));
+        filter.setCaseSensitivity((newFilterCaseSens == "true") ? (Qt::CaseSensitive) : (Qt::CaseInsensitive));
+        filter.setPatternSyntax(QRegExp::Wildcard);
+
+        // Go through top level entries (modules)
+        bool isAnythingHidden = false;
+        for(int i = 0; i < treeModuleList->topLevelItemCount(); i++)
+            {
+            QTreeWidgetItem* top = treeModuleList->topLevelItem(i);
+            // And through test cases for each module
+            for(int j = 0; j < top->childCount(); j++)
+                {                
+                QTreeWidgetItem *child = top->child(j);
+                // Remove first three chars to get valid test case title
+                QString title = (child->text(0)).mid(3);
+                // Check if title is matching to filter and show or hide it
+                if(filter.exactMatch(title))
+                    {
+                    child->setHidden(false);
+                    }
+                else
+                    {
+                    child->setHidden(true);
+                    child->setText(0, child->text(0).replace(0, 3, UNSELECTITEMHEADER));
+                    isAnythingHidden = true;
+                    }
+                }
+            }
+
+        if(isAnythingHidden)
+            treeModuleList->headerItem()->setText(0, tr("Module List (filtered)"));
+        else
+            treeModuleList->headerItem()->setText(0, tr("Module List"));
+        }
+    }
+
+void FrmMain::OnGetMessage(const QString& aMessage)
+    {
+    txtOutput->appendPlainText(aMessage);
+    }
+
+void FrmMain::OnRunningCaseChanged()
+    {
+    QList<CSTFCase> caseList = controller->GetCasesByStatus(EStatusRunning);
+    lstStartedCases->clear();
+    foreach(CSTFCase aCase, caseList)
+            {
+            lstStartedCases->addItem(aCase.Name());
+            }
+    if (caseList.size() != 0)
+        {
+        btnPauseCase->setEnabled(true);
+        btnAbortCase->setEnabled(true);
+        btnShowOutput->setEnabled(true);
+        actPause->setEnabled(true);
+        actAbort->setEnabled(true);
+        actOutput->setEnabled(true);
+        }
+    else
+        {
+        btnPauseCase->setEnabled(false);
+        btnAbortCase->setEnabled(false);
+        btnShowOutput->setEnabled(false);
+        actPause->setEnabled(false);
+        actAbort->setEnabled(false);
+        actOutput->setEnabled(false);
+        }
+    }
+
+void FrmMain::OnCaseOutputChanged(const IStfEventListener::CaseOutputCommand& /*cmd*/, const QString& /*index*/, const QString& /*msg*/)
+    {
+    //nothing to do.
+    }
+
+void FrmMain::OnSetListChanged()
+    {
+    loadSetList();
+    }
+
+void FrmMain::OnCaseStatisticChanged()
+    {
+    loadStatistic();
+    }
+
+void FrmMain::createMenus()
+    {
+    //operateMenu = menuBar()->addMenu(tr("&Operation"));
+    actAbout = new QAction(tr("&About"), this);
+    connect(actAbout, SIGNAL(triggered()), this,
+            SLOT(on_actAbout_triggered()));
+
+    actExit = new QAction(tr("&Exit"), this);
+    connect(actExit, SIGNAL(triggered()), this, SLOT(close()));
+
+    actOpenFile = new QAction(tr("&Open Ini File"), this);
+    connect(actOpenFile, SIGNAL(triggered()), this,
+            SLOT(on_actOpenFile_triggered()));
+
+    menuRunCase = new QMenu(tr("Run Selected Case(s)"), this->menuBar());
+    
+    actRunCaseSeq = new QAction(tr("Sequentially"), this);
+    connect(actRunCaseSeq, SIGNAL(triggered()), this,
+            SLOT(on_actRunCaseSeq_triggered()));
+
+    actRunCasePar = new QAction(tr("Parallel"), this);
+    connect(actRunCasePar, SIGNAL(triggered()), this,
+            SLOT(on_actRunCasePar_triggered()));
+
+    ////////////////////
+    actReapeatRunSeq = new QAction(tr("Repeat run sequentially"), this);
+    connect(actReapeatRunSeq, SIGNAL(triggered()), this,
+            SLOT(on_actReapeatRunSeq_triggered()));
+    
+    actAddtoSet = new QAction(tr("Add cases to Set"), this);
+    connect(actAddtoSet, SIGNAL(triggered()), this,
+            SLOT(on_actAddtoSet_triggered()));
+
+    actSelectAll = new QAction(tr("Select All"), this);
+    connect(actSelectAll, SIGNAL(triggered()), this,
+            SLOT(on_actSelectAll_triggered()));
+
+    actExpandAll = new QAction(tr("Expand All"), this);
+    connect(actExpandAll, SIGNAL(triggered()), this,
+            SLOT(on_actExpandAll_triggered()));
+
+    actCollapseAll = new QAction(tr("Collapse All"), this);
+    connect(actCollapseAll, SIGNAL(triggered()), this,
+            SLOT(on_actCollapseAll_triggered()));
+
+    actSetting = new QAction(tr("Settings"), this);
+    connect(actSetting, SIGNAL(triggered()), this,
+            SLOT(on_actSetting_triggered()));
+
+    menuRunSet = new QMenu(tr("Run Case(s) in Selected Set"), this->menuBar());
+    
+    actRunSetSeq = new QAction(tr("Sequentially"), this);
+    connect(actRunSetSeq, SIGNAL(triggered()), this,
+            SLOT(on_actRunSetSeq_triggered()));
+
+    actRunSetPar = new QAction(tr("Parallel"), this);
+    connect(actRunSetPar, SIGNAL(triggered()), this,
+            SLOT(on_actRunSetPar_triggered()));
+
+    actNewSet = new QAction(tr("Create New Set"), this);
+    connect(actNewSet, SIGNAL(triggered()), this,
+            SLOT(on_actNewSet_triggered()));
+
+    actDelSet = new QAction(tr("Delete Set"), this);
+    connect(actDelSet, SIGNAL(triggered()), this,
+            SLOT(on_actDelSet_triggered()));
+
+    actPause = new QAction(tr("Pause"), this);
+    actPause->setEnabled(false);
+    connect(actPause, SIGNAL(triggered()), this,
+            SLOT(on_actPause_triggered()));
+
+    actAbort = new QAction(tr("Abort"), this);
+    actAbort->setEnabled(false);
+    connect(actAbort, SIGNAL(triggered()), this,
+            SLOT(on_actAbort_triggered()));
+    
+    actOutput = new QAction(tr("Output"), this);
+    actOutput->setEnabled(false);
+    connect(actAbort, SIGNAL(triggered()), this,
+            SLOT(on_actOutput_triggered()));
+
+    actClearStatistics = new QAction(tr("Clear Statistics"), this);
+    connect(actClearStatistics, SIGNAL(triggered()), this,
+            SLOT(on_actClearStatistics_triggered()));
+
+    }
+
+void FrmMain::load()
+    {
+    this->setContextMenuPolicy(Qt::NoContextMenu);
+    
+    this->setWindowTitle(QtUIName);
+    centerWidget = new QWidget(this);
+    this->setCentralWidget(centerWidget);
+    
+    mainLayout = new QGridLayout(this);
+    mainLayout->setVerticalSpacing(2);
+    mainLayout->setHorizontalSpacing(2);
+    mainLayout->setSpacing(2);
+    mainLayout->setMargin(2);
+    
+    this->centralWidget()->setContextMenuPolicy(Qt::NoContextMenu);
+    
+    //tab control
+    tabWidget = new QTabWidget(this);
+    tabWidget->setContextMenuPolicy(Qt::NoContextMenu);
+    tabCase = new QWidget(tabWidget);
+    tabCase->setContextMenuPolicy(Qt::NoContextMenu);
+    tabWidget->addTab(tabCase, tr("Cases"));
+    tabSet = new QWidget(tabWidget);
+    tabSet->setContextMenuPolicy(Qt::NoContextMenu);
+    tabWidget->addTab(tabSet, tr(" Set "));
+    tabStarted = new QWidget(tabWidget);
+    tabStarted->setContextMenuPolicy(Qt::NoContextMenu);
+    tabWidget->addTab(tabStarted, tr("Running"));
+    tabStatistic = new QWidget(tabWidget);
+    tabStatistic->setContextMenuPolicy(Qt::NoContextMenu);
+    tabWidget->addTab(tabStatistic, tr("Statistics"));
+    connect(tabWidget, SIGNAL(currentChanged(int)), this,
+            SLOT(onTabWidgetSelectIndexChanged()));
+
+    //output panel
+    groupBox = new QGroupBox(this);
+    //groupBox->setFixedHeight(150);
+    groupBox->setContextMenuPolicy(Qt::NoContextMenu);
+    groupBox->setTitle(tr("Information"));
+    txtOutput = new QPlainTextEdit(groupBox);
+    txtOutput->setContextMenuPolicy(Qt::NoContextMenu);
+    txtOutput->setReadOnly(true);
+    txtOutput->setFocusPolicy(Qt::NoFocus);
+    //txtOutput->setEditFocus(false);
+    QGridLayout *groupBoxLayout = new QGridLayout(this);
+    groupBoxLayout->setVerticalSpacing(2);
+    groupBoxLayout->setHorizontalSpacing(2);
+    groupBoxLayout->setSpacing(2);
+    groupBoxLayout->setMargin(2);   
+    groupBoxLayout->addWidget(txtOutput, 0, 0);
+    groupBox->setLayout(groupBoxLayout);
+
+    QDesktopWidget* desktop = QApplication::desktop();
+    QRect rect = desktop->screenGeometry(0);
+    if(rect.height() > rect.width())
+        {
+        mainLayout->addWidget(tabWidget, 0, 0);
+        mainLayout->addWidget(groupBox, 1, 0, Qt::AlignBottom);
+        mainLayout->setRowStretch(0,4);
+        mainLayout->setRowStretch(1,1); 
+        layoutType = true;
+        }
+    else
+        {
+        mainLayout->addWidget(tabWidget, 0, 0);
+        mainLayout->addWidget(groupBox, 0, 1);//Qt::AlignRight
+        //groupBox->setFixedSize(60,0);
+        mainLayout->setColumnStretch(0,1);
+        mainLayout->setColumnStretch(1,1);    
+        layoutType = false;
+        }
+    
+    //Create MainLayout and MainWidget
+    this->centralWidget()->setLayout(mainLayout);
+    mainLayout->addWidget(tabWidget, 0, 0);
+    mainLayout->addWidget(groupBox, 1, 0, Qt::AlignBottom);
+    mainLayout->setRowStretch(0,4);
+    mainLayout->setRowStretch(1,1);
+    
+
+    //Tab page: Case
+    QGridLayout *tabCaseLayout = new QGridLayout(this);
+    tabCaseLayout->setVerticalSpacing(2);
+    tabCaseLayout->setHorizontalSpacing(2);
+    tabCaseLayout->setSpacing(2);
+    tabCaseLayout->setMargin(2);   
+    treeModuleList = new QTreeWidget(tabCase);
+    treeModuleList->setContextMenuPolicy(Qt::NoContextMenu);
+    treeModuleList->headerItem()->setText(0, tr("Module List"));
+    treeModuleList->setSelectionBehavior(QAbstractItemView::SelectRows);
+    treeModuleList->setEditFocus(false);
+    connect(treeModuleList, SIGNAL(itemClicked(QTreeWidgetItem* , int)), this, 
+            SLOT(on_treeModuleList_itemClicked(QTreeWidgetItem* , int)));
+    
+
+    QWidget *caseToolWidget = new QWidget(tabCase);
+    caseToolWidget->setContextMenuPolicy(Qt::NoContextMenu);
+    QGridLayout *caseToolWidgetLayout = new QGridLayout(this);
+    QPushButton *btnRunCase = new QPushButton(tr("Run"), caseToolWidget);
+    btnRunCase->setContextMenuPolicy(Qt::NoContextMenu);
+    connect(btnRunCase, SIGNAL(clicked()), this,
+            SLOT(on_actRunCaseSeq_triggered()));
+    QPushButton *btnExpandAll = new QPushButton(tr("Expand"), caseToolWidget);
+    btnExpandAll->setContextMenuPolicy(Qt::NoContextMenu);
+    connect(btnExpandAll, SIGNAL(clicked()), this,
+            SLOT(on_actExpand_triggered()));
+    QPushButton *btnCollapseAll = new QPushButton(tr("Collapse"),
+            caseToolWidget);
+    btnCollapseAll->setContextMenuPolicy(Qt::NoContextMenu);
+    connect(btnCollapseAll, SIGNAL(clicked()), this,
+            SLOT(on_actCollapse_triggered()));
+
+    caseToolWidgetLayout->addWidget(btnRunCase, 0, 0);
+    caseToolWidgetLayout->addWidget(btnExpandAll, 0, 1);
+    caseToolWidgetLayout->addWidget(btnCollapseAll, 0, 2);
+    caseToolWidget->setLayout(caseToolWidgetLayout);
+
+    tabCaseLayout->addWidget(caseToolWidget, 1, 0);
+    tabCaseLayout->addWidget(treeModuleList, 0, 0);
+    tabCase->setLayout(tabCaseLayout);
+
+    //Tab page: Set
+
+    QGridLayout *tabSetLayout = new QGridLayout(this);
+    tabSetLayout->setVerticalSpacing(2);
+    tabSetLayout->setHorizontalSpacing(2);
+    tabSetLayout->setSpacing(2);
+    tabSetLayout->setMargin(2);   
+
+    QGridLayout *tabSetMainLayout = new QGridLayout(this);
+    tabSetMainLayout->setVerticalSpacing(2);
+    tabSetMainLayout->setHorizontalSpacing(2);
+    tabSetMainLayout->setSpacing(2);
+    tabSetMainLayout->setMargin(2);   
+    QWidget *tabSetMainWidget = new QWidget(tabSet);
+    tabSetMainWidget->setContextMenuPolicy(Qt::NoContextMenu);
+    QLabel *lblSet = new QLabel(tr("Test Set:"), tabSetMainWidget);
+    lblSet->setContextMenuPolicy(Qt::NoContextMenu);
+    QLabel *lblCase = new QLabel(tr("Cases:"), tabSetMainWidget);
+    lblCase->setContextMenuPolicy(Qt::NoContextMenu);
+    cboSetList = new QComboBox(tabSetMainWidget);
+    cboSetList->setContextMenuPolicy(Qt::NoContextMenu);
+    cboSetList->setEditable(false);
+    connect(cboSetList, SIGNAL(currentIndexChanged(QString)), this,
+            SLOT(on_cboSetList_currentIndexChanged(QString)));
+    lstSetCases = new QListWidget(tabSetMainWidget);
+    lstSetCases->setContextMenuPolicy(Qt::NoContextMenu);
+    tabSetMainLayout->addWidget(lblSet, 0, 0);
+    tabSetMainLayout->addWidget(cboSetList, 0, 1);
+    tabSetMainLayout->addWidget(lblCase, 1, 0,
+            (Qt::AlignTop | Qt::AlignRight));
+    tabSetMainLayout->addWidget(lstSetCases, 1, 1);
+    tabSetMainWidget->setLayout(tabSetMainLayout);
+
+    QWidget *setToolWidget = new QWidget(tabSet);
+    setToolWidget->setContextMenuPolicy(Qt::NoContextMenu);
+    QGridLayout *setToolWidgetLayout = new QGridLayout(this);
+    setToolWidgetLayout->setVerticalSpacing(2);
+    setToolWidgetLayout->setHorizontalSpacing(2);
+    setToolWidgetLayout->setSpacing(2);
+    setToolWidgetLayout->setMargin(2);     
+    QPushButton *btnRunSetCase = new QPushButton(tr("Run"), setToolWidget);
+    btnRunSetCase->setContextMenuPolicy(Qt::NoContextMenu);
+    connect(btnRunSetCase, SIGNAL(clicked()), this,
+            SLOT(on_actRunSetSeq_triggered()));
+    QPushButton *btnNewSet = new QPushButton(tr("New Set"), setToolWidget);
+    btnNewSet->setContextMenuPolicy(Qt::NoContextMenu);
+    connect(btnNewSet, SIGNAL(clicked()), this,
+            SLOT(on_actNewSet_triggered()));
+    QPushButton *btnDelSet = new QPushButton(tr("Delete Set"), setToolWidget);
+    btnDelSet->setContextMenuPolicy(Qt::NoContextMenu);
+    connect(btnDelSet, SIGNAL(clicked()), this,
+            SLOT(on_actDelSet_triggered()));
+
+    setToolWidgetLayout->addWidget(btnRunSetCase, 0, 0);
+    setToolWidgetLayout->addWidget(btnNewSet, 0, 1);
+    setToolWidgetLayout->addWidget(btnDelSet, 0, 2);
+    setToolWidget->setLayout(setToolWidgetLayout);
+
+    tabSetLayout->addWidget(tabSetMainWidget, 0, 0);
+    tabSetLayout->addWidget(setToolWidget, 1, 0);
+    tabSet->setLayout(tabSetLayout);
+
+    //Tab Started
+    QGridLayout *tabStartedLayout = new QGridLayout(this);
+    tabStartedLayout->setVerticalSpacing(2);
+    tabStartedLayout->setHorizontalSpacing(2);
+    tabStartedLayout->setSpacing(2);
+    tabStartedLayout->setMargin(2);     
+    lstStartedCases = new QListWidget(tabStarted);
+    lstStartedCases->setContextMenuPolicy(Qt::NoContextMenu);
+    QWidget *startedToolWidget = new QWidget(tabStarted);
+    startedToolWidget->setContextMenuPolicy(Qt::NoContextMenu);
+    QGridLayout *startedToolWidgetLayout = new QGridLayout(this);
+    startedToolWidgetLayout->setVerticalSpacing(2);
+    startedToolWidgetLayout->setHorizontalSpacing(2);
+    startedToolWidgetLayout->setSpacing(2);
+    startedToolWidgetLayout->setMargin(2);
+    btnPauseCase = new QPushButton(tr("Pause"), startedToolWidget);
+    btnPauseCase->setContextMenuPolicy(Qt::NoContextMenu);
+    connect(btnPauseCase, SIGNAL(clicked()), this,
+            SLOT(on_actPause_triggered()));
+    btnPauseCase->setEnabled(false);
+
+    btnAbortCase = new QPushButton(tr("Abort"), startedToolWidget);
+    btnAbortCase->setContextMenuPolicy(Qt::NoContextMenu);
+    connect(btnAbortCase, SIGNAL(clicked()), this,
+            SLOT(on_actAbort_triggered()));
+    btnAbortCase->setEnabled(false);
+        
+    btnShowOutput = new QPushButton(tr("Output"), startedToolWidget);
+    connect(btnShowOutput, SIGNAL(clicked()), this,
+                SLOT(on_actOutput_triggered()));
+    btnShowOutput->setEnabled(false);
+
+
+    startedToolWidgetLayout->addWidget(btnPauseCase, 0, 0);
+    startedToolWidgetLayout->addWidget(btnAbortCase, 0, 1);
+    startedToolWidgetLayout->addWidget(btnShowOutput, 0, 2);
+    startedToolWidget->setLayout(startedToolWidgetLayout);
+
+    tabStartedLayout->addWidget(lstStartedCases, 0, 0);
+    tabStartedLayout->addWidget(startedToolWidget, 1, 0);
+    tabStarted->setLayout(tabStartedLayout);
+
+    //Tab Statistic
+    QGridLayout *tabStatisticLayout = new QGridLayout(this);
+    tabStatisticLayout->setVerticalSpacing(2);
+    tabStatisticLayout->setHorizontalSpacing(2);
+    tabStatisticLayout->setSpacing(2);
+    tabStatisticLayout->setMargin(2);
+
+    treeStatistic = new QTreeWidget(tabStatistic);
+    treeStatistic->setContextMenuPolicy(Qt::NoContextMenu);
+    treeStatistic->headerItem()->setText(0, tr("Statistics"));
+    tabStatisticLayout->addWidget(treeStatistic, 0, 0);
+    tabStatistic->setLayout(tabStatisticLayout);
+
+    executedItems = new QTreeWidgetItem(treeStatistic);
+    executedItems->setText(0, tr("Executed Cases(0)"));
+    passedItems = new QTreeWidgetItem(treeStatistic);
+    passedItems->setText(0, tr("Passed Cases(0)"));
+    failedItems = new QTreeWidgetItem(treeStatistic);
+    failedItems->setText(0, tr("Failed Cases(0)"));
+    crashedItems = new QTreeWidgetItem(treeStatistic);
+    crashedItems->setText(0, tr("Crashed Cases(0)"));
+    abortedItems = new QTreeWidgetItem(treeStatistic);
+    abortedItems->setText(0, tr("Aborted Cases(0)"));
+    
+    //this->repaint();
+
+
+    }
+
+
+
+void FrmMain::LoadSubMenu()
+    {
+    menuBar()->clear();
+    menuBar()->setContextMenuPolicy(Qt::NoContextMenu);
+    if (tabWidget->currentIndex() == 0)
+        {
+        //Cases Tab
+        menuBar()->addAction(actOpenFile);
+        menuBar()->addMenu(menuRunCase);
+        menuRunCase->addAction(actRunCaseSeq);
+        menuRunCase->addAction(actRunCasePar);
+        menuBar()->addAction(actReapeatRunSeq);
+        menuBar()->addSeparator();
+        menuBar()->addAction(actAddtoSet);
+        menuBar()->addSeparator();
+        menuBar()->addAction(actSelectAll);
+        menuBar()->addAction(actExpandAll);
+        menuBar()->addAction(actCollapseAll);
+        }
+    else if (tabWidget->currentIndex() == 1)
+        {
+        //Set Tab
+        menuBar()->addMenu(menuRunSet);
+        menuRunSet->addAction(actRunSetSeq);
+        menuRunSet->addAction(actRunSetPar);
+        menuBar()->addSeparator();
+        menuBar()->addAction(actNewSet);
+        menuBar()->addAction(actDelSet);
+        }
+    else if (tabWidget->currentIndex() == 2)
+        {
+        //Started Tab
+        menuBar()->addAction(actPause);
+        menuBar()->addAction(actAbort);
+        menuBar()->addAction(actOutput);
+        
+        }
+    else
+        {
+        //Staticstic tab
+        menuBar()->addAction(actClearStatistics);
+        }
+    menuBar()->addSeparator();
+    menuBar()->addAction(actSetting);
+    menuBar()->addAction(actAbout);
+    menuBar()->addAction(actExit);
+
+    }
+
+void FrmMain::onTabWidgetSelectIndexChanged()
+    {
+    LoadSubMenu();
+    }
+
+void FrmMain::loadContent()
+    {
+    //Load ModuleList
+    loadModuleList();
+    //Load SetList
+    loadSetList();
+    //Load Statistic List
+    loadStatistic();
+    }
+
+void FrmMain::loadModuleList()
+    {
+    treeModuleList->clear();
+    
+    QList<QString> moduleList = controller->GetModuleList();
+    foreach(QString moduleName, moduleList)
+            {
+            QTreeWidgetItem* item = new QTreeWidgetItem(treeModuleList);
+            item->setText(0, UNSELECTITEMHEADER + moduleName);
+            
+            QList<QString> caseList = controller->GetCaseListByModule(
+                    moduleName);
+
+            foreach(QString caseName, caseList)
+                    {
+                    QTreeWidgetItem* caseItem = new QTreeWidgetItem(item);        
+                    caseItem->setText(0, UNSELECTITEMHEADER + caseName);
+                    }
+            }
+    if (moduleList.size() > 0)
+        {
+        treeModuleList->setCurrentItem(treeModuleList->topLevelItem(0));
+        }
+    }
+
+void FrmMain::reloadStatisticItem(QString name, QTreeWidgetItem* item,
+        TSTFCaseStatusType type)
+    {
+    QList<CSTFCase> caseList = controller->GetCasesByStatus(type);
+    while (item->childCount() != 0)
+        {
+        item->removeChild(item->child(0));
+        }
+    item->setText(0, name + "(" + QString::number(caseList.size(), 10) + ")");
+    foreach(CSTFCase aCase, caseList)
+            {
+            QTreeWidgetItem* child = new QTreeWidgetItem(item);
+            child->setText(0, aCase.Name());
+            }
+    }
+
+void FrmMain::loadStatistic()
+    {
+    //executedItems;
+    reloadStatisticItem("Executed Cases", executedItems, EStatusExecuted);
+
+    //passedItems;
+    reloadStatisticItem("Passed Cases", passedItems, EStatusPassed);
+
+    //failedItems;
+    reloadStatisticItem("Failed Cases", failedItems, EStatusFailed);
+
+    //crashedItems;
+    reloadStatisticItem("Crashed Cases", crashedItems, EStatusCrashed);
+
+    //abortedItems;
+    reloadStatisticItem("Aborted Cases", abortedItems, EStatusAborted);
+
+    }
+
+void FrmMain::loadSetList()
+    {
+    cboSetList->clear();
+
+    QList<QString> setList = controller->GetSetList();
+    foreach(QString setName, setList)
+            {
+            cboSetList->addItem(setName);
+            }
+//    if (setList.size() > 0)
+//        {
+//        //cboSetList->setCurrentIndex(0);
+//        on_cboSetList_currentIndexChanged(setList.at(0));
+//        }
+    }
+
+QList<CSTFCase> FrmMain::getSelectedCases()
+    {
+    int index = 0;
+    QTreeWidgetItem* item = treeModuleList->topLevelItem(index);
+    QList<CSTFCase> caseList;
+    while (item != 0)
+        {
+        for (int i = 0; i < item->childCount(); i++)
+            {
+            QTreeWidgetItem* child = item->child(i);
+            if (child->text(0).startsWith(SELECTITEMHEADER))
+                {
+                CSTFCase aCase(child->text(0).remove(0,3), i);
+                aCase.SetIndex(i);
+                //aCase.SetModuleName(moduleBox->text());
+                aCase.SetModuleName(item->text(0).remove(0,3));
+                caseList.append(aCase);
+                }
+            }
+        index++;
+        item = treeModuleList->topLevelItem(index);
+        }
+    return caseList;
+    }
+
+void FrmMain::on_cboSetList_currentIndexChanged(QString item)
+    {
+    lstSetCases->clear();
+    QList<QString> list = controller->GetCaseListBySet(item);
+    foreach(QString caseName, list)
+            {
+            lstSetCases->addItem(caseName);
+            }
+    }
+
+void FrmMain::startRunning()
+    {
+    setSetting();
+    tabWidget->setCurrentWidget(tabStarted);    
+    }
+
+void FrmMain::on_actRunCaseSeq_triggered()
+    {
+    //run case seq
+    startRunning();
+    controller->RunCases(getSelectedCases(), Sequentially);
+    }
+
+void FrmMain::on_actRunCasePar_triggered()
+    {
+    startRunning();
+    controller->RunCases(getSelectedCases(), Parallel);
+    }
+
+void FrmMain::on_actReapeatRunSeq_triggered()
+    {
+    DlgRepeatRun dlgRepeatRun(this);
+    int result = dlgRepeatRun.exec();
+    if(result == QDialog::Accepted)
+        {
+        QList<CSTFCase> selectedCases = getSelectedCases();
+        if(selectedCases.count() > 0)
+            {
+            startRunning();
+            controller->RepeatRunCases( selectedCases, 
+                                        dlgRepeatRun.isRepeatInfinitely(),
+                                        dlgRepeatRun.GetLoopTimes() );
+            }
+        
+        }
+    }
+
+void FrmMain::on_actAddtoSet_triggered()
+    {
+    QList<CSTFCase> list = getSelectedCases();
+    if (list.size() == 0)
+        {
+        QErrorMessage *errorMessageDialog = new QErrorMessage(this);
+        errorMessageDialog->setAutoFillBackground(true);
+        errorMessageDialog->showMessage(tr(
+                "<font color =black>Please select cases you want to added to set.</font>"));
+        return;
+        }
+
+    QList<QString> setList = controller->GetSetList();
+
+    DlgSetSelector dlgSet(setList, this);
+    int result = dlgSet.exec();
+    QString setName;
+    if(result == QDialog::Accepted)
+        {
+        setName = dlgSet.SelectName();
+        }
+    else
+        {
+        return;
+        }
+    bool rst = false;
+    if(setName == "")
+        {
+        setName = "temp.set";
+        rst = controller->CreateSet(setName);
+        if(!rst)
+            {
+            return;
+            }
+        }
+    controller->AddCaseToSet(list, setName);
+//
+//     bool ok;
+//     QString setName = QInputDialog::getItem(this, tr(
+//     "\r\nAdd select cases to Set"), tr("\r\n\r\nSets:"), setList, 0, false, &ok, Qt::Dialog);
+//     if (ok && !setName.isEmpty())
+//     {
+//     if(setName == newSet)
+//         {
+//         ok = controller->CreateSet(setName);
+//         if(!ok)
+//             {
+//             return;
+//             }
+//         }
+//     controller->AddCaseToSet(list, setName);
+//     }
+    tabWidget->setCurrentIndex(1);
+    int index = -1;
+    for(int i=0;i<cboSetList->count();i++)
+        {
+        if(cboSetList->itemText(i) == setName)
+            {
+            index = i;
+            break;
+            }
+        }
+    if(index != -1)
+        {
+        cboSetList->setCurrentIndex(index);
+        }
+
+    
+    }
+
+void FrmMain::on_actSelectAll_triggered()
+    {
+    QString header = UNSELECTITEMHEADER;
+    if(actSelectAll->text() == "Select All")
+        {
+        actSelectAll->setText("UnSelect All");
+        header = SELECTITEMHEADER;
+        }
+    else
+        {
+        actSelectAll->setText("Select All");    
+        }
+    
+    int index = 0;
+    QTreeWidgetItem* item = treeModuleList->topLevelItem(index);
+    while (item != 0)
+        {
+        if(!item->isHidden())
+            item->setText(0, item->text(0).replace(0,3, header));
+        for (int i = 0; i < item->childCount(); i++)
+            {
+            QTreeWidgetItem* child = item->child(i);
+            if(!child->isHidden())
+                child->setText(0,child->text(0).replace(0,3,header));
+            }
+        index++;
+        item = treeModuleList->topLevelItem(index);
+        }
+    }
+
+void FrmMain::on_actExpandAll_triggered()
+    {
+    QTreeWidgetItem* item = treeModuleList->currentItem();
+    treeModuleList->expandAll();
+    if(item != NULL)
+        {
+        treeModuleList->setCurrentItem(item);
+        }
+        
+    }
+
+void FrmMain::on_actCollapseAll_triggered()
+    {
+    QTreeWidgetItem* item = treeModuleList->currentItem();
+    if(item != NULL)
+        {
+        if(item->parent() != NULL)
+            {
+            item = item->parent();
+            }
+        }
+    treeModuleList->collapseAll();
+    if(item != NULL)
+        {
+        treeModuleList->setCurrentItem(item);
+        }
+    
+    }
+
+void FrmMain::on_actSetting_triggered()
+    {
+    DlgSetting dlgSet(uiSetting);
+    currentFilter = uiSetting->ReadSetting(KFilter);
+    currentFilterCaseSens = uiSetting->ReadSetting(KFilterCaseSens);
+    int result = dlgSet.exec();
+    if(result == QDialog::Accepted)
+        {
+        setSetting();
+        }
+    }
+
+void FrmMain::on_actRunSetSeq_triggered()
+    {
+    startRunning();
+    QString setName = cboSetList->currentText();
+    controller->RunSets(setName, Sequentially);
+    }
+
+void FrmMain::on_actRunSetPar_triggered()
+    {
+    startRunning();
+    QString setName = cboSetList->currentText();
+    controller->RunSets(setName, Parallel);
+    }
+
+void FrmMain::on_actNewSet_triggered()
+    {
+    QString name;
+    bool rst = controller->CreateSet(name);
+    if(rst)
+        {
+        QMessageBox::information(this, 
+                tr("Create Set Successfully"), 
+                "Create a new test set, named: " + name);
+
+        int index = -1;
+        for(int i=0;i<cboSetList->count();i++)
+            {
+            if(cboSetList->itemText(i) == name)
+                {
+                index = i;
+                break;
+                }
+            }
+        if(index != -1)
+            {
+            cboSetList->setCurrentIndex(index);
+            }
+
+        
+        }
+    else
+        {
+        QMessageBox::information(this, 
+                tr("Create Set Failed"), 
+                tr("Please check the log for more information."));
+    
+        }
+    
+    }
+
+void FrmMain::on_actDelSet_triggered()
+    {
+        QString setName = cboSetList->currentText();
+        QMessageBox msgBox(QMessageBox::Warning, tr("Delete a Set"), tr(
+        "Do you really want to delete the set?"), 0, this);
+        msgBox.addButton(tr("&Delete"), QMessageBox::AcceptRole);
+        msgBox.addButton(tr("&Cancel"), QMessageBox::RejectRole);
+        if (msgBox.exec() == QMessageBox::AcceptRole)
+        {
+        controller->DeleteSet(setName);
+        }
+
+    }
+
+void FrmMain::on_actPause_triggered()
+    {
+    if (btnPauseCase->text() == "Pause")
+        {
+        controller->PauseCase();
+        btnPauseCase->setText(tr("Resume"));
+        actPause->setText(tr("Resume"));
+        }
+    else
+        {
+        controller->ResumeCase();
+        btnPauseCase->setText(tr("Pause"));
+        actPause->setText(tr("Pause"));
+        }
+    }
+
+void FrmMain::on_actAbort_triggered()
+    {
+    controller->AbortCase();
+    }
+
+void FrmMain::on_treeModuleList_itemClicked(QTreeWidgetItem* item, int /*column*/)
+    {
+    //Check if shift key is pressed
+    bool isShiftPressed = false;
+    Qt::KeyboardModifiers keyMod = QApplication::keyboardModifiers();
+    isShiftPressed=keyMod.testFlag(Qt::ShiftModifier);
+    
+    //Handle shift key.
+    //Shift not pressed.
+    if(!isShiftPressed)
+        {
+        setItemClicked(item);
+        }
+    //Shift pressed.
+    else
+        {
+        enum Direction
+            {
+            Item_NoDirection,
+            Item_Above,
+            Item_Below
+            };
+        Direction direction = Item_NoDirection;
+        QTreeWidgetItem* tempItem = item;
+        //check direction of last selected item comparing current one.
+        while(tempItem)
+            {
+            tempItem = treeModuleList->itemAbove(tempItem);
+            if(tempItem == lastItemSelected)
+                {
+                direction = Item_Above;
+                break;
+                }
+            }
+        if (direction != Item_Above)
+            {
+            tempItem = item;
+            while(tempItem)
+                {
+                tempItem = treeModuleList->itemBelow(tempItem);
+                if(tempItem == lastItemSelected)
+                    {
+                    direction = Item_Below;
+                    break;
+                    }
+                }
+            }
+        
+        // Select all items between current item and last selected item.
+        tempItem = item;
+        if(direction != Item_NoDirection)
+            {
+            while(tempItem)
+                {
+                //check if this item been selected.
+                bool isItemSelected = false;
+                if ( tempItem->text(0).left(3).compare(SELECTITEMHEADER)==0 )
+                    {
+                    isItemSelected = true;
+                    }
+                // If not selected, set to selected.
+                if (!isItemSelected )
+                    {
+                    setItemClicked(tempItem);
+                    }
+                
+                //Go above/below
+                if (direction == Item_Above)
+                    {
+                    tempItem = treeModuleList->itemAbove(tempItem);             
+                    }
+                if (direction == Item_Below)
+                    {
+                    tempItem = treeModuleList->itemBelow(tempItem);             
+                    }
+                
+                if (tempItem == lastItemSelected)
+                    {
+                    break;
+                    }
+                }
+            }
+        }
+    
+    // Set current clicked item to last selected item.
+    lastItemSelected = item;
+
+      
+    }
+
+void FrmMain::setItemClicked(QTreeWidgetItem* item)
+    {
+    QString header = UNSELECTITEMHEADER;
+    if(item->text(0).startsWith(UNSELECTITEMHEADER))
+        {
+            header = SELECTITEMHEADER;
+        }
+    item->setText(0 , item->text(0).replace(0, 3, header));
+    for(int i=0;i<item->childCount();i++)
+        {
+            item->child(i)->setText(0, item->child(i)->text(0).replace(0, 3, header));
+        }
+    }
+
+void FrmMain::on_actAbout_triggered()
+    {
+    QString str = QtUIName + "<&nbsp;>" + QtUIVersion;
+    str.append("<br>").append("engine version:");
+    
+    str.append(QString::number(STIF_MAJOR_VERSION, 10)).append(".");
+    str.append(QString::number(STIF_MINOR_VERSION, 10)).append(".");
+    str.append(QString::number(STIF_BUILD_VERSION, 10));
+    str.append("  --").append(STIF_REL_DATE).append("<br>");
+    str.append("---");
+    str.append("Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. ");
+
+    QErrorMessage *errorMessageDialog = new QErrorMessage(this);
+    errorMessageDialog->showMessage("<font color =black size=12px><b>" + str + "</b></font>");
+    
+    }
+
+void FrmMain::on_actOpenFile_triggered()
+    {
+    QString fileName = QFileDialog::getOpenFileName(this, tr(
+            "Select ini file"), tr("c:\\"), tr(
+            "Ini Files (*.ini);;All Files (*)"));
+    if (!fileName.isEmpty())
+        {
+        bool result = controller->OpenEngineIniFile(fileName);
+        if(result)
+            {
+            this->loadModuleList();   
+            QMessageBox::information(this, tr("Open INI File"), "Load Engine INI file successfully!");
+            }
+        else
+            {
+            QMessageBox::warning(this, tr("Open INI File"),"Failed to Load Engine INI file. Please check the file format and its path.");
+            }
+        
+        }
+    }
+
+void FrmMain::on_actClearStatistics_triggered()
+    {
+    model->ClearCasesStatus();
+    }
+
+
+void FrmMain::on_actExpand_triggered()
+    {
+    QTreeWidgetItem* item = treeModuleList->currentItem();
+    if(item != NULL)
+        {
+        item->setExpanded(true);
+        }
+    }
+
+void FrmMain::on_actCollapse_triggered()
+    {
+
+    QTreeWidgetItem* item = treeModuleList->currentItem();
+    if(item != NULL)
+        {
+        item->setExpanded(false);
+        }
+    }
+
+void FrmMain::on_actOutput_triggered()
+    {
+    controller->SetShowOutput(true);
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/qt/src/main.cpp	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,30 @@
+/*
+* 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: QT C++ based Class.
+*              Application entrance.
+*
+*/
+#include <QApplication>
+#include "frmmain.h"
+
+int main(int argc, char* argv[])
+{
+    Q_INIT_RESOURCE(StfQtUI);
+    QApplication app(argc, argv);
+    FrmMain win;
+    win.showMaximized();
+    return app.exec();
+}
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/qt/src/stfqtuicontroller.cpp	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,411 @@
+/*
+ * 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: QT C++ based Class.
+ *              Stf Controller implementation.
+ *
+ */
+#include "stfqtuicontroller.h"
+#include <stifinternal/UIStoreIf.h>
+#include <stifinternal/UIStoreContainer.h>
+#include <QDateTime>
+
+const QString TEMPSETNAME = "TEMPSET";
+const QString DEFAULTINI = "c:\\testframework\\testframework.ini";
+
+
+
+StfQtUIController::StfQtUIController(IStfQtUIModel* aModel) :
+    model(aModel), 
+    isShowOutput(false), 
+    iCurrentRunPos(0),
+    isLoopInfinitely(false),
+    loopTimes(0)
+       
+    {
+    executor = new CStifExecutor();
+    executor->OpenIniFile(DEFAULTINI);
+    executor->AddStifCaseUpdateListener(this);
+    }
+
+StfQtUIController::~StfQtUIController()
+    {
+    executor->RemoveStifCaseUpdateListener(this);
+    delete executor;
+    executor = NULL;
+    }
+//for cases
+
+bool StfQtUIController::OpenEngineIniFile(const QString& fileName)
+    {
+    QString path = fileName;
+    if(path.contains('/'))
+        {
+        path = path.replace('/', '\\');
+        }
+    executor->RemoveStifCaseUpdateListener(this);
+    delete executor;
+    executor = new CStifExecutor();
+    bool rst = executor->OpenIniFile(path);
+    executor->AddStifCaseUpdateListener(this);
+    return rst;
+    }
+
+QList<QString> StfQtUIController::GetModuleList()
+    {
+    QList<CSTFModule> modules = executor->GetModuleList();
+    QList<QString> moduleList;
+    foreach(CSTFModule m, modules)
+            {
+            moduleList.append(m.Name());
+            }
+    return moduleList;
+    }
+
+CSTFModule StfQtUIController::GetModuleByName(const QString& moduleName)
+    {
+    QList<CSTFModule> modules = executor->GetModuleList();
+    CSTFModule module;
+    foreach(CSTFModule m, modules)
+        {
+        if(m.Name() == moduleName)
+            {
+            module = m;
+            break;
+            }
+        }
+    return module;
+        
+    }
+
+QList<QString> StfQtUIController::GetCaseListByModule(const QString& moduleName)
+    {
+    QList<QString> caseList;
+    if (moduleName != "")
+        {
+        QList<CSTFCase> cases = executor->GetCaseList(moduleName);
+        foreach(CSTFCase c, cases)
+                {
+                caseList.append(c.Name());
+                }
+        }
+
+    return caseList;
+    }
+
+CSTFCase StfQtUIController::GetCase(const QString& moduleName, const int index)
+    {
+    CSTFCase rst;
+    if(moduleName != "")
+        {
+        QList<CSTFCase> cases = executor->GetCaseList(moduleName);
+        if(index < cases.length())
+            {
+            rst = cases.at(index);
+            }
+        }
+    return rst;
+    }
+
+void StfQtUIController::RunCases(const QList<CSTFCase>& caseList,
+        const TSTFCaseRunningType& type)
+    {
+    if (caseList.size() == 1)
+        {
+        CSTFCase aCase = caseList.at(0);
+        QString msg = "Start execute case:" + aCase.Name();
+        FireOnGetOutput(msg);
+        executor->ExecuteSingleCase(aCase.ModuleName(), aCase.Index());
+        }
+    else
+        {
+        //create a temp set, append cases into the set and execute it.
+        executor->CreateSet(TEMPSETNAME);
+        foreach(CSTFCase aCase, caseList)
+                {
+                executor->AddtoSet(TEMPSETNAME, aCase);
+                }
+        RunSets(TEMPSETNAME, type);
+        executor->RemoveSet(TEMPSETNAME);
+        }
+    }
+
+// run cases repeatly. 
+// By default, loopTimes = -1 means loop infinitely util user stop it.
+void StfQtUIController::RepeatRunCases(const QList<CSTFCase>& aCaseList, const bool aIsLoopInfinitely, const int aLoopTimes)
+    {
+    InitRepeatSetting(aIsLoopInfinitely, aLoopTimes);
+    repeatRunCaseList = aCaseList;
+    
+    Execution();
+    
+    }
+
+void StfQtUIController::InitRepeatSetting(const bool aIsLoopInfinitely, const int aLoopTimes)
+    {
+    loopTimes = aLoopTimes;
+    isLoopInfinitely = aIsLoopInfinitely;
+    iCurrentRunPos = 0;
+    }
+
+void StfQtUIController::ResetRepeatSetting()
+    {
+    iCurrentRunPos = 0;
+    isLoopInfinitely = false;
+    loopTimes = 0;
+    }
+
+// Repeat execution cases
+void StfQtUIController::Execution()
+    {
+    if(loopTimes > 0  || isLoopInfinitely)
+        {
+        int count = repeatRunCaseList.count();
+        CSTFCase aCase = repeatRunCaseList.at(iCurrentRunPos);
+        QString msg = "Start execute case:" + aCase.Name();
+        FireOnGetOutput(msg);
+        executor->ExecuteSingleCase(aCase.ModuleName(), aCase.Index());
+        
+        iCurrentRunPos++;
+        if( iCurrentRunPos >= count )
+            {
+            iCurrentRunPos = 0;
+            loopTimes --;
+            }    
+        }
+    }
+
+bool StfQtUIController::AddCaseToSet(const QList<CSTFCase>& caseList,
+        const QString& setName)
+    {
+    QString name = setName;
+    bool rst = true;
+    foreach(CSTFCase aCase, caseList)
+            {
+            rst = executor->AddtoSet(name, aCase);
+            if(!rst)
+                {
+                break;
+                }
+            }
+    if(!rst)
+        {
+        return false;
+        }
+    rst = executor->SaveSet(name);
+    FireOnSetListChanged();
+    return rst;
+    }
+
+//for set
+
+QList<QString> StfQtUIController::GetSetList()
+    {
+    return executor->GetSetList();
+    }
+QList<QString> StfQtUIController::GetCaseListBySet(const QString& setName)
+    {
+    QList<CSTFCase> cases = executor->GetCaseListFromSet(setName);
+    QList<QString> caseList;
+    foreach(CSTFCase c, cases)
+            {
+            caseList.append(c.Name());
+            }
+    return caseList;
+    }
+
+bool StfQtUIController::CreateSet(QString& setName)
+    {
+    bool rst = executor->CreateSet(setName);
+    if(!rst)
+        {
+        return rst;
+        }
+    rst = executor->SaveSet(setName);
+    FireOnSetListChanged();
+    return rst;
+    }
+
+bool StfQtUIController::DeleteSet(const QString& setName)
+    {
+    bool rst = executor->RemoveSet(setName);
+    if(!rst)
+        {
+        return false;
+        }
+    QString name = setName;
+    rst = executor->SaveSet(name);
+    FireOnSetListChanged();
+    return rst;
+    }
+
+void StfQtUIController::RunSets(const QString& setName, const TSTFCaseRunningType& type)
+    {
+    executor->ExecuteSet(setName, 0, type);
+    }
+
+//for Started
+void StfQtUIController::PauseCase()
+    {
+    model->PauseCase();
+    QString msg = "Execution Paused";
+    FireOnGetOutput(msg);
+    }
+
+void StfQtUIController::ResumeCase()
+    {
+    model->ResumeCase();
+    FireOnGetOutput("Execution Resumed");
+    }
+
+void StfQtUIController::AbortCase()
+    {
+    model->AbortCase();
+    FireOnGetOutput("Case Aborted");
+    }
+
+CSTFCase StfQtUIController::GetRunningCase(int index)
+    {
+    CStartedTestCase* startedCase = (CStartedTestCase*) index;
+    return model->GetRunningCase(startedCase);
+    }
+
+bool StfQtUIController::ShowOutput()
+    {
+    return isShowOutput;
+    }
+
+void StfQtUIController::SetShowOutput(bool isShow)
+    {
+    isShowOutput = isShow;
+    }
+
+QList<CSTFCase> StfQtUIController::GetCasesByStatus(const TSTFCaseStatusType& type)
+    {
+    return model->GetCasesByStatus(type);
+    }
+
+void StfQtUIController::AddStfEventListener(IStfEventListener* listener)
+    {
+    if (!listenerList.contains(listener))
+        {
+        listenerList.append(listener);
+        }
+    }
+void StfQtUIController::RemoveStfEventListener(IStfEventListener* listener)
+    {
+    if (listenerList.contains(listener))
+        {
+        listenerList.removeOne(listener);
+        }
+    }
+
+void StfQtUIController::OnGetCaseUpdated(CStartedTestCase* aCase,
+        CSTFCase& stfcase, int flags)
+    {
+    if (flags & CUIStoreIf::EPrintUpdate || aCase == NULL)
+        {
+        return;
+        }
+    QString msg = "case Name:";
+    msg += stfcase.Name() + "\r\n Status:";
+    flags = aCase->Status();
+    if (flags & CUIStoreIf::EStatusRunning)
+        {
+        model->AddRunningCase(aCase, stfcase);
+        msg += "start running";
+        FireOnCaseOutputChanged(IStfEventListener::ECreate, (int) aCase,
+                stfcase.Name());
+        }
+    else if (flags & CUIStoreIf::EStatusAborted)
+        {
+        FireOnCaseOutputChanged(IStfEventListener::EClose, (int) aCase, "");
+        model->RemoveRunningCase(aCase);
+        model->AddCaseByStatus(EStatusAborted, stfcase);
+        msg += "aborted";
+        
+        //reset repeat execution information
+        ResetRepeatSetting();
+
+        }
+    else if (flags & CUIStoreIf::EStatusExecuted)
+        {
+        FireOnCaseOutputChanged(IStfEventListener::EClose, (int) aCase, "");
+        model->RemoveRunningCase(aCase);
+        model->AddCaseByStatus(EStatusExecuted, stfcase);
+
+        if (flags & CUIStoreIf::EStatusCrashed)
+            {
+            model->AddCaseByStatus(EStatusCrashed, stfcase);
+            msg += "crashed";
+            }
+        else if (flags & CUIStoreIf::EStatusFailed)
+            {
+            model->AddCaseByStatus(EStatusFailed, stfcase);
+            msg += "failed";
+            }
+        else if (flags & CUIStoreIf::EStatusPassed)
+            {
+            model->AddCaseByStatus(EStatusPassed, stfcase);
+            msg += "passed";
+            }
+        
+        // if repeat execution is choosed, start to execution again.
+        if(loopTimes > 0 || isLoopInfinitely)
+            {
+            Execution();
+            }
+        }
+    else
+        {
+        return;
+        }
+
+    FireOnGetOutput(msg);
+    }
+
+void StfQtUIController::OnGetCaseOutput(CStartedTestCase* aCase, QString& msg)
+    {
+    FireOnCaseOutputChanged(IStfEventListener::EOutput, (int) aCase, msg);
+    }
+
+void StfQtUIController::FireOnCaseOutputChanged(
+        IStfEventListener::CaseOutputCommand cmd, int index, QString msg)
+    {
+    if (true)//ShowOutput
+        {
+        foreach(IStfEventListener* listener, listenerList)
+                {
+                listener->OnCaseOutputChanged(cmd,
+                        QString::number(index, 10), msg);
+                }
+        }
+    }
+
+void StfQtUIController::FireOnGetOutput(QString message)
+    {
+    foreach(IStfEventListener* listener, listenerList)
+            {
+            listener->OnGetMessage(message);
+            }
+    }
+
+void StfQtUIController::FireOnSetListChanged()
+    {
+    foreach(IStfEventListener* listener, listenerList)
+            {
+            listener->OnSetListChanged();
+            }
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/qt/src/stfqtuimodel.cpp	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,167 @@
+/*
+ * 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: QT C++ based Class.
+ *              application model implementation.
+ *
+ */
+#include "stfqtuimodel.h"
+#include <UIEngineContainer.h>
+
+StfQtUIModel::StfQtUIModel()
+    {
+    //nothing to do.
+    }
+
+StfQtUIModel::~StfQtUIModel()
+    {
+    //nothing to do.
+    }
+
+void StfQtUIModel::PauseCase()
+    {
+    foreach(const CStartedTestCase* startedCase, runningCaseList.keys())
+            {
+            startedCase->UIEngineContainer().PauseTest();
+            }
+    }
+
+void StfQtUIModel::ResumeCase()
+    {
+    foreach(const CStartedTestCase* startedCase, runningCaseList.keys())
+            {
+            startedCase->UIEngineContainer().ResumeTest();
+            }
+    }
+
+void StfQtUIModel::AbortCase()
+    {
+    foreach(const CStartedTestCase* startedCase, runningCaseList.keys())
+            {
+            startedCase->UIEngineContainer().CancelTest();
+            }
+    }
+
+void StfQtUIModel::AddRunningCase(const CStartedTestCase* startedCase,
+        const CSTFCase& stfCase)
+    {
+    runningCaseList.insert(startedCase, stfCase);
+    FireOnRunningCaseChangedEvent();
+    }
+
+void StfQtUIModel::RemoveRunningCase(const CStartedTestCase* startedCase)
+    {
+    runningCaseList.remove(startedCase);
+    FireOnRunningCaseChangedEvent();
+    }
+
+CSTFCase StfQtUIModel::GetRunningCase(const CStartedTestCase* startedCase)
+    {
+    return runningCaseList.value(startedCase);
+    }
+
+void StfQtUIModel::AddCaseByStatus(const TSTFCaseStatusType& type, const CSTFCase& aCase)
+    {
+    switch (type)
+        {
+        case EStatusRunning:
+            break;
+        case EStatusExecuted:
+            executedCaseList.append(aCase);
+            break;
+        case EStatusPassed:
+            passedCaseList.append(aCase);
+            break;
+        case EStatusFailed:
+            failedCaseList.append(aCase);
+            break;
+        case EStatusAborted:
+            abortCaseList.append(aCase);
+            break;
+        case EStatusCrashed:
+            crashedCaseList.append(aCase);
+            break;
+        default:
+            break;            
+        }
+    FireOnCaseStatisticChangedEvent();
+    }
+
+QList<CSTFCase> StfQtUIModel::GetCasesByStatus(const TSTFCaseStatusType& type)
+    {
+    switch (type)
+        {
+        case EStatusRunning:
+            return runningCaseList.values();
+        case EStatusExecuted:
+            return executedCaseList;
+        case EStatusPassed:
+            return passedCaseList;
+        case EStatusFailed:
+            return failedCaseList;
+        case EStatusAborted:
+            return abortCaseList;
+        case EStatusCrashed:
+            return crashedCaseList;
+        default:
+            break;
+        }
+    QList<CSTFCase> list;
+    return list;
+    }
+
+void StfQtUIModel::AddStifModelEventListener(
+        IStifModelEventListener* listener)
+    {
+    if (!listenerList.contains(listener))
+        {
+        listenerList.append(listener);
+        }
+    }
+
+void StfQtUIModel::RemoveStifModelEventListener(
+        IStifModelEventListener* listener)
+    {
+    if (!listenerList.contains(listener))
+        {
+        listenerList.removeOne(listener);
+        }
+    }
+
+void StfQtUIModel::FireOnCaseStatisticChangedEvent()
+    {
+    foreach(IStifModelEventListener* listener, listenerList)
+            {
+            listener->OnCaseStatisticChanged();
+            }
+    }
+
+void StfQtUIModel::FireOnRunningCaseChangedEvent()
+    {
+    foreach(IStifModelEventListener* listener, listenerList)
+            {
+            listener->OnRunningCaseChanged();
+            }
+    }
+
+void StfQtUIModel::ClearCasesStatus()
+    {
+    executedCaseList.clear();
+    passedCaseList.clear();
+    failedCaseList.clear();
+    abortCaseList.clear();
+    crashedCaseList.clear();
+    FireOnCaseStatisticChangedEvent();
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/qt/src/stifexecutor.cpp	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,411 @@
+/*
+ * 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: QT C++ and Symbian C++ combination Class.
+ *              STIF UI interface and engine caller implementaion.
+ *
+ */
+#include <e32base.h>
+#include <e32cons.h>
+#include <e32svr.h>
+#include <f32file.h>
+#include <HAL.h>
+#include <hal_data.h>
+#include "stiflogger.h"
+#include <QString>
+#include "stifexecutor.h"
+#include "StifTFwIf.h"
+
+_LIT( KLogPath, "\\Logs\\STFUI\\" ); 
+// Log file
+_LIT( KLogFile, "StifUi.log" ); 
+
+CStifExecutor::CStifExecutor() :
+    listenerList(NULL)
+    {
+    iLog = CStifLogger::NewL( KLogPath, 
+            KLogFile,
+            CStifLogger::ETxt,
+            CStifLogger::EFile,
+            ETrue,
+            ETrue,
+            ETrue,
+            EFalse,
+            ETrue,
+            EFalse,
+            100 );
+
+
+    iLog->Log(_L("started"));
+    TInt result;
+    TRAP(result, CUIStoreIf::ConstructL());
+    iLog->Log(_L("CUIStoreIf ConstructL, result=%d"), result);
+    if (result != KErrNone)
+        {
+        return;
+        }
+    TRAP(result, iBuffer = HBufC::NewL(500));
+    iLog->Log(_L("Create Case Execution output buffer, result=%d"), result);
+
+    }
+
+CStifExecutor::~CStifExecutor()
+    {
+    UIStore().Close();
+    delete iBuffer;
+    if (listenerList)
+        {
+        delete listenerList;
+        listenerList = NULL;
+        }
+    if(iLog)
+        {
+        iLog->Log(_L("finished"));
+        }
+    delete iLog;
+    }
+
+bool CStifExecutor::OpenIniFile(const QString& filename)
+    {
+    TInt result = UIStore().Open(QString2TPtrC(filename));
+    iLog->Log(_L("Open ini file %s.result=%d"),QString2TPtrC(filename).Ptr(),result);
+    return (result == KErrNone);
+    }
+
+TPtrC CStifExecutor::QString2TPtrC(const QString& aString)
+    {
+    TPtrC ret(reinterpret_cast<const TText*> (aString.constData()),
+            aString.length());
+    return ret;
+    }
+QString CStifExecutor::TDesC2QString(const TDesC& des)
+    {
+    //#ifdef QT_NO_UNICODE
+    //return QString::fromLocal8Bit((char*)des.Ptr(), des.Length());
+    //#else
+    QString rst = QString::fromUtf16(des.Ptr(), des.Length());
+    return rst;
+    //#endif
+    }
+
+bool CStifExecutor::LogResult(const TInt result,const QString str)
+    {
+    QString tmp = str + " result=%d";
+    iLog->Log(QString2TPtrC(tmp), result);
+    bool rst = true;
+    if(result != KErrNone)
+        {
+        rst = false;
+        }
+    return rst;
+    }
+
+void CStifExecutor::AddStifCaseUpdateListener(
+        IStifCaseUpdateListener* listener)
+    {
+    iLog->Log(_L("AddStifCaseUpdateListener"));
+    if (!listenerList)
+        {
+        listenerList = new QList<IStifCaseUpdateListener*> ();
+        }
+    if (!listenerList->contains(listener))
+        {
+        listenerList->append(listener);
+        }
+    }
+
+void CStifExecutor::RemoveStifCaseUpdateListener(
+        IStifCaseUpdateListener* listener)
+    {
+    iLog->Log(_L("RemoveStifCaseUpdateListener"));
+    if (!listenerList)
+        {
+        return;
+        }
+
+    if (listenerList->contains(listener))
+        {
+        listenerList->removeOne(listener);
+        }
+
+    }
+
+QList<CSTFModule> CStifExecutor::GetModuleList()
+    {
+    QList<CSTFModule> list;
+    RRefArray<TDesC> modules;
+    iLog->Log(_L("GetModuleList"));
+    TInt ret = UIStore().Modules(modules);
+    iLog->Log(_L("LoadAllModules %d"), ret);
+    iLog->Log(_L("Modules number=%d"), modules.Count());
+    for (TInt i = 0; i < modules.Count(); i++)
+        {
+        iLog->Log(_L("Get Module Names %d"), i);
+        iLog->Log(_L("Get Module Name = %d .=%s"),i,modules[i].Ptr());
+            
+        CSTFModule module;
+        module.SetName(QString::fromUtf16(modules[i].Ptr(),
+                modules[i].Length()));
+        //module.SetName(TDesC2QString(modules[i]));
+        list.append(module);
+        }
+    modules.Reset();
+    modules.Close();
+    return list;
+    }
+
+QList<CSTFCase> CStifExecutor::GetCaseList(const QString& moduleName)
+    {
+    TPtrC name = QString2TPtrC(moduleName);
+    QList<CSTFCase> list;
+    RRefArray<CTestInfo> testCases;
+    TInt ret = UIStore().TestCases(testCases, name, KNullDesC);
+    iLog->Log(_L("Get TestCases: %d"), ret);
+    for (TInt i = 0; i < testCases.Count(); i++)
+        {
+        iLog->Log(_L("Case Number: %d"),testCases[i].TestCaseNum());
+        iLog->Log(_L("Case Name: %s"),testCases[i].TestCaseTitle().Ptr());
+        CSTFCase testcase;
+        testcase.SetName(TDesC2QString(testCases[i].TestCaseTitle()));
+        testcase.SetIndex(i);
+        list.append(testcase);
+        }
+    testCases.Reset();
+    testCases.Close();
+    return list;
+    }
+
+void CStifExecutor::ExecuteSingleCase(const QString& moduleName, const int caseIndex)
+    {
+    iLog->Log(_L("ExecuteCase start"));
+    TPtrC name = QString2TPtrC(moduleName);
+    RRefArray<CTestInfo> testCases;
+    TInt ret = UIStore().TestCases(testCases, name, KNullDesC);
+    iLog->Log(_L("Get TestCases return code=%d"), ret);
+    if (testCases.Count() > caseIndex)
+        {
+        TInt index;
+        UIStore().StartTestCase(testCases[caseIndex], index);
+        iLog->Log(_L("start test case index=%d"), index);
+        }
+    testCases.Reset();
+    testCases.Close();
+    iLog->Log(_L("ExecuteCase end"));
+
+    }
+
+QList<QString> CStifExecutor::GetSetList()
+    {
+    QList<QString> list;
+    RRefArray<TDesC> aArray;
+    TInt ret = UIStore().GetTestSetsList(aArray);
+    iLog->Log(_L("Get TestSet list return code=%d"), ret);
+    if (ret != KErrNone) //setInfos.Count() != 1
+        {
+        return list;
+        }
+    for (int i = 0; i < aArray.Count(); i++)
+        {
+        list.append(TDesC2QString(aArray[i]));
+        }
+    aArray.Reset();
+    aArray.Close();
+    return list;
+    }
+
+QList<CSTFCase> CStifExecutor::GetCaseListFromSet(const QString& setName)
+    {
+    iLog->Log(_L("GetCaseListFromSet start."));
+    QList<CSTFCase> list;
+    TPtrC name = QString2TPtrC(setName);
+
+    //iLog->Log(name);
+    if (name.Length() == 0)
+        {
+        return list;
+        }
+
+    iLog->Log(_L("name.Length()=%d"), name.Length());
+    TInt ret = UIStore().LoadTestSet(name);
+    iLog->Log(_L("Load Test Set return=%d"),ret);
+    const CTestSetInfo* set = NULL;
+    TRAP(ret , set = &UIStore().TestSetL(name));
+    iLog->Log(_L("GetCaseListFromSet TestSetL."));
+    if(ret != KErrNone)
+        {
+        return list;
+        }
+    const RRefArray<const CTestInfo>& testCases = set->TestCases();
+    iLog->Log(_L("GetCaseListFromSet TestCases."));
+    TInt count = testCases.Count();
+    for (TInt i = 0; i < count; i++)
+        {
+        CSTFCase testcase;
+        testcase.SetName(TDesC2QString(testCases[i].TestCaseTitle()));
+        testcase.SetIndex(testCases[i].TestCaseNum());
+        testcase.SetModuleName(TDesC2QString(testCases[i].ModuleName()));
+        list.append(testcase);
+        }
+    iLog->Log(_L("GetCaseListFromSet end."));
+    return list;
+    }
+
+bool CStifExecutor::CreateSet(const QString& setName)
+    {
+    TPtrC name = QString2TPtrC(setName);
+    TInt ret = UIStore().CreateTestSet(name);
+    return LogResult(ret, "CreateSet");
+    }
+
+bool CStifExecutor::SaveSet(QString& setName)
+    {
+    TPtrC name = QString2TPtrC(setName);
+    TFileName testSetName;
+    testSetName.Copy(name);
+    TInt ret = UIStore().SaveTestSet(testSetName);
+    setName = TDesC2QString(testSetName);
+    return LogResult(ret, "SaveSet");
+    }
+
+bool CStifExecutor::RemoveSet(const QString& setName)
+    {
+    //This method wil not work at this stage.
+    TPtrC name = QString2TPtrC(setName);
+    TInt ret = UIStore().RemoveTestSet(name);
+    return LogResult(ret, "RemoveSet");
+    }
+
+bool CStifExecutor::AddtoSet(const QString& setName, CSTFCase& caseInfo)
+    {
+    iLog->Log(_L("AddToSet Start"));
+        
+    //IMPORT_C TInt AddToTestSet( const TDesC& aSetName, const CTestInfo& aTestInfo );
+    TPtrC modulename = QString2TPtrC(caseInfo.ModuleName());
+    iLog->Log(_L("AddToSet dealwith module: %s"), modulename.Ptr());
+    iLog->Log(_L("Case name: %s"),QString2TPtrC(caseInfo.Name()).Ptr());
+    iLog->Log(_L("Case index: %d"),caseInfo.Index());
+    TInt caseIndex = caseInfo.Index();
+    if(caseInfo.ModuleName().toLower() == "testscripter"
+            ||caseInfo.ModuleName().toLower() == "teftestmodule")
+        {
+        caseIndex++;
+        }
+    RRefArray<CTestInfo> testCases;
+    TInt ret = UIStore().TestCases(testCases, modulename, KNullDesC);
+    if(!LogResult(ret, "AddToSet, GetTestCases"))
+        {
+        return false;
+        }
+    
+    ret = -1;
+    for (TInt i = 0; i < testCases.Count(); i++)
+        {
+        iLog->Log(_L("Case Number: %d"),testCases[i].TestCaseNum());
+        iLog->Log(_L("Case Title: %s"),testCases[i].TestCaseTitle().Ptr());        
+        
+        if (testCases[i].TestCaseNum() == caseIndex)
+            {
+            ret = UIStore().AddToTestSet(QString2TPtrC(setName), testCases[i]);
+            iLog->Log(_L("AddToTestSet: %d"), ret);
+            break;
+            }
+        }
+    testCases.Reset();
+    testCases.Close();
+    return LogResult(ret, "AddToSet");
+    }
+
+void CStifExecutor::ExecuteSet(const QString& SetName, const int startIndex,
+        const TSTFCaseRunningType type)
+    {
+    CStartedTestSet::TSetType setType = CStartedTestSet::ESetSequential;
+    if (type == Parallel)
+        {
+        setType = CStartedTestSet::ESetParallel;
+        }
+    const CTestSetInfo* set = NULL;
+    TInt ret;
+    TBuf<30> test;
+    test.Append(QString2TPtrC(SetName));
+    iLog->Log(_L("StartTestSet GetSetName:"));
+    iLog->Log(test);
+    TRAP(ret, set = &UIStore().TestSetL(test));
+            
+    //const CTestSetInfo& set = UIStore().TestSetL(QString2TPtrC(SetName));
+    if(ret != KErrNone)
+        {
+        iLog->Log(_L("StartTestSet GetTestSet Error return=%d"),ret);
+        return;
+        }
+    int a = startIndex;
+    ret = UIStore().StartTestSet(*set, a, setType);
+    iLog->Log(_L("StartTestSet return=%d"),ret);
+    }
+
+void CStifExecutor::Update(CStartedTestCase* aCase, int flags)
+    {
+    iLog->Log(_L("CStifExecutor::Update return case=%d"),aCase);
+    iLog->Log(_L("CStifExecutor::Update return status=%d"),flags);
+    
+    if(aCase == NULL)
+        {
+        return;
+        }
+
+    if (flags & CUIStoreIf::EPrintUpdate)
+        {
+        //Cases output information update.
+        const RPointerArray<CTestProgress> printArray = aCase->PrintArray();
+        TInt rows = aCase->PrintArray().Count();
+        TPtr buffer(iBuffer->Des());
+        buffer.Zero();
+        for (int i = 0; i < rows; i++)
+            {
+            buffer.Append(_L("\r\n"));
+            buffer.Append(printArray[i]->iDescription);
+            buffer.Append(_L(" "));
+            buffer.Append(printArray[i]->iText);
+            buffer.Append(_L("\r\n"));
+            }
+        QString msg = TDesC2QString(buffer);
+        iLog->Log(_L("Get output msg:"));
+        iLog->Log(buffer);
+        if (listenerList)
+            {
+            for (int i = 0; i < listenerList->size(); i++)
+                {
+                listenerList->at(i)->OnGetCaseOutput(aCase, msg);
+                }
+            }
+
+        }
+    else
+        {
+        //case status changed update.
+        CSTFCase testcase;
+        testcase.SetName(TDesC2QString(aCase->TestInfo().TestCaseTitle()));
+        testcase.SetIndex(aCase->TestInfo().TestCaseNum());
+        testcase.SetModuleName(TDesC2QString(aCase->TestInfo().ModuleName()));
+        if (listenerList)
+            {
+            for (int i = 0; i < listenerList->size(); i++)
+                {
+                listenerList->at(i)->OnGetCaseUpdated(aCase, testcase, flags);
+                }
+            }
+
+        }
+
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/qt/src/uisetting.cpp	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,146 @@
+/*
+ * 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: QT C++ based Class.
+ *
+ */
+
+#include <QFile>
+#include <QTextStream>
+#include <QDateTime>
+#include "uisetting.h"
+const QString SETTINGFILE = "c:\\TestFramework\\StfQtUISetting.ini";
+
+UiSetting::UiSetting()
+    {
+    if(!load())
+        {
+        loadDefault();
+        }
+    }
+
+UiSetting::~UiSetting()
+    {
+    }
+
+QString UiSetting::ReadSetting(const QString& item)
+    {
+    QString value = "";
+    if(settingList.contains(item))
+        {
+        value = settingList.value(item);
+        }
+    else
+        {
+        value = getDefaultValue(item);
+        settingList.insert(item, value);
+        }
+    return value;
+    }
+
+
+void UiSetting::SetSetting(const QString& item, const QString& value)
+    {
+    if(settingList.contains(item))
+        {
+        settingList.remove(item);
+        }
+    settingList.insert(item, value);
+    save();
+    }
+
+
+void UiSetting::loadDefault()
+    {
+    settingList.clear();
+    settingList.insert(KShowOutput, getDefaultValue(KShowOutput));
+    settingList.insert(KStyleSheet, getDefaultValue(KStyleSheet));
+    settingList.insert(KFilter, getDefaultValue(KFilter));
+    settingList.insert(KFilterCaseSens, getDefaultValue(KFilterCaseSens));
+    //add mor default setting here.
+    }
+
+QString UiSetting::getDefaultValue(const QString& item)
+    {
+    QString result = "";
+    if(item == KShowOutput)
+        {
+        result = "true";
+        }
+    else if(item == KStyleSheet)
+        {
+        result = ":/qss/coffee.qss";
+        }
+    else if(item == KFilter)
+        {
+        result = "";
+        }
+    else if(item == KFilterCaseSens)
+        {
+        result = "false";
+        }
+    return result;
+    }
+
+bool UiSetting::load()
+    {
+    QFile file(SETTINGFILE);
+    if(!file.open(QIODevice::ReadOnly))
+        {
+        return false;
+        }
+    QTextStream in(&file);
+    QString line, item, value;
+    int index;
+    while(!in.atEnd())
+        {
+        line = in.readLine().trimmed();
+        if(!line.startsWith("//"))
+            {
+            index = line.indexOf("=");
+            if(index > 0 && index < line.length() - 1)
+                {
+                item = line.left(index).trimmed();
+                value = line.right(line.length() - index  -1);
+                if(item == KFilter) //For filter do not care about stored value
+                    value = "";
+                settingList.insert(item, value);
+                }
+            }
+        //end while.
+        }
+    return true;
+    }
+
+bool UiSetting::save()
+    {
+    QFile file(SETTINGFILE);
+    if(!file.open(QIODevice::WriteOnly))
+        {
+        return false;
+        }
+    QTextStream in(&file);
+    in << "//STFQtUI Setting.\r\n";
+    in << "//Created at: " + QDateTime::currentDateTime().toString("yyyy.mm.dd hh:mm::ss");
+    in << "\r\n";
+    for(int i=0;i< settingList.size();i++)
+        {
+        in << settingList.keys()[i];
+        in << "=";
+        in << settingList.value(settingList.keys()[i]);
+        in << "\r\n";
+        }
+    return true;    
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/qt/stifqtui.pro	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,57 @@
+# 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: QT project file.
+TARGET = STFUI
+HEADERS += inc/dlgrepeatrun.h \
+    inc/dlgsetselector.h \
+    inc\version.h \
+    inc\frmmain.h \
+    inc\istfqtuicontroller.h \
+    inc\stfqtuicontroller.h \
+    inc\cstfcase.h \
+    inc\cstfmodule.h \
+    inc\istfqtuimodel.h \
+    inc\stfqtuimodel.h \
+    inc\dlgoutput.h \
+    inc\uisetting.h \
+    inc\dlgsetting.h \
+    inc\uiversion.h
+SOURCES += src/dlgrepeatrun.cpp \
+    src\dlgsetselector.cpp \
+    src\frmmain.cpp \
+    src\main.cpp \
+    src\stfqtuimodel.cpp \
+    src\stfqtuicontroller.cpp \
+    src\dlgoutput.cpp \
+    src\uisetting.cpp \
+    src\dlgsetting.cpp
+RESOURCES += resource\StfQtUI.qrc
+symbian { 
+    TARGET.UID3 = 0x2002BCA0
+    TARGET.EPOCALLOWDLLDATA = 1
+    //HEADERS += ../../../inc/.
+    INCLUDEPATH += /epoc32/include/mw
+    INCLUDEPATH += /epoc32/include/platform
+    INCLUDEPATH += /epoc32/include/platform/stifinternal
+    INCLUDEPATH += /epoc32/include/domain/osextensions
+    INCLUDEPATH += /epoc32/include/domain/osextensions/stif
+    HEADERS += inc\stifexecutor.h
+    SOURCES += src\stifexecutor.cpp
+    LIBS += -lstiftfwif \
+        -lstiftestinterface
+    TARGET.CAPABILITY = AllFiles \
+        CommDD
+    
+    # Export headers to SDK Epoc32/include directory
+    deploy.path = $$EPOCROOT
+    BLD_INF_RULES.prj_exports += "$${LITERAL_HASH}include <platform_paths.hrh>"
+    BLD_INF_RULES.prj_exports += "rom/stfui.iby CORE_IBY_EXPORT_PATH(tools,Stfui.iby)"
+    
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/symbianunittestui/qt/dialogaddtests.cpp	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,95 @@
+/*
+ * 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: Dialog class to add test dll files.
+ *
+ */
+
+#include <QDialog>
+#include <QTextEdit>
+#include <QPushButton>
+#include <QGridLayout>
+#include <QLabel>
+#include "dialogaddtests.h"
+
+static const QString filter = "[\n \t\r;]";
+static const QChar separator = ',';
+
+DialogAddTests::DialogAddTests(QWidget* parent) :
+    QDialog(parent)
+    {
+    setContextMenuPolicy(Qt::NoContextMenu);
+    setWindowTitle(tr("Add Tests"));
+    load();
+    setLayout();
+    clear();
+    }
+
+DialogAddTests::~DialogAddTests()
+    {
+    }
+
+void DialogAddTests::clear()
+    {
+    txtTests->clear();
+    }
+
+void DialogAddTests::saveTests()
+    {
+    QString text = txtTests->toPlainText();
+    if (!text.isNull() && !text.isEmpty())
+        {
+        text.remove(QRegExp(filter));
+        emit this->testsSaved(text.split(separator));
+        this->close();
+        }
+    }
+
+void DialogAddTests::load()
+    {
+    txtTests = new QTextEdit(this);
+    txtTests->setToolTip(tr("enter file names without dll extension, comma separated."));
+    connect(txtTests, SIGNAL(textChanged()), this, SLOT(changeText()));
+    
+    btnOk = new QPushButton(tr("OK"), this);
+    connect(btnOk, SIGNAL(clicked()), this, SLOT(saveTests()));
+    
+    btnCancel = new QPushButton(tr("Cancel"), this);
+    connect(btnCancel, SIGNAL(clicked()), this, SLOT(close()));
+    
+    btnOk->setEnabled(false);
+    }
+
+void DialogAddTests::changeText()
+    {
+    QString text = txtTests->toPlainText();
+    if (text.isNull() || text.isEmpty())
+        {
+        btnOk->setEnabled(false);
+        }
+    else
+        {
+        btnOk->setEnabled(true);
+        }
+    }
+
+void DialogAddTests::setLayout()
+    {    
+    QGridLayout* layout = new QGridLayout(this);
+    layout->setSpacing(2);
+    layout->setMargin(2);
+    layout->addWidget(txtTests, 0, 0, 1, 2);
+    layout->addWidget(btnOk, 1, 0, 1, 1);
+    layout->addWidget(btnCancel, 1, 1, 1, 1);
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/symbianunittestui/qt/dialogaddtests.h	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,54 @@
+/*
+* 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: Dialog class to add test dll files.
+*
+*/
+
+#ifndef DIALOGADDTESTS_H_
+#define DIALOGADDTESTS_H_
+#include <QDialog>
+
+class QTextEdit;
+class QPushButton;
+class QWidget;
+
+class DialogAddTests: public QDialog
+    {
+    Q_OBJECT
+    
+public:
+    DialogAddTests(QWidget* parent = 0);
+    virtual ~DialogAddTests();
+    
+public:
+    void clear();
+    
+signals:
+    void testsSaved(QStringList);
+    
+private slots:
+    void saveTests();
+    void changeText();
+    
+private:
+    void load();
+    void setLayout();
+
+private:
+    QTextEdit*      txtTests;
+    QPushButton*    btnOk;
+    QPushButton*    btnCancel;
+    };
+
+#endif /* DIALOGADDTESTS_H_ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/symbianunittestui/qt/dialogmsg.cpp	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,62 @@
+/*
+* 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: Dialog class to display some useful message.
+*
+*/
+
+#include <QPushButton>
+#include <QLabel>
+#include <QVBoxLayout>
+#include <QHBoxLayout>
+#include "dialogmsg.h"
+
+DialogMsg::DialogMsg(QWidget* parent): QDialog(parent)
+    {
+    createControls();
+    setLayout();
+    setupEventHandler();
+    }
+
+void DialogMsg::createControls()
+    {
+    btnOk = new QPushButton(tr("OK"), this);
+    lableMsg = new QLabel(this);
+    }
+
+void DialogMsg::setLayout()
+    {
+    QVBoxLayout* vLayout = new QVBoxLayout(this);
+    vLayout->addWidget(lableMsg);
+    QWidget* wdgt = new QWidget(this);
+    QHBoxLayout* hLayout = new QHBoxLayout(this);
+    hLayout->addWidget(btnOk);
+    wdgt->setLayout(hLayout);
+    vLayout->addWidget(wdgt);
+    }
+
+void DialogMsg::setupEventHandler()
+    {
+    connect(btnOk, SIGNAL(clicked()), this, SLOT(close()));
+    }
+
+DialogMsg::~DialogMsg()
+    {
+    }
+
+void DialogMsg::showMsg(const QString msg)
+    {
+    lableMsg->setText(msg);
+    this->show();
+    int res = this->exec();
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/symbianunittestui/qt/dialogmsg.h	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,48 @@
+/*
+* 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: Dialog class to display some useful message.
+*
+*/
+
+#ifndef DIALOGMSG_H_
+#define DIALOGMSG_H_
+
+#include <qdialog.h>
+
+class QPushButton;
+class QLabel;
+class QWidget;
+
+class DialogMsg : public QDialog
+    {
+    Q_OBJECT
+
+public:
+    DialogMsg(QWidget* parent = 0);
+    virtual ~DialogMsg();
+    
+public slots:
+    void showMsg(const QString);
+    
+private:
+    void createControls();
+    void setLayout();
+    void setupEventHandler();
+    
+private:
+    QPushButton*    btnOk;
+    QLabel*         lableMsg;
+    };
+
+#endif /* DIALOGMSG_H_ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/symbianunittestui/qt/dialogsettings.cpp	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,260 @@
+/*
+ * 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: Dialog class to set options when running tests.
+ *
+ */
+
+#include <QCheckBox>
+#include <QLabel>
+#include <QLineEdit>
+#include <QComboBox>
+#include <QPushButton>
+#include <QHBoxLayout>
+#include <QVBoxLayout>
+#include "dialogsettings.h"
+#include "settings.h"
+
+static const QString FORMAT_HTML = "html";
+static const QString FORMAT_XML = "xml";
+static const QString FORMAT_TEXT = "txt";
+
+static const QString WIN_TITLE = "Settings";
+
+static const QString TXT_TIMEOUT = "Timeout";
+static const QString TXT_TIMEOUTUNIT = "second(s)";
+static const int DEFAULT_TIMEOUT = 30;
+
+static const QString TXT_FORMAT = "Output Format";
+
+static const QString TXT_MEMSIM = "Simulate Mem Allocation Failure";
+
+static const QString TXT_SAVE = "Save";
+static const QString TXT_CANCEL = "Cancel";
+
+DialogSettings::DialogSettings(QWidget* parent) :
+    QDialog(parent)
+    {
+    setContextMenuPolicy(Qt::NoContextMenu);
+    setWindowTitle(WIN_TITLE);
+    savedSettings = new Settings(DEFAULT_TIMEOUT, false, FORMAT_HTML);
+    load();
+    }
+
+DialogSettings::~DialogSettings()
+    {
+    }
+
+void DialogSettings::restoreSettings()
+    {
+    bool timoutChanged = savedSettings->timeout != DEFAULT_TIMEOUT;
+    chkBoxTimeout->setChecked(timoutChanged);
+    lineEditTimeout->setEnabled(timoutChanged);
+    lineEditTimeout->setText(tr("%1").arg(savedSettings->timeout));
+    bool outputFormatChanged =
+            savedSettings->outputFormat.compare(FORMAT_HTML) != 0;
+    chkBoxOutputFormat->setChecked(outputFormatChanged);
+    comboBoxOutputFormat->setEnabled(outputFormatChanged);
+    comboBoxOutputFormat->setCurrentIndex(listFormats.indexOf(
+            savedSettings->outputFormat));
+    chkBoxMemAllocFailureSim->setChecked(savedSettings->memAllocFailureSim);
+    btnSave->setEnabled(false);
+    }
+
+void DialogSettings::createTimeoutSettings()
+    {
+    chkBoxTimeout = new QCheckBox(TXT_TIMEOUT, this);
+    lineEditTimeout = new QLineEdit(tr("%1").arg(DEFAULT_TIMEOUT), this);
+    lineEditTimeout->setEnabled(false);
+    labelTimeoutUnit = new QLabel(TXT_TIMEOUTUNIT, this);
+    }
+
+void DialogSettings::setupTimeoutSettingsEventHandlers()
+    {
+    connect(chkBoxTimeout, SIGNAL(stateChanged(int)), this,
+            SLOT(setLineEditTimeoutEnabled(int)));
+    connect(lineEditTimeout, SIGNAL(textChanged(const QString&)), this,
+            SLOT(changeText(const QString&)));
+    }
+
+void DialogSettings::createOutputFormatSettings()
+    {
+    chkBoxOutputFormat = new QCheckBox(TXT_FORMAT, this);
+    comboBoxOutputFormat = new QComboBox(this);
+    listFormats << FORMAT_HTML << FORMAT_XML << FORMAT_TEXT;
+    comboBoxOutputFormat->addItems(listFormats);
+    comboBoxOutputFormat->setEnabled(false);
+    }
+
+void DialogSettings::setupOutputFormatSettingsEventHandlers()
+    {
+    connect(chkBoxOutputFormat, SIGNAL(stateChanged(int)), this,
+            SLOT(setComboxFormatEnabled(int)));
+    connect(comboBoxOutputFormat, SIGNAL(currentIndexChanged(int)), this, SLOT(changeIndex(int)));
+    }
+
+void DialogSettings::createMemSimSettings()
+    {
+    chkBoxMemAllocFailureSim = new QCheckBox(TXT_MEMSIM, this);
+    }
+
+void DialogSettings::setupMemSimSettingsEventHandlers()
+    {
+    connect(chkBoxMemAllocFailureSim, SIGNAL(stateChanged(int)), this,
+            SLOT(setMemAllocFailureSim(int)));
+    }
+
+void DialogSettings::createButtons()
+    {
+    btnSave = new QPushButton(TXT_SAVE, this);
+    btnCancel = new QPushButton(TXT_CANCEL, this);
+    btnSave->setEnabled(false);
+    }
+
+void DialogSettings::setupButtonsEventHandlers()
+    {
+    connect(btnCancel, SIGNAL(clicked()), this, SLOT(close()));
+    connect(btnSave, SIGNAL(clicked()), this, SLOT(saveSettings()));
+    }
+
+void DialogSettings::load()
+    {
+    createTimeoutSettings();
+    setupTimeoutSettingsEventHandlers();
+    createOutputFormatSettings();
+    setupOutputFormatSettingsEventHandlers();
+    createMemSimSettings();
+    setupMemSimSettingsEventHandlers();
+    createButtons();
+    setupButtonsEventHandlers();
+
+    setLayout();
+    }
+
+void DialogSettings::setLayout()
+    {
+    QVBoxLayout* mainLayout = new QVBoxLayout(this);
+    // :( should check NULL pointer.
+    mainLayout->addWidget(setTimeoutCtlsLayout());
+    mainLayout->addWidget(setOutputCtlsLayout());
+    mainLayout->addWidget(setMemAllocFailureSimCtrlLayout());
+    mainLayout->addWidget(setButtonsLayout());
+    }
+
+QWidget* DialogSettings::setTimeoutCtlsLayout()
+    {
+    QWidget* timeoutLayoutWidget = new QWidget(this);
+    QHBoxLayout* layout = new QHBoxLayout(timeoutLayoutWidget);
+    layout->addWidget(chkBoxTimeout);
+    layout->addWidget(lineEditTimeout);
+    layout->addWidget(labelTimeoutUnit);
+    timeoutLayoutWidget->setLayout(layout);
+    return timeoutLayoutWidget;
+    }
+
+QWidget* DialogSettings::setOutputCtlsLayout()
+    {
+    QWidget* formatLayoutWidget = new QWidget(this);
+    QHBoxLayout* layout = new QHBoxLayout(formatLayoutWidget);
+    layout->addWidget(chkBoxOutputFormat);
+    layout->addWidget(comboBoxOutputFormat);
+    formatLayoutWidget->setLayout(layout);
+    return formatLayoutWidget;
+    }
+QWidget* DialogSettings::setMemAllocFailureSimCtrlLayout()
+    {
+    QWidget* memSimLayoutWidget = new QWidget(this);
+    QHBoxLayout* layout = new QHBoxLayout(memSimLayoutWidget);
+    layout->addWidget(chkBoxMemAllocFailureSim);
+    memSimLayoutWidget->setLayout(layout);
+    return memSimLayoutWidget;
+    }
+
+QWidget* DialogSettings::setButtonsLayout()
+    {
+    QWidget* btnLayoutWidget = new QWidget(this);
+    QHBoxLayout* layout = new QHBoxLayout(btnLayoutWidget);
+    layout->addWidget(btnSave);
+    layout->addWidget(btnCancel);
+    btnLayoutWidget->setLayout(layout);
+    return btnLayoutWidget;
+    }
+
+void DialogSettings::setBtnSaveEnabled()
+    {
+    int timeout;
+    if (getTimeout(&timeout))
+        {
+        Settings curSettings(timeout,
+                chkBoxMemAllocFailureSim->checkState() == Qt::Checked,
+                comboBoxOutputFormat->currentText());
+
+        btnSave->setEnabled(!savedSettings->isEqual(curSettings));
+        }
+    }
+
+void DialogSettings::setLineEditTimeoutEnabled(int chkState)
+    {
+    lineEditTimeout->setEnabled(chkState == Qt::Checked);
+    if (!lineEditTimeout->isEnabled())
+        {
+        lineEditTimeout->setText(tr("%1").arg(DEFAULT_TIMEOUT));
+        }
+    setBtnSaveEnabled();
+    }
+
+void DialogSettings::setComboxFormatEnabled(int chkState)
+    {
+    comboBoxOutputFormat->setEnabled(chkState == Qt::Checked);
+    if (!comboBoxOutputFormat->isEnabled())
+        {
+        comboBoxOutputFormat->setCurrentIndex(
+                listFormats.indexOf(FORMAT_HTML));
+        }
+    setBtnSaveEnabled();
+    }
+
+void DialogSettings::setMemAllocFailureSim(int /*chkState*/)
+    {
+    setBtnSaveEnabled();
+    }
+
+void DialogSettings::changeIndex(int /*index*/)
+    {
+    setBtnSaveEnabled();
+    }
+
+void DialogSettings::changeText(const QString& /*text*/)
+    {
+    setBtnSaveEnabled();
+    }
+
+void DialogSettings::saveSettings()
+    {
+    int timeout;
+    if (getTimeout(&timeout))
+        {
+        savedSettings->timeout = timeout;
+        savedSettings->memAllocFailureSim = chkBoxMemAllocFailureSim->checkState() == Qt::Checked;
+        savedSettings->outputFormat = comboBoxOutputFormat->currentText();
+        emit this->settingsSaved(savedSettings);
+        }
+    this->close();
+    }
+
+bool DialogSettings::getTimeout(int* timeout)
+    {
+    bool ok;
+    *timeout = lineEditTimeout->text().toInt(&ok, 0);
+    return ok;
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/symbianunittestui/qt/dialogsettings.h	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,87 @@
+/*
+* 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: Dialog class to set options when running tests.
+*
+*/
+
+#ifndef DIALOGSETTINGS_H_
+#define DIALOGSETTINGS_H_
+#include <QDialog>
+#include <QStringList>
+
+class QCheckBox;
+class QLabel;
+class QLineEdit;
+class QComboBox;
+class QPushButton;
+class Settings;
+
+class DialogSettings: public QDialog
+    {
+    Q_OBJECT
+    
+public:
+    DialogSettings(QWidget* parent = 0);
+    virtual ~DialogSettings();
+    
+public:
+    void restoreSettings();
+    
+private:
+    void createTimeoutSettings();
+    void setupTimeoutSettingsEventHandlers();
+    void createOutputFormatSettings();
+    void setupOutputFormatSettingsEventHandlers();
+    void createMemSimSettings();
+    void setupMemSimSettingsEventHandlers();
+    void createButtons();
+    void setupButtonsEventHandlers();
+    void load();
+    void setLayout();    
+    QWidget* setTimeoutCtlsLayout();
+    QWidget* setOutputCtlsLayout();
+    QWidget* setButtonsLayout();
+    QWidget* setMemAllocFailureSimCtrlLayout();
+    void setBtnSaveEnabled();
+    bool getTimeout(int *);
+    
+signals:
+    void settingsSaved(const Settings*);
+    
+private slots:
+    void setLineEditTimeoutEnabled(int chkState);
+    void setComboxFormatEnabled(int chkState);
+    void setMemAllocFailureSim(int chkState);
+    void changeIndex(int);
+    void changeText(const QString&);
+    void saveSettings();
+    
+private:    
+    QCheckBox*      chkBoxTimeout;
+    QCheckBox*      chkBoxMemAllocFailureSim;
+    QCheckBox*      chkBoxOutputFormat;
+    QLabel*         labelTimeoutUnit;
+    QLineEdit*      lineEditTimeout;
+    QComboBox*      comboBoxOutputFormat;
+    QPushButton*    btnSave;
+    QPushButton*    btnCancel;
+    
+    // Populated data
+    QStringList listFormats;
+    
+    // Data
+    Settings* savedSettings;
+    };
+
+#endif /* DIALOGSETTINGS_H_ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/symbianunittestui/qt/main.cpp	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,29 @@
+/*
+* 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 C++ based Class.
+*              Application entrance.
+*
+*/
+
+#include <QApplication>
+#include "mainwindow.h"
+
+int main(int argc, char *argv[])
+{
+    QApplication app(argc, argv);
+    Q_INIT_RESOURCE(symbianunittestqt);
+    MainWindow w;
+    w.showMaximized();
+    return app.exec();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/symbianunittestui/qt/mainwindow.cpp	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,296 @@
+/*
+ * 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 C++ main window Class.
+ *
+ */
+
+#include <QAction>
+#include <QMenuBar>
+#include <QMenu>
+#include <QGridLayout>
+#include <QTreeWidgetItem>
+#include <QKeyEvent>
+#include <QFile>
+#include <QLatin1String>
+#include <QApplication>
+#include "mainwindow.h"
+#include <symbianunittestversion.h>
+#include "dialogaddtests.h"
+#include "tabwidgettestrun.h"
+#include "dialogsettings.h"
+#include "dialogmsg.h"
+
+static const QString APPNAME = "symbianunittestqt";
+static const QString STYLESHEET = ":/qss/coffee.qss";
+//Symbian EKeyLeftArrow = 0x807
+static const int KeyLeftArrow = 63495;
+//Symbian EKeyRightArrow = 0x808
+static const int KeyRightArrow = 63496;
+//Symbian EKeyUpArrow = 0x809
+static const int KeyUpArrow = 63497;
+//Symbian EKeyDownArrow = 0x80a
+static const int KeyDownArrow = 63498;
+//Symbian EKeyEnter = 0x10
+static const int KeyEnter = 0x10;
+
+MainWindow::MainWindow(QWidget* parent) :
+    QMainWindow(parent)
+    {
+    setTitle();
+    QWidget* centralWidget;
+    centralWidget = new QWidget(this);
+    centralWidget->setContextMenuPolicy(Qt::NoContextMenu);
+    setCentralWidget(centralWidget);
+    load();
+    }
+
+MainWindow::~MainWindow()
+    {
+
+    }
+
+void MainWindow::SetStyle(const QString& styleFile)
+    {
+    QFile file(styleFile);
+    bool rst = file.open(QFile::ReadOnly);    
+    if(rst)
+        {
+        QString styleSheet = QLatin1String(file.readAll());    
+        qApp->setStyleSheet(styleSheet);    
+        }
+    file.close();
+    }
+
+void MainWindow::popupDialogAddTests()
+    {
+    dlgAddTests->clear();
+    dlgAddTests->showMaximized();
+    }
+
+void MainWindow::popupDialogSettings()
+    {
+    dlgSettings->restoreSettings();
+    dlgSettings->showMaximized();
+    }
+
+void MainWindow::popupDialogAbout()
+    {
+    dlgAbout->showMsg(tr("%1 v%2.%3.%4").arg(APPNAME) .arg(
+            SUT_MAJOR_VERSION) .arg(SUT_MINOR_VERSION).arg(SUT_BUILD_VERSION));
+    }
+
+void MainWindow::setTitle()
+    {
+    this->setWindowTitle(tr("%1 v%2.%3.%4").arg(APPNAME) .arg(
+            SUT_MAJOR_VERSION) .arg(SUT_MINOR_VERSION).arg(SUT_BUILD_VERSION));
+    }
+
+void MainWindow::load()
+    {
+    createTabWidget();
+    loadTabWidget();
+    setupTabWidgetEventHandlers();
+    createDialogs();
+    setupDialogEventHandlers();
+    createMenu();
+    setupMenuEventHandlers();
+    loadMenu();
+    setupKeyEventHandlers();
+    SetStyle(STYLESHEET);
+    }
+
+void MainWindow::createMenu()
+    {
+    atnAddTests = new QAction(tr("Add Tests"), this);
+    menuMarkUnmark = new QMenu(tr("Mark / Unmark"), this);
+    menuMarkUnmark->setEnabled(false);
+    atnMark = new QAction(tr("Mark"), menuMarkUnmark);
+    atnMarkAll = new QAction(tr("Mark All"), menuMarkUnmark);
+    atnUnmark = new QAction(tr("Unmark"), menuMarkUnmark);
+    atnUnmarkAll = new QAction(tr("Unmark All"), menuMarkUnmark);
+    atnRun = new QAction(tr("Run"), this);
+    atnRun->setEnabled(false);
+    atnSettings = new QAction(tr("Settings"), this);
+    atnAbout = new QAction(tr("About"), this);
+    atnExit = new QAction(tr("Exit"), this);
+    }
+
+void MainWindow::setupMenuEventHandlers()
+    {
+    // add tests
+    connect(atnAddTests, SIGNAL(triggered()), this,
+            SLOT(popupDialogAddTests()));
+    // Mark / Unmark single / all
+    connect(atnMark, SIGNAL(triggered()), tabWdgtTestRun,
+            SLOT(selectCurrentCase()));
+    connect(atnMarkAll, SIGNAL(triggered()), tabWdgtTestRun,
+            SLOT(selectAllCases()));
+    connect(atnUnmark, SIGNAL(triggered()), tabWdgtTestRun,
+            SLOT(deselectCurrentCase()));
+    connect(atnUnmarkAll, SIGNAL(triggered()), tabWdgtTestRun,
+            SLOT(deselectAllCases()));
+    // Run tests
+    connect(atnRun, SIGNAL(triggered()), tabWdgtTestRun, SLOT(runTests()));
+    // set options to run cases
+    connect(atnSettings, SIGNAL(triggered()), this,
+            SLOT(popupDialogSettings()));
+
+    connect(atnAbout, SIGNAL(triggered()), this, SLOT(popupDialogAbout()));
+    connect(atnExit, SIGNAL(triggered()), this, SLOT(close()));
+    }
+
+void MainWindow::createTabWidget()
+    {
+    tabWdgtTestRun = new TabWidgetTestRun(this);
+    }
+
+void MainWindow::loadMenu()
+    {
+    menuBar()->clear();
+    menuBar()->addAction(atnAddTests);
+    menuMarkUnmark->addAction(atnMark);
+    menuMarkUnmark->addAction(atnMarkAll);
+    menuMarkUnmark->addAction(atnUnmark);
+    menuMarkUnmark->addAction(atnUnmarkAll);
+    menuBar()->addAction(menuMarkUnmark->menuAction());
+    menuBar()->addAction(atnRun);
+    menuBar()->addAction(atnSettings);
+    menuBar()->addAction(atnAbout);
+    menuBar()->addAction(atnExit);
+    }
+
+void MainWindow::loadTabWidget()
+    {
+    QGridLayout* tabLayout = new QGridLayout(this);
+    tabLayout->setVerticalSpacing(2);
+    tabLayout->setHorizontalSpacing(2);
+    tabLayout->setSpacing(2);
+    tabLayout->setMargin(2);
+    tabLayout->addWidget(tabWdgtTestRun, 0, 0);
+    centralWidget()->setLayout(tabLayout);
+    }
+
+void MainWindow::setupTabWidgetEventHandlers()
+    {
+    connect(tabWdgtTestRun, SIGNAL(testsAdded()), this,
+            SLOT(enableMenuMarkUnmark()));
+    connect(tabWdgtTestRun, SIGNAL(selectedTestsChanged(bool, bool, bool)), this,
+            SLOT(setRunMarkUnmarkEnabled(bool, bool, bool)));
+    // current tab changed
+    connect(tabWdgtTestRun, SIGNAL(currentTabChangedToTests(bool)), this,
+            SLOT(changCurrentTabToTests(bool)));
+    connect(tabWdgtTestRun, SIGNAL(currentTabChangedToExecution()), this,
+            SLOT(changCurrentTabToExecution()));
+    }
+
+void MainWindow::createDialogs()
+    {
+    dlgAddTests = new DialogAddTests(this);
+    dlgSettings = new DialogSettings(this);
+    dlgAbout = new DialogMsg(this);
+    }
+
+void MainWindow::setupDialogEventHandlers()
+    {
+    connect(dlgAddTests, SIGNAL(testsSaved(QStringList)), tabWdgtTestRun,
+            SLOT(addTests(QStringList)));
+    connect(dlgSettings, SIGNAL(settingsSaved(const Settings*)),
+            tabWdgtTestRun, SLOT(saveSettings(const Settings*)));
+    }
+
+void MainWindow::changCurrentTabToTests(bool hasTests)
+    {
+    if (hasTests)
+        {
+        menuMarkUnmark->setEnabled(true);
+        }
+    }
+
+void MainWindow::changCurrentTabToExecution()
+    {
+    menuMarkUnmark->setEnabled(false);
+    }
+
+void MainWindow::setRunMarkUnmarkEnabled(bool noneSelected, bool allSelected, bool curSelected)
+    {
+    atnRun->setEnabled(!noneSelected);
+    atnUnmarkAll->setEnabled(!noneSelected);
+    atnUnmark->setEnabled(curSelected);
+    atnMark->setEnabled(!curSelected);
+    atnMarkAll->setEnabled(noneSelected || !allSelected);
+    }
+
+void MainWindow::enableMenuMarkUnmark()
+    {
+    menuMarkUnmark->setEnabled(true);
+    atnMarkAll->setEnabled(true);
+    atnMark->setEnabled(true);
+    atnUnmark->setEnabled(false);
+    atnUnmarkAll->setEnabled(false);
+    }
+
+void MainWindow::keyPressEvent(QKeyEvent* event)
+    {
+    // Handle arrow keys and selection key events
+    switch (event->nativeVirtualKey())
+        {
+        case KeyLeftArrow:
+            {
+            // TODO
+            emit this->leftArrowPressed();
+            break;
+            }
+        case KeyRightArrow:
+            {
+            // TODO
+            emit this->rightArrowPressed();
+            break;
+            }
+        case KeyUpArrow:
+            {
+            // TODO
+            emit this->upArrowPressed();
+            break;
+            }
+        case KeyDownArrow:
+            {
+            // TODO
+            emit this->downArrowPressed();
+            break;
+            }
+        case KeyEnter:
+            {
+            // TODO
+            emit this->enterPressed();
+            break;
+            }
+        default:
+            {
+            break;
+            }
+        }
+    }
+
+void MainWindow::setupKeyEventHandlers()
+    {
+    connect(this, SIGNAL(leftArrowPressed()), tabWdgtTestRun,
+            SLOT(pressLeftArrow()));
+    connect(this, SIGNAL(rightArrowPressed()), tabWdgtTestRun,
+            SLOT(pressRightArrow()));
+    connect(this, SIGNAL(upArrowPressed()), tabWdgtTestRun,
+            SLOT(pressUpArrow()));
+    connect(this, SIGNAL(downArrowPressed()), tabWdgtTestRun,
+            SLOT(pressDownArrow()));
+    connect(this, SIGNAL(enterPressed()), tabWdgtTestRun, SLOT(pressEnter()));
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/symbianunittestui/qt/mainwindow.h	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,114 @@
+/*
+ * 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 C++ main window Class.
+ *
+ */
+
+#ifndef MAINWINDOW_H_
+#define MAINWINDOW_H_
+
+#include <QMainWindow>
+#include <QtGui>
+
+// Forward declarations
+class QAction;
+class QTabWidget;
+class QPushButton;
+class QWidget;
+class QMenu;
+class DialogAddTests;
+class DialogSettings;
+class TabWidgetTestRun;
+class QTreeWidgetItem;
+class QKeyEvent;
+class Settings;
+class DialogMsg;
+
+class MainWindow : public QMainWindow
+    {
+Q_OBJECT
+
+public:
+    // ctor and dtor
+    MainWindow(QWidget* parent = 0);
+    ~MainWindow();
+
+private:
+    void setTitle();
+    void load();
+    void createMenu();
+    void loadMenu();
+    void createTabWidget();
+    void loadTabWidget();
+    void createDialogs();
+    void setupMenuEventHandlers();
+    void setupDialogEventHandlers();
+    void setupTabWidgetEventHandlers();
+    void setupKeyEventHandlers();
+    void SetStyle(const QString&);
+
+public:
+    void keyPressEvent(QKeyEvent *);
+    
+signals:
+    void testsAdded(QStringList);
+    
+    // Key press events
+    void leftArrowPressed();
+    void rightArrowPressed();
+    void upArrowPressed();
+    void downArrowPressed();
+    void enterPressed();
+
+private slots:
+    void popupDialogAddTests();
+    void popupDialogSettings();
+    void popupDialogAbout();
+
+    void changCurrentTabToTests(bool hasTests);
+    void changCurrentTabToExecution();
+    void enableMenuMarkUnmark();
+    void setRunMarkUnmarkEnabled(bool noneSelected, bool allSelected, bool curSelected);
+
+private:
+    /*
+     * Menu Items.
+     */
+    // Cases
+    QAction* atnAddTests;
+    QMenu* menuMarkUnmark;
+    QAction* atnMark;
+    QAction* atnMarkAll;
+    QAction* atnUnmark;
+    QAction* atnUnmarkAll;
+    QAction* atnRun;
+    QAction* atnSettings;
+    // App
+    QAction* atnAbout;
+    QAction* atnExit;
+
+    // Add Tests dialog
+    DialogAddTests* dlgAddTests;
+    
+    // Settings dialog
+    DialogSettings* dlgSettings;
+
+    // Tab widget containing cases list and result of execution.
+    TabWidgetTestRun* tabWdgtTestRun;
+    
+    // About dialog
+    DialogMsg* dlgAbout;
+    };
+
+#endif /* MAINWINDOW_H_ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/symbianunittestui/qt/qss/coffee.qss	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,326 @@
+QWidget {
+	background-color: cornsilk;
+}
+
+QMessageBox {
+	background-color: cornsilk;
+	border-width: 2px;
+	border-style: solid;
+    border-color: darkkhaki;
+    padding: 3px;
+    font-size:12px;
+    font: bold;
+}
+
+QDialog {
+	background-color: cornsilk;
+	border-width: 2px;
+	border-style: solid;
+    border-color: darkkhaki;
+    font-size:12px;
+    font: bold;
+}
+
+QInputDialog {
+	background-color: cornsilk;
+	border-width: 2px;
+	border-style: solid;
+    border-color: darkkhaki;
+    font-size:12px;
+    font: bold;
+}
+
+
+/*QPushButton*/
+QPushButton {
+    color: #0a214c;
+    background-color: palegoldenrod;
+    border-width: 2px;
+    border-color: darkkhaki;
+    border-style: solid;
+    border-radius: 5;
+    padding: 3px;
+    min-width: 100px;
+    min-height: 32px;
+    max-width: 100px;
+    max-height: 32px;
+    font-size:16px;
+    font: bold;
+}
+
+QPushButton:hover {
+   background-color: khaki;
+}
+
+QPushButton:pressed {
+    padding-left: 2px;
+    padding-top: 2px;
+    background-color: #d0d67c;
+}
+
+
+QPushButton::disabled {
+	color: #ffffff;
+}
+
+QRadioButton {
+    font: bold;
+    font-size: 14px;
+    border: none;
+    padding: 0;
+    background-color: cornsilk;
+    color: black; 
+    background-color: cornsilk;
+    selection-color: #0a214c; 
+    selection-background-color: #C19A6B;
+}
+
+QRadioButton:focus {
+	color:black;
+	background-color: cornsilk;
+}
+
+QRadioButton:selected {
+    background-color: cornsilk;
+    color:black;
+}
+
+QRadioButton:pressed {
+    background-color: cornsilk;
+    color:black;
+}
+
+
+/*QTabQWidget*/
+QTabWidget::pane { /* The tab widget frame */
+    border-top: 2px solid #C2C7CB;
+}
+
+QTabWidget::tab-bar {
+    left: 5px; /* move to the right by 5px */
+}
+
+/* Style the tab using the tab sub-control. Note that
+    it reads QTabBar _not_ QTabWidget */
+QTabBar::tab {
+    background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,
+                                stop: 0 #E1E1E1, stop: 0.4 #DDDDDD,
+                                stop: 0.5 #D8D8D8, stop: 1.0 #D3D3D3);
+    border: 2px solid #C4C4C3;
+    border-bottom-color: #C2C7CB; /* same as the pane color */
+    border-top-left-radius: 4px;
+    border-top-right-radius: 4px;
+    /*min-width: 5ex;*/
+    padding: 2px;
+    color: #0a214c;
+    font-size:15px;
+}
+
+QTabBar::tab:selected, QTabBar::tab:hover {
+    background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,
+                                stop: 0 #fafafa, stop: 0.4 #f4f4f4,
+                                stop: 0.5 #e7e7e7, stop: 1.0 #fafafa);
+}
+
+QTabBar::tab:selected {
+    border-color: #9B9B9B;
+    border-bottom-color: #C2C7CB; /* same as pane color */
+    font: bold;
+    font-size:15px;
+}
+
+QTabBar::tab:!selected {
+    margin-top: 2px; /* make non-selected tabs look smaller */
+    font: bold;
+    font-size:14px;
+}
+
+/* make use of negative margins for overlapping tabs */
+QTabBar::tab:selected {
+    /* expand/overlap to the left and right by 4px */
+    /*
+    margin-left: -4px;
+    margin-right: -4px;
+    */
+}
+
+QTabBar::tab:first:selected {
+    margin-left: 0; /* the first selected tab has nothing to overlap with on the left */
+}
+
+QTabBar::tab:last:selected {
+    margin-right: 0; /* the last selected tab has nothing to overlap with on the right */
+}
+
+QTabBar::tab:only-one {
+    margin: 0; /* if there is only one tab, we don't want overlapping margins */
+}
+
+
+/* QLabel */
+QLabel {
+    font: bold;
+    font-size: 14px;
+    border: none;
+    padding: 0;
+    background: none;
+    color: black;
+    
+}
+
+/* QLabel */
+QCheckBox {
+    font: bold;
+    font-size: 14px;
+    border: none;
+    padding: 0;
+    background-color: cornsilk;
+    color: black; 
+    background-color: cornsilk;
+    selection-color: #0a214c; 
+    selection-background-color: #C19A6B;
+}
+
+QCheckBox::focus {
+	color:black;
+	background-color: cornsilk;
+}
+
+QCheckBox:selected {
+    background-color: cornsilk;
+    color:black;
+}
+
+QCheckBox:pressed {
+    background-color: cornsilk;
+    color:black;
+}
+
+
+QFrame {
+	background-color: cornsilk;
+}
+
+QLineEdit, QPlainTextEdit {
+	background-color: cornsilk;
+    border-width: 1px;
+    padding: 1px;
+    border-style: solid;
+    border-color: darkkhaki;
+    border-radius: 3px;
+    color:black;
+    font-size:14px;
+}
+
+QLineEdit:focus, QPlainTextEdit:focus {
+    border-width: 3px;
+    padding: 0px;
+}
+
+/*QComboBox*/
+
+QComboBox {
+    background-color: cornsilk;
+    selection-color: #0a214c; 
+    selection-background-color: #C19A6B;
+    color:black;
+    font-size:20px;
+    border-width: 1px;
+    padding: 1px;
+    border-style: solid;
+    border-color: darkkhaki;
+}
+
+/*QGroupBox*/
+QGroupBox {
+	background-color: cornsilk;
+	margin-top: 2ex;
+	border: 2px solid gray;
+	border-radius: 5px;
+	
+
+}
+
+QGroupBox::title {
+	subcontrol-origin: margin;
+	padding: 0 3px;
+	color:black;
+	font-size:14px;
+	background-color: cornsilk;
+}
+
+
+/*QTreeWidget*/
+
+QTreeWidget {
+    color: brown;
+	show-decoration-selected: 1;
+	border-width: 1px;
+    padding: 1px;
+    border-style: solid;
+    border-color: darkkhaki;
+    border-radius: 3px;
+    background-color: cornsilk;
+    selection-color: #0a214c; 
+    selection-background-color: #C19A6B;
+}
+
+QHeaderView {
+	color : black;
+	border-width: 1px;
+	padding: 1px;
+    border-style: solid;
+    border-color: darkkhaki;
+    border-radius: 3px;
+    background-color: khaki;
+}
+
+QHeaderView::section {
+	color : black;
+	border-width: 0px;
+	padding: 0px;
+    border-style: none;
+    background-color: palegoldenrod;
+}
+
+
+QTreeWidget::item{
+	height:35px;
+	font-size:20px;
+}
+
+QTreeWidget::item:hover{
+	background-color: wheat;
+}
+
+QListView {
+    color: brown;
+    show-decoration-selected: 1;
+    border-width: 1px;
+    padding: 1px;
+    border-style: solid;
+    border-color: darkkhaki;
+    border-radius: 3px;
+    background-color: cornsilk;
+    selection-color: #0a214c; 
+    selection-background-color: #C19A6B;
+    font-size:16px;
+}
+
+QListView::item:hover {
+    background-color: wheat;
+}
+
+QListView::disabled {
+	color: #ffffff;
+	background-color: gray;
+}
+
+QListView::item {
+	height:30px;
+}
+
+QErrorMessage::text {
+	color: black;
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/symbianunittestui/qt/qss/pagefold.qss	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,301 @@
+/* Customize any plain widget that is a child of a QMainWindow. */
+QMainWindow > .QWidget {
+    background-color: gainsboro;
+    background-image: url(images/pagefold.png);
+    background-position: top right;
+    background-repeat: no-repeat
+}
+
+/* Provide a padding for the layout inside the frame. The frame
+   exists only to provide a padding for the top-right image, so we
+   explicitly disable the border. */
+#mainFrame {
+    padding-right: 30px;
+    border-style: none;
+    border-image: none; /* since we set a border-image below */
+}
+
+/* mainFrame won't have this border-image since we have
+   explicitly set it to 'none' using a more specific selector. */
+QFrame, QLineEdit, QComboBox[editable="true"], QSpinBox {
+    border-image: url(images/frame.png) 4;
+    border-width: 3;
+}
+
+QLabel {
+    border: none;
+    border-image: none;
+    padding: 0;
+    background: none;
+}
+
+
+/* Make text in message boxes selectable. */
+QMessageBox {
+    /* LinksAccessibleByMouse | TextSelectableByMouse */
+    messagebox-text-interaction-flags: 5;
+}
+   
+/* Set the selection colors for all widgets. */
+QWidget {
+    selection-color: black;
+    selection-background-color: Silver;
+    color: black;
+}
+
+/* Make the entire row selected in item views. */
+QAbstractItemView {
+    show-decoration-selected: 1;
+}
+
+/* Nice WindowsXP-style password character for password line edits. */
+QLineEdit[echoMode="2"] {
+    lineedit-password-character: 9679;
+}
+
+/* Customize tooltips. */
+QToolTip {
+    background-color: rgb(200,200,255);
+    border-color: darkslategray;
+    border-width: 1px;
+    border-style: solid;
+    padding: 3px;
+    font: bold;
+    border-radius: 3px;
+    opacity: 200;
+}
+
+/* Customize radio buttons. */
+
+QRadioButton {
+    spacing: 5px;
+}
+
+QRadioButton::indicator {
+    width: 13px;
+    height: 13px;
+}
+
+QRadioButton::indicator::unchecked {
+    image: url(images/radiobutton_unchecked.png);
+}
+
+QRadioButton::indicator:unchecked:hover {
+    image: url(images/radiobutton_unchecked_hover.png);
+}
+
+QRadioButton::indicator:unchecked:pressed {
+    image: url(images/radiobutton_unchecked_pressed.png);
+}
+
+QRadioButton::indicator::checked {
+    image: url(images/radiobutton_checked.png);
+}
+
+QRadioButton::indicator:checked:hover {
+    image: url(images/radiobutton_checked_hover.png);
+}
+
+QRadioButton::indicator:checked:pressed {
+    image: url(images/radiobutton_checked_pressed.png);
+}
+
+/* Customize arrows. */
+
+*::down-arrow, *::menu-indicator {
+    image: url(images/down_arrow.png);
+    width: 7px;
+    height: 7px;
+}
+
+*::down-arrow:disabled, *::down-arrow:off {
+   image: url(images/down_arrow_disabled.png);
+}
+
+*::up-arrow {
+    image: url(images/up_arrow.png);
+    width: 7px;
+    height: 7px;
+}
+
+*::up-arrow:disabled, *::up-arrow:off {
+   image: url(images/up_arrow_disabled.png);
+}
+
+/* Customize push buttons and comboboxes. Our read-only combobox
+   is very similar to a push button, so they share the same border image. */
+
+QPushButton {
+    min-width: 4em;
+}
+
+QPushButton, QComboBox[editable="false"],
+QComboBox[editable="true"]::drop-down {
+    border-image: url(images/pushbutton.png) 5;
+    border-width: 5;
+}
+
+QPushButton:hover, QComboBox[editable="false"]:hover,
+QComboBox[editable="true"]::drop-down:hover, QMenuBar::item:hover {
+    border-image: url(images/pushbutton_hover.png) 5;
+    border-width: 5;
+}
+
+QPushButton:pressed, QComboBox[editable="false"]:on,
+QComboBox[editable="true"]::drop-down:on, QMenuBar::item:on {
+    border-image: url(images/pushbutton_pressed.png) 5;
+    border-width: 5;
+}
+
+/* Customize read-only comboboxes. */
+
+QComboBox[editable="false"] {
+    padding-left: 3px;
+    padding-right: 20px; /* space for the arrow */
+}
+
+QComboBox[editable="false"]::drop-down {
+    subcontrol-origin: padding;
+    subcontrol-position: top right;
+    width: 15px;
+    border-left-style: solid;
+    border-left-color: darkgray;
+    border-left-width: 1px;
+}
+
+QComboBox[editable="false"]::down-arrow {
+    subcontrol-origin: content;
+    subcontrol-position: center;
+    position: relative;
+    left: 1px; /* 1 pixel dropdown border */
+}
+
+/* The combobox arrow is on when the popup is open. */
+QComboBox[editable="false"]::down-arrow:on {
+    position: relative;
+    top: 1px;
+    left: 2px;
+}
+
+/* Customize editable comboboxes. */
+
+QComboBox[editable="true"] {
+    padding-right: 16px;
+}
+
+QComboBox[editable="true"]::drop-down {
+    subcontrol-origin: border;
+    subcontrol-position: top right;
+    width: 13px;
+    position: absolute;
+    top: 2px;
+    bottom: 2px;
+    right: 2px;
+}
+
+QComboBox[editable="true"]::drop-down,
+QComboBox[editable="true"]::drop-down:hover,
+QComboBox[editable="true"]::drop-down:on {
+    border-width: 0px;  
+    border-left-width: 3px; /* we need only left and center part */
+}
+
+/* Shift the arrow when it's open. */
+QComboBox[editable="true"]::down-arrow:on {
+    position: relative;
+    top: 1px;
+    left: 1px;
+}
+
+/* Customize check boxes. */
+QCheckBox {
+    spacing: 5px;
+}
+
+QCheckBox::indicator {
+    width: 13px;
+    height: 13px;
+}
+
+QCheckBox::indicator:unchecked {
+    image: url(images/checkbox_unchecked.png);
+}
+
+QCheckBox::indicator:unchecked:hover {
+    image: url(images/checkbox_unchecked_hover.png);
+}
+
+QCheckBox::indicator:unchecked:pressed {
+    image: url(images/checkbox_unchecked_pressed.png);
+}
+
+QCheckBox::indicator:checked {
+    image: url(images/checkbox_checked.png);
+}
+
+QCheckBox::indicator:checked:hover {
+    image: url(images/checkbox_checked_hover.png);
+}
+
+QCheckBox::indicator:checked:pressed {
+    image: url(images/checkbox_checked_pressed.png);
+}
+
+/* Customize the size grip. */
+QSizeGrip {
+    image: url(images/sizegrip.png);
+    width: 16px;
+    height: 16px;
+}
+
+/* Customize the menu bar. */
+QMenuBar {
+    border-image: none;
+    border-style: none;
+    border-width: 1px;
+    border-bottom-style: solid;
+    border-bottom-color: darkslategray;
+    padding: 2px;
+}
+
+/* Customize spin boxes. */
+
+QSpinBox { 
+    padding-right: 15px;
+}
+
+QSpinBox::up-button {
+    subcontrol-origin: border;
+    subcontrol-position: top right;
+
+    width: 16px; /* 16 + 2*1px border-width = 15px padding + 3px parent border */
+    border-image: url(images/spinup.png) 1;
+    border-width: 1px;
+}
+
+QSpinBox::up-button:hover {
+    border-image: url(images/spinup_hover.png) 1;
+}
+
+QSpinBox::up-button:pressed {
+    border-image: url(images/spinup_pressed.png) 1;
+}
+
+QSpinBox::down-button {
+    subcontrol-origin: border;
+    subcontrol-position: bottom right;
+
+    width: 16px;
+    border-image: url(images/spindown.png) 1;
+    border-width: 1px;
+    border-top-width: 0;
+}
+
+QSpinBox::down-button:hover {
+    border-image: url(images/spindown_hover.png) 1;
+}
+
+QSpinBox::down-button:pressed {
+    border-image: url(images/spindown_pressed.png) 1;
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/symbianunittestui/qt/rom/sutui.iby	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,27 @@
+// 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:
+// An iby file for symbianunittest UI
+// 
+//
+
+#ifndef __SUT_UI_IBY__
+#define __SUT_UI_IBY__
+
+
+S60_APP_EXE(symbianunittestqt)
+S60_APP_RESOURCE(symbianunittestqt)
+data=EPOCROOT##epoc32\data\z\private\10003a3f\import\apps\symbianunittestqt_reg.rsc private\10003a3f\import\apps\symbianunittestqt_reg.rsc
+
+#endif __SUT_UI_IBY__
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/symbianunittestui/qt/settings.cpp	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,42 @@
+/*
+ * 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: settings
+ *
+ */
+
+#include "settings.h"
+
+Settings::Settings() :
+    timeout(0), memAllocFailureSim(false), outputFormat(QString::null)
+    {
+    }
+
+Settings::Settings(int timeoutVal, bool memAllocFailureSimVal,
+        QString outputFormatVal) :
+    timeout(timeoutVal), memAllocFailureSim(memAllocFailureSimVal),
+            outputFormat(outputFormatVal)
+    {
+
+    }
+
+Settings::~Settings()
+    {
+    }
+
+bool Settings::isEqual(const Settings& settings)
+    {
+    return timeout == settings.timeout
+            && outputFormat.compare(settings.outputFormat) == 0
+            && !memAllocFailureSim == !settings.memAllocFailureSim;
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/symbianunittestui/qt/settings.h	Wed Aug 25 15:45:01 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: settings
+ *
+ */
+
+
+#ifndef SETTINGS_H_
+#define SETTINGS_H_
+#include <QString>
+class Settings
+    {
+public:
+    Settings();
+    Settings(int timeout, bool memAllocFailureSim, QString outputFormat);
+    ~Settings();
+    bool isEqual(const Settings& settings);
+public:
+    // Data
+    int timeout;
+    bool memAllocFailureSim;
+    QString outputFormat;
+    };
+
+#endif /* SETTINGS_H_ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/symbianunittestui/qt/symbianunittestqt.pro	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,42 @@
+HEADERS += mainwindow.h \
+		dialogaddtests.h \
+		tabwidgettestrun.h \
+		widgettestrunner.h \
+		dialogsettings.h \
+		settings.h \
+		testitemlist.h \
+		dialogmsg.h
+		
+SOURCES += main.cpp \
+		mainwindow.cpp \
+		dialogaddtests.cpp \
+		tabwidgettestrun.cpp \
+		widgettestrunner.cpp \
+		dialogsettings.cpp \
+		settings.cpp \
+		testitemlist.cpp \
+		dialogmsg.cpp
+
+RESOURCES += symbianunittestqt.qrc
+symbian { 
+    TARGET.UID3 = 0x2002EA7F
+    TARGET.EPOCALLOWDLLDATA = 1
+    INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE 
+    INCLUDEPATH += /epoc32/include/mw
+    INCLUDEPATH += /epoc32/include/platform
+    INCLUDEPATH += /epoc32/include/platform/sutinternal
+    HEADERS += testrunner_s60.h
+    SOURCES += testrunner_s60.cpp
+    LIBS += -leuser \
+        -lefsrv \
+        -lsymbianunittestfw \
+        -lbafl
+    TARGET.CAPABILITY = AllFiles \
+        CommDD
+    
+    # Export headers to SDK Epoc32/include directory
+    deploy.path = $$EPOCROOT
+    BLD_INF_RULES.prj_exports += "$${LITERAL_HASH}include <platform_paths.hrh>"
+    BLD_INF_RULES.prj_exports += "rom/sutui.iby CORE_IBY_EXPORT_PATH(tools,sutui.iby)"
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/symbianunittestui/qt/symbianunittestqt.qrc	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,6 @@
+<!DOCTYPE RCC>
+<RCC version="1.0">
+	<qresource prefix="/">
+	<file>./qss/coffee.qss</file>
+	</qresource>
+</RCC>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/symbianunittestui/qt/tabwidgettestrun.cpp	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,568 @@
+/*
+ * 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: TabWidget class to select, run tests and show the result.
+ *
+ */
+
+#include <QPushButton>
+#include <QWidget>
+#include <QTreeWidget>
+#include <QTreeWidgetItem>
+#include <QTableWidget>
+#include <QGridLayout>
+#include <QLabel>
+#include <QProgressBar>
+#include <QPalette>
+#include <QTableWidgetItem>
+#include <QHeaderView>
+#include "tabwidgettestrun.h"
+#include "widgettestrunner.h"
+#include "settings.h"
+#include "testitemlist.h"
+#include "dialogmsg.h"
+
+static const QString TOTAL = "Total: %1";
+static const QString PASSED = "Passed: %1";
+static const QString FAILED = "Failed: %1";
+static const QString ERRORSUMMARY = "Error summary";
+static const QString NAME = "Case Name";
+static const QString REASON = "Reason";
+static const int FONTPIXELSIZE = 12;
+static const int FONTPIXELSIZE_ITEM = 15;
+static const int FONTPIXELSIZE_SUBITEM = 10;
+static const QString CASELIST = "Cases List";
+static const QString UNMARKED = "  ";
+static const QString MARKED = "* ";
+static const QString PARTIALLY_MARKED = "# ";
+static const int MARK_LEN = MARKED.length();
+static const QString CPP_SCOPE_OP = "::";
+static const QString EXPAND = "Expand";
+static const QString EXPAND_ALL = "Expand All";
+static const QString COLLAPSE = "Collapse";
+static const QString COLLAPSE_ALL = "Collapse All";
+
+TabWidgetTestRun::TabWidgetTestRun(QWidget* parent) :
+    QTabWidget(parent)
+    {
+    setContextMenuPolicy(Qt::NoContextMenu);
+    listTestItems = new TestItemList();
+    listSelectedTestItems = new TestItemList();
+    load();
+    dlgErrMsg = new DialogMsg(this);
+    connect(testRunner, SIGNAL(errorOccurred(const QString)), dlgErrMsg, SLOT(showMsg(const QString)));
+    }
+
+TabWidgetTestRun::~TabWidgetTestRun()
+    {
+    delete listTestItems;
+    listTestItems = NULL;
+    delete listSelectedTestItems;
+    listSelectedTestItems = NULL;
+    }
+
+void TabWidgetTestRun::createTestsTab()
+    {
+    tabTests = new QWidget(this);
+    createTreeWidgetTests();
+    this->addTab(tabTests, tr("Test Cases"));
+    }
+
+void TabWidgetTestRun::createExecutionTab()
+    {
+    tabRunner = new QTabWidget(this);
+    createExecutionWidgets();
+    this->addTab(tabRunner, tr("Execution"));
+    }
+
+void TabWidgetTestRun::createExecutionWidgets()
+    {
+    labelTotal = new QLabel(tabRunner);
+    labelTotal->setText(TOTAL.arg(0));
+    labelPassed = new QLabel(tabRunner);
+    labelPassed->setText(PASSED.arg(0));
+    labelFailed = new QLabel(tabRunner);
+    labelFailed->setText(FAILED.arg(0));
+
+    labelErrorSummary = new QLabel(tabRunner);
+    labelErrorSummary->setText(ERRORSUMMARY);
+    tblWdgtErrorSummary = new QTableWidget(tabRunner);
+    tblWdgtErrorSummary->setColumnCount(2);
+    tblWdgtErrorSummary->setColumnWidth(0, 200);
+
+    QTableWidgetItem* itemName = new QTableWidgetItem();
+    tblWdgtErrorSummary->setHorizontalHeaderItem(0, itemName);
+    QTableWidgetItem* itemReason = new QTableWidgetItem();
+    tblWdgtErrorSummary->setHorizontalHeaderItem(1, itemReason);
+    tblWdgtErrorSummary->horizontalHeaderItem(0)->setText(NAME);
+    tblWdgtErrorSummary->horizontalHeaderItem(1)->setText(REASON);
+    tblWdgtErrorSummary->setShowGrid(true);
+    tblWdgtErrorSummary->setSortingEnabled(false);
+    tblWdgtErrorSummary->horizontalHeader()->setStretchLastSection(true);
+    testRunner = new WidgetTestRunner(tabRunner);
+    testRunner->setHidden(true);
+    progressBarExecuting = new QProgressBar(tabRunner);
+    progressBarExecuting->setHidden(true);
+    }
+
+void TabWidgetTestRun::setTabPageExecutionLayout()
+    {
+    QWidget* labelsWidget = new QWidget(tabRunner);
+    QGridLayout* labelsLayout = new QGridLayout(tabRunner);
+
+    labelsLayout->addWidget(labelPassed, 0, 0);
+    labelsLayout->addWidget(labelFailed, 0, 1);
+    labelsLayout->addWidget(labelTotal, 0, 2);
+    labelsWidget->setLayout(labelsLayout);
+
+    QGridLayout* layout = new QGridLayout(tabRunner);
+    layout->addWidget(labelsWidget, 0, 0);
+    layout->addWidget(progressBarExecuting, 1, 0);
+    layout->addWidget(labelErrorSummary, 2, 0);
+    layout->addWidget(tblWdgtErrorSummary, 3, 0);
+    tabRunner->setLayout(layout);
+    }
+
+void TabWidgetTestRun::load()
+    {
+    createTestsTab();
+    setupTestsTabEventHandlers();
+    setTabPageTestsLayout();
+    createExecutionTab();
+    setTabPageExecutionLayout();
+    setupRunnerEventHandlers();
+    }
+
+void TabWidgetTestRun::createTreeWidgetTests()
+    {
+    treeWdgtTests = new QTreeWidget(tabTests);
+    treeWdgtTests->headerItem()->setText(0, CASELIST);
+    btnRun = new QPushButton(tr("Run"), tabTests);
+    btnExpandCollapse = new QPushButton(tr("Expand"), tabTests);
+    // Disable buttons on startup
+    btnRun->setEnabled(false);
+
+    btnExpandCollapse->setEnabled(false);
+    }
+
+void TabWidgetTestRun::setTabPageTestsLayout()
+    {
+    QWidget* btnsWidget = new QWidget(tabTests);
+    QGridLayout* btnsLayout = new QGridLayout(tabTests);
+    btnsLayout->addWidget(btnRun, 0, 0);
+    btnsLayout->addWidget(btnExpandCollapse, 0, 1);
+    btnsWidget->setLayout(btnsLayout);
+
+    QGridLayout* layout = new QGridLayout(tabTests);
+    layout->addWidget(treeWdgtTests, 0, 0);
+    layout->addWidget(btnsWidget, 1, 0);
+
+    tabTests->setLayout(layout);
+    }
+
+void TabWidgetTestRun::setTotal(int num)
+    {
+    labelTotal->setText(TOTAL.arg(num));
+    labelTotal->repaint();
+    }
+
+void TabWidgetTestRun::setPassed(int num)
+    {
+    labelPassed->setText(PASSED.arg(num));
+    labelPassed->repaint();
+    }
+
+void TabWidgetTestRun::setFailed(QString name, QString reason, int num)
+    {
+    labelFailed->setText(FAILED.arg(num));
+    labelFailed->repaint();
+    int curRow = tblWdgtErrorSummary->rowCount();
+    tblWdgtErrorSummary->insertRow(curRow);
+    QTableWidgetItem* itemName = new QTableWidgetItem(name);
+    QTableWidgetItem* itemReason = new QTableWidgetItem(reason);
+    tblWdgtErrorSummary->setItem(curRow, 0, itemName);
+    tblWdgtErrorSummary->setItem(curRow, 1, itemReason);
+    QFont font;
+    font.setPixelSize(FONTPIXELSIZE);
+    itemName->setFont(font);
+    itemReason->setFont(font);
+    }
+
+void TabWidgetTestRun::resetTreeWidget()
+    {
+    for(int i = treeWdgtTests->topLevelItemCount() -1; i >= 0; --i)
+        {
+        delete treeWdgtTests->topLevelItem(i);
+        }
+    treeWdgtTests->clear();
+    }
+
+void TabWidgetTestRun::resetTestItemList()
+    {
+    listTestItems->removeAll();
+    listSelectedTestItems->removeAll();
+    }
+
+void TabWidgetTestRun::addTests(QStringList testCases)
+    {
+    resetTestItemList();
+    resetTreeWidget();
+    QFont font, subItemFont;
+    font.setPixelSize(FONTPIXELSIZE_ITEM);
+    subItemFont.setPixelSize(FONTPIXELSIZE_SUBITEM);
+    QStringList fetchedCaseNames;
+    QTreeWidgetItem* item = NULL;
+    QTreeWidgetItem* subItem = NULL;
+    foreach (QString dllName, testCases)
+            {
+            if (listTestItems->exists(dllName))
+                {
+                continue;
+                }
+            
+            fetchedCaseNames.clear();
+            if (testRunner->listTestCases(dllName, fetchedCaseNames) != 0)
+                {
+                continue;
+                }
+            item = new QTreeWidgetItem(treeWdgtTests);
+            item->setFlags(Qt::ItemIsUserCheckable | Qt::ItemIsSelectable
+                    | Qt::ItemIsEnabled);
+            item->setText(0, UNMARKED + dllName);
+            item->setFont(0, font);
+            
+            foreach(QString testCase, fetchedCaseNames)
+                    {
+                    subItem = new QTreeWidgetItem(item);
+                    subItem->setText(0, UNMARKED + testCase/*getFuncName(testCase)*/);
+                    subItem->setFont(0, subItemFont);
+                    }
+            listTestItems->addItemExclusively(dllName, fetchedCaseNames);
+            }
+
+    if (treeWdgtTests->topLevelItemCount() > 0)
+        {
+        treeWdgtTests->setCurrentItem(treeWdgtTests->topLevelItem(0));
+        treeWdgtTests->resizeColumnToContents(0);
+        if (this->currentWidget() != tabTests)
+            {
+            this->setCurrentWidget(tabTests);
+            }
+        treeWdgtTests->setFocus();
+        btnRun->setEnabled(false);
+        btnExpandCollapse->setEnabled(true);
+        emit this->testsAdded();
+        }
+    }
+
+QString TabWidgetTestRun::getFuncName(const QString& caseName)
+    {
+    int index = caseName.indexOf(CPP_SCOPE_OP, 0);
+    return caseName.right(caseName.length() - index - CPP_SCOPE_OP.length());
+    }
+
+void TabWidgetTestRun::setupRunnerEventHandlers()
+    {
+    connect(this, SIGNAL(currentChanged(int)), this,
+            SLOT(changeCurrentTab(int)));
+    connect(btnRun, SIGNAL(clicked()), this, SLOT(runTests()));
+    connect(btnExpandCollapse, SIGNAL(clicked()), this,
+            SLOT(expandCollapseItem()));
+    connect(this, SIGNAL(testRun()), testRunner, SLOT(runTests()));
+    connect(testRunner, SIGNAL(testExecuted(int)), progressBarExecuting,
+            SLOT(setValue(int)));
+    connect(testRunner, SIGNAL(testPassed(int)), this, SLOT(setPassed(int)));
+    connect(testRunner, SIGNAL(testFailed(QString, QString, int)), this,
+            SLOT(setFailed(QString, QString, int)));
+    }
+
+void TabWidgetTestRun::runTests()
+    {
+    if (this->currentWidget() != tabRunner)
+        {
+        this->setCurrentWidget(tabRunner);
+        }
+    tblWdgtErrorSummary->clearContents();
+    tblWdgtErrorSummary->setRowCount(0);
+    testRunner->addTestDllNames(listSelectedTestItems->items());
+    testRunner->addTestCaseNames(listSelectedTestItems->subItems());
+    progressBarExecuting->setEnabled(true);
+    progressBarExecuting->show();
+    progressBarExecuting->setMaximum(
+            listSelectedTestItems->subItems().count());
+    progressBarExecuting->setValue(0);
+    labelTotal->setText(TOTAL.arg(listSelectedTestItems->subItems().count()));
+    labelPassed->setText(PASSED.arg(0));
+    labelFailed->setText(FAILED.arg(0));
+    emit this->testRun();
+    progressBarExecuting->setEnabled(false);
+    }
+
+void TabWidgetTestRun::changeCurrentTab(int index)
+    {
+    if (this->widget(index) == tabTests)
+        {
+        treeWdgtTests->setFocus();
+        emit this->currentTabChangedToTests(!listTestItems->empty());
+        }
+    else
+        {
+        tblWdgtErrorSummary->setFocus();
+        emit this->currentTabChangedToExecution();
+        }
+    }
+
+void TabWidgetTestRun::setupTestsTabEventHandlers()
+    {
+    connect(treeWdgtTests, SIGNAL(itemClicked(QTreeWidgetItem* , int)), this,
+            SLOT(selectDeselectTestCases(QTreeWidgetItem* , int)));
+    connect(treeWdgtTests,
+            SIGNAL(currentItemChanged(QTreeWidgetItem*, QTreeWidgetItem*)),
+            this, SLOT(changeCurItem(QTreeWidgetItem*, QTreeWidgetItem*)));
+    connect(treeWdgtTests, SIGNAL(itemExpanded(QTreeWidgetItem*)), this,
+            SLOT(setBtnExpandCollapseEnabled(QTreeWidgetItem*)));
+    connect(treeWdgtTests, SIGNAL(itemCollapsed(QTreeWidgetItem*)), this,
+            SLOT(setBtnExpandCollapseEnabled(QTreeWidgetItem*)));
+    }
+
+void TabWidgetTestRun::changeCurItem(QTreeWidgetItem* cur, QTreeWidgetItem*/* prev*/)
+    {
+    if (cur != NULL)
+        {
+        setBtnExpandCollapseEnabled(cur);
+        emit this->selectedTestsChanged(listSelectedTestItems->empty(),
+                isAllCasesSelected(),
+                cur->text(treeWdgtTests->currentColumn()).contains(MARKED));
+        }
+    }
+
+void TabWidgetTestRun::selectCurrentCase()
+    {
+    QString itemName = treeWdgtTests->currentItem()->text(
+            treeWdgtTests->currentColumn());
+    if (itemName.contains(UNMARKED))
+        {
+        selectDeselectTestCases(treeWdgtTests->currentItem(),
+                treeWdgtTests->currentColumn());
+        }
+    }
+
+void TabWidgetTestRun::selectAllCases()
+    {
+    for (int i = 0; i < treeWdgtTests->topLevelItemCount(); ++i)
+        {
+        QString itemName = treeWdgtTests->topLevelItem(i)->text(
+                treeWdgtTests->currentColumn());
+        if (itemName.contains(UNMARKED)
+                || itemName.contains(PARTIALLY_MARKED))
+            {
+            // Deselect current first
+            if (itemName.contains(PARTIALLY_MARKED))
+                {
+                deselectCase(treeWdgtTests->topLevelItem(i),
+                        treeWdgtTests->currentColumn());
+                }
+            selectDeselectTestCases(treeWdgtTests->topLevelItem(i),
+                    treeWdgtTests->currentColumn());
+            }
+        }
+    }
+
+void TabWidgetTestRun::deselectCase(QTreeWidgetItem* item, int column)
+    {
+    QString itemName = item->text(column);
+    if (itemName.contains(MARKED) || itemName.contains(PARTIALLY_MARKED))
+        {
+        selectDeselectTestCases(item, column);
+        }
+    }
+
+void TabWidgetTestRun::deselectCurrentCase()
+    {
+    deselectCase(treeWdgtTests->currentItem(), treeWdgtTests->currentColumn());
+    }
+
+void TabWidgetTestRun::deselectAllCases()
+    {
+    for (int i = 0; i < treeWdgtTests->topLevelItemCount(); ++i)
+        {
+        QString itemName = treeWdgtTests->topLevelItem(i)->text(
+                treeWdgtTests->currentColumn());
+        if (itemName.contains(MARKED) || itemName.contains(PARTIALLY_MARKED))
+            {
+            selectDeselectTestCases(treeWdgtTests->topLevelItem(i),
+                    treeWdgtTests->currentColumn());
+            }
+        }
+    }
+
+void TabWidgetTestRun::saveSettings(const Settings* settings)
+    {
+    testRunner->saveSettings(settings);
+    }
+
+QString& TabWidgetTestRun::removeMark(QString& src)
+    {
+    return src.remove(MARKED).remove(UNMARKED).remove(PARTIALLY_MARKED);
+    }
+
+void TabWidgetTestRun::selectDeselectTestCases(QTreeWidgetItem* item,
+        int column)
+    {
+    QString itemName = item->text(column);
+    QTreeWidgetItem* subItem;
+    QString subName;
+    if (treeWdgtTests->indexOfTopLevelItem(item) != -1)
+        {
+        // Top level item
+        // Marked. Unmark them.        
+        if (itemName.contains(MARKED) || itemName.contains(PARTIALLY_MARKED))
+            {
+            item->setText(column, itemName.replace(0, MARK_LEN, UNMARKED));
+            listSelectedTestItems->removeItem(removeMark(itemName));
+            for (int i = 0; i < item->childCount(); ++i)
+                {
+                subItem = item->child(i);
+                subName = subItem->text(column);
+                if (subName.contains(MARKED))
+                    {
+                    subItem->setText(column, subName.replace(0, MARK_LEN,
+                            UNMARKED));
+                    }
+                }
+            }
+        // Unmarked. Mark them.
+        else
+            {
+            QStringList subNames;
+            for (int i = 0; i < item->childCount(); ++i)
+                {
+                subItem = item->child(i);
+                subName = subItem->text(column);
+                subItem->setText(column, subName.replace(0, MARK_LEN, MARKED));
+                subNames << removeMark(subName);
+                }
+            item->setText(column, itemName.replace(0, MARK_LEN, MARKED));
+            listSelectedTestItems->addItemExclusively(removeMark(itemName),
+                    subNames);
+            }
+        }
+    else
+        {
+        // Child item
+        // Marked. Unmark it.
+        QTreeWidgetItem* parentItem = item->parent();
+        QString parentItemName = parentItem->text(column);
+        if (itemName.contains(MARKED))
+            {
+            item->setText(column, itemName.replace(0, MARK_LEN, UNMARKED));
+            listSelectedTestItems->removeOneSubItem(
+                    removeMark(parentItemName), removeMark(itemName));
+            int i = 0;
+            for (; i < parentItem->childCount(); ++i)
+                {
+                if (parentItem->child(i)->text(column).contains(MARKED))
+                    {
+                    parentItem->setText(column,
+                            parentItem->text(column).replace(0, MARK_LEN,
+                                    PARTIALLY_MARKED));
+                    break;
+                    }
+                }
+            if (i == parentItem->childCount())
+                {
+                parentItem->setText(column, parentItem->text(column).replace(
+                        0, MARK_LEN, UNMARKED));
+                }
+            }
+        // Unmakred. Mark it.
+        else
+            {
+            item->setText(column, itemName.replace(0, MARK_LEN, MARKED));
+            listSelectedTestItems->addOneSubItem(removeMark(parentItemName),
+                    removeMark(itemName));
+            int i = 0;
+            for (; i < parentItem->childCount(); ++i)
+                {
+                if (parentItem->child(i)->text(column).contains(UNMARKED))
+                    break;
+                }
+            if (i < parentItem->childCount())
+                {
+                parentItem->setText(column, parentItem->text(column).replace(
+                        0, MARK_LEN, PARTIALLY_MARKED));
+                }
+            else
+                {
+                parentItem->setText(column, parentItem->text(column).replace(
+                        0, MARK_LEN, MARKED));
+                }
+            }
+        }
+    btnRun->setEnabled(!listSelectedTestItems->empty());
+    emit this->selectedTestsChanged(listSelectedTestItems->empty(),
+            isAllCasesSelected(), item->text(column).contains(MARKED));
+    }
+
+void TabWidgetTestRun::setBtnExpandCollapseEnabled(QTreeWidgetItem* item)
+    {
+    if (treeWdgtTests->indexOfTopLevelItem(item) == -1)
+        {
+        btnExpandCollapse->setEnabled(false);
+        }
+    else
+        {
+        btnExpandCollapse->setEnabled(true);
+        if (item == treeWdgtTests->currentItem())
+            {
+            btnExpandCollapse->setText(item->isExpanded() ? COLLAPSE : EXPAND);
+            }
+        }
+    }
+
+void TabWidgetTestRun::expandCollapseItem()
+    {
+    QTreeWidgetItem* cur = treeWdgtTests->currentItem();
+    cur->setExpanded(!cur->isExpanded());
+    btnExpandCollapse->setText(cur->isExpanded() ? COLLAPSE : EXPAND);
+    }
+
+bool TabWidgetTestRun::isAllCasesSelected()
+    {
+    return listSelectedTestItems->isEqual(listTestItems);
+    }
+
+void TabWidgetTestRun::pressLeftArrow()
+    {
+    // TODO
+    }
+
+void TabWidgetTestRun::pressRightArrow()
+    {
+    // TODO
+    }
+
+void TabWidgetTestRun::pressUpArrow()
+    {
+    // TODO
+    }
+
+void TabWidgetTestRun::pressDownArrow()
+    {
+    // TODO
+    }
+
+void TabWidgetTestRun::pressEnter()
+    {
+    // TODO
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/symbianunittestui/qt/tabwidgettestrun.h	Wed Aug 25 15:45:01 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: widget class to run tests.
+ *
+ */
+
+#ifndef TABWIDGETTESTRUN_H_
+#define TABWIDGETTESTRUN_H_
+#include <QTabWidget>
+#include <QList>
+
+class QPushButton;
+class QWidget;
+class QTreeWidget;
+class QTableWidget;
+class QTreeWidgetItem;
+class QLabel;
+class WidgetTestRunner;
+class QProgressBar;
+class Settings;
+class TestItemList;
+class DialogMsg;
+
+class TabWidgetTestRun : public QTabWidget
+    {
+Q_OBJECT
+
+public:
+    TabWidgetTestRun(QWidget* parent = 0);
+    virtual ~TabWidgetTestRun();
+
+protected slots:
+    void addTests(QStringList testCases);
+    void saveSettings(const Settings*);
+    void changeCurrentTab(int index);
+
+private:
+    void createTestsTab();
+    void createExecutionTab();
+    void load();
+    void createTreeWidgetTests();
+    void setTabPageTestsLayout();
+    void createExecutionWidgets();
+    void setTabPageExecutionLayout();
+    void setupRunnerEventHandlers();
+    void setupTestsTabEventHandlers();
+    bool isAllCasesSelected();
+    QString getFuncName(const QString& caseName);
+    QString& removeMark(QString&);
+    void resetTreeWidget();
+    void resetTestItemList();
+
+signals:
+    void testsAdded();
+    void testRun();
+    void currentTabChangedToTests(bool hasTests);
+    void currentTabChangedToExecution();
+    void selectedTestsChanged(bool, bool, bool);
+
+private slots:
+    void setTotal(int num);
+    void setPassed(int num);
+    void setFailed(QString name, QString reason, int num);
+    void runTests();
+    void selectCurrentCase();
+    void selectAllCases();
+    void deselectCurrentCase();
+    void deselectAllCases();
+    void selectDeselectTestCases(QTreeWidgetItem* item, int column);
+    void changeCurItem(QTreeWidgetItem*, QTreeWidgetItem*);
+    void deselectCase(QTreeWidgetItem* item, int column);
+    void setBtnExpandCollapseEnabled(QTreeWidgetItem*);
+    void expandCollapseItem();
+    
+    // Key press event received
+    void pressLeftArrow();
+    void pressRightArrow();
+    void pressUpArrow();
+    void pressDownArrow();
+    void pressEnter();
+
+private:
+    // Widgets on "test cases" tab
+    QPushButton*    btnRun;
+    QPushButton*    btnExpandCollapse;
+    QTreeWidget*    treeWdgtTests;
+    QWidget*        tabTests;
+
+    // Widgets on "execution" tab
+    QWidget*        tabRunner;
+    QTableWidget*   tblWdgtErrorSummary;
+    QProgressBar*   progressBarExecuting;
+    QLabel*         labelTotal;
+    QLabel*         labelPassed;
+    QLabel*         labelFailed;
+    QLabel*         labelErrorSummary;
+
+    // Test runner widget
+    WidgetTestRunner* testRunner;
+    
+    // Test cases    
+    TestItemList* listTestItems;
+    TestItemList* listSelectedTestItems;
+    
+    // Error msg dialog
+    DialogMsg* dlgErrMsg;
+    };
+
+#endif /* TABWIDGETTESTRUN_H_ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/symbianunittestui/qt/testitemlist.cpp	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,202 @@
+/*
+ * 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: class to setup mapping of individual test cases and dll files.
+ *
+ */
+
+#include "testitemlist.h"
+
+TestItemList::TestItemList()
+    {
+    }
+
+TestItemList::~TestItemList()
+    {
+    removeAll();
+    }
+
+void TestItemList::removeAll()
+    {
+    for (QList<TestItem*>::iterator iter = listItems.begin(); iter
+            < listItems.end(); ++iter)
+        {
+        delete (*iter);
+        }
+    listItems.clear();
+    }
+
+bool TestItemList::findItem(const QString& item, TestItem*& testItem) const
+    {
+    for (QList<TestItem*>::const_iterator iter = listItems.begin(); iter
+            < listItems.end(); ++iter)
+        {
+        if ((*iter)->itemName.compare(item) == 0)
+            {
+            testItem = *iter;
+            return true;
+            }
+        }
+    return false;
+    }
+
+void TestItemList::removeItem(const QString& item)
+    {
+    TestItem* temp;
+    if (findItem(item, temp))
+        {
+        listItems.removeOne(temp);
+        delete temp;
+        }
+    }
+
+void TestItemList::removeOneSubItem(const QString& item,
+        const QString& subItem)
+    {
+    TestItem* temp;
+    if (findItem(item, temp))
+        {
+        temp->subItemNames.removeOne(subItem);
+        if (temp->subItemNames.count() == 0)
+            {
+            removeItem(item);
+            }
+        }
+    }
+
+void TestItemList::addItemExclusively(const QString& item,
+        const QStringList& subItem)
+    {
+    TestItem* temp;
+    if (!findItem(item, temp))
+        {
+        listItems.append(new TestItem(item, subItem));
+        }
+    }
+
+void TestItemList::addItemExclusively(const QString& item)
+    {
+    TestItem* temp;
+    if (!findItem(item, temp))
+        {
+        QStringList subItem;
+        listItems.append(new TestItem(item, subItem));
+        }
+    }
+
+void TestItemList::addOneSubItem(const QString& item, const QString& subItem)
+    {
+    TestItem* temp;
+    if (!findItem(item, temp))
+        {
+        QStringList subItems;
+        subItems << subItem;
+        addItemExclusively(item, subItems);
+        }
+    else if (!temp->subItemNames.contains(subItem))
+        {
+        (temp->subItemNames) << subItem;
+        }
+    }
+
+int TestItemList::count() const
+    {
+    return listItems.count();
+    }
+
+QStringList TestItemList::items() const
+    {
+    QStringList temp;
+    for (QList<TestItem*>::const_iterator iter = listItems.begin(); iter
+            < listItems.end(); ++iter)
+        {
+        temp << (*iter)->itemName;
+        }
+    return temp;
+    }
+
+QStringList TestItemList::subItems() const
+    {
+    QStringList temp;
+    for (QList<TestItem*>::const_iterator iter = listItems.begin(); iter
+            < listItems.end(); ++iter)
+        {
+        temp << (*iter)->subItemNames;
+        }
+    return temp;
+    }
+
+bool TestItemList::empty() const
+    {
+    return listItems.count() == 0;
+    }
+
+bool TestItemList::exists(const QString& itemName) const
+    {
+    TestItem* temp;
+    return findItem(itemName, temp);
+    }
+
+bool TestItemList::isEqual(const TestItemList* itemList)
+    {
+    bool ret = this->count() == itemList->count();
+    if (ret)
+        {
+        QStringList subItems = this->subItems();
+        ret = subItems.count() == itemList->subItems().count();
+        if (ret)
+            {
+            QStringList items = this->items();
+            foreach(QString tempItem, itemList->items())
+                    {
+                    if (!items.contains(tempItem, Qt::CaseInsensitive))
+                        {
+                        return false;
+                        }
+                    }
+            foreach(QString tempSubItem, itemList->subItems())
+                    {
+                    if (!subItems.contains(tempSubItem, Qt::CaseInsensitive))
+                        {
+                        return false;
+                        }
+                    }
+            }
+        }
+    return ret;
+    }
+
+TestItemList::TestItem::TestItem()
+    {
+    }
+
+TestItemList::TestItem::TestItem(QString name, QStringList cases) :
+    itemName(name), subItemNames(cases)
+    {
+    }
+
+TestItemList::TestItem::~TestItem()
+    {
+    }
+
+QString TestItemList::TestItem::getFullQulifiedCaseName(const QString& str)
+    {
+    // TODO
+    return QString(str);
+    }
+
+bool TestItemList::TestItem::isEqual(const TestItem& item)
+    {
+    // TODO: to be extended.
+    return itemName.compare(item.itemName) == 0;
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/symbianunittestui/qt/testitemlist.h	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,69 @@
+/*
+ * 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: class to setup mapping of individual test cases and dll files.
+ *
+ */
+
+#ifndef TESTITEMLIST_H_
+#define TESTITEMLIST_H_
+#include <QString>
+#include <QStringList>
+#include <QList>
+
+class TestItemList
+    {    
+public:
+    TestItemList();
+    ~TestItemList();
+
+public:
+    void removeItem(const QString&);
+    void removeAll();
+    void removeOneSubItem(const QString&, const QString&);
+    void addItemExclusively(const QString&, const QStringList&);
+    void addItemExclusively(const QString&);
+    void addOneSubItem(const QString&, const QString&);
+    int count() const;
+    bool isEqual(const TestItemList*);
+    bool empty() const;
+    bool exists(const QString&) const;
+    QStringList items() const;
+    QStringList subItems() const;
+    
+private:
+    class TestItem
+        {
+    public:
+        TestItem();
+        TestItem(QString, QStringList);
+        ~TestItem();
+
+    public:
+        QString getFullQulifiedCaseName(const QString&);
+        bool isEqual(const TestItem&);
+
+    public:
+        QString itemName;
+        QStringList subItemNames;
+        };
+    
+private:
+    bool findItem(const QString&, TestItem*&) const;
+    
+private:
+    QList<TestItem*> listItems;
+    
+    };
+
+#endif /* TESTITEMLIST_H_ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/symbianunittestui/qt/testrunner_s60.cpp	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,257 @@
+/*
+ * 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: Symbian C++ test runner Class.
+ *
+ */
+#include "testrunner_s60.h"
+#include "symbianunittestrunner.h"
+#include "widgettestrunner.h"
+_LIT( KOutputFileName, "SymbianUnitTestResults" );
+_LIT( KDefaultOutputFormat, "html" );
+
+TestRunnerPrivate* TestRunnerPrivate::NewLC(WidgetTestRunner* aPublicApi)
+    {
+    TestRunnerPrivate* self = new (ELeave) TestRunnerPrivate(aPublicApi);
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    return self;
+    }
+
+TestRunnerPrivate* TestRunnerPrivate::NewL(WidgetTestRunner* aPublicApi)
+    {
+    TestRunnerPrivate* self = TestRunnerPrivate::NewLC(aPublicApi);
+    CleanupStack::Pop(self);
+    return self;
+    }
+
+TestRunnerPrivate::TestRunnerPrivate(WidgetTestRunner* aPublicApi) :
+    CActive(EPriorityStandard), d_ptr(aPublicApi), iTimeout(
+            KSymbianUnitTestDefaultTimeout)
+    {
+    }
+
+void TestRunnerPrivate::ConstructL()
+    {
+    User::SetJustInTime(EFalse); // Do not stop on test case panics
+
+    iTestDllNames = new (ELeave) CDesCArrayFlat(1);
+    iTestCaseNames = new (ELeave) CDesCArrayFlat(1);
+    iOutputFormat = KDefaultOutputFormat().AllocL();
+    CActiveScheduler::Add(this);
+    }
+
+TestRunnerPrivate::~TestRunnerPrivate()
+    {
+    Cancel();
+    delete iTestDllNames;
+    delete iTestCaseNames;
+    delete iOutputFormat;
+    }
+
+// -----------------------------------------------------------------------------
+// From MSymbianUnitTestUiCallBack
+// -----------------------------------------------------------------------------
+//
+void TestRunnerPrivate::InfoMsg(const TDesC& aMessage)
+    {
+    QString msg = QString::fromUtf16(aMessage.Ptr(), aMessage.Length());
+    emit d_ptr->infoMsgReceived(msg);
+    }
+
+int TestRunnerPrivate::SetTestDllNames(const QStringList& aDllNames)
+    {
+    TRAPD(err, SetTestDllNamesL(aDllNames));
+    return err;
+    }
+
+int TestRunnerPrivate::SetTestCaseNames(const QStringList& aCaseNames)
+    {
+    TRAPD(err, SetTestCaseNamesL(aCaseNames));
+    return err;
+    }
+
+int TestRunnerPrivate::SetOutputFormat(const QString& aFmt)
+    {
+    TRAPD(err, SetOutputFormatL(aFmt));
+    return err;
+    }
+
+int TestRunnerPrivate::ListTestCases(const QString& aDllName, QStringList& aCaseNames)
+    {
+    TRAPD(err, ListTestCasesL(aDllName, aCaseNames));
+    return err;
+    }
+
+// -----------------------------------------------------------------------------
+// From MSymbianUnitTestUiCallBack
+// -----------------------------------------------------------------------------
+//
+void TestRunnerPrivate::InfoMsg(const TDesC& aFormat, const TDesC& aMessage)
+    {
+    //    iConsole->Printf( aFormat, &aMessage );
+    }
+
+void TestRunnerPrivate::TestsCount()
+    {
+
+    }
+
+void TestRunnerPrivate::TestsExecuted()
+    {
+    emit d_ptr->testExecuted(iPassedTestsCount + iFailedTestsCount);
+    }
+
+void TestRunnerPrivate::SetTestDllNamesL(const QStringList& aDllNames)
+    {
+    if (!aDllNames.isEmpty())
+        {
+        CDesCArray* testDllNames = new (ELeave) CDesCArrayFlat(1);
+        CleanupStack::PushL(testDllNames);
+        foreach (QString tmp, aDllNames)
+                {
+                TPtrC myDescriptor(static_cast<const TUint16*> (tmp.utf16()),
+                        tmp.length());
+                HBufC* buffer = myDescriptor.AllocL();
+                testDllNames->AppendL(buffer->Des());
+                }
+        delete iTestDllNames;
+        iTestDllNames = testDllNames;
+        CleanupStack::Pop(testDllNames);
+        }
+    }
+
+void TestRunnerPrivate::SetTestCaseNamesL(const QStringList& aNames)
+    {
+    if (!aNames.isEmpty())
+        {
+        CDesCArray* testCaseNames = new (ELeave) CDesCArrayFlat(1);
+        CleanupStack::PushL(testCaseNames);
+        foreach (QString tmp, aNames)
+                {
+                TPtrC myDescriptor(static_cast<const TUint16*> (tmp.utf16()),
+                        tmp.length());
+                HBufC* buffer = myDescriptor.AllocL();
+                testCaseNames->AppendL(buffer->Des());
+                }
+        delete iTestCaseNames;
+        iTestCaseNames = testCaseNames;
+        CleanupStack::Pop(testCaseNames);
+        }
+    }
+
+void TestRunnerPrivate::SetAllocFailureSimulation(const TBool aSimulation)
+    {
+    iAllocFailureSimulation = aSimulation;
+    }
+
+void TestRunnerPrivate::SetTimeout(const TInt aTimeout)
+    {
+    iTimeout = aTimeout;
+    }
+
+void TestRunnerPrivate::SetOutputFormatL(const QString& aFormat)
+    {
+    TPtrC outputFormatPtr(aFormat.utf16());
+    HBufC* outputFormat = outputFormatPtr.AllocL();
+    delete iOutputFormat;
+    iOutputFormat = outputFormat;
+    }
+
+void TestRunnerPrivate::RunL()
+    {
+    iTestRunner = CSymbianUnitTestRunner::NewL(*this);
+    iPassedTestsCount = 0;
+    iFailedTestsCount = 0;
+    TRAPD(err, iTestRunner->ExecuteTestsL(*iTestDllNames,
+                    iAllocFailureSimulation,
+                    KOutputFileName,
+                    *iOutputFormat,
+                    *iTestCaseNames,
+                    iTimeout));
+    if (err != KErrNone)
+        {
+        emit d_ptr->errorOccurred(err);
+        }
+    delete iTestRunner;
+    iTestRunner = NULL;
+    }
+
+// -----------------------------------------------------------------------------
+// From CActive
+// -----------------------------------------------------------------------------
+//
+void TestRunnerPrivate::DoCancel()
+    {
+    }
+
+void TestRunnerPrivate::RunTests()
+    {
+    // Set ready to run immediately
+    TRequestStatus *status = &iStatus;
+    User::RequestComplete(status, KErrNone);
+    if (!IsActive())
+        {
+        SetActive();
+        }
+    }
+
+void TestRunnerPrivate::ListTestCasesL(const QString& aDllName,
+        QStringList& aTestCases)
+    {
+    iTestRunner = CSymbianUnitTestRunner::NewL(*this);
+    TPtrC dllName(static_cast<const TUint16*> (aDllName.utf16()),
+            aDllName.length());
+    CDesCArray* testCaseNames = new (ELeave) CDesCArrayFlat(1);
+    CleanupStack::PushL(testCaseNames);
+    iTestRunner->TestCaseNamesL(dllName, *testCaseNames);
+    for (int i = 0; i < testCaseNames->Count(); ++i)
+        {
+        aTestCases << QString::fromUtf16((*testCaseNames)[i].Ptr(),
+                (*testCaseNames)[i].Length());
+        }
+    CleanupStack::PopAndDestroy(testCaseNames);
+    delete iTestRunner;
+    iTestRunner = NULL;
+    }
+
+// -----------------------------------------------------------------------------
+// From MSymbianUnitTestUiCallBack
+// -----------------------------------------------------------------------------
+//
+void TestRunnerPrivate::TestPass(const TDesC& aTestCaseName)
+    {
+    QString caseName = QString::fromUtf16(aTestCaseName.Ptr(),
+            aTestCaseName.Length());
+    emit
+    d_ptr->infoMsgReceived(caseName);
+    emit
+    d_ptr->testPassed(++iPassedTestsCount);
+    TestsExecuted();
+    }
+
+// -----------------------------------------------------------------------------
+// From MSymbianUnitTestUiCallBack
+// -----------------------------------------------------------------------------
+//
+void TestRunnerPrivate::TestFailed(const TDesC& aTestCaseName,
+        const TDesC8& aErrMsg)
+    {
+    QString caseName = QString::fromUtf16(aTestCaseName.Ptr(),
+            aTestCaseName.Length());
+    QString reason = QString::fromUtf8(
+            reinterpret_cast<const char*> (aErrMsg.Ptr()), aErrMsg.Length());
+    emit
+    d_ptr->testFailed(caseName, reason, ++iFailedTestsCount);
+    TestsExecuted();
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/symbianunittestui/qt/testrunner_s60.h	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,90 @@
+/*
+* 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: Symbian C++ test runner Class.
+*
+*/
+
+#ifndef TESTRUNNER_S60_H_
+#define TESTRUNNER_S60_H_
+
+#include <e32base.h>
+#include <badesca.h> 
+#include <QStringList>
+#include <QString>
+#include <symbianunittestuicallback.h>
+
+class CSymbianUnitTestRunner;
+class WidgetTestRunner;
+
+class TestRunnerPrivate: public CActive, public MSymbianUnitTestUiCallBack
+    {
+public: // Constructors and destructor
+
+    static TestRunnerPrivate* NewLC(WidgetTestRunner* aPublicApi);
+    static TestRunnerPrivate* NewL(WidgetTestRunner* aPublicApi);
+    ~TestRunnerPrivate();
+    
+protected: // From CActive
+    
+    void RunL();
+    void DoCancel();
+    
+public: // From MSymbianUnitTestUiCallBack
+    
+    void InfoMsg( const TDesC& aMessage );
+    void InfoMsg( const TDesC& aFormat, const TDesC& aMessage );
+    void TestPass(const TDesC& aTestCaseName);
+    void TestFailed(const TDesC& aTestCaseName, const TDesC8& aErrMsg);
+    
+public:
+    void RunTests();
+    int SetTestDllNames(const QStringList&);
+    int SetTestCaseNames(const QStringList&);
+    void SetTimeout(const TInt);
+    int SetOutputFormat(const QString&);
+    int ListTestCases(const QString&, QStringList&);
+    void SetAllocFailureSimulation(const TBool);
+    
+private:
+    void SetTestDllNamesL(const QStringList&);
+    void SetTestCaseNamesL(const QStringList&);
+    void SetOutputFormatL(const QString&);
+    void ListTestCasesL(const QString&, QStringList&);
+    
+private:
+    void TestsCount();
+    void TestsExecuted();
+
+private: // Constructors
+
+    TestRunnerPrivate(WidgetTestRunner* aPublicApi);
+    void ConstructL();
+    
+private: // Data
+    WidgetTestRunner* d_ptr;
+    CSymbianUnitTestRunner* iTestRunner;
+    TInt iExecutedTestCount;
+    TInt iPassedTestsCount;
+    TInt iFailedTestsCount;
+    
+    CDesCArray* iTestDllNames;
+    CDesCArray* iTestCaseNames;
+    
+    // Settings
+    TBool iAllocFailureSimulation;
+    HBufC* iOutputFormat;
+    TInt iTimeout;
+    };
+
+#endif /* TESTRUNNER_S60_H_ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/symbianunittestui/qt/widgettestrunner.cpp	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,84 @@
+/*
+ * 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: widget class to run tests.
+ *
+ */
+
+#include "widgettestrunner.h"
+#include "settings.h"
+#ifdef Q_OS_SYMBIAN
+#include "testrunner_s60.h"
+//#else
+//#include "testrunner_stub.h"
+#endif
+
+WidgetTestRunner::WidgetTestRunner(QWidget* parent) :
+    QWidget(parent)
+    {
+#ifdef Q_OS_SYMBIAN //Symbian specific compilation
+    QT_TRAP_THROWING(d_ptr = TestRunnerPrivate::NewL(this));
+//#else
+//    d_ptr = new TestRunnerPrivate(this);
+#endif
+    }
+
+WidgetTestRunner::~WidgetTestRunner()
+    {
+    delete d_ptr;
+    }
+
+void WidgetTestRunner::addTestDllNames(const QStringList& dllNames)
+    {
+    if (d_ptr->SetTestDllNames(dllNames) != 0)
+        {
+        emit this->errorOccurred(tr("Failed to add test dll files."));
+        }
+    }
+
+void WidgetTestRunner::addTestCaseNames(const QStringList& caseNames)
+    {
+    if (d_ptr->SetTestCaseNames(caseNames) != 0)
+        {
+        emit this->errorOccurred(tr("Failed to set test cases to run."));
+        }
+    }
+
+int WidgetTestRunner::listTestCases(const QString& dllName, QStringList& caseNames)
+    {
+    int err = -1;
+    if (!dllName.isEmpty())
+        {
+        err = d_ptr->ListTestCases(dllName, caseNames);
+        if (err != 0)
+            {
+            emit this->errorOccurred(tr("Failed to list cases in \"") + dllName + tr("\""));
+            }
+        }
+    return err;
+    }
+
+void WidgetTestRunner::saveSettings(const Settings* settings)
+    {
+    if (d_ptr->SetOutputFormat(settings->outputFormat) != 0)
+        {
+        emit this->errorOccurred(tr("Failed to set output format."));
+        }
+    d_ptr->SetAllocFailureSimulation(settings->memAllocFailureSim);
+    d_ptr->SetTimeout(settings->timeout);
+    }
+
+void WidgetTestRunner::runTests()
+    {
+    d_ptr->RunTests();
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/symbianunittestui/qt/widgettestrunner.h	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,58 @@
+/*
+ * 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: TabWidget class to select, run tests and show the result.
+ *
+ */
+
+#ifndef WIDGETTESTRUNNER_H_
+#define WIDGETTESTRUNNER_H_
+
+#include <QWidget>
+
+class TestRunnerPrivate;
+class Settings;
+
+class WidgetTestRunner : public QWidget
+    {
+    Q_OBJECT
+    
+public:
+    WidgetTestRunner(QWidget* parent = 0);
+    virtual ~WidgetTestRunner();
+    
+public:
+    int listTestCases(const QString&, QStringList&);
+
+signals:
+    void infoMsgReceived(QString msg);
+    void testFailed(QString, QString, int);
+    void testPassed(int);
+    void errorOccurred(int);
+    void errorOccurred(const QString);
+    void testExecuted(int);
+    
+public slots:
+    void addTestDllNames(const QStringList&);
+    void addTestCaseNames(const QStringList&);
+    void saveSettings(const Settings*);
+    void runTests();
+    
+private:
+    TestRunnerPrivate* d_ptr;
+    
+private:
+    friend class TestRunnerPrivate;
+    };
+
+#endif /* WIDGETTESTRUNNER_H_ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sysdef_1_4_0.dtd	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,86 @@
+ <!ELEMENT SystemDefinition (systemModel?, build?)>
+ <!ATTLIST SystemDefinition
+  name CDATA #REQUIRED
+  schema CDATA #REQUIRED>
+ <!ELEMENT systemModel (layer+)>
+ <!ELEMENT layer (logicalset* | module*)*>
+ <!ATTLIST layer
+  name CDATA #REQUIRED
+  levels CDATA #IMPLIED
+  span CDATA #IMPLIED>
+ <!ELEMENT logicalset (logicalsubset* | module* | unit* | package* | prebuilt*)*>
+ <!ATTLIST logicalset name CDATA #REQUIRED>
+ <!ELEMENT logicalsubset (module* | unit* | package* | prebuilt*)*>
+ <!ATTLIST logicalsubset name CDATA #REQUIRED>
+ <!ELEMENT module (component* | unit* | package* | prebuilt*)*>
+ <!ATTLIST module
+  name CDATA #REQUIRED
+  level CDATA #IMPLIED>
+ <!ELEMENT component (unit* | package* | prebuilt*)*>
+ <!ATTLIST component name CDATA #REQUIRED>
+ <!ELEMENT unit EMPTY>
+ <!ATTLIST unit
+  unitID ID #REQUIRED
+  name CDATA #REQUIRED
+  mrp CDATA #REQUIRED
+  filter CDATA #IMPLIED
+  bldFile CDATA #REQUIRED
+  priority CDATA #IMPLIED
+  contract CDATA #IMPLIED>
+ <!ELEMENT package EMPTY>
+ <!ATTLIST package
+  name CDATA #REQUIRED
+  mrp CDATA #REQUIRED
+  filter CDATA #IMPLIED
+  contract CDATA #IMPLIED>
+ <!ELEMENT prebuilt EMPTY>
+ <!ATTLIST prebuilt
+  name CDATA #REQUIRED
+  version CDATA #REQUIRED
+  late (Y|N) #IMPLIED
+  filter CDATA #IMPLIED
+  contract CDATA #IMPLIED>
+ <!ELEMENT build (option* | target+ | targetList+ | unitList+ | configuration+)*>
+ <!ELEMENT unitList (unitRef+)>
+ <!ATTLIST unitList
+  name ID #REQUIRED
+  description CDATA #REQUIRED>
+ <!ELEMENT unitRef EMPTY>
+ <!ATTLIST unitRef unit IDREF #REQUIRED>
+ <!ELEMENT targetList EMPTY>
+ <!ATTLIST targetList
+  name ID #REQUIRED
+  description CDATA #REQUIRED
+  target IDREFS #REQUIRED>
+ <!ELEMENT target EMPTY>
+ <!ATTLIST target
+  name ID #REQUIRED
+  abldTarget CDATA #REQUIRED
+  description CDATA #REQUIRED>
+ <!ELEMENT option EMPTY>
+ <!ATTLIST option
+  name ID #REQUIRED
+  abldOption CDATA #REQUIRED
+  description CDATA #REQUIRED
+  enable (Y | N | y | n) #REQUIRED>
+ <!ELEMENT configuration (unitListRef+ | layerRef+ | task+)*>
+ <!ATTLIST configuration
+  name ID #REQUIRED
+  description CDATA #REQUIRED
+  filter CDATA #REQUIRED>
+ <!ELEMENT task ( unitListRef* , (buildLayer | specialInstructions))>
+ <!ELEMENT unitListRef EMPTY>
+ <!ATTLIST unitListRef unitList IDREF #REQUIRED>
+ <!ELEMENT layerRef EMPTY>
+ <!ATTLIST layerRef layerName CDATA #REQUIRED>
+ <!ELEMENT buildLayer EMPTY>
+ <!ATTLIST buildLayer
+  command CDATA #REQUIRED
+  targetList IDREFS #IMPLIED
+  unitParallel (Y | N | y | n) #REQUIRED
+  targetParallel (Y | N | y | n) #IMPLIED>
+ <!ELEMENT specialInstructions EMPTY>
+ <!ATTLIST specialInstructions
+  name CDATA #REQUIRED
+  cwd CDATA #REQUIRED
+  command CDATA #REQUIRED>  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sysdef_1_5_1.dtd	Wed Aug 25 15:45:01 2010 +0300
@@ -0,0 +1,88 @@
+ <!ELEMENT SystemDefinition (systemModel?, build?)>
+ <!ATTLIST SystemDefinition
+  name CDATA #REQUIRED
+  schema CDATA #REQUIRED>
+ <!ELEMENT systemModel (layer+)>
+ <!ELEMENT layer (logicalset* | module*)*>
+ <!ATTLIST layer
+  name CDATA #REQUIRED
+  levels CDATA #IMPLIED
+  span CDATA #IMPLIED>
+ <!ELEMENT logicalset (logicalsubset* | module* | unit* | package* | prebuilt*)*>
+ <!ATTLIST logicalset name CDATA #REQUIRED>
+ <!ELEMENT logicalsubset (module* | unit* | package* | prebuilt*)*>
+ <!ATTLIST logicalsubset name CDATA #REQUIRED>
+ <!ELEMENT module (component* | unit* | package* | prebuilt*)*>
+ <!ATTLIST module
+  name CDATA #REQUIRED
+  level CDATA #IMPLIED>
+ <!ELEMENT component (unit* | package* | prebuilt*)*>
+ <!ATTLIST component name CDATA #REQUIRED>
+ <!ELEMENT unit EMPTY>
+ <!ATTLIST unit
+  unitID ID #REQUIRED
+  name CDATA #REQUIRED
+  mrp CDATA #REQUIRED
+  filter CDATA #IMPLIED
+  bldFile CDATA #REQUIRED
+  priority CDATA #IMPLIED
+  contract CDATA #IMPLIED
+  proFile CDATA #IMPLIED
+  qmakeArgs CDATA #IMPLIED>
+ <!ELEMENT package EMPTY>
+ <!ATTLIST package
+  name CDATA #REQUIRED
+  mrp CDATA #REQUIRED
+  filter CDATA #IMPLIED
+  contract CDATA #IMPLIED>
+ <!ELEMENT prebuilt EMPTY>
+ <!ATTLIST prebuilt
+  name CDATA #REQUIRED
+  version CDATA #REQUIRED
+  late (Y|N) #IMPLIED
+  filter CDATA #IMPLIED
+  contract CDATA #IMPLIED>
+ <!ELEMENT build (option* | target+ | targetList+ | unitList+ | configuration+)*>
+ <!ELEMENT unitList (unitRef+)>
+ <!ATTLIST unitList
+  name ID #REQUIRED
+  description CDATA #REQUIRED>
+ <!ELEMENT unitRef EMPTY>
+ <!ATTLIST unitRef unit IDREF #REQUIRED>
+ <!ELEMENT targetList EMPTY>
+ <!ATTLIST targetList
+  name ID #REQUIRED
+  description CDATA #REQUIRED
+  target IDREFS #REQUIRED>
+ <!ELEMENT target EMPTY>
+ <!ATTLIST target
+  name ID #REQUIRED
+  abldTarget CDATA #REQUIRED
+  description CDATA #REQUIRED>
+ <!ELEMENT option EMPTY>
+ <!ATTLIST option
+  name ID #REQUIRED
+  abldOption CDATA #REQUIRED
+  description CDATA #REQUIRED
+  enable (Y | N | y | n) #REQUIRED>
+ <!ELEMENT configuration (unitListRef+ | layerRef+ | task+)*>
+ <!ATTLIST configuration
+  name ID #REQUIRED
+  description CDATA #REQUIRED
+  filter CDATA #REQUIRED>
+ <!ELEMENT task ( unitListRef* , (buildLayer | specialInstructions))>
+ <!ELEMENT unitListRef EMPTY>
+ <!ATTLIST unitListRef unitList IDREF #REQUIRED>
+ <!ELEMENT layerRef EMPTY>
+ <!ATTLIST layerRef layerName CDATA #REQUIRED>
+ <!ELEMENT buildLayer EMPTY>
+ <!ATTLIST buildLayer
+  command CDATA #REQUIRED
+  targetList IDREFS #IMPLIED
+  unitParallel (Y | N | y | n) #REQUIRED
+  targetParallel (Y | N | y | n) #IMPLIED>
+ <!ELEMENT specialInstructions EMPTY>
+ <!ATTLIST specialInstructions
+  name CDATA #REQUIRED
+  cwd CDATA #REQUIRED
+  command CDATA #REQUIRED>