Revision: 201021 RCL_3
authorDremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Wed, 09 Jun 2010 09:42:37 +0300
branchRCL_3
changeset 13 822c625f7adc
parent 11 454d022d514b
child 14 5616581fe08b
child 17 65b472535a0d
Revision: 201021 Kit: 2010123
filebrowser/src/FBFileDlgs.cpp
filebrowser/src/FBFileOps.cpp
filebrowser/src/FBFileUtils.cpp
group/bld.inf
htiui/HtiAdmin/data/1020DEB6.rss
htiui/HtiAdmin/group/HtiAdmin.mmp
htiui/HtiAdminQt/chtiadminengine.h
htiui/HtiAdminQt/htienginewrapper.cpp
htiui/HtiAdminQt/htienginewrapper.h
htiui/HtiAdminQt/mainview.cpp
htiui/HtiDeviceReboot/src/HtiDeviceReboot.cpp
htiui/HtiServicePlugins/HtiAppServicePlugin/src/HtiAppControl.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/HtiPIMServicePlugin/inc/HtiBookmarkHandler.h
htiui/HtiServicePlugins/HtiPIMServicePlugin/src/HtiBookmarkHandler.cpp
htiui/HtiServicePlugins/HtiSysInfoServicePlugin/group/HtiSysInfoServicePlugin.mmp
htiui/HtiServicePlugins/HtiSysInfoServicePlugin/inc/HtiSysInfoServicePlugin.h
htiui/HtiServicePlugins/HtiSysInfoServicePlugin/src/HtiSysInfoServicePlugin.cpp
htiui/group/bld.inf
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
piprofilerui/group/bld.inf
piprofilerui/group/bld_generic.inf
piprofilerui/group/group.pro
piprofilerui/piprofilerui.pro
piprofilerui/sis/PIProfiler_S60-30.pkg
piprofilerui/sis/PIProfiler_S60-31.pkg
piprofilerui/sis/PIProfiler_S60-32.pkg
piprofilerui/sis/PIProfiler_S60-50.pkg
piprofilerui/sis/PIProfiler_Symbian3.pkg
piprofilerui/sis/PIProfiler_Symbian4.pkg
piprofilerui/sis/PIProfiler_stub.pkg
piprofilerui/ui/avkon/data/piprofilerui.rss
piprofilerui/ui/avkon/data/piprofilerui_reg.rss
piprofilerui/ui/avkon/group/backup_registration.xml
piprofilerui/ui/avkon/group/bld.inf
piprofilerui/ui/avkon/group/piprofilerui.mmp
piprofilerui/ui/avkon/group/piprofilerui_extraicons.mk
piprofilerui/ui/avkon/group/piprofilerui_icons_aif.mk
piprofilerui/ui/avkon/inc/profiler_gui.hrh
piprofilerui/ui/avkon/inc/profiler_gui_app.h
piprofilerui/ui/avkon/inc/profiler_gui_appui.h
piprofilerui/ui/avkon/inc/profiler_gui_attributes.h
piprofilerui/ui/avkon/inc/profiler_gui_document.h
piprofilerui/ui/avkon/inc/profiler_gui_maincontainer.h
piprofilerui/ui/avkon/inc/profiler_gui_mainview.h
piprofilerui/ui/avkon/inc/profiler_gui_model.h
piprofilerui/ui/avkon/inc/profiler_gui_samplersettingsviewdlg.h
piprofilerui/ui/avkon/inc/profiler_gui_settingsviewdlg.h
piprofilerui/ui/avkon/inc/profiler_gui_std.h
piprofilerui/ui/avkon/rom/piprofilerui_avkon.iby
piprofilerui/ui/avkon/src/profiler_gui_app.cpp
piprofilerui/ui/avkon/src/profiler_gui_appui.cpp
piprofilerui/ui/avkon/src/profiler_gui_document.cpp
piprofilerui/ui/avkon/src/profiler_gui_maincontainer.cpp
piprofilerui/ui/avkon/src/profiler_gui_mainview.cpp
piprofilerui/ui/avkon/src/profiler_gui_model.cpp
piprofilerui/ui/avkon/src/profiler_gui_samplersettingsviewdlg.cpp
piprofilerui/ui/avkon/src/profiler_gui_settingsviewdlg.cpp
piprofilerui/ui/hb/hb.pro
piprofilerui/ui/hb/inc/generalattributes.h
piprofilerui/ui/hb/inc/notifications.h
piprofilerui/ui/hb/inc/pimainview.h
piprofilerui/ui/hb/inc/pimainwindow.h
piprofilerui/ui/hb/inc/piprofilerengine.h
piprofilerui/ui/hb/inc/piprofilerengineprivate.h
piprofilerui/ui/hb/inc/pisettingsview.h
piprofilerui/ui/hb/inc/pluginattributes.h
piprofilerui/ui/hb/pimainview.docml
piprofilerui/ui/hb/piprofiler.qrc
piprofilerui/ui/hb/rom/piprofilerui_hb.iby
piprofilerui/ui/hb/src/main.cpp
piprofilerui/ui/hb/src/notifications.cpp
piprofilerui/ui/hb/src/pimainview.cpp
piprofilerui/ui/hb/src/pimainwindow.cpp
piprofilerui/ui/hb/src/piprofilerengine.cpp
piprofilerui/ui/hb/src/piprofilerengineprivate.cpp
piprofilerui/ui/hb/src/pisettingsview.cpp
piprofilerui/ui/hb/src/pluginattributes.cpp
piprofilerui/ui/icons/qgn_menu_piprofilerui.svg
piprofilerui/ui/icons/qgn_prob_piprofilerui_status_disabled.svg
piprofilerui/ui/icons/qgn_prob_piprofilerui_status_enabled.svg
stifui/avkon/group/ReleaseNote.txt
stifui/avkon/sis/Stifui_31.sis
stifui/avkon/stifui/inc/version.h
stifui/qt/ReleaseNote.txt
stifui/qt/inc/dlgoutput.h
stifui/qt/inc/dlgsetselector.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/sis/StfQtUI.pkg
stifui/qt/src/dlgoutput.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
--- a/filebrowser/src/FBFileDlgs.cpp	Tue May 11 16:14:15 2010 +0300
+++ b/filebrowser/src/FBFileDlgs.cpp	Wed Jun 09 09:42:37 2010 +0300
@@ -465,7 +465,7 @@
     ListBox()->HandleItemAdditionL();
     Layout();
     ListBox()->SetCurrentItemIndex(0);
-    DrawNow();
+    DrawDeferred();
     }
 
 // --------------------------------------------------------------------------------------------
--- a/filebrowser/src/FBFileOps.cpp	Tue May 11 16:14:15 2010 +0300
+++ b/filebrowser/src/FBFileOps.cpp	Wed Jun 09 09:42:37 2010 +0300
@@ -332,7 +332,11 @@
                     {
                     path.Append(entry.iName);
                     path.Append(_L("\\"));
-                    DoFindEntries(aFileName, path);
+                    // test path.Left(iBuf2.Length()).Compare(iBuf2) - to prevent never ending recursive copy (in case of copy folder under itself)
+                    if( iRecursiveState == EFileOpCopy && path.Left(iBuf2.Length()).Compare(iBuf2) )
+                        {
+                        DoFindEntries(aFileName, path);
+                        }
                     }
                 }
             if ( iFileManObserverResult == MFileManObserver::ECancel )
--- a/filebrowser/src/FBFileUtils.cpp	Tue May 11 16:14:15 2010 +0300
+++ b/filebrowser/src/FBFileUtils.cpp	Wed Jun 09 09:42:37 2010 +0300
@@ -1961,7 +1961,7 @@
                 clearAttMask |= KEntryAttSystem;
             }
         
-        iModel->FileListContainer()->SetScreenLayoutL(EDisplayModeNormal);
+        iModel->FileListContainer()->SetScreenLayoutL(EDisplayModeFullScreen);
         iModel->FileListContainer()->SetNaviPaneTextL(naviText);
 
         CFileBrowserAttributeEditorDlg* dlg = CFileBrowserAttributeEditorDlg::NewL(setAttMask, clearAttMask, recurse);
@@ -2003,7 +2003,7 @@
 
 void CFileBrowserFileUtils::SearchL()
     {
-    iModel->FileListContainer()->SetScreenLayoutL(EDisplayModeNormal);
+	iModel->FileListContainer()->SetScreenLayoutL(EDisplayModeFullScreen);
     iModel->FileListContainer()->SetNaviPaneTextL(KNullDesC);
     
     iSearchAttributes.iSearchDir = iCurrentPath;
--- a/group/bld.inf	Tue May 11 16:14:15 2010 +0300
+++ b/group/bld.inf	Wed Jun 09 09:42:37 2010 +0300
@@ -28,3 +28,4 @@
 #include "../stifui/avkon/group/bld.inf"
 #include "../memspyui/group/bld.inf"
 #include "../htiui/group/bld.inf"
+#include "../piprofilerui/group/bld.inf"
\ No newline at end of file
--- a/htiui/HtiAdmin/data/1020DEB6.rss	Tue May 11 16:14:15 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,27 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:  A startup control file to add HtiFramework.exe to startup list.
-*
-*/
-
-#include <StartupItem.rh>
-
-RESOURCE STARTUP_ITEM_INFO hti_framework
-    {
-    executable_name = "!:\\sys\\bin\\HtiFramework.exe";
-    recovery = EStartupItemExPolicyNone;
-    }
-
-
-// End of file
--- a/htiui/HtiAdmin/group/HtiAdmin.mmp	Tue May 11 16:14:15 2010 +0300
+++ b/htiui/HtiAdmin/group/HtiAdmin.mmp	Wed Jun 09 09:42:37 2010 +0300
@@ -57,11 +57,6 @@
 TARGETPATH      /private/10003a3f/apps
 END
 
-START RESOURCE  1020DEB6.rss
-HEADER
-TARGETPATH      /private/101f875a/import
-END
-
 LIBRARY         apparc.lib
 LIBRARY         avkon.lib
 LIBRARY         cone.lib
--- a/htiui/HtiAdminQt/chtiadminengine.h	Tue May 11 16:14:15 2010 +0300
+++ b/htiui/HtiAdminQt/chtiadminengine.h	Wed Jun 09 09:42:37 2010 +0300
@@ -20,7 +20,7 @@
 
 #include <e32std.h>
 #include <e32base.h>
-#include <BADESCA.H> 
+#include <badesca.h> 
 
 
 class HtiEngineWrapper;
--- a/htiui/HtiAdminQt/htienginewrapper.cpp	Tue May 11 16:14:15 2010 +0300
+++ b/htiui/HtiAdminQt/htienginewrapper.cpp	Wed Jun 09 09:42:37 2010 +0300
@@ -21,7 +21,7 @@
 
 #include <coecntrl.h>
 #include <QString>
-#include <QLocale.h>
+#include <qlocale.h>
 
 
 #include <HtiVersion.h>
--- a/htiui/HtiAdminQt/htienginewrapper.h	Tue May 11 16:14:15 2010 +0300
+++ b/htiui/HtiAdminQt/htienginewrapper.h	Wed Jun 09 09:42:37 2010 +0300
@@ -20,7 +20,7 @@
 
 #include <e32cmn.h>
 #include <qobject.h>
-#include <QStringList.h>
+#include <qstringlist.h>
 
 class CHtiAdminEngine;
 class QString;
--- a/htiui/HtiAdminQt/mainview.cpp	Tue May 11 16:14:15 2010 +0300
+++ b/htiui/HtiAdminQt/mainview.cpp	Wed Jun 09 09:42:37 2010 +0300
@@ -21,9 +21,9 @@
 #include <hbmenu.h>
 #include <hbaction.h>
 #include <hblabel.h>
-#include <HbInputDialog.h>
+#include <hbinputdialog.h>
 #include <qgraphicslinearlayout.h>
-#include <HbListDialog.h>
+//#include <HbListDialog.h>
 #include <hbmessagebox.h>
 
 
@@ -264,43 +264,43 @@
 void MainView::enableComm()
 {
     //Get current selection
-	QString currentComm;
-	mEngineWrapper.getSelectedComm(currentComm);
-	int curSelection = mPluginList.indexOf(currentComm, 0);
-	
-	QStringList selection;
-	bool ok = false;
-	selection = HbListDialog::getStringItems("Select Comm", mPluginList, curSelection, &ok, HbAbstractItemView::SingleSelection);
-		
-	if(ok){
-			if(selection[0] == QString("Bt serial comm")){
-				enableBTComm();
-			}
-			else if(selection[0] == QString("IP comm")){
-				enableIPComm();
-			}
-			else if(selection[0] == QString("SERIAL comm")){
-				enableSerialComm();
-			}
-			else{
-				//All other comm plugins
-				mEngineWrapper.enableOtherComm(selection[0]);
-			}	
-		}
+//	QString currentComm;
+//	mEngineWrapper.getSelectedComm(currentComm);
+//	int curSelection = mPluginList.indexOf(currentComm, 0);
+//	
+//	QStringList selection;
+//	bool ok = false;
+//	selection = HbListDialog::getStringItems("Select Comm", mPluginList, curSelection, &ok, HbAbstractItemView::SingleSelection);
+//		
+//	if(ok){
+//			if(selection[0] == QString("Bt serial comm")){
+//				enableBTComm();
+//			}
+//			else if(selection[0] == QString("IP comm")){
+//				enableIPComm();
+//			}
+//			else if(selection[0] == QString("SERIAL comm")){
+//				enableSerialComm();
+//			}
+//			else{
+//				//All other comm plugins
+//				mEngineWrapper.enableOtherComm(selection[0]);
+//			}	
+//		}
 }
 
 // ---------------------------------------------------------------------------
 void MainView::enableSerialComm()
 {
-	bool ok = false;
-    QString str = HbInputDialog::getText(
-					"Set Comm Port number ",
-					"",
-					&ok);
-    
-    if(ok){
-    	mEngineWrapper.enableSerial(str);
-    }
+//	bool ok = false;
+//    QString str = HbInputDialog::getText(
+//					"Set Comm Port number ",
+//					"",
+//					&ok);
+//    
+//    if(ok){
+//    	mEngineWrapper.enableSerial(str);
+//    }
 }
 
 
@@ -308,109 +308,109 @@
 void MainView::enableIPComm()
 {
     // Get IAPs list
-    QStringList iapsList;
-    mEngineWrapper.listIAPs(iapsList); 
-    if(iapsList.count() == 0)
-    {
-        HbMessageBox msg("No IAPs for selection!", HbMessageBox::MessageTypeWarning);
-        msg.exec();
-        return;
-    }
-    
-    // Get current selection
-    QString curIapName;
-    QString param = "IAPName";
-    mEngineWrapper.getIPCfgParam(param, curIapName);
-    int curSelction = iapsList.indexOf(curIapName, 0);
-    
-    QString iap;
-	QStringList selection;
-	bool ok = false;
-	selection = HbListDialog::getStringItems("Select IAP:", iapsList, curSelction, &ok, HbAbstractItemView::SingleSelection);
-	
-	if(ok)
-	{
-        iap = selection[0];
-	}
-	else
-	{
-        return;
-	}
-	
-	QStringList srcList;
-	srcList <<"Listen" <<"Connect";
-	
-	selection = HbListDialog::getStringItems("Select IP Comm", srcList, 0, &ok, HbAbstractItemView::SingleSelection);
-	
-	if(ok){
-		if(selection[0] == srcList[0]){
-			QString port = HbInputDialog::getText(
-								"Local port",
-								"",
-								&ok);	
-		
-			if(ok){
-				mEngineWrapper.ipListen(port, iap);
-			}
-			
-		}
-		else{
-			QString host = HbInputDialog::getText(
-								"Remote Host",
-								"",
-								&ok);	
-					
-			if(ok){
-				QString port = HbInputDialog::getText(
-												"Remote port",
-												"",
-												&ok);	
-			
-				if(ok){
-					mEngineWrapper.ipConnect(host, port, iap);
-				}
-			}
-		}
-			
-	}
+//    QStringList iapsList;
+//    mEngineWrapper.listIAPs(iapsList); 
+//    if(iapsList.count() == 0)
+//    {
+//        HbMessageBox msg("No IAPs for selection!", HbMessageBox::MessageTypeWarning);
+//        msg.exec();
+//        return;
+//    }
+//    
+//    // Get current selection
+//    QString curIapName;
+//    QString param = "IAPName";
+//    mEngineWrapper.getIPCfgParam(param, curIapName);
+//    int curSelction = iapsList.indexOf(curIapName, 0);
+//    
+//    QString iap;
+//	QStringList selection;
+//	bool ok = false;
+//	selection = HbListDialog::getStringItems("Select IAP:", iapsList, curSelction, &ok, HbAbstractItemView::SingleSelection);
+//	
+//	if(ok)
+//	{
+//        iap = selection[0];
+//	}
+//	else
+//	{
+//        return;
+//	}
+//	
+//	QStringList srcList;
+//	srcList <<"Listen" <<"Connect";
+//	
+//	selection = HbListDialog::getStringItems("Select IP Comm", srcList, 0, &ok, HbAbstractItemView::SingleSelection);
+//	
+//	if(ok){
+//		if(selection[0] == srcList[0]){
+//			QString port = HbInputDialog::getText(
+//								"Local port",
+//								"",
+//								&ok);	
+//		
+//			if(ok){
+//				mEngineWrapper.ipListen(port, iap);
+//			}
+//			
+//		}
+//		else{
+//			QString host = HbInputDialog::getText(
+//								"Remote Host",
+//								"",
+//								&ok);	
+//					
+//			if(ok){
+//				QString port = HbInputDialog::getText(
+//												"Remote port",
+//												"",
+//												&ok);	
+//			
+//				if(ok){
+//					mEngineWrapper.ipConnect(host, port, iap);
+//				}
+//			}
+//		}
+//			
+//	}
 }
 
 // ---------------------------------------------------------------------------
 void MainView::enableBTComm()
 {
-	QStringList srcList;
-	QStringList selection;
-	 
-	srcList <<"BT address" <<"BT name" <<"Search when starting" ;
-	
-	bool ok = false;
-	selection = HbListDialog::getStringItems("", srcList, 0, &ok, HbAbstractItemView::SingleSelection);
-	
-	if(ok){
-		if(selection[0] == srcList[0]){
-			QString address = HbInputDialog::getText(
-						"BT address",
-						"",
-						&ok);
-		
-			if(ok){
-				mEngineWrapper.enableBtByAddress(address);	
-			}
-		}
-		else if(selection[0] == srcList[1]){
-			QString name = HbInputDialog::getText(
-								"BT name",
-								"",
-								&ok);
-				
-					if(ok){
-						mEngineWrapper.enableBtByName(name);	
-					}
-		}
-		else if(selection[0] == srcList[2]){
-			mEngineWrapper.btSearch();
-		}
-	}
+//	QStringList srcList;
+//	QStringList selection;
+//	 
+//	srcList <<"BT address" <<"BT name" <<"Search when starting" ;
+//	
+//	bool ok = false;
+//	selection = HbListDialog::getStringItems("", srcList, 0, &ok, HbAbstractItemView::SingleSelection);
+//	
+//	if(ok){
+//		if(selection[0] == srcList[0]){
+//			QString address = HbInputDialog::getText(
+//						"BT address",
+//						"",
+//						&ok);
+//		
+//			if(ok){
+//				mEngineWrapper.enableBtByAddress(address);	
+//			}
+//		}
+//		else if(selection[0] == srcList[1]){
+//			QString name = HbInputDialog::getText(
+//								"BT name",
+//								"",
+//								&ok);
+//				
+//					if(ok){
+//						mEngineWrapper.enableBtByName(name);	
+//					}
+//		}
+//		else if(selection[0] == srcList[2]){
+//			mEngineWrapper.btSearch();
+//		}
+//	}
 }
 
 
@@ -418,40 +418,40 @@
 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 srcList;
-	QStringList selection;
-	 
-	srcList <<"Backgroung" <<"Foregound" <<"High" << "Absolute High";
-	
-	
-	selection = HbListDialog::getStringItems("Select Hti Priority", srcList, curSelection, &ok, HbAbstractItemView::SingleSelection);
-	
-	if(ok){
-		if(selection[0] == srcList[0]){
-			mEngineWrapper.setPriorityBackground();
-		}
-		else if(selection[0] == srcList[1]){
-					mEngineWrapper.setPriorityForeground();
-		}
-		else if(selection[0] == srcList[2]){
-			mEngineWrapper.setPriorityHigh();
-		}
-		else{
-			mEngineWrapper.setPriorityAbsoluteHigh();
-		}	
-	}
+//    bool ok = false;
+//    QString curPriority;
+//    QString param = "Priority";
+//    mEngineWrapper.getHtiCfgParam(param, curPriority);
+//    int curSelection = curPriority.toInt(&ok);
+//    if(ok){
+//        curSelection--;
+//    }
+//    else{
+//    curSelection = 2;
+//    }
+//    
+//	QStringList srcList;
+//	QStringList selection;
+//	 
+//	srcList <<"Backgroung" <<"Foregound" <<"High" << "Absolute High";
+//	
+//	
+//	selection = HbListDialog::getStringItems("Select Hti Priority", srcList, curSelection, &ok, HbAbstractItemView::SingleSelection);
+//	
+//	if(ok){
+//		if(selection[0] == srcList[0]){
+//			mEngineWrapper.setPriorityBackground();
+//		}
+//		else if(selection[0] == srcList[1]){
+//					mEngineWrapper.setPriorityForeground();
+//		}
+//		else if(selection[0] == srcList[2]){
+//			mEngineWrapper.setPriorityHigh();
+//		}
+//		else{
+//			mEngineWrapper.setPriorityAbsoluteHigh();
+//		}	
+//	}
 }
 
 // ---------------------------------------------------------------------------
@@ -493,62 +493,62 @@
 // ---------------------------------------------------------------------------
 void MainView::showParamList()
 {
-	QStringList srcList;
-	QStringList selection;
-	QString value;
-	QString name;
-	QString cfgSelection;
-	QString paramSelection;
-	QString cfgHti = "Hti.cfg";
-	QString cfgBtComm ="HtiBtComm.cfg";
-	QString cfgSerialComm = "HtiSerialComm.cfg";
-	QString cfgIPComm = "HtiIPComm.cfg";
-	 
-	srcList <<cfgHti <<cfgBtComm <<cfgSerialComm << cfgIPComm;
-	
-	bool ok = false;
-	selection = HbListDialog::getStringItems("Select cfg file to modify", srcList, 0, &ok, HbAbstractItemView::SingleSelection);
-	
-	if(ok){
-        cfgSelection = selection[0];
-        srcList.clear();
-	    if(cfgSelection == cfgHti){
-	    srcList <<"CommPlugin" <<"MaxMsgSize" <<"MaxQueueSize" <<"MaxHeapSize"<<"Priority"
-	            <<"ShowConsole"<<"MaxWaitTime"<<"StartUpDelay"<<"EnableHtiWatchDog"
-	            <<"EnableHtiAutoStart"<<"ShowErrorDialogs"<<"ReconnectDelay";
-	    }
-	    else if(cfgSelection == cfgBtComm){
-	        srcList <<"BtDeviceName" <<"BtDeviceName";
-	    }
-	    else if(cfgSelection == cfgSerialComm){
-            srcList <<"CommPort" <<"DataRate"<<"Parity"<<"DataBits"<<"StopBits"<<"SendDelay"<<"Handshake";
-	    }
-	    else{
-	    srcList <<"IAPName"<<"LocalPort"<<"RemoteHost"<<"RemotePort"<<"ConnectTimeout";
-	    }
-	    
-	    selection = HbListDialog::getStringItems("Select a parameter name in" + cfgSelection, srcList, 0, &ok, HbAbstractItemView::SingleSelection);
-	}
-    
-    if(ok){
-        name = selection[0];
-        value = HbInputDialog::getText("Value for paramater " + name, "", &ok);
-    }
-    
-    if(ok){
-       if(cfgSelection == cfgHti){
-            mEngineWrapper.setHtiCfgParam(name, value);
-        }
-        else if(cfgSelection == cfgBtComm){
-            mEngineWrapper.setBtCfgParam(name, value);
-        }
-        else if(cfgSelection == cfgSerialComm){
-            mEngineWrapper.setSerialCfgParam(name, value);
-        }
-        else{
-            mEngineWrapper.setIPCfgParam(name, value);
-        }   
-    }
+//	QStringList srcList;
+//	QStringList selection;
+//	QString value;
+//	QString name;
+//	QString cfgSelection;
+//	QString paramSelection;
+//	QString cfgHti = "Hti.cfg";
+//	QString cfgBtComm ="HtiBtComm.cfg";
+//	QString cfgSerialComm = "HtiSerialComm.cfg";
+//	QString cfgIPComm = "HtiIPComm.cfg";
+//	 
+//	srcList <<cfgHti <<cfgBtComm <<cfgSerialComm << cfgIPComm;
+//	
+//	bool ok = false;
+//	selection = HbListDialog::getStringItems("Select cfg file to modify", srcList, 0, &ok, HbAbstractItemView::SingleSelection);
+//	
+//	if(ok){
+//        cfgSelection = selection[0];
+//        srcList.clear();
+//	    if(cfgSelection == cfgHti){
+//	    srcList <<"CommPlugin" <<"MaxMsgSize" <<"MaxQueueSize" <<"MaxHeapSize"<<"Priority"
+//	            <<"ShowConsole"<<"MaxWaitTime"<<"StartUpDelay"<<"EnableHtiWatchDog"
+//	            <<"EnableHtiAutoStart"<<"ShowErrorDialogs"<<"ReconnectDelay";
+//	    }
+//	    else if(cfgSelection == cfgBtComm){
+//	        srcList <<"BtDeviceName" <<"BtDeviceName";
+//	    }
+//	    else if(cfgSelection == cfgSerialComm){
+//            srcList <<"CommPort" <<"DataRate"<<"Parity"<<"DataBits"<<"StopBits"<<"SendDelay"<<"Handshake";
+//	    }
+//	    else{
+//	    srcList <<"IAPName"<<"LocalPort"<<"RemoteHost"<<"RemotePort"<<"ConnectTimeout";
+//	    }
+//	    
+//	    selection = HbListDialog::getStringItems("Select a parameter name in" + cfgSelection, srcList, 0, &ok, HbAbstractItemView::SingleSelection);
+//	}
+//    
+//    if(ok){
+//        name = selection[0];
+//        value = HbInputDialog::getText("Value for paramater " + name, "", &ok);
+//    }
+//    
+//    if(ok){
+//       if(cfgSelection == cfgHti){
+//            mEngineWrapper.setHtiCfgParam(name, value);
+//        }
+//        else if(cfgSelection == cfgBtComm){
+//            mEngineWrapper.setBtCfgParam(name, value);
+//        }
+//        else if(cfgSelection == cfgSerialComm){
+//            mEngineWrapper.setSerialCfgParam(name, value);
+//        }
+//        else{
+//            mEngineWrapper.setIPCfgParam(name, value);
+//        }   
+//    }
 }
 
 
--- a/htiui/HtiDeviceReboot/src/HtiDeviceReboot.cpp	Tue May 11 16:14:15 2010 +0300
+++ b/htiui/HtiDeviceReboot/src/HtiDeviceReboot.cpp	Wed Jun 09 09:42:37 2010 +0300
@@ -80,7 +80,7 @@
                 }
             else
                 {
-                error = Reboot((RStarterSession::TResetReason)input);
+                error = Reboot(static_cast<RStarterSession::TResetReason>(input));
                 }
             }
         }
--- a/htiui/HtiServicePlugins/HtiAppServicePlugin/src/HtiAppControl.cpp	Tue May 11 16:14:15 2010 +0300
+++ b/htiui/HtiServicePlugins/HtiAppServicePlugin/src/HtiAppControl.cpp	Wed Jun 09 09:42:37 2010 +0300
@@ -35,7 +35,7 @@
 #include <swi/sisregistrysession.h>
 #include <swi/sisregistrypackage.h>
 #include <javaregistryincludes.h>
-#include <widgetregistryclient.h>
+#include <WidgetRegistryClient.h>
 
 using namespace Java;
 
@@ -622,7 +622,26 @@
                     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 );
@@ -1558,7 +1577,7 @@
         offset += length; // skip over password
         offset += 4;      // the last one byte params
 
-        if ( aParams.Length() != offset )
+        if ( aParams.Length() < offset || aParams.Length() > offset + 2)
             {
             HTI_LOG_TEXT( "ValidateInstallParams: Failed, final length incorrect" );
             return EFalse;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiServicePlugins/HtiCameraServicePlugin/data/2002EA9D.rss	Wed Jun 09 09:42:37 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 Jun 09 09:42:37 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 Jun 09 09:42:37 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 Jun 09 09:42:37 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 Jun 09 09:42:37 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 Jun 09 09:42:37 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 Jun 09 09:42:37 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 Jun 09 09:42:37 2010 +0300
@@ -0,0 +1,203 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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
+            {
+            ECmdInit                    = 0x01,
+            ECmdPrepareVideoRecording   = 0x02,
+            ECmdStartVideoRecording     = 0x05,
+            ECmdPausingVideoRecording   = 0x06,
+            ECmdResumeVideoRecording    = 0x07,
+            ECmdStopVideoRecording      = 0x08,
+            ECmdCloseVideoRecording     = 0x09,
+            ECmdGetZoom                 = 0x0a,
+            ECmdSetZoom                 = 0x0b,
+            
+            
+            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 HandleInitCmdL(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 Jun 09 09:42:37 2010 +0300
@@ -0,0 +1,550 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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( 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" );
+    iVideoRecordingEngine = CEngineVideoRecording::NewL(*this, 0);
+    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()
+    {
+    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 ECmdInit:
+            TRAP(err, HandleInitCmdL(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::HandleInitCmdL( const TDesC8& aData )
+    {
+    HTI_LOG_FUNC_IN( "CHtiCameraServicePlugin::HandleInitCmdL" );
+    if(aData.Length() != 0)
+        {
+        SendErrorMessageL(KErrArgument, KErrInvalidateParameters);
+        return;
+        }
+    
+    HTI_LOG_TEXT("Initializes Camera Application Engine");
+    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::HandleInitCmdL" );
+    }
+
+
+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;
+        }
+    
+    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;
+        }
+    
+    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;
+        }
+    
+    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;
+        }
+    
+    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;
+        }
+    
+    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;
+        }
+    
+    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;
+        }
+    
+    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;
+        }
+    
+    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);
+    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);
+    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);
+    HTI_LOG_FUNC_OUT( "CHtiCameraServicePlugin::MevroVideoRecordingOn" );
+    }
+
+void CHtiCameraServicePlugin::MevroVideoRecordingPaused(TInt aError)
+    {
+    HTI_LOG_FUNC_IN( "CHtiCameraServicePlugin::MevroVideoRecordingPaused" );
+    HTI_LOG_FORMAT("aError = %d", aError);
+    HTI_LOG_FUNC_OUT( "CHtiCameraServicePlugin::MevroVideoRecordingPaused" );
+    }
+
+void CHtiCameraServicePlugin::MevroVideoRecordingComplete(TInt aError)
+    {
+    HTI_LOG_FUNC_IN( "CHtiCameraServicePlugin::MevroVideoRecordingComplete" );
+    HTI_LOG_FORMAT("aError = %d", 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 Jun 09 09:42:37 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;
+    }
--- a/htiui/HtiServicePlugins/HtiPIMServicePlugin/inc/HtiBookmarkHandler.h	Tue May 11 16:14:15 2010 +0300
+++ b/htiui/HtiServicePlugins/HtiPIMServicePlugin/inc/HtiBookmarkHandler.h	Wed Jun 09 09:42:37 2010 +0300
@@ -21,8 +21,8 @@
 
 // INCLUDES
 #include <e32std.h>
-#include <favouriteslimits.h>
-#include <favouritessession.h>
+#include <FavouritesLimits.h>
+#include <FavouritesSession.h>
 #include <HtiServicePluginInterface.h>
 
 // CONSTANTS
--- a/htiui/HtiServicePlugins/HtiPIMServicePlugin/src/HtiBookmarkHandler.cpp	Tue May 11 16:14:15 2010 +0300
+++ b/htiui/HtiServicePlugins/HtiPIMServicePlugin/src/HtiBookmarkHandler.cpp	Wed Jun 09 09:42:37 2010 +0300
@@ -25,14 +25,14 @@
 #include <cmdestination.h>
 #include <cmmanager.h>
 
-#include <favouritesitem.h>
-#include <favouritesitemlist.h>
+#include <FavouritesItem.h>
+#include <FavouritesItemList.h>
 #include <FavouritesDb.h>
 #include <FavouritesFile.h>
 #include <FavouritesWapAp.h>
 
 #include <HtiDispatcherInterface.h>
-#include <HTILogging.h>
+#include <HtiLogging.h>
 
 // EXTERNAL DATA STRUCTURES
 
--- a/htiui/HtiServicePlugins/HtiSysInfoServicePlugin/group/HtiSysInfoServicePlugin.mmp	Tue May 11 16:14:15 2010 +0300
+++ b/htiui/HtiServicePlugins/HtiSysInfoServicePlugin/group/HtiSysInfoServicePlugin.mmp	Wed Jun 09 09:42:37 2010 +0300
@@ -17,6 +17,7 @@
 
 
 #include <platform_paths.hrh>
+#include "../../../symbian_version.hrh"
 
 TARGET          HtiSysInfoServicePlugin.dll
 TARGETTYPE      PLUGIN
@@ -41,8 +42,11 @@
 TARGET          HtiSysInfoServicePlugin.rsc
 END
 
+#if ( SYMBIAN_VERSION_SUPPORT < SYMBIAN_4 )
+LIBRARY         avkon.lib
+#endif
+
 LIBRARY         aknskinsrv.lib
-LIBRARY         avkon.lib
 LIBRARY         bafl.lib
 LIBRARY         btdevice.lib
 LIBRARY         btmanclient.lib
--- a/htiui/HtiServicePlugins/HtiSysInfoServicePlugin/inc/HtiSysInfoServicePlugin.h	Tue May 11 16:14:15 2010 +0300
+++ b/htiui/HtiServicePlugins/HtiSysInfoServicePlugin/inc/HtiSysInfoServicePlugin.h	Wed Jun 09 09:42:37 2010 +0300
@@ -21,6 +21,8 @@
 #define HTISYSINFOPLUGIN_H
 
 // INCLUDES
+#include "../../../symbian_version.hrh"
+
 #include <e32property.h>
 #include <f32file.h>
 #include <HtiServicePluginInterface.h>
@@ -48,7 +50,9 @@
 
         void NotifyMemoryChange( TInt aAvailableMemory );
 
+#if ( SYMBIAN_VERSION_SUPPORT < SYMBIAN_4 )
         static TInt HandleAllowSSPropertyChange( TAny* aPtr );
+#endif
 
     protected:
 
@@ -106,10 +110,12 @@
         HBufC8* iMemEater;
         HBufC8* iReply;
         CHtiLightsController* iLightsController;
+        CHtiPropertySubscriber* iAllowSSSubscriber;
+#if ( SYMBIAN_VERSION_SUPPORT < SYMBIAN_4 )
         TInt iAllowSSValue;
-        CHtiPropertySubscriber* iAllowSSSubscriber;
         RProperty iAllowSSProperty;
         TBool iAllowSSPropertyAttached;
+#endif
         TBool iGalleryUpdateSupported;
     };
 
--- a/htiui/HtiServicePlugins/HtiSysInfoServicePlugin/src/HtiSysInfoServicePlugin.cpp	Tue May 11 16:14:15 2010 +0300
+++ b/htiui/HtiServicePlugins/HtiSysInfoServicePlugin/src/HtiSysInfoServicePlugin.cpp	Wed Jun 09 09:42:37 2010 +0300
@@ -23,7 +23,11 @@
 #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>
@@ -43,7 +47,6 @@
 #include <mmtsy_names.h>
 #include <rmmcustomapi.h>
 #include <hwrmpowerstatesdkpskeys.h>
-#include <ScreensaverInternalPSKeys.h>
 #include <settingsinternalcrkeys.h>
 #include <sysutil.h>
 #include <tz.h>
@@ -80,7 +83,6 @@
 _LIT8( KErrDescrSysUtil, "SysUtil failed" );
 _LIT8( KErrDescrSetTime, "Setting time failed" );
 _LIT8( KErrDescrDateTimeFormat, "Setting date and time formats failed" );
-_LIT8( KErrDescrScreenSaver, "Setting screen saver state failed" );
 _LIT8( KErrDescrGetNetworkModes, "Getting network modes failed" );
 _LIT8( KErrDescrSetNetworkMode, "Setting network mode failed" );
 _LIT8( KErrDescrIrActivation, "IR activation failed" );
@@ -90,11 +92,14 @@
 _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( KErrDescrInvalidSSTimeout, "Invalid screen saver timeout value" );
-_LIT8( KErrDescrSSTimeoutFailed, "Setting screen saver timeout failed" );
 _LIT8( KErrDescrDrmDbConnect, "DRM DB connect failed." );
 _LIT8( KErrDescrDrmDbDelete,  "DRM DB delete failed." );
 _LIT8( KErrDescrBatteryLevel, "Getting battery level failed." );
@@ -176,9 +181,12 @@
 // Constructor
 //------------------------------------------------------------------------------
 CHtiSysInfoServicePlugin::CHtiSysInfoServicePlugin():
-    iMemEater( NULL ), iReply( NULL ), iAllowSSValue( -1 ),
-    iAllowSSPropertyAttached( EFalse ), iGalleryUpdateSupported( ETrue )
+    iMemEater( NULL ), iReply( NULL ), iGalleryUpdateSupported( ETrue )
     {
+#if ( SYMBIAN_VERSION_SUPPORT < SYMBIAN_4 )
+        iAllowSSValue = -1;
+        iAllowSSPropertyAttached = EFalse;
+#endif
     }
 
 //------------------------------------------------------------------------------
@@ -199,7 +207,9 @@
         {
         iAllowSSSubscriber->Unsubscribe();
         }
+#if ( SYMBIAN_VERSION_SUPPORT < SYMBIAN_4 )
     iAllowSSProperty.Close();
+#endif 
     delete iAllowSSSubscriber;
     }
 
@@ -514,6 +524,7 @@
         }
     }
 
+#if ( SYMBIAN_VERSION_SUPPORT < SYMBIAN_4 )
 //------------------------------------------------------------------------------
 // CHtiSysInfoServicePlugin::HandleAllowSSPropertyChange
 //------------------------------------------------------------------------------
@@ -537,7 +548,7 @@
     return err;
     }
 
-
+#endif
 /*
  * Private helper methods
  */
@@ -1458,6 +1469,9 @@
 void CHtiSysInfoServicePlugin::HandleScreenSaverCommandL(
                                     const TDesC8& aMessage )
     {
+    HTI_LOG_FUNC_IN(
+            "CHtiSysInfoServicePlugin::HandleScreenSaverCommandL" );
+#if ( SYMBIAN_VERSION_SUPPORT < SYMBIAN_4 ) 
     if ( aMessage.Length() != 1 )
         {
         iDispatcher->DispatchOutgoingErrorMessage(
@@ -1522,6 +1536,12 @@
 
     iReply = HBufC8::NewL( 1 );
     iReply->Des().Append( 0 );
+#else
+    iDispatcher->DispatchOutgoingErrorMessage(KErrArgument,
+            KErrDescrNotSupported, KSysInfoServiceUid);
+#endif 
+    HTI_LOG_FUNC_OUT(
+                "CHtiSysInfoServicePlugin::HandleScreenSaverCommandL" );
     }
 
 //------------------------------------------------------------------------------
@@ -1532,6 +1552,7 @@
     {
     HTI_LOG_FUNC_IN(
             "CHtiSysInfoServicePlugin::HandleScreenSaverTimeoutCommandL" );
+#if ( SYMBIAN_VERSION_SUPPORT < SYMBIAN_4 )
     if ( aMessage.Length() != 2 )
         {
         iDispatcher->DispatchOutgoingErrorMessage(
@@ -1566,6 +1587,10 @@
         }
 
     delete persRep;
+#else
+    iDispatcher->DispatchOutgoingErrorMessage(KErrArgument,
+            KErrDescrNotSupported, KSysInfoServiceUid);
+#endif 
     HTI_LOG_FUNC_OUT(
         "CHtiSysInfoServicePlugin::HandleScreenSaverTimeoutCommandL" );
     }
@@ -2145,7 +2170,7 @@
 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,
@@ -2212,7 +2237,10 @@
         }
 
     keyLock.Close();
-
+#else
+    iDispatcher->DispatchOutgoingErrorMessage(KErrArgument,
+            KErrDescrNotSupported, KSysInfoServiceUid);
+#endif    
     HTI_LOG_FUNC_OUT( "CHtiSysInfoServicePlugin::HandleKeyLockToggleL" );
     }
 
--- a/htiui/group/bld.inf	Tue May 11 16:14:15 2010 +0300
+++ b/htiui/group/bld.inf	Wed Jun 09 09:42:37 2010 +0300
@@ -30,6 +30,7 @@
 // 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"
--- a/htiui/rom/htiui.iby	Tue May 11 16:14:15 2010 +0300
+++ b/htiui/rom/htiui.iby	Wed Jun 09 09:42:37 2010 +0300
@@ -29,6 +29,7 @@
 
 // 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)
--- a/htiui/rom/htiui_10_1.iby	Tue May 11 16:14:15 2010 +0300
+++ b/htiui/rom/htiui_10_1.iby	Wed Jun 09 09:42:37 2010 +0300
@@ -27,6 +27,7 @@
 
 // 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)
--- a/htiui/sis/HTI_S60-10_1.pkg	Tue May 11 16:14:15 2010 +0300
+++ b/htiui/sis/HTI_S60-10_1.pkg	Wed Jun 09 09:42:37 2010 +0300
@@ -18,7 +18,7 @@
 &EN
 
 ; Using UID of HtiFramework project
-#{"HTI"},(0x1020DEB6),2,21,0
+#{"HTI"},(0x1020DEB6),2,23,0
 
 ; Series60 product id for S60 5.2
 [0x20022E6D], 0, 0, 0, {"Series60ProductID"}
@@ -84,6 +84,8 @@
 "\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"
@@ -108,4 +110,4 @@
 "\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"
+;"\epoc32\data\Z\private\101f875a\import\1020deb6.rsc"            - "c:\private\101f875a\import\[1020deb6].rsc"
--- a/htiui/sis/HTI_S60-52.pkg	Tue May 11 16:14:15 2010 +0300
+++ b/htiui/sis/HTI_S60-52.pkg	Wed Jun 09 09:42:37 2010 +0300
@@ -18,7 +18,7 @@
 &EN
 
 ; Using UID of HtiFramework project
-#{"HTI"},(0x1020DEB6),2,21,0
+#{"HTI"},(0x1020DEB6),2,23,0
 
 ; Series60 product id for S60 5.2
 [0x20022E6D], 0, 0, 0, {"Series60ProductID"}
@@ -84,6 +84,8 @@
 "\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"
@@ -111,4 +113,4 @@
 "\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"
+;"\epoc32\data\Z\private\101f875a\import\1020deb6.rsc"            - "c:\private\101f875a\import\[1020deb6].rsc"
--- a/htiui/sis/HTI_S60_Upgrade-10_1.pkg	Tue May 11 16:14:15 2010 +0300
+++ b/htiui/sis/HTI_S60_Upgrade-10_1.pkg	Wed Jun 09 09:42:37 2010 +0300
@@ -18,7 +18,7 @@
 &EN
 
 ; Using UID of HtiFramework project
-#{"HTI"},(0x1020DEB6),2,21,0,TYPE=SA,RU
+#{"HTI"},(0x1020DEB6),2,23,0,TYPE=SA,RU
 
 ; Series60 product id for S60 5.2
 [0x20022E6D], 0, 0, 0, {"Series60ProductID"}
@@ -84,6 +84,8 @@
 "\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"
@@ -108,4 +110,4 @@
 "\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"
+;"\epoc32\data\Z\private\101f875a\import\1020deb6.rsc"            - "c:\private\101f875a\import\[1020deb6].rsc"
--- a/htiui/sis/HTI_S60_Upgrade-52.pkg	Tue May 11 16:14:15 2010 +0300
+++ b/htiui/sis/HTI_S60_Upgrade-52.pkg	Wed Jun 09 09:42:37 2010 +0300
@@ -18,7 +18,7 @@
 &EN
 
 ; Using UID of HtiFramework project
-#{"HTI"},(0x1020DEB6),2,21,0,TYPE=SA,RU
+#{"HTI"},(0x1020DEB6),2,23,0,TYPE=SA,RU
 
 ; Series60 product id for S60 5.2
 [0x20022E6D], 0, 0, 0, {"Series60ProductID"}
@@ -84,6 +84,8 @@
 "\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"
@@ -111,4 +113,4 @@
 "\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"
+;"\epoc32\data\Z\private\101f875a\import\1020deb6.rsc"            - "c:\private\101f875a\import\[1020deb6].rsc"
--- a/htiui/sis/HTI_stub.pkg	Tue May 11 16:14:15 2010 +0300
+++ b/htiui/sis/HTI_stub.pkg	Wed Jun 09 09:42:37 2010 +0300
@@ -18,7 +18,7 @@
 &EN
 
 ; Using UID of HtiFramework project
-#{"HTI"},(0x1020DEB6),2,21,0
+#{"HTI"},(0x1020DEB6),2,23,0
 
 ; Localised Vendor name
 %{"Nokia"}
@@ -81,6 +81,8 @@
 ""- "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"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/piprofilerui/group/bld.inf	Wed Jun 09 09:42:37 2010 +0300
@@ -0,0 +1,26 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:   
+*
+*/
+
+
+
+#include <platform_paths.hrh>
+
+#include "bld_generic.inf"
+#include "../ui/avkon/group/bld.inf"
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/piprofilerui/group/bld_generic.inf	Wed Jun 09 09:42:37 2010 +0300
@@ -0,0 +1,34 @@
+/*
+* 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: 
+*
+*/
+
+PRJ_MMPFILES
+#ifndef SBSV2
+  #ifdef MARM
+  gnumakefile piprofiler_stub_sis.mk
+  #endif
+#endif
+
+PRJ_EXTENSIONS
+#ifdef SBSV2
+  #ifdef MARM
+  START EXTENSION app-services/buildstubsis
+  OPTION SRCDIR ../sis
+  OPTION SISNAME PIProfiler_stub
+  END
+  #endif  
+#endif
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/piprofilerui/group/group.pro	Wed Jun 09 09:42:37 2010 +0300
@@ -0,0 +1,21 @@
+#
+# Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+#
+# Contributors:
+#
+# Description: 
+#
+#
+
+TEMPLATE = subdirs
+
+BLD_INF_RULES.prj_platforms += "$${LITERAL_HASH}include  \"bld_generic.inf\""
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/piprofilerui/piprofilerui.pro	Wed Jun 09 09:42:37 2010 +0300
@@ -0,0 +1,23 @@
+#
+# Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+#
+# Contributors:
+#
+# Description: 
+#
+#
+
+TEMPLATE = subdirs
+
+DEFINES += QT_NO_DEBUG_OUTPUT QT_NO_WARNING_OUTPUT QT_NO_DEBUG
+
+SUBDIRS = group \
+          ui/hb
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/piprofilerui/sis/PIProfiler_S60-30.pkg	Wed Jun 09 09:42:37 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: 
+;
+&EN
+
+; Standard SIS file header
+#{"PIProfilerUI"},(0x2001E5AE),2,2,01,TYPE=SA, RU
+
+; Supports S60 v 3.0 and 5.0
+[0x101F7961], 0, 0, 0, {"S60ProductID"}
+
+; Non-localised vendor name
+:"Nokia Corporation"
+
+; Localised vendor names
+%{"Nokia Corporation"}
+
+; normal stuff:
+"\epoc32\RELEASE\armv5\urel\PIProfilerUI.exe"-"!:\sys\bin\PIProfilerUI.exe"
+"\epoc32\data\z\Resource\apps\piprofilerui_aif.mif"-"!:\Resource\Apps\piprofilerui_aif.mif"
+"\epoc32\data\z\Resource\apps\piprofilerui_ExtraIcons.mif"-"!:\Resource\Apps\piprofilerui_ExtraIcons.mif"
+"\epoc32\data\z\Resource\apps\piprofilerui.rsc"-"!:\Resource\Apps\piprofilerui.rsc"
+"\epoc32\data\z\PRIVATE\10003A3F\APPS\piprofilerui_reg.rsc"-"!:\private\10003a3f\import\apps\piprofilerui_reg.rsc"
+"..\ui\avkon\group\backup_registration.xml"-"!:\private\2001E5AE\backup_registration.xml"
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/piprofilerui/sis/PIProfiler_S60-31.pkg	Wed Jun 09 09:42:37 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: 
+;
+&EN
+
+; Standard SIS file header
+#{"PIProfilerUI"},(0x2001E5AE),2,2,01,TYPE=SA, RU
+
+; Supports S60 v 3.0 and 5.0
+[0x101F7961], 0, 0, 0, {"S60ProductID"}
+
+; Non-localised vendor name
+:"Nokia Corporation"
+
+; Localised vendor names
+%{"Nokia Corporation"}
+
+; normal stuff:
+"\epoc32\RELEASE\armv5\urel\PIProfilerUI.exe"-"!:\sys\bin\PIProfilerUI.exe"
+"\epoc32\data\z\Resource\apps\piprofilerui_aif.mif"-"!:\Resource\Apps\piprofilerui_aif.mif"
+"\epoc32\data\z\Resource\apps\piprofilerui_ExtraIcons.mif"-"!:\Resource\Apps\piprofilerui_ExtraIcons.mif"
+"\epoc32\data\z\Resource\apps\piprofilerui.rsc"-"!:\Resource\Apps\piprofilerui.rsc"
+"\epoc32\data\z\PRIVATE\10003A3F\APPS\piprofilerui_reg.rsc"-"!:\private\10003a3f\import\apps\piprofilerui_reg.rsc"
+"..\ui\avkon\group\backup_registration.xml"-"!:\private\2001E5AE\backup_registration.xml"
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/piprofilerui/sis/PIProfiler_S60-32.pkg	Wed Jun 09 09:42:37 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: 
+;
+&EN
+
+; Standard SIS file header
+#{"PIProfilerUI"},(0x2001E5AE),2,2,01,TYPE=SA, RU
+
+; Supports S60 v 3.0 and 5.0
+[0x101F7961], 0, 0, 0, {"S60ProductID"}
+
+; Non-localised vendor name
+:"Nokia Corporation"
+
+; Localised vendor names
+%{"Nokia Corporation"}
+
+; normal stuff:
+"\epoc32\RELEASE\armv5\urel\PIProfilerUI.exe"-"!:\sys\bin\PIProfilerUI.exe"
+"\epoc32\data\z\Resource\apps\piprofilerui_aif.mif"-"!:\Resource\Apps\piprofilerui_aif.mif"
+"\epoc32\data\z\Resource\apps\piprofilerui_ExtraIcons.mif"-"!:\Resource\Apps\piprofilerui_ExtraIcons.mif"
+"\epoc32\data\z\Resource\apps\piprofilerui.rsc"-"!:\Resource\Apps\piprofilerui.rsc"
+"\epoc32\data\z\PRIVATE\10003A3F\APPS\piprofilerui_reg.rsc"-"!:\private\10003a3f\import\apps\piprofilerui_reg.rsc"
+"..\ui\avkon\group\backup_registration.xml"-"!:\private\2001E5AE\backup_registration.xml"
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/piprofilerui/sis/PIProfiler_S60-50.pkg	Wed Jun 09 09:42:37 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: 
+;
+&EN
+
+; Standard SIS file header
+#{"PIProfilerUI"},(0x2001E5AE),2,2,01,TYPE=SA, RU
+
+; Supports S60 v 3.0 and 5.0
+[0x101F7961], 0, 0, 0, {"S60ProductID"}
+
+; Non-localised vendor name
+:"Nokia Corporation"
+
+; Localised vendor names
+%{"Nokia Corporation"}
+
+; normal stuff:
+"\epoc32\RELEASE\armv5\urel\PIProfilerUI.exe"-"!:\sys\bin\PIProfilerUI.exe"
+"\epoc32\data\z\Resource\apps\piprofilerui_aif.mif"-"!:\Resource\Apps\piprofilerui_aif.mif"
+"\epoc32\data\z\Resource\apps\piprofilerui_ExtraIcons.mif"-"!:\Resource\Apps\piprofilerui_ExtraIcons.mif"
+"\epoc32\data\z\Resource\apps\piprofilerui.rsc"-"!:\Resource\Apps\piprofilerui.rsc"
+"\epoc32\data\z\PRIVATE\10003A3F\APPS\piprofilerui_reg.rsc"-"!:\private\10003a3f\import\apps\piprofilerui_reg.rsc"
+"..\ui\avkon\group\backup_registration.xml"-"!:\private\2001E5AE\backup_registration.xml"
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/piprofilerui/sis/PIProfiler_Symbian3.pkg	Wed Jun 09 09:42:37 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: 
+;
+&EN
+
+; Standard SIS file header
+#{"PIProfilerUI"},(0x2001E5AE),2,2,01,TYPE=SA, RU
+
+; Supports S60 v 3.0 and 5.0
+[0x101F7961], 0, 0, 0, {"S60ProductID"}
+
+; Non-localised vendor name
+:"Nokia Corporation"
+
+; Localised vendor names
+%{"Nokia Corporation"}
+
+; normal stuff:
+"\epoc32\RELEASE\armv5\urel\PIProfilerUI.exe"-"!:\sys\bin\PIProfilerUI.exe"
+"\epoc32\data\z\Resource\apps\piprofilerui_aif.mif"-"!:\Resource\Apps\piprofilerui_aif.mif"
+"\epoc32\data\z\Resource\apps\piprofilerui_ExtraIcons.mif"-"!:\Resource\Apps\piprofilerui_ExtraIcons.mif"
+"\epoc32\data\z\Resource\apps\piprofilerui.rsc"-"!:\Resource\Apps\piprofilerui.rsc"
+"\epoc32\data\z\PRIVATE\10003A3F\APPS\piprofilerui_reg.rsc"-"!:\private\10003a3f\import\apps\piprofilerui_reg.rsc"
+"..\ui\avkon\group\backup_registration.xml"-"!:\private\2001E5AE\backup_registration.xml"
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/piprofilerui/sis/PIProfiler_Symbian4.pkg	Wed Jun 09 09:42:37 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: 
+;
+&EN
+
+; Standard SIS file header
+#{"PIProfilerUI"},(0x2001E5AE),2,2,01,TYPE=SA, RU
+
+; Supports S60 v 3.0 and 5.0
+[0x101F7961], 0, 0, 0, {"S60ProductID"}
+
+; Non-localised vendor name
+:"Nokia Corporation"
+
+; Localised vendor names
+%{"Nokia Corporation"}
+
+; normal stuff:
+"\epoc32\RELEASE\armv5\urel\PIProfilerUI.exe"-"!:\sys\bin\PIProfilerUI.exe"
+"\epoc32\data\z\Resource\apps\piprofilerui_aif.mif"-"!:\Resource\Apps\piprofilerui_aif.mif"
+"\epoc32\data\z\Resource\apps\piprofilerui_ExtraIcons.mif"-"!:\Resource\Apps\piprofilerui_ExtraIcons.mif"
+"\epoc32\data\z\Resource\apps\piprofilerui.rsc"-"!:\Resource\Apps\piprofilerui.rsc"
+"\epoc32\data\z\PRIVATE\10003A3F\APPS\piprofilerui_reg.rsc"-"!:\private\10003a3f\import\apps\piprofilerui_reg.rsc"
+"..\ui\avkon\group\backup_registration.xml"-"!:\private\2001E5AE\backup_registration.xml"
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/piprofilerui/sis/PIProfiler_stub.pkg	Wed Jun 09 09:42:37 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: 
+;
+&EN
+
+; Standard SIS file header
+#{"ProfilerGUI"},(0x2001E5AE),1,0,0
+
+; Non-localised vendor name
+:"Nokia Corporation"
+
+; Localised vendor names
+%{"Nokia Corporation"}
+
+; normal stuff:
+""-"!:\sys\bin\PIProfilerUI.exe"
+""-"!:\Resource\Apps\piprofilerui_aif.mif"
+""-"!:\Resource\Apps\piprofilerui_ExtraIcons.mif"
+""-"!:\Resource\Apps\piprofilerui.rsc"
+""-"!:\private\10003a3f\import\apps\piprofilerui_reg.rsc"
+""-"!:\private\2001E5AE\backup_registration.xml"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/piprofilerui/ui/avkon/data/piprofilerui.rss	Wed Jun 09 09:42:37 2010 +0300
@@ -0,0 +1,962 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:   
+*
+*/
+
+
+
+
+NAME PIPR
+
+#include <eikon.rh>
+#include <eikon.rsg>
+#include <avkon.rh>
+#include <avkon.rsg>
+#include <avkon.mbg>
+#include <CommonDialogs.hrh>
+#include <CommonDialogs.rh>
+#include <pathconfiguration.hrh>
+
+#include "profiler_gui.hrh"
+#include "profiler_gui_std.h"
+#include <data_caging_paths_strings.hrh>
+#include <appinfo.rh>
+
+
+// ---------------------------------------------------------
+//   
+//    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 { }
+	
+//----------------------------------------------------
+//   
+//    r_profiler_gui_hotkeys
+//
+//----------------------------------------------------
+//
+RESOURCE HOTKEYS r_profiler_gui_hotkeys
+    {
+    control=
+        {
+        HOTKEY { command=EAknCmdExit; key='e'; }
+        };
+    }
+
+
+//----------------------------------------------------
+//    r_profiler_gui_view_main
+//----------------------------------------------------
+//
+RESOURCE AVKON_VIEW r_profiler_gui_view_main
+    {
+    hotkeys=r_profiler_gui_hotkeys;
+    menubar=r_profiler_gui_menubar_view_main;  
+    cba=R_AVKON_SOFTKEYS_OPTIONS_EXIT;    
+    }
+
+//----------------------------------------------------
+//    r_profiler_gui_menubar_view_main
+//----------------------------------------------------
+//
+RESOURCE MENU_BAR r_profiler_gui_menubar_view_main
+    {
+    titles=
+        {
+        MENU_TITLE { menu_pane=r_profiler_gui_app_menu; txt="App"; },
+        MENU_TITLE { menu_pane=r_profiler_gui_view_main_menu; txt="Main"; }
+        };
+    }
+
+//----------------------------------------------------
+//    r_profiler_gui_view_main_menu
+//----------------------------------------------------
+//
+
+RESOURCE MENU_PANE r_profiler_gui_view_main_menu
+    {
+    items=
+        {
+        };
+    }
+
+           
+        
+//----------------------------------------------------
+//    r_profiler_gui_app_menu
+//----------------------------------------------------
+//
+RESOURCE MENU_PANE r_profiler_gui_app_menu
+    {
+    items=
+        {
+        MENU_ITEM { command=EProfilerGuiCmdStartAll;cascade = r_profiler_start_submenu; txt="Start"; },
+        MENU_ITEM { command=EProfilerGuiCmdStopAll; txt="Stop profiling"; },
+        MENU_ITEM { command=EProfilerGuiCmdSamplerControl; txt="Sampler control"; cascade=r_profiler_sampler_control_menu; }, 
+        MENU_ITEM { command=EProfilerGuiCmdSettings; txt="Settings"; },
+        MENU_ITEM { command=EProfilerGuiCmdAbout; txt="About"; },
+        MENU_ITEM { command=EAknCmdExit; txt="Exit"; }
+        };
+    }
+
+//----------------------------------------------------
+//    r_profiler_start_submenu
+//----------------------------------------------------
+//
+RESOURCE MENU_PANE r_profiler_start_submenu
+    {
+    items = 
+        {
+        MENU_ITEM 
+            {
+            command = EProfilerGuiCmdStartAll;
+            txt = "Profiling";
+            }
+        };
+    }
+
+//----------------------------------------------------
+//    r_profiler_sampler_control_menu
+//----------------------------------------------------
+//
+RESOURCE MENU_PANE r_profiler_sampler_control_menu
+    {
+    items=
+        {
+        MENU_ITEM { command=EProfilerGuiCmdSamplerEnable; txt="Enable"; },
+        MENU_ITEM { command=EProfilerGuiCmdSamplerDisable; txt="Disable"; },
+        MENU_ITEM { command=EProfilerGuiCmdSamplerSettings; txt="Sampler settings"; },
+        MENU_ITEM { command=EProfilerGuiCmdSamplerInfo; txt="Sampler info"; }
+        };
+    }
+
+
+//----------------------------------------------------
+//    r_profiler_gui_settings_dialog
+//    Dialog for setting list
+//----------------------------------------------------
+//
+RESOURCE DIALOG r_profiler_gui_settings_dialog
+    {
+    flags =
+        EEikDialogFlagNoDrag | EEikDialogFlagFillAppClientRect |
+        EEikDialogFlagButtonsRight | EEikDialogFlagCbaButtons |
+        EEikDialogFlagWait | EEikDialogFlagNoTitleBar;
+    buttons = R_AVKON_SOFTKEYS_OPTIONS_BACK;
+    items =
+        {
+        DLG_LINE
+            {
+            type = EAknCtSettingListBox;
+            id = EProfilerGuiSettingItemList;
+            itemflags = EEikDlgItemTakesEnterKey | EEikDlgItemOfferAllHotKeys;
+            control = LISTBOX
+                {
+                flags = EAknListBoxSelectionList;
+                };
+            }
+        };
+    }
+
+// generic resources
+RESOURCE POPUP_SETTING_LIST r_popup_setting_list_editor
+	{
+	}
+RESOURCE AVKON_SETTING_PAGE r_binary_setting_page
+    {   
+    number = EAknSettingPageNoOrdinalDisplayed;
+    type = EAknCtPopupSettingList;
+	editor_resource_id = r_popup_setting_list_editor;
+    }
+RESOURCE AVKON_POPUP_SETTING_TEXTS r_yesno_binaryselection_texts
+	{
+	setting_texts_resource = r_yesno_binaryselection_text_array;
+	}
+RESOURCE ARRAY r_yesno_binaryselection_text_array
+	{
+	items =
+		{
+		AVKON_ENUMERATED_TEXT { value=0; text = "No"; },
+		AVKON_ENUMERATED_TEXT { value=1; text = "Yes"; }
+		};
+	}
+
+
+//
+// resources for plugin name mode selection
+//
+RESOURCE TBUF r_plugin_name_mode_setting_title
+    {
+    buf = "Sampler name length";
+    }
+RESOURCE AVKON_SETTING_PAGE r_plugin_name_mode_setting_page
+	{
+    number = EAknSettingPageNoOrdinalDisplayed; 
+	type = EAknCtPopupSettingList;
+	editor_resource_id = r_popup_setting_list_editor;
+	}
+RESOURCE AVKON_POPUP_SETTING_TEXTS r_plugin_name_mode_setting_texts
+	{
+	setting_texts_resource = r_plugin_name_mode_text_array;
+	}
+RESOURCE ARRAY r_plugin_name_mode_text_array
+	{
+	items =
+		{
+		AVKON_ENUMERATED_TEXT { value=ESamplerNameShort; text = "Short"; },
+		AVKON_ENUMERATED_TEXT { value=ESamplerNameMedium; text = "Medium"; },
+		AVKON_ENUMERATED_TEXT { value=ESamplerNameLong; text = "Long"; }
+		};
+	}
+
+
+//
+// resources for trace output selection
+//
+RESOURCE TBUF r_trace_output_setting_title
+    {
+    buf = "Output to";
+    }
+RESOURCE AVKON_SETTING_PAGE r_trace_output_setting_page
+	{
+    number = EAknSettingPageNoOrdinalDisplayed; 
+	type = EAknCtPopupSettingList;
+	editor_resource_id = r_popup_setting_list_editor;
+	}
+RESOURCE AVKON_POPUP_SETTING_TEXTS r_trace_output_setting_texts
+	{
+	setting_texts_resource = r_trace_output_text_array;
+	}
+RESOURCE ARRAY r_trace_output_text_array
+	{
+	items =
+		{
+		AVKON_ENUMERATED_TEXT { value=EOutputToDebugPort; text = "Debug output"; },
+		AVKON_ENUMERATED_TEXT { value=EOutputToFileSystem; text = "File system"; }
+		};
+	}
+
+
+//
+// resources for save_file_prefix selection
+//
+RESOURCE TBUF r_save_file_prefix_setting_title
+    {
+    buf = "File prefix";
+    }
+RESOURCE AVKON_SETTING_PAGE r_save_file_prefix_setting_page
+	{
+	type = EEikCtEdwin;
+	editor_resource_id = r_save_file_prefix_text_editor;
+	}
+
+RESOURCE EDWIN r_save_file_prefix_text_editor
+	{
+	lines = 0;  // expanding to multiple rows
+	maxlength = 63;
+	flags = EEikEdwinNoLineOrParaBreaks;
+	}
+
+//
+// resources for save file drive selection
+//
+RESOURCE TBUF r_save_file_drive_setting_title
+    {
+    buf = "Save file in";
+    }
+RESOURCE AVKON_SETTING_PAGE r_save_file_drive_setting_page
+	{
+	type = EEikCtEdwin;
+	editor_resource_id = r_save_file_drive_text_editor;
+	}
+
+RESOURCE EDWIN r_save_file_drive_text_editor
+	{
+	lines = 0;  // expanding to multiple rows
+	maxlength = 63;	
+	flags = EEikEdwinNoLineOrParaBreaks;
+	}
+
+//
+// resources for trace mode selection
+//
+RESOURCE TBUF r_trace_mode_setting_title
+    {
+    buf = "Trace mode";
+    }
+RESOURCE AVKON_SETTING_PAGE r_trace_mode_setting_page
+	{
+    number = EAknSettingPageNoOrdinalDisplayed; 
+	type = EAknCtPopupSettingList;
+	editor_resource_id = r_popup_setting_list_editor;
+	}
+RESOURCE AVKON_POPUP_SETTING_TEXTS r_trace_mode_setting_texts
+	{
+	setting_texts_resource = r_trace_mode_text_array;
+	}
+RESOURCE ARRAY r_trace_mode_text_array
+	{
+	items =
+		{
+		AVKON_ENUMERATED_TEXT { value=ETraceModeStream; text = "Stream"; },
+		AVKON_ENUMERATED_TEXT { value=ETraceModeBuffer; text = "Memory buffer"; }
+		};
+	}
+
+//
+// resources for timed_sampling_period selection
+//
+RESOURCE TBUF r_timed_sampling_period_setting_title
+    {
+    buf = "Profiling period (sec.)";
+    }
+RESOURCE AVKON_SETTING_PAGE r_timed_sampling_period_setting_page
+    {
+    type = EAknCtIntegerEdwin;
+    editor_resource_id = r_timed_sampling_period_integer_editor;
+    }
+
+RESOURCE AVKON_INTEGER_EDWIN r_timed_sampling_period_integer_editor
+    {
+    maxlength = 6;
+    min = 1;
+    max = 999999;
+    }
+
+
+//----------------------------------------------------
+//    r_profiler_gui_settings_menubar
+//----------------------------------------------------
+//
+
+RESOURCE MENU_BAR r_profiler_gui_settings_menubar
+    {
+    titles =
+        {
+        MENU_TITLE
+            {
+            menu_pane = r_profiler_gui_settings_menupane;
+            txt = " ";   // dummy
+            }
+        };
+    }
+
+RESOURCE MENU_PANE r_profiler_gui_settings_menupane
+    {
+    items =
+        {
+        MENU_ITEM
+            {
+            command = EProfilerGuiCmdSettingsChange;
+            txt = "Change";
+            },
+        MENU_ITEM
+            {
+            command = EProfilerGuiCmdSettingsExit;
+            txt = "Exit";
+            }
+        };
+    }
+
+//----------------------------------------------------
+//    r_profiler_gui_settings_dialog
+//    Dialog for setting list
+//----------------------------------------------------
+//
+RESOURCE DIALOG r_profiler_sampler_settings_dialog
+    {
+    flags =
+        EEikDialogFlagNoDrag | EEikDialogFlagFillAppClientRect |
+        EEikDialogFlagButtonsRight | EEikDialogFlagCbaButtons |
+        EEikDialogFlagWait | EEikDialogFlagNoTitleBar;
+    buttons = R_AVKON_SOFTKEYS_OPTIONS_BACK;
+    items =
+        {
+        DLG_LINE
+            {
+            type = EAknCtSettingListBox;
+            id = EProfilerSamplerSettingItemList;
+            itemflags = EEikDlgItemTakesEnterKey | EEikDlgItemOfferAllHotKeys;
+            control = LISTBOX
+                {
+                flags = EAknListBoxSelectionList;
+                };
+            }
+        };
+    }
+
+//----------------------------------------------------
+//    r_profiler_sampler_settings_menubar
+//----------------------------------------------------
+//
+
+RESOURCE MENU_BAR r_profiler_sampler_settings_menubar
+    {
+    titles =
+        {
+        MENU_TITLE
+            {
+            menu_pane = r_profiler_sampler_settings_menupane;
+            txt = "Sampler settings";
+            }
+        };
+    }
+
+RESOURCE MENU_PANE r_profiler_sampler_settings_menupane
+    {
+    items =
+        {
+        MENU_ITEM
+            {
+            command = EProfilerGuiCmdSettingsChange;
+            txt = "Change";
+            },
+        MENU_ITEM
+            {
+            command = EProfilerGuiCmdSettingsExit;
+            txt = "Exit";
+            }
+        };
+    }
+
+  
+// ---------------------------------------------------------
+//   
+//   r_profiler_gui_about_dialog
+//   About dialog - show version and copyright info etc.
+//
+// ---------------------------------------------------------
+//
+RESOURCE DIALOG r_profiler_gui_about_dialog
+    {
+    flags = EGeneralQueryFlags | EEikDialogFlagNoBorder | EEikDialogFlagNoShadow;
+    buttons = R_AVKON_SOFTKEYS_OK_EMPTY;
+    items=
+        {
+        DLG_LINE
+            {
+            type = EAknCtPopupHeadingPane;
+            id = EAknMessageQueryHeaderId;
+            control = AVKON_HEADING
+                {
+                label = "About Profiler";
+                headinglayout = R_AVKON_WML_SIGN_QUERY_HEADING_PANE;
+                };
+            },
+        DLG_LINE
+            {
+            type = EAknCtMessageQuery;
+            id = EAknMessageQueryContentId;
+            control = AVKON_MESSAGE_QUERY
+                {
+               	message = "Version 2.2.0.2 - 4th May 2010. Copyright © 2010 Nokia Corporation and/or its subsidiary(-ies). All rights reserved.";
+                };
+            }
+        };
+    }
+
+// ---------------------------------------------------------
+//   r_sampler_rate_setting_page
+// ---------------------------------------------------------
+//
+RESOURCE AVKON_SETTING_PAGE r_sampler_rate_setting_page
+    {
+    type = EAknCtIntegerEdwin;
+    editor_resource_id = r_sampler_rate_integer_editor;
+    }
+RESOURCE AVKON_INTEGER_EDWIN r_sampler_rate_integer_editor
+    {
+    maxlength = 6;
+    min = 250;
+    max = 999999;
+    }    
+
+// ---------------------------------------------------------
+//   r_cpu_sampler_rate_setting_page
+// ---------------------------------------------------------
+//
+RESOURCE AVKON_SETTING_PAGE r_cpu_sampler_rate_setting_page
+    {
+    type = EAknCtIntegerEdwin;
+    editor_resource_id = r_cpu_sampler_rate_integer_editor;
+    }
+RESOURCE AVKON_INTEGER_EDWIN r_cpu_sampler_rate_integer_editor
+    {
+    maxlength = 5;
+    min = 1;
+    max = 10000;
+    } 
+
+// ---------------------------------------------------------
+//   
+//   r_generic_sampler_dlg_line_sample_rate
+//   Empty about dialog - show sampler plugin info in this
+//
+// ---------------------------------------------------------
+//
+RESOURCE DLG_LINE r_generic_sampler_dlg_line_sample_rate
+    {
+    type = EEikCtNumberEditor;
+    prompt = "Sample rate (ms)";
+    id = EProfilerGuiGenericSamplerQuerySampleRate;
+    itemflags = EEikDlgItemTakesEnterKey | EEikDlgItemOfferAllHotKeys;
+    control = NUMBER_EDITOR
+        {
+        min = 1000;    
+        max = 10000;    
+        };
+    }
+
+// ---------------------------------------------------------
+//   
+//   r_profiler_gui_empty_about_dialog
+//   Empty about dialog - show sampler plugin info in this
+//
+// ---------------------------------------------------------
+//
+RESOURCE DIALOG r_profiler_gui_empty_about_dialog
+    {
+    flags = EGeneralQueryFlags | EEikDialogFlagNoBorder | EEikDialogFlagNoShadow;
+    buttons = R_AVKON_SOFTKEYS_OK_EMPTY;
+    items=
+        {
+        DLG_LINE
+            {
+            type = EAknCtPopupHeadingPane;
+            id = EAknMessageQueryHeaderId;
+            control = AVKON_HEADING
+                {
+                label = "About";
+                headinglayout = R_AVKON_WML_SIGN_QUERY_HEADING_PANE;
+                };
+            },
+        DLG_LINE
+            {
+            type = EAknCtMessageQuery;
+            id = EAknMessageQueryContentId;
+            control = AVKON_MESSAGE_QUERY
+                {
+                message = "";
+                };
+            }
+        };
+    }
+
+
+RESOURCE TBUF r_dummy_setting_title
+    {
+    buf = "";
+    }
+
+RESOURCE TBUF r_sample_rate_setting_title
+    {
+    buf = "Sample rate (ms)";
+    }
+
+RESOURCE TBUF r_item1_setting_title
+    {
+    buf = "Item1";
+    }
+
+RESOURCE TBUF r_item2_setting_title
+    {
+    buf = "Item2";
+    }
+
+RESOURCE TBUF r_item3_setting_title
+    {
+    buf = "Item3";
+    }
+
+RESOURCE TBUF r_item4_setting_title
+    {
+    buf = "Item4";
+    }
+
+RESOURCE TBUF r_item5_setting_title
+    {
+    buf = "Item5";
+    }
+
+RESOURCE TBUF r_item6_setting_title
+    {
+    buf = "Item6";
+    }
+
+RESOURCE AVKON_SETTING_PAGE r_numeric_setting_page
+	{
+	type = EAknCtIntegerEdwin;
+	editor_resource_id = r_numeric_integer_editor;
+	}
+RESOURCE AVKON_INTEGER_EDWIN r_numeric_integer_editor
+	{
+	maxlength = 5;
+	min = 0;
+	max = 10000;
+	}    
+
+//
+// resources for text selection
+//
+RESOURCE AVKON_SETTING_PAGE r_generic_text_setting_page
+	{
+	type = EEikCtEdwin;
+	editor_resource_id = r_generic_text_editor;
+	}
+
+RESOURCE EDWIN r_generic_text_editor
+	{
+	lines = 0;  // expanding to multiple rows
+	maxlength = 63;	
+	flags = EEikEdwinNoLineOrParaBreaks;
+	}
+
+
+// ---------------------------------------------------------
+//   r_general_confirmation_query
+// ---------------------------------------------------------
+//
+
+RESOURCE DIALOG r_general_confirmation_query
+	{
+	flags = EGeneralQueryFlags;
+	buttons = R_AVKON_SOFTKEYS_YES_NO;
+	items =
+		{
+		DLG_LINE
+			{
+			type = EAknCtQuery;
+			id = EGeneralQuery;
+			control = AVKON_CONFIRMATION_QUERY
+				{
+				layout = EConfirmationQueryLayout;
+				};
+			}
+		};
+	}
+
+// ---------------------------------------------------------
+//   r_general_text_query
+// ---------------------------------------------------------
+//
+RESOURCE DIALOG r_general_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
+                    {
+                    width = 256;
+                    lines = 3;
+                    maxlength = 256;
+                    };
+                };
+            }
+        };
+    }
+
+// ---------------------------------------------------------
+//   r_general_text_query
+// ---------------------------------------------------------
+//
+RESOURCE DIALOG r_general_numeric_query
+    {
+    flags = EGeneralQueryFlags;
+    buttons = R_AVKON_SOFTKEYS_OK_CANCEL;
+    items =
+        {
+        DLG_LINE
+            {
+            type = EAknCtQuery;
+            id = EGeneralQuery;
+            control= AVKON_DATA_QUERY
+                {
+                layout = ENumberLayout;
+                control = AVKON_INTEGER_EDWIN
+                    {
+                    min = -999999;
+                    max = 999999;
+                    };
+                };
+            }
+        };
+    }
+
+
+// ---------------------------------------------------------
+//   r_item_action_query
+// ---------------------------------------------------------
+//
+RESOURCE DIALOG r_item_action_query_enabled
+    {
+    flags = EGeneralQueryFlags;
+    buttons = R_AVKON_SOFTKEYS_OK_CANCEL;
+    items =
+        {
+        AVKON_LIST_QUERY_DLG_LINE
+            {
+            control= AVKON_LIST_QUERY_CONTROL
+                {
+				listtype = EAknCtSinglePopupMenuListBox;
+				listbox = AVKON_LIST_QUERY_LIST
+					{
+					array_id = r_item_action_query_array_enabled;
+					};
+				heading = "Sampler controls";
+			    };
+            }
+        };
+    }
+
+RESOURCE DIALOG r_item_action_query_disabled
+    {
+    flags = EGeneralQueryFlags;
+    buttons = R_AVKON_SOFTKEYS_OK_CANCEL;
+    items =
+        {
+        AVKON_LIST_QUERY_DLG_LINE
+            {
+            control= AVKON_LIST_QUERY_CONTROL
+                {
+				listtype = EAknCtSinglePopupMenuListBox;
+				listbox = AVKON_LIST_QUERY_LIST
+					{
+					array_id = r_item_action_query_array_disabled;
+					};
+				heading = "Sampler controls";
+			    };
+            }
+        };
+    }
+
+RESOURCE DIALOG r_item_action_query_hidden_settings_enabled
+    {
+    flags = EGeneralQueryFlags;
+    buttons = R_AVKON_SOFTKEYS_OK_CANCEL;
+    items =
+        {
+        AVKON_LIST_QUERY_DLG_LINE
+            {
+            control= AVKON_LIST_QUERY_CONTROL
+                {
+                listtype = EAknCtSinglePopupMenuListBox;
+                listbox = AVKON_LIST_QUERY_LIST
+                    {
+                    array_id = r_item_action_query_array_hidden_settings_enabled;
+                    };
+                heading = "Sampler controls";
+                };
+            }
+        };
+    }
+
+RESOURCE DIALOG r_item_action_query_hidden_settings_disabled
+    {
+    flags = EGeneralQueryFlags;
+    buttons = R_AVKON_SOFTKEYS_OK_CANCEL;
+    items =
+        {
+        AVKON_LIST_QUERY_DLG_LINE
+            {
+            control= AVKON_LIST_QUERY_CONTROL
+                {
+                listtype = EAknCtSinglePopupMenuListBox;
+                listbox = AVKON_LIST_QUERY_LIST
+                    {
+                    array_id = r_item_action_query_array_hidden_settings_disabled;
+                    };
+                heading = "Sampler controls";
+                };
+            }
+        };
+    }
+
+RESOURCE DIALOG r_item_action_query_hidden_start_stop
+    {
+    flags = EGeneralQueryFlags;
+    buttons = R_AVKON_SOFTKEYS_OK_CANCEL;
+    items =
+        {
+        AVKON_LIST_QUERY_DLG_LINE
+            {
+            control= AVKON_LIST_QUERY_CONTROL
+                {
+				listtype = EAknCtSinglePopupMenuListBox;
+				listbox = AVKON_LIST_QUERY_LIST
+					{
+					array_id = r_item_action_query_array_hidden_start_stop;
+					};
+				heading = "Sampler controls";
+			    };
+            }
+        };
+    }
+
+RESOURCE ARRAY r_item_action_query_array_disabled
+	{
+	items =
+		{
+		LBUF {txt = "Enable"; },
+		LBUF {txt = "Sampler settings"; },
+		LBUF {txt = "Sampler info"; }
+		};
+	} 	
+
+RESOURCE ARRAY r_item_action_query_array_enabled
+	{
+	items =
+		{
+		LBUF {txt = "Disable"; },
+		LBUF {txt = "Sampler settings"; },
+		LBUF {txt = "Sampler info"; }
+		};
+	} 
+
+RESOURCE ARRAY r_item_action_query_array_hidden_settings_disabled
+    {
+    items =
+        {
+        LBUF {txt = "Enable"; },
+        LBUF {txt = "Sampler info"; }
+        };
+    } 
+
+RESOURCE ARRAY r_item_action_query_array_hidden_settings_enabled
+    {
+    items =
+        {
+        LBUF {txt = "Disable"; },
+        LBUF {txt = "Sampler info"; }
+        };
+    } 
+
+RESOURCE ARRAY r_item_action_query_array_hidden_start_stop
+	{
+	items =
+		{
+		LBUF {txt = "Sampler settings"; },
+		LBUF {txt = "Sampler info"; }
+		};
+	} 
+
+RESOURCE STATUS_PANE_APP_MODEL r_profiler_gui_status_pane
+	{
+	panes = 
+		{
+		SPANE_PANE
+			{
+			id = EEikStatusPaneUidTitle;
+			type = EAknCtTitlePane;
+			resource = r_profiler_gui_title_resource;
+			},
+		SPANE_PANE
+			{
+			id = EEikStatusPaneUidNavi;
+			type = EAknCtNaviPane;
+			resource = r_profiler_gui_navi_text_idle;
+			}
+		};
+	}
+
+RESOURCE TITLE_PANE r_profiler_gui_title_resource
+	{
+	txt = "PI Profiler";
+	}
+
+RESOURCE TBUF r_profiler_gui_navi_text_idle
+	{
+	buf = "Idle";
+	}
+
+RESOURCE TBUF r_profiler_gui_navi_text_initializing
+	{
+	buf = "Initializing...";
+	}
+
+RESOURCE TBUF r_profiler_gui_navi_text_running
+	{
+	buf = "Profiling...";
+	}
+
+RESOURCE TBUF r_profiler_gui_navi_text_stopping
+	{
+	buf = "Stopping...";
+	}
+
+RESOURCE DIALOG r_profiler_gui_conf_query
+	{
+	flags = EAknGeneralQueryFlags;
+	buttons = R_AVKON_SOFTKEYS_YES_NO;
+	items = 
+		{
+		DLG_LINE
+			{
+			type = EAknCtQuery;
+			id = EProfilerGuiViewConfQuery;
+			control = AVKON_CONFIRMATION_QUERY
+				{
+				layout = EConfirmationQueryLayout;
+				label = "Leave profiling on?";
+				};
+			}
+		};
+	}
+
+//   
+//    RESOURCE LOCALISABLE_APP_INFO
+//
+// ---------------------------------------------------------
+//
+RESOURCE LOCALISABLE_APP_INFO r_profiler_gui_localisable_app_info
+    {
+    short_caption = "PI Profiler";
+    caption_and_icon = 
+    CAPTION_AND_ICON_INFO
+        {
+        caption = "PI Profiler";
+
+        number_of_icons = 1;
+
+        // Note for ROM-based apps it is recommended to add the drive letter
+        icon_file = APP_BITMAP_DIR"\\piprofilerui_aif.mif";
+        };
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/piprofilerui/ui/avkon/data/piprofilerui_reg.rss	Wed Jun 09 09:42:37 2010 +0300
@@ -0,0 +1,36 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:   
+*
+*/
+
+
+
+
+#include <piprofilerui.rsg>
+#include <appinfo.rh>
+#include <data_caging_paths_strings.hrh>
+
+
+UID2 KUidAppRegistrationResourceFile
+UID3 0x2001E5AE
+
+
+RESOURCE APP_REGISTRATION_INFO
+    {
+    app_file = "PIProfilerUI";
+    localisable_resource_file = APP_RESOURCE_DIR"\\PIProfilerUI";
+    localisable_resource_id = R_PROFILER_GUI_LOCALISABLE_APP_INFO;
+    group_name = "RnD Tools";    
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/piprofilerui/ui/avkon/group/backup_registration.xml	Wed Jun 09 09:42:37 2010 +0300
@@ -0,0 +1,8 @@
+<?xml version="1.0" standalone="yes"?>
+<backup_registration>
+  <passive_backup>
+    <include_directory name="\"/>
+  </passive_backup>
+  <system_backup/>
+  <restore requires_reboot = "no"/>
+</backup_registration>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/piprofilerui/ui/avkon/group/bld.inf	Wed Jun 09 09:42:37 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:   
+*
+*/
+
+
+
+#include <platform_paths.hrh>
+
+
+PRJ_EXPORTS
+../group/backup_registration.xml    Z:/private/2001E5AE/backup_registration.xml
+../rom/piprofilerui_avkon.iby		CORE_IBY_EXPORT_PATH(tools,piprofilerui.iby)
+
+PRJ_MMPFILES
+#ifndef SBSV2
+  gnumakefile piprofilerui_icons_aif.mk
+  gnumakefile piprofilerui_extraicons.mk
+#endif
+
+piprofilerui.mmp
+
+
+#ifdef SBSV2
+  PRJ_EXTENSIONS
+  START EXTENSION s60/mifconv
+  OPTION TARGETFILE piprofilerui_aif.mif
+  OPTION SOURCEDIR ../../icons
+  OPTION SOURCES -c8,8 qgn_menu_piprofilerui
+  END
+
+  START EXTENSION s60/mifconv
+  OPTION TARGETFILE piprofilerui_extraicons.mif
+  OPTION HEADERFILE piprofilerui_extraicons.mbg
+  OPTION SOURCEDIR ../../icons
+  OPTION SOURCES -c8,8 qgn_prob_piprofilerui_status_disabled -c8,8 qgn_prob_piprofilerui_status_enabled
+  END
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/piprofilerui/ui/avkon/group/piprofilerui.mmp	Wed Jun 09 09:42:37 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:   
+*
+*/
+
+
+
+#include <data_caging_paths.hrh>
+#include <platform_paths.hrh>
+
+
+TARGET            PIProfilerUI.exe
+TARGETTYPE        exe
+EPOCSTACKSIZE     0x8000
+EPOCHEAPSIZE      0x10000 0x1000000  // Min 64Kb, Max 16Mb
+
+UID               0x100039CE 0x2001E5AE
+
+VENDORID          VID_DEFAULT
+CAPABILITY        ALL -TCB //swevent networkservices
+SMPSAFE
+
+LANG              SC
+
+START RESOURCE    ../data/piprofilerui.rss
+HEADER
+TARGETPATH        APP_RESOURCE_DIR
+END
+
+START RESOURCE    ../data/piprofilerui_reg.rss
+DEPENDS           piprofilerui.rsg
+TARGETPATH        /private/10003a3f/apps
+END
+
+APP_LAYER_SYSTEMINCLUDE
+USERINCLUDE       ../inc
+SOURCEPATH        ../src
+
+
+SOURCE            profiler_gui_app.cpp
+SOURCE            profiler_gui_document.cpp 
+SOURCE            profiler_gui_appui.cpp
+SOURCE            profiler_gui_model.cpp
+SOURCE            profiler_gui_mainview.cpp 
+SOURCE            profiler_gui_maincontainer.cpp 
+SOURCE            profiler_gui_settingsviewdlg.cpp
+SOURCE            profiler_gui_samplersettingsviewdlg.cpp
+
+
+LIBRARY           euser.lib
+LIBRARY			  eiksrv.lib
+LIBRARY           CommonEngine.lib
+LIBRARY           apparc.lib
+LIBRARY           cone.lib 
+LIBRARY           eikcore.lib
+LIBRARY           eikcoctl.lib
+LIBRARY           eikctl.lib
+LIBRARY           eikdlg.lib  
+LIBRARY           avkon.lib 
+LIBRARY           ws32.lib 
+LIBRARY           apgrfx.lib
+LIBRARY           efsrv.lib
+LIBRARY           bafl.lib
+LIBRARY           gdi.lib
+LIBRARY           aknnotify.lib
+LIBRARY           aknicon.lib
+LIBRARY           aknskins.lib
+LIBRARY           aknskinsrv.lib
+LIBRARY           egul.lib
+LIBRARY           estor.lib
+LIBRARY           flogger.lib
+LIBRARY			  charconv.lib 
+LIBRARY			  sysutil.lib 
+LIBRARY			  platformenv.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/piprofilerui/ui/avkon/group/piprofilerui_extraicons.mk	Wed Jun 09 09:42:37 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:   
+#
+
+ifeq (WINS,$(findstring WINS, $(PLATFORM)))
+ZDIR=$(EPOCROOT)epoc32\release\$(PLATFORM)\$(CFG)\z
+else
+ZDIR=$(EPOCROOT)epoc32\data\z
+endif
+
+TARGETDIR=$(ZDIR)\resource\apps
+ICONTARGETFILENAME=$(TARGETDIR)\piprofilerui_extraicons.mif
+
+HEADERDIR=$(EPOCROOT)epoc32\include
+HEADERFILENAME=$(HEADERDIR)\piprofilerui_extraicons.mbg
+
+
+do_nothing :
+	@rem do_nothing
+
+MAKMAKE : do_nothing
+
+BLD : do_nothing
+
+CLEAN :
+	@if exist $(ICONTARGETFILENAME) erase $(ICONTARGETFILENAME)
+	@if exist $(HEADERFILENAME) erase $(HEADERFILENAME)
+
+LIB : do_nothing
+
+CLEANLIB : do_nothing
+
+RESOURCE : $(ICONTARGETFILENAME)
+
+$(ICONTARGETFILENAME) (HEADERFILENAME) : ..\..\icons\qgn_prob_piprofilerui_status_disabled.svg ..\..\icons\qgn_prob_piprofilerui_status_enabled.svg
+	mifconv $(ICONTARGETFILENAME) /h$(HEADERFILENAME) \
+		/c8,8 ..\..\icons\qgn_prob_piprofilerui_status_disabled.svg \
+		/c8,8 ..\..\icons\qgn_prob_piprofilerui_status_enabled.svg
+
+FREEZE : do_nothing
+
+SAVESPACE : do_nothing
+
+RELEASABLES :
+	@echo $(HEADERFILENAME) && \
+	@echo $(ICONTARGETFILENAME)
+
+FINAL : do_nothing
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/piprofilerui/ui/avkon/group/piprofilerui_icons_aif.mk	Wed Jun 09 09:42:37 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:   
+#
+
+ifeq (WINS,$(findstring WINS, $(PLATFORM)))
+ZDIR=$(EPOCROOT)epoc32\release\$(PLATFORM)\$(CFG)\z
+else
+ZDIR=$(EPOCROOT)epoc32\data\z
+endif
+
+TARGETDIR=$(ZDIR)\resource\apps
+ICONTARGETFILENAME=$(TARGETDIR)\piprofilerui_aif.mif
+
+
+do_nothing :
+	@rem do_nothing
+
+MAKMAKE : do_nothing
+
+BLD : do_nothing
+
+CLEAN :
+	@if exist $(ICONTARGETFILENAME) erase $(ICONTARGETFILENAME)
+	
+LIB : do_nothing
+
+CLEANLIB : do_nothing
+
+RESOURCE : $(ICONTARGETFILENAME)
+
+$(ICONTARGETFILENAME) : ..\..\icons\qgn_menu_piprofilerui.svg
+	mifconv $(ICONTARGETFILENAME) \
+		/c8,8 ..\..\icons\qgn_menu_piprofilerui.svg
+
+FREEZE : do_nothing
+
+SAVESPACE : do_nothing
+
+RELEASABLES :
+	@echo $(ICONTARGETFILENAME)
+
+FINAL : do_nothing
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/piprofilerui/ui/avkon/inc/profiler_gui.hrh	Wed Jun 09 09:42:37 2010 +0300
@@ -0,0 +1,117 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:   
+*
+*/
+
+
+
+#ifndef PROFILERGUI_HRH
+#define PROFILERGUI_HRH
+
+enum TProfilerCmdSamplerIds
+    {
+    EProfilerGuiCmdSamplerEnable = 1,   // id cannot be 0
+    EProfilerGuiCmdSamplerDisable,
+    EProfilerGuiCmdSamplerSettings,
+    EProfilerGuiCmdSamplerInfo
+    };
+
+enum TSamplerSettingItemIds
+    {
+    EProfilerGuiGenericSamplerQuerySampleRate = 0,
+    EProfilerGuiGenericSamplerQueryItem1,
+    EProfilerGuiGenericSamplerQueryItem2,
+    EProfilerGuiGenericSamplerQueryItem3,
+    EProfilerGuiGenericSamplerQueryItem4,
+    EProfilerGuiGenericSamplerQueryItem5,
+    EProfilerGuiGenericSamplerQueryItem6
+    };
+
+enum TGeneralSettingItemIds
+    {
+    ESettingListItemPluginTraceOutput = 0,
+    ESettingListItemPluginSaveFileDrive,
+    ESettingListItemPluginTraceFilePrefix,
+    ESettingListItemPluginSamplingTime
+    };
+
+enum TProfilerGuiCommandIds
+    {
+    EProfilerGuiCmdStart = 1000,
+    EProfilerGuiCmdStop,
+    EProfilerGuiCmdStartAll,
+    EProfilerGuiCmdStartTimed,
+    EProfilerGuiCmdStopAll,
+    
+    EProfilerGuiCmdSamplerControl,
+    EProfilerGuiCmdSamplerSettingsChange,
+    EProfilerGuiCmdSamplerSettingsExit,
+    
+    EProfilerGuiCmdSettings,
+    EProfilerGuiCmdSettingsChange,
+    EProfilerGuiCmdSettingsExit,
+    EProfilerGuiCmdSettingsBack,
+
+    EProfilerGuiCmdAbout,
+
+    EProfilerGuiViewConfQuery,
+    EProfilerGuiSettingItemList,
+    EProfilerSamplerSettingItemList
+    };
+
+enum TProfilerGuiSettingSamplerNameLength
+	{
+	ESamplerNameShort,
+	ESamplerNameMedium,
+	ESamplerNameLong
+	};
+
+enum TProfilerGuiSettingTraceMode
+	{
+	ETraceModeStream,
+	ETraceModeBuffer
+	};
+
+enum TProfilerGuiSettingOutputMode
+	{
+	EOutputToDebugPort = 0,
+	EOutputToFileSystem
+	};
+
+enum TProfilerGuiSettingSaveFileDrive
+	{
+	ETraceSaveFileDriveC,
+	ETraceSaveFileDriveD,
+	ETraceSaveFileDriveE,
+	ETraceSaveFileDriveF,
+	ETraceSaveFileDriveG,
+	ETraceSaveFileDriveH,
+	ETraceSaveFileDriveI,
+	ETraceSaveFileDriveJ,
+	ETraceSaveFileDriveK,
+	ETraceSaveFileDriveL
+	};
+
+enum TItemActionMenuTypes
+    {
+    EItemActionMenuTypeEnable = 0,
+    EItemActionMenuTypeDisable,
+    EItemActionMenuTypeEditSettings,    
+    EItemActionMenuTypeInfo,    
+    EItemActionMenuTypeStart,	// for future use
+    EItemActionMenuTypeStop	    // for future use
+    };
+
+#endif      // PROFILERGUI_HRH
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/piprofilerui/ui/avkon/inc/profiler_gui_app.h	Wed Jun 09 09:42:37 2010 +0300
@@ -0,0 +1,61 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:   
+*
+*/
+
+
+
+#ifndef PROFILER_GUI_APP_H
+#define PROFILER_GUI_APP_H
+
+
+// INCLUDES
+#include <aknapp.h>
+
+// CONSTANTS
+// UID of the application
+const TUid KUidProfilerGui = { 0x2001E5AE };
+
+// CLASS DECLARATION
+
+/**
+* CProfilerGuiApp application class.
+* Provides factory to create concrete document object.
+* 
+*/
+class CProfilerGuiApp : public CAknApplication
+    {
+    
+    public: // Functions from base classes
+
+    private:
+
+        /**
+        * From CApaApplication, creates CProfilerGuiDocument document object.
+        * @return A pointer to the created document object.
+        */
+        CApaDocument* CreateDocumentL();
+        
+        /**
+        * From CApaApplication, returns application's UID (KUidProfilerGui).
+        * @return The value of KUidProfilerGui.
+        */
+        TUid AppDllUid() const;
+    };
+
+#endif
+
+// End of File
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/piprofilerui/ui/avkon/inc/profiler_gui_appui.h	Wed Jun 09 09:42:37 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:   
+*
+*/
+
+
+
+#ifndef PROFILER_GUI_APPUI_H
+#define PROFILER_GUI_APPUI_H
+
+// INCLUDES
+#include <eikapp.h>
+#include <eikdoc.h>
+#include <e32std.h>
+#include <coeccntx.h>
+#include <aknViewAppUi.h>
+#include <akntabgrp.h>
+#include <aknnavide.h>
+#include "profiler_gui_std.h"
+
+// profiler engine inclusions
+#include <piprofiler/ProfilerConfig.h>
+
+// FORWARD DECLARATIONS
+class CProfilerGuiModel;
+
+// CLASS DECLARATIONS
+
+class CProfilerGuiAppUi : public CAknViewAppUi
+    {
+public: // constructors and destructor
+    void ConstructL();
+    ~CProfilerGuiAppUi();
+    
+    // profiler specific 
+	void StartProfilerL();
+	void StopProfilerL();
+private: // From MEikMenuObserver
+    void DynInitMenuPaneL(TInt aResourceId,CEikMenuPane* aMenuPane);
+
+private:
+    void HandleCommandL(TInt aCommand);
+    virtual TKeyResponse HandleKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType);
+    void HandleSystemEventL(const TWsEvent& aEvent);
+    
+    void SaveSettingsL();
+	void LoadSettingsL();
+	TInt RunConfQueryL( const TDesC* aOverrideText ); 
+private: //Data
+    CProfilerGuiModel*              iModel;
+    };
+
+#endif
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/piprofilerui/ui/avkon/inc/profiler_gui_attributes.h	Wed Jun 09 09:42:37 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:   
+*
+*/
+
+
+
+#ifndef PROFILER_GUI_ATTRIBUTES_H
+#define PROFILER_GUI_ATTRIBUTES_H
+
+// INCLUDES
+#include <e32std.h>
+#include <e32base.h>
+
+// CONSTANTS
+
+// FORWARD DECLARATIONS
+
+// CLASS DECLARATIONS
+       
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/piprofilerui/ui/avkon/inc/profiler_gui_document.h	Wed Jun 09 09:42:37 2010 +0300
@@ -0,0 +1,78 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:   
+*
+*/
+
+
+
+#ifndef PROFILER_GUI_DOCUMENT_H
+#define PROFILER_GUI_DOCUMENT_H
+
+// INCLUDES
+#include <AknDoc.h>
+   
+// CONSTANTS
+
+// FORWARD DECLARATIONS
+class CEikAppUi;
+class CProfilerGuiModel;
+
+
+// CLASS DECLARATION
+
+/**
+*  CProfilerGuiDocument application class.
+*/
+class CProfilerGuiDocument : public CAknDocument
+    {
+    public: // Constructors and destructor
+        static CProfilerGuiDocument* NewL(CEikApplication& aApp);
+        virtual ~CProfilerGuiDocument();
+
+    public: // New functions
+
+    public:	// from CEikDocument
+
+    protected:  // New functions
+
+    protected:  // Functions from base classes
+
+    private:
+
+        /**
+        * EPOC default constructor.
+        */
+        CProfilerGuiDocument(CEikApplication& aApp);
+        void ConstructL();
+
+    private:
+
+        /**
+        * From CEikDocument, create CProfilerGuiAppUi "App UI" object.
+        */
+        CEikAppUi* CreateAppUiL();
+
+    public:
+        inline CProfilerGuiModel* Model() { return iModel; }
+
+    private:
+        CProfilerGuiModel* iModel;
+
+    };
+
+#endif
+
+// End of File
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/piprofilerui/ui/avkon/inc/profiler_gui_maincontainer.h	Wed Jun 09 09:42:37 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:   
+*
+*/
+
+
+
+#ifndef PROFILER_GUI_VALUESCONTAINER_H
+#define PROFILER_GUI_VALUESCONTAINER_H
+
+// INCLUDES
+#include <coecntrl.h>
+#include <eiklbo.h> 
+#include <aknlists.h> 
+#include <AknInfoPopupNoteController.h> 
+
+// FORWARD DECLARATIONS
+class CProfilerGuiModel;
+class CAknInfoPopupNoteController;
+
+// CLASS DECLARATIONS
+
+class CProfilerGuiMainContainer : public CCoeControl, MCoeControlObserver, MEikListBoxObserver
+    {
+public:
+    void ConstructL(const TRect& aRect);
+    ~CProfilerGuiMainContainer();
+
+private:
+    void SizeChanged();  
+    TInt CountComponentControls() const;
+    CCoeControl* ComponentControl(TInt aIndex) const;
+    void Draw(const TRect& aRect) const;
+    void HandleResourceChange(TInt aType);
+    void HandleListBoxEventL(CEikListBox* aListBox, TListBoxEvent aEventType);  // From MEikListBoxObserver
+    void HandleControlEventL(CCoeControl* aControl,TCoeEvent aEventType);  // From MCoeControlObserver
+	TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType);
+
+public:
+    const CArrayFix<TInt>* ListBoxSelectionIndexes();
+    TInt ListBoxSelectionIndexesCount();
+    void SetDefaultTitlePaneTextL();
+    TInt CurrentListBoxItemIndex();
+    void SetListBoxTextArrayL(CDesCArray* aTextArray);
+    inline CAknSingleGraphicStyleListBox* ListBox() { return iListBox; }
+    void ShowWriterInfoPopupL(const TDesC& aNote);
+private:
+    CProfilerGuiModel*                              iModel;
+    CAknSingleGraphicStyleListBox*      			iListBox;
+    CAknInfoPopupNoteController*        			iInfoPopup;
+    };
+
+#endif
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/piprofilerui/ui/avkon/inc/profiler_gui_mainview.h	Wed Jun 09 09:42:37 2010 +0300
@@ -0,0 +1,83 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:   
+*
+*/
+
+
+
+#ifndef PROFILER_GUI_VALUESVIEW_H
+#define PROFILER_GUI_VALUESVIEW_H
+
+// INCLUDES
+#include <aknview.h>
+
+#include "profiler_gui_std.h"
+#include "profiler_gui_model.h"
+
+
+// CONSTANTS
+// UID of view
+const TUid KMainViewUID = {1};
+
+// FORWARD DECLARATIONS
+class CProfilerGuiMainContainer;
+class CProfilerGuiModel;
+class CProfilerEngineStatusChecker;
+class CAknNavigationDecorator;
+
+
+/**
+*  CProfilerGuiMainView view class.
+* 
+*/
+class CProfilerGuiMainView : public CAknView
+    {
+    public: // Constructors and destructor
+        void ConstructL();
+        ~CProfilerGuiMainView();
+
+    public: // Functions from base classes
+        TUid Id() const;
+        void HandleCommandL(TInt aCommand);
+        void HandleClientRectChange();
+        
+        /**
+         * Method for updating the Profiler engine status pane
+         * Called by Model class
+         * 
+         * @param aStatus new status of profiler engine  
+         */
+        void UpdateStatusPaneL( TInt aStatus ); 
+        
+    private: // From MEikMenuObserver
+        void DynInitMenuPaneL(TInt aResourceId, CEikMenuPane* aMenuPane);
+        
+    private: // From AknView
+        void DoActivateL(const TVwsViewId& aPrevViewId, TUid aCustomMessageId, const TDesC8& aCustomMessage);
+        void DoDeactivate();
+        void HandleStatusPaneSizeChange();
+        void SetupStatusPaneL();
+        void CleanupStatusPaneL();
+		HBufC* GetLabelTextLC(TInt aStatus);
+    private: // Data
+    	CAknNavigationDecorator*			iNaviDecorator;
+        CProfilerGuiMainContainer*        	iContainer;
+        CProfilerGuiModel*                  iModel;
+
+    };
+
+#endif
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/piprofilerui/ui/avkon/inc/profiler_gui_model.h	Wed Jun 09 09:42:37 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:   
+*
+*/
+
+
+
+#ifndef PROFILER_GUI_MODEL_H
+#define PROFILER_GUI_MODEL_H
+
+// SYSTEM INCLUDES
+#include <e32std.h>
+#include <e32base.h>
+#include <apgcli.h>
+#include <gdi.h>
+#include <utf.h>
+#include <e32property.h>    // RProperty
+
+// LOCAL INCLUDES
+#include "profiler_gui_mainview.h"
+#include "profiler_gui.hrh"
+
+// COMMON INCLUDES
+#include <piprofiler/ProfilerConfig.h>
+#include <piprofiler/ProfilerAttributes.h>
+#include <piprofiler/ProfilerEngineStatusChecker.h>
+
+// setting keys (do not change uids of existing keys to maintain compatibility to older versions!)
+const TUid KPSettingPluginNameMode                         = { 0x00 };
+const TUid KPSettingPluginSaveFileDrive                    = { 0x01 };
+const TUid KPSettingPluginTraceOutput                      = { 0x02 };
+const TUid KPSettingPluginSaveFilePrefix                   = { 0x03 };
+const TUid KPSettingPluginTraceMode                        = { 0x04 };
+
+
+// FORWARD DECLARATIONS
+class CProfilerGuiMainView;
+class CProfilerGuiMainContainer;
+class CEikonEnv;
+class TSamplerAttributes;
+class CProfilerEngineStatusChecker;
+class MProfilerStatusObserver;
+
+
+typedef CArrayFixSeg<TSamplerAttributes> CSamplerItemList;
+
+
+
+class CProfilerGuiModel : public CActive, MProfilerStatusObserver
+	{
+private:
+    enum TContainerDrawState
+    	{
+    	EDrawStateInvalid = -1,
+    	EDrawStateMain
+    	};
+ public:
+	static CProfilerGuiModel* NewL();
+	~CProfilerGuiModel();
+	void ActivateModelL();
+	void DeActivateModelL();
+	void SetMainView(CProfilerGuiMainView* aMainView);
+	void UpdateState(TInt aState);
+	TBool GetSelectedItemHasSettings();
+    TBool GetSelectedItemEnabled();
+    TBool GetSelectedItemHidden();
+    TInt EditSelectedSamplerL(TInt index);
+    void SelectedSamplerInfoL(TInt index);
+    void TerminateProfilerL();
+    TBool CheckTraceLocationSanityL(TGeneralAttributes& aAttr, TBool aQuietCheck);
+ private:
+    void RunL();
+	void DoCancel();
+	void LoadPluginsL();	
+    TInt EditSamplerL(TSamplerAttributes& aItem);
+    void SamplerInfoL(TSamplerAttributes& aItem);
+private:
+	CProfilerGuiModel();
+	void ConstructL();
+    TInt LoadGeneralSettingsL();
+
+    void AppendToSamplerItemListL(TSamplerAttributes& aItem);
+    void DisableOrEnableFromSamplerItemListL(TInt aIndex);
+    void DeleteAllSamplerItems();
+    void RefreshViewL(TBool aClearSelection=ETrue);
+    void LaunchProfilerEngineL();
+    void UpdateUIRunningStateL();
+    TInt FindProcessL(RProcess& aProc);
+    
+public:
+    
+    enum TProfilingMode
+        {
+        EProfilingModeNormal = 0,
+        EProfilingModeTimed
+        };
+    
+ 	void StartAllSamplerItemsL(TProfilingMode aProfilingMode = EProfilingModeNormal);
+    void StopAllSamplerItemsL();
+    void DeleteAllSamplerItemsL();
+    void DisableAllSamplerItemsL();
+    void EnableAllSamplerItemsL();
+            
+    TInt SamplerItemCount() const;
+    void ShowItemActionMenuL();
+    void StopSelectedOrHighlightedItemsL();
+    void DisableOrEnableSelectedOrHighlightedItemsL();
+
+    CDesCArray* GenerateListBoxItemTextArrayL();
+	void StartNewSamplerL(TInt aCommand);
+    void AddNewSamplersL(CArrayFixFlat<TSamplerAttributes>& iSamplerAttributes);
+
+    void SaveGeneralSettingsL();
+    void SetMainContainer(CProfilerGuiMainContainer* aContainer);
+    TInt LaunchSettingsDialogL();
+    inline CEikonEnv* EikonEnv() { return iEnv; }
+    inline CProfilerGuiMainContainer* MainContainer() { return iMainContainer; }
+    inline TBool SamplerItemsExists() { return iSamplerItemList->Count() > 0; } 
+    inline TGeneralAttributes const& GeneralSettings() const { return iGeneralAttributes; }
+    
+    TPtrC GetWriterInfoNoteL(const TDesC& aNote);
+    void AttachClient();
+    void RemoveClient();
+
+public:
+    // from MProfilerStatusObserver
+    void NotifyContainerReadyL();
+    void HandleProfilerStatusChange( KProfilerStatus aStatus );
+    void HandleProfilerErrorL( TInt aError );
+        
+private:
+	static const TInt                   iSamplerNameMode = ESamplerNameLong;
+    CProfilerGuiMainContainer*          iMainContainer;
+    CEikonEnv*                          iEnv;
+    TInt                                iDrawState;
+    CSamplerItemList*                   iSamplerItemList;
+    TInt                                iReferenceNumber;
+    CArrayFixFlat<TSamplerAttributes>*	iSamplerAttributes;
+    TGeneralAttributes                  iGeneralAttributes;
+    TBool                               iProfilerStatus;   // Status of Engine before it was launched by this application
+    CProfilerGuiMainView*               iMainView;
+
+    // checkers
+    CProfilerEngineStatusChecker*       iStatusChecker;
+public:
+    TInt							     iState;
+    };
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/piprofilerui/ui/avkon/inc/profiler_gui_samplersettingsviewdlg.h	Wed Jun 09 09:42:37 2010 +0300
@@ -0,0 +1,92 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:   
+*
+*/
+
+
+
+#ifndef PROFILER_GUI_SAMPLERSETTINGSVIEWDLG_H
+#define PROFILER_GUI_SAMPLERSETTINGSVIEWDLG_H
+
+//  INCLUDES
+#include <AknDialog.h>
+#include <eiklbo.h>
+#include <AknTabObserver.h> 
+#include <akntabgrp.h>
+#include <aknsettingitemlist.h> 
+#include <akncheckboxsettingpage.h> 
+
+#include "profiler_gui_model.h"
+
+
+//  FORWARD DECLARATIONS
+class CAknSettingItemArray;
+class CAknSettingStyleListBox;
+class CAknNavigationControlContainer;
+class CAknNavigationDecorator;
+class CAknTabGroup; 
+class TProfilerSamplerSettings;
+
+// CONSTANTS
+const TUint KMaxItemCount = 7;
+const TInt KMaxSettingUITextLength = 64;
+
+//  CLASS DEFINITIONS
+
+class CProfilerSamplerSettingsViewDlg : public CAknDialog, public MEikListBoxObserver, public MAknTabObserver
+    {
+public:
+    static CProfilerSamplerSettingsViewDlg* NewL(TSamplerAttributes& aSettings);
+    virtual ~CProfilerSamplerSettingsViewDlg();
+
+public: // From MEikListBoxObserver
+    void HandleListBoxEventL(CEikListBox* aListBox, TListBoxEvent aEventType);
+
+public: // From MAknTabObserver
+    void TabChangedL(TInt aIndex); 
+
+public: // From CAknDialog
+    void ProcessCommandL(TInt aCommandId);
+
+protected: // From CEikDialog
+    TKeyResponse OfferKeyEventL(const TKeyEvent &aKeyEvent, TEventCode aType);
+    void PreLayoutDynInitL();
+    TBool OkToExitL(TInt aButtonId);    
+
+private: // New methods
+    void ShowSettingPageL(TBool aCalledFromMenu);
+    void SetVisibilitiesOfSettingItemsL();
+    void UpdateListBoxL();
+    void AddSettingItemL(TInt aId, TInt aTitleResource, TInt aSettingPageResource, TInt aAssociatedResource, TInt aOrdinal);
+
+private: // Constructors
+    CProfilerSamplerSettingsViewDlg(TSamplerAttributes& aSettings);
+    void ConstructL();        
+    CAknSettingItem* GetSettingItemL(TSettingItem& aItem, TInt aIndex, TInt& aSettingPageResource);
+private: // Data
+    CAknSettingItemArray*               iSettingItemArray;
+    CAknSettingStyleListBox*            iListBox;
+    CAknNavigationControlContainer*     iNaviContainer;
+    TSamplerAttributes&                 iSettings;
+    TInt 								iItemCount;
+    
+    // item bufs for textual settings data 
+    TInt                                iItemBuf[KMaxItemCount];
+    };
+
+#endif
+
+// End of File
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/piprofilerui/ui/avkon/inc/profiler_gui_settingsviewdlg.h	Wed Jun 09 09:42:37 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:   
+*
+*/
+
+
+
+#ifndef PROFILER_GUI_SETTINGSVIEWDLG_H
+#define PROFILER_GUI_SETTINGSVIEWDLG_H
+
+//  INCLUDES
+#include <AknDialog.h>
+#include <eiklbo.h>
+#include <AknTabObserver.h> 
+#include <akntabgrp.h>
+#include <aknsettingitemlist.h> 
+#include <akncheckboxsettingpage.h> 
+
+#include "profiler_gui_model.h"
+
+
+//  FORWARD DECLARATIONS
+class CAknSettingItemArray;
+class CAknSettingStyleListBox;
+class CAknNavigationControlContainer;
+class CAknNavigationDecorator;
+class CAknTabGroup; 
+class TProfilerGuiSettings;
+
+
+//  CLASS DEFINITIONS
+
+class CProfilerGuiSettingsViewDlg : public CAknDialog, public MEikListBoxObserver, public MAknTabObserver
+    {
+public:
+    static CProfilerGuiSettingsViewDlg* NewL(TGeneralAttributes& aSettings);
+    virtual ~CProfilerGuiSettingsViewDlg();
+
+public: // From MEikListBoxObserver
+    void HandleListBoxEventL(CEikListBox* aListBox, TListBoxEvent aEventType);
+
+public: // From MAknTabObserver
+    void TabChangedL(TInt aIndex); 
+
+public: // From CAknDialog
+    void ProcessCommandL(TInt aCommandId);
+
+protected: // From CEikDialog
+    TKeyResponse OfferKeyEventL(const TKeyEvent &aKeyEvent, TEventCode aType);
+    void PreLayoutDynInitL();
+    TBool OkToExitL(TInt aButtonId);    
+
+private: // New methods
+    void ShowSettingPageL(TBool aCalledFromMenu);
+    void SetVisibilitiesOfSettingItemsL();
+    void UpdateListBoxL();
+    void AddSettingItemL(TInt aId, TInt aTitleResource, TInt aSettingPageResource, TInt aAssociatedResource, TInt aOrdinal);
+
+private: // Constructors
+    CProfilerGuiSettingsViewDlg(TGeneralAttributes& aSettings);
+    void ConstructL();        
+
+private: // Data
+    CAknSettingItemArray*               iSettingItemArray;
+    CAknSettingStyleListBox*            iListBox;
+    CAknNavigationControlContainer*     iNaviContainer;
+    TGeneralAttributes&                 iSettings;
+    
+    // temporary member variables
+    TInt                                iTraceOutput;
+    TBuf<64>                            iSaveDrive;
+    TBuf<64>                            iFilePrefix;
+    };
+
+
+#endif
+
+// End of File
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/piprofilerui/ui/avkon/inc/profiler_gui_std.h	Wed Jun 09 09:42:37 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:   
+*
+*/
+
+
+
+#ifndef PROFILER_GUI_STD_H
+#define PROFILER_GUI_STD_H
+
+
+
+#endif
+
+// End of File
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/piprofilerui/ui/avkon/rom/piprofilerui_avkon.iby	Wed Jun 09 09:42:37 2010 +0300
@@ -0,0 +1,36 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:   
+*
+*/
+
+
+
+#ifndef __PROFILERGUI_IBY__
+#define __PROFILERGUI_IBY__
+
+S60_APP_EXE(PIProfilerUI)
+S60_APP_AIF_ICONS(PIProfilerUI)
+S60_APP_RESOURCE(PIProfilerUI)
+SCALABLE_IMAGE(APP_BITMAP_DIR, APP_BITMAP_DIR, PIProfilerui_ExtraIcons)
+#ifdef S60_UPGRADABLE_APP_REG_RSC
+  S60_UPGRADABLE_APP_REG_RSC(PIProfilerUI)
+#else
+  S60_APP_AIF_RSC(PIProfilerUI)
+#endif
+
+data=ZPRIVATE\2001E5AE\backup_registration.xml        	private\2001E5AE\backup_registration.xml
+data=ZSYSTEM\Install\PIProfilerUI_stub.sis              system\install\PIProfilerUI_stub.sis
+
+#endif // __PROFILERGUI_IBY__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/piprofilerui/ui/avkon/src/profiler_gui_app.cpp	Wed Jun 09 09:42:37 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:   
+*
+*/
+
+
+
+// INCLUDE FILES
+#include "profiler_gui_app.h"
+#include "profiler_gui_document.h"
+#include <piprofiler/ProfilerTraces.h>
+
+#include <eikstart.h>
+
+
+// ================= MEMBER FUNCTIONS =======================
+
+// ---------------------------------------------------------
+// CProfilerGuiApp::AppDllUid()
+// Returns application UID
+// ---------------------------------------------------------
+//
+TUid CProfilerGuiApp::AppDllUid() const
+    {
+    return KUidProfilerGui;
+    }
+   
+// ---------------------------------------------------------
+// CProfilerGuiApp::CreateDocumentL()
+// Creates CProfilerGuiDocument object
+// ---------------------------------------------------------
+//
+CApaDocument* CProfilerGuiApp::CreateDocumentL()
+    {
+    return CProfilerGuiDocument::NewL( *this );
+    }
+
+// ================= OTHER EXPORTED FUNCTIONS ==============
+
+LOCAL_C CApaApplication* NewApplication()
+    {
+    return new CProfilerGuiApp;
+    }
+
+
+GLDEF_C TInt E32Main()
+    {
+    return EikStart::RunApplication(NewApplication);
+    }
+
+// End of File  
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/piprofilerui/ui/avkon/src/profiler_gui_appui.cpp	Wed Jun 09 09:42:37 2010 +0300
@@ -0,0 +1,260 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:   
+*
+*/
+
+
+
+// INCLUDE FILES
+#include "profiler_gui_appui.h"
+#include "profiler_gui_mainview.h"
+#include "profiler_gui.hrh"
+#include "profiler_gui_model.h"
+#include "profiler_gui_document.h"
+#include <piprofilerui.rsg>
+#include <piprofiler/ProfilerTraces.h>
+#include <piprofiler/ProfilerSession.h>
+#include <piprofiler/ProfilerConfig.h>
+
+#include <AknWaitDialog.h>
+#include <AknGlobalNote.h>
+#include <avkon.hrh>
+#include <AknQueryDialog.h>
+#include <aknmessagequerydialog.h> 
+#include <pathinfo.h>
+
+
+// ================= MEMBER FUNCTIONS =======================
+
+void CProfilerGuiAppUi::ConstructL()
+    {
+    // set as system application to prevent getting shut down events 
+    iEikonEnv->SetSystem(ETrue);
+    
+    BaseConstructL(EAknEnableSkin);
+    
+    // get model
+    iModel = static_cast<CProfilerGuiDocument*>(reinterpret_cast<CEikAppUi*>(iEikonEnv->AppUi())->Document())->Model();
+	
+	LOGTEXT(_L("ProfilerGuiAppUi::ConstructL - setting main view settings"));
+    
+    CProfilerGuiMainView* mainView = new(ELeave) CProfilerGuiMainView;
+    CleanupStack::PushL(mainView);
+    mainView->ConstructL();
+    AddViewL(mainView);           // transfer ownership to CAknViewAppUi
+    CleanupStack::Pop();          // mainView
+
+	LOGTEXT(_L("ProfilerGuiAppUi::ConstructL - setting default view"));
+
+    SetDefaultViewL(*mainView);
+
+    LOGTEXT(_L("ProfilerGuiAppUi::ConstructL - activating model"));
+
+    // notify the model that everything has been constructed
+    iModel->ActivateModelL();
+    }
+
+// --------------------------------------------------------------------------------------------
+
+CProfilerGuiAppUi::~CProfilerGuiAppUi()
+    {
+    // notify the model that the application is closing 
+    if (iModel)   
+        TRAP_IGNORE(iModel->DeActivateModelL());
+
+    }
+
+// --------------------------------------------------------------------------------------------
+
+void CProfilerGuiAppUi::DynInitMenuPaneL(TInt aResourceId, CEikMenuPane* aMenuPane)
+    {
+    if( aResourceId == R_PROFILER_START_SUBMENU )
+        {
+        CEikMenuPaneItem::SData itemData;
+        _LIT(KMenuText, "Profiling for %d sec.");
+        itemData.iText.Format(KMenuText, iModel->GeneralSettings().iTimedSamplingPeriod);// = _L("Profiling for %d sec.");  // Label text for the menu item
+        itemData.iCommandId = EProfilerGuiCmdStartTimed;    // Command ID for the menu item
+        itemData.iFlags = 0;
+        itemData.iCascadeId = 0;
+        aMenuPane->AddMenuItemL( itemData );
+        }
+    if (aResourceId == R_PROFILER_GUI_APP_MENU)
+        {
+        if(iModel->iState == MProfilerStatusObserver::ERunning)
+        	{
+			aMenuPane->SetItemDimmed(EProfilerGuiCmdStartAll, ETrue);
+			aMenuPane->SetItemDimmed(EProfilerGuiCmdStopAll, EFalse);
+			aMenuPane->SetItemDimmed(EProfilerGuiCmdSamplerControl, ETrue);
+            aMenuPane->SetItemDimmed(EProfilerGuiCmdSettings, ETrue);
+        	}
+        else if(iModel->iState == MProfilerStatusObserver::EIdle)
+        	{
+			aMenuPane->SetItemDimmed(EProfilerGuiCmdStartAll, EFalse);
+			aMenuPane->SetItemDimmed(EProfilerGuiCmdStopAll, ETrue);
+            aMenuPane->SetItemDimmed(EProfilerGuiCmdSamplerControl, EFalse);
+            aMenuPane->SetItemDimmed(EProfilerGuiCmdSettings, EFalse);
+        	}
+        else
+        	{
+        	// if initializing or stopping no start/stop actions allowed 
+			aMenuPane->SetItemDimmed(EProfilerGuiCmdStartAll, ETrue);
+			aMenuPane->SetItemDimmed(EProfilerGuiCmdStopAll, ETrue);
+            aMenuPane->SetItemDimmed(EProfilerGuiCmdSamplerControl, ETrue);
+            aMenuPane->SetItemDimmed(EProfilerGuiCmdSettings, ETrue);
+        	}
+        }
+    
+    if(aResourceId == R_PROFILER_SAMPLER_CONTROL_MENU)
+        {
+        // check if item hidden, i.e. sampler cannot be started/stopped
+        if(!iModel->GetSelectedItemHidden())
+            {
+            // item enabled => dimm the "enable" item, and other way round
+            if(iModel->GetSelectedItemEnabled())
+                {
+                aMenuPane->SetItemDimmed(EProfilerGuiCmdSamplerEnable, ETrue);
+                aMenuPane->SetItemDimmed(EProfilerGuiCmdSamplerDisable, EFalse);
+                }
+            // item enabled => dimm the "enable" item, and other way round
+            else
+                {
+                aMenuPane->SetItemDimmed(EProfilerGuiCmdSamplerEnable, EFalse);
+                aMenuPane->SetItemDimmed(EProfilerGuiCmdSamplerDisable, ETrue);
+                }
+
+            }
+        // item hidden => dimm both enable and disable items
+        else
+            {
+            aMenuPane->SetItemDimmed(EProfilerGuiCmdSamplerEnable, ETrue);
+            aMenuPane->SetItemDimmed(EProfilerGuiCmdSamplerDisable, ETrue);
+            }
+        
+        // if sampler item has specific settings to control 
+        if(iModel->GetSelectedItemHasSettings())
+            {
+            aMenuPane->SetItemDimmed(EProfilerGuiCmdSamplerSettings, EFalse);
+            }
+        else
+            {
+            aMenuPane->SetItemDimmed(EProfilerGuiCmdSamplerSettings, ETrue);
+            }
+        }
+    }
+
+// --------------------------------------------------------------------------------------------
+
+TKeyResponse CProfilerGuiAppUi::HandleKeyEventL(const TKeyEvent& /*aKeyEvent*/, TEventCode /*aType*/)
+    {
+    return EKeyWasNotConsumed;
+    }
+
+void CProfilerGuiAppUi::HandleSystemEventL(const TWsEvent& aEvent)
+    {
+    switch (*(TApaSystemEvent*)(aEvent.EventData()))
+        {
+        case EApaSystemEventShutdown:
+            // check if still profiling
+            if( iModel->iState != MProfilerStatusObserver::EIdle )
+                {
+                // stop profiling process
+                iModel->StopAllSamplerItemsL();
+                }
+
+            // terminate profiler engine
+            iModel->TerminateProfilerL();
+            break;
+        default:
+            break;
+        }
+    // call base class implementation
+    CAknAppUi::HandleSystemEventL(aEvent);
+    }
+
+// --------------------------------------------------------------------------------------------
+
+void CProfilerGuiAppUi::HandleCommandL(TInt aCommand)
+    {
+    switch ( aCommand )
+        {
+        case EProfilerGuiCmdSettings:
+            {
+            // check if exit command received
+            if (iModel->LaunchSettingsDialogL() == EAknCmdExit)
+                {
+                // terminate profiler engine...
+                iModel->TerminateProfilerL();
+                
+                // ... and exit
+                Exit();
+                }
+            break;
+            }
+        case EProfilerGuiCmdAbout:
+            {
+	        CAknMessageQueryDialog* dialog = new(ELeave) CAknMessageQueryDialog;
+            dialog->ExecuteLD(R_PROFILER_GUI_ABOUT_DIALOG);
+            }
+            break;
+            
+        // a normal way to close an application
+        case EAknCmdExit:
+        case EEikCmdExit:
+        case EAknSoftkeyExit: 
+			{
+			// decrease the client reference count in the server:
+			iModel->RemoveClient();
+            // check if still profiling
+            if( iModel->iState != MProfilerStatusObserver::EIdle && 
+                    iModel->iState != MProfilerStatusObserver::EStopping )
+                {
+                // ask user if he wants to leave profiling running in background process 
+                if( this->RunConfQueryL( NULL ) == 0 )
+                    {
+                    // stop profiling process
+                    iModel->StopAllSamplerItemsL();
+
+                    // terminate profiler engine
+                    iModel->TerminateProfilerL();
+                    }
+                }
+            else
+                {
+                // terminate profiler engine
+                iModel->TerminateProfilerL();
+                }
+            
+            Exit();
+ 			}
+            break;
+
+        default:
+            break;      
+        }
+    }
+
+TInt CProfilerGuiAppUi::RunConfQueryL( const TDesC* aOverrideText )
+	{
+	CAknQueryDialog* queryDialog = CAknQueryDialog::NewL();
+	
+	if(aOverrideText)
+		{
+		queryDialog->SetPromptL(*aOverrideText);
+		}
+	return queryDialog->ExecuteLD(R_PROFILER_GUI_CONF_QUERY);
+	}
+
+
+// End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/piprofilerui/ui/avkon/src/profiler_gui_document.cpp	Wed Jun 09 09:42:37 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:   
+*
+*/
+
+
+
+// INCLUDE FILES
+#include "profiler_gui_document.h"
+#include "profiler_gui_appui.h"
+#include "profiler_gui_model.h"
+
+// ================= MEMBER FUNCTIONS =======================
+
+// constructor
+CProfilerGuiDocument::CProfilerGuiDocument(CEikApplication& aApp)
+: CAknDocument(aApp)    
+    {
+    }
+
+// ----------------------------------------------------
+
+// destructor
+CProfilerGuiDocument::~CProfilerGuiDocument()
+    {
+    delete iModel;
+    }
+
+// ----------------------------------------------------
+
+// EPOC default constructor can leave.
+void CProfilerGuiDocument::ConstructL()
+    {
+    iModel = CProfilerGuiModel::NewL();
+    }
+
+// ----------------------------------------------------
+
+// Two-phased constructor.
+CProfilerGuiDocument* CProfilerGuiDocument::NewL(CEikApplication& aApp)
+    {
+    CProfilerGuiDocument* self = new(ELeave) CProfilerGuiDocument(aApp);
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    CleanupStack::Pop();
+
+    return self;
+    }
+    
+// ----------------------------------------------------
+// CProfilerGuiDocument::CreateAppUiL()
+// constructs CProfilerGuiAppUi
+// ----------------------------------------------------
+//
+CEikAppUi* CProfilerGuiDocument::CreateAppUiL()
+    {
+    return new (ELeave) CProfilerGuiAppUi;
+    }
+
+// End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/piprofilerui/ui/avkon/src/profiler_gui_maincontainer.cpp	Wed Jun 09 09:42:37 2010 +0300
@@ -0,0 +1,332 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:   
+*
+*/
+
+
+
+// INCLUDE FILES
+#include "profiler_gui_maincontainer.h"
+#include "profiler_gui.hrh"
+#include "profiler_gui_document.h"
+#include "profiler_gui_appui.h"
+#include "profiler_gui_model.h"
+#include <piprofilerui_extraicons.mbg>
+
+#include <aknlists.h>
+#include <eikclb.h>
+#include <eikclbd.h>
+#include <aknconsts.h>
+#include <AknUtils.h>
+#include <aknnotewrappers.h>
+#include <AknIconArray.h> 
+#include <f32file.h>
+#include <AknIconUtils.h>
+#include <AknDef.h>
+#include <akntitle.h>
+#include <eikspane.h> 
+
+_LIT(KExtraIconsPath, "\\resource\\apps\\piprofilerui_extraicons.mif");
+
+// ===================================== MEMBER FUNCTIONS =====================================
+
+void CProfilerGuiMainContainer::ConstructL(const TRect& aRect)
+    {
+    iModel = static_cast<CProfilerGuiDocument*>(reinterpret_cast<CEikAppUi*>(iEikonEnv->AppUi())->Document())->Model();
+    iModel->SetMainContainer(this);
+
+    CreateWindowL();
+    SetRect(aRect);
+    SetBlank();
+    
+    // init listbox
+    iListBox = new(ELeave) CAknSingleGraphicStyleListBox;
+    iListBox->SetContainerWindowL(*this);
+    iListBox->ConstructL(this, EAknListBoxMarkableList);
+    iListBox->View()->SetListEmptyTextL(_L("No plugins found yet"));
+
+    // if description length longer than screen width, scroll the text
+    iListBox->ItemDrawer()->ColumnData()->EnableMarqueeL(ETrue);
+    
+    // create icon array and add marking indicator to it
+    CAknIconArray* iconArray = new(ELeave) CAknIconArray(1);
+    CleanupStack::PushL(iconArray);
+    CFbsBitmap* markBitmap = NULL;
+    CFbsBitmap* markBitmapMask = NULL;
+    
+    TRgb defaultColor;
+    defaultColor = iEikonEnv->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);
+    iconArray->AppendL(markIcon);                       
+    
+    // append icons from profiler_gui_extraicons.mif
+    TFileName extraIconsPath;
+    extraIconsPath.Copy(KExtraIconsPath);
+    TParsePtrC parse((CEikonEnv::Static()->EikAppUi()->Application())->AppFullName()); // get path where this app is installed
+    extraIconsPath.Insert(0, parse.Drive()); // drive letter
+    
+    CFbsBitmap* redBitmap = NULL;
+    CFbsBitmap* redBitmapMask = NULL;
+    CFbsBitmap* greenBitmap = NULL;
+    CFbsBitmap* greenBitmapMask = NULL;
+    
+    AknIconUtils::CreateIconL(redBitmap, redBitmapMask, extraIconsPath, EMbmPiprofilerui_extraiconsQgn_prob_piprofilerui_status_disabled, EMbmPiprofilerui_extraiconsQgn_prob_piprofilerui_status_disabled_mask);
+    AknIconUtils::CreateIconL(greenBitmap, greenBitmapMask, extraIconsPath, EMbmPiprofilerui_extraiconsQgn_prob_piprofilerui_status_enabled, EMbmPiprofilerui_extraiconsQgn_prob_piprofilerui_status_enabled_mask);
+
+    CGulIcon* redIcon = CGulIcon::NewL(redBitmap, redBitmapMask);
+    iconArray->AppendL(redIcon);  
+    
+    CGulIcon* greenIcon = CGulIcon::NewL(greenBitmap, greenBitmapMask);
+    iconArray->AppendL(greenIcon);  
+
+    // set icon array
+    CleanupStack::Pop(); // iconArray
+    iListBox->ItemDrawer()->ColumnData()->SetIconArray(iconArray);
+
+    iListBox->CreateScrollBarFrameL(ETrue);
+    iListBox->ScrollBarFrame()->SetScrollBarVisibilityL(CEikScrollBarFrame::EOff, CEikScrollBarFrame::EAuto);
+    iListBox->SetListBoxObserver(this);
+    
+    // set size of the listbox
+    TSize outputRectSize;
+    AknLayoutUtils::LayoutMetricsSize(AknLayoutUtils::EMainPane, outputRectSize);
+    TRect outputRect(outputRectSize);
+    iListBox->SetRect(outputRect);
+
+    iListBox->ActivateL();    
+    
+    ActivateL();
+    
+    iInfoPopup = CAknInfoPopupNoteController::NewL();
+    iInfoPopup->SetTimePopupInView(5000);
+    iInfoPopup->SetTimeDelayBeforeShow(500);
+    iInfoPopup->SetTextL(_L("TIP: Check also sampler specific settings!")); 
+    iInfoPopup->ShowInfoPopupNote();
+    }
+
+// --------------------------------------------------------------------------------------------
+
+CProfilerGuiMainContainer::~CProfilerGuiMainContainer()
+    {
+    delete iInfoPopup;
+    
+    if (iListBox)
+        delete iListBox;
+    }
+
+// --------------------------------------------------------------------------------------------
+
+void CProfilerGuiMainContainer::SizeChanged()
+{
+    TSize outputRectSize;
+    AknLayoutUtils::LayoutMetricsSize(AknLayoutUtils::EMainPane, outputRectSize);
+    TRect outputRect(outputRectSize);
+    
+    if (iListBox)
+        iListBox->SetRect(outputRect);
+}
+
+// --------------------------------------------------------------------------------------------
+
+TInt CProfilerGuiMainContainer::CountComponentControls() const
+    {
+    if (iListBox)
+        return 1;
+    else
+        return 0;
+    }
+
+// --------------------------------------------------------------------------------------------
+
+CCoeControl* CProfilerGuiMainContainer::ComponentControl(TInt /*aIndex*/) const
+    {
+    if (iListBox)
+        return iListBox;
+    else
+        return NULL;
+    }
+
+// --------------------------------------------------------------------------------------------
+
+TInt CProfilerGuiMainContainer::CurrentListBoxItemIndex()
+    {
+    if (iListBox)
+        {
+        return iListBox->CurrentItemIndex();
+        }
+    else
+        return KErrNotFound;    
+    }
+
+// --------------------------------------------------------------------------------------------
+
+void CProfilerGuiMainContainer::SetListBoxTextArrayL(CDesCArray* aTextArray)
+    {
+    if (iListBox)
+        {    
+        iListBox->Model()->SetItemTextArray(aTextArray);
+        iListBox->Model()->SetOwnershipType(ELbmOwnsItemArray);
+        iListBox->HandleItemAdditionL();
+        iListBox->UpdateScrollBarsL();
+        }
+    }
+
+// --------------------------------------------------------------------------------------------
+
+const CArrayFix<TInt>* CProfilerGuiMainContainer::ListBoxSelectionIndexes()
+    {
+    if (iListBox)
+        {
+        const CListBoxView::CSelectionIndexArray* indices = iListBox->SelectionIndexes();
+        return static_cast<const CArrayFix<TInt>*>(indices);
+        }
+    else
+        return NULL;
+    }
+
+// --------------------------------------------------------------------------------------------
+
+TInt CProfilerGuiMainContainer::ListBoxSelectionIndexesCount()
+    {
+    if (iListBox)
+        {
+        return iListBox->SelectionIndexes()->Count();
+        }
+    else
+        return KErrNotFound;
+    }
+                        
+// --------------------------------------------------------------------------------------------
+
+void CProfilerGuiMainContainer::Draw(const TRect& aRect) const
+    {
+    CWindowGc& gc = SystemGc();
+    gc.Clear(aRect);
+    }
+    
+// --------------------------------------------------------------------------------------------
+
+void CProfilerGuiMainContainer::HandleControlEventL(CCoeControl* /*aControl*/,TCoeEvent /*aEventType*/)
+    {
+    }
+
+// --------------------------------------------------------------------------------------------
+
+void CProfilerGuiMainContainer::SetDefaultTitlePaneTextL()
+    {
+    _LIT(KTitleText, "PIProfiler");
+
+    CEikStatusPane* sp = iEikonEnv->AppUiFactory()->StatusPane();
+    CAknTitlePane* tp = static_cast<CAknTitlePane*>( sp->ControlL( TUid::Uid( EEikStatusPaneUidTitle ) ) );
+    tp->SetTextL( KTitleText );
+    }
+        
+// --------------------------------------------------------------------------------------------
+
+TKeyResponse CProfilerGuiMainContainer::OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType)
+    {
+    if(aType != EEventKey)
+        return EKeyWasNotConsumed;
+    
+    if (iListBox && iListBox->Model()->NumberOfItems() > 0)
+        {
+        // handle OK/Enter keys
+        if (aKeyEvent.iCode == EKeyOK || aKeyEvent.iCode == EKeyEnter)
+            {
+            // check if profiler state is idle
+            if(iModel->iState == MProfilerStatusObserver::EIdle)
+                {
+                // show action menu only if state is idle
+                iModel->ShowItemActionMenuL();
+                }
+            }
+        else
+            {
+            return iListBox->OfferKeyEventL(aKeyEvent, aType);
+            }
+        }
+    
+    return EKeyWasNotConsumed;
+    }
+
+// --------------------------------------------------------------------------------------------
+
+void CProfilerGuiMainContainer::HandleListBoxEventL(CEikListBox* /*aListBox*/, TListBoxEvent aEventType)
+    {
+    switch (aEventType)
+        {
+        case EEventEnterKeyPressed:
+        case EEventItemDoubleClicked:
+            {
+            iModel->ShowItemActionMenuL();
+            }
+            break;
+        default:
+            break;
+        }
+    }
+            
+// --------------------------------------------------------------------------------------------
+
+void CProfilerGuiMainContainer::HandleResourceChange(TInt aType)
+    {
+    if ( aType == KEikDynamicLayoutVariantSwitch )
+        {
+        TRect mainPaneRect;
+        AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EMainPane, mainPaneRect);
+        SetRect(mainPaneRect);
+
+        TSize outputRectSize;
+        AknLayoutUtils::LayoutMetricsSize(AknLayoutUtils::EMainPane, outputRectSize);
+        TRect outputRect(outputRectSize);
+        iListBox->SetRect(outputRect);
+        }
+    else
+        {
+        CCoeControl::HandleResourceChange(aType);
+        }
+    }
+
+// --------------------------------------------------------------------------------------------
+
+void CProfilerGuiMainContainer::ShowWriterInfoPopupL(const TDesC& aNote)
+	{
+	if(!iInfoPopup)
+	    {
+	    iInfoPopup = CAknInfoPopupNoteController::NewL();
+	    }
+    // Hide the note. The last note may be visible when creating the second
+	iInfoPopup->HideInfoPopupNote();
+    iInfoPopup->SetTimePopupInView(5000);
+    iInfoPopup->SetTimeDelayBeforeShow(500);
+    iInfoPopup->SetTextL(iModel->GetWriterInfoNoteL(aNote));
+    iInfoPopup->ShowInfoPopupNote();
+	}
+
+
+// End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/piprofilerui/ui/avkon/src/profiler_gui_mainview.cpp	Wed Jun 09 09:42:37 2010 +0300
@@ -0,0 +1,334 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:   
+*
+*/
+
+
+
+// INCLUDE FILES
+#include "profiler_gui.hrh"
+#include "profiler_gui_mainview.h"
+#include "profiler_gui_maincontainer.h"
+#include "profiler_gui_document.h" 
+#include "profiler_gui_model.h"
+#include <piprofilerui.rsg>
+
+#include <AknWaitDialog.h>
+#include <AknGlobalNote.h>
+#include <eikenv.h>
+#include <aknViewAppUi.h> 
+#include <akncontext.h>
+#include <StringLoader.h>
+#include <aknnavi.h>
+#include <akntitle.h>
+#include <barsread.h>
+#include <aknnavide.h>
+#include <aknmessagequerydialog.h> 
+
+// ================= MEMBER FUNCTIONS =======================
+
+// ---------------------------------------------------------
+// CProfilerGuiMainView::ConstructL(const TRect& aRect)
+// EPOC two-phased constructor
+// ---------------------------------------------------------
+//
+void CProfilerGuiMainView::ConstructL()
+    {
+    BaseConstructL( R_PROFILER_GUI_VIEW_MAIN );
+    
+    iModel = static_cast<CProfilerGuiDocument*>(reinterpret_cast<CEikAppUi*>(iEikonEnv->AppUi())->Document())->Model();
+    iNaviDecorator = NULL;
+    iModel->SetMainView(this);
+    }
+
+// ---------------------------------------------------------
+// CProfilerGuiMainView::~CProfilerGuiMainView()
+// ---------------------------------------------------------
+//
+CProfilerGuiMainView::~CProfilerGuiMainView()
+    {
+
+    if(iNaviDecorator)
+    	{
+    	delete iNaviDecorator;
+    	iNaviDecorator = NULL;
+    	}
+    
+    if (iContainer)
+        {
+        AppUi()->RemoveFromViewStack( *this, iContainer );
+        delete iContainer;
+        iContainer = NULL;
+        }
+    
+    }
+
+// ---------------------------------------------------------
+// TUid CProfilerGuiMainView::Id()
+// ---------------------------------------------------------
+//
+TUid CProfilerGuiMainView::Id() const
+    {
+    return KMainViewUID;
+    }
+
+// ---------------------------------------------------------
+// TUid CProfilerGuiMainView::DynInitMenuPaneL(TInt aResourceId, CEikMenuPane* aMenuPane)
+// ---------------------------------------------------------
+//
+void CProfilerGuiMainView::DynInitMenuPaneL(TInt aResourceId, CEikMenuPane* aMenuPane)
+    {
+    AppUi()->DynInitMenuPaneL(aResourceId, aMenuPane);
+    }
+
+  
+// ---------------------------------------------------------
+// CProfilerGuiMainView::HandleCommandL(TInt aCommand)
+// ---------------------------------------------------------
+//
+void CProfilerGuiMainView::HandleCommandL(TInt aCommand)
+    {   
+    switch ( aCommand )
+        {
+        // commands from sampler control sub menu 
+        case EProfilerGuiCmdSamplerEnable:
+            {
+            iModel->DisableOrEnableSelectedOrHighlightedItemsL();
+            break;
+            }
+        case EProfilerGuiCmdSamplerDisable:
+            {
+            iModel->DisableOrEnableSelectedOrHighlightedItemsL();
+            break;
+            }
+        case EProfilerGuiCmdSamplerSettings:
+            {
+            // check if sampler settings dialog returned exit command
+            iModel->EditSelectedSamplerL(iContainer->CurrentListBoxItemIndex());
+            break;
+            }
+        case EProfilerGuiCmdSamplerInfo:
+            {
+            iModel->SelectedSamplerInfoL(iContainer->CurrentListBoxItemIndex());
+            break;
+            }
+            
+        case EProfilerGuiCmdStartAll:
+        case EProfilerGuiCmdStartTimed:
+            {
+            // still using the old way of starting all the samplers simultaneously
+            if( iModel->iState != MProfilerStatusObserver::ERunning )
+            	{
+            	// set state as "initializing" for a moment before profiling has started, 
+            	// NOTE: engine changes to "Running" state
+            	iModel->iState = MProfilerStatusObserver::EInitializing;
+                // start the actual sampling process on Profiler Engine 
+            	if( aCommand == EProfilerGuiCmdStartTimed )
+            	    iModel->StartAllSamplerItemsL(CProfilerGuiModel::EProfilingModeTimed);
+            	else
+            	    iModel->StartAllSamplerItemsL();
+            	}
+
+			// prevent the control of sampler specific settings during the trace 
+            iContainer->SetDimmed(ETrue);
+            break;
+            }
+        case EProfilerGuiCmdStopAll:
+            {
+			// check if still profiling
+			if( iModel->iState != MProfilerStatusObserver::EIdle )
+				{
+				// set to stopping mode
+				iModel->iState = MProfilerStatusObserver::EStopping;
+                // stop actual sampling process on Profiler Engine
+				iModel->StopAllSamplerItemsL();
+				}
+            
+			// return the control to sampler specific settings when tracing stopped
+			iContainer->SetDimmed(EFalse);
+
+            break;
+            }
+            
+        default:
+            {
+            AppUi()->HandleCommandL(aCommand);
+            break;
+            }
+        }
+    }
+
+// ---------------------------------------------------------
+// CProfilerGuiMainView::HandleClientRectChange()
+// ---------------------------------------------------------
+//
+void CProfilerGuiMainView::HandleClientRectChange()
+    {
+    if ( iContainer )
+        {
+        iContainer->SetRect( ClientRect() );
+        }
+    }
+
+// ---------------------------------------------------------
+// CProfilerGuiMainView::DoActivateL(...)
+// ---------------------------------------------------------
+//
+void CProfilerGuiMainView::DoActivateL(
+   const TVwsViewId& /*aPrevViewId*/,TUid /*aCustomMessageId*/,
+   const TDesC8& /*aCustomMessage*/)
+    {
+    // show wait dialog
+    CAknGlobalNote* waitDialog = CAknGlobalNote::NewLC();
+    waitDialog->SetSoftkeys(R_AVKON_SOFTKEYS_EMPTY);
+    TInt dialogId = waitDialog->ShowNoteL(EAknGlobalWaitNote, _L("Initializing samplers"));
+
+    // setup the profiler engine status pane
+    SetupStatusPaneL();
+    
+    // check if container creation succesfull
+    if (!iContainer)
+        {
+        iContainer = new (ELeave) CProfilerGuiMainContainer;
+        iModel->SetMainContainer(iContainer);
+        iContainer->SetMopParent(this);
+        iContainer->ConstructL( ClientRect() );
+        iModel->NotifyContainerReadyL();
+        AppUi()->AddToStackL( *this, iContainer );
+        } 
+    
+	// remove the wait dialog
+	waitDialog->CancelNoteL(dialogId);
+	CleanupStack::PopAndDestroy(); //waitDialog;
+   }
+
+// ---------------------------------------------------------
+// CProfilerGuiMainView::DoDeactivate()
+// ---------------------------------------------------------
+//
+void CProfilerGuiMainView::DoDeactivate()
+    {
+    TRAP_IGNORE(CleanupStatusPaneL());
+    
+    if (iContainer)
+        {
+        AppUi()->RemoveFromViewStack( *this, iContainer );
+        delete iContainer;
+        iContainer = NULL;
+        }
+    }
+
+void CProfilerGuiMainView::HandleStatusPaneSizeChange()
+	{
+	CAknView::HandleStatusPaneSizeChange();
+	
+	TInt result;
+	TRAP(result, SetupStatusPaneL());
+	}
+
+
+void CProfilerGuiMainView::SetupStatusPaneL()
+	{
+	TUid naviPaneUid = TUid::Uid(EEikStatusPaneUidNavi);
+	CEikStatusPaneBase::TPaneCapabilities subPaneNavi = StatusPane()->PaneCapabilities(naviPaneUid);
+	if(subPaneNavi.IsPresent() && subPaneNavi.IsAppOwned())
+		{
+		CAknNavigationControlContainer* naviPane = static_cast<CAknNavigationControlContainer*> (StatusPane()->ControlL(naviPaneUid));
+		if(iNaviDecorator)
+			{
+			delete iNaviDecorator;
+			iNaviDecorator = NULL;
+			}
+		
+		// get the initial status label
+		HBufC* labelText = GetLabelTextLC(iModel->iState);
+		iNaviDecorator = naviPane->CreateNavigationLabelL(*labelText);
+		CleanupStack::PopAndDestroy(labelText);
+		
+		naviPane->PushL(*iNaviDecorator);
+		}
+	}
+
+void CProfilerGuiMainView::CleanupStatusPaneL()
+	{
+	// destructor for navi pane, called by destructor
+	TUid naviPaneUid = TUid::Uid(EEikStatusPaneUidNavi);
+	CEikStatusPaneBase::TPaneCapabilities subPaneNavi = StatusPane()->PaneCapabilities(naviPaneUid);
+	if(subPaneNavi.IsPresent() && subPaneNavi.IsAppOwned())
+		{
+		CAknNavigationControlContainer* naviPane = static_cast<CAknNavigationControlContainer*> (StatusPane()->ControlL(naviPaneUid));
+		if(iNaviDecorator)
+			{
+			naviPane->Pop(iNaviDecorator);
+			delete iNaviDecorator;
+			iNaviDecorator = NULL;
+			}
+		}
+	}
+
+HBufC* CProfilerGuiMainView::GetLabelTextLC(TInt aStatus)
+	{
+	// get the predefined status text
+	HBufC* labelText = NULL;
+	switch(aStatus)
+		{
+		case MProfilerStatusObserver::EIdle:
+			labelText = StringLoader::LoadLC(R_PROFILER_GUI_NAVI_TEXT_IDLE);
+			break;
+		case MProfilerStatusObserver::EInitializing:
+			labelText = StringLoader::LoadLC(R_PROFILER_GUI_NAVI_TEXT_INITIALIZING);
+			break;
+		case MProfilerStatusObserver::ERunning:
+			labelText = StringLoader::LoadLC(R_PROFILER_GUI_NAVI_TEXT_RUNNING);
+			break;
+		case MProfilerStatusObserver::EStopping:
+			labelText = StringLoader::LoadLC(R_PROFILER_GUI_NAVI_TEXT_STOPPING);
+			break;
+	     case MProfilerStatusObserver::ERestarting:
+            labelText = StringLoader::LoadLC(R_PROFILER_GUI_NAVI_TEXT_RUNNING);
+            break;
+	     default:
+	        labelText = StringLoader::LoadLC(R_PROFILER_GUI_NAVI_TEXT_IDLE); 
+	        break;
+		}
+	return labelText;
+	}
+
+void CProfilerGuiMainView::UpdateStatusPaneL( TInt aStatus )
+	{
+	TUid naviPaneUid = TUid::Uid(EEikStatusPaneUidNavi);
+	CEikStatusPaneBase::TPaneCapabilities subPaneNavi = StatusPane()->PaneCapabilities(naviPaneUid);
+	// check if navi pane is correctly initialized
+	if(subPaneNavi.IsPresent() && subPaneNavi.IsAppOwned())
+		{
+		CAknNavigationControlContainer* naviPane = static_cast<CAknNavigationControlContainer*> (StatusPane()->ControlL(naviPaneUid));
+		if(iNaviDecorator)
+			{
+			delete iNaviDecorator;
+			iNaviDecorator = NULL;
+			}
+		HBufC* labelText;
+
+		// get the right status label text 
+		labelText = GetLabelTextLC(aStatus);
+		iNaviDecorator = naviPane->CreateNavigationLabelL(*labelText);
+		CleanupStack::PopAndDestroy(labelText);
+		
+		naviPane->PushL(*iNaviDecorator);
+		}
+	}
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/piprofilerui/ui/avkon/src/profiler_gui_model.cpp	Wed Jun 09 09:42:37 2010 +0300
@@ -0,0 +1,1176 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:   
+*
+*/
+
+
+
+// INCLUDE FILES
+#include "profiler_gui_samplersettingsviewdlg.h"
+#include "profiler_gui_model.h"
+#include "profiler_gui_app.h"
+#include "profiler_gui_settingsviewdlg.h"
+#include "profiler_gui_maincontainer.h"
+#include "profiler_gui.hrh"
+#include <piprofilerui.rsg>
+
+#include <coeutils.h>
+#include <bautils.h>
+#include <eikenv.h>
+#include <AknQueryDialog.h>
+#include <AknGlobalNote.h>
+#include <aknmessagequerydialog.h> 
+#include <e32math.h> 
+#include <akntitle.h> 
+#include <s32file.h>
+#include <aknnotewrappers.h>
+#include <sysutil.h>
+
+// UIDs
+#include <piprofiler/EngineUIDs.h>
+
+#include <piprofiler/ProfilerTraces.h>
+#include <piprofiler/ProfilerSession.h>
+
+// LITERALS
+_LIT(KAppName, "PI Profiler");
+_LIT(KWarningNote, "NOTE: output changed!\n");
+_LIT(KProfilerEngineExe, "PIProfilerEngine.exe");
+
+// literals for default general setting values
+_LIT8(KTraceOutput, "file_system");
+_LIT8(KTraceDebugOutput, "debug_output");
+_LIT8(KProfilerDefaultDrive, "E:\\data");
+_LIT8(KProfilerDefaultPrefix, "Profiler_#");
+
+// ===================================== MEMBER FUNCTIONS =====================================
+
+CProfilerGuiModel* CProfilerGuiModel::NewL() 
+	{
+	CProfilerGuiModel* self = new(ELeave) CProfilerGuiModel;
+	CleanupStack::PushL(self);
+	self->ConstructL();
+	CleanupStack::Pop();
+	return self;
+	}
+
+// --------------------------------------------------------------------------------------------
+
+CProfilerGuiModel::CProfilerGuiModel() : CActive(EPriorityStandard)
+	{
+	}
+	
+// --------------------------------------------------------------------------------------------
+
+void CProfilerGuiModel::ConstructL()
+	{
+	// initialize basic settings
+	iDrawState = EDrawStateInvalid;
+	iReferenceNumber = 0;
+	iState = MProfilerStatusObserver::EIdle;
+	
+    iEnv = CEikonEnv::Static();
+
+    // profiler engine specific initialization
+    LaunchProfilerEngineL();
+    
+    // max sampler item list length is 64, i.e. max 64 sampler plugins loaded 
+    iSamplerItemList = new(ELeave) CSamplerItemList(64);
+
+    // initialize attribute arrays
+    iSamplerAttributes = new(ELeave) CArrayFixFlat<TSamplerAttributes>(20); // max sampler count is 20
+    
+    // engine status checker
+    iStatusChecker = CProfilerEngineStatusChecker::NewL();
+    iStatusChecker->SetObserver(this);
+ 	
+	CActiveScheduler::Add(this);
+	}
+
+void CProfilerGuiModel::UpdateUIRunningStateL()
+    {
+    // prevent the control of sampler specific settings during the trace 
+    iMainContainer->SetDimmed(ETrue);
+    
+    // update status pane
+    iMainView->UpdateStatusPaneL(iState);
+
+    // show an info popup showing the logging method
+    iMainContainer->ShowWriterInfoPopupL(KNullDesC);
+    
+    // refresh view
+    RefreshViewL();
+    }
+
+// --------------------------------------------------------------------------------------------
+void CProfilerGuiModel::NotifyContainerReadyL()
+	{
+	// load initial plugins
+    LoadPluginsL();
+    
+    // get the initial state
+    if( iStatusChecker->GetInitialState() == MProfilerStatusObserver::ERunning )
+        {
+        // set model state to restarting and grabbing an existing profiler process
+        iState = MProfilerStatusObserver::ERestarting;
+        
+        // update status pane to correspond the running mode
+        UpdateUIRunningStateL();
+
+        // set model state to running
+        iState = MProfilerStatusObserver::ERunning;
+
+        }
+	}
+
+// --------------------------------------------------------------------------------------------
+
+void CProfilerGuiModel::ActivateModelL()
+	{
+	// load general settings
+	if( LoadGeneralSettingsL() != KErrNone )
+	    {
+	    LOGTEXT(_L("ProfilerGuiAppUi::ActivateModelL - could not connect profiler engine"));
+	    }
+	}
+
+// --------------------------------------------------------------------------------------------
+
+void CProfilerGuiModel::DeActivateModelL()
+	{
+	Cancel();
+	
+	// for a faster exit, send the application to background
+    TApaTask selfTask(iEnv->WsSession());
+    selfTask.SetWgId(iEnv->RootWin().Identifier());
+    selfTask.SendToBackground();
+	}
+	
+// --------------------------------------------------------------------------------------------
+
+CProfilerGuiModel::~CProfilerGuiModel()
+	{
+    if (iSamplerItemList)
+        {
+        DeleteAllSamplerItems();
+        delete iSamplerItemList;
+        iSamplerItemList = NULL;
+        }
+    
+    if(iStatusChecker)
+        {
+        iStatusChecker->Cancel();
+        delete iStatusChecker;
+        iStatusChecker = NULL;
+        }
+    
+  
+    if(iSamplerAttributes)
+        {
+        iSamplerAttributes->Reset();
+        delete iSamplerAttributes;
+        iSamplerAttributes = NULL;
+        }
+     
+    }
+
+// --------------------------------------------------------------------------------------------
+
+void CProfilerGuiModel::DoCancel()
+	{
+    
+	}
+
+// --------------------------------------------------------------------------------------------
+
+void CProfilerGuiModel::RunL()
+	{
+
+	}
+	
+// --------------------------------------------------------------------------------------------
+
+void CProfilerGuiModel::SetMainContainer(CProfilerGuiMainContainer* aContainer)
+    {
+    iMainContainer = aContainer;
+    iDrawState = EDrawStateMain;
+    }
+
+void CProfilerGuiModel::UpdateState(TInt aState)
+	{
+	iState = aState;
+	}
+
+TInt CProfilerGuiModel::FindProcessL(RProcess& aProc)
+    {
+    TProcessId engId;
+    TFindProcess procName;
+    procName.Find(_L("PIProfilerEngine.exe*"));
+    TFullName aResult;
+    TFullName aResult2;
+    TInt err(KErrNone);
+
+    // find the first appearance
+    err = procName.Next(aResult);
+    if(err != KErrNone)
+        {
+        // did not find any engine process
+        return err;
+        }
+    else
+        {
+        err = aProc.Open(procName);
+        if(err == KErrNone)
+            {
+            if(aProc.ExitCategory().Length() > 0)
+                {
+                aProc.Close();
+                // process already exited => create a new one
+                return KErrNotFound;
+                }
+            aProc.Close();
+            }
+        }
+    
+//    // check now if a second appearance exists in process list, 
+//    // i.e. engine started from eshell => two engine processes appear in normal case
+//    procName.Next(aResult2);
+//
+//    // check if aResult2 contained the second appearance of profiler engine
+//    if(aResult2.CompareF(aResult) > 0)
+//        {
+//        // other process found, i.e. right process to communicate with, in case started from eshell
+//        err = aProc.Open(procName);
+//        if(err == KErrNone)
+//            {
+//            if(aProc.ExitCategory().Length() > 0)
+//                {
+//                // process already exited => create a new one
+//                return KErrNotFound;
+//                }
+//            aProc.Close();
+//            }
+//        }
+    
+    return err;
+    }
+
+void CProfilerGuiModel::LaunchProfilerEngineL()
+    {
+    LOGTEXT(_L("CProfilerGuiModel::LaunchProfilerEngineL - start"));
+
+    TRequestStatus stat = KRequestPending;
+    RProcess proc;
+    
+    TInt err(KErrNone);
+    
+    // check if process exists
+    err = FindProcessL(proc);
+    
+    // check if already exists and don't start a new eshell profiling
+    if( err == KErrNotFound )
+        {
+        // try create new process
+        err = proc.Create(KProfilerEngineExe, _L(""));
+
+        // check if RProcess::Create() succeeded
+        if( err == KErrNone )
+            {
+            // Trigger rendezvous on the supplied TRequestStatus object
+            proc.Rendezvous(stat); 
+
+            // kick off the engine process
+            proc.Resume();
+            
+            // wait for the constructor to complete 
+            User::WaitForRequest(stat); 
+            
+            // just lose the handle
+            proc.Close();
+            }
+        }
+    
+    // Increase the client reference count in server:
+    AttachClient();    
+    }
+
+//-----------------------------------------------------------------------------
+// CProfilerGuiModel::TerminateProfilerL()
+// Stops Profiler Engine if it has been launched by this launcher. 
+//-----------------------------------------------------------------------------
+
+void CProfilerGuiModel::TerminateProfilerL()
+    {
+    LOGTEXT(_L("CProfilerGuiModel::TerminateProfiler - entry"));
+    
+    // exit profiler engine 
+    RProfiler::ExitProfiler();
+        
+    LOGTEXT(_L("CProfilerGuiModel::TerminateProfiler - exit"));
+    
+    }
+
+void CProfilerGuiModel::AttachClient()
+    {
+    LOGTEXT(_L("CProfilerGuiModel::AttachClient - entry"));
+    
+    // 
+    RProfiler::AttachClient();
+        
+    LOGTEXT(_L("CProfilerGuiModel::AttachClient - exit"));
+    
+    }
+
+void CProfilerGuiModel::RemoveClient()
+    {
+    LOGTEXT(_L("CProfilerGuiModel::RemoveClient - entry"));
+    
+    // 
+    RProfiler::RemoveClient();
+        
+    LOGTEXT(_L("CProfilerGuiModel::RemoveClient - exit"));
+    
+    }
+
+void CProfilerGuiModel::AddNewSamplersL(CArrayFixFlat<TSamplerAttributes>& aAttributes)
+	{
+	TSamplerAttributes item;
+	
+	TInt count(aAttributes.Count());
+
+	// loop the attribute array and insert them into view list
+	for (TInt i(0);i<count;i++)
+		{
+    	// get a TSamplerAttributes from list at a time  
+		item = aAttributes.At(i);
+
+		iReferenceNumber++;
+	
+        // add item to the array
+        AppendToSamplerItemListL(item);
+        
+        // update the listbox
+        RefreshViewL(EFalse);
+        
+        // set item index to the begin	
+        iMainContainer->ListBox()->SetCurrentItemIndexAndDraw(iMainContainer->ListBox()->Model()->NumberOfItems()-1);
+
+		}
+    // refresh again
+    if(iReferenceNumber > 0)
+        {
+        RefreshViewL(ETrue);
+        }
+	}
+
+TBool CProfilerGuiModel::CheckTraceLocationSanityL(TGeneralAttributes& aAttr, TBool aQuietCheck)
+    {
+    RFs fs;
+    User::LeaveIfError(fs.Connect());
+
+    TBuf<32> drive;
+    
+    CnvUtfConverter::ConvertToUnicodeFromUtf8(drive, aAttr.iSaveFileDrive);
+
+    TDriveUnit driveUnit = TDriveUnit(drive);
+
+    TBool ret(EFalse);
+
+    // check that the root folder is correct
+    if (drive.Length() > 2 && BaflUtils::CheckFolder(fs, drive.Left(3)) == KErrNone )
+        {
+        // check then if drive has still some space
+        if(!SysUtil::DiskSpaceBelowCriticalLevelL(&fs, 0, driveUnit))
+            {
+            ret = ETrue;
+            }
+        }
+    
+    // check if the sanity check failed
+    if(!ret)
+        {
+        // show an error note
+        if(aQuietCheck == EFalse)
+            {
+            CAknErrorNote* note = new(ELeave) CAknErrorNote();
+            note->ExecuteLD(_L("Invalid path, check settings!"));
+            }
+        }
+    fs.Close();
+    return ret;
+    }
+
+// --------------------------------------------------------------------------------------------
+
+TInt CProfilerGuiModel::LaunchSettingsDialogL()
+    {
+    // launch the settings dialog
+    TGeneralAttributes newSettings = iGeneralAttributes;
+    TBool quietCheck(EFalse);
+    
+    CProfilerGuiSettingsViewDlg* dlg = CProfilerGuiSettingsViewDlg::NewL(newSettings);
+    TInt returnValue = dlg->ExecuteLD(R_PROFILER_GUI_SETTINGS_DIALOG);
+    
+    // check if exit command => no error note to user
+    if(returnValue == EAknCmdExit)
+        quietCheck = ETrue;
+    
+    // always save settings since the settings dialog does not provide a possibility to cancel
+    iGeneralAttributes.iTraceOutput.Copy(newSettings.iTraceOutput);
+    iGeneralAttributes.iTraceFilePrefix.Copy(newSettings.iTraceFilePrefix);
+    iGeneralAttributes.iTimedSamplingPeriod = newSettings.iTimedSamplingPeriod;
+
+    // check if debug output selected no check of
+    if(newSettings.iTraceOutput.CompareF(KTraceDebugOutput) != 0)
+        {
+        // Check save file drive sanity
+        if(CheckTraceLocationSanityL(newSettings, quietCheck))
+            {
+            // save the new location
+            iGeneralAttributes.iSaveFileDrive.Copy(newSettings.iSaveFileDrive);
+            }
+        }
+    
+    // saves the general settings to profiler engine
+    SaveGeneralSettingsL();   
+    
+    // make sure that the title of the application is correct
+    CEikStatusPane* sp = iEnv->AppUiFactory()->StatusPane();
+    CAknTitlePane* tp = static_cast<CAknTitlePane*>( sp->ControlL( TUid::Uid( EEikStatusPaneUidTitle ) ) );
+    tp->SetTextL(KAppName);
+    
+    return returnValue;
+    }
+
+
+TPtrC CProfilerGuiModel::GetWriterInfoNoteL(const TDesC& aNote)
+	{
+    TBuf<256> buf;
+    TBuf<128> descBuf;
+    
+    buf.Zero();
+
+    // get active profiler since it 
+    RProfiler::GetActiveWriter(buf);
+    
+	if(iGeneralAttributes.iTraceOutput.CompareF(KTraceOutput) == 0)
+		{
+		if(iState == MProfilerStatusObserver::EInitializing ||
+                iState == MProfilerStatusObserver::ERestarting )
+			{
+			descBuf.Zero();
+			// set the additional note if available
+			buf.Copy(aNote); 
+			RProfiler::GetFileName(descBuf);
+			buf.Append(_L("Writing to "));
+			buf.Append(descBuf);
+			}
+		else if(iState == MProfilerStatusObserver::EIdle ||
+		        iState == MProfilerStatusObserver::EStopping ||
+		        iState == MProfilerStatusObserver::ERunning )
+			{
+			descBuf.Zero();
+            // set the additional note if available
+            buf.Copy(aNote); 
+            RProfiler::GetFileName(descBuf);
+			buf.Append(_L("Wrote trace data to "));
+			buf.Append(descBuf);
+			}
+		else
+		    {
+	          buf.Copy(KNullDesC);
+		    }
+		}
+	else if(iGeneralAttributes.iTraceOutput.CompareF(KTraceDebugOutput) == 0)
+		{
+		if(iState == MProfilerStatusObserver::EInitializing ||
+                iState == MProfilerStatusObserver::ERestarting )
+			{
+			buf.Copy(_L("Writing to debug output..."));
+			}
+		else if( iState == MProfilerStatusObserver::EIdle || 
+	             iState == MProfilerStatusObserver::EStopping ||
+		         iState == MProfilerStatusObserver::ERunning )
+			{
+			buf.Copy(_L("Wrote trace data to debug output"));
+			}
+		else
+		    {
+		    buf.Copy(KNullDesC);
+		    }
+		}
+	else
+	    {
+	    // should not reach this point
+        buf.Copy(KNullDesC);
+	    }
+    
+    return TPtrC(buf);	
+    }
+
+// --------------------------------------------------------------------------------------------
+
+TInt CProfilerGuiModel::EditSamplerL(TSamplerAttributes& aItem)
+    {
+    // edit sampler specific settings i.e. attributes
+    TSamplerAttributes& newSettings = aItem;
+    TInt indexToReplace(iMainContainer->CurrentListBoxItemIndex());
+    
+    // create a new settings editor dialog
+    CProfilerSamplerSettingsViewDlg* dlg = CProfilerSamplerSettingsViewDlg::NewL(newSettings);
+    TInt returnValue = dlg->ExecuteLD(R_PROFILER_SAMPLER_SETTINGS_DIALOG);
+    
+    // save settings
+    aItem = newSettings;
+
+    // replace the old attribute container with saved values
+    iSamplerItemList->Delete(indexToReplace);
+    iSamplerItemList->InsertL(indexToReplace, newSettings);
+    
+    // save the settings to sampler item
+    RProfiler::SetSamplerAttributes(newSettings);
+    
+    // make sure that the title of the application is correct
+    CEikStatusPane* sp = iEnv->AppUiFactory()->StatusPane();
+    CAknTitlePane* tp = static_cast<CAknTitlePane*>( sp->ControlL( TUid::Uid( EEikStatusPaneUidTitle ) ) );
+    tp->SetTextL(KAppName);
+
+    return returnValue;
+    }
+
+
+void CProfilerGuiModel::SamplerInfoL(TSamplerAttributes& aItem)
+    {
+    TBuf<64> header;
+    TBuf<256> info;
+    
+    _LIT(KSamplerStr, "Sampler Info");
+    
+//    CnvUtfConverter::ConvertToUnicodeFromUtf8(header, aItem.iName);
+    
+    header.Append(KSamplerStr);
+
+    CnvUtfConverter::ConvertToUnicodeFromUtf8(info, aItem.iDescription);
+
+    CAknMessageQueryDialog* dialog = new(ELeave) CAknMessageQueryDialog;
+    //dialog->ExecuteLD(info);
+    dialog->PrepareLC( R_PROFILER_GUI_EMPTY_ABOUT_DIALOG );
+    dialog->SetHeaderText(header);
+    dialog->SetMessageTextL(info);
+    dialog->RunLD(); 
+
+    RefreshViewL(EFalse);
+    }
+
+// --------------------------------------------------------------------------------------------
+
+void CProfilerGuiModel::StartAllSamplerItemsL(TProfilingMode aProfilingMode)
+    {
+    TBuf<256> activeWriterDes;
+    TBuf8<256> writer8;
+    
+    iState = MProfilerStatusObserver::EInitializing;
+    
+    RProfiler::TProfilingMode profilingMode = aProfilingMode == EProfilingModeTimed ? RProfiler::EProfilingModeTimed : RProfiler::EProfilingModeNormal;
+    
+    // update status pane to correspond the initializing mode
+    // prevent the control of sampler specific settings during the trace 
+    iMainContainer->SetDimmed(ETrue);
+    
+    // update status pane
+    iMainView->UpdateStatusPaneL(iState);
+    
+    // refresh view
+    RefreshViewL();
+    
+    // try to start profiling process through client-server interface
+    if(RProfiler::StartSampling(profilingMode) == KErrNotFound)
+        {
+        
+        // profiler stopped (e.g. from eshell) and must be restarted 
+        LaunchProfilerEngineL();
+        
+        // set general attributes
+        SaveGeneralSettingsL();
+        
+        // set sampler attributes
+        for(TInt i(0);i<iSamplerAttributes->Count();i++)
+            {
+            // set the attributes for each sampler loaded in the UI
+            RProfiler::SetSamplerAttributes(iSamplerAttributes->At(i));
+            }
+        
+        // try to launch sampling again
+        RProfiler::StartSampling(profilingMode);
+        }
+    
+    // get selected writer
+    RProfiler::GetActiveWriter(activeWriterDes);
+    CnvUtfConverter::ConvertFromUnicodeToUtf8(writer8, activeWriterDes);
+    
+    // check that output mode has not changed for a problem with trace file name
+    // problem cases:
+    // - trace file name and/or path false
+    // - disk full, cannot write to given location
+    // - false drive, e.g. x:
+    if(writer8.CompareF(iGeneralAttributes.iTraceOutput) != 0)
+        {
+        // save change also to general attributes
+        iGeneralAttributes.iTraceOutput.Copy(writer8);
+        // show an info popup showing the logging method
+        iMainContainer->ShowWriterInfoPopupL(KWarningNote);
+        }
+    else
+        {
+        // show an info popup showing the logging method
+        iMainContainer->ShowWriterInfoPopupL(KNullDesC);
+        }
+    
+    // update the view
+    RefreshViewL();    
+    }
+    
+// --------------------------------------------------------------------------------------------
+
+void CProfilerGuiModel::DeleteAllSamplerItemsL()
+    {
+    DeleteAllSamplerItems();
+    
+    RefreshViewL();
+    }
+
+// --------------------------------------------------------------------------------------------
+
+void CProfilerGuiModel::StopAllSamplerItemsL()
+    {
+    // show an info popup showing the logging method
+    iMainContainer->ShowWriterInfoPopupL(KNullDesC);
+    
+    // Stop profiling process through CS session
+    RProfiler::StopSampling();
+    
+    RefreshViewL();
+    }
+    
+// --------------------------------------------------------------------------------------------
+
+void CProfilerGuiModel::RefreshViewL(TBool aClearSelection)
+    {
+    // refresh the main list view
+    if (iMainContainer && iDrawState == EDrawStateMain && iMainContainer->ListBox())
+        {
+        // clear selections if any
+        iMainContainer->ListBox()->ClearSelection();
+        
+        // set item index to 0
+        if (aClearSelection)
+            iMainContainer->ListBox()->SetCurrentItemIndex(0); 
+        
+        // set text items
+        iMainContainer->SetListBoxTextArrayL(GenerateListBoxItemTextArrayL());
+        }
+    }
+        
+// --------------------------------------------------------------------------------------------
+
+void CProfilerGuiModel::AppendToSamplerItemListL(TSamplerAttributes& aItem)
+    {
+    // append single sampler item into sampler item list
+    if (iSamplerItemList)
+        iSamplerItemList->AppendL( aItem );
+    else
+        User::Leave(KErrNotReady);
+    }
+
+// --------------------------------------------------------------------------------------------
+
+void CProfilerGuiModel::DisableOrEnableFromSamplerItemListL(TInt aIndex)
+    {
+    if (iSamplerItemList)
+        {
+        if (iSamplerItemList->Count() > aIndex && aIndex >= 0)
+            {
+            TSamplerAttributes& attr = iSamplerItemList->At(aIndex);
+            if (attr.iEnabled)
+                {
+                attr.iEnabled = EFalse;
+                }
+            else if (!attr.iEnabled)
+                {
+                attr.iEnabled = ETrue;
+                }
+            // save settings to engine
+            RProfiler::SetSamplerAttributes(attr);
+            }
+        else
+            User::Leave(KErrNotFound);
+        }
+    else
+        {
+        User::Leave(KErrNotReady);
+        }
+
+    }
+
+// --------------------------------------------------------------------------------------------
+
+TInt CProfilerGuiModel::SamplerItemCount() const
+    {
+    TInt count(0);
+    
+    if (iSamplerItemList)
+        count = iSamplerItemList->Count();
+    
+    return count;
+    }
+    
+// --------------------------------------------------------------------------------------------
+
+void CProfilerGuiModel::DeleteAllSamplerItems()
+    {
+    // reset sampler array
+    iSamplerItemList->Reset();    
+    }  
+          
+// --------------------------------------------------------------------------------------------
+
+CDesCArray* CProfilerGuiModel::GenerateListBoxItemTextArrayL()
+    {
+    CDesCArray* textArray = new(ELeave) CDesCArrayFlat(64);
+    CleanupStack::PushL(textArray);
+
+    _LIT(KEntryTemplateRedIcon,   "1\t%S\t\t");
+    _LIT(KEntryTemplateGreenIcon, "2\t%S\t\t");
+    
+    TSamplerAttributes attr;
+    TInt itemCount(SamplerItemCount()); 
+    for (TInt i(0); i<itemCount; i++)
+        {
+        // add description from each entry
+        TBuf<512> textEntry;
+        TBuf<512> description; 
+
+        attr = iSamplerItemList->At(i);
+        
+        description.Copy(attr.iName);
+        
+        if (attr.iEnabled)
+            textEntry.Format(KEntryTemplateGreenIcon, &description);
+        else
+            textEntry.Format(KEntryTemplateRedIcon, &description);
+        
+        textArray->AppendL(textEntry);
+        }    
+    
+    CleanupStack::Pop(); //textArray
+    return textArray;
+    }
+
+// --------------------------------------------------------------------------------------------
+
+TBool CProfilerGuiModel::GetSelectedItemEnabled()
+    {
+    TInt currentItemIndex = iMainContainer->CurrentListBoxItemIndex();
+    
+    if (SamplerItemCount() > currentItemIndex && currentItemIndex >= 0)
+        {
+        return iSamplerItemList->At(currentItemIndex).iEnabled;
+        }
+    return EFalse;
+    }
+
+// --------------------------------------------------------------------------------------------
+
+TBool CProfilerGuiModel::GetSelectedItemHasSettings()
+    {
+    TInt currentItemIndex = iMainContainer->CurrentListBoxItemIndex();
+    
+    if (SamplerItemCount() > currentItemIndex && currentItemIndex >= 0)
+        {
+        if(iSamplerItemList->At(currentItemIndex).iItemCount != 0 || 
+                iSamplerItemList->At(currentItemIndex).iSampleRate != KErrNotFound)
+            {
+            return ETrue;
+            }
+        else
+            {
+            return EFalse;
+            }
+        }
+    return EFalse;
+    }
+
+// --------------------------------------------------------------------------------------------
+
+TBool CProfilerGuiModel::GetSelectedItemHidden()
+    {
+    TInt currentItemIndex = iMainContainer->CurrentListBoxItemIndex();
+    
+    if (SamplerItemCount() > currentItemIndex && currentItemIndex >= 0)
+        {
+        if(iSamplerItemList->At(currentItemIndex).iIsHidden)
+            {
+            return ETrue;
+            }
+        else
+            {
+            return EFalse;
+            }
+        }
+    return EFalse;
+    }
+
+// --------------------------------------------------------------------------------------------
+
+TInt CProfilerGuiModel::EditSelectedSamplerL(TInt index)
+    {
+    TSamplerAttributes sampler;
+    if(SamplerItemCount() > index && index >= 0)
+        {
+        sampler = iSamplerItemList->At(index);
+        return EditSamplerL(sampler);
+        }
+    return KErrNone;
+    }
+
+// --------------------------------------------------------------------------------------------
+
+void CProfilerGuiModel::SelectedSamplerInfoL(TInt index)
+    {
+    if(SamplerItemCount() > index && index >= 0)
+        {
+        SamplerInfoL(iSamplerItemList->At(index));
+        }
+    }
+
+// --------------------------------------------------------------------------------------------
+
+void CProfilerGuiModel::ShowItemActionMenuL()
+    {
+    TInt currentItemIndex = iMainContainer->CurrentListBoxItemIndex();
+    
+    if (SamplerItemCount() > currentItemIndex && currentItemIndex >= 0)
+        {
+        // show a query dialog    
+        TInt queryIndex(0);
+        CAknListQueryDialog* listQueryDlg = new(ELeave) CAknListQueryDialog(&queryIndex);
+        TInt resource = 0;
+        TSamplerAttributes sampler = iSamplerItemList->At(currentItemIndex);
+        
+        // check if sampler enabled
+        if(sampler.iEnabled)
+        	{
+        	resource = R_ITEM_ACTION_QUERY_ENABLED;
+            }
+        else
+        	{
+        	resource = R_ITEM_ACTION_QUERY_DISABLED;
+        	}
+        
+        // check if sampler plugin hidden => don't allow starting and stopping of sampling
+        if(sampler.iIsHidden)
+        	{
+        	resource = R_ITEM_ACTION_QUERY_HIDDEN_START_STOP;
+        	}
+        else if(( sampler.iItemCount == 0 && 
+        		sampler.iSampleRate == KErrNotFound ) && 
+        		sampler.iEnabled )
+            {
+            resource = R_ITEM_ACTION_QUERY_HIDDEN_SETTINGS_ENABLED;
+            }
+        else if(( sampler.iItemCount == 0 && 
+                sampler.iSampleRate == KErrNotFound ) && 
+                !sampler.iEnabled )
+            {
+            resource = R_ITEM_ACTION_QUERY_HIDDEN_SETTINGS_DISABLED;
+            }
+        
+        // execute query dialog with the given resource
+        if (listQueryDlg->ExecuteLD(resource))
+            {
+            if(!sampler.iIsHidden)
+            	{
+            	if(sampler.iItemCount != 0 || 
+            	        sampler.iSampleRate != KErrNotFound )
+            	    {
+                    // enable/disable sampler
+                    if (queryIndex == EItemActionMenuTypeEnable)
+                        {
+                        DisableOrEnableSelectedOrHighlightedItemsL();
+                        }
+                    // edit sampler settings
+                    else if (queryIndex == EItemActionMenuTypeEditSettings - 1)
+                        {
+                        EditSamplerL(sampler);
+                        }
+                    // info
+                    else if (queryIndex == EItemActionMenuTypeInfo - 1)
+                        {
+                        SamplerInfoL(sampler);
+                        }
+            	    }
+            	else
+            	    {
+                    // special case, use raw query indexes
+                     if (queryIndex == 0)
+                         {
+                         DisableOrEnableSelectedOrHighlightedItemsL();
+                         }
+                     else if (queryIndex == 1)
+                         {
+                         SamplerInfoL(sampler);
+                         }
+            	    }
+            	}
+            else
+				{
+				if(sampler.iItemCount != 0 || 
+				        sampler.iSampleRate != KErrNotFound)
+					{
+					// special case, use raw query indexes
+					// edit sampler settings
+					if (queryIndex == 0)
+						{
+						EditSamplerL(sampler);
+						}
+					// sampler info
+					else if (queryIndex == 1)
+						{
+						SamplerInfoL(sampler);
+						}
+					}
+				else
+					{
+					// only sampler info available if hidden and no setting items to be set
+					if (queryIndex == 0)
+						{
+						SamplerInfoL(sampler);
+						}
+					
+					}
+				}
+            }
+        }
+    }
+
+void CProfilerGuiModel::DisableOrEnableSelectedOrHighlightedItemsL()
+    {
+    const CArrayFix<TInt>* selectionIndexes = iMainContainer->ListBoxSelectionIndexes();
+
+    // by default use selected items
+    if (selectionIndexes && selectionIndexes->Count() > 0)
+        {
+        TInt ref(0);
+        TKeyArrayFix key(0, ECmpTUint16);
+        TInt index(0);
+
+        for (TInt i=0; i<SamplerItemCount(); i++)
+            {
+            ref = i;
+
+            if (selectionIndexes->Find(ref, key, index) == 0)  
+                {
+                DisableOrEnableFromSamplerItemListL(i);
+                }
+            }
+        
+        RefreshViewL(EFalse);
+        }
+    
+    // or if none selected, use the current item index
+    else
+        {
+        TInt currentItemIndex = iMainContainer->CurrentListBoxItemIndex();
+        
+        if (SamplerItemCount() > currentItemIndex && currentItemIndex >= 0)
+            {
+            DisableOrEnableFromSamplerItemListL(currentItemIndex);
+            
+            RefreshViewL(EFalse);
+            }
+        }  
+    }
+
+void CProfilerGuiModel::LoadPluginsL()
+	{
+    // get samplers from Profiler Engine (client-server session) 
+	// and add the to the samplers list for the first time
+    LOGTEXT(_L("CProfilerGuiModel::LoadPlugins - get sampler plugins"));
+    TInt err = RProfiler::GetSamplerAttributes(*iSamplerAttributes);
+    
+    // check if engine provided a list of samplers
+    if( err != KErrNone )
+        {
+        // could not get samplers from engine
+        LOGTEXT(_L("CProfilerGuiModel::LoadPlugins - failed to connect engine"));
+        }
+    else
+        {
+        LOGTEXT(_L("CProfilerGuiModel::LoadPlugins - adding new samplers into view"));
+        AddNewSamplersL(*iSamplerAttributes);
+        }
+    
+    LOGTEXT(_L("CProfilerGuiModel::LoadPlugins - exit"));
+	}
+
+// --------------------------------------------------------------------------------------------
+
+TInt CProfilerGuiModel::LoadGeneralSettingsL()
+    {
+    // local variable for getting saved settings from profiler engine
+    TGeneralAttributes generalAttr;
+    TInt err(KErrNone);
+    
+    // before loading saved settings (from settings file) set the default values 
+    iGeneralAttributes.iTraceOutput.Copy(KTraceOutput);
+    iGeneralAttributes.iTraceFilePrefix.Copy(KProfilerDefaultPrefix);
+    iGeneralAttributes.iSaveFileDrive.Copy(KProfilerDefaultDrive);
+    iGeneralAttributes.iTimedSamplingPeriod = KDefaultTimedSamplingPeriod;
+    
+    // request to 
+    err = RProfiler::GetGeneralAttributes(generalAttr);
+    
+    // check that request succesfull
+    if( err != KErrNone )
+        {
+        // could not connect profiler engine, use 
+        return err;
+        }
+    
+    // check if saved settings different than the default
+    if(generalAttr.iTraceOutput.MatchF(iGeneralAttributes.iTraceOutput) == KErrNotFound)
+        {
+        iGeneralAttributes.iTraceOutput.Copy(generalAttr.iTraceOutput);
+        }
+
+    if(generalAttr.iTraceFilePrefix.MatchF(iGeneralAttributes.iTraceFilePrefix) == KErrNotFound)
+        {
+        iGeneralAttributes.iTraceFilePrefix.Copy(generalAttr.iTraceFilePrefix);
+        }
+
+    if(generalAttr.iSaveFileDrive.MatchF(iGeneralAttributes.iSaveFileDrive) == KErrNotFound)
+        {
+        iGeneralAttributes.iSaveFileDrive.Copy(generalAttr.iSaveFileDrive);
+        }
+    
+    if( generalAttr.iTimedSamplingPeriod > 0)
+        {
+        iGeneralAttributes.iTimedSamplingPeriod = generalAttr.iTimedSamplingPeriod;
+        }
+    
+    return err;
+    }
+
+// --------------------------------------------------------------------------------------------
+
+void CProfilerGuiModel::SaveGeneralSettingsL()
+    {
+    TInt err(KErrNone);
+    
+    // save general attributes to Profiler Engine
+    err = RProfiler::SetGeneralAttributes(iGeneralAttributes);
+    
+    // check if save failed
+    if(err == KErrNotFound)
+        {
+        // profiler stopped (e.g. from eshell) and must be restarted 
+        LaunchProfilerEngineL();
+        
+        err = RProfiler::SetGeneralAttributes(iGeneralAttributes);
+        if(err != KErrNone)
+            {
+            // leave no use to continue
+            User::Leave(err);
+            }
+        }
+    }
+
+void CProfilerGuiModel::SetMainView(CProfilerGuiMainView* aMainView)
+    {
+    iMainView = aMainView;
+    }
+
+// --------------------------------------------------------------------------------------------
+
+void CProfilerGuiModel::HandleProfilerStatusChange( KProfilerStatus aStatus )
+    {
+    iState = aStatus;
+    if( aStatus == EIdle )
+        {
+        iMainContainer->ShowWriterInfoPopupL(KNullDesC);
+        // set plugin list back to enabled
+        iMainContainer->SetDimmed(EFalse);
+        }
+    TRAP_IGNORE(iMainView->UpdateStatusPaneL(aStatus));
+    }
+
+void CProfilerGuiModel::HandleProfilerErrorL( TInt aError )
+    {
+    TBuf<64> errorMsg;
+    _LIT(KErrorMessage, "Error: ");
+    _LIT(KNoMemory, "Cannot write to file, check settings");
+    
+    errorMsg.Copy(KErrorMessage);
+    // message from pwr sampler
+    if( aError < -1000 )
+        {
+        errorMsg.Append(_L("Stop other power measurement tools!"));
+        }
+    else if( aError == KErrAlreadyExists || aError == 11 )
+        {
+        errorMsg.Append(_L("Close old Profiler before start!"));
+        }
+    else if( aError == KErrNotReady )
+        {
+        errorMsg.Append(_L("Memory card removed, failed to write!"));
+        }
+    else if( aError == KErrPathNotFound )
+        {
+        errorMsg.Append(_L("Given trace data location does not exist"));
+        }
+    else
+        {
+        if( aError == KErrNoMemory || 
+                aError == KErrOverflow || 
+                aError == KErrDirFull || 
+                aError == KErrDiskFull || 
+                aError == KErrNotReady )
+            {
+            errorMsg.Append(KNoMemory);
+            }
+        else
+            {
+            errorMsg.Append(_L("code: "));
+            errorMsg.AppendNum(aError);
+            }
+        }
+    // simply show an error note
+    CAknErrorNote* note = new(ELeave) CAknErrorNote();
+    note->ExecuteLD(errorMsg);
+    
+    // set state idle in all error cases
+    iState = MProfilerStatusObserver::EIdle;
+    
+    // update status pane
+    iMainView->UpdateStatusPaneL(iState);
+    
+    // set plugin list back to enabled
+    iMainContainer->SetDimmed(EFalse);
+    
+    // refresh and set menus etc. in correct state
+    RefreshViewL();
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/piprofilerui/ui/avkon/src/profiler_gui_samplersettingsviewdlg.cpp	Wed Jun 09 09:42:37 2010 +0300
@@ -0,0 +1,479 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:   
+*
+*/
+
+
+
+// INCLUDE FILES
+#include "profiler_gui_samplersettingsviewdlg.h"
+#include "profiler_gui_model.h"
+#include "profiler_gui.hrh"
+#include "profiler_gui_std.h"
+#include <piprofilerui.rsg>
+
+#include <aknsettingitemlist.h>
+#include <CAknMemorySelectionSettingItem.h> 
+#include <aknlists.h>
+#include <akntitle.h>
+#include <aknnavi.h>
+#include <aknnavide.h>
+#include <StringLoader.h>
+#include <aknnotewrappers.h> 
+
+// LITERALS
+_LIT8(KCPUSamplerName, "gpp");
+_LIT(KEmptySettingItem, "");
+
+// ===================================== MEMBER FUNCTIONS =====================================
+
+CProfilerSamplerSettingsViewDlg* CProfilerSamplerSettingsViewDlg::NewL(TSamplerAttributes& aSettings)
+    {
+    CProfilerSamplerSettingsViewDlg* self = new(ELeave) CProfilerSamplerSettingsViewDlg(aSettings);
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    CleanupStack::Pop(self);
+    return self;    
+    }
+
+// --------------------------------------------------------------------------------------------
+
+CProfilerSamplerSettingsViewDlg::~CProfilerSamplerSettingsViewDlg()
+    {
+    // restore default navi pane
+    if(iNaviContainer)
+        iNaviContainer->Pop();
+    
+    if (iSettingItemArray)
+        {
+        iSettingItemArray->ResetAndDestroy();
+        delete iSettingItemArray; 
+        }
+    
+    }
+
+// --------------------------------------------------------------------------------------------
+
+CProfilerSamplerSettingsViewDlg::CProfilerSamplerSettingsViewDlg(TSamplerAttributes& aSettings) 
+	: 	iSettings(aSettings)
+    {
+    }
+
+// --------------------------------------------------------------------------------------------
+
+void CProfilerSamplerSettingsViewDlg::ConstructL()
+    {
+    // construct a menu bar
+    CAknDialog::ConstructL(R_PROFILER_SAMPLER_SETTINGS_MENUBAR);
+   
+    CEikStatusPane* sp = iEikonEnv->AppUiFactory()->StatusPane();
+    
+    // set empty navi pane label
+    iNaviContainer = static_cast<CAknNavigationControlContainer*>(sp->ControlL(TUid::Uid(EEikStatusPaneUidNavi)));
+    iNaviContainer->PushDefaultL();
+    
+    TBuf<64> settingsTitle;
+
+    settingsTitle.Zero();
+    settingsTitle.Copy(iSettings.iName);
+    
+    // set title text
+    CAknTitlePane* tp = static_cast<CAknTitlePane*>( sp->ControlL( TUid::Uid( EEikStatusPaneUidTitle ) ) );
+    tp->SetTextL( settingsTitle );
+
+    iItemCount = iSettings.iItemCount;
+    
+    }
+
+// --------------------------------------------------------------------------------------------
+
+void CProfilerSamplerSettingsViewDlg::HandleListBoxEventL(CEikListBox* /*aListBox*/, TListBoxEvent aEventType)
+    {
+    switch (aEventType)
+        {
+        case EEventEnterKeyPressed:
+        case EEventItemDoubleClicked:
+            ShowSettingPageL(EFalse);
+            break;
+        default:
+            break;
+        }
+    }
+
+// --------------------------------------------------------------------------------------------
+
+void CProfilerSamplerSettingsViewDlg::TabChangedL(TInt /*aIndex*/)
+    {
+    iListBox->SetCurrentItemIndex(0);
+
+    SetVisibilitiesOfSettingItemsL();   
+    }
+
+// --------------------------------------------------------------------------------------------
+
+void CProfilerSamplerSettingsViewDlg::ProcessCommandL(TInt aCommandId)
+    {
+    CAknDialog::ProcessCommandL(aCommandId);
+
+    switch (aCommandId)
+        {
+        case EProfilerGuiCmdSettingsChange:
+            ShowSettingPageL(ETrue);
+            break;
+        case EProfilerGuiCmdSettingsExit:
+            TryExitL(EAknCmdExit);
+            break;
+        default:
+            break;
+        }
+    }
+
+// --------------------------------------------------------------------------------------------
+
+TKeyResponse CProfilerSamplerSettingsViewDlg::OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType)
+    {
+
+    return CAknDialog::OfferKeyEventL(aKeyEvent, aType);
+    }    
+
+// --------------------------------------------------------------------------------------------
+
+void CProfilerSamplerSettingsViewDlg::PreLayoutDynInitL()
+    {
+    iListBox = static_cast<CAknSettingStyleListBox*>( Control(EProfilerSamplerSettingItemList) );
+    iListBox->SetMopParent(this);
+    iListBox->CreateScrollBarFrameL(ETrue);
+    iListBox->ScrollBarFrame()->SetScrollBarVisibilityL(CEikScrollBarFrame::EOff, CEikScrollBarFrame::EAuto);
+    iListBox->SetListBoxObserver(this);
+
+    iSettingItemArray = new(ELeave) CAknSettingItemArray(16, EFalse, 0);
+
+    CTextListBoxModel* model = iListBox->Model();
+    model->SetItemTextArray(iSettingItemArray);
+    model->SetOwnershipType(ELbmDoesNotOwnItemArray);
+
+    UpdateListBoxL();    
+    }
+
+// --------------------------------------------------------------------------------------------
+
+TBool CProfilerSamplerSettingsViewDlg::OkToExitL(TInt aButtonId)
+    {
+    // save all settings when exiting, only numeric values are needed to saved since copied from TBuf
+    for(TInt i(1);i<iItemCount+1;i++)
+    	{
+    	if(iSettingItemArray->At(i)->IsHidden() == EFalse)
+    	    {
+            switch(i)
+    	        {
+                case 1:
+                    {
+                    // check if settings value type integer
+                    if(iSettings.iSettingItem1.iType == TSettingItem::ESettingItemTypeInt)
+                        {
+                        iSettings.iSettingItem1.iValue.Num(iItemBuf[i]);
+                        }
+                    break;
+                    }
+                case 2:
+                    {
+                    // check if settings value type integer
+                    if(iSettings.iSettingItem2.iType == TSettingItem::ESettingItemTypeInt)
+                        {
+                        iSettings.iSettingItem2.iValue.Num(iItemBuf[i]);
+                        }
+                    break;
+                    }
+                case 3:
+                    {
+                    // check if settings value type integer
+                    if(iSettings.iSettingItem3.iType == TSettingItem::ESettingItemTypeInt)
+                        {
+                        iSettings.iSettingItem3.iValue.Num(iItemBuf[i]);
+                        }
+                    break;
+                    }
+                case 4:
+                    {
+                    // check if settings value type integer
+                    if(iSettings.iSettingItem4.iType == TSettingItem::ESettingItemTypeInt)
+                        {
+                        iSettings.iSettingItem4.iValue.Num(iItemBuf[i]);
+                        }
+
+                    break;
+                    }
+                case 5:
+                    {
+                    // check if settings value type integer
+                    if(iSettings.iSettingItem5.iType == TSettingItem::ESettingItemTypeInt)
+                        {
+                        iSettings.iSettingItem5.iValue.Num(iItemBuf[i]);
+                        }
+
+                    break;
+                    }
+                case 6:
+                    {
+                    // check if settings value type integer
+                    if(iSettings.iSettingItem6.iType == TSettingItem::ESettingItemTypeInt)
+                        {
+                        iSettings.iSettingItem6.iValue.Num(iItemBuf[i]);
+                        }
+
+                    break;
+                    }
+    	        }
+    	    }
+    	}
+	return CAknDialog::OkToExitL(aButtonId);
+    }
+
+// --------------------------------------------------------------------------------------------
+
+void CProfilerSamplerSettingsViewDlg::ShowSettingPageL(TInt aCalledFromMenu)
+    {
+    TInt listIndex = iListBox->CurrentItemIndex();
+    TInt realIndex = iSettingItemArray->ItemIndexFromVisibleIndex(listIndex);
+    CAknSettingItem* item = iSettingItemArray->At(realIndex);
+    item->EditItemL(aCalledFromMenu);
+    item->StoreL();
+    SetVisibilitiesOfSettingItemsL();
+    DrawNow();
+    }
+
+// --------------------------------------------------------------------------------------------
+
+void CProfilerSamplerSettingsViewDlg::SetVisibilitiesOfSettingItemsL()
+    {
+    if (iSettingItemArray->Count() > 0)
+        {
+        if(iSettings.iSampleRate > 0)
+        	{
+        	((*iSettingItemArray)[EProfilerGuiGenericSamplerQuerySampleRate])->SetHidden(EFalse);
+        	}
+        else
+        	{
+        	((*iSettingItemArray)[EProfilerGuiGenericSamplerQuerySampleRate])->SetHidden(ETrue);
+        	}
+        if(iItemCount>0)
+        	((*iSettingItemArray)[EProfilerGuiGenericSamplerQueryItem1])->SetHidden(EFalse);
+        if(iItemCount>1)
+        	((*iSettingItemArray)[EProfilerGuiGenericSamplerQueryItem2])->SetHidden(EFalse);
+        if(iItemCount>2)
+        	((*iSettingItemArray)[EProfilerGuiGenericSamplerQueryItem3])->SetHidden(EFalse);
+        if(iItemCount>3)
+        	((*iSettingItemArray)[EProfilerGuiGenericSamplerQueryItem4])->SetHidden(EFalse);
+        if(iItemCount>4)
+        	((*iSettingItemArray)[EProfilerGuiGenericSamplerQueryItem5])->SetHidden(EFalse);
+        if(iItemCount>5)
+        	((*iSettingItemArray)[EProfilerGuiGenericSamplerQueryItem6])->SetHidden(EFalse);
+
+        iSettingItemArray->RecalculateVisibleIndicesL();
+        iListBox->HandleItemAdditionL();
+        iListBox->UpdateScrollBarsL();
+        }
+    }   
+
+// --------------------------------------------------------------------------------------------
+
+void CProfilerSamplerSettingsViewDlg::UpdateListBoxL()
+    {
+    iSettingItemArray->ResetAndDestroy();
+    
+    // create items
+    TInt ordinal(0);
+    
+    AddSettingItemL(EProfilerGuiGenericSamplerQuerySampleRate,
+					R_SAMPLE_RATE_SETTING_TITLE,
+                    R_SAMPLER_RATE_SETTING_PAGE,
+                    NULL,
+                    ordinal++);    
+    
+    if(iItemCount>0)
+	AddSettingItemL(EProfilerGuiGenericSamplerQueryItem1,
+					R_ITEM1_SETTING_TITLE,
+					NULL,
+					NULL,
+					ordinal++);
+    if(iItemCount>1)
+    AddSettingItemL(EProfilerGuiGenericSamplerQueryItem2,
+					R_ITEM2_SETTING_TITLE,
+					NULL,
+                    NULL,
+                    ordinal++);
+    if(iItemCount>2)
+    AddSettingItemL(EProfilerGuiGenericSamplerQueryItem3,
+					R_ITEM3_SETTING_TITLE,
+					NULL,
+                    NULL,
+                    ordinal++);
+    if(iItemCount>3)
+    AddSettingItemL(EProfilerGuiGenericSamplerQueryItem4,
+					R_ITEM4_SETTING_TITLE,
+					NULL,
+                    NULL,
+                    ordinal++);
+    if(iItemCount>4)
+    AddSettingItemL(EProfilerGuiGenericSamplerQueryItem5,
+					R_ITEM5_SETTING_TITLE,
+					NULL,
+                    NULL,
+                    ordinal++);
+    if(iItemCount>5)
+    AddSettingItemL(EProfilerGuiGenericSamplerQueryItem6,
+					R_ITEM6_SETTING_TITLE,
+					NULL,
+                    NULL,
+                    ordinal++);
+
+    SetVisibilitiesOfSettingItemsL(); 
+    }
+
+// --------------------------------------------------------------------------------------------
+
+CAknSettingItem* CProfilerSamplerSettingsViewDlg::GetSettingItemL(TSettingItem& aItem, TInt aIndex, TInt& aSettingPageResource)
+    {
+    CAknSettingItem* settingItem = NULL;
+    
+    // set default setting page dialog style resource
+    aSettingPageResource = R_GENERIC_TEXT_SETTING_PAGE;
+    
+    // check if setting item type integer
+    if(aItem.iType == TSettingItem::ESettingItemTypeInt)
+        {
+        TLex* lex = new TLex(aItem.iValue);
+        // check if value valid
+        if(lex->Val(iItemBuf[aIndex]) != KErrNone)
+            {
+            // if value not valid set to 0 
+            iItemBuf[aIndex] = 0;
+            }
+        settingItem = new(ELeave) CAknIntegerEdwinSettingItem(aIndex, iItemBuf[aIndex]);
+        aSettingPageResource = R_NUMERIC_SETTING_PAGE;
+        delete lex;
+        return settingItem;
+        }
+    else    // else manipulate as a text setting
+        {
+        settingItem = new(ELeave) CAknTextSettingItem(aIndex, aItem.iValue);
+        settingItem->SetEmptyItemTextL(KEmptySettingItem); 
+        return settingItem;
+        }
+    }
+
+// --------------------------------------------------------------------------------------------
+
+void CProfilerSamplerSettingsViewDlg::AddSettingItemL(TInt aId,
+                                                 TInt aTitleResource,
+                                                 TInt aSettingPageResource,
+                                                 TInt aAssociatedResource,
+                                                 TInt aOrdinal)
+    {
+    // create a setting item
+    CAknSettingItem* settingItem = NULL;
+
+    TBuf<KMaxSettingUITextLength> ptr;
+    switch(aId)
+        {
+        case EProfilerGuiGenericSamplerQuerySampleRate:
+            {
+            settingItem = new (ELeave) CAknIntegerEdwinSettingItem(aId, iSettings.iSampleRate);
+            break;
+            }
+        case EProfilerGuiGenericSamplerQueryItem1:
+            {
+            ptr.Copy(iSettings.iSettingItem1.iUIText);
+            settingItem = GetSettingItemL(iSettings.iSettingItem1, aId, aSettingPageResource);
+            break;
+            }
+        case EProfilerGuiGenericSamplerQueryItem2:
+            {
+            ptr.Copy(iSettings.iSettingItem2.iUIText); 
+            settingItem = GetSettingItemL(iSettings.iSettingItem2, aId, aSettingPageResource);
+            break;
+            }
+        case EProfilerGuiGenericSamplerQueryItem3:
+            {
+            ptr.Copy(iSettings.iSettingItem3.iUIText);
+            settingItem = GetSettingItemL(iSettings.iSettingItem3, aId, aSettingPageResource);
+            break;
+            }
+        case EProfilerGuiGenericSamplerQueryItem4:
+            {
+            ptr.Copy(iSettings.iSettingItem4.iUIText); 
+            settingItem = GetSettingItemL(iSettings.iSettingItem4, aId, aSettingPageResource);
+            break;
+            }
+        case EProfilerGuiGenericSamplerQueryItem5:
+            {
+            ptr.Copy(iSettings.iSettingItem5.iUIText);
+            settingItem = GetSettingItemL(iSettings.iSettingItem5, aId, aSettingPageResource);
+            break;
+            }
+        case EProfilerGuiGenericSamplerQueryItem6:
+            {
+            ptr.Copy(iSettings.iSettingItem6.iUIText); 
+            settingItem = GetSettingItemL(iSettings.iSettingItem6, aId, aSettingPageResource);
+            break;
+            }
+		default:
+			{
+			// Id not supported
+			User::Leave(KErrNotSupported);
+			break;
+			}
+        }
+
+    CleanupStack::PushL(settingItem);
+
+    // get title text
+    HBufC* itemTitle;
+    
+    if( ptr.Compare(KNullDesC) == 0 )
+        {
+        itemTitle = StringLoader::LoadLC(aTitleResource);
+        
+        // special case: check if CPU sampler
+        if(iSettings.iShortName.CompareF(KCPUSamplerName) == 0)
+            {
+            // change setting page using different value range, since > 10000 ms rates are too big
+            aSettingPageResource = R_CPU_SAMPLER_RATE_SETTING_PAGE;
+            }
+
+        // construct the setting item
+        settingItem->ConstructL(EFalse, aOrdinal, *itemTitle, NULL, aSettingPageResource,
+                                EAknCtPopupSettingList, NULL, aAssociatedResource);
+        // append the setting item to settingitem array
+        iSettingItemArray->InsertL(aOrdinal, settingItem);
+
+        CleanupStack::PopAndDestroy(); //itemTitle
+        }
+    else
+        {
+        // construct the setting item
+        settingItem->ConstructL(EFalse, aOrdinal, ptr, NULL, aSettingPageResource,
+                                EAknCtPopupSettingList, NULL, aAssociatedResource);
+
+        // append the setting item to settingitem array
+        iSettingItemArray->InsertL(aOrdinal, settingItem);
+        }
+
+    CleanupStack::Pop(); //settingItem
+    }
+
+// --------------------------------------------------------------------------------------------
+// End of File
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/piprofilerui/ui/avkon/src/profiler_gui_settingsviewdlg.cpp	Wed Jun 09 09:42:37 2010 +0300
@@ -0,0 +1,386 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:   
+*
+*/
+
+
+
+// INCLUDE FILES
+#include "profiler_gui_settingsviewdlg.h"
+#include "profiler_gui_model.h"
+#include "profiler_gui.hrh"
+#include "profiler_gui_std.h"
+#include <piprofilerui.rsg>
+
+#include <aknsettingitemlist.h>
+#include <CAknMemorySelectionSettingItem.h> 
+#include <aknlists.h>
+#include <akntitle.h>
+#include <aknnavi.h>
+#include <aknnavide.h>
+#include <StringLoader.h>
+#include <aknnotewrappers.h> 
+
+// LITERALS
+_LIT8(KDebugOutput, "debug_output");
+_LIT8(KFileSystem, "file_system");
+_LIT(KEmptySettingItem, "");
+
+// ===================================== MEMBER FUNCTIONS =====================================
+
+CProfilerGuiSettingsViewDlg* CProfilerGuiSettingsViewDlg::NewL(TGeneralAttributes& aSettings)
+    {
+    CProfilerGuiSettingsViewDlg* self = new(ELeave) CProfilerGuiSettingsViewDlg(aSettings);
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    CleanupStack::Pop(self);
+    return self;    
+    }
+
+// --------------------------------------------------------------------------------------------
+
+CProfilerGuiSettingsViewDlg::~CProfilerGuiSettingsViewDlg()
+    {
+    // restore default navi pane
+    if(iNaviContainer)
+        iNaviContainer->Pop();
+    
+    if (iSettingItemArray)
+        {
+        iSettingItemArray->ResetAndDestroy();
+        delete iSettingItemArray; 
+        }
+    
+    }
+
+// --------------------------------------------------------------------------------------------
+
+CProfilerGuiSettingsViewDlg::CProfilerGuiSettingsViewDlg(TGeneralAttributes& aSettings) : iSettings(aSettings)
+    {
+    }
+
+// --------------------------------------------------------------------------------------------
+
+void CProfilerGuiSettingsViewDlg::ConstructL()
+    {
+    // construct a menu bar
+    CAknDialog::ConstructL(R_PROFILER_GUI_SETTINGS_MENUBAR);
+   
+    CEikStatusPane* sp = iEikonEnv->AppUiFactory()->StatusPane();
+    
+    // set empty navi pane label
+    iNaviContainer = static_cast<CAknNavigationControlContainer*>(sp->ControlL(TUid::Uid(EEikStatusPaneUidNavi)));
+    iNaviContainer->PushDefaultL();
+    
+    // set title text
+    CAknTitlePane* tp = static_cast<CAknTitlePane*>( sp->ControlL( TUid::Uid( EEikStatusPaneUidTitle ) ) );
+    tp->SetTextL( _L("Settings") );
+
+    }
+
+// --------------------------------------------------------------------------------------------
+
+void CProfilerGuiSettingsViewDlg::HandleListBoxEventL(CEikListBox* /*aListBox*/, TListBoxEvent aEventType)
+    {
+    switch (aEventType)
+        {
+        case EEventEnterKeyPressed:
+        case EEventItemDoubleClicked:
+            ShowSettingPageL(EFalse);
+            break;
+        default:
+            break;
+        }
+    }
+
+// --------------------------------------------------------------------------------------------
+
+void CProfilerGuiSettingsViewDlg::TabChangedL(TInt /*aIndex*/)
+    {
+    iListBox->SetCurrentItemIndex(0);
+
+    SetVisibilitiesOfSettingItemsL();   
+    }
+
+// --------------------------------------------------------------------------------------------
+
+void CProfilerGuiSettingsViewDlg::ProcessCommandL(TInt aCommandId)
+    {
+    CAknDialog::ProcessCommandL(aCommandId);
+
+    switch (aCommandId)
+        {
+        case EProfilerGuiCmdSettingsChange:
+            ShowSettingPageL(ETrue);
+            break;
+        case EProfilerGuiCmdSettingsExit:
+            TryExitL(EAknCmdExit);
+            break;
+        default:
+            break;
+        }
+    }
+
+// --------------------------------------------------------------------------------------------
+
+TKeyResponse CProfilerGuiSettingsViewDlg::OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType)
+    {
+    /*
+    if (iTabGroup == NULL)
+        {
+        return EKeyWasNotConsumed;
+        }
+        */
+/*
+    TInt active = iTabGroup->ActiveTabIndex();
+    TInt count = iTabGroup->TabCount();
+
+    switch ( aKeyEvent.iCode )
+        {
+        case EKeyLeftArrow:
+            if (active > 0)
+                {
+                active--;
+                iTabGroup->SetActiveTabByIndex(active);
+                TabChangedL(active); 
+                }
+            break;
+        
+        case EKeyRightArrow:
+            if((active + 1) < count)
+                {
+                active++;
+                iTabGroup->SetActiveTabByIndex(active);
+                TabChangedL(active); 
+                }
+            break;
+        }
+*/
+    return CAknDialog::OfferKeyEventL(aKeyEvent, aType);
+    }    
+
+// --------------------------------------------------------------------------------------------
+
+void CProfilerGuiSettingsViewDlg::PreLayoutDynInitL()
+    {
+    iListBox = static_cast<CAknSettingStyleListBox*>( Control(EProfilerGuiSettingItemList) );
+    iListBox->SetMopParent(this);
+    iListBox->CreateScrollBarFrameL(ETrue);
+    iListBox->ScrollBarFrame()->SetScrollBarVisibilityL(CEikScrollBarFrame::EOff, CEikScrollBarFrame::EAuto);
+    iListBox->SetListBoxObserver(this);
+
+    iSettingItemArray = new(ELeave) CAknSettingItemArray(16, EFalse, 0);
+
+    CTextListBoxModel* model = iListBox->Model();
+    model->SetItemTextArray(iSettingItemArray);
+    model->SetOwnershipType(ELbmDoesNotOwnItemArray);
+
+    UpdateListBoxL();    
+    }
+
+// --------------------------------------------------------------------------------------------
+
+TBool CProfilerGuiSettingsViewDlg::OkToExitL(TInt aButtonId)
+    {
+    // save settings to iSettings before exiting
+    
+    // check if trace output target changed
+    if(iTraceOutput == EOutputToDebugPort)
+        {
+        iSettings.iTraceOutput.Copy(KDebugOutput);
+        }
+    else
+        {
+        iSettings.iTraceOutput.Copy(KFileSystem);
+        }
+    
+    // save trace file prefix
+    if(iFilePrefix.CompareF(KNullDesC) != 0)
+        {
+        CnvUtfConverter::ConvertFromUnicodeToUtf8(iSettings.iTraceFilePrefix, iFilePrefix);
+        }
+    
+    // save the drive 
+    if(iSaveDrive.CompareF(KNullDesC) != 0)
+        {
+        CnvUtfConverter::ConvertFromUnicodeToUtf8(iSettings.iSaveFileDrive, iSaveDrive);
+        }
+    
+    return CAknDialog::OkToExitL(aButtonId);
+    }
+
+
+
+// --------------------------------------------------------------------------------------------
+
+void CProfilerGuiSettingsViewDlg::ShowSettingPageL(TInt aCalledFromMenu)
+    {
+    TInt listIndex = iListBox->CurrentItemIndex();
+    TInt realIndex = iSettingItemArray->ItemIndexFromVisibleIndex(listIndex);
+    CAknSettingItem* item = iSettingItemArray->At(realIndex);
+    item->EditItemL(aCalledFromMenu);
+    item->StoreL();
+    SetVisibilitiesOfSettingItemsL();
+    DrawNow();
+    }
+
+// --------------------------------------------------------------------------------------------
+
+void CProfilerGuiSettingsViewDlg::SetVisibilitiesOfSettingItemsL()
+    {
+
+    // check if setting item array contains more than 0 items
+    if (iSettingItemArray->Count() > 0)
+        {
+//        ((*iSettingItemArray)[ESettingListItemPluginNameMode])->SetHidden(ETrue);
+        ((*iSettingItemArray)[ESettingListItemPluginTraceOutput])->SetHidden(EFalse);
+        if(iTraceOutput == EOutputToDebugPort)
+        	{
+        	((*iSettingItemArray)[ESettingListItemPluginSaveFileDrive])->SetHidden(ETrue);
+        	((*iSettingItemArray)[ESettingListItemPluginTraceFilePrefix])->SetHidden(ETrue);
+        	}
+        else 
+        	{
+        	((*iSettingItemArray)[ESettingListItemPluginSaveFileDrive])->SetHidden(EFalse);
+        	((*iSettingItemArray)[ESettingListItemPluginTraceFilePrefix])->SetHidden(EFalse);
+        	}
+//        ((*iSettingItemArray)[ESettingListItemPluginTraceMode])->SetHidden(ETrue);
+
+        iSettingItemArray->RecalculateVisibleIndicesL();
+        iListBox->HandleItemAdditionL();
+        iListBox->UpdateScrollBarsL();
+        }
+    }   
+
+// --------------------------------------------------------------------------------------------
+
+void CProfilerGuiSettingsViewDlg::UpdateListBoxL()
+    {
+    iSettingItemArray->ResetAndDestroy();
+
+    // create items
+    TInt ordinal(0);
+    
+//    AddSettingItemL(ESettingListItemPluginNameMode,
+//                    R_PLUGIN_NAME_MODE_SETTING_TITLE,
+//                    R_PLUGIN_NAME_MODE_SETTING_PAGE,
+//                    R_PLUGIN_NAME_MODE_SETTING_TEXTS,
+//                    ordinal++);    
+
+    AddSettingItemL(ESettingListItemPluginTraceOutput,
+                    R_TRACE_OUTPUT_SETTING_TITLE,
+                    R_TRACE_OUTPUT_SETTING_PAGE,
+                    R_TRACE_OUTPUT_SETTING_TEXTS,
+                    ordinal++);
+    
+    AddSettingItemL(ESettingListItemPluginSaveFileDrive,
+                    R_SAVE_FILE_DRIVE_SETTING_TITLE,
+                    R_SAVE_FILE_DRIVE_SETTING_PAGE,
+                    NULL, //R_SAVE_FILE_DRIVE_SETTING_TEXTS,
+                    ordinal++);
+
+    AddSettingItemL(ESettingListItemPluginTraceFilePrefix,
+                    R_SAVE_FILE_PREFIX_SETTING_TITLE,
+                    R_SAVE_FILE_PREFIX_SETTING_PAGE,
+                    NULL,
+                    ordinal++);
+    
+    AddSettingItemL(ESettingListItemPluginSamplingTime,
+                    R_TIMED_SAMPLING_PERIOD_SETTING_TITLE,
+                    R_TIMED_SAMPLING_PERIOD_SETTING_PAGE,
+                    NULL,
+                    ordinal++);
+    
+    
+
+//    AddSettingItemL(ESettingListItemPluginTraceMode,
+//                    R_TRACE_MODE_SETTING_TITLE,
+//                    R_TRACE_MODE_SETTING_PAGE,
+//                    R_TRACE_MODE_SETTING_TEXTS,
+//                    ordinal++);
+
+    SetVisibilitiesOfSettingItemsL(); 
+    }
+
+// --------------------------------------------------------------------------------------------
+
+void CProfilerGuiSettingsViewDlg::AddSettingItemL(TInt aId,
+                                                 TInt aTitleResource,
+                                                 TInt aSettingPageResource,
+                                                 TInt aAssociatedResource,
+                                                 TInt aOrdinal)
+    {
+    // create a setting item
+    CAknSettingItem* settingItem = NULL;
+    
+    switch (aId)
+        {
+
+        case ESettingListItemPluginSaveFileDrive:
+            {
+            CnvUtfConverter::ConvertToUnicodeFromUtf8(iSaveDrive, iSettings.iSaveFileDrive);
+            settingItem = new(ELeave) CAknTextSettingItem(aId, iSaveDrive);
+            settingItem->SetEmptyItemTextL(KEmptySettingItem); 
+            break;
+            }
+        case ESettingListItemPluginTraceOutput:
+            if(iSettings.iTraceOutput.MatchF(KDebugOutput) != KErrNotFound)
+                {
+                iTraceOutput = EOutputToDebugPort;
+                }
+            else
+                {
+                iTraceOutput = EOutputToFileSystem;
+                }
+            settingItem = new(ELeave) CAknEnumeratedTextPopupSettingItem(aId, iTraceOutput); 
+
+            break;
+
+        case ESettingListItemPluginTraceFilePrefix:
+            {
+            CnvUtfConverter::ConvertToUnicodeFromUtf8(iFilePrefix, iSettings.iTraceFilePrefix);
+            settingItem = new(ELeave) CAknTextSettingItem(aId, iFilePrefix);
+            settingItem->SetEmptyItemTextL(KEmptySettingItem); 
+            break;
+            }
+        case ESettingListItemPluginSamplingTime:
+            {
+            settingItem = new(ELeave) CAknIntegerEdwinSettingItem(aId, iSettings.iTimedSamplingPeriod);
+            break;
+            }
+        default:
+            User::Panic(_L("NotSetItem"), 50);
+            break;
+
+        }
+        
+    CleanupStack::PushL(settingItem);
+
+    // get title text
+    HBufC* itemTitle = StringLoader::LoadLC(aTitleResource);
+
+    // construct the setting item
+    settingItem->ConstructL(EFalse, aOrdinal, *itemTitle, NULL, aSettingPageResource,
+                            EAknCtPopupSettingList, NULL, aAssociatedResource);
+    
+    // append the setting item to settingitem array
+    iSettingItemArray->InsertL(aOrdinal, settingItem);
+
+    CleanupStack::PopAndDestroy(); //itemTitle
+    CleanupStack::Pop(); //settingItem
+    }
+
+// End of File
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/piprofilerui/ui/hb/hb.pro	Wed Jun 09 09:42:37 2010 +0300
@@ -0,0 +1,64 @@
+#
+# Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+#
+# Contributors:
+#
+# Description: 
+#
+#
+
+
+TEMPLATE = app
+TARGET = PIProfilerUI
+DEPENDPATH += ./src
+INCLUDEPATH += inc
+INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE
+load(hb.prf) 
+symbian:CONFIG -= symbian_i18n 
+
+# Input
+HEADERS += 	./inc/pimainview.h \
+			./inc/piprofilerengineprivate.h \
+			./inc/pluginattributes.h \
+			./inc/notifications.h \
+			./inc/pisettingsview.h \
+			./inc/pimainwindow.h \
+			./inc/generalattributes.h \
+			./inc/piprofilerengine.h
+SOURCES += 	./src/pimainview.cpp \
+			./src/piprofilerengineprivate.cpp \
+			./src/main.cpp \
+			./src/pluginattributes.cpp \
+			./src/notifications.cpp \
+			./src/pisettingsview.cpp \
+			./src/pimainwindow.cpp \
+			./src/piprofilerengine.cpp 
+			
+			
+RESOURCES += piprofiler.qrc
+
+
+symbian: {
+    TARGET.UID2 = 0x100039CE
+    TARGET.UID3 = 0x2001E5AE
+    
+    BLD_INF_RULES.prj_exports += "./rom/piprofilerui_hb.iby \
+    	CORE_IBY_EXPORT_PATH(tools,piprofilerui.iby)"
+    
+	TARGET.CAPABILITY = ALL -TCB
+
+	LIBS += -lcharconv -lbafl -lsysutil
+    
+    ICON = ../icons/qgn_menu_piprofilerui.svg 
+    
+} else {
+    error("Only Symbian supported!")
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/piprofilerui/ui/hb/inc/generalattributes.h	Wed Jun 09 09:42:37 2010 +0300
@@ -0,0 +1,34 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*
+*/
+
+#ifndef GENERALATTRIBUTES_H_
+#define GENERALATTRIBUTES_H_
+/*
+ * 
+ * GeneralAttributes class definition, internal settings format
+ *  
+ */
+class GeneralAttributes
+{
+public:
+    QString mTraceOutput;
+    QString mTraceFilePrefix;
+    QString mSaveFileDrive;
+    int mTimedSamplingPeriod;
+};
+
+#endif /* GENERALATTRIBUTES_H_ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/piprofilerui/ui/hb/inc/notifications.h	Wed Jun 09 09:42:37 2010 +0300
@@ -0,0 +1,39 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*
+*/
+
+#ifndef NOTIFICATIONS_H_
+#define NOTIFICATIONS_H_
+
+#include <qstring> 
+
+/**
+ * Notifications class for viewing notification messages.
+ */
+
+class Notifications
+{
+public:
+
+    static void showInformationNote(const QString &text);
+    static void showErrorNote(const QString &text);
+    static void showMessageBox(const QString &text);
+
+private:
+
+};
+
+#endif // NOTIFICATIONS_H_
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/piprofilerui/ui/hb/inc/pimainview.h	Wed Jun 09 09:42:37 2010 +0300
@@ -0,0 +1,206 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*
+*/
+
+
+#ifndef PIMAINVIEW_H
+#define PIMAINVIEW_H
+
+#include <hbview.h>
+#include <hbicon.h>
+
+#include "pluginattributes.h"
+#include "piprofilerengine.h"
+
+class HbAction;
+class HbMainWindow;
+class HbDocumentLoader;
+class HbApplication;
+class HbLabel;
+class HbWidget;
+class HbListWidget;
+class HbListWidgetItem;
+class HbMenu;
+class PISettingsView;
+class PIMainWindow;
+class HbDialog;
+
+class PIMainView: public HbView
+{
+Q_OBJECT
+
+public:
+
+    /**
+     * Constructor
+     */
+    PIMainView();
+
+    /**
+     * Destructor
+     */
+    ~PIMainView();
+
+    /**
+     * Initializes view
+     */
+    void init(PIMainWindow *mainWindow, HbApplication *app, HbDocumentLoader &loader,
+        PIProfilerEngine *engine);
+
+    /**
+     * Sets and updates new plug-in list into main view
+     * @param pluginList List of plug-ins
+     */
+    void setPluginList(QList<PluginAttributes> *pluginList);
+
+private:
+
+    /**
+     * connects signals and slots
+     */
+    void connectSignalsAndSlots(HbApplication* app);
+
+    /**
+     * Loads all UI items from xml file
+     */
+    void loadItemsFromResources(HbDocumentLoader &loader);
+
+    /**
+     * Updates plug-in list according to member variable mPluginList
+     */
+    void updatePlugInLists();
+
+    /**
+     * Gets plug-in attributes for plug-in which UID number is defined in parameter
+     * If plugin for UID if not found, empty pluginattributes variable is returned
+     */
+    PluginAttributes getPluginAttributes(int uid);
+
+    /**
+     * Shows profiling note
+     */
+    void showProfilingNote();
+
+private slots:
+
+    /**
+     * Slot that is called when profiling status is changed.
+     * Method updated text in popup that is shown in the screen
+     */
+    void profilingStatusChanged(ProfilerEngineStatus status, const QString &text = 0,
+        ProfilingMode profilingMode = PI_PROFILINGMODENORMAL, ProfilingOutput output =
+            PI_FILE_OUTPUT);
+
+    /**
+     * shows about popup
+     */
+    void showAboutPopup();
+
+    /**
+     * opens settings view
+     */
+    void openSettingsView();
+
+    /**
+     * Enables or disables plug-in from plug-in list. If parameter is zero, selected 
+     * plug-in from plug-in list is enabled/disabled.
+     */
+    void enableOrDisablePlugin(HbListWidgetItem *widget = 0);
+
+    /**
+     * Shows context menu for list widget
+     */
+    void showContexMenu(HbListWidgetItem *widget, const QPointF &point);
+
+    /**
+     * Opens sampler info for plug-in that is selected.
+     */
+    void openSampleInfo();
+
+    /**
+     * sets context menu pointer to zero
+     */
+
+    void contextMenuClosed();
+
+    /**
+     * Shows profiling-popup and starts profiling
+     */
+    void startProfiling();
+
+    /**
+     * Shows profiling popup and starts profiling
+     */
+    void startTimedProfiling();
+
+    /**
+     * Stops profiling
+     */
+    void stopProfiling();
+
+    /**
+     * Updates "Start timed profiling for xx seconds" text according to settings
+     */
+    void updateTimedProfilingText();
+
+    /**
+     * Exits and leaves profiling on
+     */
+    void exitAndLeaveProfilingOn();
+
+    /**
+     * Opens plug-in specific settings for selected plug-in
+     */
+    void openPluginSpecificSettings();
+private:
+
+    // main application
+    HbApplication *application;
+
+    // main window
+    PIMainWindow *mMainWindow;
+
+    // engine pointer
+    PIProfilerEngine *mEngine;
+
+    // list of plug-ins
+    QList<PluginAttributes> *mPluginList;
+
+    // context menu
+    HbMenu *mContextMenu;
+
+    // Actions
+    HbAction *mActionExit;
+    HbAction *mActionExitAndLeaveProfilingOn;
+    HbAction *mActionAbout;
+    HbAction *mActionStartProfiling;
+    HbAction *mActionStartTimedProfiling;
+    HbAction *mActionSettings;
+    HbAction *mActionStopProfiling;
+
+    // plug-in list widget
+    HbListWidget *mListPlugins;
+
+    // Profiling note
+    HbDialog *mProfilingNote;
+
+    // Icons for enabled and disabled plug-ins
+    HbIcon mIconEnabled;
+    HbIcon mIconDisabled;
+
+};
+
+#endif // PIMAINVIEW_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/piprofilerui/ui/hb/inc/pimainwindow.h	Wed Jun 09 09:42:37 2010 +0300
@@ -0,0 +1,109 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*
+*/
+
+#ifndef PIPROFILERMAINWINDOW_H_
+#define PIPROFILERMAINWINDOW_H_
+
+// System includes
+#include <QObject.h>
+#include <hbmainwindow.h>
+
+// User includes
+#include "pluginattributes.h"
+
+// Forward declarations
+class PIMainView;
+class PISettingsView;
+class PIProfilerEngine;
+class HbDocumentLoader;
+class HbApplication;
+
+// Class declaration
+class PIMainWindow: public HbMainWindow
+{
+Q_OBJECT
+public:
+
+    // Member functions
+
+    PIMainWindow(PIProfilerEngine* engine, HbDocumentLoader &loader, HbApplication *app);
+    virtual ~PIMainWindow();
+
+signals:
+
+    /**
+     * Signal that is emitted when back button is pressed at settings view
+     */
+    void returnedFromSettings();
+
+public slots:
+
+    /**
+     * Activates main view
+     */
+    void activateMainView();
+
+    /**
+     * Activates settings view
+     */
+    void activateSettingsView(int uid = 0);
+
+    /**
+     * method that is called when back button pressed at settings view
+     */
+    void settingsViewClosed();
+
+    /**
+     * Sets and new plugin list to all views
+     */
+    void setPluginList(QList<PluginAttributes> &pluginList);
+
+private:
+
+    /**
+     * creates and adds main view to window
+     */
+    void addMainView(HbDocumentLoader &loader, HbApplication *app);
+
+    /**
+     * creates and adds settings view to main window
+     */
+    void addSettingsView();
+
+private slots:
+
+private:
+    // data
+
+    // Engine wrapper
+    PIProfilerEngine* mEngine;
+
+    // Main view
+    PIMainView* mMainView;
+
+    // Settings view
+    PISettingsView* mSettingsView;
+
+    // Back Action
+    HbAction *mBackAction;
+
+    // plug-in attributes
+    QList<PluginAttributes> mPluginAttributes;
+
+};
+
+#endif /* PIPROFILERMAINWINDOW_H_ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/piprofilerui/ui/hb/inc/piprofilerengine.h	Wed Jun 09 09:42:37 2010 +0300
@@ -0,0 +1,135 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*
+*/
+
+#ifndef PIPROFILEREGINE_H
+#define PIPROFILEREGINE_H
+
+#include <qobject.h>
+#include <qlist.h>
+
+#include "pluginattributes.h"
+
+class PIProfilerEnginePrivate;
+class GeneralAttributes;
+
+enum ProfilerEngineStatus
+{
+    PI_PROFILING = 0, PI_FINISHED_SUCCEFULLY, PI_ERROR
+};
+enum ProfilingMode
+{
+    PI_PROFILINGMODENORMAL = 0, PI_PROFILINGMODETIMED
+};
+enum ProfilingOutput
+{
+    PI_DEBUG_OUTPUT = 0, PI_FILE_OUTPUT
+};
+
+class PIProfilerEngine: public QObject
+{
+Q_OBJECT
+public:
+
+    /**
+     * Constructor
+     */
+    PIProfilerEngine();
+
+    /**
+     * Initilises engine
+     */
+    bool init();
+
+    /**
+     * Destructor
+     */
+    ~PIProfilerEngine();
+
+    /**
+     * Gets PI Profiler general settings
+     */
+    void getGeneralSettings(GeneralAttributes &settings);
+
+    /**
+     * Notifys engine that ui is ready
+     */
+    void notifyUIReady();
+
+    /**
+     * Saves general settings into engine
+     */
+    bool saveGeneralSettings(GeneralAttributes &settings);
+
+    /**
+     * Saves plug-in settings into engine
+     */
+    bool savePluginSettings(const PluginAttributes &pluginAttributes);
+
+    /**
+     * Starts normal profiling
+     */
+    bool startProfiling();
+
+    /**
+     * Starts timed profiling 
+     */
+    bool startTimedProfiling();
+
+    /**
+     * Stops profiling
+     */
+    void stopProfiling();
+
+    /**
+     * gets time limit for timed profiling
+     */
+    int getTimeLimit();
+
+    /**
+     * Sets PI profiler engine to continue running after ui is closed.
+     */
+    void leaveProfilingOnAfterClosing();
+
+    bool checkTraceLocationSanity(QString &location);
+
+signals:
+
+    /**
+     * Signal that is emitted when plug-in list is loaded
+     */
+    void pluginListUpdated(QList<PluginAttributes> &samplerList);
+
+    /**
+     * Signal that is emitted when profiling status is changed
+     */
+    void profilingStatusChanged(ProfilerEngineStatus status, const QString &text = 0,
+        ProfilingMode profilingMode = PI_PROFILINGMODENORMAL, ProfilingOutput output =
+            PI_FILE_OUTPUT);
+
+private:
+
+    // private implementation
+    PIProfilerEnginePrivate *mPrivate;
+
+private:
+    // Friend classes
+
+    friend class PIProfilerEnginePrivate;
+
+};
+
+#endif // PIPROFILEREGINE_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/piprofilerui/ui/hb/inc/piprofilerengineprivate.h	Wed Jun 09 09:42:37 2010 +0300
@@ -0,0 +1,217 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*
+*/
+
+#ifndef PIPROFILEREGINEPRIVATE_H
+#define PIPROFILEREGINEPRIVATE_H
+
+#include <e32base.h> 
+#include <piprofiler/ProfilerAttributes.h>
+#include <piprofiler/ProfilerEngineStatusChecker.h> 
+
+class TSamplerAttributes;
+class PIMainView;
+class PluginAttributes;
+class GeneralAttributes;
+class SettingItem;
+class CProfilerEngineStatusChecker;
+class PIProfilerEngine;
+class PIProfilerEnginePrivate: public MProfilerStatusObserver
+{
+
+public:
+
+    enum TProfilingMode
+    {
+        EProfilingModeNormal = 0, EProfilingModeTimed
+    };
+
+    /**
+     * Constructor
+     */
+    PIProfilerEnginePrivate(PIProfilerEngine *aEngine);
+
+    /**
+     * Destructor
+     */
+    ~PIProfilerEnginePrivate();
+
+    /**
+     * Initializesprofiler engine
+     */
+    bool Init();
+
+    /**
+     * Method that is called when UI is ready
+     */
+    void NotifyUIReady();
+
+    /**
+     * Saves plug-in settings into engine
+     */
+    bool SavePluginSettings(const PluginAttributes &pluginAttributes);
+
+    /**
+     * Starts normal profiling
+     */
+    bool StartProfiling();
+
+    /**
+     * Starts timed profiling 
+     */
+    bool StartTimedProfiling();
+
+    /**
+     * Stops profiling
+     */
+    void StopProfiling();
+
+    /**
+     * MProfilerStatusObserver method that is called when profiler engine's status is changed
+     */
+    void HandleProfilerStatusChange(KProfilerStatus aStatus);
+
+    /**
+     * MProfilerStatusObserver method that is called when profiler error is occured.
+     */
+    void HandleProfilerErrorL(TInt aError);
+
+    /**
+     * Gets PI Profiler general settings
+     */
+    void GetGeneralSettings(GeneralAttributes &settings);
+
+    /**
+     * Saves general settings into engine
+     */
+    bool SaveGeneralSettings(GeneralAttributes &settings);
+
+    /**
+     * gets time limit for timed profiling
+     */
+    int GetTimeLimit();
+
+    /**
+     * Sets PI profiler engine to continue running after ui is closed.
+     */
+    void LeaveProfilingOnAfterClosing();
+
+    bool CheckTraceLocationSanity(QString &location);
+
+private:
+
+    /**
+     * Saves general settings into engine
+     */
+    void SaveGeneralSettingsL();
+
+    /**
+     * loads general settings from engine
+     */
+    TInt LoadGeneralSettingsL();
+
+    /**
+     * Starts to profile
+     */
+    void StartAllSamplerItemsL(TProfilingMode aProfilingMode);
+
+    // Converters for symbian to qt and qt to symbian 
+
+    /**
+     * TSamplerAttributes -> SamplerAttributes
+     */
+    static void convertTSamplerAttributesToPluginAttributes(TSamplerAttributes &tSamplerAttributes,
+        PluginAttributes &samplerAttributes);
+
+    /**
+     * TSettingItem -> SettingItem
+     */
+    static void convertTSettingItemToSettingItem(TSettingItem &tSettingItem,
+        SettingItem &settingItem);
+
+    /**
+     * SettingItem -> TSettingItem
+     */
+    static void convertSettingItemToTSettingItem(TSettingItem &tSettingItem,
+        const SettingItem &settingItem);
+
+    /**
+     * TGeneralAttributes -> GeneralAttributes
+     */
+    static void convertTGeneralAttributesToGeneralAttributes(
+        TGeneralAttributes &tSamplerAttributes, GeneralAttributes &samplerAttributes);
+
+    /**
+     * GeneralAttributes -> TGeneralAttributes
+     */
+    static void convertGeneralAttributesToTGeneralAttributes(
+        TGeneralAttributes &tSamplerAttributes, GeneralAttributes &samplerAttributes);
+
+    /**
+     * Launches PI Profiler engine
+     */
+    int LaunchEngineL();
+
+    /**
+     * Terminates PI Profiler engine
+     */
+    void terminateEngine();
+
+    /**
+     * Gets plug-ins from engine
+     */
+    void addNewSamplers(CArrayFixFlat<TSamplerAttributes>& aAttributes);
+
+    /**
+     * Loads plug-ins
+     */
+    void loadPlugins();
+
+    /**
+     * Finds PI Profiler Engine process
+     */
+    TInt FindProcessL(RProcess& aProc);
+
+    /**
+     * Attaches client into PI Profiler engine
+     */
+    void AttachClient();
+
+    /**
+     * Checks trace location sanity
+     */
+    TBool CheckTraceLocationSanityL(TBuf8<KPrefixMaxLength>& aAttr);
+
+private:
+
+    // Should Engine leaved on after ui is closed
+    bool iLeaveProfilingOnAfterClosing;
+
+    // Public part of engine
+    PIProfilerEngine *iPublic;
+
+    // Sampler Attributes
+    CArrayFixFlat<TSamplerAttributes>* iSamplerAttributes;
+
+    // General attributes
+    TGeneralAttributes iGeneralAttributes;
+
+    // Engine status checker
+    CProfilerEngineStatusChecker* iStatusChecker;
+
+};
+
+#endif // PIPROFILEREGINEPRIVATE_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/piprofilerui/ui/hb/inc/pisettingsview.h	Wed Jun 09 09:42:37 2010 +0300
@@ -0,0 +1,140 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*
+*/
+
+#ifndef PISETTINGSVIEW_H
+#define PISETTINGSVIEW_H
+
+#include <hbview.h>
+#include <qlist.h>
+
+#include "generalattributes.h"
+
+class PIProfilerEngine;
+class HbMainWindow;
+class HbDataForm;
+class HbDataFormModel;
+class HbDataFormModelItem;
+class PluginAttributes;
+class SettingItem;
+
+class PISettingsView: public HbView
+{
+Q_OBJECT
+
+public:
+
+    enum OutputMode
+    {
+        OUTPUT_MODE_DEBUG, OUTPUT_MODE_FILE
+    };
+
+    /**
+     * Constructor
+     */
+    PISettingsView(PIProfilerEngine *engine);
+
+    /**
+     * Destructor
+     */
+    ~PISettingsView();
+
+    /**
+     * Reads general settings from data form and returns GeneralAttributes
+     */
+    GeneralAttributes& getGeneralAttributes();
+
+    /**
+     * Reads plug-in specific settings from data form and saves them into mPluginlist
+     */
+    void readPluginSettings();
+
+    /**
+     * Sets plug-in specific settings and creates data form items for them
+     */
+    void setPluginSettings(QList<PluginAttributes> *pluginList);
+
+    /**
+     * Expands one plug-ins settings group. Other groups are collapsed. 
+     */
+    void expandPluginGroup(int uid);
+
+private:
+
+    /**
+     * Creates general settings form items
+     */
+    void createGeneralSettingForms();
+
+    /**
+     * Creates plug-in specific form items
+     */
+    void createPluginSpecificSettings();
+
+    /**
+     * Loads general settings and updates them into form
+     */
+    void loadGeneralSettings();
+
+    /**
+     * Creates one plug-in setting item
+     */
+    HbDataFormModelItem *createPluginSettingItem(const SettingItem *item,
+        HbDataFormModelItem *parentGroup);
+    
+    /**
+     * reads ont plug-in setting value and saves it into qstring value
+     */
+    void readPluginSettingItemValue(HbDataFormModelItem *dataFormItem, SettingItem *settingItem);
+
+private slots:
+
+    /**
+     * Adds text validators into form items
+     */
+    void addTextValidators(const QModelIndex index);
+
+private:
+
+    // engine pointer
+    PIProfilerEngine *mEngine;
+
+    // General settings
+    GeneralAttributes mGeneralAttributes;
+
+    // list of plug-ins
+    QList<PluginAttributes> *mPluginList;
+
+    // setting form
+    HbDataForm *mSettingForm;
+
+    // model class
+    HbDataFormModel *mModel;
+
+    // data form groups
+    HbDataFormModelItem *mGeneralSettingsGroup;
+    HbDataFormModelItem *mPluginSettingsGroup;
+
+    // general setting items
+    HbDataFormModelItem *mOutputItem;
+    HbDataFormModelItem *mFileLocation;
+    HbDataFormModelItem *mPrefix;
+    HbDataFormModelItem *mSamplingPeriod;
+
+    HbDataFormModelItem *testItem;//TODO remove!
+};
+
+#endif // PISETTINGSVIEW_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/piprofilerui/ui/hb/inc/pluginattributes.h	Wed Jun 09 09:42:37 2010 +0300
@@ -0,0 +1,91 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*
+*/
+
+#ifndef PLUGINATTRIBUTES_H_
+#define PLUGINATTRIBUTES_H_
+
+/*
+ * 
+ * PluginAttributes class definition, internal settings format
+ *  
+ */
+#include <qobject.h>
+#include <qvariant.h>
+#include <qstring.h>
+
+class HbDataFormModelItem;
+
+/*
+ * 
+ * TSettingItem class definition, internal settings format
+ *  
+ */
+class SettingItem
+{
+public:
+    enum
+    {
+        SettingItemTypeInt = 0, SettingItemTypeBool, SettingItemTypeHex, SettingItemTypeText
+    };
+
+public:
+    QString mSettingText;
+    int mType;
+    QString mValue;
+    QString mSettingDescription;
+    QString mUIText;
+};
+
+class PluginAttributes// : public QObject
+{
+    //Q_OBJECT
+public:
+
+    // default constructor
+    PluginAttributes();
+
+    ~PluginAttributes();
+public:
+    int mUid;
+    QString mShortName; // name of the plugin, short name
+    QString mName; // name of the plugin, long name
+    QString mDescription; // plugin description, info about HW/SW dependencies etc.
+    int mSampleRate; // sample rate of the plugin
+    bool mEnabled; // enabled for profiling
+    bool mIsHidden; // hidden, i.e. no start/stop controls
+    int mItemCount; // plugin specific setting item count
+
+
+    // plugin specific settings, plugin implementation dependent
+    SettingItem mSettingItem1;
+    SettingItem mSettingItem2;
+    SettingItem mSettingItem3;
+    SettingItem mSettingItem4;
+    SettingItem mSettingItem5;
+    SettingItem mSettingItem6;
+
+    HbDataFormModelItem *mFormItemSettingItem1;
+    HbDataFormModelItem *mFormItemSettingItem2;
+    HbDataFormModelItem *mFormItemSettingItem3;
+    HbDataFormModelItem *mFormItemSettingItem4;
+    HbDataFormModelItem *mFormItemSettingItem5;
+    HbDataFormModelItem *mFormItemSettingItem6;
+    HbDataFormModelItem *mFormItemSampleRate;
+
+};
+
+#endif /* PLUGINATTRIBUTES_H_ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/piprofilerui/ui/hb/pimainview.docml	Wed Jun 09 09:42:37 2010 +0300
@@ -0,0 +1,68 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<hbdocument version="0.9">
+    <object name="actionStartProfiling" type="HbAction">
+        <string name="text" value="Start profiling"/>
+    </object>
+    <object name="actionSettings" type="HbAction">
+        <string name="text" value="Settings"/>
+    </object>
+    <object name="actionAbout" type="HbAction">
+        <string name="text" value="About"/>
+    </object>
+    <object name="actionExit" type="HbAction">
+        <string name="text" value="Exit"/>
+    </object>
+    <object name="actionStartTimedProfiling" type="HbAction">
+        <string name="text" value="Start profiling for 60 seconds"/>
+    </object>
+    <widget name="PIMainView" type="PIMainView">
+        <widget name="viewMenu" role="HbView:menu" type="HbMenu">
+            <string name="HbVkbHost" value=""/>
+            <ref object="actionStartProfiling" role="HbMenu:addAction"/>
+            <ref object="actionStartTimedProfiling" role="HbMenu:addAction"/>
+            <ref object="actionSettings" role="HbMenu:addAction"/>
+            <ref object="actionAbout" role="HbMenu:addAction"/>
+            <ref object="actionExit" role="HbMenu:addAction"/>
+        </widget>
+        <widget name="viewToolbar" role="HbView:toolBar" type="HbToolBar">
+            <ref object="actionStartProfiling" role="HbToolBar:addAction"/>
+            <ref object="actionSettings" role="HbToolBar:addAction"/>
+        </widget>
+        <widget name="content" role="HbView:widget" type="HbWidget">
+            <widget name="listPlugins" type="HbListWidget">
+                <sizehint height="32.53731un" type="PREFERRED" width="51.04478un"/>
+                <bool name="visible" value="TRUE"/>
+            </widget>
+            <real name="z" value="0"/>
+            <layout type="anchor">
+                <anchoritem dst="listPlugins" dstEdge="LEFT" spacing="5" src="" srcEdge="LEFT"/>
+                <anchoritem dst="listPlugins" dstEdge="RIGHT" spacing="5" src="" srcEdge="RIGHT"/>
+                <anchoritem dst="listPlugins" dstEdge="TOP" spacing="5" src="" srcEdge="TOP"/>
+                <anchoritem dst="listPlugins" dstEdge="BOTTOM" spacing="5" src="" srcEdge="BOTTOM"/>
+            </layout>
+        </widget>
+        <string name="title" value="PI Profiler"/>
+    </widget>
+    <metadata activeUIState="Common ui state" display="NHD portrait" unit="un">
+        <uistate name="Common ui state" sections="#common"/>
+    </metadata>
+</hbdocument>
+
+<!-- 
+
+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: 
+
+
+  --> 
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/piprofilerui/ui/hb/piprofiler.qrc	Wed Jun 09 09:42:37 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: 
+
+
+  --> 
+
+<RCC>
+    <qresource prefix="/xml" >
+        <file alias="pimainview.docml" >pimainview.docml</file>
+    </qresource>
+    <qresource prefix="/gfx" >
+        <file alias="piprofiler.svg">../icons/qgn_menu_piprofilerui.svg</file>
+        <file alias="enabled.svg">../icons/qgn_prob_piprofilerui_status_enabled.svg</file>
+        <file alias="disabled.svg">../icons/qgn_prob_piprofilerui_status_disabled.svg</file>
+    </qresource>
+</RCC>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/piprofilerui/ui/hb/rom/piprofilerui_hb.iby	Wed Jun 09 09:42:37 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:   
+*
+*/
+
+
+
+#ifndef __PROFILERGUI_IBY__
+#define __PROFILERGUI_IBY__
+
+S60_APP_EXE(PIProfilerUI)
+//S60_APP_AIF_ICONS(PIProfilerUI)
+data=ZRESOURCE\apps\PIProfilerUI.mif resource\apps\PIProfilerUI.mif
+data=ZRESOURCE\apps\PIProfilerUI.rsc resource\apps\PIProfilerUI.rsc
+//S60_APP_RESOURCE(PIProfilerUI)
+data=ZPRIVATE\10003a3f\import\apps\PIProfilerUI_reg.rsc private\10003a3f\import\apps\PIProfilerUI_reg.rsc
+
+data=ZPRIVATE\2001E5AE\backup_registration.xml        	private\2001E5AE\backup_registration.xml
+data=ZSYSTEM\Install\PIProfilerUI_stub.sis              system\install\PIProfilerUI_stub.sis
+
+#endif // __PROFILERGUI_IBY__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/piprofilerui/ui/hb/src/main.cpp	Wed Jun 09 09:42:37 2010 +0300
@@ -0,0 +1,68 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*
+*/
+
+
+#include <hbapplication.h>
+#include <hblabel.h>
+#include <hbmainwindow.h>
+#include <hbdocumentloader.h>
+#include <hbview.h>
+#include "pimainview.h"
+#include "piprofilerengine.h"
+#include "notifications.h"
+#include "pimainwindow.h"
+
+// Create custom document loader to be able to use custom views in XML.
+class PIProfilerDocumentLoader: public HbDocumentLoader
+{
+public:
+    virtual QObject *createObject(const QString& type, const QString &name);
+};
+
+int main(int argc, char *argv[])
+{
+
+    // Create application and document loader.
+    HbApplication app(argc, argv);
+    PIProfilerDocumentLoader loader;
+
+    // Create Engine and initialize it
+    PIProfilerEngine engine;
+    if (!engine.init()) {
+        Notifications::showErrorNote(QString("Unable to start PI Profiler engine"));
+        return EXIT_FAILURE;
+    }
+
+    // create and show main window
+    PIMainWindow mainWindow(&engine, loader, &app);
+    mainWindow.show();
+
+    return app.exec();
+}
+
+QObject *PIProfilerDocumentLoader::createObject(const QString& type, const QString &name)
+{
+    // Main view
+    if (type == PIMainView::staticMetaObject.className()) {
+        QObject *object = new PIMainView;
+        object->setObjectName(name);
+        return object;
+    }
+
+    return HbDocumentLoader::createObject(type, name);
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/piprofilerui/ui/hb/src/notifications.cpp	Wed Jun 09 09:42:37 2010 +0300
@@ -0,0 +1,73 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*
+*/
+
+#include <hbmessagebox.h>
+#include <hbpopup.h>
+#include <hbaction.h>
+#include <hblabel.h>
+#include <hbdialog.h>
+#include <hbaction.h>
+#include <hbtextitem.h>
+
+#include "notifications.h"
+
+// ---------------------------------------------------------------------------
+
+void Notifications::showInformationNote(const QString &text)
+{
+    
+    // Create new dialog 
+     HbDialog *infoNote = new HbDialog();
+     infoNote->setAttribute(Qt::WA_DeleteOnClose);
+
+     // set dismiss policy
+     infoNote->setTimeout(0); //
+
+     // create text item for popup
+     HbTextItem *label = new HbTextItem(text, infoNote);
+     label->setAlignment(Qt::AlignCenter);
+     infoNote->setContentWidget(label);
+     infoNote->setPrimaryAction(new HbAction("Ok"));
+
+     infoNote->show();
+}
+
+// ---------------------------------------------------------------------------
+
+void Notifications::showMessageBox(const QString &text)
+{
+    HbMessageBox *note = new HbMessageBox(HbMessageBox::MessageTypeInformation );
+    note->setAttribute(Qt::WA_DeleteOnClose);
+    note->setTimeout(0);
+    note->setText(text);
+    note->show();
+
+}
+
+// ---------------------------------------------------------------------------
+
+void Notifications::showErrorNote(const QString &text)
+{
+    HbMessageBox *note = new HbMessageBox(HbMessageBox::MessageTypeWarning );
+    note->setAttribute(Qt::WA_DeleteOnClose);
+    note->setTimeout(0);
+    note->setText(text);
+    note->show();
+
+}
+
+// ---------------------------------------------------------------------------
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/piprofilerui/ui/hb/src/pimainview.cpp	Wed Jun 09 09:42:37 2010 +0300
@@ -0,0 +1,565 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*
+*/
+
+
+#include <hbdocumentloader.h>
+#include <hbmainwindow.h>
+#include <hbapplication.h>
+#include <hbaction.h>
+#include <qgraphicslayout.h>
+#include <qvariant.h>
+#include <qobject.h>
+#include <qlist.h>
+#include <hbmessagebox.h>
+#include <hblabel.h>
+#include <hbwidget.h>
+#include <qstringlist.h>
+#include <qsignalmapper.h>
+#include <hblistwidget.h>
+#include <hblistwidgetitem.h>
+#include <hbmenu.h>
+#include <hbtoolbar.h>
+#include <hbdialog.h>
+#include <hbprogressdialog.h>
+#include <hbtextitem.h>
+#include <hbindicator.h>
+#include <qdebug.h>
+
+#include "pimainview.h"
+#include "piprofilerengine.h"
+#include "notifications.h"
+#include "pimainwindow.h"
+
+const char *INVALIDCONFIGURATIONFILE = "Invalid configuration file";
+const char *APPLICATIONNAME = "PI Profiler";
+
+// actions that are found from xml
+const char *ACTIONEXIT = "actionExit";
+const char *ACTIONSTARTPROFILING = "actionStartProfiling";
+const char *ACTIONSTARTTIMEDPROFILING = "actionStartTimedProfiling";
+const char *ACTIONSETTINGS = "actionSettings";
+const char *ACTIONABOUT = "actionAbout";
+
+// UI components that are found from xml
+
+const char *LISTWIDGETPLUGINS = "listPlugins";
+const char *TEXTMANDATORYPLUGINS = "Mandatory plug-ins:";
+const char *TEXTOPTIONALPLUGINS = "Optional plug-ins:";
+
+// ---------------------------------------------------------------------------
+
+PIMainView::PIMainView() :
+    application(0), mMainWindow(0), mEngine(0), mPluginList(0), mContextMenu(0), mActionExit(0),
+        mActionExitAndLeaveProfilingOn(0), mActionAbout(0), mActionStartTimedProfiling(0),
+        mActionSettings(0), mActionStopProfiling(0), mListPlugins(0), mProfilingNote(0)
+{
+
+}
+
+// ---------------------------------------------------------------------------
+
+PIMainView::~PIMainView()
+{
+}
+
+// ---------------------------------------------------------------------------
+
+void PIMainView::init(PIMainWindow *mainWindow, HbApplication* app, HbDocumentLoader &loader,
+    PIProfilerEngine *engine)
+{
+
+    application = app;
+    mMainWindow = mainWindow;
+
+    // Load items from xml file
+    loadItemsFromResources(loader);
+
+    // Set list widget items
+    mListPlugins->setLongPressEnabled(true);
+    mListPlugins->setClampingStyle(HbScrollArea::BounceBackClamping);
+    mListPlugins->setFrictionEnabled(true);
+
+    // Create stop profiling action
+    mActionStopProfiling = new HbAction("Stop Profiling", this);
+
+    // Create exit and leave profiling on action
+    mActionExitAndLeaveProfilingOn = new HbAction("Close UI\n(Continue profiling)", this);
+
+    mEngine = engine;
+
+    // Connect signals and slots
+    this->connectSignalsAndSlots(app);
+
+    // Create icons
+    mIconDisabled = HbIcon(":/gfx/disabled.svg");
+    mIconEnabled = HbIcon(":/gfx/enabled.svg");
+
+    // update timed profiling text according to settings
+    updateTimedProfilingText();
+}
+
+// ---------------------------------------------------------------------------
+
+
+void PIMainView::connectSignalsAndSlots(HbApplication* app)
+{
+
+    // Menu items:
+    connect(mActionExit, SIGNAL(triggered()), app, SLOT( quit() ));
+    connect(mActionSettings, SIGNAL(triggered()), this, SLOT( openSettingsView() ));
+    connect(mActionAbout, SIGNAL(triggered()), this, SLOT( showAboutPopup() ));
+    connect(mActionStartProfiling, SIGNAL(triggered()), this, SLOT( startProfiling() ));
+    connect(mActionStartTimedProfiling, SIGNAL(triggered()), this, SLOT( startTimedProfiling() ));
+
+    // List widget actions
+    connect(mListPlugins, SIGNAL(activated(HbListWidgetItem*)), this,
+        SLOT(enableOrDisablePlugin(HbListWidgetItem*)));
+    connect(mListPlugins, SIGNAL(longPressed(HbListWidgetItem*, QPointF)), this,
+        SLOT(showContexMenu(HbListWidgetItem*, QPointF)));
+
+    connect(
+        mEngine,
+        SIGNAL(profilingStatusChanged(ProfilerEngineStatus, const QString&, ProfilingMode, ProfilingOutput)),
+        this,
+        SLOT(profilingStatusChanged(ProfilerEngineStatus, const QString&, ProfilingMode, ProfilingOutput)));
+
+    connect(mMainWindow, SIGNAL(returnedFromSettings()), this, SLOT( updateTimedProfilingText() ));
+    connect(mActionExitAndLeaveProfilingOn, SIGNAL(triggered()), this,
+        SLOT( exitAndLeaveProfilingOn() ));
+    connect(mActionStopProfiling, SIGNAL(triggered()), this, SLOT( stopProfiling() ));
+
+}
+
+// ---------------------------------------------------------------------------
+
+
+void PIMainView::loadItemsFromResources(HbDocumentLoader &loader)
+{
+
+    // ACTIONS:
+
+    // Exit
+    QObject *object = loader.findObject(ACTIONEXIT);
+    Q_ASSERT_X((object != 0), APPLICATIONNAME, INVALIDCONFIGURATIONFILE);
+    this->mActionExit = qobject_cast<HbAction *> (object);
+
+    // About
+    object = loader.findObject(ACTIONABOUT);
+    Q_ASSERT_X((object != 0), APPLICATIONNAME, INVALIDCONFIGURATIONFILE);
+    this->mActionAbout = qobject_cast<HbAction *> (object);
+
+    // Settings
+    object = loader.findObject(ACTIONSETTINGS);
+    Q_ASSERT_X((object != 0), APPLICATIONNAME, INVALIDCONFIGURATIONFILE);
+    this->mActionSettings = qobject_cast<HbAction *> (object);
+
+    // Start profiling
+    object = loader.findObject(ACTIONSTARTPROFILING);
+    Q_ASSERT_X((object != 0), APPLICATIONNAME, INVALIDCONFIGURATIONFILE);
+    this->mActionStartProfiling = qobject_cast<HbAction *> (object);
+
+    // Start timed profiling
+    object = loader.findObject(ACTIONSTARTTIMEDPROFILING);
+    Q_ASSERT_X((object != 0), APPLICATIONNAME, INVALIDCONFIGURATIONFILE);
+    this->mActionStartTimedProfiling = qobject_cast<HbAction *> (object);
+
+    QGraphicsWidget *widget = loader.findWidget(LISTWIDGETPLUGINS);
+    Q_ASSERT_X((widget != 0), "Launcher", "Invalid launcher.xml file");
+    this->mListPlugins = qobject_cast<HbListWidget *> (widget);
+}
+
+// ---------------------------------------------------------------------------
+
+void PIMainView::showAboutPopup()
+{
+
+    Notifications::showMessageBox("Version 2.2.0.2 - 4th May 2010. \n"
+            "Copyright © 2010 Nokia Corporation "
+            "and/or its subsidiary(-ies). "
+            "All rights reserved.");
+
+}
+// ---------------------------------------------------------------------------
+
+void PIMainView::setPluginList(QList<PluginAttributes> *pluginList)
+{
+
+    this->mPluginList = pluginList;
+    this->updatePlugInLists();
+
+}
+
+// ---------------------------------------------------------------------------
+
+void PIMainView::openSettingsView()
+{
+    mMainWindow->activateSettingsView();
+}
+
+// ---------------------------------------------------------------------------
+
+void PIMainView::updatePlugInLists()
+{
+
+    mListPlugins->clear();
+
+    // Create Compulsory and Optional labels into list widget:
+    HbListWidgetItem *compulsory = new HbListWidgetItem();
+    compulsory->setText(TEXTMANDATORYPLUGINS);
+    mListPlugins->addItem(compulsory);
+
+    HbListWidgetItem *optional = new HbListWidgetItem();
+    optional->setText(TEXTOPTIONALPLUGINS);
+    mListPlugins->addItem(optional);
+
+    HbIcon *icon;
+
+    // Go thru pluginlist and add list item for each plug-in into list widget 
+    for (int index = 0; index < mPluginList->size(); index++) {
+        QString plugInName = mPluginList->at(index).mName;
+
+        // get icon for item 
+        if (mPluginList->at(index).mEnabled) {
+            icon = &mIconEnabled;
+        }
+        else {
+            icon = &mIconDisabled;
+        }
+
+        // Create list widget item
+        // TODO ensure that this does not leak memory
+        HbListWidgetItem *newItem = new HbListWidgetItem();
+        newItem->setIcon(*icon);
+        newItem->setText(plugInName);
+        newItem->setData(mPluginList->at(index).mUid);
+
+        // check if plug-in is compulsory or optional
+        if (mPluginList->at(index).mIsHidden) {
+            mListPlugins->insertItem(mListPlugins->row(optional), newItem);
+        }
+        else {
+            mListPlugins->addItem(newItem);
+
+        }
+    }
+
+}
+// ---------------------------------------------------------------------------
+
+void PIMainView::enableOrDisablePlugin(HbListWidgetItem *widget)
+{
+
+    // if widget is not found, set currently highlighted item as widget
+    // (in that case this method is called from context menu)
+    if (widget == 0) {
+        widget = mListPlugins->currentItem();
+    }
+
+    // if this method is called from list widget's activated signal, do nothing
+    // if context menu is open.
+    else {
+        if (mContextMenu != 0) {
+            return;
+        }
+    }
+    bool ok = false;
+    int widgetUid = widget->data().toInt(&ok);
+    if (!ok) {
+        qWarning("PIProfiler: Unable to find plug-in uid");
+        return;
+    }
+
+    // go thru plug-in array and find checked plug-in
+    for (int index = 0; index < mPluginList->size(); index++) {
+
+        if (mPluginList->at(index).mUid == widgetUid) {
+            PluginAttributes pluginAttributes = mPluginList->at(index);
+
+            // if plug-in is hidden it cannot be disabled
+            if (pluginAttributes.mIsHidden) {
+                return;
+            }
+
+            // change enable status and set icon correct
+            if (pluginAttributes.mEnabled) {
+                pluginAttributes.mEnabled = false;
+                widget->setIcon(mIconDisabled);
+            }
+            else {
+                pluginAttributes.mEnabled = true;
+                widget->setIcon(mIconEnabled);
+            }
+
+            // save plug-in settings
+            if (mEngine->savePluginSettings(pluginAttributes)) {
+                mPluginList->replace(index, pluginAttributes);
+            }
+            else {
+                // if saving operation failed, revert icon back
+                if (pluginAttributes.mEnabled) {
+                    widget->setIcon(mIconEnabled);
+                }
+                else {
+                    pluginAttributes.mEnabled = true;
+                    widget->setIcon(mIconDisabled);
+                }
+                Notifications::showErrorNote(
+                    "Error occured while saving settings to Profiler engine.");
+            }
+            break;
+        }
+
+    }
+
+}
+
+// ---------------------------------------------------------------------------
+
+void PIMainView::showContexMenu(HbListWidgetItem *widget, const QPointF &point)
+{
+
+    bool ok = false;
+    int uid = widget->data().toInt(&ok);
+
+    if (!ok) {
+        return;
+    }
+
+    for (int index = 0; index < mPluginList->size(); index++) {
+
+        if (mPluginList->at(index).mUid == uid) {
+
+            // Create Context menu:
+            mContextMenu = new HbMenu();
+            mContextMenu->setPreferredPos(point, HbPopup::TopLeftCorner);
+            mContextMenu->setDismissPolicy(HbPopup::TapOutside);
+            mContextMenu->setAttribute(Qt::WA_DeleteOnClose);
+
+            // Enable/disable plug-in
+            if (!mPluginList->at(index).mIsHidden) {
+                HbAction *enableAction;
+                if (mPluginList->at(index).mEnabled) {
+                    enableAction = mContextMenu->addAction(QString("Disable"));
+                }
+                else {
+                    enableAction = mContextMenu->addAction(QString("Enable"));
+                }
+                connect(enableAction, SIGNAL(triggered()), this, SLOT( enableOrDisablePlugin() ));
+            }
+
+            //FIXME take these into use once expanding and collapsing data form groups works. 
+            // Plug-in specific settings 
+            /*if (mPluginList->at(index).mItemCount != 0 || mPluginList->at(index).mSampleRate != -1) {
+             HbAction *pluginSettingsAction = mContextMenu->addAction(QString(
+             "Plug-in settings"));
+             connect(pluginSettingsAction, SIGNAL(triggered()), this,
+             SLOT(openPluginSpecificSettings()));
+             }*/
+
+            // Plug in info
+            HbAction *infoAction = mContextMenu->addAction(QString("Plug-in info"));
+            connect(infoAction, SIGNAL(triggered()), this, SLOT( openSampleInfo() ));
+
+            connect(mContextMenu, SIGNAL(aboutToClose()), this, SLOT( contextMenuClosed() ));
+            mContextMenu->open(this, SLOT(contextMenuClosed()));
+            break;
+        }
+    }
+
+}
+
+// ---------------------------------------------------------------------------
+
+void PIMainView::openSampleInfo()
+{
+
+    // Show plug-in specific info
+    bool ok = false;
+    int uid = mListPlugins->currentItem()->data().toInt(&ok);
+    if (!ok) {
+        return;
+    }
+    Notifications::showInformationNote(this->getPluginAttributes(uid).mDescription);
+}
+// ---------------------------------------------------------------------------
+
+PluginAttributes PIMainView::getPluginAttributes(int uid)
+{
+    // Get plug-in attributes from the plug-in list based on uid number
+    for (int index = 0; index < mPluginList->size(); index++) {
+        if (mPluginList->at(index).mUid == uid) {
+            return mPluginList->at(index);
+        }
+    }
+    return PluginAttributes();
+}
+
+// ---------------------------------------------------------------------------
+
+void PIMainView::contextMenuClosed()
+{
+    mContextMenu = 0;
+}
+
+// ---------------------------------------------------------------------------
+
+void PIMainView::startProfiling()
+{
+
+    showProfilingNote();
+    if (!mEngine->startProfiling()) {
+        Notifications::showErrorNote("Unable to start profiling");
+        mProfilingNote->close();
+        mProfilingNote = 0;
+    }
+}
+
+// ---------------------------------------------------------------------------
+void PIMainView::startTimedProfiling()
+{
+    showProfilingNote();
+    if (!mEngine->startTimedProfiling()) {
+        Notifications::showErrorNote("Unable to start profiling");
+        mProfilingNote->close();
+        mProfilingNote = 0;
+    }
+}
+
+// ---------------------------------------------------------------------------
+
+
+void PIMainView::stopProfiling()
+{
+    mProfilingNote = 0;
+    mEngine->stopProfiling();
+}
+
+// ---------------------------------------------------------------------------
+
+void PIMainView::profilingStatusChanged(ProfilerEngineStatus status, const QString &text,
+    ProfilingMode profilingMode, ProfilingOutput outputMode)
+{
+
+    if (status == PI_FINISHED_SUCCEFULLY) {
+        // Profiling finished successfully
+
+        // close profiling note
+        if (mProfilingNote != 0) {
+            mProfilingNote->close();
+            mProfilingNote = 0;
+        }
+
+        // Show info text
+        Notifications::showInformationNote(text);
+        return;
+    }
+
+    if (mProfilingNote == 0) {
+        // if profiling note is not yet shown, create it
+        showProfilingNote();
+    }
+
+    if (status == PI_ERROR) {
+        // if errors occured, close profiling note and show error message
+        if (mProfilingNote != 0) {
+            mProfilingNote->close();
+            mProfilingNote = 0;
+        }
+        Notifications::showErrorNote(text);
+    }
+
+    else if (status == PI_PROFILING) {
+        // if profiling is on-going, update info text according to output:
+
+        HbLabel *titleLabel = new HbLabel("Profiling...", mProfilingNote);
+        titleLabel->setAlignment(Qt::AlignCenter);
+
+        HbTextItem *textItem = new HbTextItem(text, mProfilingNote);
+        textItem->setAlignment(Qt::AlignCenter);
+
+        mProfilingNote->setHeadingWidget(titleLabel);
+        mProfilingNote->setContentWidget(textItem);
+    }
+
+}
+
+// ---------------------------------------------------------------------------
+
+void PIMainView::showProfilingNote()
+{
+    // Create new dialog 
+    mProfilingNote = new HbDialog();
+    mProfilingNote->setAttribute(Qt::WA_DeleteOnClose);
+
+    // Make it modal.
+    mProfilingNote->setModal(true);
+
+    // set dismiss policy
+    mProfilingNote->setDismissPolicy(HbPopup::NoDismiss);
+    mProfilingNote->setTimeout(0); //
+    mProfilingNote->setBackgroundFaded(true);
+
+    // create label and text item for popup
+    HbTextItem *titleLabel = new HbTextItem("Profiling...", mProfilingNote);
+    HbTextItem *label = new HbTextItem("Starting to profile", mProfilingNote);
+
+    label->setAlignment(Qt::AlignCenter);
+    titleLabel->setAlignment(Qt::AlignCenter);
+    mProfilingNote->setHeadingWidget(titleLabel);
+    mProfilingNote->setContentWidget(label);
+
+    // set actions
+    mProfilingNote->setPrimaryAction(mActionStopProfiling);
+    mProfilingNote->setSecondaryAction(mActionExitAndLeaveProfilingOn);
+
+    mProfilingNote->open();
+}
+
+// ---------------------------------------------------------------------------
+
+void PIMainView::updateTimedProfilingText()
+{
+    QString text = "Start timed profiling(";
+    QString number;
+    number.setNum(mEngine->getTimeLimit(), 10);
+    text.append(number);
+    text.append("s)");
+    mActionStartTimedProfiling->setText(text);
+
+}
+
+// ---------------------------------------------------------------------------
+
+void PIMainView::exitAndLeaveProfilingOn()
+{
+    mEngine->leaveProfilingOnAfterClosing();
+    application->quit();
+}
+// ---------------------------------------------------------------------------
+
+void PIMainView::openPluginSpecificSettings()
+{
+    HbListWidgetItem *listItem = mListPlugins->currentItem();
+    bool ok = false;
+    int uid = listItem->data().toInt(&ok);
+    if (ok) {
+        mMainWindow->activateSettingsView(uid);
+    }
+}
+
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/piprofilerui/ui/hb/src/pimainwindow.cpp	Wed Jun 09 09:42:37 2010 +0300
@@ -0,0 +1,160 @@
+/*
+* 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: 
+*
+*/
+
+
+// System include
+#include <QDebug>
+#include <hbaction.h>
+#include <hbdocumentloader.h>
+#include <hbapplication.h>
+#include <hbicon.h>
+#include <hbprogressdialog.h>
+
+// User includes
+#include "pimainwindow.h"
+//#include "mcsendengine.h"
+#include "pimainview.h"
+#include "pisettingsview.h"
+#include "generalattributes.h"
+#include "piprofilerengine.h"
+#include "notifications.h"
+
+// xml definition of view
+const char *PI_MAINVIEW_XML = ":/xml/pimainview.docml";
+
+// name of the application view object in the xml file.
+const char *APPLICATIONVIEW = "PIMainView";
+
+// ViewManager Constructor
+PIMainWindow::PIMainWindow(PIProfilerEngine* engine, HbDocumentLoader &loader, HbApplication *app) :
+    mEngine(engine), mMainView(0), mSettingsView(0), mBackAction(0)
+{
+
+    HbProgressDialog *note = new HbProgressDialog(HbProgressDialog::WaitDialog);
+    note->setAttribute(Qt::WA_DeleteOnClose);
+    note->setText("Loading PI Profiler plug-ins...");
+    note->open();
+
+    // Add the views to the main window
+    addMainView(loader, app);
+    addSettingsView();
+
+    // Set main view to be displayed on startup
+    activateMainView();
+
+    connect(mEngine, SIGNAL(pluginListUpdated(QList<PluginAttributes>&)), this,
+        SLOT(setPluginList(QList<PluginAttributes>&)));
+
+    QMetaObject::connectSlotsByName(this);
+
+    mEngine->notifyUIReady();
+
+    note->close();
+
+}
+
+PIMainWindow::~PIMainWindow()
+{
+    if (mMainView != 0) {
+        delete mMainView;
+        mMainView = 0;
+    }
+    if (mSettingsView != 0) {
+        delete mSettingsView;
+        mSettingsView = 0;
+    }
+
+}
+
+// Methods to add views to the main window
+
+void PIMainWindow::addMainView(HbDocumentLoader &loader, HbApplication *app)
+{
+    // Load xml-file
+    bool ok = false;
+    loader.load(PI_MAINVIEW_XML, &ok);
+
+    // Load Application View:
+    QGraphicsWidget *widget = loader.findWidget(APPLICATIONVIEW);
+    Q_ASSERT_X(ok && (widget != 0), "PIProfiler", "Invalid docml file");
+    mMainView = qobject_cast<PIMainView *> (widget);
+
+    mMainView->init(this, app, loader, mEngine);
+
+    // Add view to main window
+    this->addView(mMainView);
+
+}
+
+void PIMainWindow::addSettingsView()
+{
+    mSettingsView = new PISettingsView(mEngine);
+    mBackAction = new HbAction("back", this);
+
+    bool value = connect(mBackAction, SIGNAL(triggered()), this, SLOT(settingsViewClosed()));
+    mSettingsView->setNavigationAction(mBackAction);
+    mSettingsView->navigationAction()->setIcon(HbIcon(":/gfx/enabled.svg"));
+    addView(mSettingsView);
+}
+
+// Slots to handle view change
+void PIMainWindow::activateMainView()
+{
+    setCurrentView(mMainView);
+}
+
+void PIMainWindow::activateSettingsView(int uid)
+{
+    if (uid != 0) {
+        mSettingsView->expandPluginGroup(uid);
+    }
+    setCurrentView(mSettingsView);
+}
+
+void PIMainWindow::settingsViewClosed()
+{
+    if (currentView() == mSettingsView) {
+        bool error = false;
+        if (!mEngine->saveGeneralSettings(mSettingsView->getGeneralAttributes())) {
+            error = true;
+        }
+
+        mSettingsView->readPluginSettings();
+
+        for (int index = 0; index < mPluginAttributes.size(); index++) {
+            if (!mEngine->savePluginSettings(mPluginAttributes.at(index))) {
+                error = true;
+            }
+        }
+
+        if (error) {
+            Notifications::showErrorNote("Unable to save some of the settings into engine");
+        }
+        activateMainView();
+        emit returnedFromSettings();
+    }
+    else {
+        qWarning("Back action is not triggered at the correct view!");
+    }
+}
+
+void PIMainWindow::setPluginList(QList<PluginAttributes> &pluginList)
+{
+    mPluginAttributes = pluginList;
+    mMainView->setPluginList(&mPluginAttributes);
+    mSettingsView->setPluginSettings(&mPluginAttributes);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/piprofilerui/ui/hb/src/piprofilerengine.cpp	Wed Jun 09 09:42:37 2010 +0300
@@ -0,0 +1,88 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*
+*/
+
+
+#include "piprofilerengine.h"
+#include "piprofilerengineprivate.h"
+
+PIProfilerEngine::PIProfilerEngine()
+{
+
+}
+
+PIProfilerEngine::~PIProfilerEngine()
+{
+    if (mPrivate != 0) {
+        delete mPrivate;
+        mPrivate = 0;
+    }
+}
+
+bool PIProfilerEngine::init()
+{
+    mPrivate = new PIProfilerEnginePrivate(this);
+    return mPrivate->Init();
+}
+
+void PIProfilerEngine::getGeneralSettings(GeneralAttributes &settings)
+{
+    mPrivate->GetGeneralSettings(settings);
+}
+
+void PIProfilerEngine::notifyUIReady()
+{
+    mPrivate->NotifyUIReady();
+}
+
+bool PIProfilerEngine::saveGeneralSettings(GeneralAttributes &settings)
+{
+    return mPrivate->SaveGeneralSettings(settings);
+
+}
+
+bool PIProfilerEngine::savePluginSettings(const PluginAttributes &pluginAttributes)
+{
+    return mPrivate->SavePluginSettings(pluginAttributes);
+}
+
+bool PIProfilerEngine::startProfiling()
+{
+    return mPrivate->StartProfiling();
+}
+bool PIProfilerEngine::startTimedProfiling()
+{
+    return mPrivate->StartTimedProfiling();
+}
+void PIProfilerEngine::stopProfiling()
+{
+    return mPrivate->StopProfiling();
+}
+
+int PIProfilerEngine::getTimeLimit()
+{
+    return mPrivate->GetTimeLimit();
+}
+
+void PIProfilerEngine::leaveProfilingOnAfterClosing()
+{
+    mPrivate->LeaveProfilingOnAfterClosing();
+}
+
+bool PIProfilerEngine::checkTraceLocationSanity(QString &location)
+{
+    mPrivate->CheckTraceLocationSanity(location);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/piprofilerui/ui/hb/src/piprofilerengineprivate.cpp	Wed Jun 09 09:42:37 2010 +0300
@@ -0,0 +1,678 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*
+*/
+
+
+#include <e32std.h>
+#include <qstring.h>
+#include <qlist.h>
+#include <qstringlist.h>
+#include <f32file.h>
+#include <xqconversions.h>
+#include <utf.h>
+#include <bautils.h>
+#include <sysutil.h>
+#include "piprofilerengineprivate.h"
+#include <piprofiler/ProfilerSession.h>
+#include "pluginattributes.h"
+#include "generalattributes.h"
+#include "piprofilerengine.h"
+
+// literals for default general setting values
+_LIT8(KTraceOutput, "file_system");
+_LIT8(KTraceDebugOutput, "debug_output");
+_LIT8(KProfilerDefaultDrive, "E:\\data");
+_LIT8(KProfilerDefaultPrefix, "Profiler_#");
+_LIT(KProfilerEngineExe, "PIProfilerEngine.exe");
+const TInt KProfilerDefaultTimedSamplingPeriod = 60; // Sampling time in seconds  
+
+// ---------------------------------------------------------------------------
+
+PIProfilerEnginePrivate::PIProfilerEnginePrivate(PIProfilerEngine *aEngine) :
+    iPublic(aEngine), iSamplerAttributes(0), iStatusChecker(0), iLeaveProfilingOnAfterClosing(
+        EFalse)
+{
+
+}
+
+// ---------------------------------------------------------------------------
+
+PIProfilerEnginePrivate::~PIProfilerEnginePrivate()
+{
+
+    // remove profiler client
+    RProfiler::RemoveClient();
+    // Terminate engine in case it is running.
+    if (iLeaveProfilingOnAfterClosing == EFalse) {
+        terminateEngine();
+    }
+
+    // delete sampler attributes.
+    if (iSamplerAttributes) {
+        delete iSamplerAttributes;
+        iSamplerAttributes = 0;
+    }
+
+    if (iStatusChecker) {
+        iStatusChecker->Cancel();
+        delete iStatusChecker;
+        iStatusChecker = NULL;
+    }
+}
+
+// ---------------------------------------------------------------------------
+
+bool PIProfilerEnginePrivate::Init()
+{
+    TRAPD(error, this->LaunchEngineL());
+    if (error != KErrNone) {
+        return false;
+    }
+
+    // initialize attribute arrays
+
+    TRAP(error, iSamplerAttributes = new (ELeave) CArrayFixFlat<TSamplerAttributes> (20)); // max sampler count is 20
+    if (error != KErrNone) {
+        return false;
+    }
+
+    // engine status checker
+    TRAP(error, iStatusChecker = CProfilerEngineStatusChecker::NewL());
+    if (error != KErrNone) {
+        return false;
+    }    
+
+    iStatusChecker->SetObserver(this);
+
+    TRAP(error, LoadGeneralSettingsL());
+    if (error != KErrNone) {
+        return false;
+    }
+
+    return true;
+}
+
+// ---------------------------------------------------------------------------
+
+
+int PIProfilerEnginePrivate::LaunchEngineL()
+{
+
+    TRequestStatus stat = KRequestPending;
+    RProcess proc;
+
+    TInt err(KErrNone);
+
+    // check if process exists
+    err = FindProcessL(proc);
+
+    // check if already exists and don't start a new eshell profiling
+    if (err == KErrNotFound) {
+        // try create new process
+        err = proc.Create(KProfilerEngineExe, _L(""));
+
+        // check if RProcess::Create() succeeded
+        if (err == KErrNone) {
+            // Trigger rendezvous on the supplied TRequestStatus object
+            proc.Rendezvous(stat);
+
+            // kick off the engine process
+            proc.Resume();
+
+            // wait for the constructor to complete 
+            User::WaitForRequest(stat);
+
+            // just lose the handle
+            proc.Close();
+        }
+    }
+
+    // Increase the client reference count in server:
+    AttachClient();
+}
+
+// ---------------------------------------------------------------------------
+
+void PIProfilerEnginePrivate::AttachClient()
+{
+    RProfiler::AttachClient();
+}
+// ---------------------------------------------------------------------------
+
+int PIProfilerEnginePrivate::FindProcessL(RProcess& aProc)
+{
+    TProcessId engId;
+    TFindProcess procName;
+    procName.Find(_L("PIProfilerEngine.exe*"));
+    TFullName aResult;
+    TFullName aResult2;
+    TInt err(KErrNone);
+
+    // find the first appearance
+    err = procName.Next(aResult);
+    if (err != KErrNone) {
+        // did not find any engine process
+        return err;
+    }
+    else {
+        err = aProc.Open(procName);
+        if (err == KErrNone) {
+            if (aProc.ExitCategory().Length() > 0) {
+                aProc.Close();
+                // process already exited => create a new one
+                return KErrNotFound;
+            }
+            aProc.Close();
+        }
+    }
+
+    // check now if a second appearance exists in process list, 
+    // i.e. engine started from eshell => two engine processes appear in normal case
+    procName.Next(aResult2);
+
+    // check if aResult2 contained the second appearance of profiler engine
+    if(aResult2.CompareF(aResult) > 0)
+        {
+        // other process found, i.e. right process to communicate with, in case started from eshell
+        err = aProc.Open(procName);
+        if(err == KErrNone)
+            {
+            if(aProc.ExitCategory().Length() > 0)
+                {
+                // process already exited => create a new one
+                return KErrNotFound;
+                }
+            aProc.Close();
+            }
+        }
+
+    return err;
+}
+
+// ---------------------------------------------------------------------------
+
+void PIProfilerEnginePrivate::terminateEngine()
+{
+    // exit profiler engine 
+    RProfiler::ExitProfiler();
+}
+// ---------------------------------------------------------------------------
+
+void PIProfilerEnginePrivate::NotifyUIReady()
+{
+    // load initial plugins
+    loadPlugins();
+
+    // get the initial state
+    int initialState = iStatusChecker->GetInitialState();
+    if (initialState == ERunning) {
+        HandleProfilerStatusChange(ERunning);
+    }
+}
+
+// ---------------------------------------------------------------------------
+
+
+void PIProfilerEnginePrivate::loadPlugins()
+{
+    // get samplers from Profiler Engine (client-server session) 
+    // and add the to the samplers list for the first time
+    LOGTEXT(_L("CProfilerGuiModel::LoadPlugins - get sampler plugins"));
+
+    TInt err = RProfiler::GetSamplerAttributes(*iSamplerAttributes);
+
+    // check if engine provided a list of samplers
+    if (err != KErrNone) {
+        // could not get samplers from engine
+        LOGTEXT(_L("CProfilerGuiModel::LoadPlugins - failed to connect engine"));
+    }
+    else {
+        LOGTEXT(_L("CProfilerGuiModel::LoadPlugins - adding new samplers into view"));
+        addNewSamplers(*iSamplerAttributes);
+    }LOGTEXT(_L("CProfilerGuiModel::LoadPlugins - exit"));
+}
+// ---------------------------------------------------------------------------
+
+void PIProfilerEnginePrivate::addNewSamplers(CArrayFixFlat<TSamplerAttributes>& aAttributes)
+{
+    TSamplerAttributes item;
+
+    TInt count(aAttributes.Count());
+
+    // loop the attribute array and insert them into view list
+
+    QList<PluginAttributes> samplerList;
+
+    for (TInt i(0); i < count; i++) {
+        // get a TSamplerAttributes from list at a time  
+        item = aAttributes.At(i);
+
+        PluginAttributes samplerAttributes;
+        convertTSamplerAttributesToPluginAttributes(item, samplerAttributes);
+
+        samplerList.append(samplerAttributes);
+    }
+
+    emit iPublic->pluginListUpdated(samplerList);
+
+}
+
+// ---------------------------------------------------------------------------
+
+void PIProfilerEnginePrivate::convertTSamplerAttributesToPluginAttributes(
+    TSamplerAttributes &tSamplerAttributes, PluginAttributes &samplerAttributes)
+{
+
+    samplerAttributes.mUid = tSamplerAttributes.iUid;
+    samplerAttributes.mSampleRate = tSamplerAttributes.iSampleRate;
+    samplerAttributes.mEnabled = tSamplerAttributes.iEnabled;
+    samplerAttributes.mIsHidden = tSamplerAttributes.iIsHidden;
+    samplerAttributes.mItemCount = tSamplerAttributes.iItemCount;
+
+    TBuf16<8> temp8;
+    temp8.Copy(tSamplerAttributes.iShortName);
+    samplerAttributes.mShortName = QString((QChar*) temp8.Ptr(), temp8.Length());
+
+    TBuf16<64> temp64;
+    temp64.Copy(tSamplerAttributes.iName);
+    samplerAttributes.mName = QString((QChar*) temp64.Ptr(), temp64.Length());
+
+    TBuf16<256> temp256;
+    temp256.Copy(tSamplerAttributes.iDescription);
+    samplerAttributes.mDescription = QString((QChar*) temp256.Ptr(), temp256.Length());
+
+    convertTSettingItemToSettingItem(tSamplerAttributes.iSettingItem1,
+        samplerAttributes.mSettingItem1);
+    convertTSettingItemToSettingItem(tSamplerAttributes.iSettingItem2,
+        samplerAttributes.mSettingItem2);
+    convertTSettingItemToSettingItem(tSamplerAttributes.iSettingItem3,
+        samplerAttributes.mSettingItem3);
+    convertTSettingItemToSettingItem(tSamplerAttributes.iSettingItem4,
+        samplerAttributes.mSettingItem4);
+    convertTSettingItemToSettingItem(tSamplerAttributes.iSettingItem5,
+        samplerAttributes.mSettingItem5);
+    convertTSettingItemToSettingItem(tSamplerAttributes.iSettingItem6,
+        samplerAttributes.mSettingItem6);
+}
+
+// ---------------------------------------------------------------------------
+
+bool PIProfilerEnginePrivate::SavePluginSettings(const PluginAttributes &samplerAttributes)
+{
+    for (int index = 0; index < iSamplerAttributes->Count(); index++) {
+        if (samplerAttributes.mUid == this->iSamplerAttributes->At(index).iUid) {
+            iSamplerAttributes->At(index).iEnabled = samplerAttributes.mEnabled;
+            iSamplerAttributes->At(index).iSampleRate = samplerAttributes.mSampleRate;
+
+            convertSettingItemToTSettingItem(this->iSamplerAttributes->At(index).iSettingItem1,
+                samplerAttributes.mSettingItem1);
+            convertSettingItemToTSettingItem(this->iSamplerAttributes->At(index).iSettingItem2,
+                samplerAttributes.mSettingItem2);
+            convertSettingItemToTSettingItem(this->iSamplerAttributes->At(index).iSettingItem3,
+                samplerAttributes.mSettingItem3);
+            convertSettingItemToTSettingItem(this->iSamplerAttributes->At(index).iSettingItem4,
+                samplerAttributes.mSettingItem4);
+            convertSettingItemToTSettingItem(this->iSamplerAttributes->At(index).iSettingItem5,
+                samplerAttributes.mSettingItem5);
+            convertSettingItemToTSettingItem(this->iSamplerAttributes->At(index).iSettingItem6,
+                samplerAttributes.mSettingItem6);
+
+            TSamplerAttributes attr = iSamplerAttributes->At(index);
+
+            if (RProfiler::SetSamplerAttributes(this->iSamplerAttributes->At(index)) == KErrNone) {
+                return true;
+            }
+            else {
+                return false;
+            }
+        }
+    }
+    return false;
+
+}
+
+// ---------------------------------------------------------------------------
+
+void PIProfilerEnginePrivate::StartAllSamplerItemsL(TProfilingMode aProfilingMode)
+{
+    TBuf<256> activeWriterDes;
+    TBuf8<256> writer8;
+
+    //iState = MProfilerStatusObserver::EInitializing;
+
+    RProfiler::TProfilingMode profilingMode = aProfilingMode == EProfilingModeTimed
+        ? RProfiler::EProfilingModeTimed : RProfiler::EProfilingModeNormal;
+
+    // try to start profiling process through client-server interface
+    if (RProfiler::StartSampling(profilingMode) == KErrNotFound) {
+        // profiler stopped (e.g. from eshell) and must be restarted 
+        LaunchEngineL();
+        // try to launch sampling again
+        RProfiler::StartSampling(profilingMode);
+    }
+}
+
+// ---------------------------------------------------------------------------
+// --------------------------------------------------------------------------------------------
+
+void PIProfilerEnginePrivate::StopProfiling()
+{
+    // Stop profiling process through CS session
+    RProfiler::StopSampling();
+
+}
+
+// --------------------------------------------------------------------------------------------
+
+void PIProfilerEnginePrivate::HandleProfilerStatusChange(KProfilerStatus aStatus)
+{
+    if (aStatus == EIdle || aStatus == ERunning) {
+
+        if (iGeneralAttributes.iTraceOutput == KTraceOutput) {
+
+            TBuf<256> buf;
+            // get profiler file name 
+            TBool valu = RProfiler::GetFileName(buf);
+
+            QString filename = QString((QChar*) buf.Ptr(), buf.Length());
+
+            // Let ui know that status has changed
+
+            if (aStatus == EIdle) {
+                QString text = QString("Wrote trace data to: \n");
+                text.append(filename);
+                emit iPublic->profilingStatusChanged(PI_FINISHED_SUCCEFULLY, text,
+                    PI_PROFILINGMODENORMAL, PI_FILE_OUTPUT);
+            }
+            else if (aStatus == ERunning) {
+                QString text = QString("Writing trace data to: \n");
+                text.append(filename);
+                emit iPublic->profilingStatusChanged(PI_PROFILING, text, PI_PROFILINGMODENORMAL,
+                    PI_FILE_OUTPUT);
+            }
+        }
+        else {
+            // Let ui know that status has changed
+            if (aStatus == EIdle) {
+                emit iPublic->profilingStatusChanged(PI_FINISHED_SUCCEFULLY, QString(
+                    "Wrote trace data to debug output"), PI_PROFILINGMODENORMAL, PI_DEBUG_OUTPUT);
+            }
+            else if (aStatus == ERunning) {
+                emit iPublic->profilingStatusChanged(PI_PROFILING, QString(
+                    "Writing trace data to debug output"), PI_PROFILINGMODENORMAL, PI_DEBUG_OUTPUT);
+            }
+        }
+    }
+
+}
+
+// ---------------------------------------------------------------------------
+
+void PIProfilerEnginePrivate::HandleProfilerErrorL(TInt aError)
+{
+    {
+        QString errorMsg = QString("Error: ");
+        QString KNoMemory = QString("Cannot write to file, check settings");
+
+        // message from pwr sampler
+        if (aError < -1000) {
+            errorMsg.append(QString("Stop other power measurement tools!"));
+        }
+        else if (aError == KErrAlreadyExists || aError == 11) {
+            errorMsg.append(QString("Close old Profiler before start!"));
+        }
+        else if (aError == KErrNotReady) {
+            errorMsg.append(QString("Memory card removed, failed to write!"));
+        }
+        else if (aError == KErrPathNotFound) {
+            errorMsg.append(QString("Given trace data location does not exist"));
+        }
+        else {
+            if (aError == KErrNoMemory || aError == KErrOverflow || aError == KErrDirFull || aError
+                == KErrDiskFull || aError == KErrNotReady) {
+                errorMsg.append(KNoMemory);
+            }
+            else {
+                errorMsg.append(QString("code: "));
+                errorMsg.append(aError);
+            }
+        }
+
+        emit iPublic->profilingStatusChanged(PI_ERROR, errorMsg);
+    }
+
+}
+// ---------------------------------------------------------------------------
+
+bool PIProfilerEnginePrivate::StartProfiling()
+{
+    TRAPD(error, this->StartAllSamplerItemsL(PIProfilerEnginePrivate::EProfilingModeNormal));
+    if (error == KErrNone) {
+        return true;
+    }
+    return false;
+
+}
+
+// ---------------------------------------------------------------------------
+
+bool PIProfilerEnginePrivate::StartTimedProfiling()
+{
+    TRAPD(error, this->StartAllSamplerItemsL(PIProfilerEnginePrivate::EProfilingModeTimed));
+    if (error == KErrNone) {
+        return true;
+    }
+    return false;
+}
+
+// ---------------------------------------------------------------------------
+
+void PIProfilerEnginePrivate::convertTGeneralAttributesToGeneralAttributes(
+    TGeneralAttributes &tSamplerAttributes, GeneralAttributes &samplerAttributes)
+{
+    samplerAttributes.mTimedSamplingPeriod = tSamplerAttributes.iTimedSamplingPeriod;
+    int test = tSamplerAttributes.iSaveFileDrive.Length();
+    TBuf16<KPrefixMaxLength> test2;
+    test2.Copy(tSamplerAttributes.iSaveFileDrive);
+    samplerAttributes.mSaveFileDrive = QString((QChar*) test2.Ptr(), test2.Length());
+    test2.Copy(tSamplerAttributes.iTraceFilePrefix);
+    samplerAttributes.mTraceFilePrefix = QString((QChar*) test2.Ptr(), test2.Length());
+    test2.Copy(tSamplerAttributes.iTraceOutput);
+    samplerAttributes.mTraceOutput = QString((QChar*) test2.Ptr(), test2.Length());
+}
+// ---------------------------------------------------------------------------
+
+void PIProfilerEnginePrivate::convertGeneralAttributesToTGeneralAttributes(
+    TGeneralAttributes &tSamplerAttributes, GeneralAttributes &samplerAttributes)
+{
+    tSamplerAttributes.iTimedSamplingPeriod = samplerAttributes.mTimedSamplingPeriod;
+
+    tSamplerAttributes.iTraceOutput.Copy(TBuf<KPrefixMaxLength> (
+        samplerAttributes.mTraceOutput.utf16()));
+    tSamplerAttributes.iSaveFileDrive.Copy(TBuf<KPrefixMaxLength> (
+        samplerAttributes.mSaveFileDrive.utf16()));
+    tSamplerAttributes.iTraceFilePrefix.Copy(TBuf<KPrefixMaxLength> (
+        samplerAttributes.mTraceFilePrefix.utf16()));
+
+}
+// ---------------------------------------------------------------------------
+
+TInt PIProfilerEnginePrivate::LoadGeneralSettingsL()
+{
+    // local variable for getting saved settings from profiler engine
+    TGeneralAttributes generalAttr;
+    TInt err(KErrNone);
+
+    // before loading saved settings (from settings file) set the default values 
+    iGeneralAttributes.iTraceOutput.Copy(KTraceOutput);
+    iGeneralAttributes.iTraceFilePrefix.Copy(KProfilerDefaultPrefix);
+    iGeneralAttributes.iSaveFileDrive.Copy(KProfilerDefaultDrive);
+    iGeneralAttributes.iTimedSamplingPeriod = KProfilerDefaultTimedSamplingPeriod;
+
+    // request to 
+    err = RProfiler::GetGeneralAttributes(generalAttr);
+
+    // check that request succesfull
+    if (err != KErrNone) {
+        // could not connect profiler engine, use 
+        return err;
+    }
+
+    // check if saved settings different than the default
+    if (generalAttr.iTraceOutput.MatchF(iGeneralAttributes.iTraceOutput) == KErrNotFound) {
+        iGeneralAttributes.iTraceOutput.Copy(generalAttr.iTraceOutput);
+    }
+
+    if (generalAttr.iTraceFilePrefix.MatchF(iGeneralAttributes.iTraceFilePrefix) == KErrNotFound) {
+        iGeneralAttributes.iTraceFilePrefix.Copy(generalAttr.iTraceFilePrefix);
+    }
+
+    if (generalAttr.iSaveFileDrive.MatchF(iGeneralAttributes.iSaveFileDrive) == KErrNotFound) {
+        iGeneralAttributes.iSaveFileDrive.Copy(generalAttr.iSaveFileDrive);
+    }
+
+    if (generalAttr.iTimedSamplingPeriod > 0) {
+        iGeneralAttributes.iTimedSamplingPeriod = generalAttr.iTimedSamplingPeriod;
+    }
+
+    return err;
+}
+
+// ---------------------------------------------------------------------------
+
+void PIProfilerEnginePrivate::GetGeneralSettings(GeneralAttributes &settings)
+{
+    convertTGeneralAttributesToGeneralAttributes(iGeneralAttributes, settings);
+}
+// ---------------------------------------------------------------------------
+
+bool PIProfilerEnginePrivate::SaveGeneralSettings(GeneralAttributes &settings)
+{
+    convertGeneralAttributesToTGeneralAttributes(iGeneralAttributes, settings);
+    TRAPD(error, SaveGeneralSettingsL());
+    if (error != KErrNone) {
+        return false;
+    }
+    return true;
+}
+
+// ---------------------------------------------------------------------------
+
+// --------------------------------------------------------------------------------------------
+
+void PIProfilerEnginePrivate::SaveGeneralSettingsL()
+{
+    TInt err(KErrNone);
+
+    // save general attributes to Profiler Engine
+    err = RProfiler::SetGeneralAttributes(iGeneralAttributes);
+
+    // check if save failed
+    if (err == KErrNotFound) {
+        // profiler stopped (e.g. from eshell) and must be restarted 
+        LaunchEngineL();
+
+        err = RProfiler::SetGeneralAttributes(iGeneralAttributes);
+        if (err != KErrNone) {
+            // leave no use to continue
+            User::Leave(err);
+        }
+    }
+}
+// --------------------------------------------------------------------------------------------
+
+int PIProfilerEnginePrivate::GetTimeLimit()
+{
+    return iGeneralAttributes.iTimedSamplingPeriod;
+}
+
+// --------------------------------------------------------------------------------------------
+
+void PIProfilerEnginePrivate::convertTSettingItemToSettingItem(TSettingItem &tSettingItem,
+    SettingItem &settingItem)
+{
+
+    settingItem.mType = tSettingItem.iType;
+    settingItem.mSettingDescription = QString((QChar*) tSettingItem.iSettingDescription.Ptr(),
+        tSettingItem.iSettingDescription.Length());
+    settingItem.mSettingText = QString((QChar*) tSettingItem.iSettingText.Ptr(),
+        tSettingItem.iSettingText.Length());
+    settingItem.mUIText = QString((QChar*) tSettingItem.iUIText.Ptr(),
+        tSettingItem.iUIText.Length());
+    settingItem.mValue = QString((QChar*) tSettingItem.iValue.Ptr(), tSettingItem.iValue.Length());
+
+}
+// --------------------------------------------------------------------------------------------
+
+void PIProfilerEnginePrivate::convertSettingItemToTSettingItem(TSettingItem &tSettingItem,
+    const SettingItem &settingItem)
+{
+    tSettingItem.iType = settingItem.mType;
+    tSettingItem.iSettingDescription.Copy(TBuf<256> (settingItem.mSettingDescription.utf16()));
+    tSettingItem.iSettingText.Copy(TBuf<64> (settingItem.mSettingText.utf16()));
+    tSettingItem.iUIText.Copy(TBuf<64> (settingItem.mUIText.utf16()));
+    tSettingItem.iValue.Copy(TBuf<128> (settingItem.mValue.utf16()));
+
+}
+
+// --------------------------------------------------------------------------------------------
+
+void PIProfilerEnginePrivate::LeaveProfilingOnAfterClosing()
+{
+    iLeaveProfilingOnAfterClosing = ETrue;
+}
+
+// --------------------------------------------------------------------------------------------
+
+bool PIProfilerEnginePrivate::CheckTraceLocationSanity(QString& location)
+{
+    TBool value = EFalse;
+
+    TBuf8<KPrefixMaxLength> fileLocation;
+    fileLocation.Copy(TBuf<KPrefixMaxLength> (location.utf16()));
+    TRAPD(error, value = CheckTraceLocationSanityL(fileLocation));
+    if (error != KErrNone) {
+        return false;
+    }
+    return value;
+}
+
+// --------------------------------------------------------------------------------------------
+
+TBool PIProfilerEnginePrivate::CheckTraceLocationSanityL(TBuf8<KPrefixMaxLength> &aAttr)
+{
+    RFs fs;
+    User::LeaveIfError(fs.Connect());
+
+    TBuf<32> drive;
+
+    CnvUtfConverter::ConvertToUnicodeFromUtf8(drive, aAttr);
+
+    TDriveUnit driveUnit = TDriveUnit(drive);
+
+    TBool ret(EFalse);
+
+    // check that the root folder is correct
+    if (drive.Length() > 2 && BaflUtils::CheckFolder(fs, drive.Left(3)) == KErrNone) {
+        // check then if drive has still some space
+        if (!SysUtil::DiskSpaceBelowCriticalLevelL(&fs, 0, driveUnit)) {
+            ret = ETrue;
+        }
+    }
+
+    fs.Close();
+    return ret;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/piprofilerui/ui/hb/src/pisettingsview.cpp	Wed Jun 09 09:42:37 2010 +0300
@@ -0,0 +1,434 @@
+/*
+ * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description: 
+ *
+ */
+
+#include <hbmainwindow>
+#include <hbdataform>
+#include <hbdataformmodel>
+#include <hbdataformmodelitem>
+#include <hbdataformviewitem>
+#include <qgraphicslinearlayout>
+#include <qvalidator>
+#include <qintvalidator>
+#include <qmodelindex>
+#include <hblineedit>
+#include <hbvalidator>
+#include <hbeditorinterface>
+#include <hbabstractitemview.h>
+
+#include "pisettingsview.h"
+#include "pimainview.h"
+#include "notifications.h"
+#include "piprofilerengine.h"
+#include "pluginattributes.h"
+
+const QStringList OUTPUTMODES = (QStringList() << "Debug output" << "File system");
+
+PISettingsView::PISettingsView(PIProfilerEngine *engine) :
+    mEngine(engine), mGeneralAttributes(), mPluginList(0), mSettingForm(0), mModel(0),
+        mGeneralSettingsGroup(0), mPluginSettingsGroup(0), mOutputItem(0), mFileLocation(0),
+        mPrefix(0), mSamplingPeriod(0)
+
+{
+    this->setTitle("Settings");
+
+    //create setting form
+    mSettingForm = new HbDataForm(this);
+
+    //create a model class
+    mModel = new HbDataFormModel(this);
+
+    this->createGeneralSettingForms();
+
+    // Set created model model to form
+    mSettingForm->setModel(mModel);
+
+    // Set widget into view
+    setWidget(mSettingForm);
+
+    // load general settings into data form
+    loadGeneralSettings();
+
+    // Let us know when list is shown
+    connect(mSettingForm, SIGNAL(itemShown(const QModelIndex)), this,
+        SLOT(addTextValidators(const QModelIndex)));
+
+    // Set general group as expanded. 
+    /*HbDataFormViewItem *viewItem = mSettingForm->dataFormViewItem(mModel->indexFromItem( 
+        mGeneralSettingsGroup));
+    viewItem->setExpanded(true);*/
+
+}
+
+// ---------------------------------------------------------------------------
+
+PISettingsView::~PISettingsView()
+{
+    if (mSettingForm != 0) {
+        delete mSettingForm;
+        mSettingForm = 0;
+    }
+
+    if (mModel != 0) {
+        delete mModel;
+        mModel = 0;
+    }
+}
+
+// ---------------------------------------------------------------------------
+
+void PISettingsView::addTextValidators(const QModelIndex index)
+{
+    HbDataFormModelItem *modelItem = mModel->itemFromIndex(index);
+
+    // Check if item is integer text box
+    if (modelItem->contentWidgetData(QString("TextboxType")) == QString("integer")) {
+
+        QString value = modelItem->contentWidgetData(QString("text")).toString();
+        // Create validator that accepts only integer values.
+        HbValidator *validator = new HbValidator(this);
+        validator->addField(new QIntValidator(0, 10000, validator), "1");
+
+        // Line editor widget from form
+        HbDataFormViewItem *viewItem = qobject_cast<HbDataFormViewItem *> (mSettingForm->itemByIndex(index));
+        HbWidget *widget = viewItem->dataItemContentWidget();
+        HbLineEdit *editor = static_cast<HbLineEdit *> (widget);
+
+        if (editor != 0) {
+            // Create interface and attach lineEdit to it.
+            HbEditorInterface editInterface(editor);
+            // set editor as phone number editor so that inserting numbers is easier
+            editor->setInputMethodHints(Qt::ImhDigitsOnly);
+            editor->setValidator(validator);
+        }
+        modelItem->setContentWidgetData(QString("text"), value);
+
+    }
+
+}
+
+// ---------------------------------------------------------------------------
+
+void PISettingsView::createGeneralSettingForms()
+{
+
+    // Add data into setting model
+
+    // General settings group
+    mGeneralSettingsGroup = mModel->appendDataFormGroup(QString("General settings"),
+        mModel->invisibleRootItem());
+
+    // Output drop down list
+    mOutputItem = mModel->appendDataFormItem(HbDataFormModelItem::ComboBoxItem,
+        QString("Output to"), mGeneralSettingsGroup);
+    mOutputItem->setContentWidgetData(QString("items"), OUTPUTMODES);
+
+    // Data file location textbox
+    mFileLocation = mModel->appendDataFormItem(HbDataFormModelItem::TextItem, QString(
+        "Save file in"), mGeneralSettingsGroup);
+    mFileLocation->setContentWidgetData("maxLength", 64);
+
+    // File name textbox
+    mPrefix = mModel->appendDataFormItem(HbDataFormModelItem::TextItem, QString("File prefix"),
+        mGeneralSettingsGroup);
+    mPrefix->setContentWidgetData("maxLength", 64);
+
+    // Period that used when using timed progfiling
+    mSamplingPeriod = mModel->appendDataFormItem(HbDataFormModelItem::TextItem, QString(
+        "Sampling period(s)"), mGeneralSettingsGroup);
+    mSamplingPeriod->setContentWidgetData(QString("TextboxType"), QString("integer"));
+    mSamplingPeriod->setContentWidgetData("maxLength", 64);
+
+}
+
+// ---------------------------------------------------------------------------
+
+void PISettingsView::createPluginSpecificSettings()
+{
+
+    // Create plug-in specific group
+    mPluginSettingsGroup = mModel->appendDataFormGroup(QString("Plug-in specific settings"),
+        mModel->invisibleRootItem());
+
+    if (mPluginList != 0) {
+
+        for (int index = 0; index < mPluginList->size(); index++) {
+
+            // create plug-in specific settings group for each plug-in which has own settings
+            if (mPluginList->at(index).mItemCount > 0 || mPluginList->at(index).mSampleRate != -1) {
+
+                // Create settings group
+                HbDataFormModelItem *mPluginGroup = mModel->appendDataFormGroup(QString(
+                    mPluginList->at(index).mName), mPluginSettingsGroup);
+
+          
+                // get plugin attributes
+                PluginAttributes attributes = mPluginList->at(index);
+
+                // Create sample rate item if it is needed
+                if (attributes.mSampleRate != -1) {
+                    attributes.mFormItemSampleRate = mModel->appendDataFormItem(
+                        HbDataFormModelItem::TextItem, "Sample rate (ms)", mPluginGroup);
+                    attributes.mFormItemSampleRate->setContentWidgetData(QString("TextboxType"), QString(
+                        "integer"));
+
+                    attributes.mFormItemSampleRate->setContentWidgetData("text",
+                        attributes.mSampleRate);
+                }
+
+                // create other setting items
+                attributes.mFormItemSettingItem1 = createPluginSettingItem(
+                    &attributes.mSettingItem1, mPluginGroup);
+                attributes.mFormItemSettingItem2 = createPluginSettingItem(
+                    &attributes.mSettingItem2, mPluginGroup);
+                attributes.mFormItemSettingItem3 = createPluginSettingItem(
+                    &attributes.mSettingItem3, mPluginGroup);
+                attributes.mFormItemSettingItem4 = createPluginSettingItem(
+                    &attributes.mSettingItem4, mPluginGroup);
+                attributes.mFormItemSettingItem5 = createPluginSettingItem(
+                    &attributes.mSettingItem5, mPluginGroup);
+                attributes.mFormItemSettingItem6 = createPluginSettingItem(
+                    &attributes.mSettingItem6, mPluginGroup);
+                mPluginList->replace(index, attributes);
+            }
+        }
+    }
+
+}
+
+// ---------------------------------------------------------------------------
+
+HbDataFormModelItem *PISettingsView::createPluginSettingItem(const SettingItem *item,
+    HbDataFormModelItem *parentGroup)
+{
+    // create individual plug-in setting item
+
+    HbDataFormModelItem *settingItem = 0;
+    if (item->mSettingText != QString("")) {
+        switch (item->mType) {
+        case SettingItem::SettingItemTypeBool:
+            settingItem = mModel->appendDataFormItem(HbDataFormModelItem::CheckBoxItem,
+                item->mUIText, parentGroup);
+            bool value = false;
+            if (item->mValue == "true") {
+                value = true;
+            }
+            settingItem->setContentWidgetData("tristate", value);
+
+            break;
+        case SettingItem::SettingItemTypeHex:
+            settingItem = mModel->appendDataFormItem(HbDataFormModelItem::TextItem, item->mUIText,
+                parentGroup);
+            settingItem->setContentWidgetData("text", item->mValue);
+            settingItem->setContentWidgetData("maxLength", 64);
+
+            break;
+
+        case SettingItem::SettingItemTypeInt:
+            settingItem = mModel->appendDataFormItem(HbDataFormModelItem::TextItem, item->mUIText,
+                parentGroup);
+            settingItem->setContentWidgetData("text", item->mValue);
+            settingItem->setContentWidgetData(QString("TextboxType"), QString("integer"));
+            settingItem->setContentWidgetData("maxLength", 64);
+
+            break;
+
+        case SettingItem::SettingItemTypeText:
+            HbDataFormModelItem *settingItem = mModel->appendDataFormItem(
+                HbDataFormModelItem::TextItem, item->mUIText, parentGroup);
+            settingItem->setContentWidgetData("text", item->mValue);
+            settingItem->setContentWidgetData("maxLength", 64);
+
+            break;
+
+        }
+    }
+    return settingItem;
+
+}
+
+// ---------------------------------------------------------------------------
+
+void PISettingsView::loadGeneralSettings()
+{
+    // load general settings from engine
+    mEngine->getGeneralSettings(mGeneralAttributes);
+
+    // set output item correct
+    if (mGeneralAttributes.mTraceOutput == "file_system") {
+        mOutputItem->setContentWidgetData(QString("currentIndex"), OUTPUT_MODE_FILE);
+    }
+    else {
+        mOutputItem->setContentWidgetData(QString("currentIndex"), OUTPUT_MODE_DEBUG);
+    }
+
+    mFileLocation->setContentWidgetData(QString("text"), mGeneralAttributes.mSaveFileDrive);
+    mPrefix->setContentWidgetData(QString("text"), mGeneralAttributes.mTraceFilePrefix);
+    mSamplingPeriod->setContentWidgetData(QString("text"), mGeneralAttributes.mTimedSamplingPeriod);
+
+}
+
+// ---------------------------------------------------------------------------
+
+GeneralAttributes &PISettingsView::getGeneralAttributes()
+{
+    // Read items from ui elements and save them into mGeneralAttributes
+
+
+    QString fileLocation = mFileLocation->contentWidgetData(QString("text")).toString();
+    if (fileLocation.length() > 0 && mEngine->checkTraceLocationSanity(fileLocation)) {
+        mGeneralAttributes.mSaveFileDrive = fileLocation;
+    }
+    else {
+        Notifications::showErrorNote("Invalid path, check settings!");
+        mFileLocation->setContentWidgetData(QString("text"), mGeneralAttributes.mSaveFileDrive);
+    }
+    bool ok = false;
+    mGeneralAttributes.mTimedSamplingPeriod
+        = mSamplingPeriod->contentWidgetData(QString("text")).toInt(&ok);
+
+    if (!ok) {
+        // this should not happen because intvalidator is set into text box
+        qWarning("Unable to convert sampling period to integer");
+
+    }
+    mGeneralAttributes.mTraceFilePrefix = mPrefix->contentWidgetData(QString("text")).toString();
+
+    if (mOutputItem->contentWidgetData(QString("currentIndex")).toInt(&ok) == OUTPUT_MODE_FILE) {
+        mGeneralAttributes.mTraceOutput = QString("file_system");
+    }
+    else {
+        mGeneralAttributes.mTraceOutput = QString("debug_output");
+    }
+
+    return mGeneralAttributes;
+
+}
+
+// ---------------------------------------------------------------------------
+
+void PISettingsView::setPluginSettings(QList<PluginAttributes> *pluginList)
+{
+    mPluginList = pluginList;
+    createPluginSpecificSettings();
+}
+
+// ---------------------------------------------------------------------------
+
+
+void PISettingsView::readPluginSettingItemValue(HbDataFormModelItem *dataFormItem,
+    SettingItem *settingItem)
+{
+    if (settingItem != 0 && dataFormItem != 0) {
+        // check if item type is bool, convert bool to string
+        if (settingItem->mType == SettingItem::SettingItemTypeBool) {
+            bool checkboxValue = true;
+            checkboxValue = dataFormItem->contentWidgetData(QString("tristate")).toBool();
+            
+            if(checkboxValue){
+                settingItem->mValue = QString("true");
+            }
+            else{
+                settingItem->mValue = QString("false");
+            }
+
+        }
+        // otherwise save text straight into settin item
+        else {
+            settingItem->mValue = dataFormItem->contentWidgetData("text").toString();
+        }
+    }
+}
+
+// ---------------------------------------------------------------------------
+
+void PISettingsView::readPluginSettings()
+{
+    // Read Plug-in setting item and save values into m
+    for (int index = 0; index < mPluginList->size(); index++) {
+
+        PluginAttributes attributes = mPluginList->at(index);
+
+        readPluginSettingItemValue(attributes.mFormItemSettingItem1, &attributes.mSettingItem1);
+        readPluginSettingItemValue(attributes.mFormItemSettingItem2, &attributes.mSettingItem2);
+        readPluginSettingItemValue(attributes.mFormItemSettingItem3, &attributes.mSettingItem3);
+        readPluginSettingItemValue(attributes.mFormItemSettingItem4, &attributes.mSettingItem4);
+        readPluginSettingItemValue(attributes.mFormItemSettingItem5, &attributes.mSettingItem5);
+        readPluginSettingItemValue(attributes.mFormItemSettingItem6, &attributes.mSettingItem6);
+
+        if (attributes.mFormItemSampleRate != 0) {
+            bool ok = false;
+            attributes.mSampleRate
+                = attributes.mFormItemSampleRate->contentWidgetData("text").toInt(&ok);
+            if (!ok) {
+                // this should not happen because intvalidator is set into text box
+                qWarning("Unable to convert sample rate to integer");
+            }
+        }
+
+        mPluginList->replace(index, attributes);
+
+    }
+
+}
+
+// ---------------------------------------------------------------------------
+
+void PISettingsView::expandPluginGroup(int uid)
+{
+
+    // FIXME some of the methods is deprecating fix once new methods available.
+    //collapse all group items
+    /*HbDataFormViewItem *viewItem = 0;
+    viewItem = mSettingForm->dataFormViewItem(mModel->indexFromItem(mPluginSettingsGroup));
+    if (viewItem != 0) {
+        viewItem->setExpanded(false);
+    }
+    viewItem = mSettingForm->dataFormViewItem(mModel->indexFromItem(mGeneralSettingsGroup));
+    if (viewItem != 0) {
+        viewItem->setExpanded(false);
+    }
+    // Set plugin group as expanded.
+    viewItem = mSettingForm->dataFormViewItem(mModel->indexFromItem(mPluginSettingsGroup));
+    if (viewItem != 0) {
+        viewItem->setExpanded(true);
+    }
+    // find group item which has same uid number
+    for (int index = 0; index < mPluginSettingsGroup->childCount(); index++) {
+        HbDataFormModelItem *item = mPluginSettingsGroup->childAt(index);
+        bool ok = false;
+        int groupUid = item->data(HbDataFormModelItem::KeyRole).toInt(&ok);
+        if (ok) {
+            if (uid == groupUid) {
+                // Set group as expanded
+                viewItem = mSettingForm->dataFormViewItem(mModel->indexFromItem(item));
+                if (viewItem != 0) {
+                    viewItem->setExpanded(true);
+                }
+
+                // scroll view so that group is shown
+                mSettingForm->scrollTo(mModel->indexFromItem(item),
+                    HbAbstractItemView::PositionAtTop);
+                break;
+
+            }
+        }
+
+    }*/
+
+}
+
+// ---------------------------------------------------------------------------
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/piprofilerui/ui/hb/src/pluginattributes.cpp	Wed Jun 09 09:42:37 2010 +0300
@@ -0,0 +1,32 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*
+*/
+
+
+#include "pluginattributes.h"
+
+PluginAttributes::PluginAttributes() :
+    mFormItemSettingItem1(0), mFormItemSettingItem2(0), mFormItemSettingItem3(0),
+        mFormItemSettingItem4(0), mFormItemSettingItem5(0), mFormItemSettingItem6(0),
+        mFormItemSampleRate(0)
+{
+
+}
+
+PluginAttributes::~PluginAttributes()
+{
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/piprofilerui/ui/icons/qgn_menu_piprofilerui.svg	Wed Jun 09 09:42:37 2010 +0300
@@ -0,0 +1,66 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+<svg
+   xmlns:svg="http://www.w3.org/2000/svg"
+   xmlns="http://www.w3.org/2000/svg"
+   xmlns:xlink="http://www.w3.org/1999/xlink"
+   version="1.0"
+   width="100%"
+   height="100%"
+   viewBox="0 0 88 88"
+   id="svg1926">
+  <defs
+     id="defs6909">
+    <linearGradient
+       id="linearGradient3171">
+      <stop
+         style="stop-color:#0000ff;stop-opacity:1"
+         offset="0"
+         id="stop3173" />
+      <stop
+         style="stop-color:#0000ff;stop-opacity:0.59793812"
+         offset="0.78571427"
+         id="stop4140" />
+      <stop
+         style="stop-color:#0000ff;stop-opacity:0"
+         offset="1"
+         id="stop3175" />
+    </linearGradient>
+    <radialGradient
+       cx="8"
+       cy="8"
+       r="7"
+       fx="8"
+       fy="8"
+       id="radialGradient3179"
+       xlink:href="#linearGradient3171"
+       gradientUnits="userSpaceOnUse"
+       gradientTransform="matrix(6.152284,0,0,6.152284,-5.2182712,-5.2182709)"
+       spreadMethod="pad" />
+    <linearGradient
+       id="linearGradient14494">
+      <stop
+         style="stop-color:#0000bc;stop-opacity:1"
+         offset="0"
+         id="stop14496" />
+      <stop
+         style="stop-color:#0000bc;stop-opacity:0.71134019"
+         offset="1"
+         id="stop14498" />
+    </linearGradient>
+  </defs>
+  <g
+     transform="matrix(1.00237,0,0,1.019616,-12.79656,94.92987)"
+     id="g14549" />
+  <rect
+     width="86.131981"
+     height="86.131981"
+     x="0.93400985"
+     y="0.93401051"
+     style="opacity:1;fill:url(#radialGradient3179);fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-opacity:1"
+     id="rect2198" />
+  <path
+     d="M 6.4042059,58.204857 L 17.170703,33.524373 L 27.937201,71.207114 L 44.086947,17.374627 L 54.853443,49.674119 L 65.61994,60.440617 L 73.215031,28.141124 L 81.769686,60.440617 L 81.769686,60.440617"
+     style="fill:none;fill-rule:evenodd;stroke:#8fe300;stroke-width:5.38324881;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+     id="path3181" />
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/piprofilerui/ui/icons/qgn_prob_piprofilerui_status_disabled.svg	Wed Jun 09 09:42:37 2010 +0300
@@ -0,0 +1,59 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+   xmlns:dc="http://purl.org/dc/elements/1.1/"
+   xmlns:cc="http://web.resource.org/cc/"
+   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+   xmlns:svg="http://www.w3.org/2000/svg"
+   xmlns="http://www.w3.org/2000/svg"
+   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+   baseProfile="tiny"
+   height="100%"
+   preserveAspectRatio="xMidYMid meet"
+   version="1.0"
+   viewBox="0 0 100 100"
+   width="100%"
+   zoomAndPan="magnify"
+   id="svg157473"
+   sodipodi:version="0.32"
+   inkscape:version="0.45.1"
+   sodipodi:docname="qgn_prob_piprofilerui_status_disabled.svg"
+   inkscape:output_extension="org.inkscape.output.svg.inkscape"
+   sodipodi:docbase="T:\BappeaProfiler\piprofiler\piprofilerui\s60ui\icons">
+  <metadata
+     id="metadata157509">
+    <rdf:RDF>
+      <cc:Work
+         rdf:about="">
+        <dc:format>image/svg+xml</dc:format>
+        <dc:type
+           rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+      </cc:Work>
+    </rdf:RDF>
+  </metadata>
+  <defs
+     id="defs157507" />
+  <sodipodi:namedview
+     inkscape:window-height="1174"
+     inkscape:window-width="1779"
+     inkscape:pageshadow="2"
+     inkscape:pageopacity="0.0"
+     guidetolerance="10.0"
+     gridtolerance="10.0"
+     objecttolerance="10.0"
+     borderopacity="1.0"
+     bordercolor="#666666"
+     pagecolor="#ffffff"
+     id="base"
+     inkscape:zoom="7.54"
+     inkscape:cx="58.387496"
+     inkscape:cy="46.88482"
+     inkscape:window-x="137"
+     inkscape:window-y="-4"
+     inkscape:current-layer="svg157473" />
+  <path
+     style="fill:#aa0000;fill-opacity:1;stroke:#000000;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:0.67105264"
+     d="M 4.7745358,23.607427 L 25.464191,6.8965515 L 47.34748,38.594164 L 77.718833,7.8249331 L 94.69496,26.657825 L 61.27321,55.835544 L 88.06366,81.697613 L 64.986737,96.949602 L 45.092838,68.700265 L 21.750663,94.960212 L 3.9787798,74.668435 L 31.962865,52.519894 L 4.7745358,23.607427 z "
+     id="path157511"
+     sodipodi:nodetypes="ccccccccccccc" />
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/piprofilerui/ui/icons/qgn_prob_piprofilerui_status_enabled.svg	Wed Jun 09 09:42:37 2010 +0300
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+<svg
+   xmlns:svg="http://www.w3.org/2000/svg"
+   xmlns="http://www.w3.org/2000/svg"
+   version="1.0"
+   width="100%"
+   height="100%"
+   viewBox="0 0 100 100"
+   id="svg156363">
+  <defs
+     id="defs156397" />
+  <path
+     d="M 3.5809023,59.018568 L 14.986738,29.310344 L 42.307692,70.689656 L 70.954907,3.8461536 L 95.490716,16.710875 L 44.827586,95.888595 L 3.5809023,59.018568 z "
+     style="fill:#00c024;fill-opacity:1;stroke:#000000;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:0.67105264"
+     id="path156428" />
+</svg>
--- a/stifui/avkon/group/ReleaseNote.txt	Tue May 11 16:14:15 2010 +0300
+++ b/stifui/avkon/group/ReleaseNote.txt	Wed Jun 09 09:42:37 2010 +0300
@@ -1,5 +1,5 @@
 ========================================================================
-RELEASE NOTE FOR STIF UI - STIF_201016 (7.3.31)
+RELEASE NOTE FOR STIF UI - STIF_201020 (7.3.33)
 SUPPORTING SERIES 60 3.0 ->
 ========================================================================
 
Binary file stifui/avkon/sis/Stifui_31.sis has changed
--- a/stifui/avkon/stifui/inc/version.h	Tue May 11 16:14:15 2010 +0300
+++ b/stifui/avkon/stifui/inc/version.h	Wed Jun 09 09:42:37 2010 +0300
@@ -20,9 +20,9 @@
 
 #define STIFUI_MAJOR_VERSION 7
 #define STIFUI_MINOR_VERSION 3
-#define STIFUI_BUILD_VERSION 31
+#define STIFUI_BUILD_VERSION 33
 
-#define STIFUI_REL_DATE "20th Apr 2010"
+#define STIFUI_REL_DATE "18th May 2010"
 
 #define TO_UNICODE(text) _L(text) 
 
--- a/stifui/qt/ReleaseNote.txt	Tue May 11 16:14:15 2010 +0300
+++ b/stifui/qt/ReleaseNote.txt	Wed Jun 09 09:42:37 2010 +0300
@@ -1,11 +1,11 @@
 ========================================================================
-RELEASE NOTE FOR STIFQTUI - STIF_201016 (7.3.31)
+RELEASE NOTE FOR STFUI_201020 (7.3.33)
 ========================================================================
 
 Product Description:
 ====================
-STIFQTUI is Series QT UI application for STIF project.
-STIF is a test harness for testing Symbian components.
+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 :
--- a/stifui/qt/inc/dlgoutput.h	Tue May 11 16:14:15 2010 +0300
+++ b/stifui/qt/inc/dlgoutput.h	Wed Jun 09 09:42:37 2010 +0300
@@ -51,6 +51,7 @@
 private slots:
     void on_btnPause_clicked();
     void on_btnAbort_clicked();
+    void on_btnClose_clicked();
     
     
 private:
@@ -58,12 +59,9 @@
     QTabWidget* tabMain;
     QPushButton* btnPause;
     QPushButton* btnAbort;
+    QPushButton* btnClose;
     QHash<QString , QPlainTextEdit*> tabList;
     
-private:
-    void on_btnClose_clicked();
-    
-    
 };
 
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/qt/inc/dlgsetselector.h	Wed Jun 09 09:42:37 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.
+*              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_ */
--- a/stifui/qt/inc/frmmain.h	Tue May 11 16:14:15 2010 +0300
+++ b/stifui/qt/inc/frmmain.h	Wed Jun 09 09:42:37 2010 +0300
@@ -20,11 +20,14 @@
 #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"
 
 QT_BEGIN_NAMESPACE
 class QAction;
@@ -43,15 +46,15 @@
 class QFileDialog;
 QT_END_NAMESPACE
 
-const QString QtUIVersion = "StfQtUI v1.0.1";
+
 
-class frmMain : public QMainWindow, public IStfEventListener, public IStifModelEventListener
+class FrmMain : public QMainWindow, public IStfEventListener, public IStifModelEventListener
 {
     Q_OBJECT
 
 public:
-    frmMain();
-    ~frmMain();
+    FrmMain();
+    ~FrmMain();
     
     
 public: //Implement IStfEventListener
@@ -64,6 +67,9 @@
     void OnCaseStatisticChanged() ;
     void OnRunningCaseChanged() ;
     
+protected:
+    void paintEvent(QPaintEvent *event);
+    
 protected slots:
     void onTabWidgetSelectIndexChanged();
 
@@ -79,16 +85,20 @@
     QList<CSTFCase> getSelectedCases();
     void reloadStatisticItem(QString name, QTreeWidgetItem* item, TSTFCaseStatusType type);
     void setSetting();
+    void startRunning();
     
 private:
     IStfQtUIController* controller;
     IStfQtUIModel* model;
     DlgOutput* dlgOutput;
     UiSetting* uiSetting; 
-    
+    bool layoutType;
 
 private: //UI Components
-    QWidget *MainWidget;
+    QWidget* centerWidget;
+    QGridLayout *mainLayout;
+    QGroupBox *groupBox;
+    
     //menus and actions
     QMenu *operateMenu;
     //output panel
@@ -120,7 +130,7 @@
     QListWidget *lstStartedCases;
     QPushButton *btnPauseCase;
     QPushButton *btnAbortCase;
-    QPlainTextEdit *txtCaseOutput;
+    QPushButton *btnShowOutput;
 
     //menu actions
     QAction *actExit;
@@ -135,14 +145,18 @@
     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;
 
@@ -157,6 +171,8 @@
     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();
@@ -165,6 +181,7 @@
     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);
 
@@ -176,4 +193,4 @@
 
 };
 
-#endif // FRMMAIN_H
+#endif // FrmMain_H
--- a/stifui/qt/inc/istfqtuicontroller.h	Tue May 11 16:14:15 2010 +0300
+++ b/stifui/qt/inc/istfqtuicontroller.h	Wed Jun 09 09:42:37 2010 +0300
@@ -48,19 +48,20 @@
     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 AddCaseToSet(const QList<CSTFCase>& aCase, const QString& setName) = 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 void CreateSet(const QString& setName) = 0;
-    virtual void DeleteSet(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;
     
--- a/stifui/qt/inc/istfqtuimodel.h	Tue May 11 16:14:15 2010 +0300
+++ b/stifui/qt/inc/istfqtuimodel.h	Wed Jun 09 09:42:37 2010 +0300
@@ -19,7 +19,6 @@
 #ifndef ISTFQTUIMODEL_H
 #define ISTFQTUIMODEL_H
 
-//#include <TestModuleInfo.h>
 #include "cstfcase.h"
 #include "cstfmodule.h"
 #include <UIStoreIf.h>
@@ -42,6 +41,7 @@
     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;
--- a/stifui/qt/inc/stfqtuicontroller.h	Tue May 11 16:14:15 2010 +0300
+++ b/stifui/qt/inc/stfqtuicontroller.h	Wed Jun 09 09:42:37 2010 +0300
@@ -35,13 +35,13 @@
     QList<QString> GetCaseListByModule(const QString& moduleName);
     CSTFCase GetCase(const QString& moduleName, const int index);
     void RunCases(const QList<CSTFCase>& caseList, const TSTFCaseRunningType& type);
-    void AddCaseToSet(const QList<CSTFCase>& aCase, const QString& setName);
+    bool AddCaseToSet(const QList<CSTFCase>& aCase, const QString& setName);
     
     //for set
     QList<QString> GetSetList();
     QList<QString> GetCaseListBySet(const QString& setName);
-    void CreateSet(const QString& setName);
-    void DeleteSet(const QString& setName);
+    bool CreateSet(QString& setName);
+    bool DeleteSet(const QString& setName);
     void RunSets(const QString& setName, const TSTFCaseRunningType& type);
     
     //for Started
@@ -49,6 +49,7 @@
     void ResumeCase();
     void AbortCase();
     bool ShowOutput();
+    CSTFCase GetRunningCase(int index);
     void SetShowOutput(bool isShow);
     
     //for staticstic
--- a/stifui/qt/inc/stfqtuimodel.h	Tue May 11 16:14:15 2010 +0300
+++ b/stifui/qt/inc/stfqtuimodel.h	Wed Jun 09 09:42:37 2010 +0300
@@ -32,6 +32,7 @@
     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();
--- a/stifui/qt/inc/stifexecutor.h	Tue May 11 16:14:15 2010 +0300
+++ b/stifui/qt/inc/stifexecutor.h	Wed Jun 09 09:42:37 2010 +0300
@@ -19,13 +19,13 @@
 #ifndef STIFEXECUTOR_H_
 #define STIFEXECUTOR_H_
 
-//#include <TestModuleInfo.h>
 #include "cstfcase.h"
 #include "cstfmodule.h"
 #include <UIStoreIf.h>
 #include <UIStore.h>
 #include <UIEngine.h>
 #include <QList>
+#include <StifLogger.h>
 
 class IStifCaseUpdateListener
     {
@@ -49,10 +49,10 @@
     void ExecuteSingleCase(const QString& moduleName, int caseIndex);
     QList<QString> GetSetList();
     QList<CSTFCase> GetCaseListFromSet(const QString& setName);
-    void CreateSet(const QString& setName);
-    void SaveSet(QString& setName);
-    void RemoveSet(const QString& setName);
-    void AddtoSet(const QString& setName, CSTFCase& caseInfo);
+    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 
@@ -63,9 +63,14 @@
      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;
     };
 
 
--- a/stifui/qt/inc/uisetting.h	Tue May 11 16:14:15 2010 +0300
+++ b/stifui/qt/inc/uisetting.h	Wed Jun 09 09:42:37 2010 +0300
@@ -18,6 +18,10 @@
 #define UISETTING_H_
 #include <QHash>
 
+const QString KShowOutput = "showoutput";
+const QString KStyleSheet = "StyleSheet";
+
+
 class UiSetting
     {
 public:
@@ -32,6 +36,7 @@
     bool load();
     bool save();
     void loadDefault();
+    QString getDefaultValue(const QString& item);
     
 private:
     QHash<QString, QString> settingList;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/qt/inc/uiversion.h	Wed Jun 09 09:42:37 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: 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_ */
--- a/stifui/qt/inc/version.h	Tue May 11 16:14:15 2010 +0300
+++ b/stifui/qt/inc/version.h	Wed Jun 09 09:42:37 2010 +0300
@@ -11,18 +11,18 @@
 *
 * Contributors:
 * 
-* Description: STIF QT UI version declaration
+* Description: STIF version declaration
 *
 */
 
 #ifndef VERSION_H_
 #define VERSION_H_
 
-#define STIF_MAJOR_VERSION 7
-#define STIF_MINOR_VERSION 3
-#define STIF_BUILD_VERSION 26
+#define STIF_MAJOR_VERSION 1
+#define STIF_MINOR_VERSION 0
+#define STIF_BUILD_VERSION 0
 
-#define STIF_REL_DATE "09th Feb 2010"
+#define STIF_REL_DATE "1st Mar 2010"
 
 #define TO_UNICODE(text) _L(text) 
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/qt/qss/coffee.qss	Wed Jun 09 09:42:37 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 Jun 09 09:42:37 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/sis/StfQtUI.pkg	Wed Jun 09 09:42:37 2010 +0300
@@ -0,0 +1,32 @@
+; StfQtUI_template.pkg generated by qmake at 2010-02-08T13:37:27
+; 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
+%{"Vendor"}
+
+; Unique Vendor name
+:"Vendor"
+
+; Manual PKG pre-rules from PRO files
+; Default HW/platform dependencies
+[0x101F7961],0,0,0,{"S60ProductID"}
+[0x102032BE],0,0,0,{"S60ProductID"}
+[0x102752AE],0,0,0,{"S60ProductID"}
+[0x1028315F],0,0,0,{"S60ProductID"}
+ 
+; Default dependency to Qt libraries
+;(0x2001E61C), , , , {"Qt"}
+
+; Executable and default resource files
+"/epoc32/release/armv5/urel/StfUI.exe"    - "!:\sys\bin\StfUI.exe"
+"/epoc32/data/z/resource/apps/StfQtUI.rsc"    - "!:\resource\apps\StfQtUI.rsc"
+"/epoc32/data/z/private/10003a3f/import/apps/StfQtUI_reg.rsc"    - "!:\private\10003a3f\import\apps\StfQtUI_reg.rsc"
+
+; Manual PKG post-rules from PRO files
--- a/stifui/qt/src/dlgoutput.cpp	Tue May 11 16:14:15 2010 +0300
+++ b/stifui/qt/src/dlgoutput.cpp	Wed Jun 09 09:42:37 2010 +0300
@@ -20,30 +20,34 @@
 DlgOutput::DlgOutput(IStfQtUIController* ctl, QWidget *parent) :
     QDialog(parent), controller(ctl)
     {
-    QSize btnSize(100,30);
     QGridLayout *mainLayout = new QGridLayout(this);
     this->setLayout(mainLayout);
     this->setContextMenuPolicy(Qt::NoContextMenu);
 
-    tabMain = new QTabWidget();
+    tabMain = new QTabWidget(this);
     tabMain->setContextMenuPolicy(Qt::NoContextMenu);
 
     QWidget *toolWidget = new QWidget(this);
     toolWidget->setContextMenuPolicy(Qt::NoContextMenu);
-    QGridLayout *toolLayout = new QGridLayout();
+    QGridLayout *toolLayout = new QGridLayout(this);
     toolWidget->setLayout(toolLayout);
     btnPause = new QPushButton(tr("Pause"), toolWidget);
     btnPause->setContextMenuPolicy(Qt::NoContextMenu);
-    btnPause->setFixedSize(btnSize);
     QObject::connect(btnPause, SIGNAL(clicked()), this,
             SLOT(on_btnPause_clicked()));
     btnAbort = new QPushButton(tr("Abort"), toolWidget);
     btnAbort->setContextMenuPolicy(Qt::NoContextMenu);
-    btnAbort->setFixedSize(btnSize);
     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);
@@ -66,8 +70,9 @@
 void DlgOutput::CloseItem(QString index)
     {
     int u = tabList.keys().indexOf(index);
+    
+    delete tabList.value(index);
     tabList.remove(index);
-    tabMain->removeTab(u);
     if (tabMain->count() == 0)
         {
         this->close();
@@ -80,6 +85,13 @@
         {
         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()
@@ -101,10 +113,19 @@
     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)
     {
-    this->showMaximized();
+    if(controller->ShowOutput() && this->isVisible() == false)
+        {
+        this->showMaximized();
+        }
     switch (cmd)
         {
         case IStfEventListener::ECreate:
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/qt/src/dlgsetselector.cpp	Wed Jun 09 09:42:37 2010 +0300
@@ -0,0 +1,114 @@
+/*
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies 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), setList(list), selectName("")
+    {
+    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();
+    }
--- a/stifui/qt/src/dlgsetting.cpp	Tue May 11 16:14:15 2010 +0300
+++ b/stifui/qt/src/dlgsetting.cpp	Wed Jun 09 09:42:37 2010 +0300
@@ -32,36 +32,38 @@
     
     chkShowoutput = new QCheckBox(this);
     chkShowoutput->setText(tr("Show output in execution."));
-    chkShowoutput->setChecked(setting->ReadSetting("showoutput") == "true");
-    
+    chkShowoutput->setChecked(setting->ReadSetting(KShowOutput) == "true");
     QWidget *toolWidget = new QWidget(this);
-    QGridLayout *toolLayout = new QGridLayout();
+    QGridLayout *toolLayout = new QGridLayout(this);
     
     toolWidget->setLayout(toolLayout);
     btnOk = new QPushButton(tr("Ok"), toolWidget);
-    btnOk->setFixedSize(100, 30);
     QObject::connect(btnOk, SIGNAL(clicked()), this,
             SLOT(on_btnOk_clicked()));
     btnCancel = new QPushButton(tr("Cancel"), toolWidget);
-    btnCancel->setFixedSize(100, 30);
     QObject::connect(btnCancel, SIGNAL(clicked()), this,
             SLOT(on_btnCancel_clicked()));
     toolLayout->addWidget(btnOk, 0, 0);
     toolLayout->addWidget(btnCancel, 0, 1);
 
-    mainLayout->addWidget(chkShowoutput, 0, 0);
-    mainLayout->addWidget(toolWidget, 2, 0);    
+    QWidget *nullWidget = new QWidget(this);
+    nullWidget->setMinimumHeight(30);
+    
+    mainLayout->addWidget(nullWidget, 0, 0);
+    mainLayout->addWidget(chkShowoutput, 1, 0);
+    mainLayout->addWidget(toolWidget, 3, 0);    
+    
     }
 
 void DlgSetting::on_btnOk_clicked()
     {
     if(chkShowoutput->checkState() == Qt::Checked)
         {
-        setting->SetSetting("showoutput", "true");
+        setting->SetSetting(KShowOutput, "true");
         }
     else
         {
-        setting->SetSetting("showoutput", "false");    
+        setting->SetSetting(KShowOutput, "false");    
         }
     this->accept();
     }
--- a/stifui/qt/src/frmmain.cpp	Tue May 11 16:14:15 2010 +0300
+++ b/stifui/qt/src/frmmain.cpp	Wed Jun 09 09:42:37 2010 +0300
@@ -21,16 +21,26 @@
 #include <QList>
 #include "version.h"
 #include <QCursor>
+#include <QDesktopWidget>
 
 const QString SELECTITEMHEADER = " * ";
 const QString UNSELECTITEMHEADER = "   ";
 
-frmMain::frmMain()
+FrmMain::FrmMain()
     {
     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);
@@ -40,7 +50,7 @@
     setSetting();
     }
 
-frmMain::~frmMain()
+FrmMain::~FrmMain()
     {
     model->AbortCase();
     controller->RemoveStfEventListener(this);
@@ -52,17 +62,57 @@
     delete model;
     }
 
-void frmMain::setSetting()
+void FrmMain::paintEvent(QPaintEvent* event)
     {
-    controller->SetShowOutput(uiSetting->ReadSetting("showoutput") == "true");    
+    
+    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::OnGetMessage(const QString& aMessage)
+void FrmMain::setSetting()
+    {
+    controller->SetShowOutput(uiSetting->ReadSetting(KShowOutput) == "true");    
+    }
+
+void FrmMain::OnGetMessage(const QString& aMessage)
     {
     txtOutput->appendPlainText(aMessage);
     }
 
-void frmMain::OnRunningCaseChanged()
+void FrmMain::OnRunningCaseChanged()
     {
     QList<CSTFCase> caseList = controller->GetCasesByStatus(EStatusRunning);
     lstStartedCases->clear();
@@ -74,34 +124,38 @@
         {
         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*/)
+void FrmMain::OnCaseOutputChanged(const IStfEventListener::CaseOutputCommand& /*cmd*/, const QString& /*index*/, const QString& /*msg*/)
     {
     //nothing to do.
     }
 
-void frmMain::OnSetListChanged()
+void FrmMain::OnSetListChanged()
     {
     loadSetList();
     }
 
-void frmMain::OnCaseStatisticChanged()
+void FrmMain::OnCaseStatisticChanged()
     {
     loadStatistic();
     }
 
-void frmMain::createMenus()
+void FrmMain::createMenus()
     {
     //operateMenu = menuBar()->addMenu(tr("&Operation"));
     actAbout = new QAction(tr("&About"), this);
@@ -115,11 +169,13 @@
     connect(actOpenFile, SIGNAL(triggered()), this,
             SLOT(on_actOpenFile_triggered()));
 
-    actRunCaseSeq = new QAction(tr("Run Case Sequentially"), this);
+    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("Run Case Parallel"), this);
+    actRunCasePar = new QAction(tr("Parallel"), this);
     connect(actRunCasePar, SIGNAL(triggered()), this,
             SLOT(on_actRunCasePar_triggered()));
 
@@ -139,15 +195,17 @@
     connect(actCollapseAll, SIGNAL(triggered()), this,
             SLOT(on_actCollapseAll_triggered()));
 
-    actSetting = new QAction(tr("Setting"), this);
+    actSetting = new QAction(tr("Settings"), this);
     connect(actSetting, SIGNAL(triggered()), this,
             SLOT(on_actSetting_triggered()));
 
-    actRunSetSeq = new QAction(tr("Run Set Sequentially"), this);
+    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("Run Set Parallel"), this);
+    actRunSetPar = new QAction(tr("Parallel"), this);
     connect(actRunSetPar, SIGNAL(triggered()), this,
             SLOT(on_actRunSetPar_triggered()));
 
@@ -168,6 +226,11 @@
     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,
@@ -175,19 +238,22 @@
 
     }
 
-void frmMain::load()
+void FrmMain::load()
     {
     this->setContextMenuPolicy(Qt::NoContextMenu);
-    QSize btnSize(100,35);
-    QGridLayout *mainLayout = new QGridLayout(this);
+    
+    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);
-
-    MainWidget = new QWidget(this);
-    MainWidget->setContextMenuPolicy(Qt::NoContextMenu);
-
+    
+    this->centralWidget()->setContextMenuPolicy(Qt::NoContextMenu);
+    
     //tab control
     tabWidget = new QTabWidget(this);
     tabWidget->setContextMenuPolicy(Qt::NoContextMenu);
@@ -207,13 +273,11 @@
             SLOT(onTabWidgetSelectIndexChanged()));
 
     //output panel
-    QGroupBox *groupBox = new QGroupBox(this);
-    groupBox->setFixedHeight(150);
+    groupBox = new QGroupBox(this);
+    //groupBox->setFixedHeight(150);
     groupBox->setContextMenuPolicy(Qt::NoContextMenu);
     groupBox->setTitle(tr("Information"));
-    QFont serifFont("Times", 5, QFont::Normal);
     txtOutput = new QPlainTextEdit(groupBox);
-    txtOutput->setFont(serifFont);
     txtOutput->setContextMenuPolicy(Qt::NoContextMenu);
     txtOutput->setReadOnly(true);
     txtOutput->setFocusPolicy(Qt::NoFocus);
@@ -226,10 +290,32 @@
     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);
-    MainWidget->setLayout(mainLayout);
+    mainLayout->setRowStretch(0,4);
+    mainLayout->setRowStretch(1,1);
     
 
     //Tab page: Case
@@ -249,23 +335,20 @@
 
     QWidget *caseToolWidget = new QWidget(tabCase);
     caseToolWidget->setContextMenuPolicy(Qt::NoContextMenu);
-    QGridLayout *caseToolWidgetLayout = new QGridLayout;
+    QGridLayout *caseToolWidgetLayout = new QGridLayout(this);
     QPushButton *btnRunCase = new QPushButton(tr("Run"), caseToolWidget);
     btnRunCase->setContextMenuPolicy(Qt::NoContextMenu);
-    btnRunCase->setFixedSize(btnSize);
     connect(btnRunCase, SIGNAL(clicked()), this,
             SLOT(on_actRunCaseSeq_triggered()));
     QPushButton *btnExpandAll = new QPushButton(tr("Expand"), caseToolWidget);
     btnExpandAll->setContextMenuPolicy(Qt::NoContextMenu);
-    btnExpandAll->setFixedSize(btnSize);
     connect(btnExpandAll, SIGNAL(clicked()), this,
-            SLOT(on_actExpandAll_triggered()));
+            SLOT(on_actExpand_triggered()));
     QPushButton *btnCollapseAll = new QPushButton(tr("Collapse"),
             caseToolWidget);
     btnCollapseAll->setContextMenuPolicy(Qt::NoContextMenu);
-    btnCollapseAll->setFixedSize(btnSize);
     connect(btnCollapseAll, SIGNAL(clicked()), this,
-            SLOT(on_actCollapseAll_triggered()));
+            SLOT(on_actCollapse_triggered()));
 
     caseToolWidgetLayout->addWidget(btnRunCase, 0, 0);
     caseToolWidgetLayout->addWidget(btnExpandAll, 0, 1);
@@ -318,17 +401,14 @@
     setToolWidgetLayout->setMargin(2);     
     QPushButton *btnRunSetCase = new QPushButton(tr("Run"), setToolWidget);
     btnRunSetCase->setContextMenuPolicy(Qt::NoContextMenu);
-    btnRunSetCase->setFixedSize(btnSize);
     connect(btnRunSetCase, SIGNAL(clicked()), this,
             SLOT(on_actRunSetSeq_triggered()));
     QPushButton *btnNewSet = new QPushButton(tr("New Set"), setToolWidget);
     btnNewSet->setContextMenuPolicy(Qt::NoContextMenu);
-    btnNewSet->setFixedSize(btnSize);
     connect(btnNewSet, SIGNAL(clicked()), this,
             SLOT(on_actNewSet_triggered()));
     QPushButton *btnDelSet = new QPushButton(tr("Delete Set"), setToolWidget);
     btnDelSet->setContextMenuPolicy(Qt::NoContextMenu);
-    btnDelSet->setFixedSize(btnSize);
     connect(btnDelSet, SIGNAL(clicked()), this,
             SLOT(on_actDelSet_triggered()));
 
@@ -358,26 +438,25 @@
     startedToolWidgetLayout->setMargin(2);
     btnPauseCase = new QPushButton(tr("Pause"), startedToolWidget);
     btnPauseCase->setContextMenuPolicy(Qt::NoContextMenu);
-    btnPauseCase->setFixedSize(btnSize);
     connect(btnPauseCase, SIGNAL(clicked()), this,
             SLOT(on_actPause_triggered()));
     btnPauseCase->setEnabled(false);
 
     btnAbortCase = new QPushButton(tr("Abort"), startedToolWidget);
     btnAbortCase->setContextMenuPolicy(Qt::NoContextMenu);
-    btnAbortCase->setFixedSize(btnSize);
     connect(btnAbortCase, SIGNAL(clicked()), this,
             SLOT(on_actAbort_triggered()));
     btnAbortCase->setEnabled(false);
-    //    
-    //    QPushButton *btnShowOutput = new QPushButton(tr("Output"), startedToolWidget);
-    //    connect(btnShowOutput, SIGNAL(clicked()), this,
-    //                SLOT(on_btnShowOutput_clicked()));
+        
+    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);
+    startedToolWidgetLayout->addWidget(btnShowOutput, 0, 2);
     startedToolWidget->setLayout(startedToolWidgetLayout);
 
     tabStartedLayout->addWidget(lstStartedCases, 0, 0);
@@ -408,12 +487,14 @@
     abortedItems = new QTreeWidgetItem(treeStatistic);
     abortedItems->setText(0, tr("Aborted Cases(0)"));
     
-    
-    setCentralWidget(MainWidget);
+    //this->repaint();
+
 
     }
 
-void frmMain::LoadSubMenu()
+
+
+void FrmMain::LoadSubMenu()
     {
     menuBar()->clear();
     menuBar()->setContextMenuPolicy(Qt::NoContextMenu);
@@ -421,8 +502,9 @@
         {
         //Cases Tab
         menuBar()->addAction(actOpenFile);
-        menuBar()->addAction(actRunCaseSeq);
-        menuBar()->addAction(actRunCasePar);
+        menuBar()->addMenu(menuRunCase);
+        menuRunCase->addAction(actRunCaseSeq);
+        menuRunCase->addAction(actRunCasePar);
         menuBar()->addSeparator();
         menuBar()->addAction(actAddtoSet);
         menuBar()->addSeparator();
@@ -433,8 +515,9 @@
     else if (tabWidget->currentIndex() == 1)
         {
         //Set Tab
-        menuBar()->addAction(actRunSetSeq);
-        menuBar()->addAction(actRunSetPar);
+        menuBar()->addMenu(menuRunSet);
+        menuRunSet->addAction(actRunSetSeq);
+        menuRunSet->addAction(actRunSetPar);
         menuBar()->addSeparator();
         menuBar()->addAction(actNewSet);
         menuBar()->addAction(actDelSet);
@@ -444,6 +527,7 @@
         //Started Tab
         menuBar()->addAction(actPause);
         menuBar()->addAction(actAbort);
+        menuBar()->addAction(actOutput);
         
         }
     else
@@ -458,12 +542,12 @@
 
     }
 
-void frmMain::onTabWidgetSelectIndexChanged()
+void FrmMain::onTabWidgetSelectIndexChanged()
     {
     LoadSubMenu();
     }
 
-void frmMain::loadContent()
+void FrmMain::loadContent()
     {
     //Load ModuleList
     loadModuleList();
@@ -473,7 +557,7 @@
     loadStatistic();
     }
 
-void frmMain::loadModuleList()
+void FrmMain::loadModuleList()
     {
     treeModuleList->clear();
     
@@ -498,7 +582,7 @@
         }
     }
 
-void frmMain::reloadStatisticItem(QString name, QTreeWidgetItem* item,
+void FrmMain::reloadStatisticItem(QString name, QTreeWidgetItem* item,
         TSTFCaseStatusType type)
     {
     QList<CSTFCase> caseList = controller->GetCasesByStatus(type);
@@ -514,7 +598,7 @@
             }
     }
 
-void frmMain::loadStatistic()
+void FrmMain::loadStatistic()
     {
     //executedItems;
     reloadStatisticItem("Executed Cases", executedItems, EStatusExecuted);
@@ -533,7 +617,7 @@
 
     }
 
-void frmMain::loadSetList()
+void FrmMain::loadSetList()
     {
     cboSetList->clear();
 
@@ -549,7 +633,7 @@
 //        }
     }
 
-QList<CSTFCase> frmMain::getSelectedCases()
+QList<CSTFCase> FrmMain::getSelectedCases()
     {
     int index = 0;
     QTreeWidgetItem* item = treeModuleList->topLevelItem(index);
@@ -574,7 +658,7 @@
     return caseList;
     }
 
-void frmMain::on_cboSetList_currentIndexChanged(QString item)
+void FrmMain::on_cboSetList_currentIndexChanged(QString item)
     {
     lstSetCases->clear();
     QList<QString> list = controller->GetCaseListBySet(item);
@@ -584,48 +668,97 @@
             }
     }
 
-void frmMain::on_actRunCaseSeq_triggered()
+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()
+void FrmMain::on_actRunCasePar_triggered()
     {
+    startRunning();
     controller->RunCases(getSelectedCases(), Parallel);
     }
 
-void frmMain::on_actAddtoSet_triggered()
+void FrmMain::on_actAddtoSet_triggered()
     {
 
     QList<CSTFCase> list = getSelectedCases();
     if (list.size() == 0)
         {
         QErrorMessage *errorMessageDialog = new QErrorMessage(this);
+        errorMessageDialog->setAutoFillBackground(true);
         errorMessageDialog->showMessage(tr(
-                "Please select cases you want to added to set."));
+                "<font color =black>Please select cases you want to added to set.</font>"));
         return;
         }
 
     QList<QString> setList = controller->GetSetList();
 
-    /*    
-     bool ok;
-     QString setName = QInputDialog::getItem(this, tr(
-     "Add select cases to Set"), tr("Sets:"), setList, 0, false, &ok);
-     if (ok && !setName.isEmpty())
-     {
-     controller->AddCaseToSet(list, setName);
-     }
-     */
+    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);
+        }
 
-    //temp code, because UIStore()->AddCaseToSet() is not support to define a set name.
-    controller->AddCaseToSet(list, "");
-    tabWidget->setCurrentIndex(1);
-
+    
     }
 
-void frmMain::on_actSelectAll_triggered()
+void FrmMain::on_actSelectAll_triggered()
     {
     QString header = UNSELECTITEMHEADER;
     if(actSelectAll->text() == "Select All")
@@ -653,17 +786,36 @@
         }
     }
 
-void frmMain::on_actExpandAll_triggered()
+void FrmMain::on_actExpandAll_triggered()
     {
+    QTreeWidgetItem* item = treeModuleList->currentItem();
     treeModuleList->expandAll();
+    if(item != NULL)
+        {
+        treeModuleList->setCurrentItem(item);
+        }
+        
     }
 
-void frmMain::on_actCollapseAll_triggered()
+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()
+void FrmMain::on_actSetting_triggered()
     {
     DlgSetting dlgSet(uiSetting);
     int result = dlgSet.exec();
@@ -673,75 +825,71 @@
         }
     }
 
-void frmMain::on_actRunSetSeq_triggered()
+void FrmMain::on_actRunSetSeq_triggered()
     {
+    startRunning();
     QString setName = cboSetList->currentText();
     controller->RunSets(setName, Sequentially);
     }
 
-void frmMain::on_actRunSetPar_triggered()
+void FrmMain::on_actRunSetPar_triggered()
     {
+    startRunning();
     QString setName = cboSetList->currentText();
     controller->RunSets(setName, Parallel);
     }
 
-void frmMain::on_actNewSet_triggered()
+void FrmMain::on_actNewSet_triggered()
     {
-    //not supported.
-    QErrorMessage *errorMessageDialog = new QErrorMessage(this);
-    errorMessageDialog->showMessage(
-            tr(
-                    "The feature is not supported in this version.\r\n    \
-            If you want to Add test set.\r\n           \
-            Please switch to \"Case\" tab, Select case(s) and perform \"Add case to set\"."));
-    return;
-    /*
-     * These function is not supported in this version.
-     * Unless this function has been impelemented:
-     * UIStore()->AddSet(setName);
-     * 
-     bool ok;
-     QString text = QInputDialog::getText(this, tr("Create a new Set"), tr(
-     "Input a set name:"), QLineEdit::Normal, QDir::home().dirName(),
-     &ok);
-     if (ok && !text.isEmpty())
-     {
-     controller->CreateSet(text);
-     }
-     */
+    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()
+void FrmMain::on_actDelSet_triggered()
     {
-    //not supported.
-    QErrorMessage *errorMessageDialog = new QErrorMessage(this);
-    errorMessageDialog->showMessage(
-            tr(
-                    "The feature is not supported in this version.\r\n    \
-            If you want to remove test set.\r\n           \
-            Please delete them under {epoc root}\\winscw\\c\\TestFramework  \
-            And restart Application"));
-    return;
-    /*
-     * These function is not supported in this version.
-     * Unless this function has been impelemented:
-     * UIStore()->RemoveSet(setName);
-     * 
-     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);
-     }
-     
-     
-     */
+        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()
+void FrmMain::on_actPause_triggered()
     {
     if (btnPauseCase->text() == "Pause")
         {
@@ -757,12 +905,12 @@
         }
     }
 
-void frmMain::on_actAbort_triggered()
+void FrmMain::on_actAbort_triggered()
     {
     controller->AbortCase();
     }
 
-void frmMain::on_treeModuleList_itemClicked(QTreeWidgetItem* item, int /*column*/)
+void FrmMain::on_treeModuleList_itemClicked(QTreeWidgetItem* item, int /*column*/)
     {
     QString header = UNSELECTITEMHEADER;
     if(item->text(0).startsWith(UNSELECTITEMHEADER))
@@ -776,34 +924,72 @@
         }
     }
 
-void frmMain::on_actAbout_triggered()
+void FrmMain::on_actAbout_triggered()
     {
-    QString str = QtUIVersion;
-    str.append("\r\n").append("STF version:");
+    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("\r\n");
+    str.append("  --").append(STIF_REL_DATE).append("<br>");
     str.append("---");
-    str.append("\r\nCopyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. ");
+    str.append("Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. ");
 
-    QMessageBox::information(this, tr("About"), str);
+    QErrorMessage *errorMessageDialog = new QErrorMessage(this);
+    errorMessageDialog->showMessage("<font color =black size=12px><b>" + str + "</b></font>");
+    
     }
 
-void frmMain::on_actOpenFile_triggered()
+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())
         {
-        controller->OpenEngineIniFile(fileName);
-        this->loadModuleList();
+        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()
+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);
+    }
+
+
--- a/stifui/qt/src/main.cpp	Tue May 11 16:14:15 2010 +0300
+++ b/stifui/qt/src/main.cpp	Wed Jun 09 09:42:37 2010 +0300
@@ -20,8 +20,9 @@
 
 int main(int argc, char* argv[])
 {
+    Q_INIT_RESOURCE(StfQtUI);
     QApplication app(argc, argv);
-    frmMain win;
+    FrmMain win;
     win.showMaximized();
     return app.exec();
 }
--- a/stifui/qt/src/stfqtuicontroller.cpp	Tue May 11 16:14:15 2010 +0300
+++ b/stifui/qt/src/stfqtuicontroller.cpp	Wed Jun 09 09:42:37 2010 +0300
@@ -18,18 +18,16 @@
 #include "stfqtuicontroller.h"
 #include <stifinternal/UIStoreIf.h>
 #include <stifinternal/UIStoreContainer.h>
-//#include "stiflogger.h"
 #include <QDateTime>
 
 const QString TEMPSETNAME = "TEMPSET";
 const QString DEFAULTINI = "c:\\testframework\\testframework.ini";
 
-//__DECLARE_LOG
+
 
 StfQtUIController::StfQtUIController(IStfQtUIModel* aModel) :
     model(aModel), isShowOutput(false)
     {
-//    __OPENLOGL ("\\STFQtUI\\", "StifQtUi.log" );
     executor = new CStifExecutor();
     executor->OpenIniFile(DEFAULTINI);
     executor->AddStifCaseUpdateListener(this);
@@ -40,15 +38,20 @@
     executor->RemoveStifCaseUpdateListener(this);
     delete executor;
     executor = NULL;
-//    __CLOSELOG;
     }
 //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(fileName);
+    bool rst = executor->OpenIniFile(path);
     executor->AddStifCaseUpdateListener(this);
     return rst;
     }
@@ -132,19 +135,26 @@
         }
     }
 
-void StfQtUIController::AddCaseToSet(const QList<CSTFCase>& caseList,
-        const QString& /*setName*/)
+bool StfQtUIController::AddCaseToSet(const QList<CSTFCase>& caseList,
+        const QString& setName)
     {
-    QString setName = QDateTime::currentDateTime().toString("hh_mm_ss");
-    setName.append(".set");
-    executor->CreateSet(setName);
+    QString name = setName;
+    bool rst = true;
     foreach(CSTFCase aCase, caseList)
             {
-            executor->AddtoSet(setName, aCase);
+            rst = executor->AddtoSet(name, aCase);
+            if(!rst)
+                {
+                break;
+                }
             }
-    executor->SaveSet(setName);
-    executor->RemoveSet(setName);
+    if(!rst)
+        {
+        return false;
+        }
+    rst = executor->SaveSet(name);
     FireOnSetListChanged();
+    return rst;
     }
 
 //for set
@@ -164,18 +174,29 @@
     return caseList;
     }
 
-void StfQtUIController::CreateSet(const QString& setName)
+bool StfQtUIController::CreateSet(QString& setName)
     {
-    executor->CreateSet(setName);
-    //executor->SaveSet(setName);
+    bool rst = executor->CreateSet(setName);
+    if(!rst)
+        {
+        return rst;
+        }
+    rst = executor->SaveSet(setName);
     FireOnSetListChanged();
+    return rst;
     }
 
-void StfQtUIController::DeleteSet(const QString& setName)
+bool StfQtUIController::DeleteSet(const QString& setName)
     {
-    executor->RemoveSet(setName);
-    //executor->SaveSet(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)
@@ -203,6 +224,12 @@
     FireOnGetOutput("Case Aborted");
     }
 
+CSTFCase StfQtUIController::GetRunningCase(int index)
+    {
+    CStartedTestCase* startedCase = (CStartedTestCase*) index;
+    return model->GetRunningCase(startedCase);
+    }
+
 bool StfQtUIController::ShowOutput()
     {
     return isShowOutput;
@@ -297,7 +324,7 @@
 void StfQtUIController::FireOnCaseOutputChanged(
         IStfEventListener::CaseOutputCommand cmd, int index, QString msg)
     {
-    if (ShowOutput())
+    if (true)//ShowOutput
         {
         foreach(IStfEventListener* listener, listenerList)
                 {
--- a/stifui/qt/src/stfqtuimodel.cpp	Tue May 11 16:14:15 2010 +0300
+++ b/stifui/qt/src/stfqtuimodel.cpp	Wed Jun 09 09:42:37 2010 +0300
@@ -65,6 +65,11 @@
     FireOnRunningCaseChangedEvent();
     }
 
+CSTFCase StfQtUIModel::GetRunningCase(const CStartedTestCase* startedCase)
+    {
+    return runningCaseList.value(startedCase);
+    }
+
 void StfQtUIModel::AddCaseByStatus(const TSTFCaseStatusType& type, const CSTFCase& aCase)
     {
     switch (type)
--- a/stifui/qt/src/stifexecutor.cpp	Tue May 11 16:14:15 2010 +0300
+++ b/stifui/qt/src/stifexecutor.cpp	Wed Jun 09 09:42:37 2010 +0300
@@ -21,25 +21,41 @@
 #include <f32file.h>
 #include <HAL.h>
 #include <hal_data.h>
-#include <stiflogger.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)
     {
-//    __LOG(_L("started"));
+    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());
-//    __LOG1(_L("CUIStoreIf ConstructL, result=%d"), result);
+    iLog->Log(_L("CUIStoreIf ConstructL, result=%d"), result);
     if (result != KErrNone)
         {
         return;
         }
     TRAP(result, iBuffer = HBufC::NewL(500));
-//    __LOG1(_L("Create Case Execution output buffer, result=%d"), result);
+    iLog->Log(_L("Create Case Execution output buffer, result=%d"), result);
 
     }
 
@@ -52,13 +68,13 @@
         delete listenerList;
         listenerList = NULL;
         }
-//    __LOG(_L("finished"));
+    iLog->Log(_L("finished"));
     }
 
 bool CStifExecutor::OpenIniFile(const QString& filename)
     {
     TInt result = UIStore().Open(QString2TPtrC(filename));
-//    __LOG2(_L("Open ini file %s.result=%d"),QString2TPtrC(filename).Ptr(),result);
+    iLog->Log(_L("Open ini file %s.result=%d"),QString2TPtrC(filename).Ptr(),result);
     return (result == KErrNone);
     }
 
@@ -78,10 +94,22 @@
     //#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)
     {
-//    __LOG(_L("AddStifCaseUpdateListener"));
+    iLog->Log(_L("AddStifCaseUpdateListener"));
     if (!listenerList)
         {
         listenerList = new QList<IStifCaseUpdateListener*> ();
@@ -95,7 +123,7 @@
 void CStifExecutor::RemoveStifCaseUpdateListener(
         IStifCaseUpdateListener* listener)
     {
-//    __LOG(_L("RemoveStifCaseUpdateListener"));
+    iLog->Log(_L("RemoveStifCaseUpdateListener"));
     if (!listenerList)
         {
         return;
@@ -112,13 +140,15 @@
     {
     QList<CSTFModule> list;
     RRefArray<TDesC> modules;
-//    __LOG(_L("GetModuleList"));
+    iLog->Log(_L("GetModuleList"));
     TInt ret = UIStore().Modules(modules);
-//    __LOG1(_L("LoadAllModules %d"), ret);
-//    __LOG1(_L("Modules number=%d"), modules.Count());
+    iLog->Log(_L("LoadAllModules %d"), ret);
+    iLog->Log(_L("Modules number=%d"), modules.Count());
     for (TInt i = 0; i < modules.Count(); i++)
         {
-//        __LOG1(_L("Get Module Names %d"), 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()));
@@ -136,10 +166,11 @@
     QList<CSTFCase> list;
     RRefArray<CTestInfo> testCases;
     TInt ret = UIStore().TestCases(testCases, name, KNullDesC);
-//    __LOG1(_L("Get TestCases: %d"), ret);
+    iLog->Log(_L("Get TestCases: %d"), ret);
     for (TInt i = 0; i < testCases.Count(); i++)
         {
-//       __LOG1(_L("Case Number: %d"),testCases[i].TestCaseNum());
+        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);
@@ -152,20 +183,20 @@
 
 void CStifExecutor::ExecuteSingleCase(const QString& moduleName, const int caseIndex)
     {
-//    __LOG(_L("ExecuteCase start"));
+    iLog->Log(_L("ExecuteCase start"));
     TPtrC name = QString2TPtrC(moduleName);
     RRefArray<CTestInfo> testCases;
     TInt ret = UIStore().TestCases(testCases, name, KNullDesC);
-//    __LOG1(_L("Get TestCases return code=%d"), ret);
+    iLog->Log(_L("Get TestCases return code=%d"), ret);
     if (testCases.Count() > caseIndex)
         {
         TInt index;
         UIStore().StartTestCase(testCases[caseIndex], index);
-//        __LOG1(_L("start test case index=%d"), index);
+        iLog->Log(_L("start test case index=%d"), index);
         }
     testCases.Reset();
     testCases.Close();
-//    __LOG(_L("ExecuteCase end"));
+    iLog->Log(_L("ExecuteCase end"));
 
     }
 
@@ -174,7 +205,7 @@
     QList<QString> list;
     RRefArray<TDesC> aArray;
     TInt ret = UIStore().GetTestSetsList(aArray);
-//    __LOG1(_L("Get TestSet list return code=%d"), ret);
+    iLog->Log(_L("Get TestSet list return code=%d"), ret);
     if (ret != KErrNone) //setInfos.Count() != 1
         {
         return list;
@@ -190,28 +221,28 @@
 
 QList<CSTFCase> CStifExecutor::GetCaseListFromSet(const QString& setName)
     {
-//    __LOG(_L("GetCaseListFromSet start."));
+    iLog->Log(_L("GetCaseListFromSet start."));
     QList<CSTFCase> list;
     TPtrC name = QString2TPtrC(setName);
 
-    //__LOG(name);
+    //iLog->Log(name);
     if (name.Length() == 0)
         {
         return list;
         }
 
-//    __LOG1(_L("name.Length()=%d"), name.Length());
+    iLog->Log(_L("name.Length()=%d"), name.Length());
     TInt ret = UIStore().LoadTestSet(name);
-//    __LOG1(_L("Load Test Set return=%d"),ret);
+    iLog->Log(_L("Load Test Set return=%d"),ret);
     const CTestSetInfo* set = NULL;
     TRAP(ret , set = &UIStore().TestSetL(name));
-//    __LOG(_L("GetCaseListFromSet TestSetL."));
+    iLog->Log(_L("GetCaseListFromSet TestSetL."));
     if(ret != KErrNone)
         {
         return list;
         }
     const RRefArray<const CTestInfo>& testCases = set->TestCases();
-//    __LOG(_L("GetCaseListFromSet TestCases."));
+    iLog->Log(_L("GetCaseListFromSet TestCases."));
     TInt count = testCases.Count();
     for (TInt i = 0; i < count; i++)
         {
@@ -221,58 +252,73 @@
         testcase.SetModuleName(TDesC2QString(testCases[i].ModuleName()));
         list.append(testcase);
         }
-//    __LOG(_L("GetCaseListFromSet end."));
+    iLog->Log(_L("GetCaseListFromSet end."));
     return list;
     }
 
-void CStifExecutor::CreateSet(const QString& setName)
+bool CStifExecutor::CreateSet(const QString& setName)
     {
     TPtrC name = QString2TPtrC(setName);
     TInt ret = UIStore().CreateTestSet(name);
-//    __LOG1(_L("CreateSet return: %d"), ret);
-//    ret = UIStore().LoadTestSet(name);
-//    __LOG1(_L("Load Set after CreateSet return: %d"), ret);
-        
-        
+    return LogResult(ret, "CreateSet");
     }
 
-void CStifExecutor::SaveSet(QString& setName)
+bool CStifExecutor::SaveSet(QString& setName)
     {
     TPtrC name = QString2TPtrC(setName);
     TFileName testSetName;
     testSetName.Copy(name);
-    TInt ret = UIStore().SaveTestSet(testSetName);
+    TInt ret = UIStore().SaveTestSet2(testSetName);
     setName = TDesC2QString(testSetName);
-//    __LOG1(_L("SaveSet return: %d"),ret);
+    return LogResult(ret, "SaveSet");
     }
 
-void CStifExecutor::RemoveSet(const QString& setName)
+bool CStifExecutor::RemoveSet(const QString& setName)
     {
     //This method wil not work at this stage.
     TPtrC name = QString2TPtrC(setName);
-    UIStore().RemoveTestSet(name);
+    TInt ret = UIStore().RemoveTestSet(name);
+    return LogResult(ret, "RemoveSet");
     }
 
-void CStifExecutor::AddtoSet(const QString& setName, CSTFCase& caseInfo)
+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);
-//    __LOG1(_L("Get TestCases: %d"), ret);
+    if(!LogResult(ret, "AddToSet, GetTestCases"))
+        {
+        return false;
+        }
+    
+    ret = -1;
     for (TInt i = 0; i < testCases.Count(); i++)
         {
-//        __LOG1(_L("Case Number: %d"),testCases[i].TestCaseNum());
-        if (TDesC2QString(testCases[i].TestCaseTitle()) == caseInfo.Name()
-                && testCases[i].TestCaseNum() == caseInfo.Index())
+        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]);
-//            __LOG1(_L("AddToTestSet: %d"), ret);
+            iLog->Log(_L("AddToTestSet: %d"), ret);
             break;
             }
         }
     testCases.Reset();
     testCases.Close();
+    return LogResult(ret, "AddToSet");
     }
 
 void CStifExecutor::ExecuteSet(const QString& SetName, const int startIndex,
@@ -287,25 +333,25 @@
     TInt ret;
     TBuf<30> test;
     test.Append(QString2TPtrC(SetName));
-//    __LOG(_L("StartTestSet GetSetName:"));
-//    __LOG(test);
+    iLog->Log(_L("StartTestSet GetSetName:"));
+    iLog->Log(test);
     TRAP(ret, set = &UIStore().TestSetL(test));
             
     //const CTestSetInfo& set = UIStore().TestSetL(QString2TPtrC(SetName));
     if(ret != KErrNone)
         {
-//        __LOG1(_L("StartTestSet GetTestSet Error return=%d"),ret);
+        iLog->Log(_L("StartTestSet GetTestSet Error return=%d"),ret);
         return;
         }
     int a = startIndex;
     ret = UIStore().StartTestSet(*set, a, setType);
-//    __LOG1(_L("StartTestSet return=%d"),ret);
+    iLog->Log(_L("StartTestSet return=%d"),ret);
     }
 
 void CStifExecutor::Update(CStartedTestCase* aCase, int flags)
     {
-//    __LOG1(_L("CStifExecutor::Update return case=%d"),aCase);
-//    __LOG1(_L("CStifExecutor::Update return status=%d"),flags);
+    iLog->Log(_L("CStifExecutor::Update return case=%d"),aCase);
+    iLog->Log(_L("CStifExecutor::Update return status=%d"),flags);
     
     if(aCase == NULL)
         {
@@ -328,8 +374,8 @@
             buffer.Append(_L("\r\n"));
             }
         QString msg = TDesC2QString(buffer);
-//        __LOG(_L("Get output msg:"));
-//        __LOG(buffer);
+        iLog->Log(_L("Get output msg:"));
+        iLog->Log(buffer);
         if (listenerList)
             {
             for (int i = 0; i < listenerList->size(); i++)
--- a/stifui/qt/src/uisetting.cpp	Tue May 11 16:14:15 2010 +0300
+++ b/stifui/qt/src/uisetting.cpp	Wed Jun 09 09:42:37 2010 +0300
@@ -40,6 +40,11 @@
         {
         value = settingList.value(item);
         }
+    else
+        {
+        value = getDefaultValue(item);
+        settingList.insert(item, value);
+        }
     return value;
     }
 
@@ -58,10 +63,24 @@
 void UiSetting::loadDefault()
     {
     settingList.clear();
-    settingList.insert("showoutput", "true");
+    settingList.insert(KShowOutput, getDefaultValue(KShowOutput));
+    settingList.insert(KStyleSheet, getDefaultValue(KStyleSheet));
     //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";
+        }
+    return result;
+    }
 
 bool UiSetting::load()
     {
@@ -75,7 +94,7 @@
     int index;
     while(!in.atEnd())
         {
-        line = in.readLine().trimmed().toLower();
+        line = in.readLine().trimmed();
         if(!line.startsWith("//"))
             {
             index = line.indexOf("=");
--- a/stifui/qt/stifqtui.pro	Tue May 11 16:14:15 2010 +0300
+++ b/stifui/qt/stifqtui.pro	Wed Jun 09 09:42:37 2010 +0300
@@ -1,20 +1,16 @@
-#
 # Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
 # All rights reserved.
 # This component and the accompanying materials are made available
 # under the terms of "Eclipse Public License v1.0"
 # which accompanies 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.              
-#
-
-HEADERS += inc\version.h \
+# Description: QT project file.
+TARGET = STFUI
+HEADERS += inc/dlgsetselector.h \
+    inc\version.h \
     inc\frmmain.h \
     inc\istfqtuicontroller.h \
     inc\stfqtuicontroller.h \
@@ -25,16 +21,16 @@
     inc\dlgoutput.h \
     inc\uisetting.h \
     inc\dlgsetting.h \
-   
-SOURCES += src\frmmain.cpp \
+    inc\uiversion.h
+SOURCES += 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 += 
+    src\dlgsetting.cpp
+RESOURCES += resource\StfQtUI.qrc
 symbian { 
     TARGET.UID3 = 0x2002BCA0
     TARGET.EPOCALLOWDLLDATA = 1
@@ -46,21 +42,15 @@
     INCLUDEPATH += /epoc32/include/domain/osextensions/stif
     HEADERS += inc\stifexecutor.h
     SOURCES += src\stifexecutor.cpp
-    LIBS += -leuser \
-        -lefsrv \
-        -lstiftestinterface \
-        -lstiftfwif \
-        -lstiftestengine \
-        -lecons \
-        -lhal \
-        -lflogger
+    LIBS += -lstiftfwif \
+        -lstiftestinterface
     TARGET.CAPABILITY = AllFiles \
         CommDD
     
     # Export headers to SDK Epoc32/include directory
     deploy.path = $$EPOCROOT
-    exportheaders.sources = $$PUBLIC_HEADERS
-    exportheaders.path = epoc32/include
-    for(header, exportheaders.sources)
-    :BLD_INF_RULES.prj_exports += "$$header $$deploy.path$$exportheaders.path/$$basename(header)"
+    #exportheaders.sources = $$PUBLIC_HEADERS
+    #exportheaders.path = epoc32/include
+    #for(header, exportheaders.sources)
+    #:BLD_INF_RULES.prj_exports += "$$header $$deploy.path$$exportheaders.path/$$basename(header)"
 }