Catchup to latest Symbian^4 GCC_SURGE
authorWilliam Roberts <williamr@symbian.org>
Thu, 22 Jul 2010 16:33:59 +0100
branchGCC_SURGE
changeset 37 c20154ccf3c0
parent 20 ba8a586c45f1 (current diff)
parent 35 98924d2efce9 (diff)
Catchup to latest Symbian^4
creator/engine/inc/creator_virtualphonebook.h
creator/engine/src/creator_virtualphonebook.cpp
filebrowser/ui/inc/filebrowsermainwindow.h
filebrowser/ui/inc/filebrowsermodel.h
filebrowser/ui/inc/filebrowserview.h
filebrowser/ui/src/filebrowsermainwindow.cpp
filebrowser/ui/src/filebrowsermodel.cpp
filebrowser/ui/src/filebrowserview.cpp
htiui/HtiAdmin/data/1020DEB6.rss
loadgen/rom/loadgen.iby
stifui/qt/sis/stifqtui.sisx
--- a/creator/creator.pro	Fri Jun 11 16:29:34 2010 +0100
+++ b/creator/creator.pro	Thu Jul 22 16:33:59 2010 +0100
@@ -1,19 +1,3 @@
-#
-# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-# All rights reserved.
-# This component and the accompanying materials are made available
-# under the terms of "Eclipse Public License v1.0"
-# which accompanies 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 = Creator
 
@@ -33,18 +17,12 @@
 	src/notifications.cpp
 
 symbian: {
-
+        INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE
 	HEADERS += engine/inc/creator.hrh \
-			engine/inc/creator_accesspoint.h \
-			engine/inc/creator_browser.h \
-			engine/inc/creator_browserelement.h \
 			engine/inc/creator_calendar.h \
 			engine/inc/creator_calendarbase.h \
 			engine/inc/creator_calendarelement.h \
 			engine/inc/creator_cmdscriptrun.h \
-			engine/inc/creator_connectionmethod.h \
-			engine/inc/creator_connectionmethodbase.h \
-			engine/inc/creator_connectionmethodelement.h \
 			engine/inc/creator_contactelement.h \
 			engine/inc/creator_contactsetcache.h \
 			engine/inc/creator_factory.h \
@@ -60,7 +38,10 @@
 			engine/inc/creator_messageelement.h \
 			engine/inc/creator_modulebase.h \
 			engine/inc/creator_note.h \
+			engine/inc/creator_notepadwrapper.h \
 			engine/inc/creator_phonebook.h \
+			engine/inc/creator_phonebookwrapper.h \
+			engine/inc/creator_phonebookapi.h \
 			engine/inc/creator_phonebookbase.h \
 			engine/inc/creator_randomdatafield.h \
 			engine/inc/creator_randomdataparser.h \
@@ -71,18 +52,13 @@
 			engine/inc/creator_std.h \
 			engine/inc/creator_traces.h \
 			engine/inc/creator_wepsecuritysettings.h \
-			engine/inc/randomData.txt \
+			engine/inc/randomdata.txt \
 			inc/engine.h \
 			inc/enginewrapper.h
 
-	SOURCES += engine/src/creator_accesspoint.cpp \
-			engine/src/creator_browser.cpp \
-			engine/src/creator_browserelement.cpp \
-			engine/src/creator_calendar.cpp \
+	SOURCES += engine/src/creator_calendar.cpp \
 			engine/src/creator_calendarelement.cpp \
 			engine/src/creator_cmdscriptrun.cpp \
-			engine/src/creator_connectionmethod.cpp \
-			engine/src/creator_connectionmethodelement.cpp \
 			engine/src/creator_contactelement.cpp \
 			engine/src/creator_contactsetcache.cpp \
 			engine/src/creator_factory.cpp \
@@ -97,7 +73,10 @@
 			engine/src/creator_message.cpp \
 			engine/src/creator_messageelement.cpp \
 			engine/src/creator_note.cpp \
+			engine/src/creator_notepadwrapper.cpp \
 			engine/src/creator_phonebook.cpp \
+			engine/src/creator_phonebookwrapper.cpp \
+			engine/src/creator_phonebookapi.cpp \
 			engine/src/creator_phonebookbase.cpp \
 			engine/src/creator_randomdataparser.cpp \
 			engine/src/creator_scriptelement.cpp \
@@ -116,7 +95,6 @@
 			-lapparc \
 			-lcone \ 
 			-lcntmodel \
-			-lfavouritesengine \
 			-lmsgs \
 			-llogwrap \
 			-llogcli \
@@ -155,11 +133,9 @@
 			-lbitmaptransforms \
 			-lcmmanager \
 			-lcmmanagerdatabase \
-			-lapengine \
 			-lnoteseditor \
 			-lxqservice \
 		    -lQtContacts \
-		    -lmobcntmodel \ 
 			-lagendainterface 
 
 	creatorDataBlock = \
--- a/creator/data/datacreator.rss	Fri Jun 11 16:29:34 2010 +0100
+++ b/creator/data/datacreator.rss	Thu Jul 22 16:33:59 2010 +0100
@@ -1,20 +1,3 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies 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 ORBT
 
 #include <appinfo.rh>
--- a/creator/engine/inc/creator_accesspoint.h	Fri Jun 11 16:29:34 2010 +0100
+++ b/creator/engine/inc/creator_accesspoint.h	Thu Jul 22 16:33:59 2010 +0100
@@ -28,11 +28,11 @@
 
 #include <e32base.h>
 #include <commdb.h>
-#include <apselect.h>
-#include <apdatahandler.h>
-#include <apaccesspointitem.h>
-#include <aputils.h>
-#include <apengineconsts.h>
+//#include <ApSelect.h>
+//#include <ApDataHandler.h>
+//#include <ApAccessPointItem.h>
+//#include <ApUtils.h>
+//#include <ApEngineConsts.h>
 #include <msvapi.h>
 #include <mtclreg.h>
 #include <mmsclient.h>
@@ -57,8 +57,8 @@
     void HandleSessionEventL(TMsvSessionEvent aEvent, TAny* aArg1, TAny* aArg2, TAny* aArg3); // from MMsvSessionObserver
 
 public:
-    TBool AskDataFromUserL(TInt aCommand, TInt& aNumberOfEntries); // from MCreatorModuleBase
-
+    TBool AskDataFromUserL( TInt aCommand ); // from MCreatorModuleBase
+    
     TInt CreateConnectionSettingsEntryL(CCreatorModuleBaseParameters *aParameters);    
     TUint32 AccessPointNameToIdL(const TDesC& aAPName, TBool aAnyIfNotFound = EFalse );
     
--- a/creator/engine/inc/creator_browser.h	Fri Jun 11 16:29:34 2010 +0100
+++ b/creator/engine/inc/creator_browser.h	Thu Jul 22 16:33:59 2010 +0100
@@ -26,9 +26,9 @@
 #include "creator_modulebase.h"
 
 #include <e32base.h>
-#include <favouritesitem.h>
-#include <favouritesdb.h>
-#include <favouritesfile.h>
+//#include <FavouritesItem.h>
+//#include <FavouritesDb.h>
+//#include <FavouritesFile.h>
 
 
 
@@ -36,7 +36,7 @@
 class CBrowserParameters;
 
 
-class CCreatorBrowser : public CBase, public MCreatorModuleBase
+class CCreatorBrowser : public CCreatorModuleBase
     {
 public: 
     static CCreatorBrowser* NewL(CCreatorEngine* aEngine);
@@ -48,7 +48,8 @@
     void ConstructL(CCreatorEngine* aEngine); // from MCreatorModuleBase
 
 public:
-    TBool AskDataFromUserL(TInt aCommand, TInt& aNumberOfEntries); // from MCreatorModuleBase
+    TBool AskDataFromUserL( TInt aCommand ); // from MCreatorModuleBase
+
     TInt CreateBookmarkEntryL(CBrowserParameters *aParameters);    
     TInt CreateBookmarkFolderEntryL(CBrowserParameters *aParameters);
     TInt CreateSavedDeckEntryL(CBrowserParameters *aParameters); 
--- a/creator/engine/inc/creator_calendar.h	Fri Jun 11 16:29:34 2010 +0100
+++ b/creator/engine/inc/creator_calendar.h	Thu Jul 22 16:33:59 2010 +0100
@@ -46,6 +46,16 @@
 
 class CCreatorInterimCalendar : public CCreatorCalendarBase, public MCalProgressCallBack
     {
+enum TCreatorCalendarStatus{
+    ECreatorCalendarDelete = 0,
+    ECreatorCalendarStart, 
+    ECreatorCalendarGetWeeklyEntries,
+    ECreatorCalendarGetAttendies,
+    ECreatorCalendarGetStartDate,
+    ECreatorCalendarGetEndDate, 
+    ECreatorCalendarAddDefaultAlarm
+};
+
 public: 
     static CCreatorInterimCalendar* NewL(CCreatorEngine* aEngine);
     static CCreatorInterimCalendar* NewLC(CCreatorEngine* aEngine);
@@ -63,8 +73,9 @@
     void SetOrganizerL(CCalEntry& aCalEntry, CCalenderInterimParameters* parameters );
     
 public:
-    TBool AskDataFromUserL(TInt aCommand, TInt& aNumberOfEntries); // from MCreatorModuleBase
-
+    TBool AskDataFromUserL( TInt aCommand ); // from MCreatorModuleBase
+    void QueryDialogClosedL(TBool aPositiveAction, TInt aUserData); //from MUIObserver
+    
     TInt CreateAppointmentEntryL(CCreatorModuleBaseParameters *aParameters);    
     TInt CreateEventEntryL(CCreatorModuleBaseParameters *aParameters);
     TInt CreateAnniversaryEntryL(CCreatorModuleBaseParameters *aParameters); 
--- a/creator/engine/inc/creator_calendarbase.h	Fri Jun 11 16:29:34 2010 +0100
+++ b/creator/engine/inc/creator_calendarbase.h	Thu Jul 22 16:33:59 2010 +0100
@@ -25,7 +25,7 @@
 
 class CCreatorModuleBaseParameters;
 
-class CCreatorCalendarBase : public CBase, public MCreatorModuleBase{
+class CCreatorCalendarBase : public CCreatorModuleBase{
 public:
 
 
--- a/creator/engine/inc/creator_cmdscriptrun.h	Fri Jun 11 16:29:34 2010 +0100
+++ b/creator/engine/inc/creator_cmdscriptrun.h	Thu Jul 22 16:33:59 2010 +0100
@@ -21,7 +21,7 @@
 
 #include "engine.h"
 
-class CCreatorCmdScriptRun : public MBeating
+class CCreatorCmdScriptRun : public CBase, public MBeating
     {
 public:
 
@@ -39,7 +39,7 @@
 private:
     CCreatorCmdScriptRun();
     void ConstructL(CCreatorEngine* aEngine);
-	void Tick();
+	void TickL();
 	
 private:
     CCreatorEngine* iEngine;
@@ -56,4 +56,4 @@
 	TInt iTickCount;
     };
 	
-#endif // __CREATORCMDSCRIPTRUN_H__	
\ No newline at end of file
+#endif // __CREATORCMDSCRIPTRUN_H__	
--- a/creator/engine/inc/creator_connectionmethod.h	Fri Jun 11 16:29:34 2010 +0100
+++ b/creator/engine/inc/creator_connectionmethod.h	Thu Jul 22 16:33:59 2010 +0100
@@ -55,7 +55,7 @@
     void HandleSessionEventL(TMsvSessionEvent aEvent, TAny* aArg1, TAny* aArg2, TAny* aArg3); // from MMsvSessionObserver
         
 public:
-    TBool AskDataFromUserL(TInt aCommand, TInt& aNumberOfEntries); // from MCreatorModuleBase
+    TBool AskDataFromUserL( TInt aCommand ); // from MCreatorModuleBase
     
     TInt CreateConnectionSettingsEntryL(CCreatorModuleBaseParameters *aParameters);    
     TUint32 AccessPointNameToIdL(const TDesC& aAPName, TBool aAnyIfNotFound = EFalse );
--- a/creator/engine/inc/creator_connectionmethodbase.h	Fri Jun 11 16:29:34 2010 +0100
+++ b/creator/engine/inc/creator_connectionmethodbase.h	Thu Jul 22 16:33:59 2010 +0100
@@ -27,7 +27,7 @@
 
 const TUint KRandomBearerType = 0xEEEEEEEE;
 
-class CCreatorConnectionSettingsBase : public CBase, public MCreatorModuleBase
+class CCreatorConnectionSettingsBase : public CCreatorModuleBase
     {
 public:
     
--- a/creator/engine/inc/creator_contactsetcache.h	Fri Jun 11 16:29:34 2010 +0100
+++ b/creator/engine/inc/creator_contactsetcache.h	Thu Jul 22 16:33:59 2010 +0100
@@ -31,6 +31,11 @@
 public:
     static CCreatorContactSet* NewL(TInt aLinkId, TInt aNumOfExistingContacts);
     virtual ~CCreatorContactSet();
+    void AppendL(TUint32);
+    TInt NumberOfExistingContacts() const;
+    RArray<TUint32> ContactLinks();
+    const RArray<TUint32> ContactLinks() const;
+
     TInt LinkId() const;
 
 private:
@@ -38,12 +43,15 @@
     //void ConstructL();
     TInt iLinkId;
     TInt iNumOfExistingContacts;
+    RArray<TUint32> iContactLinks;
 };
 
 class MContactLinkCache
 {
 public:
     virtual void AppendL(CCreatorContactSet* aContactSet) = 0;
+    virtual RArray<TUint32> ContactLinks(TInt aLinkId) = 0;
+    virtual const RArray<TUint32> ContactLinks(TInt aLinkId) const = 0;    
     virtual RPointerArray<CCreatorContactSet>& ContactSets() = 0;
     virtual const RPointerArray<CCreatorContactSet>& ContactSets() const = 0;
     virtual const CCreatorContactSet& ContactSet(TInt aLinkId) const = 0;
--- a/creator/engine/inc/creator_factory.h	Fri Jun 11 16:29:34 2010 +0100
+++ b/creator/engine/inc/creator_factory.h	Thu Jul 22 16:33:59 2010 +0100
@@ -25,7 +25,7 @@
 
 class CCreatorEngine;
 class CCreatorPhonebookBase;
-class CCreatorConnectionSettingsBase;
+//class CCreatorConnectionSettingsBase;
 
 
 class TCreatorFactory{
@@ -34,8 +34,8 @@
 	static CCreatorPhonebookBase* CreatePhoneBookL(CCreatorEngine* aEngine);
 	static CCreatorModuleBaseParameters* CreatePhoneBookParametersL();
 
-    static CCreatorConnectionSettingsBase* CreateConnectionSettingsL(CCreatorEngine* aEngine);
-    static CCreatorModuleBaseParameters* CreateConnectionSettingsParametersL();
+//    static CCreatorConnectionSettingsBase* CreateConnectionSettingsL(CCreatorEngine* aEngine);
+//    static CCreatorModuleBaseParameters* CreateConnectionSettingsParametersL();
 	
 
 };
--- a/creator/engine/inc/creator_file.h	Fri Jun 11 16:29:34 2010 +0100
+++ b/creator/engine/inc/creator_file.h	Thu Jul 22 16:33:59 2010 +0100
@@ -38,8 +38,16 @@
 class CDRMPermission;
 class CDRMConstraint;
 
-class CCreatorFiles : public CBase, public MCreatorModuleBase
+class CCreatorFiles : public CCreatorModuleBase
     {
+enum TCreatorFilesState{
+    ECreatorFilesDelete,
+    ECreatorFilesStart,
+    ECreatorFilesGetDirectory,
+    ECreatorFilesAskDRMData,
+    ECreatorFilesAskDRM_CD_Counts,
+    ECreatorFilesAskDRM_CD_Minutes
+};
 public: 
     static CCreatorFiles* NewL(CCreatorEngine* aEngine);
     static CCreatorFiles* NewLC(CCreatorEngine* aEngine);
@@ -50,7 +58,8 @@
     void ConstructL(CCreatorEngine* aEngine); // from MCreatorModuleBase
 
 public:
-    TBool AskDataFromUserL(TInt aCommand, TInt& aNumberOfEntries); // from MCreatorModuleBase
+    TBool AskDataFromUserL( TInt aCommand ); // from MCreatorModuleBase
+    void QueryDialogClosedL(TBool aPositiveAction, TInt aUserData); //from MUIObserver
     TInt CreateFileEntryL(CFilesParameters *aParameters, TInt aCommand);    
     void DeleteAllL();
     void DeleteAllCreatedByCreatorL();
@@ -61,14 +70,13 @@
     void SetPermissionsL( CMetaDataArray* aMetaData, const TDesC& aOutFileName, CFilesParameters *aParameters );
     void SetMimeTypeL( const TDesC& aFileName, TDes8& aMime, CFilesParameters *aParameters );
     TBool AskDRMDataFromUserL();
-    TBool AskDRMCDDataFromUserL();
     void StorePathsForDeleteL( CDesCArray& aPaths );
     void GenerateFileNameL( TFileName& aRootName );
     
 private:
     CFilesParameters* iParameters;
     CFilesParameters* iUserParameters;
-    HBufC* iDirectoryQueriedFromUser;
+    TFileName iDirectoryQueriedFromUser;
     RFs& iFs;
     RApaLsSession iApaLs;
     CDesCArray* iFilePaths;
--- a/creator/engine/inc/creator_landmark.h	Fri Jun 11 16:29:34 2010 +0100
+++ b/creator/engine/inc/creator_landmark.h	Thu Jul 22 16:33:59 2010 +0100
@@ -25,7 +25,7 @@
 #include "creator_modulebase.h"
 
 #include <e32base.h>
-#include <epos_landmarks.h>
+#include <EPos_Landmarks.h>
 
 class CLandmarkParameters;
 class CPosLandmarkDatabase;
@@ -33,7 +33,7 @@
 
 static const TInt KLandmarkFieldLength = 256;
 
-class CCreatorLandmarks : public CBase, public MCreatorModuleBase
+class CCreatorLandmarks : public CCreatorModuleBase
     {
 public: 
     static CCreatorLandmarks* NewL(CCreatorEngine* aEngine);
@@ -46,7 +46,8 @@
     TPosLmItemId GetCategoryIdL( TPosLmGlobalCategory aGlobalCategoryID );
 
 public:
-    TBool AskDataFromUserL(TInt aCommand, TInt& aNumberOfEntries); // from MCreatorModuleBase
+    TBool AskDataFromUserL( TInt aCommand ); // from MCreatorModuleBase
+    
     TInt CreateLandmarkEntryL(CLandmarkParameters *aParameters);
     static TPosLmGlobalCategory GetCategoryIdL(const TDesC& aCategoryStr);
     void DeleteAllL();
--- a/creator/engine/inc/creator_log.h	Fri Jun 11 16:29:34 2010 +0100
+++ b/creator/engine/inc/creator_log.h	Thu Jul 22 16:33:59 2010 +0100
@@ -39,8 +39,13 @@
 class CLogsParameters;
 
 
-class CCreatorLogs : public CActive, public MCreatorModuleBase
+class CCreatorLogs : public CActive, public MCreatorModuleBase, public MUIObserver
     {
+enum TCreatorLogsStatus{
+    ECreatorLogsDelete = 0,
+    ECreatorLogsStart
+};
+
 public: 
     static CCreatorLogs* NewL(CCreatorEngine* aEngine);
     static CCreatorLogs* NewLC(CCreatorEngine* aEngine);
@@ -54,8 +59,9 @@
 	void DoCancel();  // from CActive
 
 public:
-    TBool AskDataFromUserL(TInt aCommand, TInt& aNumberOfEntries); // from MCreatorModuleBase
-
+    TBool AskDataFromUserL( TInt aCommand ); // from MCreatorModuleBase
+    void QueryDialogClosedL(TBool aPositiveAction, TInt aUserData);    
+    
     TInt CreateMissedCallEntryL(CLogsParameters *aParameters);    
     TInt CreateReceivedCallEntryL(CLogsParameters *aParameters);
     TInt CreateDialledNumberEntryL(CLogsParameters *aParameters);
@@ -63,6 +69,11 @@
     void DeleteAllCreatedByCreatorL();
 
 private:
+    CCreatorEngine* iEngine;
+    TInt iCommand;
+    TInt iEntriesToBeCreated;
+    TInt iDummy;
+
     CLogClient* iLogClient;
     CLogEvent* iLogEvent;
     CActiveSchedulerWait iLogWriteWait;
--- a/creator/engine/inc/creator_mailbox.h	Fri Jun 11 16:29:34 2010 +0100
+++ b/creator/engine/inc/creator_mailbox.h	Thu Jul 22 16:33:59 2010 +0100
@@ -28,11 +28,11 @@
 
 #include <e32base.h>
 #include <SenduiMtmUids.h>
-#include <SMTPSET.h>
+#include <smtpset.h>
 #include <imapset.h>
-#include <POP3SET.h>
+#include <pop3set.h>
 #include <mtmuibas.h>
-#include <IAPPrefs.h>
+#include <iapprefs.h>
 #include <cemailaccounts.h>
 
 class CCreatorEngine;
@@ -46,7 +46,7 @@
     EMailboxIMAP4
     };
 
-class CCreatorMailboxes : public CBase, public MCreatorModuleBase, public MMsvSessionObserver
+class CCreatorMailboxes : public CCreatorModuleBase, public MMsvSessionObserver
     {
 public: 
     static CCreatorMailboxes* NewL(CCreatorEngine* aEngine);
@@ -81,7 +81,8 @@
 
 
 public:
-    TBool AskDataFromUserL(TInt aCommand, TInt& aNumberOfEntries); // from MCreatorModuleBase
+    TBool AskDataFromUserL( TInt aCommand ); // from MCreatorModuleBase
+    
     TInt CreateMailboxEntryL(CMailboxesParameters *aParameters);
     void DeleteAllL();
     void DeleteAllCreatedByCreatorL();
--- a/creator/engine/inc/creator_mailboxelement.h	Fri Jun 11 16:29:34 2010 +0100
+++ b/creator/engine/inc/creator_mailboxelement.h	Thu Jul 22 16:33:59 2010 +0100
@@ -23,6 +23,8 @@
 
 #include "creator_scriptelement.h"
 
+class CMailboxesParameters;
+
 namespace creatormailbox
 {
     _LIT(Kmailbox, "mailbox");
--- a/creator/engine/inc/creator_message.h	Fri Jun 11 16:29:34 2010 +0100
+++ b/creator/engine/inc/creator_message.h	Thu Jul 22 16:33:59 2010 +0100
@@ -89,8 +89,18 @@
     HBufC* iEmailAddress;
 };
 
-class CCreatorMessages : public CBase, public MCreatorModuleBase, public MMsvSessionObserver
+class CCreatorMessages : public CCreatorModuleBase, public MMsvSessionObserver
     {
+enum TCreatorMessagesStatus{
+    ECreatorMessagesDelete = 0,
+    ECreatorMessagesStart, 
+    ECreatorMessagesMessageType,
+    ECreatorMessagesFolderType,
+    ECreatorMessagesMessageStatus, 
+    ECreatorMessagesCharsInBody,
+    ECreatorMessagesAttachment,
+};
+
 public: 
     static CCreatorMessages* NewL(CCreatorEngine* aEngine);
     static CCreatorMessages* NewLC(CCreatorEngine* aEngine);
@@ -121,8 +131,8 @@
                                 TInt aNumOfExistingAddresses );
     
     void GetAllRecipientsL(RPointerArray<HBufC>& aRecipientArray, const CMessagesParameters& aParameters, TBool aUseEmailAddress );
-    void SetSenderToEntryDetails(TMsvEntry& aMsgEntry, const CMessagesParameters& aParameters, TBool aUseEmailAddress);
-    void SetRecipientToEntryDetails(TMsvEntry& aMsgEntry, const CMessagesParameters& aParameters, TBool aUseEmailAddress);
+    void SetSenderToEntryDetailsL(TMsvEntry& aMsgEntry, const CMessagesParameters& aParameters, TBool aUseEmailAddress);
+    void SetRecipientToEntryDetailsL(TMsvEntry& aMsgEntry, const CMessagesParameters& aParameters, TBool aUseEmailAddress);
     void AddSenderToMtmAddresseeL(CBaseMtm& aMtm, const CMessagesParameters& aParameters, TBool aUseEmailAddress );
     void AddMtmSenderL(CMmsClientMtm& aMtm, const CMessagesParameters& aParameters, TBool aUseEmailAddress );
     void GetSendersL(RPointerArray<HBufC>& aSenderArray, const CMessagesParameters& aParameters, TBool aUseEmailAddress, TInt aMaxNum );
@@ -130,8 +140,9 @@
     void DeleteAllFromFolderL( const TMsvId aContext, CMsvSession* aSession, CSmsClientMtm* aClientMtm, TBool aOnlyCreatedWithCreator = EFalse );
     
 public:
-    TBool AskDataFromUserL(TInt aCommand, TInt& aNumberOfEntries); // from MCreatorModuleBase
-
+    TBool AskDataFromUserL( TInt aCommand ); // from MCreatorModuleBase
+    void QueryDialogClosedL(TBool aPositiveAction, TInt aUserData); //from MUIObserver
+    
     TInt CreateMessageEntryL(CMessagesParameters *aParameters, TBool aTakeUserGivenParameters=EFalse);    
     TInt CreateRandomMessageEntryL(TInt aCommand);
     void DeleteAllL();
--- a/creator/engine/inc/creator_modulebase.h	Fri Jun 11 16:29:34 2010 +0100
+++ b/creator/engine/inc/creator_modulebase.h	Thu Jul 22 16:33:59 2010 +0100
@@ -16,13 +16,14 @@
 */
 
 
-
-
 #ifndef __CREATOR_MODULEBASE_H__
 #define __CREATOR_MODULEBASE_H__
 
 #include <e32base.h>
 
+#include "engine.h"
+#include "creator_traces.h"
+
 // Dictionary uids for each Creator module.
 // Dictionaries are for storing item identifiers created by Creator.
 // Item identifiers are for enabling deletion of only items created by Creator. 
@@ -46,30 +47,102 @@
 class MCreatorModuleBaseParameters;
 class CCommandParser;
 
+_LIT(KSavingText, "Saving");
+_LIT(KDeletingText, "Deleting");
+
 class MCreatorModuleBase
     {
 public:
 
 private:
     // constructs the module, add "iEngine = aEngine" and other construction stuff to the body
-    virtual void ConstructL(CCreatorEngine* aEngine) = 0;
+    virtual void ConstructL( CCreatorEngine* aEngine ) = 0;
 
 public:
     // this one is called when user select some features directly from menu, not running a script
     // should call CreateRandomData() function
     // returns ETrue when success, EFalse when user has cancelled
-    virtual TBool AskDataFromUserL(TInt aCommand, TInt& aNumberOfEntries) = 0;
+    virtual TBool AskDataFromUserL( TInt aCommand ) = 0;
     virtual void DeleteAllL() = 0;
     virtual void DeleteAllCreatedByCreatorL() = 0;
+    };
+
+
+class CCreatorModuleBase : public CBase, public MCreatorModuleBase, public MUIObserver
+    {
 
 public:
-    CCreatorEngine* iEngine;
+    enum TCreatorModuleStatus
+        {
+        ECreatorModuleDelete = 0, 
+        ECreatorModuleStart
+        };
+    
+    CCreatorModuleBase()
+        {
+        iEntriesToBeCreated = 1; 
+        }
+    
+    virtual TBool AskDataFromUserL(TInt aCommand)
+        {
+        iCommand = aCommand;
+        return EFalse;// will finish user interaction and engine will shutdown modules
+        }
+    
+    virtual void QueryDialogClosedL(TBool aPositiveAction, TInt aUserData)
+        {
+        LOGSTRING("Creator: CCreatorModuleBase::QueryDialogClosedL");
+        
+        if( aPositiveAction == EFalse )
+            {
+            iEngine->ShutDownEnginesL();
+            return;
+            }
+        const TDesC* showText = &KSavingText;
+        TBool finished(EFalse);
+        TBool retval(ETrue);
+        switch(aUserData)
+            {
+            case ECreatorModuleDelete:
+                showText = &KDeletingText;
+                iEntriesToBeCreated = 1;
+                finished = ETrue;
+                break;
+            case ECreatorModuleStart:
+                finished = ETrue;
+                break;
+            default:
+                //some error
+                retval = EFalse;
+                break;
+            }
+        if( retval == EFalse )
+            {
+            iEngine->ShutDownEnginesL();
+            }
+        else if( finished )
+            {
+            // add this command to command array
+            iEngine->AppendToCommandArrayL(iCommand, NULL, iEntriesToBeCreated);
+            // started exucuting commands
+            iEngine->ExecuteFirstCommandL( *showText );
+            }
+        }
 
-private:
-
+protected:
+    // constructs the module, add "iEngine = aEngine" and other construction stuff to the body
+    virtual void ConstructL(CCreatorEngine* aEngine)
+        {
+        iEngine = aEngine;
+        };
+    
+protected:
+    CCreatorEngine* iEngine;
+    TInt iCommand;
+    TInt iEntriesToBeCreated;
+    TInt iDummy;
     };
 
-
 class MCreatorModuleBaseParameters
     {
     // a base class for the parameters, no default implementation
@@ -112,4 +185,4 @@
 
 
 #endif  // __CREATOR_MODULEBASE_H__
- 
\ No newline at end of file
+ 
--- a/creator/engine/inc/creator_note.h	Fri Jun 11 16:29:34 2010 +0100
+++ b/creator/engine/inc/creator_note.h	Thu Jul 22 16:33:59 2010 +0100
@@ -16,30 +16,23 @@
 */
 
 
-
-
-
 #ifndef __CREATORNOTEPAD_H__
 #define __CREATORNOTEPAD_H__
 
 #include "engine.h"
 #include "creator_modulebase.h"
-
+#include "creator_notepadwrapper.h"
 
 #include <e32base.h>
-//#include <npdapi.h>
-#include <NotesEditor>
-#include <AgendaUtil>
-#include <AgendaEntry>
-
 
 static const TInt KNotepadFieldLength = 1024;
 
 class CCreatorEngine;
 class CNotepadParameters;
+class CCreatorNotepadWrapper;
 
 
-class CCreatorNotepad : public CBase, public MCreatorModuleBase
+class CCreatorNotepad : public CCreatorModuleBase
     {
 public: 
     static CCreatorNotepad* NewL(CCreatorEngine* aEngine);
@@ -51,15 +44,14 @@
     void ConstructL(CCreatorEngine* aEngine); // from MCreatorModuleBase
 
 public:
-    TBool AskDataFromUserL(TInt aCommand, TInt& aNumberOfEntries); // from MCreatorModuleBase
+    TBool AskDataFromUserL( TInt aCommand ); // from MCreatorModuleBase
+    
     TInt CreateNoteEntryL(CNotepadParameters *aParameters);
     void DeleteAllL();
     void DeleteAllCreatedByCreatorL();
 
 private:
-    AgendaUtil *iAgendaUtil;
-    NotesEditor *iNotepadApi;	//QT Notes api 
-    //CNotepadApi *iNotepadApi;
+    CCreatorNotepadWrapper* iNotepadWrapper;
 
     CNotepadParameters* iParameters;
     RFs& iFs;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/creator/engine/inc/creator_notepadwrapper.h	Thu Jul 22 16:33:59 2010 +0100
@@ -0,0 +1,51 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*
+*/
+
+#ifndef __CREATORNOTEPADWRAPPER_H__
+#define __CREATORNOTEPADWRAPPER_H__
+
+//#include "engine.h"
+//#include "creator_modulebase.h"
+
+
+#include <e32base.h>
+#include <NotesEditorInterface>
+#include <AgendaUtil>
+#include <AgendaEntry>
+
+
+class CCreatorNotepadWrapper : public CBase
+	{
+	public:
+		static CCreatorNotepadWrapper* NewL();
+		static CCreatorNotepadWrapper* NewLC();
+		~CCreatorNotepadWrapper();
+		
+	private:
+		CCreatorNotepadWrapper();
+		void ConstructL();
+		
+	public:
+		TInt CreateNoteL( const TDesC& aText );
+		void DeleteAllL();
+		
+	private:
+		AgendaUtil *iAgendaUtil;
+		NotesEditorInterface *iNotepadApi;	//QT Notes api
+	};
+
+#endif // __CREATORNOTEPADWRAPPER_H__
--- a/creator/engine/inc/creator_phonebook.h	Fri Jun 11 16:29:34 2010 +0100
+++ b/creator/engine/inc/creator_phonebook.h	Thu Jul 22 16:33:59 2010 +0100
@@ -17,66 +17,21 @@
 
 
 
-
-
 #ifndef __CREATORPHONEBOOK_H__
 #define __CREATORPHONEBOOK_H__
 
-#include "engine.h"
 #include "creator_phonebookbase.h"
 #include "creator_randomdatafield.h"
+#include "creator_phonebookwrapper.h"
 
 
-//#include <qmobilityglobal.h> //defines Q_SFW_EXPORT
-//#include <xqservicerequest.h>
-
-#include <QString>
-#include <qglobal.h>
-#include <QTime>
-#include <qtcontacts.h>
-//#include <qcontactmanager.h>
-//#include <qcontactname.h>
-//#include <qcontactid.h>
-//#include <qcontactphonenumber.h>
-//#include <qcontacturl.h>
-//#include <qcontactemailaddress.h>
-//#include <qcontact.h>
-
-//#include <e32base.h>
-//#include <cntdef.h>
-//#include <cntdb.h>
-//#include <cntitem.h>
-//#include <cntfldst.h>
-//#include <cntview.h>
-//#include <cvpbkcontactmanager.h>
-//#include <pbkfields.hrh>
-//#include <cpbk2imagemanager.h>
-//#include <mvpbkcontactstorelistobserver.h>
-//#include <mvpbkbatchoperationobserver.h>
-//#include <mvpbkcontactfindobserver.h>
-//#include <mvpbkcontactobserver.h>
-//#include <mpbk2imageoperationobservers.h>
-//#include <vpbkeng.rsg>
-//#include <cvpbkcontactlinkarray.h>
-//#include <MVPbkContactViewObserver.h>
-QTM_USE_NAMESPACE
 
 class CCreatorEngine;
 class CCreatorModuleBaseParameters;
 
-//class QContactManager;
-//class QContact;
-//class QContactId;
-//class QContactData;
-//class QContactName;
-
-//class MVPbkStoreContact;  //to change
-//class MVPbkContactStore;	//to change
-//class CAsyncWaiter;			//to change - remove
 class CContactDatabase;	
-//class MVPbkContactLinkArray;	//to change
 class CPhonebookParameters;	
-
+class CCreatorPhonebookWrapper;
 
 class CCreatorPhonebook : public CCreatorPhonebookBase 
     {
@@ -90,7 +45,6 @@
     void ConstructL(CCreatorEngine* aEngine); // from MCreatorModuleBase
 
 public:  
-    virtual TBool AskDataFromUserL(TInt aCommand, TInt& aNumberOfEntries);
     TInt CreateContactEntryL(CCreatorModuleBaseParameters *aParameters);    
     TInt CreateGroupEntryL(CCreatorModuleBaseParameters *aParameters);
     TInt CreateSubscribedContactEntryL(CCreatorModuleBaseParameters *aParameters); 
@@ -101,57 +55,47 @@
     void DeleteAllGroupsL();
     void DeleteAllGroupsCreatedByCreatorL();
     
+    void TestPrintOut(CPhonebookParameters* aParam);
+    
 private:
     
-    void InitializeContactParamsL(/*CCreatorModuleBaseParameters* aParameters*/);
-    TBool IsContactGroupL(/*const MVPbkContactLink& aLink*/);																								//modify
-    void StoreLinksForDeleteL( RArray<TUint32>& aLinks, TUid aStoreUid );														//modify
-    void DeleteContactsL( QList<QContactLocalId>& contacts /*MVPbkContactLinkArray* aContacts, TBool aGroup*/ );																//modify
+    void InitializeContactParamsL();
+    TBool IsContactGroupL( TUint32& aLink );
+    void StoreLinksForDeleteL( RArray<TUint32>& aLinks, TUid aStoreUid );
+    void DeleteContactsL( RArray<TUint32>& aContactsToDelete, TUid aStoreUid );
     void DeleteItemsCreatedWithCreatorL( TUid aStoreUid );
     void DoDeleteItemsCreatedWithCreatorL( TUid aStoreUid, CDictionaryFileStore* aStore );
-    TBool HasOtherThanGroupsL( /*MVPbkContactLinkArray* aContacts */);																			//modify
+    TBool HasOtherThanGroupsL();
     
-    QContactDetail CreateContactDetail(QString aDetail, QString aFieldContext, QString aFieldString, TInt aRand );
 
 private:
-	
-    QContactManager* iContactMngr;//CVPbkContactManager* iContactManager;
+	CCreatorPhonebookWrapper* iPhonebookWrapper;
     TInt iOpCounter;
     
     CPhonebookParameters* iParameters;
     
-    static QString iPhoneNumberFields[];
     static TInt iUrlFields[];
     static TInt iEmailFields[];
-    TBool iAddAllFields;
-    //QList<QContactLocalId> 
-    RArray<TUint32> iContactLinkArray;//CVPbkContactLinkArray* iContactLinkArray;	//modify
-    RArray<TUint32>  iContactsToDelete;	//CVPbkContactLinkArray* iContactsToDelete;	//modify
-    RArray<TUint32>  iContactGroupsToDelete;	//CVPbkContactLinkArray* iContactGroupsToDelete;	//modify
+    
+    RArray<TUint32> iContactLinkArray;
+    RArray<TUint32>  iContactsToDelete;	
+    RArray<TUint32>  iContactGroupsToDelete;	
     
     RArray<TUint32> iPreviousDeleteLinks;
-    //RPointerArray<MVPbkContactLinkArray> iPreviousDeleteLinks;  //modify
     
 private:
 	//new variables
 	/// Ref: the target of the copy
-	QContact* iStore;     //MVPbkContactStore* iStore;  
-    
-    //CAsyncWaiter* iWaiter;	//remove
+  
     
     /// Own: Contact database for this store
     CContactDatabase* iContactDb;    
-    
     //Contacts found in contacts db.
-    QList<QContactId>* iContactResults;//MVPbkContactLinkArray* iContactResults;
-    // Contact groups that are found in the store. These are used in filtering
-    // the groups from the find results.
-    QList<QContactId>* iContactGroupsInStore;//MVPbkContactLinkArray* iContactGroupsInStore;
     
     };
 
 /**
- * Virtual phonebook parameters
+ * phonebook parameters
  */
     
 
@@ -163,15 +107,16 @@
 	TInt CPhonebookParameters::ScriptLinkId() const;
 	void CPhonebookParameters::SetScriptLinkId(TInt aLinkId);
 
-	QList<QContactDetail> iContactFields;//	RPointerArray<CCreatorContactField> iContactFields;
+	TCreatorContactFields iContactFields;
 
-    QString iGroupName;//HBufC*  iGroupName;
-    TInt    iContactsInGroup;
+    HBufC*  iGroupName; 	
+    TInt iContactsInGroup;
     TInt iNumberOfPhoneNumberFields;
     TInt iNumberOfURLFields;
     TInt iNumberOfEmailAddressFields;
     TInt iContactSetPtr;
-    RArray<TLinkIdParam> iLinkIds; //QList<QContactId> iLinkIds;// For contactgroup. Stores the linked contact ids.
+    RArray<TLinkIdParam> iLinkIds; // For contactgroup. Stores the linked contact ids.
+    
     
 public:
     CPhonebookParameters();
@@ -182,5 +127,16 @@
     };
 
 
+class CCreatorContactField : public CBase				//, public MCreatorRandomDataField
+    {
+public:    
+    static CCreatorContactField* NewL();
+    void AddFieldToParamL( CCreatorEngine* aEngine, CPhonebookParameters* aParam, TInt aType, TInt aRand = KErrNotFound );
+    void AddFieldToParamL( CPhonebookParameters* aParam, TInt aType, TPtrC aContent );
+    ~CCreatorContactField();
+private:
+    CCreatorContactField();
+    void ConstructL();
+    };
 
 #endif // __CREATORPHONEBOOK_H__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/creator/engine/inc/creator_phonebookapi.h	Thu Jul 22 16:33:59 2010 +0100
@@ -0,0 +1,53 @@
+/*
+* 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 CREATOR_PHONEBOOKAPI_H_
+#define CREATOR_PHONEBOOKAPI_H_
+
+#include <QString>
+#include <qglobal.h>
+#include <QTime>
+#include <qtcontacts.h>
+QTM_USE_NAMESPACE
+
+
+class CCreatorPhonebookAPI
+    {
+public:
+    CCreatorPhonebookAPI ();
+    ~CCreatorPhonebookAPI ();
+
+    quint32 saveContact( const QList<QContactDetail>& list );
+    quint32 createGroup( const QString& groupName );
+    int numberOfContacts();
+    int addContactToGroup( QContactLocalId group, QContactLocalId contact );
+    int addToGroup(QContactLocalId group, int amount);
+    bool deleteAllContacts();
+    bool deleteAllContacts( const QString& type );
+    bool deleteContacts( const QList<QContactLocalId>& list );
+    QContact contact( const QContactLocalId& contactId );
+
+private:
+    bool IsContactGroupL( const QContact& contact );
+    
+private:
+    QContactManager* mContactMngr;
+
+    };
+
+#endif /* CREATOR_PHONEBOOKAPI_H_ */
--- a/creator/engine/inc/creator_phonebookbase.h	Fri Jun 11 16:29:34 2010 +0100
+++ b/creator/engine/inc/creator_phonebookbase.h	Thu Jul 22 16:33:59 2010 +0100
@@ -24,17 +24,32 @@
 #include "creator_modulebase.h"
 
 static const TInt KPhonebookFieldLength = 128;
-static const TInt KCreateRandomAmountOfGroups = -9999;
+static const TInt KCreateRandomAmountOfGroups = 1;
 
 class CCreatorModuleBaseParameters;
 
-class CCreatorPhonebookBase : public CBase, public MCreatorModuleBase{
+class CCreatorPhonebookBase : public CCreatorModuleBase
+{
+enum TCreatorPhonebookStatus{
+    ECreatorPhonebookDelete = 0,
+    ECreatorPhonebookStart,
+    ECreatorPhonebookGetContactFields,
+    ECreatorPhonebookGetPhoneNumbersCount,
+    ECreatorPhonebookGetUrlsCount,
+    ECreatorPhonebookGetEmailsCount,
+    ECreatorPhonebookContactsAllFields,
+    ECreatorPhonebookGetGroupFields,
+    ECreatorPhonebookGetContactsInGroup
+};
+
 public:
 
     virtual TInt CreateContactEntryL(CCreatorModuleBaseParameters *aParameters) = 0;    
     virtual TInt CreateGroupEntryL(CCreatorModuleBaseParameters *aParameters) = 0;
     virtual TInt CreateSubscribedContactEntryL(CCreatorModuleBaseParameters *aParameters) = 0;
-    virtual TBool AskDataFromUserL(TInt aCommand, TInt& aNumberOfEntries); // from MCreatorModuleBase
+    virtual TBool AskDataFromUserL( TInt aCommand ); // from MCreatorModuleBase
+    virtual void QueryDialogClosedL(TBool aPositiveAction, TInt aUserData); //from MUIObserver
+
 //    virtual TBool IsActive() = 0;
 //    virtual void CancelOperation() = 0;
     virtual void DeleteAllGroupsL() = 0;
@@ -48,6 +63,7 @@
     TInt iNumberOfEmailAddressFields;
     TInt iContactsInGroup;    
     TBool iDefaultFieldsSelected;
+    TBool iAddAllFields;
 };
 
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/creator/engine/inc/creator_phonebookwrapper.h	Thu Jul 22 16:33:59 2010 +0100
@@ -0,0 +1,197 @@
+/*
+* 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 __CREATORPHONEBOOKWRAPPER_H__
+#define __CREATORPHONEBOOKWRAPPER_H__
+
+#include "creator_phonebookbase.h"
+#include "creator_randomdatafield.h"
+
+#include <map>
+
+#include "creator_phonebookapi.h"
+
+class CCreatorEngine;
+class CCreatorModuleBaseParameters;
+
+class CContactDatabase;	
+//class CPhonebookWrapperParameters;	
+class CPhonebookParameters;
+
+typedef typename std::map<const TInt, HBufC*> TCreatorContactFields;
+typedef typename std::pair<const TInt, HBufC*> TCreatorContactField;
+
+class CCreatorPhonebookWrapper : public CBase 
+    {
+public:
+	enum ContactDetailType{
+	ELastName,					//0
+	ELastNameReading,			//1
+	EFirstName,
+	EFirstNameReading,
+	EPrefix,
+	ESuffix,					//5
+	ESecondName,
+	ELandPhoneHome,
+	EMobilePhoneHome,
+	EVideoNumberHome,
+	EFaxNumberHome,				//10
+	EVoipHome,
+	EEmailHome,
+	EUrlHome,
+	EAddrLabelHome,
+	EAddrPoHome,				//15
+	EAddrExtHome,
+	EAddrStreetHome,
+	EAddrLocalHome,
+	EAddrRegionHome,
+	EAddrPostCodeHome,			//20
+	EAddrCountryHome,
+	EJobTitle,
+	ECompanyName,
+	ELandPhoneWork,
+	EMobilePhoneWork,			//25
+	EVideoNumberWork,
+	EFaxNumberWork,
+	EVoipWork,
+	EEmailWork,
+	EUrlWork,					//30
+	EAddrLabelWork,
+	EAddrPoWork,
+	EAddrExtWork,
+	EAddrStreetWork,
+	EAddrLocalWork,				//35
+	EAddrRegionWork,
+	EAddrPostCodeWork,
+	EAddrCountryWork,
+	ELandPhoneGen,
+	EMobilePhoneGen,			//40
+	EVideoNumberGen,
+	EFaxNumberGen,
+	EVoipGen,
+	EPoc,
+	ESwis,						//45
+	ESip,
+	EEmailGen,
+	EUrlGen,
+	EAddrLabelGen,
+	EAddrPoGen,					//50
+	EAddrExtGen,
+	EAddrStreetGen,
+	EAddrLocalGen,
+	EAddrRegionGen,
+	EAddrPostCodeGen,			//55
+	EAddrCountryGen,
+	EPagerNumber,
+	EDtmfString,
+	EWVAddress,
+	EDate,						//60
+	ENote,
+	EThumbnailPic,
+	ERingTone,
+	ECallerObjImg,
+	ECallerObjText,				//65
+	EMiddleName,
+	EDepartment,
+	EAsstName,
+	ESpouse,
+	EChildren,					//70
+	EAsstPhone,
+	ECarPhone,
+	EAnniversary,
+	ESyncClass,
+	ELocPrivacy,				//75
+	EGenLabel,
+	ETopContact,
+	EIMPP,
+	};
+
+	
+public: 
+    static CCreatorPhonebookWrapper* NewL();
+    static CCreatorPhonebookWrapper* NewLC();
+    ~CCreatorPhonebookWrapper();
+
+private:
+    CCreatorPhonebookWrapper();
+    void ConstructL();
+
+public:  
+    TUint32 CreateContactEntryL(const TCreatorContactFields& Map);    
+    TUint32 CreateGroupEntryL( HBufC* aGroupName );
+    TInt CreateSubscribedContactEntryL(); 
+
+    /**
+     * NumberOfContacts() will return all contacts from Contact API
+     */
+    TInt NumberOfContacts();
+    
+    TInt AddContactToGroup( TUint32 aGroupId, TUint32 aContact );
+    TInt AddToGroup( TUint32 aGroupId, TInt aAmount );
+    
+    
+    void DeleteAllL();
+    void DeleteAllGroupsL();
+    void DeleteContactsL( RArray<TUint32>& aContactsToDelete, TUid aStoreUid );
+    
+private:
+    QList<QContactDetail> CreateContactDetailsFromParameters( const TCreatorContactFields& Map );
+    QContactDetail CreateContactDetail( QList<QContactDetail>& aContactDetailList,QString aDetail, QString aFieldContext, QString aFieldString, QString aData );
+    void AddFieldToList( QList<QContactDetail>& aDetailList, QContactDetail aDetail);
+    
+    TBool IsContactGroupL( TUint32& aLink );
+    
+    void DeleteItemsCreatedWithCreatorL( TUid aStoreUid );
+    void DoDeleteItemsCreatedWithCreatorL( TUid aStoreUid, CDictionaryFileStore* aStore );
+    TBool HasOtherThanGroupsL();
+    
+
+private:
+	
+    TInt iOpCounter;
+    
+    static QString iPhoneNumberFields[];
+    static TInt iUrlFields[];
+    static TInt iEmailFields[];
+    
+    RArray<TUint32> iContactLinkArray;
+    RArray<TUint32>  iContactsToDelete;	
+    RArray<TUint32>  iContactGroupsToDelete;	
+    
+    RArray<TUint32> iPreviousDeleteLinks;
+    //RPointerArray<MVPbkContactLinkArray> iPreviousDeleteLinks;  //modify
+    
+private:
+	//new variables
+	/// Ref: the target of the copy
+	QContact* iStore;       
+    
+    /// Own: Contact database for this store
+    CContactDatabase* iContactDb;    
+    
+    //Contacts found in contacts db.
+    QList<QContactId>* iContactResults;
+    // Contact groups that are found in the store. These are used in filtering
+    // the groups from the find results.
+    QList<QContactId>* iContactGroupsInStore;
+    
+    CCreatorPhonebookAPI* iPhonebookAPI;
+    };
+
+#endif // __CREATORPHONEBOOKWRAPPER_H__
--- a/creator/engine/inc/creator_scriptentry.h	Fri Jun 11 16:29:34 2010 +0100
+++ b/creator/engine/inc/creator_scriptentry.h	Thu Jul 22 16:33:59 2010 +0100
@@ -23,13 +23,11 @@
 #define __FILEUTILS_H__
 
 
-#include "engine.h"
-
 #include <e32base.h>
 #include <f32file.h>
 #include <badesca.h>
-#include <aknglobalnote.h>
-#include <akniconarray.h> 
+#include <AknGlobalNote.h>
+#include <AknIconArray.h> 
 #include <aknmemorycardui.mbg>
 #include <msvapi.h>
 
@@ -43,8 +41,13 @@
     static TInt FindFilesRecursiveL(CDesCArrayFlat* aFileArray, const TDesC& aFileName, const TDesC& aPath);
 };
 
-class CCommandParser : public CBase, public MMsvSessionObserver
+class CCommandParser : public CBase, public MMsvSessionObserver, MUIObserver
     {
+enum TCommandParserStatus{
+    EGetingScript,
+    EGetingRandomDataFile
+};
+
 public:
     static CCommandParser* NewL(CCreatorEngine* aEngine);
     static CCommandParser* NewLC(CCreatorEngine* aEngine);
@@ -65,19 +68,32 @@
     void HandleSessionEventL(TMsvSessionEvent aEvent, TAny* aArg1, TAny* aArg2, TAny* aArg3); // from MMsvSessionObserver
 
 public:
+    /**
+     * Called when some dialog in UI is closed
+     *
+     * @since S60 10.1
+     * @param aPositiveAction ETrue if "Ok", "Yes" or other "positive" button was pressed
+     * @param aUserData number that was passed to UI before dialog was opened
+     * @return None.
+     */
+    virtual void QueryDialogClosedL(TBool aPositiveAction, TInt aUserData);
+    
+public:
     void OpenScriptL();
-    TBool OpenScriptL(RFile& aScriptFile);
-    TBool GetRandomDataFilenameL(TDes& aFilename);
+    TBool OpenScriptL(MCommandParserObserver* aObserver);
+    TBool GetRandomDataFilenameL(MCommandParserObserver* aObserver);
 
 private:
     CCreatorEngine* iEngine;
     CDesCArrayFlat* iSearchArray;
-
+    TInt iSelectedItem;
+    
     TInt iParserPosition;
     TInt iParserOldPosition;
 
     HBufC8* iReadBuf;
 
+    MCommandParserObserver* iObserver;
     };
 
 
--- a/creator/engine/inc/creator_virtualphonebook.h	Fri Jun 11 16:29:34 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,299 +0,0 @@
-/*
-* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-*
-*/
-
-
-
-
-
-#ifndef __CREATORVIRTUALPHONEBOOK_H__
-#define __CREATORVIRTUALPHONEBOOK_H__
-
-#include "engine.h"
-#include "creator_phonebookbase.h"
-#include "creator_randomdatafield.h"
-
-#include <e32base.h>
-#include <cntdef.h>
-#include <cntdb.h>
-#include <cntitem.h>
-#include <cntfldst.h>
-#include <cntview.h>
-#include <cvpbkcontactmanager.h>
-#include <pbkfields.hrh>
-#include <cpbk2imagemanager.h>
-#include <mvpbkcontactstorelistobserver.h>
-#include <mvpbkbatchoperationobserver.h>
-#include <mvpbkcontactfindobserver.h>
-#include <mvpbkcontactobserver.h>
-#include <mpbk2imageoperationobservers.h>
-#include <vpbkeng.rsg>
-#include <cvpbkcontactlinkarray.h>
-#include <MVPbkContactViewObserver.h>
-
-class CCreatorEngine;
-class CCreatorModuleBaseParameters;
-
-class MVPbkStoreContact;
-class MVPbkContactStore;
-class CAsyncWaiter;
-class CContactDatabase;
-class MVPbkContactLinkArray;
-class CVirtualPhonebookParameters;
-
-
-class CCreatorVirtualPhonebook : public CCreatorPhonebookBase,  
-	public MVPbkContactStoreListObserver, public MVPbkBatchOperationObserver,
-	public MVPbkContactFindObserver, public MVPbkContactObserver, public MPbk2ImageSetObserver,
-	public MVPbkSingleContactOperationObserver, public MVPbkContactViewObserver
-    {
-public: 
-    static CCreatorVirtualPhonebook* NewL(CCreatorEngine* aEngine);
-    static CCreatorVirtualPhonebook* NewLC(CCreatorEngine* aEngine);
-    ~CCreatorVirtualPhonebook();
-
-private:
-    CCreatorVirtualPhonebook();
-    void ConstructL(CCreatorEngine* aEngine); // from MCreatorModuleBase
-
-public:  
-    virtual TBool AskDataFromUserL(TInt aCommand, TInt& aNumberOfEntries);
-    TInt CreateContactEntryL(CCreatorModuleBaseParameters *aParameters);    
-    TInt CreateGroupEntryL(CCreatorModuleBaseParameters *aParameters);
-    TInt CreateSubscribedContactEntryL(CCreatorModuleBaseParameters *aParameters); 
-
-    void AddFieldToContactItemL(MVPbkStoreContact& aItem, TPbkFieldId aFieldId, const TDesC& aFieldText);
-    void AddFieldToContactItemL(MVPbkStoreContact& aItem, TPbkFieldId aFieldId, const TDesC8& aFieldText);
-    void AddFieldToContactItemL(MVPbkStoreContact& aItem, TPbkFieldId aFieldId, const TTime& aFieldText);
-    
-    void AddImageToContactL(MVPbkStoreContact& aContact, TInt aFieldResId, const TDesC& aFileName);
-    TBool IsActive();
-    void CancelOperation();
-    void DeleteAllL();
-    void DeleteAllCreatedByCreatorL();
-    void DeleteAllGroupsL();
-    void DeleteAllGroupsCreatedByCreatorL();
-    
-private:
-    void CompactPbkDatabaseL(TBool aCompressImmediately=EFalse);    
-    void AddFieldToParamsL(TInt aFieldType, const TDesC& aData);
-    void AddFieldToParamsL(TInt aFieldType, const TDesC8& aData);
-    void AddFieldToParamsL(TInt aFieldType, const TTime& aData);    
-    void InitializeContactParamsL(/*CCreatorModuleBaseParameters* aParameters*/);
-    TBool IsContactGroupL(const MVPbkContactLink& aLink);
-    void StoreLinksForDeleteL( MVPbkContactLinkArray& aLinks, TUid aStoreUid );
-    void DeleteContactsL( MVPbkContactLinkArray* aContacts, TBool aGroup );
-    void DeleteItemsCreatedWithCreatorL( TUid aStoreUid );
-    void DoDeleteItemsCreatedWithCreatorL( TUid aStoreUid, CDictionaryFileStore* aStore );
-    TBool HasOtherThanGroupsL( MVPbkContactLinkArray* aContacts );
-
-public: // MVPbkSingleContactOperationObserver
-    
-    void VPbkSingleContactOperationComplete(
-                    MVPbkContactOperationBase& aOperation,
-                    MVPbkStoreContact* aContact );
-    void VPbkSingleContactOperationFailed(
-                    MVPbkContactOperationBase& aOperation, 
-                    TInt aError );
-
-private: // MVPbkContactViewObserver
-    
-    void ContactViewReady( MVPbkContactViewBase& aView );
-    void ContactViewUnavailable(
-            MVPbkContactViewBase& aView );
-    void ContactAddedToView(
-            MVPbkContactViewBase& aView, 
-            TInt aIndex, 
-            const MVPbkContactLink& aContactLink );
-    void ContactRemovedFromView(
-            MVPbkContactViewBase& aView, 
-            TInt aIndex, 
-            const MVPbkContactLink& aContactLink );
-    void ContactViewError(
-            MVPbkContactViewBase& aView, 
-            TInt aError, 
-            TBool aErrorNotified );
-
-private:
-	CVPbkContactManager* iContactManager;
-    TInt iOpCounter;
-
-    CVirtualPhonebookParameters* iParameters;
-    
-    static TInt iPhoneNumberFields[];
-    static TInt iUrlFields[];
-    static TInt iEmailFields[];
-    TBool iAddAllFields;
-    CVPbkContactLinkArray* iContactLinkArray;
-    CVPbkContactLinkArray* iContactsToDelete;
-    CVPbkContactLinkArray* iContactGroupsToDelete;
-    RPointerArray<MVPbkContactLinkArray> iPreviousDeleteLinks;   
-    
-private:
-	//new variables
-	/// Ref: the target of the copy
-	MVPbkContactStore* iStore;
-    
-    CAsyncWaiter* iWaiter;	
-    
-    /// Own: Contact database for this store
-    CContactDatabase* iContactDb;    
-    
-    //Contacts found in contacts db.
-    MVPbkContactLinkArray* iContactResults;
-    // Contact groups that are found in the store. These are used in filtering
-    // the groups from the find results.
-    MVPbkContactLinkArray* iContactGroupsInStore;
-    
-    // Phonebook asynchronous operation
-    MVPbkContactOperationBase* iOperation;
-    
-    // Flag to indicate whether it is required to notify
-    // iEngine after operation is complete. This happens
-    // when user has cancelled the operation during 
-    // iOperation exists.
-    TBool iCancelCbRequested;
-
-public:
-	//Observer implentation from MVPbkContactStoreListObserver
-	void OpenComplete();
-
-	//observer implentation from MVPbkContactStoreObserver
-
-	void StoreReady(MVPbkContactStore& aContactStore);
-
-	void StoreUnavailable(MVPbkContactStore& aContactStore, 
-	        TInt aReason);
-
-	void HandleStoreEventL(
-	        MVPbkContactStore& aContactStore, 
-	        TVPbkContactStoreEvent aStoreEvent);
-
-	 TAny* ContactStoreObserverExtension(TUid aExtensionUid); 
-	        	
-	
-
-    
-    
-public:
-	//Observer implementation for MVPbkBatchOperationObserver
-
-	void StepComplete( 
-	        MVPbkContactOperationBase& aOperation,
-	        TInt aStepSize );
-	
-	TBool StepFailed(
-	        MVPbkContactOperationBase& aOperation,
-	        TInt aStepSize, TInt aError );
-	
-	void OperationComplete( 
-	        MVPbkContactOperationBase& aOperation );
-	
-	TAny* BatchOperationObserverExtension( 
-	        TUid aExtensionUid ) ;
-
-	
-	//--------------------------------------------
-	//Observer implementation for MVPbkContactFindObserver
-	public: // Interface
-
-	        void FindCompleteL( MVPbkContactLinkArray* aResults );
-
-	        void FindFailed( TInt aError );
-
-	        TAny* ContactFindObserverExtension( 
-	                TUid aExtensionUid );	
-	
-	
-	
-   	//--------------------------------------------
-   	//Observer implementation for MVPbkContactObserver
-
-	public:
-		void ContactOperationCompleted(TContactOpResult aResult);
-	
-		void ContactOperationFailed
-			(TContactOp aOpCode, TInt aErrorCode, TBool aErrorNotified);
-	
-	    TAny* ContactObserverExtension(TUid aExtensionUid) ;
-	     //~MVPbkContactObserver();	        
-	        
-	//--------------------------------------------
-	// Implementation of MPbk2ImageSetObserver:
-	public:
-	    void Pbk2ImageSetComplete(MPbk2ImageOperation& aOperation);
-	    void Pbk2ImageSetFailed(MPbk2ImageOperation& aOperation, TInt aError );	        
-    };
-
-class CCreatorContactFieldImpl;
-class CCreatorContactField : public CBase, public MCreatorRandomDataField
-    {
-public:    
-    static CCreatorContactField* NewL(TInt aFieldType, const TDesC& aData);
-    static CCreatorContactField* NewL(TInt aFieldType, const TDesC8& aData);
-    static CCreatorContactField* NewL(TInt aFieldType, const TTime& aData);
-    
-    static CCreatorContactField* NewL(TInt aFieldType, TRandomLengthType aRandomLenType, TInt aRandomLen);
-    
-    ~CCreatorContactField();    
-    TInt FieldType();
-    virtual void AddToContactL(CCreatorEngine* aEngine, MVPbkStoreContact& aContact, CCreatorVirtualPhonebook* aVPbk);
-    virtual void SetRandomParametersL(  MCreatorRandomDataField::TRandomLengthType aRandomLenType = MCreatorRandomDataField::ERandomLengthDefault, 
-                                TInt aRandomLen = 0 );
-    virtual void ParseL(CCommandParser* parser);
-    
-private:    
-    CCreatorContactField();
-    void ConstructL(TInt aFieldType, const TDesC& aData);
-    void ConstructL(TInt aFieldType, const TDesC8& aData);
-    void ConstructL(TInt aFieldType, const TTime& aData);
-    CCreatorContactFieldImpl* pImpl;    
-    };
-    
-    
-/**
- * Virtual phonebook parameters
- */
-    
-
-class CVirtualPhonebookParameters : public CCreatorModuleBaseParameters
-    {
-public:
-	void ParseL(CCommandParser* parser, TParseParams /*aCase = 0*/);
-	
-	TInt CVirtualPhonebookParameters::ScriptLinkId() const;
-	void CVirtualPhonebookParameters::SetScriptLinkId(TInt aLinkId);
-	RPointerArray<CCreatorContactField> iContactFields;
-
-    HBufC*  iGroupName;
-    TInt    iContactsInGroup;
-    TInt iNumberOfPhoneNumberFields;
-    TInt iNumberOfURLFields;
-    TInt iNumberOfEmailAddressFields;
-    TInt iContactSetPtr;
-    RArray<TLinkIdParam> iLinkIds; // For contactgroup. Stores the linked contact ids.
-    
-public:
-    CVirtualPhonebookParameters();
-    ~CVirtualPhonebookParameters();
-    
-private:
-    TInt iLinkId; // For contact. Stores the contact id
-    };
-
-
-
-#endif // __CREATORVIRTUALPHONEBOOK_H__
--- a/creator/engine/inc/creator_wepsecuritysettings.h	Fri Jun 11 16:29:34 2010 +0100
+++ b/creator/engine/inc/creator_wepsecuritysettings.h	Thu Jul 22 16:33:59 2010 +0100
@@ -72,7 +72,7 @@
 
 private:
     CCreatorWEPSecuritySettings();
-    void ConstructL(); // from MCreatorModuleBase
+    void ConstructL();
 
 
 public:
--- a/creator/engine/src/creator_accesspoint.cpp	Fri Jun 11 16:29:34 2010 +0100
+++ b/creator/engine/src/creator_accesspoint.cpp	Thu Jul 22 16:33:59 2010 +0100
@@ -18,10 +18,10 @@
 
 
 
-#include "creator_accesspoint.h" 
+//#include "creator_accesspoint.h" 
 #include "creator_traces.h"
-#include <aplistitemlist.h>
-#include <aplistitem.h> 
+#include <ApListItemList.h>
+#include <ApListItem.h> 
 #include "enginewrapper.h"
 
 static const TInt KAccessPointsFieldLength = 128;
@@ -188,20 +188,22 @@
 
 //----------------------------------------------------------------------------
 
-TBool CCreatorAccessPoints::AskDataFromUserL(TInt aCommand, TInt& aNumberOfEntries)
+TBool CCreatorAccessPoints::AskDataFromUserL(TInt aCommand)
     {
     LOGSTRING("Creator: CCreatorAccessPoints::AskDataFromUserL");
-
+    
+    CCreatorModuleBase::AskDataFromUserL( aCommand );//ignore retval
+    
     if( aCommand == ECmdDeleteIAPs )
         {
-        return iEngine->GetEngineWrapper()->YesNoQueryDialog(_L("Delete all Access Points?") );
+        return iEngine->GetEngineWrapper()->YesNoQueryDialog(_L("Delete all Access Points?"), this, ECreatorModuleDelete );
         }
     else if( aCommand == ECmdDeleteCreatorIAPs )
         {
-        return iEngine->GetEngineWrapper()->YesNoQueryDialog(_L("Delete all Access Points created with Creator?") );
+        return iEngine->GetEngineWrapper()->YesNoQueryDialog(_L("Delete all Access Points created with Creator?"), this, ECreatorModuleDelete );
         }
 
-    return iEngine->GetEngineWrapper()->EntriesQueryDialog(aNumberOfEntries, _L("How many entries to create?"));
+    return iEngine->GetEngineWrapper()->EntriesQueryDialog(&iEntriesToBeCreated, _L("How many entries to create?"), EFalse, this, ECreatorModuleStart );
     }
 
 
--- a/creator/engine/src/creator_browser.cpp	Fri Jun 11 16:29:34 2010 +0100
+++ b/creator/engine/src/creator_browser.cpp	Thu Jul 22 16:33:59 2010 +0100
@@ -16,7 +16,7 @@
 */
 
 
-#include <favouriteswapap.h> 
+#include <FavouritesWapAp.h> 
 
 #include "engine.h"
 #include "enginewrapper.h"
@@ -124,56 +124,58 @@
 
 //----------------------------------------------------------------------------
 
-TBool CCreatorBrowser::AskDataFromUserL(TInt aCommand, TInt& aNumberOfEntries)
+TBool CCreatorBrowser::AskDataFromUserL(TInt aCommand)
     {
     LOGSTRING("Creator: CCreatorBrowser::AskDataFromUserL");
 
+    CCreatorModuleBase::AskDataFromUserL( aCommand );//ignore retval
+    
     TBool result( EFalse );
     switch ( aCommand )
         {
         case ECmdDeleteBrowserBookmarks:
             {
-            result = iEngine->GetEngineWrapper()->YesNoQueryDialog( _L("Delete all Browser bookmarks?") );
+            result = iEngine->GetEngineWrapper()->YesNoQueryDialog( _L("Delete all Browser bookmarks?"), this, ECreatorModuleDelete );
             break;
             }
         case ECmdDeleteCreatorBrowserBookmarks:
             {
-            result = iEngine->GetEngineWrapper()->YesNoQueryDialog( _L("Delete all Browser bookmarks created with Creator?") );
+            result = iEngine->GetEngineWrapper()->YesNoQueryDialog( _L("Delete all Browser bookmarks created with Creator?"), this, ECreatorModuleDelete );
             break;
             }
         case ECmdDeleteBrowserBookmarkFolders:
             {
-            result = iEngine->GetEngineWrapper()->YesNoQueryDialog( _L("Delete all Browser bookmark folders?") );
+            result = iEngine->GetEngineWrapper()->YesNoQueryDialog( _L("Delete all Browser bookmark folders?"), this, ECreatorModuleDelete );
             break;
             }
         case ECmdDeleteCreatorBrowserBookmarkFolders:
             {
-            result = iEngine->GetEngineWrapper()->YesNoQueryDialog( _L("Delete all Browser bookmark folders created with Creator?") );
+            result = iEngine->GetEngineWrapper()->YesNoQueryDialog( _L("Delete all Browser bookmark folders created with Creator?"), this, ECreatorModuleDelete );
             break;
             }
         case ECmdDeleteBrowserSavedPages:
             {
-            result = iEngine->GetEngineWrapper()->YesNoQueryDialog( _L("Delete all Browser saved pages?") );
+            result = iEngine->GetEngineWrapper()->YesNoQueryDialog( _L("Delete all Browser saved pages?"), this, ECreatorModuleDelete );
             break;
             }
         case ECmdDeleteCreatorBrowserSavedPages:
             {
-            result = iEngine->GetEngineWrapper()->YesNoQueryDialog( _L("Delete all Browser saved pages created with Creator?") );
+            result = iEngine->GetEngineWrapper()->YesNoQueryDialog( _L("Delete all Browser saved pages created with Creator?"), this, ECreatorModuleDelete );
             break;
             }
         case ECmdDeleteBrowserSavedPageFolders:
             {
-            result = iEngine->GetEngineWrapper()->YesNoQueryDialog( _L("Delete all Browser saved pages folders?") );
+            result = iEngine->GetEngineWrapper()->YesNoQueryDialog( _L("Delete all Browser saved pages folders?"), this, ECreatorModuleDelete );
             break;
             }
         case ECmdDeleteCreatorBrowserSavedPageFolders:
             {
-            result = iEngine->GetEngineWrapper()->YesNoQueryDialog( _L("Delete all Browser saved pages folders created with Creator?") );
+            result = iEngine->GetEngineWrapper()->YesNoQueryDialog( _L("Delete all Browser saved pages folders created with Creator?"), this, ECreatorModuleDelete );
             break;
             }
         default:
             {
-            result = iEngine->GetEngineWrapper()->EntriesQueryDialog(aNumberOfEntries, _L("How many entries to create?"));
+            result = iEngine->GetEngineWrapper()->EntriesQueryDialog(&iEntriesToBeCreated, _L("How many entries to create?"), EFalse, this, ECreatorModuleStart );
             break;
             }
         }
--- a/creator/engine/src/creator_calendar.cpp	Fri Jun 11 16:29:34 2010 +0100
+++ b/creator/engine/src/creator_calendar.cpp	Thu Jul 22 16:33:59 2010 +0100
@@ -330,63 +330,107 @@
 
 //----------------------------------------------------------------------------
 
-TBool CCreatorInterimCalendar::AskDataFromUserL (TInt aCommand,
-        TInt& aNumberOfEntries )
+void CCreatorInterimCalendar::QueryDialogClosedL(TBool aPositiveAction, TInt aUserData)
+    {
+    LOGSTRING("Creator: CCreatorInterimCalendar::QueryDialogClosedL");
+    
+    if( aPositiveAction == EFalse && aUserData != ECreatorCalendarAddDefaultAlarm )
+        {
+        iEngine->ShutDownEnginesL();
+        return;
+        }
+    
+    const TDesC* showText = &KSavingText;
+    TBool finished(EFalse);
+    TBool retval(ETrue);
+    switch(aUserData)
+        {
+        case ECreatorCalendarDelete:
+            iEntriesToBeCreated = 1;
+            showText = &KDeletingText;
+            finished = ETrue;
+            break;
+        case ECreatorCalendarStart:
+            if( iCommand == ECmdCreateCalendarEntryEvents || iCommand == ECmdCreateCalendarEntryAppointments )
+                {
+                _LIT(KRepeatingNum, "How many repeating (weekly) entries");
+                retval = iEngine->GetEngineWrapper()->EntriesQueryDialog(&iNumberRepeatingEntries, KRepeatingNum, ETrue, this, ECreatorCalendarGetWeeklyEntries);
+                }
+            else
+                {
+                _LIT(KStartPeriodDate, "Start date of creation period");// \n dd/mm/yyyy
+                retval = iEngine->GetEngineWrapper()->TimeQueryDialog(&iRandomModeStartTime, KStartPeriodDate, this, ECreatorCalendarGetStartDate); // ask start date
+                }
+            break;
+        case ECreatorCalendarGetWeeklyEntries:
+            _LIT(KAttendeesNum, "How many attendees to create");
+            retval = iEngine->GetEngineWrapper()->EntriesQueryDialog(&iNumberOfAttendees, KAttendeesNum, ETrue, this, ECreatorCalendarGetAttendies);
+            break;
+        case ECreatorCalendarGetAttendies:
+            {
+            // ask start date
+            _LIT(KStartPeriodDate, "Start date of creation period");
+            retval = iEngine->GetEngineWrapper()->TimeQueryDialog(&iRandomModeStartTime, KStartPeriodDate, this, ECreatorCalendarGetStartDate ); 
+            }
+            break;
+        case ECreatorCalendarGetStartDate:
+            {
+            _LIT(KEndPeriodDate, "End date of creation period\n dd/mm/yyyy");
+            iEngine->GetEngineWrapper()->TimeQueryDialog (&iRandomModeEndTime, KEndPeriodDate, this, ECreatorCalendarGetEndDate ); // ask end date
+            }
+            break;
+        case ECreatorCalendarGetEndDate:
+           if (iRandomModeStartTime > iRandomModeEndTime ) // check end date is ok
+                {
+                iEngine->GetEngineWrapper()->ShowNote(_L("End date must be after start date") );
+                retval = EFalse;
+                }
+            else 
+                {
+                retval = iEngine->GetEngineWrapper()->YesNoQueryDialog(_L("Add default alarm?"), this, ECreatorCalendarAddDefaultAlarm);
+                }
+           break;
+        case ECreatorCalendarAddDefaultAlarm:
+            iSetAlarm = aPositiveAction;
+            finished = ETrue;
+            break;
+        default:
+            //some error
+            retval = EFalse;
+            break;
+        }
+    if( retval == EFalse )
+        {
+        iEngine->ShutDownEnginesL();
+        }
+    else if( finished )
+        {
+        // add this command to command array
+        iEngine->AppendToCommandArrayL(iCommand, NULL, iEntriesToBeCreated);
+        // started exucuting commands
+        iEngine->ExecuteFirstCommandL( *showText );
+        }
+    }
+
+//----------------------------------------------------------------------------
+
+TBool CCreatorInterimCalendar::AskDataFromUserL( TInt aCommand )
     {
     LOGSTRING("Creator: CCreatorInterimCalendar::AskDataFromUserL");
-
+    
+    CCreatorModuleBase::AskDataFromUserL( aCommand );//ignore retval
+    
     if( aCommand == ECmdDeleteCalendarEntries )
         {
-        return iEngine->GetEngineWrapper()->YesNoQueryDialog(_L("Delete all calendar entries?") );
+        return iEngine->GetEngineWrapper()->YesNoQueryDialog(_L("Delete all calendar entries?"), this, ECreatorCalendarDelete );
         }
     if( aCommand == ECmdDeleteCreatorCalendarEntries )
         {
-        return iEngine->GetEngineWrapper()->YesNoQueryDialog(_L("Delete all calendar entries created with Creator?") ); 
+        return iEngine->GetEngineWrapper()->YesNoQueryDialog(_L("Delete all calendar entries created with Creator?"), this, ECreatorCalendarDelete ); 
         }
 
     // display queries
-    if (iEngine->GetEngineWrapper()->EntriesQueryDialog (aNumberOfEntries, _L("How many entries to create?") ) ) // ask number of entries to create
-        {
-        if( aCommand == ECmdCreateCalendarEntryEvents ||
-            aCommand == ECmdCreateCalendarEntryAppointments)
-            {
-            _LIT(KRepeatingNum, "How many repeating (weekly) entries");
-            if( !iEngine->GetEngineWrapper()->EntriesQueryDialog(iNumberRepeatingEntries, KRepeatingNum, ETrue))
-                {
-                return EFalse;
-                }
-            _LIT(KAttendeesNum, "How many attendees to create");
-            if( !iEngine->GetEngineWrapper()->EntriesQueryDialog(iNumberOfAttendees, KAttendeesNum, ETrue))
-                {
-                return EFalse;
-                }
-            }
-        if (iEngine->GetEngineWrapper()->TimeQueryDialog(iRandomModeStartTime, _L("Start date of creation period\n dd/mm/yyyy") ) ) // ask start date
-            {
-            if (iEngine->GetEngineWrapper()->TimeQueryDialog (iRandomModeEndTime, _L("End date of creation period\n dd/mm/yyyy") ) ) // ask end date
-                {
-                if (iRandomModeStartTime > iRandomModeEndTime ) // check end date is ok
-                    {
-                    iEngine->GetEngineWrapper()->ShowNote(_L("End date must be after start date") );
-                    return EFalse;
-                    }
-                else 
-                    {
-                    if( iEngine->GetEngineWrapper()->YesNoQueryDialog(_L("Add default alarm?")))
-                        {
-                        iSetAlarm = ETrue;
-                        }                   
-                    }                    
-                    return ETrue;
-                }
-            else
-                return EFalse;
-            }
-        else
-            return EFalse;
-        }
-    else
-        return EFalse;
+    return iEngine->GetEngineWrapper()->EntriesQueryDialog(&iEntriesToBeCreated, _L("How many entries to create?"), EFalse, this, ECreatorCalendarStart ); // ask number of entries to create
     }
 
 //----------------------------------------------------------------------------
--- a/creator/engine/src/creator_cmdscriptrun.cpp	Fri Jun 11 16:29:34 2010 +0100
+++ b/creator/engine/src/creator_cmdscriptrun.cpp	Thu Jul 22 16:33:59 2010 +0100
@@ -16,8 +16,8 @@
 */
 
 
-#include <EIKENV.H>
-#include <COEAUI.H>  
+#include <eikenv.h>
+#include <coeaui.h>  
 #include <pathinfo.h> 
 #include "creator_cmdscriptrun.h"
 #include "engine.h"
@@ -117,15 +117,15 @@
 
 void  CCreatorCmdScriptRun::Beat()
 	{
-	Tick();
+	TRAP_IGNORE( TickL() );
 	}
 
 void  CCreatorCmdScriptRun::Synchronize()
 	{
-	Tick();
+    TRAP_IGNORE( TickL() );
 	}
 
-void  CCreatorCmdScriptRun::Tick()
+void  CCreatorCmdScriptRun::TickL()
 	{
 	iTickCount++;
 	if (iTickCount > KCommandLineDelay)
--- a/creator/engine/src/creator_connectionmethod.cpp	Fri Jun 11 16:29:34 2010 +0100
+++ b/creator/engine/src/creator_connectionmethod.cpp	Thu Jul 22 16:33:59 2010 +0100
@@ -148,21 +148,23 @@
 
 //----------------------------------------------------------------------------
 
-TBool CCreatorConnectionSettings::AskDataFromUserL(TInt aCommand, TInt& aNumberOfEntries)
+TBool CCreatorConnectionSettings::AskDataFromUserL(TInt aCommand)
     {
     LOGSTRING("Creator: CCreatorConnectionSettings::AskDataFromUserL");
-
+    
+    CCreatorModuleBase::AskDataFromUserL( aCommand );
+    
     if( aCommand == ECmdDeleteIAPs )
         {
-        return iEngine->GetEngineWrapper()->YesNoQueryDialog(_L("Delete all Connection Methods?") );
+        return iEngine->GetEngineWrapper()->YesNoQueryDialog(_L("Delete all Connection Methods?"), this, ECreatorModuleDelete );
         }
     else if( aCommand == ECmdDeleteCreatorIAPs )
         {
-        return iEngine->GetEngineWrapper()->YesNoQueryDialog(_L("Delete all Connection Methods created with Creator?") );
+        return iEngine->GetEngineWrapper()->YesNoQueryDialog(_L("Delete all Connection Methods created with Creator?"), this, ECreatorModuleDelete );
         }
     else
         {
-        return iEngine->GetEngineWrapper()->EntriesQueryDialog(aNumberOfEntries, _L("How many entries to create?"));
+        return iEngine->GetEngineWrapper()->EntriesQueryDialog(&iEntriesToBeCreated, _L("How many entries to create?"), EFalse, this, ECreatorModuleStart );
         }
     }
 
--- a/creator/engine/src/creator_connectionmethodelement.cpp	Fri Jun 11 16:29:34 2010 +0100
+++ b/creator/engine/src/creator_connectionmethodelement.cpp	Thu Jul 22 16:33:59 2010 +0100
@@ -20,7 +20,7 @@
 #include "enginewrapper.h"
 #include "creator_connectionmethodelement.h"
 #include "creator_traces.h"
-#include "creator_accesspoint.h"
+//#include "creator_accesspoint.h"
 
 
 using namespace creatorconnectionmethod;
--- a/creator/engine/src/creator_contactelement.cpp	Fri Jun 11 16:29:34 2010 +0100
+++ b/creator/engine/src/creator_contactelement.cpp	Thu Jul 22 16:33:59 2010 +0100
@@ -19,9 +19,11 @@
 
 #include "creator_contactelement.h"
 #include "creator_traces.h"
+#include "creator_phonebook.h"
 #include "creator_factory.h"
 #include "creator_contactsetcache.h"
 #include <xml/documentparameters.h>
+#include <qtcontacts.h>
 
 using namespace Xml;
 using namespace creatorcontact;
@@ -43,6 +45,98 @@
     TInt  iFieldCode;
     TContactFieldDataType iDataType;
 };
+FieldMapping fieldMappingTbl[] = {
+       {TPtrC(KFirstname), CCreatorPhonebookWrapper::EFirstName, EDataTypeText},
+       {TPtrC(KLastname), CCreatorPhonebookWrapper::ELastName, EDataTypeText},
+       {TPtrC(KFirstnameReading), CCreatorPhonebookWrapper::EFirstNameReading, EDataTypeText},
+       {TPtrC(KLastnameReading), CCreatorPhonebookWrapper::ELastNameReading, EDataTypeText},
+       {TPtrC(KPrefix), CCreatorPhonebookWrapper::EPrefix, EDataTypeText},
+       {TPtrC(KSuffix), CCreatorPhonebookWrapper::ESuffix, EDataTypeText},
+       {TPtrC(KSecondname), CCreatorPhonebookWrapper::ESecondName, EDataTypeText},
+       {TPtrC(KLandphoneHome), CCreatorPhonebookWrapper::ELandPhoneHome, EDataTypeText},
+       
+       {TPtrC(KMobilephoneHome), CCreatorPhonebookWrapper::EMobilePhoneHome, EDataTypeText},
+       {TPtrC(KVideonumberHome), CCreatorPhonebookWrapper::EVideoNumberHome, EDataTypeText},
+       {TPtrC(KFaxnumberHome), CCreatorPhonebookWrapper::EFaxNumberHome, EDataTypeText},
+       {TPtrC(KVoipHome), CCreatorPhonebookWrapper::EVoipHome, EDataTypeText},
+       {TPtrC(KEmailHome), CCreatorPhonebookWrapper::EEmailHome, EDataTypeText},
+       {TPtrC(KUrlHome), CCreatorPhonebookWrapper::EUrlHome, EDataTypeText},
+       {TPtrC(KAddrlabelHome), CCreatorPhonebookWrapper::EAddrLabelHome, EDataTypeText},
+       {TPtrC(KAddrpoHome), CCreatorPhonebookWrapper::EAddrPoHome, EDataTypeText},
+       
+       {TPtrC(KAddrextHome), CCreatorPhonebookWrapper::EAddrExtHome, EDataTypeText},
+       {TPtrC(KAddrstreetHome), CCreatorPhonebookWrapper::EAddrStreetHome, EDataTypeText},
+       {TPtrC(KAddrlocalHome), CCreatorPhonebookWrapper::EAddrLocalHome, EDataTypeText},
+       {TPtrC(KAddrregionHome), CCreatorPhonebookWrapper::EAddrRegionHome, EDataTypeText},
+       {TPtrC(KAddrpostcodeHome), CCreatorPhonebookWrapper::EAddrPostCodeHome, EDataTypeText},
+       {TPtrC(KAddrcountryHome), CCreatorPhonebookWrapper::EAddrCountryHome, EDataTypeText},
+       {TPtrC(KJobtitle), CCreatorPhonebookWrapper::EJobTitle, EDataTypeText},
+       {TPtrC(KCompanyname), CCreatorPhonebookWrapper::ECompanyName, EDataTypeText},
+       
+       {TPtrC(KLandphoneWork), CCreatorPhonebookWrapper::ELandPhoneWork, EDataTypeText},
+       {TPtrC(KMobilephoneWork), CCreatorPhonebookWrapper::EMobilePhoneWork, EDataTypeText},
+       {TPtrC(KVideonumberWork), CCreatorPhonebookWrapper::EVideoNumberWork, EDataTypeText},
+       {TPtrC(KFaxnumberWork), CCreatorPhonebookWrapper::EFaxNumberWork, EDataTypeText},
+       {TPtrC(KVoipWork), CCreatorPhonebookWrapper::EVoipWork, EDataTypeText},
+       {TPtrC(KEmailWork), CCreatorPhonebookWrapper::EEmailWork, EDataTypeText},
+       {TPtrC(KUrlWork), CCreatorPhonebookWrapper::EUrlWork, EDataTypeText},
+       {TPtrC(KAddrlabelWork), CCreatorPhonebookWrapper::EAddrLabelWork, EDataTypeText},
+       
+       {TPtrC(KAddrpoWork), CCreatorPhonebookWrapper::EAddrPoWork, EDataTypeText},
+       {TPtrC(KAddrextWork), CCreatorPhonebookWrapper::EAddrExtWork, EDataTypeText},
+       {TPtrC(KAddrstreetWork), CCreatorPhonebookWrapper::EAddrStreetWork, EDataTypeText},
+       {TPtrC(KAddrlocalWork), CCreatorPhonebookWrapper::EAddrLocalWork, EDataTypeText},
+       {TPtrC(KAddrregionWork), CCreatorPhonebookWrapper::EAddrRegionWork, EDataTypeText},
+       {TPtrC(KAddrpostcodeWork), CCreatorPhonebookWrapper::EAddrPostCodeWork, EDataTypeText},
+       {TPtrC(KAddrcountryWork), CCreatorPhonebookWrapper::EAddrCountryWork, EDataTypeText},
+       {TPtrC(KLandphoneGen), CCreatorPhonebookWrapper::ELandPhoneGen, EDataTypeText},
+       
+       {TPtrC(KMobilephoneGen), CCreatorPhonebookWrapper::EMobilePhoneGen, EDataTypeText},
+       {TPtrC(KVideonumberGen), CCreatorPhonebookWrapper::EVideoNumberGen, EDataTypeText},
+       {TPtrC(KFaxnumberGen), CCreatorPhonebookWrapper::EFaxNumberGen, EDataTypeText},
+       {TPtrC(KVoipGen), CCreatorPhonebookWrapper::EVoipGen, EDataTypeText},
+       {TPtrC(KPoc), CCreatorPhonebookWrapper::EPoc, EDataTypeText},
+       {TPtrC(KSwis), CCreatorPhonebookWrapper::ESwis, EDataTypeText},
+       {TPtrC(KSip), CCreatorPhonebookWrapper::ESip, EDataTypeText},
+       {TPtrC(KEmailGen), CCreatorPhonebookWrapper::EEmailGen, EDataTypeText},
+       
+       {TPtrC(KUrlGen), CCreatorPhonebookWrapper::EUrlGen, EDataTypeText},
+       {TPtrC(KAddrlabelGen), CCreatorPhonebookWrapper::EAddrLabelGen, EDataTypeText},
+       {TPtrC(KAddrpoGen), CCreatorPhonebookWrapper::EAddrPoGen, EDataTypeText},
+       {TPtrC(KAddrextGen), CCreatorPhonebookWrapper::EAddrExtGen, EDataTypeText},
+       {TPtrC(KAddrstreetGen), CCreatorPhonebookWrapper::EAddrStreetGen, EDataTypeText},
+       {TPtrC(KAddrlocalGen), CCreatorPhonebookWrapper::EAddrLocalGen, EDataTypeText},
+       {TPtrC(KAddrregionGen), CCreatorPhonebookWrapper::EAddrRegionGen, EDataTypeText},
+       {TPtrC(KAddrpostcodeGen), CCreatorPhonebookWrapper::EAddrPostCodeGen, EDataTypeText},
+       
+       {TPtrC(KAddrcountryGen), CCreatorPhonebookWrapper::EAddrCountryGen, EDataTypeText},
+       {TPtrC(KPagerNumber), CCreatorPhonebookWrapper::EPagerNumber, EDataTypeText},
+       {TPtrC(KDtmfString), CCreatorPhonebookWrapper::EDtmfString, EDataTypeText},
+       {TPtrC(KWvAddress), CCreatorPhonebookWrapper::EWVAddress, EDataTypeText},
+       {TPtrC(KDate), CCreatorPhonebookWrapper::EDate, EDataTypeDateTime},
+       {TPtrC(KNote), CCreatorPhonebookWrapper::ENote, EDataTypeText},
+       {TPtrC(KThumbnailPath), CCreatorPhonebookWrapper::EThumbnailPic, EDataTypeText},
+       {TPtrC(KThumbnailId), CCreatorPhonebookWrapper::EThumbnailPic, EDataTypeText},
+       {TPtrC(KRingTone), CCreatorPhonebookWrapper::ERingTone, EDataTypeText},
+       {TPtrC(KRingToneId), CCreatorPhonebookWrapper::ERingTone, EDataTypeText},
+       
+       {TPtrC(KCallerobjImg), CCreatorPhonebookWrapper::ECallerObjImg, EDataTypeText},
+       {TPtrC(KCallerobjText), CCreatorPhonebookWrapper::ECallerObjText, EDataTypeText},
+       {TPtrC(KMiddlename), CCreatorPhonebookWrapper::EMiddleName, EDataTypeText},
+       {TPtrC(KDepartment), CCreatorPhonebookWrapper::EDepartment, EDataTypeText},
+       {TPtrC(KAsstname), CCreatorPhonebookWrapper::EAsstName, EDataTypeText},
+       {TPtrC(KSpouse), CCreatorPhonebookWrapper::ESpouse, EDataTypeText},
+       {TPtrC(KChildren), CCreatorPhonebookWrapper::EChildren, EDataTypeText},
+       {TPtrC(KAsstphone), CCreatorPhonebookWrapper::EAsstPhone, EDataTypeText},
+       
+       {TPtrC(KCarphone), CCreatorPhonebookWrapper::ECarPhone, EDataTypeText},
+       {TPtrC(KAnniversary), CCreatorPhonebookWrapper::EAnniversary, EDataTypeDateTime},
+       {TPtrC(KSyncclass), CCreatorPhonebookWrapper::ESyncClass, EDataTypeText},
+       {TPtrC(KLocPrivacy), CCreatorPhonebookWrapper::ELocPrivacy, EDataTypeText},
+       {TPtrC(KGenlabel), CCreatorPhonebookWrapper::EGenLabel, EDataTypeText}
+};
+
+//*********************************************************************************
 
 CCreatorContactElementBase* CCreatorContactElementBase::NewL(CCreatorEngine* aEngine, const TDesC& aName, const TDesC& aContext)
     {
@@ -74,8 +168,107 @@
 
 
 void CCreatorContactElement::ExecuteCommandL()
+    {    
+    LOGSTRING("Creator: CCreatorContactElement::ExecuteCommandL");
+    // Find out how many contacts should we create:
+    const CCreatorScriptAttribute* contactAmountAttr = this->FindAttributeByName(KAmount);    
+    TInt contactAmount = 1;    
+    if( contactAmountAttr )
+        {
+        contactAmount = ConvertStrToIntL(contactAmountAttr->Value());
+        }
+    CCreatorScriptElement* fieldsElement = FindSubElement(KFields);
+    TInt fieldMappingTblSize = sizeof(fieldMappingTbl)/sizeof(FieldMapping);
+    for( TInt cI = 0; cI < contactAmount; ++cI )
+        {
+        CPhonebookParameters* param = (CPhonebookParameters*) TCreatorFactory::CreatePhoneBookParametersL();
+        CleanupStack::PushL(param);
+        // Loop all the field elements
+        if( fieldsElement && fieldsElement->SubElements().Count() > 0 )
+            {
+            
+            const RPointerArray<CCreatorScriptElement>& fieldList = fieldsElement->SubElements();
+            
+            if( fieldList.Count() == 0 )
+                {
+                
+                }
+            for( TInt i = 0; i < fieldList.Count(); ++i )
+                {
+                TPtrC fieldName = fieldList[i]->Name();
+                CCreatorContactField* field = 0;
+				field = CCreatorContactField::NewL();
+
+                const CCreatorScriptAttribute* amountAttr = fieldList[i]->FindAttributeByName(KAmount);
+                const CCreatorScriptAttribute* rndLenAttr = fieldList[i]->FindAttributeByName(KRandomLength);
+                const CCreatorScriptAttribute* increaseAttr = fieldList[i]->FindAttributeByName(KIncrease);
+                TBool increase( EFalse );
+                if ( increaseAttr )
+                    {
+                    increase = ConvertStrToBooleanL( increaseAttr->Value() );
+                    }
+                for( TInt j = 0; j < fieldMappingTblSize; ++j )
+                    {
+                    const FieldMapping& mapping = fieldMappingTbl[j];
+                    if( fieldName == mapping.iElementName )
+                        {
+                        TInt rndLen = 0;
+                        TPtrC content = fieldList[i]->Content();
+                                                                        
+//                        MCreatorRandomDataField::TRandomLengthType randomLenType = MCreatorRandomDataField::ERandomLengthUndefined;
+                    
+                        if( content == TPtrC(KEmpty) || content == TPtrC(KNullDesC) )
+                            {
+							CCreatorContactField* field = CCreatorContactField::NewL();
+                        	CleanupStack::PushL(field);
+                        	field->AddFieldToParamL( iEngine,param, mapping.iFieldCode, KErrNotFound );
+                          	CleanupStack::Pop(field);
+                            }
+                        else
+                        	{
+							CCreatorContactField* field = CCreatorContactField::NewL();
+                            CleanupStack::PushL(field);
+                            field->AddFieldToParamL( param, mapping.iFieldCode, content );
+                            CleanupStack::Pop(field);
+                        	}
+                        
+
+                        break;
+                        
+                        }
+                    }
+
+                }
+            } 
+        else
+            {
+            // No fields specified, so add all fields with random content:
+            for( TInt i = 0; i < fieldMappingTblSize; ++i )
+                {
+                if( fieldMappingTbl[i].iElementName == KThumbnailId || 
+                    fieldMappingTbl[i].iElementName == KRingToneId )
+                    {
+                    // Skip thumbnail and ringtone IDs, since they are duplicates with thumbnailpath and ringtonepath
+                    continue;
+                    }
+                CCreatorContactField* field = CCreatorContactField::NewL();
+                CleanupStack::PushL(field);
+                field->AddFieldToParamL( iEngine,param, fieldMappingTbl[i].iFieldCode, KErrNotFound );
+                CleanupStack::Pop(field);
+                }
+                
+            }
+        iEngine->AppendToCommandArrayL(ECmdCreatePhoneBookEntryContacts, param);
+        iParameters.AppendL(param); // Save the pointer to the parametes. 
+        CleanupStack::Pop(param);
+        }
+    }
+
+
+/*
+void CCreatorContactElement::ExecuteCommandL()
     {}
-
+*/
 CCreatorContactSetElement* CCreatorContactSetElement::NewL(CCreatorEngine* aEngine, const TDesC& aName, const TDesC& aContext)
     {
     LOGSTRING("Creator: CCreatorContactSetElement::NewL");
@@ -147,8 +340,55 @@
 
 
 void CCreatorContactGroupElement::ExecuteCommandL()
+    {
+    LOGSTRING("Creator: CCreatorContactGroupElement::ExecuteCommandL");
+    // Get attributes (amount and name)
+    const CCreatorScriptAttribute* groupAmountAttr = this->FindAttributeByName(KAmount);        
+    const CCreatorScriptAttribute* groupNameAttr = this->FindAttributeByName(KName);
+    // How many groups to create:
+    TInt groupAmount = 1;        
+    if( groupAmountAttr )
+        {
+        groupAmount = ConvertStrToIntL(groupAmountAttr->Value());
+        }
+    
+    for( TInt i = 0; i < groupAmount; ++i )
+        {        
+        CCreatorScriptElement* membersElement = FindSubElement(KMembers);
+        
+        if( membersElement )
+            {    
+            CPhonebookParameters* param = (CPhonebookParameters*) TCreatorFactory::CreatePhoneBookParametersL();            
+            CleanupStack::PushL(param);
+            
+            // Links to contact-sets:
+            const RPointerArray<CCreatorScriptElement>& linkList = membersElement->SubElements();
+            if( linkList.Count() > 0 )
+                {
+                for( TInt i = 0; i < linkList.Count(); ++i )
+                    {
+                    AppendContactSetReferenceL(*linkList[i], param->iLinkIds);
+                    }                
+                }
+            
+            if( groupNameAttr )
+                {
+				param->iGroupName->Des().Copy( groupNameAttr->Value() );
+                }
+            else
+            	{
+                param->iGroupName->Des().Copy( iEngine->RandomString(CCreatorEngine::EGroupName) );
+                }                
+            iEngine->AppendToCommandArrayL(ECmdCreatePhoneBookEntryGroups, param);
+            CleanupStack::Pop(param);
+            }
+        }
+    }
+
+/*
+void CCreatorContactGroupElement::ExecuteCommandL()
     {}
-
+*/
 CCreatorContactFieldElement* CCreatorContactFieldElement::NewL(CCreatorEngine* aEngine, const TDesC& aName, const TDesC& aContext)
     {
     LOGSTRING("Creator: CCreatorContactFieldElement::NewL");
--- a/creator/engine/src/creator_contactsetcache.cpp	Fri Jun 11 16:29:34 2010 +0100
+++ b/creator/engine/src/creator_contactsetcache.cpp	Thu Jul 22 16:33:59 2010 +0100
@@ -32,9 +32,31 @@
     return iLinkId;
     }
 
+void CCreatorContactSet::AppendL(TUint32 aContactLink)
+    {
+    iContactLinks.AppendL(aContactLink);
+    }
+
+RArray<TUint32> CCreatorContactSet::ContactLinks()
+    {
+    return iContactLinks;
+    }
+
+const RArray<TUint32> CCreatorContactSet::ContactLinks() const
+    {
+    return iContactLinks;
+    }
+
+
+TInt CCreatorContactSet::NumberOfExistingContacts() const
+    {
+    return iNumOfExistingContacts;
+    }
 
 CCreatorContactSet::~CCreatorContactSet()
     {
+    iContactLinks.Reset();
+    iContactLinks.Close();
     }
 
 
@@ -50,6 +72,10 @@
     static CContactLinkCacheImp* NewL();
     virtual ~CContactLinkCacheImp();
     virtual void AppendL(CCreatorContactSet* aContactSet); 
+
+    virtual RArray<TUint32> ContactLinks(TInt aLinkId);
+    virtual const RArray<TUint32> ContactLinks(TInt aLinkId) const;
+
     virtual RPointerArray<CCreatorContactSet>& ContactSets();
     virtual const RPointerArray<CCreatorContactSet>& ContactSets() const;
     virtual const CCreatorContactSet& ContactSet(TInt aLinkId) const;
@@ -58,6 +84,9 @@
 private:
     void ConstructL();
     CContactLinkCacheImp();
+    
+    RArray<TUint32> iEmptyLinks;
+
     RPointerArray<CCreatorContactSet> iContactSets;
     CCreatorContactSet* iDummyContactSet;
 };
@@ -83,6 +112,9 @@
 
 CContactLinkCacheImp::~CContactLinkCacheImp()
     {
+    iEmptyLinks.Reset();// just in case...
+    iEmptyLinks.Close();
+
     iContactSets.ResetAndDestroy();
     iContactSets.Close();
     delete iDummyContactSet;
@@ -91,6 +123,30 @@
     {
     iContactSets.AppendL(aContactSet);
     }
+RArray<TUint32> CContactLinkCacheImp::ContactLinks(TInt aLinkId)
+    {
+    for( TInt i = 0; i < iContactSets.Count(); ++i )
+        {
+        if( iContactSets[i]->LinkId() == aLinkId )
+            {
+            return iContactSets[i]->ContactLinks();
+            }
+        }
+    return iEmptyLinks;
+    }
+
+const RArray<TUint32> CContactLinkCacheImp::ContactLinks(TInt aLinkId) const
+    {
+    for( TInt i = 0; i < iContactSets.Count(); ++i )
+        {
+        if( iContactSets[i]->LinkId() == aLinkId )
+            {
+            return iContactSets[i]->ContactLinks();
+            }
+        }
+    return iEmptyLinks;
+    }
+
 
 const CCreatorContactSet& CContactLinkCacheImp::ContactSet(TInt aLinkId) const
     {
--- a/creator/engine/src/creator_factory.cpp	Fri Jun 11 16:29:34 2010 +0100
+++ b/creator/engine/src/creator_factory.cpp	Thu Jul 22 16:33:59 2010 +0100
@@ -19,7 +19,7 @@
 #include "engine.h"
 #include "creator_factory.h"
 
-#include "creator_accessPoint.h"
+//#include "creator_accesspoint.h"
 #include "creator_phonebook.h"
 
 CCreatorPhonebookBase* TCreatorFactory::CreatePhoneBookL(CCreatorEngine* aEngine)
@@ -29,10 +29,9 @@
 
 CCreatorModuleBaseParameters* TCreatorFactory::CreatePhoneBookParametersL()
 	{
-	//return new(ELeave) CVirtualPhonebookParameters;
-    return NULL;
+	return new(ELeave) CPhonebookParameters;
 	}
-
+/*
 CCreatorConnectionSettingsBase* TCreatorFactory::CreateConnectionSettingsL(CCreatorEngine* aEngine)
 {
     return CCreatorAccessPoints::NewL(aEngine); 
@@ -42,3 +41,4 @@
     {
     return new(ELeave) CAccessPointsParameters;
     }
+*/
--- a/creator/engine/src/creator_file.cpp	Fri Jun 11 16:29:34 2010 +0100
+++ b/creator/engine/src/creator_file.cpp	Thu Jul 22 16:33:59 2010 +0100
@@ -16,7 +16,7 @@
 */
 
 
-#include <drmrights.h>
+#include <DRMRights.h>
 
 #include "engine.h"
 #include "enginewrapper.h"
@@ -37,6 +37,7 @@
     LOGSTRING("Creator: CFilesParameters::CFilesParameters");
     iFullFilePath = HBufC::New(KFilesFieldLength);
     }
+
 CFilesParameters::CFilesParameters( CFilesParameters& aCopy )
     {
     LOGSTRING("Creator: CFilesParameters::CFilesParameters");
@@ -46,10 +47,13 @@
     iEncrypt = aCopy.iEncrypt;
     if ( aCopy.iPermission )
         {
-        iPermission = CDRMPermission::NewL();
-        iPermission->DuplicateL( *aCopy.iPermission );
+        TRAP_IGNORE(    
+            iPermission = CDRMPermission::NewL();
+            iPermission->DuplicateL( *aCopy.iPermission );
+            );
         }
     }
+
 CFilesParameters::~CFilesParameters()
     {
     LOGSTRING("Creator: CFilesParameters::~CFilesParameters");
@@ -85,7 +89,6 @@
 
     iEngine = aEngine;
 
-    iDirectoryQueriedFromUser = HBufC::New(KFilesFieldLength);
     User::LeaveIfError( iApaLs.Connect() );
     
     iFilePaths = new (ELeave) CDesCArrayFlat( 4 );
@@ -121,7 +124,6 @@
         TRAP_IGNORE( StorePathsForDeleteL( *iFilePaths ) );
         }
     delete iFilePaths;
-    delete iDirectoryQueriedFromUser;
     delete iParameters;
     delete iUserParameters;
     iApaLs.Close();
@@ -129,66 +131,182 @@
 
 //----------------------------------------------------------------------------
 
-TBool CCreatorFiles::AskDataFromUserL(TInt aCommand, TInt& aNumberOfEntries)
+void CCreatorFiles::QueryDialogClosedL(TBool aPositiveAction, TInt aUserData)
+    {
+    LOGSTRING("Creator: CCreatorFiles::QueryDialogClosedL");
+    
+    if( aPositiveAction == EFalse )
+        {
+        iEngine->ShutDownEnginesL();
+        return;
+        }
+    
+    const TDesC* showText = &KSavingText;
+    TBool finished(EFalse);
+    TBool retval(ETrue);
+    switch(aUserData)
+        {
+        case ECreatorFilesDelete:
+            showText = &KDeletingText;
+            iEntriesToBeCreated = 1;
+            finished = ETrue;
+            break;
+        case ECreatorFilesStart:
+            {
+            // set a default directory  (eg. c:\Nokia\Images\)
+            iEngine->SetDefaultPathForFileCommandL(iCommand, iDirectoryQueriedFromUser);
+            TBuf<50> promptText;
+            if (iCommand == ECmdCreateFileEntryEmptyFolder)
+                promptText.Copy( _L("Specify the folder path and name") );
+            else
+                promptText.Copy( _L("Specify the directory") );
+            
+            // show directory query dialog
+            retval = iEngine->GetEngineWrapper()->DirectoryQueryDialog(promptText, iDirectoryQueriedFromUser, this, ECreatorFilesGetDirectory );
+            }
+            break;
+        case ECreatorFilesGetDirectory:
+            // check that the root folder is correct
+            if ( iDirectoryQueriedFromUser.Length() < 3  ||  BaflUtils::CheckFolder( iFs, iDirectoryQueriedFromUser.Left(3) ) != KErrNone )
+                {
+                iEngine->GetEngineWrapper()->ShowErrorMessage(_L("Invalid path"));
+                retval = EFalse;
+                }        
+            else
+                {
+                // check the directory contains a trailing backlash
+                if ( iDirectoryQueriedFromUser.Right(1) != _L("\\") )
+                    {
+                    iDirectoryQueriedFromUser.Append(_L("\\"));
+                    }
+                // copy the directory name to a class member
+                if ( iCommand == ECmdCreateFileEntryEmptyFolder )
+                    {
+                    finished = ETrue;
+                    }
+                else
+                    {
+                    retval = AskDRMDataFromUserL();
+                    }
+                }
+            break;
+        case ECreatorFilesAskDRMData:
+            if ( iDummy > 0 )
+                {
+                iUserParameters->iEncrypt = ETrue;
+                }
+            if ( iDummy == 2 )
+                {
+                iUserParameters->iPermission = CDRMPermission::NewL();
+                CDRMPermission* perm = iUserParameters->iPermission; 
+                perm->iTopLevel->iActiveConstraints = EConstraintNone;
+                perm->iPlay->iActiveConstraints = EConstraintNone;
+                perm->iDisplay->iActiveConstraints = EConstraintNone;
+                perm->iPrint->iActiveConstraints = EConstraintNone;
+                perm->iExecute->iActiveConstraints = EConstraintNone;
+                perm->iUniqueID = 0;
+                // DRM Combined Delivery
+                iDummy = 0;
+                retval = iEngine->GetEngineWrapper()->EntriesQueryDialog( &iDummy, _L("How many counts(0=unlimited)?"), ETrue, this, ECreatorFilesAskDRM_CD_Counts );
+                }
+            else
+                {
+                finished = ETrue;
+                }
+            break;
+        case ECreatorFilesAskDRM_CD_Counts:
+            if ( iDummy > 0 )
+                {
+                TInt count = iDummy;
+                CDRMPermission* perm = iUserParameters->iPermission;
+                // apply constraints to all permission types
+                // applied type will be selected by setting iAvailableRights
+                // when determining the file type
+                perm->iDisplay->iActiveConstraints |= EConstraintCounter;
+                perm->iDisplay->iCounter = count;
+                perm->iDisplay->iOriginalCounter = count;
+    
+                perm->iPlay->iActiveConstraints |= EConstraintCounter;
+                perm->iPlay->iCounter = count;
+                perm->iPlay->iOriginalCounter = count;
+    
+                perm->iPrint->iActiveConstraints |= EConstraintCounter;
+                perm->iPrint->iCounter = count;
+                perm->iPrint->iOriginalCounter = count;
+                
+                perm->iExecute->iActiveConstraints |= EConstraintCounter;
+                perm->iExecute->iCounter = count;
+                perm->iExecute->iOriginalCounter = count;
+                }
+            iDummy = 0;
+            retval = iEngine->GetEngineWrapper()->EntriesQueryDialog( &iDummy, _L("How many minutes until expire(0=unlimited)?"), ETrue, 
+                this, ECreatorFilesAskDRM_CD_Minutes
+                );
+            break;
+        case ECreatorFilesAskDRM_CD_Minutes:
+            if ( iDummy > 0 )
+                {
+                TInt minutes = iDummy;
+                CDRMPermission* perm = iUserParameters->iPermission;            
+                // apply constraints to all permission types
+                // applied type will be selected by setting iAvailableRights
+                // when determining the file type            
+                perm->iDisplay->iActiveConstraints |= EConstraintInterval;
+                perm->iDisplay->iInterval = TTimeIntervalSeconds( 60 * minutes );
+                perm->iDisplay->iIntervalStart = Time::NullTTime();
+                
+                perm->iPlay->iActiveConstraints |= EConstraintInterval;
+                perm->iPlay->iInterval = TTimeIntervalSeconds( 60 * minutes );
+                perm->iPlay->iIntervalStart = Time::NullTTime();
+    
+                perm->iPrint->iActiveConstraints |= EConstraintInterval;
+                perm->iPrint->iInterval = TTimeIntervalSeconds( 60 * minutes );
+                perm->iPrint->iIntervalStart = Time::NullTTime();
+    
+                perm->iExecute->iActiveConstraints |= EConstraintInterval;
+                perm->iExecute->iInterval = TTimeIntervalSeconds( 60 * minutes );
+                perm->iExecute->iIntervalStart = Time::NullTTime();
+                }
+            finished = ETrue;
+            break;
+        default:
+            //some error
+            retval = EFalse;
+            break;
+        }
+    if( retval == EFalse )
+        {
+        iEngine->ShutDownEnginesL();
+        }
+    else if( finished )
+        {
+        // add this command to command array
+        iEngine->AppendToCommandArrayL(iCommand, NULL, iEntriesToBeCreated);
+        // started exucuting commands
+        iEngine->ExecuteFirstCommandL( *showText );
+        }
+    }
+
+//----------------------------------------------------------------------------
+
+TBool CCreatorFiles::AskDataFromUserL(TInt aCommand)
     {
     LOGSTRING("Creator: CCreatorFiles::AskDataFromUserL");
     
+    CCreatorModuleBase::AskDataFromUserL( aCommand );
+    
     if ( aCommand == ECmdDeleteCreatorFiles )
         {
-        return iEngine->GetEngineWrapper()->YesNoQueryDialog( _L("Delete all files created with Creator?") );
+        return iEngine->GetEngineWrapper()->YesNoQueryDialog( _L("Delete all files created with Creator?"), this, ECreatorFilesDelete );
         }
     
     delete iUserParameters;
     iUserParameters = NULL;
     iUserParameters = new(ELeave) CFilesParameters();
     
-    iDirectoryQueriedFromUser->Des().Copy( KNullDesC );
-
-    if (iEngine->GetEngineWrapper()->EntriesQueryDialog(aNumberOfEntries, _L("How many entries to create?")))
-        {
-        // set a default directory  (eg. c:\Nokia\Images\)
-        TFileName directory;
-        iEngine->SetDefaultPathForFileCommandL(aCommand, directory);
-
-        // directory query dialog
-		/*
-        CAknTextQueryDialog* textDialog = CAknTextQueryDialog::NewL(directory, CAknQueryDialog::ENoTone);
-        textDialog->SetMaxLength(256);
-		*/
-		
-        TBuf<50> promptText;
+    iDirectoryQueriedFromUser.Copy( KNullDesC );
 
-        if (aCommand == ECmdCreateFileEntryEmptyFolder)
-            promptText.Copy( _L("Specify the folder path and name") );
-        else
-            promptText.Copy( _L("Specify the directory") );
-		// show directory query dialog
-        if (iEngine->GetEngineWrapper()->DirectoryQueryDialog(promptText, directory))
-            {
-	        // check that the root folder is correct
-            if (directory.Length() < 3  ||  BaflUtils::CheckFolder(iFs, directory.Left(3)) != KErrNone)
-                {
-                iEngine->GetEngineWrapper()->ShowErrorMessage(_L("Invalid path"));
-                return EFalse;
-                }        
-            else
-                {
-                // check the directory contains a trailing backlash
-                if (directory.Right(1) != _L("\\"))
-                    directory.Append(_L("\\"));
-
-                // copy the directory name to a class member
-                iDirectoryQueriedFromUser->Des() = directory;
-                if ( aCommand == ECmdCreateFileEntryEmptyFolder ) return ETrue;
-                else return AskDRMDataFromUserL();
-                }
-            }        
-        else
-            return EFalse;
-        }
-    else 
-        return EFalse;
-
+    return iEngine->GetEngineWrapper()->EntriesQueryDialog(&iEntriesToBeCreated, _L("How many entries to create?"), EFalse, this, ECreatorFilesStart );
     }
 
 
@@ -226,8 +344,8 @@
     if ( aCommand == ECmdCreateFileEntryEmptyFolder)
         {
         // strip the last backslash from the path
-        if( iDirectoryQueriedFromUser && iDirectoryQueriedFromUser->Des().Length() > 0)
-        	directoryToBeCreated = iDirectoryQueriedFromUser->Des();
+        if( iDirectoryQueriedFromUser.Length() > 0)
+        	directoryToBeCreated = iDirectoryQueriedFromUser;
         else if( parameters->iFullFilePath && parameters->iFullFilePath->Des().Length() > 0 )
         	directoryToBeCreated = parameters->iFullFilePath->Des();
         else 
@@ -332,13 +450,13 @@
             LOGSTRING2("Creator: CCreatorFiles::CreateFileEntryL iFullFilePath used, fullTargetPath: %S", &fullTargetPath);
             }
     
-        else if ( iDirectoryQueriedFromUser && iDirectoryQueriedFromUser->Des().Length() > 0 )
+        else if ( iDirectoryQueriedFromUser.Length() > 0 )
             {
             // target path = directory + the file name from source path
             TParse parser;
             parser.Set(fullSourcePath, NULL, NULL);
 
-            fullTargetPath = iDirectoryQueriedFromUser->Des();
+            fullTargetPath = iDirectoryQueriedFromUser;
             fullTargetPath.Append( parser.NameAndExt() );
 
             LOGSTRING2("Creator: CCreatorFiles::CreateFileEntryL iDirectoryQueriedFromUser used, fullTargetPath: %S", &fullTargetPath);
@@ -409,7 +527,7 @@
         SetPermissionsL( metaData, aOutFileName, aParameters );
         }
     
-    supplier->SetOutputDirectoryL( *iDirectoryQueriedFromUser );
+    supplier->SetOutputDirectoryL( iDirectoryQueriedFromUser );
     
     // The KOmaImportContentType is a OMA DRM agent specific MIME type which
     // indicates that plain content is to be encrypted
@@ -559,12 +677,6 @@
     {
     LOGSTRING("Creator: CCreatorFiles::AskDRMDataFromUserL");
     // Encryption -dialog
-    TInt encIndex( 0 );
-	
-
-    //CAknListQueryDialog* encDlg = new (ELeave) CAknListQueryDialog( &encIndex );
-    //encDlg->PrepareLC( R_ENCRYPTION_DIALOG );
-    //Create flat array from which list is built.
     CDesCArrayFlat* items = new(ELeave) CDesCArrayFlat(5);
     CleanupStack::PushL(items);
 
@@ -573,144 +685,12 @@
     items->AppendL( _L("DRM Forward Lock") );
     items->AppendL( _L("DRM Combined Delivery") );
 
-    // Add items into main list
-    //encDlg->SetOwnershipType( ELbmOwnsItemArray );
-    //encDlg->SetItemTextArray( items );
-    CleanupStack::Pop( items );
-    //encDlg->ListBox()->SetCurrentItemIndexAndDraw( 0 );
-
+    
 	// create a popup list
-    if ( iEngine->GetEngineWrapper()->PopupListDialog(_L("Encryption"), items, encIndex) )
-        {
-        if ( encIndex > 0 )
-            {
-            iUserParameters->iEncrypt = ETrue;
-            }
-        if ( encIndex == 2 )
-            {
-            iUserParameters->iPermission = CDRMPermission::NewL();
-            CDRMPermission* perm = iUserParameters->iPermission; 
-            perm->iTopLevel->iActiveConstraints = EConstraintNone;
-            perm->iPlay->iActiveConstraints = EConstraintNone;
-            perm->iDisplay->iActiveConstraints = EConstraintNone;
-            perm->iPrint->iActiveConstraints = EConstraintNone;
-            perm->iExecute->iActiveConstraints = EConstraintNone;
-            perm->iUniqueID = 0;
-            // DRM Combined Delivery
-            return AskDRMCDDataFromUserL();
-            }
-        return ETrue;
-        }
-    else
-        {
-        return EFalse;
-        } 
-    }
-
-//----------------------------------------------------------------------------
-
-TBool CCreatorFiles::AskDRMCDDataFromUserL()
-    {
-    LOGSTRING("Creator: CCreatorFiles::AskDRMCDDataFromUserL");
-    TInt count( 0 );
-    if ( iEngine->GetEngineWrapper()->EntriesQueryDialog( count, _L("How many counts\r\n(0=unlimited)?"), ETrue ) )
-        {
-        if ( count > 0 )
-            {
-            CDRMPermission* perm = iUserParameters->iPermission;
-            // apply constraints to all permission types
-            // applied type will be selected by setting iAvailableRights
-            // when determining the file type
-            perm->iDisplay->iActiveConstraints |= EConstraintCounter;
-            perm->iDisplay->iCounter = count;
-            perm->iDisplay->iOriginalCounter = count;
-
-            perm->iPlay->iActiveConstraints |= EConstraintCounter;
-            perm->iPlay->iCounter = count;
-            perm->iPlay->iOriginalCounter = count;
-
-            perm->iPrint->iActiveConstraints |= EConstraintCounter;
-            perm->iPrint->iCounter = count;
-            perm->iPrint->iOriginalCounter = count;
-            
-            perm->iExecute->iActiveConstraints |= EConstraintCounter;
-            perm->iExecute->iCounter = count;
-            perm->iExecute->iOriginalCounter = count;
-            }
-        }
-    else
-        {
-        return EFalse;
-        }
-    /*
-    TInt seconds( 0 );
-    if ( iEngine->GetEngineWrapper()->EntriesQueryDialog( seconds, _L("How many accumulated seconds until expire (0=unlimited)?"), ETrue ) )
-        {
-        if ( seconds > 0 )
-            {
-            CDRMPermission* perm = iUserParameters->iPermission;            
-            // apply constraints to all permission types
-            // applied type will be selected by setting iAvailableRights
-            // when determining the file type            
-            perm->iDisplay->iActiveConstraints |= EConstraintAccumulated;
-            perm->iDisplay->iEndTime = Time::MaxTTime();
-            perm->iDisplay->iStartTime = Time::MinTTime();;
-            perm->iDisplay->iAccumulatedTime = seconds;
-            
-            perm->iPlay->iActiveConstraints |= EConstraintAccumulated;
-            perm->iPlay->iEndTime = Time::MaxTTime();
-            perm->iPlay->iStartTime = Time::MinTTime();;
-            perm->iPlay->iAccumulatedTime = seconds;
-
-            perm->iPrint->iActiveConstraints |= EConstraintAccumulated;
-            perm->iPrint->iEndTime = Time::MaxTTime();
-            perm->iPrint->iStartTime = Time::MinTTime();;
-            perm->iPrint->iAccumulatedTime = seconds;
-
-            perm->iExecute->iActiveConstraints |= EConstraintAccumulated;
-            perm->iExecute->iEndTime = Time::MaxTTime();
-            perm->iExecute->iStartTime = Time::MinTTime();;
-            perm->iExecute->iAccumulatedTime = seconds;
-            }
-        }
-    else
-        {
-        return EFalse;
-        }
-    */
-    
-    TInt minutes( 0 );
-    if ( iEngine->GetEngineWrapper()->EntriesQueryDialog( minutes, _L("How many minutes until expire (0=unlimited)?"), ETrue ) )
-        {
-        if ( minutes > 0 )
-            {
-            CDRMPermission* perm = iUserParameters->iPermission;            
-            // apply constraints to all permission types
-            // applied type will be selected by setting iAvailableRights
-            // when determining the file type            
-            perm->iDisplay->iActiveConstraints |= EConstraintInterval;
-            perm->iDisplay->iInterval = TTimeIntervalSeconds( 60 * minutes );
-            perm->iDisplay->iIntervalStart = Time::NullTTime();
-            
-            perm->iPlay->iActiveConstraints |= EConstraintInterval;
-            perm->iPlay->iInterval = TTimeIntervalSeconds( 60 * minutes );
-            perm->iPlay->iIntervalStart = Time::NullTTime();
-
-            perm->iPrint->iActiveConstraints |= EConstraintInterval;
-            perm->iPrint->iInterval = TTimeIntervalSeconds( 60 * minutes );
-            perm->iPrint->iIntervalStart = Time::NullTTime();
-
-            perm->iExecute->iActiveConstraints |= EConstraintInterval;
-            perm->iExecute->iInterval = TTimeIntervalSeconds( 60 * minutes );
-            perm->iExecute->iIntervalStart = Time::NullTTime();
-            }
-        }
-    else
-        {
-        return EFalse;
-        }
-    
-    return ETrue;
+    iDummy = 0;
+    TBool retval = iEngine->GetEngineWrapper()->PopupListDialog(_L("Encryption"), items, &iDummy, this, ECreatorFilesAskDRMData );
+    CleanupStack::PopAndDestroy( items );
+    return retval;
     }
 
 //----------------------------------------------------------------------------
--- a/creator/engine/src/creator_fileelement.cpp	Fri Jun 11 16:29:34 2010 +0100
+++ b/creator/engine/src/creator_fileelement.cpp	Thu Jul 22 16:33:59 2010 +0100
@@ -18,8 +18,8 @@
 
 
 #include "creator_fileelement.h"
-#include <drmpermission.h>
-#include <drmconstraint.h>
+#include <DrmPermission.h>
+#include <DrmConstraint.h>
 #include "creator_traces.h"
 #include "creator_file.h"
 
--- a/creator/engine/src/creator_landmark.cpp	Fri Jun 11 16:29:34 2010 +0100
+++ b/creator/engine/src/creator_landmark.cpp	Thu Jul 22 16:33:59 2010 +0100
@@ -16,8 +16,8 @@
 */
 
 
-#include <epos_cposlandmarkdatabase.h>
-#include <epos_cposlmcategorymanager.h>
+#include <EPos_CPosLandmarkDatabase.h>
+#include <EPos_CPosLmCategoryManager.h>
 #include <lbsposition.h>
 
 #include "engine.h"
@@ -353,18 +353,21 @@
 /**
  *
  */
-TBool CCreatorLandmarks::AskDataFromUserL(TInt aCommand, TInt& aNumberOfEntries)
+TBool CCreatorLandmarks::AskDataFromUserL(TInt aCommand)
     {
     LOGSTRING("Creator: CCreatorLandmarks::AskDataFromUserL");
+    
+    CCreatorModuleBase::AskDataFromUserL( aCommand );
+    
     if ( aCommand == ECmdDeleteLandmarks )
         {
-        return iEngine->GetEngineWrapper()->YesNoQueryDialog( _L("Delete all Landmarks?") );
+        return iEngine->GetEngineWrapper()->YesNoQueryDialog( _L("Delete all Landmarks?"), this, ECreatorModuleDelete );
         }
     else if ( aCommand ==  ECmdDeleteCreatorLandmarks )
         {
-        return iEngine->GetEngineWrapper()->YesNoQueryDialog( _L("Delete all Landmarks created with Creator?") );
+        return iEngine->GetEngineWrapper()->YesNoQueryDialog( _L("Delete all Landmarks created with Creator?"), this, ECreatorModuleDelete );
         }
-    return iEngine->GetEngineWrapper()->EntriesQueryDialog(aNumberOfEntries, _L("How many landmarks to create?"));    
+    return iEngine->GetEngineWrapper()->EntriesQueryDialog(&iEntriesToBeCreated, _L("How many landmarks to create?"), EFalse, this, ECreatorModuleStart );    
     }
 
 /**
--- a/creator/engine/src/creator_log.cpp	Fri Jun 11 16:29:34 2010 +0100
+++ b/creator/engine/src/creator_log.cpp	Thu Jul 22 16:33:59 2010 +0100
@@ -69,6 +69,7 @@
 
 CCreatorLogs::CCreatorLogs() : CActive(0)
     {
+    iEntriesToBeCreated = 1;
     }
 
 void CCreatorLogs::ConstructL(CCreatorEngine* aEngine)
@@ -105,18 +106,64 @@
 
 //----------------------------------------------------------------------------
 
-TBool CCreatorLogs::AskDataFromUserL(TInt aCommand, TInt& aNumberOfEntries)
+void CCreatorLogs::QueryDialogClosedL(TBool aPositiveAction, TInt aUserData)
+    {
+    LOGSTRING("Creator: CCreatorModuleBase::QueryDialogClosedL");
+    
+    if( aPositiveAction == EFalse )
+        {
+        iEngine->ShutDownEnginesL();
+        return;
+        }
+    
+    const TDesC* showText = &KSavingText;
+    TBool finished(EFalse);
+    TBool retval(ETrue);
+    switch(aUserData)
+        {
+        case ECreatorLogsDelete:
+            showText = &KDeletingText;
+            iEntriesToBeCreated = 1;
+            finished = ETrue;
+            break;
+        case ECreatorLogsStart:
+            finished = ETrue;
+            break;
+        default:
+            //some error
+            retval = EFalse;
+            break;
+        }
+    if( retval == EFalse )
+        {
+        iEngine->ShutDownEnginesL();
+        }
+    else if( finished )
+        {
+        // add this command to command array
+        iEngine->AppendToCommandArrayL(iCommand, NULL, iEntriesToBeCreated);
+        // started exucuting commands
+        iEngine->ExecuteFirstCommandL( *showText );
+        }
+    }
+    
+//----------------------------------------------------------------------------
+
+TBool CCreatorLogs::AskDataFromUserL(TInt aCommand)
     {
     LOGSTRING("Creator: CCreatorLogs::AskDataFromUserL");
+    
+    iCommand = aCommand;
+    
     if ( aCommand == ECmdDeleteLogs )
         {
-        return iEngine->GetEngineWrapper()->YesNoQueryDialog( _L("Delete all log entries?") );
+        return iEngine->GetEngineWrapper()->YesNoQueryDialog( _L("Delete all log entries?"), this, ECreatorLogsDelete );
         }
     else if ( aCommand ==  ECmdDeleteCreatorLogs )
         {
-        return iEngine->GetEngineWrapper()->YesNoQueryDialog( _L("Delete all log entries created with Creator?") );
+        return iEngine->GetEngineWrapper()->YesNoQueryDialog( _L("Delete all log entries created with Creator?"), this, ECreatorLogsDelete );
         }
-    return iEngine->GetEngineWrapper()->EntriesQueryDialog( aNumberOfEntries, _L("How many entries to create?") );
+    return iEngine->GetEngineWrapper()->EntriesQueryDialog( &iEntriesToBeCreated, _L("How many entries to create?"), EFalse, this, ECreatorLogsStart );
     }
 
 //----------------------------------------------------------------------------
--- a/creator/engine/src/creator_mailbox.cpp	Fri Jun 11 16:29:34 2010 +0100
+++ b/creator/engine/src/creator_mailbox.cpp	Thu Jul 22 16:33:59 2010 +0100
@@ -134,18 +134,21 @@
 
 //----------------------------------------------------------------------------
 
-TBool CCreatorMailboxes::AskDataFromUserL(TInt aCommand, TInt& aNumberOfEntries)
+TBool CCreatorMailboxes::AskDataFromUserL(TInt aCommand)
     {
     LOGSTRING("Creator: CCreatorMailboxes::AskDataFromUserL");
+    
+    CCreatorModuleBase::AskDataFromUserL( aCommand );//ignore retval
+    
     if ( aCommand == ECmdDeleteMailboxes )
         {
-        return iEngine->GetEngineWrapper()->YesNoQueryDialog( _L("Delete all mailboxes?") );
+        return iEngine->GetEngineWrapper()->YesNoQueryDialog( _L("Delete all mailboxes?"), this, ECreatorModuleDelete );
         }
     else if ( aCommand ==  ECmdDeleteCreatorMailboxes )
         {
-        return iEngine->GetEngineWrapper()->YesNoQueryDialog( _L("Delete all mailboxes created with Creator?") );
+        return iEngine->GetEngineWrapper()->YesNoQueryDialog( _L("Delete all mailboxes created with Creator?"), this, ECreatorModuleDelete );
         }
-    return iEngine->GetEngineWrapper()->EntriesQueryDialog(aNumberOfEntries, _L("How many entries to create?"));
+    return iEngine->GetEngineWrapper()->EntriesQueryDialog( &iEntriesToBeCreated, _L("How many entries to create?"), EFalse, this, ECreatorModuleStart );
     }
 
 
--- a/creator/engine/src/creator_message.cpp	Fri Jun 11 16:29:34 2010 +0100
+++ b/creator/engine/src/creator_message.cpp	Thu Jul 22 16:33:59 2010 +0100
@@ -24,6 +24,7 @@
 #include "creator_contactsetcache.h"
 #include <apgcli.h>
 #include <MuiuServiceUtilities.h>
+#include <utf.h>
 
 #include <mmf/common/mmfcontrollerpluginresolver.h> // for CleanupResetAndDestroyPushL
 
@@ -123,187 +124,131 @@
 
 //----------------------------------------------------------------------------
 
-TBool CCreatorMessages::AskDataFromUserL(TInt aCommand, TInt& aNumberOfEntries)
+void CCreatorMessages::QueryDialogClosedL(TBool aPositiveAction, TInt aUserData)
+    {
+    LOGSTRING("Creator: CCreatorMessages::QueryDialogClosedL");  
+    
+    if( aPositiveAction == EFalse )
+        {
+        iEngine->ShutDownEnginesL();
+        return;
+        }
+    
+    const TDesC* showText = &KSavingText;
+    TBool finished(EFalse);
+    TBool retval(ETrue);
+    switch(aUserData)
+        {
+        case ECreatorMessagesDelete:
+            showText = &KDeletingText;
+            iEntriesToBeCreated = 1;
+            finished = ETrue;
+            break;
+        case ECreatorMessagesStart:
+            // message type query
+            retval = iEngine->GetEngineWrapper()->ListQueryDialog(_L("Message type"), R_MESSAGE_TYPE_QUERY, (TInt*) &iMessageType, this, ECreatorMessagesMessageType);
+            break;
+        case ECreatorMessagesMessageType:
+            retval = iEngine->GetEngineWrapper()->ListQueryDialog(_L("Folder type"), R_FOLDER_TYPE_QUERY, (TInt*) &iFolderType, this, ECreatorMessagesFolderType);
+            break;
+        case ECreatorMessagesFolderType:
+            // query create as unread
+            retval = iEngine->GetEngineWrapper()->ListQueryDialog(_L("Message status"), R_UNREAD_QUERY, (TInt*)&iCreateAsUnread, this, ECreatorMessagesMessageStatus);
+            break;
+        case ECreatorMessagesMessageStatus:
+            if( iMessageType == ESMS || iMessageType == EMMS || iMessageType == EEmail )
+                {
+                iDefinedMessageLength = 100;
+                retval = iEngine->GetEngineWrapper()->EntriesQueryDialog(&iDefinedMessageLength, _L("Amount of characters in message body?"), ETrue, 
+                    this, ECreatorMessagesCharsInBody
+                    );
+                break;
+                }
+            else
+                {
+                iDefinedMessageLength = 0;
+                // goto query attachments ... :-) DO NOT break;
+                }
+        case ECreatorMessagesCharsInBody:
+            // query attachments
+            iAttachments->Reset();
+            if( iMessageType == EMMS || iMessageType == EEmail)
+                {
+                retval = iEngine->GetEngineWrapper()->ListQueryDialog(_L("Choose attachment:"), R_ATTACHMENT_MULTI_SELECTION_QUERY, 
+                    iAttachments, this, ECreatorMessagesAttachment
+                    );
+                }
+            else if( iMessageType == EAMS )
+                {
+                iAttachments->AppendL( TInt(0) );
+                retval = iEngine->GetEngineWrapper()->ListQueryDialog(_L("Choose attachment:"), R_AMS_ATTACHMENT_SINGLE_SELECTION_QUERY, 
+                    &iAttachments->At(0), this, ECreatorMessagesAttachment
+                    );
+                }
+            else if( iMessageType == EIrMessage || iMessageType == EBTMessage )
+                {
+                iAttachments->AppendL( TInt(0) );
+                retval = iEngine->GetEngineWrapper()->ListQueryDialog(_L("Choose attachment:"), R_ATTACHMENT_SINGLE_SELECTION_QUERY,
+                    &iAttachments->At(0), this, ECreatorMessagesAttachment
+                    );
+                }
+            else
+                {
+                finished = ETrue;
+                }
+            break;
+        case ECreatorMessagesAttachment:
+            finished = ETrue;
+            if(iMessageType== EMMS || iMessageType == EEmail)
+                {
+                // "none" is selected
+                if (iAttachments->At(0) == 0)
+                    {
+                    iAttachments->Reset();
+                    }
+                else  // otherwise fix indexes
+                    {
+                    for (TInt i=0; i<iAttachments->Count(); i++)
+                        iAttachments->At(i)--;  // decrease value by one 
+
+                    }
+                }
+            break;
+        default:
+            //some error
+            retval = EFalse;
+            break;
+        }
+    if( retval == EFalse )
+        {
+        iEngine->ShutDownEnginesL();
+        }
+    else if( finished )
+        {
+        // add this command to command array
+        iEngine->AppendToCommandArrayL(iCommand, NULL, iEntriesToBeCreated);
+        // started exucuting commands
+        iEngine->ExecuteFirstCommandL( *showText );
+        }
+    }
+//----------------------------------------------------------------------------
+
+TBool CCreatorMessages::AskDataFromUserL(TInt aCommand)
     {
     LOGSTRING("Creator: CCreatorMessages::AskDataFromUserL");
 
+    CCreatorModuleBase::AskDataFromUserL(aCommand);
+    
     if ( aCommand == ECmdDeleteMessages )
         {
-        return iEngine->GetEngineWrapper()->YesNoQueryDialog( _L("Delete all messages?") );
+        return iEngine->GetEngineWrapper()->YesNoQueryDialog( _L("Delete all messages?"), this, ECreatorMessagesDelete );
         }
     else if ( aCommand ==  ECmdDeleteCreatorMessages )
         {
-        return iEngine->GetEngineWrapper()->YesNoQueryDialog( _L("Delete all messages created with Creator?") );
+        return iEngine->GetEngineWrapper()->YesNoQueryDialog( _L("Delete all messages created with Creator?"), this, ECreatorMessagesDelete  );
         }
 
-    if (iEngine->GetEngineWrapper()->EntriesQueryDialog(aNumberOfEntries, _L("How many entries to create?")))
-        {
-        
-        // message type query
-        if (iEngine->GetEngineWrapper()->ListQueryDialog(_L("Message type"), R_MESSAGE_TYPE_QUERY, (TInt&) iMessageType))
-            {
-			if (iEngine->GetEngineWrapper()->ListQueryDialog(_L("Folder type"), R_FOLDER_TYPE_QUERY, (TInt&) iFolderType))
-                {
-                /*
-                if (iFolderType == EMailbox)
-                    {
-                    // array to hold mailbox names
-                    CDesCArray* names = new (ELeave) CDesCArrayFlat(16);
-                    CleanupStack::PushL(names);                    
-                    
-                    CMsvSession* session = CMsvSession::OpenSyncL(*this);
-                    CleanupStack::PushL(session);
-    
-                    // generate list of mailboxes
-                    CMsvEntrySelection* entrySelection = MsvUiServiceUtilities::GetListOfAccountsWithMTML(*session, KUidMsgTypeSMTP, ETrue);
-                    CleanupStack::PushL(entrySelection);
-
-                    TBool doReturn(EFalse);
-                    
-                    if (entrySelection->Count() == 0)
-                        {
-                        CAknInformationNote* note = new(ELeave) CAknInformationNote;
-                        note->ExecuteLD(_L("No mailboxes found"));
-
-                        doReturn = ETrue;
-                        }
-                    else
-                        {
-                        // get mailbox names
-                        for (TInt i=0; i<entrySelection->Count(); i++)
-                            {
-                            CMsvEntry* centry = session->GetEntryL(entrySelection->At(i));
-                            CleanupStack::PushL(centry);
-
-                            TMsvEntry tentry = centry->Entry();
-                            names->AppendL(tentry.iDetails);
-                            CleanupStack::PopAndDestroy(); //centry
-                            }
-                        
-                        // show query
-                        TInt index(0);
-                        CAknListQueryDialog* dlg = new(ELeave) CAknListQueryDialog(&index);
-                        dlg->PrepareLC(R_MAILBOX_SELECTION_QUERY);
-                        dlg->SetItemTextArray(names);
-                        dlg->SetOwnershipType(ELbmDoesNotOwnItemArray);
-
-                        if(dlg->RunLD())
-                            {
-                            iUserSelectedMailbox = entrySelection->At(index);
-
-                            doReturn = EFalse;
-                            }
-                        else
-                            {
-                            doReturn = ETrue;
-                            }    
-                        
-                        }
-                    
-                    CleanupStack::PopAndDestroy(3); // names, session, entrySelection
-                    
-                    if (doReturn)
-                        return EFalse;                    
-                    }
-                */
-
-                // query create as unread
-                if (iEngine->GetEngineWrapper()->ListQueryDialog(_L("Message status"), R_UNREAD_QUERY, (TInt&)iCreateAsUnread))
-                    {                
-                    // query number of characters in msg body
-                    switch (iMessageType)
-                        {
-                        case ESMS:
-                        case EMMS:
-                        case EEmail:
-                            {
-                            iDefinedMessageLength = 100;
-                            if (iEngine->GetEngineWrapper()->EntriesQueryDialog(iDefinedMessageLength, _L("Amount of characters in message body?"), ETrue))
-                                {
-                                ;
-                                }
-                            else
-                                return EFalse;
-
-                            break;
-                            }
-                        case EAMS:
-                        	{
-                        	iDefinedMessageLength = 0;
-                        	break;
-                        	}
-                        default: break;
-                        }
-
-                    // query attachments
-                    iAttachments->Reset();
-              
-                    switch (iMessageType)
-                        {
-                        case EMMS:
-                        case EEmail:
-                            {
-                            if (iEngine->GetEngineWrapper()->ListQueryDialog(_L("Choose attachment:"), R_ATTACHMENT_MULTI_SELECTION_QUERY, iAttachments))
-                                {
-                                // "none" is selected
-                                if (iAttachments->At(0) == 0)
-                                    iAttachments->Reset();
-                                else  // otherwise fix indexes
-                                    {
-                                    for (TInt i=0; i<iAttachments->Count(); i++)
-                                        iAttachments->At(i)--;  // decrease value by one 
-
-                                    }
-                                }
-                            else
-                                return EFalse;
-                            
-                            break;
-                            }
-                        case EAMS:
-                        	{
-                            iAttachments->AppendL( TInt(0) );
-                            if (iEngine->GetEngineWrapper()->ListQueryDialog(_L("Choose attachment:"), R_AMS_ATTACHMENT_SINGLE_SELECTION_QUERY, iAttachments->At(0)))
-                                {
-                                ;
-                                }
-                            else
-                                return EFalse;                        
-
-                            break;
-                        	}
-                            
-                        case EIrMessage:
-                        case EBTMessage:
-                            {
-                            iAttachments->AppendL( TInt(0) );
-                            if (iEngine->GetEngineWrapper()->ListQueryDialog(_L("Choose attachment:"), R_ATTACHMENT_SINGLE_SELECTION_QUERY, iAttachments->At(0)))
-                                {
-                                ;
-                                }
-                            else
-                                return EFalse;                        
-
-                            break;
-                            }
-                        default: break;
-                        }
-                    
-                    return ETrue;  // all queries accepted
-
-                    }
-                else
-                    return EFalse;
-                }
-            else
-                return EFalse;
-            }
-        else
-            return EFalse;
-			
-        }
-    // else
-        return EFalse;
+    return iEngine->GetEngineWrapper()->EntriesQueryDialog( &iEntriesToBeCreated, _L("How many entries to create?"), EFalse, this, ECreatorMessagesStart );
     }
 
 //----------------------------------------------------------------------------
@@ -513,10 +458,11 @@
     clientMtm->CreateMessageL(defaultServiceId);
 
     // set the from field to sms header
-    if (parameters.iFolderType == EInbox)
+    // !!! This will cause CRASH
+    /*if (parameters.iFolderType == EInbox)
         {
         CSmsHeader* smsHeader = &clientMtm->SmsHeader();
-        delete smsHeader;
+        delete smsHeader; // <-- This will cause CRASH
         smsHeader = NULL;
         smsHeader = CSmsHeader::NewL(CSmsPDU::ESmsDeliver, clientMtm->Body());        
         if( parameters.iSenderAddress )
@@ -527,7 +473,7 @@
             {
             smsHeader->SetFromAddressL(KEmpty);
             }
-        }       
+        }       */
 
     // set body
     clientMtm->Body().Reset();
@@ -539,11 +485,11 @@
     // set the details field
     if (parameters.iFolderType == EInbox)
         {
-        SetSenderToEntryDetails(messageEntry, parameters, EFalse);        
+        SetSenderToEntryDetailsL(messageEntry, parameters, EFalse);        
         }
     else
         {
-        SetRecipientToEntryDetails(messageEntry, parameters, EFalse);
+        SetRecipientToEntryDetailsL(messageEntry, parameters, EFalse);
         // Add all recipients to clientMtm
         // iRecipientArray is up-to-date so don't call AddRecipientsL here 
         for( TInt i = 0; i < iRecipientArray.Count(); i++ )
@@ -707,8 +653,8 @@
     waiter->StartAndWait();
     CleanupStack::PopAndDestroy(waiter);        
    
-    HBufC8* tempBuf = HBufC8::NewLC( parameters.iMessageBodyText->Des().Length() );
-    tempBuf->Des().Copy( parameters.iMessageBodyText->Des() );
+    HBufC8* tempBuf = CnvUtfConverter::ConvertFromUnicodeToUtf8L( parameters.iMessageBodyText->Des() );
+    CleanupStack::PushL(tempBuf);
     textFile.Write( tempBuf->Des() );        
     textFile.Close();
     CleanupStack::PopAndDestroy(); //tempBuf
@@ -722,11 +668,11 @@
     // set the details field
     if (parameters.iFolderType == EInbox)
         {
-        SetSenderToEntryDetails(messageEntry, parameters, EFalse);        
+        SetSenderToEntryDetailsL(messageEntry, parameters, EFalse);        
         }
     else
         {
-        SetRecipientToEntryDetails(messageEntry, parameters, EFalse);
+        SetRecipientToEntryDetailsL(messageEntry, parameters, EFalse);
         }    
 
     // set the description field same as the message subject
@@ -981,11 +927,11 @@
     // set the details field
     if (parameters.iFolderType == EInbox)
         {
-        SetSenderToEntryDetails(messageEntry, parameters, EFalse);        
+        SetSenderToEntryDetailsL(messageEntry, parameters, EFalse);        
         }  
     else
         {
-        SetRecipientToEntryDetails(messageEntry, parameters, EFalse);
+        SetRecipientToEntryDetailsL(messageEntry, parameters, EFalse);
         }
 
     // set the description field same as the message subject
@@ -1146,14 +1092,14 @@
     if (parameters.iFolderType == EInbox)
         {
         AddSenderToMtmAddresseeL(*clientMtm, parameters, ETrue );
-        SetSenderToEntryDetails(messageEntry, parameters, ETrue);
+        SetSenderToEntryDetailsL(messageEntry, parameters, ETrue);
         messageEntry.iMtm = KUidMsgTypeIMAP4;  // or any other than KUidMsgTypeSMTP to display 'from' field instead of 'to' field 
         }
     else
         {
         // Add all recipients to clientMtm
         AddRecipientsL( *clientMtm, parameters, ETrue );
-        SetRecipientToEntryDetails(messageEntry, parameters, EFalse);        
+        SetRecipientToEntryDetailsL(messageEntry, parameters, EFalse);        
         }
 
     // set the description field same as the message subject
@@ -1377,11 +1323,11 @@
     // set the details field
     if (parameters.iFolderType == EInbox)
         {
-        SetSenderToEntryDetails(messageEntry, parameters, EFalse);        
+        SetSenderToEntryDetailsL(messageEntry, parameters, EFalse);        
         }        
     else
         {
-        SetRecipientToEntryDetails(messageEntry, parameters, EFalse);
+        SetRecipientToEntryDetailsL(messageEntry, parameters, EFalse);
         }
 
     // set the subject line
@@ -1488,11 +1434,11 @@
     // set the details field and
     if (parameters.iFolderType == EInbox)
         {
-        SetSenderToEntryDetails(messageEntry, parameters, EFalse);
+        SetSenderToEntryDetailsL(messageEntry, parameters, EFalse);
         }        
     else
         {
-        SetRecipientToEntryDetails(messageEntry, parameters, EFalse);
+        SetRecipientToEntryDetailsL(messageEntry, parameters, EFalse);
         }
     
     // set mtm
@@ -1578,7 +1524,7 @@
     }
 
 //----------------------------------------------------------------------------
-void CCreatorMessages::SetSenderToEntryDetails(TMsvEntry& aMsgEntry, const CMessagesParameters& aParameters, TBool aUseEmailAddress)
+void CCreatorMessages::SetSenderToEntryDetailsL(TMsvEntry& aMsgEntry, const CMessagesParameters& aParameters, TBool aUseEmailAddress)
     {        
     // Only one sender allowed:
     if( iSenderArray.Count() == 0 )
@@ -1596,7 +1542,7 @@
     }
 
 //----------------------------------------------------------------------------
-void CCreatorMessages::SetRecipientToEntryDetails(TMsvEntry& aMsgEntry, const CMessagesParameters& aParameters, TBool aUseEmailAddress)
+void CCreatorMessages::SetRecipientToEntryDetailsL(TMsvEntry& aMsgEntry, const CMessagesParameters& aParameters, TBool aUseEmailAddress)
     {        
     // Only one sender allowed:
     GetAllRecipientsL(iRecipientArray, aParameters, aUseEmailAddress);
--- a/creator/engine/src/creator_note.cpp	Fri Jun 11 16:29:34 2010 +0100
+++ b/creator/engine/src/creator_note.cpp	Thu Jul 22 16:33:59 2010 +0100
@@ -22,6 +22,7 @@
 #include "creator_note.h" 
 #include "creator_traces.h"
 
+
 const TInt KCreatorDiskSpaceNeededForSingleDeletion( 8192 );
 _LIT( KCreatorNotepadFile, "c:Notepad.dat" );
 
@@ -71,36 +72,42 @@
     LOGSTRING("Creator: CCreatorNotepad::ConstructL");
 
     iEngine = aEngine;
-
-    iNotepadApi = new NotesEditor();
-    //iNotepadApi = CNotepadApi::NewL();
+    iNotepadWrapper = CCreatorNotepadWrapper::NewL();
     }
 
 CCreatorNotepad::~CCreatorNotepad()
     {
     LOGSTRING("Creator: CCreatorNotepad::~CCreatorNotepad");
     
-    delete iNotepadApi;
+    if (iParameters)
+        {
+        delete iParameters;
+        iParameters;
+        }
     
-    if (iParameters)
-        delete iParameters;
+    if (iNotepadWrapper)
+    	{
+		delete iNotepadWrapper;
+    	}
     }
 
 //----------------------------------------------------------------------------
 
-TBool CCreatorNotepad::AskDataFromUserL(TInt aCommand, TInt& aNumberOfEntries)
+TBool CCreatorNotepad::AskDataFromUserL(TInt aCommand)
     {
     LOGSTRING("Creator: CCreatorNotepad::AskDataFromUserL");
 
+    CCreatorModuleBase::AskDataFromUserL(aCommand);
+        
     if ( aCommand == ECmdDeleteNotes )
         {
-        return iEngine->GetEngineWrapper()->YesNoQueryDialog( _L("Delete all Notes?") );
+        return iEngine->GetEngineWrapper()->YesNoQueryDialog( _L("Delete all Notes?"), this, ECreatorModuleDelete );
         }
     
     // By Creator not supported because 
     // note id is not available via Notepad API
 
-    return iEngine->GetEngineWrapper()->EntriesQueryDialog(aNumberOfEntries, _L("How many entries to create?"));
+    return iEngine->GetEngineWrapper()->EntriesQueryDialog( &iEntriesToBeCreated, _L("How many entries to create?"), EFalse,  this, ECreatorModuleStart );
     }
 
 
@@ -126,10 +133,7 @@
     
     TInt err = KErrNone;
 
-    //iNotepadApi->AddContentL(parameters->iNoteText->Des());
-    QString textNote = QString::fromUtf16(parameters->iNoteText->Ptr(),parameters->iNoteText->Length());
-    iNotepadApi->edit(textNote);
-    iNotepadApi->close(NotesEditor::CloseWithSave);
+    iNotepadWrapper->CreateNoteL(parameters->iNoteText->Des());
     
     return err;
     }
@@ -138,53 +142,7 @@
 void CCreatorNotepad::DeleteAllL()
     {
     LOGSTRING("Creator: CCreatorNotepad::DeleteAllL");
-    QList<AgendaEntry> ael;
-    AgendaUtil::FilterFlags filter = AgendaUtil::FilterFlags(AgendaUtil::IncludeNotes);
-
-    iAgendaUtil = new AgendaUtil();
-    ael = iAgendaUtil->fetchAllEntries(filter);
-    for(int i=0 ; i<ael.count() ; i++)
-    	{
-        iAgendaUtil->deleteEntry(ael[i].id());
-    	}
-    delete iAgendaUtil;
-    // Open Notes db
- /*   RDbs dbs;
-    User::LeaveIfError( dbs.Connect() );
-    CleanupClosePushL( dbs );
-    RDbNamedDatabase db;
-    TInt openErr( db.Open( dbs, KCreatorNotepadFile, KCreatorNotepadFormat ) );
-    CleanupClosePushL( db );
-    
-    if ( openErr && openErr !=  KErrNotFound )
-        {
-        User::Leave( openErr );
-        }
-    
-    // do not leave if openErr == KErrNotFound, 
-    // it means there is no notes (file) created -> no need to delete
-    
-    if ( openErr !=  KErrNotFound )
-        {
-        TInt retval = iFs.ReserveDriveSpace( KDefaultDrive, KCreatorDiskSpaceNeededForSingleDeletion );
-        if ( retval == KErrNone )
-            {
-            retval = iFs.GetReserveAccess( KDefaultDrive );
-            }
-
-        // Delete all Notes. Ignore rowCount returnvalue
-        db.Execute( KCreatorNotepadDeleteAllSQL );            
-        
-        User::LeaveIfError( db.Compact() );
-        
-        if ( retval == KErrNone )
-            {
-            retval = iFs.ReleaseReserveAccess( KDefaultDrive );
-            }
-        }
-    
-    CleanupStack::PopAndDestroy( &db );
-    CleanupStack::PopAndDestroy( &dbs );*/
+    iNotepadWrapper->DeleteAllL();
     }
 
 //----------------------------------------------------------------------------
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/creator/engine/src/creator_notepadwrapper.cpp	Thu Jul 22 16:33:59 2010 +0100
@@ -0,0 +1,99 @@
+/*
+* 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 "creator_notepadwrapper.h"
+
+	/**
+	* Constructor
+	*/
+CCreatorNotepadWrapper::CCreatorNotepadWrapper()
+	{
+	}
+	
+	/**
+	* Destructor
+	*/
+CCreatorNotepadWrapper::~CCreatorNotepadWrapper()
+	{
+/*    
+	if(iNotepadApi)
+        {
+        delete iNotepadApi;
+        iNotepadApi = NULL;
+        }
+ */   
+    if(iAgendaUtil)
+        {
+        delete iAgendaUtil;
+        iAgendaUtil = NULL;
+        }
+	}
+	
+	/**
+	* Two-Phased constructor
+	*/
+CCreatorNotepadWrapper* CCreatorNotepadWrapper::NewL()
+	{
+	CCreatorNotepadWrapper* self = CCreatorNotepadWrapper::NewLC();
+	CleanupStack::Pop(self);
+    return self;
+	}
+
+	/**
+	* Two-Phased constructor
+	*/
+CCreatorNotepadWrapper* CCreatorNotepadWrapper::NewLC()
+	{
+	CCreatorNotepadWrapper* self = new (ELeave) CCreatorNotepadWrapper;
+	CleanupStack::PushL(self);
+	self->ConstructL();
+    return self;
+	}
+	
+	/**
+	* ConstructL()
+	*/
+
+void CCreatorNotepadWrapper::ConstructL()
+	{
+	iAgendaUtil = new AgendaUtil();
+//	iNotepadApi = new NotesEditor(iAgendaUtil);
+	}
+
+TInt CCreatorNotepadWrapper::CreateNoteL( const TDesC& aText )
+	{
+	TInt err = KErrNone;
+	QString textNote = QString::fromUtf16( aText.Ptr(),aText.Length());
+    iNotepadApi->edit(textNote,iAgendaUtil);
+    iNotepadApi->close(NotesEditorInterface::CloseWithSave, iAgendaUtil);
+	return err;
+    }
+void CCreatorNotepadWrapper::DeleteAllL()
+	{
+	
+	QList<AgendaEntry> ael;
+    AgendaUtil::FilterFlags filter = AgendaUtil::FilterFlags(AgendaUtil::IncludeNotes);
+
+    ael = iAgendaUtil->fetchAllEntries(filter);
+    for(int i=0 ; i<ael.count() ; i++)
+    	{
+        iAgendaUtil->deleteEntry(ael[i].id());
+    	}
+		
+	}
+	
--- a/creator/engine/src/creator_phonebook.cpp	Fri Jun 11 16:29:34 2010 +0100
+++ b/creator/engine/src/creator_phonebook.cpp	Thu Jul 22 16:33:59 2010 +0100
@@ -18,148 +18,138 @@
 
 #include "engine.h"
 #include "enginewrapper.h"
+#include "creator_contactsetcache.h"
 
-#include "creator_phonebook.h" 
+#include "creator_phonebook.h"
 #include "creator_traces.h"
 
 #include <bautils.h> 
-#include <qpixmap>
 
-//#include <QDebug>
 _LIT(KTempPath, "C:\\Data\\Creator\\");
 
 
 typedef struct {
-QString iDetail;
-QString iFieldContext;
-QString iFieldString;
+TInt iFieldCode;
 TInt iRandomType;
 } DetailFieldInfo;
 static const TInt RND_TYPE_UNDEF = -99;
 DetailFieldInfo CreatorPbkMiscTextFields[] = {        
-        { (QContactName::DefinitionName).operator QString(), (QContactDetail::ContextHome).operator QString(), (QContactName::FieldFirstName).operator QString(), (TInt) CCreatorEngine::EFirstName},
-        { (QContactName::DefinitionName).operator QString(), (QContactDetail::ContextHome).operator QString(), (QContactName::FieldLastName).operator QString(), (TInt) CCreatorEngine::ESurname},
-        { (QContactOrganization::DefinitionName).operator QString(), (QContactDetail::ContextWork).operator QString(), (QContactOrganization::FieldName).operator QString(), (TInt) CCreatorEngine::ECompany},
-        { (QContactOrganization::DefinitionName).operator QString(), (QContactDetail::ContextWork).operator QString(), (QContactOrganization::FieldTitle).operator QString(), (TInt) CCreatorEngine::EJobTitle},
-        { (QContactName::DefinitionName).operator QString(), (QContactDetail::ContextHome).operator QString(), (QContactName::FieldPrefix).operator QString(), (TInt) CCreatorEngine::EPrefix},
-        { (QContactName::DefinitionName).operator QString(), (QContactDetail::ContextHome).operator QString(), (QContactName::FieldSuffix).operator QString(), (TInt) CCreatorEngine::ESuffix},
-        { (QContactName::DefinitionName).operator QString(), (QContactDetail::ContextHome).operator QString(), (QContactName::FieldMiddleName).operator QString(), (TInt) CCreatorEngine::EFirstName},
-        { (QContactAddress::DefinitionName).operator QString(), (QContactDetail::ContextHome).operator QString(), (QContactAddress::FieldStreet).operator QString(), (TInt) CCreatorEngine::EAddress},
-        { (QContactAddress::DefinitionName).operator QString(), (QContactDetail::ContextHome).operator QString(), (QContactAddress::FieldLocality).operator QString(), (TInt) CCreatorEngine::ECity},
-        { (QContactAddress::DefinitionName).operator QString(), (QContactDetail::ContextHome).operator QString(), (QContactAddress::FieldRegion).operator QString(), (TInt) CCreatorEngine::EState},
-        { (QContactAddress::DefinitionName).operator QString(), (QContactDetail::ContextHome).operator QString(), (QContactAddress::FieldPostcode).operator QString(), (TInt) CCreatorEngine::EPostcode},
-        { (QContactAddress::DefinitionName).operator QString(), (QContactDetail::ContextHome).operator QString(), (QContactAddress::FieldCountry).operator QString(), (TInt) CCreatorEngine::ECountry},
-        { (QContactAddress::DefinitionName).operator QString(), (QContactDetail::ContextWork).operator QString(), (QContactAddress::FieldStreet).operator QString(), (TInt) CCreatorEngine::EAddress},
-        { (QContactAddress::DefinitionName).operator QString(), (QContactDetail::ContextWork).operator QString(), (QContactAddress::FieldLocality).operator QString(), (TInt) CCreatorEngine::ECity},
-        { (QContactAddress::DefinitionName).operator QString(), (QContactDetail::ContextWork).operator QString(), (QContactAddress::FieldRegion).operator QString(), (TInt) CCreatorEngine::EState},
-        { (QContactAddress::DefinitionName).operator QString(), (QContactDetail::ContextWork).operator QString(), (QContactAddress::FieldPostcode).operator QString(), (TInt) CCreatorEngine::EPostcode},
-        { (QContactAddress::DefinitionName).operator QString(), (QContactDetail::ContextWork).operator QString(), (QContactAddress::FieldCountry).operator QString(), (TInt) CCreatorEngine::ECountry},
-        { (QContactPhoneNumber::DefinitionName).operator QString(), (QContactDetail::ContextWork).operator QString(), (QContactPhoneNumber::SubTypeMobile).operator QString(), (TInt) CCreatorEngine::EPhoneNumber},
-        { (QContactPhoneNumber::DefinitionName).operator QString(), (QContactDetail::ContextWork).operator QString(), (QContactPhoneNumber::SubTypeLandline).operator QString(), (TInt) CCreatorEngine::EPhoneNumber},
-        { (QContactNote::DefinitionName).operator QString(), (QContactDetail::ContextHome).operator QString(), (QContactNote::FieldNote).operator QString(), (TInt)  CCreatorEngine::EMemoText},
-        { (QContactOrganization::DefinitionName).operator QString(), (QContactDetail::ContextWork).operator QString(), (QContactOrganization::FieldDepartment).operator QString(), (TInt) CCreatorEngine::ECompany},
-        { (QContactOrganization::DefinitionName).operator QString(), (QContactDetail::ContextWork).operator QString(), (QContactOrganization::FieldAssistantName).operator QString(), (TInt) CCreatorEngine::ECompany},
-        { (QContactFamily::DefinitionName).operator QString(), (QContactDetail::ContextHome).operator QString(), (QContactFamily::FieldSpouse).operator QString(), (TInt) CCreatorEngine::EFirstName},
-        { (QContactFamily::DefinitionName).operator QString(), (QContactDetail::ContextHome).operator QString(), (QContactFamily::FieldChildren).operator QString(), (TInt) CCreatorEngine::EFirstName},
-        { (QContactName::DefinitionName).operator QString(), (QContactDetail::ContextHome).operator QString(),  (QContactName::FieldCustomLabel).operator QString(), (TInt) CCreatorEngine::EFirstName}
+        {CCreatorPhonebookWrapper::EFirstName, (TInt) CCreatorEngine::EFirstName},
+        {CCreatorPhonebookWrapper::EFirstNameReading, (TInt) CCreatorEngine::EFirstName},
+        {CCreatorPhonebookWrapper::ELastName, (TInt) CCreatorEngine::ESurname},
+        {CCreatorPhonebookWrapper::ELastNameReading, (TInt) CCreatorEngine::ESurname},
+        {CCreatorPhonebookWrapper::ECompanyName, (TInt) CCreatorEngine::ECompany},
+        {CCreatorPhonebookWrapper::EJobTitle, (TInt) CCreatorEngine::EJobTitle},
+        {CCreatorPhonebookWrapper::EPrefix, (TInt) CCreatorEngine::EPrefix},
+        {CCreatorPhonebookWrapper::ESuffix, (TInt) CCreatorEngine::ESuffix},
+        {CCreatorPhonebookWrapper::ESecondName, (TInt) CCreatorEngine::EFirstName},
+        {CCreatorPhonebookWrapper::EAddrLabelGen, (TInt) CCreatorEngine::EAddress},
+        {CCreatorPhonebookWrapper::EAddrPoGen, (TInt) CCreatorEngine::EPobox},
+        {CCreatorPhonebookWrapper::EAddrExtGen, (TInt) CCreatorEngine::EAddress},
+        {CCreatorPhonebookWrapper::EAddrStreetGen, (TInt) CCreatorEngine::EAddress},
+        {CCreatorPhonebookWrapper::EAddrLocalGen, (TInt) CCreatorEngine::ECity},
+        {CCreatorPhonebookWrapper::EAddrRegionGen, (TInt) CCreatorEngine::EState},
+        {CCreatorPhonebookWrapper::EAddrPostCodeGen, (TInt) CCreatorEngine::EPostcode},
+        {CCreatorPhonebookWrapper::EAddrCountryGen, (TInt) CCreatorEngine::ECountry},
+        {CCreatorPhonebookWrapper::EAddrLabelHome, (TInt) CCreatorEngine::EAddress},
+        {CCreatorPhonebookWrapper::EAddrPoHome, (TInt) CCreatorEngine::EPobox},
+        {CCreatorPhonebookWrapper::EAddrExtHome, (TInt) CCreatorEngine::EAddress},
+        {CCreatorPhonebookWrapper::EAddrStreetHome, (TInt) CCreatorEngine::EAddress},
+        {CCreatorPhonebookWrapper::EAddrLocalHome, (TInt) CCreatorEngine::ECity},
+        {CCreatorPhonebookWrapper::EAddrRegionHome, (TInt) CCreatorEngine::EState},
+        {CCreatorPhonebookWrapper::EAddrPostCodeHome, (TInt) CCreatorEngine::EPostcode},
+        {CCreatorPhonebookWrapper::EAddrCountryHome, (TInt) CCreatorEngine::ECountry},
+        {CCreatorPhonebookWrapper::EAddrLabelWork, (TInt) CCreatorEngine::EAddress},
+        {CCreatorPhonebookWrapper::EAddrPoWork, (TInt) CCreatorEngine::EPobox},
+        {CCreatorPhonebookWrapper::EAddrExtWork, (TInt) CCreatorEngine::EAddress},
+        {CCreatorPhonebookWrapper::EAddrStreetWork, (TInt) CCreatorEngine::EAddress},
+        {CCreatorPhonebookWrapper::EAddrLocalWork, (TInt) CCreatorEngine::ECity},
+        {CCreatorPhonebookWrapper::EAddrRegionWork, (TInt) CCreatorEngine::EState},
+        {CCreatorPhonebookWrapper::EAddrPostCodeWork, (TInt) CCreatorEngine::EPostcode},
+        {CCreatorPhonebookWrapper::EAddrCountryWork, (TInt) CCreatorEngine::ECountry},
+        {CCreatorPhonebookWrapper::EPoc, (TInt) CCreatorEngine::EPhoneNumber},
+        {CCreatorPhonebookWrapper::ESwis, (TInt) CCreatorEngine::EPhoneNumber},
+        {CCreatorPhonebookWrapper::ESip, (TInt) CCreatorEngine::EPhoneNumber},
+        {CCreatorPhonebookWrapper::EDtmfString, (TInt) CCreatorEngine::EFirstName},
+        {CCreatorPhonebookWrapper::ENote,(TInt)  CCreatorEngine::EMemoText},
+        {CCreatorPhonebookWrapper::EMiddleName, (TInt) CCreatorEngine::EFirstName},
+        {CCreatorPhonebookWrapper::EDepartment, (TInt) CCreatorEngine::ECompany},
+        {CCreatorPhonebookWrapper::EAsstName, (TInt) CCreatorEngine::EFirstName},
+        {CCreatorPhonebookWrapper::ESpouse, (TInt) CCreatorEngine::EFirstName},
+        {CCreatorPhonebookWrapper::EChildren, (TInt) CCreatorEngine::EFirstName},
+        {CCreatorPhonebookWrapper::ESyncClass, RND_TYPE_UNDEF},
+        {CCreatorPhonebookWrapper::ELocPrivacy, RND_TYPE_UNDEF},
+        {CCreatorPhonebookWrapper::EGenLabel, (TInt) CCreatorEngine::EFirstName},
+        {CCreatorPhonebookWrapper::EWVAddress, (TInt) CCreatorEngine::EPhoneNumber},
+        {CCreatorPhonebookWrapper::ERingTone, RND_TYPE_UNDEF},
+        {CCreatorPhonebookWrapper::EThumbnailPic, RND_TYPE_UNDEF},
+        {CCreatorPhonebookWrapper::ECallerObjText, (TInt) CCreatorEngine::EFirstName}
         };
                   
-/*TInt CreatorVPbkBinaryFields[] = {
-        R_VPBK_FIELD_TYPE_CALLEROBJIMG//,
+
+TInt CreatorPbkBinaryFields[] = {
+        CCreatorPhonebookWrapper::ECallerObjImg//,
         //R_VPBK_FIELD_TYPE_THUMBNAILPATH
-        };*/
+        };
 
-/*QString CreatorPbkDateTimeFields[] = {
-        QContactAnniversary::DefinitionName//R_VPBK_FIELD_TYPE_ANNIVERSARY
-        };*/
+TInt CreatorPbkDateTimeFields[] = {
+        CCreatorPhonebookWrapper::EAnniversary
+        };
 
 //----------------------------------------------------------------------------
-
-/*
-typedef struct{
-QString iFieldContext;
-QString iFieldString;
-}PhoneNumInfo;
-PhoneNumInfo CreatorPhoneNumberFields[] =
+TInt CreatorPbkPhoneNumberFields[] =
     {
-    { QContactPhoneNumber::ContextHome, QContactPhoneNumber::SubTypeLandline},
-    { QContactPhoneNumber::ContextWork, QContactPhoneNumber::SubTypeLandline},                        
-    { QContactPhoneNumber::ContextHome, QContactPhoneNumber::SubTypeMobile},
-    { QContactPhoneNumber::ContextWork, QContactPhoneNumber::SubTypeMobile},
-    { QContactPhoneNumber::ContextHome, QContactPhoneNumber::SubTypeFacsimile},
-    { QContactPhoneNumber::ContextWork, QContactPhoneNumber::SubTypeFacsimile},
-    { QContactPhoneNumber::ContextWork, QContactPhoneNumber::SubTypePager },           
-    { QContactPhoneNumber::ContextHome, QContactPhoneNumber::SubTypeVideo },
-    { QContactPhoneNumber::ContextWork, QContactPhoneNumber::SubTypeVideo },
-    { QContactPhoneNumber::ContextHome, QContactPhoneNumber::SubTypeVoice },
-    { QContactPhoneNumber::ContextWork, QContactPhoneNumber::SubTypeVoice },
-    { QContactPhoneNumber::ContextWork, QContactPhoneNumber::SubTypeAssistant },
-    { QContactPhoneNumber::ContextHome, QContactPhoneNumber::SubTypeCar }
+    CCreatorPhonebookWrapper::ELandPhoneGen,
+    CCreatorPhonebookWrapper::ELandPhoneHome,
+    CCreatorPhonebookWrapper::ELandPhoneWork,                        
+    CCreatorPhonebookWrapper::EMobilePhoneGen,
+    CCreatorPhonebookWrapper::EMobilePhoneHome,
+    CCreatorPhonebookWrapper::EMobilePhoneWork,
+    CCreatorPhonebookWrapper::EFaxNumberGen,
+    CCreatorPhonebookWrapper::EFaxNumberHome,
+    CCreatorPhonebookWrapper::EFaxNumberWork,
+    CCreatorPhonebookWrapper::EPagerNumber,           
+    CCreatorPhonebookWrapper::EVideoNumberGen,
+    CCreatorPhonebookWrapper::EVideoNumberHome,
+    CCreatorPhonebookWrapper::EVideoNumberWork,
+    CCreatorPhonebookWrapper::EVoipGen,
+    CCreatorPhonebookWrapper::EVoipHome,
+    CCreatorPhonebookWrapper::EVoipWork,
+    CCreatorPhonebookWrapper::EAsstPhone,
+    CCreatorPhonebookWrapper::ECarPhone
     };
 
-*/
-typedef struct{
-QString iFieldContext;
-QString iFieldString;
-}PhoneNumInfo;
-PhoneNumInfo CreatorPhoneNumberFields[] =
+TInt CreatorPbkUrlFields[] =
     {
-    { "Home", "Landline"},
-    { "Work", "Landline"},                        
-    { "Home","Mobile"},
-    { "Work", "Mobile"},
-    { "Home", "Facsimile"},
-    { "Work", "Facsimile"},
-    { "Work", "Pager"},
-    { "Home", "Video"},
-    { "Work", "Video"},   //{ "Home", "Voice" },//{ "Work", "Voice" },
-    { "Work", "Assistant" },
-    { "Home",  "Car" }
+    CCreatorPhonebookWrapper::EUrlGen,
+    CCreatorPhonebookWrapper::EUrlHome,
+    CCreatorPhonebookWrapper::EUrlWork
     };
 
-
-/*QString CCreatorPhonebook::iPhoneNumberFields[] =
+TInt CreatorPbkEmailFields[] =
     {
-    {QContactPhoneNumber::SubTypeLandline},
-    {QContactPhoneNumber::SubTypeMobile},
-    {QContactPhoneNumber::SubTypeFacsimile},
-    {QContactPhoneNumber::SubTypePager},           
-    {QContactPhoneNumber::SubTypeVideo},
-    {QContactPhoneNumber::SubTypeVoice} ,
-    {QContactPhoneNumber::SubTypeAssistant},
-    {QContactPhoneNumber::SubTypeCar} 
+    CCreatorPhonebookWrapper::EEmailGen,
+    CCreatorPhonebookWrapper::EEmailHome,
+    CCreatorPhonebookWrapper::EEmailWork
     };
-*/
-/*
-QStringList CreatorPbkContextFields =
-    {
-    QContactDetail::ContextHome,
-    QContactDetail::ContextWork
-    };
-*/
-QString CreatorPbkEmailFields[] =
-    {
-    //R_VPBK_FIELD_TYPE_EMAILGEN,
-    (QContactDetail::ContextHome).operator QString(),//"Home",//R_VPBK_FIELD_TYPE_EMAILHOME,
-    (QContactDetail::ContextWork).operator QString()//R_VPBK_FIELD_TYPE_EMAILWORK
-    };
-
 
 CPhonebookParameters::CPhonebookParameters()
     {
-    LOGSTRING("Creator: CVirtualPhonebookParameters::CVirtualPhonebookParameters");
-    //iGroupName = HBufC::New(KPhonebookFieldLength);  
+    LOGSTRING("Creator: CPhonebookParameters::CVirtualPhonebookParameters");
+    iGroupName = HBufC::New(KPhonebookFieldLength);  
     }
 
 CPhonebookParameters::~CPhonebookParameters()
     {
-    LOGSTRING("Creator: CVirtualPhonebookParameters::~CVirtualPhonebookParameters");
+    LOGSTRING("Creator: CPhonebookParameters::~CPhonebookParameters");
 
-    //delete iGroupName;   
-    //iContactFields.ResetAndDestroy();
-    //iContactFields.Close();
-    
-    //iLinkIds.clear();
+    delete iGroupName;   
+    for( TCreatorContactFields::iterator it = iContactFields.begin(); it != iContactFields.end(); ++it)
+        {
+        HBufC* temp =  (*it).second;
+        iContactFields.erase(it);
+        delete temp;
+        }
     iLinkIds.Reset();
     iLinkIds.Close();
     }
@@ -208,7 +198,7 @@
 	
 	iEngine = aEngine;
 	
-	iContactMngr = new QContactManager("symbian");
+	iPhonebookWrapper = CCreatorPhonebookWrapper::NewL();
 
 	SetDefaultParameters();
     }
@@ -227,59 +217,68 @@
         TRAP_IGNORE( StoreLinksForDeleteL( iContactGroupsToDelete, KUidDictionaryUidContactGroups ) );
         }
     
-	if( iContactMngr )
+	if( iPhonebookWrapper )
 		{
-		delete iContactMngr;
+		delete iPhonebookWrapper;
 		}
     
     if (iParameters)
     	{
         delete iParameters;
     	}
+  
     }
 
 //----------------------------------------------------------------------------
 
-TBool CCreatorPhonebook::AskDataFromUserL(TInt aCommand, TInt& aNumberOfEntries)
-    {
-    LOGSTRING("Creator: CCreatorPhonebook::AskDataFromUserL");
-
-    TBool ret = CCreatorPhonebookBase::AskDataFromUserL(aCommand, aNumberOfEntries);
-   
-    if(ret && aCommand == ECmdCreatePhoneBookEntryContacts && !iDefaultFieldsSelected)    
-        {
-        iAddAllFields = iEngine->GetEngineWrapper()->YesNoQueryDialog(_L("Add all the other fields to contacts?"));
-        }
-    return ret;
-    }
-
-
-//----------------------------------------------------------------------------
-
 TInt CCreatorPhonebook::CreateContactEntryL(CCreatorModuleBaseParameters *aParameters)
     {
-	TInt err=0;	
-
-	InitializeContactParamsL();
-	bool success = false;
+	TInt err = KErrNone;
+	delete iParameters;
+	    iParameters = 0;
+	CPhonebookParameters* parameters = 0;
+	
+	if( aParameters == 0 )
+	    {
+	    InitializeContactParamsL();
+	    parameters = iParameters;
+	    }
+	else
+	    {
+	    parameters = (CPhonebookParameters*) aParameters;
+	    }
+	    
+	int numberOfFields = parameters->iContactFields.size();
 	// create a new contact item
-	//iStore = new QContact();
 	
-	QContact iStore;
+	TUint32 contactId = iPhonebookWrapper->CreateContactEntryL( parameters->iContactFields ); //wrapper should return contact id to store
+	iContactsToDelete.Append( contactId );
 	
-	int numberOfFields = iParameters->iContactFields.count();
-	QString phone;
-	for(int i=0; i< numberOfFields; i++ )
-		{
-		QContactDetail* cntdet = new QContactDetail(iParameters->iContactFields.at(i));
-		success = iStore.saveDetail( cntdet );
-		delete cntdet;		
-		}
-	
-	iContactMngr->saveContact( &iStore );
-	
-	iContactsToDelete.Append( (TUint32)iStore.localId() );
-	//delete iStore;
+
+	// If this contact has a link id in script (i.e. belongs to a contact-set), we must cache the contact id:
+	    if( parameters->ScriptLinkId() > 0 )
+	        {                
+	        RPointerArray<CCreatorContactSet>& contactsets = ContactLinkCache::Instance()->ContactSets();
+	        TBool setFound(EFalse);
+	        for(TInt i = 0; i < contactsets.Count(); ++i )
+	            {
+	            if( contactsets[i]->LinkId() == parameters->ScriptLinkId() )
+	                {
+	                if( contactId )
+	                    {
+	                    contactsets[i]->AppendL( contactId );
+	                    iContactLinkArray.AppendL( contactId );
+	                    }
+	                setFound = ETrue;
+	                break;
+	                }
+	            }
+	        if( !setFound )
+	            {
+	            LOGSTRING2("Error: Contact set id %d not found.", parameters->ScriptLinkId());
+	            }
+	        }
+	    
     return err;
     }
 
@@ -292,8 +291,7 @@
 
 void CCreatorPhonebook::DeleteAllL()
     {
-	QList<QContactLocalId> contacts = iContactMngr->contactIds();
-	DeleteContactsL( contacts );
+	iPhonebookWrapper->DeleteAllL();
     }
 
 //----------------------------------------------------------------------------
@@ -307,24 +305,7 @@
 void CCreatorPhonebook::DeleteAllGroupsL()
     {
     LOGSTRING("Creator: CCreatorPhonebook::DeleteAllGroupsL");
-    
-    QList<QContactLocalId> contacts = iContactMngr->contactIds();
-    QList<QContactLocalId> groups;
-    for(int i = 0; i < contacts.count(); i++)
-    	{
-		QContact group = iContactMngr->contact( contacts.at(i) );
-		if( group.type() == QContactType::TypeGroup )
-			{
-			groups.append( group.localId() );
-			}
-    	}
-    DeleteContactsL( groups );
-/*  
-    User::LeaveIfNull( iStore );
-    MVPbkContactLinkArray* groups = iStore->ContactGroupsLC();
-    DeleteContactsL( groups, ETrue );
-    CleanupStack::PopAndDestroy(); // cannot use groups as parameter
-    */
+    iPhonebookWrapper->DeleteAllGroupsL();
     }
 
 //----------------------------------------------------------------------------
@@ -335,318 +316,61 @@
     }
 
 //----------------------------------------------------------------------------
-void CCreatorPhonebook::DeleteContactsL( QList<QContactLocalId>& aContacts /*MVPbkContactLinkArray* aContacts, TBool aGroup*/ )
+void CCreatorPhonebook::DeleteContactsL( RArray<TUint32>& aContactsToDelete, TUid aStoreUid	)
     {
-	//QList<QContactLocalId> contacts = iContactMngr->contactIds();
-    QMap<int, QContactManager::Error> errorMap;
-	iContactMngr->removeContacts( &aContacts, &errorMap );
+	iPhonebookWrapper->DeleteContactsL( aContactsToDelete, aStoreUid );
     }
 
 //----------------------------------------------------------------------------
+
+
 void CCreatorPhonebook::DeleteItemsCreatedWithCreatorL( TUid aStoreUid )
     {
 	CDictionaryFileStore* store = iEngine->FileStoreLC();
-	       User::LeaveIfNull( store );
-	       
-	       QList<QContactLocalId> contacts;
-	       // backup previous contact links from store
-	       // otherwise they would be overwritten when calling out.WriteL
-	       TUint32 creatorLink;
-	       if ( store->IsPresentL( aStoreUid ) )
-	           {
-	           RDictionaryReadStream in;
-	           in.OpenLC( *store, aStoreUid );
-	           TRAP_IGNORE( 
-	               do{ 
-	                   creatorLink = in.ReadUint32L();
-	                   QContact contact = iContactMngr->contact( creatorLink );
-	                   if( (contact.type() == QContactType::TypeGroup && aStoreUid == KUidDictionaryUidContactGroups ) ||  (contact.type() != QContactType::TypeGroup && aStoreUid != KUidDictionaryUidContactGroups) )
-	                	   {
-						   contacts.append( creatorLink );
-	                	   }
-	               }while( creatorLink );)
-	           
-	           CleanupStack::PopAndDestroy(); // in
-	           }
-	       
-	       
-	       DeleteContactsL( contacts );
-	       
-	       store->Remove( aStoreUid );
-	       store->CommitL();
-	       
-	       CleanupStack::PopAndDestroy( store );
+    User::LeaveIfNull( store );
+    
+    RArray<TUint32> contacts; 
+    // backup previous contact links from store
+    // otherwise they would be overwritten when calling out.WriteL
+    TUint32 creatorLink;
+    if ( store->IsPresentL( aStoreUid ) )
+       {
+       RDictionaryReadStream in;
+       in.OpenLC( *store, aStoreUid );
+       TRAP_IGNORE( 
+           do{ 
+               creatorLink = in.ReadUint32L();
+               contacts.AppendL( creatorLink );
+           }while( creatorLink );
+       );
+       
+       CleanupStack::PopAndDestroy(); // in
+       }
+    
+    
+    iPhonebookWrapper->DeleteContactsL( contacts, aStoreUid );
+    
+    store->Remove( aStoreUid );
+    store->CommitL();
+    
+    CleanupStack::PopAndDestroy( store );
     }
 
 //----------------------------------------------------------------------------
-void CCreatorPhonebook::DoDeleteItemsCreatedWithCreatorL( TUid aStoreUid, CDictionaryFileStore* aStore )
+void CCreatorPhonebook::DoDeleteItemsCreatedWithCreatorL( TUid /*aStoreUid*/, CDictionaryFileStore* /*aStore*/ )
     {
     
     }
 
 //----------------------------------------------------------------------------
-TBool CCreatorPhonebook::HasOtherThanGroupsL( /*MVPbkContactLinkArray* aContacts */)
+TBool CCreatorPhonebook::HasOtherThanGroupsL()
     {
     LOGSTRING("Creator: CCreatorPhonebook::HasOtherThanGroupsL");
     TBool result( EFalse );
     return result;
     }
 
-QContactDetail CCreatorPhonebook::CreateContactDetail(QString aDetail, QString aFieldContext, QString aFieldString, TInt aRand )
-	{
-	QContactDetail contactDetail;
-	TPtrC contentData;
-	if( aDetail == QContactPhoneNumber::DefinitionName)
-		{
-		QContactPhoneNumber phoneNumber;// = contactDetail;
-		phoneNumber.setContexts(aFieldContext);
-		phoneNumber.setSubTypes(aFieldString);
-		contentData.Set(iEngine->RandomString((CCreatorEngine::TRandomStringType) aRand));
-		QString number = QString::fromUtf16(contentData.Ptr(),contentData.Length());
-		phoneNumber.setNumber(number);
-		return phoneNumber;
-		}
-	else if( aDetail == QContactName::DefinitionName )			//--Contact NAME-----------------------------
-		{
-		QContactName contactName;
-		for(int i = 0 ; i < iParameters->iContactFields.count() ; i++ ) //go through all contact details to check if there is already Contact Name to set other details
-			{
-			if(iParameters->iContactFields.at(i).definitionName() == QContactName::DefinitionName )
-				{
-				contactName = iParameters->iContactFields.at(i);
-				}
-			}
-		contentData.Set(iEngine->RandomString((CCreatorEngine::TRandomStringType) aRand));
-		QString name = QString::fromUtf16(contentData.Ptr(),contentData.Length());
-		if(aFieldString == QContactName::FieldFirstName)
-			{
-			if(contactName.firstName().isEmpty())
-				{
-				contactName.setFirstName( name );
-				}
-			}
-		else if(aFieldString == QContactName::FieldLastName)
-			{
-			if(contactName.lastName().isEmpty())
-				{
-				contactName.setLastName( name );
-				}
-			}
-		else if(aFieldString == QContactName::FieldMiddleName)
-			{
-			if(contactName.middleName().isEmpty())
-				{
-				contactName.setMiddleName( name );
-				}
-			}
-		else if(aFieldString == QContactName::FieldPrefix)
-			{
-			if(contactName.prefix().isEmpty())
-				{
-				contactName.setPrefix( name );
-				}
-			}
-		else if(aFieldString == QContactName::FieldSuffix)
-			{
-			if(contactName.suffix().isEmpty())
-				{
-				contactName.setSuffix( name );
-				}
-			}
-		else		//QContactName::FieldCustomLabel:
-			{
-			if(contactName.customLabel().isEmpty())
-				{
-				contactName.setCustomLabel( name );
-				}
-			}
-		return contactName;
-		}
-	else if( aDetail == QContactOrganization::DefinitionName )			//--Contact Company-----------------------------
-		{
-		QContactOrganization contactCompany;
-		
-		for(int i = 0 ; i < iParameters->iContactFields.count() ; i++ ) //go through all contact details to check if there is already Contact Name to set other details
-			{
-			if(iParameters->iContactFields.at(i).definitionName() == QContactOrganization::DefinitionName )
-				{
-				contactCompany = iParameters->iContactFields.at(i);
-				}
-			}
-		contentData.Set(iEngine->RandomString((CCreatorEngine::TRandomStringType) aRand));
-		QString company = QString::fromUtf16(contentData.Ptr(),contentData.Length());
-		if(aFieldString == QContactOrganization::FieldName)
-			{
-			if(contactCompany.name().isEmpty())
-				{
-				contactCompany.setName( company );
-				}
-			}
-		if(aFieldString == QContactOrganization::FieldTitle)
-			{
-			if(contactCompany.title().isEmpty())
-				{
-				contactCompany.setTitle( company );
-				}
-			}
-		if(aFieldString == QContactOrganization::FieldDepartment)
-			{
-			//if(contactCompany.department().isEmpty())
-				//{
-				QStringList depList = contactCompany.department();
-				depList.append(company);
-				contactCompany.setDepartment(depList);
-				//}
-			}
-		if(aFieldString == QContactOrganization::FieldAssistantName)
-			{
-			if(contactCompany.assistantName().isEmpty())
-				{
-				contactCompany.setAssistantName( company );
-				}
-			}
-		return contactCompany;
-		}
-	else if( aDetail == QContactAddress::DefinitionName )			//--Contact Address-----------------------------
-			{
-			QContactAddress contactAddress;
-			
-			for(int i = 0 ; i < iParameters->iContactFields.count() ; i++ ) //go through all contact details to check if there is already Contact Name to set other details
-				{
-				if(iParameters->iContactFields.at(i).definitionName() == QContactAddress::DefinitionName && iParameters->iContactFields.at(i).value(QContactDetail::FieldContext) == aFieldContext )
-					{
-					contactAddress = iParameters->iContactFields.at(i);
-					}
-				}
-			
-			contactAddress.setContexts( aFieldContext );
-			
-			contentData.Set(iEngine->RandomString((CCreatorEngine::TRandomStringType) aRand));
-			QString address = QString::fromUtf16(contentData.Ptr(),contentData.Length());
-			if(aFieldString == QContactAddress::FieldStreet )
-				{
-				if( contactAddress.street().isEmpty() )
-					{
-					contactAddress.setStreet( address );
-					}
-				}
-			else if(aFieldString == QContactAddress::FieldLocality )
-				{
-				if( contactAddress.locality().isEmpty() )
-					{
-					contactAddress.setLocality( address );
-					}
-				}
-			else if(aFieldString == QContactAddress::FieldRegion )
-				{
-				if( contactAddress.region().isEmpty() )
-					{
-					contactAddress.setRegion( address );
-					}
-				}
-			else if(aFieldString == QContactAddress::FieldPostcode )
-				{
-				if( contactAddress.postcode().isEmpty() )
-					{
-					contactAddress.setPostcode( address );
-					}
-				}
-			else if(aFieldString == QContactAddress::FieldCountry )
-				{
-				if( contactAddress.country().isEmpty() )
-					{
-					contactAddress.setCountry( address );
-					}
-				}
-			else 
-				{
-				return contactDetail;
-				}
-			return contactAddress;
-			}
-	else if( aDetail == QContactNote::DefinitionName )			//--Contact Note-----------------------------
-				{
-				QContactNote contactNote;
-				contentData.Set(iEngine->RandomString((CCreatorEngine::TRandomStringType) aRand));
-				QString note = QString::fromUtf16(contentData.Ptr(),contentData.Length());
-				contactNote.setNote(note);
-				return contactNote;
-				}
-	else if( aDetail == QContactFamily::DefinitionName )			//--Contact Family-----------------------------
-				{
-				QContactFamily contactFamily;
-				
-				for(int i = 0 ; i < iParameters->iContactFields.count() ; i++ ) //go through all contact details to check if there is already Contact Name to set other details
-					{
-					if(iParameters->iContactFields.at(i).definitionName() == QContactFamily::DefinitionName && iParameters->iContactFields.at(i).value(QContactDetail::FieldContext) == aFieldContext )
-						{
-						contactFamily = iParameters->iContactFields.at(i);
-						}
-					}
-				contentData.Set(iEngine->RandomString((CCreatorEngine::TRandomStringType) aRand));
-				QString familyData = QString::fromUtf16(contentData.Ptr(),contentData.Length());
-				if(aFieldString == QContactFamily::FieldSpouse )
-					{
-					if( contactFamily.spouse().isEmpty() )
-						{
-						contactFamily.setSpouse( familyData );
-						}
-					}
-				if(aFieldString == QContactFamily::FieldChildren )
-					{
-						QStringList children = contactFamily.children();
-						children.append( familyData );
-						contactFamily.setChildren( children );
-					}
-				
-				return contactFamily;
-				}
-	
-	if( aDetail == QContactAvatar::DefinitionName)						//--Contact Picture-----------------------------
-			{
-			RFs& fs = CCoeEnv::Static()->FsSession();
-			QContactAvatar contactAvatar;
-			TBuf<KMaxFileName> srcPath;
-			iEngine->RandomPictureFileL(srcPath);
-			TBuf<KMaxFileName> destPath(KTempPath);
-						
-			if(!BaflUtils::FolderExists( fs, destPath ))
-				{
-				BaflUtils::EnsurePathExistsL( fs, destPath );
-				}
-			
-			TInt err=BaflUtils::CopyFile( fs, srcPath, destPath );
 
-			TParse temp;
-			temp.Set( srcPath,NULL,NULL );
-			destPath.Append(temp.NameAndExt());
-			
-			QString avatarFile = QString::fromUtf16( destPath.Ptr(),destPath.Length() );
-			
-			QPixmap avatarPix(avatarFile);
-
-			contactAvatar.setAvatar(avatarFile);
-            contactAvatar.setPixmap(avatarPix);
-
-			return contactAvatar;
-			}
-	if( aDetail == QContactAnniversary::DefinitionName)
-			{
-			QContactAnniversary contactAnniversary;
-			QDate date;
-			TTime datetime = iEngine->RandomDate( CCreatorEngine::EDateFuture );
-			date.setDate( datetime.DateTime().Year(),(int) (datetime.DateTime().Month()+1), datetime.DateTime().Day() );
-			//contactAnniversary.setEvent(QContactAnniversary::);
-			contactAnniversary.setOriginalDate( date );
-			return contactAnniversary;
-			}
-			
-
-
-	
-	
-	return contactDetail;
-	}
 //----------------------------------------------------------------------------
 
 
@@ -689,18 +413,14 @@
        for ( TInt i = 0; i < iPreviousDeleteLinks.Count(); i++ )
            {
            out.WriteUint32L( iPreviousDeleteLinks[i] );
-           //CleanupStack::PopAndDestroy(); // PackLC            
            }
        
        // write new links
        for(int i=0; i < aLinks.Count(); i++)
     	   {
-		   //TUint32 localId = (TUint32) aLinks[i];
-		   //out.WriteUint32L( aLinks[i] );
 		   out.WriteUint32L( aLinks[i] );
     	   }
        out.CommitL();
-       //CleanupStack::PopAndDestroy(); // aLinks.PackLC
        CleanupStack::PopAndDestroy(); // out
        
        store->CommitL();
@@ -709,45 +429,9 @@
     }
 
 //----------------------------------------------------------------------------
-       
 //----------------------------------------------------------------------------
-/*TInt CCreatorPhonebook::iPhoneNumberFields[] =
-    {
-    R_VPBK_FIELD_TYPE_LANDPHONEGEN,
-    R_VPBK_FIELD_TYPE_LANDPHONEHOME,
-    R_VPBK_FIELD_TYPE_LANDPHONEWORK,                        
-    R_VPBK_FIELD_TYPE_MOBILEPHONEGEN,
-    R_VPBK_FIELD_TYPE_MOBILEPHONEHOME,
-    R_VPBK_FIELD_TYPE_MOBILEPHONEWORK,
-    R_VPBK_FIELD_TYPE_FAXNUMBERGEN,
-    R_VPBK_FIELD_TYPE_FAXNUMBERHOME,
-    R_VPBK_FIELD_TYPE_FAXNUMBERWORK,
-    R_VPBK_FIELD_TYPE_PAGERNUMBER,           
-    R_VPBK_FIELD_TYPE_VIDEONUMBERGEN,
-    R_VPBK_FIELD_TYPE_VIDEONUMBERHOME,
-    R_VPBK_FIELD_TYPE_VIDEONUMBERWORK,
-    R_VPBK_FIELD_TYPE_VOIPGEN,
-    R_VPBK_FIELD_TYPE_VOIPHOME,
-    R_VPBK_FIELD_TYPE_VOIPWORK,
-    R_VPBK_FIELD_TYPE_ASSTPHONE,
-    R_VPBK_FIELD_TYPE_CARPHONE
-    };*/
 
-/*TInt CCreatorPhonebook::iUrlFields[] =
-    {
-    R_VPBK_FIELD_TYPE_URLGEN,
-    R_VPBK_FIELD_TYPE_URLHOME,
-    R_VPBK_FIELD_TYPE_URLWORK
-    };*/
-
-/*TInt CCreatorPhonebook::iEmailFields[] =
-    {
-    R_VPBK_FIELD_TYPE_EMAILGEN,
-    R_VPBK_FIELD_TYPE_EMAILHOME,
-    R_VPBK_FIELD_TYPE_EMAILWORK
-    };*/
-
-void CCreatorPhonebook::InitializeContactParamsL(/*CCreatorModuleBaseParameters* aParameters*/)
+void CCreatorPhonebook::InitializeContactParamsL()
     {
     LOGSTRING("Creator: CCreatorPhonebook::InitializeContactParamsL");        
  
@@ -757,193 +441,175 @@
     iParameters->iNumberOfURLFields = iNumberOfURLFields;
     iParameters->iNumberOfEmailAddressFields = iNumberOfEmailAddressFields;       
     
-        
-    QContactName name;
-    
     TPtrC fname = iEngine->RandomString(CCreatorEngine::EFirstName);
     TPtrC lname = iEngine->RandomString(CCreatorEngine::ESurname);
-    QString firstname = QString::fromUtf16( fname.Ptr(), fname.Length() ); 
-    QString lastname  = QString::fromUtf16( lname.Ptr(), lname.Length() );               
     
-    name.setFirstName(firstname);
-    name.setLastName(lastname);
     
     if( iAddAllFields )
         {
 		TInt textFieldCount = sizeof(CreatorPbkMiscTextFields) / sizeof(DetailFieldInfo);
 		for( TInt tfIndex = 0; tfIndex < textFieldCount; ++tfIndex )
-                    { 
-    				QContactDetail field = CreateContactDetail( CreatorPbkMiscTextFields[tfIndex].iDetail, CreatorPbkMiscTextFields[tfIndex].iFieldContext, CreatorPbkMiscTextFields[tfIndex].iFieldString, CreatorPbkMiscTextFields[tfIndex].iRandomType );
-    				bool replace = false;
-                    for(int i = 0 ; i< iParameters->iContactFields.count() ; i++)
-                    	{
-						if( !field.isEmpty() && field.definitionName() == iParameters->iContactFields.at(i).definitionName() )
-							{
-							QString context = field.value(QContactDetail::FieldContext);
-							bool isContextEmpty = context.isEmpty();
-							if(  isContextEmpty ||  ( field.value(QContactDetail::FieldContext) == iParameters->iContactFields.at(i).value(QContactDetail::FieldContext)) )
-								{
-								//replace
-								iParameters->iContactFields.replace(i,field);
-								replace = true;
-								}
-							}
-                    	}
-						if(!replace)
-							{
-							if(!field.isEmpty())
-								{
-								iParameters->iContactFields.append(field);
-								}
-							}
-                    }
+			{ 
+			CCreatorContactField* field = CCreatorContactField::NewL();
+			CleanupStack::PushL(field);
+	        field->AddFieldToParamL( iEngine,iParameters, CreatorPbkMiscTextFields[tfIndex].iFieldCode, CreatorPbkMiscTextFields[tfIndex].iRandomType );
+  	        CleanupStack::Pop(field);
+            }
+		
 		// Add binary fields:
-		QContactDetail field = CreateContactDetail(QContactAvatar::DefinitionName,"","",0);
-		iParameters->iContactFields.append(field);
 		
+		RFs& fs = CCoeEnv::Static()->FsSession();
+		      
+        TBuf<KMaxFileName> srcPath;
+		iEngine->RandomPictureFileL(srcPath);
+		TBuf<KMaxFileName> destPath(KTempPath);
+		                            
+		if(!BaflUtils::FolderExists( fs, destPath ))
+			{
+		    BaflUtils::EnsurePathExistsL( fs, destPath );
+		    }
+		                
+		TInt err=BaflUtils::CopyFile( fs, srcPath, destPath );
+
+		TParse temp;
+		temp.Set( srcPath,NULL,NULL );
+		destPath.Append(temp.NameAndExt());
+		TPtrC picture;
+		picture.Set(destPath);
+		CCreatorContactField* picturefield = CCreatorContactField::NewL();
+		CleanupStack::PushL(picturefield);
+		picturefield->AddFieldToParamL( iParameters, CCreatorPhonebookWrapper::EThumbnailPic, picture );
+		CleanupStack::Pop(picturefield);
 		// Add date-time fields:
-		QContactDetail fieldAnniv = CreateContactDetail(QContactAnniversary::DefinitionName,"","",0);
-		iParameters->iContactFields.append(fieldAnniv);
-    //***************************************************************************
-    // Add text fields:
- /*           TInt textFieldCount = sizeof(CreatorVPbkMiscTextFields) / sizeof(FieldInfo);
-            for( TInt tfIndex = 0; tfIndex < textFieldCount; ++tfIndex )
-                { 
-				//QContactDetail field;
-                CCreatorContactField* field = CCreatorContactField::NewL(CreatorVPbkMiscTextFields[tfIndex].iFieldCode, KNullDesC);
-                CleanupStack::PushL(field);
-                field->SetRandomParametersL(CCreatorContactField::ERandomLengthDefault);
-                iParameters->iContactFields.AppendL(field);
-                CleanupStack::Pop(field);
-                }
-                
-            // Add binary fields:
-            TInt binFieldCount = sizeof(CreatorVPbkBinaryFields) / sizeof(TInt);
-            for( TInt bfIndex = 0; bfIndex < binFieldCount; ++bfIndex )
-                {                
-                CCreatorContactField* field = CCreatorContactField::NewL(CreatorVPbkBinaryFields[bfIndex], KNullDesC8);
-                CleanupStack::PushL(field);
-                field->SetRandomParametersL(CCreatorContactField::ERandomLengthDefault);
-                iParameters->iContactFields.AppendL(field);
-                CleanupStack::Pop(field);
-                }
-                
-            // Add date-time fields:
-            TInt dtFieldCount = sizeof(CreatorVPbkDateTimeFields) / sizeof(TInt);
-            for( TInt dtIndex = 0; dtIndex < dtFieldCount; ++dtIndex )
-                {
-                AddFieldToParamsL(CreatorVPbkDateTimeFields[dtIndex], iEngine->RandomDate(CCreatorEngine::EDateFuture));
-                }
-
-            AddFieldToParamsL(R_VPBK_FIELD_TYPE_CALLEROBJIMG, KNullDesC8);        
-            AddFieldToParamsL(R_VPBK_FIELD_TYPE_THUMBNAILPIC, KNullDesC8);        
-            AddFieldToParamsL(R_VPBK_FIELD_TYPE_CALLEROBJTEXT, firstname);*/
+		TPtrC anniv;
+		TBuf<20> timeString;
+		TTime datetime = iEngine->RandomDate( CCreatorEngine::EDateFuture );
+		_LIT(KDateString,"%D%M%Y%/0%1%/1%2%/2%3%/3");
+		TRAP_IGNORE( datetime.FormatL(timeString, KDateString) );
+		
+		anniv.Set(timeString);
+ 
+		CCreatorContactField* fieldAnniv = CCreatorContactField::NewL();
+		CleanupStack::PushL( fieldAnniv );
+		fieldAnniv->AddFieldToParamL(iParameters,CCreatorPhonebookWrapper::EAnniversary, anniv );
+		CleanupStack::Pop( fieldAnniv );
     //***************************************************************************
     
-		//iParameters->iContactFields.append( name );
         }
     else
-        {    
-		iParameters->iContactFields.append( name );
+        {
+		CCreatorContactField* field = CCreatorContactField::NewL();
+    	CleanupStack::PushL(field);
+    	field->AddFieldToParamL( iParameters, CCreatorPhonebookWrapper::EFirstName, fname );
+		field->AddFieldToParamL( iParameters, CCreatorPhonebookWrapper::ELastName, lname );
+		CleanupStack::Pop(field);
         }
                         
       // Phone numbers:
-    TInt phoneFieldCount = sizeof(CreatorPhoneNumberFields) / sizeof(PhoneNumInfo);
+    TInt phoneFieldCount = sizeof(CreatorPbkPhoneNumberFields) / sizeof(TInt);
     
     TInt inc=0;
-    for( int i=0; i<iNumberOfPhoneNumberFields; i++ )
+    for( TInt i=0; i<iNumberOfPhoneNumberFields; i++ )
     	{
     
 		if(inc >= phoneFieldCount )
         	{
     		inc = 0;
         	}
+		
+		CCreatorContactField* field = CCreatorContactField::NewL();
+        CleanupStack::PushL(field);
+		field->AddFieldToParamL(iEngine, iParameters, CreatorPbkPhoneNumberFields[inc] );
+		CleanupStack::Pop(field);
     
-		QContactPhoneNumber phoneNum;
-		TPtrC phoneNumber = iEngine->RandomString(CCreatorEngine::EPhoneNumber);
-		QString phone = QString::fromUtf16( phoneNumber.Ptr(), phoneNumber.Length() );
-		
-		phoneNum.setContexts(CreatorPhoneNumberFields[inc].iFieldContext);
-		phoneNum.setSubTypes(CreatorPhoneNumberFields[inc].iFieldString);
-		
-
-		phoneNum.setNumber( phone );
-
-		iParameters->iContactFields.append( phoneNum );
 		inc++;
     	}
     
     
     
     // URLs:
-    for( int i=0; i<iNumberOfURLFields; i++ )
+    TInt urlFieldCount = sizeof(CreatorPbkUrlFields) / sizeof(TInt);
+    inc = 0;
+    for( TInt i=0; i<iNumberOfURLFields; i++ )
+        {
+    
+		if(inc >= urlFieldCount )
           	{
-			QContactUrl contactUrl;
-			HBufC16* url = iEngine->CreateHTTPUrlLC();
-			QString urlAddress = QString::fromUtf16(url->Ptr(), url->Length() );
-			contactUrl.setUrl( urlAddress );
-			iParameters->iContactFields.append( contactUrl );
-			CleanupStack::PopAndDestroy(url);
-          	}
+        	inc = 0;
+           	}
+    
+		CCreatorContactField* field = CCreatorContactField::NewL();
+        CleanupStack::PushL(field);
+    	field->AddFieldToParamL(iEngine, iParameters, CreatorPbkUrlFields[inc] );
+    	CleanupStack::Pop(field);
+    	inc++;
+        }
 
     // EMail addresses:
+    TInt emailFieldCount = sizeof(CreatorPbkEmailFields) / sizeof(TInt);
+    inc = 0;
     for( int i=0; i<iNumberOfEmailAddressFields; i++ )
+    	{
+		if(inc >= emailFieldCount )
+           	{
+          	inc = 0;
+           	}
+        CCreatorContactField* field = CCreatorContactField::NewL();
+        CleanupStack::PushL(field);
+        field->AddFieldToParamL(iEngine, iParameters, CreatorPbkEmailFields[inc] );
+        CleanupStack::Pop(field);
+        inc++;
+    	}
+    
+    TestPrintOut(iParameters);
+    
+   }
+
+void CCreatorPhonebook::TestPrintOut(CPhonebookParameters* aParam)
+	{
+	LOGSTRING("Creator: CCreatorPhonebook::TestPrintOut");
+	for( TCreatorContactFields::iterator it = aParam->iContactFields.begin(); it != aParam->iContactFields.end(); ++it)
+        {
+        HBufC* temp = (*it).second;
+        if(temp)
         	{
-			QContactEmailAddress emailAddr;
-			HBufC16* addr= iEngine->CreateEmailAddressLC();;
-			/*TPtrC comp = iEngine->RandomString(CCreatorEngine::ECompany);
-			QString company = QString::fromUtf16( comp.Ptr(), comp.Length() );
-    		QString address = firstname+"@"+company+".com";*/
-			//CreatorPbkEmailFields
-			QString address = QString::fromUtf16(addr->Ptr(), addr->Length() );
-    		emailAddr.setEmailAddress( address );
-    		emailAddr.setContexts(CreatorPbkEmailFields[i%2]);
-    		iParameters->iContactFields.append( emailAddr );
-    		CleanupStack::PopAndDestroy(addr);
+			LOGSTRING3("Type: %d Content:%S ", (*it).first, &temp->Des() );
         	}
-    
+        }
     }
 
-
-
 // Checks if the link is a group or not
-TBool CCreatorPhonebook::IsContactGroupL()
+TBool CCreatorPhonebook::IsContactGroupL( TUint32& aLink )
 	{
+	//not used right now
 	return EFalse;
 	}
 
+
 TInt CCreatorPhonebook::CreateGroupEntryL(CCreatorModuleBaseParameters *aParameters)
     {
-	 LOGSTRING("Creator: CCreatorVirtualPhonebook::CreateGroupEntryL");
+	 LOGSTRING("Creator: CCreatorPhonebook::CreateGroupEntryL");
+	 TInt err = KErrNone;
+	 
 	    delete iParameters;
 	    iParameters = 0;
 	    
 	    CPhonebookParameters* parameters = (CPhonebookParameters*) aParameters;
 	    
 	    if( !parameters )
-	        {
-	        iParameters = new (ELeave) CPhonebookParameters;
-	        iParameters->iContactsInGroup = iContactsInGroup;
-	        TPtrC gname = iEngine->RandomString(CCreatorEngine::EGroupName);
-	        iParameters->iGroupName = QString::fromUtf16( gname.Ptr(),gname.Length() );
-	        iParameters->iGroupName += " #";
-	        int rnd = iEngine->RandomNumber(1000, 9999);
-	        iParameters->iGroupName += QString::number( rnd, 10 );
-	        parameters = iParameters;
-	        }
-
-	    TInt err = KErrNone;
-	 
+	       {
+	       iParameters = new (ELeave) CPhonebookParameters;
+	       iParameters->iContactsInGroup = iContactsInGroup;
+	       iParameters->iGroupName->Des().Copy( iEngine->RandomString(CCreatorEngine::EGroupName) );
+	       iParameters->iGroupName->Des().Append( _L(" #") );
+	       iParameters->iGroupName->Des().AppendNum( iEngine->RandomNumber(1000, 9999) );
+	       parameters = iParameters;
+	       }
+	   
 	    // create a new contact group
-	    QContact newGroup;
-	    newGroup.setType(QContactType::TypeGroup);
-        QContactName newGroupName;
-        newGroupName.setCustomLabel( iParameters->iGroupName );
-        newGroup.saveDetail(&newGroupName);
-        iContactMngr->saveContact(&newGroup);
-        QContactLocalId newGroupId = newGroup.localId();
-
-	        
+	    
+	    TUint32 newGroupId = iPhonebookWrapper->CreateGroupEntryL( parameters->iGroupName );
+	    
 	    // define amounts of contacts to be added to the group
 	    TInt amountOfContactsToBeAdded = 0;
 	    if (parameters->iContactsInGroup == KCreateRandomAmountOfGroups)
@@ -958,10 +624,10 @@
 	    if( parameters->iLinkIds.Count() > 0 )
 	        {
 	        for( TInt i = 0; i < parameters->iLinkIds.Count(); ++i )
-	            {/*
+	            {
 	            const CCreatorContactSet& set = ContactLinkCache::Instance()->ContactSet(parameters->iLinkIds[i].iLinkId);
 	          
-	            const RPointerArray<MVPbkContactLink>& links = set.ContactLinks();
+	            const RArray<TUint32> links = set.ContactLinks();//ContactLinkCache::Instance()->ContactSets();//set.ContactLinks();
 	            TInt numberOfExplicitLinks = links.Count(); // Number of defined contacts in contact-set
 	            TInt numberOfExistingContacts = set.NumberOfExistingContacts(); // Number of existing contacts in contact-set
 	            TInt maxAmount = numberOfExplicitLinks + numberOfExistingContacts;
@@ -973,67 +639,26 @@
 	            
 	            for( TInt j = 0; j < links.Count() && addedMembers < maxAmount; ++j )
 	                {
-	                MVPbkContactLink* link = links[j]; 
-	                if( link && IsContactGroupL(*link) == EFalse )
-	                    {
-	                    TRAPD(err, newGroup->AddContactL(*link));
-	                    if( err != KErrAlreadyExists )
-	                    	{
-	                    	// Ignore "allready exists" -error
-	                    	User::LeaveIfError(err);
-	                    	++addedMembers;
-	                    	}                    
-	                    }
+					
+					addedMembers += iPhonebookWrapper->AddContactToGroup(newGroupId,links[j]);
+	           
 	                }
 	            if( addedMembers < maxAmount )
 	            	{
 	            	// Add existing contacts, withing the limits set by maxAmount:
 	            	amountOfContactsToBeAdded += maxAmount - addedMembers;
-	            	}*/
+	            	}
 	            }
 	        }
 	    if( amountOfContactsToBeAdded > 0 )
 	        {
-			QList<QContactLocalId> contacts = iContactMngr->contactIds();
-			QContactRelationshipFilter rFilter;
-			rFilter.setRelationshipType(QContactRelationship::HasMember);
-			rFilter.setRelatedContactRole(QContactRelationshipFilter::First);
-			rFilter.setRelatedContactId( newGroup.id() );
-			
-			int cnt = 0;
-			for(int i=0; cnt < amountOfContactsToBeAdded && i < contacts.count() ; i++ )
-				{
-				QContact contact = iContactMngr->contact( iContactMngr->contactIds().at(i) );
-				if( iContactMngr->error() == QContactManager::DoesNotExistError )
-					{
-				
-					}
-				else
-					{
-					QList<QContactRelationship> relationships = contact.relationships(QContactRelationship::HasMember);
-					if(!relationships.count() && contact.type() == QContactType::TypeContact ) //just for contacts that are not in relationship - not in group yet
-						{
-						QContactRelationship* contactRel = new QContactRelationship();
-						contactRel->setRelationshipType(QContactRelationship::HasMember);
-						contactRel->setFirst(newGroup.id());
-						contactRel->setSecond(contact.id());
-						iContactMngr->saveRelationship( contactRel );
-						delete contactRel;
-						cnt++;
-						}
-					}
-				}
-			
-	       // group members and their count
-			QList<QContactLocalId> groupMemberIds = iContactMngr->contactIds( rFilter );
-			int testcnt = groupMemberIds.count(); 
-	    
-	   
+			TInt addedContacts = iPhonebookWrapper->AddToGroup(newGroupId, amountOfContactsToBeAdded);
+		
 	        }
 	    
 	    // store the link to contact, so that Creator is able to delete
 	    // it when user requests deletion of contacts that were created with Creator 
-	    iContactGroupsToDelete.Append( (TUint32)newGroupId );
+	    iContactGroupsToDelete.Append( newGroupId );
 	    
 	    return err;
     }
@@ -1049,6 +674,96 @@
 
 //----------------------------------------------------------------------------
 
+CCreatorContactField::CCreatorContactField()
+    {
+    }
+CCreatorContactField::~CCreatorContactField()
+    {
+    }
+
+CCreatorContactField* CCreatorContactField::NewL()
+    {
+    CCreatorContactField* self = new (ELeave) CCreatorContactField();
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    CleanupStack::Pop();
+    return self;
+    }
+void CCreatorContactField::ConstructL()
+    {
+    }
+
+
+void CCreatorContactField::AddFieldToParamL( CCreatorEngine* aEngine, CPhonebookParameters* aParam, TInt aType, TInt aRand )
+    {
+    HBufC* content = NULL;
+    if( aRand == KErrNotFound ) 
+        {
+        TInt textFieldCount = sizeof(CreatorPbkPhoneNumberFields)/sizeof(TInt);;
+        for( TInt tfIndex = 0; tfIndex < textFieldCount; ++tfIndex )
+            {
+            if( CreatorPbkPhoneNumberFields[tfIndex] == aType )
+                {
+                content = aEngine->RandomString(CCreatorEngine::EPhoneNumber).AllocL();
+                break;
+                }
+            }
+    
+        textFieldCount = sizeof(CreatorPbkUrlFields)/sizeof(TInt);;
+        for( TInt tfIndex = 0; tfIndex < textFieldCount; ++tfIndex )
+            {
+            if( CreatorPbkUrlFields[tfIndex] == aType )
+                {
+                content = aEngine->CreateHTTPUrlLC(); 
+                CleanupStack::Pop();
+                break;
+                }
+            }
+        textFieldCount = sizeof(CreatorPbkEmailFields)/sizeof(TInt);;
+        for( TInt tfIndex = 0; tfIndex < textFieldCount; ++tfIndex )
+            {
+            if( CreatorPbkEmailFields[tfIndex] == aType )
+                {
+                content = aEngine->CreateEmailAddressLC();
+                CleanupStack::Pop();
+                break;
+                }
+            }
+        
+    
+        //if there is textfield without specified random number
+        textFieldCount = sizeof(CreatorPbkMiscTextFields) / sizeof(DetailFieldInfo);
+        for( TInt tfIndex = 0; tfIndex < textFieldCount; ++tfIndex )
+            {
+			if( CreatorPbkMiscTextFields[tfIndex].iFieldCode == aType && CreatorPbkMiscTextFields[tfIndex].iRandomType != RND_TYPE_UNDEF )
+            	{
+				TInt rand =  CreatorPbkMiscTextFields[tfIndex].iRandomType;
+				content = aEngine->RandomString((CCreatorEngine::TRandomStringType) rand).AllocL();
+				break;
+				}
+			}	
+        }
+
+    if( aRand != KErrNotFound && aRand != RND_TYPE_UNDEF ) 
+        {
+        TInt textFieldCount = sizeof(CreatorPbkMiscTextFields) / sizeof(DetailFieldInfo);
+        for( TInt tfIndex = 0; tfIndex < textFieldCount; ++tfIndex )
+            {
+            if( CreatorPbkMiscTextFields[tfIndex].iFieldCode == aType )
+                {
+                content = aEngine->RandomString((CCreatorEngine::TRandomStringType) aRand).AllocL();
+                }
+            }
+        }
+	
+	aParam->iContactFields.insert( TCreatorContactField(aType, content) );
+	}
+
+void CCreatorContactField::AddFieldToParamL( CPhonebookParameters* aParam, TInt aType, TPtrC aContent )
+    {
+    aParam->iContactFields.insert( TCreatorContactField(aType, aContent.AllocL()) );
+    }
+
 //----------------------------------------------------------------------------
 
 //----------------------------------------------------------------------------
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/creator/engine/src/creator_phonebookapi.cpp	Thu Jul 22 16:33:59 2010 +0100
@@ -0,0 +1,161 @@
+/*
+* 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 "creator_phonebookapi.h"
+
+CCreatorPhonebookAPI::CCreatorPhonebookAPI ()
+    {
+    mContactMngr = new QContactManager("symbian");
+    }
+
+CCreatorPhonebookAPI::~CCreatorPhonebookAPI ()
+    {
+    if( mContactMngr )
+        {
+        delete mContactMngr;
+        mContactMngr = NULL;
+        }
+    }
+
+quint32 CCreatorPhonebookAPI::saveContact( const QList<QContactDetail>& list )
+    {
+    // create a new contact item
+    QContact store;
+    quint32 id;
+    bool success = false;
+    for(int i = 0 ; i < list.count() ; i++ )
+    	{
+		QContactDetail cntdetail = list.at(i);
+		success = store.saveDetail(&cntdetail);
+    	}
+    /*foreach( QContactDetail cntdetail, list )
+        {
+        success = store.saveDetail( &cntdetail );
+        }
+    */
+    success = mContactMngr->saveContact( &store );
+    id = store.localId();
+    return id;
+    }
+
+quint32 CCreatorPhonebookAPI::createGroup( const QString& groupName )
+	{
+	QContact newGroup;
+	newGroup.setType(QContactType::TypeGroup);
+	QContactName newGroupName;
+	newGroupName.setCustomLabel( groupName );
+	newGroup.saveDetail(&newGroupName);
+	mContactMngr->saveContact(&newGroup);
+	return newGroup.localId();
+	}
+
+int CCreatorPhonebookAPI::numberOfContacts()
+	{
+	QList<QContactLocalId> contacts = mContactMngr->contactIds();
+	return contacts.count();
+	
+	}
+
+bool CCreatorPhonebookAPI::IsContactGroupL( const QContact& contact )
+	{
+	 
+	if( contact.type() == QContactType::TypeGroup )
+		{
+		return true;
+		}
+	return false;
+	}
+
+int CCreatorPhonebookAPI::addContactToGroup( QContactLocalId group, QContactLocalId contact )
+	{
+	QContact newGroup = mContactMngr->contact( group );
+	QContact contactLink = mContactMngr->contact( contact );
+	int ret = 0;
+	if( contact && IsContactGroupL( contactLink ) == false )
+	    {
+        QList<QContactRelationship> relationships = contactLink.relationships(QContactRelationship::HasMember);
+        if( !relationships.count() && contactLink.type() == QContactType::TypeContact ) //just for contacts that are not in relationship - not in group yet
+			{
+			QContactRelationship* contactRel = new QContactRelationship();
+			contactRel->setRelationshipType(QContactRelationship::HasMember);
+			contactRel->setFirst(newGroup.id());
+			contactRel->setSecond( contactLink.id() );
+			mContactMngr->saveRelationship( contactRel );
+			delete contactRel;
+			ret++;
+			}         
+		}
+	return ret;
+	}
+int CCreatorPhonebookAPI::addToGroup(QContactLocalId group, int amount)
+	{
+	QList<QContactLocalId> contacts = mContactMngr->contactIds();
+	int ret = 0;		
+	int tmp = 0;
+	int cnt = 0;
+	
+	for( int i=0; cnt < amount && i < contacts.count() ; i++ )
+		{
+		QContact contact = mContactMngr->contact( mContactMngr->contactIds().at(i) );
+		if( contact.type() == QContactType::TypeContact )
+			{
+			tmp = addContactToGroup(group,mContactMngr->contactIds().at(i)); 
+			ret += tmp;
+			if(tmp)
+				{
+				cnt++;
+				tmp = 0;
+				}
+			}
+		}
+	return ret;
+	}
+
+
+bool CCreatorPhonebookAPI::deleteAllContacts()
+    {
+    QList<QContactLocalId> all = mContactMngr->contactIds();
+    return deleteContacts( all );
+    }
+
+bool CCreatorPhonebookAPI::deleteAllContacts( const QString& type )
+    {
+    QList<QContactLocalId> contactsToDelete;
+    QList<QContactLocalId> contacts = mContactMngr->contactIds();
+    foreach(QContactLocalId contactId, contacts)
+        {
+        QContact contact = mContactMngr->contact( contactId );
+        if( contact.type() == type )
+            {
+            contactsToDelete.append( contact.localId() );
+            }
+        }
+    return deleteContacts( contactsToDelete );
+    }
+
+
+bool CCreatorPhonebookAPI::deleteContacts( const QList<QContactLocalId>& list )
+    {
+    QMap<int, QContactManager::Error> errorMap;
+    return mContactMngr->removeContacts( list, &errorMap );
+    }
+
+QContact CCreatorPhonebookAPI::contact( const QContactLocalId& contactId )
+    {
+    return mContactMngr->contact( contactId );
+    }
+// End of File
--- a/creator/engine/src/creator_phonebookbase.cpp	Fri Jun 11 16:29:34 2010 +0100
+++ b/creator/engine/src/creator_phonebookbase.cpp	Thu Jul 22 16:33:59 2010 +0100
@@ -20,94 +20,127 @@
 #include "creator_phonebookbase.h"
 #include "creator_traces.h"
 
-TBool CCreatorPhonebookBase::AskDataFromUserL(TInt aCommand, TInt& aNumberOfEntries)
+void CCreatorPhonebookBase::QueryDialogClosedL(TBool aPositiveAction, TInt aUserData)
     {
-    LOGSTRING("Creator: CCreatorPhonebook::AskDataFromUserL");
+    LOGSTRING("Creator: CCreatorPhonebookBase::QueryDialogClosedL");
+    
+    if(aPositiveAction == EFalse && aUserData!=ECreatorPhonebookGetContactFields )
+        {
+        iEngine->ShutDownEnginesL();
+        return;
+        }
+    
+    const TDesC* showText = &KSavingText;
+    TBool finished(EFalse);
+    TBool retval(ETrue);
+    switch(aUserData)
+        {
+        case ECreatorPhonebookDelete:
+            showText = &KDeletingText;
+            finished = ETrue;
+            iEntriesToBeCreated = 1;
+            break;
+        case ECreatorPhonebookStart:
+        	if(iCommand == ECmdCreatePhoneBookEntryContacts )
+        		{
+				retval = iEngine->GetEngineWrapper()->ListQueryDialog(_L("Fields in contact"), R_CONTACT_CREATION_TYPE_QUERY, 
+        	                &iDummy, this, ECreatorPhonebookGetContactFields );
+        		}
+        	else
+        		{
+				retval = iEngine->GetEngineWrapper()->ListQueryDialog(_L("Number of contacts "), R_GROUP_CREATION_TYPE_QUERY, 
+        	       	                &iDummy, this, ECreatorPhonebookGetGroupFields );
+        		}
+            break;
+        case ECreatorPhonebookGetContactFields:
+            if(iDummy==0)// first item, use default fields
+                    
+                {
+                iDefaultFieldsSelected = ETrue;
+                finished = ETrue;
+                }
+            else
+                {
+                retval = iEngine->GetEngineWrapper()->EntriesQueryDialog(&iNumberOfPhoneNumberFields, _L("Amount of phone number fields in one contact?"), 
+                    ETrue, this, ECreatorPhonebookGetPhoneNumbersCount 
+                    );
+                }
+            break;
+        case ECreatorPhonebookGetPhoneNumbersCount:
+            retval = iEngine->GetEngineWrapper()->EntriesQueryDialog(&iNumberOfURLFields, _L("Amount of URL fields in one contact?"), 
+                ETrue, this, ECreatorPhonebookGetUrlsCount 
+                );
+            break;
+        case ECreatorPhonebookGetUrlsCount:
+            retval = iEngine->GetEngineWrapper()->EntriesQueryDialog(&iNumberOfEmailAddressFields, _L("Amount of email fields in one contact?"), 
+                ETrue, this, ECreatorPhonebookGetEmailsCount
+                );
+            break;
+        case ECreatorPhonebookGetEmailsCount:
+            retval = iEngine->GetEngineWrapper()->YesNoQueryDialog(_L("Add all the other fields to contacts?"), this, ECreatorPhonebookContactsAllFields);
+            break;
+        case ECreatorPhonebookContactsAllFields:
+            iAddAllFields = aPositiveAction;
+            // finaly we have all informations from user, start engine
+            finished = ETrue;
+            break;
+        case ECreatorPhonebookGetGroupFields:
+            iContactsInGroup = KCreateRandomAmountOfGroups;
+            if(iDummy==0)// first item, use default fields
+                {
+                finished = ETrue;
+                }
+            else
+                {
+                retval = iEngine->GetEngineWrapper()->EntriesQueryDialog(&iContactsInGroup, _L("Amount of contacts in one group?"), 
+                    ETrue, this, ECreatorPhonebookGetContactsInGroup);
+                }
+            break;
+        case ECreatorPhonebookGetContactsInGroup:
+            // finaly we have all informations from user, start engine
+            finished = ETrue;
+            break;
+        default:
+            //some error
+            retval = EFalse;
+            break;
+        }
+    if( retval == EFalse )
+        {
+        iEngine->ShutDownEnginesL();
+        }
+    else if( finished )
+        {
+        // add this command to command array
+        iEngine->AppendToCommandArrayL(iCommand, NULL, iEntriesToBeCreated);
+        // started exucuting commands
+        iEngine->ExecuteFirstCommandL( *showText );
+        }
+    }
+    
+TBool CCreatorPhonebookBase::AskDataFromUserL(TInt aCommand)
+    {
+    LOGSTRING("Creator: CCreatorPhonebookBase::AskDataFromUserL");
+    iCommand = aCommand;
     
     if( aCommand == ECmdDeleteContacts )
         {
-        return iEngine->GetEngineWrapper()->YesNoQueryDialog(_L("Delete all contacts?") );
+        return iEngine->GetEngineWrapper()->YesNoQueryDialog(_L("Delete all contacts?"), this, ECreatorPhonebookDelete );
         }
     if( aCommand == ECmdDeleteCreatorContacts )
         {
-        return iEngine->GetEngineWrapper()->YesNoQueryDialog(_L("Delete all contacts created with Creator?") ); 
+        return iEngine->GetEngineWrapper()->YesNoQueryDialog(_L("Delete all contacts created with Creator?"), this, ECreatorPhonebookDelete ); 
         }
     if( aCommand == ECmdDeleteContactGroups )
         {
-        return iEngine->GetEngineWrapper()->YesNoQueryDialog(_L("Delete all contact groups?") );
+        return iEngine->GetEngineWrapper()->YesNoQueryDialog(_L("Delete all contact groups?"), this, ECreatorPhonebookDelete );
         }
     if( aCommand == ECmdDeleteCreatorContactGroups )
         {
-        return iEngine->GetEngineWrapper()->YesNoQueryDialog(_L("Delete all contact groups created with Creator?") ); 
+        return iEngine->GetEngineWrapper()->YesNoQueryDialog(_L("Delete all contact groups created with Creator?"), this, ECreatorPhonebookDelete ); 
         }    
     // display queries
-    if (iEngine->GetEngineWrapper()->EntriesQueryDialog(aNumberOfEntries, _L("How many entries to create?"))) // ask number of entries to create
-        {
-        if (aCommand == ECmdCreatePhoneBookEntryContacts)
-            {
-            TInt index = 0;
-
-            //CAknListQueryDialog* dlg1 = new(ELeave) CAknListQueryDialog(&index);
-            if (iEngine->GetEngineWrapper()->ListQueryDialog(_L("Fields in contact"), R_CONTACT_CREATION_TYPE_QUERY, index))
-                {
-                if (index == 0) //first item
-                    {
-                    iDefaultFieldsSelected = ETrue;
-                    return ETrue;    
-                    }
-                else  // detailed mode selected
-                    {
-                    iDefaultFieldsSelected = EFalse;
-                    if (iEngine->GetEngineWrapper()->EntriesQueryDialog(iNumberOfPhoneNumberFields, _L("Amount of phone number fields in one contact?"), ETrue))
-                        {
-                        if (iEngine->GetEngineWrapper()->EntriesQueryDialog(iNumberOfURLFields, _L("Amount of URL fields in one contact?"), ETrue))
-                            {
-                            if (iEngine->GetEngineWrapper()->EntriesQueryDialog(iNumberOfEmailAddressFields, _L("Amount of email fields in one contact?"), ETrue))
-                                {                                
-                                return ETrue;
-                                }
-                            else
-                                return EFalse;
-                            }
-                            else
-                                return EFalse;
-                        }
-                    else
-                        return EFalse;
-                    }
-                }
-            else
-                return EFalse;
-            }
-        else if (aCommand == ECmdCreatePhoneBookEntryGroups)
-            {
-            TInt index = 0;
-            //CAknListQueryDialog* dlg1 = new(ELeave) CAknListQueryDialog(&index);
-            if (iEngine->GetEngineWrapper()->ListQueryDialog(_L("Fields in contact"), R_GROUP_CREATION_TYPE_QUERY, index))
-                {
-                if (index == 0) //first item
-                    {
-                    iContactsInGroup = KCreateRandomAmountOfGroups;
-                    return ETrue;
-                    }
-                else
-                    {
-                    if (iEngine->GetEngineWrapper()->EntriesQueryDialog(iContactsInGroup, _L("Amount of contacts in one group?"), ETrue))
-                        {
-                        return ETrue;
-                        }
-                    else
-                        return EFalse;
-                    }
-                }
-            else
-                return EFalse;
-            }
-        else 
-            return ETrue; 
-        }
-    else
-        return EFalse;
+    return iEngine->GetEngineWrapper()->EntriesQueryDialog( &iEntriesToBeCreated, _L("How many entries to create?"), EFalse, this, ECreatorPhonebookStart); // ask number of entries to create
     }
 
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/creator/engine/src/creator_phonebookwrapper.cpp	Thu Jul 22 16:33:59 2010 +0100
@@ -0,0 +1,654 @@
+/*
+* 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 "engine.h"
+#include "enginewrapper.h"
+#include "creator_contactsetcache.h"
+
+#include "creator_phonebookwrapper.h" 
+#include "creator_traces.h"
+
+#include <bautils.h> 
+
+_LIT(KTempPath, "C:\\Data\\Creator\\");
+
+typedef struct {
+TInt iFieldCode;
+QString iDetail;
+QString iFieldContext;
+QString iFieldString;
+} QDetailFieldInfo;
+//static const TInt RND_TYPE_UNDEF = -99;
+QDetailFieldInfo CreatorPbkTextFields[] = {        
+        { (TInt)CCreatorPhonebookWrapper::EFirstName,(QContactName::DefinitionName).operator QString(), (QContactDetail::ContextHome).operator QString(), (QContactName::FieldFirstName).operator QString()},
+        { (TInt)CCreatorPhonebookWrapper::ELastName,(QContactName::DefinitionName).operator QString(), (QContactDetail::ContextHome).operator QString(), (QContactName::FieldLastName).operator QString()},
+        { (TInt)CCreatorPhonebookWrapper::ECompanyName,(QContactOrganization::DefinitionName).operator QString(), (QContactDetail::ContextWork).operator QString(), (QContactOrganization::FieldName).operator QString()},
+        { (TInt)CCreatorPhonebookWrapper::EJobTitle,(QContactOrganization::DefinitionName).operator QString(), (QContactDetail::ContextWork).operator QString(), (QContactOrganization::FieldTitle).operator QString()},
+        { (TInt)CCreatorPhonebookWrapper::EPrefix,(QContactName::DefinitionName).operator QString(), (QContactDetail::ContextHome).operator QString(), (QContactName::FieldPrefix).operator QString()},
+        { (TInt)CCreatorPhonebookWrapper::ESuffix,(QContactName::DefinitionName).operator QString(), (QContactDetail::ContextHome).operator QString(), (QContactName::FieldSuffix).operator QString()},
+        { (TInt)CCreatorPhonebookWrapper::EMiddleName,(QContactName::DefinitionName).operator QString(), (QContactDetail::ContextHome).operator QString(), (QContactName::FieldMiddleName).operator QString()},
+        { (TInt)CCreatorPhonebookWrapper::EAddrStreetHome,(QContactAddress::DefinitionName).operator QString(), (QContactDetail::ContextHome).operator QString(), (QContactAddress::FieldStreet).operator QString()},
+        { (TInt)CCreatorPhonebookWrapper::EAddrLocalHome,(QContactAddress::DefinitionName).operator QString(), (QContactDetail::ContextHome).operator QString(), (QContactAddress::FieldLocality).operator QString()},
+        { (TInt)CCreatorPhonebookWrapper::EAddrRegionHome,(QContactAddress::DefinitionName).operator QString(), (QContactDetail::ContextHome).operator QString(), (QContactAddress::FieldRegion).operator QString()},
+        { (TInt)CCreatorPhonebookWrapper::EAddrPostCodeHome,(QContactAddress::DefinitionName).operator QString(), (QContactDetail::ContextHome).operator QString(), (QContactAddress::FieldPostcode).operator QString()},
+        { (TInt)CCreatorPhonebookWrapper::EAddrCountryHome,(QContactAddress::DefinitionName).operator QString(), (QContactDetail::ContextHome).operator QString(), (QContactAddress::FieldCountry).operator QString()},
+        { (TInt)CCreatorPhonebookWrapper::EAddrStreetGen,(QContactAddress::DefinitionName).operator QString(), "", (QContactAddress::FieldStreet).operator QString()},
+        { (TInt)CCreatorPhonebookWrapper::EAddrLocalGen,(QContactAddress::DefinitionName).operator QString(), "", (QContactAddress::FieldLocality).operator QString()},
+        { (TInt)CCreatorPhonebookWrapper::EAddrRegionGen,(QContactAddress::DefinitionName).operator QString(), "", (QContactAddress::FieldRegion).operator QString()},
+        { (TInt)CCreatorPhonebookWrapper::EAddrPostCodeGen,(QContactAddress::DefinitionName).operator QString(), "", (QContactAddress::FieldPostcode).operator QString()},
+        { (TInt)CCreatorPhonebookWrapper::EAddrCountryGen,(QContactAddress::DefinitionName).operator QString(), "", (QContactAddress::FieldCountry).operator QString()},
+        { (TInt)CCreatorPhonebookWrapper::EAddrStreetWork,(QContactAddress::DefinitionName).operator QString(), (QContactDetail::ContextWork).operator QString(), (QContactAddress::FieldStreet).operator QString()},
+        { (TInt)CCreatorPhonebookWrapper::EAddrLocalWork,(QContactAddress::DefinitionName).operator QString(), (QContactDetail::ContextWork).operator QString(), (QContactAddress::FieldLocality).operator QString()},
+        { (TInt)CCreatorPhonebookWrapper::EAddrRegionWork,(QContactAddress::DefinitionName).operator QString(), (QContactDetail::ContextWork).operator QString(), (QContactAddress::FieldRegion).operator QString()},
+        { (TInt)CCreatorPhonebookWrapper::EAddrPostCodeWork,(QContactAddress::DefinitionName).operator QString(), (QContactDetail::ContextWork).operator QString(), (QContactAddress::FieldPostcode).operator QString()},
+        { (TInt)CCreatorPhonebookWrapper::EAddrCountryWork,(QContactAddress::DefinitionName).operator QString(), (QContactDetail::ContextWork).operator QString(), (QContactAddress::FieldCountry).operator QString()},
+        { (TInt)CCreatorPhonebookWrapper::EMobilePhoneWork,(QContactPhoneNumber::DefinitionName).operator QString(), (QContactDetail::ContextWork).operator QString(), (QContactPhoneNumber::SubTypeMobile).operator QString()},
+        { (TInt)CCreatorPhonebookWrapper::ELandPhoneWork,(QContactPhoneNumber::DefinitionName).operator QString(), (QContactDetail::ContextWork).operator QString(), (QContactPhoneNumber::SubTypeLandline).operator QString()},
+        { (TInt)CCreatorPhonebookWrapper::ENote,(QContactNote::DefinitionName).operator QString(), (QContactDetail::ContextHome).operator QString(), (QContactNote::FieldNote).operator QString()},
+        { (TInt)CCreatorPhonebookWrapper::EDepartment,(QContactOrganization::DefinitionName).operator QString(), (QContactDetail::ContextWork).operator QString(), (QContactOrganization::FieldDepartment).operator QString()},
+        { (TInt)CCreatorPhonebookWrapper::EAsstName,(QContactOrganization::DefinitionName).operator QString(), (QContactDetail::ContextWork).operator QString(), (QContactOrganization::FieldAssistantName).operator QString()},
+        { (TInt)CCreatorPhonebookWrapper::ESpouse,(QContactFamily::DefinitionName).operator QString(), (QContactDetail::ContextHome).operator QString(), (QContactFamily::FieldSpouse).operator QString()},
+        { (TInt)CCreatorPhonebookWrapper::EChildren,(QContactFamily::DefinitionName).operator QString(), (QContactDetail::ContextHome).operator QString(), (QContactFamily::FieldChildren).operator QString()},
+        { (TInt)CCreatorPhonebookWrapper::EGenLabel,(QContactName::DefinitionName).operator QString(), (QContactDetail::ContextHome).operator QString(),  (QContactName::FieldCustomLabel).operator QString()}
+        };
+                  
+
+typedef struct{
+TInt iFieldCode;
+QString iFieldContext;
+QString iFieldString;
+}PhoneNumInfo;
+PhoneNumInfo CreatorPhoneNumberFields[] =
+    {
+    { CCreatorPhonebookWrapper::ELandPhoneGen,"", "Landline"},
+    { CCreatorPhonebookWrapper::ELandPhoneHome,"Home", "Landline"},
+    { CCreatorPhonebookWrapper::ELandPhoneWork,"Work", "Landline"},                        
+    { CCreatorPhonebookWrapper::EMobilePhoneGen,"","Mobile"},
+    { CCreatorPhonebookWrapper::EMobilePhoneHome,"Home","Mobile"},
+    { CCreatorPhonebookWrapper::EMobilePhoneWork,"Work", "Mobile"},
+    { CCreatorPhonebookWrapper::EFaxNumberGen, "", "Facsimile"},
+    { CCreatorPhonebookWrapper::EFaxNumberHome, "Home", "Facsimile"},
+    { CCreatorPhonebookWrapper::EFaxNumberWork, "Work", "Facsimile"},
+    { CCreatorPhonebookWrapper::EPagerNumber, "Work", "Pager"},
+    { CCreatorPhonebookWrapper::EVideoNumberGen, "", "Video"},
+    { CCreatorPhonebookWrapper::EVideoNumberHome, "Home", "Video"},
+    { CCreatorPhonebookWrapper::EVideoNumberWork, "Work", "Video"},   //{ "Home", "Voice" },//{ "Work", "Voice" },
+    { CCreatorPhonebookWrapper::EAsstPhone, "Work", "Assistant" },
+    { CCreatorPhonebookWrapper::ECarPhone, "Home",  "Car" }
+    };
+
+
+typedef struct{
+	TInt iFieldCode;
+	QString iFieldContext;
+}EmailInfo;
+EmailInfo CreatorEmailFields[] =
+	{
+    {CCreatorPhonebookWrapper::EEmailGen,""},
+    {CCreatorPhonebookWrapper::EEmailHome,(QContactDetail::ContextHome).operator QString()},
+    {CCreatorPhonebookWrapper::EEmailWork,(QContactDetail::ContextWork).operator QString()}
+    };
+
+typedef struct{
+	TInt iFieldCode;
+	QString iFieldContext;
+}UrlInfo;
+UrlInfo CreatorUrlFields[] =
+    {
+    {CCreatorPhonebookWrapper::EUrlGen,""},
+    {CCreatorPhonebookWrapper::EUrlHome,(QContactDetail::ContextHome).operator QString()},
+    {CCreatorPhonebookWrapper::EUrlWork,(QContactDetail::ContextWork).operator QString()}
+    };
+
+CCreatorPhonebookWrapper* CCreatorPhonebookWrapper::NewL()
+    {
+    CCreatorPhonebookWrapper* self = CCreatorPhonebookWrapper::NewLC();
+    CleanupStack::Pop(self);
+    return self;
+    }
+
+CCreatorPhonebookWrapper* CCreatorPhonebookWrapper::NewLC()
+    {
+    CCreatorPhonebookWrapper* self = new (ELeave) CCreatorPhonebookWrapper();
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    return self;
+    }
+
+
+CCreatorPhonebookWrapper::CCreatorPhonebookWrapper() 
+    {
+    }
+
+void CCreatorPhonebookWrapper::ConstructL()
+    {
+    LOGSTRING("Creator: CCreatorPhonebookWrapper::ConstructL");
+
+    QT_TRYCATCH_LEAVING( iPhonebookAPI = new CCreatorPhonebookAPI() );
+	
+	}
+	
+
+CCreatorPhonebookWrapper::~CCreatorPhonebookWrapper()
+    {
+    LOGSTRING("Creator: CCreatorPhonebookWrapper::~CCreatorPhonebookWrapper");
+	if( iPhonebookAPI )
+        {
+        delete iPhonebookAPI;
+        iPhonebookAPI = NULL;
+        }
+    }
+
+//----------------------------------------------------------------------------
+
+QList<QContactDetail> CCreatorPhonebookWrapper::CreateContactDetailsFromParameters( const TCreatorContactFields& aFields )
+	{
+	QList<QContactDetail> contDetList;
+	QString content;
+	HBufC* temp;
+	TInt arraySize = sizeof(CreatorPbkTextFields)/sizeof(QDetailFieldInfo);
+	for (TInt i = 0; i < arraySize; i++)
+		{
+	    TCreatorContactFields::const_iterator it = aFields.find(CreatorPbkTextFields[i].iFieldCode);
+		if( it != aFields.end() )
+			{
+		    temp = (*it).second;
+			content = QString::fromUtf16( temp->Des().Ptr(), temp->Length() );
+			QContactDetail contactDetail =  CreateContactDetail(contDetList, CreatorPbkTextFields[i].iDetail,CreatorPbkTextFields[i].iFieldContext,CreatorPbkTextFields[i].iFieldString, content );
+			AddFieldToList( contDetList, contactDetail );
+			}
+		
+		}
+	arraySize = sizeof(CreatorPhoneNumberFields)/sizeof(PhoneNumInfo);
+		for (TInt i = 0; i < arraySize; i++)
+			{
+			TCreatorContactFields::const_iterator it = aFields.find(CreatorPhoneNumberFields[i].iFieldCode);
+			if( it != aFields.end() )
+				{
+			    temp = (*it).second;
+				content = QString::fromUtf16( temp->Des().Ptr(), temp->Length() );
+				QContactDetail contactDetail =  CreateContactDetail(contDetList, QContactPhoneNumber::DefinitionName ,CreatorPhoneNumberFields[i].iFieldContext,CreatorPhoneNumberFields[i].iFieldString, content );
+				AddFieldToList( contDetList, contactDetail );
+				}
+			}
+		
+	arraySize = sizeof(CreatorEmailFields)/sizeof(EmailInfo);
+		for (TInt i = 0; i < arraySize; i++)
+			{
+			TCreatorContactFields::const_iterator it = aFields.find(CreatorEmailFields[i].iFieldCode);
+			if( it != aFields.end() )
+				{
+			    temp = (*it).second;
+				content = QString::fromUtf16( temp->Des().Ptr(), temp->Length() );
+				QContactDetail contactDetail =  CreateContactDetail(contDetList, QContactEmailAddress::DefinitionName ,CreatorEmailFields[i].iFieldContext,"", content );
+				AddFieldToList( contDetList, contactDetail );
+				}
+			}
+		
+	arraySize = sizeof(CreatorUrlFields)/sizeof(UrlInfo);
+			for (TInt i = 0; i < arraySize; i++)
+				{
+				TCreatorContactFields::const_iterator it = aFields.find(CreatorUrlFields[i].iFieldCode);
+				if( it != aFields.end() )
+					{
+				    temp = (*it).second;
+					content = QString::fromUtf16( temp->Des().Ptr(), temp->Length() );
+					QContactDetail contactDetail =  CreateContactDetail(contDetList, QContactUrl::DefinitionName ,CreatorUrlFields[i].iFieldContext,"", content );
+					AddFieldToList( contDetList, contactDetail );
+					}
+				}	
+	arraySize = sizeof(CreatorUrlFields)/sizeof(UrlInfo);
+			for (TInt i = 0; i < arraySize; i++)
+				{
+				TCreatorContactFields::const_iterator it = aFields.find(CreatorUrlFields[i].iFieldCode);
+				if( it != aFields.end() )
+					{
+					temp = (*it).second;
+					content = QString::fromUtf16( temp->Des().Ptr(), temp->Length() );
+					QContactDetail contactDetail =  CreateContactDetail(contDetList, QContactUrl::DefinitionName ,CreatorUrlFields[i].iFieldContext,"", content );
+					AddFieldToList( contDetList, contactDetail );
+					}
+				}
+			
+			TCreatorContactFields::const_iterator it = aFields.find(CCreatorPhonebookWrapper::EThumbnailPic);
+			if( it != aFields.end() )
+				{
+				temp = (*it).second;
+				if(temp)
+					{
+					content = QString::fromUtf16( temp->Des().Ptr(), temp->Length() );
+					QContactDetail contactDetail =  CreateContactDetail(contDetList, QContactAvatar::DefinitionName ,"","", content );
+					AddFieldToList( contDetList, contactDetail );
+					}
+				}
+			it = aFields.find(CCreatorPhonebookWrapper::EAnniversary);
+				if( it != aFields.end() )
+					{
+					temp = (*it).second;
+					if(temp)
+						{
+						content = QString::fromUtf16( temp->Des().Ptr(), temp->Length() );
+						QContactDetail contactDetail =  CreateContactDetail(contDetList, QContactAnniversary::DefinitionName ,"","", content );
+						AddFieldToList( contDetList, contactDetail );
+						}
+					}
+		
+	return contDetList;
+	}
+QContactDetail CCreatorPhonebookWrapper::CreateContactDetail( QList<QContactDetail>& aContactDetailList,QString aDetail, QString aFieldContext, QString aFieldString, QString aData )
+    {
+    QContactDetail contactDetail;
+        
+        if( aDetail == QContactPhoneNumber::DefinitionName)
+            {
+            QContactPhoneNumber phoneNumber;// = contactDetail;
+            if(!aFieldContext.isEmpty())
+            	{
+				phoneNumber.setContexts(aFieldContext);
+            	}
+            phoneNumber.setSubTypes(aFieldString);
+            //QString number = QString::fromUtf16(aData.Ptr(),aData.Length());
+            phoneNumber.setNumber(aData);
+            return phoneNumber;
+            }
+        else if( aDetail == QContactName::DefinitionName )          //--Contact NAME-----------------------------
+            {
+            QContactName contactName;
+            for(int i = 0 ; i < aContactDetailList.count() ; i++ ) //go through all contact details to check if there is already Contact Name to set other details
+                {
+                if(aContactDetailList.at(i).definitionName() == QContactName::DefinitionName )
+                    {
+                    contactName = aContactDetailList.at(i);
+                    }
+                }
+            //QString name = QString::fromUtf16(aData.Ptr(),aData.Length());
+            if(aFieldString == QContactName::FieldFirstName)
+                {
+                if(contactName.firstName().isEmpty())
+                    {
+                    contactName.setFirstName( aData );
+                    }
+                }
+            else if(aFieldString == QContactName::FieldLastName)
+                {
+                if(contactName.lastName().isEmpty())
+                    {
+                    contactName.setLastName( aData );
+                    }
+                }
+            else if(aFieldString == QContactName::FieldMiddleName)
+                {
+                if(contactName.middleName().isEmpty())
+                    {
+                    contactName.setMiddleName( aData );
+                    }
+                }
+            else if(aFieldString == QContactName::FieldPrefix)
+                {
+                if(contactName.prefix().isEmpty())
+                    {
+                    contactName.setPrefix( aData );
+                    }
+                }
+            else if(aFieldString == QContactName::FieldSuffix)
+                {
+                if(contactName.suffix().isEmpty())
+                    {
+                    contactName.setSuffix( aData );
+                    }
+                }
+            else        //QContactName::FieldCustomLabel:
+                {
+                if(contactName.customLabel().isEmpty())
+                    {
+                    contactName.setCustomLabel( aData );
+                    }
+                }
+            return contactName;
+            }
+        else if( aDetail == QContactOrganization::DefinitionName )          //--Contact Company-----------------------------
+            {
+            QContactOrganization contactCompany;
+            
+            for(int i = 0 ; i < aContactDetailList.count() ; i++ ) //go through all contact details to check if there is already Contact Name to set other details
+                {
+                if(aContactDetailList.at(i).definitionName() == QContactOrganization::DefinitionName )
+                    {
+                    contactCompany = aContactDetailList.at(i);
+                    }
+                }
+            
+            //QString company = QString::fromUtf16(aData.Ptr(),aData.Length());
+            if(aFieldString == QContactOrganization::FieldName)
+                {
+                if(contactCompany.name().isEmpty())
+                    {
+                    contactCompany.setName( aData );
+                    }
+                }
+            if(aFieldString == QContactOrganization::FieldTitle)
+                {
+                if(contactCompany.title().isEmpty())
+                    {
+                    contactCompany.setTitle( aData );
+                    }
+                }
+            if(aFieldString == QContactOrganization::FieldDepartment)
+                {
+                QStringList depList = contactCompany.department();
+                depList.append(aData);
+                contactCompany.setDepartment(depList);
+                }
+            if(aFieldString == QContactOrganization::FieldAssistantName)
+                {
+                if(contactCompany.assistantName().isEmpty())
+                    {
+                    contactCompany.setAssistantName( aData );
+                    }
+                }
+            return contactCompany;
+            }
+        else if( aDetail == QContactAddress::DefinitionName )           //--Contact Address-----------------------------
+                {
+                QContactAddress contactAddress;
+                
+                for(int i = 0 ; i < aContactDetailList.count() ; i++ ) //go through all contact details to check if there is already Contact Name to set other details
+                    {
+                    if(aContactDetailList.at(i).definitionName() == QContactAddress::DefinitionName && aContactDetailList.at(i).value(QContactDetail::FieldContext) == aFieldContext )
+                        {
+                        contactAddress = aContactDetailList.at(i);
+                        }
+                    }
+                if( !aFieldContext.isEmpty() )
+                    {
+					contactAddress.setContexts( aFieldContext );
+                    }
+                //QString address = QString::fromUtf16(aData.Ptr(),aData.Length());
+                if(aFieldString == QContactAddress::FieldStreet )
+                    {
+                    if( contactAddress.street().isEmpty() )
+                        {
+                        contactAddress.setStreet( aData );
+                        }
+                    }
+                else if(aFieldString == QContactAddress::FieldLocality )
+                    {
+                    if( contactAddress.locality().isEmpty() )
+                        {
+                        contactAddress.setLocality( aData );
+                        }
+                    }
+                else if(aFieldString == QContactAddress::FieldRegion )
+                    {
+                    if( contactAddress.region().isEmpty() )
+                        {
+                        contactAddress.setRegion( aData );
+                        }
+                    }
+                else if(aFieldString == QContactAddress::FieldPostcode )
+                    {
+                    if( contactAddress.postcode().isEmpty() )
+                        {
+                        contactAddress.setPostcode( aData );
+                        }
+                    }
+                else if(aFieldString == QContactAddress::FieldCountry )
+                    {
+                    if( contactAddress.country().isEmpty() )
+                        {
+                        contactAddress.setCountry( aData );
+                        }
+                    }
+                else 
+                    {
+                    return contactDetail;
+                    }
+                return contactAddress;
+                }
+        else if( aDetail == QContactNote::DefinitionName )          //--Contact Note-----------------------------
+                    {
+                    QContactNote contactNote;
+                    //QString note = QString::fromUtf16(aData.Ptr(),aData.Length());
+                    contactNote.setNote(aData);
+                    return contactNote;
+                    }
+        else if( aDetail == QContactFamily::DefinitionName )            //--Contact Family-----------------------------
+                    {
+                    QContactFamily contactFamily;
+                    
+                    for(int i = 0 ; i < aContactDetailList.count() ; i++ ) //go through all contact details to check if there is already Contact Name to set other details
+                        {
+                        if(aContactDetailList.at(i).definitionName() == QContactFamily::DefinitionName && aContactDetailList.at(i).value(QContactDetail::FieldContext) == aFieldContext )
+                            {
+                            contactFamily = aContactDetailList.at(i);
+                            }
+                        }
+                   
+                    //QString familyData = QString::fromUtf16(aData.Ptr(),aData.Length());
+                    if(aFieldString == QContactFamily::FieldSpouse )
+                        {
+                        if( contactFamily.spouse().isEmpty() )
+                            {
+                            contactFamily.setSpouse( aData );
+                            }
+                        }
+                    if(aFieldString == QContactFamily::FieldChildren )
+                        {
+                            QStringList children = contactFamily.children();
+                            children.append( aData );
+                            contactFamily.setChildren( children );
+                        }
+                    
+                    return contactFamily;
+                    }
+        
+        if( aDetail == QContactAvatar::DefinitionName)                      //--Contact Picture-----------------------------
+                {
+                QContactAvatar contactAvatar;
+                /*TBuf<KMaxFileName> srcPath;
+                aEngine->RandomPictureFileL(srcPath);
+                TBuf<KMaxFileName> destPath(KTempPath);
+                            
+                if(!BaflUtils::FolderExists( fs, destPath ))
+                    {
+                    BaflUtils::EnsurePathExistsL( fs, destPath );
+                    }
+                
+                TInt err=BaflUtils::CopyFile( fs, srcPath, destPath );
+
+                TParse temp;
+                temp.Set( srcPath,NULL,NULL );
+                destPath.Append(temp.NameAndExt());
+                
+                QString avatarFile = QString::fromUtf16( destPath.Ptr(),destPath.Length() );
+                */
+                QUrl imageUrl;
+                imageUrl.setUrl(aData);
+                contactAvatar.setImageUrl(imageUrl);
+
+                return contactAvatar;
+                }
+        if( aDetail == QContactAnniversary::DefinitionName) //--Anniversary------------------------------
+                {
+                QContactAnniversary contactAnniversary;
+                aData.replace(QChar('/'), QChar('-'));
+       		    QDate date = QDate::fromString(aData, "dd-MM-yyyy");
+                //TTime datetime = aEngine->RandomDate( CCreatorEngine::EDateFuture );
+                //date.setDate( datetime.DateTime().Year(),(int) (datetime.DateTime().Month()+1), datetime.DateTime().Day() );
+                contactAnniversary.setOriginalDate( date );
+                return contactAnniversary;
+                }
+        if( aDetail == QContactEmailAddress::DefinitionName) //--Email------------------------------------
+            {
+            QContactEmailAddress email;
+            //QString emailAddr = QString::fromUtf16(aData.Ptr(),aData.Length());
+            if( !aFieldContext.isEmpty() )
+            	{
+				email.setContexts( aFieldContext );
+            	}
+            email.setEmailAddress( aData );
+            return email;
+            }
+        if( aDetail == QContactUrl::DefinitionName )    //--Url-------------------------------------------
+            {
+            QContactUrl url;
+            //QString urlStr = QString::fromUtf16(aData.Ptr(),aData.Length());
+            if( !aFieldContext.isEmpty() )
+                {
+				url.setContexts( aFieldContext );
+                }
+            url.setUrl(aData);
+            return url;
+            }
+        if( aDetail == QContactBirthday::DefinitionName )   //--Birthday-----------------------------------
+            {
+            QContactBirthday birthday;
+            QDate date = QDate::fromString(aData);
+            //TTime datetime = aEngine->RandomDate( CCreatorEngine::EDatePast );
+            //date.setDate( datetime.DateTime().Year(),(int) (datetime.DateTime().Month()+1), datetime.DateTime().Day() );
+            birthday.setDate( date );
+            return birthday;
+            }
+                
+        return contactDetail;
+    }
+
+void CCreatorPhonebookWrapper::AddFieldToList( QList<QContactDetail>& aDetailList, QContactDetail aDetail)
+    {
+     bool replace = false;
+     for(int i = 0 ; i< aDetailList.count() ; i++) //go through
+          {
+           if( !aDetail.isEmpty() && aDetail.definitionName() == aDetailList.at(i).definitionName() 
+        		   && aDetail.definitionName() != QContactPhoneNumber::DefinitionName 
+        		   && aDetail.definitionName() != QContactEmailAddress::DefinitionName
+        		   && aDetail.definitionName() != QContactUrl::DefinitionName )
+               {
+               QString context = aDetail.value(QContactDetail::FieldContext);
+               bool isContextEmpty = context.isEmpty();
+               if( isContextEmpty ||  ( aDetail.value(QContactDetail::FieldContext) == aDetailList.at(i).value(QContactDetail::FieldContext)) )
+                   {
+                   //replace
+                   aDetailList.replace(i,aDetail);
+                   replace = true;
+                   }
+               }
+          }
+          if(!replace)
+             {
+             if(!aDetail.isEmpty())
+                {
+                aDetailList.append(aDetail);
+                }
+             }
+      
+    }
+
+TUint32 CCreatorPhonebookWrapper::CreateContactEntryL(const TCreatorContactFields& aFields)
+    {
+	QList<QContactDetail> list = CreateContactDetailsFromParameters( aFields );
+	
+	return iPhonebookAPI->saveContact( list );
+    }
+
+
+//----------------------------------------------------------------------------
+
+
+
+//----------------------------------------------------------------------------
+
+void CCreatorPhonebookWrapper::DeleteAllL()
+    {
+	iPhonebookAPI->deleteAllContacts();
+    }
+
+//----------------------------------------------------------------------------
+void CCreatorPhonebookWrapper::DeleteAllGroupsL()
+    {
+    LOGSTRING("Creator: CCreatorPhonebookWrapper::DeleteAllGroupsL");
+    
+    iPhonebookAPI->deleteAllContacts( QContactType::TypeGroup );
+
+    }
+
+//----------------------------------------------------------------------------
+void CCreatorPhonebookWrapper::DeleteContactsL( RArray<TUint32>& aContactsToDelete, TUid aStoreUid )
+    {
+	QList<QContactLocalId> contacts; 
+	for( TInt i = 0; i < aContactsToDelete.Count(); ++i )
+	    {
+	    QContact contact = iPhonebookAPI->contact( QContactLocalId( aContactsToDelete[i] ) );
+	    if( (contact.type() == QContactType::TypeGroup && aStoreUid == KUidDictionaryUidContactGroups ) ||  (contact.type() != QContactType::TypeGroup && aStoreUid != KUidDictionaryUidContactGroups) )
+            {
+            contacts.append( QContactLocalId( aContactsToDelete[i] ) );
+            }
+	    }
+    QMap<int, QContactManager::Error> errorMap;
+	iPhonebookAPI->deleteContacts( contacts );
+    }
+
+//----------------------------------------------------------------------------
+TBool CCreatorPhonebookWrapper::HasOtherThanGroupsL()
+    {
+    LOGSTRING("Creator: CCreatorPhonebookWrapper::HasOtherThanGroupsL");
+    TBool result( EFalse );
+    return result;
+    }
+
+
+TUint32 CCreatorPhonebookWrapper::CreateGroupEntryL( HBufC* aGroupName )
+    {
+	TUint32 id = 0;
+	QString groupName = QString::fromUtf16( aGroupName->Des().Ptr(), aGroupName->Length() );
+	
+	id = iPhonebookAPI->createGroup( groupName );
+	
+	return id; 
+    }
+TInt CCreatorPhonebookWrapper::NumberOfContacts()
+	{
+	//return all stored contacts
+	return iPhonebookAPI->numberOfContacts();
+	}
+
+TInt CCreatorPhonebookWrapper::AddContactToGroup( TUint32 aGroupId, TUint32 aContact )
+	{
+	QContactLocalId group = QContactLocalId(aGroupId);
+	QContactLocalId contact = QContactLocalId(aContact);
+	
+	TInt ret = iPhonebookAPI->addContactToGroup(group, contact);
+
+	return ret;
+	}
+TInt CCreatorPhonebookWrapper::AddToGroup( TUint32 aGroupId, TInt aAmount )
+	{
+	QContactLocalId group = QContactLocalId(aGroupId);
+	TInt ret = iPhonebookAPI->addToGroup( group, (int) aAmount );
+	return ret;
+	}
+
+
+//----------------------------------------------------------------------------
+
+TInt CCreatorPhonebookWrapper::CreateSubscribedContactEntryL()
+    {
+    LOGSTRING("Creator: CCreatorPhonebookWrapper::CreateSubscribedContactEntryL");
+
+    return KErrNotSupported;
+    }
+
--- a/creator/engine/src/creator_scriptelementfactory.cpp	Fri Jun 11 16:29:34 2010 +0100
+++ b/creator/engine/src/creator_scriptelementfactory.cpp	Thu Jul 22 16:33:59 2010 +0100
@@ -23,13 +23,13 @@
 #include "creator_calendarelement.h"
 #include "creator_messageelement.h"
 #include "creator_fileelement.h"
-#include "creator_browserelement.h"
+//#include "creator_browserelement.h"
 #include "creator_logelement.h"
 //#include "creator_noteelement.h"
 //#include "creator_impselement.h"
 #include "creator_landmarkelement.h"
 #include "creator_mailboxelement.h"
-#include "creator_connectionmethodelement.h"
+//#include "creator_connectionmethodelement.h"
 
 CCreatorScriptElement* TCreatorScriptElementFactory::CreateElementL(CCreatorEngine* aEngine, const TDesC& aElementName, const TDesC& aContext )
     {   
@@ -73,6 +73,7 @@
         {
         return CCreatorFileElement::NewL(aEngine, aElementName, aContext);
         }
+    /*
     else if( aElementName == creatorbrowser::KBookmark ||
             aElementName == creatorbrowser::KBookmarkFolder ||
             aElementName == creatorbrowser::KSavedPage ||
@@ -80,6 +81,7 @@
         {
         return CCreatorBrowserElement::NewL(aEngine, aElementName, aContext);
         }
+    */
     else if( aElementName == creatorlog::KLog )
         {
         return CCreatorLogElement::NewL(aEngine, aElementName, aContext);
@@ -106,10 +108,12 @@
         {
         return CCreatorMailboxElement::NewL(aEngine, aElementName, aContext);
         }
+/*    
     else if( aElementName == creatorconnectionmethod::KCm )
     	{
     	return CCreatorConnectionMethodElement::NewL(aEngine, aElementName, aContext);
     	}
+*/    	
     else
         {
         return CCreatorScriptElement::NewL(aEngine, aElementName, aContext);
--- a/creator/engine/src/creator_scriptentry.cpp	Fri Jun 11 16:29:34 2010 +0100
+++ b/creator/engine/src/creator_scriptentry.cpp	Thu Jul 22 16:33:59 2010 +0100
@@ -18,13 +18,14 @@
 
 
 #include <aknlists.h> 
-#include <aknsskininstance.h>
+#include <AknsSkinInstance.h>
 #include <data_caging_path_literals.hrh>
 
 #include "engine.h"
 #include "enginewrapper.h"
 #include "creator_traces.h"
 #include "creator_factory.h"
+#include "creator_scriptentry.h"
 
 
 
@@ -68,24 +69,73 @@
 	{
     LOGSTRING("Creator: CCommandParser::~CCommandParser");
 
-    if (iSearchArray)
+    if (iSearchArray){
         delete iSearchArray;
+        iSearchArray = NULL;
+    }
 
     if (iReadBuf)
         delete iReadBuf;
 	}
 
+// ---------------------------------------------------------------------------
+
+void CCommandParser::QueryDialogClosedL(TBool aPositiveAction, TInt aUserData)
+    {
+    User::LeaveIfNull(iSearchArray);
+    
+    if( aUserData == EGetingScript )
+        {
+        if(aPositiveAction)
+            {
+            iObserver->ScriptChosenL( ETrue, iSearchArray->MdcaPoint(iSelectedItem) );
+            }
+        else
+            {
+            iObserver->ScriptChosenL( EFalse );
+            }
+        }
+    else if( aUserData == EGetingRandomDataFile && aPositiveAction && iSearchArray->Count() )
+        {
+        if(aPositiveAction)
+            {
+            TFileName fileName;
+            if (iSelectedItem == (iSearchArray->Count() - 1))
+                {
+                // "default" (resource file) selected
+                fileName.Copy(KNullDesC);
+                }
+            else
+                {
+                // xml file selected
+                fileName.Copy(iSearchArray->MdcaPoint(iSelectedItem));
+                }
+            iObserver->RandomDataFileChosenL( ETrue, fileName );
+            }
+        else
+            {
+            iObserver->RandomDataFileChosenL( EFalse );
+            }
+        }
+    }
 
 // ---------------------------------------------------------------------------
 //#if(!defined __SERIES60_30__ && !defined __SERIES60_31__)
 void CCommandParser::OpenScriptL() {}
-TBool CCommandParser::OpenScriptL(RFile& aScriptFile)
+TBool CCommandParser::OpenScriptL(MCommandParserObserver* aObserver)
     {    
     LOGSTRING("Creator: CCommandParser::OpenScriptL");
+    
+    User::LeaveIfNull( aObserver );
+    iObserver = aObserver;
+    iSelectedItem = 0;
+    
     TBool ret = EFalse;
 
     // init the search array
-    iSearchArray = new(ELeave) CDesCArrayFlat(500);
+    delete iSearchArray;
+    iSearchArray = NULL;
+    iSearchArray = new(ELeave) CDesCArrayFlat(20);
 
     // wait dialog
 	// TODO
@@ -154,70 +204,18 @@
                 fileNameArray->AppendL(filename.Name());
                 }
             }
-        CleanupStack::Pop(fileNameArray);
 
-
-		// create a popup list
-		int index = 0;
-		TBool result = iEngine->GetEngineWrapper()->PopupListDialog(_L("Select script"), fileNameArray, index);
-        //CAknSinglePopupMenuStyleListBox* listBox = new(ELeave) CAknSinglePopupMenuStyleListBox;
-        //CleanupStack::PushL(listBox);
-		
-        //CAknPopupList* popupList = CAknPopupList::NewL( listBox, R_AVKON_SOFTKEYS_SELECT_CANCEL, AknPopupLayouts::EMenuWindow );
-        //CleanupStack::PushL(popupList);
-        //popupList->SetTitleL(_L("Select script"));
-        //listBox->ConstructL( popupList, EAknListBoxSelectionList|EAknListBoxLoopScrolling );
-        //listBox->CreateScrollBarFrameL( ETrue );
-        //listBox->ScrollBarFrame()->SetScrollBarVisibilityL( CEikScrollBarFrame::EOff, CEikScrollBarFrame::EAuto);
-        //listBox->Model()->SetItemTextArray( fileNameArray );
-        //listBox->Model()->SetOwnershipType( ELbmOwnsItemArray );  // !!!
-        //listBox->HandleItemAdditionL();
-
-
-        // define MMC icon 
-        //MAknsSkinInstance* skin = AknsUtils::SkinInstance();
-        //_LIT( KFLDMemoryCardUiBitmapFile, "z:aknmemorycardui.mbm" );
-        //CAknIconArray* iconArray = new( ELeave ) CAknIconArray( 1 );
-        //listBox->ItemDrawer()->ColumnData()->SetIconArray( iconArray );
-
-        //TParse* fp = new(ELeave) TParse();
-        //fp->Set(KFLDMemoryCardUiBitmapFile, &KDC_APP_BITMAP_DIR, NULL);
-        //TFileName resourceFileName( fp->FullName() );
-        //delete fp;
-
-        //CGulIcon* icon = AknsUtils::CreateGulIconL( skin, KAknsIIDQgnIndiMmcAdd,
-        //    resourceFileName,
-        //    EMbmAknmemorycarduiQgn_indi_mmc_add,
-        //    EMbmAknmemorycarduiQgn_indi_mmc_add_mask );
-        //CleanupStack::PushL( icon );
-        //iconArray->AppendL( icon );
-        //CleanupStack::Pop( icon );
-
-        // execute dialog
-        //TBool result; // = popupList->ExecuteLD();
-        //CleanupStack::Pop();  // popupList
-
-        if ( result ) 
-            {
-            // open the file for reading
-            //RFile file;
-			TRAPD(err, aScriptFile.Open(CEikonEnv::Static()->FsSession(), iSearchArray->MdcaPoint(index), EFileRead));
-            if( err != KErrNone)
-                {
-                aScriptFile.Close();
-                User::Leave(err);
-                }
-            ret = ETrue;
-            }
-        //CleanupStack::PopAndDestroy();  //listBox
+        ret = iEngine->GetEngineWrapper()->PopupListDialog(_L("Select script"), fileNameArray, &iSelectedItem, this, EGetingScript);
+		CleanupStack::PopAndDestroy(fileNameArray);
         }
     else  // no scripts found from the search paths
         {
         iEngine->GetEngineWrapper()->ShowNote(_L("No scripts found"));
+        delete iSearchArray;
+        iSearchArray = NULL;
         }
 
-    delete iSearchArray;
-    iSearchArray = NULL;
+    
     return ret;
     }
 /*
@@ -391,11 +389,15 @@
 #endif
 */
 
-TBool CCommandParser::GetRandomDataFilenameL(TDes& aFilename)
+TBool CCommandParser::GetRandomDataFilenameL(MCommandParserObserver *aObserver)
     {    
     LOGSTRING("Creator: CCommandParser::GetRandomDataFilenameL");
     TBool ret = EFalse;
 
+    User::LeaveIfNull( aObserver );
+    iObserver = aObserver;
+    iSelectedItem = 0;
+
     // init the search array
     if (iSearchArray)
     	{
@@ -476,72 +478,16 @@
         // add "default" (resource file) to list
         fileNameArray->AppendL(_L("Default"));
 
-        CleanupStack::Pop(fileNameArray);
-
-        // create a popup list
-		int index = 0;
-		TBool result = iEngine->GetEngineWrapper()->PopupListDialog(_L("Select random data file"), fileNameArray, index);
-        /*
-		CAknSinglePopupMenuStyleListBox* listBox = new(ELeave) CAknSinglePopupMenuStyleListBox;
-        CleanupStack::PushL(listBox);
-        CAknPopupList* popupList = CAknPopupList::NewL( listBox, R_AVKON_SOFTKEYS_SELECT_CANCEL, AknPopupLayouts::EMenuWindow );
-        CleanupStack::PushL(popupList);
-        popupList->SetTitleL(_L("Select random data file"));
-        listBox->ConstructL( popupList, EAknListBoxSelectionList|EAknListBoxLoopScrolling );
-        listBox->CreateScrollBarFrameL( ETrue );
-        listBox->ScrollBarFrame()->SetScrollBarVisibilityL( CEikScrollBarFrame::EOff, CEikScrollBarFrame::EAuto);
-        listBox->Model()->SetItemTextArray( fileNameArray );
-        listBox->Model()->SetOwnershipType( ELbmOwnsItemArray );  // !!!
-        listBox->HandleItemAdditionL();
-
-
-        // define MMC icon 
-        MAknsSkinInstance* skin = AknsUtils::SkinInstance();
-        _LIT( KFLDMemoryCardUiBitmapFile, "z:aknmemorycardui.mbm" );
-        CAknIconArray* iconArray = new( ELeave ) CAknIconArray( 1 );
-        listBox->ItemDrawer()->ColumnData()->SetIconArray( iconArray );
-
-        TParse* fp = new(ELeave) TParse();
-        fp->Set(KFLDMemoryCardUiBitmapFile, &KDC_APP_BITMAP_DIR, NULL);
-        TFileName resourceFileName( fp->FullName() );
-        delete fp;
-
-        CGulIcon* icon = AknsUtils::CreateGulIconL( skin, KAknsIIDQgnIndiMmcAdd,
-            resourceFileName,
-            EMbmAknmemorycarduiQgn_indi_mmc_add,
-            EMbmAknmemorycarduiQgn_indi_mmc_add_mask );
-        CleanupStack::PushL( icon );
-        iconArray->AppendL( icon );
-        CleanupStack::Pop( icon );
-
-
-        // execute dialog
-        TBool result = popupList->ExecuteLD();
-        CleanupStack::Pop();  // popupList
-		*/
-        if ( result ) 
-            {
-            if (index == (fileNameArray->Count() - 1))
-            	{
-            	// "default" (resource file) selected
-            	aFilename.Copy(KNullDesC);
-            	}
-            else
-            	{
-            	// xml file selected
-            	aFilename.Copy(iSearchArray->MdcaPoint(index));
-            	}
-            ret = ETrue;
-            }
-        // CleanupStack::PopAndDestroy();  //listBox
+		ret = iEngine->GetEngineWrapper()->PopupListDialog(_L("Select random data file"), fileNameArray, &iSelectedItem, this, EGetingRandomDataFile);
+        CleanupStack::PopAndDestroy(fileNameArray);
         }
     else  // no random data files found from the search paths
         {
         iEngine->GetEngineWrapper()->ShowNote(_L("No random data files found"));
+        delete iSearchArray;
+        iSearchArray = NULL;
         }
 
-    delete iSearchArray;
-    iSearchArray = NULL;
     return ret;
     }
 
--- a/creator/engine/src/creator_scriptparser.cpp	Fri Jun 11 16:29:34 2010 +0100
+++ b/creator/engine/src/creator_scriptparser.cpp	Thu Jul 22 16:33:59 2010 +0100
@@ -149,6 +149,7 @@
     {
     LOGSTRING2("Creator: CCreatorScriptParser::OnEndDocumentL (Error code: %d)", aErrorCode);
     User::LeaveIfError(aErrorCode);
+    iEngine->SortCommands();
     }
 
 void CCreatorScriptParser::OnStartPrefixMappingL(   const RString& /*aPrefix*/, 
--- a/creator/engine/src/creator_virtualphonebook.cpp	Fri Jun 11 16:29:34 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1790 +0,0 @@
-/*
-* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-*
-*/
-
-
-
-#include "engine.h"
-#include "enginewrapper.h"
-#include "creator_virtualphonebook.h" 
-#include "creator_traces.h"
-#include "creator_contactsetcache.h"
-
-#include <cvpbkcontactstoreuriarray.h>
-#include <vpbkcontactstoreuris.h>
-#include <tvpbkcontactstoreuriptr.h>
-#include <mvpbkcontactgroup.h>
-#include <mvpbkcontactstore.h>
-#include <cvpbkcontactmanager.h>
-#include <mvpbkcontactstorelist.h>
-#include <mvpbkcontactstorelistobserver.h>
-#include <mvpbkcontactoperationbase.h>
-#include <mvpbkstorecontact.h>
-#include <mvpbkcontactstoreproperties.h>
-#include <mvpbkcontactfielddata.h>
-#include <mvpbkfieldtype.h>
-#include <mvpbkcontactfieldtextdata.h>
-#include <mvpbkcontactfieldbinarydata.h>
-#include <mvpbkcontactfielddatetimedata.h>
-#include <CVPbkContactViewDefinition.h>
-#include <mvpbkcontactview.h>
-
-#include <vpbkcontactview.hrh>
-#include <vpbkeng.rsg>
-
-typedef struct {
-TInt iFieldCode;
-TInt iRandomType;
-} FieldInfo;
-static const TInt RND_TYPE_UNDEF = -99;
-FieldInfo CreatorVPbkMiscTextFields[] = {        
-        {R_VPBK_FIELD_TYPE_FIRSTNAME, (TInt) CCreatorEngine::EFirstName},
-        {R_VPBK_FIELD_TYPE_FIRSTNAMEREADING, (TInt) CCreatorEngine::EFirstName},
-        {R_VPBK_FIELD_TYPE_LASTNAME, (TInt) CCreatorEngine::ESurname},
-        {R_VPBK_FIELD_TYPE_LASTNAMEREADING, (TInt) CCreatorEngine::ESurname},
-        {R_VPBK_FIELD_TYPE_COMPANYNAME, (TInt) CCreatorEngine::ECompany},
-        {R_VPBK_FIELD_TYPE_JOBTITLE, (TInt) CCreatorEngine::EJobTitle},
-        {R_VPBK_FIELD_TYPE_PREFIX, (TInt) CCreatorEngine::EPrefix},
-        {R_VPBK_FIELD_TYPE_SUFFIX, (TInt) CCreatorEngine::ESuffix},
-        {R_VPBK_FIELD_TYPE_SECONDNAME, (TInt) CCreatorEngine::EFirstName},
-        {R_VPBK_FIELD_TYPE_ADDRLABELGEN, (TInt) CCreatorEngine::EAddress},
-        {R_VPBK_FIELD_TYPE_ADDRPOGEN, (TInt) CCreatorEngine::EPobox},
-        {R_VPBK_FIELD_TYPE_ADDREXTGEN, (TInt) CCreatorEngine::EAddress},
-        {R_VPBK_FIELD_TYPE_ADDRSTREETGEN, (TInt) CCreatorEngine::EAddress},
-        {R_VPBK_FIELD_TYPE_ADDRLOCALGEN, (TInt) CCreatorEngine::ECity},
-        {R_VPBK_FIELD_TYPE_ADDRREGIONGEN, (TInt) CCreatorEngine::EState},
-        {R_VPBK_FIELD_TYPE_ADDRPOSTCODEGEN, (TInt) CCreatorEngine::EPostcode},
-        {R_VPBK_FIELD_TYPE_ADDRCOUNTRYGEN, (TInt) CCreatorEngine::ECountry},
-        {R_VPBK_FIELD_TYPE_ADDRLABELHOME, (TInt) CCreatorEngine::EAddress},
-        {R_VPBK_FIELD_TYPE_ADDRPOHOME, (TInt) CCreatorEngine::EPobox},
-        {R_VPBK_FIELD_TYPE_ADDREXTHOME, (TInt) CCreatorEngine::EAddress},
-        {R_VPBK_FIELD_TYPE_ADDRSTREETHOME, (TInt) CCreatorEngine::EAddress},
-        {R_VPBK_FIELD_TYPE_ADDRLOCALHOME, (TInt) CCreatorEngine::ECity},
-        {R_VPBK_FIELD_TYPE_ADDRREGIONHOME, (TInt) CCreatorEngine::EState},
-        {R_VPBK_FIELD_TYPE_ADDRPOSTCODEHOME, (TInt) CCreatorEngine::EPostcode},
-        {R_VPBK_FIELD_TYPE_ADDRCOUNTRYHOME, (TInt) CCreatorEngine::ECountry},
-        {R_VPBK_FIELD_TYPE_ADDRLABELWORK, (TInt) CCreatorEngine::EAddress},
-        {R_VPBK_FIELD_TYPE_ADDRPOWORK, (TInt) CCreatorEngine::EPobox},
-        {R_VPBK_FIELD_TYPE_ADDREXTWORK, (TInt) CCreatorEngine::EAddress},
-        {R_VPBK_FIELD_TYPE_ADDRSTREETWORK, (TInt) CCreatorEngine::EAddress},
-        {R_VPBK_FIELD_TYPE_ADDRLOCALWORK, (TInt) CCreatorEngine::ECity},
-        {R_VPBK_FIELD_TYPE_ADDRREGIONWORK, (TInt) CCreatorEngine::EState},
-        {R_VPBK_FIELD_TYPE_ADDRPOSTCODEWORK, (TInt) CCreatorEngine::EPostcode},
-        {R_VPBK_FIELD_TYPE_ADDRCOUNTRYWORK, (TInt) CCreatorEngine::ECountry},
-        {R_VPBK_FIELD_TYPE_POC, (TInt) CCreatorEngine::EPhoneNumber},
-        {R_VPBK_FIELD_TYPE_SWIS, (TInt) CCreatorEngine::EPhoneNumber},
-        {R_VPBK_FIELD_TYPE_SIP, (TInt) CCreatorEngine::EPhoneNumber},
-        {R_VPBK_FIELD_TYPE_DTMFSTRING, (TInt) CCreatorEngine::EFirstName},
-        {R_VPBK_FIELD_TYPE_NOTE,(TInt)  CCreatorEngine::EMemoText},
-        {R_VPBK_FIELD_TYPE_MIDDLENAME, (TInt) CCreatorEngine::EFirstName},
-        {R_VPBK_FIELD_TYPE_DEPARTMENT, (TInt) CCreatorEngine::ECompany},
-        {R_VPBK_FIELD_TYPE_ASSTNAME, (TInt) CCreatorEngine::EFirstName},
-        {R_VPBK_FIELD_TYPE_SPOUSE, (TInt) CCreatorEngine::EFirstName},
-        {R_VPBK_FIELD_TYPE_CHILDREN, (TInt) CCreatorEngine::EFirstName},
-        {R_VPBK_FIELD_TYPE_SYNCCLASS, RND_TYPE_UNDEF},
-        {R_VPBK_FIELD_TYPE_LOCPRIVACY, RND_TYPE_UNDEF},
-        {R_VPBK_FIELD_TYPE_GENLABEL, (TInt) CCreatorEngine::EFirstName},
-        {R_VPBK_FIELD_TYPE_WVADDRESS, (TInt) CCreatorEngine::EPhoneNumber},
-        {R_VPBK_FIELD_TYPE_RINGTONE, RND_TYPE_UNDEF},
-        {R_VPBK_FIELD_TYPE_THUMBNAILPIC, RND_TYPE_UNDEF},
-        {R_VPBK_FIELD_TYPE_CALLEROBJTEXT, (TInt) CCreatorEngine::EFirstName}
-        };
-                    
-TInt CreatorVPbkBinaryFields[] = {
-        R_VPBK_FIELD_TYPE_CALLEROBJIMG//,
-        //R_VPBK_FIELD_TYPE_THUMBNAILPATH
-        };
-
-TInt CreatorVPbkDateTimeFields[] = {
-        R_VPBK_FIELD_TYPE_ANNIVERSARY
-        };
-
-//----------------------------------------------------------------------------
-TInt CreatorVPbkPhoneNumberFields[] =
-    {
-    R_VPBK_FIELD_TYPE_LANDPHONEGEN,
-    R_VPBK_FIELD_TYPE_LANDPHONEHOME,
-    R_VPBK_FIELD_TYPE_LANDPHONEWORK,                        
-    R_VPBK_FIELD_TYPE_MOBILEPHONEGEN,
-    R_VPBK_FIELD_TYPE_MOBILEPHONEHOME,
-    R_VPBK_FIELD_TYPE_MOBILEPHONEWORK,
-    R_VPBK_FIELD_TYPE_FAXNUMBERGEN,
-    R_VPBK_FIELD_TYPE_FAXNUMBERHOME,
-    R_VPBK_FIELD_TYPE_FAXNUMBERWORK,
-    R_VPBK_FIELD_TYPE_PAGERNUMBER,           
-    R_VPBK_FIELD_TYPE_VIDEONUMBERGEN,
-    R_VPBK_FIELD_TYPE_VIDEONUMBERHOME,
-    R_VPBK_FIELD_TYPE_VIDEONUMBERWORK,
-    R_VPBK_FIELD_TYPE_VOIPGEN,
-    R_VPBK_FIELD_TYPE_VOIPHOME,
-    R_VPBK_FIELD_TYPE_VOIPWORK,
-    R_VPBK_FIELD_TYPE_ASSTPHONE,
-    R_VPBK_FIELD_TYPE_CARPHONE
-    };
-
-TInt CreatorVPbkUrlFields[] =
-    {
-    R_VPBK_FIELD_TYPE_URLGEN,
-    R_VPBK_FIELD_TYPE_URLHOME,
-    R_VPBK_FIELD_TYPE_URLWORK
-    };
-
-TInt CreatorVPbkEmailFields[] =
-    {
-    R_VPBK_FIELD_TYPE_EMAILGEN,
-    R_VPBK_FIELD_TYPE_EMAILHOME,
-    R_VPBK_FIELD_TYPE_EMAILWORK
-    };
-
-//----------------------------------------------------------------------------
-
-CVirtualPhonebookParameters::CVirtualPhonebookParameters()
-    {
-    LOGSTRING("Creator: CVirtualPhonebookParameters::CVirtualPhonebookParameters");
-    iGroupName = HBufC::New(KPhonebookFieldLength);  
-    }
-
-CVirtualPhonebookParameters::~CVirtualPhonebookParameters()
-    {
-    LOGSTRING("Creator: CVirtualPhonebookParameters::~CVirtualPhonebookParameters");
-
-    delete iGroupName;   
-    iContactFields.ResetAndDestroy();
-    iContactFields.Close();
-    iLinkIds.Reset();
-    iLinkIds.Close();
-    }
-
-void CVirtualPhonebookParameters::ParseL(CCommandParser* /*parser*/, TParseParams /*aCase = 0*/)
-	{
-	}
-
-TInt CVirtualPhonebookParameters::ScriptLinkId() const
-    {
-    return iLinkId;
-    }
-
-void CVirtualPhonebookParameters::SetScriptLinkId(TInt aLinkId)
-    {
-    iLinkId = aLinkId;
-    }
-
-//----------------------------------------------------------------------------
-
-CCreatorVirtualPhonebook* CCreatorVirtualPhonebook::NewL(CCreatorEngine* aEngine)
-    {
-    CCreatorVirtualPhonebook* self = CCreatorVirtualPhonebook::NewLC(aEngine);
-    CleanupStack::Pop(self);
-    return self;
-    }
-
-CCreatorVirtualPhonebook* CCreatorVirtualPhonebook::NewLC(CCreatorEngine* aEngine)
-    {
-    CCreatorVirtualPhonebook* self = new (ELeave) CCreatorVirtualPhonebook;
-    CleanupStack::PushL(self);
-    self->ConstructL(aEngine);
-    return self;
-    }
-
-CCreatorVirtualPhonebook::CCreatorVirtualPhonebook()
-    {    
-    iAddAllFields = EFalse;
-    }
-
-void CCreatorVirtualPhonebook::ConstructL(CCreatorEngine* aEngine)
-    {
-    LOGSTRING("Creator: CCreatorVirtualPhonebook::ConstructL");
-
-    iContactLinkArray = CVPbkContactLinkArray::NewL();
-    iContactsToDelete = CVPbkContactLinkArray::NewL();
-    iContactGroupsToDelete = CVPbkContactLinkArray::NewL();
-    
-    iEngine = aEngine;
-    SetDefaultParameters();
-    
-    // initialize virtual phonebook
-    CVPbkContactStoreUriArray* uriArray = CVPbkContactStoreUriArray::NewLC();
-    uriArray->AppendL( TVPbkContactStoreUriPtr(VPbkContactStoreUris::DefaultCntDbUri()));
-    iContactManager = CVPbkContactManager::NewL( *uriArray, &CCoeEnv::Static()->FsSession());
-    CleanupStack::PopAndDestroy(uriArray);
-    
-    //When the contact manager is created, the stores is opened
-    MVPbkContactStoreList& storeList = iContactManager->ContactStoresL();
-    
-    iWaiter = CAsyncWaiter::NewL();
-
-    //MVPbkContactStoreListObserver must give as parameter    
-    storeList.OpenAllL(*this);
-    // wait for OpenComplete() callback
-    iWaiter->StartAndWait();
-    
-    _LIT(dbUri, "cntdb://c:contacts.cdb");
-    const TVPbkContactStoreUriPtr uri = TVPbkContactStoreUriPtr(dbUri);
-       
-    iStore = storeList.Find(uri);    
-    iOpCounter = 0;    
-    }
-
-TBool CCreatorVirtualPhonebook::IsActive()
-    {
-    LOGSTRING("Creator: CCreatorVirtualPhonebook::IsActive");
-    return iOperation != NULL;
-    }
-
-void CCreatorVirtualPhonebook::CancelOperation()
-    {
-    LOGSTRING("Creator: CCreatorVirtualPhonebook::CancelOperation");
-    iCancelCbRequested = ETrue;    
-    }
-
-CCreatorVirtualPhonebook::~CCreatorVirtualPhonebook()
-    {
-    LOGSTRING("Creator: CCreatorVirtualPhonebook::~CCreatorVirtualPhonebook");
-    
-    // this is done only once per phonebook operation
-    if ( iContactsToDelete && iContactsToDelete->Count() )
-        {
-        TRAP_IGNORE( StoreLinksForDeleteL( *iContactsToDelete, KUidDictionaryUidContacts ) );
-        }
-    delete iContactsToDelete;
-    if ( iContactGroupsToDelete && iContactGroupsToDelete->Count() )
-        {
-        TRAP_IGNORE( StoreLinksForDeleteL( *iContactGroupsToDelete, KUidDictionaryUidContactGroups ) );
-        }
-    delete iContactGroupsToDelete;
-    
-    iPreviousDeleteLinks.ResetAndDestroy();
-    
-    delete iOperation;
-    
-    TInt err = 0;
-    TRAP(err, CompactPbkDatabaseL( ETrue ));
-
-    if(iContactResults)
-    	{
-    	delete iContactResults;
-    	}
-    
-    delete iContactLinkArray;
-    delete iContactGroupsInStore;
-    
-    if(iContactManager)
-    	{
-    	TRAP(err, iContactManager->ContactStoresL().CloseAll(*this));
-    	delete iContactManager;
-    	}
-    if(iWaiter)
-    	{
-    	delete iWaiter;    
-    	}
-    if (iParameters)
-    	{
-        delete iParameters;
-    	}
-    }
-
-//----------------------------------------------------------------------------
-TBool CCreatorVirtualPhonebook::AskDataFromUserL(TInt aCommand, TInt& aNumberOfEntries)
-    {
-    LOGSTRING("Creator: CCreatorVirtualPhonebook::AskDataFromUserL");
-    TBool ret = CCreatorPhonebookBase::AskDataFromUserL(aCommand, aNumberOfEntries);
-   
-    if(ret && aCommand == ECmdCreatePhoneBookEntryContacts && !iDefaultFieldsSelected)    
-        {
-        iAddAllFields = iEngine->GetEngineWrapper()->YesNoQueryDialog(_L("Add all the other fields to contacts?"));
-        }
-    return ret;
-    }
-
-//----------------------------------------------------------------------------
-void CCreatorVirtualPhonebook::DeleteAllL()
-    {
-    LOGSTRING("Creator: CCreatorVirtualPhonebook::DeleteAllL");
-    
-    // Delete all contacts, not contact groups
-    
-    //get field types
-    const MVPbkFieldTypeList& fieldList = iStore->StoreProperties().SupportedFields();
-        
-    // get all contact links, results will be set to iContactResults
-    MVPbkContactOperationBase* operation = iContactManager->FindL( _L(""), fieldList , *this );
-    if ( operation )
-        {
-        iWaiter->StartAndWait(); //Making asynchronous FindL to synchronous
-        delete operation;
-        }
-    
-    while( iContactResults->Count() && 
-           !iCancelCbRequested &&
-           HasOtherThanGroupsL( iContactResults ) )
-        {
-        // delete all found contacts
-        DeleteContactsL( iContactResults, EFalse );
-        
-        if ( !iCancelCbRequested )
-            {
-            // find next set of contacts to delete
-            MVPbkContactOperationBase* operation = iContactManager->FindL( _L(""), fieldList , *this );
-            if ( operation )
-                {
-                iWaiter->StartAndWait(); //Making asynchronous FindL to synchronous
-                delete operation;
-                }
-            }
-        }
-    
-    if ( iCancelCbRequested && iEngine )
-        {
-        // User cancelled, must callback to finish terminatio sequence
-        iEngine->CancelComplete();
-        }
-    else
-        {
-        // contacts deleted, remove the Creator internal contact registry
-        // (no callback required)
-        CDictionaryFileStore* store = iEngine->FileStoreLC();
-        if ( store )
-            {
-            store->Remove( KUidDictionaryUidContacts );
-            store->CommitL();        
-            }
-        CleanupStack::PopAndDestroy( store );
-        }    
-    }
-
-//----------------------------------------------------------------------------
-void CCreatorVirtualPhonebook::DeleteAllCreatedByCreatorL()
-    {
-    LOGSTRING("Creator: CCreatorVirtualPhonebook::DeleteAllCreatedByCreatorL");
-    DeleteItemsCreatedWithCreatorL( KUidDictionaryUidContacts );
-    }
-
-//----------------------------------------------------------------------------
-void CCreatorVirtualPhonebook::DeleteAllGroupsL()
-    {
-    LOGSTRING("Creator: CCreatorVirtualPhonebook::DeleteAllGroupsL");
-    User::LeaveIfNull( iStore );
-    MVPbkContactLinkArray* groups = iStore->ContactGroupsLC();
-    DeleteContactsL( groups, ETrue );
-    CleanupStack::PopAndDestroy(); // cannot use groups as parameter
-    }
-
-//----------------------------------------------------------------------------
-void CCreatorVirtualPhonebook::DeleteAllGroupsCreatedByCreatorL()
-    {
-    LOGSTRING("Creator: CCreatorVirtualPhonebook::DeleteAllGroupsCreatedByCreatorL");
-    DeleteItemsCreatedWithCreatorL( KUidDictionaryUidContactGroups );
-    }
-
-//----------------------------------------------------------------------------
-void CCreatorVirtualPhonebook::DeleteContactsL( MVPbkContactLinkArray* aContacts, TBool aGroup )
-    {
-    LOGSTRING("Creator: CCreatorVirtualPhonebook::DeleteContactsL");
-    const MVPbkContactLink* link( NULL );
-    delete iOperation;
-    iOperation = NULL;
-    TInt i(0);
-    while ( aContacts && i < aContacts->Count() && !iCancelCbRequested )
-        {
-        link = &aContacts->At( i++ );
-        if ( aGroup == IsContactGroupL( *link ) )
-            {
-            iOperation = iContactManager->RetrieveContactL( *link, *this );
-            // see VPbkSingleContactOperationComplete
-            if ( iOperation )
-                {
-                iWaiter->StartAndWait();
-                delete iOperation;
-                iOperation = NULL;
-                }            
-            }
-        link = NULL;
-        }
-    }
-
-//----------------------------------------------------------------------------
-void CCreatorVirtualPhonebook::DeleteItemsCreatedWithCreatorL( TUid aStoreUid )
-    {
-    LOGSTRING("Creator: CCreatorVirtualPhonebook::DeleteItemsCreatedWithCreatorL");
-    __ASSERT_ALWAYS( aStoreUid == KUidDictionaryUidContacts || 
-                     aStoreUid == KUidDictionaryUidContactGroups,
-                     User::Panic( _L("CCreatorVPb"), KErrArgument ) );
-    CDictionaryFileStore* store = iEngine->FileStoreLC();
-    User::LeaveIfNull( store );
-    if ( store->IsPresentL( aStoreUid ) )
-        {
-        TRAP_IGNORE( DoDeleteItemsCreatedWithCreatorL( aStoreUid, store ) );
-
-        if ( iCancelCbRequested && iEngine )
-            {
-            iEngine->CancelComplete();
-            }
-        else
-            {
-            // contacts deleted, remove the Creator internal contact registry
-            store->Remove( aStoreUid );
-            store->CommitL();            
-            }
-        }
-    CleanupStack::PopAndDestroy( store );
-    }
-
-//----------------------------------------------------------------------------
-void CCreatorVirtualPhonebook::DoDeleteItemsCreatedWithCreatorL( TUid aStoreUid, CDictionaryFileStore* aStore )
-    {
-    LOGSTRING("Creator: CCreatorVirtualPhonebook::DoDeleteItemsCreatedWithCreatorL");
-    RDictionaryReadStream in;
-    in.OpenLC( *aStore, aStoreUid );
-    MVPbkContactLinkArray* contactsToDelete = NULL;
-    // fetch contact links from store
-    while ( ( contactsToDelete = iContactManager->CreateLinksLC( in ) ) != NULL && // will leave with KErrEof
-            !iCancelCbRequested ) 
-        {
-        DeleteContactsL( contactsToDelete, aStoreUid == KUidDictionaryUidContactGroups );
-        // PopAndDestroy for contactsToDelete causes E32USER-CBase:90
-        // however there is no mem-leak even if not deleting contactsToDelete object
-        }
-    CleanupStack::PopAndDestroy(); // in
-    }
-
-//----------------------------------------------------------------------------
-TBool CCreatorVirtualPhonebook::HasOtherThanGroupsL( MVPbkContactLinkArray* aContacts )
-    {
-    LOGSTRING("Creator: CCreatorVirtualPhonebook::HasOtherThanGroupsL");
-    TBool result( EFalse );
-    TInt i(0);
-    while ( aContacts && i < aContacts->Count() && !iCancelCbRequested && !result )
-        {
-        if ( !IsContactGroupL( aContacts->At( i++ ) ) )
-            {
-            result = ETrue;
-            }
-        }
-    return result;
-    }
-
-//----------------------------------------------------------------------------
-void CCreatorVirtualPhonebook::VPbkSingleContactOperationComplete(
-                MVPbkContactOperationBase& /*aOperation*/,
-                MVPbkStoreContact* aContact )
-    {
-    LOGSTRING("Creator: CCreatorVirtualPhonebook::VPbkSingleContactOperationComplete");
-    
-    // This callback is currently used only for deleting a contact
-    // See DeleteContactsL
-    
-    TRAP_IGNORE( 
-            aContact->PushL();
-            aContact->DeleteL( *this );
-            CleanupStack::PopAndDestroy( aContact );
-        );
-    }
-
-void CCreatorVirtualPhonebook::VPbkSingleContactOperationFailed(
-                MVPbkContactOperationBase& /*aOperation*/, 
-                TInt /*aError*/ )
-    {
-    LOGSTRING("Creator: CCreatorVirtualPhonebook::VPbkSingleContactOperationFailed");
-    iWaiter->Cancel();
-    }
-
-//----------------------------------------------------------------------------
-void CCreatorVirtualPhonebook::StoreLinksForDeleteL( MVPbkContactLinkArray& aLinks, TUid aStoreUid )
-    {
-    LOGSTRING("Creator: CCreatorVirtualPhonebook::StoreLinksForDeleteL");
-    CDictionaryFileStore* store = iEngine->FileStoreLC();
-    User::LeaveIfNull( store );
-    
-    // backup previous contact links from store
-    // otherwise they would be overwritten when calling out.WriteL
-    MVPbkContactLinkArray* previousLinks( NULL );
-    if ( store->IsPresentL( aStoreUid ) )
-        {
-        RDictionaryReadStream in;
-        in.OpenLC( *store, aStoreUid );        
-        TRAP_IGNORE( 
-            while ( ( previousLinks = iContactManager->CreateLinksLC( in )) != NULL ) // will leave with KErrEof
-                {
-                CleanupStack::Pop(); // previousLinks
-                iPreviousDeleteLinks.Append( previousLinks );
-                previousLinks = NULL;
-                }
-            );
-        CleanupStack::PopAndDestroy(); // in
-        }
-
-    RDictionaryWriteStream out;       
-    out.AssignLC( *store, aStoreUid );
-    
-    // restore previous links
-    for ( TInt i = 0; i < iPreviousDeleteLinks.Count(); i++ )
-        {
-        out.WriteL( *iPreviousDeleteLinks[i]->PackLC() );
-        CleanupStack::PopAndDestroy(); // PackLC            
-        }
-    iPreviousDeleteLinks.ResetAndDestroy();
-    
-    // write new links
-    out.WriteL( *aLinks.PackLC() );
-    out.CommitL();
-    CleanupStack::PopAndDestroy(); // aLinks.PackLC
-    CleanupStack::PopAndDestroy(); // out
-    
-    store->CommitL();
-    CleanupStack::PopAndDestroy( store );
-    }
-
-//----------------------------------------------------------------------------
-void CCreatorVirtualPhonebook::AddFieldToParamsL(TInt aFieldType, const TDesC& aData)
-    {
-    LOGSTRING("Creator: CCreatorVirtualPhonebook::AddFieldToParamsL(TInt aFieldType, const TDesC& aData)");
-    if(iParameters == 0)
-        return;
-    CCreatorContactField* field = CCreatorContactField::NewL(aFieldType, aData);
-    CleanupStack::PushL(field);
-    iParameters->iContactFields.AppendL(field);
-    CleanupStack::Pop();
-    }
-
-void CCreatorVirtualPhonebook::AddFieldToParamsL(TInt aFieldType, const TDesC8& aData)
-    {
-    LOGSTRING("Creator: CCreatorVirtualPhonebook::AddFieldToParamsL(TInt aFieldType, const TDesC8& aData)");
-    if(iParameters == 0)
-        return;
-    CCreatorContactField* field = CCreatorContactField::NewL(aFieldType, aData);
-    CleanupStack::PushL(field);
-    iParameters->iContactFields.AppendL(field);
-    CleanupStack::Pop();
-    }
-
-void CCreatorVirtualPhonebook::AddFieldToParamsL(TInt aFieldType, const TTime& aData)
-    {
-    LOGSTRING("Creator: CCreatorVirtualPhonebook::AddFieldToParamsL(TInt aFieldType, const TTime& aData)");
-    if(iParameters == 0)
-        return;
-    CCreatorContactField* field = CCreatorContactField::NewL(aFieldType, aData);
-    CleanupStack::PushL(field);
-    iParameters->iContactFields.AppendL(field);
-    CleanupStack::Pop();
-    }
-       
-//----------------------------------------------------------------------------
-TInt CCreatorVirtualPhonebook::iPhoneNumberFields[] =
-    {
-    R_VPBK_FIELD_TYPE_LANDPHONEGEN,
-    R_VPBK_FIELD_TYPE_LANDPHONEHOME,
-    R_VPBK_FIELD_TYPE_LANDPHONEWORK,                        
-    R_VPBK_FIELD_TYPE_MOBILEPHONEGEN,
-    R_VPBK_FIELD_TYPE_MOBILEPHONEHOME,
-    R_VPBK_FIELD_TYPE_MOBILEPHONEWORK,
-    R_VPBK_FIELD_TYPE_FAXNUMBERGEN,
-    R_VPBK_FIELD_TYPE_FAXNUMBERHOME,
-    R_VPBK_FIELD_TYPE_FAXNUMBERWORK,
-    R_VPBK_FIELD_TYPE_PAGERNUMBER,           
-    R_VPBK_FIELD_TYPE_VIDEONUMBERGEN,
-    R_VPBK_FIELD_TYPE_VIDEONUMBERHOME,
-    R_VPBK_FIELD_TYPE_VIDEONUMBERWORK,
-    R_VPBK_FIELD_TYPE_VOIPGEN,
-    R_VPBK_FIELD_TYPE_VOIPHOME,
-    R_VPBK_FIELD_TYPE_VOIPWORK,
-    R_VPBK_FIELD_TYPE_ASSTPHONE,
-    R_VPBK_FIELD_TYPE_CARPHONE
-    };
-
-TInt CCreatorVirtualPhonebook::iUrlFields[] =
-    {
-    R_VPBK_FIELD_TYPE_URLGEN,
-    R_VPBK_FIELD_TYPE_URLHOME,
-    R_VPBK_FIELD_TYPE_URLWORK
-    };
-
-TInt CCreatorVirtualPhonebook::iEmailFields[] =
-    {
-    R_VPBK_FIELD_TYPE_EMAILGEN,
-    R_VPBK_FIELD_TYPE_EMAILHOME,
-    R_VPBK_FIELD_TYPE_EMAILWORK
-    };
-
-void CCreatorVirtualPhonebook::InitializeContactParamsL(/*CCreatorModuleBaseParameters* aParameters*/)
-    {
-    LOGSTRING("Creator: CCreatorPhonebook::InitializeContactParamsL");        
-    iParameters = new (ELeave) CVirtualPhonebookParameters;
-        
-    iParameters->iNumberOfPhoneNumberFields = iNumberOfPhoneNumberFields;
-    iParameters->iNumberOfURLFields = iNumberOfURLFields;
-    iParameters->iNumberOfEmailAddressFields = iNumberOfEmailAddressFields;       
-        
-    TPtrC firstname = iEngine->RandomString(CCreatorEngine::EFirstName);
-    TPtrC lastname  = iEngine->RandomString(CCreatorEngine::ESurname);               
-                    
-    if( iAddAllFields )
-        {
-        // Add text fields:
-        TInt textFieldCount = sizeof(CreatorVPbkMiscTextFields) / sizeof(FieldInfo);
-        for( TInt tfIndex = 0; tfIndex < textFieldCount; ++tfIndex )
-            {                
-            CCreatorContactField* field = CCreatorContactField::NewL(CreatorVPbkMiscTextFields[tfIndex].iFieldCode, KNullDesC);
-            CleanupStack::PushL(field);
-            field->SetRandomParametersL(CCreatorContactField::ERandomLengthDefault);
-            iParameters->iContactFields.AppendL(field);
-            CleanupStack::Pop(field);
-            }
-            
-        // Add binary fields:
-        TInt binFieldCount = sizeof(CreatorVPbkBinaryFields) / sizeof(TInt);
-        for( TInt bfIndex = 0; bfIndex < binFieldCount; ++bfIndex )
-            {                
-            CCreatorContactField* field = CCreatorContactField::NewL(CreatorVPbkBinaryFields[bfIndex], KNullDesC8);
-            CleanupStack::PushL(field);
-            field->SetRandomParametersL(CCreatorContactField::ERandomLengthDefault);
-            iParameters->iContactFields.AppendL(field);
-            CleanupStack::Pop(field);
-            }
-            
-        // Add date-time fields:
-        TInt dtFieldCount = sizeof(CreatorVPbkDateTimeFields) / sizeof(TInt);
-        for( TInt dtIndex = 0; dtIndex < dtFieldCount; ++dtIndex )
-            {
-            AddFieldToParamsL(CreatorVPbkDateTimeFields[dtIndex], iEngine->RandomDate(CCreatorEngine::EDateFuture));
-            }
-
-        AddFieldToParamsL(R_VPBK_FIELD_TYPE_CALLEROBJIMG, KNullDesC8);        
-        AddFieldToParamsL(R_VPBK_FIELD_TYPE_THUMBNAILPIC, KNullDesC8);        
-        AddFieldToParamsL(R_VPBK_FIELD_TYPE_CALLEROBJTEXT, firstname);
-        }
-    else
-        {                      
-        AddFieldToParamsL(R_VPBK_FIELD_TYPE_FIRSTNAME, firstname);            
-        AddFieldToParamsL(R_VPBK_FIELD_TYPE_LASTNAME, lastname);            
-        }
-                    
-    // Phone numbers:
-    TInt arraySize = sizeof(iPhoneNumberFields)/sizeof(TInt);
-    TInt index = 0;
-    for (TInt i=0; i<iParameters->iNumberOfPhoneNumberFields; i++ )
-        {            
-        if( index >= arraySize )
-            {
-            index = 0;
-            }
-        if( arraySize > 0  )
-            {
-            CCreatorContactField* field = CCreatorContactField::NewL(iPhoneNumberFields[index], KNullDesC);
-            CleanupStack::PushL(field);
-            field->SetRandomParametersL(CCreatorContactField::ERandomLengthDefault);
-            iParameters->iContactFields.AppendL(field);
-            CleanupStack::Pop(field);
-            }
-        ++index;
-        }
-            
-       
-    // URLs:
-    arraySize = sizeof(iUrlFields)/sizeof(TInt);
-    index = 0;
-    for( TInt i = 0; i < iParameters->iNumberOfURLFields; ++i)
-        {
-        if( index >= arraySize )
-            {
-            index = 0;
-            }
-        if( arraySize > 0  )
-            {
-            CCreatorContactField* field = CCreatorContactField::NewL(iUrlFields[index], KNullDesC);
-            CleanupStack::PushL(field);
-            field->SetRandomParametersL(CCreatorContactField::ERandomLengthDefault);
-            iParameters->iContactFields.AppendL(field);
-            CleanupStack::Pop(field);            
-            }
-        ++index;
-        }
-                    
-    // EMail addresses:
-    arraySize = sizeof(iEmailFields)/sizeof(TInt);
-    index = 0;
-    for( TInt i = 0; i < iParameters->iNumberOfEmailAddressFields; ++i)
-        {
-        if( index >= arraySize )
-            {
-            index = 0;
-            }
-        if( arraySize > 0  )
-            {
-            CCreatorContactField* field = CCreatorContactField::NewL(iEmailFields[index], KNullDesC);
-            CleanupStack::PushL(field);
-            field->SetRandomParametersL(CCreatorContactField::ERandomLengthDefault);
-            iParameters->iContactFields.AppendL(field);
-            CleanupStack::Pop(field);               
-            }
-        ++index;
-        }
-    }
-
-TInt CCreatorVirtualPhonebook::CreateContactEntryL(CCreatorModuleBaseParameters *aParameters)
-    {
-    LOGSTRING("Creator: CCreatorVirtualPhonebook::CreateContactEntryL");
-    
-    delete iParameters;
-    iParameters = 0;
-    CVirtualPhonebookParameters* parameters = 0;
-    
-    if( aParameters == 0 )
-        {
-        InitializeContactParamsL();
-        parameters = iParameters;
-        }
-    else
-        {
-        parameters = (CVirtualPhonebookParameters*) aParameters;
-        }
-    
-    TInt err = KErrNone;
-
-    // create a new contact item
-    MVPbkStoreContact* newContact = iStore->CreateNewContactLC();
-    for( TInt i = 0; i < parameters->iContactFields.Count(); ++i )
-        {
-        CCreatorContactField* cField = parameters->iContactFields[i];
-        if( cField )
-            {
-            cField->AddToContactL(iEngine, *newContact, this);
-            }
-        }
-
-    RArray<MVPbkStoreContact*> contacts;
-    CleanupClosePushL( contacts );    
-    contacts.Append(newContact);        
-    
-    delete iOperation;
-    iOperation = NULL;
-    iOperation = iContactManager->CommitContactsL( contacts.Array(), *this );       
-    if ( iOperation )
-        {
-
-        iWaiter->StartAndWait();//Making asynchronous CommitContctsL to synchronous
-        delete iOperation;
-        iOperation = NULL;
-        }    
-    
-    // store the link to contact, so that Creator is able to delete
-    // it when user requests deletion of contacts that are created by Creator 
-    MVPbkContactLink* linkToContact = newContact->CreateLinkLC();
-    iContactsToDelete->AppendL( linkToContact );
-    CleanupStack::Pop(); // linkToContact
-    
-    // If this contact has a link id in script (i.e. belongs to a contact-set), we must cache the contact id:
-    if( parameters->ScriptLinkId() > 0 )
-        {                
-        RPointerArray<CCreatorContactSet>& contactsets = ContactLinkCache::Instance()->ContactSets();
-        TBool setFound(EFalse);
-        for(TInt i = 0; i < contactsets.Count(); ++i )
-            {
-            if( contactsets[i]->LinkId() == parameters->ScriptLinkId())
-                {
-                MVPbkContactLink* linkToContact = newContact->CreateLinkLC();
-                if( linkToContact )
-                    {
-                    contactsets[i]->AppendL(linkToContact);
-                    iContactLinkArray->AppendL(linkToContact);
-                    CleanupStack::Pop(); // linkToContact
-                    }
-                setFound = ETrue;
-                break;
-                }
-            }
-        if( !setFound )
-        	{
-        	LOGSTRING2("Error: Contact set id %d not found.", parameters->ScriptLinkId());
-        	}
-        }
-    
-    CleanupStack::Pop();//contacts
-    contacts.Close();
-    CompactPbkDatabaseL();
-    CleanupStack::PopAndDestroy();//newContact
-    if ( iCancelCbRequested && iEngine ) iEngine->CancelComplete();
-    return err;
-    }
-
-
-//----------------------------------------------------------------------------
-
-void CCreatorVirtualPhonebook::AddImageToContactL(MVPbkStoreContact& aContact, TInt aFieldResId, const TDesC& aFileName)
-    {
-    LOGSTRING("Creator: CCreatorPhonebook::AddImageToContactL");
-    CPbk2ImageManager* imageMgr = CPbk2ImageManager::NewL(*iContactManager);
-    CleanupStack::PushL(imageMgr);
-    const MVPbkFieldTypeList& fieldList = aContact.ParentStore().StoreProperties().SupportedFields();        
-    const MVPbkFieldType* fieldType = fieldList.Find(aFieldResId);
-    if( fieldType == 0 )
-        {
-        return;
-        }
-    MPbk2ImageOperation* imageOp = 0;
-    TRAPD(err, imageOp = imageMgr->SetImageAsyncL(aContact, *fieldType, *this, aFileName));   
-    if( err == KErrNone)
-        {
-        if (imageOp)
-            {
-            CleanupDeletePushL( imageOp );
-            iWaiter->StartAndWait(); // Making asynchronous SetImageAsyncL to synchronous
-            CleanupStack::Pop(imageOp);
-            delete imageOp;
-            }
-        }    
-    else if(err != KErrNotSupported)
-        {
-        User::Leave(err);
-        }
-    CleanupStack::PopAndDestroy(imageMgr);        
-    }
-
-// Checks if the link is a group or not
-TBool CCreatorVirtualPhonebook::IsContactGroupL(const MVPbkContactLink& aLink)
-	{
-	LOGSTRING("Creator: CCreatorPhonebook::IsContactGroupL");
-	if( iStore )
-		{
-		delete iContactGroupsInStore;
-		iContactGroupsInStore = 0;
-		// Save contact group links here
-		iContactGroupsInStore = iStore->ContactGroupsLC();
-		CleanupStack::Pop();
-		}
-		
-	if( iContactGroupsInStore )
-		{
-		// Loop all the groups and check if any of them matches to the given link.
-		for( TInt i = 0; i < iContactGroupsInStore->Count(); ++i )
-			{
-			if( (*iContactGroupsInStore)[i].IsSame(aLink) )
-				return ETrue;
-			}
-		}
-	return EFalse;
-	}
-
-TInt CCreatorVirtualPhonebook::CreateGroupEntryL(CCreatorModuleBaseParameters *aParameters)
-    {
-    LOGSTRING("Creator: CCreatorVirtualPhonebook::CreateGroupEntryL");
-    delete iParameters;
-    iParameters = 0;
-    
-    CVirtualPhonebookParameters* parameters = (CVirtualPhonebookParameters*) aParameters;
-    
-    if( !parameters )
-        {
-        iParameters = new (ELeave) CVirtualPhonebookParameters;
-        iParameters->iContactsInGroup = iContactsInGroup;
-        iParameters->iGroupName->Des().Copy( iEngine->RandomString(CCreatorEngine::EGroupName) );
-        iParameters->iGroupName->Des().Append( _L(" #") );
-        iParameters->iGroupName->Des().AppendNum( iEngine->RandomNumber(1000, 9999) );
-        parameters = iParameters;
-        }
-
-    TInt err = KErrNone;
- 
-    // create a new contact group    
-    MVPbkContactGroup* newGroup = iStore->CreateNewContactGroupLC();
-    
-    newGroup->SetGroupLabelL(parameters->iGroupName->Des());
-        
-    // define amounts of contacts to be added to the group
-    TInt amountOfContactsToBeAdded = 0;
-    if (parameters->iContactsInGroup == KCreateRandomAmountOfGroups)
-    	{
-        amountOfContactsToBeAdded = iEngine->RandomNumber(30);
-    	}
-    else 
-    	{
-        amountOfContactsToBeAdded = parameters->iContactsInGroup;
-    	}
-    
-    if( parameters->iLinkIds.Count() > 0 )
-        {
-        for( TInt i = 0; i < parameters->iLinkIds.Count(); ++i )
-            {
-            const CCreatorContactSet& set = ContactLinkCache::Instance()->ContactSet(parameters->iLinkIds[i].iLinkId);
-            
-            const RPointerArray<MVPbkContactLink>& links = set.ContactLinks();
-            TInt numberOfExplicitLinks = links.Count(); // Number of defined contacts in contact-set
-            TInt numberOfExistingContacts = set.NumberOfExistingContacts(); // Number of existing contacts in contact-set
-            TInt maxAmount = numberOfExplicitLinks + numberOfExistingContacts;
-            
-            if( parameters->iLinkIds[i].iLinkAmount > 0 )
-                maxAmount = parameters->iLinkIds[i].iLinkAmount; // Max amount is limited
-            
-            TInt addedMembers = 0;
-            
-            for( TInt j = 0; j < links.Count() && addedMembers < maxAmount; ++j )
-                {
-                MVPbkContactLink* link = links[j]; 
-                if( link && IsContactGroupL(*link) == EFalse )
-                    {
-                    TRAPD(err, newGroup->AddContactL(*link));
-                    if( err != KErrAlreadyExists )
-                    	{
-                    	// Ignore "allready exists" -error
-                    	User::LeaveIfError(err);
-                    	++addedMembers;
-                    	}                    
-                    }
-                }
-            if( addedMembers < maxAmount )
-            	{
-            	// Add existing contacts, withing the limits set by maxAmount:
-            	amountOfContactsToBeAdded += maxAmount - addedMembers;
-            	}
-            }
-        }
-    if( amountOfContactsToBeAdded > 0 )
-        {    
-        CVPbkContactViewDefinition* viewDef = CVPbkContactViewDefinition::NewL();
-        CleanupStack::PushL( viewDef );
-        viewDef->SetType( EVPbkContactsView );
-        MVPbkContactView* contactView = iStore->CreateViewLC( 
-                *viewDef, 
-                *this, 
-                iStore->StoreProperties().SupportedFields() );
-        iWaiter->StartAndWait();//Making asynchronous CreateViewLC to synchronous
-
-        TInt cnt = 0;
-        // assign some random contacts to the group
-        for ( TInt y = 0; cnt < amountOfContactsToBeAdded && y < contactView->ContactCountL(); ++y )
-            {
-            MVPbkContactLink* link = contactView->CreateLinkLC( y );
-            TRAPD( err, newGroup->AddContactL( *link ) );
-            CleanupStack::PopAndDestroy(); // link
-            if( err != KErrAlreadyExists )
-                {
-                // Ignore "allready exists" -error
-                User::LeaveIfError( err );
-                ++cnt;
-                }
-            }
-        CleanupStack::PopAndDestroy(); // contactView
-        CleanupStack::PopAndDestroy( viewDef );
-        }
-    
-    newGroup->CommitL(*this);
-    iWaiter->StartAndWait(); //Making asynchronous CommitL to synchronous
-
-    // store the link to contact, so that Creator is able to delete
-    // it when user requests deletion of contacts that were created with Creator 
-    MVPbkContactLink* linkToContact = newGroup->CreateLinkLC();
-    iContactGroupsToDelete->AppendL( linkToContact );
-    CleanupStack::Pop(); // linkToContact
-    
-    CleanupStack::PopAndDestroy(); // newGroup
-   
-    CompactPbkDatabaseL();
-
-    return err;
-
-    }
-
-//----------------------------------------------------------------------------
-
-TInt CCreatorVirtualPhonebook::CreateSubscribedContactEntryL(CCreatorModuleBaseParameters* /*aParameters*/)
-    {
-    LOGSTRING("Creator: CCreatorVirtualPhonebook::CreateSubscribedContactEntryL");
-
-    return KErrNotSupported;
-    }
-
-//----------------------------------------------------------------------------
-
-void CCreatorVirtualPhonebook::AddFieldToContactItemL(
-		MVPbkStoreContact& newContact, TPbkFieldId aFieldId, const TDesC& aFieldText)
-	{
-    LOGSTRING("Creator: CCreatorVirtualPhonebook::AddFieldToContactItemL");
-
-    // Get field type object
-    const MVPbkFieldTypeList& fieldList = newContact.ParentStore().StoreProperties().SupportedFields();        
-    const MVPbkFieldType* fieldType = fieldList.Find(aFieldId);
-    if( fieldType == 0 )
-        return; // field type is not supported
-    
-    // Create a new field
-	MVPbkStoreContactField* newField = newContact.CreateFieldLC(*fieldType);	
-	if( !newField )
-	    {
-	    User::Leave(KErrNotSupported);
-	    }
-	
-	MVPbkContactFieldData& fieldData = newField->FieldData();
-	
-	//data type must be text in this case
-	TVPbkFieldStorageType dataType = fieldData.DataType();
-
-	if(dataType == EVPbkFieldStorageTypeText)
-	    {
-		//set text to field	
-		MVPbkContactFieldTextData& tmpData = MVPbkContactFieldTextData::Cast(fieldData);
-		tmpData.SetTextL(aFieldText);
-		//set field to contact		
-		newContact.AddFieldL(newField);//This object takes ownership of the field.
-		CleanupStack::Pop(newField);			
-	    }
-	else
-		{
-		User::Leave(KErrArgument);
-		}
-	
-    }
-
-//----------------------------------------------------------------------------
-
-void CCreatorVirtualPhonebook::AddFieldToContactItemL(
-		MVPbkStoreContact& newContact, TPbkFieldId aFieldId, const TDesC8& aFieldText)
-	{
-    LOGSTRING("Creator: CCreatorVirtualPhonebook::AddFieldToContactItemL");
-
-	//get field types
-	const MVPbkFieldTypeList& fieldList = newContact.ParentStore().StoreProperties().SupportedFields();
-	
-	//get wanted field type
-	const MVPbkFieldType* fieldType = fieldList.Find(aFieldId);
-	
-	//create a new field
-	MVPbkStoreContactField* newField =
-	            newContact.CreateFieldLC(*fieldType);
-	//get field data	
-	MVPbkContactFieldData& fieldData = newField->FieldData();
-	
-	//data type must be text in this case
-	TVPbkFieldStorageType dataType = fieldData.DataType();
-
-	if(dataType == EVPbkFieldStorageTypeBinary){
-		//set bindata to field	
-		MVPbkContactFieldBinaryData& tmpData = MVPbkContactFieldBinaryData::Cast(fieldData);		
-		tmpData.SetBinaryDataL(aFieldText);
-		//set field to contact		
-		newContact.AddFieldL(newField);//This object takes ownership of the field.
-		CleanupStack::Pop(newField);			
-	}
-	else
-		{
-		CleanupStack::PopAndDestroy(newField);
-		}
-	
-    }
-
-void CCreatorVirtualPhonebook::AddFieldToContactItemL(
-        MVPbkStoreContact& newContact, TPbkFieldId aFieldId, const TTime& aFieldText)
-    {
-    LOGSTRING("Creator: CCreatorVirtualPhonebook::AddFieldToContactItemL");
-    //get field types
-    const MVPbkFieldTypeList& fieldList = newContact.ParentStore().StoreProperties().SupportedFields();
-        
-    //get wanted field type
-    const MVPbkFieldType* fieldType = fieldList.Find(aFieldId);
-        
-    //create a new field
-    MVPbkStoreContactField* newField = newContact.CreateFieldLC(*fieldType);
-    //get field data    
-    MVPbkContactFieldData& fieldData = newField->FieldData();
-        
-    //data type must be datetime in this case
-    TVPbkFieldStorageType dataType = fieldData.DataType();
-
-    if(dataType == EVPbkFieldStorageTypeDateTime)
-        {
-        //set bindata to field  
-        MVPbkContactFieldDateTimeData& tmpData = MVPbkContactFieldDateTimeData::Cast(fieldData);        
-        tmpData.SetDateTime(aFieldText);
-        //set field to contact      
-        newContact.AddFieldL(newField);//This object takes ownership of the field.
-        CleanupStack::Pop(newField);            
-        }
-    else
-        {
-        CleanupStack::PopAndDestroy(newField);
-        }
-    }
-
-//----------------------------------------------------------------------------
-
-void CCreatorVirtualPhonebook::CompactPbkDatabaseL(TBool aCompressImmediately)
-    {
-    LOGSTRING("Creator: CCreatorVirtualPhonebook::CompactPbkDatabase");
-
-    iOpCounter++;
-
-    // compress the database immediately or after each 100th operation
-    if (aCompressImmediately || iOpCounter%100 == 0)
-        {
-        MVPbkContactOperationBase* operation= iContactManager->CompressStoresL(*this);
-        if (operation)
-            {
-            CleanupDeletePushL( operation );
-            iWaiter->StartAndWait();//Making asynchronous CompressStoresL to synchronous
-            CleanupStack::Pop(operation);
-            delete operation;
-            }             		 
-        }
-    }
-
-//----------------------------------------------------------------------------
-//Observer implementations for MVPbkContactStoreListObserver 
-//(and it's super class MVPbkContactStoreObserver)
-
-void CCreatorVirtualPhonebook::OpenComplete()
-	{
-	LOGSTRING("Creator: CCreatorVirtualPhonebook::OpenComplete()");
-    iWaiter->Cancel();
-	}
-
-void CCreatorVirtualPhonebook::StoreReady(MVPbkContactStore& /*aContactStore*/)
-	{
-	LOGSTRING("Creator: CCreatorVirtualPhonebook::StoreReady()");
-	}
-
-
-void CCreatorVirtualPhonebook::StoreUnavailable(MVPbkContactStore& /*aContactStore*/, 
-        TInt /*aReason*/)
-	{
-	LOGSTRING("Creator: CCreatorVirtualPhonebook::StoreUnavailable()");
-	}
-
-
-void CCreatorVirtualPhonebook::HandleStoreEventL(
-        MVPbkContactStore& /*aContactStore*/, 
-        TVPbkContactStoreEvent /*aStoreEvent*/)
-	{
-	LOGSTRING("Creator: CCreatorVirtualPhonebook::HandleStoreEventL()");
-	}
-
-
- TAny* CCreatorVirtualPhonebook::ContactStoreObserverExtension(
-		 TUid /*aExtensionUid*/) 
-        
- { 
- LOGSTRING("Creator: CCreatorVirtualPhonebook::ContactStoreObserverExtension()");
- return NULL; 
- }
- 
- 
-//----------------------------------------------------------------------------
-//Observer implementation for MVPbkBatchOperationObserver
-
-void CCreatorVirtualPhonebook::StepComplete( 
-     MVPbkContactOperationBase& /*aOperation*/,
-     TInt /*aStepSize*/ )
-	{
-    LOGSTRING("Creator: CCreatorVirtualPhonebook::StepComplete" );	
-	}
-
-
-TBool CCreatorVirtualPhonebook::StepFailed(
-     MVPbkContactOperationBase& /*aOperation*/,
-     TInt /*aStepSize*/, TInt /*aError*/ )
-{
-	LOGSTRING("Creator: CCreatorVirtualPhonebook::StepFailed" );
-	iWaiter->Cancel();
-	return EFalse;
-}
-
-
-void CCreatorVirtualPhonebook::OperationComplete( 
-     MVPbkContactOperationBase& /*aOperation*/ )
-	{
-    LOGSTRING("Creator: CCreatorVirtualPhonebook::OperationComplete" );
-    //Canceling waiter when operation is done.
-    iWaiter->Cancel();
-	}
-
-
-TAny* CCreatorVirtualPhonebook::BatchOperationObserverExtension( 
-     TUid /*aExtensionUid*/ ) 
-     {
-     LOGSTRING("Creator: CCreatorVirtualPhonebook::BatchOperationObserverExtension" );
-     return NULL;
-     }
-
-//----------------------------------------------------------------------------
-//Observer implementation for MVPbkContactFindObserver
-void CCreatorVirtualPhonebook::FindCompleteL( MVPbkContactLinkArray* aResults )
-  	 {
-  	 LOGSTRING("Creator: CCreatorVirtualPhonebook::FindCompleteL" );
-  	 if(iContactResults)
-  		 {
-  		 delete iContactResults;
-  		 iContactResults = NULL;
-  		 }
-  	 iContactResults = aResults;
-  	 iWaiter->Cancel();
-   	 }
-
-void CCreatorVirtualPhonebook::FindFailed( TInt aError )
- 	 {
- 	LOGSTRING2("Creator: CCreatorVirtualPhonebook::FindFailed - Error: %d", aError );
- 	iWaiter->Cancel();
-  	 }
-
-TAny* CCreatorVirtualPhonebook::ContactFindObserverExtension( 
-	                TUid /*aExtensionUid*/ )
-	 {
-	 LOGSTRING("Creator: CCreatorVirtualPhonebook::ContactFindObserverExtension" );
-	 return NULL;
-	 }	                
-
-
-//Observer implementation for MVPbkContactObserver
-//----------------------------------------------------------------------------
-
-void CCreatorVirtualPhonebook::ContactOperationCompleted(TContactOpResult aResult)
-	{
-    LOGSTRING("Creator: CCreatorVirtualPhonebook::ContactOperationCompleted" );
-            
-	TContactOp op = aResult.iOpCode; 		 
-    switch ( op )
-        {
-        case EContactCommit:
-        case EContactDelete:
-            {
-            iWaiter->Cancel();
-            break;
-            }
-        case EContactLock:
-        default: break;
-        }
-	}
-	
-void CCreatorVirtualPhonebook::ContactOperationFailed
-			(TContactOp /*aOpCode*/, TInt aErrorCode, TBool /*aErrorNotified*/)
-	{
-    LOGSTRING2("Creator: CCreatorVirtualPhonebook::ContactOperationFailed - Error: %d", aErrorCode );
-    iWaiter->Cancel();
-	}
-	
-TAny* CCreatorVirtualPhonebook::ContactObserverExtension(TUid /*aExtensionUid*/) 
-	{
-    LOGSTRING("Creator: CCreatorVirtualPhonebook::ContactObserverExtension" );
-    return NULL;
-	}
-
-void CCreatorVirtualPhonebook::Pbk2ImageSetComplete(MPbk2ImageOperation& /*aOperation*/)
-    {
-    LOGSTRING("Creator: CCreatorVirtualPhonebook::Pbk2ImageSetComplete" );
-    //Canceling waiter when operation is done.
-    iWaiter->Cancel();
-    }
-
-void CCreatorVirtualPhonebook::Pbk2ImageSetFailed(MPbk2ImageOperation& /*aOperation*/, TInt /*aError*/)
-    {
-    LOGSTRING("Creator: CCreatorVirtualPhonebook::Pbk2ImageSetFailed" );
-    //Canceling waiter when operation is done.
-    iWaiter->Cancel();
-    }
-
-
-//Observer implementation for MVPbkContactViewObserver
-//----------------------------------------------------------------------------
-void CCreatorVirtualPhonebook::ContactViewReady( MVPbkContactViewBase& /*aView*/ )
-    {
-    LOGSTRING("Creator: CCreatorVirtualPhonebook::ContactViewReady" );
-    iWaiter->Cancel();
-    }
-
-void CCreatorVirtualPhonebook::ContactViewUnavailable(
-        MVPbkContactViewBase& /*aView*/ )
-    {
-    iWaiter->Cancel();
-    }
-
-void CCreatorVirtualPhonebook::ContactAddedToView(
-        MVPbkContactViewBase& /*aView*/, 
-        TInt /*aIndex*/, 
-        const MVPbkContactLink& /*aContactLink*/ )
-    {
-    }
-
-void CCreatorVirtualPhonebook::ContactRemovedFromView(
-        MVPbkContactViewBase& /*aView*/, 
-        TInt /*aIndex*/, 
-        const MVPbkContactLink& /*aContactLink*/ )
-    {
-    }
-        
-void CCreatorVirtualPhonebook::ContactViewError(
-        MVPbkContactViewBase& /*aView*/, 
-        TInt /*aError*/, 
-        TBool /*aErrorNotified*/ )
-    {
-    iWaiter->Cancel();
-    }
-
-/**
- * CCreatorContactFieldImpl Base class for contact field implementations
- */
-class CCreatorContactFieldImpl : public CBase
-    {
-public:        
-    virtual ~CCreatorContactFieldImpl() {};
-    
-    virtual void AddToContactL(CCreatorEngine* aEngine, MVPbkStoreContact& aContact, CCreatorVirtualPhonebook* aVPbk);
-    virtual void SetRandomParametersL(CCreatorContactField::TRandomLengthType aRandomLenType = CCreatorContactField::ERandomLengthDefault, TInt aRandomLen = 0 );
-    virtual void ParseL(CCommandParser* parser);
-     
-    virtual TInt FieldType();
-protected:
-    CCreatorContactFieldImpl(TInt aFieldType);    
-    TInt iFieldType;    
-    CCreatorContactField::TRandomLengthType iRandomLenType;
-    TInt iRandomLen;
-    };
-    
-void CCreatorContactFieldImpl::AddToContactL(CCreatorEngine* /*aEngine*/, MVPbkStoreContact& /*aContact*/, CCreatorVirtualPhonebook* /*aVPbk*/ )
-    {}
-
-void CCreatorContactFieldImpl::SetRandomParametersL(CCreatorContactField::TRandomLengthType aRandomLenType, TInt aRandomLen )
-    {    
-    iRandomLenType = aRandomLenType;
-    iRandomLen = aRandomLen;
-    }
-
-void CCreatorContactFieldImpl::ParseL(CCommandParser* /*parser*/)
-    {}
-    
-CCreatorContactFieldImpl::CCreatorContactFieldImpl(TInt aFieldType)
-    {
-    iFieldType = aFieldType;
-    }
-
-TInt CCreatorContactFieldImpl::FieldType()
-    {
-    return iFieldType;    
-    }
-
-
-/**
- * CCreatorContactTextField Text field implementation
- */
-class CCreatorContactTextField : public CCreatorContactFieldImpl
-    {
-    public:
-    static CCreatorContactTextField* NewL(TInt aFieldType, const TDesC& aData);
-    ~CCreatorContactTextField();
-    virtual void AddToContactL(CCreatorEngine* aEngine, MVPbkStoreContact& aContact, CCreatorVirtualPhonebook* aVPbk);    
-    virtual void ParseL(CCommandParser* parser);
-    
-    protected:
-    virtual void SetDefaultRandomContentL(CCreatorEngine* aEngine);
-    virtual void SetExplicitRandomContentL(CCreatorEngine* aEngine, TInt aRandomLen);
-    
-    private:    
-    CCreatorContactTextField(TInt aFieldType);
-    void ConstructL(const TDesC& aData);
-    HBufC* iPtr;    
-    };
-    
-CCreatorContactTextField::CCreatorContactTextField(TInt aFieldType) 
-: CCreatorContactFieldImpl(aFieldType)
-    { }
-CCreatorContactTextField::~CCreatorContactTextField()
-    { 
-    delete iPtr; 
-    }
- void CCreatorContactTextField::AddToContactL(CCreatorEngine* aEngine, MVPbkStoreContact& aContact, CCreatorVirtualPhonebook* aVPbk)
-     {
-     LOGSTRING("Creator: CCreatorContactTextField::AddToContactL"); 
-     if( aVPbk == 0 )
-         User::Leave(KErrArgument);
-               
-     if( iPtr == 0 || iPtr->Length() == 0)
-         {
-         switch( iRandomLenType )
-         {
-         case CCreatorContactField::ERandomLengthDefault:
-             {
-             SetDefaultRandomContentL(aEngine);
-             break;
-             }
-         case CCreatorContactField::ERandomLengthMax:
-             {
-             const MVPbkFieldTypeList& fieldList = aContact.ParentStore().StoreProperties().SupportedFields();
-             const MVPbkFieldType* fieldType = fieldList.Find(iFieldType);
-             if( fieldType == 0 )
-                 return; // field type is not supported
-                 
-             // Create a new field
-             MVPbkStoreContactField* newField = aContact.CreateFieldLC(*fieldType);    
-             if( !newField )
-                 {
-                 User::Leave(KErrNotSupported);
-                 }
-                 
-             MVPbkContactFieldData& fieldData = newField->FieldData();  
-             //data type must be text in this case
-             TVPbkFieldStorageType dataType = fieldData.DataType();
-
-             if(dataType == EVPbkFieldStorageTypeText)
-                 {
-                 //set text to field 
-                 MVPbkContactFieldTextData& tmpData = MVPbkContactFieldTextData::Cast(fieldData);
-                 iRandomLen = tmpData.MaxLength();
-                 if( iRandomLen == KVPbkUnlimitedFieldLength )
-                     iRandomLen = 128;
-                 }
-             CleanupStack::PopAndDestroy(newField);       
-             SetExplicitRandomContentL(aEngine, iRandomLen);
-             break;
-             }
-         case CCreatorContactField::ERandomLengthExplicit:
-             {
-             SetExplicitRandomContentL(aEngine, iRandomLen);
-             break;
-             }
-         default:
-             break;
-         }
-         }
-     if( iPtr )
-         {
-         if( iFieldType == R_VPBK_FIELD_TYPE_THUMBNAILPIC )
-             {
-             if( iPtr && iPtr->Length() > 0 )
-            	 {
-            	 aVPbk->AddImageToContactL(aContact, iFieldType, iPtr->Des());
-            	 }
-             }
-         //Thumbnail id handling
-         /*else if( iFieldType == FIELD_TYPE_THUMBNAILPIC_ID )
-             {
-             if( iPtr && iPtr->Length() > 0 )
-                 {
-                 TInt id = aEngine->GetAttachmentIdL(iPtr->Des());
-                 if( id != KUndef )
-                     {
-                     //get picture path by id
-                     TFileName sourceFileName = aEngine->TestDataPathL((CCreatorEngine::TTestDataPath)id);// (CCreatorEngine::TTestDataPath) parameters.iAttachments->At(i)
-                     //set image to contact
-                     aVPbk->AddImageToContactL(aContact, R_VPBK_FIELD_TYPE_THUMBNAILPIC, sourceFileName);                     
-                     }
-                 }
-             }*/         
-         else
-             {
-             if( iPtr && iPtr->Length() > 0 )
-            	 {
-            	 aVPbk->AddFieldToContactItemL(aContact, iFieldType, iPtr->Des());
-            	 }
-             }
-         }
-     }
-
- void CCreatorContactTextField::SetDefaultRandomContentL(CCreatorEngine* aEngine)
-     {
-     LOGSTRING("Creator: CCreatorContactTextField::SetDefaultRandomContentL");
-     if( aEngine == 0 )
-         return;
-     
-     if( iPtr )
-         {
-         delete iPtr;
-         iPtr = 0;
-         }
-     TPtrC contentData;
-     
-     TInt textFieldCount = sizeof(CreatorVPbkMiscTextFields) / sizeof(FieldInfo);
-     TBool found = EFalse;
-     for( TInt tfIndex = 0; tfIndex < textFieldCount; ++tfIndex )
-         {
-         if( iFieldType == CreatorVPbkMiscTextFields[tfIndex].iFieldCode )
-             {
-             found = ETrue;
-             if( CreatorVPbkMiscTextFields[tfIndex].iRandomType != RND_TYPE_UNDEF )
-                 {
-                 contentData.Set(aEngine->RandomString((CCreatorEngine::TRandomStringType) CreatorVPbkMiscTextFields[tfIndex].iRandomType));
-                 }
-             else
-                 {
-                 switch( iFieldType )
-                 {
-                 case R_VPBK_FIELD_TYPE_RINGTONE:
-                     {
-                     contentData.Set(aEngine->CreateRandomSoundFileL());
-                     break;                 
-                     }
-                 //Thumbnail (path) and thumbnailid handling with random is the same, only in script they have different handling
-                 case R_VPBK_FIELD_TYPE_THUMBNAILPIC:                 
-                     {
-                     contentData.Set(aEngine->RandomPictureFileL());
-                     break;
-                     }
-                 case R_VPBK_FIELD_TYPE_SYNCCLASS:
-                 case R_VPBK_FIELD_TYPE_LOCPRIVACY:
-                     {
-                     _LIT(KPublic, "Public");
-                     contentData.Set(KPublic);
-                     break;
-                     }
-                 default:
-                     break;
-                 }
-                 }
-             break;
-             }
-         }
-     
-     if( found == EFalse )
-         {
-         TInt phNumFieldCount = sizeof(CreatorVPbkPhoneNumberFields) / sizeof(TInt);
-         for( TInt phIndex = 0; phIndex < phNumFieldCount; ++phIndex )
-             {
-             if( iFieldType == CreatorVPbkPhoneNumberFields[phIndex] )
-                 {
-                 contentData.Set(aEngine->RandomString(CCreatorEngine::EPhoneNumber));
-                 found = ETrue;
-                 break;
-                 }
-             }
-         }
-     
-     if( found == EFalse )
-         {
-         TInt emailFieldCount = sizeof(CreatorVPbkEmailFields) / sizeof(TInt);
-         for( TInt eIndex = 0; eIndex < emailFieldCount; ++eIndex )
-             {
-             if( iFieldType == CreatorVPbkEmailFields[eIndex] )
-                 {
-                 iPtr = aEngine->CreateEmailAddressLC();
-                 CleanupStack::Pop();
-                 return;
-                 }
-             }
-         }
-     iPtr = HBufC::NewL(contentData.Length());
-     iPtr->Des().Copy(contentData);
-     }
- 
- void CCreatorContactTextField::SetExplicitRandomContentL(CCreatorEngine* aEngine, TInt aRandomLen)
-     {     
-     LOGSTRING("Creator: CCreatorContactTextField::SetExplicitRandomContentL");
-     if( iPtr )
-         {
-         delete iPtr;
-         iPtr = 0;
-         }
-     iPtr = aEngine->CreateRandomStringLC(aRandomLen);
-     CleanupStack::Pop(); // iPtr
-     }
- 
- void CCreatorContactTextField::ParseL(CCommandParser* parser)
-     {
-     parser->StrParserL(iPtr, '|');
-     }
- 
- void CCreatorContactTextField::ConstructL(const TDesC& aData)
-      {     
-      iPtr = HBufC::New(KPhonebookFieldLength);
-      iPtr->Des().Copy(aData);
-      }
- 
- CCreatorContactTextField* CCreatorContactTextField::NewL(TInt aFieldType, const TDesC& aData)
-     {
-     CCreatorContactTextField* self = new (ELeave) CCreatorContactTextField(aFieldType);
-     CleanupStack::PushL(self);
-     self->ConstructL(aData);
-     CleanupStack::Pop();
-     return self;
-     }
- /**
-  * CCreatorContactBinaryField Binary field implementation
-  */
- class CCreatorContactBinaryField : public CCreatorContactFieldImpl
-    {
-public:
-    static CCreatorContactBinaryField* NewL(TInt aFieldType, const TDesC8& aData);
-    ~CCreatorContactBinaryField();  
-    virtual void AddToContactL(CCreatorEngine* aEngine, MVPbkStoreContact& aContact, CCreatorVirtualPhonebook* aVPbk);
-    virtual void ParseL(CCommandParser* parser);
-    virtual void SetDefaultRandomContentL(CCreatorEngine* aEngine);
-private:
-    CCreatorContactBinaryField(TInt aFieldType);
-    void ConstructL(const TDesC8& aData);
-    HBufC8* iPtr;    
-    };
- 
- CCreatorContactBinaryField::CCreatorContactBinaryField(TInt aFieldType) 
- : CCreatorContactFieldImpl(aFieldType)
-     { }
- CCreatorContactBinaryField::~CCreatorContactBinaryField()
-     { 
-     delete iPtr; 
-     }
-   
- void CCreatorContactBinaryField::ConstructL(const TDesC8& aData)
-     {
-     iPtr = HBufC8::New(KPhonebookFieldLength);
-     iPtr->Des() = aData;
-     }
- 
- CCreatorContactBinaryField* CCreatorContactBinaryField::NewL(TInt aFieldType, const TDesC8& aData)
-      {
-      CCreatorContactBinaryField* self = new (ELeave) CCreatorContactBinaryField(aFieldType);
-      CleanupStack::PushL(self);
-      self->ConstructL(aData);
-      CleanupStack::Pop();
-      return self;
-      }
- 
-void CCreatorContactBinaryField::AddToContactL(CCreatorEngine* /*aEngine*/, MVPbkStoreContact& aContact, CCreatorVirtualPhonebook* aVPbk)
-    {
-    LOGSTRING("Creator: CCreatorContactBinaryField::AddToContactL");
-    if( aVPbk == 0 )
-        User::Leave(KErrArgument);
-    if( iPtr )
-        {
-            aVPbk->AddFieldToContactItemL(aContact, iFieldType, iPtr->Des());
-        }
-    }
-void CCreatorContactBinaryField::ParseL(CCommandParser* parser)
-     {
-     parser->StrParserL(iPtr, '&');
-     }
-
-void CCreatorContactBinaryField::SetDefaultRandomContentL(CCreatorEngine* /*aEngine*/)
-    {
-    LOGSTRING("Creator: CCreatorContactBinaryField::SetDefaultRandomContentL");
-    }
-
-/**
- * CCreatorContactDateTimeField
- */ 
-class CCreatorContactDateTimeField : public CCreatorContactFieldImpl
-    {
-public:
-    static CCreatorContactDateTimeField* NewL(TInt aFieldType, const TTime& aData);
-    ~CCreatorContactDateTimeField();  
-    virtual void AddToContactL(CCreatorEngine* aEngine, MVPbkStoreContact& aContact, CCreatorVirtualPhonebook* aVPbk);
-    virtual void ParseL(CCommandParser* parser);    
-private:
-CCreatorContactDateTimeField(TInt aFieldType);
-    void ConstructL(const TTime& aData);
-    TTime iPtr;    
-    };
- 
-CCreatorContactDateTimeField::CCreatorContactDateTimeField(TInt aFieldType) 
-: CCreatorContactFieldImpl(aFieldType)
-     { }
-CCreatorContactDateTimeField::~CCreatorContactDateTimeField()
-     {
-     }
-   
- void CCreatorContactDateTimeField::ConstructL(const TTime& aData)
-     {
-     iPtr = aData;
-     }
- 
- CCreatorContactDateTimeField* CCreatorContactDateTimeField::NewL(TInt aFieldType, const TTime& aData)
-      {
-      CCreatorContactDateTimeField* self = new (ELeave) CCreatorContactDateTimeField(aFieldType);
-      CleanupStack::PushL(self);
-      self->ConstructL(aData);
-      CleanupStack::Pop();
-      return self;
-      }
- 
-void CCreatorContactDateTimeField::AddToContactL(CCreatorEngine* aEngine, MVPbkStoreContact& aContact, CCreatorVirtualPhonebook* aVPbk)
-    {
-    LOGSTRING("Creator: CCreatorContactDateTimeField::AddToContactL");
-    if( aVPbk == 0 )
-        User::Leave(KErrArgument);
-    
-    //TTime undefTime();
-    if( iPtr == Time::NullTTime() )
-        {
-        iPtr = aEngine->RandomDate(CCreatorEngine::EDateFuture);
-        }
-    
-    aVPbk->AddFieldToContactItemL(aContact, iFieldType, iPtr);    
-    }
-void CCreatorContactDateTimeField::ParseL(CCommandParser* /*parser*/)
-     {
-     //parser->StrParserL(iPtr, '&');
-     }
-
-/**
- * CCreatorContactField Contact field API
- */
-CCreatorContactField* CCreatorContactField::NewL(TInt aFieldType, const TDesC& aData)
-    {
-    CCreatorContactField* self = new (ELeave) CCreatorContactField();
-    CleanupStack::PushL(self);
-    self->ConstructL(aFieldType, aData);
-    CleanupStack::Pop();
-    return self;
-    }
-
-CCreatorContactField* CCreatorContactField::NewL(TInt aFieldType, const TDesC8& aData)
-    {
-    CCreatorContactField* self = new (ELeave) CCreatorContactField();
-    CleanupStack::PushL(self);
-    self->ConstructL(aFieldType, aData);
-    CleanupStack::Pop();
-    return self;
-    }
-
-CCreatorContactField* CCreatorContactField::NewL(TInt aFieldType, const TTime& aData)
-    {
-    CCreatorContactField* self = new (ELeave) CCreatorContactField();
-    CleanupStack::PushL(self);
-    self->ConstructL(aFieldType, aData);
-    CleanupStack::Pop();
-    return self;
-    }
-
-void CCreatorContactField::ConstructL(TInt aFieldType, const TDesC& aData)
-    {
-    pImpl = CCreatorContactTextField::NewL(aFieldType, aData); 
-    }
-
-void CCreatorContactField::ConstructL(TInt aFieldType, const TDesC8& aData)
-    {
-    pImpl = CCreatorContactBinaryField::NewL(aFieldType, aData);    
-    }
-
-void CCreatorContactField::ConstructL(TInt aFieldType, const TTime& aData)
-    {
-    pImpl = CCreatorContactDateTimeField::NewL(aFieldType, aData);    
-    }
-
-CCreatorContactField::CCreatorContactField()
-    {}
-CCreatorContactField::~CCreatorContactField()
-    {
-    delete pImpl;
-    }
- 
-TInt CCreatorContactField::FieldType()
-    {
-    return pImpl->FieldType();
-    }
-void CCreatorContactField::AddToContactL(CCreatorEngine* aEngine, MVPbkStoreContact& aContact, CCreatorVirtualPhonebook* aVPbk)
-    {
-    pImpl->AddToContactL(aEngine, aContact, aVPbk);
-    }
-void CCreatorContactField::ParseL(CCommandParser* parser)
-    {
-    pImpl->ParseL(parser);
-    }
-
-void CCreatorContactField::SetRandomParametersL(TRandomLengthType aRandomLenType, TInt aRandomLen )
-    {
-    pImpl->SetRandomParametersL(aRandomLenType, aRandomLen);
-    }
--- a/creator/engine/src/creator_wepsecuritysettings.cpp	Fri Jun 11 16:29:34 2010 +0100
+++ b/creator/engine/src/creator_wepsecuritysettings.cpp	Thu Jul 22 16:33:59 2010 +0100
@@ -21,7 +21,7 @@
 #include "creator_wepsecuritysettings.h"
 #include <commdb.h>
 //#include <featmgr.h>
-#include <wlancdbcols.h>
+#include <WlanCdbCols.h>
 
 //#include <commsdattypesv1_1.h>
 //#include <cmmanagertablefields.h>
--- a/creator/inc/engine.h	Fri Jun 11 16:29:34 2010 +0100
+++ b/creator/inc/engine.h	Thu Jul 22 16:33:59 2010 +0100
@@ -22,14 +22,15 @@
 // INCLUDES
 #include <e32std.h>
 #include <e32base.h>
-#include <f32file.h>
-#include <W32STD.H>
+#include <e32hal.h>
+#include <s32file.h>
+#include <s32mem.h>
+#include <w32std.h>
 
 //#include <aknenv.h>
 #include <coeutils.h>
 #include <apparc.h>
 #include <eikenv.h>
-//#include <aknprogressdialog.h>
 //#include <eikprogi.h>
 #include <bautils.h>
 #include <commdb.h>
@@ -37,18 +38,6 @@
 
 #include "creator.hrh"
 #include "creator_std.h"
-#include "creator_scriptentry.h"
-#include "creator_modulebase.h"
-#include "creator_browser.h"
-#include "creator_calendar.h"
-#include "creator_phonebookbase.h"
-#include "creator_note.h"
-#include "creator_log.h"
-#include "creator_connectionmethodbase.h"
-#include "creator_mailbox.h"
-//#include "creator_imps.h"
-#include "creator_message.h"
-#include "creator_landmark.h"
 #include "creator_randomdataparser.h"
 
 //class CCreatorAppUi;
@@ -57,17 +46,21 @@
 class CCreatorCalendarBase;
 class CCreatorNotepad;
 class CCreatorLogs;
-class CCreatorAccessPoints;
+//class CCreatorAccessPoints;
 class CCreatorMailboxes;
 class CCreatorIMPS;
 class CCreatorFiles;
 class CCreatorMessages;
 class CCreatorLandmarks;
+class MCreatorModuleBase;
+class CCreatorPhonebookBase;
+class CCreatorModuleBaseParameters;
+//class CCreatorConnectionSettingsBase;
 class CDictionaryFileStore;
 class CImageDecoder;
 class CFbsBitmap;
 class CBitmapScaler;
-
+class CCommandParser;
 class EngineWrapper;
 class CCreatorCmdScriptRun;
 
@@ -85,27 +78,79 @@
 	R_ATTACHMENT_SINGLE_SELECTION_QUERY
 	};
 
+/*
+ * Interface for UI dialogs
+ */
+class MUIObserver
+    {
+public:
+    /**
+     * Called when some dialog in UI is closed
+     *
+     * @since S60 10.1
+     * @param aPositiveAction ETrue if "Ok", "Yes" or other "positive" button was pressed
+     * @param aUserData number that was passed to UI before dialog was opened
+     * @return None.
+     */
+    virtual void QueryDialogClosedL(TBool aPositiveAction, TInt aUserData) = 0;
+
+    };
+
+/*
+ * Interface for CCommandParser
+ */
+class MCommandParserObserver
+    {
+public:
+    /**
+     * Called when CCommandParser user has choosen script file
+     *
+     * @since S60 10.1
+     * @param aSuccess ETrue if "Ok", "Yes" or other "positive" button was pressed
+     * @param aFileName filename chosen by user
+     * @return None.
+     */
+    virtual void ScriptChosenL(TBool aSuccess, const TDesC& aFileName = KNullDesC) = 0;
+
+    /**
+     * Called when CCommandParser user has choosen random data file
+     *
+     * @since S60 10.1
+     * @param aSuccess ETrue if "Ok", "Yes" or other "positive" button was pressed
+     * @param aFileName filename chosen by user
+     * @return None.
+     */
+    virtual void RandomDataFileChosenL(TBool aSuccess, const TDesC& aFileName = KNullDesC) = 0;
+    };
+
 /**
  * Device memory information
  */
 class TMemoryDetails
 	{
 public:
-    TBuf<16> iCFree;
-    TBuf<16> iDFree;
-    TBuf<16> iEFree;
-    TBuf<16> iHFree;
-	TBuf<16> iCSize;
-    TBuf<16> iDSize;
+	
+	TBuf<16> iFree;
+	TBuf<16> iSize;
+	TChar iDriveLetter;
+
+    TBuf<16> iRamFree;
+    TBuf<16> iRomFree;
+    
 	TBool    iENotAvailable;
-    TBuf<16> iESize;
-	TBuf<16> iHSize;
+
+	TBuf<16> iRamSize;
+	TBuf<16> iRomSize;
 	};
 // Common constant for undefined integer value:
 const TInt KUndef = KErrNotFound;
 
-class CCreatorEngine : public CActive 
+class CCreatorEngine : public CActive, public MUIObserver, public MCommandParserObserver
 	{
+enum ECreatorEngineState{
+    ECreatorEngineDeleteAllEntries,
+    ECreatorEngineDeleteAllCreatorEntries,
+};
 public:
     
     enum TRandomStringType
@@ -196,6 +241,7 @@
     static CCreatorEngine* NewLC(EngineWrapper *aEngineWrapper);	
     ~CCreatorEngine();
 	
+    inline RPointerArray<TMemoryDetails> GetMemoryDetailsList(){ return iMemoryDetailsList; };
 	inline TMemoryDetails GetMemoryDetails(){ return iMemoryDetails; };
 	inline EngineWrapper* GetEngineWrapper(){ return iEngineWrapper; };
 	
@@ -213,10 +259,8 @@
     TInt RunError(TInt aError);
     void DoCancel();
 
-    void ExecuteFirstCommandL(const TDesC& aText);
     void ExecuteCommand();
     void StartEnginesL();
-    void ShutDownEnginesL();
     void CheckForMoreCommandsL();
     
     TBool IsDeleteCommand( TInt aCommand );
@@ -228,11 +272,45 @@
     void GenerateSourceImageFileL( const TTestDataPath aFileType, const TDesC& aFileName );
     void GenereteSourceTextFileL( const TDesC& aFileName, TInt aSize );
 
+public: // from MUIObserver
+    /**
+     * Called when some dialog in UI is closed
+     *
+     * @since S60 10.1
+     * @param aPositiveAction ETrue if "Ok", "Yes" or other "positive" button was pressed
+     * @param aUserData number that was passed to UI before dialog was opened
+     * @return ?description
+     */
+    virtual void QueryDialogClosedL(TBool aPositiveAction, TInt aUserData);
+    
+public: // from MCommandParserObserver
+    /**
+     * Called when CCommandParser user has choosen script file
+     *
+     * @since S60 10.1
+     * @param aSuccess ETrue if "Ok", "Yes" or other "positive" button was pressed
+     * @param aFileName filename chosen by user
+     * @return None.
+     */
+    virtual void ScriptChosenL(TBool aSuccess, const TDesC& aFileName = KNullDesC);
+    
+    /**
+     * Called when CCommandParser user has choosen random data file
+     *
+     * @since S60 10.1
+     * @param aSuccess ETrue if "Ok", "Yes" or other "positive" button was pressed
+     * @param aFileName filename chosen by user
+     * @return None.
+     */
+    virtual void RandomDataFileChosenL(TBool aSuccess, const TDesC& aFileName = KNullDesC);
+    
 public:
     void ExecuteOptionsMenuCommandL(TInt aCommand);
     void RunScriptL();
     TInt RunScriptL(const TDesC& aScriptFile);
-
+    void ShutDownEnginesL();
+    void ExecuteFirstCommandL(const TDesC& aText);
+    
     void AppendToCommandArrayL(TInt aCommand, CCreatorModuleBaseParameters* aParameters, TInt aNumberOfEntries = 1);
     TInt CommandArrayCount();
  
@@ -280,7 +358,7 @@
     
     void SetDefaultPathForFileCommandL(TInt aCommand, TFileName& aPath);
 
-    TBool GetRandomDataFilenameL(TDes& aFilename);
+    TBool GetRandomDataL();
     TBool GetRandomDataFromFileL(const TDesC& aFilename);
     void CancelComplete();
     CDictionaryFileStore* FileStoreLC();
@@ -290,6 +368,8 @@
     void WriteEntryIdsToStoreL( RArray<TUint32>& aEntryIds, const TUid aModuleUid );
     void RemoveStoreL( const TUid aModuleUid );
 	void ProgressDialogCancelledL();
+	
+	void SortCommands();
     
 private:
     // needed by the engine itself
@@ -297,7 +377,6 @@
     CEikonEnv* iEnv;
     //CCreatorAppUi* iAppUi;
     TInt iCurrentEntry;
-    TInt iEntriesToBeCreated;
     TInt iFailedCommands;
 
     CDesCArrayFlat* iSoundFileArray;
@@ -331,13 +410,14 @@
     CCreatorPhonebookBase* iPhonebook;
     CCreatorNotepad* iNotepad;
     CCreatorLogs* iLogs;
-    CCreatorConnectionSettingsBase* iAccessPoints;
+//    CCreatorConnectionSettingsBase* iAccessPoints;
     CCreatorMailboxes* iMailboxes;
     CCreatorIMPS* iIMPS;
     CCreatorFiles* iFiles;
     CCreatorMessages* iMessages;
     CCreatorLandmarks* iLandmarks;
 	CCreatorCmdScriptRun* iCmdScriptRun;
+	CCommandParser* iCommandParser;
 
     // options menu command home module
     MCreatorModuleBase* iUsedOptionsMenuModule;
@@ -359,6 +439,9 @@
 
     EngineWrapper* iEngineWrapper; // Enginewrapper that is used for communicating between QT and Symbian
 	TMemoryDetails iMemoryDetails;
+	
+	RPointerArray<TMemoryDetails> iMemoryDetailsList;
+	
 	TInt iResourceFileId;
 
 	HBufC* iCommandLineScriptName;
--- a/creator/inc/enginewrapper.h	Fri Jun 11 16:29:34 2010 +0100
+++ b/creator/inc/enginewrapper.h	Thu Jul 22 16:33:59 2010 +0100
@@ -24,7 +24,7 @@
 #include <badesca.h>
 #include <engine.h>
 
- #include <QObject> // for iProgressNote signal connect
+#include <QObject> // for iProgressNote signal connect
 
 
 class MainView;
@@ -32,6 +32,7 @@
 class HbProgressDialog;
 class HbPopup;
 class HbCommonNote;
+class HbAction;
 
 
 /**
@@ -64,6 +65,11 @@
 	*/
 	MemoryDetails GetMemoryDetails();
 	
+	/**
+	 * Get memory details list
+	 */
+	QList<MemoryDetails> GetMemoryDetailsList();
+	
 public: 
     
     /* Functions that are called from UI */
@@ -102,37 +108,37 @@
 	/**
 	* Create entries query dialog
 	*/
-	TBool EntriesQueryDialog(TInt& aNumberOfEntries, const TDesC& aPrompt, TBool aAcceptsZero = EFalse);
+	TBool EntriesQueryDialog(TInt* aNumberOfEntries, const TDesC& aPrompt, TBool aAcceptsZero, MUIObserver* aObserver, TInt aUserData);
 
 	/**
 	* Create time query dialog
 	*/    
-    TBool TimeQueryDialog(TTime aTime, const TDesC& aPrompt);
+    TBool TimeQueryDialog(TTime* aTime, const TDesC& aPrompt, MUIObserver* aObserver, TInt aUserData);
 
 	/**
 	* Create yes or no query dialog
 	*/    
-    TBool YesNoQueryDialog(const TDesC& aPrompt);
+    TBool YesNoQueryDialog(const TDesC& aPrompt, MUIObserver* aObserver, int userData);
 	
 	/**
 	* Popup list dialog for selecting item from dialog list
 	*/
-	bool PopupListDialog(const TDesC& aPrompt, CDesCArray* aFileNameArray, TInt& aIndex); 
+	TBool PopupListDialog(const TDesC& aPrompt, const CDesCArray* aFileNameArray, TInt* aIndex, MUIObserver* aObserver, TInt aUserData); 
 	
 	/**
 	* Directory query dialog
 	*/
-	bool DirectoryQueryDialog(const TDesC& aPrompt, TFileName& aDirectory);
+	TBool DirectoryQueryDialog(const TDesC& aPrompt, TDes& aDirectory, MUIObserver* aObserver, TInt aUserData);
 	
 	/**
 	* Create list query single-selection dialog
 	*/
-	bool ListQueryDialog(const TDesC& aPrompt, TListQueryId aId, TInt& aIndex);
+	TBool ListQueryDialog(const TDesC& aPrompt, TListQueryId aId, TInt* aSeletedItem, MUIObserver* aObserver, TInt aUserData);
 
 	/**
 	* Create list query multi-selection dialog
 	*/
-	bool ListQueryDialog(const TDesC& aPrompt, TListQueryId aId, CArrayFixFlat<TInt>* aIndexes);
+	TBool ListQueryDialog(const TDesC& aPrompt, TListQueryId aId, CArrayFixFlat<TInt>* aSelectedItems, MUIObserver* aObserver, TInt aUserData);
 	
 	
 	/**
@@ -145,7 +151,7 @@
 	/**
 	* progress dialog cancelled
 	*/
-	void ProgressDialogCancelled();    
+	void ProgressDialogCancelled();
 	
 private:
     
@@ -156,6 +162,7 @@
     /* progress dialog that is shown */
     HbProgressDialog* iProgressDialog;
     
+    MCreatorModuleBase *iModule;
 };
 
 #endif //ENGINEWRAPPER_H
--- a/creator/inc/mainview.h	Fri Jun 11 16:29:34 2010 +0100
+++ b/creator/inc/mainview.h	Thu Jul 22 16:33:59 2010 +0100
@@ -30,15 +30,13 @@
 class MemoryDetails
 {
 public:
-    QString         mCFree;
-    QString         mDFree;
-    QString         mEFree;
-    QString         mHFree;
-	QString         mCSize;
-	QString         mDSize;
+	QString 		mFree;
+	QString			mSize;
+	QString			mDriveLetter;
+	
+    QString         mRamFree;
 	bool			mENotAvailable;
-	QString         mESize;
-	QString         mHSize;
+	QString         mRamSize;
 };
 
 /**
@@ -195,6 +193,7 @@
 	
 	
 	MemoryDetails mMemoryDetails;
+	QList<MemoryDetails> mMemoryDetailsList;
     // signal mapper
     QSignalMapper *mSm;    
 };
--- a/creator/inc/notifications.h	Fri Jun 11 16:29:34 2010 +0100
+++ b/creator/inc/notifications.h	Thu Jul 22 16:33:59 2010 +0100
@@ -21,6 +21,11 @@
 
 #include <hbmessagebox.h>
 #include <hbselectiondialog.h>
+#include <hbinputdialog.h>
+
+#include "engine.h"
+
+#include <stdexcept>
 
 class HbProgressDialog;
 class HbPopup;
@@ -51,37 +56,94 @@
      */
 	static HbProgressDialog* showProgressBar(const QString& text, int max);
 	
-	/**
-	* Entries query dialog
-	*/
-	static bool entriesQueryDialog(int& numberOfEntries, const QString& text, bool acceptsZero);
-    
-	/**
-	* Time query dialog
-	*/
-    static bool timeQueryDialog(QDate& date, const QString& text);
-
-	/**
-	* Yes or No query dialog
-	*/    
-    static bool yesNoQueryDialog(const QString& text);
-	
-	/**
-	* popup list dialog for selecting one item from list
-	*/
-	static void popupListDialog(const QString& text, QStringList& items, HbAbstractItemView::SelectionMode mode, QObject* receiver = 0, const char* member = 0);
-	
-	/**
-	* directory query dialog
-	*/
-	static bool directoryQueryDialog(const QString& text, QString& directory);
-
     /**
      * shows global HbGlobalCommonNote type note
      */
 	static void showGlobalNote(const QString& text, HbMessageBox::MessageBoxType type, HbPopup::DefaultTimeout timeout = HbPopup::ConfirmationNoteTimeout);
     };
 
+class CreatorDialog
+{
+    Q_DISABLE_COPY(CreatorDialog)
+protected:
+    CreatorDialog(MUIObserver* observer, int userData) throw(std::exception) : mObserver(observer), mUserData(userData)
+        {
+            if(!mObserver)
+                throw std::invalid_argument("module cannot be the null!");
+        };
+protected:
+    virtual void NotifyObserver(TBool aPositiveAction)
+        {
+        TRAPD( err, mObserver->QueryDialogClosedL(aPositiveAction, mUserData) );
+        if(err)
+            {
+            Notifications::error( QString("Symbian Leave: %1 ").arg(err) );
+            }
+        }
+    
+protected:
+    MUIObserver* mObserver;
+    int mUserData;
+};
 
+class CreatorYesNoDialog : public HbMessageBox, public CreatorDialog
+{
+    Q_DISABLE_COPY(CreatorYesNoDialog)
+    Q_OBJECT
+public:
+    static void launch(const QString& text, const QString& label, MUIObserver* observer, int userData) throw( std::exception );
+protected:
+    CreatorYesNoDialog(MUIObserver* observer, int userData);
+protected slots:
+    void DialogClosed(HbAction*);
+};
 
+class CreatorInputDialog : public HbInputDialog, public CreatorDialog
+{
+    Q_DISABLE_COPY(CreatorInputDialog)
+    Q_OBJECT
+public:
+    static void launch(const QString& label, int* value, bool acceptZero,  MUIObserver* observer, int userData) throw( std::exception );
+    static void launch(const QString& label, TDes& value,  MUIObserver* observer, int userData) throw( std::exception );
+protected:
+    CreatorInputDialog(int* value, MUIObserver* observer, int userData);
+    CreatorInputDialog(TDes& value, MUIObserver* observer, int userData);
+protected slots:
+    void DialogClosed(HbAction*);
+private:
+    int *mIntValue;
+    TDes& mStrValue;
+    TBuf<1> mDummy;
+};
+
+class CreatorSelectionDialog : public HbSelectionDialog, public CreatorDialog
+{
+    Q_DISABLE_COPY(CreatorSelectionDialog)
+    Q_OBJECT
+public:
+    static void launch(const QString& label, const QStringList& items, TInt* selectedItem, MUIObserver* observer, int userData) throw( std::exception );
+    static void launch(const QString& label, const QStringList& items, CArrayFixFlat<TInt>* aSelectedItems, MUIObserver* observer, int userData) throw( std::exception );
+protected:
+    CreatorSelectionDialog(TInt* selectedItem, MUIObserver* observer, int userData) throw( std::exception );
+    CreatorSelectionDialog(CArrayFixFlat<TInt>* aSelectedItems, MUIObserver* observer, int userData) throw( std::exception );
+protected slots:
+    void DialogClosed(HbAction*);
+private:
+    TInt* mSelectedItem;
+    CArrayFixFlat<TInt>* mSelectedItems;
+};
+
+class CreatorDateTimeDialog : public HbDialog, public CreatorDialog
+{
+    Q_DISABLE_COPY(CreatorDateTimeDialog)
+    Q_OBJECT
+public:
+    static void launch(const QString& label, TTime* value, MUIObserver* observer, int userData) throw( std::exception );
+protected:
+    CreatorDateTimeDialog(TTime* value, MUIObserver* observer, int userData);
+protected slots:
+    void DialogClosed(HbAction*);
+private:
+    TTime *mValue;
+};
 #endif // NOTIFICATIONS_H_
--- a/creator/src/engine.cpp	Fri Jun 11 16:29:34 2010 +0100
+++ b/creator/src/engine.cpp	Thu Jul 22 16:33:59 2010 +0100
@@ -16,10 +16,12 @@
 */
 
 
-#include <EIKENV.H>
-#include <S32FILE.H> 
+#include <eikenv.h>
+#include <s32file.h> 
 #include <coemain.h>
 
+#include <driveinfo.h>
+
 #include <datacreator.rsg>
 
 #include "mainview.h"
@@ -29,13 +31,26 @@
 
 #include <cntdb.h>//For Math
 
+#include "creator_scriptentry.h"
+#include "creator_modulebase.h"
+//#include "creator_browser.h"
+#include "creator_calendar.h"
+#include "creator_phonebookbase.h"
+#include "creator_note.h"
+#include "creator_log.h"
+//#include "creator_connectionmethodbase.h"
+#include "creator_mailbox.h"
+//#include "creator_imps.h"
+#include "creator_message.h"
+#include "creator_landmark.h"
+
 
 #include "creator_traces.h"
 #include "creator_factory.h"
 #include "creator_scriptparser.h"
 #include "creator_file.h"
 #include "creator_cmdscriptrun.h"
-
+#include "creator_contactsetcache.h"
 
 #include <apparc.h>
 #include <eikappui.h>
@@ -45,8 +60,6 @@
 _LIT(KEDriveError, "Not available");
 _LIT(KTempPathDrive, "d");
 _LIT(KTempPath, ":\\Creator\\");
-_LIT(KSavingText, "Saving");
-_LIT(KDeletingText, "Deleting");
 const TInt KRegisterDrive = EDriveC;
 _LIT(KRegisterFileName, "creator_created_items.dat");
 _LIT(KResourceFileName, "z:\\Resource\\apps\\datacreator.RSC");
@@ -129,6 +142,7 @@
 
 	iEnv->DeleteResourceFile(iResourceFileId);
     
+	iMemoryDetailsList.Reset();
     delete iPictureFileArray;
     delete iSoundFileArray;
     delete iTempPath;
@@ -141,7 +155,9 @@
     delete iBitmapData;
 	
     delete iCmdScriptRun;
-    iCmdScriptRun = NULL;	
+    iCmdScriptRun = NULL;
+    
+    delete iCommandParser;
     }
 
 void CCreatorEngine::CopyFileL(const TFileName& aSourceFile, const TFileName& aTargetFile, TBool aOverwrite )
@@ -161,52 +177,49 @@
 	
 void CCreatorEngine::RequestMemoryDetails() 
     {
+
+	TDriveList dl;
     // variables for memory and disk handling
-    TDriveNumber cDrive=EDriveC;
-    TDriveNumber dDrive=EDriveD;
-    TDriveNumber eDrive=EDriveE;
     TVolumeInfo vinfo;
-    TBuf<16> cFree;
-    TBuf<16> dFree;
-    TBuf<16> eFree;
-    TBuf<16> cSize;
-    TBuf<16> dSize;
-    TBuf<16> eSize;
 
+    //*************************************************************************
+   
+    //*************************************************************************
     // get an access to file server
     RFs& fsSession = CEikonEnv::Static()->FsSession();
 
-    // check the C-drive
-    fsSession.Volume(vinfo, cDrive);
-    iMemoryDetails.iCFree.Num(TInt64(vinfo.iFree/1024));
-    iMemoryDetails.iCSize.Num(TInt64(vinfo.iSize/1024));
-
-    // the same thing for D-drive
-    fsSession.Volume(vinfo, dDrive);
-	iMemoryDetails.iDFree.Num(TInt64(vinfo.iFree/1024));
-	iMemoryDetails.iDSize.Num(TInt64(vinfo.iSize/1024));
-
-    // the same thing for E-drive (MMC), if it exists 
-    if (MMC_OK())
-        {
-        fsSession.Volume(vinfo, eDrive);
-        iMemoryDetails.iEFree.Num(TInt64(vinfo.iFree/1024));
-		iMemoryDetails.iESize.Num(TInt64(vinfo.iSize/1024));
-
-        }
-	
-	else {
-		iMemoryDetails.iEFree = KEDriveError;
-		iMemoryDetails.iENotAvailable = ETrue;
-		}
+    fsSession.DriveList(dl);
+    
+    for(TInt driveNum = EDriveC; driveNum <= EDriveZ ; driveNum ++ )
+    	{
+		if( dl[driveNum] )
+			{
+			TMemoryDetails *memDet = new TMemoryDetails;
+			if(fsSession.Volume(vinfo, driveNum) == KErrNone)
+				{
+				memDet->iFree.Num(TInt64(vinfo.iFree/1024));
+				memDet->iSize.Num(TInt64(vinfo.iSize/1024));
+				}
+			else
+				{
+				memDet->iFree.Num( 0 );
+				memDet->iSize.Num( 0 );
+				}
+			User::LeaveIfError(fsSession.DriveToChar(driveNum,memDet->iDriveLetter));
+			iMemoryDetailsList.AppendL( memDet );
+			}
+    	}
+  
     // available work memory
     TMemoryInfoV1Buf memory;
     UserHal::MemoryInfo(memory);
     TInt64 freeMemBytes=(TInt64)(memory().iFreeRamInBytes);
     TInt64 sizeMemBytes=(TInt64)(memory().iTotalRamInBytes);
     TInt64 sizeWorkMemBytes = sizeMemBytes; 
-    iMemoryDetails.iHFree.Num(TInt64(freeMemBytes/1024));
-    iMemoryDetails.iHSize.Num(TInt64(sizeWorkMemBytes/1024));
+    TInt64 sizeRomBytes = (TInt64)(memory().iTotalRomInBytes);
+    iMemoryDetails.iRamFree.Num(TInt64(freeMemBytes/1024));
+    iMemoryDetails.iRamSize.Num(TInt64(sizeWorkMemBytes/1024));
+    iMemoryDetails.iRomSize.Num(TInt64(sizeRomBytes/1024));
     }
 
 // ---------------------------------------------------------------------------
@@ -291,11 +304,12 @@
     TCreatorIds cmd = (TCreatorIds)iCommandArray->At(iCurrentEntry).iCommandId; 
     switch( cmd )
         {
+/*        
 	    case ECmdCreateBrowserBookmarkEntries: { iBrowser->CreateBookmarkEntryL(reinterpret_cast<CBrowserParameters*>(iCommandArray->At(iCurrentEntry).iParameters)); } break;
 	    case ECmdCreateBrowserBookmarkFolderEntries: { iBrowser->CreateBookmarkFolderEntryL(reinterpret_cast<CBrowserParameters*>(iCommandArray->At(iCurrentEntry).iParameters)); } break;
 	    case ECmdCreateBrowserSavedPageEntries: { iBrowser->CreateSavedDeckEntryL(reinterpret_cast<CBrowserParameters*>(iCommandArray->At(iCurrentEntry).iParameters)); } break;
 	    case ECmdCreateBrowserSavedPageFolderEntries: { iBrowser->CreateSavedDeckFolderEntryL(reinterpret_cast<CBrowserParameters*>(iCommandArray->At(iCurrentEntry).iParameters)); } break;
-	    
+*/	    
         case ECmdCreateCalendarEntryAppointments: { iCalendar->CreateAppointmentEntryL(iCommandArray->At(iCurrentEntry).iParameters); } break;
 	    case ECmdCreateCalendarEntryEvents: { iCalendar->CreateEventEntryL(iCommandArray->At(iCurrentEntry).iParameters); } break;
 	    case ECmdCreateCalendarEntryAnniversaries: { iCalendar->CreateAnniversaryEntryL(iCommandArray->At(iCurrentEntry).iParameters); } break;
@@ -312,11 +326,11 @@
 	    case ECmdCreateLogEntryMissedCalls: { iLogs->CreateMissedCallEntryL(reinterpret_cast<CLogsParameters*>(iCommandArray->At(iCurrentEntry).iParameters)); } break;
 	    case ECmdCreateLogEntryReceivedCalls: { iLogs->CreateReceivedCallEntryL(reinterpret_cast<CLogsParameters*>(iCommandArray->At(iCurrentEntry).iParameters)); } break;
 	    case ECmdCreateLogEntryDialledNumbers: { iLogs->CreateDialledNumberEntryL(reinterpret_cast<CLogsParameters*>(iCommandArray->At(iCurrentEntry).iParameters)); } break;
-
+/*
         case ECmdCreateMiscEntryAccessPoints: { iAccessPoints->CreateConnectionSettingsEntryL(iCommandArray->At(iCurrentEntry).iParameters); } break;
         case ECmdDeleteIAPs: { iAccessPoints->DeleteAllL(); } break;
         case ECmdDeleteCreatorIAPs: { iAccessPoints->DeleteAllCreatedByCreatorL(); } break;
-
+*/
         case ECmdCreateMiscEntryLandmarks: { iLandmarks->CreateLandmarkEntryL(reinterpret_cast<CLandmarkParameters*>(iCommandArray->At(iCurrentEntry).iParameters)); } break;
         
 	    case ECmdCreateMessagingEntryMailboxes: { iMailboxes->CreateMailboxEntryL(reinterpret_cast<CMailboxesParameters*>(iCommandArray->At(iCurrentEntry).iParameters)); } break;
@@ -471,18 +485,18 @@
             iNotepad->DeleteAllL();
             break;
             }
-/*
+
         case ECmdDeleteIMPSs:
             {
-            iIMPS->DeleteAllL();
+//            iIMPS->DeleteAllL();
             break;
             }
         case ECmdDeleteCreatorIMPSs:
             {
-            iIMPS->DeleteAllCreatedByCreatorL();
+//            iIMPS->DeleteAllCreatedByCreatorL();
             break;
             }
-*/
+/*            
         case ECmdDeleteBrowserBookmarks:
             {
             iBrowser->DeleteAllBookmarksL();
@@ -523,6 +537,7 @@
             iBrowser->DeleteAllSavedPageFoldersCreatedByCreatorL();
             break;
             }
+*/            
         case ECmdDeleteCreatorFiles:
             {
             iFiles->DeleteAllCreatedByCreatorL();
@@ -637,6 +652,12 @@
     }
 
 // ---------------------------------------------------------------------------
+void CCreatorEngine::SortCommands()
+	{
+	TKeyArrayFix iBufKey(_FOFF(TCommand, iCommandId),ECmpTInt);
+	iCommandArray->Sort(iBufKey);
+	}
+// ---------------------------------------------------------------------------
 
 // This callback function is called when cancel button of the progress bar was pressed
 
@@ -699,25 +720,23 @@
     // start from the beginning
     iCurrentEntry = 0;
 
-    // we'll retrieve a correct number for this later
-    iEntriesToBeCreated = 0;
-
     // init the command array
     __ASSERT_ALWAYS(!iCommandArray, User::Panic(_L("iCommandArray"), 701));
     iCommandArray = new(ELeave) CCommandArray(10000);
 
     // init all modules here
     TInt err(KErrNone);
-    TRAP(err, iBrowser = CCreatorBrowser::NewL(this));
+//    TRAP(err, iBrowser = CCreatorBrowser::NewL(this));
     TRAP(err, iCalendar = CCreatorInterimCalendar::NewL(this));
     TRAP(err, iPhonebook = (CCreatorPhonebookBase*)TCreatorFactory::CreatePhoneBookL(this)); 
     TRAP(err, iNotepad = CCreatorNotepad::NewL(this));
     TRAP(err, iLogs = CCreatorLogs::NewL(this));
-    TRAP(err, iAccessPoints = (CCreatorConnectionSettingsBase*)TCreatorFactory::CreateConnectionSettingsL(this));
+//    TRAP(err, iAccessPoints = (CCreatorConnectionSettingsBase*)TCreatorFactory::CreateConnectionSettingsL(this));
     TRAP(err, iMailboxes = CCreatorMailboxes::NewL(this));
     TRAP(err, iFiles = CCreatorFiles::NewL(this));
     TRAP(err, iMessages = CCreatorMessages::NewL(this));
     TRAP(err, iLandmarks = CCreatorLandmarks::NewL(this));
+    ContactLinkCache::InitializeL();
 /*
     #ifdef __PRESENCE
       TRAP(err, iIMPS = CCreatorIMPS::NewL(this));
@@ -751,8 +770,8 @@
     iFiles = NULL;
     delete iMailboxes;
     iMailboxes = NULL;
-    delete iAccessPoints;
-    iAccessPoints = NULL;
+ //   delete iAccessPoints;
+//    iAccessPoints = NULL;
     delete iLogs;
     iLogs = NULL;
     delete iNotepad;
@@ -761,11 +780,12 @@
     iPhonebook = NULL;
     delete iCalendar;
     iCalendar = NULL;
-    delete iBrowser;
-    iBrowser = NULL;
+ //   delete iBrowser;
+ //   iBrowser = NULL;
     delete iLandmarks;
     iLandmarks = NULL;
 
+    ContactLinkCache::DestroyL();
     // now delete the command array
     delete iCommandArray;
     iCommandArray = NULL;
@@ -773,6 +793,13 @@
 	// delete parameter array
 	iParameterArray.ResetAndDestroy();
 	iParameterArray.Close();
+	
+	if(iCommandParser)
+	    {
+        delete iCommandParser;
+	    iCommandParser = NULL;
+	    }
+    
     
 	// clear temp drive
 	CFileMan* fileMan = CFileMan::NewL( iEnv->FsSession() );
@@ -790,6 +817,55 @@
     iTimer.Cancel();
     }
 
+void CCreatorEngine::ScriptChosenL( TBool aSuccess, const TDesC& aFileName )
+    {
+    if( aSuccess )
+        {
+        // open the file for reading
+        RFile scriptFile;
+        User::LeaveIfError( scriptFile.Open( iEnv->FsSession(), aFileName, EFileRead ) );
+        CleanupClosePushL(scriptFile);
+    
+        
+        // wait dialog
+        /* TODO
+        CAknGlobalNote* waitDialog = CAknGlobalNote::NewLC();
+        waitDialog->SetSoftkeys( R_AVKON_SOFTKEYS_CANCEL );
+        TInt dialogId = waitDialog->ShowNoteL( EAknGlobalWaitNote, _L("Parsing") );
+        */
+        TInt parseErr( KErrNone );
+        CCreatorScriptParser* scriptParser = CCreatorScriptParser::NewLC(this);
+        scriptParser->ParseL(scriptFile);
+        parseErr = scriptParser->GetError();
+        CleanupStack::PopAndDestroy( scriptParser );
+    
+        CleanupStack::PopAndDestroy( &scriptFile );
+    
+        //waitDialog->CancelNoteL( dialogId );
+        //CleanupStack::PopAndDestroy( waitDialog );
+    
+        if(parseErr != KErrNone)
+            {
+            // show error note
+            _LIT(KErrMsg, "Parser error: %d");
+            TBuf<32> msgBuf;
+            msgBuf.Format(KErrMsg, parseErr);
+            iEngineWrapper->ShowErrorMessage(msgBuf);
+            ShutDownEnginesL();
+            return;
+            }         
+        }
+
+    // start executing commands if commands in the command array
+    if (CommandArrayCount() > 0)
+        {
+        ExecuteFirstCommandL( KSavingText );
+        }
+    else
+        {
+        ShutDownEnginesL();
+        }
+    }
 // ---------------------------------------------------------------------------
 
 void CCreatorEngine::RunScriptL()
@@ -800,55 +876,16 @@
     StartEnginesL();
 
     // use the command parser module to init the command array from a script file
-    CCommandParser* commandParser = CCommandParser::NewLC(this);
-    RFile scriptFile;
-    TBool ret = commandParser->OpenScriptL(scriptFile);
-    CleanupClosePushL(scriptFile);
-    if( ret )
-        {
-        // wait dialog
-		/* TODO
-        CAknGlobalNote* waitDialog = CAknGlobalNote::NewLC();
-        waitDialog->SetSoftkeys( R_AVKON_SOFTKEYS_CANCEL );
-        TInt dialogId = waitDialog->ShowNoteL( EAknGlobalWaitNote, _L("Parsing") );
-        */
-        TInt parseErr( KErrNone );
-        TRAPD( parserErr,
-               CCreatorScriptParser* scriptParser = CCreatorScriptParser::NewLC(this);
-               scriptParser->ParseL(scriptFile);
-               parseErr = scriptParser->GetError();
-               CleanupStack::PopAndDestroy( scriptParser );
-             );
-        //waitDialog->CancelNoteL( dialogId );
-        //CleanupStack::PopAndDestroy( waitDialog );
-        User::LeaveIfError( parserErr );
-        
-        if(parseErr != KErrNone)
-            {
-			
-            // show error note
-            _LIT(KErrMsg, "Parser error: %d");
-            TBuf<32> msgBuf;
-            msgBuf.Format(KErrMsg, parseErr);
-            iEngineWrapper->ShowNote(msgBuf);
-            CleanupStack::PopAndDestroy(); //commandParser   
-            ShutDownEnginesL();
-            return;
-            }         
-        }
-    CleanupStack::PopAndDestroy( &scriptFile );
-    CleanupStack::PopAndDestroy( commandParser );   
-
-    // start executing commands if commands in the command array
-    if (CommandArrayCount() > 0)
-        {
-        ExecuteFirstCommandL( KSavingText );
-        }
-    else
+    delete iCommandParser;
+    iCommandParser = NULL;
+    iCommandParser = CCommandParser::NewL(this);
+    TBool ret = EFalse;
+    TRAPD(err, ret = iCommandParser->OpenScriptL( this ) );
+    if( err != KErrNone || ret == EFalse)
         {
         ShutDownEnginesL();
+        User::LeaveIfError(err);
         }
-
     }
 
 // ---------------------------------------------------------------------------
@@ -895,6 +932,65 @@
     }
 
 // ---------------------------------------------------------------------------
+void CCreatorEngine::QueryDialogClosedL( TBool aPositiveAction, TInt aUserData )
+    {
+    LOGSTRING("Creator: CCreatorEngine::QueryDialogClosedL");
+    
+    if( aPositiveAction == EFalse )
+        {
+        ShutDownEnginesL();
+        return;
+        }
+
+    switch(aUserData)
+        {
+        case ECreatorEngineDeleteAllEntries:
+            AppendToCommandArrayL( ECmdDeleteContacts, NULL, 1 );
+            AppendToCommandArrayL( ECmdDeleteContactGroups, NULL, 1 );
+            AppendToCommandArrayL( ECmdDeleteCalendarEntries, NULL, 1 );
+            //AppendToCommandArrayL( ECmdDeleteBrowserBookmarks, NULL, 1 );
+            //AppendToCommandArrayL( ECmdDeleteBrowserBookmarkFolders, NULL, 1 );
+            //AppendToCommandArrayL( ECmdDeleteBrowserSavedPages, NULL, 1 );
+            //AppendToCommandArrayL( ECmdDeleteBrowserSavedPageFolders, NULL, 1 );
+            AppendToCommandArrayL( ECmdDeleteLogs, NULL, 1 );
+            AppendToCommandArrayL( ECmdDeleteMessages, NULL, 1 );
+            //AppendToCommandArrayL( ECmdDeleteIAPs, NULL, 1 );
+            //AppendToCommandArrayL( ECmdDeleteIMPSs, NULL, 1 );
+            AppendToCommandArrayL( ECmdDeleteNotes, NULL, 1 );
+            AppendToCommandArrayL( ECmdDeleteLandmarks, NULL, 1 );
+            AppendToCommandArrayL( ECmdDeleteCreatorFiles, NULL, 1 );
+            
+            // started exucuting delete commands
+            ExecuteFirstCommandL( KDeletingText );
+            break;
+        case ECreatorEngineDeleteAllCreatorEntries:
+            AppendToCommandArrayL( ECmdDeleteCreatorContacts, NULL, 1 );
+            AppendToCommandArrayL( ECmdDeleteCreatorContactGroups, NULL, 1 );
+            AppendToCommandArrayL( ECmdDeleteCreatorCalendarEntries, NULL, 1 );
+            /*
+            AppendToCommandArrayL( ECmdDeleteCreatorBrowserBookmarks, NULL, 1 );
+            AppendToCommandArrayL( ECmdDeleteCreatorBrowserBookmarkFolders, NULL, 1 );
+            AppendToCommandArrayL( ECmdDeleteCreatorBrowserSavedPages, NULL, 1 );
+            AppendToCommandArrayL( ECmdDeleteCreatorBrowserSavedPageFolders, NULL, 1 );
+            */
+            AppendToCommandArrayL( ECmdDeleteCreatorFiles, NULL, 1 );
+            AppendToCommandArrayL( ECmdDeleteCreatorLogs, NULL, 1 );
+            AppendToCommandArrayL( ECmdDeleteCreatorMessages, NULL, 1 );
+            //AppendToCommandArrayL( ECmdDeleteCreatorIAPs, NULL, 1 );
+            //AppendToCommandArrayL( ECmdDeleteCreatorIMPSs, NULL, 1 );
+            AppendToCommandArrayL( ECmdDeleteCreatorLandmarks, NULL, 1 );
+            
+            // started exucuting delete commands
+            ExecuteFirstCommandL( KDeletingText );
+            break;
+        default:
+            //some error
+             ShutDownEnginesL();
+            break;
+        }
+    }
+
+// ---------------------------------------------------------------------------
 
 void CCreatorEngine::ExecuteOptionsMenuCommandL(TInt aCommand)
     {
@@ -906,7 +1002,8 @@
     // set the home module
     switch(aCommand)
         {
-	    case ECmdCreateBrowserBookmarkEntries:
+/*
+        case ECmdCreateBrowserBookmarkEntries:
 	    case ECmdCreateBrowserBookmarkFolderEntries:
 	    case ECmdCreateBrowserSavedPageEntries:
 	    case ECmdCreateBrowserSavedPageFolderEntries:
@@ -922,7 +1019,7 @@
             iUsedOptionsMenuModule = iBrowser;
             }
             break;
-	    
+*/	    
         case ECmdCreateCalendarEntryAppointments:
 	    case ECmdCreateCalendarEntryEvents:
 	    case ECmdCreateCalendarEntryAnniversaries:
@@ -963,7 +1060,7 @@
             iUsedOptionsMenuModule = iLogs;
             }
             break;
-
+/*
 	    case ECmdCreateMiscEntryAccessPoints:
 	    case ECmdDeleteIAPs:
 	    case ECmdDeleteCreatorIAPs:
@@ -971,7 +1068,7 @@
             iUsedOptionsMenuModule = iAccessPoints;
             }
             break;
-
+*/
 	    case ECmdCreateMessagingEntryMailboxes:
 	    case ECmdDeleteMailboxes:
 	    case ECmdDeleteCreatorMailboxes:
@@ -1065,27 +1162,7 @@
         {
         if ( aCommand == ECmdDeleteAllEntries )
             {
-            if ( iEngineWrapper->YesNoQueryDialog( _L("Delete all entries?") ) )
-                {
-                AppendToCommandArrayL( ECmdDeleteContacts, NULL, 1 );
-                AppendToCommandArrayL( ECmdDeleteContactGroups, NULL, 1 );
-                AppendToCommandArrayL( ECmdDeleteCalendarEntries, NULL, 1 );
-                AppendToCommandArrayL( ECmdDeleteBrowserBookmarks, NULL, 1 );
-                AppendToCommandArrayL( ECmdDeleteBrowserBookmarkFolders, NULL, 1 );
-                AppendToCommandArrayL( ECmdDeleteBrowserSavedPages, NULL, 1 );
-                AppendToCommandArrayL( ECmdDeleteBrowserSavedPageFolders, NULL, 1 );
-                AppendToCommandArrayL( ECmdDeleteLogs, NULL, 1 );
-                AppendToCommandArrayL( ECmdDeleteMessages, NULL, 1 );
-                AppendToCommandArrayL( ECmdDeleteIAPs, NULL, 1 );
-                AppendToCommandArrayL( ECmdDeleteIMPSs, NULL, 1 );
-                AppendToCommandArrayL( ECmdDeleteNotes, NULL, 1 );
-                AppendToCommandArrayL( ECmdDeleteLandmarks, NULL, 1 );
-                AppendToCommandArrayL( ECmdDeleteCreatorFiles, NULL, 1 );
-                
-                // started exucuting delete commands
-                ExecuteFirstCommandL( KDeletingText );
-                }
-            else
+            if ( !iEngineWrapper->YesNoQueryDialog( _L("Delete all entries?"), this, ECreatorEngineDeleteAllEntries) )
                 {
                 // cancelled, free resources
                 ShutDownEnginesL();
@@ -1093,58 +1170,23 @@
             }
         else if ( aCommand == ECmdDeleteAllCreatorEntries )
             {
-            if ( iEngineWrapper->YesNoQueryDialog( _L("Delete all entries created with Creator?") ) )
-                {
-                AppendToCommandArrayL( ECmdDeleteCreatorContacts, NULL, 1 );
-                AppendToCommandArrayL( ECmdDeleteCreatorContactGroups, NULL, 1 );
-                AppendToCommandArrayL( ECmdDeleteCreatorCalendarEntries, NULL, 1 );
-                AppendToCommandArrayL( ECmdDeleteCreatorBrowserBookmarks, NULL, 1 );
-                AppendToCommandArrayL( ECmdDeleteCreatorBrowserBookmarkFolders, NULL, 1 );
-                AppendToCommandArrayL( ECmdDeleteCreatorBrowserSavedPages, NULL, 1 );
-                AppendToCommandArrayL( ECmdDeleteCreatorBrowserSavedPageFolders, NULL, 1 );
-                AppendToCommandArrayL( ECmdDeleteCreatorFiles, NULL, 1 );
-                AppendToCommandArrayL( ECmdDeleteCreatorLogs, NULL, 1 );
-                AppendToCommandArrayL( ECmdDeleteCreatorMessages, NULL, 1 );
-                AppendToCommandArrayL( ECmdDeleteCreatorIAPs, NULL, 1 );
-                AppendToCommandArrayL( ECmdDeleteCreatorIMPSs, NULL, 1 );
-                AppendToCommandArrayL( ECmdDeleteCreatorLandmarks, NULL, 1 );
-                
-                // started exucuting delete commands
-                ExecuteFirstCommandL( KDeletingText );
-                }
-            else
+            if ( !iEngineWrapper->YesNoQueryDialog( _L("Delete all entries created with Creator?"), this, ECreatorEngineDeleteAllCreatorEntries ) )
                 {
                 // cancelled, free resources
                 ShutDownEnginesL();
                 }
             }
-        else if ( iUsedOptionsMenuModule->AskDataFromUserL( aCommand, iEntriesToBeCreated )  )
+        else if ( !iUsedOptionsMenuModule->AskDataFromUserL( aCommand )  )
             {
-            // add this command to command array
-            AppendToCommandArrayL( aCommand, NULL, 1 );
-    
-            // started exucuting commands
-            ExecuteFirstCommandL( KDeletingText );        
-            }
-        else
-            {
-            // cancelled, free resources
+            // cancelled or error, free resources
             ShutDownEnginesL();
             }
         }
 
     // ask user data, if query accepted start processing...
-    else if (iUsedOptionsMenuModule->AskDataFromUserL(aCommand, iEntriesToBeCreated))
+    else if (!iUsedOptionsMenuModule->AskDataFromUserL(aCommand))
         {
-        // add this command to command array
-        AppendToCommandArrayL(aCommand, NULL, iEntriesToBeCreated);
-
-        // started exucuting commands
-        ExecuteFirstCommandL( KSavingText );
-        }
-     else
-        {
-        // cancelled, free resources
+        // cancelled or error, free resources
         ShutDownEnginesL();
         }
     }
@@ -1199,15 +1241,23 @@
         }
      
     }
+// ---------------------------------------------------------------------------
+void CCreatorEngine::RandomDataFileChosenL( TBool aSuccess, const TDesC& aFileName )
+    {
+    if( aSuccess )
+        {
+        GetRandomDataFromFileL( aFileName );
+        }
+    }
 
 // ---------------------------------------------------------------------------
 
-TBool CCreatorEngine::GetRandomDataFilenameL(TDes& aFilename)
+TBool CCreatorEngine::GetRandomDataL()
 	{
-    CCommandParser* commandParser = CCommandParser::NewLC(this);
-	TBool ret = commandParser->GetRandomDataFilenameL(aFilename);
-    CleanupStack::PopAndDestroy(commandParser);
-    return ret;
+    delete iCommandParser;
+    iCommandParser = NULL;
+    iCommandParser = CCommandParser::NewL( this );
+	return iCommandParser->GetRandomDataFilenameL( this );
 	}
 
 // ---------------------------------------------------------------------------
@@ -1791,7 +1841,8 @@
     {
     LOGSTRING("Creator: CCreatorEngine::AccessPointNameToIdL");
     // Accespoint impl moved from engine to accespoint implementations for supporting 3.0-3.1 and 3.2->
-    return iAccessPoints->AccessPointNameToIdL(aAPName, aAnyIfNotFound );
+    //return iAccessPoints->AccessPointNameToIdL(aAPName, aAnyIfNotFound );
+    return 0;
     }
 
 static CCreatorEngine::TTestDataPath SoundFiles[] = {
--- a/creator/src/enginewrapper.cpp	Fri Jun 11 16:29:34 2010 +0100
+++ b/creator/src/enginewrapper.cpp	Thu Jul 22 16:33:59 2010 +0100
@@ -18,8 +18,7 @@
 
 #include <hbprogressdialog.h>
 #include <hbmessagebox.h>
-
-#include <hbpopup.h>
+#include <hblabel.h>
 
 #include <QString>
 #include <QDate>
@@ -69,28 +68,37 @@
 
 // ---------------------------------------------------------------------------
 
+QList<MemoryDetails> EngineWrapper::GetMemoryDetailsList()
+	{
+	RPointerArray<TMemoryDetails> tMemDetList = iEngine->GetMemoryDetailsList();
+	QList<MemoryDetails> memDetList;
+	MemoryDetails memDet;
+		for(int i=0; i<tMemDetList.Count(); i++)
+			{
+			TMemoryDetails* temp = tMemDetList.operator [](i);
+			QString free = QString::fromUtf16(tMemDetList.operator [](i)->iFree.Ptr(), tMemDetList.operator [](i)->iFree.Length());//QString((QChar*) temp->iFree.Ptr(), temp->iFree.Length());
+			QString size = QString::fromUtf16(tMemDetList.operator [](i)->iSize.Ptr(), tMemDetList.operator [](i)->iSize.Length());//QString((QChar*) temp->iSize.Ptr(), temp->iSize.Length());
+			QString driveLetter = QString::fromUtf8((const char*) &tMemDetList.operator [](i)->iDriveLetter, (int) sizeof(char) );//QString((QChar*) &temp->iDriveLetter, (int) sizeof( char ) );
+			memDet.mFree = free; //QString((QChar*)tMemDetList[i]->iFree.Ptr(), tMemDetList[i]->iFree.Length());
+			memDet.mSize = size; //QString((QChar*) tMemDetList[i]->iSize.Ptr(), tMemDetList[i]->iSize.Length());
+			memDet.mDriveLetter = driveLetter;
+			
+			//memDetList[i].mDriveLetter = QString::fromUtf8( (char *) &tMemDetList[i]->iDriveLetter, (int) sizeof( char ) );
+			memDetList.append( memDet );
+			}
+	return memDetList;
+	}
+
 MemoryDetails EngineWrapper::GetMemoryDetails()
 {
+	
     TMemoryDetails tMemoryDetails = iEngine->GetMemoryDetails();
     MemoryDetails memoryDetails;
 
     // Convert TMemoryDetails to MemoryDetails 
-    memoryDetails.mCFree  = QString((QChar*)tMemoryDetails.iCFree.Ptr(), tMemoryDetails.iCFree.Length());
-	memoryDetails.mDFree  = QString((QChar*)tMemoryDetails.iDFree.Ptr(), tMemoryDetails.iDFree.Length());
-	memoryDetails.mEFree  = QString((QChar*)tMemoryDetails.iEFree.Ptr(), tMemoryDetails.iEFree.Length());
-	memoryDetails.mHFree  = QString((QChar*)tMemoryDetails.iHFree.Ptr(), tMemoryDetails.iHFree.Length());
-	
-	memoryDetails.mCSize  = QString((QChar*)tMemoryDetails.iCSize.Ptr(), tMemoryDetails.iCSize.Length());
-	memoryDetails.mDSize  = QString((QChar*)tMemoryDetails.iDSize.Ptr(), tMemoryDetails.iDSize.Length());
-		memoryDetails.mHSize  = QString((QChar*)tMemoryDetails.iHSize.Ptr(), tMemoryDetails.iHSize.Length());
-	
-	if (tMemoryDetails.iENotAvailable == EFalse) {
-		memoryDetails.mESize  = QString((QChar*)tMemoryDetails.iESize.Ptr(), tMemoryDetails.iESize.Length());
-		memoryDetails.mENotAvailable = false;
-	}
-	else {
-		memoryDetails.mENotAvailable = true;
-	}
+	memoryDetails.mRamFree  = QString((QChar*)tMemoryDetails.iRamFree.Ptr(), tMemoryDetails.iRamFree.Length());
+	memoryDetails.mRamSize  = QString((QChar*)tMemoryDetails.iRamSize.Ptr(), tMemoryDetails.iRamSize.Length());
+
 	return memoryDetails;
 }
 
@@ -106,7 +114,7 @@
 
 // ---------------------------------------------------------------------------
 
-void EngineWrapper::ShowNote(const TDesC& aNoteMessage, TInt aResourceId)
+void EngineWrapper::ShowNote(const TDesC& aNoteMessage, TInt /*aResourceId*/)
 {
     QString note((QChar*)aNoteMessage.Ptr(),aNoteMessage.Length());
     Notifications::showGlobalNote(note, HbMessageBox::MessageTypeInformation, HbPopup::ConfirmationNoteTimeout);
@@ -117,6 +125,10 @@
 void EngineWrapper::ShowProgressBar(const TDesC& aPrompt, int aMax)
 {
 	QString text((QChar*)aPrompt.Ptr(), aPrompt.Length());
+	if(iProgressDialog){
+        delete iProgressDialog;
+        iProgressDialog = NULL;
+	}
     iProgressDialog = Notifications::showProgressBar(text, aMax);
 	connect(iProgressDialog, SIGNAL(cancelled()), this, SLOT(ProgressDialogCancelled()));
 }
@@ -125,47 +137,68 @@
 
 void EngineWrapper::IncrementProgressbarValue()
 {
-    iProgressDialog->setProgressValue(iProgressDialog->progressValue() + 1);
+    if(iProgressDialog)
+        iProgressDialog->setProgressValue(iProgressDialog->progressValue() + 1);
 }
 
 // ---------------------------------------------------------------------------
 
 void EngineWrapper::CloseProgressbar()
 {
-    delete iProgressDialog;
-    iProgressDialog = 0;
+    if(iProgressDialog){
+        disconnect(iProgressDialog, SIGNAL(cancelled()), this, SLOT(ProgressDialogCancelled()));
+        delete iProgressDialog;
+        iProgressDialog = NULL;
+    }
 }
 
 // ---------------------------------------------------------------------------
 
-TBool EngineWrapper::EntriesQueryDialog(TInt& aNumberOfEntries, const TDesC& aPrompt, TBool aAcceptsZero)
+TBool EngineWrapper::EntriesQueryDialog(TInt* aNumberOfEntries, const TDesC& aPrompt, TBool aAcceptsZero, MUIObserver* observer, int userData)
     {
 	QString text((QChar*)aPrompt.Ptr(), aPrompt.Length());
-    bool err = Notifications::entriesQueryDialog(aNumberOfEntries, text, aAcceptsZero);
-	return err;
+	TBool success(EFalse);
+    try{
+        CreatorInputDialog::launch(text, aNumberOfEntries, aAcceptsZero ? true : false, observer, userData);
+        success = ETrue;
+    }
+    catch (std::exception& e)
+        {
+        Notifications::error( QString("exception: ")+e.what() );
+        }
+	return success;
     }
 	
 // ---------------------------------------------------------------------------	
 
-TBool EngineWrapper::TimeQueryDialog(TTime aTime, const TDesC& aPrompt)
+TBool EngineWrapper::TimeQueryDialog(TTime* aTime, const TDesC& aPrompt, MUIObserver* observer, int userData)
     {
-    // TTime to QDate
-    TBuf<20> timeString;
-    _LIT(KDateString,"%D%M%Y%/0%1%/1%2%/2%3%/3");
-    TRAP_IGNORE( aTime.FormatL(timeString, KDateString) );
-    QString temp = QString::fromUtf16(timeString.Ptr(), timeString.Length());
-    temp.replace(QChar('/'), QChar('-'));
-    QDate date = QDate::fromString(temp, "dd-MM-yyyy");
-
-	QString text((QChar*)aPrompt.Ptr(), aPrompt.Length());
-    bool err = Notifications::timeQueryDialog(date, text);
-	return err;
+    QString text((QChar*)aPrompt.Ptr(), aPrompt.Length());
+    TBool success(EFalse);
+    try{
+        CreatorDateTimeDialog::launch(text, aTime, observer, userData); 
+        success = ETrue;
+    }
+    catch (std::exception& e)
+        {
+        Notifications::error( QString("exception: ")+e.what() );
+        }
+    return success;
     }
 
-TBool EngineWrapper::YesNoQueryDialog(const TDesC& aPrompt)
+TBool EngineWrapper::YesNoQueryDialog(const TDesC& aPrompt, MUIObserver* observer, int userData)
 {
 	QString text((QChar*)aPrompt.Ptr(), aPrompt.Length());
-    return Notifications::yesNoQueryDialog(text);	
+	TBool success(EFalse);
+    try{
+        CreatorYesNoDialog::launch(text, "", observer, userData);	
+        success = ETrue;
+    }
+    catch (std::exception& e)
+        {
+        Notifications::error( QString("exception: ")+e.what() );
+        }
+    return success;
 }
  
 // ---------------------------------------------------------------------------	
@@ -177,16 +210,12 @@
 		TRAP(err, iEngine->RunScriptL());
 	}
 	else if (commandId == ECmdSelectRandomDataFile) {
-		TFileName filename;
 		TBool ret = EFalse;
-		TRAP(err, ret = iEngine->GetRandomDataFilenameL(filename));
-		if (err != KErrNone) {
+		TRAP(err, ret = iEngine->GetRandomDataL());
+		if ( err != KErrNone || ret == EFalse ) {
 			Notifications::error("Error in getting random data.");
 			return false;
 		}		
-		if (ret == true) {
-			TRAP(err, iEngine->GetRandomDataFromFileL(filename));
-		}
 	}
     else {
 		TRAP(err, iEngine->ExecuteOptionsMenuCommandL(commandId));
@@ -202,7 +231,7 @@
 
 // ---------------------------------------------------------------------------	
 
-bool EngineWrapper::PopupListDialog(const TDesC& aPrompt, CDesCArray* aFileNameArray, TInt& aIndex) 
+TBool EngineWrapper::PopupListDialog(const TDesC& aPrompt, const CDesCArray* aFileNameArray, TInt* aIndex, MUIObserver* aObserver, TInt aUserData) 
 {
 	QString text((QChar*)aPrompt.Ptr(), aPrompt.Length());
 	QStringList itemList;
@@ -212,23 +241,33 @@
 				  aFileNameArray->MdcaPoint(i).Ptr(),
 				  aFileNameArray->MdcaPoint(i).Length()));
 	}
-	// TODO: HbSelectionDialog handle close & user choice
-	Notifications::popupListDialog(text, itemList, HbAbstractItemView::SingleSelection);
-	return false;
+	TBool success(EFalse);
+    try{
+        CreatorSelectionDialog::launch(text, itemList, aIndex, aObserver, aUserData);
+	    success = ETrue;
+    }
+    catch (std::exception& e)
+        {
+        Notifications::error( QString("exception: ")+e.what() );
+        }
+    return success;
 }
 
 // ---------------------------------------------------------------------------	
 
-bool EngineWrapper::DirectoryQueryDialog(const TDesC& aPrompt, TFileName& aDirectory)
+TBool EngineWrapper::DirectoryQueryDialog(const TDesC& aPrompt, TDes& aDirectory, MUIObserver* aObserver, TInt aUserData)
 {
 	QString text((QChar*)aPrompt.Ptr(), aPrompt.Length());
-	QString directory = QString((QChar*)aDirectory.Ptr(), aDirectory.Length());
-	bool ret = Notifications::directoryQueryDialog(text, directory);
-	if (ret == true) {
-		aDirectory = TFileName(directory.utf16());
-	}
-	return ret;
-
+	TBool success(EFalse);
+    try{
+        CreatorInputDialog::launch(text, aDirectory, aObserver, aUserData);
+        success = ETrue;
+    }
+    catch (std::exception& e)
+        {
+        Notifications::error( QString("exception: ")+e.what() );
+        }
+    return success;
 }
 
 
@@ -246,7 +285,7 @@
 
 // ---------------------------------------------------------------------------
 
-bool EngineWrapper::ListQueryDialog(const TDesC& aPrompt, TListQueryId aId, TInt& aIndex)
+TBool EngineWrapper::ListQueryDialog(const TDesC& aPrompt, TListQueryId aId, TInt* aIndex, MUIObserver* aObserver, TInt aUserData)
 {
 	bool ret = false;
 	QString text((QChar*)aPrompt.Ptr(), aPrompt.Length());
@@ -292,35 +331,42 @@
 			return ret;
 		}
 	}
-    // TODO: HbSelectionDialog handle close & user choice
-    Notifications::popupListDialog(text, itemList, HbAbstractItemView::SingleSelection);
-    return false;
-
+	TBool success(EFalse);
+    try{
+        CreatorSelectionDialog::launch(text, itemList, aIndex, aObserver, aUserData);
+        success = ETrue;
+    }
+    catch (std::exception& e)
+        {
+        Notifications::error( QString("exception: ")+e.what() );
+        }
+    return success;
 }
 
-bool EngineWrapper::ListQueryDialog(const TDesC& aPrompt, TListQueryId aId, CArrayFixFlat<TInt>* aIndexes)
+TBool EngineWrapper::ListQueryDialog(const TDesC& aPrompt, TListQueryId aId, CArrayFixFlat<TInt>* aSelectedItems, MUIObserver* aObserver, TInt aUserData)
 {
-	bool ret = false;
+    TBool success(EFalse);
+	QStringList itemList;
 	QString text((QChar*)aPrompt.Ptr(), aPrompt.Length());
-	QStringList itemList;
-	QList<int> indexes;
 	if (aId == R_ATTACHMENT_MULTI_SELECTION_QUERY) {
-		itemList << "None" << "JPEG 25kB" << "JPEG 300kB" << "JPEG 500kB" << "PNG 15kB" << "GIF 2kB" << "RNG 1kB" 
-			<< "MIDI 10kB" << "WAVE 20kB" << "AMR 20kB" << "Excel 15kB" << "Word 20kB" << "PowerPoint 40kB" 
-			<< "Text 10kB" << "Text 70kB" << "3GPP 70kB" << "MP3 250kB" << "AAC 100kB" << "RM 95kB";
-
-		//ret = Notifications::popupListDialog(text, itemList, indexes);
-		// TODO: HbSelectionDialog handle close & user choice
-		Notifications::popupListDialog(text, itemList, HbAbstractItemView::MultiSelection);
-
-		if (ret == true) {
-			aIndexes->Reset();
-			for (int i = 0; i < indexes.count(); i++) {
-				aIndexes->AppendL(indexes.at(i));
-			}
-		}
+       itemList << "None" << "JPEG 25kB" << "JPEG 300kB" << "JPEG 500kB" << "PNG 15kB" << "GIF 2kB" << "RNG 1kB" 
+           << "MIDI 10kB" << "WAVE 20kB" << "AMR 20kB" << "Excel 15kB" << "Word 20kB" << "PowerPoint 40kB" 
+           << "Text 10kB" << "Text 70kB" << "3GPP 70kB" << "MP3 250kB" << "AAC 100kB" << "RM 95kB";
 	}
-	return ret;			
+	else{
+        Notifications::error("Error in resource id.");
+        return EFalse;
+    }
+	
+    try{
+        CreatorSelectionDialog::launch(text, itemList, aSelectedItems, aObserver, aUserData);
+        success = ETrue;
+    }
+    catch (std::exception& e)
+        {
+        Notifications::error( QString("exception: ")+e.what() );
+        }
+    return success;
 }
 
 void EngineWrapper::CloseCreatorApp()
--- a/creator/src/mainview.cpp	Fri Jun 11 16:29:34 2010 +0100
+++ b/creator/src/mainview.cpp	Thu Jul 22 16:33:59 2010 +0100
@@ -509,30 +509,31 @@
     // get memory details from engine;
     mMemoryDetails = mEngineWrapper.GetMemoryDetails();
 	
-    if (layout != NULL) {
-        HbTextEdit* edit = new HbTextEdit(this);
-        if(edit != NULL) {
-			if (mMemoryDetails.mENotAvailable == false) {
-            edit->setPlainText(QString("\n\nFree RAM Memory:\n %1 of %2 kB \n\nFree disk memory: \nC: %3 of %4 kB \nD: %5 of %6 kB \nE: %7 of %8 kB")
-					.arg(mMemoryDetails.mHFree).arg(mMemoryDetails.mHSize)
-					.arg(mMemoryDetails.mCFree).arg(mMemoryDetails.mCSize)
-					.arg(mMemoryDetails.mDFree).arg(mMemoryDetails.mDSize)
-					.arg(mMemoryDetails.mEFree).arg(mMemoryDetails.mESize));
-			}
-			else {
-			edit->setPlainText(QString("\n\nFree RAM Memory:\n %1 of %2 kB \n\nFree disk memory: \nC: %3 of %4 kB \nD: %5 of %6 kB \nE: %7")
-					.arg(mMemoryDetails.mHFree).arg(mMemoryDetails.mHSize)
-					.arg(mMemoryDetails.mCFree).arg(mMemoryDetails.mCSize)
-					.arg(mMemoryDetails.mDFree).arg(mMemoryDetails.mDSize)
-					.arg(mMemoryDetails.mEFree));
-			}
-            edit->setReadOnly(true);
+    QList<MemoryDetails> memDet = mEngineWrapper.GetMemoryDetailsList();
+    
+    if (layout != NULL) 
+    	{
+		HbLabel* edit = new HbLabel(this);
+        //HbTextEdit* edit = new HbTextEdit(this);
+        if(edit != NULL) 
+        	{
+        QString text = QString("<BR><BR>Free RAM Memory:<BR> %1 of %2 kB").arg(mMemoryDetails.mRamFree).arg(mMemoryDetails.mRamSize);	
+        //QString text = QString("\n\nFree RAM Memory:\n %1 of %2 kB").arg(mMemoryDetails.mRamFree).arg(mMemoryDetails.mRamSize);
+			for(int i=0 ; i < memDet.count() ; i++ )
+				{
+			text += QString("<BR><BR>Free %1: Memory:<BR> %2 of %3 kB").arg(memDet[i].mDriveLetter).arg(memDet[i].mFree).arg(memDet[i].mSize);//text += QString("\n\nFree %1: Memory:\n %2 of %3 kB").arg(memDet[i].mDriveLetter).arg(memDet[i].mFree).arg(memDet[i].mSize);
+				}
+			edit->setTextWrapping(Hb::TextWordWrap);
+			edit->setHtml(text);
+			//edit->setPlainText(text);
+                	
+            //edit->setReadOnly(true);
             //edit->setCursorHidden(true);
-            //edit->setAttribute(Qt::WA_InputMethodEnabled, false);
+            edit->setAttribute(Qt::WA_InputMethodEnabled, false);
             layout->addItem(edit);
             layout->setContentsMargins(5, 5, 5, 5);
             this->setLayout(layout);
-        }
+        	}
         
     }
     
--- a/creator/src/notifications.cpp	Fri Jun 11 16:29:34 2010 +0100
+++ b/creator/src/notifications.cpp	Thu Jul 22 16:33:59 2010 +0100
@@ -24,10 +24,12 @@
 #include <hbvalidator.h>
 #include <hbabstractitemview.h>
 #include <hbprogressdialog.h>
+#include <hbdatetimepicker.h>
 
 #include <QString>
 #include <QDate>
 #include <QRegExp>
+#include <QList>
 
 #include "notifications.h"
 
@@ -52,7 +54,7 @@
 void Notifications::about()
 {
     showMessageBox(HbMessageBox::MessageTypeInformation,
-        "Version 6.0.0 - April 23rd 2010. Copyright © 2010 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. Licensed under Eclipse Public License v1.0.",
+        "Version 6.1.0 - June 18th 2010. Copyright © 2010 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. Licensed under Eclipse Public License v1.0.",
         "About Creator", 
         HbPopup::NoTimeout
         );
@@ -73,6 +75,7 @@
 	HbProgressDialog *note = new HbProgressDialog(HbProgressDialog::ProgressDialog);
     note->setText(text);
     note->setMaximum(max);
+    note->setAutoClose(false);
     note->show();
     return note;
 
@@ -85,151 +88,218 @@
     showMessageBox(type, text, QString("Creator"), timeout);
 }
 
-// ---------------------------------------------------------------------------
-
-bool Notifications::entriesQueryDialog(int& numberOfEntries, const QString& text, bool acceptsZero)
-{
-	bool err = false;
-	HbDialog *popup = new HbDialog();
-    popup->setDismissPolicy(HbPopup::TapOutside);
-    popup->setTimeout(HbPopup::NoTimeout);
-	
-	HbLabel *title = new HbLabel();
-    HbLineEdit *edit = new HbLineEdit();
-	HbAction *actionOk = new HbAction("Ok");
-	HbAction *actionCancel = new HbAction("Cancel");
-	
-	title->setPlainText(text);
-	popup->setHeadingWidget(title);
-	popup->setContentWidget(edit);
-	
-	HbValidator *validator = new HbValidator();
-	QString tmp;
-    if (acceptsZero == false) {
-		tmp.append("[1-9]{1}\\d{1,4}");
-	}
-	else {
-		tmp.append("^[0-9]{5}");
-	}
-        
-	QRegExp rxBasic(tmp);
-	validator->addField(new QRegExpValidator(rxBasic, 0), "");
-    edit->setValidator(validator);
-	edit->setText(QString::number(numberOfEntries));
-	edit->setSelection(0, QString::number(numberOfEntries).length());
-	
-	popup->setPrimaryAction(actionOk);
-    popup->setSecondaryAction(actionCancel);
-
-    // Launch popup syncronously
-    popup->setAttribute(Qt::WA_DeleteOnClose);
-    // TODO: handle dialog close & user input
-    popup->open();
-
-	// continue if ok selected and valid user input exists in line editor
-    /*if (action && action->text() == "Ok" && edit->text() != "") {
-		numberOfEntries = edit->text().toInt(&err, 10);
-	}*/
-	return err;
-}
-
-// ---------------------------------------------------------------------------
-bool Notifications::timeQueryDialog(QDate& date, const QString& text)
-{
-	bool err = false;
-    HbDialog *popup = new HbDialog();
-    popup->setDismissPolicy(HbPopup::TapOutside);
-    popup->setTimeout(HbPopup::NoTimeout);
-	
-	HbLabel *title = new HbLabel();
-    HbLineEdit *edit = new HbLineEdit();
-	HbAction *actionOk = new HbAction("Ok");
-	HbAction *actionCancel = new HbAction("Cancel");
-    
-	title->setPlainText(text);
-	popup->setHeadingWidget(title);
-	popup->setContentWidget(edit);
-
-    HbValidator *validator =new HbValidator;
-    QString dateString("(0[1-9]|[12][0-9]|3[01])[/](0[1-9]|1[012])[/](19|20)\\d\\d");
-	QRegExp rxDate(dateString);
-	validator->addField(new QRegExpValidator(rxDate, 0), "");
-    edit->setValidator(validator);
-	edit->setText(date.toString());
-	edit->setSelection(0, date.toString().length());
-
-    
-	popup->setPrimaryAction(actionOk);
-    popup->setSecondaryAction(actionCancel);
-
-    // Launch popup syncronously
-    popup->setAttribute(Qt::WA_DeleteOnClose);
-    // TODO: handle dialog close & user input
-    popup->open();
-
-	// continue if ok selected and valid user input exists in line editor
-    /*if (action && action->text() == "Ok" && edit->text() != "") {
-		date = QDate::fromString(edit->text());
-        err = true;
-	}*/
-	return err;    
-}
 
 // ---------------------------------------------------------------------------
 
-bool Notifications::yesNoQueryDialog(const QString& text)
+CreatorYesNoDialog::CreatorYesNoDialog(MUIObserver* observer, int userData) : 
+    HbMessageBox(HbMessageBox::MessageTypeQuestion, NULL),
+    CreatorDialog(observer, userData)
+{
+}
+
+void CreatorYesNoDialog::launch(const QString& text, const QString& label, MUIObserver* observer, int userData) throw(std::exception)
+{
+    CreatorYesNoDialog* dlg = new CreatorYesNoDialog(observer, userData);
+    dlg->setText(text);
+    if(label.length())
+        dlg->setHeadingWidget(new HbLabel(label, dlg));
+    dlg->setAttribute(Qt::WA_DeleteOnClose);
+    dlg->setTimeout(HbPopup::NoTimeout);
+    dlg->open(dlg, SLOT(DialogClosed(HbAction*)));
+}
+
+void CreatorYesNoDialog::DialogClosed(HbAction *action)
 {
-    HbMessageBox::question(text, 0, 0);
-    return false;
+    TBool PositiveAction(EFalse);
+    if(action && (action->softKeyRole()==QAction::PositiveSoftKey || !action->text().compare("yes", Qt::CaseInsensitive))){
+        PositiveAction = ETrue;
+    }
+    NotifyObserver(PositiveAction);
+}
+
+CreatorInputDialog::CreatorInputDialog(int* value, MUIObserver* module, int userData) : 
+    HbInputDialog(NULL),
+    CreatorDialog(module, userData),
+    mIntValue(value), 
+    mStrValue(mDummy)// will not be used
+{
+    if(!value)
+        throw std::invalid_argument("value cannot be the null!");
+}
+
+CreatorInputDialog::CreatorInputDialog(TDes& value, MUIObserver* module, int userData) : 
+    HbInputDialog(NULL),
+    CreatorDialog(module, userData),
+    mIntValue(NULL),
+    mStrValue(value)
+{
 }
 
-// ---------------------------------------------------------------------------
+void CreatorInputDialog::launch(const QString& label, int* value, bool acceptsZero, MUIObserver* observer, int userData) throw( std::exception )
+{
+    CreatorInputDialog* dlg = new CreatorInputDialog(value, observer, userData);
+    dlg->setPromptText(label);
+    dlg->setInputMode(IntInput);
+    HbValidator *validator = new HbValidator(dlg);
+    QString tmp;
+    if (acceptsZero == false) {
+        tmp.append("[1-9]{1}\\d{1,4}");
+    }
+    else {
+        tmp.append("^[0-9]{5}");
+    }
+        
+    QRegExp rxBasic(tmp);
+    validator->addField(new QRegExpValidator(rxBasic, 0), "");
+    dlg->setValidator(validator);
+    dlg->setValue(QVariant(*value));
+    dlg->lineEdit()->setSelection(0, dlg->value().toString().length());
+    dlg->setAttribute(Qt::WA_DeleteOnClose);
+    dlg->open(dlg, SLOT(DialogClosed(HbAction*)));
+}
 
-void Notifications::popupListDialog(const QString& text, QStringList& items, HbAbstractItemView::SelectionMode mode, QObject* receiver, const char* member)
+void CreatorInputDialog::launch(const QString& label, TDes& value, MUIObserver* observer, int userData) throw( std::exception )
 {
-	HbSelectionDialog *dlg = new HbSelectionDialog;
-	dlg->setHeadingWidget(new HbLabel(text, dlg));
-	dlg->setStringItems(items);
-	dlg->setSelectionMode(mode); 
-	dlg->setAttribute(Qt::WA_DeleteOnClose);
-	dlg->open(receiver, member);
+    CreatorInputDialog* dlg = new CreatorInputDialog(value, observer, userData);
+    dlg->setPromptText(label);
+    dlg->lineEdit()->setMaxLength(value.MaxLength());
+    dlg->setValue(QString::fromUtf16(value.Ptr(), value.Length()));
+    dlg->lineEdit()->setSelection(0, dlg->value().toString().length());
+    dlg->setInputMode(TextInput);
+    dlg->setAttribute(Qt::WA_DeleteOnClose);
+    dlg->open(dlg, SLOT(DialogClosed(HbAction*)));
+}
+
+void CreatorInputDialog::DialogClosed(HbAction *action)
+{
+    TBool PositiveAction(EFalse);
+    if(action && (action->softKeyRole()==QAction::PositiveSoftKey || !action->text().compare("ok", Qt::CaseInsensitive))){
+        bool ok = true;
+        if( inputMode() == IntInput )
+            *mIntValue = value().toInt(&ok);
+        else if( inputMode() == TextInput && mStrValue.MaxLength() >= value().toString().length() )
+            mStrValue.Copy(value().toString().utf16());
+        else
+            ok = false;
+        PositiveAction = ok ? ETrue : EFalse;
+    }
+    NotifyObserver(PositiveAction);
+}
+
+CreatorSelectionDialog::CreatorSelectionDialog(int* selectedItem, MUIObserver* observer, int userData) throw(std::exception) : 
+    HbSelectionDialog(NULL),
+    CreatorDialog(observer, userData),
+    mSelectedItem(selectedItem),
+    mSelectedItems(NULL)
+{
+    if(!mSelectedItem)
+        throw std::invalid_argument("selectedItem cannot be null!");
 }
 
-// ---------------------------------------------------------------------------
+CreatorSelectionDialog::CreatorSelectionDialog(CArrayFixFlat<TInt>* selectedItems, MUIObserver* observer, int userData) throw(std::exception) : 
+    HbSelectionDialog(NULL),
+    CreatorDialog(observer, userData),
+    mSelectedItem(NULL),
+    mSelectedItems(selectedItems)
+{
+    if(!mSelectedItems)
+        throw std::invalid_argument("selectedItems cannot be null!");
+}
 
-bool Notifications::directoryQueryDialog(const QString& text, QString& directory)
+void CreatorSelectionDialog::launch(const QString& label, const QStringList& items, int* selectedItem, MUIObserver* observer, int userData) throw(std::exception)
 {
-	bool err = false;
-    HbDialog *popup = new HbDialog();
-    popup->setDismissPolicy(HbPopup::TapOutside);
-    popup->setTimeout(HbPopup::NoTimeout);
-	
-	HbLabel *title = new HbLabel();
-    HbLineEdit *edit = new HbLineEdit();
-	HbAction *actionOk = new HbAction("Ok");
-	HbAction *actionCancel = new HbAction("Cancel");
-	
-	title->setPlainText(text);
-	popup->setHeadingWidget(title);
-	popup->setContentWidget(edit);
-	edit->setMaxLength(256);
-	edit->setText(directory);
-	edit->setSelection(0, directory.length());
-	
-	popup->setPrimaryAction(actionOk);
-    popup->setSecondaryAction(actionCancel);
+    CreatorSelectionDialog* dlg = new CreatorSelectionDialog(selectedItem, observer, userData);
+    if(label.length())
+        dlg->setHeadingWidget(new HbLabel(label, dlg));
+    dlg->setStringItems(items);
+    dlg->setSelectionMode(HbAbstractItemView::SingleSelection); 
+    dlg->setAttribute(Qt::WA_DeleteOnClose);
+    dlg->open(dlg, SLOT(DialogClosed(HbAction*)));
+}
 
-    // Launch popup syncronously
-    popup->setAttribute(Qt::WA_DeleteOnClose);
-    // TODO: handle dialog close & user input
-    popup->open();
-
-	// continue if ok selected and valid user input exists in line editor
-    /*if (action && action->text() == "Ok" && edit->text() != "") {
-		directory = edit->text();
-		err = true;
-	}*/
-	return err;
+void CreatorSelectionDialog::launch(const QString& label, const QStringList& items, CArrayFixFlat<TInt>* selectedItems, MUIObserver* observer, int userData) throw(std::exception)
+{
+    CreatorSelectionDialog* dlg = new CreatorSelectionDialog(selectedItems, observer, userData);
+    if(label.length())
+        dlg->setHeadingWidget(new HbLabel(label, dlg));
+    dlg->setStringItems(items);
+    dlg->setSelectionMode(HbAbstractItemView::MultiSelection); 
+    dlg->setAttribute(Qt::WA_DeleteOnClose);
+    dlg->open(dlg, SLOT(DialogClosed(HbAction*)));
 }
 
-// ---------------------------------------------------------------------------
+void CreatorSelectionDialog::DialogClosed(HbAction *action)
+{
+    TBool PositiveAction(EFalse);
+    //CreatorSelectionDialog* dlg = qobject_cast<CreatorSelectionDialog*>(sender());
+    if(!action || (action && action->softKeyRole()==QAction::SelectSoftKey) || (action && !action->text().compare("ok", Qt::CaseInsensitive))){
+        if(selectedItems().count()){
+            try{
+                if( selectionMode() == HbAbstractItemView::SingleSelection && mSelectedItem){
+                    bool ok(false);
+                    *mSelectedItem = selectedItems().at(0).toInt(&ok);
+                    if(!ok)
+                        throw std::invalid_argument("cannot obtain selected item!");
+                }
+                if( selectionMode() == HbAbstractItemView::MultiSelection && mSelectedItems){
+                    QList<QVariant> items = selectedItems();
+                    foreach( QVariant item, items){
+                        QT_TRAP_THROWING( mSelectedItems->AppendL( item.toInt() ) );
+                    }
+                }
+                PositiveAction = ETrue;
+            }
+            catch (std::exception& e){
+                Notifications::error( QString("exception: ")+e.what() );
+            }
+        }
+    }
+    NotifyObserver(PositiveAction);
+}
+
+CreatorDateTimeDialog::CreatorDateTimeDialog(TTime* value, MUIObserver* observer, int userData) : 
+    HbDialog(NULL),
+    CreatorDialog(observer, userData),
+    mValue(value)
+{
+}
+
+void CreatorDateTimeDialog::launch(const QString& label, TTime* value, MUIObserver* observer, int userData) throw( std::exception )
+{
+    CreatorDateTimeDialog* dlg = new CreatorDateTimeDialog(value, observer, userData);
+    if(!value)
+        throw std::invalid_argument("value cannot be the null!");
+    if(label.length())
+        dlg->setHeadingWidget( new HbLabel(label, dlg) );
+    
+    // TTime to QDate
+    TBuf<20> timeString;
+    _LIT(KDateString,"%D%M%Y%/0%1%/1%2%/2%3%/3");
+    TRAP_IGNORE( value->FormatL(timeString, KDateString) );
+    QString temp = QString::fromUtf16(timeString.Ptr(), timeString.Length());
+    temp.replace(QChar('/'), QChar('-'));
+    QDate date = QDate::fromString(temp, "dd-MM-yyyy");
+    HbDateTimePicker* widget = new HbDateTimePicker( date, dlg );
+    dlg->setContentWidget( widget );
+    dlg->addAction(new HbAction("Ok", dlg));
+    dlg->addAction(new HbAction("Cancel", dlg));
+    dlg->setModal(true); // Dialog is modal  
+    dlg->setAttribute(Qt::WA_DeleteOnClose);
+    dlg->setTimeout(HbPopup::NoTimeout);
+    dlg->open(dlg, SLOT(DialogClosed(HbAction*)));
+}
+
+void CreatorDateTimeDialog::DialogClosed(HbAction *action)
+{
+    TBool PositiveAction(EFalse);
+    if(action && (action->softKeyRole()==QAction::PositiveSoftKey || !action->text().compare("ok", Qt::CaseInsensitive))){
+        QString str = qobject_cast<HbDateTimePicker*>(contentWidget())->date().toString(Qt::ISODate);
+        str.remove('-');
+        str += ":000000";// 0h 0m 0s
+        TBuf<30> dateTimeString(str.utf16());
+        mValue->Set(dateTimeString);
+        PositiveAction = ETrue;
+    }
+    NotifyObserver(PositiveAction);
+}
+//End of File
--- a/filebrowser/engine/FB.hrh	Fri Jun 11 16:29:34 2010 +0100
+++ b/filebrowser/engine/FB.hrh	Thu Jul 22 16:33:59 2010 +0100
@@ -274,4 +274,15 @@
     EFileChecksumsSHA1
     };
 
+enum TListingMode
+    {
+    ENormalEntries = 0,
+    ESearchResults,
+    EOpenFiles,
+    EMsgAttachmentsInbox,
+    EMsgAttachmentsDrafts,
+    EMsgAttachmentsSentItems,
+    EMsgAttachmentsOutbox
+    };
+
 #endif      // FILEBROWSER_HRH
--- a/filebrowser/engine/FBFileOps.cpp	Fri Jun 11 16:29:34 2010 +0100
+++ b/filebrowser/engine/FBFileOps.cpp	Thu Jul 22 16:33:59 2010 +0100
@@ -254,6 +254,8 @@
                                 }
                             else
                                 {
+                                // ensure that root target folder exists
+                                BaflUtils::EnsurePathExistsL(iFs, iBuf2);
                                 // otherwise copy the file
                                 FileOpCopy(fullSourcePath, fullTargetPath, iUint1);
                                 }
@@ -331,7 +333,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 )
@@ -380,17 +386,13 @@
         iBuf2.Copy(targetPath);
         iUint1 = newSwitch;
         
-        // create initial directory - if it does not succeed, do not even try to continue
-        err = FileOpMkDirAll(targetPath, aSourceEntry.iEntry.iAtt);
-        
-        if (iOperationError == KErrNone)
+        TRAP(err, DoFindEntries(_L("*"), sourcePath));              // entries under current directory entry
+        if ( iFileManObserverResult != MFileManObserver::ECancel )
             {
-            TRAP(err, DoFindEntries(_L("*"), sourcePath));              // entries under current directory entry
-            if ( iFileManObserverResult != MFileManObserver::ECancel )
-                {
-                TRAP(err, DoFindEntriesRecursiveL(_L("*"), sourcePath));    // recursively under directories of current directory entry
-                }
+            TRAP(err, DoFindEntriesRecursiveL(_L("*"), sourcePath));    // recursively under directories of current directory entry
             }
+        // a path has a trailing backslash so it needs to be removed before the call
+        err = FileOpAttribs(targetPath.Left(targetPath.Length()-1), aSourceEntry.iEntry.iAtt, 0, 0, 0);
         }
 
     else if (aSourceEntry.iEntry.IsDir())
--- a/filebrowser/engine/FBFileUtils.cpp	Fri Jun 11 16:29:34 2010 +0100
+++ b/filebrowser/engine/FBFileUtils.cpp	Thu Jul 22 16:33:59 2010 +0100
@@ -24,15 +24,16 @@
 
 #include <textresolver.h> 
 #include <eikprogi.h>
-#include <f32file.h>
+#include <e32svr.h>
 #include <eikfutil.h>
 #include <apparc.h>
+#include <apaid.h>
+#include <apaidpartner.h>
 #include <eikenv.h>
 #include <bautils.h>
 #include <gulicon.h>
-#include <aknconsts.h>
 #include <babackup.h> 
-#include <aknmemorycardui.mbg>
+//#include <aknmemorycardui.mbg>
 #include <sendui.h>
 #include <CMessageData.h>
 #include <ezgzip.h>
@@ -118,7 +119,7 @@
     iCurrentSelectionList = new(ELeave) CFileEntryList(64);
 
     iDocHandler = CDocumentHandler::NewL();
-    iDocHandler->SetExitObserver(this);
+//    iDocHandler->SetExitObserver(this);
     
     // set defaults to the search settings
     iSearchAttributes.iSearchDir = KNullDesC;
@@ -202,7 +203,7 @@
 
 // --------------------------------------------------------------------------------------------
 
-void CFileBrowserFileUtils::StartExecutingCommandsL(const TDesC& /*aLabel*/)
+void CFileBrowserFileUtils::StartExecutingCommandsL(const TDesC& aLabel)
     {
     if (iCommandArray->Count() >= 2)
         {
@@ -215,6 +216,8 @@
 //        iProgressInfo->SetFinalValue( CommandArrayCount() );
 //        iProgressDialog->RunLD();
 //        iProgressDialog->MakeVisible( ETrue );        
+        iEngine->FileBrowserUI()->ShowProgressDialog(aLabel, 0, CommandArrayCount());
+        isProgressDialog = ETrue;
         }
     else if (iCommandArray->Count() >= 1)
         {
@@ -224,6 +227,8 @@
 //        iWaitDialog->PrepareLC(R_GENERAL_WAIT_NOTE);
 //        iWaitDialog->SetTextL( aLabel );
 //        iWaitDialog->RunLD();
+        iEngine->FileBrowserUI()->ShowWaitDialog(aLabel);
+        isWaitDialog = ETrue;
         }
     else
         {
@@ -249,6 +254,15 @@
     __ASSERT_ALWAYS(!IsActive(), User::Panic(_L("FileUtils:IsActive"), 333));
 
     // execute a command after a very short delay (25ms)
+    if (isWaitDialog)
+        {
+        iEngine->FileBrowserUI()->ProcessEvents();
+        }
+    if (isProgressDialog)
+        {
+        TInt newValue = iCurrentEntry;
+        iEngine->FileBrowserUI()->SetProgressValue(newValue);
+        }
     iTimer.After(iStatus, 25);
     SetActive();
     }
@@ -363,6 +377,16 @@
         iFileOps->DeActivateSecureBackUpViaFileOp();
 
         // dismiss any wait/progress dialogs        
+        if (isWaitDialog)
+            {
+            iEngine->FileBrowserUI()->CancelWaitDialog();
+            isWaitDialog = EFalse;
+            }
+        if (isProgressDialog)
+            {
+            iEngine->FileBrowserUI()->CancelProgressDialog();
+            isProgressDialog = EFalse;
+            }
 //        if (iWaitDialog)
 //            {
 //            TRAP_IGNORE(iWaitDialog->ProcessFinishedL()); 
@@ -420,29 +444,29 @@
 
         RefreshViewL();
 
-		}
+            }
 	else
-		{
-		// maintain requests
-		iCurrentEntry++;
-
-        //LOGSTRING2("Creator: CCreatorEngine::CheckForMoreCommandsL iCurrentEntry=%d", iCurrentEntry);
-
-        ExecuteCommand();
-		}
+            {
+            // maintain requests
+            iCurrentEntry++;
+
+            //LOGSTRING2("Creator: CCreatorEngine::CheckForMoreCommandsL iCurrentEntry=%d", iCurrentEntry);
+
+            ExecuteCommand();
+            }
     }    
 // --------------------------------------------------------------------------------------------
 
 // This callback function is called when cancel button of the progress bar was pressed
-void CFileBrowserFileUtils::DialogDismissedL(TInt aButtonId)
+void CFileBrowserFileUtils::DialogDismissedL(/*TInt aButtonId*/)
     {
 //    iProgressDialog = NULL;
 //    iProgressInfo = NULL;
 //    iWaitDialog = NULL;
     
     // check if cancel button was pressed
-    if (aButtonId == EAknSoftkeyCancel)
-        {
+//    if (aButtonId == EAknSoftkeyCancel)
+//        {
         // cancel the active object, command executer 
         Cancel();
         
@@ -450,8 +474,10 @@
         
         ResetCommandArray();
 
+        isProgressDialog = EFalse;
+
         iEngine->FileBrowserUI()->ShowInformationNote(_L("Cancelled"), _L(""));
-        }
+//        }
     }
     
 // --------------------------------------------------------------------------------------------
@@ -607,22 +633,6 @@
 
 //    if (iEngine->FileListContainer())
 //        {
-        // update navi pane text        
-//        if (iListingMode == ENormalEntries)
-//            iEngine->FileListContainer()->SetNaviPaneTextL(iCurrentPath);
-//        else if (iListingMode == ESearchResults)
-//            iEngine->FileListContainer()->SetNaviPaneTextL(_L("Search results"));
-//        else if (iListingMode == EOpenFiles)
-//            iEngine->FileListContainer()->SetNaviPaneTextL(_L("Open files"));
-//        else if (iListingMode == EMsgAttachmentsInbox)
-//            iEngine->FileListContainer()->SetNaviPaneTextL(_L("Attachments in Inbox"));
-//        else if (iListingMode == EMsgAttachmentsDrafts)
-//            iEngine->FileListContainer()->SetNaviPaneTextL(_L("Attachments in Drafts"));
-//        else if (iListingMode == EMsgAttachmentsSentItems)
-//            iEngine->FileListContainer()->SetNaviPaneTextL(_L("Attachments in Sent Items"));
-//        else if (iListingMode == EMsgAttachmentsOutbox)
-//            iEngine->FileListContainer()->SetNaviPaneTextL(_L("Attachments in Outbox"));
-//
 //        // create a list box if it doesn't already exist
 //        if (!iEngine->FileListContainer()->ListBox())
 //            iEngine->FileListContainer()->CreateListBoxL(iEngine->Settings().iFileViewMode);
@@ -655,153 +665,153 @@
     
 // --------------------------------------------------------------------------------------------
 
-/*CAknIconArray* CFileBrowserFileUtils::GenerateIconArrayL(TBool aGenerateNewBasicIconArray)
-    {
-	// TODO
-	
-    CAknIconArray* iconArray = NULL;
-
-    if (aGenerateNewBasicIconArray)
-        {
-        iconArray = new(ELeave) CAknIconArray(16);    
-        }
-    else
-        {
-        if (iEngine->FileListContainer())
-            iconArray = iEngine->FileListContainer()->ListBoxIconArrayL();
-        
-        if (!iconArray)    
-            iconArray = new(ELeave) CAknIconArray(16);
-        }
-
-        
-    CleanupStack::PushL(iconArray);
-    
-    // generate basic items if not already existing
-    if (iconArray->Count() < EFixedIconListLength)
-        {
-        // reset arrays
-        iconArray->Reset();
-        iAppIconList->Reset();
-        
-        // get default control color
-        TRgb defaultColor;
-        defaultColor = iEngine->EikonEnv()->Color(EColorControlText);
-        
-        // create a color icon of the marking indicator
-        CFbsBitmap* markBitmap = NULL;
-        CFbsBitmap* markBitmapMask = NULL;
-
-        AknsUtils::CreateColorIconL(AknsUtils::SkinInstance(),
-                KAknsIIDQgnIndiMarkedAdd,
-                KAknsIIDQsnIconColors,
-                EAknsCIQsnIconColorsCG13,
-                markBitmap,
-                markBitmapMask,
-                AknIconUtils::AvkonIconFileName(),
-                EMbmAvkonQgn_indi_marked_add,
-                EMbmAvkonQgn_indi_marked_add_mask,
-                defaultColor
-                );
-         
-        // 0 marking indicator
-        CGulIcon* markIcon = CGulIcon::NewL(markBitmap, markBitmapMask);
-        iconArray->AppendL(markIcon);                       
-
-        // 1 empty
-        AppendGulIconToIconArrayL(iconArray, AknIconUtils::AvkonIconFileName(),
-                                  EMbmAvkonQgn_prop_empty, EMbmAvkonQgn_prop_empty_mask, KAknsIIDQgnPropEmpty);
-        // 2 phone memory
-        AppendGulIconToIconArrayL(iconArray, AknIconUtils::AvkonIconFileName(),
-                                  EMbmAvkonQgn_prop_phone_memc, EMbmAvkonQgn_prop_phone_memc_mask, KAknsIIDQgnPropPhoneMemc);
-        // 3 memory card
-        AppendGulIconToIconArrayL(iconArray, KMemoryCardUiBitmapFile,
-                                  EMbmAknmemorycarduiQgn_prop_mmc_memc, EMbmAknmemorycarduiQgn_prop_mmc_memc_mask, KAknsIIDQgnPropMmcMemc);
-        // 4 memory card disabled
-        AppendGulIconToIconArrayL(iconArray, KMemoryCardUiBitmapFile,
-                                  EMbmAknmemorycarduiQgn_prop_mmc_non, EMbmAknmemorycarduiQgn_prop_mmc_non_mask, KAknsIIDQgnPropMmcNon);
-        // 5 folder
-        AppendGulIconToIconArrayL(iconArray, AknIconUtils::AvkonIconFileName(),
-                                  EMbmAvkonQgn_prop_folder_small, EMbmAvkonQgn_prop_folder_small_mask, KAknsIIDQgnPropFolderSmall);
-        // 6 folder with subfolders
-        AppendGulIconToIconArrayL(iconArray, AknIconUtils::AvkonIconFileName(),
-                                  EMbmAvkonQgn_prop_folder_sub_small, EMbmAvkonQgn_prop_folder_sub_small_mask, KAknsIIDQgnPropFolderSubSmall);
-        // 7 current folder
-        AppendGulIconToIconArrayL(iconArray, AknIconUtils::AvkonIconFileName(),
-                                  EMbmAvkonQgn_prop_folder_current, EMbmAvkonQgn_prop_folder_current_mask, KAknsIIDQgnPropFolderCurrent);
-        }
-
-    // append custom icons if not in drive list view and setting is enabled
-    if (!aGenerateNewBasicIconArray && !IsDriveListViewActive() && iEngine->Settings().iShowAssociatedIcons)
-        {
-        // init id counter
-        TInt idCounter(EFixedIconListLength + iAppIconList->Count());
-        
-        // loop all items in the file list
-        for (TInt i=0; i<iFileEntryList->Count(); i++)
-            {
-            TFileEntry& fileEntry = iFileEntryList->At(i);
-
-            // just check for normal files            
-            if (!fileEntry.iEntry.IsDir())     
-                {
-                TUid appUid = GetAppUid(fileEntry);
-                TInt iconId = AppIconIdForUid(appUid);
-                
-                if (appUid != KNullUid && iconId == KErrNotFound)
-                    {
-                    // icon not found from the icon array, generate it
-                    CFbsBitmap* bitmap = NULL;
-                    CFbsBitmap* mask = NULL;
-                    CGulIcon* appIcon = NULL;
-        
-                    TRAPD(err, 
-                        AknsUtils::CreateAppIconLC(AknsUtils::SkinInstance(), appUid, EAknsAppIconTypeList, bitmap, mask);
-                        appIcon = CGulIcon::NewL(bitmap, mask);
-                        CleanupStack::Pop(2); //bitmap, mask
-                        );
-                         
-                    if (err == KErrNone)
-                        {
-                        TAppIcon appIconEntry;
-                        appIconEntry.iId = idCounter;
-                        appIconEntry.iUid = appUid;
-                        
-                        appIcon->SetBitmapsOwnedExternally(EFalse);
-                        iconArray->AppendL(appIcon);
-                        iAppIconList->AppendL(appIconEntry);
-
-                        fileEntry.iIconId = idCounter;
-                                                
-                        idCounter++;      
-                        }
-                    else
-                        {
-                        delete bitmap;
-                        delete mask;
-		
-                        TAppIcon appIconEntry;
-                        appIconEntry.iId = EFixedIconEmpty;
-                        appIconEntry.iUid = appUid;
-                        
-                        iAppIconList->AppendL(appIconEntry);
-                        }
-                    }
-
-                else if (appUid != KNullUid && iconId >= 0)
-                    {
-                    // we already have already generated an icon for this uid, use it
-                    fileEntry.iIconId = iconId;
-                    }
-                }
-            }
-        }
-
-    CleanupStack::Pop(); //iconArray
-	return iconArray;
-    
-	}
-*/
+//CAknIconArray* CFileBrowserFileUtils::GenerateIconArrayL(TBool aGenerateNewBasicIconArray)
+//    {
+//	// TODO
+//
+//    CAknIconArray* iconArray = NULL;
+//
+//    if (aGenerateNewBasicIconArray)
+//        {
+//        iconArray = new(ELeave) CAknIconArray(16);
+//        }
+//    else
+//        {
+//        if (iEngine->FileListContainer())
+//            iconArray = iEngine->FileListContainer()->ListBoxIconArrayL();
+//
+//        if (!iconArray)
+//            iconArray = new(ELeave) CAknIconArray(16);
+//        }
+//
+//
+//    CleanupStack::PushL(iconArray);
+//
+//    // generate basic items if not already existing
+//    if (iconArray->Count() < EFixedIconListLength)
+//        {
+//        // reset arrays
+//        iconArray->Reset();
+//        iAppIconList->Reset();
+//
+//        // get default control color
+//        TRgb defaultColor;
+//        defaultColor = iEngine->EikonEnv()->Color(EColorControlText);
+//
+//        // create a color icon of the marking indicator
+//        CFbsBitmap* markBitmap = NULL;
+//        CFbsBitmap* markBitmapMask = NULL;
+//
+//        AknsUtils::CreateColorIconL(AknsUtils::SkinInstance(),
+//                KAknsIIDQgnIndiMarkedAdd,
+//                KAknsIIDQsnIconColors,
+//                EAknsCIQsnIconColorsCG13,
+//                markBitmap,
+//                markBitmapMask,
+//                AknIconUtils::AvkonIconFileName(),
+//                EMbmAvkonQgn_indi_marked_add,
+//                EMbmAvkonQgn_indi_marked_add_mask,
+//                defaultColor
+//                );
+//
+//        // 0 marking indicator
+//        CGulIcon* markIcon = CGulIcon::NewL(markBitmap, markBitmapMask);
+//        iconArray->AppendL(markIcon);
+//
+//        // 1 empty
+//        AppendGulIconToIconArrayL(iconArray, AknIconUtils::AvkonIconFileName(),
+//                                  EMbmAvkonQgn_prop_empty, EMbmAvkonQgn_prop_empty_mask, KAknsIIDQgnPropEmpty);
+//        // 2 phone memory
+//        AppendGulIconToIconArrayL(iconArray, AknIconUtils::AvkonIconFileName(),
+//                                  EMbmAvkonQgn_prop_phone_memc, EMbmAvkonQgn_prop_phone_memc_mask, KAknsIIDQgnPropPhoneMemc);
+//        // 3 memory card
+//        AppendGulIconToIconArrayL(iconArray, KMemoryCardUiBitmapFile,
+//                                  EMbmAknmemorycarduiQgn_prop_mmc_memc, EMbmAknmemorycarduiQgn_prop_mmc_memc_mask, KAknsIIDQgnPropMmcMemc);
+//        // 4 memory card disabled
+//        AppendGulIconToIconArrayL(iconArray, KMemoryCardUiBitmapFile,
+//                                  EMbmAknmemorycarduiQgn_prop_mmc_non, EMbmAknmemorycarduiQgn_prop_mmc_non_mask, KAknsIIDQgnPropMmcNon);
+//        // 5 folder
+//        AppendGulIconToIconArrayL(iconArray, AknIconUtils::AvkonIconFileName(),
+//                                  EMbmAvkonQgn_prop_folder_small, EMbmAvkonQgn_prop_folder_small_mask, KAknsIIDQgnPropFolderSmall);
+//        // 6 folder with subfolders
+//        AppendGulIconToIconArrayL(iconArray, AknIconUtils::AvkonIconFileName(),
+//                                  EMbmAvkonQgn_prop_folder_sub_small, EMbmAvkonQgn_prop_folder_sub_small_mask, KAknsIIDQgnPropFolderSubSmall);
+//        // 7 current folder
+//        AppendGulIconToIconArrayL(iconArray, AknIconUtils::AvkonIconFileName(),
+//                                  EMbmAvkonQgn_prop_folder_current, EMbmAvkonQgn_prop_folder_current_mask, KAknsIIDQgnPropFolderCurrent);
+//        }
+//
+//    // append custom icons if not in drive list view and setting is enabled
+//    if (!aGenerateNewBasicIconArray && !IsDriveListViewActive() && iEngine->Settings().iShowAssociatedIcons)
+//        {
+//        // init id counter
+//        TInt idCounter(EFixedIconListLength + iAppIconList->Count());
+//
+//        // loop all items in the file list
+//        for (TInt i=0; i<iFileEntryList->Count(); i++)
+//            {
+//            TFileEntry& fileEntry = iFileEntryList->At(i);
+//
+//            // just check for normal files
+//            if (!fileEntry.iEntry.IsDir())
+//                {
+//                TUid appUid = GetAppUid(fileEntry);
+//                TInt iconId = AppIconIdForUid(appUid);
+//
+//                if (appUid != KNullUid && iconId == KErrNotFound)
+//                    {
+//                    // icon not found from the icon array, generate it
+//                    CFbsBitmap* bitmap = NULL;
+//                    CFbsBitmap* mask = NULL;
+//                    CGulIcon* appIcon = NULL;
+//
+//                    TRAPD(err,
+//                        AknsUtils::CreateAppIconLC(AknsUtils::SkinInstance(), appUid, EAknsAppIconTypeList, bitmap, mask);
+//                        appIcon = CGulIcon::NewL(bitmap, mask);
+//                        CleanupStack::Pop(2); //bitmap, mask
+//                        );
+//
+//                    if (err == KErrNone)
+//                        {
+//                        TAppIcon appIconEntry;
+//                        appIconEntry.iId = idCounter;
+//                        appIconEntry.iUid = appUid;
+//
+//                        appIcon->SetBitmapsOwnedExternally(EFalse);
+//                        iconArray->AppendL(appIcon);
+//                        iAppIconList->AppendL(appIconEntry);
+//
+//                        fileEntry.iIconId = idCounter;
+//
+//                        idCounter++;
+//                        }
+//                    else
+//                        {
+//                        delete bitmap;
+//                        delete mask;
+//
+//                        TAppIcon appIconEntry;
+//                        appIconEntry.iId = EFixedIconEmpty;
+//                        appIconEntry.iUid = appUid;
+//
+//                        iAppIconList->AppendL(appIconEntry);
+//                        }
+//                    }
+//
+//                else if (appUid != KNullUid && iconId >= 0)
+//                    {
+//                    // we already have already generated an icon for this uid, use it
+//                    fileEntry.iIconId = iconId;
+//                    }
+//                }
+//            }
+//        }
+//
+//    CleanupStack::Pop(); //iconArray
+//	return iconArray;
+//
+//	}
+//
 // --------------------------------------------------------------------------------------------
 
 //void CFileBrowserFileUtils::AppendGulIconToIconArrayL(CAknIconArray* aIconArray, const TDesC& aIconFile, TInt aIconId, TInt aMaskId, const TAknsItemID aAknsItemId)
@@ -1369,8 +1379,9 @@
     // update view
     RefreshViewL();
     
-    if ( iEngine->Settings().iRememberFolderSelection &&
-         iEngine->FileListContainer() && iPrevFolderIndex > KErrNotFound )
+    if (iEngine->Settings().iRememberFolderSelection
+        //&& iEngine->FileListContainer()
+        && iPrevFolderIndex > KErrNotFound )
         {
         
 //        TInt visibleItems = iEngine->FileListContainer()->ListBox()->Rect().Height() /
@@ -1960,46 +1971,48 @@
 //    if (dlgResult)
 //        {
 //        iEngine->EikonEnv()->BusyMsgL(_L("** Searching **"), TGulAlignment(EHCenterVTop));
-//
-//        iFileEntryList->Reset();
-//
-//        // if search dir is empty, find from all drives
-//        if (iSearchAttributes.iSearchDir == KNullDesC)
-//            {
-//            for (TInt i=0; i<iDriveEntryList->Count(); i++)
-//                {
-//                TDriveEntry driveEntry = iDriveEntryList->At(i);
-//
-//                TBuf<10> driveRoot;
-//                driveRoot.Append(driveEntry.iLetter);
-//                driveRoot.Append(_L(":\\"));
-//
-//                DoSearchFiles(iSearchAttributes.iWildCards, driveRoot);
-//
-//                if (iSearchAttributes.iRecurse)
-//                    DoSearchFilesRecursiveL(iSearchAttributes.iWildCards, driveRoot);
-//
-//                }
-//
-//            }
-//
-//        // otherwise just search from the selected directory
-//        else
-//            {
-//            DoSearchFiles(iSearchAttributes.iWildCards, iSearchAttributes.iSearchDir);
-//
-//            if (iSearchAttributes.iRecurse)
-//                DoSearchFilesRecursiveL(iSearchAttributes.iWildCards, iSearchAttributes.iSearchDir);
-//            }
-//
+
+
+        iEngine->FileBrowserUI()->ShowWaitDialog(_L("Searching"));
+        iFileEntryList->Reset();
+
+        // if search dir is empty, find from all drives
+        if (iSearchAttributes.iSearchDir == KNullDesC)
+            {
+            for (TInt i=0; i<iDriveEntryList->Count(); i++)
+                {
+                TDriveEntry driveEntry = iDriveEntryList->At(i);
+
+                TBuf<10> driveRoot;
+                driveRoot.Append(driveEntry.iLetter);
+                driveRoot.Append(_L(":\\"));
+
+                DoSearchFiles(iSearchAttributes.iWildCards, driveRoot);
+
+                if (iSearchAttributes.iRecurse)
+                    DoSearchFilesRecursiveL(iSearchAttributes.iWildCards, driveRoot);
+                }
+
+            }
+
+        // otherwise just search from the selected directory
+        else
+            {
+            DoSearchFiles(iSearchAttributes.iWildCards, iSearchAttributes.iSearchDir);
+
+            if (iSearchAttributes.iRecurse)
+                DoSearchFilesRecursiveL(iSearchAttributes.iWildCards, iSearchAttributes.iSearchDir);
+            }
+
 //        iEngine->EikonEnv()->BusyMsgCancel();
-//
+        iEngine->FileBrowserUI()->CancelWaitDialog();
+
 //        TInt operations = iFileEntryList->Count();
-//
-//        iListingMode = ESearchResults;
-//        iEngine->FileListContainer()->ListBox()->SetCurrentItemIndex(0);
-//        RefreshViewL();
-//
+
+        iListingMode = ESearchResults;
+        // TODO iEngine->FileListContainer()->ListBox()->SetCurrentItemIndex(0);
+        RefreshViewL();
+
 //        _LIT(KMessage, "%d entries found");
 //        TFileName noteMsg;
 //        noteMsg.Format(KMessage, operations);
@@ -2016,8 +2029,9 @@
     CDir* dir;
     TInt err = fileFinder.FindWildByPath(aFileName, &aPath, dir);
 
-    while (err == KErrNone)
+    while (err == KErrNone && iAllowProcessing)
         {
+        iEngine->FileBrowserUI()->ProcessEvents();
         for (TInt i=0; i<dir->Count(); i++)
             {
             TEntry entry = (*dir)[i];
@@ -2739,15 +2753,15 @@
 	
 // --------------------------------------------------------------------------------------------
 
-void CFileBrowserFileUtils::HandleServerAppExit(TInt aReason)
-	{
+//void CFileBrowserFileUtils::HandleServerAppExit(TInt aReason)
+//	{
 //	if (iOpenFileService)
 //		{
 //		delete iOpenFileService;
 //		iOpenFileService = NULL;
 //		}
-	MAknServerAppExitObserver::HandleServerAppExit(aReason);
-	}
+//	MAknServerAppExitObserver::HandleServerAppExit(aReason);
+//	}
 
 // --------------------------------------------------------------------------------------------
 
@@ -3123,7 +3137,7 @@
         // update view
         RefreshViewL(); 
     
-        if (err == KErrNone)    
+        if (err == KErrNone)
             {
             iEngine->FileBrowserUI()->ShowConfirmationNote(_L("State changed"));
             }
@@ -3266,7 +3280,7 @@
         CleanupClosePushL(file);
         iFindFileEntryList->Reset();
         
-        iEngine->EikonEnv()->BusyMsgL(_L("** Generating **"), TGulAlignment(EHCenterVTop));
+        iEngine->FileBrowserUI()->ShowWaitDialog(_L("Generating"));
         
         for (TInt i=0; i<iDriveEntryList->Count(); i++)
             {
@@ -3291,12 +3305,35 @@
             
             writeBuf.Copy(fileEntry.iPath);
             writeBuf.Append(fileEntry.iEntry.iName);
+            writeBuf.Append(_L(","));
+            writeBuf.AppendNum(fileEntry.iEntry.iSize);
+            writeBuf.Append(_L(" B"));
+
+//            // date
+//            TTime entryModified = fileEntry.iEntry.iModified;
+//            // convert from universal time
+//            if ( iTz.ConvertToLocalTime( entryModified ) == KErrNone )
+//                {
+//                entryModified = fileEntry.iEntry.iModified; // use universal time
+//                }
+//
+//            _LIT(KDateFormat,               "%D%M%Y%/0%1%/1%2%/2%3%/3");
+//            TBuf<32> dateBuf;
+//            entryModified.FormatL(dateBuf, KDateFormat);
+//            writeBuf.Append(dateBuf);
+//
+//            writeBuf.Append(_L(" "));
+//            // time
+//            _LIT(KTimeFormat, "%-B%:0%J%:1%T%:2%S%:3%+B");
+//            TBuf<32> timeBuf;
+//            entryModified.FormatL(timeBuf, KTimeFormat);
+//            writeBuf.Append(timeBuf);
+//
             writeBuf.Append(KFileNewLine);
-            
             file.Write(writeBuf);
             }
         
-        iEngine->EikonEnv()->BusyMsgCancel();
+        iEngine->FileBrowserUI()->CancelWaitDialog();
         
         CleanupStack::PopAndDestroy(); //file
         iFindFileEntryList->Reset();
@@ -3305,7 +3342,7 @@
         TFileName noteMsg;
         noteMsg.Format(KMessage, &allFilesPath);
 
-        iEngine->FileBrowserUI()->ShowConfirmationNote(noteMsg, ETrue); // NoTimeout
+        iEngine->FileBrowserUI()->ShowConfirmationNote(noteMsg, EFalse); // NoTimeout
         }
     else
         {
@@ -3325,8 +3362,9 @@
     CDir* dir;
     TInt err = fileFinder.FindWildByPath(aFileName, &aPath, dir);
 
-    while (err == KErrNone)
+    while (err == KErrNone && iAllowProcessing)
         {
+        iEngine->FileBrowserUI()->ProcessEvents();
         for (TInt i=0; i<dir->Count(); i++)
             {
             TEntry entry = (*dir)[i];
--- a/filebrowser/engine/FBFileUtils.h	Fri Jun 11 16:29:34 2010 +0100
+++ b/filebrowser/engine/FBFileUtils.h	Thu Jul 22 16:33:59 2010 +0100
@@ -24,10 +24,9 @@
 #include <w32std.h>
 #include <badesca.h>
 #include <coedef.h>
-#include <AknServerApp.h>
 #include <msvapi.h>
-#include <AknProgressDialog.h>
 #include <tz.h>
+#include "FB.hrh"
 
 _LIT(KIRAppPath, "z:\\sys\\bin\\irapp.exe");
 _LIT(KBTAppPath, "z:\\sys\\bin\\btui.exe");
@@ -39,16 +38,10 @@
 // FORWARD DECLARATIONS
 class CEngine;
 class CFileBrowserFileOps;
-class CAknIconArray;
-class TAknsItemID;
 class CDocumentHandler;
-//class CAknWaitDialog;
-//class CAknProgressDialog;
 class CEikProgressInfo;
 class CFBFileOpClient;
-//class CAknProgressDialog;
 class CEikProgressInfo;
-class CAknOpenFileService;
 class CMessageDigest;
 
 // CLASS DECLARATIONS
@@ -181,7 +174,7 @@
 
 
 
-class CFileBrowserFileUtils : public CActive, public MAknServerAppExitObserver, public MMsvSessionObserver, public MProgressDialogCallback 
+class CFileBrowserFileUtils : public CActive, public MMsvSessionObserver
 	{
 private:
     enum TState // active object states
@@ -195,17 +188,6 @@
     	EClipBoardModeCopy
     	};
 
-    enum TListingMode
-    	{
-    	ENormalEntries = 0,
-    	ESearchResults,
-    	EOpenFiles,
-    	EMsgAttachmentsInbox,
-    	EMsgAttachmentsDrafts,
-    	EMsgAttachmentsSentItems,
-    	EMsgAttachmentsOutbox
-    	};
-    	    	
 public:
 	static CFileBrowserFileUtils* NewL(CEngine* aEngine);
 	~CFileBrowserFileUtils();
@@ -216,17 +198,14 @@
 
 private: // from CActive
 	void RunL();
-    TInt RunError(TInt aError);
+        TInt RunError(TInt aError);
 	void DoCancel();
 
-private: // from MAknServerAppExitObserver
-    void HandleServerAppExit(TInt aReason);
-
 private: // from MMsvSessionObserver
     void HandleSessionEventL(TMsvSessionEvent aEvent, TAny* aArg1, TAny* aArg2, TAny* aArg3);
 
-private:  //from MProgressDialogCallback
-    void DialogDismissedL(TInt aButtonId);  
+public:  //from MProgressDialogCallback
+    void DialogDismissedL(/*TInt aButtonId*/);
     
 public: // command handling
     void StartExecutingCommandsL(const TDesC& aLabel);
@@ -334,7 +313,7 @@
     void GetDriveVolumeLabel(TInt aIndex, TFileName &aVolumeLabel);
 
     CFileEntryList* FileEntries() const;
-    CDriveEntryList* DriveEntries() const;   
+    CDriveEntryList* DriveEntries() const;
     
 public:    
     inline TInt SortMode() { return iSortMode; }
@@ -343,19 +322,23 @@
     inline CFileEntryList* CurrentSelectionList() { return iCurrentSelectionList; }
     inline TBool IsDriveListViewActive() { return iCurrentPath==KNullDesC && iListingMode==ENormalEntries; }
     inline TBool IsNormalModeActive() { return iListingMode==ENormalEntries; }
+    inline TListingMode ListingMode() { return iListingMode; }
     inline TFileName CurrentPath() { return iCurrentPath; }
 	
     inline TSearchAttributes GetSearchAttributes(){ return iSearchAttributes; };
     inline void ChangeAttributes(TSearchAttributes attributes) { iSearchAttributes = attributes; };
     inline TSearchResults SearchResults(){ return iFileSearchResults; };
-    inline CFileEntryList* FoundFiles() { return iFileEntryList; };
+    inline CFileEntryList* FoundFiles() { return iFileEntryList; };    
+    inline void SetAllowProcessing(TBool aAllowProcessing) { iAllowProcessing = aAllowProcessing; }
 	
 private:
     TState                          iState;
     CEngine*                        iEngine;
     CFileBrowserFileOps*            iFileOps;
-//    CAknWaitDialog*                 iWaitDialog;
-//    CAknProgressDialog*             iProgressDialog;
+
+    TBool                           isWaitDialog;
+    TBool                           isProgressDialog;
+
     CEikProgressInfo*               iProgressInfo;
     CCommandArray*                  iCommandArray;
     TInt                            iCurrentEntry;
@@ -381,13 +364,14 @@
     CFileEntryList*                 iCurrentSelectionList;
     TSearchAttributes               iSearchAttributes;
     CDocumentHandler*               iDocHandler;
-    CAknOpenFileService*            iOpenFileService;
+
     RFile                           iMsgStoreWalkFile;
     TInt                            iPrevFolderIndex;
     TFileName                       iPrevFolderName;
     RTz                             iTz;
     TSearchResults                  iFileSearchResults;
     CDesCArray*                     iTextArray;
+    TBool                           iAllowProcessing;
     };
 
 
--- a/filebrowser/engine/engine.cpp	Fri Jun 11 16:29:34 2010 +0100
+++ b/filebrowser/engine/engine.cpp	Thu Jul 22 16:33:59 2010 +0100
@@ -31,14 +31,6 @@
 #include <apaid.h>
 #include <s32file.h>
 
-// hash key selection related includes
-#ifndef __SERIES60_30__
-  #include <centralrepository.h>
-  #include <AknFepInternalCRKeys.h>
-  #include <AvkonInternalCRKeys.h>
-  #include <e32property.h> 
-#endif
-
 // CONSTANTS
 // UID of the application
 const TUid KUidFileBrowser = { 0x102828D6 };
@@ -90,9 +82,6 @@
     TRAP_IGNORE( LoadSettingsL() );
 
     iFileUtils = CFileBrowserFileUtils::NewL(this);
-
-    // get hash key selection value
-    GetHashKeySelectionStatus();
     }
 
 // ---------------------------------------------------------------------------
@@ -101,13 +90,6 @@
     {
     }
 	
-// --------------------------------------------------------------------------------------------
-
-//void CEngine::SetFileListContainer(CFileBrowserFileListContainer* aFileListContainer)
-//    {
-//    iFileListContainer = aFileListContainer;
-//    }
-
 // ---------------------------------------------------------------------------
 
 void CEngine::LoadDFSValueL(CDictionaryFileStore* aDicFS, const TUid& aUid, TInt& aValue)
@@ -172,20 +154,20 @@
     iSettings.iRememberLastPath = EFalse;
     iSettings.iLastPath = KNullDesC;
     iSettings.iRememberFolderSelection = ETrue;
-#if 0 // TODO
-#if(!defined __SERIES60_30__ && !defined __SERIES60_31__ && !defined __S60_32__)
-    if ( AknLayoutUtils::PenEnabled() )
-        {
-        iSettings.iEnableToolbar = ETrue;
-        }
-    else
-        {
-        iSettings.iEnableToolbar = EFalse;
-        }
-#else
-    iSettings.iEnableToolbar = EFalse;
-#endif
-#endif // TODO
+//#if 0 // TODO
+//#if(!defined __SERIES60_30__ && !defined __SERIES60_31__ && !defined __S60_32__)
+//    if ( AknLayoutUtils::PenEnabled() )
+//        {
+//        iSettings.iEnableToolbar = ETrue;
+//        }
+//    else
+//        {
+//        iSettings.iEnableToolbar = EFalse;
+//        }
+//#else
+//    iSettings.iEnableToolbar = EFalse;
+//#endif
+//#endif // TODO
 
     iSettings.iSupportNetworkDrives = EFalse;
     iSettings.iBypassPlatformSecurity = EFalse;
@@ -276,39 +258,6 @@
 
 // --------------------------------------------------------------------------------------------
 
-void CEngine::GetHashKeySelectionStatus()
-    {
-    TBool hashKeySelectionInUse(EFalse);
-    
-#ifndef __SERIES60_30__
-    
-    // get hash key selection value
-    TRAP_IGNORE(
-        CRepository* repository = CRepository::NewLC(KCRUidAknFep);
-        repository->Get(KAknFepHashKeySelection, hashKeySelectionInUse);
-        CleanupStack::PopAndDestroy();
-    );
-    
-    // even if hash key selection is in use, ignore the value in qwerty mode
-    if (hashKeySelectionInUse)
-        {
-        TBool qwertyMode(EFalse);
-        RProperty qwertyModeStatusProperty;
-        qwertyModeStatusProperty.Attach(KCRUidAvkon, KAknQwertyInputModeActive);
-        qwertyModeStatusProperty.Get(qwertyMode);
-        qwertyModeStatusProperty.Close();
-        
-        if (qwertyMode)
-            hashKeySelectionInUse = EFalse;        
-        }
-
-#endif
-
-    iIsHashKeySelectionInUse = hashKeySelectionInUse;
-    }
-    	
-// --------------------------------------------------------------------------------------------
-
 TInt CEngine::LaunchSettingsDialogL()
     {
 	TInt retValue = KErrNone;
@@ -380,7 +329,7 @@
         User::RequestComplete( s, KErrCancel );
         }
 
-    //CAknEnv::StopSchedulerWaitWithBusyMessage( iWait );
+        //CAknEnv::StopSchedulerWaitWithBusyMessage( iWait );
 	iWait.AsyncStop();
 	}
 
--- a/filebrowser/engine/engine.h	Fri Jun 11 16:29:34 2010 +0100
+++ b/filebrowser/engine/engine.h	Thu Jul 22 16:33:59 2010 +0100
@@ -22,7 +22,7 @@
 #include <e32std.h>
 #include <e32base.h>
 #include <apgcli.h>
-#include <CAknMemorySelectionSettingPage.h>
+
 #include "FBFileUtils.h"
 
 // setting keys (do not change uids of existing keys to maintain compatibility to older versions!)
@@ -48,7 +48,6 @@
 class CFileBrowserScreenCapture;
 class CFileBrowserFileUtils;
 class CEikonEnv;
-class CAknGlobalConfirmationQuery;
 class CDictionaryFileStore;
 class MFileBrowserUI;
 
@@ -78,10 +77,10 @@
 class MFileBrowserUI
 {
 public:
-    /**
-      * Method from getting current index
-      * @return current index.
-      */
+//    /**
+//      * Method from getting current index
+//      * @return current index.
+//      */
 //    virtual TInt QueryCurrentItemIndex() = 0;
 
     /**
@@ -106,14 +105,26 @@
      */
     virtual void ShowConfirmationNote(const TDesC& aText, TBool aNoTimeout = EFalse) = 0;
 
-//    /**
-//     * Shows progress bar with text
-//     * @param aText A text to be shown at top of the progress bar.
-//     * @param aMinimum A minimum progress bar value.
-//     * @param aMaximum A maximum progress bar value.
-//     * @return None.
-//     */
-//    virtual void ShowProgressBar(const TDesC& aText, TInt aMinimum, TInt aMaximum ) = 0;
+    /**
+     * Shows progress bar with text
+     * @param aText A text to be shown at top of the progress bar.
+     * @param aMinimum A minimum progress bar value.
+     * @param aMaximum A maximum progress bar value.
+     * @return None.
+     */
+    virtual void ShowProgressDialog(const TDesC& aDescText, TInt aMinimum, TInt aMaximum ) = 0;
+
+    /**
+     * Cancel progress dialog
+     * @return None.
+     */
+    virtual void CancelProgressDialog() = 0;
+
+    /**
+      * Set progress dialog value
+      * @param aValue A vaule to be shown at top of the progress dialog.
+      */
+    virtual void SetProgressValue(TInt aValue) = 0;
 //
 //    /**
 //     * Sets progress bar value
@@ -128,18 +139,24 @@
 //     */
 //    virtual void HideProgressBar() = 0;
 //
-//    /**
-//     * Shows wait dialog with text
-//     * @param aText A text to be shown at top of the wait bar.
-//     * @return None.
-//     */
-//    virtual void ShowWaitDialog(const TDesC& aText) = 0;
-//
-//    /**
-//     * Hides wait dialog
-//     * @return None.
-//     */
-//    virtual void HideWaitDialog() = 0;
+    /**
+     * Shows wait dialog with text
+     * @param aText A text to be shown at top of the wait bar.
+     * @return None.
+     */
+    virtual void ShowWaitDialog(const TDesC& aText) = 0;
+
+    /**
+     * Cancel wait dialog
+     * @return None.
+     */
+    virtual void CancelWaitDialog() = 0;
+
+    /**
+     * Processes all pending events to allow wait/progresa dialog to update itself
+     * @return None.
+     */
+    virtual void ProcessEvents() = 0;
 
     /**
      * Shows confirmation dialog
@@ -160,7 +177,6 @@
     CEngine();
     void ConstructL(MFileBrowserUI *aFileBrowserUI);
     void LoadSettingsL();
-    void GetHashKeySelectionStatus();
     void LoadDFSValueL(CDictionaryFileStore* aDicFS, const TUid& aUid, TInt& aValue);
     void LoadDFSValueL(CDictionaryFileStore* aDicFS, const TUid& aUid, TDes& aValue);
     void SaveDFSValueL(CDictionaryFileStore* aDicFS, const TUid& aUid, const TInt& aValue);
@@ -170,7 +186,6 @@
     void ActivateEngineL();
     void DeActivateEngineL();
     void SaveSettingsL(TBool aNotifyModules=ETrue);
-//    void SetFileListContainer(CFileBrowserFileListContainer* aFileListContainer);
     TInt LaunchSettingsDialogL();
     inline TFileBrowserSettings& Settings() { return iSettings; }
     inline CEikonEnv* EikonEnv() { return iEnv; }
@@ -178,13 +193,10 @@
     inline CFileBrowserScreenCapture* ScreenCapture() { return iScreenCapture; }
     inline CFileBrowserFileUtils* FileUtils() { return iFileUtils; }
     inline MFileBrowserUI* FileBrowserUI() { return iFileBrowserUI; }
-    inline CFileBrowserFileListContainer* FileListContainer() { return iFileListContainer; }
-    inline TBool IsHashKeySelectionInUse() { return iIsHashKeySelectionInUse; }
 
     void OpenWithApparcL(TFileName aFileName);
     void OpenWithDocHandlerL(TFileName aFileName, TBool aEmbed);
 //    TInt QueryCurrentItemIndex();
-//    CArrayFix<TInt> *GetSelectedIndices();
     TSearchAttributes GetSearchAttributes();
     void ChangeAttributes(TSearchAttributes attributes);
     TSearchResults SearchResults();
@@ -193,7 +205,6 @@
 
 private:
     MFileBrowserUI                  *iFileBrowserUI;
-    CFileBrowserFileListContainer   *iFileListContainer;
     CFileBrowserScreenCapture       *iScreenCapture;
     CFileBrowserFileUtils           *iFileUtils;
     CEikonEnv*                      iEnv;
--- a/filebrowser/group/ReleaseNotes_FileBrowser.txt	Fri Jun 11 16:29:34 2010 +0100
+++ b/filebrowser/group/ReleaseNotes_FileBrowser.txt	Thu Jul 22 16:33:59 2010 +0100
@@ -1,7 +1,7 @@
 ===============================================================================
 
-RELEASE NOTES - FILEBROWSER v5.0.0
-RELEASED 23th April 2010
+RELEASE NOTES - FILEBROWSER v5.1.0
+RELEASED 18th June 2010
 
 SUPPORTS S60 3.0+
 
@@ -37,9 +37,11 @@
 
 ===============================================================================
 
-What's New in v5.0.0
+What's New in v5.1.0
 ====================
-- Orbit UI
+- Error fixes
+- File filtering
+- Usability improvements
 
 ===============================================================================
 
@@ -109,6 +111,16 @@
 Version History:
 ================
 
+Version 5.0.1 - 21th May 2010
+====================
+- Error fixes
+- All files to text file with file sizes
+- Usability improvements
+
+Version 5.0.0 - 23th April 2010
+-----------------------------
+- Orbit UI
+
 Version 4.5.2 - 10th December 2009
 -----------------------------
 - Fix: UI layout problems fixed
--- a/filebrowser/ui/inc/editorview.h	Fri Jun 11 16:29:34 2010 +0100
+++ b/filebrowser/ui/inc/editorview.h	Thu Jul 22 16:33:59 2010 +0100
@@ -19,8 +19,6 @@
 #define EDITORVIEW_H
 
 #include <hbview.h>
-#include <hbmainwindow.h>
-//#include <QtGui>
 
 class HbTextEdit;
 class HbAction;
@@ -30,7 +28,7 @@
     Q_OBJECT
 
 public:
-    EditorView(HbMainWindow &mainWindow);
+    EditorView();
     ~EditorView();
     void open(const QString& fileName, bool flagReadOnly);
 
@@ -56,8 +54,6 @@
     void loadFile(const QString &fileName);
     void createMenu();
 
-    /* Main Window of folderbrowser */
-    HbMainWindow &mMainWindow;
     // editor
     HbTextEdit *mTextEdit;
     // if flag true, file is currently in hex format
@@ -69,7 +65,6 @@
     HbAction* mToTextAction;
     HbAction* mToHexAction;
     HbAction* mExitAction;
-	
 };
 
 #endif // EDITORVIEW_H
--- a/filebrowser/ui/inc/enginewrapper.h	Fri Jun 11 16:29:34 2010 +0100
+++ b/filebrowser/ui/inc/enginewrapper.h	Thu Jul 22 16:33:59 2010 +0100
@@ -34,6 +34,7 @@
 class SearchAttributes;
 class SearchResults;
 class FileBrowserView;
+class HbProgressDialog;
 
 class QModelIndex;
 
@@ -55,9 +56,10 @@
 /**
  * class that is used for communicating between Symbian and Qt code.
  */
-class EngineWrapper : MFileBrowserUI {
+class EngineWrapper : public QObject, public MFileBrowserUI
+{
+    Q_OBJECT
 public:
-    
     /**
      * Constructor
      */
@@ -79,6 +81,15 @@
     void ShowInformationNote(const TDesC &aDescText, const TDesC &aDescTitle);
     void ShowErrorNote(const TDesC& aDescText, TBool aNoTimeout = EFalse);
     void ShowConfirmationNote(const TDesC& aDescText, TBool aNoTimeout = EFalse);
+
+    void ShowProgressDialog(const TDesC& aDescText, TInt aMinimum, TInt aMaximum);
+    void CancelProgressDialog();
+    void SetProgressValue(TInt aValue);
+
+    void ShowWaitDialog(const TDesC& aText);
+    void CancelWaitDialog();
+    void ProcessEvents();
+
     TBool ShowConfirmationQuery(const TDesC& aDescText);
 
 public: 
@@ -95,6 +106,7 @@
 
     void startExecutingCommands(const QString &aCommandsExecutionMessage);
     void refreshView();
+    inline TListingMode listingMode() { return mEngine->FileUtils()->ListingMode(); }
 //    TBool IsCurrentDriveReadOnly();
 //    TBool IsCurrentItemDirectory();
     void moveUpOneLevel();
@@ -158,14 +170,22 @@
     quint32 getDebugMask();
     void toolsSetDebugMask(quint32 aDbgMask);
 
+    void toolsWriteAllFiles();
+
     void showFileCheckSums(const QModelIndex &aIndex, TFileBrowserCmdFileChecksums checksumType);
 
+private slots:
+        void progressDialogCancelled();
+        void waitDialogCancelled();
+
 private:
     // FB engine
     CEngine *mEngine;
     // List of found files results for Ui
     QStringList mFilesFound;
     FileBrowserSettings mSettings;
+    HbProgressDialog *mProgressDialog;
+    HbProgressDialog *mWaitDialog;
     };
 
 #endif //ENGINEWRAPPER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/filebrowser/ui/inc/fbdrivelistviewitem.h	Thu Jul 22 16:33:59 2010 +0100
@@ -0,0 +1,65 @@
+/*
+* 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 FBDRIVELISTVIEWITEMS_H
+#define FBDRIVELISTVIEWITEMS_H
+
+#include <HbListViewItem>
+
+#include <QGraphicsWidget>
+#include <QtGlobal>
+
+class HbAbstractViewItem;
+class HbLabel;
+class HbCheckBox;
+class HbWidget;
+
+class QGraphicsLinearLayout;
+class QModelIndex;
+class QGraphicsItem;
+
+class FbDriveListViewItem : public HbListViewItem
+{
+    Q_OBJECT
+
+public:
+    FbDriveListViewItem( QGraphicsItem *parent = 0 );
+    ~FbDriveListViewItem();
+
+    virtual bool canSetModelIndex(const QModelIndex &index) const;
+    virtual HbAbstractViewItem *createItem();
+    virtual void updateChildItems();
+
+private slots:
+    void setCheckedState( int state );
+
+private:
+    virtual void polish(HbStyleParameters& params);
+
+private:
+    void init();
+
+    QGraphicsLinearLayout *hLayout;
+
+    HbLabel *mDiskNameLabel;
+    HbLabel *mSizeLabel;
+    HbLabel *mFreeLabel;
+    //HbCheckBox *mCheckBox;
+    HbLabel *mIconLabel;
+};
+
+#endif // FBDRIVELISTVIEWITEMS_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/filebrowser/ui/inc/fbdrivemodel.h	Thu Jul 22 16:33:59 2010 +0100
@@ -0,0 +1,55 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef FBDRIVEMODELH_H_
+#define FBDRIVEMODELH_H_
+
+#include "driveentry.h"
+
+#include <QAbstractListModel>
+#include <QVariant>
+
+// Forward declarations
+class EngineWrapper;
+class QModelIndex;
+class QFileIconProvider;
+class QObject;
+
+class FbDriveModel : public QAbstractListModel
+{
+    Q_OBJECT
+
+public:
+    explicit FbDriveModel(EngineWrapper *engineWrapper, QObject *parent = 0);
+    virtual ~FbDriveModel();
+
+    int rowCount(const QModelIndex &parent = QModelIndex()) const;
+    QVariant data(const QModelIndex &index, int role) const;
+    QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;
+
+    DriveEntry driveEntry(const QModelIndex &index) const;
+    QString driveLetter( const QModelIndex &index ) const;
+    QString mediaTypeString(const QModelIndex &index) const;
+
+private:
+    EngineWrapper *mEngineWrapper;
+    QFileIconProvider *mFileIconProvider;
+};
+
+
+
+#endif /* FBDRIVEMODELH_H_ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/filebrowser/ui/inc/fbdriveview.h	Thu Jul 22 16:33:59 2010 +0100
@@ -0,0 +1,244 @@
+/*
+* 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 FBDRIVEVIEWH_H_
+#define FBDRIVEVIEWH_H_
+
+#include "menuaction.h"
+#include "enginewrapper.h"
+
+#include <HbView>
+#include <HbApplication>
+
+#include <QModelIndexList>
+
+// Forward declarations
+class QFileInfo;
+class QSignalMapper;
+class QItemSelection;
+class QString;
+class QGraphicsLinearLayout;
+
+class HbListView;
+class HbListWidget;
+class HbToolBar;
+class HbLabel;
+class HbDialog;
+class HbAbstractViewItem;
+class HbMenu;
+class HbSearchPanel;
+
+class EditorView;
+class SearchView;
+class SettingsView;
+class EngineWrapper;
+class FbDriveModel;
+class FileBrowserSortFilterProxyModel;
+
+class FbDriveView : public HbView
+{
+    Q_OBJECT
+
+public:
+    explicit FbDriveView();
+    virtual ~FbDriveView();
+    void init(EngineWrapper *engineWrapper);
+
+public slots:
+    void refreshList();
+
+private:
+    void openListDialog(const QStringList &items, const QString &titleText, QObject *receiver, const char *member);
+
+    void openPropertyDialog(const QStringList &propertyList, const QString &title);
+
+    QModelIndex currentItemIndex();
+    void storeSelectedItemsOrCurrentItem();
+
+    // Menu related methods
+    void createMenu();
+    void createFileMenu();
+    void createEditMenu();
+    void createViewMenu();
+    void createToolsMenu();
+
+    void createSettingsMenuItem();
+    void createAboutMenuItem();
+    void createExitMenuItem();
+
+    void createContextMenu();
+    void createFileContextMenu();
+    void createEditContextMenu();
+    void createViewContextMenu();
+    void createDiskAdminContextMenu();
+
+private slots:
+    // menu action slots
+    // file menu
+    void fileOpenDrive();
+    void fileSearch();
+
+    void fileProperties();
+
+    void fileSetAttributes();
+
+    // edit menu
+    void editSnapShotToE();
+
+    // view menu
+    void viewRefresh();
+
+    // disk admin menu
+    void diskAdminSetDrivePassword();
+    void diskAdminSetDrivePasswordNew(HbAction *);
+    void doDiskAdminSetDrivePassword(HbAction *);
+
+    void diskAdminUnlockDrive();
+    void doDiskAdminUnlockDrive(HbAction *);
+
+    void diskAdminClearDrivePassword();
+    void doDiskAdminClearDrivePassword(HbAction *);
+
+    void diskAdminEraseDrivePassword();
+    void doDiskAdminEraseDrivePassword(HbAction *);
+
+    void diskAdminFormatDrive();
+    void doDiskAdminFormatDrive(HbAction *);
+
+    void diskAdminQuickFormatDrive();
+    void doDiskAdminQuickFormatDrive(HbAction *);
+
+    void diskAdminCheckDisk();
+
+    void diskAdminScanDrive();
+    void doDiskAdminScanDrive(HbAction *);
+
+    void diskAdminSetDriveName();
+    void doDiskAdminSetDriveName(HbAction *);
+
+    void diskAdminSetDriveVolumeLabel();
+    void doDiskAdminSetDriveVolumeLabel(HbAction *);
+
+    void diskAdminEjectDrive();
+    void diskAdminDismountDrive();
+    void doDiskAdminDismountDrive(HbAction *);
+
+    void diskAdminEraseMBR();
+    void doDiskAdminEraseMBR(HbAction *);
+    void doDiskAdminReallyEraseMBR(HbAction *);
+    void doDiskAdminNotRemovableReallyEraseMBR(HbAction *);
+    
+    void diskAdminPartitionDrive();
+    void diskAdminPartitionDriveProceed(HbAction *);
+    void diskAdminPartitionDriveReallyProceed(HbAction *);
+    void diskAdminPartitionDriveIsNotRemovable(HbAction *);
+    void diskAdminPartitionDriveEraseMbr(HbAction *);
+    void diskAdminPartitionDriveGetCount(HbAction*);
+
+    // tools menu
+    void toolsAllAppsToTextFile();
+    void toolsAllFilesToTextFile();
+//    void toolsAvkonIconCacheEnable();
+//    void toolsAvkonIconCacheDisable();
+
+    void toolsDisableExtendedErrors();
+    void toolsDumpMsgStoreWalk();
+    void toolsEditDataTypes();
+    void toolsEnableExtendedErrors();
+
+    void toolsErrorSimulateLeave();
+    void doToolsErrorSimulateLeave(HbAction *);
+
+    void toolsErrorSimulatePanic();
+    void doToolsErrorSimulatePanicCode(HbAction *);
+    void doToolsErrorSimulatePanic(HbAction *);
+
+    void toolsErrorSimulateException();
+    void doToolsErrorSimulateException(HbAction *);
+
+//    void toolsLocalConnectivityActivateInfrared();
+//    void toolsLocalConnectivityLaunchBTUI();
+//    void toolsLocalConnectivityLaunchUSBUI();
+    void toolsMessageInbox();
+    void toolsMessageDrafts();
+    void toolsMessageSentItems();
+    void toolsMessageOutbox();
+    void toolsMemoryInfo();
+    void toolsSecureBackStart();
+    void toolsSecureBackRestore();
+    void toolsSecureBackStop();
+    void toolsSetDebugMaskQuestion();
+    void toolsSetDebugMask(HbAction *);
+    void toolsShowOpenFilesHere();
+
+    // main menu items
+    void about();
+    
+signals:
+    void aboutToShowFileView();
+    void aboutToShowSettingsView();
+    void aboutToShowEditorView(const QString &, bool);
+    void aboutToShowSearchView(const QString &);
+    void aboutToSimulateLeave(int);
+
+private slots:
+    void updateOptionMenu();
+    void updateContextMenu();
+    void selectionChanged(const QItemSelection &, const QItemSelection &);
+    void activated(const QModelIndex& index);
+
+    void onLongPressed(HbAbstractViewItem *, QPointF);
+
+private:
+    EngineWrapper *mEngineWrapper;
+
+    HbListView *mListView;
+    HbLabel *mNaviPane;
+
+    QGraphicsLinearLayout *mMainLayout;
+
+    // file info contains all needed information of selected file from file model
+    QModelIndexList mClipboardIndexes;
+    QModelIndexList mSelectionIndexes;
+
+    FbDriveModel *mFbDriveModel;
+    OptionMenuActions mOptionMenuActions;
+    ContextMenuActions mContextMenuActions;
+    HbMenu *mContextMenu;
+
+    // flags
+    bool mLocationChanged;
+    // flag for removing source file after copied to target file
+    bool mRemoveFileAfterCopied;
+    bool mClipBoardInUse;
+    bool mFolderContentChanged;
+    QModelIndex mCurrentIndex;
+
+    // temporarily storage
+    QString mOldPassword;
+    QString mPanicCategory;
+    QString mAbsoluteFilePath;
+    OverwriteOptions mOverwriteOptions;
+    QModelIndex mModelIndex;
+    QString mNewFileName;
+    bool mProceed;
+    bool mEraseMBR;
+};
+
+
+
+#endif /* FBDRIVEVIEWH_H_ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/filebrowser/ui/inc/fbfilelistviewitem.h	Thu Jul 22 16:33:59 2010 +0100
@@ -0,0 +1,65 @@
+/*
+* 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 FBFILELISTVIEWITEM_H
+#define FBFILELISTVIEWITEM_H
+
+#include <HbListViewItem>
+
+#include <QGraphicsWidget>
+#include <QtGlobal>
+
+class HbAbstractViewItem;
+class HbLabel;
+class HbCheckBox;
+class HbWidget;
+
+class QGraphicsLinearLayout;
+class QModelIndex;
+class QGraphicsItem;
+
+class FbFileListViewItem : public HbListViewItem
+{
+    Q_OBJECT
+
+public:
+    FbFileListViewItem( QGraphicsItem *parent = 0 );
+    ~FbFileListViewItem();
+
+    virtual bool canSetModelIndex(const QModelIndex &) const;
+    virtual HbAbstractViewItem *createItem();
+    virtual void updateChildItems();
+
+private slots:
+    void setCheckedState(int state);
+
+private:
+    virtual void polish(HbStyleParameters &);
+
+private:
+    void init();
+
+    QGraphicsLinearLayout *hLayout;
+
+    HbLabel *mDiskNameLabel;
+    HbLabel *mSizeLabel;
+    HbLabel *mFreeLabel;
+    //HbCheckBox *mCheckBox;
+    HbLabel *mIconLabel;
+};
+
+#endif // FBFILELISTVIEWITEM_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/filebrowser/ui/inc/fbfilemodel.h	Thu Jul 22 16:33:59 2010 +0100
@@ -0,0 +1,47 @@
+/*
+* 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 FBFILEMODELH_H_
+#define FBFILEMODELH_H_
+
+#include <QAbstractListModel>
+
+// Forward declarations
+class EngineWrapper;
+class QModelIndex;
+class QFileIconProvider;
+
+class FbFileModel : public QAbstractListModel
+{
+    Q_OBJECT
+
+public:
+    explicit FbFileModel(EngineWrapper *engineWrapper, QObject *parent = 0);
+    virtual ~FbFileModel();
+
+    int rowCount(const QModelIndex &parent = QModelIndex()) const;
+    QVariant data(const QModelIndex &index, int role) const;
+    QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;
+
+private:
+    EngineWrapper *mEngineWrapper;
+    QFileIconProvider *mFileIconProvider;
+};
+
+
+
+#endif /* FBFILEMODELH_H_ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/filebrowser/ui/inc/fbfileview.h	Thu Jul 22 16:33:59 2010 +0100
@@ -0,0 +1,248 @@
+/*
+* 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 FBFILEVIEWH_H_
+#define FBFILEVIEWH_H_
+
+#include "menuaction.h"
+#include "enginewrapper.h"
+
+#include <HbView>
+#include <HbApplication>
+
+#include <QModelIndexList>
+
+// Forward declarations
+class QFileInfo;
+class QSignalMapper;
+class QItemSelection;
+class QString;
+class QGraphicsLinearLayout;
+
+class HbListView;
+class HbListWidget;
+class HbToolBar;
+class HbLabel;
+class HbDialog;
+class HbAbstractViewItem;
+class HbMenu;
+class HbSearchPanel;
+
+class EditorView;
+class SearchView;
+class SettingsView;
+class EngineWrapper;
+class FbFileModel;
+class FileBrowserSortFilterProxyModel;
+
+class FbFileView : public HbView
+{
+    Q_OBJECT
+
+public:
+    explicit FbFileView();
+    virtual ~FbFileView();
+    void init(EngineWrapper *engineWrapper);
+
+public slots:
+    void refreshList();
+
+private:
+    void fileOverwriteDialog();
+    void openListDialog(const QStringList &items, const QString &titleText, QObject *receiver, const char *member);
+
+    void openPropertyDialog(const QStringList &propertyList, const QString &title);
+
+    QModelIndex currentItemIndex();
+    void storeSelectedItemsOrCurrentItem();
+
+    // Menu related methods
+    void createMenu();
+    void createFileMenu();
+    void createEditMenu();
+    void createViewMenu();
+    void createToolsMenu();
+
+    void createSelectionMenuItem();
+    void createSettingsMenuItem();
+    void createAboutMenuItem();
+    void createExitMenuItem();
+
+    void createContextMenu();
+    void createFileContextMenu();
+    void createEditContextMenu();
+    void createViewContextMenu();
+    void createToolBar();
+
+private slots:
+    // menu action slots
+    // file menu
+    void fileBackMoveUp();
+    void fileOpenDirectory();
+    void fileSearch();
+
+    void fileNewFile();
+    void doFileNewFile(HbAction *);
+
+    void fileNewDirectory();
+    void doFileNewDirectory(HbAction *);
+
+    void fileDelete();
+    void doFileDelete(HbAction *);
+
+    void fileRename();
+    void doFileRename(HbAction *);
+    void doFileRenameFileExist(HbAction *);
+
+    void fileTouch();
+    void doFileTouch(HbAction *);
+    void fileProperties();
+
+    void fileChecksumsMD5();
+    void fileChecksumsMD2();
+    void fileChecksumsSHA1();
+    void fileChecksums(TFileBrowserCmdFileChecksums checksumType);
+
+    void fileSetAttributes();
+
+    // edit menu
+    void editSnapShotToE();
+    void editCut();
+    void editCopy();
+    void editPaste();
+
+    void editCopyToFolder();
+    void doEditCopyToFolder(HbAction *);
+
+    void editMoveToFolder();
+    void doEditMoveToFolder(HbAction *);
+
+    void editSelect();
+    void editUnselect();
+    void editSelectAll();
+    void editUnselectAll();
+
+    // view menu
+    void viewFilterEntries();
+    void filterCriteriaChanged(const QString &);
+    void clearFilterCriteria();
+    void viewRefresh();
+
+    // tools menu
+    void toolsAllAppsToTextFile();
+    void toolsAllFilesToTextFile();
+//    void toolsAvkonIconCacheEnable();
+//    void toolsAvkonIconCacheDisable();
+
+    void toolsDisableExtendedErrors();
+    void toolsDumpMsgStoreWalk();
+    void toolsEditDataTypes();
+    void toolsEnableExtendedErrors();
+
+    void toolsErrorSimulateLeave();
+    void doToolsErrorSimulateLeave(HbAction *);
+
+    void toolsErrorSimulatePanic();
+    void doToolsErrorSimulatePanicCode(HbAction *);
+    void doToolsErrorSimulatePanic(HbAction *);
+
+    void toolsErrorSimulateException();
+    void doToolsErrorSimulateException(HbAction *);
+
+//    void toolsLocalConnectivityActivateInfrared();
+//    void toolsLocalConnectivityLaunchBTUI();
+//    void toolsLocalConnectivityLaunchUSBUI();
+    void toolsMessageInbox();
+    void toolsMessageDrafts();
+    void toolsMessageSentItems();
+    void toolsMessageOutbox();
+    void toolsMemoryInfo();
+    void toolsSecureBackStart();
+    void toolsSecureBackRestore();
+    void toolsSecureBackStop();
+    void toolsSetDebugMaskQuestion();
+    void toolsSetDebugMask(HbAction *);
+    void toolsShowOpenFilesHere();
+
+    // main menu items
+    void selectionModeChanged();
+    void about();
+    
+signals:
+    void aboutToShowDriveView();
+    void aboutToShowSettingsView();
+    void aboutToShowEditorView(const QString &, bool);
+    void aboutToShowSearchView(const QString &);
+    void aboutToSimulateLeave(int);
+
+private slots:
+    void updateOptionMenu();
+    void updateContextMenu();
+    void selectionChanged(const QItemSelection &, const QItemSelection &);
+    void activated(const QModelIndex& index);
+    void activateSelectionMode();
+    void deActivateSelectionMode();
+    void onLongPressed(HbAbstractViewItem *, QPointF);
+
+    void fileOpen(HbAction *);
+    void fileOverwrite(HbAction *);
+    void fileOverwritePostfix(HbAction *);
+
+private:
+    EngineWrapper *mEngineWrapper;
+
+    HbListView *mListView;
+    HbToolBar *mToolBar;
+    HbLabel *mNaviPane;
+    HbSearchPanel *mSearchPanel;
+
+    QGraphicsLinearLayout *mMainLayout;
+
+    // file info contains all needed information of selected file from file model
+    QModelIndexList mClipboardIndexes;
+    QModelIndexList mSelectionIndexes;
+
+    FbFileModel *mFbFileModel;
+    FileBrowserSortFilterProxyModel *mSortFilterProxyModel;
+    OptionMenuActions mOptionMenuActions;
+    ContextMenuActions mContextMenuActions;
+    HbMenu *mContextMenu;
+    HbAction *mToolbarBackAction;
+
+    // flags
+    bool mItemHighlighted;
+    bool mLocationChanged;
+    // flag for removing source file after copied to target file
+    bool mRemoveFileAfterCopied;
+    bool mClipBoardInUse;
+    bool mFolderContentChanged;
+    QModelIndex mCurrentIndex;
+
+    // temporarily storage
+    QString mOldPassword;
+    QString mPanicCategory;
+    QString mAbsoluteFilePath;
+    OverwriteOptions mOverwriteOptions;
+    QModelIndex mModelIndex;
+    QString mNewFileName;
+    bool mProceed;
+    bool mEraseMBR;
+};
+
+
+
+#endif /* FBFILEVIEWH_H_ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/filebrowser/ui/inc/fbmainwindow.h	Thu Jul 22 16:33:59 2010 +0100
@@ -0,0 +1,62 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef FBMAINWINDOW_H_
+#define FBMAINWINDOW_H_
+
+#include <hbmainwindow.h>
+
+class HbApplication;
+class HbView;
+
+class EngineWrapper;
+class FbDriveView;
+class FbFileView;
+class SettingsView;
+class EditorView;
+class SearchView;
+
+class FbMainWindow : public HbMainWindow
+{
+    Q_OBJECT
+
+public:
+    explicit FbMainWindow(QWidget *parent = 0);
+    virtual ~FbMainWindow();
+    
+    void init();
+
+private slots:
+    void openPreviousBrowserView();
+    void openFileBrowserView(bool);
+    void openDriveView();
+    void openFileView();
+    void openSettingsView();
+    void openEditorView(const QString &, bool);
+    void openSearchView(const QString &);
+    
+private:
+    EngineWrapper *mEngineWrapper;
+    FbDriveView *mDriveView;
+    FbFileView *mFileView;
+    SettingsView *mSettingsView;
+    EditorView *mEditorView;
+    SearchView *mSearchView;
+    HbView *mPreviousView;
+};
+
+#endif /* FBMAINWINDOW_H_ */
--- a/filebrowser/ui/inc/filebrowsermainwindow.h	Fri Jun 11 16:29:34 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,51 +0,0 @@
-/*
-* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-#ifndef FILEBROWSERMAINWINDOW_H_
-#define FILEBROWSERMAINWINDOW_H_
-
-#include <hbmainwindow.h>
-
-class HbApplication;
-class EngineWrapper;
-class FileBrowserView;
-class SettingsView;
-class EditorView;
-
-class FileBrowserMainWindow : public HbMainWindow
-    {
-    Q_OBJECT
-
-public:
-    explicit FileBrowserMainWindow(QWidget *parent = 0);
-    virtual ~FileBrowserMainWindow();
-    
-    void init();
-
-private slots:
-    void openFileBrowserView();
-    void openSettingsView();
-    void openEditorView(const QString &, bool);
-    
-private:
-    EngineWrapper* mEngineWrapper;
-    FileBrowserView* mFileBrowserView;
-    SettingsView* mSettingsView;
-    EditorView* mEditorView;
-    };
-
-#endif /* FILEBROWSERMAINWINDOW_H_ */
--- a/filebrowser/ui/inc/filebrowsermodel.h	Fri Jun 11 16:29:34 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,47 +0,0 @@
-/*
-* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-#ifndef FILEBROWSERMODELH_H_
-#define FILEBROWSERMODELH_H_
-
-#include <QAbstractListModel>
-
-// Forward declarations
-class EngineWrapper;
-class QModelIndex;
-class QFileIconProvider;
-
-class FileBrowserModel : public QAbstractListModel
-{
-    Q_OBJECT
-
-public:
-    explicit FileBrowserModel(EngineWrapper *engineWrapper, QObject *parent = 0);
-    virtual ~FileBrowserModel();
-
-    int rowCount(const QModelIndex &parent = QModelIndex()) const;
-    QVariant data(const QModelIndex &index, int role) const;
-    QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;
-
-private:
-    EngineWrapper *mEngineWrapper;
-    QFileIconProvider *mFileIconProvider;
-};
-
-
-
-#endif /* FILEBROWSERMODELH_H_ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/filebrowser/ui/inc/filebrowsersortfilterproxymodel.h	Thu Jul 22 16:33:59 2010 +0100
@@ -0,0 +1,41 @@
+/*
+* 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 FILEBROWSERSORTFILTERPROXYMODEL_H
+#define FILEBROWSERSORTFILTERPROXYMODEL_H
+
+#include <QString>
+#include <QSortFilterProxyModel>
+
+class FileBrowserSortFilterProxyModel : public QSortFilterProxyModel
+{
+    Q_OBJECT
+
+public:
+    FileBrowserSortFilterProxyModel(QObject *parent = 0);
+
+    QString filterCriteria() const { return mFilterCriteria; }
+    void setFilterCriteria(const QString &criteria);
+
+protected:
+    bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const;
+
+private:
+    QString mFilterCriteria;
+};
+
+#endif // FILEBROWSERSORTFILTERPROXYMODEL_H
--- a/filebrowser/ui/inc/filebrowserview.h	Fri Jun 11 16:29:34 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,315 +0,0 @@
-/*
-* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-#ifndef FILEBROWSERVIEWH_H_
-#define FILEBROWSERVIEWH_H_
-
-#include "menuaction.h"
-#include "enginewrapper.h"
-
-#include <HbView>
-#include <HbMainWindow>
-#include <HbApplication>
-
-#include <QDir>
-
-// Forward declarations
-class QFileInfo;
-class QSignalMapper;
-class QItemSelection;
-class QString;
-class QGraphicsLinearLayout;
-
-class HbListView;
-class HbListWidget;
-class HbToolBar;
-class HbLabel;
-class HbDialog;
-
-class FileBrowserMainWindow;
-class EditorView;
-class SearchView;
-class SettingsView;
-class EngineWrapper;
-class FileBrowserModel;
-
-class FileBrowserView : public HbView
-{
-    Q_OBJECT
-
-    enum resourceItem
-    {
-	FileItem,
-	Directory
-    };
-
-public:
-    explicit FileBrowserView(FileBrowserMainWindow &mainWindow);
-    virtual ~FileBrowserView();
-    void init(EngineWrapper *engineWrapper);
-    QModelIndex currentItemIndex();
-    QModelIndexList getSelectedItemsOrCurrentItem();
-
-public slots:
-
-private:
-    void fileOverwriteDialog();
-    void openListDialog(const QStringList& items, const QString &aTitleText, QObject* receiver, const char* member);
-
-    void diskAdmin(int cmd);
-    HbDialog *filePathQuery(const QString &headingText,
-                            const QString &text,
-                            const QString &primaryActionText,
-                            const QString &secondaryActionText);
-
-//    HbDialog *openTextQuery(const QString &headingText,
-//                            const QString &text,
-//                            const QString &primaryActionText,
-//                            const QString &secondaryActionText);
-
-    HbDialog *openNumberQuery(const QString &headingText,
-                              const QString &text,
-                              const QString &primaryActionText,
-                              const QString &secondaryActionText,
-                              int aMin = -99999,
-                              int aMax = 99999);
-
-    void openPropertyDialog(const QStringList& propertyList, const QString& title);
-
-//    QModelIndexList *getSelectedItemsOrCurrentItem();
-
-    void createToolBar();
-    // Menu related methods
-    void createMenu();
-    void createFileMenu();
-    void createEditMenu();
-    void createViewMenu();
-    void createDiskAdminMenu();
-    void createToolsMenu();
-
-    void createSelectionMenuItem();
-    void createSettingsMenuItem();
-    void createAboutMenuItem();
-    void createExitMenuItem();
-
-    void refreshList();
-    void populateFolderContent();
-
-private slots:
-    // menu action slots
-    // file menu
-    void fileBackMoveUp();
-    void fileOpenDrive();
-    void fileOpenDirectory();
-    void fileSearch();
-
-    void fileNewFile();
-    void doFileNewFile(HbAction *);
-
-    void fileNewDirectory();
-    void doFileNewDirectory(HbAction *);
-
-    void fileDelete();
-    void doFileDelete(HbAction *);
-
-    void fileRename();
-    void doFileRename(HbAction *);
-    void doFileRenameFileExist(HbAction *);
-
-    void fileTouch();
-    void doFileTouch(HbAction *);
-    void fileProperties();
-
-    void fileChecksumsMD5();
-    void fileChecksumsMD2();
-    void fileChecksumsSHA1();
-    void fileChecksums(TFileBrowserCmdFileChecksums checksumType);
-
-    void fileSetAttributes();
-
-    // edit menu
-    void editSnapShotToE();
-    void editCut();
-    void editCopy();
-    void editPaste();
-
-    void editCopyToFolder();
-    void doEditCopyToFolder(HbAction *);
-
-    void editMoveToFolder();
-    void doEditMoveToFolder(HbAction *);
-
-    void editSelect();
-    void editUnselect();
-    void editSelectAll();
-    void editUnselectAll();
-
-    // view menu
-    void viewFilterEntries();
-    void viewRefresh();
-
-    // disk admin menu
-    void diskAdminSetDrivePassword();
-    void diskAdminSetDrivePasswordNew(HbAction *);
-    void doDiskAdminSetDrivePassword(HbAction *);
-
-    void diskAdminUnlockDrive();
-    void doDiskAdminUnlockDrive(HbAction *action);
-
-    void diskAdminClearDrivePassword();
-    void doDiskAdminClearDrivePassword(HbAction *action);
-
-    void diskAdminEraseDrivePassword();
-    void doDiskAdminEraseDrivePassword(HbAction *);
-
-    void diskAdminFormatDrive();
-    void doDiskAdminFormatDrive(HbAction *);
-
-    void diskAdminQuickFormatDrive();
-    void doDiskAdminQuickFormatDrive(HbAction *);
-
-    void diskAdminCheckDisk();
-
-    void diskAdminScanDrive();
-    void doDiskAdminScanDrive(HbAction *);
-
-    void diskAdminSetDriveName();
-    void doDiskAdminSetDriveName(HbAction *action);
-
-    void diskAdminSetDriveVolumeLabel();
-    void doDiskAdminSetDriveVolumeLabel(HbAction*);
-
-    void diskAdminEjectDrive();
-    void diskAdminDismountDrive();
-    void doDiskAdminDismountDrive(HbAction *);
-
-    void diskAdminEraseMBR();
-    void doDiskAdminEraseMBR(HbAction *);
-    void doDiskAdminReallyEraseMBR(HbAction *);
-    void doDiskAdminNotRemovableReallyEraseMBR(HbAction *);
-    
-    void diskAdminPartitionDrive();
-    void diskAdminPartitionDriveProceed(HbAction *);
-    void diskAdminPartitionDriveReallyProceed(HbAction *);
-    void diskAdminPartitionDriveIsNotRemovable(HbAction *);
-    void diskAdminPartitionDriveEraseMbr(HbAction *);
-    void diskAdminPartitionDriveGetCount(HbAction*);
-
-    // tools menu
-    void toolsAllAppsToTextFile();
-    void toolsAllFilesToTextFile();
-    void toolsAvkonIconCacheEnable();
-    void toolsAvkonIconCacheDisable();
-
-    void toolsDisableExtendedErrors();
-    void toolsDumpMsgStoreWalk();
-    void toolsEditDataTypes();
-    void toolsEnableExtendedErrors ();
-
-    void toolsErrorSimulateLeave();
-    void doToolsErrorSimulateLeave(HbAction *action);
-
-    void toolsErrorSimulatePanic();
-    void doToolsErrorSimulatePanicCode(HbAction *action);
-    void doToolsErrorSimulatePanic(HbAction *action);
-
-    void toolsErrorSimulateException();
-    void doToolsErrorSimulateException(HbAction *);
-
-//    void toolsLocalConnectivityActivateInfrared();
-//    void toolsLocalConnectivityLaunchBTUI();
-//    void toolsLocalConnectivityLaunchUSBUI();
-    void toolsMessageInbox();
-    void toolsMessageDrafts();
-    void toolsMessageSentItems();
-    void toolsMessageOutbox();
-    void toolsMemoryInfo();
-    void toolsSecureBackStart();
-    void toolsSecureBackRestore();
-    void toolsSecureBackStop();
-    void toolsSetDebugMaskQuestion();
-    void toolsSetDebugMask(HbAction *);
-    void toolsShowOpenFilesHere();
-
-    // main menu items
-    void selectionModeChanged();
-    void about();
-    
-signals:
-    void aboutToShowSettingsView();
-    void aboutToShowEditorView(const QString &, bool);
-    void aboutToSimulateLeave(int);
-
-private slots:
-    void itemHighlighted(const QModelIndex &index);
-    //void itemSelected(const QModelIndex &index);
-    void updateMenu();
-    void selectionChanged(const QItemSelection &/*selected*/, const QItemSelection &/*deselected*/);
-    void activated(const QModelIndex& index);
-    void activateSelectionMode();
-    void deActivateSelectionMode();
-
-    void fileOpen(HbAction *);
-    void fileOverwrite(HbAction *);
-    void fileOverwritePostfix(HbAction *);
-
-private:
-    FileBrowserMainWindow &mMainWindow;
-    EngineWrapper *mEngineWrapper;
-
-    HbListView *mListView;
-    HbToolBar *mToolBar;
-    HbLabel *mNaviPane;
-    QGraphicsLinearLayout *mMainLayout;
-
-    QString mDirectory;
-    // selected path
-    QString mSelectedFilePath;
-    // initial path
-    //QDir mInitDirPath;
-    // file info contains all needed information of selected file from file model
-    QModelIndexList mClipboardIndices;
-    FileBrowserModel *mFileBrowserModel;
-    MenuAction mFileViewMenuActions;
-    HbAction *mToolbarBackAction;
-
-    // search
-    SearchView *mSearch;
-    // settings
-    SettingsView *mSettingsView;
-    // flags
-    bool mItemHighlighted;
-    bool mLocationChanged;
-    // flag for removing source file after copied to target file
-    bool mRemoveFileAfterCopied;
-    bool mClipBoardInUse;
-    bool mFolderContentChanged;
-
-    // temporarily storage
-    QString mOldPassword;
-    QString mPanicCategory;
-    QString mAbsoluteFilePath;
-    OverwriteOptions mOverwriteOptions;
-    QModelIndex mModelIndex;
-    bool mIsRenameAllowed;
-    bool mProceed;
-    bool mEraseMBR;
-};
-
-
-
-#endif /* FILEBROWSERVIEWH_H_ */
--- a/filebrowser/ui/inc/menuaction.h	Fri Jun 11 16:29:34 2010 +0100
+++ b/filebrowser/ui/inc/menuaction.h	Thu Jul 22 16:33:59 2010 +0100
@@ -18,16 +18,13 @@
 #ifndef MENUACTION_H
 #define MENUACTION_H
 
-//#include <QtGui>
-
 class HbMenu;
 class HbAction;
 
-class MenuAction
+class OptionMenuActions
 {
 public:
-    MenuAction() :
-            //NoAction = 0,
+    OptionMenuActions() :
             mFileMenu(0),
             mFileBackMoveUp(0),
             mFileOpenDrive(0),
@@ -97,10 +94,10 @@
             mToolsMessageDrafts(0),
             mToolsMessageSentItems(0),
             mToolsMessageOutbox(0),
-            //    mLocalConnectivityMenu(0),
-            //    mToolsLocalConnectivityActivateInfrared(0),
-            //    mToolsLocalConnectivityLaunchBTUI(0),
-            //    mToolsLocalConnectivityLaunchUSBUI(0),
+            mToolsLocalConnectivityMenu(0),
+            mToolsLocalConnectivityActivateInfrared(0),
+            mToolsLocalConnectivityLaunchBTUI(0),
+            mToolsLocalConnectivityLaunchUSBUI(0),
             mToolsMemoryInfo(0),
             mToolsSecureBackupMenu(0),
             mToolsSecureBackStart(0),
@@ -116,10 +113,9 @@
 
     }
 
-    ~MenuAction() { }
+    ~OptionMenuActions() { }
 public:
     //File menu operations
-    //NoAction = 0,
     HbMenu *mFileMenu;
     HbAction *mFileBackMoveUp;
     HbAction *mFileOpenDrive;
@@ -221,4 +217,191 @@
 };
 
 
+class ContextMenuActions
+{
+public:
+    ContextMenuActions() :
+            mFileMenu(0),
+            mFileBackMoveUp(0),
+            mFileOpenDrive(0),
+            mFileOpenDirectory(0),
+            mFileSearch(0),
+            mFileNewMenu(0),
+            mFileNewFile(0),
+            mFileNewDirectory(0),
+            mFileDelete(0),
+            mFileRename(0),
+            mFileTouch(0),
+            mFileProperties(0),
+            mFileChecksumsMenu(0),
+            mFileChecksumsMD5(0),
+            mFileChecksumsMD2(0),
+            mFileChecksumsSHA1(0),
+            mFileSetAttributes(0),
+            //Edit -
+            mEditMenu(0),
+//            mEditSnapShotToE(0),
+            mEditCut(0),
+            mEditCopy(0),
+            mEditPaste(0),
+            mEditCopyToFolder(0),
+            mEditMoveToFolder(0),
+//            mEditSelect(0),
+//            mEditUnselect(0),
+//            mEditSelectAll(0),
+//            mEditUnselectAll(0),
+            // View -
+//            mViewMenu(0),
+//            mViewFilterEntries(0),
+//            mViewRefresh(0),
+            // Disk admin -
+            mDiskAdminMenu(0),
+            mDiskAdminSetDrivePassword(0),
+            mDiskAdminUnlockDrive(0),
+            mDiskAdminClearDrivePassword(0),
+            mDiskAdminEraseDrivePassword(0),
+            mDiskAdminFormatDrive(0),
+            mDiskAdminQuickFormatDrive(0),
+            mDiskAdminCheckDisk(0),
+            mDiskAdminScanDrive(0),
+            mDiskAdminSetDriveName(0),
+            mDiskAdminSetDriveVolumeLabel(0),
+            mDiskAdminEjectDrive(0),
+            mDiskAdminDismountDrive(0),
+            mDiskAdminEraseMBR(0),
+            mDiskAdminPartitionDrive(0)
+            // Tools -
+//            mToolsMenu(0),
+//            mToolsAllAppsToTextFile(0),
+//            mToolsAllFilesToTextFile(0),
+//            mToolsAvkonIconCacheMenu(0),
+//            mToolsAvkonIconCacheEnable(0),
+//            mToolsAvkonIconCacheDisable(0),
+//            mToolsDisableExtendedErrors(0),
+//            mToolsDumpMsgStoreWalk(0),
+//            mToolsEditDataTypes(0),
+//            mToolsEnableExtendedErrors(0),
+//            mToolsErrorSimulateMenu(0),
+//            mToolsErrorSimulateLeave(0),
+//            mToolsErrorSimulatePanic(0),
+//            mToolsErrorSimulateException(0),
+//            mToolsMessageAttachmentsMenu(0),
+//            mToolsMessageInbox(0),
+//            mToolsMessageDrafts(0),
+//            mToolsMessageSentItems(0),
+//            mToolsMessageOutbox(0),
+//            //    mLocalConnectivityMenu(0),
+//            //    mToolsLocalConnectivityActivateInfrared(0),
+//            //    mToolsLocalConnectivityLaunchBTUI(0),
+//            //    mToolsLocalConnectivityLaunchUSBUI(0),
+//            mToolsMemoryInfo(0),
+//            mToolsSecureBackupMenu(0),
+//            mToolsSecureBackStart(0),
+//            mToolsSecureBackRestore(0),
+//            mToolsSecureBackStop(0),
+//            mToolsSetDebugMask(0),
+//            mToolsShowOpenFilesHere(0)
+    {
+
+    }
+
+    ~ContextMenuActions() { }
+public:
+    //File menu operations
+    HbMenu *mFileMenu;
+    HbAction *mFileBackMoveUp;
+    HbAction *mFileOpenDrive;
+    HbAction *mFileOpenDirectory;
+    HbAction *mFileSearch;
+    HbMenu *mFileNewMenu;
+    HbAction *mFileNewFile;
+    HbAction *mFileNewDirectory;
+    HbAction *mFileDelete;
+    HbAction *mFileRename;
+    HbAction *mFileTouch;
+    HbAction *mFileProperties;
+    HbMenu *mFileChecksumsMenu;
+    HbAction *mFileChecksumsMD5;
+    HbAction *mFileChecksumsMD2;
+    HbAction *mFileChecksumsSHA1;
+    HbAction *mFileSetAttributes;
+
+    //Edit -
+    HbMenu *mEditMenu;
+//    HbAction *mEditSnapShotToE;
+    HbAction *mEditCut;
+    HbAction *mEditCopy;
+    HbAction *mEditPaste;
+    HbAction *mEditCopyToFolder;
+    HbAction *mEditMoveToFolder;
+//    HbAction *mEditSelect;
+//    HbAction *mEditUnselect;
+//    HbAction *mEditSelectAll;
+//    HbAction *mEditUnselectAll;
+//
+//    // View -
+//    HbMenu *mViewMenu;
+//    HbAction *mViewFilterEntries;
+//    HbAction *mViewRefresh;
+
+    // Disk admin -
+    HbMenu *mDiskAdminMenu;
+    HbAction *mDiskAdminSetDrivePassword;
+    HbAction *mDiskAdminUnlockDrive;
+    HbAction *mDiskAdminClearDrivePassword;
+    HbAction *mDiskAdminEraseDrivePassword;
+    HbAction *mDiskAdminFormatDrive;
+    HbAction *mDiskAdminQuickFormatDrive;
+    HbAction *mDiskAdminCheckDisk;
+    HbAction *mDiskAdminScanDrive;
+    HbAction *mDiskAdminSetDriveName;
+    HbAction *mDiskAdminSetDriveVolumeLabel;
+    HbAction *mDiskAdminEjectDrive;
+    HbAction *mDiskAdminDismountDrive;
+    HbAction *mDiskAdminEraseMBR;
+    HbAction *mDiskAdminPartitionDrive;
+//
+//    // Tools -
+//    HbMenu *mToolsMenu;
+//    HbAction *mToolsAllAppsToTextFile;
+//    HbAction *mToolsAllFilesToTextFile;
+//
+//    HbMenu *mToolsAvkonIconCacheMenu;
+//    HbAction *mToolsAvkonIconCacheEnable;
+//    HbAction *mToolsAvkonIconCacheDisable;
+//
+//    HbAction *mToolsDisableExtendedErrors;
+//    HbAction *mToolsDumpMsgStoreWalk;
+//    HbAction *mToolsEditDataTypes;
+//
+//    HbAction *mToolsEnableExtendedErrors;
+//
+//    HbMenu *mToolsErrorSimulateMenu;
+//    HbAction *mToolsErrorSimulateLeave;
+//    HbAction *mToolsErrorSimulatePanic;
+//    HbAction *mToolsErrorSimulateException;
+//
+//    HbMenu *mToolsMessageAttachmentsMenu;
+//    HbAction *mToolsMessageInbox;
+//    HbAction *mToolsMessageDrafts;
+//    HbAction *mToolsMessageSentItems;
+//    HbAction *mToolsMessageOutbox;
+//
+//    HbMenu *mToolsLocalConnectivityMenu;
+//    HbAction *mToolsLocalConnectivityActivateInfrared;
+//    HbAction *mToolsLocalConnectivityLaunchBTUI;
+//    HbAction *mToolsLocalConnectivityLaunchUSBUI;
+//
+//    HbAction *mToolsMemoryInfo;
+//
+//    HbMenu *mToolsSecureBackupMenu;
+//    HbAction *mToolsSecureBackStart;
+//    HbAction *mToolsSecureBackRestore;
+//    HbAction *mToolsSecureBackStop;
+//
+//    HbAction *mToolsSetDebugMask;
+//    HbAction *mToolsShowOpenFilesHere;
+};
+
+
 #endif // MENUACTION_H
--- a/filebrowser/ui/inc/notifications.h	Fri Jun 11 16:29:34 2010 +0100
+++ b/filebrowser/ui/inc/notifications.h	Thu Jul 22 16:33:59 2010 +0100
@@ -18,24 +18,19 @@
 #ifndef NOTIFICATIONS_H_
 #define NOTIFICATIONS_H_
 
-//#include <hbdeviceprogressdialog.h>
 #include <hbmessagebox.h>
 
+class HbProgressDialog;
+
 class Notifications
 {
 public:
-    
     static void showAboutNote();
     static void showMessageBox(HbMessageBox::MessageBoxType type, const QString &text, const QString &label, int timeout = HbPopup::NoTimeout);
     static void showInformationNote(const QString &text, const QString &title = QString());
     static void showErrorNote(const QString &text, bool noTimeout = false);
     static void showConfirmationNote(const QString &text, bool noTimeout = false);
     static bool showConfirmationQuery(const QString &aText);
-    
-
-//    static HbDeviceProgressDialog* showWaitDialog(const QString &text);
-
-private:    
 };
 
 #endif // NOTIFICATIONS_H_
--- a/filebrowser/ui/inc/searchview.h	Fri Jun 11 16:29:34 2010 +0100
+++ b/filebrowser/ui/inc/searchview.h	Thu Jul 22 16:33:59 2010 +0100
@@ -18,16 +18,16 @@
 #ifndef SEARCHVIEW_H
 #define SEARCHVIEW_H
 
-#include <hbview.h>
-#include <hbmainwindow.h>
+#include <HbView>
+
+#include <QDateTime>
 
-#include <qdatetime.h>
+class QStringList;
 
-class QDir;
 class EngineWrapper;
-class QStringList;
 class HbDataForm;
 class HbDataFormModelItem;
+class HbProgressDialog;
 
 /**
   * Settings class that is used for 
@@ -51,8 +51,8 @@
 class SearchResults
 {
 public:
-    int         mNumberOfFoundFiles;
-    QStringList* mFoundFilesList;
+    int mNumberOfFoundFiles;
+    QStringList *mFoundFilesList;
 };
 
 class SearchView : public HbView
@@ -60,24 +60,27 @@
     Q_OBJECT
 
 public:
-    SearchView(HbView &mainView, HbMainWindow &mainWindow, EngineWrapper &engineWrapper);
+    explicit SearchView(EngineWrapper &engineWrapper);
     ~SearchView();
     void open(const QString &path);
 
+signals:
+    void finished(bool ok);
 
 private slots:
-    void backButtonClicked();
-    void startFileSearch();
+    void accept();
+    void reject();
+
+private:
+    void initDataForm();
+    void createToolbar();
     void loadAttributes();
     void readFormItems();
-    
-private:
+
+    void startFileSearch();
     void fileSearchResults();
 
-    /* Main Window of folderbrowser */
-    HbMainWindow &mMainWindow;
-    /* Main View of folderbrowser*/
-    HbView &mMainView;
+private:
     /* EngineWrapper */
     EngineWrapper &mEngineWrapper;  
 
@@ -97,6 +100,8 @@
     HbDataFormModelItem *mMaxDate;
 
     QString mPath;
+
+    HbProgressDialog *mProgressDialog;
 };
 
 #endif // SEARCHVIEW_H
--- a/filebrowser/ui/inc/settingsview.h	Fri Jun 11 16:29:34 2010 +0100
+++ b/filebrowser/ui/inc/settingsview.h	Thu Jul 22 16:33:59 2010 +0100
@@ -22,7 +22,6 @@
 
 class HbDataForm;
 class HbDataFormModelItem;
-class FileBrowserMainWindow;
 class EngineWrapper;
 class FileBrowserSettings;
 
@@ -31,9 +30,10 @@
     Q_OBJECT
 
 public:
-    SettingsView(FileBrowserMainWindow &mainWindow, EngineWrapper &engineWrapper);
+    SettingsView(EngineWrapper &engineWrapper);
     virtual ~SettingsView();
 
+    void initDataForm();
 signals:
     void finished(bool ok);
 
@@ -51,14 +51,12 @@
     void reject();
 
 private:
-    void initDataForm();
     void createToolbar();
     void constructMenu();
     void loadSettings(const FileBrowserSettings &settings);
     void saveSettings(FileBrowserSettings &settings);
 
 private:
-    FileBrowserMainWindow &mMainWindow;
     EngineWrapper &mEngineWrapper;
 
     HbDataForm *mForm;
--- a/filebrowser/ui/src/editorview.cpp	Fri Jun 11 16:29:34 2010 +0100
+++ b/filebrowser/ui/src/editorview.cpp	Thu Jul 22 16:33:59 2010 +0100
@@ -16,7 +16,6 @@
 */
 
 #include <HbView>
-#include <HbMainWindow>
 #include <HbApplication>
 #include <HbAction>
 #include <HbMenu>
@@ -32,8 +31,7 @@
 
 #include "editorview.h"
 
-EditorView::EditorView(HbMainWindow &mainWindow)
-    : mMainWindow(mainWindow),
+EditorView::EditorView() :
     mTextEdit(0),
     mFileHex(false),
     mFlagReadOnly(),
--- a/filebrowser/ui/src/enginewrapper.cpp	Fri Jun 11 16:29:34 2010 +0100
+++ b/filebrowser/ui/src/enginewrapper.cpp	Thu Jul 22 16:33:59 2010 +0100
@@ -19,11 +19,13 @@
 #include "engine.h"
 #include "FBFileUtils.h"
 #include "notifications.h"
-#include "filebrowserview.h"
+#include "fbfileview.h"
 #include "searchview.h"
 #include "filebrowsersettings.h"
 #include "settingsview.h"
 
+#include <HbProgressDialog>
+
 #include <QString>
 #include <QFileInfo>
 #include <QModelIndex>
@@ -33,7 +35,9 @@
 EngineWrapper::EngineWrapper()
     : mEngine(0),
     mFilesFound(),
-    mSettings(0)
+    mSettings(0),
+    mProgressDialog(0),
+    mWaitDialog(0)
 {
 }
 
@@ -45,6 +49,11 @@
         TRAP_IGNORE(mEngine->DeActivateEngineL());
         delete mEngine;
     } 
+    if (mProgressDialog)
+        delete mProgressDialog;
+
+    if (mWaitDialog)
+        delete mWaitDialog;
 }
 
 // ---------------------------------------------------------------------------
@@ -686,6 +695,11 @@
     mEngine->FileUtils()->SetDebugMaskL(aDbgMask);
 }
 
+void EngineWrapper::toolsWriteAllFiles()
+{
+    mEngine->FileUtils()->WriteAllFilesL();
+}
+
 void EngineWrapper::showFileCheckSums(const QModelIndex &aIndex, TFileBrowserCmdFileChecksums checksumType)
 {
     mEngine->FileUtils()->ShowFileCheckSumsL(aIndex.row(), checksumType);
@@ -699,8 +713,8 @@
 
 void EngineWrapper::ShowErrorNote(const TDesC& aDescText, TBool aNoTimeout /*= EFalse*/)
 {
-    QString qStringText = QString::fromUtf16(aDescText.Ptr(), aDescText.Length());
-    Notifications::showErrorNote(qStringText, aNoTimeout);
+    QString qText = QString::fromUtf16(aDescText.Ptr(), aDescText.Length());
+    Notifications::showErrorNote(qText, aNoTimeout);
 }
 
 // ---------------------------------------------------------------------------
@@ -716,14 +730,79 @@
 
 void EngineWrapper::ShowConfirmationNote(const TDesC& aDescText, TBool aNoTimeout /*= EFalse*/)
 {
-    QString qStringText = QString::fromUtf16(aDescText.Ptr(), aDescText.Length());
-    Notifications::showConfirmationNote(qStringText, aNoTimeout);
+    QString qText = QString::fromUtf16(aDescText.Ptr(), aDescText.Length());
+    Notifications::showConfirmationNote(qText, aNoTimeout);
+}
+
+void EngineWrapper::ShowProgressDialog(const TDesC& aDescText, TInt aMinimum, TInt aMaximum )
+{
+    const QString qText = QString::fromUtf16(aDescText.Ptr(), aDescText.Length());
+    if (!mProgressDialog) {
+        mProgressDialog = new HbProgressDialog(HbProgressDialog::WaitDialog);
+        QObject::connect(mProgressDialog, SIGNAL(cancelled()), this, SLOT(progressDialogCancelled()));
+    }
+
+    mProgressDialog->setText(qText);
+    mProgressDialog->setMinimum(aMinimum);
+    mProgressDialog->setMaximum(aMaximum);
+    mEngine->FileUtils()->SetAllowProcessing(true);
+    mProgressDialog->show();
+}
+
+void EngineWrapper::CancelProgressDialog()
+{
+    if (mProgressDialog) {
+        QObject::disconnect(mProgressDialog, SIGNAL(cancelled()), this, SLOT(progressDialogCancelled()));
+        mProgressDialog->cancel();
+        QObject::connect(mProgressDialog, SIGNAL(cancelled()), this, SLOT(progressDialogCancelled()));
+    }
+}
+
+void EngineWrapper::SetProgressValue(TInt aValue)
+{
+    if (mProgressDialog)
+        mProgressDialog->setProgressValue(aValue);
+}
+
+void EngineWrapper::progressDialogCancelled()
+{
+    mEngine->FileUtils()->DialogDismissedL();
+}
+
+void EngineWrapper::ShowWaitDialog(const TDesC& aDescText)
+{
+    const QString qText = QString::fromUtf16(aDescText.Ptr(), aDescText.Length());
+    if (!mWaitDialog) {
+        mWaitDialog = new HbProgressDialog(HbProgressDialog::WaitDialog);
+        QObject::connect(mWaitDialog, SIGNAL(cancelled()), this, SLOT(waitDialogCancelled()));
+    }
+
+    mWaitDialog->setText(qText);
+    mEngine->FileUtils()->SetAllowProcessing(true);
+    //mWaitDialog->setAttribute(Qt::WA_DeleteOnClose);
+    mWaitDialog->show();
+}
+
+void EngineWrapper::CancelWaitDialog()
+{
+    if (mWaitDialog)
+        mWaitDialog->cancel();
+}
+
+void EngineWrapper::waitDialogCancelled()
+{
+    mEngine->FileUtils()->SetAllowProcessing(false);
+}
+
+void EngineWrapper::ProcessEvents()
+{
+    qApp->processEvents();
 }
 
 TBool EngineWrapper::ShowConfirmationQuery(const TDesC& aDescText)
 {
-    QString qStringText = QString::fromUtf16(aDescText.Ptr(), aDescText.Length());
-    return Notifications::showConfirmationQuery(qStringText);
+    QString qText = QString::fromUtf16(aDescText.Ptr(), aDescText.Length());
+    return Notifications::showConfirmationQuery(qText);
 }
 
 // ---------------------------------------------------------------------------
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/filebrowser/ui/src/fbdrivelistviewitem.cpp	Thu Jul 22 16:33:59 2010 +0100
@@ -0,0 +1,173 @@
+/*
+* 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 "fbdrivelistviewitem.h"
+#include "driveentry.h"
+#include "fbdrivemodel.h"
+
+#include <hblabel.h>
+#include <hbcheckbox.h>
+#include <hbabstractitemview.h>
+
+#include <QString>
+#include <QStringList>
+#include <QFileIconProvider>
+#include <QGraphicsLinearLayout>
+#include <QRectF>
+#include <QPainter>
+
+FbDriveListViewItem::FbDriveListViewItem(QGraphicsItem *parent) :
+    HbListViewItem(parent),
+    hLayout(0),
+    mDiskNameLabel(0),
+    mSizeLabel(0),
+    mFreeLabel(0),
+    mIconLabel(0)
+{
+}
+
+FbDriveListViewItem::~FbDriveListViewItem()
+{
+}
+
+void FbDriveListViewItem::polish(HbStyleParameters& params)
+{
+    Q_UNUSED(params);
+}
+
+bool FbDriveListViewItem::canSetModelIndex(const QModelIndex &index) const
+{
+    Q_UNUSED(index);
+    return true;
+}
+
+
+HbAbstractViewItem *FbDriveListViewItem::createItem()
+{
+    return new FbDriveListViewItem(*this);
+}
+
+void FbDriveListViewItem::updateChildItems()
+{
+    if(!hLayout) {
+        init();
+    }
+
+    // Qt::DisplayRole
+//    QVariant displayRole = modelIndex().data(Qt::DisplayRole);
+//    QString diskName("default");
+    QStringList stringList;
+//    if (displayRole.isValid()) {
+//        if (displayRole.canConvert<QString>()) {                // EFileViewModeSimple
+//            stringList.append(displayRole.toString());
+//        } else if (displayRole.canConvert<QStringList>()) {     // EFileViewModeExtended
+//            stringList = displayRole.toStringList();
+//        }
+//        if (stringList.count() > 0)
+//            diskName = stringList[0]; //modelIndex().data( Qt::UserRole ).toString();
+//
+//        mDiskNameLabel->setPlainText(diskName/*displayString*/);
+//    }
+//    if (stringList.count() > 1)
+//        mSizeLabel->setPlainText( stringList[1] );
+
+
+    // Get the Drive Entry
+    const FbDriveModel* driveModel= qobject_cast<const FbDriveModel *>(modelIndex().model());
+    DriveEntry driveEntry = driveModel->driveEntry(modelIndex());
+
+    const QString SimpleDriveEntry("%1: <%2>");
+
+    QString diskName = SimpleDriveEntry.arg(driveEntry.driveLetter()).arg(driveEntry.mediaTypeString());
+    mDiskNameLabel->setPlainText(diskName);
+
+    const QString ExtendedDriveEntry("%1/%2 kB");
+    QString diskSize = ExtendedDriveEntry.arg(QString::number(driveEntry.volumeInfoFree()/1024))
+                                         .arg(QString::number(driveEntry.volumeInfoSize()/1024));
+    mSizeLabel->setPlainText( diskSize );
+
+    //mFreeLabel->setPlainText( stringList[2] );
+
+    //    mCheckBox->setCheckState( checkState() );
+
+    // Qt::DecorationRole
+    // QTBUG-11033 No Icon provided for QFileIconProvider::Desktop, Network, Drive on Symbian
+    QVariant decorationRole = modelIndex().data(Qt::DecorationRole);
+    if (decorationRole.isValid()) {
+        QIcon icon = qvariant_cast<QIcon>(decorationRole);
+    if( icon.isNull() ) {
+        QFileIconProvider fileIconProvider;
+        icon = fileIconProvider.icon(QFileIconProvider::File);
+    }
+    mIconLabel->setIcon(HbIcon(icon));
+    }
+}
+
+void FbDriveListViewItem::setCheckedState(int state)
+{
+    HbAbstractViewItem::setCheckState(static_cast<Qt::CheckState>(state));
+}
+
+void FbDriveListViewItem::init()
+{
+    hLayout = new QGraphicsLinearLayout();
+    hLayout->setContentsMargins(0, 0, 0, 0);
+
+    hLayout->setOrientation( Qt::Horizontal );
+    hLayout->addItem(layout());
+
+    mIconLabel = new HbLabel();
+    hLayout->addItem( mIconLabel );
+    hLayout->setAlignment( mIconLabel, Qt::AlignTop );
+    hLayout->setStretchFactor( mIconLabel, 0 );
+
+    QGraphicsLinearLayout *vLayout = new QGraphicsLinearLayout();
+    //vLayout->setContentsMargins(0, 0, 0, 0);
+    vLayout->setOrientation( Qt::Vertical );
+
+    mDiskNameLabel = new HbLabel();
+    HbFontSpec fontSpecPrimary(HbFontSpec::Primary);
+    //fontSpecPrimary.setTextHeight(18.0);
+    mDiskNameLabel->setFontSpec( fontSpecPrimary );
+    vLayout->addItem( mDiskNameLabel );
+    vLayout->setAlignment( mDiskNameLabel, Qt::AlignLeft );
+
+    mSizeLabel = new HbLabel();
+    HbFontSpec fontSpecSecondary(HbFontSpec::Secondary);
+    //fontSpecSecondary.setTextHeight(18.0);
+    mSizeLabel->setFontSpec(fontSpecSecondary);
+    vLayout->addItem( mSizeLabel );
+    vLayout->setAlignment(mSizeLabel, Qt::AlignLeft);
+
+//    mFreeLabel = new HbLabel();
+//    mFreeLabel->setFontSpec( HbFontSpec( HbFontSpec::Secondary ) );
+//    vLayout->addItem( mFreeLabel );
+//    vLayout->setAlignment( mFreeLabel, Qt::AlignLeft );
+
+    HbWidget *labelsWidget = new HbWidget();
+    labelsWidget->setLayout(vLayout);
+
+    hLayout->setAlignment( labelsWidget, Qt::AlignLeft );
+
+    hLayout->addItem( labelsWidget );
+    hLayout->setStretchFactor( labelsWidget, 1 );
+
+    //this->setMaximumHeight( mDiskNameLabel->preferredHeight() );
+    //setMaximumHeight( mIconLabel->preferredHeight() );
+
+    setLayout( hLayout );
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/filebrowser/ui/src/fbdrivemodel.cpp	Thu Jul 22 16:33:59 2010 +0100
@@ -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:
+*
+*/
+
+#include "fbdrivemodel.h"
+#include "enginewrapper.h"
+#include "driveentry.h"
+#include "settingsview.h"
+#include "filebrowsersettings.h"
+#include "FB.hrh"
+
+#include <QModelIndex>
+#include <QFileIconProvider>
+
+/**
+  Constructs a file browser custom system model with the given \a engineWrapper and \a parent.
+  */
+FbDriveModel::FbDriveModel(EngineWrapper *engineWrapper, QObject *parent) :
+    QAbstractListModel(parent),
+    mEngineWrapper(engineWrapper),
+    mFileIconProvider(0)
+{
+    mFileIconProvider = new QFileIconProvider();
+}
+
+/**
+  Destroys this file browser custom system model.
+  */
+FbDriveModel::~FbDriveModel()
+{  
+    if (mFileIconProvider) {
+        delete mFileIconProvider;
+    }
+}
+
+/**
+  \reimp
+  */
+int FbDriveModel::rowCount(const QModelIndex &parent) const
+{
+    Q_UNUSED(parent);
+    return mEngineWrapper->itemCount();
+}
+
+/**
+  \reimp
+  */
+QVariant FbDriveModel::data(const QModelIndex &index, int role) const
+{
+    if (!index.isValid() || index.model() != this)
+        return QVariant();
+
+    switch (role) {
+    case Qt::EditRole:
+    case Qt::DisplayRole: {
+            QStringList listItem;
+            DriveEntry driveEntry(mEngineWrapper->getDriveEntry(index));
+            if (mEngineWrapper->settings().fileViewMode() == EFileViewModeSimple)
+            {
+                const QString SimpleDriveEntry("%1: <%2>");
+                listItem /*<< driveEntry.IconId() */
+                        << SimpleDriveEntry.arg(driveEntry.driveLetter())
+                                           .arg(driveEntry.mediaTypeString());
+            } else if (mEngineWrapper->settings().fileViewMode() == EFileViewModeExtended) {
+                const QString SimpleDriveEntry("%1: <%2>");
+                const QString ExtendedDriveEntry("%1/%2 kB");
+                listItem /*<< driveEntry.IconId()*/
+                        << SimpleDriveEntry.arg(driveEntry.driveLetter())
+                                           .arg(driveEntry.mediaTypeString())
+                        << ExtendedDriveEntry.arg(QString::number(driveEntry.volumeInfoFree()/1024))
+                                             .arg(QString::number(driveEntry.volumeInfoSize()/1024));
+
+            }
+            return listItem;
+        }
+    case Qt::DecorationRole: {
+            if (mEngineWrapper) {
+                QIcon icon;
+                //TODO Drive ico has to be provided, for some reason it is not visible
+                icon = mFileIconProvider->icon(QFileIconProvider::Drive);
+                return QVariant(icon);
+            }
+        }
+    }
+    return QVariant();
+}
+
+/**
+  \reimp
+  */
+QVariant FbDriveModel::headerData(int section, Qt::Orientation orientation, int role) const
+{
+    Q_UNUSED(section);
+    Q_UNUSED(orientation);
+    Q_UNUSED(role);
+
+    // TODO, implement or remove
+    return QVariant();
+}
+
+
+DriveEntry FbDriveModel::driveEntry(const QModelIndex &index) const
+{
+    return mEngineWrapper->getDriveEntry(index);
+}
+
+QString FbDriveModel::driveLetter(const QModelIndex &index) const
+{
+    QString diskLetter;
+    if (index.row() >= 0 && index.row() < mEngineWrapper->itemCount()) {
+        DriveEntry driveEntry(mEngineWrapper->getDriveEntry(index));
+        diskLetter = driveEntry.driveLetter();
+    }
+    return diskLetter;
+}
+
+QString FbDriveModel::mediaTypeString(const QModelIndex &index) const
+{
+    QString mediaTypeString;
+    if (index.row() >= 0 && index.row() < mEngineWrapper->itemCount()) {
+        DriveEntry driveEntry(mEngineWrapper->getDriveEntry(index));
+        mediaTypeString = driveEntry.mediaTypeString();
+    }
+    return mediaTypeString;
+}
+
+// ---------------------------------------------------------------------------
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/filebrowser/ui/src/fbdriveview.cpp	Thu Jul 22 16:33:59 2010 +0100
@@ -0,0 +1,1308 @@
+/*
+* 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 "fbdriveview.h"
+#include "settingsview.h"
+#include "editorview.h"
+#include "searchview.h"
+#include "enginewrapper.h"
+#include "notifications.h"
+
+#include "fbdrivemodel.h"
+#include "filebrowsersortfilterproxymodel.h"
+#include "fbdrivelistviewitem.h"
+
+#include <HbMenu>
+#include <HbPopup>
+#include <HbView>
+#include <HbMessageBox>
+#include <HbAction>
+#include <HbLabel>
+#include <HbListView>
+#include <HbListViewItem>
+#include <HbListWidget>
+#include <HbLineEdit>
+#include <HbAbstractViewItem>
+#include <HbSelectionDialog>
+#include <HbValidator>
+#include <HbInputDialog>
+
+#include <QString>
+#include <QGraphicsLinearLayout>
+#include <QItemSelection>
+#include <QDebug>
+//TODO check if needed to do this way
+#include <FB.hrh>
+
+// ---------------------------------------------------------------------------
+
+FbDriveView::FbDriveView() :
+    mEngineWrapper(0),
+    mListView(0),
+    mNaviPane(0),
+    mMainLayout(0),
+    mFbDriveModel(0),
+    mOptionMenuActions(),
+    mContextMenuActions(),
+    mContextMenu(0),
+    mLocationChanged(false),
+    mRemoveFileAfterCopied(false),
+//    mClipBoardInUse(false),
+    mFolderContentChanged(false),
+    mCurrentIndex(),
+    mOldPassword(),
+    mPanicCategory(),
+    mAbsoluteFilePath(),
+    mOverwriteOptions(),
+    mModelIndex(),
+    mNewFileName(),
+    mProceed(false),
+    mEraseMBR(false)
+{
+    setTitle("File Browser");
+
+    createMenu();
+    createContextMenu();
+}
+
+// ---------------------------------------------------------------------------	
+
+void FbDriveView::init(EngineWrapper *engineWrapper)
+{
+    mEngineWrapper = engineWrapper;
+
+    mListView = new HbListView(this);
+    mListView->listItemPrototype()->setStretchingStyle(HbListViewItem::StretchLandscape);
+
+    mListView->setItemPrototype(new FbDriveListViewItem(mListView));
+
+    mFbDriveModel = new FbDriveModel(mEngineWrapper);
+    if (!mListView->model()) {
+        mEngineWrapper->refreshView();
+        mListView->setModel(mFbDriveModel);
+    }
+
+    //mListView->setRootIndex(mFileSystemModel->index(startPath));
+    //mListView->setRootIndex(model->index());
+
+//    mListView->setScrollingStyle(HbScrollArea::PanWithFollowOn);
+
+    connect(mListView, SIGNAL(activated(QModelIndex)), this, SLOT(activated(QModelIndex)));
+    connect(mListView, SIGNAL(longPressed(HbAbstractViewItem*,QPointF)),
+            this, SLOT(onLongPressed(HbAbstractViewItem*, QPointF)));
+
+    mNaviPane = new HbLabel(this);
+    mNaviPane->setPlainText(QString(" ")); // TODO get from settings or default
+    //mNaviPane->setPlainText(QString(mEngineWrapper->currentPath()));
+    HbFontSpec fontSpec(HbFontSpec::PrimarySmall);
+    mNaviPane->setFontSpec(fontSpec);
+
+    // Create layout and add list view and naviPane into layout:
+    mMainLayout = new QGraphicsLinearLayout(Qt::Vertical);
+    mMainLayout->addItem(mNaviPane);
+    mMainLayout->addItem(mListView);
+    setLayout(mMainLayout);
+}
+
+// ---------------------------------------------------------------------------
+
+FbDriveView::~FbDriveView()
+{  
+//    if (mEngineWrapper) {
+//        delete mEngineWrapper;
+//    }
+    if (mContextMenu) {
+        mContextMenu->deleteLater();
+    }
+
+    delete mFbDriveModel;
+    delete mListView;
+}
+
+/**
+  Initial setup for options menu.
+  Dynamic menu update during the runtime is performed by updateOptionMenu() which
+  to menu's aboutToShow() signal.
+  */
+void FbDriveView::createMenu()
+{
+    createFileMenu();
+    createEditMenu();
+    createViewMenu();
+    createToolsMenu();
+
+    createSettingsMenuItem();
+    createAboutMenuItem();
+    createExitMenuItem();
+
+    // menu dynamic update
+    connect(menu(), SIGNAL(aboutToShow()), this, SLOT(updateOptionMenu()));
+}
+
+/**
+  Initial setup for File submenu
+  */
+void FbDriveView::createFileMenu()
+{
+    mOptionMenuActions.mFileMenu = menu()->addMenu("File");
+
+//    mOptionMenuActions.mFileOpenDrive = mOptionMenuActions.mFileMenu->addAction("Open drive", this, SLOT(fileOpenDrive()));
+    mOptionMenuActions.mFileSearch = mOptionMenuActions.mFileMenu->addAction("Search...", this, SLOT(fileSearch()));
+    //mOptionMenuActions.mFileSearch->setVisible(false);
+
+    //mOptionMenuActions.mFileNewMenu = mOptionMenuActions.mFileMenu->addMenu("New");
+
+    mOptionMenuActions.mFileSetAttributes = mOptionMenuActions.mFileMenu->addAction("Set attributes...", this, SLOT(fileSetAttributes()));
+    mOptionMenuActions.mFileSetAttributes->setVisible(false);
+}
+
+/**
+  Initial setup for Edit submenu
+  */
+void FbDriveView::createEditMenu()
+{
+    mOptionMenuActions.mEditMenu = menu()->addMenu("Edit");
+
+    mOptionMenuActions.mEditSnapShotToE = mOptionMenuActions.mEditMenu->addAction("Snap shot to E:", this, SLOT(editSnapShotToE()));
+    mOptionMenuActions.mEditSnapShotToE->setVisible(false);
+}
+
+/**
+  Initial setup for View submenu
+  */
+void FbDriveView::createViewMenu()
+{
+    mOptionMenuActions.mViewMenu = menu()->addMenu("View");
+    //mOptionMenuActions.mViewMenu->menuAction()->setVisible(false);
+
+    //mOptionMenuActions.mViewFilterEntries = mOptionMenuActions.mViewMenu->addAction("Filter entries", this, SLOT(viewFilterEntries()));
+    mOptionMenuActions.mViewRefresh = mOptionMenuActions.mViewMenu->addAction("Refresh", this, SLOT(viewRefresh()));
+}
+
+/**
+  Initial setup for Tools submenu
+  */
+void FbDriveView::createToolsMenu()
+{
+    mOptionMenuActions.mToolsMenu = menu()->addMenu("Tools");
+
+    mOptionMenuActions.mToolsAllAppsToTextFile = mOptionMenuActions.mToolsMenu->addAction("All apps to a text file", this, SLOT(toolsAllAppsToTextFile()));
+    mOptionMenuActions.mToolsAllAppsToTextFile->setVisible(false);
+    mOptionMenuActions.mToolsAllFilesToTextFile = mOptionMenuActions.mToolsMenu->addAction("All files to a text file", this, SLOT(toolsAllFilesToTextFile()));
+    //mOptionMenuActions.mToolsAllFilesToTextFile->setVisible(false);
+
+//    mOptionMenuActions.mToolsAvkonIconCacheMenu = mOptionMenuActions.mToolsMenu->addMenu("Avkon icon cache");
+//    mOptionMenuActions.mToolsAvkonIconCacheMenu->menuAction()->setVisible(false);
+//    mOptionMenuActions.mToolsAvkonIconCacheEnable = mOptionMenuActions.mToolsAvkonIconCacheMenu->addAction("Enable", this, SLOT(toolsAvkonIconCacheEnable()));
+//    mOptionMenuActions.mToolsAvkonIconCacheDisable = mOptionMenuActions.mToolsAvkonIconCacheMenu->addAction("Clear and disable", this, SLOT(toolsAvkonIconCacheDisable()));
+
+    mOptionMenuActions.mToolsDisableExtendedErrors = mOptionMenuActions.mToolsMenu->addAction("Disable extended errors", this, SLOT(toolsDisableExtendedErrors()));
+    mOptionMenuActions.mToolsDumpMsgStoreWalk = mOptionMenuActions.mToolsMenu->addAction("Dump msg. store walk", this, SLOT(toolsDumpMsgStoreWalk()));
+    mOptionMenuActions.mToolsDumpMsgStoreWalk->setVisible(false);
+    mOptionMenuActions.mToolsEditDataTypes = mOptionMenuActions.mToolsMenu->addAction("Edit data types", this, SLOT(toolsEditDataTypes()));
+    mOptionMenuActions.mToolsEditDataTypes->setVisible(false);
+    mOptionMenuActions.mToolsEnableExtendedErrors = mOptionMenuActions.mToolsMenu->addAction("Enable extended errors", this, SLOT(toolsEnableExtendedErrors()));
+
+    mOptionMenuActions.mToolsErrorSimulateMenu = mOptionMenuActions.mToolsMenu->addMenu("Error simulate");
+    mOptionMenuActions.mToolsErrorSimulateLeave = mOptionMenuActions.mToolsErrorSimulateMenu->addAction("Leave", this, SLOT(toolsErrorSimulateLeave()));
+    mOptionMenuActions.mToolsErrorSimulatePanic = mOptionMenuActions.mToolsErrorSimulateMenu->addAction("Panic", this, SLOT(toolsErrorSimulatePanic()));
+    mOptionMenuActions.mToolsErrorSimulatePanic->setVisible(false);
+    mOptionMenuActions.mToolsErrorSimulateException = mOptionMenuActions.mToolsErrorSimulateMenu->addAction("Exception", this, SLOT(toolsErrorSimulateException()));
+
+//    mOptionMenuActions.mLocalConnectivityMenu = mOptionMenuActions.mToolsMenu->addMenu("Local connectivity");
+//    mOptionMenuActions.mToolsLocalConnectivityActivateInfrared = mOptionMenuActions.mLocalConnectivityMenu->addAction("Activate infrared", this, SLOT(toolsLocalConnectivityActivateInfrared()));
+//    mOptionMenuActions.mToolsLocalConnectivityLaunchBTUI = mOptionMenuActions.mLocalConnectivityMenu->addAction("Launch BT UI", this, SLOT(toolsLocalConnectivityLaunchBTUI()));
+//    mOptionMenuActions.mToolsLocalConnectivityLaunchUSBUI = mOptionMenuActions.mLocalConnectivityMenu->addAction("Launch USB UI", this, SLOT(toolsLocalConnectivityLaunchUSBUI()));
+
+    mOptionMenuActions.mToolsMessageAttachmentsMenu = mOptionMenuActions.mToolsMenu->addMenu("Message attachments");
+    mOptionMenuActions.mToolsMessageAttachmentsMenu->menuAction()->setVisible(false);
+    mOptionMenuActions.mToolsMessageInbox = mOptionMenuActions.mToolsMessageAttachmentsMenu->addAction("Inbox", this, SLOT(toolsMessageInbox()));
+    mOptionMenuActions.mToolsMessageDrafts = mOptionMenuActions.mToolsMessageAttachmentsMenu->addAction("Drafts", this, SLOT(toolsMessageDrafts()));
+    mOptionMenuActions.mToolsMessageSentItems = mOptionMenuActions.mToolsMessageAttachmentsMenu->addAction("Sent items", this, SLOT(toolsMessageSentItems()));
+    mOptionMenuActions.mToolsMessageOutbox = mOptionMenuActions.mToolsMessageAttachmentsMenu->addAction("Outbox", this, SLOT(toolsMessageOutbox()));
+
+    mOptionMenuActions.mToolsMemoryInfo = mOptionMenuActions.mToolsMenu->addAction("Memory info", this, SLOT(toolsMemoryInfo()));
+    mOptionMenuActions.mToolsMemoryInfo->setVisible(false);
+
+    mOptionMenuActions.mToolsSecureBackupMenu = mOptionMenuActions.mToolsMenu->addMenu("Secure backup");
+    mOptionMenuActions.mToolsSecureBackupMenu->menuAction()->setVisible(false);
+    mOptionMenuActions.mToolsSecureBackStart = mOptionMenuActions.mToolsSecureBackupMenu->addAction("Start backup", this, SLOT(toolsSecureBackStart()));
+    mOptionMenuActions.mToolsSecureBackRestore = mOptionMenuActions.mToolsSecureBackupMenu->addAction("Start restore", this, SLOT(toolsSecureBackRestore()));
+    mOptionMenuActions.mToolsSecureBackStop = mOptionMenuActions.mToolsSecureBackupMenu->addAction("Stop", this, SLOT(toolsSecureBackStop()));
+
+    mOptionMenuActions.mToolsSetDebugMask = mOptionMenuActions.mToolsMenu->addAction("Set debug mask", this, SLOT(toolsSetDebugMaskQuestion()));
+    mOptionMenuActions.mToolsShowOpenFilesHere = mOptionMenuActions.mToolsMenu->addAction("Show open files here", this, SLOT(toolsShowOpenFilesHere()));
+    mOptionMenuActions.mToolsShowOpenFilesHere->setVisible(false);
+}
+
+/**
+  Creates Setting menu item in option menu
+  */
+void FbDriveView::createSettingsMenuItem()
+{
+    mOptionMenuActions.mSetting = menu()->addAction("Settings...");
+    connect(mOptionMenuActions.mSetting, SIGNAL(triggered()), this, SIGNAL(aboutToShowSettingsView()));
+}
+
+
+/**
+  Creates About menu item in option menu
+  */
+void FbDriveView::createAboutMenuItem()
+{
+    // about note
+    mOptionMenuActions.mAbout = menu()->addAction("About");
+    connect(mOptionMenuActions.mAbout, SIGNAL(triggered()), this, SLOT(about()));
+}
+
+/**
+  Creates Exit menu item in option menu
+  */
+void FbDriveView::createExitMenuItem()
+{
+    // application exit
+    mOptionMenuActions.mExit = menu()->addAction("Exit");
+    connect(mOptionMenuActions.mExit, SIGNAL(triggered()), qApp, SLOT(quit()));
+}
+
+/**
+  update menu: disk admin available only in device root view. edit available only in folder view
+  when file or folder content exist in current folder, or clipboard has copied item.
+  file and view menus updated every time regarding the folder content.
+  tools, settings, about, exit always available.
+  If there's remove and add operations at same time, always remove first
+  to keep to the correct menu items order.
+  */
+void FbDriveView::updateOptionMenu()
+{
+    bool isFileItemListEmpty = mFbDriveModel->rowCount() == 0;
+//    bool isDriveListViewActive = true; //mEngineWrapper->isDriveListViewActive();
+    bool isNormalModeActive = true;       //iModel->FileUtils()->IsNormalModeActive();
+//    bool isCurrentDriveReadOnly = mEngineWrapper->isCurrentDriveReadOnly();   //iModel->FileUtils()->IsCurrentDriveReadOnly();
+//    bool isCurrentItemDirectory = mEngineWrapper->getFileEntry(currentItemIndex()).isDir();
+    // bool currentSelected = true;    //iContainer->ListBox()->View()->ItemIsSelected(iContainer->ListBox()->View()->CurrentItemIndex());
+//    bool isAllSelected = mListView->selectionModel()->selection().count() == mFbDriveModel->rowCount();
+    //bool isNoneSelected = mListView->selectionModel()->selection().count() != 0;
+//    bool hasSelectedItems = mListView->selectionModel()->selection().count() != 0;
+    //bool isSelectionMode = mOptionMenuActions.mSelection && mOptionMenuActions.mSelection->isChecked();
+    bool isClipBoardEmpty = !mEngineWrapper->isClipBoardListInUse();
+    bool showSnapShot = false;           //iModel->FileUtils()->DriveSnapShotPossible();
+
+    bool showEditMenu(true);
+    if (!showSnapShot || isFileItemListEmpty && isClipBoardEmpty)
+        showEditMenu = false;
+    else
+        showEditMenu = true;
+
+    mOptionMenuActions.mEditMenu->menuAction()->setVisible(showEditMenu);
+
+    //aMenuPane->SetItemDimmed(EFileBrowserCmdFileOpen, isFileItemListEmpty || isDriveListViewActive || isCurrentItemDirectory);
+//    mOptionMenuActions.mFileOpenDrive->setVisible( !(isFileItemListEmpty || !isDriveListViewActive));
+
+    //aMenuPane->SetItemDimmed(EFileBrowserCmdFileView, isFileItemListEmpty || !hasSelectedItems || isCurrentItemDirectory || isDriveListViewActive);
+    //aMenuPane->SetItemDimmed(EFileBrowserCmdFileEdit, isFileItemListEmpty || !hasSelectedItems || isCurrentItemDirectory || isDriveListViewActive);
+    //aMenuPane->SetItemDimmed(EFileBrowserCmdFileSendTo, isFileItemListEmpty || driveListActive || isCurrentItemDirectory);
+
+    // TODO mOptionMenuActions.mFileCompress->setVisible(!(isCurrentDriveReadOnly || isFileItemListEmpty || !hasSelectedItems || isCurrentItemDirectory || isDriveListViewActive));
+    // TODO mOptionMenuActions.mFileDecompress->setVisible(!(isCurrentDriveReadOnly || isFileItemListEmpty || !hasSelectedItems || isCurrentItemDirectory || isDriveListViewActive));
+
+    // TODO mOptionMenuActions.mEditSnapShotToE->setVisible(isDriveListViewActive);
+
+    // TODO mOptionMenuActions.mViewSort->setVisible(!(!isNormalModeActive || isDriveListViewActive || isFileItemListEmpty));
+    // TODO mOptionMenuActions.mViewOrder->setVisible(!(!isNormalModeActive || isDriveListViewActive || isFileItemListEmpty));
+    mOptionMenuActions.mViewRefresh->setVisible(isNormalModeActive);
+    //mOptionMenuActions.mViewFilterEntries->setVisible(!isFileItemListEmpty);
+
+    // TODO R_FILEBROWSER_VIEW_SORT_SUBMENU
+    // aMenuPane->SetItemButtonState(iModel->FileUtils()->SortMode(), EEikMenuItemSymbolOn);
+
+    // TODO R_FILEBROWSER_VIEW_ORDER_SUBMENU
+    // aMenuPane->SetItemButtonState(iModel->FileUtils()->OrderMode(), EEikMenuItemSymbolOn);
+
+    // aResourceId == R_FILEBROWSER_TOOLS_SUBMENU
+    bool noExtendedErrorsAllowed = mEngineWrapper->ErrRdFileExists();
+    mOptionMenuActions.mToolsDisableExtendedErrors->setVisible(noExtendedErrorsAllowed);
+    mOptionMenuActions.mToolsEnableExtendedErrors->setVisible(!noExtendedErrorsAllowed);
+
+//    bool infraRedAllowed = mEngineWrapper->FileExists(KIRAppPath);
+//    bool bluetoothAllowed = mEngineWrapper->FileExists(KBTAppPath);
+//    bool usbAllowed = mEngineWrapper->FileExists(KUSBAppPath);
+//
+//    bool noLocalCon = !infraRedAllowed && !bluetoothAllowed && !usbAllowed;
+//    mOptionMenuActions.mToolsLocalConnectivityMenu->menuAction()->setVisible(!noLocalCon);
+//
+//    mOptionMenuActions.mToolsLocalConnectivityActivateInfrared->setVisible(infraRedAllowed);
+//    mOptionMenuActions.mToolsLocalConnectivityLaunchBTUI->setVisible(bluetoothAllowed);
+//    mOptionMenuActions.mToolsLocalConnectivityLaunchUSBUI->setVisible(usbAllowed);
+}
+
+void FbDriveView::createContextMenu()
+{
+    mContextMenu = new HbMenu();
+    connect(mContextMenu, SIGNAL(aboutToShow()), this, SLOT(updateContextMenu()));
+
+    createFileContextMenu();
+    createEditContextMenu();
+    createViewContextMenu();
+    createDiskAdminContextMenu();
+}
+
+
+void FbDriveView::createFileContextMenu()
+{
+    //mContextMenuActions.mFileMenu = mContextMenu->addMenu("File");
+
+    //mContextMenuActions.mFileOpenDrive = mContextMenuActions.mFileMenu->addAction("Open drive (->)", this, SLOT(fileOpenDrive()));
+//    mContextMenuActions.mFileSearch = mContextMenuActions.mFileMenu->addAction("Search...", this, SLOT(fileSearch()));
+    //mContextMenuActions.mFileSearch->setVisible(false);
+
+    //mContextMenuActions.mFileProperties = mContextMenuActions.mFileMenu->addAction("Properties", this, SLOT(fileProperties()));
+    mContextMenuActions.mFileProperties = mContextMenu->addAction("Properties", this, SLOT(fileProperties()));
+    mContextMenuActions.mFileSearch = mContextMenu->addAction("Search...", this, SLOT(fileSearch()));
+
+//    mContextMenuActions.mFileSetAttributes = mContextMenuActions.mFileMenu->addAction("Set attributes...", this, SLOT(fileSetAttributes()));
+//    mContextMenuActions.mFileSetAttributes->setVisible(false);
+}
+
+void FbDriveView::createEditContextMenu()
+{
+//    mContextMenuActions.mEditMenu = mContextMenu->addMenu("Edit");
+
+    //mContextMenuActions.mEditSnapShotToE = mContextMenuActions.mEditMenu->addAction("Snap shot to E:", this, SLOT(editSnapShotToE()));
+//    mContextMenuActions.mEditSnapShotToE->setVisible(false);
+//    mContextMenuActions.mEditCut = mContextMenuActions.mEditMenu->addAction("Cut", this, SLOT(editCut()));
+//    mContextMenuActions.mEditCopy = mContextMenuActions.mEditMenu->addAction("Copy", this, SLOT(editCopy()));
+//    mContextMenuActions.mEditPaste = mContextMenuActions.mEditMenu->addAction("Paste", this, SLOT(editPaste()));
+//    mContextMenuActions.mEditCopyToFolder = mContextMenuActions.mEditMenu->addAction("Copy to folder...", this, SLOT(editCopyToFolder()));
+//    mContextMenuActions.mEditMoveToFolder = mContextMenuActions.mEditMenu->addAction("Move to folder...", this, SLOT(editMoveToFolder()));
+}
+
+void FbDriveView::createViewContextMenu()
+{
+
+}
+
+/**
+  Initial setup for Disk Admin submenu
+  */
+void FbDriveView::createDiskAdminContextMenu()
+{
+    mContextMenuActions.mDiskAdminMenu = mContextMenu->addMenu("Disk admin");
+    //mContextMenuActions.mDiskAdminMenu->menuAction()->setVisible(false);
+
+    mContextMenuActions.mDiskAdminSetDrivePassword = mContextMenuActions.mDiskAdminMenu->addAction("Set drive password", this, SLOT(diskAdminSetDrivePassword()));
+    mContextMenuActions.mDiskAdminUnlockDrive = mContextMenuActions.mDiskAdminMenu->addAction("Unlock drive", this, SLOT(diskAdminUnlockDrive()));
+    mContextMenuActions.mDiskAdminClearDrivePassword = mContextMenuActions.mDiskAdminMenu->addAction("Clear drive password", this, SLOT(diskAdminClearDrivePassword()));
+    mContextMenuActions.mDiskAdminEraseDrivePassword = mContextMenuActions.mDiskAdminMenu->addAction("Erase drive password", this, SLOT(diskAdminEraseDrivePassword()));
+
+    mContextMenuActions.mDiskAdminFormatDrive = mContextMenuActions.mDiskAdminMenu->addAction("Format drive", this, SLOT(diskAdminFormatDrive()));
+    mContextMenuActions.mDiskAdminFormatDrive->setVisible(false);
+    mContextMenuActions.mDiskAdminQuickFormatDrive = mContextMenuActions.mDiskAdminMenu->addAction("Quick format drive", this, SLOT(diskAdminQuickFormatDrive()));
+    mContextMenuActions.mDiskAdminQuickFormatDrive->setVisible(false);
+
+    mContextMenuActions.mDiskAdminCheckDisk = mContextMenuActions.mDiskAdminMenu->addAction("Check disk", this, SLOT(diskAdminCheckDisk()));
+    mContextMenuActions.mDiskAdminScanDrive = mContextMenuActions.mDiskAdminMenu->addAction("Scan drive", this, SLOT(diskAdminScanDrive()));
+    mContextMenuActions.mDiskAdminSetDriveName = mContextMenuActions.mDiskAdminMenu->addAction("Set drive name", this, SLOT(diskAdminSetDriveName()));
+    mContextMenuActions.mDiskAdminSetDriveVolumeLabel = mContextMenuActions.mDiskAdminMenu->addAction("Set drive volume label", this, SLOT(diskAdminSetDriveVolumeLabel()));
+    mContextMenuActions.mDiskAdminEjectDrive = mContextMenuActions.mDiskAdminMenu->addAction("Eject drive", this, SLOT(diskAdminEjectDrive()));
+    mContextMenuActions.mDiskAdminDismountDrive = mContextMenuActions.mDiskAdminMenu->addAction("Dismount drive", this, SLOT(diskAdminDismountDrive()));
+    mContextMenuActions.mDiskAdminEraseMBR = mContextMenuActions.mDiskAdminMenu->addAction("Erase MBR", this, SLOT(diskAdminEraseMBR()));
+    mContextMenuActions.mDiskAdminPartitionDrive = mContextMenuActions.mDiskAdminMenu->addAction("Partition drive", this, SLOT(diskAdminPartitionDrive()));
+}
+
+void FbDriveView::updateContextMenu()
+{
+    bool isFileItemListEmpty = mFbDriveModel->rowCount() == 0;
+    mContextMenuActions.mFileProperties->setVisible(!isFileItemListEmpty);
+}
+
+// ---------------------------------------------------------------------------
+
+void FbDriveView::onLongPressed(HbAbstractViewItem *listViewItem, QPointF coords)
+{
+    mCurrentIndex = listViewItem->modelIndex();
+
+    mContextMenu->setPreferredPos(coords);
+    mContextMenu->show();
+}
+
+/**
+  Refresh FileBrowser view
+  */
+void FbDriveView::refreshList()
+{
+    mEngineWrapper->refreshView();
+    mListView->reset();
+
+    TListingMode listingMode = mEngineWrapper->listingMode();
+    if (listingMode == ENormalEntries)
+        mNaviPane->setPlainText(QString(mEngineWrapper->currentPath()));
+    else if (listingMode == ESearchResults)
+        mNaviPane->setPlainText(QString(tr("Search results")));
+    else if (listingMode == EOpenFiles)
+        mNaviPane->setPlainText(QString(tr("Open files")));
+    else if (listingMode == EMsgAttachmentsInbox)
+        mNaviPane->setPlainText(QString(tr("Attachments in Inbox")));
+    else if (listingMode == EMsgAttachmentsDrafts)
+        mNaviPane->setPlainText(QString(tr("Attachments in Drafts")));
+    else if (listingMode == EMsgAttachmentsSentItems)
+        mNaviPane->setPlainText(QString(tr("Attachments in Sent Items")));
+    else if (listingMode == EMsgAttachmentsOutbox)
+        mNaviPane->setPlainText(QString(tr("Attachments in Outbox")));
+}
+
+// ---------------------------------------------------------------------------
+/**
+  Show a list dialog
+  \param List aList of item to select item from.
+  \param Title text titleText of a dialog heading widget
+  \return None
+  */
+void FbDriveView::openListDialog(const QStringList& items, const QString &titleText, QObject* receiver, const char* member)
+{
+    // Create a list and some simple content for it
+    HbSelectionDialog *dlg = new HbSelectionDialog();
+    dlg->setAttribute(Qt::WA_DeleteOnClose);
+    // Set items to be popup's content
+    dlg->setStringItems(items);
+    dlg->setSelectionMode(HbAbstractItemView::SingleSelection);
+
+    HbLabel *title = new HbLabel(dlg);
+    title->setPlainText(titleText);
+    dlg->setHeadingWidget(title);
+
+    // Launch popup and handle the user response:
+    dlg->open(receiver, member);
+}
+
+// ---------------------------------------------------------------------------
+
+void FbDriveView::openPropertyDialog(const QStringList& propertyList, const QString& title)
+{
+    HbDialog *dialog = new HbDialog();
+    dialog->setDismissPolicy(HbPopup::TapOutside);
+    dialog->setTimeout(HbPopup::NoTimeout);
+
+    HbLabel *titleWidget = new HbLabel();
+    titleWidget->setPlainText(title);
+    dialog->setHeadingWidget(titleWidget);
+
+    // Create a list and some simple content for it
+    HbListWidget *list = new HbListWidget();
+    QString str;
+    foreach (str, propertyList) {
+        list->addItem(str);
+    }
+
+    // Connect list item activation signal to close the popup
+    connect(list, SIGNAL(activated(HbListWidgetItem*)), dialog, SLOT(close()));
+
+    HbAction *cancelAction = new HbAction("Close");
+    dialog->setPrimaryAction(cancelAction);
+
+    // Set listwidget to be popup's content
+    dialog->setContentWidget(list);
+    // Launch popup and handle the user response:
+    dialog->open();
+}
+
+void FbDriveView::storeSelectedItemsOrCurrentItem()
+{
+    QItemSelectionModel *selectionIndexes = mListView->selectionModel();
+
+    // by default use selected items
+    if (selectionIndexes) {
+        if (selectionIndexes->hasSelection()) {
+            mSelectionIndexes = mListView->selectionModel()->selectedIndexes();
+        } else { // or if none selected, use the current item index
+            mSelectionIndexes.clear();
+            mSelectionIndexes.append(mCurrentIndex);
+//            QModelIndex currentIndex = currentItemIndex();
+//            if (mFbDriveModel->rowCount(currentItemIndex) > currentItemIndex && currentItemIndex >= 0)
+//            {
+//                modelIndexList.append(currentIndex);
+//            }
+        }
+    }
+//    mClipBoardInUse = true;
+}
+
+// ---------------------------------------------------------------------------
+
+QModelIndex FbDriveView::currentItemIndex()
+{
+    return mCurrentIndex;//mListView->selectionModel()->currentIndex();
+}
+
+// ---------------------------------------------------------------------------
+// operations in File Menu
+// ---------------------------------------------------------------------------
+
+void FbDriveView::fileOpenDrive()
+{
+    // TODO make a separate function to be called from here and fileOpenDirectory()
+    mLocationChanged = true;
+    // get selected drive or directory from list view model and open it:
+    //if (mListView->selectionModel()->hasSelection()) {
+//    if (mListView->selectionModel()->selection().count() != 0) {
+//        QModelIndex currentIndex = currentItemIndex();
+        mEngineWrapper->moveDownToDirectory(mCurrentIndex);
+        mListView->setRootIndex(mCurrentIndex);
+        refreshList();
+//    } else {
+//        Notifications::showErrorNote("not selected item!");
+//    }
+}
+
+void FbDriveView::fileSearch()
+{
+    QString searchPath;
+    HbAction *contextrMenuAction = static_cast<HbAction *>(sender());
+    if (contextrMenuAction
+        && contextrMenuAction->text().compare(QString("Search..."), Qt::CaseInsensitive) == 0
+        && contextrMenuAction == mContextMenuActions.mFileSearch) {
+        DriveEntry driveEntry(mEngineWrapper->getDriveEntry(currentItemIndex()));
+        searchPath = driveEntry.driveLetter() + QString(":\\");
+    } else {
+        searchPath = mEngineWrapper->currentPath();
+    }
+    emit aboutToShowSearchView(searchPath);
+}
+
+/**
+  Show file properties
+  */
+void FbDriveView::fileProperties()
+{
+    QModelIndex currentIndex = currentItemIndex();
+    QStringList propertyList;
+    QString titleText;
+    mEngineWrapper->properties(currentIndex, propertyList, titleText);
+    openPropertyDialog(propertyList, titleText);
+}
+
+void FbDriveView::fileSetAttributes()
+{
+
+}
+
+// edit menu
+void FbDriveView::editSnapShotToE()
+{
+
+}
+
+// ---------------------------------------------------------------------------
+// view menu
+// ---------------------------------------------------------------------------
+
+/**
+  Refresh view
+  */
+void FbDriveView::viewRefresh()
+{
+    refreshList();
+}
+
+// ---------------------------------------------------------------------------
+// disk admin menu
+// ---------------------------------------------------------------------------
+
+/**
+  Open old password for the selected drive dialog.
+  */
+void FbDriveView::diskAdminSetDrivePassword()
+{
+    QModelIndex currentIndex = currentItemIndex();
+    // check if the drive has a password
+    if (mEngineWrapper->hasDrivePassword(currentIndex)) {
+        QString heading = QString("Existing password");
+        HbInputDialog::getText(heading, this, SLOT(diskAdminSetDrivePasswordNew(HbAction*)), QString(), scene());
+    } else {
+        QString heading = QString("New password");
+        HbInputDialog::getText(heading, this, SLOT(doDiskAdminSetDrivePassword(HbAction*)), mOldPassword, scene());
+    }
+}
+
+/**
+   Open new password for the selected drive dialog.
+  */
+void FbDriveView::diskAdminSetDrivePasswordNew(HbAction *action)
+{
+    HbInputDialog *dlg = static_cast<HbInputDialog*>(sender());
+    if (dlg && action && action->text().compare(QString("Ok"), Qt::CaseInsensitive) == 0) {
+        mOldPassword = dlg->value().toString();
+        QString heading = QString("New password");
+        HbInputDialog::getText(heading, this, SLOT(doDiskAdminSetDrivePassword(HbAction*)), mOldPassword, scene());
+    }
+}
+
+/**
+   Set password for the selected drive.
+  */
+void FbDriveView::doDiskAdminSetDrivePassword(HbAction *action)
+{
+    HbInputDialog *dlg = static_cast<HbInputDialog*>(sender());
+    if (dlg && action && action->text().compare(QString("Ok"), Qt::CaseInsensitive) == 0) {
+        QString newPassword = dlg->value().toString();
+        QModelIndex currentIndex = currentItemIndex();
+        mEngineWrapper->DiskAdminSetDrivePassword(currentIndex, mOldPassword, newPassword);
+        refreshList();
+        mOldPassword = QString();
+        newPassword = QString();
+    }
+}
+
+/**
+  Open Unlock the selected drive dialog.
+  */
+void FbDriveView::diskAdminUnlockDrive()
+{
+    QModelIndex currentIndex = currentItemIndex();
+    // check if the drive is locked
+    if (mEngineWrapper->isDriveLocked(currentIndex)) {
+        QString heading = QString("Existing password");
+        HbInputDialog::getText(heading, this, SLOT(doDiskAdminUnlockDrive(HbAction*)), QString(), scene());
+    } else {
+        Notifications::showInformationNote(QString("This drive is not locked"));
+    }
+}
+
+/**
+  Unlock the selected drive.
+  */
+void FbDriveView::doDiskAdminUnlockDrive(HbAction *action)
+{
+    HbInputDialog *dlg = static_cast<HbInputDialog*>(sender());
+    if (dlg && action && action->text().compare(QString("Ok"), Qt::CaseInsensitive) == 0) {
+        QString oldPassword = dlg->value().toString();
+        QModelIndex currentIndex = currentItemIndex();
+        mEngineWrapper->DiskAdminUnlockDrive(currentIndex, oldPassword);
+        refreshList();
+    }
+}
+
+/**
+  Open clear password of the selected drive dialog.
+  */
+void FbDriveView::diskAdminClearDrivePassword()
+{
+    QModelIndex currentIndex = currentItemIndex();
+    // check if the drive has a password
+    if (mEngineWrapper->hasDrivePassword(currentIndex)) {
+        QString heading = QString("Existing password");
+        HbInputDialog::getText(heading, this, SLOT(doDiskAdminClearDrivePassword(HbAction*)), QString(), scene());
+    } else {
+        Notifications::showInformationNote(QString("This drive has no password"));
+    }
+}
+
+/**
+  Clear password of the selected drive.
+  */
+void FbDriveView::doDiskAdminClearDrivePassword(HbAction *action)
+{
+    HbInputDialog *dlg = static_cast<HbInputDialog*>(sender());
+    if (dlg && action && action->text().compare(QString("Ok"), Qt::CaseInsensitive) == 0) {
+        QString oldPassword = dlg->value().toString();
+        QModelIndex currentIndex = currentItemIndex();
+        mEngineWrapper->DiskAdminClearDrivePassword(currentIndex, oldPassword);
+        refreshList();
+    }
+}
+
+
+/**
+  Question for erase password of the selected drive
+  */
+void FbDriveView::diskAdminEraseDrivePassword()
+{
+    // check if the drive has a password
+    QModelIndex currentIndex = currentItemIndex();
+    if (mEngineWrapper->hasDrivePassword(currentIndex)) {
+        HbMessageBox::question(QString("Are you sure? All data can be lost!"), this, SLOT(doDiskAdminEraseDrivePassword(HbAction*)));
+    } else {
+        Notifications::showInformationNote(QString("This drive has no password"));
+    }
+}
+
+/**
+  Erase password of the selected drive
+  */
+void FbDriveView::doDiskAdminEraseDrivePassword(HbAction* action)
+{
+    if (action && action->text().compare(QString("Yes"), Qt::CaseInsensitive) == 0) {
+        QModelIndex currentIndex = currentItemIndex();
+        mEngineWrapper->DiskAdminEraseDrivePassword(currentIndex);
+        refreshList();
+    }
+}
+
+/**
+  Performs format on the selected drive
+  */
+void FbDriveView::diskAdminFormatDrive()
+{
+    HbMessageBox::question(QString("Are you sure? All data will be lost!"), this, SLOT(doDiskAdminFormatDrive(HbAction*)));
+}
+
+/**
+  Performs format on the selected drive
+  */
+void FbDriveView::doDiskAdminFormatDrive(HbAction* action)
+{
+    if (action && action->text().compare(QString("Yes"), Qt::CaseInsensitive) == 0) {
+        QModelIndex currentIndex = currentItemIndex();
+        mEngineWrapper->DiskAdminFormatDrive(currentIndex, false);
+    }
+}
+
+/**
+  Performs quick format on the selected drive
+  */
+void FbDriveView::diskAdminQuickFormatDrive()
+{
+    HbMessageBox::question(QString("Are you sure? All data will be lost!"), this, SLOT(doDiskAdminQuickFormatDrive(HbAction*)));
+}
+
+/**
+  Performs quick format on the selected drive
+  */
+void FbDriveView::doDiskAdminQuickFormatDrive(HbAction* action)
+{
+    if (action && action->text().compare(QString("Yes"), Qt::CaseInsensitive) == 0) {
+        QModelIndex currentIndex = currentItemIndex();
+        mEngineWrapper->DiskAdminFormatDrive(currentIndex, true);
+    }
+}
+
+/**
+    Checks the disk integrity on the selected drive
+  */
+void FbDriveView::diskAdminCheckDisk()
+{
+    QModelIndex currentIndex = currentItemIndex();
+    mEngineWrapper->DiskAdminCheckDisk(currentIndex);
+}
+
+/**
+  Checks the selected drive for errors and corrects them
+  */
+void FbDriveView::diskAdminScanDrive()
+{
+    HbMessageBox::question(QString("This finds errors on disk and corrects them. Proceed?"), this, SLOT(doDiskAdminScanDrive(HbAction*)));
+}
+
+/**
+  Checks the selected drive for errors and corrects them
+  */
+void FbDriveView::doDiskAdminScanDrive(HbAction* action)
+{
+    if (action && action->text().compare(QString("Yes"), Qt::CaseInsensitive) == 0) {
+        QModelIndex currentIndex = currentItemIndex();
+        mEngineWrapper->DiskAdminScanDrive(currentIndex);
+        refreshList();
+    }
+}
+
+/**
+  Open drive name dialog
+  */
+void FbDriveView::diskAdminSetDriveName()
+{
+    QString driveName;
+
+    // get existing drive name
+    QModelIndex currentIndex = currentItemIndex();
+    mEngineWrapper->GetDriveName(currentIndex, driveName);
+
+    QString heading = QString("New name");
+    HbInputDialog::getText(heading, this, SLOT(doDiskAdminSetDriveName(HbAction*)), driveName, scene());
+}
+
+/**
+  Set drive name.
+  */
+void FbDriveView::doDiskAdminSetDriveName(HbAction *action)
+{
+    HbInputDialog *dlg = static_cast<HbInputDialog*>(sender());
+    if (dlg && action && action->text().compare(QString("Ok"), Qt::CaseInsensitive) == 0) {
+        QString driveName = dlg->value().toString();
+
+        QModelIndex currentIndex = currentItemIndex();
+        mEngineWrapper->DiskAdminSetDriveName(currentIndex, driveName);
+
+        refreshList();
+    }
+}
+
+/**
+  Open drive volume label dialog
+  */
+void FbDriveView::diskAdminSetDriveVolumeLabel()
+{
+    QString volumeLabel;
+
+    // get existing drive name
+    QModelIndex currentIndex = currentItemIndex();
+    mEngineWrapper->GetDriveVolumeLabel(currentIndex, volumeLabel);
+
+    QString heading = QString("New volume label");
+    HbInputDialog::getText(heading, this, SLOT(doDiskAdminSetDriveVolumeLabel(HbAction*)), volumeLabel, scene());
+}
+
+/**
+  Set drive volume label.
+  */
+void FbDriveView::doDiskAdminSetDriveVolumeLabel(HbAction *action)
+{
+    HbInputDialog *dlg = static_cast<HbInputDialog*>(sender());
+    if (dlg && action && action->text().compare(QString("Ok"), Qt::CaseInsensitive) == 0) {
+        QString volumeLabel = dlg->value().toString();
+
+        QModelIndex currentIndex = currentItemIndex();
+        mEngineWrapper->DiskAdminSetDriveVolumeLabel(currentIndex, volumeLabel);
+
+        refreshList();
+    }
+}
+
+/**
+  Eject the selected drive
+  */
+void FbDriveView::diskAdminEjectDrive()
+{
+    QModelIndex currentIndex = currentItemIndex();
+    mEngineWrapper->DiskAdminEjectDrive(currentIndex);
+    refreshList();
+}
+
+/**
+  Dismount the selected drive
+  */
+void FbDriveView::diskAdminDismountDrive()
+{
+    HbMessageBox::question(QString("Are you sure you know what are you doing?"), this, SLOT(doDiskAdminDismountDrive(HbAction*)));
+}
+
+void FbDriveView::doDiskAdminDismountDrive(HbAction* action)
+{
+    if (action && action->text().compare(QString("Yes"), Qt::CaseInsensitive) == 0) {
+        QModelIndex currentIndex = currentItemIndex();
+        mEngineWrapper->DiskAdminDismountDrive(currentIndex);
+        refreshList();
+    }
+}
+
+/**
+  Erase Master Boot Record of the selected drive
+  */
+void FbDriveView::diskAdminEraseMBR()
+{
+    // TODO What to do with FB LITE macros?
+    HbMessageBox::question(QString("Are you sure? Your media driver must support this!"), this, SLOT(doDiskAdminEraseMBR(HbAction*)));
+}
+
+void FbDriveView::doDiskAdminEraseMBR(HbAction* action)
+{
+    // TODO What to do with FB LITE macros?
+    if (action && action->text().compare(QString("Yes"), Qt::CaseInsensitive) == 0) {
+        HbMessageBox::question(QString("Are you really sure you know what are you doing ?!?"), this, SLOT(doDiskAdminReallyEraseMBR(HbAction*)));
+    }
+}
+
+void FbDriveView::doDiskAdminReallyEraseMBR(HbAction* action)
+{
+    if (action && action->text().compare(QString("Yes"), Qt::CaseInsensitive) == 0) {
+        QModelIndex currentIndex = currentItemIndex();
+        // warn if the selected drive is not detected as removable
+        if (mEngineWrapper->isDriveRemovable(currentIndex)) {
+            mEngineWrapper->DiskAdminEraseMBR(currentIndex);
+            refreshList();
+        } else {
+            HbMessageBox::question(QString("Selected drive is not removable, really continue?"), this, SLOT(doDiskAdminNotRemovableReallyEraseMBR(HbAction*)));
+        }
+    }
+}
+
+void FbDriveView::doDiskAdminNotRemovableReallyEraseMBR(HbAction* action)
+{
+    if (action && action->text().compare(QString("Yes"), Qt::CaseInsensitive) == 0) {
+        QModelIndex currentIndex = currentItemIndex();
+        mEngineWrapper->DiskAdminEraseMBR(currentIndex);
+        refreshList();
+    }
+
+}
+
+/**
+  Partition the selected drive
+  */
+void FbDriveView::diskAdminPartitionDrive()
+{
+    const QString message("Are you sure? Your media driver must support this!");
+    HbMessageBox::question(message, this, SLOT(diskAdminPartitionDriveProceed(HbAction *)));
+}
+
+/**
+  Partition the selected drive if user is sure
+  */
+void FbDriveView::diskAdminPartitionDriveProceed(HbAction *action)
+{
+    if (action && action->text().compare(QString("Yes"), Qt::CaseInsensitive) == 0) {
+        const QString message("Are you really sure you know what are you doing ?!?");
+        HbMessageBox::question(message, this, SLOT(diskAdminPartitionDriveReallyProceed(HbAction *)));
+    }
+}
+
+/**
+  Partition the selected drive if user is really sure
+  */
+void FbDriveView::diskAdminPartitionDriveReallyProceed(HbAction *action)
+{
+    if (action && action->text().compare(QString("Yes"), Qt::CaseInsensitive) == 0) {
+        QModelIndex currentIndex = currentItemIndex();
+        mEraseMBR = false;
+        // warn if the selected drive is not detected as removable
+        mProceed = false;
+        if (mEngineWrapper->isDriveRemovable(currentIndex)) {
+            mProceed = true;
+        } else {
+            const QString message("Selected drive is not removable, really continue?");
+            HbMessageBox::question(message, this, SLOT(diskAdminPartitionDriveIsNotRemovable(HbAction *)));
+        }
+
+        if (mProceed) {
+            // query if erase mbr
+            mEraseMBR = false;
+
+            QString message("Erase MBR first (normally needed)?");
+            HbMessageBox::question(message, this, SLOT(diskAdminPartitionDriveEraseMbr(HbAction *)));
+
+            // TODO use HbListDialog
+            QStringList list;
+            list << "1" << "2" << "3" << "4";
+            openListDialog(list, QString("Partitions?"), this, SLOT(diskAdminPartitionDriveGetCount(HbAction*)));
+        }
+    }
+}
+
+/**
+  Store result of user query about proceeding when drive is not removable.
+  */
+void FbDriveView::diskAdminPartitionDriveIsNotRemovable(HbAction *action)
+{
+    if (action && action->text().compare(QString("Yes"), Qt::CaseInsensitive) == 0) {
+        mProceed = true;
+    } else {
+        mProceed = false;
+    }
+}
+
+/**
+  Store result of user query about erase MBR
+  */
+void FbDriveView::diskAdminPartitionDriveEraseMbr(HbAction *action)
+{
+    if (action && action->text().compare(QString("Yes"), Qt::CaseInsensitive) == 0) {
+        mEraseMBR = true;
+    }
+}
+
+/**
+  Partition the selected drive
+  */
+void FbDriveView::diskAdminPartitionDriveGetCount(HbAction* action)
+{
+    HbSelectionDialog *dlg = static_cast<HbSelectionDialog*>(sender());
+    if(!action && dlg && dlg->selectedItems().count()){
+        int selectionIndex = dlg->selectedItems().at(0).toInt();
+        QModelIndex currentIndex = currentItemIndex();
+        int amountOfPartitions = selectionIndex + 1;
+        mEngineWrapper->DiskAdminPartitionDrive(currentIndex, mEraseMBR, amountOfPartitions);
+        refreshList();
+    }
+}
+
+// ---------------------------------------------------------------------------
+// tools menu
+// ---------------------------------------------------------------------------
+void FbDriveView::toolsAllAppsToTextFile()
+{
+
+}
+
+/**
+  Write all files to text file
+  */
+void FbDriveView::toolsAllFilesToTextFile()
+{
+    mEngineWrapper->toolsWriteAllFiles();
+}
+
+//void FbDriveView::toolsAvkonIconCacheEnable()
+//{
+//
+//}
+//void FbDriveView::toolsAvkonIconCacheDisable()
+//{
+//
+//}
+
+/**
+  Disable extended errors
+  */
+void FbDriveView::toolsDisableExtendedErrors()
+{
+    mEngineWrapper->ToolsSetErrRd(false);
+}
+
+void FbDriveView::toolsDumpMsgStoreWalk()
+{
+
+}
+void FbDriveView::toolsEditDataTypes()
+{
+
+}
+
+/**
+  Enable extended errors
+  */
+void FbDriveView::toolsEnableExtendedErrors()
+{
+    mEngineWrapper->ToolsSetErrRd(true);
+}
+
+/**
+  Open simulate leave dialog
+  */
+void FbDriveView::toolsErrorSimulateLeave()
+{
+    int leaveCode = -6;
+    QString heading = QString("Leave code");
+    //HbInputDialog::getInteger(heading, this, SLOT(doToolsErrorSimulateLeave(HbAction*)), leaveCode, scene());
+    HbInputDialog::getText(heading, this, SLOT(doToolsErrorSimulateLeave(HbAction*)), QString::number(leaveCode), scene());
+}
+
+
+/**
+  Simulate leave.
+  */
+void FbDriveView::doToolsErrorSimulateLeave(HbAction *action)
+{
+    HbInputDialog *dlg = static_cast<HbInputDialog*>(sender());
+    if (dlg && action && action->text().compare(QString("Ok"), Qt::CaseInsensitive) == 0) {
+        bool ok;
+        int leaveCode = dlg->value().toString().toInt(&ok);
+        if (leaveCode != 0 || ok) {
+            mEngineWrapper->ToolsErrorSimulateLeave(leaveCode);
+        }
+    }
+}
+
+/**
+  Open simulate panic dialog.
+  */
+void FbDriveView::toolsErrorSimulatePanic()
+{
+    mPanicCategory = QString ("Test Category");
+    QString heading = QString("Panic category");
+    HbInputDialog::getText(heading, this, SLOT(doToolsErrorSimulatePanicCode(HbAction*)), mPanicCategory, scene());
+}
+
+/**
+  Simulate panic.
+  */
+void FbDriveView::doToolsErrorSimulatePanicCode(HbAction *action)
+{
+    HbInputDialog *dlg = static_cast<HbInputDialog*>(sender());
+    if (dlg && action && action->text().compare(QString("Ok"), Qt::CaseInsensitive) == 0) {
+        mPanicCategory = dlg->value().toString();
+        int panicCode(555);
+        QString heading = QString("Panic code");
+        HbInputDialog::getInteger(heading, this, SLOT(doToolsErrorSimulatePanic(HbAction*)), panicCode, scene());
+    }
+}
+
+/**
+  Simulate panic.
+  */
+void FbDriveView::doToolsErrorSimulatePanic(HbAction *action)
+{
+    HbInputDialog *dlg = static_cast<HbInputDialog*>(sender());
+    if (dlg && action && action->text().compare(QString("Ok"), Qt::CaseInsensitive) == 0) {
+        bool ok;
+        int panicCode = dlg->value().toInt(&ok);
+        if (panicCode != 0 || ok) {
+            mEngineWrapper->ToolsErrorSimulatePanic(mPanicCategory, panicCode);
+        }
+    }
+}
+
+/**
+  Open simulate exception dialog.
+  */
+void FbDriveView::toolsErrorSimulateException()
+{
+    int exceptionCode = 0;
+    QString heading = QString("Exception code");
+    HbInputDialog::getInteger(heading, this, SLOT(doToolsErrorSimulateException(HbAction*)), exceptionCode, scene());
+}
+
+/**
+  Simulate exception.
+  */
+void FbDriveView::doToolsErrorSimulateException(HbAction *action)
+{
+    HbInputDialog *dlg = static_cast<HbInputDialog*>(sender());
+    if (dlg && action && action->text().compare(QString("Ok"), Qt::CaseInsensitive) == 0) {
+        bool ok;
+        int exceptionCode = dlg->value().toInt(&ok);
+        if (exceptionCode != 0 || ok) {
+            mEngineWrapper->ToolsErrorSimulateException(exceptionCode);
+        }
+    }
+}
+
+//    void FbDriveView::toolsLocalConnectivityActivateInfrared()
+//{
+//
+//}
+//    void FbDriveView::toolsLocalConnectivityLaunchBTUI()
+//{
+//
+//}
+//    void FbDriveView::toolsLocalConnectivityLaunchUSBUI()
+//{
+//
+//}
+void FbDriveView::toolsMessageInbox()
+{
+
+}
+void FbDriveView::toolsMessageDrafts()
+{
+
+}
+void FbDriveView::toolsMessageSentItems()
+{
+
+}
+void FbDriveView::toolsMessageOutbox()
+{
+
+}
+void FbDriveView::toolsMemoryInfo()
+{
+
+}
+void FbDriveView::toolsSecureBackStart()
+{
+
+}
+void FbDriveView::toolsSecureBackRestore()
+{
+
+}
+void FbDriveView::toolsSecureBackStop()
+{
+
+}
+
+/**
+  Open debug mask dialog
+  */
+void FbDriveView::toolsSetDebugMaskQuestion()
+{
+    quint32 dbgMask = mEngineWrapper->getDebugMask();
+    QString dbgMaskText = QString("0x").append(QString::number(dbgMask, 16));
+    QString heading = QString("Kernel debug mask in hex format");
+    HbInputDialog::getText(heading, this, SLOT(toolsSetDebugMask(HbAction*)), dbgMaskText, scene());
+}
+
+/**
+  Set debug mask
+  */
+void FbDriveView::toolsSetDebugMask(HbAction *action)
+{
+    HbInputDialog *dlg = static_cast<HbInputDialog*>(sender());
+    if (dlg && action && action->text().compare(QString("Ok"), Qt::CaseInsensitive) == 0) {
+        QString dbgMaskText = dlg->value().toString();
+        if (dbgMaskText.length() > 2 && dbgMaskText[0]=='0' && dbgMaskText[1]=='x') {
+            bool ok;
+            quint32 dbgMask = dbgMaskText.toUInt(&ok, 16);
+            if (dbgMask != 0 || ok) {
+                mEngineWrapper->toolsSetDebugMask(dbgMask);
+                Notifications::showConfirmationNote(QString("Changed"));
+            } else {
+                Notifications::showErrorNote(QString("Cannot convert value"));
+            }
+        } else {
+            Notifications::showErrorNote(QString("Not in hex format"));
+        }
+    }
+}
+
+void FbDriveView::toolsShowOpenFilesHere()
+{
+
+}
+
+// ---------------------------------------------------------------------------
+// main menu items
+// ---------------------------------------------------------------------------
+
+/**
+  Show about note
+  */
+void FbDriveView::about()
+{
+    Notifications::showAboutNote();
+}
+
+// ---------------------------------------------------------------------------
+// End of operations
+// ---------------------------------------------------------------------------
+
+// ---------------------------------------------------------------------------
+
+/**
+  Item is selected from list when selection mode is activated from menu
+  */
+void FbDriveView::selectionChanged(const QItemSelection &/*selected*/, const QItemSelection &/*deselected*/)
+{
+    //QItemSelectionModel *selectionModel = mListView->selectionModel();
+}
+
+/**
+  An item is clicked from navigation item list. Navigation item list contains
+  drive-, folder- or file items. Opens selected drive, folder or file popup menu
+  */
+void FbDriveView::activated(const QModelIndex& index)
+{
+    if (mFbDriveModel) {
+//        if (mEngineWrapper->isDriveListViewActive()) {
+            mEngineWrapper->moveDownToDirectory(index);
+            //emit aboutToShowFileView(QString(mEngineWrapper->currentPath()));
+            emit aboutToShowFileView();
+            //refreshList();
+//        }
+    }
+}
+
+// ---------------------------------------------------------------------------
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/filebrowser/ui/src/fbfilelistviewitem.cpp	Thu Jul 22 16:33:59 2010 +0100
@@ -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:
+*
+*/
+
+#include "fbfilelistviewitem.h"
+
+#include <QString>
+#include <QStringList>
+#include <QGraphicsLinearLayout>
+#include <QRectF>
+#include <QPainter>
+
+#include <hblabel.h>
+#include <hbcheckbox.h>
+#include <hbabstractitemview.h>
+
+FbFileListViewItem::FbFileListViewItem(QGraphicsItem *parent) :
+    HbListViewItem(parent),
+    hLayout(0),
+    mDiskNameLabel(0),
+    mSizeLabel(0),
+    mFreeLabel(0),
+    mIconLabel(0)
+{
+}
+
+FbFileListViewItem::~FbFileListViewItem()
+{
+}
+
+void FbFileListViewItem::polish(HbStyleParameters &params)
+{
+    Q_UNUSED(params);
+}
+
+bool FbFileListViewItem::canSetModelIndex(const QModelIndex &index) const
+{
+    Q_UNUSED(index);
+    return true;
+}
+
+
+HbAbstractViewItem *FbFileListViewItem::createItem()
+{
+    return new FbFileListViewItem(*this);
+}
+
+void FbFileListViewItem::updateChildItems()
+{
+    if(!hLayout) {
+        init();
+    }
+
+    // Qt::DisplayRole
+    QVariant displayRole = modelIndex().data(Qt::DisplayRole);
+    QString diskName("default");
+    QStringList stringList;
+    if (displayRole.isValid()) {
+        if (displayRole.canConvert<QString>()) {                // EFileViewModeSimple
+            stringList.append(displayRole.toString());
+        } else if (displayRole.canConvert<QStringList>()) {     // EFileViewModeExtended
+            stringList = displayRole.toStringList();
+        }
+        if (stringList.count() > 0)
+            diskName = stringList[0]; //modelIndex().data( Qt::UserRole ).toString();
+
+        mDiskNameLabel->setPlainText(diskName/*displayString*/);
+    }
+
+//    mSizeLabel->setPlainText( hbTrId ( "Size: " ) /*+ FmUtils::formatStorageSize( driverInfo.size() )*/ );
+//    mFreeLabel->setPlainText( hbTrId ( "Free: " ) /*+ FmUtils::formatStorageSize( driverInfo.freeSize() )*/ );
+    if (stringList.count() > 1)
+        mSizeLabel->setPlainText( stringList[1] );
+
+    //mStorageSizeDiagram->setFreeSizePercentage();
+    //mFreeLabel->setPlainText( stringList[2] );
+
+    //    mCheckBox->setCheckState( checkState() );
+
+    // Qt::DecorationRole
+    QVariant decorationRole = modelIndex().data(Qt::DecorationRole);
+    if (decorationRole.isValid()) {
+        QIcon icon = qvariant_cast<QIcon>(decorationRole);
+//    if( icon.isNull() ) {
+//        QFileIconProvider fileIconProvider;
+//        icon = fileIconProvider.icon(QFileIconProvider::Drive);
+//    }
+    mIconLabel->setIcon(HbIcon(icon));
+    }
+}
+
+void FbFileListViewItem::setCheckedState(int state)
+{
+    HbAbstractViewItem::setCheckState(static_cast<Qt::CheckState>(state));
+}
+
+void FbFileListViewItem::init()
+{
+    hLayout = new QGraphicsLinearLayout();
+
+    hLayout->setOrientation( Qt::Horizontal );
+    hLayout->addItem(layout());
+
+    mIconLabel = new HbLabel();
+    hLayout->addItem( mIconLabel );
+    hLayout->setAlignment( mIconLabel, Qt::AlignTop );
+    hLayout->setStretchFactor( mIconLabel, 0 );
+
+//    mStorageSizeDiagram = new FbDriveStorageSizeDiagram(this);
+//    hLayout->addItem( mStorageSizeDiagram );
+//    hLayout->setAlignment( mIconLabel, Qt::AlignTop );
+//    hLayout->setStretchFactor( mStorageSizeDiagram, 0 );
+
+    QGraphicsLinearLayout *vLayout = new QGraphicsLinearLayout();
+    vLayout->setOrientation( Qt::Vertical );
+
+    mDiskNameLabel = new HbLabel();
+    //HbFontSpec fontSpecPrimary(HbFontSpec::Primary);
+    //fontSpecPrimary.setTextHeight(18.0);
+    //mDiskNameLabel->setFontSpec( fontSpecPrimary );
+    vLayout->addItem( mDiskNameLabel );
+    vLayout->setAlignment( mDiskNameLabel, Qt::AlignLeft );
+
+    mSizeLabel = new HbLabel();
+    //HbFontSpec fontSpecSecondary(HbFontSpec::Secondary);
+    //fontSpecSecondary.setTextHeight(18.0);
+    //mSizeLabel->setFontSpec(fontSpecSecondary);
+    vLayout->addItem( mSizeLabel );
+    vLayout->setAlignment(mSizeLabel, Qt::AlignLeft);
+
+//    mFreeLabel = new HbLabel();
+//    mFreeLabel->setFontSpec( HbFontSpec( HbFontSpec::Secondary ) );
+//    vLayout->addItem( mFreeLabel );
+//    vLayout->setAlignment( mFreeLabel, Qt::AlignLeft );
+
+    HbWidget *labelsWidget = new HbWidget();
+    labelsWidget->setLayout(vLayout);
+
+    hLayout->setAlignment( labelsWidget, Qt::AlignLeft );
+
+    hLayout->addItem( labelsWidget );
+    hLayout->setStretchFactor( labelsWidget, 1 );
+
+//    this->setMaximumHeight(80);
+
+    setLayout( hLayout );
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/filebrowser/ui/src/fbfilemodel.cpp	Thu Jul 22 16:33:59 2010 +0100
@@ -0,0 +1,145 @@
+/*
+* 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 "fbfilemodel.h"
+#include "enginewrapper.h"
+#include "fileentry.h"
+#include "driveentry.h"
+#include "settingsview.h"
+#include "filebrowsersettings.h"
+#include "FB.hrh"
+
+#include <QModelIndex>
+#include <QFileIconProvider>
+
+/**
+  Constructs a file browser custom system model with the given \a engineWrapper and \a parent.
+  */
+FbFileModel::FbFileModel(EngineWrapper *engineWrapper, QObject *parent) :
+    QAbstractListModel(parent),
+    mEngineWrapper(engineWrapper),
+    mFileIconProvider(0)
+{
+    mFileIconProvider = new QFileIconProvider();
+}
+
+/**
+  Destroys this file browser custom system model.
+  */
+FbFileModel::~FbFileModel()
+{  
+    if (mFileIconProvider) {
+        delete mFileIconProvider;
+    }
+}
+
+/**
+  \reimp
+  */
+int FbFileModel::rowCount(const QModelIndex &parent) const
+{
+    Q_UNUSED(parent);
+    return mEngineWrapper->itemCount();
+}
+
+/**
+  \reimp
+  */
+QVariant FbFileModel::data(const QModelIndex &index, int role) const
+{
+    if (!index.isValid() || index.model() != this)
+        return QVariant();
+
+    switch (role) {
+    case Qt::EditRole:
+    case Qt::DisplayRole: {
+            QStringList listItem;
+//            if (mEngineWrapper->isDriveListViewActive()) {
+//                DriveEntry driveEntry(mEngineWrapper->getDriveEntry(index));
+//                if (mEngineWrapper->settings().fileViewMode() == EFileViewModeSimple)
+//                {
+//                    const QString SimpleDriveEntry("%1: <%2>");
+//                    listItem /*<< driveEntry.IconId() */
+//                            << SimpleDriveEntry.arg(driveEntry.driveLetter())
+//                                               .arg(driveEntry.mediaTypeString());
+//                } else if (mEngineWrapper->settings().fileViewMode() == EFileViewModeExtended) {
+//                    const QString SimpleDriveEntry("%1: <%2>");
+//                    const QString ExtendedDriveEntry("%1/%2 kB");
+//                    listItem /*<< driveEntry.IconId()*/
+//                            << SimpleDriveEntry.arg(driveEntry.driveLetter())
+//                                               .arg(driveEntry.mediaTypeString())
+//                            << ExtendedDriveEntry.arg(QString::number(driveEntry.volumeInfoFree()/1024))
+//                                                 .arg(QString::number(driveEntry.volumeInfoSize()/1024));
+//
+//                }
+//            } else {
+                FileEntry fileEntry(mEngineWrapper->getFileEntry(index));
+                if (mEngineWrapper->settings().fileViewMode() == EFileViewModeSimple)
+                {
+                    listItem /*<< fileEntry.IconId()*/
+                            << fileEntry.name();
+                } else if (mEngineWrapper->settings().fileViewMode() == EFileViewModeExtended) {
+                    QString extraData;
+                    extraData.append(fileEntry.modifiedString());
+                    if (fileEntry.isDir() && fileEntry.dirEntries() >= 0) {
+                        extraData.append(" - ");
+                        extraData.append(fileEntry.dirEntriesString());
+                    } else if (!fileEntry.isDir()) {
+                        extraData.append(" - ");
+                        extraData.append(fileEntry.sizeString());
+                    }
+                    listItem /*<< fileEntry.IconId()*/
+                            << fileEntry.name() << extraData << fileEntry.attributesString();
+                }
+//            }
+            return listItem;
+        }
+    case Qt::DecorationRole: {
+            if (mEngineWrapper) {
+                QIcon icon;
+//                if (mEngineWrapper->isDriveListViewActive()) {
+//                    icon = mFileIconProvider->icon(QFileIconProvider::Drive);
+//                } else {
+                    FileEntry fileEntry(mEngineWrapper->getFileEntry(index));
+                    if (fileEntry.isDir()) {
+                        icon = mFileIconProvider->icon(QFileIconProvider::Folder);
+                    } else {
+                        icon = mFileIconProvider->icon(QFileIconProvider::File);
+                    }
+//                }
+                return QVariant(icon);
+            }
+        }
+    }
+
+    return QVariant();
+}
+
+/**
+  \reimp
+  */
+QVariant FbFileModel::headerData(int section, Qt::Orientation orientation, int role) const
+{
+    Q_UNUSED(section)
+    Q_UNUSED(orientation)
+    Q_UNUSED(role)
+
+    // TODO, implement or remove
+    return QVariant();
+}
+
+// ---------------------------------------------------------------------------
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/filebrowser/ui/src/fbfileview.cpp	Thu Jul 22 16:33:59 2010 +0100
@@ -0,0 +1,1535 @@
+/*
+* 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 "fbfileview.h"
+#include "settingsview.h"
+#include "editorview.h"
+#include "searchview.h"
+#include "enginewrapper.h"
+#include "notifications.h"
+
+#include "fbfilemodel.h"
+#include "filebrowsersortfilterproxymodel.h"
+//#include "fbfilelistviewitem.h"
+
+#include <HbMenu>
+#include <HbPopup>
+#include <HbView>
+#include <HbMessageBox>
+#include <HbAction>
+#include <HbLabel>
+#include <HbListView>
+#include <HbListViewItem>
+#include <HbListWidget>
+#include <HbLineEdit>
+#include <HbAbstractViewItem>
+#include <HbSelectionDialog>
+#include <HbValidator>
+#include <HbInputDialog>
+#include <HbToolBar>
+#include <HbToolBarExtension>
+#include <HbSearchPanel>
+
+#include <QString>
+#include <QGraphicsLinearLayout>
+#include <QItemSelection>
+#include <QDebug>
+//TODO check if needed to do this way
+#include <FB.hrh>
+
+// ---------------------------------------------------------------------------
+
+FbFileView::FbFileView() :
+    mEngineWrapper(0),
+    mListView(0),
+    mToolBar(0),
+    mNaviPane(0),
+    mSearchPanel(0),
+    mMainLayout(0),
+    mFbFileModel(0),
+    mSortFilterProxyModel(0),
+    mOptionMenuActions(),
+    mContextMenuActions(),
+    mContextMenu(0),
+    mToolbarBackAction(0),
+    mItemHighlighted(false),
+    mLocationChanged(false),
+    mRemoveFileAfterCopied(false),
+//    mClipBoardInUse(false),
+    mFolderContentChanged(false),
+    mCurrentIndex(),
+    mOldPassword(),
+    mPanicCategory(),
+    mAbsoluteFilePath(),
+    mOverwriteOptions(),
+    mModelIndex(),
+    mNewFileName(),
+    mProceed(false),
+    mEraseMBR(false)
+{
+    setTitle("File Browser");
+
+    createMenu();
+    createContextMenu();
+    createToolBar();
+}
+
+// ---------------------------------------------------------------------------	
+
+void FbFileView::init(EngineWrapper *engineWrapper)
+{
+    mEngineWrapper = engineWrapper;
+
+    mListView = new HbListView(this);
+    mListView->listItemPrototype()->setStretchingStyle(HbListViewItem::StretchLandscape);
+
+//    mListView->setItemPrototype(new FbDiskListViewItem(mListView));
+
+    mFbFileModel = new FbFileModel(mEngineWrapper);
+    if (!mListView->model()) {
+
+        mEngineWrapper->refreshView();
+
+        mSortFilterProxyModel = new FileBrowserSortFilterProxyModel(this);
+        mSortFilterProxyModel->setSourceModel(mFbFileModel);
+        mSortFilterProxyModel->setFilterCaseSensitivity(Qt::CaseInsensitive);
+        mSearchPanel->setPlaceholderText(QString("Type filter criteria"));
+
+        mListView->setModel(mSortFilterProxyModel);
+    }
+
+    //mListView->setRootIndex(mFileSystemModel->index(startPath));
+    //mListView->setRootIndex(model->index());
+
+    //setItemVisible(Hb::ToolBarItem, !mEngineWrapper->isDriveListViewActive());
+//    mListView->setScrollingStyle(HbScrollArea::PanWithFollowOn);
+
+    connect(mListView, SIGNAL(activated(QModelIndex)), this, SLOT(activated(QModelIndex)));
+    connect(mListView, SIGNAL(longPressed(HbAbstractViewItem*,QPointF)),
+            this, SLOT(onLongPressed(HbAbstractViewItem*, QPointF)));
+
+    mNaviPane = new HbLabel(this);
+    mNaviPane->setPlainText(QString(" ")); // TODO get from settings or default
+    //mNaviPane->setPlainText(QString(mEngineWrapper->currentPath()));
+    HbFontSpec fontSpec(HbFontSpec::PrimarySmall);
+    mNaviPane->setFontSpec(fontSpec);
+
+    // Create layout and add list view and toolbar into layout:
+    mMainLayout = new QGraphicsLinearLayout(Qt::Vertical);
+    mMainLayout->addItem(mNaviPane);
+    mMainLayout->addItem(mListView);
+    setLayout(mMainLayout);
+}
+
+// ---------------------------------------------------------------------------
+
+FbFileView::~FbFileView()
+{  
+//    if (mEngineWrapper) {
+//        delete mEngineWrapper;
+//    }
+    if (mContextMenu) {
+        mContextMenu->deleteLater();
+    }
+
+    delete mSortFilterProxyModel;
+    delete mFbFileModel;
+    delete mListView;
+    delete mToolBar;
+}
+
+/**
+  Initial setup for options menu.
+  Dynamic menu update during the runtime is performed by updateOptionMenu() which
+  to menu's aboutToShow() signal.
+  */
+void FbFileView::createMenu()
+{
+    createFileMenu();
+    createEditMenu();
+    createViewMenu();
+    createToolsMenu();
+
+    createSelectionMenuItem();
+    createSettingsMenuItem();
+    createAboutMenuItem();
+    createExitMenuItem();
+
+    // menu dynamic update
+    connect(menu(), SIGNAL(aboutToShow()), this, SLOT(updateOptionMenu()));
+}
+
+/**
+  Initial setup for File submenu
+  */
+void FbFileView::createFileMenu()
+{
+    mOptionMenuActions.mFileMenu = menu()->addMenu("File");
+
+    mOptionMenuActions.mFileBackMoveUp = mOptionMenuActions.mFileMenu->addAction("Back/Move up", this, SLOT(fileBackMoveUp()));
+    mOptionMenuActions.mFileSearch = mOptionMenuActions.mFileMenu->addAction("Search...", this, SLOT(fileSearch()));
+    //mOptionMenuActions.mFileSearch->setVisible(false);
+
+    mOptionMenuActions.mFileNewMenu = mOptionMenuActions.mFileMenu->addMenu("New");
+    mOptionMenuActions.mFileNewFile = mOptionMenuActions.mFileNewMenu->addAction("File", this, SLOT(fileNewFile()));
+    mOptionMenuActions.mFileNewDirectory = mOptionMenuActions.mFileNewMenu->addAction("Directory", this, SLOT(fileNewDirectory()));
+
+    mOptionMenuActions.mFileDelete = mOptionMenuActions.mFileMenu->addAction("Delete", this, SLOT(fileDelete()));
+    mOptionMenuActions.mFileRename = mOptionMenuActions.mFileMenu->addAction("Rename", this, SLOT(fileRename()));
+    mOptionMenuActions.mFileTouch = mOptionMenuActions.mFileMenu->addAction("Touch", this, SLOT(fileTouch()));
+
+//    mOptionMenuActions.mFileChecksumsMenu = mOptionMenuActions.mFileMenu->addMenu("Checksums");
+//    mOptionMenuActions.mFileChecksumsMD5 = mOptionMenuActions.mFileChecksumsMenu->addAction("MD5", this, SLOT(fileChecksumsMD5()));
+//    mOptionMenuActions.mFileChecksumsMD2 = mOptionMenuActions.mFileChecksumsMenu->addAction("MD2", this, SLOT(fileChecksumsMD2()));
+//    mOptionMenuActions.mFileChecksumsSHA1 = mOptionMenuActions.mFileChecksumsMenu->addAction("SHA-1", this, SLOT(fileChecksumsSHA1()));
+
+    mOptionMenuActions.mFileSetAttributes = mOptionMenuActions.mFileMenu->addAction("Set attributes...", this, SLOT(fileSetAttributes()));
+    mOptionMenuActions.mFileSetAttributes->setVisible(false);
+}
+
+/**
+  Initial setup for Edit submenu
+  */
+void FbFileView::createEditMenu()
+{
+    mOptionMenuActions.mEditMenu = menu()->addMenu("Edit");
+
+    mOptionMenuActions.mEditSnapShotToE = mOptionMenuActions.mEditMenu->addAction("Snap shot to E:", this, SLOT(editSnapShotToE()));
+    mOptionMenuActions.mEditSnapShotToE->setVisible(false);
+    mOptionMenuActions.mEditCut = mOptionMenuActions.mEditMenu->addAction("Cut", this, SLOT(editCut()));
+    mOptionMenuActions.mEditCopy = mOptionMenuActions.mEditMenu->addAction("Copy", this, SLOT(editCopy()));
+    mOptionMenuActions.mEditPaste = mOptionMenuActions.mEditMenu->addAction("Paste", this, SLOT(editPaste()));
+
+    mOptionMenuActions.mEditCopyToFolder = mOptionMenuActions.mEditMenu->addAction("Copy to folder...", this, SLOT(editCopyToFolder()));
+    mOptionMenuActions.mEditMoveToFolder = mOptionMenuActions.mEditMenu->addAction("Move to folder...", this, SLOT(editMoveToFolder()));
+
+    mOptionMenuActions.mEditSelect = mOptionMenuActions.mEditMenu->addAction("Select", this, SLOT(editSelect()));
+    mOptionMenuActions.mEditUnselect = mOptionMenuActions.mEditMenu->addAction("Unselect", this, SLOT(editUnselect()));
+    mOptionMenuActions.mEditSelectAll = mOptionMenuActions.mEditMenu->addAction("Select all", this, SLOT(editSelectAll()));
+    mOptionMenuActions.mEditUnselectAll = mOptionMenuActions.mEditMenu->addAction("Unselect all", this, SLOT(editUnselectAll()));
+}
+
+/**
+  Initial setup for View submenu
+  */
+void FbFileView::createViewMenu()
+{
+    mOptionMenuActions.mViewMenu = menu()->addMenu("View");
+    //mOptionMenuActions.mViewMenu->menuAction()->setVisible(false);
+
+    mOptionMenuActions.mViewFilterEntries = mOptionMenuActions.mViewMenu->addAction("Filter entries", this, SLOT(viewFilterEntries()));
+    mOptionMenuActions.mViewRefresh = mOptionMenuActions.mViewMenu->addAction("Refresh", this, SLOT(viewRefresh()));
+}
+
+/**
+  Initial setup for Tools submenu
+  */
+void FbFileView::createToolsMenu()
+{
+    mOptionMenuActions.mToolsMenu = menu()->addMenu("Tools");
+
+    mOptionMenuActions.mToolsAllAppsToTextFile = mOptionMenuActions.mToolsMenu->addAction("All apps to a text file", this, SLOT(toolsAllAppsToTextFile()));
+    mOptionMenuActions.mToolsAllAppsToTextFile->setVisible(false);
+    mOptionMenuActions.mToolsAllFilesToTextFile = mOptionMenuActions.mToolsMenu->addAction("All files to a text file", this, SLOT(toolsAllFilesToTextFile()));
+    //mOptionMenuActions.mToolsAllFilesToTextFile->setVisible(false);
+
+//    mOptionMenuActions.mToolsAvkonIconCacheMenu = mOptionMenuActions.mToolsMenu->addMenu("Avkon icon cache");
+//    mOptionMenuActions.mToolsAvkonIconCacheMenu->menuAction()->setVisible(false);
+//    mOptionMenuActions.mToolsAvkonIconCacheEnable = mOptionMenuActions.mToolsAvkonIconCacheMenu->addAction("Enable", this, SLOT(toolsAvkonIconCacheEnable()));
+//    mOptionMenuActions.mToolsAvkonIconCacheDisable = mOptionMenuActions.mToolsAvkonIconCacheMenu->addAction("Clear and disable", this, SLOT(toolsAvkonIconCacheDisable()));
+
+    mOptionMenuActions.mToolsDisableExtendedErrors = mOptionMenuActions.mToolsMenu->addAction("Disable extended errors", this, SLOT(toolsDisableExtendedErrors()));
+    mOptionMenuActions.mToolsDumpMsgStoreWalk = mOptionMenuActions.mToolsMenu->addAction("Dump msg. store walk", this, SLOT(toolsDumpMsgStoreWalk()));
+    mOptionMenuActions.mToolsDumpMsgStoreWalk->setVisible(false);
+    mOptionMenuActions.mToolsEditDataTypes = mOptionMenuActions.mToolsMenu->addAction("Edit data types", this, SLOT(toolsEditDataTypes()));
+    mOptionMenuActions.mToolsEditDataTypes->setVisible(false);
+    mOptionMenuActions.mToolsEnableExtendedErrors = mOptionMenuActions.mToolsMenu->addAction("Enable extended errors", this, SLOT(toolsEnableExtendedErrors()));
+
+    mOptionMenuActions.mToolsErrorSimulateMenu = mOptionMenuActions.mToolsMenu->addMenu("Error simulate");
+    mOptionMenuActions.mToolsErrorSimulateLeave = mOptionMenuActions.mToolsErrorSimulateMenu->addAction("Leave", this, SLOT(toolsErrorSimulateLeave()));
+    mOptionMenuActions.mToolsErrorSimulatePanic = mOptionMenuActions.mToolsErrorSimulateMenu->addAction("Panic", this, SLOT(toolsErrorSimulatePanic()));
+    mOptionMenuActions.mToolsErrorSimulatePanic->setVisible(false);
+    mOptionMenuActions.mToolsErrorSimulateException = mOptionMenuActions.mToolsErrorSimulateMenu->addAction("Exception", this, SLOT(toolsErrorSimulateException()));
+
+//    mOptionMenuActions.mLocalConnectivityMenu = mOptionMenuActions.mToolsMenu->addMenu("Local connectivity");
+//    mOptionMenuActions.mToolsLocalConnectivityActivateInfrared = mOptionMenuActions.mLocalConnectivityMenu->addAction("Activate infrared", this, SLOT(toolsLocalConnectivityActivateInfrared()));
+//    mOptionMenuActions.mToolsLocalConnectivityLaunchBTUI = mOptionMenuActions.mLocalConnectivityMenu->addAction("Launch BT UI", this, SLOT(toolsLocalConnectivityLaunchBTUI()));
+//    mOptionMenuActions.mToolsLocalConnectivityLaunchUSBUI = mOptionMenuActions.mLocalConnectivityMenu->addAction("Launch USB UI", this, SLOT(toolsLocalConnectivityLaunchUSBUI()));
+
+    mOptionMenuActions.mToolsMessageAttachmentsMenu = mOptionMenuActions.mToolsMenu->addMenu("Message attachments");
+    mOptionMenuActions.mToolsMessageAttachmentsMenu->menuAction()->setVisible(false);
+    mOptionMenuActions.mToolsMessageInbox = mOptionMenuActions.mToolsMessageAttachmentsMenu->addAction("Inbox", this, SLOT(toolsMessageInbox()));
+    mOptionMenuActions.mToolsMessageDrafts = mOptionMenuActions.mToolsMessageAttachmentsMenu->addAction("Drafts", this, SLOT(toolsMessageDrafts()));
+    mOptionMenuActions.mToolsMessageSentItems = mOptionMenuActions.mToolsMessageAttachmentsMenu->addAction("Sent items", this, SLOT(toolsMessageSentItems()));
+    mOptionMenuActions.mToolsMessageOutbox = mOptionMenuActions.mToolsMessageAttachmentsMenu->addAction("Outbox", this, SLOT(toolsMessageOutbox()));
+
+    mOptionMenuActions.mToolsMemoryInfo = mOptionMenuActions.mToolsMenu->addAction("Memory info", this, SLOT(toolsMemoryInfo()));
+    mOptionMenuActions.mToolsMemoryInfo->setVisible(false);
+
+    mOptionMenuActions.mToolsSecureBackupMenu = mOptionMenuActions.mToolsMenu->addMenu("Secure backup");
+    mOptionMenuActions.mToolsSecureBackupMenu->menuAction()->setVisible(false);
+    mOptionMenuActions.mToolsSecureBackStart = mOptionMenuActions.mToolsSecureBackupMenu->addAction("Start backup", this, SLOT(toolsSecureBackStart()));
+    mOptionMenuActions.mToolsSecureBackRestore = mOptionMenuActions.mToolsSecureBackupMenu->addAction("Start restore", this, SLOT(toolsSecureBackRestore()));
+    mOptionMenuActions.mToolsSecureBackStop = mOptionMenuActions.mToolsSecureBackupMenu->addAction("Stop", this, SLOT(toolsSecureBackStop()));
+
+    mOptionMenuActions.mToolsSetDebugMask = mOptionMenuActions.mToolsMenu->addAction("Set debug mask", this, SLOT(toolsSetDebugMaskQuestion()));
+    mOptionMenuActions.mToolsShowOpenFilesHere = mOptionMenuActions.mToolsMenu->addAction("Show open files here", this, SLOT(toolsShowOpenFilesHere()));
+    mOptionMenuActions.mToolsShowOpenFilesHere->setVisible(false);
+}
+
+/**
+  Creates Selection mode menu item in option menu
+  */
+void FbFileView::createSelectionMenuItem()
+{
+    if (!mOptionMenuActions.mSelection) {
+        mOptionMenuActions.mSelection = menu()->addAction("Selection mode");
+        mOptionMenuActions.mSelection->setToolTip("Selection mode");
+        mOptionMenuActions.mSelection->setCheckable(true);
+        connect(mOptionMenuActions.mSelection, SIGNAL(triggered()), this, SLOT(selectionModeChanged()));
+    }
+}
+
+/**
+  Creates Setting menu item in option menu
+  */
+void FbFileView::createSettingsMenuItem()
+{
+    mOptionMenuActions.mSetting = menu()->addAction("Settings...");
+    connect(mOptionMenuActions.mSetting, SIGNAL(triggered()), this, SIGNAL(aboutToShowSettingsView()));
+}
+
+
+/**
+  Creates About menu item in option menu
+  */
+void FbFileView::createAboutMenuItem()
+{
+    // about note
+    mOptionMenuActions.mAbout = menu()->addAction("About");
+    connect(mOptionMenuActions.mAbout, SIGNAL(triggered()), this, SLOT(about()));
+}
+
+/**
+  Creates Exit menu item in option menu
+  */
+void FbFileView::createExitMenuItem()
+{
+    // application exit
+    mOptionMenuActions.mExit = menu()->addAction("Exit");
+    connect(mOptionMenuActions.mExit, SIGNAL(triggered()), qApp, SLOT(quit()));
+}
+
+/**
+  update menu: disk admin available only in device root view. edit available only in folder view
+  when file or folder content exist in current folder, or clipboard has copied item.
+  file and view menus updated every time regarding the folder content.
+  tools, settings, about, exit always available.
+  If there's remove and add operations at same time, always remove first
+  to keep to the correct menu items order.
+  */
+void FbFileView::updateOptionMenu()
+{
+    bool isFileItemListEmpty = mFbFileModel->rowCount() == 0;
+    bool isNormalModeActive = true;       //iModel->FileUtils()->IsNormalModeActive();
+    bool isCurrentDriveReadOnly = mEngineWrapper->isCurrentDriveReadOnly();   //iModel->FileUtils()->IsCurrentDriveReadOnly();
+    bool isCurrentItemDirectory = mEngineWrapper->getFileEntry(currentItemIndex()).isDir();
+    // bool currentSelected = true;    //iContainer->ListBox()->View()->ItemIsSelected(iContainer->ListBox()->View()->CurrentItemIndex());
+    bool isAllSelected = mListView->selectionModel()->selection().count() == mFbFileModel->rowCount();
+    //bool isNoneSelected = mListView->selectionModel()->selection().count() != 0;
+    bool hasSelectedItems = mListView->selectionModel()->selection().count() != 0;
+    bool isSelectionMode = mOptionMenuActions.mSelection && mOptionMenuActions.mSelection->isChecked();
+    bool isClipBoardEmpty = !mEngineWrapper->isClipBoardListInUse();
+    //bool showSnapShot = false;           //iModel->FileUtils()->DriveSnapShotPossible();
+
+    bool showEditMenu(true);
+    if (isFileItemListEmpty && isClipBoardEmpty)
+        showEditMenu = false;
+    else
+        showEditMenu = true;
+
+    mOptionMenuActions.mEditMenu->menuAction()->setVisible(showEditMenu);
+
+    //mOptionMenuActions.mFileBackMoveUp->setVisible( !isDriveListViewActive);
+
+    //aMenuPane->SetItemDimmed(EFileBrowserCmdFileView, isFileItemListEmpty || !hasSelectedItems || isCurrentItemDirectory);
+    //aMenuPane->SetItemDimmed(EFileBrowserCmdFileEdit, isFileItemListEmpty || !hasSelectedItems || isCurrentItemDirectory);
+    //aMenuPane->SetItemDimmed(EFileBrowserCmdFileSendTo, isFileItemListEmpty || driveListActive || isCurrentItemDirectory);
+
+    mOptionMenuActions.mFileNewMenu->menuAction()->setVisible(!isCurrentDriveReadOnly);
+    mOptionMenuActions.mFileDelete->setVisible(!isFileItemListEmpty && !isCurrentDriveReadOnly && hasSelectedItems/*isSelectionMode*/);
+    mOptionMenuActions.mFileRename->setVisible(!isFileItemListEmpty && !isCurrentDriveReadOnly && hasSelectedItems/*&& isSelectionMode*/);
+    mOptionMenuActions.mFileTouch->setVisible(!isFileItemListEmpty && !isCurrentDriveReadOnly && hasSelectedItems);
+
+    // TODO mOptionMenuActions.mFileChecksumsMenu->setVisible(!(isFileItemListEmpty || !hasSelectedItems || isCurrentItemDirectory));
+    // TODO mOptionMenuActions.mFileSetAttributes->setVisible(!(isFileItemListEmpty || isCurrentDriveReadOnly));
+    // TODO mOptionMenuActions.mFileCompress->setVisible(!(isCurrentDriveReadOnly || isFileItemListEmpty || !hasSelectedItems || isCurrentItemDirectory));
+    // TODO mOptionMenuActions.mFileDecompress->setVisible(!(isCurrentDriveReadOnly || isFileItemListEmpty || !hasSelectedItems || isCurrentItemDirectory));
+
+    mOptionMenuActions.mEditCut->setVisible(!isFileItemListEmpty && !isCurrentDriveReadOnly && isSelectionMode);
+    mOptionMenuActions.mEditCopy->setVisible(!isFileItemListEmpty && isSelectionMode);
+    mOptionMenuActions.mEditPaste->setVisible(!(isClipBoardEmpty || isCurrentDriveReadOnly));
+    mOptionMenuActions.mEditCopyToFolder->setVisible(!isFileItemListEmpty);
+    mOptionMenuActions.mEditMoveToFolder->setVisible(!(isCurrentDriveReadOnly || isFileItemListEmpty));
+
+    mOptionMenuActions.mEditSelect->setVisible(false/*!currentSelected && !isFileItemListEmpty*/);
+    mOptionMenuActions.mEditUnselect->setVisible(false/*currentSelected && !isFileItemListEmpty*/);
+    mOptionMenuActions.mEditSelectAll->setVisible(isSelectionMode && !isAllSelected && !isFileItemListEmpty);
+    mOptionMenuActions.mEditUnselectAll->setVisible(hasSelectedItems && !isFileItemListEmpty);
+
+    // TODO mOptionMenuActions.mViewSort->setVisible(!(!isNormalModeActive || isFileItemListEmpty));
+    // TODO mOptionMenuActions.mViewOrder->setVisible(!(!isNormalModeActive  || isFileItemListEmpty));
+    mOptionMenuActions.mViewRefresh->setVisible(isNormalModeActive);
+    mOptionMenuActions.mViewFilterEntries->setVisible(!isFileItemListEmpty);
+
+    // TODO R_FILEBROWSER_VIEW_SORT_SUBMENU
+    // aMenuPane->SetItemButtonState(iModel->FileUtils()->SortMode(), EEikMenuItemSymbolOn);
+
+    // TODO R_FILEBROWSER_VIEW_ORDER_SUBMENU
+    // aMenuPane->SetItemButtonState(iModel->FileUtils()->OrderMode(), EEikMenuItemSymbolOn);
+
+    // aResourceId == R_FILEBROWSER_TOOLS_SUBMENU
+    bool noExtendedErrorsAllowed = mEngineWrapper->ErrRdFileExists();
+    mOptionMenuActions.mToolsDisableExtendedErrors->setVisible(noExtendedErrorsAllowed);
+    mOptionMenuActions.mToolsEnableExtendedErrors->setVisible(!noExtendedErrorsAllowed);
+
+//    bool infraRedAllowed = mEngineWrapper->FileExists(KIRAppPath);
+//    bool bluetoothAllowed = mEngineWrapper->FileExists(KBTAppPath);
+//    bool usbAllowed = mEngineWrapper->FileExists(KUSBAppPath);
+//
+//    bool noLocalCon = !infraRedAllowed && !bluetoothAllowed && !usbAllowed;
+//    mOptionMenuActions.mToolsLocalConnectivityMenu->menuAction()->setVisible(!noLocalCon);
+//
+//    mOptionMenuActions.mToolsLocalConnectivityActivateInfrared->setVisible(infraRedAllowed);
+//    mOptionMenuActions.mToolsLocalConnectivityLaunchBTUI->setVisible(bluetoothAllowed);
+//    mOptionMenuActions.mToolsLocalConnectivityLaunchUSBUI->setVisible(usbAllowed);
+}
+
+void FbFileView::createContextMenu()
+{
+    mContextMenu = new HbMenu();
+    connect(mContextMenu, SIGNAL(aboutToShow()), this, SLOT(updateContextMenu()));
+
+    createFileContextMenu();
+    createEditContextMenu();
+    createViewContextMenu();
+}
+
+
+void FbFileView::createFileContextMenu()
+{
+    mContextMenuActions.mFileMenu = mContextMenu->addMenu("File");
+
+    //mContextMenuActions.mFileBackMoveUp = mContextMenuActions.mFileMenu->addAction("Back/Move up (<-)", this, SLOT(fileBackMoveUp()));
+    mContextMenuActions.mFileOpenDirectory = mContextMenuActions.mFileMenu->addAction("Open directory (->)", this, SLOT(fileOpenDirectory()));
+//    mContextMenuActions.mFileSearch = mContextMenuActions.mFileMenu->addAction("Search...", this, SLOT(fileSearch()));
+    //mContextMenuActions.mFileSearch->setVisible(false);
+
+    mContextMenuActions.mFileDelete = mContextMenuActions.mFileMenu->addAction("Delete", this, SLOT(fileDelete()));
+    mContextMenuActions.mFileRename = mContextMenuActions.mFileMenu->addAction("Rename", this, SLOT(fileRename()));
+    mContextMenuActions.mFileTouch = mContextMenuActions.mFileMenu->addAction("Touch", this, SLOT(fileTouch()));
+    mContextMenuActions.mFileProperties = mContextMenuActions.mFileMenu->addAction("Properties", this, SLOT(fileProperties()));
+
+    mContextMenuActions.mFileChecksumsMenu = mContextMenuActions.mFileMenu->addMenu("Checksums");
+    mContextMenuActions.mFileChecksumsMD5 = mContextMenuActions.mFileChecksumsMenu->addAction("MD5", this, SLOT(fileChecksumsMD5()));
+    mContextMenuActions.mFileChecksumsMD2 = mContextMenuActions.mFileChecksumsMenu->addAction("MD2", this, SLOT(fileChecksumsMD2()));
+    mContextMenuActions.mFileChecksumsSHA1 = mContextMenuActions.mFileChecksumsMenu->addAction("SHA-1", this, SLOT(fileChecksumsSHA1()));
+
+//    mContextMenuActions.mFileSetAttributes = mContextMenuActions.mFileMenu->addAction("Set attributes...", this, SLOT(fileSetAttributes()));
+//    mContextMenuActions.mFileSetAttributes->setVisible(false);
+}
+
+void FbFileView::createEditContextMenu()
+{
+    mContextMenuActions.mEditMenu = mContextMenu->addMenu("Edit");
+
+    //mContextMenuActions.mEditSnapShotToE = mContextMenuActions.mEditMenu->addAction("Snap shot to E:", this, SLOT(editSnapShotToE()));
+//    mContextMenuActions.mEditSnapShotToE->setVisible(false);
+    mContextMenuActions.mEditCut = mContextMenuActions.mEditMenu->addAction("Cut", this, SLOT(editCut()));
+    mContextMenuActions.mEditCopy = mContextMenuActions.mEditMenu->addAction("Copy", this, SLOT(editCopy()));
+    mContextMenuActions.mEditPaste = mContextMenuActions.mEditMenu->addAction("Paste", this, SLOT(editPaste()));
+
+    mContextMenuActions.mEditCopyToFolder = mContextMenuActions.mEditMenu->addAction("Copy to folder...", this, SLOT(editCopyToFolder()));
+    mContextMenuActions.mEditMoveToFolder = mContextMenuActions.mEditMenu->addAction("Move to folder...", this, SLOT(editMoveToFolder()));
+}
+
+void FbFileView::createViewContextMenu()
+{
+
+}
+
+void FbFileView::updateContextMenu()
+{
+    bool isFileItemListEmpty = mFbFileModel->rowCount() == 0;
+    bool isDriveListViewActive = mEngineWrapper->isDriveListViewActive();
+//    bool isNormalModeActive = true;       //iModel->FileUtils()->IsNormalModeActive();
+    bool isCurrentDriveReadOnly = mEngineWrapper->isCurrentDriveReadOnly();
+    bool isCurrentItemDirectory = mEngineWrapper->getFileEntry(currentItemIndex()).isDir();
+    bool hasSelectedItems = mListView->selectionModel()->selection().count() != 0;
+    bool isSelectionMode = mOptionMenuActions.mSelection && mOptionMenuActions.mSelection->isChecked();
+    bool isClipBoardEmpty = !mEngineWrapper->isClipBoardListInUse();
+
+    // File submenu
+    //mContextMenuActions.mFileBackMoveUp->setVisible( !isDriveListViewActive);
+    mContextMenuActions.mFileOpenDirectory->setVisible( !isFileItemListEmpty && !isDriveListViewActive && isCurrentItemDirectory);
+
+    mContextMenuActions.mFileDelete->setVisible(!isFileItemListEmpty && !isDriveListViewActive && !isCurrentDriveReadOnly);
+    mContextMenuActions.mFileRename->setVisible(!isFileItemListEmpty && !isDriveListViewActive && !isCurrentDriveReadOnly);
+    mContextMenuActions.mFileTouch->setVisible(!isFileItemListEmpty && !isDriveListViewActive && !isCurrentDriveReadOnly);
+    mContextMenuActions.mFileProperties->setVisible(!isFileItemListEmpty && !isSelectionMode);
+
+    mContextMenuActions.mFileChecksumsMenu->menuAction()->setVisible(!(isFileItemListEmpty || isSelectionMode /*|| !hasSelectedItems*/ || isCurrentItemDirectory || isDriveListViewActive));
+    // Edit submenu
+    mContextMenuActions.mEditMenu->menuAction()->setVisible(!isDriveListViewActive);
+    mContextMenuActions.mEditCut->setVisible(!(isDriveListViewActive || isCurrentDriveReadOnly || isFileItemListEmpty));
+    mContextMenuActions.mEditCopy->setVisible(!(isDriveListViewActive || isFileItemListEmpty));
+    mContextMenuActions.mEditPaste->setVisible(!isDriveListViewActive && !isClipBoardEmpty && !isCurrentDriveReadOnly);
+    mContextMenuActions.mEditCopyToFolder->setVisible(!(isDriveListViewActive || isFileItemListEmpty));
+    mContextMenuActions.mEditMoveToFolder->setVisible(!(isDriveListViewActive || isCurrentDriveReadOnly || isFileItemListEmpty));
+}
+
+// ---------------------------------------------------------------------------
+
+void FbFileView::onLongPressed(HbAbstractViewItem *listViewItem, QPointF coords)
+{
+    QModelIndex proxyIndex = listViewItem->modelIndex();
+    //map to source model
+    mCurrentIndex = mSortFilterProxyModel->mapToSource(proxyIndex);
+
+    mContextMenu->setPreferredPos(coords);
+    mContextMenu->show();
+}
+
+/**
+  Create a file browser tool bar
+  */
+void FbFileView::createToolBar()
+{
+    mToolBar = toolBar();
+
+    mToolbarBackAction = new HbAction(mToolBar);
+    mToolbarBackAction->setToolTip("Back");
+    mToolbarBackAction->setIcon(HbIcon(QString(":/qgn_indi_tb_filebrowser_folder_parent.svg")));
+    connect(mToolbarBackAction, SIGNAL(triggered()), this, SLOT(fileBackMoveUp()));
+    mToolBar->addAction(mToolbarBackAction);
+
+    // Find button and its extension
+    HbToolBarExtension* filterExtension = new HbToolBarExtension();
+    // Set search panel widget
+    mSearchPanel = new HbSearchPanel(filterExtension);
+    mSearchPanel->setMinimumWidth( 360 ); // TODO should be based on layout, screen width
+    connect(mSearchPanel, SIGNAL(criteriaChanged(const QString &)), this, SLOT(filterCriteriaChanged(const QString &)));
+    connect(mSearchPanel, SIGNAL(exitClicked()), filterExtension, SLOT(close()));
+    connect(mSearchPanel, SIGNAL(exitClicked()), this, SLOT(clearFilterCriteria()));
+    filterExtension->setContentWidget(mSearchPanel);
+
+    HbAction* mToolbarFilterAction = mToolBar->addExtension(filterExtension);
+//    mToolbarFilterAction->setText("Filter");
+    mToolbarFilterAction->setToolTip("Filter");
+    mToolbarFilterAction->setIcon(HbIcon(QString(":/qgn_indi_tb_filebrowser_find.svg")));
+    //connect(mToolbarFilterAction, SIGNAL(triggered()), this, SLOT(viewFilterEntries()));
+
+    if (mOptionMenuActions.mSelection) {
+        //mOptionMenuActions.mSelection->setIcon(HbIcon(QString(":/qgn_indi_tb_filebrowser_selection_active.svg")));
+        mToolBar->addAction(mOptionMenuActions.mSelection);
+    }
+
+//    // TODO Paste to be added
+//    if (mOptionMenuActions.mEditPaste) {
+//        //mOptionMenuActions.mEditPaste->setIcon(HbIcon(QString(":/qgn_indi_tb_filebrowser_selection_active.svg")));
+//        mToolBar->addAction(mOptionMenuActions.mEditPaste);
+//    }
+}
+
+/**
+  Refresh FileBrowser view
+  */
+void FbFileView::refreshList()
+{
+    editUnselectAll();
+    mEngineWrapper->refreshView();
+    mSearchPanel->setCriteria(QString(""));
+    mListView->model()->revert();
+    mListView->reset();
+
+    if (mListView->model() && mListView->model()->rowCount() > 0) {
+        QModelIndex firstIndex = mListView->model()->index(0, 0);
+        mListView->scrollTo(firstIndex);
+    }
+
+    TListingMode listingMode = mEngineWrapper->listingMode();
+    if (listingMode == ENormalEntries)
+        mNaviPane->setPlainText(QString(mEngineWrapper->currentPath()));
+    else if (listingMode == ESearchResults)
+        mNaviPane->setPlainText(QString(tr("Search results")));
+    else if (listingMode == EOpenFiles)
+        mNaviPane->setPlainText(QString(tr("Open files")));
+    else if (listingMode == EMsgAttachmentsInbox)
+        mNaviPane->setPlainText(QString(tr("Attachments in Inbox")));
+    else if (listingMode == EMsgAttachmentsDrafts)
+        mNaviPane->setPlainText(QString(tr("Attachments in Drafts")));
+    else if (listingMode == EMsgAttachmentsSentItems)
+        mNaviPane->setPlainText(QString(tr("Attachments in Sent Items")));
+    else if (listingMode == EMsgAttachmentsOutbox)
+        mNaviPane->setPlainText(QString(tr("Attachments in Outbox")));
+}
+
+// ---------------------------------------------------------------------------	
+
+void FbFileView::fileOpen(HbAction *action)
+{
+//    Q_UNUSED(action);
+    HbSelectionDialog *dlg = static_cast<HbSelectionDialog*>(sender());
+    if(!action && dlg && dlg->selectedItems().count()){
+        int selectionIndex = dlg->selectedItems().at(0).toInt();
+
+        if (selectionIndex == 0) {
+            // open editor view
+            emit aboutToShowEditorView(mAbsoluteFilePath, true);
+        } else if (selectionIndex == 1) {
+            // AppArc
+            mEngineWrapper->openAppArc(mAbsoluteFilePath);
+        } else {
+            // DocHandler
+            mEngineWrapper->openDocHandler(mAbsoluteFilePath, true);
+        }
+    }
+}
+
+/**
+  Open overwrite dialog
+  */
+void FbFileView::fileOverwriteDialog()
+{
+    mOverwriteOptions = OverwriteOptions();
+    // open user-dialog to select: view as text/hex,  open w/AppArc or open w/DocH. embed
+    QStringList list;
+    list << QString("Overwrite all")
+         << QString("Skip all existing")
+         << QString("Gen. unique filenames")
+         << QString("Query postfix");
+    openListDialog(list, QString("Overwrite?"), this, SLOT(fileOverwrite(HbAction *)));
+}
+
+/**
+  File overwrite
+  */
+void FbFileView::fileOverwrite(HbAction *action)
+{
+    HbSelectionDialog *dlg = static_cast<HbSelectionDialog*>(sender());
+    if(!action && dlg && dlg->selectedItems().count()) {
+        mOverwriteOptions.queryIndex = dlg->selectedItems().at(0).toInt();
+        if (mOverwriteOptions.queryIndex == EFileActionQueryPostFix) {
+            QString heading = QString("Postfix");
+            HbInputDialog::getText(heading, this, SLOT(fileOverwritePostfix(HbAction *)), QString(), scene());
+        } else if (mOverwriteOptions.queryIndex == EFileActionSkipAllExisting) {
+            mOverwriteOptions.overWriteFlags = 0;
+        }
+    } else {
+        mOverwriteOptions.doFileOperations = false;
+    }
+}
+
+/**
+  File overwrite postfix query dialog
+  */
+void FbFileView::fileOverwritePostfix(HbAction *action)
+{
+    HbInputDialog *dlg = static_cast<HbInputDialog*>(sender());
+    if (dlg && action && action->text().compare(QString("Ok"), Qt::CaseInsensitive) == 0) {
+        mOverwriteOptions.postFix = dlg->value().toString();
+    } else {
+        mOverwriteOptions.doFileOperations = false;
+    }
+}
+
+// ---------------------------------------------------------------------------
+/**
+  Show a list dialog
+  \param List aList of item to select item from.
+  \param Title text titleText of a dialog heading widget
+  \return None
+  */
+void FbFileView::openListDialog(const QStringList& items, const QString &titleText, QObject* receiver, const char* member)
+{
+    // Create a list and some simple content for it
+    HbSelectionDialog *dlg = new HbSelectionDialog();
+    dlg->setAttribute(Qt::WA_DeleteOnClose);
+    // Set items to be popup's content
+    dlg->setStringItems(items);
+    dlg->setSelectionMode(HbAbstractItemView::SingleSelection);
+
+    HbLabel *title = new HbLabel(dlg);
+    title->setPlainText(titleText);
+    dlg->setHeadingWidget(title);
+
+    // Launch popup and handle the user response:
+    dlg->open(receiver, member);
+}
+
+// ---------------------------------------------------------------------------
+
+void FbFileView::openPropertyDialog(const QStringList& propertyList, const QString& title)
+{
+    HbDialog *dialog = new HbDialog();
+    dialog->setDismissPolicy(HbPopup::TapOutside);
+    dialog->setTimeout(HbPopup::NoTimeout);
+
+    HbLabel *titleWidget = new HbLabel();
+    titleWidget->setPlainText(title);
+    dialog->setHeadingWidget(titleWidget);
+
+    // Create a list and some simple content for it
+    HbListWidget *list = new HbListWidget();
+    QString str;
+    foreach (str, propertyList) {
+        list->addItem(str);
+    }
+
+    // Connect list item activation signal to close the popup
+    connect(list, SIGNAL(activated(HbListWidgetItem*)), dialog, SLOT(close()));
+
+    HbAction *cancelAction = new HbAction("Close");
+    dialog->setPrimaryAction(cancelAction);
+
+    // Set listwidget to be popup's content
+    dialog->setContentWidget(list);
+    // Launch popup and handle the user response:
+    dialog->open();
+}
+
+/**
+  Stores selection or current index mapped to source model
+  */
+void FbFileView::storeSelectedItemsOrCurrentItem()
+{
+    QItemSelectionModel *selectionIndexes = mListView->selectionModel();
+
+    // by default use selected items
+    if (selectionIndexes) {
+        if (selectionIndexes->hasSelection()) {
+            QItemSelection proxyItemSelection = mListView->selectionModel()->selection();
+            QItemSelection itemSelection = mSortFilterProxyModel->mapSelectionToSource(proxyItemSelection);
+            mSelectionIndexes = itemSelection.indexes();
+        } else { // or if none selected, use the current item index
+            mSelectionIndexes.clear();
+            QModelIndex currentIndex = currentItemIndex();  //alreade mapped to source model
+            mSelectionIndexes.append(currentIndex);
+        }
+    }
+}
+
+// ---------------------------------------------------------------------------
+
+QModelIndex FbFileView::currentItemIndex()
+{
+    return mCurrentIndex;
+}
+
+// ---------------------------------------------------------------------------
+// operations in File Menu
+// ---------------------------------------------------------------------------
+
+/**
+  Move back/up in folder browsing history
+  */
+void FbFileView::fileBackMoveUp()
+{
+    mLocationChanged = true;
+    mEngineWrapper->moveUpOneLevel();
+    //mListView->setRootIndex(currentItemIndex());
+    refreshList();
+    if (mEngineWrapper->isDriveListViewActive()) {
+        emit aboutToShowDriveView();
+    }
+}
+
+void FbFileView::fileOpenDirectory()
+{
+    mLocationChanged = true;
+    // get selected drive or directory from list view model and open it:
+    //if (mListView->selectionModel()->hasSelection()) {
+//    if (mListView->selectionModel()->selection().count() != 0) {
+//        QModelIndex currentIndex = currentItemIndex();
+        mEngineWrapper->moveDownToDirectory(currentItemIndex());
+//        mListView->setRootIndex(currentItemIndex());
+        refreshList();
+//    } else {
+//        Notifications::showErrorNote("not selected item!");
+//    }
+}
+
+void FbFileView::fileSearch()
+{
+    QString searchPath;
+//    if (mEngineWrapper->currentPath() != mInitDirPath.path()) {
+//        searchPath = mDirectory;
+//        searchPath.replace("/", "\\");
+//        searchPath+="\\";
+//    }
+    searchPath = mEngineWrapper->currentPath();
+//    mSearch->open(searchPath);
+    emit aboutToShowSearchView(searchPath);
+}
+
+/**
+  Open new file dialog
+  */
+void FbFileView::fileNewFile()
+{
+    QString heading = QString("Enter filename");
+    HbInputDialog::getText(heading, this, SLOT(doFileNewFile(HbAction*)), QString(), scene());
+}
+
+/**
+  Create a new file in current directory with a name queried from user
+  */
+void FbFileView::doFileNewFile(HbAction *action)
+{
+    HbInputDialog *dlg = static_cast<HbInputDialog*>(sender());
+    if (dlg && action && action->text().compare(QString("Ok"), Qt::CaseInsensitive) == 0) {
+        QString newFileName = dlg->value().toString();
+        mEngineWrapper->createNewFile(newFileName);
+        refreshList();
+    }
+}
+
+/**
+  Open new directory dialog
+  */
+void FbFileView::fileNewDirectory()
+{
+    QString heading = QString("Enter directory name");
+    HbInputDialog::getText(heading, this, SLOT(doFileNewDirectory(HbAction*)), QString(), scene());
+}
+
+/**
+  Create a new directory in current directory with a name queried from user
+  */
+void FbFileView::doFileNewDirectory(HbAction *action)
+{
+    HbInputDialog *dlg = static_cast<HbInputDialog*>(sender());
+    if (dlg && action && action->text().compare(QString("Ok"), Qt::CaseInsensitive) == 0) {
+        QString newDirectoryName = dlg->value().toString();
+        mEngineWrapper->createNewDirectory(newDirectoryName);
+        refreshList();
+    }
+}
+
+/**
+  Question for Delete actually selected files
+  */
+void FbFileView::fileDelete()
+{
+    storeSelectedItemsOrCurrentItem();
+    const QString messageFormat = "Delete %1 entries?";
+    QString message = messageFormat.arg(mSelectionIndexes.count());
+    HbMessageBox::question(message, this, SLOT(doFileDelete(HbAction*)));
+}
+
+/**
+  Delete actually selected files
+  */
+void FbFileView::doFileDelete(HbAction* action)
+{
+    if (action && action->text().compare(QString("Yes"), Qt::CaseInsensitive) == 0) {
+        //storeSelectedItemsOrCurrentItem();
+        mEngineWrapper->deleteItems(mSelectionIndexes);
+        refreshList();
+    }
+}
+
+/**
+  Open rename dialog for actually selected files
+  */
+void FbFileView::fileRename()
+{
+    storeSelectedItemsOrCurrentItem();
+    mEngineWrapper->setCurrentSelection(mSelectionIndexes);
+
+    for (int i(0), ie(mSelectionIndexes.count()); i < ie; ++i ) {
+        mProceed = (i == ie-1); // if the last item
+        mModelIndex = mSelectionIndexes.at(i);
+        FileEntry entry = mEngineWrapper->getFileEntry(mModelIndex);
+
+        QString heading = QString("Enter new name");
+        HbInputDialog::getText(heading, this, SLOT(doFileRename(HbAction*)), entry.name(), scene());
+    }
+}
+
+/**
+  Rename actually selected files
+  */
+void FbFileView::doFileRename(HbAction *action)
+{
+    HbInputDialog *dlg = static_cast<HbInputDialog*>(sender());
+    if (dlg && action && action->text().compare(QString("Ok"), Qt::CaseInsensitive) == 0) {
+        mNewFileName = dlg->value().toString();
+
+        if (mEngineWrapper->targetExists(mModelIndex, mNewFileName)) {
+            const QString messageTemplate = QString("%1 already exists, overwrite?");
+            QString message = messageTemplate.arg(mNewFileName);
+            HbMessageBox::question(message, this, SLOT(doFileRenameFileExist(HbAction *)));
+        } else {
+            mEngineWrapper->rename(mModelIndex, mNewFileName);
+            if (mProceed) {
+                mEngineWrapper->startExecutingCommands(QString("Renaming"));
+                refreshList();
+            }
+        }
+    }
+}
+
+/**
+  Rename actually selected files
+  */
+void FbFileView::doFileRenameFileExist(HbAction *action)
+{
+    if (action && action->text().compare(QString("Yes"), Qt::CaseInsensitive) == 0) {
+        mEngineWrapper->rename(mModelIndex, mNewFileName);
+        if (mProceed) {
+            mEngineWrapper->startExecutingCommands(QString("Renaming"));
+            refreshList();
+        }
+    }
+}
+
+/**
+  Touch actually selected files
+  */
+void FbFileView::fileTouch()
+{
+    storeSelectedItemsOrCurrentItem();
+    mEngineWrapper->setCurrentSelection(mSelectionIndexes);
+
+    if (mEngineWrapper->selectionHasDirs()) {
+        const QString message = "Recurse touch for all selected dirs?";
+        HbMessageBox::question(message, this, SLOT(doFileTouch(HbAction*)));
+    }
+    else{
+        mEngineWrapper->touch(false);
+        refreshList();
+    }
+}
+
+/**
+  Touch actually selected files
+  */
+void FbFileView::doFileTouch(HbAction* action)
+{
+    bool recurse = false;
+    if (action && action->text().compare(QString("Yes"), Qt::CaseInsensitive) == 0) {
+        recurse = true;
+        }
+    mEngineWrapper->touch(recurse);
+    refreshList();
+}
+
+void FbFileView::fileChecksumsMD5()
+{
+    fileChecksums(EFileChecksumsMD5);
+}
+
+void FbFileView::fileChecksumsMD2()
+{
+    fileChecksums(EFileChecksumsMD2);
+}
+
+void FbFileView::fileChecksumsSHA1()
+{
+    fileChecksums(EFileChecksumsSHA1);
+}
+
+void FbFileView::fileChecksums(TFileBrowserCmdFileChecksums checksumType)
+{
+    mEngineWrapper->showFileCheckSums(currentItemIndex(), checksumType);
+}
+
+/**
+  Show file properties
+  */
+void FbFileView::fileProperties()
+{
+    QModelIndex currentIndex = currentItemIndex();
+    QStringList propertyList;
+    QString titleText;
+    mEngineWrapper->properties(currentIndex, propertyList, titleText);
+    openPropertyDialog(propertyList, titleText);
+}
+
+void FbFileView::fileSetAttributes()
+{
+
+}
+
+// edit menu
+void FbFileView::editSnapShotToE()
+{
+
+}
+
+/**
+  Set selected files into clipboard.
+  Selected item will be removed after paste operation.
+  */
+void FbFileView::editCut()
+{
+    storeSelectedItemsOrCurrentItem();
+
+    // Store indices to clipboard
+    mClipboardIndexes.clear();
+    for (int i = 0; i < mSelectionIndexes.size(); ++i) {
+        mClipboardIndexes.append(mSelectionIndexes.at(i));
+    }
+
+    mEngineWrapper->clipboardCut(mClipboardIndexes);
+
+    int operations = mClipboardIndexes.count();
+    const QString message = QString ("%1 entries cut to clipboard");
+    QString noteMsg = message.arg(operations);
+
+    Notifications::showInformationNote(noteMsg);
+}
+
+/**
+  Set selected files into clipboard.
+  Selected item will not be removed after paste operation.
+  */
+void FbFileView::editCopy()
+{
+    storeSelectedItemsOrCurrentItem();
+
+    // Store indices to clipboard
+    mClipboardIndexes.clear();
+    for (int i = 0; i < mSelectionIndexes.size(); ++i) {
+        mClipboardIndexes.append(mSelectionIndexes.at(i));
+    }
+
+    mEngineWrapper->clipboardCopy(mClipboardIndexes);
+
+    int operations = mClipboardIndexes.count();
+
+    const QString message = QString ("%1 entries copied to clipboard");
+    QString noteMsg = message.arg(operations);
+
+    Notifications::showInformationNote(noteMsg);
+}
+
+/**
+  Moves or copies file selection stored in clipboard to a actual directory.
+  Removing files depend on previous operation, i.e. Cut or Copy
+  */
+void FbFileView::editPaste()
+{
+    bool someEntryExists(false);
+
+    // TODO Set entry items here
+
+    someEntryExists = mEngineWrapper->isDestinationEntriesExists(mClipboardIndexes, mEngineWrapper->currentPath());
+    if (someEntryExists) {
+        fileOverwriteDialog();
+    }
+    
+    mEngineWrapper->clipboardPaste(mOverwriteOptions);
+}
+
+/**
+  Open copy to folder new filename dialog
+  */
+void FbFileView::editCopyToFolder()
+{
+    QString heading = QString("Enter new name");
+    HbInputDialog::getText(heading, this, SLOT(doEditCopyToFolder(HbAction*)), mEngineWrapper->currentPath(), scene());
+}
+
+/**
+  Copies current file selection to a queried directory.
+  */
+void FbFileView::doEditCopyToFolder(HbAction *action)
+{
+    HbInputDialog *dlg = static_cast<HbInputDialog*>(sender());
+    if (dlg && action && action->text().compare(QString("Ok"), Qt::CaseInsensitive) == 0) {
+        QString targetDir = dlg->value().toString();
+        bool someEntryExists(false);
+
+        // TODO Set entry items here
+        storeSelectedItemsOrCurrentItem();
+        mEngineWrapper->setCurrentSelection(mSelectionIndexes);
+
+        someEntryExists = mEngineWrapper->isDestinationEntriesExists(mSelectionIndexes, targetDir);
+        if (someEntryExists) {
+            fileOverwriteDialog();
+        }
+        mEngineWrapper->copyToFolder(targetDir, mOverwriteOptions, false);
+        refreshList();
+    }
+}
+
+/**
+  Open move to folder new filename dialog.
+  */
+void FbFileView::editMoveToFolder()
+{
+    QString heading = QString("Enter new name");
+    HbInputDialog::getText(heading, this, SLOT(doEditMoveToFolder(HbAction*)), mEngineWrapper->currentPath(), scene());
+}
+
+/**
+  Moves current file selection to a queried directory.
+  */
+void FbFileView::doEditMoveToFolder(HbAction *action)
+{
+    HbInputDialog *dlg = static_cast<HbInputDialog*>(sender());
+    if (dlg && action && action->text().compare(QString("Ok"), Qt::CaseInsensitive) == 0) {
+        QString targetDir = dlg->value().toString();
+        bool someEntryExists(false);
+
+        // TODO Set entry items here
+        storeSelectedItemsOrCurrentItem();
+        mEngineWrapper->setCurrentSelection(mSelectionIndexes);
+
+        someEntryExists = mEngineWrapper->isDestinationEntriesExists(mSelectionIndexes, targetDir);
+        if (someEntryExists) {
+            fileOverwriteDialog();
+        }
+        mEngineWrapper->copyToFolder(targetDir, mOverwriteOptions, true);
+        refreshList();
+    }
+}
+
+/**
+  Select current file
+  */
+void FbFileView::editSelect()
+{
+    QItemSelectionModel *selectionModel = mListView->selectionModel();
+    if (selectionModel) {
+        selectionModel->select(selectionModel->currentIndex(), QItemSelectionModel::SelectCurrent);
+        selectionModel->select(selectionModel->currentIndex(), QItemSelectionModel::Select);
+//        itemHighlighted(selectionModel->currentIndex());
+        refreshList();
+    }
+}
+
+/**
+  Unselect current file
+  */
+void FbFileView::editUnselect()
+{
+    QItemSelectionModel *selectionModel = mListView->selectionModel();
+    if (selectionModel) {
+        selectionModel->select(selectionModel->currentIndex(), QItemSelectionModel::Deselect);
+//        itemHighlighted(selectionModel->currentIndex());
+    }
+}
+
+/**
+  Select all files
+  */
+void FbFileView::editSelectAll()
+{
+    QItemSelectionModel *selectionModel = mListView->selectionModel();
+    if (selectionModel) {
+
+        //if (mFileBrowserModel->rowCount() > 0) {
+        if (mListView->model() && mListView->model()->rowCount() > 0) {
+            QModelIndex firstIndex = mListView->model()->index(0, 0);
+            QModelIndex lastIndex = mListView->model()->index( (mListView->model()->rowCount() - 1), 0);
+
+            QItemSelection itemSelection(firstIndex, lastIndex);
+            selectionModel->select(itemSelection, QItemSelectionModel::SelectCurrent);
+        }
+    }
+}
+
+/**
+  Unselect all files
+  */
+void FbFileView::editUnselectAll()
+{
+    QItemSelectionModel *selectionModel = mListView->selectionModel();
+    if (selectionModel) {
+        selectionModel->clearSelection();
+    }
+}
+
+// ---------------------------------------------------------------------------
+// view menu
+// ---------------------------------------------------------------------------
+void FbFileView::viewFilterEntries()
+{
+    if (mToolBar && mToolBar->actions().count() > 1 && mToolBar->actions().at(1)) {
+        HbAction* tbeFilterAction = qobject_cast<HbAction*>(mToolBar->actions().at(1));
+        if (tbeFilterAction && tbeFilterAction->toolBarExtension()) {
+            HbToolBarExtension *tbeFilter = tbeFilterAction->toolBarExtension();
+            tbeFilter->open();
+        }
+    }
+}
+
+/**
+  Set filter criteria to proxy model
+  */
+void FbFileView::filterCriteriaChanged(const QString &criteria)
+{
+    mSortFilterProxyModel->setFilterCriteria(criteria);
+}
+
+/**
+  Set filter criteria to proxy model
+  */
+void FbFileView::clearFilterCriteria()
+{
+    mSearchPanel->setCriteria(QString(""));
+}
+
+/**
+  Refresh view
+  */
+void FbFileView::viewRefresh()
+{
+    refreshList();
+}
+
+// ---------------------------------------------------------------------------
+// tools menu
+// ---------------------------------------------------------------------------
+void FbFileView::toolsAllAppsToTextFile()
+{
+
+}
+
+/**
+  Write all files to text file
+  */
+void FbFileView::toolsAllFilesToTextFile()
+{
+    mEngineWrapper->toolsWriteAllFiles();
+}
+
+//void FbFileView::toolsAvkonIconCacheEnable()
+//{
+//
+//}
+//void FbFileView::toolsAvkonIconCacheDisable()
+//{
+//
+//}
+
+/**
+  Disable extended errors
+  */
+void FbFileView::toolsDisableExtendedErrors()
+{
+    mEngineWrapper->ToolsSetErrRd(false);
+}
+
+void FbFileView::toolsDumpMsgStoreWalk()
+{
+
+}
+void FbFileView::toolsEditDataTypes()
+{
+
+}
+
+/**
+  Enable extended errors
+  */
+void FbFileView::toolsEnableExtendedErrors()
+{
+    mEngineWrapper->ToolsSetErrRd(true);
+}
+
+/**
+  Open simulate leave dialog
+  */
+void FbFileView::toolsErrorSimulateLeave()
+{
+    int leaveCode = -6;
+    QString heading = QString("Leave code");
+    //HbInputDialog::getInteger(heading, this, SLOT(doToolsErrorSimulateLeave(HbAction*)), leaveCode, scene());
+    HbInputDialog::getText(heading, this, SLOT(doToolsErrorSimulateLeave(HbAction*)), QString::number(leaveCode), scene());
+}
+
+
+/**
+  Simulate leave.
+  */
+void FbFileView::doToolsErrorSimulateLeave(HbAction *action)
+{
+    HbInputDialog *dlg = static_cast<HbInputDialog*>(sender());
+    if (dlg && action && action->text().compare(QString("Ok"), Qt::CaseInsensitive) == 0) {
+        bool ok;
+        int leaveCode = dlg->value().toString().toInt(&ok);
+        if (leaveCode != 0 || ok) {
+            mEngineWrapper->ToolsErrorSimulateLeave(leaveCode);
+        }
+    }
+}
+
+/**
+  Open simulate panic dialog.
+  */
+void FbFileView::toolsErrorSimulatePanic()
+{
+    mPanicCategory = QString ("Test Category");
+    QString heading = QString("Panic category");
+    HbInputDialog::getText(heading, this, SLOT(doToolsErrorSimulatePanicCode(HbAction*)), mPanicCategory, scene());
+}
+
+/**
+  Simulate panic.
+  */
+void FbFileView::doToolsErrorSimulatePanicCode(HbAction *action)
+{
+    HbInputDialog *dlg = static_cast<HbInputDialog*>(sender());
+    if (dlg && action && action->text().compare(QString("Ok"), Qt::CaseInsensitive) == 0) {
+        mPanicCategory = dlg->value().toString();
+        int panicCode(555);
+        QString heading = QString("Panic code");
+        HbInputDialog::getInteger(heading, this, SLOT(doToolsErrorSimulatePanic(HbAction*)), panicCode, scene());
+    }
+}
+
+/**
+  Simulate panic.
+  */
+void FbFileView::doToolsErrorSimulatePanic(HbAction *action)
+{
+    HbInputDialog *dlg = static_cast<HbInputDialog*>(sender());
+    if (dlg && action && action->text().compare(QString("Ok"), Qt::CaseInsensitive) == 0) {
+        bool ok;
+        int panicCode = dlg->value().toInt(&ok);
+        if (panicCode != 0 || ok) {
+            mEngineWrapper->ToolsErrorSimulatePanic(mPanicCategory, panicCode);
+        }
+    }
+}
+
+/**
+  Open simulate exception dialog.
+  */
+void FbFileView::toolsErrorSimulateException()
+{
+    int exceptionCode = 0;
+    QString heading = QString("Exception code");
+    HbInputDialog::getInteger(heading, this, SLOT(doToolsErrorSimulateException(HbAction*)), exceptionCode, scene());
+}
+
+/**
+  Simulate exception.
+  */
+void FbFileView::doToolsErrorSimulateException(HbAction *action)
+{
+    HbInputDialog *dlg = static_cast<HbInputDialog*>(sender());
+    if (dlg && action && action->text().compare(QString("Ok"), Qt::CaseInsensitive) == 0) {
+        bool ok;
+        int exceptionCode = dlg->value().toInt(&ok);
+        if (exceptionCode != 0 || ok) {
+            mEngineWrapper->ToolsErrorSimulateException(exceptionCode);
+        }
+    }
+}
+
+//    void FbFileView::toolsLocalConnectivityActivateInfrared()
+//{
+//
+//}
+//    void FbFileView::toolsLocalConnectivityLaunchBTUI()
+//{
+//
+//}
+//    void FbFileView::toolsLocalConnectivityLaunchUSBUI()
+//{
+//
+//}
+void FbFileView::toolsMessageInbox()
+{
+
+}
+void FbFileView::toolsMessageDrafts()
+{
+
+}
+void FbFileView::toolsMessageSentItems()
+{
+
+}
+void FbFileView::toolsMessageOutbox()
+{
+
+}
+void FbFileView::toolsMemoryInfo()
+{
+
+}
+void FbFileView::toolsSecureBackStart()
+{
+
+}
+void FbFileView::toolsSecureBackRestore()
+{
+
+}
+void FbFileView::toolsSecureBackStop()
+{
+
+}
+
+/**
+  Open debug mask dialog
+  */
+void FbFileView::toolsSetDebugMaskQuestion()
+{
+    quint32 dbgMask = mEngineWrapper->getDebugMask();
+    QString dbgMaskText = QString("0x").append(QString::number(dbgMask, 16));
+    QString heading = QString("Kernel debug mask in hex format");
+    HbInputDialog::getText(heading, this, SLOT(toolsSetDebugMask(HbAction*)), dbgMaskText, scene());
+}
+
+/**
+  Set debug mask
+  */
+void FbFileView::toolsSetDebugMask(HbAction *action)
+{
+    HbInputDialog *dlg = static_cast<HbInputDialog*>(sender());
+    if (dlg && action && action->text().compare(QString("Ok"), Qt::CaseInsensitive) == 0) {
+        QString dbgMaskText = dlg->value().toString();
+        if (dbgMaskText.length() > 2 && dbgMaskText[0]=='0' && dbgMaskText[1]=='x') {
+            bool ok;
+            quint32 dbgMask = dbgMaskText.toUInt(&ok, 16);
+            if (dbgMask != 0 || ok) {
+                mEngineWrapper->toolsSetDebugMask(dbgMask);
+                Notifications::showConfirmationNote(QString("Changed"));
+            } else {
+                Notifications::showErrorNote(QString("Cannot convert value"));
+            }
+        } else {
+            Notifications::showErrorNote(QString("Not in hex format"));
+        }
+    }
+}
+
+void FbFileView::toolsShowOpenFilesHere()
+{
+
+}
+
+// ---------------------------------------------------------------------------
+// main menu items
+// ---------------------------------------------------------------------------
+void FbFileView::selectionModeChanged()
+{
+    if (mOptionMenuActions.mSelection->isChecked()) {
+         activateSelectionMode();
+     } else {
+         deActivateSelectionMode();
+     }
+}
+
+/**
+  Show about note
+  */
+void FbFileView::about()
+{
+    Notifications::showAboutNote();
+}
+
+// ---------------------------------------------------------------------------
+// End of operations
+// ---------------------------------------------------------------------------
+
+// ---------------------------------------------------------------------------
+
+/**
+  Item is selected from list when selection mode is activated from menu
+  */
+void FbFileView::selectionChanged(const QItemSelection &/*selected*/, const QItemSelection &/*deselected*/)
+{
+    //QItemSelectionModel *selectionModel = mListView->selectionModel();
+    //itemHighlighted(selectionModel->currentIndex());
+}
+
+/**
+  An item is clicked from navigation item list. Navigation item list contains
+  drive-, folder- or file items. Opens selected drive, folder or file popup menu
+  */
+void FbFileView::activated(const QModelIndex& index)
+{
+    if (mFbFileModel) {
+        //map to source model
+        QModelIndex activatedIndex = mSortFilterProxyModel->mapToSource(index);
+
+        if (mEngineWrapper->getFileEntry(activatedIndex).isDir()) {
+            // populate new content of changed navigation view.
+            // mLocationChanged = true;
+            // mDirectory = filePath;
+            mEngineWrapper->moveDownToDirectory(activatedIndex);
+            refreshList();
+        } else {  // file item
+            // mSelectedFilePath = filePath;
+            FileEntry fileEntry = mEngineWrapper->getFileEntry(activatedIndex);
+            mAbsoluteFilePath = fileEntry.path() + fileEntry.name();
+
+            // open user-dialog to select: view as text/hex,  open w/AppArc or open w/DocH. embed
+            QStringList list;
+            list << QString("View as text/hex") << QString("Open w/ AppArc") << QString("Open w/ DocH. embed");
+            openListDialog(list, QString("Open file"), this, SLOT(fileOpen(HbAction *)));
+        }
+    }
+}
+
+// ---------------------------------------------------------------------------
+
+void FbFileView::activateSelectionMode()
+{
+    QString path;
+    disconnect(mListView, SIGNAL(activated(QModelIndex)), this, SLOT(activated(QModelIndex)));
+    mListView->setSelectionMode(HbListView::MultiSelection);
+
+//    QModelIndex index = mFileSystemModel->index(path,0);
+//    mListView->selectionModel()->setCurrentIndex(index, QItemSelectionModel::SelectCurrent);
+//    mListView->selectionModel()->select(index, QItemSelectionModel::Select);
+//    //mListView->setHighlightMode(HbItemHighlight::HighlightAlwaysVisible);
+//    mListView->setFocus();    // TODO use focus in
+    if (mListView->selectionModel()) {
+        connect(mListView->selectionModel(),
+                SIGNAL(selectionChanged(QItemSelection, QItemSelection)),
+                this,
+                SLOT(selectionChanged(QItemSelection, QItemSelection)));
+//        // flag to indicate that selection mode changed, "edit" sub-menu update needed
+//        mFolderContentChanged = true;
+    }
+}
+
+// ---------------------------------------------------------------------------
+
+void FbFileView::deActivateSelectionMode()
+{
+    disconnect(mListView->selectionModel(),
+               SIGNAL(selectionChanged(QItemSelection, QItemSelection)),
+               this,
+               SLOT(selectionChanged(QItemSelection, QItemSelection)));
+    mListView->setSelectionMode(HbListView::NoSelection);
+    connect(mListView, SIGNAL(activated(QModelIndex)), this, SLOT(activated(QModelIndex)));
+    editUnselectAll();
+    // flag to indicate that selection mode changed, "edit" sub-menu update needed
+    mFolderContentChanged = true;
+}
+
+// ---------------------------------------------------------------------------
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/filebrowser/ui/src/fbmainwindow.cpp	Thu Jul 22 16:33:59 2010 +0100
@@ -0,0 +1,145 @@
+/*
+* 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>
+#include <HbMainWindow>
+
+#include "fbmainwindow.h"
+#include "enginewrapper.h"
+#include "fbfileview.h"
+#include "fbdriveview.h"
+#include "settingsview.h"
+#include "editorview.h"
+#include "searchview.h"
+
+FbMainWindow::FbMainWindow(QWidget *parent)
+    : HbMainWindow(parent),
+    mEngineWrapper(0),
+    mDriveView(0),
+    mFileView(0),
+    mSettingsView(0),
+    mEditorView(0),
+    mSearchView(0),
+    mPreviousView(0)
+{
+}
+
+FbMainWindow::~FbMainWindow ()
+{
+    if (mEngineWrapper) {
+        delete mEngineWrapper;
+    }
+}
+
+void FbMainWindow::init()
+{
+    // Create Engine Wrapper and initialize it
+    mEngineWrapper = new EngineWrapper();
+    int error = mEngineWrapper->init();
+    Q_ASSERT_X(error == 1, "FileBrowser", "Engine initialization failed");
+
+    // Create drive view
+    mDriveView = new FbDriveView();
+    connect(mDriveView, SIGNAL(aboutToShowSettingsView()), this, SLOT(openSettingsView()));
+    connect(mDriveView, SIGNAL(aboutToShowFileView()), this, SLOT(openFileView()));
+    mDriveView->init(mEngineWrapper);
+    addView(mDriveView);
+
+    // Create file view
+    mFileView = new FbFileView();
+    connect(mFileView, SIGNAL(aboutToShowSettingsView()), this, SLOT(openSettingsView()));
+    connect(mFileView, SIGNAL(aboutToShowDriveView()), this, SLOT(openDriveView()));
+    mFileView->init(mEngineWrapper);
+    addView(mFileView);
+
+    // Create settings view
+    mSettingsView = new SettingsView(*mEngineWrapper);
+    connect(mSettingsView, SIGNAL(finished(bool)), this, SLOT(openPreviousBrowserView()));
+    addView(mSettingsView);
+
+    // Create editor view
+    mEditorView = new EditorView();
+    connect(mFileView, SIGNAL(aboutToShowEditorView(const QString &, bool)), this, SLOT(openEditorView(const QString &, bool)));
+    connect(mEditorView, SIGNAL(finished(bool)), this, SLOT(openFileView()));
+    addView(mEditorView);
+
+    // Create Search view
+    mSearchView = new SearchView(*mEngineWrapper);
+    connect(mDriveView, SIGNAL(aboutToShowSearchView(QString)), this, SLOT(openSearchView(QString)));
+    connect(mFileView, SIGNAL(aboutToShowSearchView(QString)), this, SLOT(openSearchView(QString)));
+    connect(mSearchView, SIGNAL(finished(bool)), this, SLOT(openFileBrowserView(bool)));
+    addView(mSearchView);
+
+    // Show ApplicationView at startup
+    setCurrentView(mDriveView);
+    mPreviousView = mDriveView;
+
+    // Show HbMainWindow
+    show();
+}
+
+
+void FbMainWindow::openPreviousBrowserView()
+{
+    mDriveView->refreshList();
+    mFileView->refreshList();
+    setCurrentView(mPreviousView);
+}
+
+void FbMainWindow::openFileBrowserView(bool accepted)
+{
+    mDriveView->refreshList();
+    mFileView->refreshList();
+    if (accepted) {
+        setCurrentView(mFileView);
+    } else {
+        setCurrentView(mPreviousView);
+    }
+}
+
+void FbMainWindow::openDriveView()
+{
+    mDriveView->refreshList();
+    setCurrentView(mDriveView);
+    mPreviousView = mDriveView;
+}
+
+void FbMainWindow::openFileView()
+{
+    mDriveView->refreshList();
+//    mFileView->setCurrentpath(path);
+    mFileView->refreshList();
+    setCurrentView(mFileView);
+    mPreviousView = mFileView;
+}
+
+void FbMainWindow::openSettingsView()
+{
+    mSettingsView->initDataForm();
+    setCurrentView(mSettingsView);
+}
+
+void FbMainWindow::openEditorView(const QString &fileName, bool flagReadOnly)
+{
+    mEditorView->open(fileName, flagReadOnly);
+    setCurrentView(mEditorView);
+}
+
+void FbMainWindow::openSearchView(const QString &path)
+{
+    mSearchView->open(path);
+    setCurrentView(mSearchView);
+}
--- a/filebrowser/ui/src/filebrowsermainwindow.cpp	Fri Jun 11 16:29:34 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,88 +0,0 @@
-/*
-* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-
-#include <HbApplication>
-#include <HbMainWindow>
-
-#include "filebrowsermainwindow.h"
-#include "enginewrapper.h"
-#include "filebrowserview.h"
-#include "settingsview.h"
-#include "editorview.h"
-
-FileBrowserMainWindow::FileBrowserMainWindow(QWidget *parent) :
-        HbMainWindow( parent )
-        ,mEngineWrapper(0)
-        ,mFileBrowserView(0)
-        ,mSettingsView(0)
-        ,mEditorView(0)
-{
-}
-
-FileBrowserMainWindow::~FileBrowserMainWindow ()
-{
-    if (mEngineWrapper) {
-        delete mEngineWrapper;
-    }
-}
-
-void FileBrowserMainWindow::init()
-{
-    // Create Engine Wrapper and initialize it
-    mEngineWrapper = new EngineWrapper();
-    int error = mEngineWrapper->init();
-    Q_ASSERT_X(error == 1, "FileBrowser", "Engine initialization failed");
-
-    // Create file browser view
-    mFileBrowserView = new FileBrowserView(*this);
-    connect(mFileBrowserView, SIGNAL(aboutToShowSettingsView()), this, SLOT(openSettingsView()));
-    mFileBrowserView->init(mEngineWrapper);
-    addView(mFileBrowserView);
-
-    // Create settings view
-    mSettingsView = new SettingsView(*this, *mEngineWrapper);
-    connect(mSettingsView, SIGNAL(finished(bool)), this, SLOT(openFileBrowserView()));
-    addView(mSettingsView);
-
-    // Create settings view
-    mEditorView = new EditorView(*this);
-    connect(mFileBrowserView, SIGNAL(aboutToShowEditorView(const QString &, bool)), this, SLOT(openEditorView(const QString &, bool)));
-    connect(mEditorView, SIGNAL(finished(bool)), this, SLOT(openFileBrowserView()));
-    addView(mEditorView);
-
-    // Show ApplicationView at startup
-    setCurrentView(mFileBrowserView);
-    // Show HbMainWindow
-    show();
-}
-
-void FileBrowserMainWindow::openFileBrowserView()
-{
-    setCurrentView(mFileBrowserView);
-}
-
-void FileBrowserMainWindow::openSettingsView()
-{
-    setCurrentView(mSettingsView);
-}
-
-void FileBrowserMainWindow::openEditorView(const QString &fileName, bool flagReadOnly)
-{
-    mEditorView->open(fileName, flagReadOnly);
-    setCurrentView(mEditorView);
-}
--- a/filebrowser/ui/src/filebrowsermodel.cpp	Fri Jun 11 16:29:34 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,145 +0,0 @@
-/*
-* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-#include "filebrowsermodel.h"
-#include "enginewrapper.h"
-#include "fileentry.h"
-#include "driveentry.h"
-#include "settingsview.h"
-#include "filebrowsersettings.h"
-#include "FB.hrh"
-
-#include <QModelIndex>
-#include <QFileIconProvider>
-
-/**
-  Constructs a file browser custom system model with the given \a engineWrapper and \a parent.
-  */
-FileBrowserModel::FileBrowserModel(EngineWrapper *engineWrapper, QObject *parent) :
-    QAbstractListModel(parent),
-    mEngineWrapper(engineWrapper),
-    mFileIconProvider(0)
-{
-    mFileIconProvider = new QFileIconProvider();
-}
-
-/**
-  Destroys this file browser custom system model.
-  */
-FileBrowserModel::~FileBrowserModel()
-{  
-    if (mFileIconProvider) {
-        delete mFileIconProvider;
-    }
-}
-
-/**
-  \reimp
-  */
-int FileBrowserModel::rowCount(const QModelIndex &parent) const
-{
-    Q_UNUSED(parent);
-    return mEngineWrapper->itemCount();
-}
-
-/**
-  \reimp
-  */
-QVariant FileBrowserModel::data(const QModelIndex &index, int role) const
-{
-    if (!index.isValid() || index.model() != this)
-        return QVariant();
-
-    switch (role) {
-    case Qt::EditRole:
-    case Qt::DisplayRole: {
-            QStringList listItem;
-            if (mEngineWrapper->isDriveListViewActive()) {
-                DriveEntry driveEntry(mEngineWrapper->getDriveEntry(index));
-                if (mEngineWrapper->settings().fileViewMode() == EFileViewModeSimple)
-                {
-                    const QString SimpleDriveEntry("%1: <%2>");
-                    listItem /*<< driveEntry.IconId() */
-                            << SimpleDriveEntry.arg(driveEntry.driveLetter())
-                                               .arg(driveEntry.mediaTypeString());
-                } else if (mEngineWrapper->settings().fileViewMode() == EFileViewModeExtended) {
-                    const QString SimpleDriveEntry("%1: <%2>");
-                    const QString ExtendedDriveEntry("%1/%2 kB");
-                    listItem /*<< driveEntry.IconId()*/
-                            << SimpleDriveEntry.arg(driveEntry.driveLetter())
-                                               .arg(driveEntry.mediaTypeString())
-                            << ExtendedDriveEntry.arg(QString::number(driveEntry.volumeInfoFree()/1024))
-                                                 .arg(QString::number(driveEntry.volumeInfoSize()/1024));
-
-                }
-            } else {
-                FileEntry fileEntry(mEngineWrapper->getFileEntry(index));
-                if (mEngineWrapper->settings().fileViewMode() == EFileViewModeSimple)
-                {
-                    listItem /*<< fileEntry.IconId()*/
-                            << fileEntry.name();
-                } else if (mEngineWrapper->settings().fileViewMode() == EFileViewModeExtended) {
-                    QString extraData;
-                    extraData.append(fileEntry.modifiedString());
-                    if (fileEntry.isDir() && fileEntry.dirEntries() >= 0) {
-                        extraData.append(" - ");
-                        extraData.append(fileEntry.dirEntriesString());
-                    } else if (!fileEntry.isDir()) {
-                        extraData.append(" - ");
-                        extraData.append(fileEntry.sizeString());
-                    }
-                    listItem /*<< fileEntry.IconId()*/
-                            << fileEntry.name() << extraData << fileEntry.attributesString();
-                }
-            }
-            return listItem;
-        }
-    case Qt::DecorationRole: {
-            if (mEngineWrapper) {
-                QIcon icon;
-                if (mEngineWrapper->isDriveListViewActive()) {
-                    icon = mFileIconProvider->icon(QFileIconProvider::Drive);
-                } else {
-                    FileEntry fileEntry(mEngineWrapper->getFileEntry(index));
-                    if (fileEntry.isDir()) {
-                        icon = mFileIconProvider->icon(QFileIconProvider::Folder);
-                    } else {
-                        icon = mFileIconProvider->icon(QFileIconProvider::File);
-                    }
-                }
-                return QVariant(icon);
-            }
-        }
-    }
-
-    return QVariant();
-}
-
-/**
-  \reimp
-  */
-QVariant FileBrowserModel::headerData(int section, Qt::Orientation orientation, int role) const
-{
-    Q_UNUSED(section)
-    Q_UNUSED(orientation)
-    Q_UNUSED(role)
-
-    // TODO, implement or remove
-    return QVariant();
-}
-
-// ---------------------------------------------------------------------------
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/filebrowser/ui/src/filebrowsersortfilterproxymodel.cpp	Thu Jul 22 16:33:59 2010 +0100
@@ -0,0 +1,62 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#include "filebrowsersortfilterproxymodel.h"
+
+#include <QString>
+#include <QStringList>
+
+FileBrowserSortFilterProxyModel::FileBrowserSortFilterProxyModel(QObject *parent)
+    : QSortFilterProxyModel(parent)
+{
+}
+
+bool FileBrowserSortFilterProxyModel::filterAcceptsRow(int sourceRow,
+                                                       const QModelIndex &sourceParent) const
+{
+    QModelIndex index = sourceModel()->index(sourceRow, 0, sourceParent);
+
+    QVariant displayRole = index.data(Qt::DisplayRole);
+    QStringList stringList;
+    if (displayRole.isValid()) {
+        if (displayRole.canConvert<QString>()) {
+            stringList.append(displayRole.toString());
+        } else if (displayRole.canConvert<QStringList>()) {
+            stringList = displayRole.toStringList();
+        }
+        QString itemName = stringList.at(0);
+        //QString criteria = filterRegExp().pattern();
+        QString criteria = filterCriteria();
+        if (!criteria.isEmpty()) {
+            bool contains = itemName.contains(criteria, Qt::CaseInsensitive);
+            return contains;
+        } else {
+            //invalidateFilter();
+            return true;
+        }
+    }
+    return true;
+}
+
+void FileBrowserSortFilterProxyModel::setFilterCriteria(const QString &criteria)
+{
+    mFilterCriteria = criteria;
+    invalidate();
+}
+
+
+// End of File
--- a/filebrowser/ui/src/filebrowserview.cpp	Fri Jun 11 16:29:34 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1976 +0,0 @@
-/*
-* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-#include "filebrowserview.h"
-#include "filebrowsermainwindow.h"
-#include "settingsview.h"
-#include "editorview.h"
-#include "searchview.h"
-#include "enginewrapper.h"
-#include "notifications.h"
-
-#include "filebrowsermodel.h"
-
-#include <HbMainWindow>
-#include <HbMenu>
-#include <HbPopup>
-#include <HbView>
-#include <HbMessageBox>
-#include <HbAction>
-#include <HbLabel>
-#include <HbListView>
-#include <HbListViewItem>
-#include <HbListWidget>
-#include <HbLineEdit>
-#include <HbAbstractViewItem>
-#include <HbSelectionDialog>
-#include <HbValidator>
-#include <HbInputDialog>
-#include <HbToolBar>
-
-#include <QString>
-#include <QGraphicsLinearLayout>
-#include <QItemSelection>
-#include <QDebug>
-//TODO check if needed to do this way
-#include <FB.hrh>
-
-//const int DRIVEPATHLENGTH = 4;
-const QString okActionText("OK");
-const QString cancelActionText("Cancel");
-
-// ---------------------------------------------------------------------------
-
-FileBrowserView::FileBrowserView(FileBrowserMainWindow &mainWindow)
-    : mMainWindow(mainWindow),
-    mEngineWrapper(0),
-    mListView(0),
-    mToolBar(0),
-    mNaviPane(0),
-    mMainLayout(0),
-    mDirectory(),
-    mSelectedFilePath(),
-    mFileBrowserModel(0),
-    mFileViewMenuActions(),
-    mToolbarBackAction(0),
-    mSearch(0),
-    mSettingsView(0),
-    mItemHighlighted(false),
-    mLocationChanged(false),
-    mRemoveFileAfterCopied(false),
-    mClipBoardInUse(false),
-    mFolderContentChanged(false),
-    mOldPassword(),
-    mPanicCategory(),
-    mAbsoluteFilePath(),
-    mOverwriteOptions(),
-    mIsRenameAllowed(true),
-    mProceed(false),
-    mEraseMBR(false)
-{
-    setTitle("File Browser");
-
-    createMenu();
-    createToolBar();
-}
-
-// ---------------------------------------------------------------------------	
-
-void FileBrowserView::init(EngineWrapper *engineWrapper)
-{
-    mEngineWrapper = engineWrapper;
-
-    mListView = new HbListView(this);
-    mFileBrowserModel = new FileBrowserModel(mEngineWrapper);
-    if (!mListView->model()) {
-        mListView->setModel(mFileBrowserModel);
-        mListView->listItemPrototype()->setStretchingStyle(HbListViewItem::StretchLandscape);
-        mEngineWrapper->refreshView();
-        mToolbarBackAction->setEnabled(!mEngineWrapper->isDriveListViewActive());
-    }
-
-    //mListView->setRootIndex(mFileSystemModel->index(startPath));
-    //mListView->setRootIndex(model->index());
-
-    mListView->setScrollingStyle(HbScrollArea::PanWithFollowOn);
-    //mListView->setHighlightMode(HbItemHighlight::HighlightAlwaysVisible);
-
-    connect(mListView, SIGNAL(activated(QModelIndex)), this, SLOT(activated(QModelIndex)));
-
-    mNaviPane = new HbLabel(this);
-    mNaviPane->setPlainText(QString(" ")); // TODO get from settings or default
-    //mNaviPane->setPlainText(QString(mEngineWrapper->currentPath()));
-    HbFontSpec fontSpec(HbFontSpec::PrimarySmall);
-    mNaviPane->setFontSpec(fontSpec);
-
-    // Create layout and add list view and toolbar into layout:
-    mMainLayout = new QGraphicsLinearLayout(Qt::Vertical);
-    mMainLayout->addItem(mNaviPane);
-    mMainLayout->addItem(mListView);
-    //mMainLayout->addItem(mToolBar);
-    setLayout(mMainLayout);
-}
-
-// ---------------------------------------------------------------------------
-
-FileBrowserView::~FileBrowserView()
-{  
-//    if (mSearch !=0) {
-//        delete mSearch;
-//    }
-//    if (mSettingsView != 0) {
-//        delete mSettingsView;
-//    }
-//    if (mEngineWrapper) {
-//        delete mEngineWrapper;
-//    }
-    delete mFileBrowserModel;
-    delete mListView;
-    delete mToolBar;
-}
-
-/**
-  Create a file browser tool bar
-  */
-void FileBrowserView::createToolBar()
-{
-    mToolBar = new HbToolBar(this);
-
-    mToolbarBackAction = new HbAction(/*"Back"*/);
-    mToolbarBackAction->setToolTip("Back");
-    mToolbarBackAction->setIcon(HbIcon(QString(":/qgn_indi_tb_filebrowser_folder_parent.svg")));
-    connect(mToolbarBackAction, SIGNAL(triggered()), this, SLOT(fileBackMoveUp()));
-    mToolBar->addAction(mToolbarBackAction);
-
-    if (mFileViewMenuActions.mSelection) {
-        mToolBar->addAction(mFileViewMenuActions.mSelection);
-    }
-
-    setToolBar(mToolBar);
-}
-
-/**
-  Initial setup for options menu.
-  Dynamic menu update during the runtime is performed by updateMenu() which
-  to menu's aboutToShow() signal.
-  */
-void FileBrowserView::createMenu()
-{
-    createFileMenu();
-    createEditMenu();
-    createViewMenu();
-    createDiskAdminMenu();
-    createToolsMenu();
-
-    createSelectionMenuItem();
-    createSettingsMenuItem();
-    createAboutMenuItem();
-    createExitMenuItem();
-
-    // menu dynamic update
-    connect(menu(), SIGNAL(aboutToShow()), this, SLOT(updateMenu()));
-}
-
-/**
-  Initial setup for File submenu
-  */
-void FileBrowserView::createFileMenu()
-{
-    mFileViewMenuActions.mFileMenu = menu()->addMenu("File");
-
-    mFileViewMenuActions.mFileBackMoveUp = mFileViewMenuActions.mFileMenu->addAction("Back/Move up (<-)", this, SLOT(fileBackMoveUp()));
-    mFileViewMenuActions.mFileOpenDrive = mFileViewMenuActions.mFileMenu->addAction("Open drive (->)", this, SLOT(fileOpenDrive()));
-    mFileViewMenuActions.mFileOpenDirectory = mFileViewMenuActions.mFileMenu->addAction("Open directory (->)", this, SLOT(fileOpenDirectory()));
-    mFileViewMenuActions.mFileSearch = mFileViewMenuActions.mFileMenu->addAction("Search", this, SLOT(fileSearch()));
-    mFileViewMenuActions.mFileSearch->setVisible(false);
-
-    mFileViewMenuActions.mFileNewMenu = mFileViewMenuActions.mFileMenu->addMenu("New");
-    mFileViewMenuActions.mFileNewFile = mFileViewMenuActions.mFileNewMenu->addAction("File", this, SLOT(fileNewFile()));
-    mFileViewMenuActions.mFileNewDirectory = mFileViewMenuActions.mFileNewMenu->addAction("Directory", this, SLOT(fileNewDirectory()));
-
-    mFileViewMenuActions.mFileDelete = mFileViewMenuActions.mFileMenu->addAction("Delete", this, SLOT(fileDelete()));
-    mFileViewMenuActions.mFileRename = mFileViewMenuActions.mFileMenu->addAction("Rename", this, SLOT(fileRename()));
-    mFileViewMenuActions.mFileTouch = mFileViewMenuActions.mFileMenu->addAction("Touch", this, SLOT(fileTouch()));
-    mFileViewMenuActions.mFileProperties = mFileViewMenuActions.mFileMenu->addAction("Properties", this, SLOT(fileProperties()));
-
-    mFileViewMenuActions.mFileChecksumsMenu = mFileViewMenuActions.mFileMenu->addMenu("Checksums");
-    mFileViewMenuActions.mFileChecksumsMD5 = mFileViewMenuActions.mFileChecksumsMenu->addAction("MD5", this, SLOT(fileChecksumsMD5()));
-    mFileViewMenuActions.mFileChecksumsMD2 = mFileViewMenuActions.mFileChecksumsMenu->addAction("MD2", this, SLOT(fileChecksumsMD2()));
-    mFileViewMenuActions.mFileChecksumsSHA1 = mFileViewMenuActions.mFileChecksumsMenu->addAction("SHA-1", this, SLOT(fileChecksumsSHA1()));
-
-    mFileViewMenuActions.mFileSetAttributes = mFileViewMenuActions.mFileMenu->addAction("Set attributes...", this, SLOT(fileSetAttributes()));
-    mFileViewMenuActions.mFileSetAttributes->setVisible(false);
-}
-
-/**
-  Initial setup for Edit submenu
-  */
-void FileBrowserView::createEditMenu()
-{
-    mFileViewMenuActions.mEditMenu = menu()->addMenu("Edit");
-
-    mFileViewMenuActions.mEditSnapShotToE = mFileViewMenuActions.mEditMenu->addAction("Snap shot to E:", this, SLOT(editSnapShotToE()));
-    mFileViewMenuActions.mEditSnapShotToE->setVisible(false);
-    mFileViewMenuActions.mEditCut = mFileViewMenuActions.mEditMenu->addAction("Cut", this, SLOT(editCut()));
-    mFileViewMenuActions.mEditCopy = mFileViewMenuActions.mEditMenu->addAction("Copy", this, SLOT(editCopy()));
-    mFileViewMenuActions.mEditPaste = mFileViewMenuActions.mEditMenu->addAction("Paste", this, SLOT(editPaste()));
-
-    mFileViewMenuActions.mEditCopyToFolder = mFileViewMenuActions.mEditMenu->addAction("Copy to folder...", this, SLOT(editCopyToFolder()));
-    mFileViewMenuActions.mEditMoveToFolder = mFileViewMenuActions.mEditMenu->addAction("Move to folder...", this, SLOT(editMoveToFolder()));
-
-    mFileViewMenuActions.mEditSelect = mFileViewMenuActions.mEditMenu->addAction("Select", this, SLOT(editSelect()));
-    mFileViewMenuActions.mEditUnselect = mFileViewMenuActions.mEditMenu->addAction("Unselect", this, SLOT(editUnselect()));
-    mFileViewMenuActions.mEditSelectAll = mFileViewMenuActions.mEditMenu->addAction("Select all", this, SLOT(editSelectAll()));
-    mFileViewMenuActions.mEditUnselectAll = mFileViewMenuActions.mEditMenu->addAction("Unselect all", this, SLOT(editUnselectAll()));
-}
-
-/**
-  Initial setup for View submenu
-  */
-void FileBrowserView::createViewMenu()
-{
-    mFileViewMenuActions.mViewMenu = menu()->addMenu("View");
-    mFileViewMenuActions.mViewMenu->menuAction()->setVisible(false);
-
-    mFileViewMenuActions.mViewFilterEntries = mFileViewMenuActions.mViewMenu->addAction("Filter entries", this, SLOT(viewFilterEntries()));
-    mFileViewMenuActions.mViewRefresh = mFileViewMenuActions.mViewMenu->addAction("Refresh", this, SLOT(viewRefresh()));
-}
-
-/**
-  Initial setup for Disk Admin submenu
-  */
-void FileBrowserView::createDiskAdminMenu()
-{
-    mFileViewMenuActions.mDiskAdminMenu = menu()->addMenu("Disk admin");
-    mFileViewMenuActions.mDiskAdminMenu->menuAction()->setVisible(false);
-
-    mFileViewMenuActions.mDiskAdminSetDrivePassword = mFileViewMenuActions.mDiskAdminMenu->addAction("Set drive password", this, SLOT(diskAdminSetDrivePassword()));
-    mFileViewMenuActions.mDiskAdminUnlockDrive = mFileViewMenuActions.mDiskAdminMenu->addAction("Unlock drive", this, SLOT(diskAdminUnlockDrive()));
-    mFileViewMenuActions.mDiskAdminClearDrivePassword = mFileViewMenuActions.mDiskAdminMenu->addAction("Clear drive password", this, SLOT(diskAdminClearDrivePassword()));
-    mFileViewMenuActions.mDiskAdminEraseDrivePassword = mFileViewMenuActions.mDiskAdminMenu->addAction("Erase drive password", this, SLOT(diskAdminEraseDrivePassword()));
-    mFileViewMenuActions.mDiskAdminFormatDrive = mFileViewMenuActions.mDiskAdminMenu->addAction("Format drive", this, SLOT(diskAdminFormatDrive()));
-    mFileViewMenuActions.mDiskAdminQuickFormatDrive = mFileViewMenuActions.mDiskAdminMenu->addAction("Quick format drive", this, SLOT(diskAdminQuickFormatDrive()));
-    mFileViewMenuActions.mDiskAdminCheckDisk = mFileViewMenuActions.mDiskAdminMenu->addAction("Check disk", this, SLOT(diskAdminCheckDisk()));
-    mFileViewMenuActions.mDiskAdminScanDrive = mFileViewMenuActions.mDiskAdminMenu->addAction("Scan drive", this, SLOT(diskAdminScanDrive()));
-    mFileViewMenuActions.mDiskAdminSetDriveName = mFileViewMenuActions.mDiskAdminMenu->addAction("Set drive name", this, SLOT(diskAdminSetDriveName()));
-    mFileViewMenuActions.mDiskAdminSetDriveVolumeLabel = mFileViewMenuActions.mDiskAdminMenu->addAction("Set drive volume label", this, SLOT(diskAdminSetDriveVolumeLabel()));
-    mFileViewMenuActions.mDiskAdminEjectDrive = mFileViewMenuActions.mDiskAdminMenu->addAction("Eject drive", this, SLOT(diskAdminEjectDrive()));
-    mFileViewMenuActions.mDiskAdminDismountDrive = mFileViewMenuActions.mDiskAdminMenu->addAction("Dismount drive", this, SLOT(diskAdminDismountDrive()));
-    mFileViewMenuActions.mDiskAdminEraseMBR = mFileViewMenuActions.mDiskAdminMenu->addAction("Erase MBR", this, SLOT(diskAdminEraseMBR()));
-    mFileViewMenuActions.mDiskAdminPartitionDrive = mFileViewMenuActions.mDiskAdminMenu->addAction("Partition drive", this, SLOT(diskAdminPartitionDrive()));
-}
-
-/**
-  Initial setup for Tools submenu
-  */
-void FileBrowserView::createToolsMenu()
-{
-    mFileViewMenuActions.mToolsMenu = menu()->addMenu("Tools");
-
-    mFileViewMenuActions.mToolsAllAppsToTextFile = mFileViewMenuActions.mToolsMenu->addAction("All apps to a text file", this, SLOT(toolsAllAppsToTextFile()));
-    mFileViewMenuActions.mToolsAllAppsToTextFile->setVisible(false);
-    mFileViewMenuActions.mToolsAllFilesToTextFile = mFileViewMenuActions.mToolsMenu->addAction("All files to a text file", this, SLOT(toolsAllFilesToTextFile()));
-    mFileViewMenuActions.mToolsAllFilesToTextFile->setVisible(false);
-
-    mFileViewMenuActions.mToolsAvkonIconCacheMenu = mFileViewMenuActions.mToolsMenu->addMenu("Avkon icon cache");
-    mFileViewMenuActions.mToolsAvkonIconCacheMenu->menuAction()->setVisible(false);
-    mFileViewMenuActions.mToolsAvkonIconCacheEnable = mFileViewMenuActions.mToolsAvkonIconCacheMenu->addAction("Enable", this, SLOT(toolsAvkonIconCacheEnable()));
-    mFileViewMenuActions.mToolsAvkonIconCacheDisable = mFileViewMenuActions.mToolsAvkonIconCacheMenu->addAction("Clear and disable", this, SLOT(toolsAvkonIconCacheDisable()));
-
-    mFileViewMenuActions.mToolsDisableExtendedErrors = mFileViewMenuActions.mToolsMenu->addAction("Disable extended errors", this, SLOT(toolsDisableExtendedErrors()));
-    mFileViewMenuActions.mToolsDumpMsgStoreWalk = mFileViewMenuActions.mToolsMenu->addAction("Dump msg. store walk", this, SLOT(toolsDumpMsgStoreWalk()));
-    mFileViewMenuActions.mToolsDumpMsgStoreWalk->setVisible(false);
-    mFileViewMenuActions.mToolsEditDataTypes = mFileViewMenuActions.mToolsMenu->addAction("Edit data types", this, SLOT(toolsEditDataTypes()));
-    mFileViewMenuActions.mToolsEditDataTypes->setVisible(false);
-    mFileViewMenuActions.mToolsEnableExtendedErrors = mFileViewMenuActions.mToolsMenu->addAction("Enable extended errors", this, SLOT(toolsEnableExtendedErrors()));
-
-    mFileViewMenuActions.mToolsErrorSimulateMenu = mFileViewMenuActions.mToolsMenu->addMenu("Error simulate");
-    mFileViewMenuActions.mToolsErrorSimulateLeave = mFileViewMenuActions.mToolsErrorSimulateMenu->addAction("Leave", this, SLOT(toolsErrorSimulateLeave()));
-    mFileViewMenuActions.mToolsErrorSimulatePanic = mFileViewMenuActions.mToolsErrorSimulateMenu->addAction("Panic", this, SLOT(toolsErrorSimulatePanic()));
-    mFileViewMenuActions.mToolsErrorSimulatePanic->setVisible(false);
-    mFileViewMenuActions.mToolsErrorSimulateException = mFileViewMenuActions.mToolsErrorSimulateMenu->addAction("Exception", this, SLOT(toolsErrorSimulateException()));
-
-//    mFileViewMenuActions.mLocalConnectivityMenu = mFileViewMenuActions.mToolsMenu->addMenu("Local connectivity");
-//    mFileViewMenuActions.mToolsLocalConnectivityActivateInfrared = mFileViewMenuActions.mLocalConnectivityMenu->addAction("Activate infrared", this, SLOT(toolsLocalConnectivityActivateInfrared()));
-//    mFileViewMenuActions.mToolsLocalConnectivityLaunchBTUI = mFileViewMenuActions.mLocalConnectivityMenu->addAction("Launch BT UI", this, SLOT(toolsLocalConnectivityLaunchBTUI()));
-//    mFileViewMenuActions.mToolsLocalConnectivityLaunchUSBUI = mFileViewMenuActions.mLocalConnectivityMenu->addAction("Launch USB UI", this, SLOT(toolsLocalConnectivityLaunchUSBUI()));
-
-    mFileViewMenuActions.mToolsMessageAttachmentsMenu = mFileViewMenuActions.mToolsMenu->addMenu("Message attachments");
-    mFileViewMenuActions.mToolsMessageAttachmentsMenu->menuAction()->setVisible(false);
-    mFileViewMenuActions.mToolsMessageInbox = mFileViewMenuActions.mToolsMessageAttachmentsMenu->addAction("Inbox", this, SLOT(toolsMessageInbox()));
-    mFileViewMenuActions.mToolsMessageDrafts = mFileViewMenuActions.mToolsMessageAttachmentsMenu->addAction("Drafts", this, SLOT(toolsMessageDrafts()));
-    mFileViewMenuActions.mToolsMessageSentItems = mFileViewMenuActions.mToolsMessageAttachmentsMenu->addAction("Sent items", this, SLOT(toolsMessageSentItems()));
-    mFileViewMenuActions.mToolsMessageOutbox = mFileViewMenuActions.mToolsMessageAttachmentsMenu->addAction("Outbox", this, SLOT(toolsMessageOutbox()));
-
-    mFileViewMenuActions.mToolsMemoryInfo = mFileViewMenuActions.mToolsMenu->addAction("Memory info", this, SLOT(toolsMemoryInfo()));
-    mFileViewMenuActions.mToolsMemoryInfo->setVisible(false);
-
-    mFileViewMenuActions.mToolsSecureBackupMenu = mFileViewMenuActions.mToolsMenu->addMenu("Secure backup");
-    mFileViewMenuActions.mToolsSecureBackupMenu->menuAction()->setVisible(false);
-    mFileViewMenuActions.mToolsSecureBackStart = mFileViewMenuActions.mToolsSecureBackupMenu->addAction("Start backup", this, SLOT(toolsSecureBackStart()));
-    mFileViewMenuActions.mToolsSecureBackRestore = mFileViewMenuActions.mToolsSecureBackupMenu->addAction("Start restore", this, SLOT(toolsSecureBackRestore()));
-    mFileViewMenuActions.mToolsSecureBackStop = mFileViewMenuActions.mToolsSecureBackupMenu->addAction("Stop", this, SLOT(toolsSecureBackStop()));
-
-    mFileViewMenuActions.mToolsSetDebugMask = mFileViewMenuActions.mToolsMenu->addAction("Set debug mask", this, SLOT(toolsSetDebugMaskQuestion()));
-    mFileViewMenuActions.mToolsShowOpenFilesHere = mFileViewMenuActions.mToolsMenu->addAction("Show open files here", this, SLOT(toolsShowOpenFilesHere()));
-    mFileViewMenuActions.mToolsShowOpenFilesHere->setVisible(false);
-}
-
-/**
-  Creates Selection mode menu item in option menu
-  */
-void FileBrowserView::createSelectionMenuItem()
-{
-    if (!mFileViewMenuActions.mSelection) {
-        mFileViewMenuActions.mSelection = menu()->addAction("Selection mode");
-        mFileViewMenuActions.mSelection->setToolTip("Selection mode");
-        mFileViewMenuActions.mSelection->setCheckable(true);
-        connect(mFileViewMenuActions.mSelection, SIGNAL(triggered()), this, SLOT(selectionModeChanged()));
-    }
-}
-
-/**
-  Creates Setting menu item in option menu
-  */
-void FileBrowserView::createSettingsMenuItem()
-{
-    mFileViewMenuActions.mSetting = menu()->addAction("Settings");
-    connect(mFileViewMenuActions.mSetting, SIGNAL(triggered()), this, SIGNAL(aboutToShowSettingsView()));
-}
-
-
-/**
-  Creates About menu item in option menu
-  */
-void FileBrowserView::createAboutMenuItem()
-{
-    // about note
-    mFileViewMenuActions.mAbout = menu()->addAction("About");
-    connect(mFileViewMenuActions.mAbout, SIGNAL(triggered()), this, SLOT(about()));
-}
-
-/**
-  Creates Exit menu item in option menu
-  */
-void FileBrowserView::createExitMenuItem()
-{
-    // application exit
-    mFileViewMenuActions.mExit = menu()->addAction("Exit");
-    connect(mFileViewMenuActions.mExit, SIGNAL(triggered()), qApp, SLOT(quit()));
-}
-
-/**
-  update menu: disk admin available only in device root view. edit available only in folder view
-  when file or folder content exist in current folder, or clipboard has copied item.
-  file and view menus updated every time regarding the folder content.
-  tools, settings, about, exit always available.
-  If there's remove and add operations at same time, always remove first
-  to keep to the correct menu items order.
-  */
-void FileBrowserView::updateMenu()
-{
-    bool emptyListBox = mFileBrowserModel->rowCount() == 0;           //iContainer->ListBoxNumberOfVisibleItems() == 0;
-    bool driveListActive = mEngineWrapper->isDriveListViewActive(); //iModel->FileUtils()->IsDriveListViewActive();
-    bool normalModeActive = true;       //iModel->FileUtils()->IsNormalModeActive();
-    bool currentDriveReadOnly = mEngineWrapper->isCurrentDriveReadOnly();   //iModel->FileUtils()->IsCurrentDriveReadOnly();
-    bool currentItemDirectory = mEngineWrapper->getFileEntry(currentItemIndex()).isDir();   //iModel->FileUtils()->IsCurrentItemDirectory();
-    bool listBoxSelections = mListView->selectionModel()->selection().count() == 0;      //iContainer->ListBoxSelectionIndexesCount() == 0;
-    bool emptyClipBoard = !mEngineWrapper->isClipBoardListInUse();
-    bool showSnapShot = false;           //iModel->FileUtils()->DriveSnapShotPossible();
-
-    bool showEditMenu(true);
-    if (driveListActive) {
-        if (!showSnapShot || emptyListBox && emptyClipBoard)
-            showEditMenu = false;
-        else
-            showEditMenu = true;
-    } else {
-        if (emptyListBox && emptyClipBoard)
-            showEditMenu = false;
-        else
-            showEditMenu = true;
-    }
-
-    mFileViewMenuActions.mEditMenu->menuAction()->setVisible(showEditMenu);
-    // TODO mFileViewMenuActions.mDiskAdminMenu->menuAction()->setVisible(driveListActive);
-
-    mFileViewMenuActions.mFileBackMoveUp->setVisible( !driveListActive);
-
-    //aMenuPane->SetItemDimmed(EFileBrowserCmdFileOpen, emptyListBox || driveListActive || currentItemDirectory);
-    mFileViewMenuActions.mFileOpenDrive->setVisible( !(emptyListBox || !driveListActive));
-    mFileViewMenuActions.mFileOpenDirectory->setVisible( !(emptyListBox || driveListActive || !currentItemDirectory));
-
-    //aMenuPane->SetItemDimmed(EFileBrowserCmdFileView, emptyListBox || listBoxSelections || currentItemDirectory || driveListActive);
-    //aMenuPane->SetItemDimmed(EFileBrowserCmd FileEdit, emptyListBox || listBoxSelections || currentItemDirectory || driveListActive);
-    //aMenuPane->SetItemDimmed(EFileBrowserCmdFileSendTo, emptyListBox || driveListActive || currentItemDirectory);
-
-    mFileViewMenuActions.mFileNewMenu->menuAction()->setVisible(!(driveListActive || currentDriveReadOnly));
-    mFileViewMenuActions.mFileDelete->setVisible(!(emptyListBox || driveListActive || currentDriveReadOnly));
-    mFileViewMenuActions.mFileRename->setVisible(!(emptyListBox || driveListActive || currentDriveReadOnly || listBoxSelections));
-    mFileViewMenuActions.mFileTouch->setVisible(!(emptyListBox || driveListActive || currentDriveReadOnly));
-    mFileViewMenuActions.mFileProperties->setVisible(!(emptyListBox || listBoxSelections));
-    // TODO mFileViewMenuActions.mFileChecksums->setVisible(!(emptyListBox || listBoxSelections || currentItemDirectory || driveListActive));
-    // TODO mFileViewMenuActions.mFileSetAttributes->setVisible(!(emptyListBox || driveListActive || currentDriveReadOnly));
-    // TODO mFileViewMenuActions.mFileCompress->setVisible(!(currentDriveReadOnly || emptyListBox || listBoxSelections || currentItemDirectory || driveListActive));
-    // TODO mFileViewMenuActions.mFileDecompress->setVisible(!(currentDriveReadOnly || emptyListBox || listBoxSelections || currentItemDirectory || driveListActive));
-
-    bool currentSelected = true;    //iContainer->ListBox()->View()->ItemIsSelected(iContainer->ListBox()->View()->CurrentItemIndex());
-    bool allSelected = mListView->selectionModel()->selection().count() == mFileBrowserModel->rowCount();        //iContainer->ListBox()->SelectionIndexes()->Count() == iContainer->ListBox()->Model()->NumberOfItems();
-    bool noneSelected = mListView->selectionModel()->selection().count() != 0;       //iContainer->ListBox()->SelectionIndexes()->Count() == 0;
-
-    //mFileViewMenuActions.mEditSnapShotToE->setVisible(driveListActive); // TODO
-    mFileViewMenuActions.mEditCut->setVisible(!(driveListActive || currentDriveReadOnly || emptyListBox));
-    mFileViewMenuActions.mEditCopy->setVisible(!(driveListActive || emptyListBox));
-    mFileViewMenuActions.mEditPaste->setVisible(!(driveListActive || emptyClipBoard || currentDriveReadOnly));
-    mFileViewMenuActions.mEditCopyToFolder->setVisible(!(driveListActive || emptyListBox));
-    mFileViewMenuActions.mEditMoveToFolder->setVisible(!(driveListActive || currentDriveReadOnly || emptyListBox));
-    mFileViewMenuActions.mEditSelect->setVisible(!(driveListActive || currentSelected || emptyListBox));
-    mFileViewMenuActions.mEditUnselect->setVisible(!(driveListActive || !currentSelected || emptyListBox));
-    mFileViewMenuActions.mEditSelectAll->setVisible(!(driveListActive || allSelected || emptyListBox));
-    mFileViewMenuActions.mEditUnselectAll->setVisible(!(driveListActive || noneSelected || emptyListBox));
-
-    // TODO mFileViewMenuActions.mViewSort->setVisible(!(!normalModeActive || driveListActive || emptyListBox));
-    // TODO mFileViewMenuActions.mViewOrder->setVisible(!(!normalModeActive || driveListActive || emptyListBox));
-    mFileViewMenuActions.mViewRefresh->setVisible(normalModeActive);
-    mFileViewMenuActions.mViewFilterEntries->setVisible(!emptyListBox);
-
-    // TODO R_FILEBROWSER_VIEW_SORT_SUBMENU
-    // aMenuPane->SetItemButtonState(iModel->FileUtils()->SortMode(), EEikMenuItemSymbolOn);
-
-    // TODO R_FILEBROWSER_VIEW_ORDER_SUBMENU
-    // aMenuPane->SetItemButtonState(iModel->FileUtils()->OrderMode(), EEikMenuItemSymbolOn);
-
-    // aResourceId == R_FILEBROWSER_TOOLS_SUBMENU
-    bool noExtendedErrorsAllowed = mEngineWrapper->ErrRdFileExists();
-    mFileViewMenuActions.mToolsDisableExtendedErrors->setVisible(noExtendedErrorsAllowed);
-    mFileViewMenuActions.mToolsEnableExtendedErrors->setVisible(!noExtendedErrorsAllowed);
-
-//    bool infraRedAllowed = mEngineWrapper->FileExists(KIRAppPath);
-//    bool bluetoothAllowed = mEngineWrapper->FileExists(KBTAppPath);
-//    bool usbAllowed = mEngineWrapper->FileExists(KUSBAppPath);
-//
-//    bool noLocalCon = !infraRedAllowed && !bluetoothAllowed && !usbAllowed;
-//    mFileViewMenuActions.mToolsLocalConnectivityMenu->menuAction()->setVisible(!noLocalCon);
-//
-//    mFileViewMenuActions.mToolsLocalConnectivityActivateInfrared->setVisible(infraRedAllowed);
-//    mFileViewMenuActions.mToolsLocalConnectivityLaunchBTUI->setVisible(bluetoothAllowed);
-//    mFileViewMenuActions.mToolsLocalConnectivityLaunchUSBUI->setVisible(usbAllowed);
-}
-
-/**
-  Refresh FileBrowser view
-  */
-void FileBrowserView::refreshList()
-{
-    mEngineWrapper->refreshView();
-    mNaviPane->setPlainText(QString(mEngineWrapper->currentPath()));
-    mListView->reset();
-    mListView->setModel(mFileBrowserModel);
-    mToolbarBackAction->setEnabled(!mEngineWrapper->isDriveListViewActive());
-}
-
-/**
-  Populate changed folder content, i.e. in practice navigation list items
-  */
-void FileBrowserView::populateFolderContent()
-{
-    // update the file browser by setting up the model with current directory as root path
-    if(mListView->model() == 0)  {
-        mFileBrowserModel = new FileBrowserModel(mEngineWrapper);
-        mListView->setModel(mFileBrowserModel);
-    }
-
-    refreshList();
-    //mFileSystemModel->setFilter(mFileSystemModel->filter() | QDir::System | QDir::Hidden);
-    //mFileSystemModel->setRootPath(directory);
-    //mListView->setRootIndex(mFileSystemModel->index(directory));
-}
-
-// ---------------------------------------------------------------------------	
-
-void FileBrowserView::fileOpen(HbAction *action)
-{  
-    HbSelectionDialog *dlg = static_cast<HbSelectionDialog*>(sender());
-    if(!action && dlg && dlg->selectedModelIndexes().count()){
-        int selectionIndex = dlg->selectedModelIndexes().at(0).row();
-
-        if (selectionIndex == 0) {
-            // open editor view
-            emit aboutToShowEditorView(mAbsoluteFilePath, true);
-        } else if (selectionIndex == 1) {
-            // AppArc
-            mEngineWrapper->openAppArc(mAbsoluteFilePath);
-        } else {
-            // DocHandler
-            mEngineWrapper->openDocHandler(mAbsoluteFilePath, true);
-        }
-    }
-}
-
-/**
-  Open overwrite dialog
-  */
-void FileBrowserView::fileOverwriteDialog()
-{
-    mOverwriteOptions = OverwriteOptions();
-    // open user-dialog to select: view as text/hex,  open w/AppArc or open w/DocH. embed
-    QStringList list;
-    list << QString("Overwrite all")
-            << QString("Skip all existing")
-            << QString("Gen. unique filenames")
-            << QString("Query postfix");
-    openListDialog(list, QString("Overwrite?"), this, SLOT(fileOverwrite(HbAction *)));
-}
-
-/**
-  File overwrite
-  */
-void FileBrowserView::fileOverwrite(HbAction *action)
-{
-    HbSelectionDialog *dlg = static_cast<HbSelectionDialog*>(sender());
-    if(!action && dlg && dlg->selectedModelIndexes().count()) {
-        mOverwriteOptions.queryIndex = dlg->selectedModelIndexes().at(0).row();
-        if (mOverwriteOptions.queryIndex == EFileActionQueryPostFix) {
-            QString heading = QString("Postfix");
-            HbInputDialog::getText(heading, this, SLOT(fileOverwritePostfix(HbAction *)), QString(), scene());
-        } else if (mOverwriteOptions.queryIndex == EFileActionSkipAllExisting) {
-            mOverwriteOptions.overWriteFlags = 0;
-        }
-    } else {
-        mOverwriteOptions.doFileOperations = false;
-    }
-}
-
-/**
-  File overwrite postfix query dialog
-  */
-void FileBrowserView::fileOverwritePostfix(HbAction *action)
-{
-    HbInputDialog *dlg = static_cast<HbInputDialog*>(sender());
-    if (action == dlg->primaryAction()) {
-        mOverwriteOptions.postFix = dlg->value().toString();
-    } else {
-        mOverwriteOptions.doFileOperations = false;
-    }
-}
-
-// ---------------------------------------------------------------------------
-/**
-  Show a list dialog
-  \param List aList of item to select item from.
-  \param Title text aTitleText of a dialog heading widget
-  \return None
-  */
-void FileBrowserView::openListDialog(const QStringList& items, const QString &aTitleText, QObject* receiver, const char* member)
-{
-    // Create a list and some simple content for it
-    HbSelectionDialog *dlg = new HbSelectionDialog();
-    dlg->setAttribute(Qt::WA_DeleteOnClose);
-    // Set items to be popup's content
-    dlg->setStringItems(items);
-    dlg->setSelectionMode(HbAbstractItemView::SingleSelection);
-    //dlg->setDismissPolicy(HbPopup::TapOutside);
-    
-    HbLabel *title = new HbLabel(dlg);
-    title->setPlainText(aTitleText);
-    dlg->setHeadingWidget(title);
-
-    // Launch popup and handle the user response:
-    dlg->open(receiver, member);
-}
-
-// ---------------------------------------------------------------------------
-
-HbDialog *FileBrowserView::filePathQuery(const QString &headingText,
-                                         const QString &text,
-                                         const QString &primaryActionText,
-                                         const QString &secondaryActionText)
-{
-    HbDialog *dialog = new HbDialog();
-    dialog->setDismissPolicy(HbPopup::TapOutside);
-    dialog->setTimeout(HbPopup::NoTimeout);
-    HbLineEdit *edit = new HbLineEdit();
-    HbAction *primaryAction = new HbAction(primaryActionText);
-    HbAction *secondaryAction = new HbAction(secondaryActionText);
-    // connect signal to close pop-up if cancel selected:
-    connect(secondaryAction, SIGNAL(triggered()), dialog, SLOT(close()));
-    edit->setText(text);
-    dialog->setHeadingWidget(new HbLabel(headingText));
-    //popup->setHeadingWidget(dlgTitle);
-    dialog->setContentWidget(edit);
-    dialog->setPrimaryAction(primaryAction);
-    dialog->setSecondaryAction(secondaryAction);
-
-    return dialog;
-}
-
-// ---------------------------------------------------------------------------
-
-//HbDialog *FileBrowserView::openTextQuery(const QString &headingText,
-//                                         const QString &text,
-//                                         const QString &primaryActionText,
-//                                         const QString &secondaryActionText)
-//{
-//    HbDialog *dialog = new HbDialog();
-//    dialog->setDismissPolicy(HbPopup::TapOutside);
-//    dialog->setTimeout(HbPopup::NoTimeout);
-//    HbLineEdit *edit = new HbLineEdit();
-//    HbAction *primaryAction = new HbAction(primaryActionText);
-//    HbAction *secondaryAction = new HbAction(secondaryActionText);
-//    // connect signal to close pop-up if cancel selected:
-//    connect(secondaryAction, SIGNAL(triggered()), dialog, SLOT(close()));
-//    edit->setText(text);
-//    dialog->setHeadingWidget(new HbLabel(headingText));
-//    //popup->setHeadingWidget(dlgTitle);
-//    dialog->setContentWidget(edit);
-//    dialog->setPrimaryAction(primaryAction);
-//    dialog->setSecondaryAction(secondaryAction);
-//
-//    return dialog;
-//}
-
-// ---------------------------------------------------------------------------
-
-HbDialog *FileBrowserView::openNumberQuery(const QString &headingText,
-                                           const QString &text,
-                                           const QString &primaryActionText,
-                                           const QString &secondaryActionText,
-                                           int aMin/* = -99999*/,
-                                           int aMax/* = 99999*/)
-{
-    HbDialog *dialog = new HbDialog();
-    dialog->setDismissPolicy(HbPopup::TapOutside);
-    dialog->setTimeout(HbPopup::NoTimeout);
-    HbAction *primaryAction = new HbAction(primaryActionText);
-    HbAction *secondaryAction = new HbAction(secondaryActionText);
-    // connect signal to close pop-up if cancel selected:
-    connect(secondaryAction, SIGNAL(triggered()), dialog, SLOT(close()));
-
-    HbLineEdit *edit = new HbLineEdit();
-    HbValidator *validator = new HbValidator();
-    validator->addField(new QIntValidator(aMin, aMax, 0), text);
-    edit->setValidator(validator);
-    edit->setInputMethodHints(Qt::ImhDigitsOnly);
-
-    //edit->setText(text);
-    dialog->setHeadingWidget(new HbLabel(headingText));
-    //popup->setHeadingWidget(dlgTitle);
-    dialog->setContentWidget(edit);
-    dialog->setPrimaryAction(primaryAction);
-    dialog->setSecondaryAction(secondaryAction);
-
-    return dialog;
-}
-
-// ---------------------------------------------------------------------------
-
-void FileBrowserView::openPropertyDialog(const QStringList& propertyList, const QString& title)
-{
-    HbDialog *dialog = new HbDialog();
-    dialog->setDismissPolicy(HbPopup::TapOutside);
-    dialog->setTimeout(HbPopup::NoTimeout);
-
-    HbLabel *titleWidget = new HbLabel();
-    titleWidget->setPlainText(title);
-    dialog->setHeadingWidget(titleWidget);
-
-    // Create a list and some simple content for it
-    HbListWidget *list = new HbListWidget();
-    QString str;
-    foreach (str, propertyList) {
-        list->addItem(str);
-    }
-
-    // Connect list item activation signal to close the popup
-    connect(list, SIGNAL(activated(HbListWidgetItem*)), dialog, SLOT(close()));
-
-    HbAction *cancelAction = new HbAction("Close");
-    dialog->setPrimaryAction(cancelAction);
-
-    // Set listwidget to be popup's content
-    dialog->setContentWidget(list);
-    // Launch popup and handle the user response:
-    dialog->open();
-}
-
-QModelIndexList FileBrowserView::getSelectedItemsOrCurrentItem()
-{
-    QModelIndexList modelIndexList;
-    QItemSelectionModel *selectionIndexes = mListView->selectionModel();
-
-    // by default use selected items
-    if (selectionIndexes) {
-        if (selectionIndexes->hasSelection()) {
-            modelIndexList = mListView->selectionModel()->selectedIndexes();
-        } else { // or if none selected, use the current item index
-            QModelIndex currentIndex = currentItemIndex();
-//            if (mFileBrowserModel->rowCount(currentItemIndex) > currentItemIndex && currentItemIndex >= 0)
-//            {
-                modelIndexList.append(currentIndex);
-//            }
-        }
-    }
-    mClipBoardInUse = true;
-    return modelIndexList;
-}
-
-// ---------------------------------------------------------------------------
-
-QModelIndex FileBrowserView::currentItemIndex()
-{
-    return mListView->selectionModel()->currentIndex();
-}
-
-// ---------------------------------------------------------------------------
-// operations in File Menu
-// ---------------------------------------------------------------------------
-
-/**
-  Move back/up in folder browsing history
-  */
-void FileBrowserView::fileBackMoveUp()
-{
-    mLocationChanged = true;
-//    if(mDirectory.length() < DRIVEPATHLENGTH) {
-//        // location in the root of any drive -> move back/up to root of device
-//        QModelIndex index = currentItemIndex();
-//        const QString filePath = mFileSystemModel->filePath(index);
-//        qDebug() << "handleBackButton filePath" << filePath;
-//        mDirectory = mInitDirPath.path();
-//        populateFolderContent(mDirectory);
-//    }
-//    else if(mDirectory != mInitDirPath.path()) {
-//        // location in any folder in any drive -> move back/up
-//        QDir dir(mDirectory);
-//        dir.cdUp();
-//        const QString currentPath = dir.absolutePath();
-//        mDirectory = currentPath;
-//        populateFolderContent(currentPath);
-//        mSelectedFilePath = "";
-//    } else {
-//        // location already in the device root, no way up.
-//        // do nothing.
-//    }
-    mEngineWrapper->moveUpOneLevel();
-    populateFolderContent();
-}
-
-void FileBrowserView::fileOpenDrive()
-{
-    // TODO make a separate function to be called from here and fileOpenDirectory()
-    mLocationChanged = true;
-    // get selected drive or directory from list view model and open it:
-    //if (mListView->selectionModel()->hasSelection()) {
-    if (mListView->selectionModel()->selection().count() != 0) {
-        QModelIndex currentIndex = currentItemIndex();
-        mEngineWrapper->moveDownToDirectory(currentIndex);
-        populateFolderContent();
-    } else {
-        Notifications::showErrorNote("not selected item!");
-    }
-}
-
-void FileBrowserView::fileOpenDirectory()
-{
-    mLocationChanged = true;
-    // get selected drive or directory from list view model and open it:
-    //if (mListView->selectionModel()->hasSelection()) {
-    if (mListView->selectionModel()->selection().count() != 0) {
-        QModelIndex currentIndex = currentItemIndex();
-        mEngineWrapper->moveDownToDirectory(currentIndex);
-        populateFolderContent();
-    } else {
-        Notifications::showErrorNote("not selected item!");
-    }
-}
-
-void FileBrowserView::fileSearch()
-{
-    // create and launch search:
-//    if(mSearch != 0){
-//        delete mSearch;
-//        mSearch = 0;
-//    }
-//    mSearch = new SearchView(*this, mMainWindow, *mEngineWrapper);
-//    QString searchPath;
-//    if (mDirectory != mInitDirPath.path()) {
-//        searchPath = mDirectory;
-//        searchPath.replace("/", "\\");
-//        searchPath+="\\";
-//    }
-//    mSearch->open(searchPath);
-}
-
-/**
-  Open new file dialog
-  */
-void FileBrowserView::fileNewFile()
-{
-    QString heading = QString("Enter filename");
-    HbInputDialog::getText(heading, this, SLOT(doFileNewFile(HbAction*)), QString(), scene());
-}
-
-/**
-  Create a new file in current directory with a name queried from user
-  */
-void FileBrowserView::doFileNewFile(HbAction *action)
-{
-    HbInputDialog *dlg = static_cast<HbInputDialog*>(sender());
-    if (action == dlg->primaryAction())
-    {
-        QString newFileName = dlg->value().toString();
-        mEngineWrapper->createNewFile(newFileName);
-        refreshList();
-    }
-}
-
-/**
-  Open new directory dialog
-  */
-void FileBrowserView::fileNewDirectory()
-{
-    QString heading = QString("Enter directory name");
-    HbInputDialog::getText(heading, this, SLOT(doFileNewDirectory(HbAction*)), QString(), scene());
-}
-
-/**
-  Create a new directory in current directory with a name queried from user
-  */
-void FileBrowserView::doFileNewDirectory(HbAction *action)
-{
-    HbInputDialog *dlg = static_cast<HbInputDialog*>(sender());
-    if (action == dlg->primaryAction())
-    {
-        QString newDirectoryName = dlg->value().toString();
-        mEngineWrapper->createNewDirectory(newDirectoryName);
-        refreshList();
-    }
-}
-
-/**
-  Question for Delete actually selected files
-  */
-void FileBrowserView::fileDelete()
-{
-    QModelIndexList currentSelection = getSelectedItemsOrCurrentItem();
-    const QString messageFormat = "Delete %1 entries?";
-    QString message = messageFormat.arg(currentSelection.count());
-    HbMessageBox::question(message, this, SLOT(doFileDelete(HbAction*)));
-}
-
-/**
-  Delete actually selected files
-  */
-void FileBrowserView::doFileDelete(HbAction* action)
-{
-    HbMessageBox *dlg = qobject_cast<HbMessageBox*>(sender());
-    if (action == dlg->primaryAction()) {
-        QModelIndexList currentSelection = getSelectedItemsOrCurrentItem();
-        mEngineWrapper->deleteItems(currentSelection);
-        refreshList();
-    }
-}
-
-/**
-  Open rename dialog for actually selected files
-  */
-void FileBrowserView::fileRename()
-{
-    QModelIndexList currentSelection = getSelectedItemsOrCurrentItem();
-    mEngineWrapper->setCurrentSelection(currentSelection);
-
-    for (int i(0), ie(currentSelection.count()); i < ie; ++i ) {
-        mModelIndex = currentSelection.at(i);
-        FileEntry entry = mEngineWrapper->getFileEntry(mModelIndex);
-
-        QString heading = QString("Enter new name");
-        HbInputDialog::getText(heading, this, SLOT(doFileRename(HbAction*)), entry.name(), scene());
-
-    }
-    mEngineWrapper->startExecutingCommands(QString("Renaming"));
-    refreshList();
-}
-
-/**
-  Rename actually selected files
-  */
-void FileBrowserView::doFileRename(HbAction *action)
-{
-    HbInputDialog *dlg = static_cast<HbInputDialog*>(sender());
-    if (action == dlg->primaryAction())
-    {
-        QString newName = dlg->value().toString();
-
-        if (mEngineWrapper->targetExists(mModelIndex, newName)) {
-
-            const QString messageTemplate = QString("%1 already exists, overwrite?");
-            QString message = messageTemplate.arg(newName);
-            HbMessageBox::question(message, this, SLOT(doFileRenameFileExist(HbAction *)));
-        }
-        if (mIsRenameAllowed) {
-            mEngineWrapper->rename(mModelIndex, newName);
-        }
-    }
-}
-
-/**
-  Rename actually selected files
-  */
-void FileBrowserView::doFileRenameFileExist(HbAction *action)
-{
-    HbMessageBox *dlg = qobject_cast<HbMessageBox*>(sender());
-    if (action == dlg->secondaryAction()) {
-        mIsRenameAllowed = false;
-    }
-}
-
-/**
-  Touch actually selected files
-  */
-void FileBrowserView::fileTouch()
-{
-    QModelIndexList currentSelection = getSelectedItemsOrCurrentItem();
-    mEngineWrapper->setCurrentSelection(currentSelection);
-
-    if (mEngineWrapper->selectionHasDirs()) {
-        const QString message = "Recurse touch for all selected dirs?";
-        HbMessageBox::question(message, this, SLOT(doFileTouch(HbAction*)));
-    }
-    else{
-        mEngineWrapper->touch(false);
-        refreshList();
-    }
-}
-
-/**
-  Touch actually selected files
-  */
-void FileBrowserView::doFileTouch(HbAction* action)
-{
-    bool recurse = false;
-    HbMessageBox *dlg = qobject_cast<HbMessageBox*>(sender());
-    if (action == dlg->primaryAction()) {
-        recurse = true;
-        }
-    mEngineWrapper->touch(recurse);
-    refreshList();
-}
-
-void FileBrowserView::fileChecksumsMD5()
-{
-    fileChecksums(EFileChecksumsMD5);
-}
-
-void FileBrowserView::fileChecksumsMD2()
-{
-    fileChecksums(EFileChecksumsMD2);
-}
-
-void FileBrowserView::fileChecksumsSHA1()
-{
-    fileChecksums(EFileChecksumsSHA1);
-}
-
-void FileBrowserView::fileChecksums(TFileBrowserCmdFileChecksums checksumType)
-{
-    QModelIndex currentIndex = currentItemIndex();
-    mEngineWrapper->showFileCheckSums(currentIndex, checksumType);
-}
-
-/**
-  Show file properties
-  */
-void FileBrowserView::fileProperties()
-{
-    QModelIndex currentIndex = currentItemIndex();
-    QStringList propertyList;
-    QString titleText;
-    mEngineWrapper->properties(currentIndex, propertyList, titleText);
-    openPropertyDialog(propertyList, titleText);
-}
-
-void FileBrowserView::fileSetAttributes()
-{
-
-}
-
-// edit menu
-void FileBrowserView::editSnapShotToE()
-{
-
-}
-
-/**
-  Set selected files into clipboard.
-  Selected item will be removed after paste operation.
-  */
-void FileBrowserView::editCut()
-{
-    mClipboardIndices = getSelectedItemsOrCurrentItem();
-
-    mEngineWrapper->clipboardCut(mClipboardIndices);
-
-    int operations = mClipboardIndices.count();
-    const QString message = QString ("%1 entries cut to clipboard");
-    QString noteMsg = message.arg(operations);
-
-    Notifications::showInformationNote(noteMsg);
-}
-
-/**
-  Set selected files into clipboard.
-  Selected item will not be removed after paste operation.
-  */
-void FileBrowserView::editCopy()
-{
-    mClipboardIndices = getSelectedItemsOrCurrentItem();
-
-    mEngineWrapper->clipboardCopy(mClipboardIndices);
-
-    int operations = mClipboardIndices.count();
-
-    const QString message = QString ("%1 entries copied to clipboard");
-    QString noteMsg = message.arg(operations);
-
-    Notifications::showInformationNote(noteMsg);
-}
-
-/**
-  Moves or copies file selection stored in clipboard to a actual directory.
-  Removing files depend on previous operation, i.e. Cut or Copy
-  */
-void FileBrowserView::editPaste()
-{
-    bool someEntryExists(false);
-
-    // TODO Set entry items here
-
-    someEntryExists = mEngineWrapper->isDestinationEntriesExists(mClipboardIndices, mEngineWrapper->currentPath());
-    if (someEntryExists) {
-        fileOverwriteDialog();
-    }
-    mEngineWrapper->clipboardPaste(mOverwriteOptions);
-}
-
-/**
-  Open copy to folder new filename dialog
-  */
-void FileBrowserView::editCopyToFolder()
-{
-    QString heading = QString("Enter new name");
-    HbInputDialog::getText(heading, this, SLOT(doEditCopyToFolder(HbAction*)), mEngineWrapper->currentPath(), scene());
-}
-
-/**
-  Copies current file selection to a queried directory.
-  */
-void FileBrowserView::doEditCopyToFolder(HbAction *action)
-{
-    HbInputDialog *dlg = static_cast<HbInputDialog*>(sender());
-    if (action == dlg->primaryAction())
-    {
-        QString targetDir = dlg->value().toString();
-        bool someEntryExists(false);
-
-        // TODO Set entry items here
-        QModelIndexList currentSelection = getSelectedItemsOrCurrentItem();
-        mEngineWrapper->setCurrentSelection(currentSelection);
-
-        someEntryExists = mEngineWrapper->isDestinationEntriesExists(currentSelection, targetDir);
-        if (someEntryExists) {
-            fileOverwriteDialog();
-        }
-        mEngineWrapper->copyToFolder(targetDir, mOverwriteOptions, false);
-        refreshList();
-    }
-}
-
-/**
-  Open move to folder new filename dialog.
-  */
-void FileBrowserView::editMoveToFolder()
-{
-    QString heading = QString("Enter new name");
-    HbInputDialog::getText(heading, this, SLOT(doEditCopyToFolder(HbAction*)), mEngineWrapper->currentPath(), scene());
-}
-
-/**
-  Moves current file selection to a queried directory.
-  */
-void FileBrowserView::doEditMoveToFolder(HbAction *action)
-{
-    HbInputDialog *dlg = static_cast<HbInputDialog*>(sender());
-    if (action == dlg->primaryAction())
-    {
-        QString targetDir = dlg->value().toString();
-        bool someEntryExists(false);
-
-        // TODO Set entry items here
-        QModelIndexList currentSelection = getSelectedItemsOrCurrentItem();
-        mEngineWrapper->setCurrentSelection(currentSelection);
-
-        someEntryExists = mEngineWrapper->isDestinationEntriesExists(currentSelection, targetDir);
-        if (someEntryExists) {
-            fileOverwriteDialog();
-        }
-        mEngineWrapper->copyToFolder(targetDir, mOverwriteOptions, true);
-        refreshList();
-    }
-}
-
-/**
-  Select current file
-  */
-void FileBrowserView::editSelect()
-{
-    QItemSelectionModel *selectionModel = mListView->selectionModel();
-    if (selectionModel) {
-        selectionModel->select(selectionModel->currentIndex(), QItemSelectionModel::SelectCurrent);
-        selectionModel->select(selectionModel->currentIndex(), QItemSelectionModel::Select);
-        itemHighlighted(selectionModel->currentIndex());
-        refreshList();
-    }
-}
-
-/**
-  Unselect current file
-  */
-void FileBrowserView::editUnselect()
-{
-    QItemSelectionModel *selectionModel = mListView->selectionModel();
-    if (selectionModel) {
-        selectionModel->select(selectionModel->currentIndex(), QItemSelectionModel::Deselect);
-        itemHighlighted(selectionModel->currentIndex());
-    }
-}
-
-/**
-  Select all files
-  */
-void FileBrowserView::editSelectAll()
-{
-    QItemSelectionModel *selectionModel = mListView->selectionModel();
-    if (selectionModel) {
-
-        if (mFileBrowserModel->rowCount() > 0) {
-            QModelIndex firstIndex = mFileBrowserModel->index(0, 0);
-            QModelIndex lastIndex = mFileBrowserModel->index( (mFileBrowserModel->rowCount() - 1), 0);
-
-            QItemSelection itemSelection(firstIndex, lastIndex);
-            //selectionModel->select(itemSelection, QItemSelectionModel::SelectCurrent);
-            selectionModel->select(itemSelection, QItemSelectionModel::Select);
-        }
-    }
-}
-
-/**
-  Unselect all files
-  */
-void FileBrowserView::editUnselectAll()
-{
-    QItemSelectionModel *selectionModel = mListView->selectionModel();
-    if (selectionModel) {
-        selectionModel->clearSelection();
-    }
-}
-
-// ---------------------------------------------------------------------------
-// view menu
-// ---------------------------------------------------------------------------
-void FileBrowserView::viewFilterEntries()
-{
-
-}
-void FileBrowserView::viewRefresh()
-{
-    refreshList();
-}
-
-// ---------------------------------------------------------------------------
-// disk admin menu
-// ---------------------------------------------------------------------------
-
-/**
-  Open old password for the selected drive dialog.
-  */
-void FileBrowserView::diskAdminSetDrivePassword()
-{
-    QModelIndex currentIndex = currentItemIndex();
-    // check if the drive has a password
-    if (mEngineWrapper->hasDrivePassword(currentIndex)) {
-        QString heading = QString("Existing password");
-        HbInputDialog::getText(heading, this, SLOT(diskAdminSetDrivePasswordNew(HbAction*)), QString(), scene());
-    }
-}
-
-/**
-   Open new password for the selected drive dialog.
-  */
-void FileBrowserView::diskAdminSetDrivePasswordNew(HbAction *action)
-{
-    HbInputDialog *dlg = static_cast<HbInputDialog*>(sender());
-    if (action == dlg->primaryAction()) {
-        mOldPassword = dlg->value().toString();
-    }
-
-    QString heading = QString("New password");
-    HbInputDialog::getText(heading, this, SLOT(doDiskAdminSetDrivePassword(HbAction*)), mOldPassword, scene());
-}
-
-/**
-   Set password for the selected drive.
-  */
-void FileBrowserView::doDiskAdminSetDrivePassword(HbAction *action)
-{
-    HbInputDialog *dlg = static_cast<HbInputDialog*>(sender());
-    if (action == dlg->primaryAction()) {
-        QString newPassword = dlg->value().toString();
-        QModelIndex currentIndex = currentItemIndex();
-        mEngineWrapper->DiskAdminSetDrivePassword(currentIndex, mOldPassword, newPassword);
-        refreshList();
-    }
-}
-
-/**
-  Open Unlock the selected drive dialog.
-  */
-void FileBrowserView::diskAdminUnlockDrive()
-{
-    QModelIndex currentIndex = currentItemIndex();
-    // check if the drive is locked
-    if (mEngineWrapper->isDriveLocked(currentIndex)) {
-        QString heading = QString("Existing password");
-        HbInputDialog::getText(heading, this, SLOT(doDiskAdminUnlockDrive(HbAction*)), QString(), scene());
-    } else {
-        Notifications::showInformationNote(QString("This drive is not locked"));
-    }
-}
-
-/**
-  Unlock the selected drive.
-  */
-void FileBrowserView::doDiskAdminUnlockDrive(HbAction *action)
-{
-    HbInputDialog *dlg = static_cast<HbInputDialog*>(sender());
-    if (action == dlg->primaryAction())
-    {
-        QString oldPassword = dlg->value().toString();
-        QModelIndex currentIndex = currentItemIndex();
-        mEngineWrapper->DiskAdminUnlockDrive(currentIndex, oldPassword);
-        refreshList();
-    }
-}
-
-/**
-  Open clear password of the selected drive dialog.
-  */
-void FileBrowserView::diskAdminClearDrivePassword()
-{
-    QModelIndex currentIndex = currentItemIndex();
-    // check if the drive has a password
-    if (mEngineWrapper->hasDrivePassword(currentIndex)) {
-        QString heading = QString("Existing password");
-        HbInputDialog::getText(heading, this, SLOT(doDiskAdminClearDrivePassword(HbAction*)), QString(), scene());
-    } else {
-        Notifications::showInformationNote(QString("This drive has no password"));
-    }
-}
-
-/**
-  Clear password of the selected drive.
-  */
-void FileBrowserView::doDiskAdminClearDrivePassword(HbAction *action)
-{
-    HbInputDialog *dlg = static_cast<HbInputDialog*>(sender());
-    if (action == dlg->primaryAction())
-    {
-        QString oldPassword = dlg->value().toString();
-        QModelIndex currentIndex = currentItemIndex();
-        mEngineWrapper->DiskAdminClearDrivePassword(currentIndex, oldPassword);
-        refreshList();
-    }
-}
-
-
-/**
-  Question for erase password of the selected drive
-  */
-void FileBrowserView::diskAdminEraseDrivePassword()
-{
-    // check if the drive has a password
-    QModelIndex currentIndex = currentItemIndex();
-    if (mEngineWrapper->hasDrivePassword(currentIndex)) {
-        HbMessageBox::question(QString("Are you sure? All data can be lost!"), this, SLOT(doDiskAdminEraseDrivePassword(HbAction*)));
-    } else {
-        Notifications::showInformationNote(QString("This drive has no password"));
-    }
-}
-
-/**
-  Erase password of the selected drive
-  */
-void FileBrowserView::doDiskAdminEraseDrivePassword(HbAction* action)
-{
-    HbMessageBox *dlg = qobject_cast<HbMessageBox*>(sender());
-    if (action == dlg->primaryAction()) {
-        QModelIndex currentIndex = currentItemIndex();
-        mEngineWrapper->DiskAdminEraseDrivePassword(currentIndex);
-        refreshList();
-    }
-}
-
-/**
-  Performs format on the selected drive
-  */
-void FileBrowserView::diskAdminFormatDrive()
-{
-    HbMessageBox::question(QString("Are you sure? All data will be lost!"), this, SLOT(doDiskAdminFormatDrive(HbAction*)));
-}
-
-/**
-  Performs format on the selected drive
-  */
-void FileBrowserView::doDiskAdminFormatDrive(HbAction* action)
-{
-    HbMessageBox *dlg = qobject_cast<HbMessageBox*>(sender());
-    if (action == dlg->primaryAction()) {
-        QModelIndex currentIndex = currentItemIndex();
-        mEngineWrapper->DiskAdminFormatDrive(currentIndex, false);
-    }
-}
-
-/**
-  Performs quick format on the selected drive
-  */
-void FileBrowserView::diskAdminQuickFormatDrive()
-{
-    HbMessageBox::question(QString("Are you sure? All data will be lost!"), this, SLOT(doDiskAdminQuickFormatDrive(HbAction*)));
-}
-
-/**
-  Performs quick format on the selected drive
-  */
-void FileBrowserView::doDiskAdminQuickFormatDrive(HbAction* action)
-{
-    HbMessageBox *dlg = qobject_cast<HbMessageBox*>(sender());
-    if (action == dlg->primaryAction()) {
-        QModelIndex currentIndex = currentItemIndex();
-        mEngineWrapper->DiskAdminFormatDrive(currentIndex, true);
-    }
-}
-
-/**
-    Checks the disk integrity on the selected drive
-  */
-void FileBrowserView::diskAdminCheckDisk()
-{
-    QModelIndex currentIndex = currentItemIndex();
-    mEngineWrapper->DiskAdminCheckDisk(currentIndex);
-}
-
-/**
-  Checks the selected drive for errors and corrects them
-  */
-void FileBrowserView::diskAdminScanDrive()
-{
-    HbMessageBox::question(QString("This finds errors on disk and corrects them. Proceed?"), this, SLOT(doDiskAdminScanDrive(HbAction*)));
-}
-
-/**
-  Checks the selected drive for errors and corrects them
-  */
-void FileBrowserView::doDiskAdminScanDrive(HbAction* action)
-{
-    HbMessageBox *dlg = qobject_cast<HbMessageBox*>(sender());
-    if (action == dlg->primaryAction()) {
-        QModelIndex currentIndex = currentItemIndex();
-        mEngineWrapper->DiskAdminScanDrive(currentIndex);
-        refreshList();
-    }
-}
-
-/**
-  Open drive name dialog
-  */
-void FileBrowserView::diskAdminSetDriveName()
-{
-    QString driveName;
-
-    // get existing drive name
-    QModelIndex currentIndex = currentItemIndex();
-    mEngineWrapper->GetDriveName(currentIndex, driveName);
-
-    QString heading = QString("New name");
-    HbInputDialog::getText(heading, this, SLOT(doDiskAdminSetDriveName(HbAction*)), driveName, scene());
-}
-
-/**
-  Set drive name.
-  */
-void FileBrowserView::doDiskAdminSetDriveName(HbAction *action)
-{
-    HbInputDialog *dlg = static_cast<HbInputDialog*>(sender());
-    if (action == dlg->primaryAction()) {
-        QString driveName = dlg->value().toString();
-
-        QModelIndex currentIndex = currentItemIndex();
-        mEngineWrapper->DiskAdminSetDriveName(currentIndex, driveName);
-
-        refreshList();
-    }
-}
-
-/**
-  Open drive volume label dialog
-  */
-void FileBrowserView::diskAdminSetDriveVolumeLabel()
-{
-    QString volumeLabel;
-
-    // get existing drive name
-    QModelIndex currentIndex = currentItemIndex();
-    mEngineWrapper->GetDriveVolumeLabel(currentIndex, volumeLabel);
-
-    QString heading = QString("New volume label");
-    HbInputDialog::getText(heading, this, SLOT(doDiskAdminSetDriveVolumeLabel(HbAction*)), volumeLabel, scene());
-}
-
-/**
-  Set drive volume label.
-  */
-void FileBrowserView::doDiskAdminSetDriveVolumeLabel(HbAction *action)
-{
-    HbInputDialog *dlg = static_cast<HbInputDialog*>(sender());
-    if (action == dlg->primaryAction()) {
-        QString volumeLabel = dlg->value().toString();
-
-        QModelIndex currentIndex = currentItemIndex();
-        mEngineWrapper->DiskAdminSetDriveVolumeLabel(currentIndex, volumeLabel);
-
-        refreshList();
-    }
-}
-
-/**
-  Eject the selected drive
-  */
-void FileBrowserView::diskAdminEjectDrive()
-{
-    QModelIndex currentIndex = currentItemIndex();
-    mEngineWrapper->DiskAdminEjectDrive(currentIndex);
-    refreshList();
-}
-
-/**
-  Dismount the selected drive
-  */
-void FileBrowserView::diskAdminDismountDrive()
-{
-    HbMessageBox::question(QString("Are you sure you know what are you doing?"), this, SLOT(doDiskAdminDismountDrive(HbAction*)));
-}
-
-void FileBrowserView::doDiskAdminDismountDrive(HbAction* action)
-{
-    HbMessageBox *dlg = qobject_cast<HbMessageBox*>(sender());
-    if (action == dlg->primaryAction()) {
-        QModelIndex currentIndex = currentItemIndex();
-        mEngineWrapper->DiskAdminDismountDrive(currentIndex);
-        refreshList();
-    }
-}
-
-/**
-  Erase Master Boot Record of the selected drive
-  */
-void FileBrowserView::diskAdminEraseMBR()
-{
-    // TODO What to do with FB LITE macros?
-    HbMessageBox::question(QString("Are you sure? Your media driver must support this!"), this, SLOT(doDiskAdminEraseMBR(HbAction*)));
-}
-
-void FileBrowserView::doDiskAdminEraseMBR(HbAction* action)
-{
-    // TODO What to do with FB LITE macros?
-    HbMessageBox *dlg = qobject_cast<HbMessageBox*>(sender());
-    if (action == dlg->primaryAction()){
-        HbMessageBox::question(QString("Are you really sure you know what are you doing ?!?"), this, SLOT(doDiskAdminReallyEraseMBR(HbAction*)));
-    }
-}
-
-void FileBrowserView::doDiskAdminReallyEraseMBR(HbAction* action)
-{
-    HbMessageBox *dlg = qobject_cast<HbMessageBox*>(sender());
-    if (action == dlg->primaryAction()) {
-        QModelIndex currentIndex = currentItemIndex();
-        // warn if the selected drive is not detected as removable
-        if (mEngineWrapper->isDriveRemovable(currentIndex)) {
-            mEngineWrapper->DiskAdminEraseMBR(currentIndex);
-            refreshList();
-        } else {
-            HbMessageBox::question(QString("Selected drive is not removable, really continue?"), this, SLOT(doDiskAdminNotRemovableReallyEraseMBR(HbAction*)));
-        }
-    }
-}
-
-void FileBrowserView::doDiskAdminNotRemovableReallyEraseMBR(HbAction* action)
-{
-    HbMessageBox *dlg = qobject_cast<HbMessageBox*>(sender());
-    if (action == dlg->primaryAction()) {
-        QModelIndex currentIndex = currentItemIndex();
-        mEngineWrapper->DiskAdminEraseMBR(currentIndex);
-        refreshList();
-    }
-
-}
-
-/**
-  Partition the selected drive
-  */
-void FileBrowserView::diskAdminPartitionDrive()
-{
-    const QString message("Are you sure? Your media driver must support this!");
-    HbMessageBox::question(message, this, SLOT(diskAdminPartitionDriveProceed(HbAction *)));
-}
-
-/**
-  Partition the selected drive if user is sure
-  */
-void FileBrowserView::diskAdminPartitionDriveProceed(HbAction *action)
-{
-    HbMessageBox *dlg = qobject_cast<HbMessageBox*>(sender());
-    if (action == dlg->primaryAction()) {
-        const QString message("Are you really sure you know what are you doing ?!?");
-        HbMessageBox::question(message, this, SLOT(diskAdminPartitionDriveReallyProceed(HbAction *)));
-    }
-}
-
-/**
-  Partition the selected drive if user is really sure
-  */
-void FileBrowserView::diskAdminPartitionDriveReallyProceed(HbAction *action)
-{
-    HbMessageBox *dlg = qobject_cast<HbMessageBox*>(sender());
-    if (action == dlg->primaryAction()) {
-        QModelIndex currentIndex = currentItemIndex();
-        mEraseMBR = false;
-        // warn if the selected drive is not detected as removable
-        if (mEngineWrapper->isDriveRemovable(currentIndex)) {
-            mProceed = true;
-        } else {
-            const QString message("Selected drive is not removable, really continue?");
-            HbMessageBox::question(message, this, SLOT(diskAdminPartitionDriveIsNotRemovable(HbAction *)));
-        }
-
-        if (mProceed) {
-            // query if erase mbr
-            mEraseMBR = false;
-
-            QString message("Erase MBR first (normally needed)?");
-            HbMessageBox::question(message, this, SLOT(diskAdminPartitionDriveEraseMbr(HbAction *)));
-
-            // TODO use HbListDialog
-            QStringList list;
-            list << "1" << "2" << "3" << "4";
-            openListDialog(list, QString("Partitions?"), this, SLOT(diskAdminPartitionDriveGetCount(HbAction*)));
-        }
-    }
-}
-
-/**
-  Store result of user query about proceeding when drive is not removable.
-  */
-void FileBrowserView::diskAdminPartitionDriveIsNotRemovable(HbAction *action)
-{
-    HbMessageBox *dlg = qobject_cast<HbMessageBox*>(sender());
-    if (action == dlg->primaryAction()) {
-        mProceed = true;
-    } else {
-        mProceed = false;
-    }
-}
-
-/**
-  Store result of user query about erase MBR
-  */
-void FileBrowserView::diskAdminPartitionDriveEraseMbr(HbAction *action)
-{
-    HbMessageBox *dlg = qobject_cast<HbMessageBox*>(sender());
-    if (action == dlg->primaryAction()) {
-        mEraseMBR = true;
-    }
-}
-
-/**
-  Partition the selected drive
-  */
-void FileBrowserView::diskAdminPartitionDriveGetCount(HbAction* action)
-{
-    HbSelectionDialog *dlg = static_cast<HbSelectionDialog*>(sender());
-    if(!action && dlg && dlg->selectedItems().count()){
-        int selectionIndex = dlg->selectedItems().at(0).toInt();
-        QModelIndex currentIndex = currentItemIndex();
-        int amountOfPartitions = selectionIndex + 1;
-        mEngineWrapper->DiskAdminPartitionDrive(currentIndex, mEraseMBR, amountOfPartitions);
-        refreshList();
-    }
-}
-
-// ---------------------------------------------------------------------------
-// tools menu
-// ---------------------------------------------------------------------------
-void FileBrowserView::toolsAllAppsToTextFile()
-{
-
-}
-void FileBrowserView::toolsAllFilesToTextFile()
-{
-
-}
-void FileBrowserView::toolsAvkonIconCacheEnable()
-{
-
-}
-void FileBrowserView::toolsAvkonIconCacheDisable()
-{
-
-}
-
-/**
-  Disable extended errors
-  */
-void FileBrowserView::toolsDisableExtendedErrors()
-{
-    mEngineWrapper->ToolsSetErrRd(false);
-}
-
-void FileBrowserView::toolsDumpMsgStoreWalk()
-{
-
-}
-void FileBrowserView::toolsEditDataTypes()
-{
-
-}
-
-/**
-  Enable extended errors
-  */
-void FileBrowserView::toolsEnableExtendedErrors()
-{
-    mEngineWrapper->ToolsSetErrRd(true);
-}
-
-/**
-  Open simulate leave dialog
-  */
-void FileBrowserView::toolsErrorSimulateLeave()
-{
-    int leaveCode = -6;
-    QString heading = QString("Leave code");
-    //HbInputDialog::getInteger(heading, this, SLOT(doToolsErrorSimulateLeave(HbAction*)), leaveCode, scene());
-    HbInputDialog::getText(heading, this, SLOT(doToolsErrorSimulateLeave(HbAction*)), QString::number(leaveCode), scene());
-}
-
-
-/**
-  Simulate leave.
-  */
-void FileBrowserView::doToolsErrorSimulateLeave(HbAction *action)
-{
-    HbInputDialog *dlg = static_cast<HbInputDialog*>(sender());
-    if (action == dlg->primaryAction()) {
-        bool ok;
-        int leaveCode = dlg->value().toString().toInt(&ok);
-        if (leaveCode != 0 || ok) {
-            mEngineWrapper->ToolsErrorSimulateLeave(leaveCode);
-        }
-    }
-}
-
-/**
-  Open simulate panic dialog.
-  */
-void FileBrowserView::toolsErrorSimulatePanic()
-{
-    mPanicCategory = QString ("Test Category");
-    QString heading = QString("Panic category");
-    HbInputDialog::getText(heading, this, SLOT(doToolsErrorSimulatePanicCode(HbAction*)), mPanicCategory, scene());
-}
-
-/**
-  Simulate panic.
-  */
-void FileBrowserView::doToolsErrorSimulatePanicCode(HbAction *action)
-{
-    HbInputDialog *dlg = static_cast<HbInputDialog*>(sender());
-    if (action == dlg->primaryAction()) {
-        mPanicCategory = dlg->value().toString();
-        int panicCode(555);
-        QString heading = QString("Panic code");
-        HbInputDialog::getInteger(heading, this, SLOT(doToolsErrorSimulatePanic(HbAction*)), panicCode, scene());
-    }
-}
-
-/**
-  Simulate panic.
-  */
-void FileBrowserView::doToolsErrorSimulatePanic(HbAction *action)
-{
-    HbInputDialog *dlg = static_cast<HbInputDialog*>(sender());
-    if (action == dlg->primaryAction()) {
-        bool ok;
-        int panicCode = dlg->value().toInt(&ok);
-        if (panicCode != 0 || ok) {
-            mEngineWrapper->ToolsErrorSimulatePanic(mPanicCategory, panicCode);
-        }
-    }
-}
-
-/**
-  Open simulate exception dialog.
-  */
-void FileBrowserView::toolsErrorSimulateException()
-{
-    int exceptionCode = 0;
-    QString heading = QString("Exception code");
-    HbInputDialog::getInteger(heading, this, SLOT(doToolsErrorSimulateException(HbAction*)), exceptionCode, scene());
-}
-
-/**
-  Simulate exception.
-  */
-void FileBrowserView::doToolsErrorSimulateException(HbAction *action)
-{
-    HbInputDialog *dlg = static_cast<HbInputDialog*>(sender());
-    if (action == dlg->primaryAction()) {
-        bool ok;
-        int exceptionCode = dlg->value().toInt(&ok);
-        if (exceptionCode != 0 || ok) {
-            mEngineWrapper->ToolsErrorSimulateException(exceptionCode);
-        }
-    }
-}
-
-//    void FileBrowserView::toolsLocalConnectivityActivateInfrared()
-//{
-//
-//}
-//    void FileBrowserView::toolsLocalConnectivityLaunchBTUI()
-//{
-//
-//}
-//    void FileBrowserView::toolsLocalConnectivityLaunchUSBUI()
-//{
-//
-//}
-void FileBrowserView::toolsMessageInbox()
-{
-
-}
-void FileBrowserView::toolsMessageDrafts()
-{
-
-}
-void FileBrowserView::toolsMessageSentItems()
-{
-
-}
-void FileBrowserView::toolsMessageOutbox()
-{
-
-}
-void FileBrowserView::toolsMemoryInfo()
-{
-
-}
-void FileBrowserView::toolsSecureBackStart()
-{
-
-}
-void FileBrowserView::toolsSecureBackRestore()
-{
-
-}
-void FileBrowserView::toolsSecureBackStop()
-{
-
-}
-
-/**
-  Open debug mask dialog
-  */
-void FileBrowserView::toolsSetDebugMaskQuestion()
-{
-    quint32 dbgMask = mEngineWrapper->getDebugMask();
-    QString dbgMaskText = QString("0x").append(QString::number(dbgMask, 16));
-    QString heading = QString("Kernel debug mask in hex format");
-    HbInputDialog::getText(heading, this, SLOT(toolsSetDebugMask(HbAction*)), dbgMaskText, scene());
-}
-
-/**
-  Set debug mask
-  */
-void FileBrowserView::toolsSetDebugMask(HbAction *action)
-{
-    HbInputDialog *dlg = static_cast<HbInputDialog*>(sender());
-    if(action == dlg->primaryAction())
-    {
-        QString dbgMaskText = dlg->value().toString();
-        if (dbgMaskText.length() > 2 && dbgMaskText[0]=='0' && dbgMaskText[1]=='x') {
-            bool ok;
-            quint32 dbgMask = dbgMaskText.toUInt(&ok, 16);
-            if (dbgMask != 0 || ok) {
-                mEngineWrapper->toolsSetDebugMask(dbgMask);
-                Notifications::showConfirmationNote(QString("Changed"));
-            } else {
-                Notifications::showErrorNote(QString("Cannot convert value"));
-            }
-        } else {
-            Notifications::showErrorNote(QString("Not in hex format"));
-        }
-    }
-}
-
-void FileBrowserView::toolsShowOpenFilesHere()
-{
-
-}
-
-// ---------------------------------------------------------------------------
-// main menu items
-// ---------------------------------------------------------------------------
-void FileBrowserView::selectionModeChanged()
-{
-    if (mFileViewMenuActions.mSelection->isChecked()) {
-         activateSelectionMode();
-     } else {
-         deActivateSelectionMode();
-     }
-}
-
-/**
-  Show about note
-  */
-void FileBrowserView::about()
-{
-    Notifications::showAboutNote();
-}
-
-// ---------------------------------------------------------------------------
-// End of operations
-// ---------------------------------------------------------------------------
-
-// ---------------------------------------------------------------------------
-
-/**
-  Item is selected from list when selection mode is activated from menu
-  */
-void FileBrowserView::selectionChanged(const QItemSelection &/*selected*/, const QItemSelection &/*deselected*/)
-{
-    QItemSelectionModel *selectionModel = mListView->selectionModel();
-    itemHighlighted(selectionModel->currentIndex());
-}
-
-/**
-  An item is highlighted = single-clicked from file/folder list.
-  */
-void FileBrowserView::itemHighlighted(const QModelIndex& index)
-{
-    Q_UNUSED(index)
-//    mItemHighlighted = true;
-//    mFileInfo = mFileSystemModel->fileInfo(index);
-}
-
-
-/**
-  An item is clicked from navigation item list. Navigation item list contains
-  drive-, folder- or file items. Opens selected drive, folder or file popup menu
-  */
-void FileBrowserView::activated(const QModelIndex& index)
-{
-    if (mFileBrowserModel) {
-        if (mEngineWrapper->isDriveListViewActive()) {
-            mEngineWrapper->moveDownToDirectory(index);
-            populateFolderContent();
-        } else if (mEngineWrapper->getFileEntry(index).isDir()) {
-            // populate new content of changed navigation view.
-            // mLocationChanged = true;
-            // mDirectory = filePath;
-            mEngineWrapper->moveDownToDirectory(index);
-            populateFolderContent();
-        } else {  // file item
-            // mSelectedFilePath = filePath;
-            FileEntry fileEntry = mEngineWrapper->getFileEntry(index);
-            mAbsoluteFilePath = fileEntry.path() + fileEntry.name();
-
-            // open user-dialog to select: view as text/hex,  open w/AppArc or open w/DocH. embed
-            QStringList list;
-            list << QString("View as text/hex") << QString("Open w/ AppArc") << QString("Open w/ DocH. embed");
-            openListDialog(list, QString("Open file"), this, SLOT(fileOpen(HbAction *)));
-        }
-    }
-}
-
-// ---------------------------------------------------------------------------
-
-void FileBrowserView::activateSelectionMode()
-{
-    QString path;
-    disconnect(mListView, SIGNAL(activated(QModelIndex)), this, SLOT(activated(QModelIndex)));
-    mListView->setSelectionMode(HbListView::MultiSelection);
-
-//    if (mDirectory != mInitDirPath.path()) {
-//        QDir dir(mDirectory);
-//        path = mDirectory;
-//        QStringList dirs = dir.entryList(QDir::AllDirs | QDir::System | QDir::Hidden);
-//        if (dirs.count() > 0) {
-//            path.append("\\" + dirs.at(0) + "\\");
-//        }
-//    } else {
-//        path = ("C:\\");
-//    }
-//    QModelIndex index = mFileSystemModel->index(path,0);
-//    mListView->selectionModel()->setCurrentIndex(index, QItemSelectionModel::SelectCurrent);
-//    mListView->selectionModel()->select(index, QItemSelectionModel::Select);
-//    //mListView->setHighlightMode(HbItemHighlight::HighlightAlwaysVisible);
-//    mListView->setFocus();    // TODO use focus in
-    if (mListView->selectionModel()) {
-        connect(mListView->selectionModel(),
-                SIGNAL(selectionChanged(QItemSelection, QItemSelection)),
-                this,
-                SLOT(selectionChanged(QItemSelection, QItemSelection)));
-//        // flag to indicate that selection mode changed, "edit" sub-menu update needed
-//        mFolderContentChanged = true;
-    }
-}
-
-// ---------------------------------------------------------------------------
-
-void FileBrowserView::deActivateSelectionMode()
-{
-    disconnect(mListView->selectionModel(),
-               SIGNAL(selectionChanged(QItemSelection, QItemSelection)),
-               this,
-               SLOT(selectionChanged(QItemSelection, QItemSelection)));
-    mListView->setSelectionMode(HbListView::NoSelection);
-    connect(mListView, SIGNAL(activated(QModelIndex)), this, SLOT(activated(QModelIndex)));
-    editUnselectAll();
-    // flag to indicate that selection mode changed, "edit" sub-menu update needed
-    mFolderContentChanged = true;
-}
-
-// ---------------------------------------------------------------------------
--- a/filebrowser/ui/src/main.cpp	Fri Jun 11 16:29:34 2010 +0100
+++ b/filebrowser/ui/src/main.cpp	Thu Jul 22 16:33:59 2010 +0100
@@ -18,13 +18,13 @@
 #include <HbApplication>
 #include <HbMainWindow>
 
-#include "filebrowsermainwindow.h"
+#include "fbmainwindow.h"
 
 
 int main(int argc, char *argv[])
 {
     HbApplication app(argc, argv);
-    FileBrowserMainWindow window;
+    FbMainWindow window;
     window.init();
     int result = app.exec();
 
--- a/filebrowser/ui/src/notifications.cpp	Fri Jun 11 16:29:34 2010 +0100
+++ b/filebrowser/ui/src/notifications.cpp	Thu Jul 22 16:33:59 2010 +0100
@@ -14,14 +14,11 @@
 * Description:
 *
 */
-
-
-#include <hblabel.h>
-//#include <hbdeviceprogressdialog.h>
-#include <hbmessagebox.h>
-
 #include "notifications.h"
 
+#include <HbLabel>
+#include <HbProgressDialog>
+#include <HbMessageBox>
 
 // ---------------------------------------------------------------------------
 
@@ -41,7 +38,7 @@
 void Notifications::showAboutNote()
 {
     showMessageBox(HbMessageBox::MessageTypeInformation,
-                   "Version 5.0.0 - 23h April 2010. Copyright © 2010 Nokia Corporation"
+                   "Version 5.1.0 - 18th June 2010. Copyright © 2010 Nokia Corporation"
                         "and/or its subsidiary(-ies). All rights reserved."
                         "Licensed under Eclipse Public License v1.0.",
                    "About File Browser"
@@ -50,39 +47,32 @@
 
 // ---------------------------------------------------------------------------
 
-//HbDeviceProgressDialog* Notifications::showWaitDialog(const QString &text)
-//{
-//    HbDeviceProgressDialog *note = new HbDeviceProgressDialog( HbProgressDialog::WaitDialog );
-//    note->setText( text );
-//    note->show();
-//    return note;
-//}
-
-// ---------------------------------------------------------------------------
-
 void Notifications::showInformationNote(const QString &text, const QString &title)
 {
-    showMessageBox(HbMessageBox::MessageTypeInformation, text, title, false);
+    showMessageBox(HbMessageBox::MessageTypeInformation, text, title, 3000);
 }
 
 // ---------------------------------------------------------------------------
 
 void Notifications::showErrorNote(const QString &text, bool noTimeout)
 {
-    showMessageBox(HbMessageBox::MessageTypeWarning, text, "", noTimeout ? HbPopup::NoTimeout : HbPopup::StandardTimeout);
+    showMessageBox(HbMessageBox::MessageTypeWarning, text, "",
+                   noTimeout ? HbPopup::NoTimeout : 3000 /*HbPopup::StandardTimeout*/);
 }
 
 // ---------------------------------------------------------------------------
 
 void Notifications::showConfirmationNote(const QString &text, bool noTimeout)
 {
-    showMessageBox(HbMessageBox::MessageTypeWarning, text, "", noTimeout ? HbPopup::NoTimeout : HbPopup::ConfirmationNoteTimeout);
+    showMessageBox(HbMessageBox::MessageTypeInformation, text, "",
+                   noTimeout ? HbPopup::NoTimeout : 3000 /*HbPopup::ConfirmationNoteTimeout*/);
 }
 
 // ---------------------------------------------------------------------------
 
 bool Notifications::showConfirmationQuery(const QString &aText)
 {
+    Q_UNUSED(aText);
     return false; //HbMessageBox::question(aText);
 }
 
--- a/filebrowser/ui/src/searchview.cpp	Fri Jun 11 16:29:34 2010 +0100
+++ b/filebrowser/ui/src/searchview.cpp	Thu Jul 22 16:33:59 2010 +0100
@@ -17,62 +17,64 @@
 
 #include "searchview.h"
 #include "enginewrapper.h"
+#include "notifications.h"
 
 #include <HbView>
-#include <HbMainWindow>
-
 #include <HbDataForm>
 #include <HbDataFormModel>
 #include <HbDataFormModelItem>
 #include <HbAction>
-#include <HbPushButton>
 #include <HbListWidget>
 #include <HbListWidgetItem>
 #include <HbDialog>
-#include <HbMenu>
+#include <HbToolBar>
+#include <HbProgressDialog>
 
 #include <QtGui>
 #include <QDir>
 #include <QFileInfo>
-#include <QProgressBar>
-
 
 const QStringList RECURSEMODES = (QStringList() << "Non-recursive" << "Recursive");
+const QString acceptActionText = "Search";
+const QString rejectActionText = "Cancel";
 
-SearchView::SearchView(HbView &mainView, HbMainWindow &mainWindow, EngineWrapper &engineWrapper)
-: mMainWindow(mainWindow),
-  mMainView(mainView),
-  mEngineWrapper(engineWrapper),
-  mAttributes(),
-  mResults(),
-  mForm(0),
-  mSearchFileNameItem(0),
-  mWildCardItem(0),
-  mHasString(0),
-  mRecurse(0),
-  mMinSize(0),
-  mMaxSize(0),
-  mMinDate(0),
-  mMaxDate(0),
-  mPath()
+
+SearchView::SearchView(EngineWrapper &engineWrapper)
+    : mEngineWrapper(engineWrapper),
+    mAttributes(),
+    mResults(),
+    mForm(0),
+    mSearchFileNameItem(0),
+    mWildCardItem(0),
+    mHasString(0),
+    mRecurse(0),
+    mMinSize(0),
+    mMaxSize(0),
+    mMinDate(0),
+    mMaxDate(0),
+    mPath(),
+    mProgressDialog(0)
 {
+    // Set title and add this view to main window
+    setTitle("Search");
+
+    // Override back navigation action
+    HbAction *leaveViewAction = new HbAction(Hb::BackNaviAction, this);
+    connect(leaveViewAction, SIGNAL(triggered()), this, SLOT(reject()));
+    setNavigationAction(leaveViewAction);
+
+    initDataForm();
+    createToolbar();
 }
 
 SearchView::~SearchView() 
 {
 }
 
-void SearchView::open(const QString &path)
-{   
-    // Remove main view from main window
-    mMainWindow.removeView(&mMainView);
-    mMainWindow.addView(this);
-    // Set title and add this view to main window
-    setTitle("Search");
-	
+void SearchView::initDataForm() {
     mForm = new HbDataForm(/*HbFormView::ModeEdit,*/ this);
     HbDataFormModel *model = new HbDataFormModel();
-    mPath = path;
+
     mSearchFileNameItem = new HbDataFormModelItem(HbDataFormModelItem::TextItem);
     mSearchFileNameItem->setLabel("Search dir: ");
 
@@ -81,28 +83,25 @@
 
     mHasString = new HbDataFormModelItem(HbDataFormModelItem::TextItem);
     mHasString->setLabel("Has string: ");
-    
+
     mRecurse = new HbDataFormModelItem(HbDataFormModelItem::ComboBoxItem);
     mRecurse->setLabel("Recurse: ");
     mRecurse->setContentWidgetData("items", RECURSEMODES);
-    
+
     mMinSize = new HbDataFormModelItem(HbDataFormModelItem::TextItem);
     mMinSize->setLabel("Min size: ");
-    
+
     mMaxSize = new HbDataFormModelItem(HbDataFormModelItem::TextItem);
     mMaxSize->setLabel("Max size: ");
-    
+
     mMinDate = new HbDataFormModelItem(HbDataFormModelItem::TextItem);
     mMinDate->setLabel("Min date: ");
     mMinDate->setContentWidgetData("text", "01/01/1980");
-    
+
     mMaxDate = new HbDataFormModelItem(HbDataFormModelItem::TextItem);
     mMaxDate->setLabel("Max date: ");
     mMaxDate->setContentWidgetData("text", "31/12/2060");
-    
-    // load file search attribute values from FB engine:
-    loadAttributes();
-    
+
     model->appendDataFormItem(mSearchFileNameItem);
     model->appendDataFormItem(mWildCardItem);
     model->appendDataFormItem(mHasString);
@@ -114,82 +113,32 @@
     mForm->setModel(model);
 
     QGraphicsLinearLayout* layout = new QGraphicsLinearLayout(Qt::Vertical,this);
-
-    HbPushButton* buttonSearch = new HbPushButton("Search");
-    buttonSearch->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Fixed);
-    connect(buttonSearch, SIGNAL(clicked()), this, SLOT(startFileSearch()));
-
-	HbPushButton* buttonCancel = new HbPushButton("Cancel");
-    buttonCancel->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Fixed);
-    connect(buttonCancel, SIGNAL(clicked()), this, SLOT(backButtonClicked()));
-
-    // Create widget and layout for buttons
-    QGraphicsWidget *buttonsWidget = new QGraphicsWidget(this);
-    QGraphicsGridLayout *gridLayout = new QGraphicsGridLayout(buttonsWidget);
-    
-    // add buttons to layout
-    gridLayout->addItem(buttonSearch, 0, 0);
-	gridLayout->addItem(buttonCancel, 0, 1);
-    buttonsWidget->setLayout(gridLayout);
-	// add form and buttons widget to list layout
-	layout->addItem(mForm);
-	layout->addItem(buttonsWidget);
+    layout->addItem(mForm);
     setLayout(layout);
-    // about to close connect to go back to file browser view
-    connect(this, SIGNAL(aboutToClose()), this, SLOT(backButtonClicked())); 
-}
-
-void SearchView::backButtonClicked()
-{
-    mMainWindow.removeView(this);
-	mForm->deleteLater();
-	mForm = 0;
-    mMainWindow.addView(&mMainView);
 }
 
-void SearchView::startFileSearch()
+void SearchView::createToolbar()
 {
-    // save form data values and set them as search attributes into FB engine. 
-    readFormItems();
-    mEngineWrapper.setFileSearchAttributes(mAttributes);
-    
-    // Create busy indicator widget with  label **Searching**. Launch it to screen when
-    // FB Utils engine started for file search.  Hide busy indicator when search completed.
-    QProgressBar *progressBar = new QProgressBar();
-	progressBar->setMaximumHeight(16);
-	progressBar->setMaximumWidth(200);    
-    progressBar->setTextVisible(false);
-    progressBar->setMaximum(0);
-    progressBar->setMinimum(0);
-    progressBar->setValue(1);
+    HbToolBar *toolBar = new HbToolBar(this);
+    HbAction *acceptAction = new HbAction(acceptActionText);
+    connect(acceptAction, SIGNAL(triggered()), this, SLOT(accept()));
+    toolBar->addAction(acceptAction);
 
-    QWidget *busyIndWidget = new QWidget();
-    busyIndWidget->setGeometry(12, 50, 120, 60);
-    QVBoxLayout *vbl = new QVBoxLayout(busyIndWidget);
-    QLabel *label = new QLabel("**Searching**");
-    vbl->addWidget(label);
-    vbl->addWidget(progressBar);
-    QHBoxLayout *hbl1 = new QHBoxLayout();
-    vbl->addLayout(hbl1);   
-    busyIndWidget->show();        
-    qApp->processEvents();
-    bool err = mEngineWrapper.searchFiles();
-    busyIndWidget->hide();
+    HbAction *rejectAction = new HbAction(rejectActionText);
+    connect(rejectAction, SIGNAL(triggered()), this, SLOT(reject()));
+    toolBar->addAction(rejectAction);
 
-    // show results of file search:
-    mResults = mEngineWrapper.getSearchResults();
-    fileSearchResults();
+    setToolBar(toolBar);
 }
 
-
 void SearchView::loadAttributes()
 {
     // get settings from engine;
     mAttributes = mEngineWrapper.getFileSearchAttributes();
-    
+
     // set data:
     mSearchFileNameItem->setContentWidgetData("text", mPath);
-    mSearchFileNameItem->setContentWidgetData("text", mAttributes.mSearchDir);
+//    mSearchFileNameItem->setContentWidgetData("text", mAttributes.mSearchDir);
     mWildCardItem->setContentWidgetData("text",mAttributes.mWildCards);
     mHasString->setContentWidgetData("text", mAttributes.mTextInFile);
 
@@ -202,23 +151,6 @@
     mMaxDate->setContentWidgetData("text", mAttributes.mMaxDate);
 }
 
-
-void SearchView::fileSearchResults()
-{
-    HbDialog *dialog = new HbDialog();
-    dialog->setDismissPolicy(HbPopup::TapOutside);
-    dialog->setTimeout(HbPopup::NoTimeout);
-
-    // Create a list and some simple content for it
-    HbListWidget *resultsList = new HbListWidget();
-    resultsList->addItem(QString("%1 entries found").arg(mResults.mNumberOfFoundFiles));
-    for (int i = 0; i < mResults.mFoundFilesList->size(); i++) {
-        resultsList->addItem(QString("%1").arg(mResults.mFoundFilesList->at(i)));
-        }
-    dialog->setContentWidget(resultsList);    
-    dialog->open();
-}
-
 /**
  * Reads form items and saves values of them into member variable mAttributes
  */
@@ -233,3 +165,40 @@
     mAttributes.mMaxDate    = mMaxDate->contentWidgetData("text").toDate();
     mAttributes.mRecurse    = mRecurse->contentWidgetData("selected").toBool();
 }
+
+void SearchView::open(const QString &path)
+{   
+    mPath = path;
+    // load file search attribute values from FB engine:
+    loadAttributes();
+}
+
+void SearchView::startFileSearch()
+{
+    // save form data values and set them as search attributes into FB engine. 
+    readFormItems();
+    mEngineWrapper.setFileSearchAttributes(mAttributes);
+    
+    bool err = mEngineWrapper.searchFiles();
+
+    // show results of file search:
+    mResults = mEngineWrapper.getSearchResults();
+    fileSearchResults();
+}
+
+void SearchView::fileSearchResults()
+{
+    QString noteMsg("%1 entries found");
+    Notifications::showInformationNote(noteMsg.arg(mEngineWrapper.itemCount()), QString(""));
+}
+
+void SearchView::accept()
+{
+    startFileSearch();
+    emit finished(true);
+}
+
+void SearchView::reject()
+{
+    emit finished(false);
+}
--- a/filebrowser/ui/src/settingsview.cpp	Fri Jun 11 16:29:34 2010 +0100
+++ b/filebrowser/ui/src/settingsview.cpp	Thu Jul 22 16:33:59 2010 +0100
@@ -16,7 +16,6 @@
 */
 
 #include "settingsview.h"
-#include "filebrowsermainwindow.h"
 #include "enginewrapper.h"
 #include "filebrowsersettings.h"
 
@@ -37,8 +36,7 @@
 const QString acceptActionText = "OK";
 const QString rejectActionText = "Cancel";
 
-SettingsView::SettingsView(FileBrowserMainWindow &mainWindow, EngineWrapper &engineWrapper) :
-    mMainWindow(mainWindow),
+SettingsView::SettingsView(EngineWrapper &engineWrapper) :
     mEngineWrapper(engineWrapper),
     mForm(0),
     mDisplayModeItem(0),
@@ -229,35 +227,6 @@
 {
     
 }
-//
-//void SettingsView::displayModeChanged()
-//{
-//}
-//
-//void SettingsView::fileViewChanged()
-//{
-//
-//}
-//
-//void SettingsView::subDirectoryInfoChanged()
-//{
-//}
-//
-//void SettingsView::associatedIconsChanged()
-//{
-//}
-//
-//void SettingsView::rememberFolderOnExitChanged()
-//{
-//}
-//
-//void SettingsView::rememberLastFolderChanged()
-//{
-//}
-//
-//void SettingsView::showToolbarChanged()
-//{
-//}
 
 void SettingsView::accept()
 {
--- a/filebrowser/ui/ui.pro	Fri Jun 11 16:29:34 2010 +0100
+++ b/filebrowser/ui/ui.pro	Thu Jul 22 16:33:59 2010 +0100
@@ -21,9 +21,14 @@
 load(hb.prf)
 symbian:CONFIG -= symbian_i18n
 
-HEADERS += ./inc/filebrowsermainwindow.h \
-           ./inc/filebrowserview.h \
-           ./inc/filebrowsermodel.h \
+HEADERS += ./inc/fbmainwindow.h \
+           ./inc/fbdrivelistviewitem.h \
+           ./inc/fbdrivemodel.h \
+           ./inc/fbdriveview.h \
+           ./inc/fbfilelistviewitem.h \
+           ./inc/fbfilemodel.h \
+           ./inc/fbfileview.h \
+           ./inc/filebrowsersortfilterproxymodel.h \
            ./inc/menuaction.h \
            ./inc/filebrowsersettings.h \
            ./inc/settingsview.h \
@@ -34,9 +39,14 @@
            ./inc/fileentry.h \
            ./inc/driveentry.h
 SOURCES += ./src/main.cpp \
-           ./src/filebrowsermainwindow.cpp \
-           ./src/filebrowserview.cpp \
-           ./src/filebrowsermodel.cpp \
+           ./src/fbmainwindow.cpp \
+           ./src/fbdrivelistviewitem.cpp \
+           ./src/fbdrivemodel.cpp \
+           ./src/fbdriveview.cpp \
+           ./src/fbfilelistviewitem.cpp \
+           ./src/fbfilemodel.cpp \
+           ./src/fbfileview.cpp \
+           ./src/filebrowsersortfilterproxymodel.cpp \
            ./src/settingsview.cpp \
            ./src/editorview.cpp \
            ./src/searchview.cpp \
--- a/filebrowser/ui/ui.qrc	Fri Jun 11 16:29:34 2010 +0100
+++ b/filebrowser/ui/ui.qrc	Thu Jul 22 16:33:59 2010 +0100
@@ -2,5 +2,6 @@
     <qresource prefix="/">
         <file alias="qgn_indi_tb_filebrowser_folder_parent.svg" >../icons/qgn_indi_tb_filebrowser_folder_parent.svg</file>
         <file alias="qgn_indi_tb_filebrowser_find.svg" >../icons/qgn_indi_tb_filebrowser_find.svg</file>
+        <file alias="qgn_indi_tb_filebrowser_selection_active.svg" >../icons/qgn_indi_tb_filebrowser_selection_active.svg</file>
     </qresource>
 </RCC>
--- a/group/bld.inf	Fri Jun 11 16:29:34 2010 +0100
+++ b/group/bld.inf	Thu Jul 22 16:33:59 2010 +0100
@@ -25,6 +25,6 @@
 //Orbit version added #include "../loadgen/group/bld.inf"
 //Orbit version added #include "../perfmon/group/bld.inf"
 //Orbit version added #include "../screengrabber/group/bld.inf"
-#include "../stifui/avkon/group/bld.inf"
+//Orbit version added #include "../stifui/avkon/group/bld.inf"
 //Orbit version added #include "../memspyui/group/bld.inf"
 //Orbit version added #include "../htiui/group/bld.inf"
--- a/htiui/HtiAdmin/data/1020DEB6.rss	Fri Jun 11 16:29:34 2010 +0100
+++ /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	Fri Jun 11 16:29:34 2010 +0100
+++ b/htiui/HtiAdmin/group/HtiAdmin.mmp	Thu Jul 22 16:33:59 2010 +0100
@@ -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/HtiAdmin/inc/HtiAdminAppUi.h	Fri Jun 11 16:29:34 2010 +0100
+++ b/htiui/HtiAdmin/inc/HtiAdminAppUi.h	Thu Jul 22 16:33:59 2010 +0100
@@ -135,6 +135,8 @@
     	void HandleBtSearch();
     	void HandleIPConnect();
     	void HandleIPListen();
+    	
+    	void StartTimer();
 
     private:
 
--- a/htiui/HtiAdmin/src/HtiAdminAppUi.cpp	Fri Jun 11 16:29:34 2010 +0100
+++ b/htiui/HtiAdmin/src/HtiAdminAppUi.cpp	Thu Jul 22 16:33:59 2010 +0100
@@ -109,6 +109,7 @@
     iAppView->SetSelectedCommCaption( KHtiSelectedCommCaption );
     UpdateVersion();
     UpdateStatusL();
+    StartTimer();
     iHtiCfg = CHtiCfg::NewL();
     UpdateAutoStartStatus(); // uses iHtiCfg
     UpdateSelectedComm(); // uses iHtiCfg
@@ -810,6 +811,7 @@
         {
         UpdateStatusL();
         UpdateAutoStartStatus();
+        StartTimer();
         }
     else
         {
@@ -889,15 +891,6 @@
                 {
                 _LIT( KTxt, "Running" );
                 iAppView->SetStatus( KTxt );
-
-                // start timer to watch the status
-                if ( !iPeriodic )
-                    {
-                    iPeriodic = CPeriodic::NewL( CActive::EPriorityStandard );
-                    iPeriodic->Start( 5 * 1000 * 1000,
-                                      5 * 1000 * 1000,
-                                      TCallBack( TimerCallBackL, this ) );
-                    }
                 }
                 break;
 
@@ -906,7 +899,6 @@
                 {
                 _LIT( KTxt, "Stopped" );
                 iAppView->SetStatus( KTxt );
-                KillTimer();
                 }
                 break;
 
@@ -914,16 +906,11 @@
                 {
                 _LIT( KTxt, "Panic" );
                 iAppView->SetStatus( KTxt );
-                KillTimer();
                 }
                 break;
             };
         prs.Close();
         }
-    else
-        {
-        KillTimer();
-        }
     }
 
 void CHtiAdminAppUi::UpdateAutoStartStatus()
@@ -1083,6 +1070,18 @@
         }
     }
 
+void CHtiAdminAppUi::StartTimer()
+    {
+    // start timer to watch the status
+    if ( !iPeriodic )
+        {
+        iPeriodic = CPeriodic::NewL( CActive::EPriorityIdle );
+        iPeriodic->Start( 1 * 1000 * 1000,
+                          10 * 1000 * 1000,
+                          TCallBack( TimerCallBackL, this ) );
+        }
+    }
+
 void CHtiAdminAppUi::KillTimer()
     {
     if ( iPeriodic )
--- a/htiui/HtiAdminQt/HtiAdmin.pro	Fri Jun 11 16:29:34 2010 +0100
+++ b/htiui/HtiAdminQt/HtiAdmin.pro	Thu Jul 22 16:33:59 2010 +0100
@@ -1,19 +1,3 @@
-#
-# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-# All rights reserved.
-# This component and the accompanying materials are made available
-# under the terms of "Eclipse Public License v1.0"
-# which accompanies 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 = HtiAdmin
 DEPENDPATH += .
--- a/htiui/HtiAdminQt/chtiadminengine.cpp	Fri Jun 11 16:29:34 2010 +0100
+++ b/htiui/HtiAdminQt/chtiadminengine.cpp	Thu Jul 22 16:33:59 2010 +0100
@@ -121,6 +121,7 @@
     iHtiCfg = CHtiCfg::NewL();
     
     CheckStatusesL();
+    StartTimer();
     }
 
 // ---------------------------------------------------------------------------
@@ -594,15 +595,6 @@
             case EExitPending:
                 {
                 iEngineWrapper->updateStatus(HtiEngineWrapper::Running);
-		
-                // start timer to watch the status
-                if ( !iPeriodic )
-                    {
-                    iPeriodic = CPeriodic::NewL( CActive::EPriorityStandard );
-                    iPeriodic->Start( 5 * 1000 * 1000,
-                                      5 * 1000 * 1000,
-                                      TCallBack( TimerCallBackL, this ) );
-                    }
                 }
                 break;
 
@@ -610,23 +602,17 @@
             case EExitTerminate:
                 {
                 iEngineWrapper->updateStatus(HtiEngineWrapper::Stopped);
-                KillTimer();
                 }
                 break;
 
             case EExitPanic:
                 {
                 iEngineWrapper->updateStatus(HtiEngineWrapper::Panic);
-                KillTimer();
                 }
                 break;
             };
         prs.Close();
         }
-    else
-        {
-        KillTimer();
-        }
     }
 
 // ---------------------------------------------------------------------------
@@ -647,6 +633,18 @@
     }
 
 // ---------------------------------------------------------------------------
+void CHtiAdminEngine::StartTimer()
+    {
+    // start timer to watch the status
+    if ( !iPeriodic )
+        {
+        iPeriodic = CPeriodic::NewL( CActive::EPriorityIdle );
+        iPeriodic->Start( 1 * 1000 * 1000,
+                          10 * 1000 * 1000,
+                          TCallBack( TimerCallBackL, this ) );
+        }
+    }
+// ---------------------------------------------------------------------------
 void CHtiAdminEngine::KillTimer()
     {
     if ( iPeriodic )
--- a/htiui/HtiAdminQt/chtiadminengine.h	Fri Jun 11 16:29:34 2010 +0100
+++ b/htiui/HtiAdminQt/chtiadminengine.h	Thu Jul 22 16:33:59 2010 +0100
@@ -20,7 +20,7 @@
 
 #include <e32std.h>
 #include <e32base.h>
-#include <BADESCA.H> 
+#include <badesca.h> 
 
 
 class HtiEngineWrapper;
@@ -160,6 +160,8 @@
 		void SetCfgParamL(const TDesC& aParamName, const TDesC& aParamValue, const TDesC& aFileName);
 		void GetCfgParamL(const TDesC& aParamName, TDes& aParamValue, const TDesC& aFileName);
 		
+		void StartTimer();
+		
 	private:
 		// Enginewrapper that is used for communicating between QT and Symbian
 		HtiEngineWrapper* iEngineWrapper;             
--- a/htiui/HtiAdminQt/htienginewrapper.cpp	Fri Jun 11 16:29:34 2010 +0100
+++ b/htiui/HtiAdminQt/htienginewrapper.cpp	Thu Jul 22 16:33:59 2010 +0100
@@ -21,7 +21,7 @@
 
 #include <coecntrl.h>
 #include <QString>
-#include <QLocale.h>
+#include <qlocale.h>
 
 
 #include <HtiVersion.h>
--- a/htiui/HtiAdminQt/htienginewrapper.h	Fri Jun 11 16:29:34 2010 +0100
+++ b/htiui/HtiAdminQt/htienginewrapper.h	Thu Jul 22 16:33:59 2010 +0100
@@ -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	Fri Jun 11 16:29:34 2010 +0100
+++ b/htiui/HtiAdminQt/mainview.cpp	Thu Jul 22 16:33:59 2010 +0100
@@ -23,7 +23,7 @@
 #include <hblabel.h>
 #include <hbinputdialog.h>
 #include <qgraphicslinearlayout.h>
-//#include <HbListDialog.h>
+#include <hbselectiondialog.h>
 #include <hbmessagebox.h>
 
 
@@ -260,200 +260,231 @@
 	mEngineWrapper.stopHti();
 }
 
+
 // ---------------------------------------------------------------------------
 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);
+	openListDialog(mPluginList, curSelection, QString("Select Comm"), this, SLOT(doSelectComm(HbAction*)));
 }
 
+void MainView::doSelectComm(HbAction* action)
+{
+    HbSelectionDialog *dlg = static_cast<HbSelectionDialog*>(sender());
+    if(dlg && dlg->selectedModelIndexes().count() &&
+            (!action || action == dlg->actions().at(0)))
+    {
+        int selectionIndex = dlg->selectedModelIndexes().at(0).row();
+
+        if (mPluginList[selectionIndex] == QString("Bt serial comm"))
+        {
+            enableBTComm();
+        }
+        else if (mPluginList[selectionIndex] == QString("IP comm"))
+        {
+            enableIPComm();
+        }
+        else if (mPluginList[selectionIndex] == QString("SERIAL comm"))
+        {
+            enableSerialComm();
+        }
+        else
+        {
+            //All other comm plugins
+            mEngineWrapper.enableOtherComm(mPluginList[selectionIndex]);
+        }   
+    }    
+}
 // ---------------------------------------------------------------------------
 void MainView::enableSerialComm()
 {
-//	bool ok = false;
-//    QString str = HbInputDialog::getText(
-//					"Set Comm Port number ",
-//					"",
-//					&ok);
-//    
-//    if(ok){
-//    	mEngineWrapper.enableSerial(str);
-//    }
+    QString heading = QString("Set Comm Port number");
+    HbInputDialog::getInteger(heading, this, SLOT(doEnableSerialComm(HbAction*)), 0, scene());
 }
 
-
+void MainView::doEnableSerialComm(HbAction* action)
+{
+    HbInputDialog *dlg = static_cast<HbInputDialog*>(sender());
+    if (action == dlg->actions().at(0))
+    {
+        QString strPortNumber = dlg->value().toString();
+        mEngineWrapper.enableSerial(strPortNumber);
+    }
+}
 // ---------------------------------------------------------------------------
 void MainView::enableIPComm()
 {
     // Get IAPs list
-//    QStringList iapsList;
-//    mEngineWrapper.listIAPs(iapsList); 
-//    if(iapsList.count() == 0)
-//    {
-//        HbMessageBox 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::warning(QString("No IAPs for selection!"));
+        return;
+    }
+    
+    // Get current selection
+    QString curIapName;
+    QString param = "IAPName";
+    mEngineWrapper.getIPCfgParam(param, curIapName);
+    int curSelection = iapsList.indexOf(curIapName, 0);
+    
+    openListDialog(iapsList, curSelection, QString("Select IAP:"), this, SLOT(doSelectIAP(HbAction*)));
+}
+
+void MainView::doSelectIAP(HbAction* action)
+{
+    HbSelectionDialog *dlg = static_cast<HbSelectionDialog*>(sender());
+    if(dlg && dlg->selectedModelIndexes().count() &&
+            (!action || action == dlg->actions().at(0)))
+    {
+        int selectionIndex = dlg->selectedModelIndexes().at(0).row();
+        mIapSelection = dlg->stringItems()[selectionIndex];
+        
+        QStringList items;
+        items <<"Listen" <<"Connect";
+        openListDialog(items, 0, QString("Select IP Comm"), this, SLOT(doSelectIpComm(HbAction*)));
+    }  
+}
+
+void MainView::doSelectIpComm(HbAction* action)
+{
+    HbSelectionDialog *dlg = static_cast<HbSelectionDialog*>(sender());
+    if(dlg && dlg->selectedModelIndexes().count() &&
+            (!action || action == dlg->actions().at(0)))
+    {
+        int selectionIndex = dlg->selectedModelIndexes().at(0).row();
+        if(selectionIndex == 0) //Listen
+        {
+            HbInputDialog::getInteger(QString("Local port"), this, SLOT(doListenOnPort(HbAction*)), 0, scene());
+        }
+        else //Connect
+        {
+            openIPAddressDialog(QString("Remote Host"), this, SLOT(doConnectRemoteHost(HbAction*)));
+        }
+    }
+}
+
+void MainView::doListenOnPort(HbAction* action)
+{
+    HbInputDialog *dlg = static_cast<HbInputDialog*>(sender());
+    if (action == dlg->actions().at(0))
+    {
+        QString port = dlg->value().toString();
+        mEngineWrapper.ipListen(port, mIapSelection);
+    }
+}
+
+void MainView::doConnectRemoteHost(HbAction* action)
+{
+    HbInputDialog *dlg = static_cast<HbInputDialog*>(sender());
+    if (action == dlg->actions().at(0))
+    {
+        QString host = dlg->value(0).toString();
+        QString port = dlg->value(1).toString();
+        mEngineWrapper.ipConnect(host, port, mIapSelection);
+    }
 }
 
 // ---------------------------------------------------------------------------
 void MainView::enableBTComm()
 {
-//	QStringList 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 items;
+	items <<"BT address" <<"BT name" <<"Search when starting" ;
+	openListDialog(items, 0, QString("Bluetooth Comm"), this, SLOT(doSelectBTComm(HbAction*)));
 }
 
+void MainView::doSelectBTComm(HbAction* action)
+{
+    HbSelectionDialog *dlg = static_cast<HbSelectionDialog*>(sender());
+    if(dlg && dlg->selectedModelIndexes().count() &&
+            (!action || action == dlg->actions().at(0)))
+    {
+        int selectionIndex = dlg->selectedModelIndexes().at(0).row();
+        if(selectionIndex == 0)
+        {
+            HbInputDialog::getText(QString("BT address"), this, SLOT(doEnableByBTAddress(HbAction*)));
+        }
+        else if(selectionIndex == 1)
+        {
+            HbInputDialog::getText(QString("BT name"), this, SLOT(doEnableByBTName(HbAction*)));
+        }
+        else if(selectionIndex == 2)
+        {
+            mEngineWrapper.btSearch();
+        }
+    }
+}
+
+void MainView::doEnableByBTAddress(HbAction* action)
+{
+    HbInputDialog *dlg = static_cast<HbInputDialog*>(sender());
+    if (action == dlg->actions().at(0))
+    {
+        QString address = dlg->value().toString();
+        mEngineWrapper.enableBtByAddress(address);
+    }
+}
+void MainView::doEnableByBTName(HbAction* action)
+{
+    HbInputDialog *dlg = static_cast<HbInputDialog*>(sender());
+    if (action == dlg->actions().at(0))
+    {
+        QString name = dlg->value().toString();
+        mEngineWrapper.enableBtByName(name);
+    }
+}
 
 // ---------------------------------------------------------------------------
 void MainView::setPriority()
 {
     // Get current priority
-//    bool ok = false;
-//    QString curPriority;
-//    QString param = "Priority";
-//    mEngineWrapper.getHtiCfgParam(param, curPriority);
-//    int curSelection = curPriority.toInt(&ok);
-//    if(ok){
-//        curSelection--;
-//    }
-//    else{
-//    curSelection = 2;
-//    }
-//    
-//	QStringList 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 items;
+	items <<"Backgroung" <<"Foregound" <<"High" << "Absolute High";
+	openListDialog(items, curSelection, QString("Select Hti Priority"), 
+	        this, SLOT(doSetPriority(HbAction*)));
 }
 
+void MainView::doSetPriority(HbAction* action)
+{
+    HbSelectionDialog *dlg = static_cast<HbSelectionDialog*>(sender());
+    if(dlg && dlg->selectedModelIndexes().count() &&
+            (!action || action == dlg->actions().at(0)))
+    {
+        int selectionIndex = dlg->selectedModelIndexes().at(0).row();
+        if(selectionIndex == 0)
+        {
+            mEngineWrapper.setPriorityBackground();
+        }
+        else if(selectionIndex == 1)
+        {
+            mEngineWrapper.setPriorityForeground();
+        }
+        else if(selectionIndex == 2)
+        {
+            mEngineWrapper.setPriorityHigh();
+        }
+        else
+        {
+            mEngineWrapper.setPriorityAbsoluteHigh();
+        }
+    }
+}
 // ---------------------------------------------------------------------------
 void MainView::enableAutoStart()
 {
@@ -493,62 +524,203 @@
 // ---------------------------------------------------------------------------
 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 items;
+    items << "Hti.cfg" << "HtiBtComm.cfg" << "HtiSerialComm.cfg" << "HtiIPComm.cfg";
+    openListDialog(items, 0, QString("Select cfg file to modify"), 
+            this, SLOT(doSelectCfgFile(HbAction*)));
+}
+
+void MainView::doSelectCfgFile(HbAction* action)
+{
+    HbSelectionDialog *dlg = static_cast<HbSelectionDialog*>(sender());
+    if(dlg && dlg->selectedModelIndexes().count() &&
+            (!action || action == dlg->actions().at(0)))
+    {
+        int selectionIndex = dlg->selectedModelIndexes().at(0).row();
+        QStringList items;
+        if(selectionIndex == 0)
+        {
+            items <<"CommPlugin" <<"MaxMsgSize" <<"MaxQueueSize" <<"MaxHeapSize"<<"Priority"
+                    <<"ShowConsole"<<"MaxWaitTime"<<"StartUpDelay"<<"EnableHtiWatchDog"
+                    <<"EnableHtiAutoStart"<<"ShowErrorDialogs"<<"ReconnectDelay";
+            openListDialog(items, 0, QString("Hti.cfg"), this, SLOT(doModifyHtiCfgFile(HbAction*)));
+        }
+        else if(selectionIndex == 1)
+        {
+            items <<"BtDeviceName" <<"BtDeviceName";
+            openListDialog(items, 0, QString("HtiBtComm.cfg"), this, SLOT(doModifyBtCfgFile(HbAction*)));
+        }
+        else if(selectionIndex == 2)
+        {
+            items <<"CommPort" <<"DataRate"<<"Parity"<<"DataBits"<<"StopBits"<<"SendDelay"<<"Handshake";
+            openListDialog(items, 0, QString("HtiSerialComm.cfg"), this, SLOT(doModifySerialCfgFile(HbAction*)));
+        }
+        else
+        {
+            items <<"IAPName"<<"LocalPort"<<"RemoteHost"<<"RemotePort"<<"ConnectTimeout";
+            openListDialog(items, 0, QString("HtiIPComm.cfg"), this, SLOT(doModifyIPCfgFile(HbAction*)));
+        }
+    }
+}
+
+void MainView::doModifyHtiCfgFile(HbAction* action)
+{
+    HbSelectionDialog *dlgSelection = static_cast<HbSelectionDialog*>(sender());
+    if(dlgSelection && dlgSelection->selectedModelIndexes().count() &&
+            (!action || action == dlgSelection->actions().at(0)))
+    {
+        int selectionIndex = dlgSelection->selectedModelIndexes().at(0).row();
+        HbInputDialog* dlgInput = new HbInputDialog();
+        dlgInput->setAttribute(Qt::WA_DeleteOnClose);
+        dlgInput->setPromptText(dlgSelection->stringItems()[selectionIndex]);
+        dlgInput->setInputMode(HbInputDialog::TextInput);
+        
+        HbLabel *title = new HbLabel(dlgInput);
+        title->setPlainText(QString("Set parameter value"));
+        dlgInput->setHeadingWidget(title);
+        
+        dlgInput->open(this, SLOT(doSetHtiCfgParameter(HbAction*)));
+    }
+}
+
+void MainView::doSetHtiCfgParameter(HbAction* action)
+{
+    HbInputDialog *dlg = static_cast<HbInputDialog*>(sender());
+    if (action == dlg->actions().at(0))
+    {
+        QString parameter = dlg->promptText();
+        QString value = dlg->value().toString();
+        mEngineWrapper.setHtiCfgParam(parameter, value);
+    }
+}
+
+void MainView::doModifyBtCfgFile(HbAction* action)
+{
+    HbSelectionDialog *dlgSelection = static_cast<HbSelectionDialog*>(sender());
+    if(dlgSelection && dlgSelection->selectedModelIndexes().count() &&
+            (!action || action == dlgSelection->actions().at(0)))
+    {
+        int selectionIndex = dlgSelection->selectedModelIndexes().at(0).row();
+        HbInputDialog* dlgInput = new HbInputDialog();
+        dlgInput->setAttribute(Qt::WA_DeleteOnClose);
+        dlgInput->setPromptText(dlgSelection->stringItems()[selectionIndex]);
+        dlgInput->setInputMode(HbInputDialog::TextInput);
+        
+        HbLabel *title = new HbLabel(dlgInput);
+        title->setPlainText(QString("Set parameter value"));
+        dlgInput->setHeadingWidget(title);
+        
+        dlgInput->open(this, SLOT(doSetBtCfgParameter(HbAction*)));
+    }
 }
 
+void MainView::doSetBtCfgParameter(HbAction* action)
+{
+    HbInputDialog *dlg = static_cast<HbInputDialog*>(sender());
+    if (action == dlg->actions().at(0))
+    {
+        QString parameter = dlg->promptText();
+        QString value = dlg->value().toString();
+        mEngineWrapper.setBtCfgParam(parameter, value);
+    }
+}
 
+void MainView::doModifySerialCfgFile(HbAction* action)
+{
+    HbSelectionDialog *dlgSelection = static_cast<HbSelectionDialog*>(sender());
+    if(dlgSelection && dlgSelection->selectedModelIndexes().count() &&
+            (!action || action == dlgSelection->actions().at(0)))
+    {
+        int selectionIndex = dlgSelection->selectedModelIndexes().at(0).row();
+        HbInputDialog* dlgInput = new HbInputDialog();
+        dlgInput->setAttribute(Qt::WA_DeleteOnClose);
+        dlgInput->setPromptText(dlgSelection->stringItems()[selectionIndex]);
+        dlgInput->setInputMode(HbInputDialog::TextInput);
+        
+        HbLabel *title = new HbLabel(dlgInput);
+        title->setPlainText(QString("Set parameter value"));
+        dlgInput->setHeadingWidget(title);
+        
+        dlgInput->open(this, SLOT(doSetSerialCfgParameter(HbAction*)));
+    }
+}
+
+void MainView::doSetSerialCfgParameter(HbAction* action)
+{
+    HbInputDialog *dlg = static_cast<HbInputDialog*>(sender());
+    if (action == dlg->actions().at(0))
+    {
+        QString parameter = dlg->promptText();
+        QString value = dlg->value().toString();
+        mEngineWrapper.setSerialCfgParam(parameter, value);
+    }
+}
+
+void MainView::doModifyIPCfgFile(HbAction* action)
+{
+    HbSelectionDialog *dlgSelection = static_cast<HbSelectionDialog*>(sender());
+    if(dlgSelection && dlgSelection->selectedModelIndexes().count() &&
+            (!action || action == dlgSelection->actions().at(0)))
+    {
+        int selectionIndex = dlgSelection->selectedModelIndexes().at(0).row();
+        HbInputDialog* dlgInput = new HbInputDialog();
+        dlgInput->setAttribute(Qt::WA_DeleteOnClose);
+        dlgInput->setPromptText(dlgSelection->stringItems()[selectionIndex]);
+        dlgInput->setInputMode(HbInputDialog::TextInput);
+        
+        HbLabel *title = new HbLabel(dlgInput);
+        title->setPlainText(QString("Set parameter value"));
+        dlgInput->setHeadingWidget(title);
+        
+        dlgInput->open(this, SLOT(doSetIPCfgParameter(HbAction*)));
+    }
+}
+
+void MainView::doSetIPCfgParameter(HbAction* action)
+{
+    HbInputDialog *dlg = static_cast<HbInputDialog*>(sender());
+    if (action == dlg->actions().at(0))
+    {
+        QString parameter = dlg->promptText();
+        QString value = dlg->value().toString();
+        mEngineWrapper.setIPCfgParam(parameter, value);
+    }
+}
+
+void MainView::openListDialog(const QStringList& items, const int currentSelection,
+        const QString &titleText, QObject* receiver, const char* member)
+{
+    // Create a list and some simple content for it
+    HbSelectionDialog *dlg = new HbSelectionDialog();
+    dlg->setAttribute(Qt::WA_DeleteOnClose);
+    // Set items to be popup's content
+    dlg->setStringItems(items);
+    dlg->setSelectionMode(HbAbstractItemView::SingleSelection);
+    QList<QVariant> current;
+    current.append(QVariant(currentSelection));
+    dlg->setSelectedItems(current);
+    
+    HbLabel *title = new HbLabel(dlg);
+    title->setPlainText(titleText);
+    dlg->setHeadingWidget(title);
+
+    // Launch popup and handle the user response:
+    dlg->open(receiver, member);
+}
+
+void MainView::openIPAddressDialog(const QString &titleText, QObject* receiver, const char* member)
+{
+    HbInputDialog* dlg = new HbInputDialog();
+    dlg->setAttribute(Qt::WA_DeleteOnClose);
+    dlg->setAdditionalRowVisible(true);
+    dlg->setPromptText(QString("IP Address:"), 0);
+    dlg->setInputMode(HbInputDialog::IpInput, 0);
+    dlg->setPromptText(QString("Port:"), 1);
+    dlg->setInputMode(HbInputDialog::IntInput, 1);
+    
+    HbLabel *title = new HbLabel(dlg);
+    title->setPlainText(titleText);
+    dlg->setHeadingWidget(title);
+    
+    dlg->open(receiver, member);
+}
--- a/htiui/HtiAdminQt/mainview.h	Fri Jun 11 16:29:34 2010 +0100
+++ b/htiui/HtiAdminQt/mainview.h	Thu Jul 22 16:33:59 2010 +0100
@@ -84,8 +84,26 @@
 	void enableConsole();
 	void disableConsole();
 	void showParamList ();
-	
 
+	void doSelectComm(HbAction*);
+	void doEnableSerialComm(HbAction* );
+	void doSelectIAP(HbAction* );
+	void doSelectIpComm(HbAction* );
+	void doListenOnPort(HbAction* );
+	void doConnectRemoteHost(HbAction*);
+	void doSelectBTComm(HbAction*);
+	void doEnableByBTAddress(HbAction*);
+	void doEnableByBTName(HbAction*);
+	void doSetPriority(HbAction*);
+	void doSelectCfgFile(HbAction*);
+	void doModifyHtiCfgFile(HbAction*);
+	void doModifyBtCfgFile(HbAction*);
+	void doModifySerialCfgFile(HbAction*);
+	void doModifyIPCfgFile(HbAction*);
+	void doSetHtiCfgParameter(HbAction*);
+	void doSetBtCfgParameter(HbAction*);
+	void doSetSerialCfgParameter(HbAction*);
+	void doSetIPCfgParameter(HbAction*);
 private:
     
     /**
@@ -99,6 +117,10 @@
     void createToolbar();
     
     void createTexts();
+    
+    void openListDialog(const QStringList& items, const int currentSelection, 
+            const QString &titleText, QObject* receiver, const char* member);
+    void openIPAddressDialog(const QString &titleText, QObject* receiver, const char* member);
 	
 public:
     
@@ -130,6 +152,8 @@
     HbLabel* mCommDetailsTxt;
     
     QStringList mPluginList;
+    
+    QString mIapSelection;
 
 };
 
--- a/htiui/HtiDeviceReboot/src/HtiDeviceReboot.cpp	Fri Jun 11 16:29:34 2010 +0100
+++ b/htiui/HtiDeviceReboot/src/HtiDeviceReboot.cpp	Thu Jul 22 16:33:59 2010 +0100
@@ -80,7 +80,7 @@
                 }
             else
                 {
-                error = Reboot((RStarterSession::TResetReason)input);
+                error = Reboot(static_cast<RStarterSession::TResetReason>(input));
                 }
             }
         }
--- a/htiui/HtiServicePlugins/HtiAppServicePlugin/group/HtiAppControl.mmp	Fri Jun 11 16:29:34 2010 +0100
+++ b/htiui/HtiServicePlugins/HtiAppServicePlugin/group/HtiAppControl.mmp	Thu Jul 22 16:33:59 2010 +0100
@@ -43,7 +43,12 @@
 LIBRARY     apparc.lib
 LIBRARY     apmime.lib
 LIBRARY     ws32.lib
+#if ( SYMBIAN_VERSION_SUPPORT < SYMBIAN_4 )
 LIBRARY     swinstcli.lib
+#else
+LIBRARY     sif.lib       // USIF
+LIBRARY     scrclient.lib // SCR
+#endif
 LIBRARY     sisregistryclient.lib
 LIBRARY     javaregistryclient.lib
 LIBRARY     widgetregistryclient.lib
--- a/htiui/HtiServicePlugins/HtiAppServicePlugin/inc/HtiAppControl.h	Fri Jun 11 16:29:34 2010 +0100
+++ b/htiui/HtiServicePlugins/HtiAppServicePlugin/inc/HtiAppControl.h	Thu Jul 22 16:33:59 2010 +0100
@@ -22,11 +22,17 @@
 #define HTIAPPSERVICEPLUGIN_H__
 
 //  INCLUDES
+#include "../../../symbian_version.hrh"
+
 #include <e32base.h>
 #include <apgcli.h>
 #include <w32std.h>
+#if ( SYMBIAN_VERSION_SUPPORT < SYMBIAN_4 )
 #include <SWInstDefs.h>
 #include <swi/sisregistryentry.h>
+#else
+#include <usif/usifcommon.h>
+#endif
 #include <HtiServicePluginInterface.h>
 
 // CONSTANTS
@@ -155,8 +161,14 @@
     TInt OpenProcessL( RProcess& aProcess, const TDesC& aMatch );
     TInt OpenProcessL( RProcess& aProcess, const TUint32 aProcessId );
 
+#if ( SYMBIAN_VERSION_SUPPORT < SYMBIAN_4 )
     SwiUI::TPolicy ConvertToPolicy( const TInt8 aValue );
     TInt GetPackageUidL( const TDesC& aPackageName, TInt aMimeIndex );
+#else
+    Usif::TSifPolicy ConvertToSifPolicy( const TInt8 aValue );
+    TInt GetComponentIdFromUid(const TInt32 aUid);
+    TInt GetComponentIdFromPackageName(const TDesC& aPackageName);
+#endif
 
     TBool ValidateInstallParams( const TDesC8& aParams, TBool aIsUnicode );
 
@@ -199,12 +211,14 @@
     // possible mimetypes for silent software uninstallation
     CDesC8ArrayFlat* iMimeTypes;
 
+#if ( SYMBIAN_VERSION_SUPPORT < SYMBIAN_4 )
     SwiUI::TInstallOptions iInstOpts;
     SwiUI::TInstallOptionsPckg iInstOptsPckg;
     SwiUI::TUninstallOptions iUnInstOpts;
     SwiUI::TUninstallOptionsPckg iUnInstOptsPckg;
     RPointerArray<Swi::CSisRegistryPackage> iAugmentations;
     TInt iAugmentationIndex;
+#endif
     };
 
 #endif
--- a/htiui/HtiServicePlugins/HtiAppServicePlugin/src/HtiAppControl.cpp	Fri Jun 11 16:29:34 2010 +0100
+++ b/htiui/HtiServicePlugins/HtiAppServicePlugin/src/HtiAppControl.cpp	Thu Jul 22 16:33:59 2010 +0100
@@ -17,8 +17,6 @@
 
 
 // INCLUDE FILES
-#include "../../../symbian_version.hrh"
-
 #include <apacmdln.h>
 #include <apgtask.h>
 #include <apgwgnam.h>
@@ -31,13 +29,27 @@
 #include <HtiDispatcherInterface.h>
 #include <HtiLogging.h>
 
+#if ( SYMBIAN_VERSION_SUPPORT < SYMBIAN_4 )
 #include <SWInstApi.h>
 #include <swi/sisregistrysession.h>
 #include <swi/sisregistrypackage.h>
+#else
+#include <usif/sif/sif.h>
+#include <usif/scr/scr.h>    //RSoftwareComponentRegistry
+#endif
 #include <javaregistryincludes.h>
-#include <widgetregistryclient.h>
+#include <WidgetRegistryClient.h>
 
 using namespace Java;
+#if ( SYMBIAN_VERSION_SUPPORT >= SYMBIAN_4 )
+_LIT8( KSisxMimeType, "x-epoc/x-sisx-app" );
+_LIT8( KSisMimeType, "application/vnd.symbian.install" );
+_LIT8( KPipMimeType, "application/x-pip" );
+_LIT8( KJadMIMEType, "text/vnd.sun.j2me.app-descriptor" );
+_LIT8( KJarMIMEType, "application/java-archive" );
+_LIT8( KJavaMIMEType, "application/java");
+_LIT8( KJarxMIMEType, "application/x-java-archive");
+#endif
 
 // CONSTANTS
 const static TUid KAppServiceUid = { 0x1020DEC7 }; //This is Uid of AppServiceOS
@@ -57,7 +69,9 @@
 _LIT8( KErrDescrFailedInstall, "Failed to install" );
 _LIT8( KErrDescrFailedUnInstall, "Failed to uninstall" );
 _LIT8( KErrDescrFailedFindPackage, "Failed to find the package" );
-
+#if ( SYMBIAN_VERSION_SUPPORT >= SYMBIAN_4 )
+_LIT8( KErrDescrBadComponentId, "Bad component id");
+#endif
 _LIT8( KErrDescrFailedListInstApps, "Failed to list installed apps" );
 
 const static TUint8 KUnicodeMask = 0x01;
@@ -114,7 +128,9 @@
         delete iMimeTypes;
         }
 
+#if ( SYMBIAN_VERSION_SUPPORT < SYMBIAN_4 )
     iAugmentations.ResetAndDestroy();
+#endif
 
     HTI_LOG_FUNC_OUT( "~CHtiAppControl" );
     }
@@ -124,6 +140,7 @@
     {
     HTI_LOG_FUNC_IN( "CHtiAppControl::ConstructL" );
     iMimeTypes = new (ELeave) CDesC8ArrayFlat( 8 );
+#if ( SYMBIAN_VERSION_SUPPORT < SYMBIAN_4 )
     iMimeTypes->AppendL( SwiUI::KSisxMimeType() );
     iMimeTypes->AppendL( SwiUI::KSisMimeType() );
     iMimeTypes->AppendL( SwiUI::KPipMimeType() );
@@ -131,8 +148,19 @@
     iMimeTypes->AppendL( SwiUI::KJarMIMEType() );
     iMimeTypes->AppendL( SwiUI::KJavaMIMEType() );
     iMimeTypes->AppendL( SwiUI::KJarxMIMEType() );
+#else
+    iMimeTypes->AppendL( KSisxMimeType() );
+    iMimeTypes->AppendL( KSisMimeType() );
+    iMimeTypes->AppendL( KPipMimeType() );
+    iMimeTypes->AppendL( KJadMIMEType() );
+    iMimeTypes->AppendL( KJarMIMEType() );
+    iMimeTypes->AppendL( KJavaMIMEType() );
+    iMimeTypes->AppendL( KJarxMIMEType() );
+#endif
     iMimeTypes->AppendL( KWidgetMime() ); // from widgetregistryconstants.h
+#if ( SYMBIAN_VERSION_SUPPORT < SYMBIAN_4 )
     iAugmentationIndex = 0;
+#endif
 
     TInt err = iAppServer.Connect();
     if ( err == KErrNone )
@@ -566,8 +594,10 @@
     HTI_LOG_FORMAT( "Unicode flag: %d", unicode );
 
     TFileName path;
+#if ( SYMBIAN_VERSION_SUPPORT < SYMBIAN_4 )
     TBuf<SwiUI::KSWInstMaxPasswordLength> login;
     TBuf<SwiUI::KSWInstMaxPasswordLength> password;
+#endif
 
     switch ( aMessage[0] )
         {
@@ -584,6 +614,7 @@
 
                 if ( offset >= 0)
                     {
+#if ( SYMBIAN_VERSION_SUPPORT < SYMBIAN_4 )
                     iInstOpts = SwiUI::TInstallOptions();
 
                     iInstOpts.iUpgrade =            ConvertToPolicy( parameters[offset] ); offset++;
@@ -622,7 +653,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 );
@@ -651,6 +701,156 @@
 
                     launcher.Close();
                     SendMessageL( EOk );
+#else
+                    HTI_LOG_TEXT( "============RSoftwareInstall::Install=============" );
+                    Usif::RSoftwareInstall installer;
+                    TInt err = installer.Connect();
+                    if(err)
+                        {
+                        SendErrorMsg( err , KErrDescrFailedConnectSilentInstaller );
+                        HTI_LOG_FORMAT("cannot connect to SIF server, err %d", err);
+                        User::Leave(err);
+                        }
+                    CleanupClosePushL(installer);
+                    TRequestStatus status;
+                    Usif::COpaqueNamedParams *arguments = Usif::COpaqueNamedParams::NewL();
+                    CleanupStack::PushL(arguments);
+                    Usif::COpaqueNamedParams *results = Usif::COpaqueNamedParams::NewL();
+                    CleanupStack::PushL(results);
+                    
+                    arguments->AddIntL(Usif::KSifInParam_InstallSilently, ETrue);
+                    
+                    TInt intValue = ConvertToSifPolicy(parameters[offset]); offset++;
+                    if(intValue != Usif::EAllowed)
+                        arguments->AddIntL(Usif::KSifInParam_AllowUpgrade, intValue);
+                    HTI_LOG_FORMAT( "iUpgrade: %d", intValue );
+                    intValue = ConvertToSifPolicy(parameters[offset]); offset++; 
+                    if(intValue != Usif::EAllowed)
+                        arguments->AddIntL(Usif::KSifInParam_InstallOptionalItems, intValue);
+                    HTI_LOG_FORMAT( "iOptionalItems: %d", intValue );
+                    intValue = ConvertToSifPolicy(parameters[offset]); offset++;
+                    if(intValue != Usif::EAllowed)
+                        arguments->AddIntL(Usif::KSifInParam_PerformOCSP, intValue);
+                    HTI_LOG_FORMAT( "iOCSP: %d", intValue );
+                    intValue = ConvertToSifPolicy(parameters[offset]); offset++;
+                    if(intValue != Usif::EAllowed)
+                        arguments->AddIntL(Usif::KSifInParam_IgnoreOCSPWarnings, intValue);
+                    HTI_LOG_FORMAT( "iIgnoreOCSPWarnings: %d", intValue );
+                    intValue = ConvertToSifPolicy(parameters[offset]); offset++;
+                    if(intValue != Usif::ENotAllowed)
+                        arguments->AddIntL(Usif::KSifInParam_AllowUntrusted, intValue);
+                    HTI_LOG_FORMAT( "iUntrusted: %d", intValue );
+                    intValue = ConvertToSifPolicy(parameters[offset]); offset++;
+                    if(intValue != Usif::EAllowed)
+						arguments->AddIntL(Usif::KSifInParam_PackageInfo, intValue);
+                    HTI_LOG_FORMAT( "iPackageInfo: %d", intValue );
+                    intValue = ConvertToSifPolicy(parameters[offset]); offset++;
+                    if(intValue != Usif::EAllowed)
+                        arguments->AddIntL(Usif::KSifInParam_GrantCapabilities,intValue);
+                    HTI_LOG_FORMAT( "iCapabilities: %d", intValue );
+                    intValue = ConvertToSifPolicy(parameters[offset]); offset++;
+                    if(intValue != Usif::EAllowed)
+                        arguments->AddIntL(Usif::KSifInParam_AllowAppShutdown,intValue);
+                    HTI_LOG_FORMAT( "iKillApp: %d", intValue );
+                    intValue = ConvertToSifPolicy(parameters[offset]); offset++;
+                    if(intValue != Usif::EAllowed)
+                        arguments->AddIntL(Usif::KSifInParam_AllowOverwrite,intValue);
+                    HTI_LOG_FORMAT( "iOverwrite: %d", intValue );
+                    intValue = ConvertToSifPolicy(parameters[offset]); offset++;
+                    if(intValue != Usif::EAllowed)
+                        arguments->AddIntL(Usif::KSifInParam_AllowDownload, intValue);
+                    HTI_LOG_FORMAT( "iDownload: %d", intValue );
+
+                    TBuf<32> login;
+                    offset = ParseString( parameters, offset, unicode, login );
+                    HTI_LOG_FORMAT( "login length: %d", login.Length() );
+                    if(login != KNullDesC)
+                        {
+                        arguments->AddStringL(Usif::KSifInParam_UserName, login);
+                        }
+                    HTI_LOG_TEXT( "Parsed login:" );
+                    HTI_LOG_DES( login )
+
+                    TBuf<32> password;
+                    offset = ParseString( parameters, offset, unicode, password );
+                    HTI_LOG_FORMAT( "password length: %d", password.Length() );
+                    if(password != KNullDesC)
+                        {
+                        arguments->AddStringL(Usif::KSifInParam_Password, password );
+                        }
+                    HTI_LOG_TEXT( "Parsed password:" );
+                    HTI_LOG_DES( password )
+
+                    TChar driver = (TChar) parameters[offset]; offset++;
+                    if(driver >= 'A' && driver <= 'Z')
+                        {
+                        intValue = driver - (TChar)'A';
+                        arguments->AddIntL(Usif::KSifInParam_Drive, intValue);
+                        HTI_LOG_FORMAT( "iDrive: %c", intValue + 'a' );
+                        }
+                    else if(driver >= 'a' && driver <= 'z')
+                        {
+                        intValue = driver - (TChar)'a';
+                        arguments->AddIntL(Usif::KSifInParam_Drive, intValue);
+                        HTI_LOG_FORMAT( "iDrive: %c", intValue + 'a' );
+                        }
+
+                    TLanguage oldFormatLanuage = (TLanguage)parameters[offset]; offset++;
+
+                    TBool usePhoneLang = (TBool)parameters[offset]; offset++;
+                    HTI_LOG_FORMAT( "iUsePhoneLang: %d", usePhoneLang );
+
+                    intValue =  ConvertToSifPolicy( parameters[offset] );offset++;
+                    /*if(intValue != Usif::EAllowed)
+                        arguments->AddIntL(Usif::KSifInParam_AllowUpgrade, intValue);*/
+                    HTI_LOG_FORMAT( "iUpgradeData: %d",  intValue ); 
+                    
+                    HTI_LOG_FORMAT( "parameters length: %d", parameters.Length());
+                    HTI_LOG_FORMAT( "next offset: %d", offset);
+
+                    if(usePhoneLang == EFalse)
+                        {
+                        if(parameters.Length() > offset)
+                            {
+                            TLanguage language = ELangTest;
+                            if (parameters.Length() == offset+2)
+                                {
+                                language = (TLanguage)(parameters[offset] + (parameters[offset+1]<<8));
+                                }
+                            else if (parameters.Length() == offset+1)
+                                {
+                                language = (TLanguage)(parameters[offset]);
+                                }
+                            if ((language > ELangTest) && (language < ELangMaximum))
+                                {
+                                arguments->AddIntL(Usif::KSifInParam_Languages, language);
+                                HTI_LOG_FORMAT( "iLang: %d", language );
+                                }
+                            }
+                        else
+                            {
+                            arguments->AddIntL(Usif::KSifInParam_Languages, oldFormatLanuage);
+                            HTI_LOG_FORMAT( "iLang0: %d", oldFormatLanuage );
+                            }
+                        }
+
+                    installer.Install(path, *arguments, *results, status);
+                    User::WaitForRequest(status);
+                    HTI_LOG_FORMAT("install status: %d", status.Int());
+                    TInt componentId = 0;
+                    TBool idExisted = results->GetIntByNameL(Usif::KSifOutParam_ComponentId, componentId);
+                    if ( idExisted )
+                        {
+                        HTI_LOG_FORMAT( "componentId:%d", componentId);
+                        }
+                    CleanupStack::PopAndDestroy(3);
+                    if (status != KErrNone)
+                        {
+                        SendErrorMsg( status.Int(), KErrDescrFailedInstall );
+                        break;
+                        }
+                    SendMessageL( EOk );
+#endif
                     }
                 else
                     {
@@ -685,11 +885,39 @@
             TInt offset = 0;
             TInt32 uid = KErrNotFound;
             HBufC* packageName = NULL;
+#if ( SYMBIAN_VERSION_SUPPORT >= SYMBIAN_4 )
+            Usif::TComponentId cid = KErrNotFound; 
+            HTI_LOG_TEXT( "============RSoftwareInstall::Uninstall=============" );
+            Usif::RSoftwareInstall installer;
+            TInt err = installer.Connect();
+            if(err)
+                {
+                SendErrorMsg( err , KErrDescrFailedConnectSilentInstaller );
+                HTI_LOG_FORMAT("cannot connect to SIF server, err %d", err);
+                User::Leave(err);
+                }
+            CleanupClosePushL(installer);
+            TRequestStatus status;
+            Usif::COpaqueNamedParams *arguments = Usif::COpaqueNamedParams::NewL();
+            CleanupStack::PushL(arguments);
+            Usif::COpaqueNamedParams *results = Usif::COpaqueNamedParams::NewL();
+            CleanupStack::PushL(results);
+#endif
             if ( aMessage[0] == EUnInstall )
                 {
                 uid = Parse32<TInt32>( parameters );
                 offset += 4;
                 HTI_LOG_FORMAT( "Uninstall by uid: %d", uid );
+#if ( SYMBIAN_VERSION_SUPPORT >= SYMBIAN_4 )
+                cid = GetComponentIdFromUid(uid);
+                if ( cid == KErrNotFound )
+                    {
+                    HTI_LOG_FORMAT( "cid: %d", cid );
+                    SendErrorMsg( KErrNotFound, KErrDescrBadComponentId );
+                    CleanupStack::PopAndDestroy(3); //results, arguments, installer
+                    break;
+                    }
+#endif
                 }
             else
                 {
@@ -697,7 +925,19 @@
                 TPtr namePtr = packageName->Des();
                 offset = ParseString( parameters, offset, unicode, namePtr );
                 HTI_LOG_FORMAT( "Uninstall by name: %S", packageName );
+#if ( SYMBIAN_VERSION_SUPPORT >= SYMBIAN_4 )
+                cid = GetComponentIdFromPackageName(*packageName);
+                CleanupStack::PopAndDestroy(); // packageName
+                if ( cid == KErrNotFound )
+                    {
+                    HTI_LOG_FORMAT( "cid: %d", cid );
+                    SendErrorMsg( KErrNotFound, KErrDescrFailedFindPackage );
+                    CleanupStack::PopAndDestroy(3); //results, arguments, installer
+                    break;
+                    }
+#endif
                 }
+#if ( SYMBIAN_VERSION_SUPPORT < SYMBIAN_4 )
             iUnInstOpts = SwiUI::TUninstallOptions();
             iUnInstOpts.iKillApp = ConvertToPolicy( parameters[offset] );
             offset++;
@@ -769,6 +1009,48 @@
                 }
 
             launcher.Close();
+#else
+            
+            TInt intValue = ConvertToSifPolicy( parameters[offset] );
+            offset++;
+            arguments->AddIntL(Usif::KSifInParam_AllowAppShutdown, intValue);
+            HTI_LOG_FORMAT( "iKillApp: %d", intValue );
+            intValue = ConvertToSifPolicy( parameters[offset] );
+            offset++;
+            arguments->AddIntL(Usif::KSifInParam_AllowAppBreakDependency, intValue);
+            HTI_LOG_FORMAT( "iBreakDependency: %d", intValue );
+
+            TInt mimeIndex = parameters[offset];
+            if ( mimeIndex > iMimeTypes->Count() - 1 )
+                {
+                HTI_LOG_FORMAT( "Invalid mime type: %d", mimeIndex );
+                SendErrorMsg( KErrArgument, KErrDescrInvalidCmd );
+                break;
+                }
+
+            HTI_LOG_TEXT( "Uninstall mime type:" );
+            HTI_LOG_DES( (*iMimeTypes)[mimeIndex] );
+
+            HBufC* buf = HBufC::NewLC((*iMimeTypes)[mimeIndex].Length());
+            TPtr ptr = buf->Des();
+            ptr.Copy((*iMimeTypes)[mimeIndex]);
+            arguments->AddStringL(Usif::KSifInParam_MimeType, *buf);
+            CleanupStack::PopAndDestroy(); // buf
+      
+            HTI_LOG_FORMAT( "Component ID = %d", cid );
+            
+            arguments->AddIntL(Usif::KSifInParam_InstallSilently, ETrue);
+            
+            installer.Uninstall(cid, *arguments, *results, status, EFalse);
+            User::WaitForRequest(status);
+            HTI_LOG_FORMAT("uninstall status:%d", status.Int());
+            CleanupStack::PopAndDestroy(3); //results, arguments, installer
+            if (status != KErrNone)
+                {
+                SendErrorMsg(status.Int(), KErrDescrFailedUnInstall);
+                break;
+                }            
+#endif
             SendMessageL( EOk );
             }
             break;
@@ -1505,15 +1787,25 @@
                                                KAppServiceUid );
     }
 
+#if ( SYMBIAN_VERSION_SUPPORT < SYMBIAN_4 )
 SwiUI::TPolicy CHtiAppControl::ConvertToPolicy( const TInt8 aValue )
     {
     if ( aValue == 0 ) return SwiUI::EPolicyNotAllowed;
 
     return  SwiUI::EPolicyAllowed;
     }
+#else
+Usif::TSifPolicy CHtiAppControl::ConvertToSifPolicy( const TInt8 aValue )
+    {
+    if ( aValue == 0 ) return Usif::ENotAllowed;
+
+    return  Usif::EAllowed;    
+    }
+#endif
 
 TBool CHtiAppControl::ValidateInstallParams( const TDesC8& aParams, TBool aIsUnicode )
     {
+    HTI_LOG_FORMAT( "ValidateInstallParams => length: %d", aParams.Length() );
     if ( aParams.Length() > 0 )
         {
         TInt offset = 0;
@@ -1558,7 +1850,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;
@@ -1570,6 +1862,7 @@
     return EFalse;
     }
 
+#if ( SYMBIAN_VERSION_SUPPORT < SYMBIAN_4 )
 TInt CHtiAppControl::GetPackageUidL( const TDesC& aPackageName,
                                           TInt aMimeIndex )
     {
@@ -1714,6 +2007,88 @@
 
     return KErrNone; // never returns from here
     }
-
+#else
+TInt CHtiAppControl::GetComponentIdFromUid(const TInt32 aUid)
+    {
+    TInt cid = KErrNotFound;
+    Usif::RSoftwareComponentRegistry registry;
+    User::LeaveIfError(registry.Connect());
+    CleanupClosePushL(registry);
+    RArray<TUid> uidList;
+    CleanupClosePushL(uidList);
+    RArray<Usif::TComponentId> componentIdList;
+    CleanupClosePushL(componentIdList);
+    registry.GetComponentIdsL(componentIdList);
+    for(TInt i = 0; i < componentIdList.Count(); i++)
+        {
+        Usif::TComponentId compId = componentIdList[i];
+        Usif::CComponentEntry *compEntry = Usif::CComponentEntry::NewLC();
+        if(registry.GetComponentL(compId, *compEntry))
+            {
+            /*if(compEntry->IsRemovable() && 
+                 compEntry->SoftwareType() == Usif::KSoftwareTypeNative)*/
+            if(compEntry->IsRemovable())
+                {
+                _LIT(KCompUid, "CompUid");
+                Usif::CPropertyEntry *property = 
+                    registry.GetComponentPropertyL(compId, KCompUid);
+                CleanupStack::PushL(property);
+                Usif::CIntPropertyEntry* intProperty = 
+                    dynamic_cast<Usif::CIntPropertyEntry*>(property);
+                uidList.AppendL(TUid::Uid(intProperty->IntValue()));
+                CleanupStack::PopAndDestroy(property);
+                }
+            else
+                {
+                uidList.AppendL(KNullUid);
+                }
+            }
+        CleanupStack::PopAndDestroy( compEntry );
+        }
+    TUid tuid(TUid::Uid(aUid));
+    if(tuid != KNullUid)
+        {
+        TInt index = uidList.Find(tuid);
+        if(index >= 0 && index < componentIdList.Count())
+            {
+            cid = componentIdList[index];
+            }
+        }
+        CleanupStack::PopAndDestroy( 3, &registry );// componentIdList, uidList, registry
+        return cid;
+    }
 
+TInt CHtiAppControl::GetComponentIdFromPackageName(const TDesC& aPackageName)
+    {
+    TInt cid = KErrNotFound;
+    Usif::RSoftwareComponentRegistry registry;
+    User::LeaveIfError(registry.Connect());
+    CleanupClosePushL(registry);
+    RArray<Usif::TComponentId> componentIdList;
+    CleanupClosePushL(componentIdList);
+    registry.GetComponentIdsL(componentIdList);
+    TInt count = componentIdList.Count();    
+    for(TInt i = 0; i < count; i++)
+        {
+        Usif::TComponentId compId = componentIdList[i];
+        Usif::CComponentEntry *compEntry = Usif::CComponentEntry::NewLC();
+        if(registry.GetComponentL(compId, *compEntry))
+            {
+            if(compEntry->IsRemovable())
+                {
+                if ( aPackageName.Compare( compEntry->Name() ) == 0 )
+                    {
+                    cid = compId;
+                    CleanupStack::PopAndDestroy( compEntry );
+                    break;
+                    }
+                }
+            }
+        CleanupStack::PopAndDestroy( compEntry );
+        }
+        CleanupStack::PopAndDestroy( 2, &registry );// componentIdList, registry
+        return cid;
+    }
+
+#endif
 // End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiServicePlugins/HtiCameraServicePlugin/data/2002EA9D.rss	Thu Jul 22 16:33:59 2010 +0100
@@ -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	Thu Jul 22 16:33:59 2010 +0100
@@ -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	Thu Jul 22 16:33:59 2010 +0100
@@ -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	Thu Jul 22 16:33:59 2010 +0100
@@ -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	Thu Jul 22 16:33:59 2010 +0100
@@ -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	Thu Jul 22 16:33:59 2010 +0100
@@ -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	Thu Jul 22 16:33:59 2010 +0100
@@ -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	Thu Jul 22 16:33:59 2010 +0100
@@ -0,0 +1,204 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Defines the ECom plugin for HTI camera service.
+*
+*/
+
+
+
+#ifndef HTICAMERASERVICEPLUGIN_H
+#define HTICAMERASERVICEPLUGIN_H
+
+//  INCLUDES
+#include <HtiServicePluginInterface.h>
+#include "EngineVideoRecording.h"
+// CONSTANTS
+
+// MACROS
+
+// DATA TYPES
+
+// FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+class CEngineVideoRecording;
+class MEngineVideoRecordingObserver;
+
+// CLASS DECLARATION
+
+/**
+*  The ECom plugin for HTI camera service.
+*
+*/
+class CHtiCameraServicePlugin : public CHTIServicePluginInterface,
+                                public MEngineVideoRecordingObserver
+    {
+
+    protected:
+        // commands
+        enum TCommands
+            {
+            ECmdInitialize              = 0x01,
+            ECmdPrepareVideoRecording   = 0x02,
+            ECmdStartVideoRecording     = 0x05,
+            ECmdPausingVideoRecording   = 0x06,
+            ECmdResumeVideoRecording    = 0x07,
+            ECmdStopVideoRecording      = 0x08,
+            ECmdCloseVideoRecording     = 0x09,
+            ECmdGetZoom                 = 0x0a,
+            ECmdSetZoom                 = 0x0b,
+            
+            ECmdUninitialize            = 0x51,
+            EResultOk                   = 0xFF // only for response message
+            };
+
+
+    public:  // Constructors and destructor
+
+        /**
+        * Two-phased constructor.
+        */
+        static CHtiCameraServicePlugin* NewL();
+
+    public: // New functions
+
+    public:
+    // Functions from base classes
+
+    /**
+     * From CHTIServicePluginInterface
+     * Called by the HTI Framework when sending message to this service.
+     * @param aMessage message body destinated to a servive
+     * @param aPriority message priority
+     */
+    void ProcessMessageL(const TDesC8& aMessage,
+            THtiMessagePriority aPriority);
+
+    /**
+     * From CHTIServicePluginInterface
+     * Indicates to HTI Framework whether the plugin is ready to process
+     * a new message or if it's busy processing previous message.
+     */
+    TBool IsBusy();
+
+ 
+    protected:  // New functions
+
+        /**
+        * C++ default constructor.
+        */
+        CHtiCameraServicePlugin();
+
+        /**
+        * 2nd phase constructor.
+        */
+        void ConstructL();
+
+        /**
+        * Destructor.
+         */
+        virtual ~CHtiCameraServicePlugin();
+    
+    protected:
+        // Functions from base classes
+        
+        /**
+        * From MEngineVideoRecordingObserver
+        * Called asynchronously when CEngineVideoRecording::Init(), CCaeEngine::CEngineVideoRecording(), 
+        * or CEngineVideoRecording::Reserve() completes.
+        * Indicates if Video Recording Engine is ready for operation, 
+        * the camera is reserved and its power is switched on.
+        * @param aError Error code KErrNone to indicate success or a standard Symbian OS error code.
+        * @return void
+        */
+        virtual void MevroInitComplete( TInt aError );
+        
+        /**
+         * From MEngineVideoRecordingObserver
+         * Called asynchronously when preparing of video recording completes 
+         * after PrepareVideoRecordingL() has been called.
+         * May be called second time with an error code after a successful preparation 
+         * if video recording loses its prepared state for some reason (e.g. audio HW 
+         * is reserved for some other application).
+         * @param aError Error code KErrNone to indicate success or a standard Symbian OS error code.
+         * @return void
+         */
+        virtual void MevroVideoPrepareComplete(TInt aError);
+    
+        /**
+         * From MEngineVideoRecordingObserver
+         * Called (possibly asynchronously) when video recording is running 
+         * after CEngineVideoRecording::StartVideoRecording() or 
+         * CEngineVideoRecording::ResumeVideoRecording() has been called.
+         * @param aError Error code KErrNone to indicate success or a standard Symbian OS error code.
+         * @return void
+         */
+        virtual void MevroVideoRecordingOn(TInt aError);
+    
+        /**
+         * From MEngineVideoRecordingObserver
+         * Called (possibly asynchronously) when video recording is paused after 
+         * CEngineVideoRecording::PauseVideoRecording() has been called.
+         * @param aError Error code KErrNone to indicate success or a standard Symbian OS error code.
+         * @return void
+         */
+        virtual void MevroVideoRecordingPaused(TInt aError);
+    
+        /**
+         * From MEngineVideoRecordingObserver
+         * Called (possibly asynchronously) when video recording is completed 
+         * after CEngineVideoRecording::StopVideoRecording() has been called or 
+         * recording has been completed for some other reason.
+         * @param aError Error code KErrNone to indicate success or a standard Symbian OS error code.
+         * if aError == KErrDiskFull, then disk storage is full.
+         * if aError == KErrCompletion, then clip max size was reached.
+         * @return void
+         */
+        virtual void MevroVideoRecordingComplete(TInt aError);
+    
+    private:
+        void HandleInitializeCmdL(const TDesC8& aData);
+        void HandleUninitializeCmdL(const TDesC8& aData);
+        void HandlePrepareVideoRecordingCmdL(const TDesC8& aData);
+        void HandleStartVideoRecordingCmdL( const TDesC8& aData );
+        void HandlePausingVideoRecordingCmdL( const TDesC8& aData );
+        void HandleResumeVideoRecordingCmdL( const TDesC8& aData );
+        void HandleStopVideoRecordingCmdL( const TDesC8& aData );
+        void HandleCloseVideoRecordingCmdL( const TDesC8& aData );
+        void HandleGetZoomCmdL( const TDesC8& aData );
+        void HandleSetZoomCmdL( const TDesC8& aData );
+        
+        void SendOkMsgL( const TDesC8& aData );
+        void SendErrorMessageL( TInt aError, const TDesC8& aDescription );
+        
+        TInt ParseString( const TDesC8& aRequest,
+                                       TInt aOffset, TDes& aResult );
+
+    public:     // Data
+
+    protected:  // Data
+
+    private:    // Data
+        // Flag telling if the service is busy processing a message
+        TBool                   iIsBusy;
+        
+        TInt                    iError;
+        CEngineVideoRecording*  iVideoRecordingEngine;
+        CActiveSchedulerWait*   iWaiter;
+
+    };
+
+#endif      // HTICAMERASERVICEPLUGIN_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiServicePlugins/HtiCameraServicePlugin/src/HtiCameraServicePlugin.cpp	Thu Jul 22 16:33:59 2010 +0100
@@ -0,0 +1,637 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Implements the ECom plugin for HTI camera
+*                service.
+*
+*/
+
+
+
+// INCLUDE FILES
+#include <HtiDispatcherInterface.h>
+#include <HtiLogging.h>
+
+
+#include "HtiCameraServicePlugin.h"
+
+// EXTERNAL DATA STRUCTURES
+
+// EXTERNAL FUNCTION PROTOTYPES
+
+// CONSTANTS
+
+// MACROS
+
+// LOCAL CONSTANTS AND MACROS
+const static TUid KCameraServiceUid = { 0x2002EA9E };
+
+
+
+// NOTE: Max length for error description is defined
+// in HtiDispatcherInterface.h (currently 118).
+
+_LIT8( KErrorNoCommand, "ERROR: No command given" );
+_LIT8( KErrorUnknownCmd, "ERROR: Unknown Camera Service command" );
+_LIT8( KErrorInitFailed, "ERROR: Failed to init");
+_LIT8( KErrorUninitialized, "ERROR: Uninitialized");
+_LIT8( KErrInvalidateParameters, "ERROR: Invalidate parameters");
+_LIT8( KErrQualityLevel, "ERROR: Invalidate quality level");
+_LIT8( KErrorPrepareVideoRecordingFailed, "ERROR: Prepare video recording failed");
+_LIT8( KErrorStartVideoRecordingFailed, "ERROR: Start video recording failed");
+_LIT8( KErrorPausingVideoRecordingFailed, "ERROR: Pausing video recording failed");
+_LIT8( KErrorResumeVideoRecordingFailed, "ERROR: Resume video recording failed");
+_LIT8( KErrorStopVideoRecordingFailed, "ERROR: Stop video recording failed");
+_LIT8( KErrorSetZoomModeFailed, "ERROR: Set zoom mode failed");
+_LIT8( KErrorSetZoomValueFailed, "ERROR: Set zoom value failed");
+
+// MODULE DATA STRUCTURES
+
+// LOCAL FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+// ============================= LOCAL FUNCTIONS ===============================
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CHtiCameraServicePlugin::CHtiCameraServicePlugin
+// C++ default constructor can NOT contain any code, that might leave.
+// -----------------------------------------------------------------------------
+//
+CHtiCameraServicePlugin::CHtiCameraServicePlugin():iIsBusy(EFalse), iError(0),
+        iVideoRecordingEngine(NULL), iWaiter(NULL)
+    {
+    }
+
+
+// -----------------------------------------------------------------------------
+// CHtiCameraServicePlugin::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CHtiCameraServicePlugin::ConstructL()
+    {
+    HTI_LOG_TEXT( "CHtiCameraServicePlugin::ConstructL" );
+    iWaiter = new ( ELeave ) CActiveSchedulerWait;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CHtiCameraServicePlugin::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CHtiCameraServicePlugin* CHtiCameraServicePlugin::NewL()
+    {
+    CHtiCameraServicePlugin* self = new (ELeave) CHtiCameraServicePlugin;
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop();
+    return self;
+    }
+
+
+// Destructor
+CHtiCameraServicePlugin::~CHtiCameraServicePlugin()
+    {
+    if(iVideoRecordingEngine)
+        {
+        delete iVideoRecordingEngine;
+        iVideoRecordingEngine = NULL;
+        }
+    
+    delete iWaiter;
+    iWaiter = NULL;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CHtiCameraServicePlugin::ProcessMessageL
+// -----------------------------------------------------------------------------
+//
+void CHtiCameraServicePlugin::ProcessMessageL( const TDesC8& aMessage,
+                                        THtiMessagePriority /*aPriority*/ )
+    {
+    HTI_LOG_FUNC_IN( "CHtiCameraServicePlugin::ProcessMessageL" );
+    HTI_LOG_FORMAT( "Message length = %d", aMessage.Length() );
+
+    if ( iIsBusy )
+        {
+        HTI_LOG_TEXT( "Plugin is busy - leaving" );
+        User::Leave( KErrInUse );
+        }
+
+    // Will be set to EFalse in the SendResponseMsg or SendErrorResponseMsg
+    // methods when the response has been successfully sent and the plugin is
+    // ready for next message.
+    iIsBusy = ETrue;
+
+    if ( aMessage.Length() < 1 )
+        {
+        SendErrorMessageL( KErrArgument, KErrorNoCommand );
+        return;
+        }
+    
+    TUint8 command = aMessage.Ptr()[0];
+    TInt err = KErrNone;
+
+    switch (command)
+        {
+        case ECmdInitialize:
+            TRAP(err, HandleInitializeCmdL(aMessage.Right( aMessage.Length() - 1 )));
+            break;
+        case ECmdUninitialize:
+            TRAP(err, HandleUninitializeCmdL(aMessage.Right( aMessage.Length() - 1 )));
+            break;
+        case ECmdPrepareVideoRecording:
+            TRAP(err, HandlePrepareVideoRecordingCmdL(aMessage.Right( aMessage.Length() - 1 )));
+            break;
+        case ECmdStartVideoRecording:
+            TRAP(err, HandleStartVideoRecordingCmdL(aMessage.Right( aMessage.Length() - 1 )));
+            break;
+        case ECmdPausingVideoRecording:
+            TRAP(err, HandlePausingVideoRecordingCmdL(aMessage.Right( aMessage.Length() - 1 )));
+            break;
+        case ECmdResumeVideoRecording:
+            TRAP(err, HandleResumeVideoRecordingCmdL(aMessage.Right( aMessage.Length() - 1 )));
+            break;
+        case ECmdStopVideoRecording:
+            TRAP(err, HandleStopVideoRecordingCmdL(aMessage.Right( aMessage.Length() - 1 )));
+            break;
+        case ECmdCloseVideoRecording:
+            TRAP(err, HandleCloseVideoRecordingCmdL(aMessage.Right( aMessage.Length() - 1 )));
+            break;
+        case ECmdGetZoom:
+            TRAP(err, HandleGetZoomCmdL(aMessage.Right( aMessage.Length() - 1 )));
+            break;
+        case ECmdSetZoom:
+            TRAP(err, HandleSetZoomCmdL(aMessage.Right( aMessage.Length() - 1 )));
+            break;
+        default:
+            TRAP(err, SendErrorMessageL(KErrArgument, KErrorUnknownCmd));
+            break;
+        }
+    
+    if(err != KErrNone)
+        {
+        iIsBusy = EFalse;
+        User::Leave( err );
+        }
+
+    HTI_LOG_FUNC_OUT( "CHtiCameraServicePlugin::ProcessMessageL" );
+    }
+
+void CHtiCameraServicePlugin::HandleInitializeCmdL( const TDesC8& aData )
+    {
+    HTI_LOG_FUNC_IN( "CHtiCameraServicePlugin::HandleInitializeCmdL" );
+    if(aData.Length() != 0)
+        {
+        SendErrorMessageL(KErrArgument, KErrInvalidateParameters);
+        return;
+        }
+    
+    HTI_LOG_TEXT("Initializes Camera Application Engine");
+    if(iVideoRecordingEngine)
+        {
+        delete iVideoRecordingEngine;
+        iVideoRecordingEngine = NULL;
+        }
+    
+    iVideoRecordingEngine = CEngineVideoRecording::NewL(*this, 0);
+    iVideoRecordingEngine->InitL();
+    iWaiter->Start();
+    if(iError != KErrNone)
+        {
+        SendErrorMessageL(iError, KErrorInitFailed);
+        }
+    else
+        {
+        HTI_LOG_TEXT("Initializes video recording");
+        iVideoRecordingEngine->InitVideoRecorderL();
+        
+        SendOkMsgL(KNullDesC8);
+        }
+
+    HTI_LOG_FUNC_OUT( "CHtiCameraServicePlugin::HandleInitializeCmdL" );
+    }
+
+void CHtiCameraServicePlugin::HandleUninitializeCmdL(const TDesC8& aData)
+    {
+    HTI_LOG_FUNC_IN( "CHtiCameraServicePlugin::HandleUninitializeCmdL" );
+    if(aData.Length() != 0)
+        {
+        SendErrorMessageL(KErrArgument, KErrInvalidateParameters);
+        return;
+        }
+    
+    if(iVideoRecordingEngine == NULL)
+        {
+        SendErrorMessageL(KErrNotReady, KErrorUninitialized);
+        return;
+        }
+    
+    delete iVideoRecordingEngine;
+    iVideoRecordingEngine = NULL;
+    
+    SendOkMsgL(KNullDesC8);
+    HTI_LOG_FUNC_OUT( "CHtiCameraServicePlugin::HandleUninitializeCmdL" );
+    }
+
+void CHtiCameraServicePlugin::HandlePrepareVideoRecordingCmdL( const TDesC8& aData )
+    {
+    HTI_LOG_FUNC_IN( "CHtiCameraServicePlugin::HandlePrepareVideoRecordingCmdL" );
+    if(aData.Length() < 2 || aData[1] != aData.Length() -2)
+        {
+        SendErrorMessageL(KErrArgument, KErrInvalidateParameters);
+        return;
+        }
+    
+    if(iVideoRecordingEngine == NULL)
+        {
+        SendErrorMessageL(KErrNotReady, KErrorUninitialized);
+        return;
+        }
+    
+    TInt qualityLevelIndex = aData[0];
+    if(qualityLevelIndex < 0 || qualityLevelIndex > iVideoRecordingEngine->VideoQualityCount() -1)
+        {
+        SendErrorMessageL(KErrOverflow, KErrQualityLevel);
+        return;
+        }
+    
+    TBuf<255> filePath;
+    TInt nextOffset = ParseString( aData, 1, filePath );
+    if ( filePath.Length() < 1 || nextOffset < 0 )
+        {
+        SendErrorMessageL(KErrArgument, KErrInvalidateParameters);
+        return;
+        }
+    
+    HTI_LOG_FORMAT("Set video recording file name: %S", &filePath);
+    iVideoRecordingEngine->SetVideoRecordingFileNameL(filePath);
+    
+    HTI_LOG_FORMAT("Prepare video recording with quality level index: %d", qualityLevelIndex);
+    iVideoRecordingEngine->PrepareVideoRecordingL(qualityLevelIndex);
+    
+    iWaiter->Start();
+    if(iError != KErrNone)
+        {
+        SendErrorMessageL(iError, KErrorPrepareVideoRecordingFailed);
+        }
+    else
+        {
+        SendOkMsgL(KNullDesC8);
+        }
+    
+     HTI_LOG_FUNC_OUT( "CHtiCameraServicePlugin::HandlePrepareVideoRecordingCmdL" );
+    }
+
+void CHtiCameraServicePlugin::HandleStartVideoRecordingCmdL( const TDesC8& aData )
+    {
+    HTI_LOG_FUNC_IN( "CHtiCameraServicePlugin::HandleStartVideoRecordingCmdL" );
+    if(aData.Length() != 0)
+        {
+        SendErrorMessageL(KErrArgument, KErrInvalidateParameters);
+        return;
+        }
+    
+    if(iVideoRecordingEngine == NULL)
+        {
+        SendErrorMessageL(KErrNotReady, KErrorUninitialized);
+        return;
+        }
+    
+    HTI_LOG_TEXT("Start video recording...");
+    iVideoRecordingEngine->StartVideoRecording();
+    
+    if(iError != KErrNone)
+        {
+        SendErrorMessageL(iError, KErrorStartVideoRecordingFailed);
+        }
+    else
+        {
+        SendOkMsgL(KNullDesC8);
+        }
+
+    HTI_LOG_FUNC_OUT( "CHtiCameraServicePlugin::HandleStartVideoRecordingCmdL" );
+    }
+
+void CHtiCameraServicePlugin::HandlePausingVideoRecordingCmdL( const TDesC8& aData )
+    {
+    HTI_LOG_FUNC_IN( "CHtiCameraServicePlugin::HandlePausingVideoRecordingCmdL" );
+    if(aData.Length() != 0)
+        {
+        SendErrorMessageL(KErrArgument, KErrInvalidateParameters);
+        return;
+        }
+    
+    if(iVideoRecordingEngine == NULL)
+        {
+        SendErrorMessageL(KErrNotReady, KErrorUninitialized);
+        return;
+        }
+    
+    HTI_LOG_TEXT("Pausing video recording");
+    iVideoRecordingEngine->PauseVideoRecording();
+    if(iError != KErrNone)
+        {
+        SendErrorMessageL(iError, KErrorPausingVideoRecordingFailed);
+        }
+    else
+        {
+        SendOkMsgL(KNullDesC8);
+        }
+    HTI_LOG_FUNC_OUT( "CHtiCameraServicePlugin::HandlePausingVideoRecordingCmdL" );
+    }
+
+void CHtiCameraServicePlugin::HandleResumeVideoRecordingCmdL( const TDesC8& aData )
+    {
+    HTI_LOG_FUNC_IN( "CHtiCameraServicePlugin::HandleResumeVideoRecordingCmdL" );
+    if(aData.Length() != 0)
+        {
+        SendErrorMessageL(KErrArgument, KErrInvalidateParameters);
+        return;
+        }
+    
+    if(iVideoRecordingEngine == NULL)
+        {
+        SendErrorMessageL(KErrNotReady, KErrorUninitialized);
+        return;
+        }
+    
+    HTI_LOG_TEXT("Resume video recording...");
+    iVideoRecordingEngine->ResumeVideoRecording();
+    
+    if(iError != KErrNone)
+        {
+        SendErrorMessageL(iError, KErrorResumeVideoRecordingFailed);
+        }
+    else
+        {
+        SendOkMsgL(KNullDesC8);
+        }
+    HTI_LOG_FUNC_OUT( "CHtiCameraServicePlugin::HandleResumeVideoRecordingCmdL" );
+    }
+
+void CHtiCameraServicePlugin::HandleStopVideoRecordingCmdL( const TDesC8& aData )    
+    {
+    HTI_LOG_FUNC_IN( "CHtiCameraServicePlugin::HandleStopVideoRecordingCmdL" );
+    if(aData.Length() != 0)
+        {
+        SendErrorMessageL(KErrArgument, KErrInvalidateParameters);
+        return;
+        }
+    
+    if(iVideoRecordingEngine == NULL)
+        {
+        SendErrorMessageL(KErrNotReady, KErrorUninitialized);
+        return;
+        }
+    
+    HTI_LOG_TEXT("Stop video recording");
+    iVideoRecordingEngine->StopVideoRecording();
+    if(iError != KErrNone)
+        {
+        SendErrorMessageL(iError, KErrorStopVideoRecordingFailed);
+        }
+    else
+        {
+        SendOkMsgL(KNullDesC8);
+        }
+    HTI_LOG_FUNC_OUT( "CHtiCameraServicePlugin::HandleStopVideoRecordingCmdL" );
+    }
+
+void CHtiCameraServicePlugin::HandleCloseVideoRecordingCmdL( const TDesC8& aData )
+    {
+    HTI_LOG_FUNC_IN( "CHtiCameraServicePlugin::HandleCloseVideoRecordingCmdL" );
+    if(aData.Length() != 0)
+        {
+        SendErrorMessageL(KErrArgument, KErrInvalidateParameters);
+        return;
+        }
+    
+    if(iVideoRecordingEngine == NULL)
+        {
+        SendErrorMessageL(KErrNotReady, KErrorUninitialized);
+        return;
+        }
+    
+    HTI_LOG_TEXT("Close video recording");
+    iVideoRecordingEngine->CloseVideoRecording();
+    SendOkMsgL(KNullDesC8);
+    HTI_LOG_FUNC_OUT( "CHtiCameraServicePlugin::HandleCloseVideoRecordingCmdL" );
+    }
+
+void CHtiCameraServicePlugin::HandleGetZoomCmdL( const TDesC8& aData )
+    {
+    HTI_LOG_FUNC_IN( "CHtiCameraServicePlugin::HandleGetZoomCmdL" );
+    if(aData.Length() != 0)
+        {
+        SendErrorMessageL(KErrArgument, KErrInvalidateParameters);
+        return;
+        }
+    
+    if(iVideoRecordingEngine == NULL)
+        {
+        SendErrorMessageL(KErrNotReady, KErrorUninitialized);
+        return;
+        }
+    
+    TUint8 zoomMode = (TUint8)iVideoRecordingEngine->ZoomMode();
+    HTI_LOG_FORMAT("Current zoom mode: %d", zoomMode);
+    
+    TUint32 zoomValue = iVideoRecordingEngine->ZoomValue();
+    HTI_LOG_FORMAT("Current zoom value: %d", zoomValue);
+    
+    TUint32 zoomMinValue = iVideoRecordingEngine->MinZoomValue();
+    HTI_LOG_FORMAT("Min zoom value: %d", zoomMinValue);
+    
+    TUint32 zoomMaxValue = iVideoRecordingEngine->MaxZoomValue();
+    HTI_LOG_FORMAT("Max zoom value: %d", zoomMaxValue);
+    
+    TBuf8<13> buf;
+    buf.Append(zoomMode);
+    buf.Append((TUint8*)&zoomValue, 4);
+    buf.Append((TUint8*)&zoomMinValue, 4);
+    buf.Append((TUint8*)&zoomMaxValue, 4);
+    SendOkMsgL( buf );
+
+    HTI_LOG_FUNC_OUT( "CHtiCameraServicePlugin::HandleGetZoomCmdL" );
+    }
+
+void CHtiCameraServicePlugin::HandleSetZoomCmdL( const TDesC8& aData )
+    {
+    HTI_LOG_FUNC_IN( "CHtiCameraServicePlugin::HandleSetZoomCmdL" );
+    if(aData.Length() != 5)
+        {
+        SendErrorMessageL(KErrArgument, KErrInvalidateParameters);
+        return;
+        }
+    
+    if(iVideoRecordingEngine == NULL)
+        {
+        SendErrorMessageL(KErrNotReady, KErrorUninitialized);
+        return;
+        }
+    
+    CEngineVideoRecording::TZoomMode zoomMode = (CEngineVideoRecording::TZoomMode)aData[0];
+    HTI_LOG_FORMAT("Set zoom mode: %d", zoomMode);
+    TRAPD(err, iVideoRecordingEngine->SetZoomModeL(zoomMode));
+    if(err != KErrNone)
+        {
+        SendErrorMessageL(err, KErrorSetZoomModeFailed);
+        }
+    else
+        {
+        TInt value = aData[1] + ( aData[2] << 8 )
+                + ( aData[3] << 16 )
+                + ( aData[4] << 24 );
+        HTI_LOG_FORMAT("Set zoom value: %d", value);
+        TRAPD(err, iVideoRecordingEngine->SetZoomValueL(value));
+        if(err != KErrNone)
+            {
+            SendErrorMessageL(err, KErrorSetZoomValueFailed);
+            }
+        else
+            {
+            SendOkMsgL(KNullDesC8);
+            }
+        }
+    
+    HTI_LOG_FUNC_OUT( "CHtiCameraServicePlugin::HandleSetZoomCmdL" );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CHtiCameraServicePlugin::IsBusy
+// -----------------------------------------------------------------------------
+//
+TBool CHtiCameraServicePlugin::IsBusy()
+    {
+    return iIsBusy;
+    }
+
+
+// ----------------------------------------------------------------------------
+void CHtiCameraServicePlugin::SendOkMsgL( const TDesC8& aData )
+    {
+    HTI_LOG_FUNC_IN( "CHtiCameraServicePlugin::SendOkMsgL: Starting" );
+
+    User::LeaveIfNull( iDispatcher );
+
+    HBufC8* temp = HBufC8::NewL( aData.Length() + 1 );
+    TPtr8 response = temp->Des();
+    response.Append( ( TChar ) EResultOk );
+    response.Append( aData );
+    User::LeaveIfError( iDispatcher->DispatchOutgoingMessage(
+        temp, KCameraServiceUid ) );
+    iIsBusy = EFalse;
+    HTI_LOG_FUNC_OUT( "CHtiCameraServicePlugin::SendOkMsgL: Done" );
+    }
+
+// ----------------------------------------------------------------------------
+void CHtiCameraServicePlugin::SendErrorMessageL( TInt aError, const TDesC8& aDescription )
+    {
+    HTI_LOG_FUNC_IN( "CHtiCameraServicePlugin::SendErrorMessageL: Starting" );
+    User::LeaveIfNull( iDispatcher );
+    User::LeaveIfError( iDispatcher->DispatchOutgoingErrorMessage(
+        aError, aDescription, KCameraServiceUid ) );
+    iIsBusy = EFalse;
+    HTI_LOG_FUNC_OUT( "CHtiCameraServicePlugin::SendErrorMessageL: Done" );
+    }
+
+TInt CHtiCameraServicePlugin::ParseString( const TDesC8& aRequest,
+                                          TInt aOffset,
+                                          TDes& aResult )
+    {
+    HTI_LOG_FUNC_IN( "CHtiCameraServicePlugin::ParseString" );
+
+    // If offset outside the string return empty string
+    if ( aOffset >= aRequest.Size() )
+        {
+        return aOffset;
+        }
+
+    TInt length = aRequest[aOffset];
+    HTI_LOG_FORMAT( "String length = %d", length );
+
+    // If length is zero return empty string
+    if ( length < 1 )
+        {
+        return aOffset + 1;
+        }
+
+    if ( length > aResult.MaxLength() )
+        {
+        return KErrBadDescriptor;
+        }
+
+    TInt nextOffset = length + aOffset + 1;
+    HTI_LOG_FORMAT( "Next offset = %d", nextOffset );
+    HTI_LOG_FORMAT( "Request size = %d", aRequest.Size() );
+
+    if ( nextOffset > aRequest.Size() )
+        {
+        return KErrArgument;
+        }
+
+    aResult.Copy( aRequest.Mid( aOffset + 1, length ) );
+
+    HTI_LOG_FUNC_OUT( "CHtiCameraServicePlugin::ParseString" );
+    return nextOffset;
+    }
+
+void CHtiCameraServicePlugin::MevroInitComplete( TInt aError )
+    {
+    HTI_LOG_FUNC_IN( "CHtiCameraServicePlugin::MevroInitComplete" );
+    HTI_LOG_FORMAT("aError = %d", aError);
+    iError = aError; 
+    iWaiter->AsyncStop();
+    HTI_LOG_FUNC_OUT( "CHtiCameraServicePlugin::MevroInitComplete" );
+    }
+
+void CHtiCameraServicePlugin::MevroVideoPrepareComplete(TInt aError)
+    {
+    HTI_LOG_FUNC_IN( "CHtiCameraServicePlugin::MevroVideoPrepareComplete" );
+    HTI_LOG_FORMAT("aError = %d", aError);
+    iError = aError;
+    iWaiter->AsyncStop();
+    HTI_LOG_FUNC_OUT( "CHtiCameraServicePlugin::MevroVideoPrepareComplete" );
+    }
+
+void CHtiCameraServicePlugin::MevroVideoRecordingOn(TInt aError)
+    {
+    HTI_LOG_FUNC_IN( "CHtiCameraServicePlugin::MevroVideoRecordingOn" );
+    HTI_LOG_FORMAT("aError = %d", aError);
+    iError = aError;
+    HTI_LOG_FUNC_OUT( "CHtiCameraServicePlugin::MevroVideoRecordingOn" );
+    }
+
+void CHtiCameraServicePlugin::MevroVideoRecordingPaused(TInt aError)
+    {
+    HTI_LOG_FUNC_IN( "CHtiCameraServicePlugin::MevroVideoRecordingPaused" );
+    HTI_LOG_FORMAT("aError = %d", aError);
+    iError = aError;
+    HTI_LOG_FUNC_OUT( "CHtiCameraServicePlugin::MevroVideoRecordingPaused" );
+    }
+
+void CHtiCameraServicePlugin::MevroVideoRecordingComplete(TInt aError)
+    {
+    HTI_LOG_FUNC_IN( "CHtiCameraServicePlugin::MevroVideoRecordingComplete" );
+    HTI_LOG_FORMAT("aError = %d", aError);
+    iError = aError;
+    HTI_LOG_FUNC_OUT( "CHtiCameraServicePlugin::MevroVideoRecordingComplete" );
+    }
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiServicePlugins/HtiCameraServicePlugin/src/proxy.cpp	Thu Jul 22 16:33:59 2010 +0100
@@ -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	Fri Jun 11 16:29:34 2010 +0100
+++ b/htiui/HtiServicePlugins/HtiPIMServicePlugin/inc/HtiBookmarkHandler.h	Thu Jul 22 16:33:59 2010 +0100
@@ -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	Fri Jun 11 16:29:34 2010 +0100
+++ b/htiui/HtiServicePlugins/HtiPIMServicePlugin/src/HtiBookmarkHandler.cpp	Thu Jul 22 16:33:59 2010 +0100
@@ -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	Fri Jun 11 16:29:34 2010 +0100
+++ b/htiui/HtiServicePlugins/HtiSysInfoServicePlugin/group/HtiSysInfoServicePlugin.mmp	Thu Jul 22 16:33:59 2010 +0100
@@ -65,6 +65,7 @@
 LIBRARY         sysutil.lib
 LIBRARY         tzclient.lib
 LIBRARY         flogger.lib
+LIBRARY	        featmgr.lib // Chinese support
 
 SMPSAFE
 
--- a/htiui/HtiServicePlugins/HtiSysInfoServicePlugin/inc/HtiSysInfoServicePlugin.h	Fri Jun 11 16:29:34 2010 +0100
+++ b/htiui/HtiServicePlugins/HtiSysInfoServicePlugin/inc/HtiSysInfoServicePlugin.h	Thu Jul 22 16:33:59 2010 +0100
@@ -98,7 +98,9 @@
         void HandleHsdpaCommandL( const TDesC8& aMessage );
         void HandleUpdateMediaGalleryL( const TDesC8& aMessage );
         void HandleActivateSkinL( const TDesC8& aMessage );
+        void HandleSetLanguageL( const TDesC8& aMessage );
 
+        void SetDefaultNumberModeL(TInt aMode, TInt aNbrModeType);
         void ParseTimeDataL( const TDesC8& aTimeData, TTime& aResult );
         TInt CleanUpTempFiles();
         TBool CanTurnBluetoothOnL( const TBool aUseForce );
--- a/htiui/HtiServicePlugins/HtiSysInfoServicePlugin/src/HtiSysInfoServicePlugin.cpp	Fri Jun 11 16:29:34 2010 +0100
+++ b/htiui/HtiServicePlugins/HtiSysInfoServicePlugin/src/HtiSysInfoServicePlugin.cpp	Thu Jul 22 16:33:59 2010 +0100
@@ -31,6 +31,10 @@
 #include <AknSkinsInternalCRKeys.h>
 #include <AknsSkinUID.h>
 #include <AknsSrvClient.h>
+#include <AknFepInternalCRKeys.h>
+#include <AknFepGlobalEnums.h> //For chinese input modes
+#include <CommonEngineDomainCRKeys.h>
+#include <featmgr.h>
 #include <bautils.h>
 #include <btengsettings.h>
 #include <btengdomaincrkeys.h>
@@ -61,6 +65,8 @@
 const TInt KMaxBtNameLength = 30;
 const TInt KDateTimeFormatCmdLength = 6;
 
+const TInt KFepChineseInputModeLength = 10;
+
 _LIT( KTempFilePath, "\\" );
 _LIT( KTempFileName, "HtiTempFile.tmp" );
 _LIT( KMatchFileName, "HtiTempFile.tmp*" );
@@ -83,6 +89,7 @@
 _LIT8( KErrDescrSysUtil, "SysUtil failed" );
 _LIT8( KErrDescrSetTime, "Setting time failed" );
 _LIT8( KErrDescrDateTimeFormat, "Setting date and time formats failed" );
+_LIT8( KErrDescrSetLanguage, "Setting language failed");
 _LIT8( KErrDescrGetNetworkModes, "Getting network modes failed" );
 _LIT8( KErrDescrSetNetworkMode, "Setting network mode failed" );
 _LIT8( KErrDescrIrActivation, "IR activation failed" );
@@ -130,6 +137,8 @@
     ESysInfoSetHomeTime =     0x20,
     ESysInfoGetHomeTime =     0x21,
     ESetDateTimeFormat =      0x22,
+    
+    ESetLanguage =            0x25,
 
     ELightStatus =            0x30,
     ELightOn =                0x31,
@@ -164,6 +173,17 @@
     EActivateSkin =           0x80
     };
 
+enum TGSNumberModes
+    {
+    EGSNbrModeLatin, EGSNbrModeArabic = 1, EGSNbrModeIndic = 1
+    };
+
+// Number mode type
+enum TGSNumberModeType
+    {
+    EGSNbrModeTypeArabic, EGSNbrModeTypeIndic, EGSNbrModeTypeEasternArabic
+    // for Urdu & Farsi languages
+    };
 
 //------------------------------------------------------------------------------
 // Create instance of concrete ECOM interface implementation
@@ -211,6 +231,8 @@
     iAllowSSProperty.Close();
 #endif 
     delete iAllowSSSubscriber;
+    
+    FeatureManager::UnInitializeLib();
     }
 
 //------------------------------------------------------------------------------
@@ -221,6 +243,8 @@
     HTI_LOG_TEXT( "CHtiSysInfoServicePlugin::ConstructL" );
     User::LeaveIfError( iFs.Connect() );
     iFileMan = CFileMan::NewL( iFs );
+    
+    FeatureManager::InitializeLibL();
     }
 
 //------------------------------------------------------------------------------
@@ -352,6 +376,12 @@
                 HandleSetDateTimeFormatL( aMessage );
                 }
                 break;
+            case ESetLanguage:
+                {
+                HTI_LOG_TEXT("ESetLanguage");
+                HandleSetLanguageL( aMessage);
+                }
+                break;
             case ELightStatus:
             case ELightOn:
             case ELightOff:
@@ -2851,6 +2881,160 @@
     }
 
 //------------------------------------------------------------------------------
+// CHtiSysInfoServicePlugin::HandleSetLanguageL
+//------------------------------------------------------------------------------
+void CHtiSysInfoServicePlugin::HandleSetLanguageL( const TDesC8& aMessage )
+    {
+    HTI_LOG_FUNC_IN( "CHtiSysInfoServicePlugin::HandleSetLanguageL" );
+    if ( aMessage.Length() != 3 )
+        {
+        iDispatcher->DispatchOutgoingErrorMessage( KErrArgument,
+                KErrDescrArgument, KSysInfoServiceUid );
+        return;
+        }
+    
+    TInt language = aMessage[1] + ( aMessage[2] << 8 );
+    if(language < 0)
+        {
+        iDispatcher->DispatchOutgoingErrorMessage( KErrArgument,
+                KErrDescrSetLanguage, KSysInfoServiceUid );
+        return;
+        }
+    HTI_LOG_FORMAT( "Set language to %d", language );
+    
+    // Never set Language code 0 to HAL
+    if (language != 0)
+        {
+        User::LeaveIfError(HAL::Set(HAL::ELanguageIndex, language));
+        }
+    
+    CRepository* commonEngineRepository = CRepository::NewL(
+            KCRUidCommonEngineKeys);
+    CleanupStack::PushL(commonEngineRepository);
+    
+    User::LeaveIfError(commonEngineRepository->Set(KGSDisplayTxtLang, language));
+
+    CleanupStack::PopAndDestroy();
+
+    TBool nbrModeSaved = EFalse;
+    if (language == ELangArabic || User::Language() == ELangArabic)
+        {
+        //numberMode = EGSNumberModeArabicIndic;
+        SetDefaultNumberModeL(EGSNbrModeArabic, EGSNbrModeTypeArabic);
+        nbrModeSaved = ETrue;
+        }
+    else if ((language == ELangUrdu || User::Language() == ELangUrdu)
+            || (language == ELangFarsi || User::Language() == ELangFarsi))
+        {
+        //numberMode = EGSNumberModeEasternArabicIndic;
+        SetDefaultNumberModeL(EGSNbrModeLatin, EGSNbrModeTypeEasternArabic);
+        nbrModeSaved = ETrue;
+        }
+    else if (language == ELangHindi || User::Language() == ELangHindi
+            || language == ELangMarathi || User::Language() == ELangMarathi)
+        {
+        //numberMode = EGSNumberModeIndic;
+        SetDefaultNumberModeL(EGSNbrModeLatin, EGSNbrModeTypeIndic);
+        nbrModeSaved = ETrue;
+        }
+
+    //if number mode is not set above, then set it to Latin with respective
+    //number mode types. This part might be executed when Automatic is
+    //selected and the SIM card does not support the language.
+    if (!nbrModeSaved)
+        {
+        TInt nbrModeType = EGSNbrModeTypeIndic;
+        if (language == ELangArabic || User::Language() == ELangArabic)
+            {
+            nbrModeType = EGSNbrModeTypeArabic;
+            }
+        else if ((language == ELangUrdu || User::Language() == ELangUrdu)
+                || (language == ELangFarsi || User::Language() == ELangFarsi))
+            {
+            nbrModeType = EGSNbrModeTypeEasternArabic;
+            }
+
+        //EGSNumberModeLatin is true in both cases;
+        SetDefaultNumberModeL(EGSNbrModeLatin, nbrModeType);
+        }
+    
+    // Change input language
+    CRepository* aknFepRepository = CRepository::NewL( KCRUidAknFep );
+    CleanupStack::PushL(aknFepRepository);
+    User::LeaveIfError(  aknFepRepository->Set( KAknFepInputTxtLang,
+                                                language ));
+    // Change input method for Chinese variants
+    if( FeatureManager::FeatureSupported( KFeatureIdChinese ) )
+        {
+        TBuf<KFepChineseInputModeLength> conversion;
+        if( language == ELangPrcChinese )
+            {
+            conversion.Num( EPinyin, EHex );
+            User::LeaveIfError( aknFepRepository->Set( KAknFepChineseInputMode, conversion ) );
+            }
+        else if( language == ELangHongKongChinese )
+            {
+            conversion.Num( EStroke, EHex );
+            User::LeaveIfError( aknFepRepository->Set( KAknFepChineseInputMode, conversion ) );
+            }
+        else if( language == ELangTaiwanChinese )
+            {
+            conversion.Num( EZhuyin, EHex );
+            User::LeaveIfError( aknFepRepository->Set( KAknFepChineseInputMode, conversion ) );
+            }
+        }
+    CleanupStack::PopAndDestroy();
+    
+    iReply = HBufC8::NewL( 1 );
+    iReply->Des().Append( 0 );
+    HTI_LOG_FUNC_OUT( "CHtiSysInfoServicePlugin::HandleSetLanguageL" );
+    }
+
+void CHtiSysInfoServicePlugin::SetDefaultNumberModeL(TInt aMode, TInt aNbrModeType)
+    {
+
+    CRepository* localeRepository = CRepository::NewL(KCRUidLocaleSettings);
+    CleanupStack::PushL(localeRepository);
+    if (aNbrModeType == EGSNbrModeTypeArabic || aNbrModeType
+            == EGSNbrModeTypeEasternArabic)
+        {
+        localeRepository->Set(KSettingsDefaultNumberMode, aMode);
+        }
+    else
+        {
+        localeRepository->Set(KSettingsIndicDefaultNumberMode, aMode);
+        }
+    CleanupStack::PopAndDestroy();
+
+    TLocale locale;
+    if (aMode == EGSNbrModeLatin)
+        {
+        locale.SetDigitType(EDigitTypeWestern);
+        }
+    else
+        {
+        //if aMode <> EGSNbrModeLatin, then it should be either latin or arabic. However
+        //as EGSNbrModeArabic and EGsNbrModeIndic both have a value = 1, we can't use
+        //that constant for below comparison. Hence, need to depend on the 2nd param.
+        switch (aNbrModeType)
+            {
+            case EGSNbrModeTypeArabic:
+                locale.SetDigitType(EDigitTypeArabicIndic);
+                break;
+            case EGSNbrModeTypeIndic:
+                locale.SetDigitType(EDigitTypeDevanagari);
+                break;
+            case EGSNbrModeTypeEasternArabic:
+                locale.SetDigitType(EDigitTypeEasternArabicIndic);
+                break;
+            default:
+                break;
+            }
+        }
+
+    locale.Set();
+    }
+//------------------------------------------------------------------------------
 // CHtiSysInfoServicePlugin::ParseTimeDataL
 //------------------------------------------------------------------------------
 void CHtiSysInfoServicePlugin::ParseTimeDataL( const TDesC8& aTimeData,
--- a/htiui/group/bld.inf	Fri Jun 11 16:29:34 2010 +0100
+++ b/htiui/group/bld.inf	Thu Jul 22 16:33:59 2010 +0100
@@ -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	Fri Jun 11 16:29:34 2010 +0100
+++ b/htiui/rom/htiui.iby	Thu Jul 22 16:33:59 2010 +0100
@@ -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	Fri Jun 11 16:29:34 2010 +0100
+++ b/htiui/rom/htiui_10_1.iby	Thu Jul 22 16:33:59 2010 +0100
@@ -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	Fri Jun 11 16:29:34 2010 +0100
+++ b/htiui/sis/HTI_S60-10_1.pkg	Thu Jul 22 16:33:59 2010 +0100
@@ -18,7 +18,7 @@
 &EN
 
 ; Using UID of HtiFramework project
-#{"HTI"},(0x1020DEB6),2,21,0
+#{"HTI"},(0x1020DEB6),2,25,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"
@@ -94,6 +96,9 @@
 ; HTI watchdog
 "\epoc32\release\armv5\urel\HtiWatchDog.exe"                     - "!:\sys\bin\HtiWatchDog.exe"
 
+; HTI Restart
+"\epoc32\release\armv5\urel\HtiRestart.exe"                      - "!:\sys\bin\HtiRestart.exe"
+
 ; HTI device reboot
 "\epoc32\release\armv5\urel\HtiDeviceRebootUI.exe"               - "!:\sys\bin\HtiDeviceRebootUI.exe"
 
@@ -108,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-52.pkg	Fri Jun 11 16:29:34 2010 +0100
+++ b/htiui/sis/HTI_S60-52.pkg	Thu Jul 22 16:33:59 2010 +0100
@@ -18,7 +18,7 @@
 &EN
 
 ; Using UID of HtiFramework project
-#{"HTI"},(0x1020DEB6),2,21,0
+#{"HTI"},(0x1020DEB6),2,25,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"
@@ -97,6 +99,9 @@
 ; HTI watchdog
 "\epoc32\release\armv5\urel\HtiWatchDog.exe"                     - "!:\sys\bin\HtiWatchDog.exe"
 
+; HTI Restart
+"\epoc32\release\armv5\urel\HtiRestart.exe"                      - "!:\sys\bin\HtiRestart.exe"
+
 ; HTI device reboot
 "\epoc32\release\armv5\urel\HtiDeviceRebootUI.exe"               - "!:\sys\bin\HtiDeviceRebootUI.exe"
 
@@ -111,4 +116,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	Fri Jun 11 16:29:34 2010 +0100
+++ b/htiui/sis/HTI_S60_Upgrade-10_1.pkg	Thu Jul 22 16:33:59 2010 +0100
@@ -18,7 +18,7 @@
 &EN
 
 ; Using UID of HtiFramework project
-#{"HTI"},(0x1020DEB6),2,21,0,TYPE=SA,RU
+#{"HTI"},(0x1020DEB6),2,25,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"
@@ -94,6 +96,9 @@
 ; HTI watchdog
 "\epoc32\release\armv5\urel\HtiWatchDog.exe"                     - "!:\sys\bin\HtiWatchDog.exe"
 
+; HTI Restart
+"\epoc32\release\armv5\urel\HtiRestart.exe"                      - "!:\sys\bin\HtiRestart.exe"
+
 ; HTI device reboot
 "\epoc32\release\armv5\urel\HtiDeviceRebootUI.exe"               - "!:\sys\bin\HtiDeviceRebootUI.exe"
 
@@ -108,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-52.pkg	Fri Jun 11 16:29:34 2010 +0100
+++ b/htiui/sis/HTI_S60_Upgrade-52.pkg	Thu Jul 22 16:33:59 2010 +0100
@@ -18,7 +18,7 @@
 &EN
 
 ; Using UID of HtiFramework project
-#{"HTI"},(0x1020DEB6),2,21,0,TYPE=SA,RU
+#{"HTI"},(0x1020DEB6),2,25,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"
@@ -97,6 +99,9 @@
 ; HTI watchdog
 "\epoc32\release\armv5\urel\HtiWatchDog.exe"                     - "!:\sys\bin\HtiWatchDog.exe"
 
+; HTI Restart
+"\epoc32\release\armv5\urel\HtiRestart.exe"                      - "!:\sys\bin\HtiRestart.exe"
+
 ; HTI device reboot
 "\epoc32\release\armv5\urel\HtiDeviceRebootUI.exe"               - "!:\sys\bin\HtiDeviceRebootUI.exe"
 
@@ -111,4 +116,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	Fri Jun 11 16:29:34 2010 +0100
+++ b/htiui/sis/HTI_stub.pkg	Thu Jul 22 16:33:59 2010 +0100
@@ -18,7 +18,7 @@
 &EN
 
 ; Using UID of HtiFramework project
-#{"HTI"},(0x1020DEB6),2,21,0
+#{"HTI"},(0x1020DEB6),2,25,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"
@@ -94,6 +96,9 @@
 ; HTI watchdog
 ""- "z:\sys\bin\HtiWatchDog.exe"
 
+; HTI Restart
+""- "z:\sys\bin\HtiRestart.exe"
+
 ; HTI device reboot
 ""- "z:\sys\bin\HtiDeviceRebootUI.exe"
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/launcher/ReleaseNotes_Launcher.txt	Thu Jul 22 16:33:59 2010 +0100
@@ -0,0 +1,135 @@
+===============================================================================
+
+RELEASE NOTES - LAUNCHER v4.0.1
+RELEASED 21st May 2010 
+
+SUPPORTS S60 3.0+
+
+===============================================================================
+
+Product Description:
+====================
+Launcher is a testing utility application aimed to help test the launching of
+applications installed in the system, both on user side disk drives and on
+ROM. Launcher tests if an application can be launched and then, if the launch
+has failed, reports the possible reason for the failure. It is a very useful
+application when checking the build as the user can instantly see if the
+applications work. Launcher can also be used when testing binary
+compatibility issues because it can reveal any DLL files missing from the
+device.
+
+Main Features:
+==============
+- Show a list of installed applications in all drives
+- Launch selected applications and read their statuses from threads
+- In case of a failure, report thread's exit type, reason and category
+- Show missing DLL files required by the binary to be launched
+- Show problems on the UI and print all cases to a log file
+- Generate a list of DLLs in the device to a file
+- Analyse binary compatibility of system DLLs comparing them to a user
+  given reference data. Report any binary compatibility issues or missing
+  DLL files.
+
+===============================================================================
+
+What's New in v4.0.1
+====================
+- Feature: Orbit UI improvements
+- Fix: Launching DLL analysis not starting
+
+===============================================================================
+
+Installation Notes:
+===================
+Launcher is typically preinstalled on ROM. If not, it can be added to the
+ROM with the .iby file. Alternatively, a .sis file can be found under the sis-
+directory, but the user needs to sign it with their own developer certificate.
+In Nokia R&D environment, you can use directly the R&D-signed .sis file under the
+internal\sis directory.
+
+When signing with own developer certificate, the following capabilities are
+needed:
+  PowerMgmt
+  ReadDeviceData
+  WriteDeviceData
+  AllFiles
+  ReadUserData
+  WriteUserData
+
+When building Launcher against S60 3.0 or 3.1, you may need to patch your SDK
+environment first with some fixes. For more information, please refer to the
+instructions under the "envpatcher" directory.
+  
+===============================================================================
+
+System Requirements:
+====================
+Basic Requirements:
+- Any S60 3.x device or emulator environment
+
+===============================================================================
+
+Compatibility Issues:
+=====================
+N/A
+
+===============================================================================
+
+Known Issues:
+=============
+
+Fails in a test despite the application is working correctly
+------------------------------------------------------------
+- Some application may exit immediately after a launch. This can be
+  normal behavior and should be checked manually. Such application is, for example, 
+  irapp.exe.
+  
+Binary compatibility check support
+----------------------------------
+- Currently, only uncompressed and deflate compressed ELF binaries are
+  supported. This means that for example WINSCW is not supported.
+
+===============================================================================
+
+Version History:
+================
+3.7.0 - 29th May 2009
+- Feature: Binary compatiblity check for DLLs, which checks UID1, UID2, UID3, SID
+and capability values of system DLLs against an XML-formatted input file.
+- Fix: Launcher panics when comparing a large DLL list against system DLLs.
+- Fix: Launcher panics when application launching is cancelled.
+
+Version 3.6.3 - 14th March 2008
+-------------------------------
+- Change: Removed unnecessary capabilities
+
+Version 3.6.2 - 6th November 2007
+--------------------------------
+- Fix: Applications can be selected/unselected on a touch UI
+- Fix: Scroll bar in the output view can be scrolled on a touch UI
+
+Version 3.6.1 - 9th October 2007
+--------------------------------
+- Fix: Layout in out tab in mirrored mode
+- Fix: Codescanner high warnings
+
+Version 3.6.0 - 25th January 2007
+---------------------------------
+- Fix: Re-fix problems when reading import section from binaries
+- Fix: Output screen for larger resolutions
+- Fix: Stopping of launching
+
+Version 3.5.0 - 4th December 2006
+---------------------------------
+- Fix: Problems when reading import section from binaries
+- Change: Marquee used for items in the application list view
+
+===============================================================================
+
+Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+All rights reserved.
+
+This component and the accompanying materials are made available
+under the terms of "Eclipse Public License v1.0"
+which accompanies this distribution, and is available
+at the URL "http://www.eclipse.org/legal/epl-v10.html".
--- a/launcher/engine/inc/e32image.h	Fri Jun 11 16:29:34 2010 +0100
+++ b/launcher/engine/inc/e32image.h	Thu Jul 22 16:33:59 2010 +0100
@@ -24,6 +24,7 @@
 #include <e32base.h>
 #include <badesca.h>
 #include <eikenv.h>
+#include <e32ldr_private.h>
 
 class E32ImageHeader;
 class E32ImportSection;
--- a/launcher/engine/inc/launcherengine.h	Fri Jun 11 16:29:34 2010 +0100
+++ b/launcher/engine/inc/launcherengine.h	Thu Jul 22 16:33:59 2010 +0100
@@ -21,7 +21,8 @@
 #include <e32base.h>
 #include <apgcli.h>
 #include <w32std.h>
-#include <e32std.h> 
+#include <e32std.h>
+#include <e32hal.h>
 
 #include "launcherparserobserver.h"
 
--- a/launcher/engine/src/launcherengine.cpp	Fri Jun 11 16:29:34 2010 +0100
+++ b/launcher/engine/src/launcherengine.cpp	Thu Jul 22 16:33:59 2010 +0100
@@ -1033,7 +1033,7 @@
     if (iBCLogFile.Open(iEnv->FsSession(), iBCLogFilePath, EFileWrite) != KErrNone)
         {
         iEnv->FsSession().MkDirAll(iLogFilePath);
-        iBCLogFile.Replace(iEnv->FsSession(), iBCLogFilePath, EFileWrite);
+        User::LeaveIfError( iBCLogFile.Replace(iEnv->FsSession(), iBCLogFilePath, EFileWrite) );
         }
     else
         {
@@ -1099,9 +1099,14 @@
 void CLauncherEngine::CancelBCAnalysis()
     {
     LOGSTRING("Launcher: CLauncherEngine::CancelBCAnalysis");
-    iXMLParser->Cancel();
+    if( iXMLParser )
+        {
+        iXMLParser->Cancel();
+        }
     iLauncherUI->PrintText(_L("\nAnalysis cancelled.\n\n"));
-
+    WriteInitialStuffToTheLogL(_L("Analysis cancelled by user"), iBCLogFile);
+    iLogWriteBuf->Des().Zero();
+    iBCLogFile.Close();
     }
 
 // ---------------------------------------------------------------------------
--- a/launcher/launcher.pro	Fri Jun 11 16:29:34 2010 +0100
+++ b/launcher/launcher.pro	Thu Jul 22 16:33:59 2010 +0100
@@ -1,19 +1,3 @@
-#
-# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-# All rights reserved.
-# This component and the accompanying materials are made available
-# under the terms of "Eclipse Public License v1.0"
-# which accompanies 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 = Launcher
 load(hb.prf)
@@ -22,8 +6,8 @@
 DEPENDPATH += inc
 INCLUDEPATH += inc
 
-HEADERS += launchermainwindow.h applicationview.h enginewrapper.h notifications.h  outputview.h commonactions.h
-SOURCES += main.cpp launchermainwindow.cpp applicationview.cpp enginewrapper.cpp notifications.cpp  outputview.cpp commonactions.cpp
+HEADERS += launchermainwindow.h applicationview.h enginewrapper.h notifications.h  outputview.h commonActions.h
+SOURCES += main.cpp launchermainwindow.cpp applicationview.cpp enginewrapper.cpp notifications.cpp  outputview.cpp commonActions.cpp
 RESOURCES += launcher.qrc
 
 symbian: {
@@ -61,7 +45,8 @@
 		
 		RSS_RULES += "group_name = \"RnD Tools\"";
 		
-		LIBS += -lapgrfx -lPlatformEnv -lxqutils -lxmlframework -lbafl -lshareui
+		LIBS += -lapgrfx -lPlatformEnv -lxqutils -lxmlframework -lbafl -lshareui -lws32 -lapparc -lefsrv -lcone
+
 
         TARGET.CAPABILITY = ReadUserData ReadDeviceData WriteUserData WriteDeviceData PowerMgmt AllFiles
         
--- a/launcher/rom/Launcher.iby	Fri Jun 11 16:29:34 2010 +0100
+++ b/launcher/rom/Launcher.iby	Thu Jul 22 16:33:59 2010 +0100
@@ -1,4 +1,4 @@
-//*
+/*
 * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
 * All rights reserved.
 * This component and the accompanying materials are made available
--- a/launcher/src/applicationview.cpp	Fri Jun 11 16:29:34 2010 +0100
+++ b/launcher/src/applicationview.cpp	Thu Jul 22 16:33:59 2010 +0100
@@ -26,7 +26,7 @@
 #include "launchermainwindow.h"
 #include "enginewrapper.h"
 #include "notifications.h"
-#include "commonactions.h"
+#include "commonActions.h"
 #include "outputview.h"
 
 
--- a/launcher/src/commonActions.cpp	Fri Jun 11 16:29:34 2010 +0100
+++ b/launcher/src/commonActions.cpp	Thu Jul 22 16:33:59 2010 +0100
@@ -20,7 +20,7 @@
 
 #include "hbaction.h"
 #include "hbmenu.h"
-#include "commonactions.h"
+#include "commonActions.h"
 #include "notifications.h"
 #include "enginewrapper.h"
 
--- a/launcher/src/enginewrapper.cpp	Fri Jun 11 16:29:34 2010 +0100
+++ b/launcher/src/enginewrapper.cpp	Thu Jul 22 16:33:59 2010 +0100
@@ -21,6 +21,7 @@
 #include <shareuidialog.h>
 #include <eikenv.h>
 #include <hbprogressdialog.h>
+#include <hbaction.h>
 #include <QDebug>
 
 #include "launchermainwindow.h"
@@ -207,7 +208,7 @@
 void EngineWrapper::doCompareDlls(HbAction* action)
     {
     HbInputDialog *dlg = static_cast<HbInputDialog*>(sender());
-    if(action == dlg->primaryAction())
+    if( action && !action->text().compare("ok", Qt::CaseInsensitive) )
         {
         TFileName fileName( dlg->value().toString().utf16() );
         TRAPD(error,  mEngine->AnalyseDLLsL( fileName ) );
--- a/launcher/src/launchermainwindow.cpp	Fri Jun 11 16:29:34 2010 +0100
+++ b/launcher/src/launchermainwindow.cpp	Thu Jul 22 16:33:59 2010 +0100
@@ -21,7 +21,7 @@
 #include <hbdocumentloader.h>
 
 #include "enginewrapper.h"
-#include "commonactions.h"
+#include "commonActions.h"
 #include "applicationview.h"
 #include "outputview.h"
 #include "launchermainwindow.h"
--- a/launcher/src/notifications.cpp	Fri Jun 11 16:29:34 2010 +0100
+++ b/launcher/src/notifications.cpp	Thu Jul 22 16:33:59 2010 +0100
@@ -45,7 +45,7 @@
 {
     Notifications::showMessageBox( 
         HbMessageBox::MessageTypeInformation, 
-        "Version 4.0.0 - 3rd March 2010. Copyright © 2010 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. Licensed under Eclipse Public License v1.0.", 
+        "Version 4.0.1 - 21st May 2010. Copyright © 2010 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. Licensed under Eclipse Public License v1.0.", 
         "About Launcher"
         );
 }
--- a/launcher/src/outputview.cpp	Fri Jun 11 16:29:34 2010 +0100
+++ b/launcher/src/outputview.cpp	Thu Jul 22 16:33:59 2010 +0100
@@ -22,7 +22,7 @@
 #include <hbtextedit.h>
 
 #include "enginewrapper.h"
-#include "commonactions.h"
+#include "commonActions.h"
 #include "outputview.h"
 
 // xml definition of view
--- a/layers.sysdef.xml	Fri Jun 11 16:29:34 2010 +0100
+++ b/layers.sysdef.xml	Thu Jul 22 16:33:59 2010 +0100
@@ -6,9 +6,6 @@
 <SystemDefinition name="rndtools" schema="1.5.1">
   <systemModel>
     <layer name="app_layer">
-      <module name="rndtools">
-        <unit unitID="tools.rndtools" mrp="" bldFile="&layer_real_source_path;/group" name="rndtools" />
-      </module>
       <module name="screengrabber">
 				<unit unitID="tools.screengrabberqt" mrp="" bldFile="&layer_real_source_path;/screengrabber" name="screengrabber" proFile="screengrabber.pro" />
 			</module>
@@ -32,7 +29,13 @@
 			</module>
 			<module name="memspyui">
 				<unit unitID="tools.memspyuiqt" mrp="" bldFile="&layer_real_source_path;/memspyui" name="memspyui" proFile="memspyui.pro" />
-			</module>			
+			</module>
+			<module name="piprofilerui">
+				<unit unitID="tools.piprofilerui" mrp="" bldFile="&layer_real_source_path;/piprofilerui" name="piprofilerui" proFile="piprofilerui.pro" />
+			</module>
+			<module name="stifui">
+				<unit unitID="tools.stifui" mrp="" bldFile="&layer_real_source_path;/stifui/avkon/group" name="stifui"/>
+			</module>
     </layer>
   </systemModel>
 </SystemDefinition>
\ No newline at end of file
--- a/loadgen/engine/inc/loadgen_memoryeat.h	Fri Jun 11 16:29:34 2010 +0100
+++ b/loadgen/engine/inc/loadgen_memoryeat.h	Thu Jul 22 16:33:59 2010 +0100
@@ -23,6 +23,7 @@
 #include <e32std.h>
 #include <e32base.h>
 #include <f32file.h>
+#include <e32hal.h>
 
 #include "loadgen_loadbase.h"
 #include "loadgen_loadattributes.h"
--- a/loadgen/engine/inc/loadgen_netconn.h	Fri Jun 11 16:29:34 2010 +0100
+++ b/loadgen/engine/inc/loadgen_netconn.h	Thu Jul 22 16:33:59 2010 +0100
@@ -22,7 +22,8 @@
 // INCLUDES
 #include <e32std.h>
 #include <e32base.h>
-#include <DownloadMgrClient.h> 
+//#include <DownloadMgrClient.h> 
+//#include <downloadcontroller.h>
 
 #include "loadgen_loadbase.h"
 #include "loadgen_loadattributes.h"
--- a/loadgen/engine/inc/loadgen_pointerevent.h	Fri Jun 11 16:29:34 2010 +0100
+++ b/loadgen/engine/inc/loadgen_pointerevent.h	Thu Jul 22 16:33:59 2010 +0100
@@ -23,7 +23,7 @@
 #include <e32std.h>
 #include <e32base.h>
 #include <w32std.h>
-
+#include <e32svr.h>
 #include "loadgen_loadbase.h"
 #include "loadgen_loadattributes.h"
 
--- a/loadgen/group/bld.inf	Fri Jun 11 16:29:34 2010 +0100
+++ b/loadgen/group/bld.inf	Thu Jul 22 16:33:59 2010 +0100
@@ -1,13 +1,13 @@
 // ============================================================================
 // * Makefile for building: group
-// * Generated by qmake (2.01a) (Qt 4.6.1) on: 2010-02-23T09:27:08
+// * Generated by qmake (2.01a) (Qt 4.6.3) on: 2010-06-17T13:18:03
 // * This file is generated by qmake and should not be modified by the
 // * user.
 // * Project:  group.pro
 // * Template: subdirs
 // ============================================================================
 
-#define BLD_INF_GROUP_0010C4D8
+#define BLD_INF_GROUP_037FC092
 
 
 prj_platforms
@@ -15,10 +15,17 @@
 WINSCW GCCE ARMV5 ARMV6
 #include "bld_generic.inf"
 
-#include "../ui/avkon/group/bld.inf"
 
 prj_mmpfiles
 
 
 prj_extensions
 
+
+#if defined(WINSCW)
+#endif
+
+START EXTENSION qt/qmake_store_build
+END
+
+
--- a/loadgen/group/group.pro	Fri Jun 11 16:29:34 2010 +0100
+++ b/loadgen/group/group.pro	Thu Jul 22 16:33:59 2010 +0100
@@ -1,18 +1,3 @@
-#
-# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-# All rights reserved.
-# This component and the accompanying materials are made available
-# under the terms of "Eclipse Public License v1.0"
-# which accompanies 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
--- a/loadgen/rom/loadgen.iby	Fri Jun 11 16:29:34 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,35 +0,0 @@
-/*
-* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-*
-*/
-
-
-#ifndef __LOADGEN_IBY__
-#define __LOADGEN_IBY__
-
-S60_APP_EXE(LoadGen)
-S60_APP_AIF_ICONS(LoadGen)
-S60_APP_RESOURCE(LoadGen)
-SCALABLE_IMAGE(APP_BITMAP_DIR,APP_BITMAP_DIR,LoadGen_ExtraIcons)
-#ifdef S60_UPGRADABLE_APP_REG_RSC
-  S60_UPGRADABLE_APP_REG_RSC(LoadGen)
-#else
-  S60_APP_AIF_RSC(LoadGen)
-#endif
-
-data=ZPRIVATE\20011384\backup_registration.xml        	private\20011384\backup_registration.xml
-data=ZSYSTEM\Install\LoadGen_stub.sis                   \system\install\LoadGen_stub.sis
-
-#endif // __LOADGEN_IBY__
--- a/loadgen/sis/LoadGen_stub.pkg	Fri Jun 11 16:29:34 2010 +0100
+++ b/loadgen/sis/LoadGen_stub.pkg	Thu Jul 22 16:33:59 2010 +0100
@@ -29,6 +29,7 @@
 
 ; normal stuff:
 ""-"z:\sys\bin\LoadGen.exe"
+""-"z:\Resource\Apps\LoadGen.mif"
 ""-"z:\Resource\Apps\LoadGen_aif.mif"
 ""-"z:\Resource\Apps\LoadGen_ExtraIcons.mif"
 ""-"z:\Resource\Apps\LoadGen.rsc"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/loadgen/ui/avkon/rom/loadgen.iby	Thu Jul 22 16:33:59 2010 +0100
@@ -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 the License "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  
+*
+*/
+
+
+#ifndef __LOADGEN_IBY__
+#define __LOADGEN_IBY__
+
+S60_APP_EXE(LoadGen)
+S60_APP_AIF_ICONS(LoadGen)
+S60_APP_RESOURCE(LoadGen)
+SCALABLE_IMAGE(APP_BITMAP_DIR,APP_BITMAP_DIR,LoadGen_ExtraIcons)
+#ifdef S60_UPGRADABLE_APP_REG_RSC
+  S60_UPGRADABLE_APP_REG_RSC(LoadGen)
+#else
+  S60_APP_AIF_RSC(LoadGen)
+#endif
+
+data=ZPRIVATE\20011384\backup_registration.xml        	private\20011384\backup_registration.xml
+data=ZSYSTEM\Install\LoadGen_stub.sis                   \system\install\LoadGen_stub.sis
+
+#endif // __LOADGEN_IBY__
--- a/loadgen/ui/hb/hb.pro	Fri Jun 11 16:29:34 2010 +0100
+++ b/loadgen/ui/hb/hb.pro	Thu Jul 22 16:33:59 2010 +0100
@@ -1,111 +1,100 @@
-#
 # 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: 
-#
-#
-
-
+# Description:
 TEMPLATE = app
 TARGET = LoadGen
 DEPENDPATH += .
-
-INCLUDEPATH += . /inc
+INCLUDEPATH += . \
+    /inc
 INCLUDEPATH += ./inc \
-			   ../../engine/inc \
-			   /epoc32/include \
-				 /epoc32/include/mw \
-				 /epoc32/include/platform/mw \
-				 /epoc32/include/platform \
-				 /epoc32/include/app \
-				 /epoc32/include/platform/app \
-				 /epoc32/include/platform/loc \
-				 /epoc32/include/platform/mw/loc \
-				 /epoc32/include/platform/app/loc \
-				 /epoc32/include/platform/loc/sc \
-				 /epoc32/include/platform/mw/loc/sc \
-				 /epoc32/include/platform/app/loc/sc
-
+    ../../engine/inc
 load(hb.prf)
 symbian:CONFIG -= symbian_i18n
-
-HEADERS += inc/mainview.h inc/settingsview.h inc/notifications.h 
-SOURCES += src/main.cpp src/mainview.cpp src/settingsview.cpp src/notifications.cpp 
+HEADERS += inc/mainview.h \
+    inc/settingsview.h \
+    inc/notifications.h
+SOURCES += src/main.cpp \
+    src/mainview.cpp \
+    src/settingsview.cpp \
+    src/notifications.cpp
 RESOURCES += loadgen.qrc
-
-symbian: {
-		BLD_INF_RULES.prj_exports += "./rom/loadgen.iby CORE_IBY_EXPORT_PATH(tools,loadgen.iby)"
-
-		HEADERS += inc/engine.h \ 
-		           inc/enginewrapper.h 
-		SOURCES += src/engine.cpp \
-		           src/enginewrapper.cpp \
-				   ../../engine/src/loadgen_utils.cpp  \
-        		   ../../engine/src/loadgen_loadbase.cpp  \
- 				   ../../engine/src/loadgen_cpuload.cpp \
- 				   ../../engine/src/loadgen_memoryeat.cpp \
- 				   ../../engine/src/loadgen_phonecall.cpp \
- 				   ../../engine/src/loadgen_netconn.cpp \
- 				   ../../engine/src/loadgen_keypress.cpp \
- 				   ../../engine/src/loadgen_messages.cpp \ 
- 				   ../../engine/src/loadgen_applications.cpp \ 
- 				   ../../engine/src/loadgen_photocapture.cpp \
- 				   ../../engine/src/loadgen_bluetooth.cpp \ 
- 				   ../../engine/src/loadgen_pointerevent.cpp 
-		
-		
-		RSS_RULES += "group_name = \"RnD Tools\"";
-		LIBS += -leuser \
-				-lcommonengine \
-				-lapparc \
-				-lcone \ 
-				-leikcore \
-				-leikcoctl \
-				-leikctl \
-				-leikdlg \  
-				-lws32 \ 
-				-lapgrfx \
-				-lefsrv \
-				-lbafl \
-				-lgdi \
-				-legul \
-				-letel3rdparty \
-				-ldownloadmgr \
-				-lcommdb \
-				-lflogger \
-				-lestor \ 
-				-lmsgs \
-				-lsmcm \
-				-lgsmu \
-				-letext \
-				-lsendas2 \
-				-lecam \
-				-lfeatdiscovery \ 
-				-lcentralrepository \
-				-lesock \
-				-lbluetooth \
-				-lhal
-    TARGET.CAPABILITY = swevent ReadUserData WriteUserData NetworkServices UserEnvironment CAP_APPLICATION AllFiles
-
+symbian: { 
+    MMP_RULES -= PAGED
+    MMP_RULES *= UNPAGED
+    BLD_INF_RULES.prj_exports += "./rom/loadgen.iby CORE_IBY_EXPORT_PATH(tools,loadgen.iby)"
+    INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE
+    HEADERS += inc/engine.h \
+        inc/enginewrapper.h
+    SOURCES += src/engine.cpp \
+        src/enginewrapper.cpp \
+        ../../engine/src/loadgen_utils.cpp \
+        ../../engine/src/loadgen_loadbase.cpp \
+        ../../engine/src/loadgen_cpuload.cpp \
+        ../../engine/src/loadgen_memoryeat.cpp \
+        ../../engine/src/loadgen_phonecall.cpp \
+        ../../engine/src/loadgen_keypress.cpp \
+        ../../engine/src/loadgen_messages.cpp \
+        ../../engine/src/loadgen_applications.cpp \
+        ../../engine/src/loadgen_photocapture.cpp \
+        ../../engine/src/loadgen_bluetooth.cpp \
+        ../../engine/src/loadgen_pointerevent.cpp
+    RSS_RULES += "group_name = \"RnD Tools\"";
+    LIBS += -leuser \
+        -lcommonengine \
+        -lapparc \
+        -lcone \
+        -leikcore \
+        -leikcoctl \
+        -leikctl \
+        -leikdlg \
+        -lws32 \
+        -lapgrfx \
+        -lefsrv \
+        -lbafl \
+        -lgdi \
+        -legul \
+        -letel3rdparty \
+        -lcommdb \
+        -lflogger \
+        -lestor \
+        -lmsgs \
+        -lsmcm \
+        -lgsmu \
+        -letext \
+        -lsendas2 \
+        -lecam \
+        -lfeatdiscovery \
+        -lcentralrepository \
+        -lesock \
+        -lbluetooth \
+        -lhal
+    TARGET.CAPABILITY = swevent \
+        ReadUserData \
+        WriteUserData \
+        NetworkServices \
+        UserEnvironment \
+        CAP_APPLICATION \
+        AllFiles
     TARGET.UID2 = 0x100039CE
     TARGET.UID3 = 0x20011384
     // TARGET.SID = 0x20011384
-    TARGET.VID = 0x101FB657 // Nokia
-	
-    TARGET.EPOCHEAPSIZE = 0x10000 0x1000000  // Min 64Kb, Max 16Mb
-
-    ICON = ../../icons/qgn_menu_loadgen.svg 
-
-} else {
-    error("Only Symbian supported!")
+    TARGET.VID = 0x101FB657 \
+        // \
+        Nokia
+    TARGET.EPOCHEAPSIZE = 0x10000 \
+        0x1000000 \
+        // \
+        Min \
+        64Kb, \
+        Max \
+        16Mb
+    ICON = ../../icons/qgn_menu_loadgen.svg
 }
+else:error("Only Symbian supported!")
--- a/loadgen/ui/hb/src/engine.cpp	Fri Jun 11 16:29:34 2010 +0100
+++ b/loadgen/ui/hb/src/engine.cpp	Thu Jul 22 16:33:59 2010 +0100
@@ -24,7 +24,7 @@
 #include "loadgen_cpuload.h"
 #include "loadgen_memoryeat.h"
 #include "loadgen_phonecall.h"
-#include "loadgen_netconn.h"
+//#include "loadgen_netconn.h"
 #include "loadgen_keypress.h"
 #include "loadgen_pointerevent.h"
 #include "loadgen_messages.h"
@@ -530,11 +530,12 @@
             item = CPhoneCall::NewL(iPhoneCallAttributes, iReferenceNumber);
             break;
             }
-        case ELoadGenCmdNewLoadNetConn:
+/*        case ELoadGenCmdNewLoadNetConn:
             {
             item = CNetConn::NewL(iNetConnAttributes, iReferenceNumber);
             break;
             }
+*/            
         case ELoadGenCmdNewLoadKeyPress:
             {
             item = CKeyPress::NewL(iKeyPressAttributes, iReferenceNumber);
@@ -1022,6 +1023,7 @@
 
 TNetConnAttributes CEngine::GetNetConnAttributes()
 	{ 
+/*  
 	if (iEditExistingLoad == EFalse)
 		{	
 		return iNetConnAttributes; 
@@ -1031,12 +1033,14 @@
 		CLoadBase* aItem = iLoadItemList->At(iCurrentItemIndex);
 		return (static_cast<CNetConn*>(aItem)->Attributes());
 		}
+*/		
 	}
 
 // --------------------------------------------------------------------------------------------		
 	
 void CEngine::ChangeNetConnAttributes(TNetConnAttributes aAttributes)
 	{
+/*    
 	if (iEditExistingLoad == EFalse) 
 		{
 		iNetConnAttributes = aAttributes; 
@@ -1045,7 +1049,8 @@
 		{
 		CLoadBase* aItem = iLoadItemList->At(iCurrentItemIndex);
 		static_cast<CNetConn*>(aItem)->SetAttributes(aAttributes);
-		}	
+		}
+*/			
 	}
 	
 // --------------------------------------------------------------------------------------------	
--- a/loadgen/ui/hb/src/enginewrapper.cpp	Fri Jun 11 16:29:34 2010 +0100
+++ b/loadgen/ui/hb/src/enginewrapper.cpp	Thu Jul 22 16:33:59 2010 +0100
@@ -19,6 +19,7 @@
 #include <hbmainwindow.h>
 //#include <hbcommonnote.h>
 #include <hbpopup.h>
+#include <hbaction.h>
 
 #include <QString>
  #include <QStringList>
@@ -136,8 +137,7 @@
 
 void EngineWrapper::StopLoadYesNoDialogClosed(HbAction *action)
 {
-    HbMessageBox *dlg = static_cast<HbMessageBox*>(sender());
-    if(action == dlg->primaryAction()){
+    if( action && !action->text().compare("yes", Qt::CaseInsensitive) ){
         const CArrayFix<TInt>* selectionIndexes = NULL;
         try{
             QT_TRAP_THROWING( selectionIndexes = QueryListSelectedIndexesOrCurrentItemL() );
--- a/loadgen/ui/hb/src/mainview.cpp	Fri Jun 11 16:29:34 2010 +0100
+++ b/loadgen/ui/hb/src/mainview.cpp	Thu Jul 22 16:33:59 2010 +0100
@@ -106,11 +106,12 @@
 		mMessagesLoadAction = mLoadSubMenu1->addAction("Messages");
 		connect(mMessagesLoadAction, SIGNAL( triggered() ), mSm, SLOT(map()));
 		mSm->setMapping(mMessagesLoadAction, ELoadGenCmdNewLoadMessages);
-
+//TODO to be fixed using replacement for downloadmanager
+/*
 		mNetConnLoadAction = mLoadSubMenu1->addAction("Network conn.");
 		connect(mNetConnLoadAction, SIGNAL( triggered() ), mSm, SLOT(map()));
 		mSm->setMapping(mNetConnLoadAction, ELoadGenCmdNewLoadNetConn);
-	
+*/	
 		mKeyPressLoadAction = mLoadSubMenu2->addAction("Key presses");
 		connect(mKeyPressLoadAction, SIGNAL( triggered() ), mSm, SLOT(map()));
 		mSm->setMapping(mKeyPressLoadAction, ELoadGenCmdNewLoadKeyPress);
--- a/memspyui/data/memspyui.rss	Fri Jun 11 16:29:34 2010 +0100
+++ b/memspyui/data/memspyui.rss	Thu Jul 22 16:33:59 2010 +0100
@@ -35,7 +35,7 @@
 
 
 // User includes
-#include "MemSpy.hrh"
+#include "../ui/avkon/inc/MemSpy.hrh"
 
 
 RESOURCE RSS_SIGNATURE { }
--- a/memspyui/ui/avkon/group/memspyui.mmp	Fri Jun 11 16:29:34 2010 +0100
+++ b/memspyui/ui/avkon/group/memspyui.mmp	Thu Jul 22 16:33:59 2010 +0100
@@ -64,7 +64,6 @@
 source			MemSpyViewECom.cpp
 */
 source          MemSpyViewThreads.cpp
-/*
 source          MemSpyViewThreadInfoItemList.cpp
 source          MemSpyViewThreadInfoItemGeneric.cpp
 source          MemSpyViewThreadInfoItemHeap.cpp
@@ -74,6 +73,7 @@
 source          MemSpyViewThreadInfoItemServer.cpp
 source          MemSpyViewThreadInfoItemActiveObject.cpp
 source          MemSpyViewThreadInfoItemGeneralInfo.cpp
+/*
 source          MemSpyViewHeapTracking.cpp
 source          MemSpyViewHeapTrackingResults.cpp
 source          MemSpyViewHeapTrackingSettings.cpp
--- a/memspyui/ui/avkon/inc/MemSpyAppUi.h	Fri Jun 11 16:29:34 2010 +0100
+++ b/memspyui/ui/avkon/inc/MemSpyAppUi.h	Thu Jul 22 16:33:59 2010 +0100
@@ -30,6 +30,7 @@
 #include "MemSpyDeviceWideOperationDialog.h"
 #include "MemSpyContainerObserver.h"
 #include <memspy/engine/memspyengineobserver.h>
+#include "MemSpySettings.h"
 
 // Classes referenced
 class CEikMenuBar;
@@ -41,7 +42,7 @@
 class RMemSpySession;
 
 
-class CMemSpyAppUi : public CAknAppUi, public MMemSpyContainerObserver, public MCoeControlObserver, public MMemSpyEngineObserver, public MMemSpyDeviceWideOperationDialogObserver
+class CMemSpyAppUi : public CAknAppUi, public MMemSpyContainerObserver, public MCoeControlObserver, public MMemSpyEngineObserver//, public MMemSpyDeviceWideOperationDialogObserver
     {
 public:
     //CMemSpyAppUi( CMemSpyEngine& aEngine );
@@ -95,7 +96,8 @@
     void OnCmdOutputToFileL();
  
     // Phone-information
-    void OnCmdPhoneInformationOperationL( CMemSpyDeviceWideOperations::TOperation aOp );
+    //void OnCmdPhoneInformationOperationL( CMemSpyDeviceWideOperations::TOperation aOp );
+    void OnCmdPhoneInformationOperationL( TDeviceWideOperation aOperation );
     void OnCmdPhoneInformationOperationKernelContainersL();
     
     // Automatic capture
@@ -116,6 +118,7 @@
     //CMemSpyEngine& iEngine;
     RMemSpySession& iMemSpySession;
     CMemSpyContainer* iAppContainer;
+    CMemSpySettings* iSettings;
     
     // For phone information dialog
     TBool iRunningDeviceWideOperation;
--- a/memspyui/ui/avkon/inc/MemSpyDeviceWideOperationDialog.h	Fri Jun 11 16:29:34 2010 +0100
+++ b/memspyui/ui/avkon/inc/MemSpyDeviceWideOperationDialog.h	Thu Jul 22 16:33:59 2010 +0100
@@ -21,12 +21,41 @@
 // System includes
 #include <AknProgressDialog.h>
 #include <AknWaitDialog.h>
+#include <e32cmn.h>
 
 // Engine includes
 #include <memspy/engine/memspydevicewideoperations.h>
+#include <memspyengineclientinterface.h>
+#include <memspysession.h>
+
+//#include "MemSpyAppUi.h"
 
 // Classes referenced
-class CMemSpyEngine;
+//class RMemSpySession;
+
+enum TDeviceWideOperation
+{
+	OutputPhoneInfo = 0,
+	    
+	OutputDetailedPhoneInfo,
+	    
+	OutputHeapInfo,
+	    
+	OutputCompactHeapInfo,
+	    
+	OutputHeapCellListing,
+	    
+	OutputHeapData,
+	    
+	OutputStackInfo,
+	    
+	OutputCompactStackInfo,
+	    
+	OutputUserStackData,
+	    
+	OutputKernelStackData
+};
+
 
 class MMemSpyDeviceWideOperationDialogObserver
     {
@@ -37,15 +66,94 @@
     };
 
 
+class CMemSpyDwoProgressTracker : public CActive, public MProgressDialogCallback
+{
+public:
+	CMemSpyDwoProgressTracker(RMemSpySession &aSession);
+	
+	virtual ~CMemSpyDwoProgressTracker();
+	
+	void Start();
+	
+	void Cancel();
+	
+	TMemSpyDeviceWideOperationProgress Progress() { return iProgress; }
+	
+	CAknProgressDialog* ProgressDialog() { return iProgressDialog; }
+	
+	void UpdateProcessDialogL( TInt aProgress, const TDesC& aProgressText );
+
+protected: // from CActive
+	
+	void DialogDismissedL(TInt aButtonId);
+	
+	virtual void RunL();
+	 
+	virtual void DoCancel();
+	 
+	virtual TInt RunError(TInt aError);
+	
+private:
+	TMemSpyDeviceWideOperationProgress iProgress;
+	RMemSpySession iSession;	
+	
+	CEikProgressInfo* iProgressInfo;
+	CAknProgressDialog* iProgressDialog;		
+};
+
+
+
+
+
+
+class CMemSpyDwoTracker : public CActive
+{	
+public:	
+	CMemSpyDwoTracker(RMemSpySession &aSession, TDeviceWideOperation aOperation);
+	
+	virtual ~CMemSpyDwoTracker();
+	
+	void Start();
+	
+	void Cancel();		
+	
+protected: // from CActive
+	
+	virtual void RunL();
+	 
+	virtual void DoCancel();
+	 
+	virtual TInt RunError(TInt aError);		
+	
+private:
+	RMemSpySession iSession;
+	CMemSpyDwoProgressTracker *iProgressTracker;	
+	TDeviceWideOperation iOperation;
+};
+
+
+
+
+
+
+
 class CMemSpyDeviceWideOperationDialog : public CBase, public MProgressDialogCallback, public MMemSpyDeviceWideOperationsObserver
     {
 public:
-    static void ExecuteLD( CMemSpyEngine& aEngine, MMemSpyDeviceWideOperationDialogObserver& aObserver, CMemSpyDeviceWideOperations::TOperation aOperation );
+    //static void ExecuteLD( CMemSpyEngine& aEngine, MMemSpyDeviceWideOperationDialogObserver& aObserver, CMemSpyDeviceWideOperations::TOperation aOperation );
+	//static void ExecuteLD( RMemSpySession& aSession, MMemSpyDeviceWideOperationDialogObserver& aObserver, CMemSpyDeviceWideOperations::TOperation aOperation );
+	static void ExecuteLD( RMemSpySession& aSession, TDeviceWideOperation aOp );
     ~CMemSpyDeviceWideOperationDialog();
+    
+    //added
+    static CMemSpyDwoTracker* CreateDeviceWideOperation( RMemSpySession& aSession, TDeviceWideOperation aOp );
 
 private:
-    CMemSpyDeviceWideOperationDialog( CMemSpyEngine& aEngine, MMemSpyDeviceWideOperationDialogObserver& aObserver );
-    void ExecuteL( CMemSpyDeviceWideOperations::TOperation aOperation );
+    //CMemSpyDeviceWideOperationDialog( CMemSpyEngine& aEngine, MMemSpyDeviceWideOperationDialogObserver& aObserver );
+    //CMemSpyDeviceWideOperationDialog( RMemSpySession& aSession, MMemSpyDeviceWideOperationDialogObserver& aObserver );
+    CMemSpyDeviceWideOperationDialog( RMemSpySession& aSession );
+    //void ExecuteL( CMemSpyDeviceWideOperations::TOperation aOperation );
+    void ExecuteL( TDeviceWideOperation aOp );
 
 public: // API
     void Cancel();
@@ -60,13 +168,13 @@
     void SetDialogCaptionL( const TDesC& aText );
 
 private: // Member data
-    CMemSpyEngine& iEngine;
-    MMemSpyDeviceWideOperationDialogObserver& iObserver;
+    //CMemSpyEngine& iEngine;
+    RMemSpySession iSession;	
+    //MMemSpyDeviceWideOperationDialogObserver& iObserver;
     TBool iForcedCancel;
     CEikProgressInfo* iProgressInfo;
     CAknProgressDialog* iProgressDialog;
-    CMemSpyDeviceWideOperations* iOperation;
+    CMemSpyDeviceWideOperations* iOperation;        
     };
 
-
 #endif
--- a/memspyui/ui/avkon/inc/MemSpySettings.h	Fri Jun 11 16:29:34 2010 +0100
+++ b/memspyui/ui/avkon/inc/MemSpySettings.h	Thu Jul 22 16:33:59 2010 +0100
@@ -25,6 +25,7 @@
 
 // Engine includes
 #include <memspy/engine/memspyengineoutputsink.h>
+#include <memspy/engine/memspyenginehelpersysmemtrackerconfig.h>
 
 // Classes referenced
 class CMemSpyEngine;
@@ -48,6 +49,8 @@
 public: // API
     inline RFs& FsSession() { return iFsSession; }
     void StoreSettingsL();
+    
+    void SetSinkType( TMemSpySinkType aType ) { iSinkType = aType; }
 
 private: // Settings methods
     void RestoreSettingsL();
@@ -56,9 +59,13 @@
     RFile SettingsFileLC( TBool aReplace = EFalse );
 
 private: // Data members
-    RFs& iFsSession;
-    //CMemSpyEngine& iEngine;
-    //RMemSpySession& iMemSpySession;
+    RFs& iFsSession;    
+    RMemSpySession& iMemSpySession;
+    
+private: //Settings
+    TMemSpySinkType iSinkType;
+    TMemSpyEngineHelperSysMemTrackerConfig iSwmtConfig;
+    RArray<TUid> iUidList;
     };
 
 
--- a/memspyui/ui/avkon/inc/MemSpyUiUtils.h	Fri Jun 11 16:29:34 2010 +0100
+++ b/memspyui/ui/avkon/inc/MemSpyUiUtils.h	Thu Jul 22 16:33:59 2010 +0100
@@ -20,9 +20,58 @@
 
 // System includes
 #include <e32std.h>
+#include <e32const.h>
 
 // Engine includes
 #include <memspy/engine/memspyengineutils.h>
+#include <memspy/engine/memspyengineobjectthreadinfoobjects.h>
+
+typedef TBuf<20> TMemSpySizeText;
+
+_LIT( KTab, "\t" );
+
+//ThreadInfoItemList view types
+_LIT( KTypeUnknown, "Unknown Type" );
+_LIT( KGeneral, "General" );
+_LIT( KHeap, "Heap" );
+_LIT( KStack, "Stack" );
+_LIT( KChunks, "Chunks" );
+_LIT( KCodeSegs, "Code Segments" );
+_LIT( KOpenFiles, "Open Files" );
+_LIT( KActiveObjects, "Active Objects" );
+_LIT( KThreadHandlers, "Handlers to other Threads" );
+_LIT( KProcessHandlers, "Handlers to other Processes" );
+_LIT( KServers, "Servers running in Thread" );
+_LIT( KConnections, "Client <> Server Connections" );
+_LIT( KSemaphores, "Semaphores" );
+_LIT( KThreadReferences, "References in Thread" );
+_LIT( KProcessReferences, "References in Process" );
+_LIT( KMutexes, "Mutexes" );
+_LIT( KTimers, "Timers" );
+_LIT( KDD, "Logical DD Channels" );
+_LIT( KChangeNotif, "Change Notifiers" );
+_LIT( KUndertakers, "Undertakers" );
+_LIT( KLogicalDrivers, "Logical Device Drivers" );
+_LIT( KPhysicalDrivers, "Physical Device Drivers" );	
+
+//Kernel Object types
+_LIT( KTypeThread, "Thread" );
+_LIT( KTypeProcess, "Process" );
+_LIT( KTypeChunk, "Chunk" );
+_LIT( KTypeLibrary, "Library" );
+_LIT( KTypeSemaphore, "Semaphore" );
+_LIT( KTypeMutex, "Mutex" );
+_LIT( KTypeTimer, "Timer" );
+_LIT( KTypeServer, "Server" );
+_LIT( KTypeSession, "Session" );
+_LIT( KTypeLogicalDevice, "Logical Device" );
+_LIT( KTypePhysicalDevice, "Physical Device" );
+_LIT( KTypeLogicalChannel, "Logical Channel" );
+_LIT( KTypeChangeNotifier, "Change Notifier" );
+_LIT( KTypeUndertaker, "Undertaker" );
+_LIT( KTypeMsgQueue, "Msg. Queue" );
+_LIT( KTypePropertyRef, "Property Ref." );
+_LIT( KTypeCondVar, "Conditional Var." );
 
 
 class MemSpyUiUtils : public MemSpyEngineUtils
@@ -30,6 +79,15 @@
 public:
     static void Format( TDes& aBuf, TInt aResourceId, ...);
     static void GetErrorText( TDes& aBuf, TInt aError );
+    static HBufC* FormatItem( const TDesC& aCaption );
+    static TDesC& ThreadInfoItemNameByType( TMemSpyThreadInfoItemType aType );
+    static void AppendPriority( TDes& aDes, TProcessPriority aPriority );
+    static void AppendExitInfo( TDes& aDes, TExitType aType, TInt aExitReason, const TDesC& aExitCategory  );
+    static void AppendExitType( TDes& aDes, TExitType aType );
+    
+    //for Kernel Objects
+    static TPtrC TypeAsString( TMemSpyDriverContainerType aType );
+    static TMemSpySizeText FormatSizeText( const TInt64& aValue, TInt aDecimalPlaces, TBool aExtraRounding = EFalse );
     };
 
 
--- a/memspyui/ui/avkon/inc/MemSpyViewKernelObjects.h	Fri Jun 11 16:29:34 2010 +0100
+++ b/memspyui/ui/avkon/inc/MemSpyViewKernelObjects.h	Thu Jul 22 16:33:59 2010 +0100
@@ -66,7 +66,7 @@
     TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType );
 
 private: // From MAknTabObserver
-    void TabChangedL( TInt aIndex ); 
+    void TabChangedL( TInt aIndex );     
     
 private: // Command handlers
     void OnCmdTerminateL();
--- a/memspyui/ui/avkon/inc/MemSpyViewThreadInfoItemActiveObject.h	Fri Jun 11 16:29:34 2010 +0100
+++ b/memspyui/ui/avkon/inc/MemSpyViewThreadInfoItemActiveObject.h	Thu Jul 22 16:33:59 2010 +0100
@@ -27,14 +27,14 @@
 
 // Classes referenced
 class CMemSpyEngineActiveObjectArray;
-
+class RMemSpySession;
 
 
 class CMemSpyViewThreadInfoItemActiveObjectBase : public CMemSpyViewThreadInfoItemGeneric
     {
 public:
-    CMemSpyViewThreadInfoItemActiveObjectBase( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyThreadInfoContainer& aContainer );
-
+    CMemSpyViewThreadInfoItemActiveObjectBase( RMemSpySession& aSession, MMemSpyViewObserver& aObserver, TProcessId aProcId, TThreadId aId, TMemSpyThreadInfoItemType aType );
+    
 public: // From CMemSpyViewBase
     TBool HandleCommandL( TInt aCommand );
 
@@ -55,7 +55,7 @@
 class CMemSpyViewThreadInfoItemActiveObject : public CMemSpyViewThreadInfoItemActiveObjectBase
     {
 public:
-    CMemSpyViewThreadInfoItemActiveObject( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyThreadInfoContainer& aContainer );
+    CMemSpyViewThreadInfoItemActiveObject( RMemSpySession& aSession, MMemSpyViewObserver& aObserver, TProcessId aProcId, TThreadId aId, TMemSpyThreadInfoItemType aType );
     void ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune = NULL );
 
 public: // From CMemSpyViewBase
--- a/memspyui/ui/avkon/inc/MemSpyViewThreadInfoItemChunk.h	Fri Jun 11 16:29:34 2010 +0100
+++ b/memspyui/ui/avkon/inc/MemSpyViewThreadInfoItemChunk.h	Thu Jul 22 16:33:59 2010 +0100
@@ -25,11 +25,12 @@
 // User includes
 #include "MemSpyViewThreadInfoItemGeneric.h"
 
+class RMemSpySession;
 
 class CMemSpyViewThreadInfoItemChunk : public CMemSpyViewThreadInfoItemGeneric
     {
 public:
-    CMemSpyViewThreadInfoItemChunk( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyThreadInfoContainer& aContainer );
+    CMemSpyViewThreadInfoItemChunk( RMemSpySession& aSession, MMemSpyViewObserver& aObserver, TProcessId aProcId,  TThreadId aId, TMemSpyThreadInfoItemType aType );
 
 private: // From CMemSpyViewBase
     CMemSpyViewBase* PrepareChildViewL();
--- a/memspyui/ui/avkon/inc/MemSpyViewThreadInfoItemCodeSeg.h	Fri Jun 11 16:29:34 2010 +0100
+++ b/memspyui/ui/avkon/inc/MemSpyViewThreadInfoItemCodeSeg.h	Thu Jul 22 16:33:59 2010 +0100
@@ -25,11 +25,12 @@
 // User includes
 #include "MemSpyViewThreadInfoItemGeneric.h"
 
+class RMemSpySession;
 
 class CMemSpyViewThreadInfoItemCodeSeg : public CMemSpyViewThreadInfoItemGeneric
     {
 public:
-    CMemSpyViewThreadInfoItemCodeSeg( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyThreadInfoContainer& aContainer );
+    CMemSpyViewThreadInfoItemCodeSeg( RMemSpySession& aSession, MMemSpyViewObserver& aObserver, TProcessId aProcId, TThreadId aId, TMemSpyThreadInfoItemType aType );
 
 public: // From CMemSpyViewBase
     TBool HandleCommandL( TInt aCommand );
--- a/memspyui/ui/avkon/inc/MemSpyViewThreadInfoItemGeneralInfo.h	Fri Jun 11 16:29:34 2010 +0100
+++ b/memspyui/ui/avkon/inc/MemSpyViewThreadInfoItemGeneralInfo.h	Thu Jul 22 16:33:59 2010 +0100
@@ -25,11 +25,14 @@
 // User includes
 #include "MemSpyViewThreadInfoItemGeneric.h"
 
+class CMemSpyThreadInfoContainer;
+class CMemSpyThreadInfoItemBase;
+class RMemSpySession;
 
 class CMemSpyViewThreadInfoItemGeneralInfo : public CMemSpyViewThreadInfoItemGeneric
     {
 public:
-    CMemSpyViewThreadInfoItemGeneralInfo( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyThreadInfoContainer& aContainer );
+    CMemSpyViewThreadInfoItemGeneralInfo( RMemSpySession& aSession, MMemSpyViewObserver& aObserver, TProcessId aProcId, TThreadId aId, TMemSpyThreadInfoItemType aType );
 
 public: // From CMemSpyViewBase
     TBool HandleCommandL( TInt aCommand );
--- a/memspyui/ui/avkon/inc/MemSpyViewThreadInfoItemGeneric.h	Fri Jun 11 16:29:34 2010 +0100
+++ b/memspyui/ui/avkon/inc/MemSpyViewThreadInfoItemGeneric.h	Thu Jul 22 16:33:59 2010 +0100
@@ -24,6 +24,7 @@
 
 // Engine includes
 #include <memspy/engine/memspyengineobjectthreadinfoobjects.h>
+#include <memspy/api/memspyapithreadinfoitem.h>
 
 // User includes
 #include "MemSpyViewBase.h"
@@ -34,12 +35,13 @@
 class CMemSpyThread;
 class CMemSpyThreadInfoContainer;
 class CMemSpyThreadInfoItemBase;
-
+class RMemSpySession;
 
 class CMemSpyViewThreadInfoItemGeneric : public CMemSpyViewBase
     {
 public:
-    CMemSpyViewThreadInfoItemGeneric( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyThreadInfoContainer& aInfoContainer, TMemSpyThreadInfoItemType aType );
+    //CMemSpyViewThreadInfoItemGeneric( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyThreadInfoContainer& aInfoContainer, TMemSpyThreadInfoItemType aType );
+	CMemSpyViewThreadInfoItemGeneric( RMemSpySession& aSession, MMemSpyViewObserver& aObserver, TProcessId aProcessId, TThreadId aId, TMemSpyThreadInfoItemType aType );
     ~CMemSpyViewThreadInfoItemGeneric();
 
 public: // From CMemSpyViewBase
@@ -50,7 +52,8 @@
     CMemSpyThread& Thread() const;
     CMemSpyThreadInfoContainer& Container() const;
     CMemSpyThreadInfoItemBase& InfoItem() const;
-
+    TThreadId ThreadId() { return iThreadId; }
+    
 public: // From CMemSpyViewBase
     void RefreshL();
     TMemSpyViewType ViewType() const;
@@ -69,12 +72,18 @@
     static TInt CheckForItemConstructionComplete( TAny* aSelf );
 
 protected: // Member data
-    CMemSpyThreadInfoContainer& iContainer;
-    CMemSpyThreadInfoItemBase* iInfoItem;
-
+    //CMemSpyThreadInfoContainer& iContainer;
+    //CMemSpyThreadInfoItemBase* iInfoItem;
+    
 private: // Member data
     CAknWaitDialog* iWaitNote;
     CPeriodic* iWaitConstructionChecker;
+    
+    RArray<CMemSpyApiThreadInfoItem*> iThreadInfoItems;  //cigasto
+    CDesCArrayFlat* iModel;
+    TThreadId iThreadId;
+    TProcessId iParentProcessId;
+    TMemSpyThreadInfoItemType iType;
     };
 
 
--- a/memspyui/ui/avkon/inc/MemSpyViewThreadInfoItemHeap.h	Fri Jun 11 16:29:34 2010 +0100
+++ b/memspyui/ui/avkon/inc/MemSpyViewThreadInfoItemHeap.h	Thu Jul 22 16:33:59 2010 +0100
@@ -25,11 +25,12 @@
 // User includes
 #include "MemSpyViewThreadInfoItemGeneric.h"
 
+class RMemSpySession;
 
 class CMemSpyViewThreadInfoItemHeap : public CMemSpyViewThreadInfoItemGeneric
     {
 public:
-    CMemSpyViewThreadInfoItemHeap( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyThreadInfoContainer& aContainer );
+    CMemSpyViewThreadInfoItemHeap( RMemSpySession& aSession, MMemSpyViewObserver& aObserver, TProcessId aProcId, TThreadId aId, TMemSpyThreadInfoItemType aType  );
 
 public: // From CMemSpyViewBase
     TBool HandleCommandL( TInt aCommand );
--- a/memspyui/ui/avkon/inc/MemSpyViewThreadInfoItemList.h	Fri Jun 11 16:29:34 2010 +0100
+++ b/memspyui/ui/avkon/inc/MemSpyViewThreadInfoItemList.h	Thu Jul 22 16:33:59 2010 +0100
@@ -30,18 +30,17 @@
 class CMemSpyProcess;
 class CMemSpyThread;
 class CMemSpyThreadInfoItemBase;
-
+class RMemSpySession;
 
 class CMemSpyViewThreadInfoItemList : public CMemSpyViewBase, public MMemSpyThreadInfoContainerObserver
     {
 public:
-    CMemSpyViewThreadInfoItemList( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyThread& aThread );
+    //CMemSpyViewThreadInfoItemList( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyThread& aThread );
+	CMemSpyViewThreadInfoItemList( RMemSpySession& aSession, MMemSpyViewObserver& aObserver, TProcessId aProcess, TThreadId aThread );
     ~CMemSpyViewThreadInfoItemList();
-    void ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune = NULL );
+    void ConstructL( const TRect& aRect, CCoeControl& aContainer, TMemSpyThreadInfoItemType iType);
 
 public: // API
-    const CMemSpyProcess& Process() const;
-    const CMemSpyThread& Thread() const;
     const CMemSpyThreadInfoItemBase& CurrentInfoItem() const;
 
 public: // From CMemSpyViewBase
@@ -67,11 +66,14 @@
     void HandleListBoxItemActionedL( TInt aCurrentIndex );
     void HandleListBoxItemSelectedL( TInt aCurrentIndex );
     static TInt IdleUpdateListBoxModel( TAny* aSelf );
-    void DoIdleUpdateListBoxModelL();
+    void DoIdleUpdateListBoxModelL();   
 
 private: // Member data
-    CMemSpyThread& iThread;
+    //CMemSpyThread& iThread;
+    TThreadId iThreadId;
+    TProcessId iParentProcessId;
     CMemSpyThreadInfoItemBase* iCurrentInfoItem;
+    TInt iCurrentInfoItemId;
     CPeriodic* iIdleResetListboxTimer;
     };
 
--- a/memspyui/ui/avkon/inc/MemSpyViewThreadInfoItemServer.h	Fri Jun 11 16:29:34 2010 +0100
+++ b/memspyui/ui/avkon/inc/MemSpyViewThreadInfoItemServer.h	Thu Jul 22 16:33:59 2010 +0100
@@ -28,13 +28,12 @@
 
 // Classes referenced
 class TMemSpyDriverHandleInfoGeneric;
-
-
+class RMemSpySession;
 
 class CMemSpyViewThreadInfoItemServer : public CMemSpyViewThreadInfoItemGeneric
     {
 public:
-    CMemSpyViewThreadInfoItemServer( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyThreadInfoContainer& aContainer );
+    CMemSpyViewThreadInfoItemServer( RMemSpySession& aSession, MMemSpyViewObserver& aObserver, TProcessId aProcId, TThreadId aId, TMemSpyThreadInfoItemType aType );
 
 public: // From CMemSpyViewBase
     void ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune = NULL );
--- a/memspyui/ui/avkon/inc/MemSpyViewThreadInfoItemStack.h	Fri Jun 11 16:29:34 2010 +0100
+++ b/memspyui/ui/avkon/inc/MemSpyViewThreadInfoItemStack.h	Thu Jul 22 16:33:59 2010 +0100
@@ -25,11 +25,12 @@
 // User includes
 #include "MemSpyViewThreadInfoItemGeneric.h"
 
+class RMemSpySession;
 
 class CMemSpyViewThreadInfoItemStack : public CMemSpyViewThreadInfoItemGeneric
     {
 public:
-    CMemSpyViewThreadInfoItemStack( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyThreadInfoContainer& aContainer );
+    CMemSpyViewThreadInfoItemStack( RMemSpySession& aSession, MMemSpyViewObserver& aObserver, TProcessId aProcId, TThreadId aId, TMemSpyThreadInfoItemType aType );
 
 public: // From CMemSpyViewBase
     TBool HandleCommandL( TInt aCommand );
--- a/memspyui/ui/avkon/inc/MemSpyViewThreads.h	Fri Jun 11 16:29:34 2010 +0100
+++ b/memspyui/ui/avkon/inc/MemSpyViewThreads.h	Thu Jul 22 16:33:59 2010 +0100
@@ -36,7 +36,7 @@
     {
 public:
     //CMemSpyViewThreads( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyProcess& aProcess );
-	CMemSpyViewThreads( RMemSpySession& aSession, MMemSpyViewObserver& aObserver, TProcessId aId );
+	CMemSpyViewThreads( RMemSpySession& aSession, MMemSpyViewObserver& aObserver, TProcessId aId, TThreadId aThreadId );
     ~CMemSpyViewThreads();
     void ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune = NULL );
 
--- a/memspyui/ui/avkon/src/MemSpyAppUi.cpp	Fri Jun 11 16:29:34 2010 +0100
+++ b/memspyui/ui/avkon/src/MemSpyAppUi.cpp	Thu Jul 22 16:33:59 2010 +0100
@@ -257,13 +257,16 @@
     case EMemSpyCmdToolsAbout:
         OnCmdAboutL();
         break;
-    //
+    //         
     case EMemSpyCmdPhoneInfoGeneralSummary:
-        OnCmdPhoneInformationOperationL( CMemSpyDeviceWideOperations::EPerEntityGeneralSummary );
+        //OnCmdPhoneInformationOperationL( CMemSpyDeviceWideOperations::EPerEntityGeneralSummary );
+    	OnCmdPhoneInformationOperationL( OutputPhoneInfo );
+        break;        
+    case EMemSpyCmdPhoneInfoGeneralDetailed:
+        //OnCmdPhoneInformationOperationL( CMemSpyDeviceWideOperations::EPerEntityGeneralDetailed );
+        OnCmdPhoneInformationOperationL( OutputDetailedPhoneInfo );
         break;
-    case EMemSpyCmdPhoneInfoGeneralDetailed:
-        OnCmdPhoneInformationOperationL( CMemSpyDeviceWideOperations::EPerEntityGeneralDetailed );
-        break;
+    /*
     case EMemSpyCmdPhoneInfoGeneralHandles:
         OnCmdPhoneInformationOperationL( CMemSpyDeviceWideOperations::EPerEntityGeneralHandles );
         break;
@@ -271,30 +274,40 @@
         OnCmdPhoneInformationOperationKernelContainersL();
         break;
     //
+    */
     case EMemSpyCmdPhoneInfoHeapInfoSummary:
-        OnCmdPhoneInformationOperationL( CMemSpyDeviceWideOperations::EPerEntityHeapInfo );
+        //OnCmdPhoneInformationOperationL( CMemSpyDeviceWideOperations::EPerEntityHeapInfo );
+    	OnCmdPhoneInformationOperationL (OutputHeapInfo );
         break;
     case EMemSpyCmdPhoneInfoHeapInfoCompact:
-        OnCmdPhoneInformationOperationL( CMemSpyDeviceWideOperations::EEntireDeviceHeapInfoCompact );
+        //OnCmdPhoneInformationOperationL( CMemSpyDeviceWideOperations::EEntireDeviceHeapInfoCompact );
+    	OnCmdPhoneInformationOperationL( OutputCompactHeapInfo );
         break;
     case EMemSpyCmdPhoneInfoHeapCellListing:
-        OnCmdPhoneInformationOperationL( CMemSpyDeviceWideOperations::EPerEntityHeapCellListing );
+        //OnCmdPhoneInformationOperationL( CMemSpyDeviceWideOperations::EPerEntityHeapCellListing );
+        OnCmdPhoneInformationOperationL( OutputHeapCellListing );
         break;
+        
     case EMemSpyCmdPhoneInfoHeapDump:
-        OnCmdPhoneInformationOperationL( CMemSpyDeviceWideOperations::EPerEntityHeapData );
+        //OnCmdPhoneInformationOperationL( CMemSpyDeviceWideOperations::EPerEntityHeapData );
+    	OnCmdPhoneInformationOperationL( OutputHeapData );
         break;
-    //
+    //		   		    		
     case EMemSpyCmdPhoneInfoStackInfo:
-        OnCmdPhoneInformationOperationL( CMemSpyDeviceWideOperations::EPerEntityStackInfo );
+        //OnCmdPhoneInformationOperationL( CMemSpyDeviceWideOperations::EPerEntityStackInfo );
+        OnCmdPhoneInformationOperationL( OutputStackInfo );
         break;
     case EMemSpyCmdPhoneInfoStackInfoCompact:
-        OnCmdPhoneInformationOperationL( CMemSpyDeviceWideOperations::EEntireDeviceStackInfoCompact );
+        //OnCmdPhoneInformationOperationL( CMemSpyDeviceWideOperations::EEntireDeviceStackInfoCompact );
+        OnCmdPhoneInformationOperationL( OutputCompactStackInfo );
         break;
     case EMemSpyCmdPhoneInfoStackDumpUser:
-        OnCmdPhoneInformationOperationL( CMemSpyDeviceWideOperations::EPerEntityStackDataUser );
+        //OnCmdPhoneInformationOperationL( CMemSpyDeviceWideOperations::EPerEntityStackDataUser );
+    	OnCmdPhoneInformationOperationL( OutputUserStackData );
         break;
     case EMemSpyCmdPhoneInfoStackDumpKernel:
-        OnCmdPhoneInformationOperationL( CMemSpyDeviceWideOperations::EPerEntityStackDataKernel );
+        //OnCmdPhoneInformationOperationL( CMemSpyDeviceWideOperations::EPerEntityStackDataKernel );
+        OnCmdPhoneInformationOperationL( OutputKernelStackData );
         break;
 
     case EMemSpyCmdAutoCaptureToggle:
@@ -523,21 +536,26 @@
     }
 
 
-void CMemSpyAppUi::OnCmdPhoneInformationOperationL( CMemSpyDeviceWideOperations::TOperation aOp )
-    {	/* TODO
+void CMemSpyAppUi::OnCmdPhoneInformationOperationL( TDeviceWideOperation aOperation )
+    {	
+	//
+	//CMemSpyDeviceWideOperationDialog::ExecuteLD( iMemSpySession, aOperation );
+	CMemSpyDwoTracker* tracker = CMemSpyDeviceWideOperationDialog::CreateDeviceWideOperation( iMemSpySession, aOperation );
+	tracker->Start();		
+	/*
 #ifdef _DEBUG
     RDebug::Printf( "[MemSpy] CMemSpyAppUi::OnCmdPhoneInformationOperationL() - START - aOp: %d, iRunningDeviceWideOperation: %d, iAutoCaptureTimer is active: %d", aOp, iRunningDeviceWideOperation, iAutoCaptureTimer->IsActive() );
 #endif
 
     if  ( !iRunningDeviceWideOperation )
-        {
-        //CMemSpyDeviceWideOperationDialog::ExecuteLD( iEngine, *this, aOp );
+        {        
 		CMemSpyDeviceWideOperationDialog::ExecuteLD( iMemSpySession, *this, aOp );
         }
 
 #ifdef _DEBUG
     RDebug::Printf( "[MemSpy] CMemSpyAppUi::OnCmdPhoneInformationOperationL() - END - aOp: %d, iRunningDeviceWideOperation: %d, iAutoCaptureTimer is active: %d", aOp, iRunningDeviceWideOperation, iAutoCaptureTimer->IsActive() );
-#endif*/
+#endif
+	*/
     }
 
 
@@ -639,7 +657,7 @@
     RDebug::Printf( "[MemSpy] CMemSpyAppUi::AutoCaptureCallBackL() - START - iAutoCaptureOperationType: %d, iAutoCaptureTimer is active: %d", iAutoCaptureOperationType, iAutoCaptureTimer->IsActive() );
 #endif
 
-    OnCmdPhoneInformationOperationL( iAutoCaptureOperationType );
+   // OnCmdPhoneInformationOperationL( iAutoCaptureOperationType );
 
 #ifdef _DEBUG
     RDebug::Printf( "[MemSpy] CMemSpyAppUi::AutoCaptureCallBackL() - END - iAutoCaptureOperationType: %d, iAutoCaptureTimer is active: %d", iAutoCaptureOperationType, iAutoCaptureTimer->IsActive() );
@@ -668,25 +686,15 @@
 
 void CMemSpyAppUi::OnCmdOutputToDebugL()
     {
-	/* TODO
-	iMemSpyAPI.OutputToDebug();
-	*/
-	/*
-    iEngine.InstallSinkL( ESinkTypeDebug );
-    MemSpyDocument().Settings().StoreSettingsL();
-    */
+	iMemSpySession.SwitchOutputSink( ESinkTypeDebug ); //set in engine
+	MemSpyDocument().Settings().SetSinkType( ESinkTypeDebug ); //set in settings
     }
 
 
 void CMemSpyAppUi::OnCmdOutputToFileL()
     {
-	/* TODO
-	iMemSpyAPI.OutputToFile();
-	*/
-	/*
-    iEngine.InstallSinkL( ESinkTypeFile );
-    MemSpyDocument().Settings().StoreSettingsL();
-    */
+	iMemSpySession.SwitchOutputSink( ESinkTypeFile ); //set in engine
+	MemSpyDocument().Settings().SetSinkType( ESinkTypeFile ); //set in settings
     }
 
 
--- a/memspyui/ui/avkon/src/MemSpyDeviceWideOperationDialog.cpp	Fri Jun 11 16:29:34 2010 +0100
+++ b/memspyui/ui/avkon/src/MemSpyDeviceWideOperationDialog.cpp	Thu Jul 22 16:33:59 2010 +0100
@@ -26,12 +26,25 @@
 #include <avkon.hrh>
 #include <memspyui.rsg>
 
+#include <memspysession.h>
 
+/*
 CMemSpyDeviceWideOperationDialog::CMemSpyDeviceWideOperationDialog( CMemSpyEngine& aEngine, MMemSpyDeviceWideOperationDialogObserver& aObserver )
 :   iEngine( aEngine ), iObserver( aObserver )
     {
     }
 
+CMemSpyDeviceWideOperationDialog::CMemSpyDeviceWideOperationDialog( RMemSpySession& aSession, MMemSpyDeviceWideOperationDialogObserver& aObserver )
+:   iSession( aSession ), iObserver( aObserver )
+    {
+    }    
+*/
+
+CMemSpyDeviceWideOperationDialog::CMemSpyDeviceWideOperationDialog( RMemSpySession& aSession )
+:   iSession( aSession )
+    {
+    }    
+
 
 CMemSpyDeviceWideOperationDialog::~CMemSpyDeviceWideOperationDialog()
     {
@@ -54,7 +67,7 @@
     RDebug::Printf("[MemSpy] CMemSpyDeviceWideOperationDialog::~CMemSpyDeviceWideOperationDialog() - sending EDialogDismissed to observer..." );
 #endif
 
-    iObserver.DWOperationCompleted();
+    //iObserver.DWOperationCompleted(); //TODO
 
 #ifdef _DEBUG
     RDebug::Printf("[MemSpy] CMemSpyDeviceWideOperationDialog::~CMemSpyDeviceWideOperationDialog() - END" );
@@ -62,8 +75,10 @@
     }
 
 
-void CMemSpyDeviceWideOperationDialog::ExecuteL( CMemSpyDeviceWideOperations::TOperation aOperation )
+//void CMemSpyDeviceWideOperationDialog::ExecuteL( CMemSpyDeviceWideOperations::TOperation aOperation )
+void CMemSpyDeviceWideOperationDialog::ExecuteL( TDeviceWideOperation aOp )
     {
+	/*
 #ifdef _DEBUG
     RDebug::Printf("[MemSpy] CMemSpyDeviceWideOperationDialog::ExecuteL() - START" );
 #endif
@@ -88,13 +103,15 @@
 #ifdef _DEBUG
     RDebug::Printf("[MemSpy] CMemSpyDeviceWideOperationDialog::ExecuteL() - END" );
 #endif
+	*/
     }
 
-void CMemSpyDeviceWideOperationDialog::ExecuteLD( CMemSpyEngine& aEngine, MMemSpyDeviceWideOperationDialogObserver& aObserver, CMemSpyDeviceWideOperations::TOperation aOperation )
+void CMemSpyDeviceWideOperationDialog::ExecuteLD( RMemSpySession& aSession, TDeviceWideOperation aOp )
     {
-    CMemSpyDeviceWideOperationDialog* self = new(ELeave) CMemSpyDeviceWideOperationDialog( aEngine, aObserver );
+    //CMemSpyDeviceWideOperationDialog* self = new(ELeave) CMemSpyDeviceWideOperationDialog( aSession, aObserver );
+	CMemSpyDeviceWideOperationDialog* self = new(ELeave) CMemSpyDeviceWideOperationDialog( aSession );
     CleanupStack::PushL( self );
-    self->ExecuteL( aOperation );
+    self->ExecuteL( aOp );
     CleanupStack::PopAndDestroy( self );
     }
 
@@ -112,7 +129,7 @@
         iOperation->Cancel();
         }
     //
-    iObserver.DWOperationCancelled();
+    //iObserver.DWOperationCancelled();
 
 #ifdef _DEBUG
     RDebug::Printf("[MemSpy] CMemSpyDeviceWideOperationDialog::Cancel() - END" );
@@ -147,7 +164,7 @@
     case MMemSpyDeviceWideOperationsObserver::EOperationSized:
         break;
     case MMemSpyDeviceWideOperationsObserver::EOperationStarting:
-        iObserver.DWOperationStarted();
+        //iObserver.DWOperationStarted();
         break;
     case MMemSpyDeviceWideOperationsObserver::EOperationProgressStart:
         ASSERT( iProgressDialog != NULL );
@@ -191,7 +208,180 @@
         }
     }
 
+CMemSpyDwoTracker* CMemSpyDeviceWideOperationDialog::CreateDeviceWideOperation( RMemSpySession& aSession, TDeviceWideOperation aOp )
+{
+	return new CMemSpyDwoTracker( aSession, aOp );
+}
+
+
+
+
+
+
+
+
+
 
 
 
 
+CMemSpyDwoProgressTracker::CMemSpyDwoProgressTracker(RMemSpySession &aSession) 
+	: CActive( EPriorityStandard ), iSession( aSession )
+	{
+	CActiveScheduler::Add(this);
+	}
+
+CMemSpyDwoProgressTracker::~CMemSpyDwoProgressTracker()
+	{
+	Cancel();	
+	}
+
+void CMemSpyDwoProgressTracker::Start()
+	{
+	ASSERT( iProgressDialog == NULL );
+	iProgressDialog = new( ELeave ) CAknProgressDialog( reinterpret_cast< CEikDialog** >( &iProgressDialog ), ETrue );
+	iProgressDialog->PrepareLC( R_MEMSPY_DEVICE_WIDE_OPERATION_PROGRESS_DIALOG );
+	iProgressDialog->SetCallback( this );
+	iProgressDialog->SetGloballyCapturing( ETrue );
+	iProgressInfo = iProgressDialog->GetProgressInfoL();	
+	
+	iSession.NotifyDeviceWideOperationProgress( iProgress, iStatus );
+	
+	UpdateProcessDialogL( iProgress.Progress(), iProgress.Description() );
+	
+	SetActive();
+	
+	iProgressDialog->RunLD();
+	}
+
+void CMemSpyDwoProgressTracker::Cancel()
+	{	
+	}
+
+void CMemSpyDwoProgressTracker::RunL()
+    { 		
+    // If an error occurred handle it in RunError().
+    User::LeaveIfError(iStatus.Int());
+ 
+    // Resubmit the request immediately    
+    iSession.NotifyDeviceWideOperationProgress( iProgress, iStatus );     
+    
+    SetActive();            
+    
+    UpdateProcessDialogL( iProgress.Progress(), iProgress.Description() );    
+    }
+ 
+void CMemSpyDwoProgressTracker::DoCancel()
+	{ 	
+	}
+ 
+TInt CMemSpyDwoProgressTracker::RunError(TInt aError)
+	{ 
+	// KErrNotReady and KErrCancel errors are OK, they just notify 
+	// us about the outstanding notification request that won't be 
+	// processed.		
+    return KErrNone;
+	}
+
+void CMemSpyDwoProgressTracker::UpdateProcessDialogL( TInt aProgress, const TDesC& aProgressText )
+	{
+	if(iProgressDialog)
+		{
+		iProgressDialog->SetTextL( aProgressText );
+	    }
+	 
+	if(iProgressInfo)
+		{
+	    iProgressInfo->SetAndDraw( aProgress );	
+		}
+	}
+
+void CMemSpyDwoProgressTracker::DialogDismissedL(TInt aButtonId)
+	{
+	iProgressDialog = NULL;
+	iProgressInfo = NULL;	
+	 
+	Cancel();
+	}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+CMemSpyDwoTracker::CMemSpyDwoTracker( RMemSpySession &aSession, TDeviceWideOperation aOperation )
+:	CActive( EPriorityStandard ), 
+	iSession( aSession ),
+	iProgressTracker(new CMemSpyDwoProgressTracker( aSession )),
+	iOperation( aOperation )
+	{
+	CActiveScheduler::Add(this);
+	}
+
+CMemSpyDwoTracker::~CMemSpyDwoTracker()
+	{		
+	Cancel();
+	
+	delete iProgressTracker;
+	}
+
+void CMemSpyDwoTracker::Start()
+{	
+	void (RMemSpySession::*functions[])(TRequestStatus&) = { 
+		&RMemSpySession::OutputPhoneInfo,
+		&RMemSpySession::OutputDetailedPhoneInfo,
+		&RMemSpySession::OutputHeapInfo,
+		&RMemSpySession::OutputCompactHeapInfo,
+		&RMemSpySession::OutputHeapCellListing,
+		&RMemSpySession::OutputHeapData,
+		&RMemSpySession::OutputStackInfo,
+		&RMemSpySession::OutputCompactStackInfo,
+		&RMemSpySession::OutputUserStackData,
+		&RMemSpySession::OutputKernelStackData };
+		
+	(iSession.*functions[iOperation])(iStatus);			
+	
+	SetActive();
+	
+	iProgressTracker->Start();				
+}
+
+void CMemSpyDwoTracker::Cancel()
+{
+}
+ 
+void CMemSpyDwoTracker::RunL()
+    { 
+    // If an error occurred handle it in RunError().
+    User::LeaveIfError(iStatus.Int());
+ 
+    if( !IsActive() )
+    	{
+		iProgressTracker->ProgressDialog()->ProcessFinishedL();
+    	}
+    }
+ 
+void CMemSpyDwoTracker::DoCancel()
+{ 
+	// Cancel progress tracker
+	iProgressTracker->Cancel();
+	
+	iSession.CancelDeviceWideOperationL();	
+}
+ 
+TInt CMemSpyDwoTracker::RunError(TInt aError)
+{ 
+	// Emit the finished(false) signal to notify user 
+	// operation was canceled
+	//emit finished(false); //TODO:
+	
+    return KErrNone;
+}
--- a/memspyui/ui/avkon/src/MemSpySettings.cpp	Fri Jun 11 16:29:34 2010 +0100
+++ b/memspyui/ui/avkon/src/MemSpySettings.cpp	Thu Jul 22 16:33:59 2010 +0100
@@ -26,63 +26,38 @@
 #include <memspy/engine/memspyenginelogger.h>
 #include <memspy/engine/memspyenginehelperprocess.h>
 #include <memspy/engine/memspyenginehelpersysmemtracker.h>
-#include <memspy/engine/memspyenginehelpersysmemtrackerconfig.h>
 
 #include <memspysession.h>
 
 // Constants
-_LIT( KMemSpySettingsFileName, "settings.dat" );
+_LIT( KMemSpySettingsFileName, "settings.dat" ); //file or avkon client settings
 
 // Version 03 dumped some of the system wide memory tracker settings
 const TInt KMemSpySettingsFileFormatVersion = 6;
 
-/*
-CMemSpySettings::CMemSpySettings( RFs& aFsSession, CMemSpyEngine& aEngine )
-:   iFsSession( aFsSession ), iEngine( aEngine )
-    {
-    }
-*/
 CMemSpySettings::CMemSpySettings( RFs& aFsSession, RMemSpySession& aSession )
-:   iFsSession( aFsSession )
+:   iFsSession( aFsSession ), iMemSpySession( aSession )
     {	
     }
 
 
 CMemSpySettings::~CMemSpySettings()
-    {
-	/*
+    {	
     TRACE( RDebug::Printf( "CMemSpySettings::~CMemSpySettings() - START" ) );
     TRAP_IGNORE( StoreSettingsL() );
-    TRACE( RDebug::Printf( "CMemSpySettings::~CMemSpySettings() - END" ) );
-    */
-	
-	//iMemSpyAPI.StoreSettings();
+    TRACE( RDebug::Printf( "CMemSpySettings::~CMemSpySettings() - END" ) );    	
     }
 
 
 void CMemSpySettings::ConstructL()
-    {
-	/*
+    {	
     TRACE( RDebug::Print( _L("CMemSpySettings::ConstructL() - START") ) );
 
     TRAP_IGNORE( RestoreSettingsL() );
 
-    TRACE( RDebug::Print( _L("CMemSpySettings::ConstructL() - END") ) );
-    */
-	
-	//iMemSpyAPI.RestoreSettings();
+    TRACE( RDebug::Print( _L("CMemSpySettings::ConstructL() - END") ) );    
     }
 
-/*
-CMemSpySettings* CMemSpySettings::NewL( RFs& aFsSession, CMemSpyEngine& aEngine )
-    {
-    CMemSpySettings* self = new(ELeave) CMemSpySettings( aFsSession, aEngine );
-    CleanupStack::PushL( self );
-    self->ConstructL();
-    CleanupStack::Pop( self );
-    return self;
-    }
-*/
 CMemSpySettings* CMemSpySettings::NewL( RFs& aFsSession, RMemSpySession& aSession )
     {
     CMemSpySettings* self = new(ELeave) CMemSpySettings( aFsSession, aSession );
@@ -92,7 +67,6 @@
     return self;
     }
 
-/*
 void CMemSpySettings::GetSettingsFileNameL( TDes& aFileName )
     {
     GetSettingsPathL( aFileName );
@@ -120,7 +94,6 @@
     TRACE( RDebug::Print( _L("CMemSpySettings::GetSettingsPathL() - END - %S"), &aPath ) );
     }
 
-
 RFile CMemSpySettings::SettingsFileLC( TBool aReplace )
     {
     TRACE( RDebug::Print( _L("CMemSpySettings::SettingsFileLC() - START - aReplace: %d"), aReplace ) );
@@ -170,20 +143,23 @@
     // Verion info
     stream.WriteInt32L( KMemSpySettingsFileFormatVersion );
     
-    // Engine settings
-    TRACE( RDebug::Printf( "CMemSpySettings::StoreSettingsL() - sinkType: %d", iEngine.SinkType() ) );
-    stream.WriteUint8L( iEngine.SinkType() );
-
+    stream.WriteUint8L( iSinkType );
+    
+    
     // Get SWMT config
-    CMemSpyEngineHelperSysMemTracker& swmt = iEngine.HelperSysMemTracker();
-    TMemSpyEngineHelperSysMemTrackerConfig swmtConfig;
-    swmt.GetConfig( swmtConfig );
+    //CMemSpyEngineHelperSysMemTracker& swmt = iEngine.HelperSysMemTracker();
+    //TMemSpyEngineHelperSysMemTrackerConfig swmtConfig;
+    //swmt.GetConfig( swmtConfig );
 
     // Write SWMT settings
-    stream.WriteInt32L( swmtConfig.TimerPeriod().Int() );
-    stream.WriteUint8L( swmtConfig.DumpData() );
+    //stream.WriteInt32L( swmtConfig.TimerPeriod().Int() );
+    //stream.WriteUint8L( swmtConfig.DumpData() );
+    
+    stream.WriteInt32L( iSwmtConfig.TimerPeriod().Int() );
+    stream.WriteUint8L( iSwmtConfig.DumpData() );
     
     // Write memory tracking auto-start process list
+    /*
     const RArray<TUid>& processUidList = iEngine.HelperProcess().MemoryTrackingAutoStartProcessList();
     stream.WriteInt32L( processUidList.Count() );
     for( TInt i=0; i<processUidList.Count(); i++ )
@@ -192,12 +168,24 @@
         TRACE( RDebug::Printf( "CMemSpySettings::StoreSettingsL() - process tracker uid[%02d]: 0x%08x", i, uid.iUid ) );
         stream << uid;
         }
-
+    */    
+    stream.WriteInt32L( iUidList.Count() );
+    for( TInt i = 0; i < iUidList.Count(); i++ )
+    	{
+		const TUid uid = iUidList[ i ];
+		TRACE( RDebug::Printf( "CMemSpySettings::StoreSettingsL() - process tracker uid[%02d]: 0x%08x", i, uid.iUid ) );
+		stream << uid;
+    	}
+    
     // Write memory tracking categories
-    stream.WriteInt32L( swmtConfig.iEnabledCategories );
+    //stream.WriteInt32L( swmtConfig.iEnabledCategories );
+    stream.WriteInt32L( iSwmtConfig.iEnabledCategories );
     
     // Write heap tracking thread name filter
-    stream.WriteInt32L( swmtConfig.iThreadNameFilter.Length() );
+    //stream.WriteInt32L( swmtConfig.iThreadNameFilter.Length() );
+    stream.WriteInt32L( iSwmtConfig.iThreadNameFilter.Length() );
+    
+    /*
     if ( swmtConfig.iThreadNameFilter.Length() > 0 )
         {
         stream.WriteL( swmtConfig.iThreadNameFilter, swmtConfig.iThreadNameFilter.Length() );
@@ -205,21 +193,25 @@
     
     // Write mode
     stream.WriteInt32L( swmtConfig.iMode );
+    */
+    if ( iSwmtConfig.iThreadNameFilter.Length() > 0 )
+    	{
+		stream.WriteL( iSwmtConfig.iThreadNameFilter, iSwmtConfig.iThreadNameFilter.Length() );
+    	}
+        
+    // Write mode
+    stream.WriteInt32L( iSwmtConfig.iMode );
     
     stream.CommitL();
-    CleanupStack::PopAndDestroy( &stream ); // Closes file
-    TRACE( RDebug::Printf( "CMemSpySettings::StoreSettingsL() - END - sinkType: %d", iEngine.SinkType() ) );
+    CleanupStack::PopAndDestroy( &stream ); // Closes file    
     }
 
-
 void CMemSpySettings::RestoreSettingsL()
-    {
-    TRACE( RDebug::Printf( "CMemSpySettings::RestoreSettingsL() - START - current engine sinkType: %d", iEngine.SinkType() ) );
-
+    {  
     RFile file = SettingsFileLC();
     RFileReadStream stream( file );
     CleanupStack::Pop(); // file
-    CleanupClosePushL( stream );
+    CleanupClosePushL( stream ); 
     
     // Version info
     const TInt version = stream.ReadInt32L(); // discarded for now
@@ -228,11 +220,13 @@
     // Engine settings
     TMemSpySinkType type = static_cast< TMemSpySinkType >( stream.ReadUint8L() );
     TRACE( RDebug::Printf( "CMemSpySettings::RestoreSettingsL() - read sinkType: %d", type ) );
-    iEngine.InstallSinkL( type );
+       
+    //iEngine.InstallSinkL( type );
+    //iMemSpySession.SwitchOutputSink( type ); //TODO: to argue to set stuf in engine from here
     
     // Set SWMT config
     TMemSpyEngineHelperSysMemTrackerConfig swmtConfig;
-    swmtConfig.iTimerPeriod = TTimeIntervalMicroSeconds32( stream.ReadInt32L() );
+    swmtConfig.iTimerPeriod = TTimeIntervalMicroSeconds32( stream.ReadInt32L() ); 
     swmtConfig.iDumpData = static_cast< TBool >( stream.ReadUint8L() );
 
     if  ( version < 3 )
@@ -247,21 +241,28 @@
     // Restore memory tracking auto-start process uids if file format supports it...
     if ( version >= 2 )
         {
-        RArray<TUid> list;
+        RArray<TUid> list;		
         CleanupClosePushL( list );
         //
         const TInt count = stream.ReadInt32L();
+        
+        //CArrayFixFlat<TUid>* list = new(ELeave)CArrayFixFlat<TUid>(count);
+        //CleanupStack::PushL(list );               
+        
         for( TInt i=0; i<count; i++ )
             {
             TUid processUid;
             stream >> processUid;
-            //
-            TRACE( RDebug::Printf( "CMemSpySettings::RestoreSettingsL() - process tracker uid[%02d]: 0x%08x", i, processUid.iUid ) );
-            User::LeaveIfError( list.Append( processUid ) );
+            //           
+            User::LeaveIfError( list.Append( processUid ) );            
+            //list->AppendL( processUid );
             }
         //
-        CMemSpyEngineHelperProcess& processHelper = iEngine.HelperProcess();
-        processHelper.SetMemoryTrackingAutoStartProcessListL( list );
+        //CMemSpyEngineHelperProcess& processHelper = iEngine.HelperProcess();
+        //processHelper.SetMemoryTrackingAutoStartProcessListL( list );        
+        //iMemSpySession.SetSwmtAutoStartProcessList( list );
+        iUidList = list; 	//TODO: to get it into the engine
+        
         CleanupStack::PopAndDestroy( &list );
         }
     
@@ -287,11 +288,13 @@
         swmtConfig.iMode = (TMemSpyEngineHelperSysMemTrackerConfig::TMemSpyEngineSysMemTrackerMode)stream.ReadInt32L();
         }
     
-    CMemSpyEngineHelperSysMemTracker& swmt = iEngine.HelperSysMemTracker();
-    swmt.SetConfigL( swmtConfig );
-
-    CleanupStack::PopAndDestroy( &stream ); // Closes file
-    TRACE( RDebug::Printf( "CMemSpySettings::RestoreSettingsL() - END - engine sink type: %d", iEngine.SinkType() ) );
+    //CMemSpyEngineHelperSysMemTracker& swmt = iEngine.HelperSysMemTracker();
+    //swmt.SetConfigL( swmtConfig );
+    //iMemSpySession.SetSwmtConfig( swmtConfig );
+    
+    iSwmtConfig = swmtConfig; 	//TODO: to get it into the engine
+    
+    CleanupStack::PopAndDestroy( &stream ); // Closes file    
     }
 
-*/
+
--- a/memspyui/ui/avkon/src/MemSpyUiUtils.cpp	Fri Jun 11 16:29:34 2010 +0100
+++ b/memspyui/ui/avkon/src/MemSpyUiUtils.cpp	Thu Jul 22 16:33:59 2010 +0100
@@ -63,3 +63,305 @@
         }
     }
 
+HBufC* MemSpyUiUtils::FormatItem( const TDesC& aCaption )
+	{
+	HBufC* retBuf = HBufC::NewL( 32 );
+	TPtr pRetBuf( retBuf->Des() );
+	pRetBuf.Zero();
+	pRetBuf.Append( _L("\t") );
+	pRetBuf.Append( aCaption );
+	return retBuf;
+	}
+
+TDesC& MemSpyUiUtils::ThreadInfoItemNameByType( TMemSpyThreadInfoItemType aType )
+	{	
+	TPtrC pType( KTypeUnknown );
+	
+	switch( aType )
+		{
+		case EMemSpyThreadInfoItemTypeFirst:			
+			pType.Set(KGeneral);
+			break;			
+		case EMemSpyThreadInfoItemTypeHeap:			
+			pType.Set(KHeap);
+			break;				
+		case EMemSpyThreadInfoItemTypeStack:			
+			pType.Set(KStack);
+			break;			
+		case EMemSpyThreadInfoItemTypeChunk:			
+			pType.Set(KChunks);
+			break;
+		case EMemSpyThreadInfoItemTypeCodeSeg:
+			pType.Set(KCodeSegs);
+			break;
+		case EMemSpyThreadInfoItemTypeOpenFiles:
+			pType.Set(KOpenFiles);
+			break;	
+		case EMemSpyThreadInfoItemTypeActiveObject:
+			pType.Set(KActiveObjects);
+			break;
+		case EMemSpyThreadInfoItemTypeOwnedThreadHandles:
+			pType.Set(KThreadHandlers);
+			break;
+		case EMemSpyThreadInfoItemTypeOwnedProcessHandles:
+			pType.Set(KProcessHandlers);
+			break;
+		case EMemSpyThreadInfoItemTypeServer:
+			pType.Set(KServers);
+			break;
+		case EMemSpyThreadInfoItemTypeSession:
+			pType.Set(KConnections);
+			break;
+		case EMemSpyThreadInfoItemTypeSemaphore:
+			pType.Set(KSemaphores);
+			break;
+		case EMemSpyThreadInfoItemTypeOtherThreads:
+			pType.Set(KThreadReferences);
+			break;
+		case EMemSpyThreadInfoItemTypeOtherProcesses:
+			pType.Set(KProcessReferences);
+			break;
+		case EMemSpyThreadInfoItemTypeMutex:
+			pType.Set(KMutexes);
+			break;
+		case EMemSpyThreadInfoItemTypeTimer:
+			pType.Set(KTimers);					
+			break;
+		case EMemSpyThreadInfoItemTypeLogicalChannel:
+			pType.Set(KDD);
+			break;
+		case EMemSpyThreadInfoItemTypeChangeNotifier:
+			pType.Set(KChangeNotif);
+			break;
+		case EMemSpyThreadInfoItemTypeUndertaker:
+			pType.Set(KUndertakers);
+			break;				
+		case EMemSpyThreadInfoItemTypeLDD:
+			pType.Set(KLogicalDrivers);
+			break;
+		case EMemSpyThreadInfoItemTypePDD:
+			pType.Set(KPhysicalDrivers);
+			break;
+			
+	    default:	       
+	    	break;  
+		}
+	return pType;
+	}
+
+
+void MemSpyUiUtils::AppendPriority( TDes& aDes, TProcessPriority aPriority )
+	{
+	switch( aPriority )
+		{
+	    case EPriorityLow:
+	        aDes += _L("[L]");
+	        break;
+	    case EPriorityBackground:
+	        aDes += _L("[B]");
+	        break;
+	    case EPriorityForeground:
+	        aDes += _L("[F]");
+	        break;
+	    case EPriorityHigh:
+	        aDes += _L("[H]");
+	        break;
+	    case EPriorityWindowServer:
+	        aDes += _L("[WS]");
+	        break;
+	    case EPriorityFileServer:
+	        aDes += _L("[FS]");
+	        break;
+	    case EPriorityRealTimeServer:
+	        aDes += _L("[RTS]");
+	        break;
+	    case EPrioritySupervisor:
+	        aDes += _L("[SUP]");
+	        break;
+	    default:
+	        aDes += _L("[?]");
+	        break;
+		}
+	}
+
+void MemSpyUiUtils::AppendExitInfo( TDes& aDes, TExitType aType, TInt aExitReason, const TDesC& aExitCategory  )
+	{
+    aDes.Append( '[' );
+    const TInt length = aDes.Length();
+    AppendExitType( aDes, aType );
+    aDes.SetLength( length + 1 ); // Remove all but the first letter
+    aDes.Append( ']' );
+    
+    if  ( aType == EExitKill || aType == EExitPending )
+        {
+        // Kill implies "clean" exit. Pending implies not yet dead.
+        }
+    else
+        {
+        TMemSpyTruncateOverflow overflow;
+
+        // Terminate or Panic implies abnormal exit condition, so
+        // show full exit info.
+        _LIT( KAbnormalFormatSpec, " %S-%d" );
+        aDes.AppendFormat( KAbnormalFormatSpec, &overflow, &aExitCategory, aExitReason );
+        }
+	}
+
+
+void MemSpyUiUtils::AppendExitType( TDes& aDes, TExitType aType )
+    {
+    _LIT( KExitTypeKilled, "Killed" );
+    _LIT( KExitTypeTerminated, "Terminated" );
+    _LIT( KExitTypePanicked, "Panicked" );
+    _LIT( KExitTypePending, "Pending" );
+    
+    // Panic and Terminate are exceptional exit conditions.
+    // Kill, is ironically, not an exceptional condition.
+    switch( aType )
+        {
+    case EExitKill:
+        aDes += KExitTypeKilled;
+        break;
+    case EExitTerminate:
+        aDes += KExitTypeTerminated;
+        break;
+    case EExitPanic:
+        aDes += KExitTypePanicked;
+        break;
+    default:
+    case EExitPending:
+        aDes += KExitTypePending;
+        break;
+        }
+    }
+
+
+TPtrC MemSpyUiUtils::TypeAsString( TMemSpyDriverContainerType aType )
+    {     
+    TPtrC pType( KTypeUnknown );
+    //
+    switch( aType )
+        {
+    case EMemSpyDriverContainerTypeThread:
+        pType.Set( KTypeThread );
+        break;
+    case EMemSpyDriverContainerTypeProcess:
+        pType.Set( KTypeProcess );
+        break;
+    case EMemSpyDriverContainerTypeChunk:
+        pType.Set( KTypeChunk );
+        break;
+    case EMemSpyDriverContainerTypeLibrary:
+        pType.Set( KTypeLibrary );
+        break;
+    case EMemSpyDriverContainerTypeSemaphore:
+        pType.Set( KTypeSemaphore );
+        break;
+    case EMemSpyDriverContainerTypeMutex:
+        pType.Set( KTypeMutex );
+        break;
+    case EMemSpyDriverContainerTypeTimer:
+        pType.Set( KTypeTimer );
+        break;
+    case EMemSpyDriverContainerTypeServer:
+        pType.Set( KTypeServer );
+        break;
+    case EMemSpyDriverContainerTypeSession:
+        pType.Set( KTypeSession );
+        break;
+    case EMemSpyDriverContainerTypeLogicalDevice:
+        pType.Set( KTypeLogicalDevice );
+        break;
+    case EMemSpyDriverContainerTypePhysicalDevice:
+        pType.Set( KTypePhysicalDevice );
+        break;
+    case EMemSpyDriverContainerTypeLogicalChannel:
+        pType.Set( KTypeLogicalChannel );
+        break;
+    case EMemSpyDriverContainerTypeChangeNotifier:
+        pType.Set( KTypeChangeNotifier );
+        break;
+    case EMemSpyDriverContainerTypeUndertaker:
+        pType.Set( KTypeUndertaker );
+        break;
+    case EMemSpyDriverContainerTypeMsgQueue:
+        pType.Set( KTypeMsgQueue );
+        break;
+    case EMemSpyDriverContainerTypePropertyRef:
+        pType.Set( KTypePropertyRef );
+        break;
+    case EMemSpyDriverContainerTypeCondVar:
+        pType.Set( KTypeCondVar );
+        break;
+        
+    default:
+        break;
+        }
+    //
+    return pType;
+    }
+
+TMemSpySizeText MemSpyUiUtils::FormatSizeText( const TInt64& aValue, TInt aDecimalPlaces, TBool aExtraRounding )
+    {
+    _LIT(KFormatKilo, "%dK");
+    _LIT(KFormatMega, "%SM");
+    _LIT(KFormatGiga, "%SG");
+
+	TMemSpySizeText buf;
+	if  ( aValue < 1024000 )					// If < 1000K
+		{
+		TInt sizeInK = 0;
+
+        if  ( aValue != 0 )
+			{
+			sizeInK = I64INT( (aValue + 512) >> 10 );
+			if  (sizeInK < 1)
+                {
+				sizeInK = 1;
+                }
+			if  (sizeInK > 999)
+                {
+				sizeInK = 999;
+                }
+			}
+
+        buf.Format( KFormatKilo, sizeInK );
+		}
+	else
+		{
+		TReal sizeInM = I64INT( aValue );
+		sizeInM /= 1048576;
+		if  ( sizeInM < 1 )
+            {
+			sizeInM = 1;
+            }
+
+        TPtrC pFormat( KFormatMega );
+		if  ( sizeInM >= 1000 )
+			{
+			sizeInM /= 1024;				// Size in G
+			if  (sizeInM < 1)
+                {
+				sizeInM = 1;
+                }
+			
+            pFormat.Set( KFormatGiga );
+			}
+
+        if  ( sizeInM > 999.9)
+            {
+            sizeInM = 999.9;
+            }
+
+        if  ( aExtraRounding )
+            {
+			sizeInM += 0.499999;
+            }
+
+		TBuf<16> size;
+		size.Num( sizeInM, TRealFormat( 14, aDecimalPlaces ) );	// Allow for "17179869184.0"G which is 2^64
+        buf.Format( pFormat, &size );
+		}
+
+    return buf;
+    }
--- a/memspyui/ui/avkon/src/MemSpyViewKernel.cpp	Fri Jun 11 16:29:34 2010 +0100
+++ b/memspyui/ui/avkon/src/MemSpyViewKernel.cpp	Thu Jul 22 16:33:59 2010 +0100
@@ -102,13 +102,11 @@
     const TInt index = iListBox->CurrentItemIndex();
     //
     if  ( index == 0 )
-        {
-        //child = new(ELeave) CMemSpyViewKernelContainers( iEngine, iObserver );
+        {        
 		child = new(ELeave) CMemSpyViewKernelContainers( iMemSpySession, iObserver );
         }
     else if ( index == 1 )
-        {
-        //child = new(ELeave) CMemSpyViewKernelHeap( iEngine, iObserver );
+        {        
 		child = new(ELeave) CMemSpyViewKernelHeap( iMemSpySession, iObserver );
         }
 	
--- a/memspyui/ui/avkon/src/MemSpyViewKernelContainers.cpp	Fri Jun 11 16:29:34 2010 +0100
+++ b/memspyui/ui/avkon/src/MemSpyViewKernelContainers.cpp	Thu Jul 22 16:33:59 2010 +0100
@@ -56,7 +56,7 @@
     {
     _LIT( KTitle, "Kernel Objects" );
     SetTitleL( KTitle );
-    //
+    //    
     CMemSpyViewBase::ConstructL( aRect, aContainer, aSelectionRune );
     }
 
@@ -107,9 +107,10 @@
 		{
 		TInt count = iKernelObjects[i]->Count();
 		TInt size = iKernelObjects[i]->Size();
-		const TMemSpySizeText sizeText( MemSpyEngineUtils::FormatSizeText( size, 0 ) ); //TODO: is this OK to call Engine Utils?
+		const TMemSpySizeText sizeText( MemSpyUiUtils::FormatSizeText( size, 0 ) );
 								
-		HBufC* tempName = HBufC::NewL( iKernelObjects[i]->Name().Length() + 32 ); //TODO: to removed this bulharic constant
+		HBufC* tempName = HBufC::NewL( iKernelObjects[i]->Name().Length() + 32 );
+		
 		CleanupStack::PushL( tempName );
 		TPtr tempNamePtr( tempName->Des() );
 		tempNamePtr.Copy( iKernelObjects[i]->Name() );									
@@ -117,7 +118,7 @@
 		_LIT(KNameFormat, "\t%S\t\t%d item");
 		TPtr pName( tempName->Des() );
 		//
-		const TPtrC pType( TypeAsString( iKernelObjects[i]->Type() ) );
+		const TPtrC pType( MemSpyUiUtils::TypeAsString( iKernelObjects[i]->Type() ) );
 		//
 		pName.Format( KNameFormat, &pType, count );
 		//
@@ -126,7 +127,7 @@
 			pName.Append( _L("s") );
 			}
 
-		pName.AppendFormat( _L(", %S"), &sizeText ); // TODO: to create some ServerUtils class with formating methods for size and type!
+		pName.AppendFormat( _L(", %S"), &sizeText );
 		
 		model->AppendL( pName );
 		
@@ -136,19 +137,6 @@
 	CAknSettingStyleListBox* listbox = static_cast< CAknSettingStyleListBox* >( iListBox );	
 	listbox->Model()->SetItemTextArray( model );
 	listbox->Model()->SetOwnershipType( ELbmDoesNotOwnItemArray );
-
-	/*
-    // Take ownership of new model
-    CMemSpyEngineHelperKernelContainers& kernelContainerManager = iEngine.HelperKernelContainers();
-    CMemSpyEngineGenericKernelObjectContainer* model = kernelContainerManager.ObjectsAllL();
-    delete iModel;
-    iModel = model;
-    
-    // Set up list box
-    CAknSettingStyleListBox* listbox = static_cast< CAknSettingStyleListBox* >( iListBox );
-    listbox->Model()->SetItemTextArray( model );
-    listbox->Model()->SetOwnershipType( ELbmDoesNotOwnItemArray );
-    */
     }
 
 
@@ -173,94 +161,5 @@
 
 void CMemSpyViewKernelContainers::OnCmdOutputAllContainerContentsL()
     {
-	/* TODO
-    CMemSpyEngineOutputSink& sink = iEngine.Sink();
-    iModel->OutputL( sink );
-    */
+	iMemSpySession.OutputAllContainerContents();		
     }
-
-//formating methods
-TPtrC CMemSpyViewKernelContainers::TypeAsString( TMemSpyDriverContainerType aType )
-    {
-    _LIT( KTypeUnknown, "Unknown Type" );
-    _LIT( KTypeThread, "Thread" );
-    _LIT( KTypeProcess, "Process" );
-    _LIT( KTypeChunk, "Chunk" );
-    _LIT( KTypeLibrary, "Library" );
-    _LIT( KTypeSemaphore, "Semaphore" );
-    _LIT( KTypeMutex, "Mutex" );
-    _LIT( KTypeTimer, "Timer" );
-    _LIT( KTypeServer, "Server" );
-    _LIT( KTypeSession, "Session" );
-    _LIT( KTypeLogicalDevice, "Logical Device" );
-    _LIT( KTypePhysicalDevice, "Physical Device" );
-    _LIT( KTypeLogicalChannel, "Logical Channel" );
-    _LIT( KTypeChangeNotifier, "Change Notifier" );
-    _LIT( KTypeUndertaker, "Undertaker" );
-    _LIT( KTypeMsgQueue, "Msg. Queue" );
-    _LIT( KTypePropertyRef, "Property Ref." );
-    _LIT( KTypeCondVar, "Conditional Var." );
-     //
-    TPtrC pType( KTypeUnknown );
-    //
-    switch( aType )
-        {
-    case EMemSpyDriverContainerTypeThread:
-        pType.Set( KTypeThread );
-        break;
-    case EMemSpyDriverContainerTypeProcess:
-        pType.Set( KTypeProcess );
-        break;
-    case EMemSpyDriverContainerTypeChunk:
-        pType.Set( KTypeChunk );
-        break;
-    case EMemSpyDriverContainerTypeLibrary:
-        pType.Set( KTypeLibrary );
-        break;
-    case EMemSpyDriverContainerTypeSemaphore:
-        pType.Set( KTypeSemaphore );
-        break;
-    case EMemSpyDriverContainerTypeMutex:
-        pType.Set( KTypeMutex );
-        break;
-    case EMemSpyDriverContainerTypeTimer:
-        pType.Set( KTypeTimer );
-        break;
-    case EMemSpyDriverContainerTypeServer:
-        pType.Set( KTypeServer );
-        break;
-    case EMemSpyDriverContainerTypeSession:
-        pType.Set( KTypeSession );
-        break;
-    case EMemSpyDriverContainerTypeLogicalDevice:
-        pType.Set( KTypeLogicalDevice );
-        break;
-    case EMemSpyDriverContainerTypePhysicalDevice:
-        pType.Set( KTypePhysicalDevice );
-        break;
-    case EMemSpyDriverContainerTypeLogicalChannel:
-        pType.Set( KTypeLogicalChannel );
-        break;
-    case EMemSpyDriverContainerTypeChangeNotifier:
-        pType.Set( KTypeChangeNotifier );
-        break;
-    case EMemSpyDriverContainerTypeUndertaker:
-        pType.Set( KTypeUndertaker );
-        break;
-    case EMemSpyDriverContainerTypeMsgQueue:
-        pType.Set( KTypeMsgQueue );
-        break;
-    case EMemSpyDriverContainerTypePropertyRef:
-        pType.Set( KTypePropertyRef );
-        break;
-    case EMemSpyDriverContainerTypeCondVar:
-        pType.Set( KTypeCondVar );
-        break;
-        
-    default:
-        break;
-        }
-    //
-    return pType;
-    }
-
--- a/memspyui/ui/avkon/src/MemSpyViewKernelHeap.cpp	Fri Jun 11 16:29:34 2010 +0100
+++ b/memspyui/ui/avkon/src/MemSpyViewKernelHeap.cpp	Thu Jul 22 16:33:59 2010 +0100
@@ -101,26 +101,13 @@
 	CMemSpyApiHeap* iHeap;
 	iHeap = iMemSpySession.GetHeap( );
 		
-	CDesCArrayFlat* model = new (ELeave) CDesC16ArrayFlat( 22 ); //array for formated items TODO: to remove constant
+	CDesCArrayFlat* model = new (ELeave) CDesC16ArrayFlat( 22 );
 		
 	model = FormatModel( iHeap );	
 				
 	CAknSettingStyleListBox* listbox = static_cast< CAknSettingStyleListBox* >( iListBox );
 	listbox->Model()->SetItemTextArray( model );
-	listbox->Model()->SetOwnershipType( ELbmOwnsItemArray );	
-	
-	/*
-	// Get list contents
-	TMemSpyHeapInfo heapInfo;
-	iEngine.HelperHeap().GetHeapInfoKernelL( heapInfo );
-	CMemSpyEngineOutputList* list = iEngine.HelperHeap().NewHeapSummaryShortLC( heapInfo );
-
-	// Set up list box
-	CAknSettingStyleListBox* listbox = static_cast< CAknSettingStyleListBox* >( iListBox );
-	listbox->Model()->SetItemTextArray( list );
-	listbox->Model()->SetOwnershipType( ELbmOwnsItemArray );
-	CleanupStack::Pop( list );
-	*/
+	listbox->Model()->SetOwnershipType( ELbmOwnsItemArray );			
 	}
 
 
@@ -144,9 +131,8 @@
 
 
 void CMemSpyViewKernelHeap::OnCmdDumpKernelHeapL()
-    {
-	// TODO
-    //iEngine.HelperHeap().OutputHeapDataKernelL();
+    {	
+    iMemSpySession.DumpKernelHeap();
     }
 
 
@@ -178,7 +164,7 @@
 	 _LIT( KItem11, "Max. length" );
 	 _LIT( KItem12, "Debug Allocator Library" );
 	 
-	HBufC* iItem = HBufC::NewL( 64 );	
+	HBufC* iItem = HBufC::NewL( KMaxName );	
 	
 	iItem = FormatItem( KItem0, aHeap->Type() );
 	TPtr pItem( iItem->Des() );
@@ -305,7 +291,7 @@
 
 HBufC* CMemSpyViewKernelHeap::FormatItem( const TDesC& aCaption, const TDesC& aValue )
 	{
-	HBufC* retBuf = HBufC::NewL( 64 );
+	HBufC* retBuf = HBufC::NewL( KMaxName );
 	TPtr pRetBuf( retBuf->Des() );
 	pRetBuf.Zero();
 	pRetBuf.Append( _L("\t") );
@@ -317,7 +303,7 @@
 
 HBufC* CMemSpyViewKernelHeap::FormatItem( const TDesC& aCaption, TInt aValue )
 	{
-	HBufC* retBuf = HBufC::NewL( 64 );
+	HBufC* retBuf = HBufC::NewL( KMaxName );
 	TPtr pRetBuf( retBuf->Des() );
 	pRetBuf.Zero();
     
@@ -334,7 +320,7 @@
 
 HBufC* CMemSpyViewKernelHeap::FormatItem( const TDesC& aCaption, TUint aValue )
 	{
-	HBufC* retBuf = HBufC::NewL( 64 );
+	HBufC* retBuf = HBufC::NewL( KMaxName );
 	TPtr pRetBuf( retBuf->Des() );
 	pRetBuf.Zero();
     
@@ -352,7 +338,7 @@
 
 HBufC* CMemSpyViewKernelHeap::FormatItem( const TDesC& aCaption, const TInt64& aValue )
 	{
-	HBufC* retBuf = HBufC::NewL( 64 );
+	HBufC* retBuf = HBufC::NewL( KMaxName );
 	TPtr pRetBuf( retBuf->Des() );
 	pRetBuf.Zero();
 	    
@@ -369,7 +355,7 @@
 
 HBufC* CMemSpyViewKernelHeap::FormatItem( const TDesC& aCaption, TAny* aValue )
 	{
-	HBufC* retBuf = HBufC::NewL( 64 );
+	HBufC* retBuf = HBufC::NewL( KMaxName );
 	TPtr pRetBuf( retBuf->Des() );
 	pRetBuf.Zero();
 		    
@@ -386,7 +372,7 @@
 
 HBufC* CMemSpyViewKernelHeap::FormatItem( const TDesC& aCaption, TUint* aValue )
 	{
-	HBufC* retBuf = HBufC::NewL( 64 );
+	HBufC* retBuf = HBufC::NewL( KMaxName );
 	TPtr pRetBuf( retBuf->Des() );
 	pRetBuf.Zero();
 		    
@@ -403,7 +389,7 @@
 
 HBufC* CMemSpyViewKernelHeap::FormatItem( const TDesC& aCaption, TUint8* aValue )
 	{
-	HBufC* retBuf = HBufC::NewL( 64 );
+	HBufC* retBuf = HBufC::NewL( KMaxName );
 	TPtr pRetBuf( retBuf->Des() );
 	pRetBuf.Zero();
 		    
@@ -420,7 +406,7 @@
 
 HBufC* CMemSpyViewKernelHeap::FormatPercentageItem( const TDesC& aCaption, TReal aOneHundredPercentValue, TReal aValue )
 	{
-	HBufC* retBuf = HBufC::NewL( 64 );	//buffer for formatted item
+	HBufC* retBuf = HBufC::NewL( KMaxName );	//buffer for formatted item
 	TPtr pRetBuf( retBuf->Des() );
 	pRetBuf.Zero();
 	
--- a/memspyui/ui/avkon/src/MemSpyViewKernelObjects.cpp	Fri Jun 11 16:29:34 2010 +0100
+++ b/memspyui/ui/avkon/src/MemSpyViewKernelObjects.cpp	Thu Jul 22 16:33:59 2010 +0100
@@ -165,7 +165,7 @@
 
 void CMemSpyViewKernelObjects::SetListBoxModelL()
     {
-    _LIT( KLineFormatSpec, "\t%S" );
+    //_LIT( KLineFormatSpec, "\t%S" );
     _LIT( KTab, "\t" );
        
     iMemSpySession.GetKernelObjectItems( iKernelObjectItems, iObjectType );
@@ -178,7 +178,10 @@
     	CleanupStack::PushL( tempName );
     	TPtr tempNamePtr( tempName->Des() );
     	tempNamePtr.Copy( KTab );
-    	tempNamePtr.Append( iKernelObjectItems[i]->Name() );
+    	
+    	TBuf<KMaxName> temp;
+    	temp.Copy(iKernelObjectItems[i]->Name());    	
+    	tempNamePtr.Append( temp	 );
     	iModel->AppendL( tempNamePtr );
     	
     	CleanupStack::PopAndDestroy( tempName ); 
@@ -248,27 +251,15 @@
 
 
 TKeyResponse CMemSpyViewKernelObjects::OfferKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType )
-    {
-	// TODO: to remove support of tabs
+    {	
     TKeyResponse resp = EKeyWasNotConsumed;
-    if  ( iTabs && ( aKeyEvent.iScanCode == EStdKeyRightArrow || aKeyEvent.iScanCode == EStdKeyLeftArrow ) )
-        {
-        resp = iTabs->OfferKeyEventL( aKeyEvent, aType );
-        }
-    else
-        {
-        resp = CMemSpyViewBase::OfferKeyEventL( aKeyEvent, aType );    
-        }
+    resp = CMemSpyViewBase::OfferKeyEventL( aKeyEvent, aType );    
+    //}
     return resp;
     }
 
-
 void CMemSpyViewKernelObjects::TabChangedL( TInt /*aIndex*/ )
     {
-	/* TODO: tabs removed
-    iObjectType = (TMemSpyDriverContainerType)iTabs->ActiveTabId();
-    RefreshL();
-    */
     }
 
 
@@ -278,13 +269,13 @@
         {
         case EMemSpyDriverContainerTypeThread:
             {
+            TBool err = EFalse;
             TBool doTerminate = ETrue;
             
             //CMemSpyEngineObjectContainer& container = iEngine.Container();
             //TThreadId id( iObjectList->At( iListBox->CurrentItemIndex() ).iId );
             TThreadId id( iKernelObjectItems[ iListBox->CurrentItemIndex() ]->Id() ); //get id of the current thread
-            
-            TBool err;
+                        
             iMemSpySession.ThreadSystemPermanentOrCritical( id, err );
             
             // Try to find the thread in question...
@@ -299,7 +290,8 @@
 				
 				if ( doTerminate )
 					{
-					iMemSpySession.TerminateThread( id );
+					iMemSpySession.EndThread( id, ETerminate );
+					RefreshL();
 					}
             	}            
             
@@ -319,21 +311,35 @@
                     thread->TerminateL();
                     }                
                 }
-            */
-            RefreshL();
+            */            
             break;
             }        
         case EMemSpyDriverContainerTypeProcess:
             {
+            TBool err = EFalse;
             TBool doTerminate = ETrue;
-            // Obtain the process that corresponds to the selected item
-            //CMemSpyEngineObjectContainer& container = iEngine.Container();
-            //TProcessId id( iObjectList->At( iListBox->CurrentItemIndex() ).iId );
             TProcessId id( iKernelObjectItems[ iListBox->CurrentItemIndex() ]->Id() );
+            iMemSpySession.ProcessSystemPermanentOrCritical( id, err );
             
+            if( err )
+            	{
+				CAknQueryDialog* importDialog = CAknQueryDialog::NewL();	
+                doTerminate = ( importDialog->ExecuteLD( R_MEMSPY_PANIC_SYSTEM_CRITICAL_THREAD_OR_PROCESS ) );
+                
+                if( doTerminate )
+                	{
+                    iMemSpySession.EndProcess( id, ETerminate );     
+                    RefreshL();
+                    }
+            	}
+            
+            // Obtain the process that corresponds to the selected item
+            /*
+            CMemSpyEngineObjectContainer& container = iEngine.Container();
+            TProcessId id( iObjectList->At( iListBox->CurrentItemIndex() ).iId );                                                
             CMemSpyProcess& process = container.ProcessByIdL( id );
-            process.Open();
-
+            process.Open();			
+            						
             if  ( process.IsSystemPermanent() || process.IsSystemCritical() )
                 {
                 CAknQueryDialog* importDialog = CAknQueryDialog::NewL();
@@ -344,7 +350,8 @@
                 {
                 process.TerminateL();
                 RefreshL();
-                }
+                }*/
+            
             break;
             }
         default:
@@ -357,7 +364,9 @@
 
 
 void CMemSpyViewKernelObjects::OnCmdSwitchToL()
-    {/*
+    {	
+	TBool brought = EFalse;
+	/*
     TInt wgCount;
     RWsSession wsSession;
     User::LeaveIfError( wsSession.Connect() );
@@ -370,11 +379,15 @@
     TBool brought( EFalse );
     TInt wgId( KErrNotFound );
     TThreadId threadId;
+    */
     switch ( iObjectType )
-        {
+        {    	    	    	
         case EMemSpyDriverContainerTypeThread:
             {
-            TThreadId currentThreadId( iObjectList->At( iListBox->CurrentItemIndex() ).iId );
+            TThreadId currentThreadId( iKernelObjectItems[ iListBox->CurrentItemIndex() ]->Id() );
+            TInt error = iMemSpySession.SwitchToThread( currentThreadId, brought );
+            /*
+            TThreadId currentThreadId( iObjectList->At( iListBox->CurrentItemIndex() ).iId );            
             
             // loop trough all window groups and see if a thread id matches
             while( !brought && wgCount-- )
@@ -392,14 +405,21 @@
                         }
                     CleanupStack::PopAndDestroy( wgName );
                     }
-                }                
+                }
+                */                
             break;
             }
         case EMemSpyDriverContainerTypeProcess:
-            {
-            CMemSpyEngineObjectContainer& container = iEngine.Container();
-            TProcessId id( iObjectList->At( iListBox->CurrentItemIndex() ).iId );
-            CMemSpyProcess& process = container.ProcessByIdL( id );
+            {                        
+            TProcessId id( iKernelObjectItems[ iListBox->CurrentItemIndex() ]->Id() );
+            TInt error = iMemSpySession.SwitchToProcess( id, brought  );
+            /*
+            //CMemSpyEngineObjectContainer& container = iEngine.Container();
+            //TProcessId id( iObjectList->At( iListBox->CurrentItemIndex() ).iId );
+            //CMemSpyProcess& process = container.ProcessByIdL( id );
+            
+            TProcessId id( iKernelObjectItems[iListBox->CurrentItemIndex()]->Id() );
+            
             
             // loop trough threads in a process
             for ( TInt i = 0; i < process.MdcaCount(); i++ )
@@ -424,7 +444,7 @@
                         }
                     }
                 }
-
+			*/
             break;
             }
         default:
@@ -438,18 +458,36 @@
         // Error handling in HandleCommandL
         User::Leave( KErrGeneral );
         }
-    CleanupStack::PopAndDestroy( 2 ); //wgArray,wsSession*/
+    CleanupStack::PopAndDestroy( 2 ); //wgArray,wsSession    
     }
 
 
 void CMemSpyViewKernelObjects::OnCmdEndL()
-    {/*
+    {
     switch ( iObjectType )
         {
         case EMemSpyDriverContainerTypeThread:
             {
+            TBool err = EFalse;
             TBool doTerminate = ETrue;
             
+            TThreadId id( iKernelObjectItems[ iListBox->CurrentItemIndex() ]->Id() ); //get id of the current thread                                   
+            iMemSpySession.ThreadSystemPermanentOrCritical( id, err );
+            
+            if( err )
+            	{
+				CAknQueryDialog* importDialog = CAknQueryDialog::NewL();
+				doTerminate = ( importDialog->ExecuteLD( R_MEMSPY_PANIC_SYSTEM_CRITICAL_THREAD_OR_PROCESS ) );
+                        				
+				if ( doTerminate )
+					{
+					iMemSpySession.EndThread( id, EKill );
+					RefreshL();
+					}
+            	}            
+
+            
+            /*
             CMemSpyEngineObjectContainer& container = iEngine.Container();
             TThreadId id( iObjectList->At( iListBox->CurrentItemIndex() ).iId );
             
@@ -473,11 +511,31 @@
                     thread->KillL();
                     }                
                 }
+            
             RefreshL();
+            */
             break;
             }
         case EMemSpyDriverContainerTypeProcess:
             {
+            TBool err = EFalse;
+            TBool doTerminate = ETrue;
+            TProcessId id( iKernelObjectItems[ iListBox->CurrentItemIndex() ]->Id() );
+            iMemSpySession.ProcessSystemPermanentOrCritical( id, err );
+            
+            if( err )
+            	{
+				CAknQueryDialog* importDialog = CAknQueryDialog::NewL();	
+				doTerminate = ( importDialog->ExecuteLD( R_MEMSPY_PANIC_SYSTEM_CRITICAL_THREAD_OR_PROCESS ) );
+				
+				if( doTerminate )
+					{
+					iMemSpySession.EndProcess( id, EKill);     
+					RefreshL();
+					}
+            	}
+            
+            /*
             TBool doTerminate = ETrue;
             // Obtain the process that corresponds to the selected item
             CMemSpyEngineObjectContainer& container = iEngine.Container();
@@ -495,7 +553,7 @@
                 process.KillL();
                 RefreshL();
                 }
-
+			*/
             break;
             }
         default:
@@ -503,63 +561,55 @@
             // Programming error
             __ASSERT_ALWAYS( EFalse, User::Panic( _L("MemSpy-View"), 0 ) );
             }
-        }    */
+        }    
     }
 
 
 void CMemSpyViewKernelObjects::OnCmdPanicL()
-    {/*
+    {
     switch ( iObjectType )
         {
         case EMemSpyDriverContainerTypeThread:
             {
+            TBool err = EFalse;
             TBool doTerminate = ETrue;
             
-            CMemSpyEngineObjectContainer& container = iEngine.Container();
-            TThreadId id( iObjectList->At( iListBox->CurrentItemIndex() ).iId );
+            TThreadId id( iKernelObjectItems[ iListBox->CurrentItemIndex() ]->Id() ); //get id of the current thread                                   
+            iMemSpySession.ThreadSystemPermanentOrCritical( id, err );
             
-            // Try to find the thread in question...
-            CMemSpyProcess* process = NULL;
-            CMemSpyThread* thread = NULL; 
-            User::LeaveIfError( container.ProcessAndThreadByThreadId( id, process, thread ) );
-
-            if ( thread )
-                {
-                thread->Open();
-                //
-                if  ( thread->IsSystemPermanent() || thread->IsSystemCritical() )
-                    {
-                    CAknQueryDialog* importDialog = CAknQueryDialog::NewL();
-                    doTerminate = ( importDialog->ExecuteLD( R_MEMSPY_PANIC_SYSTEM_CRITICAL_THREAD_OR_PROCESS ) );
-                    }
-                //
-                if  ( doTerminate )
-                    {
-                    thread->PanicL();
-                    }                
-                }
-            RefreshL();
+            if( err )
+            	{
+				CAknQueryDialog* importDialog = CAknQueryDialog::NewL();
+				doTerminate = ( importDialog->ExecuteLD( R_MEMSPY_PANIC_SYSTEM_CRITICAL_THREAD_OR_PROCESS ) );
+                        				
+				if ( doTerminate )
+					{
+					iMemSpySession.EndThread( id, EPanic );
+					RefreshL();
+					}
+            	}
+            
             break;
             }
         case EMemSpyDriverContainerTypeProcess:
             {
+            TBool err = EFalse;
             TBool doTerminate = ETrue;
-            // Obtain the process that corresponds to the selected item
-            CMemSpyEngineObjectContainer& container = iEngine.Container();
-            TProcessId id( iObjectList->At( iListBox->CurrentItemIndex() ).iId );
-            CMemSpyProcess& process = container.ProcessByIdL( id );
-            process.Open();
-
-            if  ( process.IsSystemPermanent() || process.IsSystemCritical() )
-                {
-                CAknQueryDialog* importDialog = CAknQueryDialog::NewL();
-                doTerminate = ( importDialog->ExecuteLD( R_MEMSPY_PANIC_SYSTEM_CRITICAL_THREAD_OR_PROCESS ) );
-                }
-            if  ( doTerminate )
-                {
-                process.PanicL();
-                RefreshL();
-                }
+            TProcessId id( iKernelObjectItems[ iListBox->CurrentItemIndex() ]->Id() );
+            iMemSpySession.ProcessSystemPermanentOrCritical( id, err );
+            
+            if( err )
+            	{
+				CAknQueryDialog* importDialog = CAknQueryDialog::NewL();	
+				doTerminate = ( importDialog->ExecuteLD( R_MEMSPY_PANIC_SYSTEM_CRITICAL_THREAD_OR_PROCESS ) );
+                           
+				if( doTerminate )
+					{
+					iMemSpySession.EndProcess( id, EPanic );     
+					RefreshL();
+					}
+            	}
+        
             break;
             }
         default:
@@ -567,42 +617,21 @@
             // Programming error
             __ASSERT_ALWAYS( EFalse, User::Panic( _L("MemSpy-View"), 0 ) );
             }
-        }*/
+        }
     }
 
 
 void CMemSpyViewKernelObjects::CreateTabsL()
     {
+	TMemSpyDriverContainerType type = iKernelObjectItems[ iListBox->CurrentItemIndex() ]->Type();
+	const TPtrC pType( MemSpyUiUtils::TypeAsString( type ) );
+	
 	CEikStatusPane* statusPane = static_cast<CAknAppUi*> ( iEikonEnv->EikAppUi() )->StatusPane();
 	TUid uid;
 	uid.iUid = EEikStatusPaneUidNavi;
 	iNaviPane = ( CAknNavigationControlContainer * ) statusPane->ControlL( TUid::Uid( EEikStatusPaneUidNavi ) );	
-	iNavDecorator=iNaviPane->CreateMessageLabelL(_L("Kernel Object Type")); //TODO: To print there kernel object type
-	iNaviPane->PushL(*iNavDecorator); 
-	/*
-    CEikStatusPane* statusPane = static_cast<CAknAppUi*> ( iEikonEnv->EikAppUi() )->StatusPane();
-    TUid uid;
-    uid.iUid = EEikStatusPaneUidNavi;
-    iNavDecorator = ((CAknNavigationControlContainer*)(statusPane->ControlL(uid)))->Top();
-
-    if ( !iNavDecorator )
-        {
-        iNavContainer = (CAknNavigationControlContainer*)statusPane->ControlL(uid);
-        iNavDecorator = iNavContainer->CreateTabGroupL();
-
-        iTabs = ( CAknTabGroup* )iNavDecorator->DecoratedControl();
-        iTabs->SetTabFixedWidthL( KTabWidthWithThreeLongTabs );
-    
-        for ( TInt i = 0; i < iModel->Count(); i++ )
-            {
-            const CMemSpyEngineGenericKernelObjectList& item = iModel->At( i );
-            iTabs->AddTabL( item.Type(), item.TypeAsString( item.Type() ) );
-            }
-        iTabs->SetActiveTabById( iObjectType );
-        iTabs->SetObserver( this );
-        iNavContainer->PushL( *iNavDecorator );
-       }
-       */
+	iNavDecorator=iNaviPane->CreateMessageLabelL( pType );
+	iNaviPane->PushL(*iNavDecorator); 		
     }
 
 
--- a/memspyui/ui/avkon/src/MemSpyViewProcesses.cpp	Fri Jun 11 16:29:34 2010 +0100
+++ b/memspyui/ui/avkon/src/MemSpyViewProcesses.cpp	Thu Jul 22 16:33:59 2010 +0100
@@ -37,39 +37,18 @@
 #include "MemSpyViewThreads.h"
 #include "MemSpyViewMainMenu.h"
 #include "MemSpyContainerObserver.h"
+#include "MemSpyUiUtils.h"
 
 // Constants
 const TInt KMemSpyMaxSearchTextLength = 30;
 const TInt KMemSpyMaxSearchTextLengthWithWildcards = KMemSpyMaxSearchTextLength + 4;
 
 
-/*
-CMemSpyViewProcesses::CMemSpyViewProcesses( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver )
-:   CMemSpyViewBase( aEngine, aObserver )
-    {
-    }
-
-
-CMemSpyViewProcesses::CMemSpyViewProcesses( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyProcess& aProcess )
-:   CMemSpyViewBase( aEngine, aObserver ), iCurrentProcess( &aProcess )
-    {
-    iCurrentProcess->Open();
-    }
-*/
-
 CMemSpyViewProcesses::CMemSpyViewProcesses( RMemSpySession& aSession, MMemSpyViewObserver& aObserver )
 :   CMemSpyViewBase( aSession, aObserver )
     {
     }
 
-/*
-CMemSpyViewProcesses::CMemSpyViewProcesses( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyProcess& aProcess )
-:   CMemSpyViewBase( aEngine, aObserver ), iCurrentProcess( &aProcess )
-    {
-    iCurrentProcess->Open();
-    }
-*/
-
 CMemSpyViewProcesses::CMemSpyViewProcesses( RMemSpySession& aEngine, MMemSpyViewObserver& aObserver, TProcessId aId )
 :   CMemSpyViewBase( aEngine, aObserver ), iCurrentProcessId( aId )
     {
@@ -97,17 +76,18 @@
     iMatcherBuffer = HBufC::NewL( KMemSpyMaxSearchTextLengthWithWildcards );
     //
     iSearchField = CAknSearchField::NewL( *this, CAknSearchField::ESearch, NULL, KMemSpyMaxSearchTextLength );
+
     iSearchField->SetObserver( this );
     iSearchField->SetFocus( ETrue );
     iSearchField->SetComponentsToInheritVisibility( ETrue );
     //    
-    if  ( aSelectionRune )
+    if  ( iCurrentProcessId > 0 )
         {
 		TInt index = 0;
-		TProcessId selectedItem = aSelectionRune; //static_cast< TProcessId >( *aSelectionRune );
+	//	TProcessId selectedItem = aSelectionRune; //static_cast< TProcessId >( *aSelectionRune );
 		for( TInt i=0; i<iProcesses.Count();i++)
 			{
-			if( iProcesses[i]->Id() == selectedItem )
+			if( iProcesses[i]->Id() == iCurrentProcessId )
 				{
 				index = i;
 				}
@@ -119,7 +99,7 @@
             HandleListBoxItemSelectedL( index );
             }            
         }
-    else if ( iProcesses.Count() > 0 ) //TODO: to solve item selection when come back from previous view
+    else if ( iProcesses.Count() > 0 )
         {
         iListBox->SetCurrentItemIndex( 0 );
         HandleListBoxItemSelectedL( 0 );
@@ -164,7 +144,7 @@
 
 CMemSpyViewBase* CMemSpyViewProcesses::PrepareChildViewL()
     {	
-    CMemSpyViewThreads* child = new(ELeave) CMemSpyViewThreads( iMemSpySession, iObserver, iProcesses[iListBox->CurrentItemIndex()]->Id() );
+    CMemSpyViewThreads* child = new(ELeave) CMemSpyViewThreads( iMemSpySession, iObserver, iProcesses[iListBox->CurrentItemIndex()]->Id(), 0 );
     CleanupStack::PushL( child );
     child->ConstructL( Rect(), *Parent() );
     CleanupStack::Pop( child );
@@ -379,9 +359,9 @@
 	iModel = new (ELeave) CDesC16ArrayFlat( iProcesses.Count() + 1); //array for formated items
 	
 	_LIT( KTab, "\t" );
-	//iModel = FormatModel( iProcesses ); //TODO Format model method with advanced formatting
+	iModel = FormatModel( iProcesses ); //TODO Format model method with advanced formatting
 	
-	
+	/*
 	for( TInt i=0; i < iProcesses.Count(); i++ )
 		{
 		HBufC* tempName = HBufC::NewL( iProcesses[i]->Name().Length() + 16 );
@@ -393,7 +373,7 @@
     	
     	CleanupStack::PopAndDestroy( tempName ); 
 		}			
-	
+	*/
 	CAknSettingStyleListBox* listbox = static_cast< CAknSettingStyleListBox* >( iListBox );
     //listbox->Model()->SetItemTextArray( &iEngine.Container() );
     listbox->Model()->SetItemTextArray( iModel );
@@ -578,7 +558,7 @@
 
 //Model formating methods
 //TODO: to be debbuged
-/*
+
 CDesCArrayFlat* CMemSpyViewProcesses::FormatModel( RArray<CMemSpyApiProcess*> aProcesses )
 	{		
 	model = new (ELeave) CDesC16ArrayFlat( iProcesses.Count() + 16 ); //array for formated items
@@ -592,17 +572,18 @@
 	    tempNamePtr.Copy( aProcesses[i]->Name() );
 		
 		TBuf<10> priority;
-		AppendPriority( priority, aProcesses[i]->Priority() );
+		TProcessPriority tempPriority = aProcesses[i]->Priority();
+		MemSpyUiUtils::AppendPriority( priority, tempPriority );
 		
 	    // Convert the full name to the format we want in the UI
 	    TBuf<KMaxFullName + 60> name;
 	    TMemSpyTruncateOverflow overflow; //included from EngineUtils TODO: to consider if this is needed to be removed or left there
-	    	    
-	    name.AppendFormat( KMemSpyProcessNameFormatSpecBasicName, &overflow, tempNamePtr, aProcesses[i]->SID() );
+	    TUint32 tempSID =  aProcesses[i]->SID();
+	    name.AppendFormat( KMemSpyProcessNameFormatSpecBasicName, &overflow, tempName, tempSID );	//tempNamePtr
 	    
 	    if( aProcesses[i]->ExitType() != EExitPending ) // instead of IsDead() method
 	    	{
-			AppendExitInfo( name, aProcesses[i]->ExitType(), aProcesses[i]->ExitReason(), aProcesses[i]->ExitCategory() );
+			MemSpyUiUtils::AppendExitInfo( name, aProcesses[i]->ExitType(), aProcesses[i]->ExitReason(), aProcesses[i]->ExitCategory() );
 	    	}
 	    else
 	        {
@@ -617,7 +598,7 @@
 	
 	return model;
 	}
-
+/*
 void CMemSpyViewProcesses::AppendPriority( TDes& aDes, TProcessPriority aPriority )
 	{
 	switch( aPriority )
@@ -674,7 +655,8 @@
         aDes.AppendFormat( KAbnormalFormatSpec, &overflow, &aExitCategory, aExitReason );
         }
 	}
-
+*/
+/*
 void CMemSpyViewProcesses::AppendExitType( TDes& aDes, TExitType aType )
     {
     _LIT( KExitTypeKilled, "Killed" );
@@ -702,3 +684,4 @@
         }
     }
 */
+
--- a/memspyui/ui/avkon/src/MemSpyViewThreadInfoItemActiveObject.cpp	Fri Jun 11 16:29:34 2010 +0100
+++ b/memspyui/ui/avkon/src/MemSpyViewThreadInfoItemActiveObject.cpp	Thu Jul 22 16:33:59 2010 +0100
@@ -25,14 +25,14 @@
 #include <memspy/engine/memspyengineobjectthreadinfoobjects.h>
 #include <memspy/engine/memspyengineobjectthreadinfocontainer.h>
 #include <memspy/engine/memspyenginehelperactiveobject.h>
+#include <memspysession.h>
 
 // User includes
 #include "MemSpyContainerObserver.h"
 
 
-
-CMemSpyViewThreadInfoItemActiveObjectBase::CMemSpyViewThreadInfoItemActiveObjectBase( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyThreadInfoContainer& aContainer )
-:   CMemSpyViewThreadInfoItemGeneric( aEngine, aObserver, aContainer, EMemSpyThreadInfoItemTypeActiveObject )
+CMemSpyViewThreadInfoItemActiveObjectBase::CMemSpyViewThreadInfoItemActiveObjectBase(RMemSpySession& aSession, MMemSpyViewObserver& aObserver, TProcessId aProcId, TThreadId aId, TMemSpyThreadInfoItemType aType )
+:   CMemSpyViewThreadInfoItemGeneric( aSession, aObserver, aProcId, aId, EMemSpyThreadInfoItemTypeActiveObject )
     {
     }
 
@@ -40,6 +40,7 @@
 TBool CMemSpyViewThreadInfoItemActiveObjectBase::HandleCommandL( TInt aCommand )
     {
     TBool handled = ETrue;
+    /*
     //
     switch ( aCommand )
         {
@@ -51,6 +52,7 @@
         break;
         }
     //
+     * */
     return handled;
     }
 
@@ -59,20 +61,23 @@
     {
     if  ( aResourceId == R_MEMSPY_MENUPANE )
         {
-        aMenuPane->SetItemDimmed( EMemSpyCmdActiveObject, Thread().IsDead() );
+     //   aMenuPane->SetItemDimmed( EMemSpyCmdActiveObject, Thread().IsDead() );
         }
     }
 
 
 CMemSpyEngineActiveObjectArray& CMemSpyViewThreadInfoItemActiveObjectBase::ActiveObjectArray() const
     {
-    CMemSpyThreadInfoActiveObjects* activeObjectArray = static_cast< CMemSpyThreadInfoActiveObjects* >( iInfoItem );
-    return activeObjectArray->Array();
+ //   CMemSpyThreadInfoActiveObjects* activeObjectArray = static_cast< CMemSpyThreadInfoActiveObjects* >( iInfoItem );
+ //   return activeObjectArray->Array();
     }
     
     
 void CMemSpyViewThreadInfoItemActiveObjectBase::OnCmdWriteAOListingL()
     {
+	iMemSpySession.OutputAOListL( ThreadId(), EMemSpyThreadInfoItemTypeActiveObject );
+	
+	/*
     CMemSpyEngineActiveObjectArray& objects = ActiveObjectArray();
 
     // Begin a new data stream
@@ -100,6 +105,7 @@
 
     // End data stream
     iEngine.Sink().DataStreamEndL();
+    */
     }
 
 
@@ -112,8 +118,8 @@
 
 
 
-CMemSpyViewThreadInfoItemActiveObject::CMemSpyViewThreadInfoItemActiveObject( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyThreadInfoContainer& aContainer )
-:   CMemSpyViewThreadInfoItemActiveObjectBase( aEngine, aObserver, aContainer )
+CMemSpyViewThreadInfoItemActiveObject::CMemSpyViewThreadInfoItemActiveObject( RMemSpySession& aSession, MMemSpyViewObserver& aObserver,  TProcessId aProcId, TThreadId aId, TMemSpyThreadInfoItemType aType )
+:   CMemSpyViewThreadInfoItemActiveObjectBase( aSession, aObserver, aProcId, aId, aType )
     {
     }
 
@@ -127,6 +133,7 @@
     SetTitleL( KTitle );
 
     // Try to select the correct server
+    /* TODO: to consider this
     CMemSpyThreadInfoHandleObjectBase* infoItem = static_cast< CMemSpyThreadInfoHandleObjectBase* >( iInfoItem );
     TInt selectedIndex = 0;
     if  ( aSelectionRune )
@@ -142,9 +149,12 @@
     // Select item
     if  ( infoItem->DetailsCount() > 0 )
         {
-        iListBox->SetCurrentItemIndex( selectedIndex );
-        HandleListBoxItemSelectedL( selectedIndex );
+        */
+        iListBox->SetCurrentItemIndex( 0 ); //selectedIndex
+        HandleListBoxItemSelectedL( 0 ); //selectedIndex
+        /*
         }
+        */
     }
 
 
@@ -157,7 +167,7 @@
 CMemSpyViewBase* CMemSpyViewThreadInfoItemActiveObject::PrepareChildViewL()
     {
     CMemSpyViewBase* child = NULL;
-
+    /*
     // Get current entry address
     TInt index = iListBox->CurrentItemIndex();
     if  ( index > 0 )
@@ -177,6 +187,8 @@
             }
         }
     //
+     * 
+     */
     return child;
     }
 
@@ -189,7 +201,7 @@
 
 
 
-
+/*
 CMemSpyViewThreadInfoItemActiveObjectDetails::CMemSpyViewThreadInfoItemActiveObjectDetails( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyThreadInfoContainer& aContainer, TAny* aObjectAddress )
 :   CMemSpyViewThreadInfoItemActiveObjectBase( aEngine, aObserver, aContainer ), iObjectAddress( aObjectAddress )
     {
@@ -233,9 +245,4 @@
     listbox->Model()->SetItemTextArray( &object );
     listbox->Model()->SetOwnershipType( ELbmDoesNotOwnItemArray );
     }
-
-
-
-
-
-
+*/
--- a/memspyui/ui/avkon/src/MemSpyViewThreadInfoItemChunk.cpp	Fri Jun 11 16:29:34 2010 +0100
+++ b/memspyui/ui/avkon/src/MemSpyViewThreadInfoItemChunk.cpp	Thu Jul 22 16:33:59 2010 +0100
@@ -33,16 +33,16 @@
 
 
 
-CMemSpyViewThreadInfoItemChunk::CMemSpyViewThreadInfoItemChunk( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyThreadInfoContainer& aContainer )
-:   CMemSpyViewThreadInfoItemGeneric( aEngine, aObserver, aContainer, EMemSpyThreadInfoItemTypeChunk )
+CMemSpyViewThreadInfoItemChunk::CMemSpyViewThreadInfoItemChunk( RMemSpySession& aSession, MMemSpyViewObserver& aObserver, TProcessId aProcId, TThreadId aId, TMemSpyThreadInfoItemType aType )
+:   CMemSpyViewThreadInfoItemGeneric( aSession, aObserver, aProcId, aId, EMemSpyThreadInfoItemTypeChunk )
     {
     }
 
 
 CMemSpyViewBase* CMemSpyViewThreadInfoItemChunk::PrepareChildViewL()
-    {
+    {	
     CMemSpyViewBase* child = NULL;
-    
+    /* TODO
     // Get the code segment list
     CMemSpyThreadInfoChunk* chunkInfoItem = static_cast< CMemSpyThreadInfoChunk* >( iInfoItem );
     CMemSpyEngineChunkList* list = &chunkInfoItem->List();
@@ -62,8 +62,8 @@
         child->ConstructL( Rect(), *Parent() );
         CleanupStack::Pop( child );
         }
-        
-    return child;
+    */
+    return child;    
     }
 
 
--- a/memspyui/ui/avkon/src/MemSpyViewThreadInfoItemCodeSeg.cpp	Fri Jun 11 16:29:34 2010 +0100
+++ b/memspyui/ui/avkon/src/MemSpyViewThreadInfoItemCodeSeg.cpp	Thu Jul 22 16:33:59 2010 +0100
@@ -33,8 +33,8 @@
 
 
 
-CMemSpyViewThreadInfoItemCodeSeg::CMemSpyViewThreadInfoItemCodeSeg( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyThreadInfoContainer& aContainer )
-:   CMemSpyViewThreadInfoItemGeneric( aEngine, aObserver, aContainer, EMemSpyThreadInfoItemTypeCodeSeg )
+CMemSpyViewThreadInfoItemCodeSeg::CMemSpyViewThreadInfoItemCodeSeg( RMemSpySession& aSession, MMemSpyViewObserver& aObserver, TProcessId aProcId, TThreadId aId, TMemSpyThreadInfoItemType aType )
+:   CMemSpyViewThreadInfoItemGeneric( aSession, aObserver, aProcId, aId, EMemSpyThreadInfoItemTypeCodeSeg )
     {
     }
 
@@ -47,9 +47,9 @@
 
 
 CMemSpyViewBase* CMemSpyViewThreadInfoItemCodeSeg::PrepareChildViewL()
-    {
+    {	
     CMemSpyViewBase* child = NULL;
-    
+    /* TODO
     // Get the code segment list
     CMemSpyThreadInfoCodeSeg* codeSegInfoItem = static_cast< CMemSpyThreadInfoCodeSeg* >( iInfoItem );
     CMemSpyEngineCodeSegList* list = &codeSegInfoItem->List();
@@ -69,8 +69,8 @@
         child->ConstructL( Rect(), *Parent() );
         CleanupStack::Pop( child );
         }
-        
-    return child;
+    */
+    return child;    
     }
 
 
--- a/memspyui/ui/avkon/src/MemSpyViewThreadInfoItemGeneralInfo.cpp	Fri Jun 11 16:29:34 2010 +0100
+++ b/memspyui/ui/avkon/src/MemSpyViewThreadInfoItemGeneralInfo.cpp	Thu Jul 22 16:33:59 2010 +0100
@@ -26,6 +26,7 @@
 #include <memspy/engine/memspyengineobjectthreadinfocontainer.h>
 #include <memspy/engine/memspyenginehelperprocess.h>
 #include <memspy/engine/memspyenginehelperheap.h>
+#include <memspysession.h>
 
 // User includes
 #include "MemSpyContainerObserver.h"
@@ -33,11 +34,16 @@
 #include "MemSpyViewThreadInfoItemHeap.h"
 
 
-
+/*
 CMemSpyViewThreadInfoItemGeneralInfo::CMemSpyViewThreadInfoItemGeneralInfo( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyThreadInfoContainer& aContainer )
 :   CMemSpyViewThreadInfoItemGeneric( aEngine, aObserver, aContainer, EMemSpyThreadInfoItemTypeGeneralInfo )
     {
     }
+*/
+CMemSpyViewThreadInfoItemGeneralInfo::CMemSpyViewThreadInfoItemGeneralInfo( RMemSpySession& aSession, MMemSpyViewObserver& aObserver, TProcessId aProcId, TThreadId aId, TMemSpyThreadInfoItemType aType )
+:   CMemSpyViewThreadInfoItemGeneric( aSession, aObserver, aProcId, aId, EMemSpyThreadInfoItemTypeGeneralInfo )
+    {
+    }
 
 
 TBool CMemSpyViewThreadInfoItemGeneralInfo::HandleCommandL( TInt aCommand )
--- a/memspyui/ui/avkon/src/MemSpyViewThreadInfoItemGeneric.cpp	Fri Jun 11 16:29:34 2010 +0100
+++ b/memspyui/ui/avkon/src/MemSpyViewThreadInfoItemGeneric.cpp	Thu Jul 22 16:33:59 2010 +0100
@@ -29,58 +29,40 @@
 #include <memspy/engine/memspyengineobjectthreadinfoobjects.h>
 #include <memspy/engine/memspyengineobjectthreadinfocontainer.h>
 #include <memspy/engine/memspyenginehelperprocess.h>
+#include <memspysession.h>
 
 // User includes
 #include "MemSpyContainerObserver.h"
 #include "MemSpyViewThreadInfoItemList.h"
+#include "MemSpyUiUtils.h"
 
 // Constants
 const TInt KMemSpyConstructionCheckerTimerPeriod = 500000; // 1/2 second
 
-
-
-CMemSpyViewThreadInfoItemGeneric::CMemSpyViewThreadInfoItemGeneric( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyThreadInfoContainer& aInfoContainer, TMemSpyThreadInfoItemType aType )
-:   CMemSpyViewBase( aEngine, aObserver ), iContainer( aInfoContainer )
+CMemSpyViewThreadInfoItemGeneric::CMemSpyViewThreadInfoItemGeneric( RMemSpySession& aSession, MMemSpyViewObserver& aObserver, TProcessId aProcessId, TThreadId aId, TMemSpyThreadInfoItemType aType )
+:   CMemSpyViewBase( aSession, aObserver )//, iThreadId( aId ), iType( aType )		//iContainer( aInfoContainer )
     {
-    iContainer.Thread().Process().Open();
-    iContainer.Thread().Open();
-    iContainer.Open();
-    //
-    iInfoItem = &iContainer.Item( aType );
-    __ASSERT_ALWAYS( iInfoItem != NULL, User::Invariant() );
-    iInfoItem->Open();
+	iParentProcessId = aProcessId;
+	iThreadId = aId;
+	iType = aType;
     }
 
 
 CMemSpyViewThreadInfoItemGeneric::~CMemSpyViewThreadInfoItemGeneric()
-    {
+    {/* TODO:
     if  ( iInfoItem )
         {
         iInfoItem->Close();
-        }
-    //
-    DestroyWaitNote();
-    //
-    iContainer.Close();
-    iContainer.Thread().Close();
-    iContainer.Thread().Process().Close();
+        }    
+    DestroyWaitNote();    
+    */
     }
 
 
 void CMemSpyViewThreadInfoItemGeneric::ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune )
     {
-    const TPtrC pTitle( iInfoItem->Name().Mid( 1 ) );
-    SetTitleL( pTitle );
-    //
-    if  ( iInfoItem->IsReady() == EFalse )
-        {
-#ifdef _DEBUG
-        RDebug::Printf( "CMemSpyViewThreadInfoItemGeneric::ConstructL() - show wait note - item not ready, iType: %d", iInfoItem->Type() );
-#endif
-
-        // Wait for engine data to be made ready... 
-        ShowWaitNoteL();
-        }
+	const TPtrC pTitle( MemSpyUiUtils::ThreadInfoItemNameByType( iType ) );
+	SetTitleL( pTitle );
 
     CMemSpyViewBase::ConstructL( aRect, aContainer, aSelectionRune );
     }
@@ -88,32 +70,32 @@
 
 CMemSpyProcess& CMemSpyViewThreadInfoItemGeneric::Process() const
     {
-    return iContainer.Thread().Process();
+  //  return iContainer.Thread().Process();
     }
 
 
 CMemSpyThread& CMemSpyViewThreadInfoItemGeneric::Thread() const
     {
-    return iContainer.Thread();
+  //  return iContainer.Thread();
     }
 
 
 CMemSpyThreadInfoContainer& CMemSpyViewThreadInfoItemGeneric::Container() const
     {
-    return iContainer;
+ //   return iContainer;
     }
 
 
 CMemSpyThreadInfoItemBase& CMemSpyViewThreadInfoItemGeneric::InfoItem() const
     {
-    __ASSERT_ALWAYS( iInfoItem != NULL, User::Invariant() );
-    return *iInfoItem;
+ //   __ASSERT_ALWAYS( iInfoItem != NULL, User::Invariant() );
+ //   return *iInfoItem;
     }
 
 
 void CMemSpyViewThreadInfoItemGeneric::RefreshL()
     {
-    iInfoItem->RebuildL();    
+ //   iInfoItem->RebuildL();     //TODO
     SetListBoxModelL();
     CMemSpyViewBase::RefreshL();
     }
@@ -123,7 +105,8 @@
     {
     TMemSpyViewType type = EMemSpyViewTypeNone;
     //
-    switch( iInfoItem->Type() )
+    //switch( iInfoItem->Type() )
+    switch( iType )
         {
     case EMemSpyThreadInfoItemTypeHeap:
         type = EMemSpyViewTypeThreadInfoItemHeap;
@@ -196,7 +179,7 @@
         break;
 
     default:
-        __ASSERT_DEBUG( EFalse, User::Invariant() );
+        //__ASSERT_DEBUG( EFalse, User::Invariant() );
         break;
         }
     //
@@ -206,9 +189,9 @@
 
 CMemSpyViewBase* CMemSpyViewThreadInfoItemGeneric::PrepareParentViewL()
     {
-    CMemSpyViewThreadInfoItemList* parent = new(ELeave) CMemSpyViewThreadInfoItemList( iEngine, iObserver, Thread() );
+    CMemSpyViewThreadInfoItemList* parent = new(ELeave) CMemSpyViewThreadInfoItemList( iMemSpySession, iObserver, iParentProcessId, iThreadId );
     CleanupStack::PushL( parent );
-    parent->ConstructL( Rect(), *Parent(), iInfoItem );
+    parent->ConstructL( Rect(), *Parent(), iType );
     CleanupStack::Pop( parent );
     return parent;
     }
@@ -216,7 +199,7 @@
 
 CMemSpyViewBase* CMemSpyViewThreadInfoItemGeneric::PrepareChildViewL()
     {
-    __ASSERT_ALWAYS( iInfoItem != NULL, User::Invariant() );
+    //__ASSERT_ALWAYS( iInfoItem != NULL, User::Invariant() );
     CMemSpyViewBase* child = NULL;
     //
     return child;
@@ -232,8 +215,36 @@
 
 void CMemSpyViewThreadInfoItemGeneric::SetListBoxModelL()
     {
+	iMemSpySession.GetThreadInfoItems( iThreadInfoItems, iThreadId, iType );
+	
+	iModel = new (ELeave) CDesC16ArrayFlat( iThreadInfoItems.Count() + 10 );
+	
+	for( TInt i=0; i<iThreadInfoItems.Count(); i++)
+		{						
+		HBufC* combined = HBufC::NewLC( iThreadInfoItems[i]->Caption().Length() + iThreadInfoItems[i]->Value().Length() + 30 );		
+			/*
+		else if ( combined->Des().MaxLength() < requiredLength )
+			{
+			combined = combined->ReAllocL( requiredLength );
+			}*/				
+        
+		TPtr pCombined( combined->Des() );
+		pCombined.Zero();
+		pCombined.Copy( _L("\t") );
+		if( iThreadInfoItems[i]->Caption() != KNullDesC )
+			pCombined.Append( iThreadInfoItems[i]->Caption() );
+		if( iType != EMemSpyThreadInfoItemTypeChunk )
+			{
+			pCombined.Append( _L("\t\t") );
+			pCombined.Append( iThreadInfoItems[i]->Value() );
+			}					
+		
+		iModel->AppendL( pCombined );								
+		}	
+	
     CAknSettingStyleListBox* listbox = static_cast< CAknSettingStyleListBox* >( iListBox );
-    listbox->Model()->SetItemTextArray( iInfoItem );
+    //listbox->Model()->SetItemTextArray( iInfoItem );
+    listbox->Model()->SetItemTextArray( iModel );
     listbox->Model()->SetOwnershipType( ELbmDoesNotOwnItemArray );
     }
 
@@ -256,7 +267,7 @@
 void CMemSpyViewThreadInfoItemGeneric::ShowWaitNoteL()
     {
     // Ugly, but I'm not adding an observer mechanism just for this wait dialog.
-    __ASSERT_ALWAYS( iWaitConstructionChecker == NULL, User::Invariant() );
+   // __ASSERT_ALWAYS( iWaitConstructionChecker == NULL, User::Invariant() );
     iWaitConstructionChecker = CPeriodic::NewL( CActive::EPriorityLow );
     iWaitConstructionChecker->Start( KMemSpyConstructionCheckerTimerPeriod, 
                                      KMemSpyConstructionCheckerTimerPeriod, 
@@ -293,12 +304,15 @@
 
 TInt CMemSpyViewThreadInfoItemGeneric::CheckForItemConstructionComplete( TAny* aSelf )
     {
+	/*
     CMemSpyViewThreadInfoItemGeneric& self = *reinterpret_cast< CMemSpyViewThreadInfoItemGeneric* >( aSelf );
+    */
     //
 #ifdef _DEBUG
-    RDebug::Printf( "CMemSpyViewThreadInfoItemGeneric::CheckForItemConstructionComplete() - ready status: %d, iType: %d", self.iInfoItem->IsReady(), self.iInfoItem->Type() );
+/*   RDebug::Printf( "CMemSpyViewThreadInfoItemGeneric::CheckForItemConstructionComplete() - ready status: %d, iType: %d", self.iInfoItem->IsReady(), self.iInfoItem->Type() );*/
 #endif
 	//
+    /*
     TBool callAgain = ETrue;
     if  ( self.iInfoItem->IsReady() )
         {
@@ -307,6 +321,7 @@
         }
     //
     return callAgain;
+    */
     }
 
 
--- a/memspyui/ui/avkon/src/MemSpyViewThreadInfoItemHeap.cpp	Fri Jun 11 16:29:34 2010 +0100
+++ b/memspyui/ui/avkon/src/MemSpyViewThreadInfoItemHeap.cpp	Thu Jul 22 16:33:59 2010 +0100
@@ -26,18 +26,25 @@
 #include <memspy/engine/memspyengineobjectthreadinfocontainer.h>
 #include <memspy/engine/memspyenginehelperprocess.h>
 #include <memspy/engine/memspyenginehelperheap.h>
+#include <memspysession.h>
 
 // User includes
 #include "MemSpyContainerObserver.h"
 #include "MemSpyViewThreads.h"
 #include "MemSpyViewThreadInfoItemHeap.h"
+#include "MemSpyAppUi.h" 
 
 
-
+/*
 CMemSpyViewThreadInfoItemHeap::CMemSpyViewThreadInfoItemHeap( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyThreadInfoContainer& aContainer )
 :   CMemSpyViewThreadInfoItemGeneric( aEngine, aObserver, aContainer, EMemSpyThreadInfoItemTypeHeap )
     {
     }
+*/
+CMemSpyViewThreadInfoItemHeap::CMemSpyViewThreadInfoItemHeap( RMemSpySession& aSession, MMemSpyViewObserver& aObserver, TProcessId aProcId, TThreadId aId, TMemSpyThreadInfoItemType aType )
+:   CMemSpyViewThreadInfoItemGeneric( aSession, aObserver, aProcId, aId , EMemSpyThreadInfoItemTypeHeap )
+    {
+    } 
 
 
 TBool CMemSpyViewThreadInfoItemHeap::HandleCommandL( TInt aCommand )
@@ -69,19 +76,19 @@
 
 void CMemSpyViewThreadInfoItemHeap::OnCmdHeapDataL()
     {
-    iEngine.HelperHeap().OutputHeapDataUserL( Thread() );
+	iMemSpySession.OutputThreadHeapDataL( ThreadId() );    
     }
 
 
 void CMemSpyViewThreadInfoItemHeap::OnCmdHeapCellListingL()
     {
-    iEngine.HelperHeap().OutputCellListingUserL( Thread() );
+    iMemSpySession.OutputThreadCellListL( ThreadId() );
     }
 
 
 void CMemSpyViewThreadInfoItemHeap::OnCmdHeapInfoL()
     {
-    iEngine.HelperHeap().OutputHeapInfoUserL( Thread() );
+	iMemSpySession.OutputHeapInfoUserL( ThreadId() );    
     }
 
 
@@ -89,6 +96,6 @@
     {
     if  ( aResourceId == R_MEMSPY_MENUPANE )
         {
-        aMenuPane->SetItemDimmed( EMemSpyCmdHeap, Thread().IsDead() );
+        //aMenuPane->SetItemDimmed( EMemSpyCmdHeap, Thread().IsDead() ); //TODO
         }
     }
--- a/memspyui/ui/avkon/src/MemSpyViewThreadInfoItemList.cpp	Fri Jun 11 16:29:34 2010 +0100
+++ b/memspyui/ui/avkon/src/MemSpyViewThreadInfoItemList.cpp	Thu Jul 22 16:33:59 2010 +0100
@@ -25,6 +25,10 @@
 #include <memspy/engine/memspyengineobjectthreadinfoobjects.h>
 #include <memspy/engine/memspyengineobjectthreadinfocontainer.h>
 #include <memspy/engine/memspyenginehelperprocess.h>
+#include <memspysession.h>
+
+// UI Utils include
+#include "MemSpyUiUtils.h"
 
 // User includes
 #include "MemSpyContainerObserver.h"
@@ -42,48 +46,52 @@
 const TInt KMemSpyIdleResetListboxTimerPeriod = 250000;
 
 
-CMemSpyViewThreadInfoItemList::CMemSpyViewThreadInfoItemList( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyThread& aThread )
-:   CMemSpyViewBase( aEngine, aObserver ), iThread( aThread )
+CMemSpyViewThreadInfoItemList::CMemSpyViewThreadInfoItemList( RMemSpySession& aSession, MMemSpyViewObserver& aObserver, TProcessId aProcess, TThreadId aThread )
+:   CMemSpyViewBase( aSession, aObserver ), iParentProcessId( aProcess ), iThreadId( aThread )
     {
-    iThread.Process().Open();
-    iThread.Open();
     }
 
 
 CMemSpyViewThreadInfoItemList::~CMemSpyViewThreadInfoItemList()
     {
-    delete iIdleResetListboxTimer;
-
+	/* TODO:
     TRAP_IGNORE( 
         CMemSpyThreadInfoContainer& container = iThread.InfoContainerL();
         container.ObserverRemove( *this );
     );
-
-    if  ( iCurrentInfoItem )
-        {
-        iCurrentInfoItem->Close();
-        }
-
-    iThread.Process().Close();
-    iThread.Close();
+	*/
     }
 
 
 
-void CMemSpyViewThreadInfoItemList::ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune )
+void CMemSpyViewThreadInfoItemList::ConstructL( const TRect& aRect, CCoeControl& aContainer, TMemSpyThreadInfoItemType aType )
     {
     _LIT( KTitle, "Thread Objects" );
     SetTitleL( KTitle );
     //
-    iIdleResetListboxTimer = CPeriodic::NewL( CActive::EPriorityIdle );
-    //
+    //iIdleResetListboxTimer = CPeriodic::NewL( CActive::EPriorityIdle );    
+    /* TODO: to solve observer
     CMemSpyThreadInfoContainer& container = iThread.InfoContainerL();
     container.ObserverAddL( *this );
-    //
-    CMemSpyViewBase::ConstructL( aRect, aContainer, aSelectionRune );
+    */    
+    CMemSpyViewBase::ConstructL( aRect, aContainer );
     //
-    if  ( aSelectionRune )
-        {
+    if( aType > EMemSpyThreadInfoItemTypeFirst || aType < EMemSpyThreadInfoItemTypeLast )
+    	{
+		TInt index(aType);
+		if  ( index >= 0 && index < iListBox->Model()->NumberOfItems() )
+			{
+			iListBox->SetCurrentItemIndex( index );
+			HandleListBoxItemSelectedL( index );
+			}
+    	}
+    else
+    	{
+		iListBox->SetCurrentItemIndex( 0 );
+        HandleListBoxItemSelectedL( 0 );
+    	}
+    /*if  ( aSelectionRune )
+        {		
         CMemSpyThreadInfoItemBase* selectedItem = reinterpret_cast< CMemSpyThreadInfoItemBase* >( aSelectionRune );
         const TInt index = container.InfoItemIndexByType( selectedItem->Type() );
         if  ( index >= 0 && index < iListBox->Model()->NumberOfItems() )
@@ -93,32 +101,18 @@
             }
         }
     else if ( container.MdcaCount() > 0 )
-        {
-        iListBox->SetCurrentItemIndex( 0 );
-        HandleListBoxItemSelectedL( 0 );
-        }
+        {*/
+        //iListBox->SetCurrentItemIndex( 0 );
+        //HandleListBoxItemSelectedL( 0 );
+        //}
     }
 
-
-const CMemSpyProcess& CMemSpyViewThreadInfoItemList::Process() const
-    {
-    return iThread.Process();
-    }
-
-
-const CMemSpyThread& CMemSpyViewThreadInfoItemList::Thread() const
-    {
-    return iThread;
-    }
-
-
 const CMemSpyThreadInfoItemBase& CMemSpyViewThreadInfoItemList::CurrentInfoItem() const
     {
-    __ASSERT_ALWAYS( iCurrentInfoItem != NULL, User::Invariant() );
+    //__ASSERT_ALWAYS( iCurrentInfoItem != NULL, User::Invariant() );
     return *iCurrentInfoItem;
     }
 
-
 void CMemSpyViewThreadInfoItemList::RefreshL()
     {
     SetListBoxModelL();
@@ -134,9 +128,9 @@
 
 CMemSpyViewBase* CMemSpyViewThreadInfoItemList::PrepareParentViewL()
     {
-    CMemSpyViewBase* parent = new(ELeave) CMemSpyViewThreads( iEngine, iObserver, iThread.Process() );
+    CMemSpyViewBase* parent = new(ELeave) CMemSpyViewThreads( iMemSpySession, iObserver, iParentProcessId, iThreadId );
     CleanupStack::PushL( parent );
-    parent->ConstructL( Rect(), *Parent(), &iThread );
+    parent->ConstructL( Rect(), *Parent() );
     CleanupStack::Pop( parent );
     return parent;
     }
@@ -144,38 +138,41 @@
 
 CMemSpyViewBase* CMemSpyViewThreadInfoItemList::PrepareChildViewL()
     {
-    __ASSERT_ALWAYS( iCurrentInfoItem != NULL, User::Invariant() );
     CMemSpyViewBase* child = NULL;
 
-    // Decide what type of child view to create...
-    const TMemSpyThreadInfoItemType type = iCurrentInfoItem->Type();
-    //
+    TMemSpyThreadInfoItemType type;
+    iMemSpySession.GetInfoItemType( iCurrentInfoItemId, iThreadId, type );
+    
     switch( type )
-        {
+        {    	
     case EMemSpyThreadInfoItemTypeHeap:
-        child = new(ELeave) CMemSpyViewThreadInfoItemHeap( iEngine, iObserver, iThread.InfoContainerL() );
-        break;
+        child = new(ELeave) CMemSpyViewThreadInfoItemHeap( iMemSpySession, iObserver, iParentProcessId, iThreadId, type );
+        break;        
     case EMemSpyThreadInfoItemTypeStack:
-        child = new(ELeave) CMemSpyViewThreadInfoItemStack( iEngine, iObserver, iThread.InfoContainerL() );
-        break;
+        child = new(ELeave) CMemSpyViewThreadInfoItemStack( iMemSpySession, iObserver, iParentProcessId, iThreadId, type );
+        break;        
     case EMemSpyThreadInfoItemTypeChunk:
-        child = new(ELeave) CMemSpyViewThreadInfoItemChunk( iEngine, iObserver, iThread.InfoContainerL() );
+        child = new(ELeave) CMemSpyViewThreadInfoItemChunk( iMemSpySession, iObserver, iParentProcessId, iThreadId, type  );
         break;
     case EMemSpyThreadInfoItemTypeCodeSeg:
-        child = new(ELeave) CMemSpyViewThreadInfoItemCodeSeg( iEngine, iObserver, iThread.InfoContainerL() );
-        break;
+        child = new(ELeave) CMemSpyViewThreadInfoItemCodeSeg( iMemSpySession, iObserver, iParentProcessId, iThreadId, type  );
+        break;        
     case EMemSpyThreadInfoItemTypeServer:
-        child = new(ELeave) CMemSpyViewThreadInfoItemServer( iEngine, iObserver, iThread.InfoContainerL() );
-        break;
+        child = new(ELeave) CMemSpyViewThreadInfoItemServer( iMemSpySession, iObserver, iParentProcessId, iThreadId, type  );
+        break;        
     case EMemSpyThreadInfoItemTypeActiveObject:
-        child = new(ELeave) CMemSpyViewThreadInfoItemActiveObject( iEngine, iObserver, iThread.InfoContainerL() );
-        break;
+        child = new(ELeave) CMemSpyViewThreadInfoItemActiveObject( iMemSpySession, iObserver, iParentProcessId, iThreadId, type  );
+        break;             
     case EMemSpyThreadInfoItemTypeGeneralInfo:
-        child = new(ELeave) CMemSpyViewThreadInfoItemGeneralInfo( iEngine, iObserver, iThread.InfoContainerL() );
+        child = new(ELeave) CMemSpyViewThreadInfoItemGeneralInfo( iMemSpySession, iObserver, iParentProcessId, iThreadId, type );
         break;
+    /* 
+     * This subview is permanently removed from Thread Info Item subview.
+     * 
     case EMemSpyThreadInfoItemTypeMemoryTracking:
         child = new(ELeave) CMemSpyViewThreadInfoItemMemoryTracking( iEngine, iObserver, iThread.InfoContainerL() );
         break;
+    */
     case EMemSpyThreadInfoItemTypeSession:
     case EMemSpyThreadInfoItemTypeSemaphore:
     case EMemSpyThreadInfoItemTypeMutex:
@@ -192,14 +189,14 @@
     case EMemSpyThreadInfoItemTypeOtherProcesses:
     case EMemSpyThreadInfoItemTypeOwnedThreadHandles:
     case EMemSpyThreadInfoItemTypeOwnedProcessHandles:
-        child = new(ELeave) CMemSpyViewThreadInfoItemGeneric( iEngine, iObserver, iThread.InfoContainerL(), type );
+        child = new(ELeave) CMemSpyViewThreadInfoItemGeneric( iMemSpySession, iObserver, iParentProcessId, iThreadId, type );
         break;
     
     default:
-        __ASSERT_ALWAYS( EFalse, User::Panic( _L("MemSpy-View"), 0) );
-        break;
+       // __ASSERT_ALWAYS( EFalse, User::Panic( _L("MemSpy-View"), 0) );
+        break;        
         }
-    //
+       
     CleanupStack::PushL( child );
     child->ConstructL( Rect(), *Parent() );
     CleanupStack::Pop( child );
@@ -230,7 +227,7 @@
     {
     if  ( aResourceId == R_MEMSPY_MENUPANE )
         {
-        aMenuPane->SetItemDimmed( EMemSpyCmdThread, iThread.IsDead() );
+     //   aMenuPane->SetItemDimmed( EMemSpyCmdThread, iThread.IsDead() ); //TODO
         }
     else if ( aResourceId == MenuCascadeResourceId() )
         {
@@ -243,12 +240,12 @@
 
 void CMemSpyViewThreadInfoItemList::OnCmdInfoHandlesL()
     {
-    iThread.InfoContainerForceSyncronousConstructionL().PrintL();
+    iMemSpySession.OutputThreadInfoHandlesL( iThreadId );
     }
 
 
 void CMemSpyViewThreadInfoItemList::HandleMemSpyEngineInfoContainerEventL( TEvent aEvent, TMemSpyThreadInfoItemType aType )
-    {
+    {/*
     if  ( aEvent == EInfoItemChanged )
         {
         }
@@ -263,13 +260,123 @@
 
     iIdleResetListboxTimer->Cancel();
     iIdleResetListboxTimer->Start( KMemSpyIdleResetListboxTimerPeriod, KMemSpyIdleResetListboxTimerPeriod, TCallBack( IdleUpdateListBoxModel, this ) );
+    */
     }
 
 
 void CMemSpyViewThreadInfoItemList::SetListBoxModelL()
-    {
-    CAknSettingStyleListBox* listbox = static_cast< CAknSettingStyleListBox* >( iListBox );
-    listbox->Model()->SetItemTextArray( &iThread.InfoContainerL() );
+    {	
+	CDesC16ArrayFlat* iModel = new (ELeave) CDesC16ArrayFlat( 32 );
+	
+	HBufC* iItem = HBufC::NewL( 32 );
+	
+	iItem = MemSpyUiUtils::FormatItem( KGeneral );
+	TPtr pItem( iItem->Des() );
+	iModel->AppendL( pItem );
+	pItem.Zero();
+	
+	iItem = MemSpyUiUtils::FormatItem( KHeap );
+	pItem = iItem->Des();
+	iModel->AppendL( pItem );
+	pItem.Zero();
+	
+	iItem = MemSpyUiUtils::FormatItem( KStack );
+	pItem = iItem->Des();
+	iModel->AppendL( pItem );
+	pItem.Zero();
+	
+	iItem = MemSpyUiUtils::FormatItem( KChunks );
+	pItem = iItem->Des();
+	iModel->AppendL( pItem );
+	pItem.Zero();
+	
+	iItem = MemSpyUiUtils::FormatItem( KCodeSegs );
+	pItem = iItem->Des();
+	iModel->AppendL( pItem );
+	pItem.Zero();
+	
+	iItem = MemSpyUiUtils::FormatItem( KOpenFiles );
+	pItem = iItem->Des();
+	iModel->AppendL( pItem );
+	pItem.Zero();
+	
+	iItem = MemSpyUiUtils::FormatItem( KActiveObjects );
+	pItem = iItem->Des();
+	iModel->AppendL( pItem );
+	pItem.Zero();
+	
+	iItem = MemSpyUiUtils::FormatItem( KThreadHandlers );
+	pItem = iItem->Des();
+	iModel->AppendL( pItem );
+	pItem.Zero();
+	
+	iItem = MemSpyUiUtils::FormatItem( KProcessHandlers );
+	pItem = iItem->Des();
+	iModel->AppendL( pItem );
+	pItem.Zero();
+	
+	iItem = MemSpyUiUtils::FormatItem( KServers );
+	pItem = iItem->Des();
+	iModel->AppendL( pItem );
+	pItem.Zero();
+	
+	iItem = MemSpyUiUtils::FormatItem( KConnections );
+	pItem = iItem->Des();
+	iModel->AppendL( pItem );
+	pItem.Zero();
+	
+	iItem = MemSpyUiUtils::FormatItem( KSemaphores );
+	pItem = iItem->Des();
+	iModel->AppendL( pItem );
+	pItem.Zero();
+	
+	iItem = MemSpyUiUtils::FormatItem( KThreadReferences );
+	pItem = iItem->Des();
+	iModel->AppendL( pItem );
+	pItem.Zero();
+	
+	iItem = MemSpyUiUtils::FormatItem( KProcessReferences );
+	pItem = iItem->Des();
+	iModel->AppendL( pItem );
+	pItem.Zero();
+	
+	iItem = MemSpyUiUtils::FormatItem( KMutexes );
+	pItem = iItem->Des();
+	iModel->AppendL( pItem );
+	pItem.Zero();
+	
+	iItem = MemSpyUiUtils::FormatItem( KTimers );
+	pItem = iItem->Des();
+	iModel->AppendL( pItem );
+	pItem.Zero();
+	
+	iItem = MemSpyUiUtils::FormatItem( KDD );
+	pItem = iItem->Des();
+	iModel->AppendL( pItem );
+	pItem.Zero();
+	
+	iItem = MemSpyUiUtils::FormatItem( KChangeNotif );
+	pItem = iItem->Des();
+	iModel->AppendL( pItem );
+	pItem.Zero();
+	
+	iItem = MemSpyUiUtils::FormatItem( KUndertakers );
+	pItem = iItem->Des();
+	iModel->AppendL( pItem );
+	pItem.Zero();
+	
+	iItem = MemSpyUiUtils::FormatItem( KLogicalDrivers );
+	pItem = iItem->Des();
+	iModel->AppendL( pItem );
+	pItem.Zero();
+	
+	iItem = MemSpyUiUtils::FormatItem( KPhysicalDrivers );
+	pItem = iItem->Des();
+	iModel->AppendL( pItem );
+	pItem.Zero();		
+	
+    CAknSettingStyleListBox* listbox = static_cast< CAknSettingStyleListBox* >( iListBox ); 
+    listbox->Model()->SetItemTextArray( iModel );
     listbox->Model()->SetOwnershipType( ELbmDoesNotOwnItemArray );
     }
 
@@ -283,17 +390,8 @@
 
 void CMemSpyViewThreadInfoItemList::HandleListBoxItemSelectedL( TInt aIndex )
     {
-    if  ( iCurrentInfoItem )
-        {
-        CMemSpyThreadInfoItemBase* item = iCurrentInfoItem;
-        iCurrentInfoItem = NULL;
-        item->Close();
-        }
-
-    // Identify the type of item to display...
-    iCurrentInfoItem = &iThread.InfoContainerL().Item( aIndex );
-    iCurrentInfoItem->Open();
-
+	iCurrentInfoItemId = aIndex;
+	
     // Notify observer about item selection
     ReportEventL( MMemSpyViewObserver::EEventItemSelected );
     }
@@ -309,6 +407,7 @@
 
 void CMemSpyViewThreadInfoItemList::DoIdleUpdateListBoxModelL()
     {
+	/*
     CMemSpyThreadInfoContainer& container = iThread.InfoContainerL();
 
     // Try to maintain current item selection if at all possible.
@@ -332,5 +431,5 @@
         }
 
     iIdleResetListboxTimer->Cancel();
+    */
     }
-
--- a/memspyui/ui/avkon/src/MemSpyViewThreadInfoItemServer.cpp	Fri Jun 11 16:29:34 2010 +0100
+++ b/memspyui/ui/avkon/src/MemSpyViewThreadInfoItemServer.cpp	Thu Jul 22 16:33:59 2010 +0100
@@ -36,8 +36,8 @@
 
 
 
-CMemSpyViewThreadInfoItemServer::CMemSpyViewThreadInfoItemServer( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyThreadInfoContainer& aContainer )
-:   CMemSpyViewThreadInfoItemGeneric( aEngine, aObserver, aContainer, EMemSpyThreadInfoItemTypeServer )
+CMemSpyViewThreadInfoItemServer::CMemSpyViewThreadInfoItemServer( RMemSpySession& aSession, MMemSpyViewObserver& aObserver, TProcessId aProcId, TThreadId aId, TMemSpyThreadInfoItemType aType )
+:   CMemSpyViewThreadInfoItemGeneric( aSession, aObserver, aProcId, aId, EMemSpyThreadInfoItemTypeServer )
     {
     }
 
@@ -53,11 +53,12 @@
 #ifdef _DEBUG
     RDebug::Printf( "CMemSpyViewThreadInfoItemServer::ConstructL() - aSelectionRune: 0x%08x", aSelectionRune );
 #endif
-
+    /* TODO
     // Try to select the correct server
     CMemSpyThreadInfoHandleObjectBase* infoItem = static_cast< CMemSpyThreadInfoHandleObjectBase* >( iInfoItem );
+    */
     TInt selectedIndex = 0;
-    if  ( aSelectionRune )
+    /*if  ( aSelectionRune )
         {
         // Treat the rune as a handle, and try to look it up
         selectedIndex = infoItem->DetailsIndexByHandle( aSelectionRune );
@@ -65,10 +66,10 @@
 
     // Select item
     if  ( infoItem->DetailsCount() > 0 )
-        {
+        {*/
         iListBox->SetCurrentItemIndex( selectedIndex );
         HandleListBoxItemSelectedL( selectedIndex );
-        }
+        /*}*/
     }
 
 
@@ -81,16 +82,18 @@
 
 CMemSpyViewBase* CMemSpyViewThreadInfoItemServer::PrepareChildViewL()
     {
+	/*
     CMemSpyViewThreadInfoItemServerDetails* child = new(ELeave) CMemSpyViewThreadInfoItemServerDetails( iEngine, iObserver, iContainer, iCurrentInfoItemDetails );
     CleanupStack::PushL( child );
     child->ConstructL( Rect(), *Parent() );
     CleanupStack::Pop( child );
     return child;
+    */
     }
 
 
 void CMemSpyViewThreadInfoItemServer::HandleListBoxItemSelectedL( TInt aIndex )
-    {
+    {/* TODO
     // Identify the type of item to display...
     CMemSpyThreadInfoHandleObjectBase* infoItem = static_cast< CMemSpyThreadInfoHandleObjectBase* >( iInfoItem );
     iCurrentInfoItemDetails = infoItem->DetailsAt( aIndex );
@@ -98,7 +101,7 @@
 #ifdef _DEBUG
     RDebug::Printf( "CMemSpyViewThreadInfoItemServer::HandleListBoxItemSelectedL() - iCurrentInfoItemDetails.iHandle: 0x%08x", iCurrentInfoItemDetails.iHandle );
 #endif
-
+*/
     // Notify observer about item selection
     ReportEventL( MMemSpyViewObserver::EEventItemSelected );
     }
@@ -127,7 +130,7 @@
 
 
 
-
+/*
 CMemSpyViewThreadInfoItemServerDetails::CMemSpyViewThreadInfoItemServerDetails( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyThreadInfoContainer& aContainer, const TMemSpyDriverHandleInfoGeneric& aInfoItemDetails )
 :   CMemSpyViewThreadInfoItemGeneric( aEngine, aObserver, aContainer, EMemSpyThreadInfoItemTypeServer ), iInfoItemDetails( aInfoItemDetails )
     {
@@ -229,19 +232,25 @@
     CleanupStack::Pop( model );
     }
 
-
-void CMemSpyViewThreadInfoItemServerDetails::HandleListBoxItemActionedL( TInt /*aIndex*/ )
-    {
-    // Notify observer about an item being 'fired'
+*/
+/*
+void CMemSpyViewThreadInfoItemServerDetails::HandleListBoxItemActionedL( TInt /*aIndex*/ /*)
+*/
+/*    
+   	{
+    // Notify observer about an item being 'fired'    
     ReportEventL( MMemSpyViewObserver::EEventItemActioned );
     }
 
 
-void CMemSpyViewThreadInfoItemServerDetails::HandleListBoxItemSelectedL( TInt /*aIndex*/ )
+void CMemSpyViewThreadInfoItemServerDetails::HandleListBoxItemSelectedL( TInt /*aIndex*/ /*)
+*/
+/*
     {
     // Notify observer about item selection
     ReportEventL( MMemSpyViewObserver::EEventItemSelected );
     }
+*/
 
 
 
@@ -266,8 +275,7 @@
 
 
 
-
-
+/*
 
 
 CMemSpyViewThreadInfoItemServerSessions::CMemSpyViewThreadInfoItemServerSessions( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyThreadInfoContainer& aContainer, const TMemSpyDriverHandleInfoGeneric& aInfoItemDetails )
@@ -374,6 +382,7 @@
     CleanupStack::Pop( model );
     }
 
+*/
 
 
 
@@ -383,9 +392,3 @@
 
 
 
-
-
-
-
-
-
--- a/memspyui/ui/avkon/src/MemSpyViewThreadInfoItemStack.cpp	Fri Jun 11 16:29:34 2010 +0100
+++ b/memspyui/ui/avkon/src/MemSpyViewThreadInfoItemStack.cpp	Thu Jul 22 16:33:59 2010 +0100
@@ -26,16 +26,18 @@
 #include <memspy/engine/memspyengineobjectthreadinfocontainer.h>
 #include <memspy/engine/memspyenginehelperprocess.h>
 #include <memspy/engine/memspyenginehelperstack.h>
+#include <memspysession.h>
 
 // User includes
 #include "MemSpyContainerObserver.h"
 #include "MemSpyViewThreads.h"
 #include "MemSpyViewThreadInfoItemHeap.h"
+#include "MemSpyAppUi.h"
 
 
 
-CMemSpyViewThreadInfoItemStack::CMemSpyViewThreadInfoItemStack( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyThreadInfoContainer& aContainer )
-:   CMemSpyViewThreadInfoItemGeneric( aEngine, aObserver, aContainer, EMemSpyThreadInfoItemTypeStack )
+CMemSpyViewThreadInfoItemStack::CMemSpyViewThreadInfoItemStack( RMemSpySession& aSession, MMemSpyViewObserver& aObserver, TProcessId aProcId, TThreadId aId, TMemSpyThreadInfoItemType aType )
+:   CMemSpyViewThreadInfoItemGeneric( aSession, aObserver, aProcId, aId, EMemSpyThreadInfoItemTypeStack )
     {
     }
 
@@ -69,19 +71,19 @@
 
 void CMemSpyViewThreadInfoItemStack::OnCmdStackInfoL()
     {
-    iEngine.HelperStack().OutputStackInfoL( Thread() );
+	iMemSpySession.OutputStackInfoL( ThreadId() );   
     }
 
 
 void CMemSpyViewThreadInfoItemStack::OnCmdStackDataUserL()
     {
-    iEngine.HelperStack().OutputStackDataL( Thread(), EMemSpyDriverDomainUser );
+    iMemSpySession.OutputStackDataL( ThreadId(), EMemSpyDriverDomainUser );
     }
 
 
 void CMemSpyViewThreadInfoItemStack::OnCmdStackDataKernelL()
     {
-    iEngine.HelperStack().OutputStackDataL( Thread(), EMemSpyDriverDomainKernel );
+	iMemSpySession.OutputStackDataL( ThreadId(), EMemSpyDriverDomainKernel );
     }    
 
 
@@ -89,6 +91,6 @@
     {
     if  ( aResourceId == R_MEMSPY_MENUPANE )
         {
-        aMenuPane->SetItemDimmed( EMemSpyCmdStack, Thread().IsDead() );
+        //TODO aMenuPane->SetItemDimmed( EMemSpyCmdStack, Thread().IsDead() );
         }
     }
--- a/memspyui/ui/avkon/src/MemSpyViewThreads.cpp	Fri Jun 11 16:29:34 2010 +0100
+++ b/memspyui/ui/avkon/src/MemSpyViewThreads.cpp	Thu Jul 22 16:33:59 2010 +0100
@@ -38,15 +38,8 @@
 
 
 
-/*
-CMemSpyViewThreads::CMemSpyViewThreads( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyProcess& aProcess )
-:   CMemSpyViewBase( aEngine, aObserver ), iParentProcess( aProcess )
-    {
-    iParentProcess.Open();
-    }
-*/
-CMemSpyViewThreads::CMemSpyViewThreads( RMemSpySession& aSession, MMemSpyViewObserver& aObserver, TProcessId aId )
-:   CMemSpyViewBase( aSession, aObserver ), iParentProcessId( aId )
+CMemSpyViewThreads::CMemSpyViewThreads( RMemSpySession& aSession, MMemSpyViewObserver& aObserver, TProcessId aId, TThreadId aThreadId )
+:   CMemSpyViewBase( aSession, aObserver ), iParentProcessId( aId ), iCurrentThreadId( aThreadId )
     {    
     }
 
@@ -58,30 +51,33 @@
  
 void CMemSpyViewThreads::ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune )
     {
+	iMemSpySession.GetThreadsL( iParentProcessId, iThreads );
+	
     _LIT( KTitle, "Threads" );
     SetTitleL( KTitle );
     //
     CMemSpyViewBase::ConstructL( aRect, aContainer, aSelectionRune );
-    //
-    if  ( aSelectionRune )
-        {
-		iListBox->SetCurrentItemIndex( 0 ); //for now
+    //    
+    if( iCurrentThreadId > 0 )
+        {		
+		for( TInt i = 0; i < iThreads.Count() ; i++ )
+			{
+			if( iThreads[i]->Id() == iCurrentThreadId )
+				{
+				const TInt index = i;
+				if  ( index >= 0 && index < iListBox->Model()->NumberOfItems() )
+					{
+					iListBox->SetCurrentItemIndex( index );
+					HandleListBoxItemSelectedL( index );
+					}
+				}			
+			}
+        }
+    else if( iThreads.Count() > 0 )
+    	{
+		iListBox->SetCurrentItemIndex( 0 );
 		HandleListBoxItemSelectedL( 0 );
-		/* TODO: 
-        CMemSpyThread* selectedItem = reinterpret_cast< CMemSpyThread* >( aSelectionRune );
-        const TInt index = iParentProcess.ThreadIndexById( selectedItem->Id() );
-        if  ( index >= 0 && index < iListBox->Model()->NumberOfItems() )
-            {
-            iListBox->SetCurrentItemIndex( index );
-            HandleListBoxItemSelectedL( index );
-            }
-        */		
-        }
-    //else if ( iParentProcess.Count() > 0 )
-    //    {
-        iListBox->SetCurrentItemIndex( 0 );
-        HandleListBoxItemSelectedL( 0 );
-    //    }
+    	}		
     }
 
 
@@ -122,14 +118,12 @@
 
 
 CMemSpyViewBase* CMemSpyViewThreads::PrepareChildViewL()
-    {
-	/*
-    CMemSpyViewThreadInfoItemList* child = new(ELeave) CMemSpyViewThreadInfoItemList( iEngine, iObserver, *iCurrentThread );
+    {	
+    CMemSpyViewThreadInfoItemList* child = new(ELeave) CMemSpyViewThreadInfoItemList( iMemSpySession, iObserver, iParentProcessId, iCurrentThreadId );
     CleanupStack::PushL( child );
-    child->ConstructL( Rect(), *Parent() );
+    child->ConstructL( Rect(), *Parent(), EMemSpyThreadInfoItemTypeFirst );
     CleanupStack::Pop( child );
-    return child;
-    */
+    return child;    
     }
 
 
@@ -333,16 +327,13 @@
 
 void CMemSpyViewThreads::OnCmdInfoHandlesL()
     {
-	/*
-    CMemSpyThread& thread = CurrentThread();
-    thread.InfoContainerForceSyncronousConstructionL().PrintL();
-    */
+	iMemSpySession.OutputThreadInfoHandlesL( iCurrentThreadId );	
     }
 
 
 void CMemSpyViewThreads::SetListBoxModelL()
     {
-	iMemSpySession.GetThreadsL( iParentProcessId, iThreads );
+	//iMemSpySession.GetThreadsL( iParentProcessId, iThreads );
 	
 	iModel = new (ELeave) CDesC16ArrayFlat( iThreads.Count() ); //array for formated items
 		
@@ -361,8 +352,7 @@
 	    	CleanupStack::PopAndDestroy( tempName ); 
 			}			
 	
-    CAknSettingStyleListBox* listbox = static_cast< CAknSettingStyleListBox* >( iListBox );
-    //listbox->Model()->SetItemTextArray( &iParentProcess );
+    CAknSettingStyleListBox* listbox = static_cast< CAknSettingStyleListBox* >( iListBox );    
     listbox->Model()->SetItemTextArray( iModel );
     listbox->Model()->SetOwnershipType( ELbmDoesNotOwnItemArray );
     }
--- a/memspyui/ui/avkon/src/MemSpyViewWindowGroups.cpp	Fri Jun 11 16:29:34 2010 +0100
+++ b/memspyui/ui/avkon/src/MemSpyViewWindowGroups.cpp	Thu Jul 22 16:33:59 2010 +0100
@@ -204,6 +204,7 @@
 
 void CMemSpyViewWindowGroups::OnCmdEndL( TInt aCommand )
     {
+	/*
     TBool doTerminate = ETrue;
     
     CMemSpyEngineObjectContainer& container = iEngine.Container();
@@ -252,6 +253,7 @@
             }                
         }
     RefreshL();
+    */
     }
 
 
--- a/memspyui/ui/hb/hb.pro	Fri Jun 11 16:29:34 2010 +0100
+++ b/memspyui/ui/hb/hb.pro	Thu Jul 22 16:33:59 2010 +0100
@@ -27,25 +27,37 @@
 HEADERS += inc/enginewrapper.h \
 	inc/viewmanager.h \
 	inc/memspyview.h \
+	inc/memspylistview.h \
 	inc/memspymainview.h \
 	inc/memspyprocessview.h \
 	inc/memspythreadview.h \
+	inc/memspythreaddetailindexview.h \
 	inc/memspythreaddetailview.h \
 	inc/memspykernelobjecttypeview.h \
 	inc/memspykernelobjectview.h \
-	inc/memspykernelobjectdetailview.h  
+	inc/memspykernelobjectdetailview.h \
+	inc/memspytrackingview.h \
+	inc/memspyswmtview.h \
+	inc/memspyheapdumpsview.h \
+	inc/memspysettingsview.h
 
 SOURCES += src/main.cpp \
 	src/enginewrapper.cpp \
 	src/viewmanager.cpp \
 	src/memspyview.cpp \
+	src/memspylistview.cpp \
 	src/memspymainview.cpp \
 	src/memspyprocessview.cpp \
 	src/memspythreadview.cpp \
+	src/memspythreaddetailindexview.cpp \
 	src/memspythreaddetailview.cpp \
 	src/memspykernelobjecttypeview.cpp \
 	src/memspykernelobjectview.cpp \
-	src/memspykernelobjectdetailview.cpp 
+	src/memspykernelobjectdetailview.cpp \
+	src/memspytrackingview.cpp \
+	src/memspyswmtview.cpp \
+	src/memspyheapdumpsview.cpp \
+	src/memspysettingsview.cpp
 
 RESOURCES +=
 
--- a/memspyui/ui/hb/inc/enginewrapper.h	Fri Jun 11 16:29:34 2010 +0100
+++ b/memspyui/ui/hb/inc/enginewrapper.h	Thu Jul 22 16:33:59 2010 +0100
@@ -19,31 +19,14 @@
 #define ENGINEWRAPPER_H_
 
 #include <QObject>
+#include <QVariantList>
+#include <QSettings>
 
 #include <memspysession.h>
-#include <memspyapiprocess.h>
 
 typedef quint64 ProcessId;
 typedef quint64 ThreadId;
 
-class MemSpyProcess
-{
-public:
-	MemSpyProcess(CMemSpyApiProcess* process)
-		: mProcess(process)
-	{}
-	
-	virtual  ~MemSpyProcess() { delete mProcess;	}
-	
-	ProcessId id() const { return mProcess->Id(); }
-	
-	QString name() const { return QString((QChar*) mProcess->Name().Ptr(), mProcess->Name().Length()); }
-	
-	
-private:
-	CMemSpyApiProcess *mProcess;
-};
-
 enum ThreadPriority
 {
 	ThreadPriorityNull=(-30),
@@ -94,6 +77,105 @@
 	KernelObjectTypeCondVar
 };
 
+enum ThreadInfoType
+{
+	ThreadInfoTypeGeneral = EMemSpyThreadInfoItemTypeGeneralInfo,
+	ThreadInfoTypeHeap = EMemSpyThreadInfoItemTypeHeap,
+	ThreadInfoTypeStack = EMemSpyThreadInfoItemTypeStack,
+	ThreadInfoTypeChunk = EMemSpyThreadInfoItemTypeChunk,
+	ThreadInfoTypeCodeSeg = EMemSpyThreadInfoItemTypeCodeSeg,
+	ThreadInfoTypeOpenFiles = EMemSpyThreadInfoItemTypeOpenFiles,
+	ThreadInfoTypeActiveObjects = EMemSpyThreadInfoItemTypeActiveObject,
+	ThreadInfoTypeOwnedThreadHandles = EMemSpyThreadInfoItemTypeOwnedThreadHandles,
+	ThreadInfoTypeOwnedProcessHandles = EMemSpyThreadInfoItemTypeOwnedProcessHandles,
+	ThreadInfoTypeServer = EMemSpyThreadInfoItemTypeServer,
+	ThreadInfoTypeSession = EMemSpyThreadInfoItemTypeSession,
+	ThreadInfoTypeSemaphore = EMemSpyThreadInfoItemTypeSemaphore,
+	ThreadInfoTypeOtherThreads = EMemSpyThreadInfoItemTypeOtherThreads,
+	ThreadInfoTypeOtherProcesses = EMemSpyThreadInfoItemTypeOtherProcesses,
+	ThreadInfoTypeMutex = EMemSpyThreadInfoItemTypeMutex,
+	ThreadInfoTypeTimer = EMemSpyThreadInfoItemTypeTimer,
+	ThreadInfoTypeChannel = EMemSpyThreadInfoItemTypeLogicalChannel,
+	ThreadInfoTypeChangeNotifier = EMemSpyThreadInfoItemTypeChangeNotifier,
+	ThreadInfoTypeUndertaker = EMemSpyThreadInfoItemTypeUndertaker,
+	ThreadInfoTypeMessageQueue = EMemSpyThreadInfoItemTypeMessageQueue,
+	ThreadInfoTypeConditionalVariable = EMemSpyThreadInfoItemTypeConditionalVariable,
+	ThreadInfoTypeLDD = EMemSpyThreadInfoItemTypeLDD,
+	ThreadInfoTypePDD = EMemSpyThreadInfoItemTypePDD,
+};
+
+enum DeviceWideOperation
+{
+	OutputPhoneInfo = 0,
+	    
+	OutputDetailedPhoneInfo,
+	    
+	OutputHeapInfo,
+	    
+	OutputCompactHeapInfo,
+	    
+	OutputHeapCellListing,
+	    
+	OutputHeapData,
+	    
+	OutputStackInfo,
+	    
+	OutputCompactStackInfo,
+	    
+	OutputUserStackData,
+	    
+	OutputKernelStackData
+};
+
+enum SwmtMode
+{
+	SwmtModeBasic = 0,
+	SwmtModeFull,
+	SwmtModeCustom
+};
+
+enum HeapDumpsMode
+{
+	HeapDumpsModeKernel = 0,
+	HeapDumpsModeUser,
+	HeapDumpsModeBoth
+};
+
+enum OutputMode
+{
+	OutputModeTrace = 0,
+	OutputModeFile
+};
+
+class MemSpyProcess
+{
+public:
+	MemSpyProcess(CMemSpyApiProcess* process)
+		: mProcess(process)
+	{}
+	
+	virtual  ~MemSpyProcess() { delete mProcess; }
+	
+	ProcessId id() const { return mProcess->Id(); }
+	
+	QString name() const { return QString((QChar*) mProcess->Name().Ptr(), mProcess->Name().Length()); }
+	
+	QString exitInfo() const;
+	
+	int priority() const { return mProcess->Priority(); }
+	
+	int threadCount() const { return mProcess->ThreadCount(); }
+	
+	int sid() const { return mProcess->SID(); }
+	
+	int vid() const { return mProcess->VID(); }
+	
+	bool isDead() const { return mProcess->IsDead(); }
+	
+private:
+	CMemSpyApiProcess *mProcess;
+};
+
 class MemSpyThread
 {
 public:
@@ -127,6 +209,10 @@
 	
 	QString name() const { return QString((QChar*) mType->Name().Ptr(), mType->Name().Length()); }
 	
+	int count() const { return mType->Count(); }
+	
+	qint64 size() const { return mType->Size(); }
+	
 private:
 	CMemSpyApiKernelObject *mType;
 };
@@ -236,25 +322,208 @@
 	CMemSpyApiKernelObjectItem *mObject;
 };
 
-class EngineWrapper : public QObject
+class MemSpyThreadInfoItem 
 {
 public:
+	MemSpyThreadInfoItem(CMemSpyApiThreadInfoItem *item)
+		: mItem(item)
+	{}
+	
+	virtual  ~MemSpyThreadInfoItem() { delete mItem;	}
+	
+	QString caption() const { return QString((QChar*) mItem->Caption().Ptr(), mItem->Caption().Length()); }
+	
+	QString value() const { return QString((QChar*) mItem->Value().Ptr(), mItem->Value().Length()); }
+	
+private:
+	CMemSpyApiThreadInfoItem* mItem;
+};
+
+class MemSpyDwoProgressTracker : public QObject, public CActive
+{
+	Q_OBJECT
+
+public:
+	MemSpyDwoProgressTracker(RMemSpySession &session);
+	virtual ~MemSpyDwoProgressTracker();
+	
+public slots:
+
+	void start();
+
+	void cancel();
+	
+protected: // from CActive
+	
+	virtual void RunL();
+	 
+	virtual void DoCancel();
+	 
+	virtual TInt RunError(TInt aError);
+	
+signals:
+	void progress(int progress, const QString& processName);
+	
+private:
+	TMemSpyDeviceWideOperationProgress mProgress;
+	RMemSpySession mSession;
+};
+
+class MemSpyDwoTracker : public QObject, public CActive
+{
+	Q_OBJECT
+
+public:
+	MemSpyDwoTracker(RMemSpySession &session, DeviceWideOperation operation);
+	virtual ~MemSpyDwoTracker();
+	
+public slots:
+
+	void start();
+	
+	void cancel();
+	
+protected: // from CActive
+	
+	virtual void RunL();
+	 
+	virtual void DoCancel();
+	 
+	virtual TInt RunError(TInt aError);
+	
+signals:
+	void finished(int errorCode);
+	void progress(int progress, const QString& processName);
+	
+private:
+	RMemSpySession mSession;
+	MemSpyDwoProgressTracker *mProgressTracker;
+	DeviceWideOperation mOperation;
+};
+
+class MemSpyAsyncTracker : public QObject, public CActive
+{
+	Q_OBJECT
+	
+public:
+	
+	MemSpyAsyncTracker(RMemSpySession& session, void (RMemSpySession::*function)(TRequestStatus&));
+	
+	void start();
+	
+	virtual void RunL();
+	
+	virtual void DoCancel();
+	
+	virtual TInt RunError(TInt aError);
+	
+signals:
+	
+	void finished(int errorCode);
+	
+private:
+	void (RMemSpySession::*mFunction)(TRequestStatus&);
+	RMemSpySession& mSession;
+};
+
+class MemSpySwmtDumpTracker : public MemSpyAsyncTracker
+{
+public:
+	MemSpySwmtDumpTracker(RMemSpySession& session) : 
+		MemSpyAsyncTracker(session, &RMemSpySession::ForceSwmtUpdate)
+	{}
+};
+
+class MemSpyKernelHeapDumpTracker : public MemSpyAsyncTracker
+{
+public:
+	MemSpyKernelHeapDumpTracker(RMemSpySession& session) : 
+		MemSpyAsyncTracker(session, &RMemSpySession::OutputKernelHeapData)
+	{}
+};
+
+class MemSpySettings : private QSettings
+{
+public:
+	
+	MemSpySettings();
+	
+	OutputMode outputMode() const;
+	void setOutputMode(OutputMode mode);
+	
+	QString outputPath() const;
+	void setOutputPath(const QString& path);
+		
+	int swmtTimerPeriod() const;
+	void setSwmtTimerPeriod(int period);
+	
+	SwmtMode swmtMode() const;
+	void setSwmtMode(SwmtMode mode);
+	
+	QVariantList swmtCategories() const;
+	void setSwmtCategories(const QVariantList& categories);
+	
+	HeapDumpsMode heapDumpsMode() const;
+	void setHeapDumpsMode(HeapDumpsMode mode);
+};
+
+class EngineWrapper : public QObject
+{
+	Q_OBJECT
+	
+public:
+	EngineWrapper();
+	
 	virtual ~EngineWrapper();
+	
 	bool initialize();
 	
+	MemSpySettings& settings();
+	
+	const MemSpySettings& settings() const;
+	
+	
+	
 	QList<MemSpyProcess*> getProcesses();
 	
 	QList<MemSpyThread*> getThreads(ProcessId processId);
 	
+	QList<MemSpyThreadInfoItem*> getThreadInfo(ThreadId threadId, ThreadInfoType type);
+	
 	void setThreadPriority(ThreadId threadId, ThreadPriority priority);
 	
 	QList<MemSpyKernelObjectType*> getKernelObjectTypes();
 	
 	QList<MemSpyKernelObject*> getKernelObjects(int type);
 	
+	MemSpyDwoTracker* createDeviceWideOperation(DeviceWideOperation operation);
+	
+	MemSpyKernelHeapDumpTracker* createKernelHeapDumpTracker();
+	
+	MemSpySwmtDumpTracker* createSwmtDumpTracker();
+	
+	void setSwmtSettings(SwmtMode mode, const QVariantList& categories);
+	
+	bool isSwmtRunning();
+	
+	void startSwmt(int period);
+	
+	void stopSwmt();
+	
+	void forceSwmtDump();
+	
+	void outputKernelHeapData();
+	
+	int outputThreadHeapData(const QString& filter);
+	
+	void updateOutputSettings();
+	
 private:
 	RMemSpySession mSession;
 	
+	bool mSwmtRunning;
+	
+	MemSpySettings mSettings;
 };
 
 #endif /* ENGINEWRAPPER_H_ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/memspyui/ui/hb/inc/memspyheapdumpsview.h	Thu Jul 22 16:33:59 2010 +0100
@@ -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 MEMSPYHEAPDUMPSVIEW_H_
+#define MEMSPYHEAPDUMPSVIEW_H_
+
+#include "memspyview.h"
+
+class HbDataFormModel;
+class HbDataFormModelItem;
+
+class MemSpyHeapDumpsView : public MemSpyView
+{
+	Q_OBJECT
+	
+public:
+	MemSpyHeapDumpsView(EngineWrapper &engine, ViewManager &viewManager);
+	virtual ~MemSpyHeapDumpsView();
+	
+	void initialize(const QVariantMap& params);
+		
+protected:
+	HbToolBar* createToolBar();
+	
+	HbWidget* createCentralWidget();
+	
+private slots:
+	void modeChanged(int mode);
+	void dump();
+
+	void updateDwoProgress(int progress, const QString& processName);
+	void asyncOperationFinished(int errorCode);
+
+	
+private:
+	void removeFilterItem();
+	void createFilterItem();
+	
+private:
+	HbDataFormModel* mModel;
+	HbDataFormModelItem* mModeItem;
+	HbDataFormModelItem* mFilterItem;
+	
+	HbProgressDialog* mDwoProgressDialog;
+};
+
+#endif /* MEMSPYHEAPDUMPSVIEW_H_ */
--- a/memspyui/ui/hb/inc/memspykernelobjectdetailview.h	Fri Jun 11 16:29:34 2010 +0100
+++ b/memspyui/ui/hb/inc/memspykernelobjectdetailview.h	Thu Jul 22 16:33:59 2010 +0100
@@ -18,18 +18,39 @@
 #ifndef MEMSPYKERNELOBJECTDETAILVIEW_H_
 #define MEMSPYKERNELOBJECTDETAILVIEW_H_
 
-#include "memspyview.h"
+#include "memspylistview.h"
 
-class MemSpyKernelObjectDetailView : public MemSpyView
+class MemSpyKernelObjectDetailModel : public QAbstractListModel
+{
+public:
+    MemSpyKernelObjectDetailModel(const QStringList& details, QObject *parent = 0);
+    
+    int rowCount(const QModelIndex &parent = QModelIndex()) const;
+    
+    QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
+  
+private:
+    QStringList mDetails;
+};
+
+class MemSpyKernelObjectDetailView : public MemSpyListView
 {
 	Q_OBJECT
 	
 public:
 	MemSpyKernelObjectDetailView(EngineWrapper &engine, ViewManager &viewManager) 
-		: MemSpyView(engine, viewManager) {}
+		: MemSpyListView(engine, viewManager) {}
 	
 protected:
 	virtual void initialize(const QVariantMap& params);
+	
+	virtual bool isBreadCrumbVisible() const;
+	        
+	virtual QString getBreadCrumbText() const;
+	
+private:
+	QString mTypeName;
+	QString mObjectName;
 };
 
 #endif /* MEMSPYKERNELOBJECTDETAILVIEW_H_ */
--- a/memspyui/ui/hb/inc/memspykernelobjecttypeview.h	Fri Jun 11 16:29:34 2010 +0100
+++ b/memspyui/ui/hb/inc/memspykernelobjecttypeview.h	Thu Jul 22 16:33:59 2010 +0100
@@ -18,7 +18,7 @@
 #ifndef MEMSPYKERNELOBJECTTYPESVIEW_H_
 #define MEMSPYKERNELOBJECTTYPESVIEW_H_
 
-#include "memspyview.h"
+#include "memspylistview.h"
 #include "enginewrapper.h"
 
 class MemSpyKernelObjectTypeModel : public QAbstractListModel
@@ -26,23 +26,28 @@
 public:
 	MemSpyKernelObjectTypeModel(EngineWrapper &engine, QObject *parent = 0);
 	
-	~MemSpyKernelObjectTypeModel();
+	virtual ~MemSpyKernelObjectTypeModel();
 	
 	int rowCount(const QModelIndex &parent = QModelIndex()) const;
 	
 	QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
 	
 private:
+	QString formatSize(qint64 size) const;
+	
+private:
 	QList<MemSpyKernelObjectType*> mObjectTypes;
+	
+	QStringList mKernelObjectNames;
 };
 
-class MemSpyKernelObjectTypeView : public MemSpyView
+class MemSpyKernelObjectTypeView : public MemSpyListView
 {
 	Q_OBJECT
 	
 public:
 	MemSpyKernelObjectTypeView(EngineWrapper &engine, ViewManager &viewManager) 
-		: MemSpyView(engine, viewManager) {}
+		: MemSpyListView(engine, viewManager) {}
 
 protected:
 	virtual void initialize(const QVariantMap& params);
--- a/memspyui/ui/hb/inc/memspykernelobjectview.h	Fri Jun 11 16:29:34 2010 +0100
+++ b/memspyui/ui/hb/inc/memspykernelobjectview.h	Thu Jul 22 16:33:59 2010 +0100
@@ -18,7 +18,7 @@
 #ifndef MEMSPYKERNELOBJECTVIEW_H_
 #define MEMSPYKERNELOBJECTVIEW_H_
 
-#include "memspyview.h"
+#include "memspylistview.h"
 #include "enginewrapper.h"
 
 class MemSpyKernelObjectModel : public QAbstractListModel
@@ -37,16 +37,20 @@
 };
 
 
-class MemSpyKernelObjectView : public MemSpyView
+class MemSpyKernelObjectView : public MemSpyListView
 {
 	Q_OBJECT
 
 public:
 	MemSpyKernelObjectView(EngineWrapper &engine, ViewManager &viewManager) 
-		: MemSpyView(engine, viewManager) {}
+		: MemSpyListView(engine, viewManager) {}
 
 protected:
 	virtual void initialize(const QVariantMap& params);
+	
+	virtual bool isBreadCrumbVisible() const;
+	            
+	virtual QString getBreadCrumbText() const;
 
 private slots:
 	void itemClicked(const QModelIndex& index);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/memspyui/ui/hb/inc/memspylistview.h	Thu Jul 22 16:33:59 2010 +0100
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description:
+ *  
+ */
+
+#ifndef MEMSPYLISTVIEW_H_
+#define MEMSPYLISTVIEW_H_
+
+#include <HbListView>
+
+#include "memspyview.h"
+
+class MemSpyListView : public MemSpyView
+	{
+public:
+	MemSpyListView(EngineWrapper &engine, ViewManager &viewManager) : 
+		MemSpyView(engine, viewManager) {}
+	
+protected:
+	virtual HbWidget* createCentralWidget();
+	
+protected:
+	HbListView mListView;
+	};
+
+#endif /* MEMSPYLISTVIEW_H_ */
--- a/memspyui/ui/hb/inc/memspymainview.h	Fri Jun 11 16:29:34 2010 +0100
+++ b/memspyui/ui/hb/inc/memspymainview.h	Thu Jul 22 16:33:59 2010 +0100
@@ -18,17 +18,18 @@
 #ifndef MEMSPYMAINVIEW_H_
 #define MEMSPYMAINVIEW_H_
 
-#include "memspyview.h"
+#include "memspylistview.h"
 
-class MemSpyMainView : public MemSpyView
+class MemSpyMainView : public MemSpyListView
 {
     Q_OBJECT
     
 public:
 	MemSpyMainView(EngineWrapper &engine, ViewManager &viewManager) 
-		: MemSpyView(engine, viewManager) {}
+		: MemSpyListView(engine, viewManager) {}
 protected:
 	virtual void initialize(const QVariantMap& params);
+	virtual bool isBreadCrumbVisible() const;
 	
 public slots:
 	void itemClicked(const QModelIndex& index);
--- a/memspyui/ui/hb/inc/memspyprocessview.h	Fri Jun 11 16:29:34 2010 +0100
+++ b/memspyui/ui/hb/inc/memspyprocessview.h	Thu Jul 22 16:33:59 2010 +0100
@@ -20,7 +20,7 @@
 
 #include <QAbstractListModel>
 
-#include "memspyview.h"
+#include "memspylistview.h"
 #include "enginewrapper.h"
 
 
@@ -35,17 +35,28 @@
 	
 	QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
 	
+	void refresh();
+	
 private:
+	EngineWrapper& mEngine;
+	
 	QList<MemSpyProcess*> mProcesses;
+	
+	QMap<int, QString> mPriorityMap;
 };
 
-class MemSpyProcessView : public MemSpyView
+class MemSpyProcessView : public MemSpyListView
 {
     Q_OBJECT
     
 public:
-	MemSpyProcessView(EngineWrapper &engine, ViewManager &viewManager) 
-			: MemSpyView(engine, viewManager) {}
+	MemSpyProcessView(EngineWrapper &engine, ViewManager &viewManager) : 
+        MemSpyListView(engine, viewManager),
+		mModel(0)
+	{}
+	
+public slots:
+    virtual void refresh();
 	
 protected:
 	void initialize(const QVariantMap& params);
@@ -55,6 +66,9 @@
 	
 private slots:
 	void itemClicked(const QModelIndex& index);
+	
+private:
+	MemSpyProcessModel* mModel;
 };
 
 #endif /* MEMSPYPROCESSVIEW_H_ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/memspyui/ui/hb/inc/memspysettingsview.h	Thu Jul 22 16:33:59 2010 +0100
@@ -0,0 +1,56 @@
+/*
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description:
+ *  
+ */
+
+#ifndef MEMSPYSETTINGSVIEW_H_
+#define MEMSPYSETTINGSVIEW_H_
+
+#include <HbView>
+
+class HbDataForm;
+class HbDataFormModel;
+class HbDataFormModelItem;
+class EngineWrapper;
+
+class MemSpySettingsView : public HbView
+{
+	Q_OBJECT
+	
+public:
+	MemSpySettingsView(EngineWrapper &engine);
+	virtual ~MemSpySettingsView();
+	
+	void initialize(const QVariantMap& params);
+	
+private slots:
+	void updateModel();
+	void accept();
+	void reject();
+	
+signals:
+	void finished(bool ok);
+
+private:
+	HbDataForm* mForm;
+	HbDataFormModel* mModel;
+	HbDataFormModelItem* mModeItem;
+	HbDataFormModelItem* mPathItem;
+	HbDataFormModelItem* mCustomPathItem;
+	
+	EngineWrapper& mEngine;
+};
+
+#endif /* MEMSPYSETTINGSVIEW_H_ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/memspyui/ui/hb/inc/memspyswmtview.h	Thu Jul 22 16:33:59 2010 +0100
@@ -0,0 +1,65 @@
+/*
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description:
+ *  
+ */
+
+#ifndef MEMSPYSWMTVIEW_H_
+#define MEMSPYSWMTVIEW_H_
+
+#include "memspyview.h"
+
+class HbDataFormModel;
+class HbDataFormModelItem;
+class HbProgressDialog;
+
+class MemSpySwmtView : public MemSpyView
+{
+	Q_OBJECT
+	
+public:
+	MemSpySwmtView(EngineWrapper &engine, ViewManager &viewManager);
+	virtual ~MemSpySwmtView();
+	
+	void initialize(const QVariantMap& params);
+		
+protected:
+	HbToolBar* createToolBar();
+	
+	HbWidget* createCentralWidget();
+	
+private slots:
+	void toggleTimer();
+	void forceDump();
+	void modeChanged(int mode);
+	void asyncOperationFinished(int errorCode);
+	
+private:
+	void updateTimerAction(bool isRunning);
+	void removeCategoriesItem();
+	void createCategoriesItem();
+	void updateSettings();
+	
+private:
+	HbAction* mToggleTimerAction;
+	
+	HbDataFormModel* mModel;
+	HbDataFormModelItem* mTimerItem;
+	HbDataFormModelItem* mModeItem;
+	HbDataFormModelItem* mCategoriesItem;
+	
+	HbProgressDialog* mProgressDialog;
+};
+
+#endif /* MEMSPYSWMTVIEW_H_ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/memspyui/ui/hb/inc/memspythreaddetailindexview.h	Thu Jul 22 16:33:59 2010 +0100
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies 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 MEMSPYTHREADDETAILINDEXVIEW_H_
+#define MEMSPYTHREADDETAILINDEXVIEW_H_
+
+#include "memspylistview.h"
+#include "enginewrapper.h"
+
+class HbMenu;
+
+class MemSpyThreadDetailIndexView : public MemSpyListView
+{
+	Q_OBJECT
+	
+public:
+	MemSpyThreadDetailIndexView(EngineWrapper &engine, ViewManager &viewManager) 
+		: MemSpyListView(engine, viewManager) {}
+protected:
+	virtual void initialize(const QVariantMap& params);
+	
+	virtual HbMenu* createToolMenu();
+	
+	virtual bool isBreadCrumbVisible() const;
+	    
+	virtual QString getBreadCrumbText() const;
+
+private slots:
+	void changePriority();
+	void itemClicked(const QModelIndex& index);
+	
+private:
+	ThreadId mThreadId;
+	HbMenu *mPriorityMenu;
+	QString mProcessName;
+	QString mThreadName;
+};
+
+#endif /* MEMSPYTHREADDETAILINDEXVIEW_H_ */
--- a/memspyui/ui/hb/inc/memspythreaddetailview.h	Fri Jun 11 16:29:34 2010 +0100
+++ b/memspyui/ui/hb/inc/memspythreaddetailview.h	Thu Jul 22 16:33:59 2010 +0100
@@ -18,28 +18,46 @@
 #ifndef MEMSPYTHREADDETAILVIEW_H_
 #define MEMSPYTHREADDETAILVIEW_H_
 
-#include "memspyview.h"
+#include "memspylistview.h"
 #include "enginewrapper.h"
 
 class HbMenu;
 
-class MemSpyThreadDetailView : public MemSpyView
+class MemSpyThreadDetailModel : public QAbstractListModel
+{
+public:
+	MemSpyThreadDetailModel(EngineWrapper &engine, ThreadId threadId, ThreadInfoType type, QObject *parent = 0);
+	
+	~MemSpyThreadDetailModel();
+	
+	int rowCount(const QModelIndex &parent = QModelIndex()) const;
+	
+	QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
+	
+private:
+	QList<MemSpyThreadInfoItem*> mThreadInfo;
+};
+
+
+class MemSpyThreadDetailView : public MemSpyListView
 {
 	Q_OBJECT
 	
 public:
 	MemSpyThreadDetailView(EngineWrapper &engine, ViewManager &viewManager) 
-		: MemSpyView(engine, viewManager) {}
+		: MemSpyListView(engine, viewManager) {}
 protected:
 	virtual void initialize(const QVariantMap& params);
-	virtual HbMenu* createToolMenu();
-
-private slots:
-	void changePriority();
+	
+	virtual bool isBreadCrumbVisible() const;
+	
+	virtual QString getBreadCrumbText() const;
 	
 private:
 	ThreadId mThreadId;
 	HbMenu *mPriorityMenu;
+	QString mProcessName;
+	QString mThreadName;
 };
 
 #endif /* MEMSPYTHREADDETAILVIEW_H_ */
--- a/memspyui/ui/hb/inc/memspythreadview.h	Fri Jun 11 16:29:34 2010 +0100
+++ b/memspyui/ui/hb/inc/memspythreadview.h	Thu Jul 22 16:33:59 2010 +0100
@@ -18,7 +18,7 @@
 #ifndef MEMSPYTHREADVIEW_H_
 #define MEMSPYTHREADVIEW_H_
 
-#include "memspyview.h"
+#include "memspylistview.h"
 #include "enginewrapper.h"
 
 class MemSpyThreadModel : public QAbstractListModel
@@ -32,20 +32,29 @@
 	
 	QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
 	
+	void refresh();
+	
 private:
+	ProcessId mProcessId;
+	
+	EngineWrapper& mEngine;
+	
 	QList<MemSpyThread*> mThreads;
 	
 	QMap<int, QString> mPriorityMap;
 };
 
 
-class MemSpyThreadView : public MemSpyView
+class MemSpyThreadView : public MemSpyListView
 {
 	Q_OBJECT
 	
 public:
 	MemSpyThreadView(EngineWrapper &engine, ViewManager &viewManager);
 	~MemSpyThreadView();
+	
+public slots:
+    virtual void refresh();
 
 protected:
 	void initialize(const QVariantMap& params);
@@ -53,6 +62,10 @@
 protected:
 	virtual bool isRefreshable() const { return true; }
 	
+	virtual bool isBreadCrumbVisible() const;
+	
+	QString getBreadCrumbText() const;
+	
 private slots:
 	void itemClicked(const QModelIndex& index);
 	void catchLongPress(HbAbstractViewItem *item, const QPointF &coords);
@@ -62,6 +75,9 @@
 	HbMenu* mContextMenu;
 	HbMenu* mPriorityMenu;
 	ThreadId mThreadId;
+	QString mProcessName;
+	
+	MemSpyThreadModel* mModel;
 };
 
 #endif /* MEMSPYTHREADVIEW_H_ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/memspyui/ui/hb/inc/memspytrackingview.h	Thu Jul 22 16:33:59 2010 +0100
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description:
+ *  
+ */
+
+#ifndef MEMSPYTRACKINGVIEW_H_
+#define MEMSPYTRACKINGVIEW_H_
+
+#include "memspylistview.h"
+
+class MemSpyTrackingView : public MemSpyListView
+{
+    Q_OBJECT
+    
+public:
+    MemSpyTrackingView(EngineWrapper &engine, ViewManager &viewManager) 
+		: MemSpyListView(engine, viewManager) {}
+protected:
+	virtual void initialize(const QVariantMap& params);
+	virtual bool isBreadCrumbVisible() const;
+	
+public slots:
+	void itemClicked(const QModelIndex& index);
+};
+
+#endif /* MEMSPYTRACKINGVIEW_H_ */
--- a/memspyui/ui/hb/inc/memspyview.h	Fri Jun 11 16:29:34 2010 +0100
+++ b/memspyui/ui/hb/inc/memspyview.h	Thu Jul 22 16:33:59 2010 +0100
@@ -22,9 +22,12 @@
 #include <HbListView>
 #include <QVariantMap>
 
+class HbLabel;
+class HbProgressDialog;
 class EngineWrapper;
 class ViewManager;
 
+
 class MemSpyView : public HbView
 {
 	Q_OBJECT
@@ -44,22 +47,33 @@
 	
 	virtual bool isRefreshable() const;
 	
+	virtual bool isBreadCrumbVisible() const;
+	
+	virtual QString getBreadCrumbText() const;
+	
+	virtual HbWidget* createCentralWidget() = 0;
+	
 public slots:
 
 	virtual void initialize(const QVariantMap& params);
 
 	virtual void refresh();
 	
+	void showSettings();
+	
 	void showAbout();
 	
-protected:
+private slots:
 	
-	HbListView mListView;
+	void closeSettings();
+		
+protected:
 	
 	EngineWrapper &mEngine;
 	
 	ViewManager &mViewManager;
 	
+	
 private:
 	HbMenu* mOutputMenu;
 	HbMenu* mOutputGenInfoMenu;
@@ -67,6 +81,7 @@
 	HbMenu* mOutputStackInfoMenu;
 	HbToolBar* mToolBar;
 	
+	HbLabel* mBreadCrumb;
 };
 
 #endif /* MEMSPYVIEW_H_ */
--- a/memspyui/ui/hb/inc/viewmanager.h	Fri Jun 11 16:29:34 2010 +0100
+++ b/memspyui/ui/hb/inc/viewmanager.h	Thu Jul 22 16:33:59 2010 +0100
@@ -26,10 +26,14 @@
 	MainView,
 	ProcessView,
 	ThreadView,
+	ThreadDetailIndexView,
 	ThreadDetailView,
 	KernelObjectTypeView,
 	KernelObjectView,
-	KernelObjectDetailView
+	KernelObjectDetailView,
+	TrackingView,
+	SwmtView,
+	HeapDumpsView
 };
 
 class HbMainWindow;
--- a/memspyui/ui/hb/src/enginewrapper.cpp	Fri Jun 11 16:29:34 2010 +0100
+++ b/memspyui/ui/hb/src/enginewrapper.cpp	Thu Jul 22 16:33:59 2010 +0100
@@ -15,8 +15,272 @@
 * 
 */
 
+#include <QMessageBox>
+
+#include <memspy/engine/memspyenginehelpersysmemtrackerconfig.h>
+
 #include "enginewrapper.h"
-#include <QMessageBox>
+
+// CONSTANTS
+
+const QString OUTPUT_MODE = "output/mode";
+const QString OUTPUT_PATH = "output/path";
+const QString SWMT_PERIOD = "swmt/period";
+const QString SWMT_MODE = "swmt/mode";
+const QString SWMT_CATEGORIES = "swmt/categories";
+const QString HEAP_DUMPS_MODE = "heapdumps/mode";
+
+QString MemSpyProcess::exitInfo() const
+{
+    QChar exitType[] = {'K', 'T', 'P', 'R'};
+    QString result = QString("[%1]").arg(exitType[mProcess->ExitType()]);
+    
+    if (mProcess->ExitType() != EExitKill && mProcess->ExitType() != EExitPending) {
+        
+        QString exitCategory = QString((QChar*) mProcess->ExitCategory().Ptr(), mProcess->ExitCategory().Length());
+        result.append(QString(" %1-%2").arg(exitCategory).arg(mProcess->ExitReason()));
+    }
+    
+    return result;
+}
+
+
+MemSpyDwoProgressTracker::MemSpyDwoProgressTracker(RMemSpySession &session) :
+	CActive(EPriorityStandard), mSession(session)
+{
+	CActiveScheduler::Add(this);
+}
+
+MemSpyDwoProgressTracker::~MemSpyDwoProgressTracker()
+{
+	Cancel();
+}
+
+void MemSpyDwoProgressTracker::start()
+{
+	mSession.NotifyDeviceWideOperationProgress(mProgress, iStatus);
+	
+	SetActive();
+}
+
+void MemSpyDwoProgressTracker::cancel()
+{
+	Cancel();
+}
+
+// Event handler method.
+ 
+void MemSpyDwoProgressTracker::RunL()
+    {
+ 
+    // If an error occurred handle it in RunError().
+    User::LeaveIfError(iStatus.Int());
+ 
+    // Resubmit the request immediately
+    
+    mSession.NotifyDeviceWideOperationProgress(mProgress, iStatus);
+ 
+    SetActive();
+ 
+    emit progress(mProgress.Progress(), QString((QChar*) mProgress.Description().Ptr(), mProgress.Description().Length()));
+    }
+ 
+void MemSpyDwoProgressTracker::DoCancel()
+{ 
+	// this is not yet implemented, as it is not required in current use cases
+}
+ 
+TInt MemSpyDwoProgressTracker::RunError(TInt aError)
+{ 
+	// KErrNotReady and KErrCancel errors are OK, they just notify 
+	// us about the outstanding notification request that won't be 
+	// processed.
+	Q_UNUSED(aError);
+	
+    return KErrNone;
+}
+
+MemSpyDwoTracker::MemSpyDwoTracker(RMemSpySession &session, DeviceWideOperation operation) :
+	CActive(EPriorityStandard), 
+	mSession(session),
+	mProgressTracker(new MemSpyDwoProgressTracker(session)),
+	mOperation(operation)
+{
+	CActiveScheduler::Add(this);
+	connect(mProgressTracker, SIGNAL(progress(int,QString)), this, SIGNAL(progress(int,QString)));
+}
+
+MemSpyDwoTracker::~MemSpyDwoTracker()
+{
+	Cancel();
+	
+	delete mProgressTracker;
+}
+
+void MemSpyDwoTracker::start()
+{
+	void (RMemSpySession::*functions[])(TRequestStatus&) = { 
+			&RMemSpySession::OutputPhoneInfo,
+			&RMemSpySession::OutputDetailedPhoneInfo,
+			&RMemSpySession::OutputHeapInfo,
+			&RMemSpySession::OutputCompactHeapInfo,
+			&RMemSpySession::OutputHeapCellListing,
+			&RMemSpySession::OutputHeapData,
+			&RMemSpySession::OutputStackInfo,
+			&RMemSpySession::OutputCompactStackInfo,
+			&RMemSpySession::OutputUserStackData,
+			&RMemSpySession::OutputKernelStackData };
+	
+	(mSession.*functions[mOperation])(iStatus);
+	
+	mProgressTracker->start();
+	
+	SetActive();
+}
+
+void MemSpyDwoTracker::cancel()
+{
+	Cancel();
+}
+
+// Event handler method.
+ 
+void MemSpyDwoTracker::RunL()
+    {
+ 
+    // If an error occurred handle it in RunError().
+    User::LeaveIfError(iStatus.Int());
+ 
+    // Operation has finished successfully 
+    emit finished(0);
+    }
+ 
+void MemSpyDwoTracker::DoCancel()
+{
+	// Cancel progress tracker
+	mProgressTracker->cancel();
+	
+	mSession.CancelDeviceWideOperationL();
+}
+ 
+TInt MemSpyDwoTracker::RunError(TInt aError)
+{ 
+	// Emit the finished signal to notify user 
+	// operation was canceled
+	emit finished(aError);
+	
+    return KErrNone;
+}
+
+MemSpyAsyncTracker::MemSpyAsyncTracker(RMemSpySession& session, void (RMemSpySession::*function)(TRequestStatus&)) :
+	CActive(EPriorityStandard), 
+	mFunction(function),
+	mSession(session)
+{
+	CActiveScheduler::Add(this);
+}
+
+void MemSpyAsyncTracker::RunL()
+{ 
+    // If an error occurred handle it in RunError().
+    User::LeaveIfError(iStatus.Int());
+ 
+    // Operation has finished successfully 
+    emit finished(0);
+}
+
+void MemSpyAsyncTracker::DoCancel()
+{
+	// nothing to do here
+}
+
+TInt MemSpyAsyncTracker::RunError(TInt aError)
+{ 
+	// Emit the finished signal to notify user 
+	// that operation was canceled
+	emit finished(aError);
+	
+    return KErrNone;
+}
+
+void MemSpyAsyncTracker::start()
+{
+	(mSession.*mFunction)(iStatus);
+	
+	SetActive();
+}
+
+MemSpySettings::MemSpySettings() : 
+	QSettings("Nokia", "MemSpy") 
+{
+}
+
+OutputMode MemSpySettings::outputMode() const
+{
+	return static_cast<OutputMode>(value(OUTPUT_MODE, 0).toInt());
+}
+
+void MemSpySettings::setOutputMode(OutputMode mode)
+{
+	setValue(OUTPUT_MODE, mode);
+}
+	
+QString MemSpySettings::outputPath() const
+{
+	return value(OUTPUT_PATH).toString();
+}
+
+void MemSpySettings::setOutputPath(const QString& path)
+{
+	setValue(OUTPUT_PATH, path);
+}
+
+int MemSpySettings::swmtTimerPeriod() const
+{
+	return value(SWMT_PERIOD, 30).toInt();
+}
+
+void MemSpySettings::setSwmtMode(SwmtMode mode)
+{
+	setValue(SWMT_MODE, mode);
+}
+
+SwmtMode MemSpySettings::swmtMode() const
+{
+	return static_cast<SwmtMode>(value(SWMT_MODE, 0).toInt());
+}
+
+void MemSpySettings::setSwmtTimerPeriod(int period)
+{
+	setValue(SWMT_PERIOD, period);
+}
+
+
+QVariantList MemSpySettings::swmtCategories() const
+{
+	return value(SWMT_CATEGORIES).toList();
+}
+
+void MemSpySettings::setSwmtCategories(const QVariantList& categories)
+{
+	setValue(SWMT_CATEGORIES, categories);
+}
+
+HeapDumpsMode MemSpySettings::heapDumpsMode() const
+{
+	return static_cast<HeapDumpsMode>(value(HEAP_DUMPS_MODE).toInt());
+}
+
+void MemSpySettings::setHeapDumpsMode(HeapDumpsMode mode)
+{
+	setValue(HEAP_DUMPS_MODE, mode);
+}
+
+
+EngineWrapper::EngineWrapper() :
+	mSwmtRunning(false)
+{
+}
 
 EngineWrapper::~EngineWrapper()
 {
@@ -28,15 +292,28 @@
 	return mSession.Connect() == KErrNone;
 }
 
+MemSpySettings& EngineWrapper::settings()
+{
+	return mSettings;
+}
+
+const MemSpySettings& EngineWrapper::settings() const
+{
+	return mSettings;
+}
+
+
+
 QList<MemSpyProcess*> EngineWrapper::getProcesses()
 {
 	QList<MemSpyProcess*> result;
 	
 	RArray<CMemSpyApiProcess*> proc;
-	TRAPD(error, mSession.GetProcessesL(proc));
-	if (error == KErrNone)
-		for(TInt i=0; i<proc.Count(); i++)
-			result.append(new MemSpyProcess(proc[i]));
+	
+	QT_TRAP_THROWING(mSession.GetProcessesL(proc));
+	
+	for (TInt i=0; i<proc.Count(); i++)
+        result.append(new MemSpyProcess(proc[i]));
 	
 	return result;
 }
@@ -46,17 +323,31 @@
 	QList<MemSpyThread*> result;
 	
 	RArray<CMemSpyApiThread*> proc;
-	TRAPD(error, mSession.GetThreadsL(processId, proc));
-	if (error == KErrNone)
-		for(TInt i=0; i<proc.Count(); i++)
-			result.append(new MemSpyThread(proc[i]));
+	
+	QT_TRAP_THROWING(mSession.GetThreadsL(processId, proc));
+	
+    for (TInt i=0; i<proc.Count(); i++)
+        result.append(new MemSpyThread(proc[i]));
+	
+	return result;
+}
+
+QList<MemSpyThreadInfoItem*> EngineWrapper::getThreadInfo(ThreadId threadId, ThreadInfoType type)
+{
+	QList<MemSpyThreadInfoItem*> result;
+	RArray<CMemSpyApiThreadInfoItem*> threadInfo;
+	qt_symbian_throwIfError(mSession.GetThreadInfoItems(threadInfo, threadId, 
+			static_cast<TMemSpyThreadInfoItemType>(type)));
+	
+	for (TInt i=0; i<threadInfo.Count(); i++)
+		result.append(new MemSpyThreadInfoItem(threadInfo[i]));
 	
 	return result;
 }
 
 void EngineWrapper::setThreadPriority(ThreadId threadId, ThreadPriority priority)
 {
-	TRAPD(error, mSession.SetThreadPriorityL(threadId, priority));
+	TRAP_IGNORE(mSession.SetThreadPriorityL(threadId, priority));
 }
 
 QList<MemSpyKernelObjectType*> EngineWrapper::getKernelObjectTypes()
@@ -64,10 +355,10 @@
 	QList<MemSpyKernelObjectType*> result;
 		
 	RArray<CMemSpyApiKernelObject*> types;
-	TInt error = mSession.GetKernelObjects(types);
-	if (error == KErrNone)
-		for(TInt i=0; i<types.Count(); i++)
-			result.append(new MemSpyKernelObjectType(types[i]));
+	qt_symbian_throwIfError(mSession.GetKernelObjects(types));
+	
+	for(TInt i=0; i<types.Count(); i++)
+		result.append(new MemSpyKernelObjectType(types[i]));
 	
 	return result;
 }
@@ -77,11 +368,139 @@
 	QList<MemSpyKernelObject*> result;
 		
 	RArray<CMemSpyApiKernelObjectItem*> objects;
-	TInt error = mSession.GetKernelObjectItems(objects, 
-			static_cast<TMemSpyDriverContainerType>(type));
-	if (error == KErrNone)
-		for(TInt i=0; i<objects.Count(); i++)
-			result.append(new MemSpyKernelObject(objects[i]));
+	qt_symbian_throwIfError(mSession.GetKernelObjectItems(objects, 
+			static_cast<TMemSpyDriverContainerType>(type)));
+	
+	for(TInt i=0; i<objects.Count(); i++)
+		result.append(new MemSpyKernelObject(objects[i]));
 	
 	return result;
 }
+
+MemSpyDwoTracker* EngineWrapper::createDeviceWideOperation(DeviceWideOperation operation)
+{
+	return new MemSpyDwoTracker(mSession, operation);
+}
+
+MemSpyKernelHeapDumpTracker* EngineWrapper::createKernelHeapDumpTracker()
+{
+	return new MemSpyKernelHeapDumpTracker(mSession);
+}
+
+MemSpySwmtDumpTracker* EngineWrapper::createSwmtDumpTracker()
+{
+	return new MemSpySwmtDumpTracker(mSession);
+}
+
+void EngineWrapper::setSwmtSettings(SwmtMode mode, const QVariantList& categories)
+{
+	int bits = 0;
+	bool heapDumps = false;
+	switch (mode)
+	{
+	case SwmtModeBasic:
+		bits = TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryUserHeap | 
+			TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryUserStacks |
+			TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryGlobalData |
+			TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategorySystemMemory;
+		
+		break;
+		
+	case SwmtModeFull:
+		bits = TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryAll;
+		heapDumps = true;
+		
+		break;
+		
+	case SwmtModeCustom:
+		bits = 0;
+		// this needs to be in sync. with swmt view categories
+		TMemSpyEngineHelperSysMemTrackerConfig::TMemSpyEngineSysMemTrackerCategories cats[] = {
+            TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryFileServerCache,
+            //TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryBitmapHandles,
+            TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryUserHeap,
+            //TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryKernelHeap,
+            TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryLocalChunks,
+            TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryGlobalChunks,
+            TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryRAMDrive,
+            //TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryUserStacks,
+            //TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryGlobalData,
+            TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryRAMLoadedCode,
+            TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryKernelHandles,
+            TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryOpenFiles,
+            TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryDiskusage,
+            TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategorySystemMemory,
+            TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryWindowGroups
+		};
+
+		foreach (const QVariant& bit, categories)
+			bits |= cats[bit.toInt()];
+		
+		break;
+	}
+	
+	TRAP_IGNORE(mSession.SetSwmtCategoriesL(bits));
+	TRAP_IGNORE(mSession.SetSwmtHeapDumpsEnabledL(heapDumps));
+}
+
+bool EngineWrapper::isSwmtRunning()
+{
+	return mSwmtRunning;
+}
+	
+void EngineWrapper::startSwmt(int period)
+{
+	mSwmtRunning = true;
+	updateOutputSettings();
+	TRAP_IGNORE(mSession.StartSwmtTimerL(period));
+}
+
+void EngineWrapper::stopSwmt()
+{
+	mSwmtRunning = false;
+	TRAP_IGNORE(mSession.StopSwmtTimerL());
+}
+
+void EngineWrapper::forceSwmtDump()
+{
+	updateOutputSettings();	
+	TRAP_IGNORE(mSession.ForceSwmtUpdateL());
+}
+
+void EngineWrapper::outputKernelHeapData()
+{
+	updateOutputSettings();
+	TRAP_IGNORE(mSession.OutputKernelHeapDataL());
+}
+
+int EngineWrapper::outputThreadHeapData(const QString& filter)
+{
+	TPtrC customFilterDesc(static_cast<const TUint16*>(filter.utf16()), filter.length());
+	
+	TRAPD(err, mSession.OutputThreadHeapDataL(customFilterDesc));
+	
+	return err;
+}
+
+void EngineWrapper::updateOutputSettings()
+{
+	switch (mSettings.outputMode()) {
+		case OutputModeTrace:
+			TRAP_IGNORE(mSession.SwitchOutputToTraceL());
+			break;
+		
+		case OutputModeFile:
+		
+			if (mSettings.outputPath().isEmpty()) {
+				TRAP_IGNORE(mSession.SwitchOutputToFileL(KNullDesC));
+			
+			} else {
+				
+				QString root = mSettings.outputPath();
+				TPtrC rootDesc (static_cast<const TUint16*>(root.utf16()), root.length());
+			
+				TRAP_IGNORE(mSession.SwitchOutputToFileL(rootDesc));
+			}
+	
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/memspyui/ui/hb/src/memspyheapdumpsview.cpp	Thu Jul 22 16:33:59 2010 +0100
@@ -0,0 +1,184 @@
+/*
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description:
+ *  
+ */
+
+#include <HbToolBar>
+#include <HbAction>
+#include <HbDataForm>
+#include <HbDataFormModel>
+#include <HbProgressDialog>
+#include <HbMessageBox>
+#include <HbLabel>
+
+#include "memspyheapdumpsview.h"
+#include "enginewrapper.h"
+
+const QStringList MODE_ITEMS = QStringList() << 
+	MemSpyHeapDumpsView::tr("Kernel") << 
+	MemSpyHeapDumpsView::tr("User") << 
+	MemSpyHeapDumpsView::tr("Both");
+	
+MemSpyHeapDumpsView::MemSpyHeapDumpsView(EngineWrapper &engine, ViewManager &viewManager) : 
+	MemSpyView(engine, viewManager),
+	mModel(0),
+	mModeItem(0),
+	mFilterItem(0),
+	mDwoProgressDialog(0)
+{
+}
+
+MemSpyHeapDumpsView::~MemSpyHeapDumpsView()
+{
+	delete mDwoProgressDialog;
+}
+
+void MemSpyHeapDumpsView::initialize(const QVariantMap& params)
+{
+	setTitle(tr("Heap Dumps"));
+	
+	MemSpyView::initialize(params);
+}
+
+HbToolBar* MemSpyHeapDumpsView::createToolBar()
+{
+	HbToolBar* toolBar = new HbToolBar();
+	toolBar->addAction(tr("Dump Now"), this, SLOT(dump()));
+	return toolBar;
+}
+
+HbWidget* MemSpyHeapDumpsView::createCentralWidget()
+{
+	mModel = new HbDataFormModel(this);
+	
+	//TODO: uncomment after kernel heap dumps are implemented 
+//	mModeItem = mModel->appendDataFormItem(
+//		HbDataFormModelItem::ComboBoxItem, tr("Heap Dump"));
+//	mModeItem->setContentWidgetData("items", MODE_ITEMS);
+//	mModeItem->setContentWidgetData("currentIndex", mEngine.settings().heapDumpsMode());
+//	modeChanged(mEngine.settings().heapDumpsMode());
+	
+	//TODO: remove after kernel heap dumps are implemented
+	createFilterItem();
+	
+	HbDataForm* form = new HbDataForm(this);
+	form->setModel(mModel);
+	
+	//TODO: uncomment after kernel heap dumps are implemented
+//	form->addConnection(mModeItem, SIGNAL(currentIndexChanged(int)), this, SLOT(modeChanged(int)));
+	
+	return form;
+}
+
+void MemSpyHeapDumpsView::modeChanged(int mode)
+{
+	if (mode == HeapDumpsModeKernel && mFilterItem)
+		removeFilterItem();
+	else if (mode != HeapDumpsModeKernel && !mFilterItem)
+		createFilterItem();
+}
+
+void MemSpyHeapDumpsView::createFilterItem()
+{
+	mFilterItem = mModel->appendDataFormItem(
+			HbDataFormModelItem::TextItem, tr("Filter"));
+}
+
+void MemSpyHeapDumpsView::removeFilterItem()
+{
+	mModel->removeItem(mFilterItem);
+	mFilterItem = 0;
+}
+
+void MemSpyHeapDumpsView::dump()
+{
+    mEngine.updateOutputSettings();
+    
+	HeapDumpsMode mode = HeapDumpsModeUser;
+	//TODO: uncomment after kernel heap dumps are implemented 
+	//static_cast<HeapDumpsMode>(mModeItem->contentWidgetData("currentIndex").toInt());
+	
+	// save settings
+	//TODO: uncomment after kernel heap dumps are implemented
+	//mEngine.settings().setHeapDumpsMode(mode);
+
+	if (mode == HeapDumpsModeKernel || mode == HeapDumpsModeBoth) {
+		// dump kernel heap
+		mDwoProgressDialog = new HbProgressDialog(HbProgressDialog::WaitDialog);
+		mDwoProgressDialog->setText(tr("Please wait..."));
+		mDwoProgressDialog->show();
+		
+		MemSpyKernelHeapDumpTracker* tracker = mEngine.createKernelHeapDumpTracker();
+		connect(tracker, SIGNAL(finished(int)), this, SLOT(asyncOperationFinished(int)));
+		tracker->start();
+	}
+	
+	if (mode == HeapDumpsModeUser || mode == HeapDumpsModeBoth) {
+		// dump user heap
+		
+		QString filter = mFilterItem->contentWidgetData("text").toString();
+		if (!filter.isEmpty()) {
+		    
+			int errorCode = mEngine.outputThreadHeapData(filter);
+            if (errorCode == KErrNotFound) {
+                HbMessageBox *messageBox = new HbMessageBox(HbMessageBox::MessageTypeInformation);
+                messageBox->setText(tr("No thread matches your filter"));
+                HbLabel *header = new HbLabel(tr("No such thread"), messageBox);
+                messageBox->setHeadingWidget(header);
+                messageBox->setAttribute(Qt::WA_DeleteOnClose);
+                messageBox->setTimeout(HbPopup::StandardTimeout);
+                messageBox->open();
+            }
+			    
+			
+		} else {
+			mDwoProgressDialog = new HbProgressDialog(HbProgressDialog::ProgressDialog);
+			mDwoProgressDialog->setMinimum(0);
+			mDwoProgressDialog->setMaximum(100);
+			mDwoProgressDialog->show();
+			
+			MemSpyDwoTracker* tracker = mEngine.createDeviceWideOperation(OutputHeapData);
+			connect(tracker, SIGNAL(progress(int,QString)), this, SLOT(updateDwoProgress(int,QString)));
+			connect(tracker, SIGNAL(finished(int)), this, SLOT(asyncOperationFinished(int)));
+			connect(mDwoProgressDialog, SIGNAL(cancelled()), tracker, SLOT(cancel()));
+			tracker->start();
+		}
+	}
+}
+
+void MemSpyHeapDumpsView::updateDwoProgress(int progress, const QString& processName)
+{
+	mDwoProgressDialog->setText(processName);
+	mDwoProgressDialog->setProgressValue(progress);
+}
+
+void MemSpyHeapDumpsView::asyncOperationFinished(int errorCode)
+{
+	mDwoProgressDialog->hide();
+	delete mDwoProgressDialog;
+	mDwoProgressDialog = 0;
+	
+	delete sender();    
+	
+	if (errorCode != KErrNone && errorCode != KErrCancel) {
+	    HbMessageBox *messageBox = new HbMessageBox(HbMessageBox::MessageTypeWarning);
+        messageBox->setText(tr("An error occured during the operation. Error code: %1").arg(errorCode));
+        HbLabel *header = new HbLabel(tr("Error"), messageBox);
+        messageBox->setHeadingWidget(header);
+        messageBox->setAttribute(Qt::WA_DeleteOnClose);
+        messageBox->setTimeout(HbPopup::StandardTimeout);
+        messageBox->open();
+	}
+}
--- a/memspyui/ui/hb/src/memspykernelobjectdetailview.cpp	Fri Jun 11 16:29:34 2010 +0100
+++ b/memspyui/ui/hb/src/memspykernelobjectdetailview.cpp	Thu Jul 22 16:33:59 2010 +0100
@@ -19,11 +19,49 @@
 
 #include "memspykernelobjectdetailview.h"
 
+MemSpyKernelObjectDetailModel::MemSpyKernelObjectDetailModel(const QStringList& details, QObject *parent) :
+    QAbstractListModel(parent),
+    mDetails(details)
+{
+
+}
+    
+int MemSpyKernelObjectDetailModel::rowCount(const QModelIndex &parent) const
+{
+    Q_UNUSED(parent);
+    return mDetails.count();
+}
+    
+QVariant MemSpyKernelObjectDetailModel::data(const QModelIndex &index, int role) const
+{
+    if (role == Qt::DisplayRole) {
+        
+        // convert from semicolon delimited line to two lines
+        return mDetails.at(index.row()).split(": ");
+    }
+    
+    return QVariant();
+}
+
+
 void MemSpyKernelObjectDetailView::initialize(const QVariantMap& params)
 {
-	MemSpyView::initialize(params);
+	setTitle("Details");
 	
-	setTitle("Details");
+	mTypeName = params["typeName"].toString();
+	mObjectName = params["objectName"].toString();
+	MemSpyView::initialize(params);
+		
 	QStringList items = params.value("details").toStringList();
-	mListView.setModel(new QStringListModel(items, this));
+	mListView.setModel(new MemSpyKernelObjectDetailModel(items, this));
 }
+
+bool MemSpyKernelObjectDetailView::isBreadCrumbVisible() const
+{
+    return true;
+}
+            
+QString MemSpyKernelObjectDetailView::getBreadCrumbText() const
+{
+    return tr("Kernel Objects > %1 > %2").arg(mTypeName).arg(mObjectName);
+}
--- a/memspyui/ui/hb/src/memspykernelobjecttypeview.cpp	Fri Jun 11 16:29:34 2010 +0100
+++ b/memspyui/ui/hb/src/memspykernelobjecttypeview.cpp	Thu Jul 22 16:33:59 2010 +0100
@@ -24,6 +24,10 @@
 	QAbstractListModel(parent),
 	mObjectTypes(engine.getKernelObjectTypes())
 {
+    mKernelObjectNames << "Threads" << "Processes" << "Chunks" << "Libraries" <<
+        "Semaphores" << "Mutexes" << "Timers" << "Servers" << "Sessions" << "Logical Devices" <<
+        "Physical Devices" << "Logical Channels" << "Change Notifiers" << "Undertakers" <<
+        "Message Queues" << "Property Refs." << "Conditional Vars.";
 }
 
 MemSpyKernelObjectTypeModel::~MemSpyKernelObjectTypeModel()
@@ -41,7 +45,10 @@
 {
 	if (role == Qt::DisplayRole) {
 		QStringList lines;
-		lines << mObjectTypes.at(index.row())->name();
+		lines << mKernelObjectNames.at(index.row());
+		lines << QString("%1, %2").
+			arg(tr("%n item(s)", "", mObjectTypes.at(index.row())->count())).
+			arg(formatSize(mObjectTypes.at(index.row())->size()));
 		
 		return lines;
 	}
@@ -52,19 +59,26 @@
 	return QVariant();
 }
 
+QString MemSpyKernelObjectTypeModel::formatSize(qint64 size) const
+{
+	// If < 1000K
+	if  (size < 1024000)
+		return QString("%1K").arg(size ? qBound<int>(1, (size + 512) >> 10, 999) : 0);
+	
+	// larger than 1M
+	double sizeInM = size / 1048576.;
+	return sizeInM >= 1000 ?
+		QString("%1G").arg(qMax<double>(1, sizeInM / 1024), 0, 'f', 1) :
+		QString("%1M").arg(qBound<double>(1, sizeInM, 999.9), 0, 'f', 1);
+}
+
 void MemSpyKernelObjectTypeView::initialize(const QVariantMap& params)
 {
+	setTitle(tr("Kernel Objects"));
+		
 	MemSpyView::initialize(params);
-	
-	setTitle(tr("Kernel Objects"));
-	
-	QStringList list = QStringList() << "Thread" << "Process" << "Chunk" << "Library" <<
-			"Semaphore" << "Mutex" << "Timer" << "Server" << "Session" << "Logical Device" <<
-			"Physical Device" << "Logical Channel" << "Change Notifier" << "Undertaker" <<
-			"Message Queue" << "Property Ref." << "Conditional Var.";
 			
-	//mListView.setModel(new MemSpyKernelObjectTypeModel(mEngine, this));
-	mListView.setModel(new QStringListModel(list, this));
+	mListView.setModel(new MemSpyKernelObjectTypeModel(mEngine, this));
 	
 	connect(&mListView, SIGNAL(activated(QModelIndex)), this, SLOT(itemClicked(QModelIndex)));
 }
--- a/memspyui/ui/hb/src/memspykernelobjectview.cpp	Fri Jun 11 16:29:34 2010 +0100
+++ b/memspyui/ui/hb/src/memspykernelobjectview.cpp	Thu Jul 22 16:33:59 2010 +0100
@@ -55,8 +55,6 @@
 
 void MemSpyKernelObjectView::initialize(const QVariantMap& params)
 {
-	MemSpyView::initialize(params);
-	
 	QStringList list = QStringList() << "Threads" << "Processes" << "Chunks" << "Libraries" <<
 			"Semaphores" << "Mutexes" << "Timers" << "Servers" << "Sessions" << "Logical Devices" <<
 			"Physical Devices" << "Logical Channels" << "Change Notifiers" << "Undertakers" <<
@@ -66,16 +64,31 @@
 	
 	setTitle(list.at(type));
 	
+	MemSpyView::initialize(params);
+	
 	//mListView.setModel(new MemSpyKernelObjectTypeModel(mEngine, this));
 	mListView.setModel(new MemSpyKernelObjectModel(mEngine, type, this));
 	
 	connect(&mListView, SIGNAL(activated(QModelIndex)), this, SLOT(itemClicked(QModelIndex)));
 }
 
+bool MemSpyKernelObjectView::isBreadCrumbVisible() const
+{
+    return true;
+}
+            
+QString MemSpyKernelObjectView::getBreadCrumbText() const
+{
+    return tr("Kernel Objects");
+}
+
+
 void MemSpyKernelObjectView::itemClicked(const QModelIndex& index)
 {
 	QVariantMap map;
 	map.insert("details", getDetails(static_cast<MemSpyKernelObject*>(qVariantValue<void*>(index.data(Qt::UserRole)))));
+	map.insert("typeName", title());
+	map.insert("objectName", static_cast<MemSpyKernelObject*>(qVariantValue<void*>(index.data(Qt::UserRole)))->nameDetail());
     mViewManager.showView(KernelObjectDetailView, map);
 }
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/memspyui/ui/hb/src/memspylistview.cpp	Thu Jul 22 16:33:59 2010 +0100
@@ -0,0 +1,23 @@
+/*
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description:
+ *  
+ */
+
+#include "memspylistview.h"
+
+HbWidget* MemSpyListView::createCentralWidget()
+{
+	return &mListView;
+}
--- a/memspyui/ui/hb/src/memspymainview.cpp	Fri Jun 11 16:29:34 2010 +0100
+++ b/memspyui/ui/hb/src/memspymainview.cpp	Thu Jul 22 16:33:59 2010 +0100
@@ -16,20 +16,21 @@
  */
 
 #include "memspymainview.h"
-#include "viewManager.h"
+#include "viewmanager.h"
 
 #include <QStringListModel>
 #include <QDebug>
 
 void MemSpyMainView::initialize(const QVariantMap& params)
 {
+	setTitle("MemSpy");
+	
 	MemSpyView::initialize(params);
 	
-	setTitle("MemSpy");
 	QStringList items = QStringList() 
 			<< tr("Processes & Threads") 
-			<< tr("Kernel Objects"); 
-			//<< tr("Kernel Heap");
+			<< tr("Kernel Objects")
+			<< tr("Tracking");
 	mListView.setModel(new QStringListModel(items, this));
     
 	QObject::connect(&mListView, SIGNAL(released(QModelIndex)), this, SLOT(itemClicked(QModelIndex)));
@@ -38,7 +39,12 @@
 void MemSpyMainView::itemClicked(const QModelIndex& index)
 {
 	Q_UNUSED(index);
-	ViewIndex indexes[] = { ProcessView, KernelObjectTypeView, KernelObjectTypeView };
+	ViewIndex indexes[] = { ProcessView, KernelObjectTypeView, TrackingView };
     mViewManager.showView(indexes[index.row()]);
 }
 
+bool MemSpyMainView::isBreadCrumbVisible() const
+{
+	return false;
+}
+
--- a/memspyui/ui/hb/src/memspyprocessview.cpp	Fri Jun 11 16:29:34 2010 +0100
+++ b/memspyui/ui/hb/src/memspyprocessview.cpp	Thu Jul 22 16:33:59 2010 +0100
@@ -23,8 +23,17 @@
 
 MemSpyProcessModel::MemSpyProcessModel(EngineWrapper &engine, QObject *parent) :
 	QAbstractListModel(parent),
+	mEngine(engine),
 	mProcesses(engine.getProcesses())
 {
+    mPriorityMap.insert(EPriorityLow, tr("[L]"));
+    mPriorityMap.insert(EPriorityBackground, tr("[B]"));
+    mPriorityMap.insert(EPriorityForeground, tr("[F]"));
+    mPriorityMap.insert(EPriorityHigh, tr("[H]"));
+    mPriorityMap.insert(EPriorityWindowServer, tr("[WS]"));
+    mPriorityMap.insert(EPriorityFileServer, tr("[FS]"));
+    mPriorityMap.insert(EPriorityRealTimeServer, tr("[RTS]"));
+    mPriorityMap.insert(EPrioritySupervisor, tr("[SUP]"));
 }
 
 MemSpyProcessModel::~MemSpyProcessModel()
@@ -41,8 +50,17 @@
 QVariant MemSpyProcessModel::data(const QModelIndex &index, int role) const
 {
 	if (role == Qt::DisplayRole) {
+	    const MemSpyProcess* process = mProcesses.at(index.row());
+	    
 		QStringList lines;
-		lines << mProcesses.at(index.row())->name();
+		lines << process->name();
+		
+		lines << (process->isDead() ? 
+		    process->exitInfo() :
+		    QString("%1, %2 thr, %3").
+                arg(process->sid(), 0, 16).
+                arg(process->threadCount()).
+                arg(mPriorityMap.value(process->priority(), tr("[?]"))));
 		
 		return lines;
 	}
@@ -52,14 +70,24 @@
 	
 	return QVariant();
 }
+
+void MemSpyProcessModel::refresh()
+{
+    beginResetModel();
+    QList<MemSpyProcess*> data = mEngine.getProcesses();
+    qDeleteAll(mProcesses);
+    mProcesses = data;
+    endResetModel();
+}
 	
 
 void MemSpyProcessView::initialize(const QVariantMap& params)
 {
+	setTitle(tr("Processes"));
 	MemSpyView::initialize(params);
 	
-	setTitle(tr("Processes"));
-	mListView.setModel(new MemSpyProcessModel(mEngine, this));
+	mModel = new MemSpyProcessModel(mEngine, this);
+	mListView.setModel(mModel);
 	
 	connect(&mListView, SIGNAL(activated(QModelIndex)), this, SLOT(itemClicked(QModelIndex)));
 }
@@ -68,6 +96,12 @@
 {
 	QVariantMap map;
 	map.insert("pid", index.data(Qt::UserRole));
+	map.insert("pname", index.data(Qt::DisplayRole).toStringList().at(0));
     mViewManager.showView(ThreadView, map);
 }
 
+void MemSpyProcessView::refresh()
+{ 
+    mModel->refresh(); 
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/memspyui/ui/hb/src/memspysettingsview.cpp	Thu Jul 22 16:33:59 2010 +0100
@@ -0,0 +1,127 @@
+/*
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description:
+ *  
+ */
+
+#include <HbToolBar>
+#include <HbAction>
+#include <HbDataForm>
+#include <HbDataFormModel>
+#include <HbProgressDialog>
+
+#include "memspysettingsview.h"
+#include "enginewrapper.h"
+
+const QStringList MODE_ITEMS = QStringList() << 
+	MemSpySettingsView::tr("RDebug") << 
+	MemSpySettingsView::tr("File");
+	
+MemSpySettingsView::MemSpySettingsView(EngineWrapper &engine) :
+	mForm(new HbDataForm(this)),
+	mModel(0),
+	mModeItem(0),
+	mPathItem(0),
+	mCustomPathItem(0),
+	mEngine(engine)
+{
+	setTitle(tr("Settings"));
+	
+	toolBar()->addAction(tr("OK"), this, SLOT(accept()));
+	toolBar()->addAction(tr("Cancel"), this, SLOT(reject()));
+	
+	mModel = new HbDataFormModel(this);
+		
+	mModeItem = mModel->appendDataFormItem(
+		HbDataFormModelItem::ComboBoxItem, tr("Output"));
+	mModeItem->setContentWidgetData("items", MODE_ITEMS);
+	mModeItem->setContentWidgetData("currentIndex", mEngine.settings().outputMode());
+	
+	updateModel();
+		
+	
+	mForm->setModel(mModel);
+	mForm->addConnection(mModeItem, SIGNAL(currentIndexChanged(int)), this, SLOT(updateModel()));
+	setWidget(mForm);
+	
+	// change navigation action
+	HbAction* action = new HbAction(Hb::BackNaviAction, this);
+	connect(action, SIGNAL(triggered()), this, SLOT(reject()));
+	setNavigationAction(action);
+}
+
+MemSpySettingsView::~MemSpySettingsView()
+{
+}
+
+void MemSpySettingsView::updateModel()
+{
+	OutputMode mode = static_cast<OutputMode>(mModeItem->contentWidgetData("currentIndex").toInt());
+	if (mode == OutputModeTrace) {
+		// remove both path item and custom path item
+		if (mPathItem)
+			mModel->removeItem(mPathItem);
+		if (mCustomPathItem)
+			mModel->removeItem(mCustomPathItem);
+		
+		mPathItem = mCustomPathItem = 0;
+	} else if (mode == OutputModeFile) {
+		if (!mPathItem) {
+			// create path item
+			mPathItem = mModel->appendDataFormItem(
+					HbDataFormModelItem::CheckBoxItem, tr("Path"));
+			mPathItem->setContentWidgetData("text", tr("Use Default Path (\\MemSpy)"));
+			mPathItem->setContentWidgetData("checkState", 
+					mEngine.settings().outputPath().isEmpty() ? Qt::Checked : Qt::Unchecked);
+			
+			mForm->addConnection(mPathItem, SIGNAL(stateChanged(int)), 
+					this, SLOT(updateModel()));
+		}
+		
+		if (mPathItem->contentWidgetData("checkState").toInt() == Qt::Unchecked && !mCustomPathItem) {
+			// create custom path item
+			mCustomPathItem = mModel->appendDataFormItem(
+					HbDataFormModelItem::TextItem, tr("Custom Path"));
+			mCustomPathItem->setContentWidgetData("text", 
+					mEngine.settings().outputPath().isEmpty() ? "\\MemSpy" : mEngine.settings().outputPath());
+		}
+		
+		if (mPathItem->contentWidgetData("checkState").toInt() == Qt::Checked && mCustomPathItem) {
+			// remove cusom path item
+			mModel->removeItem(mCustomPathItem);
+			mCustomPathItem = 0;
+		}
+	}
+}
+
+void MemSpySettingsView::accept()
+{
+	OutputMode mode = static_cast<OutputMode>(mModeItem->contentWidgetData("currentIndex").toInt());
+	
+	mEngine.settings().setOutputMode(mode);
+	
+	if (mode == OutputModeFile) {
+		QString path = mPathItem->contentWidgetData("checkState").toInt() == Qt::Checked ? 
+				"" :
+				mCustomPathItem->contentWidgetData("text").toString();
+		mEngine.settings().setOutputPath(path);
+	}
+	emit finished(true);
+}
+
+void MemSpySettingsView::reject()
+{
+	emit finished(false);
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/memspyui/ui/hb/src/memspyswmtview.cpp	Thu Jul 22 16:33:59 2010 +0100
@@ -0,0 +1,180 @@
+/*
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies 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 <HbToolBar>
+#include <HbAction>
+#include <HbDataForm>
+#include <HbDataFormModel>
+#include <HbProgressDialog>
+
+#include "memspyswmtview.h"
+#include "enginewrapper.h"
+
+const QStringList MODE_ITEMS = QStringList() << 
+	MemSpySwmtView::tr("Basic") << 
+	MemSpySwmtView::tr("Full") << 
+	MemSpySwmtView::tr("Custom");
+ 
+const QStringList CATEGORIES_ITEMS = QStringList() <<
+	MemSpySwmtView::tr("FileServer Cache") <<
+	//MemSpySwmtView::tr("Bitmap Handles") <<
+	MemSpySwmtView::tr("User Heap") <<
+	//MemSpySwmtView::tr("Kernel Heap") <<
+	MemSpySwmtView::tr("Local Chunks") <<
+	MemSpySwmtView::tr("Global Chunks") <<
+	MemSpySwmtView::tr("RAM Drive") <<
+	//MemSpySwmtView::tr("User Stacks") <<
+	//MemSpySwmtView::tr("Global Data") <<
+	MemSpySwmtView::tr("RAM-loaded Code") <<
+	MemSpySwmtView::tr("Kernel Handles") <<
+	MemSpySwmtView::tr("Open Files") <<
+	MemSpySwmtView::tr("Disk Usage") <<
+	MemSpySwmtView::tr("System Memory") <<
+	MemSpySwmtView::tr("Windows Groups");
+	
+MemSpySwmtView::MemSpySwmtView(EngineWrapper &engine, ViewManager &viewManager) : 
+	MemSpyView(engine, viewManager), 
+	mToggleTimerAction(0),
+	mCategoriesItem(0),
+	mProgressDialog(0)
+{
+}
+
+MemSpySwmtView::~MemSpySwmtView()
+{
+}
+
+void MemSpySwmtView::initialize(const QVariantMap& params)
+{
+	setTitle(tr("SWMT"));
+	
+	MemSpyView::initialize(params);
+}
+
+HbToolBar* MemSpySwmtView::createToolBar()
+{
+	HbToolBar* toolBar = new HbToolBar();
+	mToggleTimerAction = toolBar->addAction("", this, SLOT(toggleTimer()));
+	toolBar->addAction(tr("Dump Now"), this, SLOT(forceDump()));
+	
+	updateTimerAction(mEngine.isSwmtRunning());
+	
+	return toolBar;
+}
+
+HbWidget* MemSpySwmtView::createCentralWidget()
+{
+	mModel = new HbDataFormModel(this);
+	
+	mTimerItem = mModel->appendDataFormItem(
+			HbDataFormModelItem::TextItem, tr("Timer (sec.)"));
+	mTimerItem->setContentWidgetData("maxLength", 2);
+	mTimerItem->setContentWidgetData("text", mEngine.settings().swmtTimerPeriod());
+	
+	mModeItem = mModel->appendDataFormItem(
+			HbDataFormModelItem::ComboBoxItem, tr("Tracking mode"));
+	mModeItem->setContentWidgetData("items", MODE_ITEMS);
+	mModeItem->setContentWidgetData("currentIndex", mEngine.settings().swmtMode());
+	
+	modeChanged(mEngine.settings().swmtMode());
+	
+	HbDataForm* form = new HbDataForm(this);
+	form->setModel(mModel);
+	
+	form->addConnection(mModeItem, SIGNAL(currentIndexChanged(int)), this, SLOT(modeChanged(int)));
+	
+	return form;
+}
+
+void MemSpySwmtView::updateTimerAction(bool isRunning)
+{
+	mToggleTimerAction->setText(isRunning ? tr("Stop Timer") : tr("Start Timer"));
+}
+
+void MemSpySwmtView::toggleTimer()
+{
+	bool wasRunning = mEngine.isSwmtRunning();
+	if (wasRunning)
+		mEngine.stopSwmt();
+	else
+	{
+		updateSettings();
+		mEngine.startSwmt(qBound(5, mTimerItem->contentWidgetData("text").toInt(), 60));
+	}
+	
+	updateTimerAction(!wasRunning);
+}
+
+void MemSpySwmtView::forceDump()
+{
+	updateSettings();
+	mEngine.updateOutputSettings();
+		
+	MemSpySwmtDumpTracker* tracker = mEngine.createSwmtDumpTracker();
+	connect(tracker, SIGNAL(finished(int)), this, SLOT(asyncOperationFinished(int)));
+	
+	mProgressDialog = new HbProgressDialog(HbProgressDialog::WaitDialog);
+	mProgressDialog->setText(tr("Please wait..."));
+	mProgressDialog->show();
+	
+	tracker->start();
+}
+
+void MemSpySwmtView::updateSettings()
+{
+	mEngine.settings().setSwmtTimerPeriod(mTimerItem->contentWidgetData("text").toInt());
+	mEngine.settings().setSwmtMode(static_cast<SwmtMode>(
+			mModeItem->contentWidgetData("currentIndex").toInt()));
+	if (mCategoriesItem)
+		mEngine.settings().setSwmtCategories(mCategoriesItem->contentWidgetData("selectedItems").toList());
+	
+	mEngine.setSwmtSettings(static_cast<SwmtMode>(mEngine.settings().swmtMode()), 
+		mEngine.settings().swmtCategories());
+}
+
+void MemSpySwmtView::modeChanged(int mode)
+{
+	if (mode != SwmtModeCustom && mCategoriesItem)
+		removeCategoriesItem();
+	else if (mode == SwmtModeCustom && !mCategoriesItem)
+		createCategoriesItem();
+}
+
+void MemSpySwmtView::asyncOperationFinished(int errorCode)
+{
+	Q_UNUSED(errorCode);
+		
+	mProgressDialog->hide();
+	delete mProgressDialog;
+	mProgressDialog = 0;
+	
+	delete sender();
+}
+
+void MemSpySwmtView::createCategoriesItem()
+{
+	mCategoriesItem = mModel->appendDataFormItem(
+			HbDataFormModelItem::MultiselectionItem, tr("Categories"));
+	mCategoriesItem->setContentWidgetData("items", CATEGORIES_ITEMS);
+	mCategoriesItem->setContentWidgetData("selectedItems", mEngine.settings().swmtCategories());
+}
+
+void MemSpySwmtView::removeCategoriesItem()
+{
+	mModel->removeItem(mCategoriesItem);
+	mCategoriesItem = 0;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/memspyui/ui/hb/src/memspythreaddetailindexview.cpp	Thu Jul 22 16:33:59 2010 +0100
@@ -0,0 +1,131 @@
+/*
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description:
+ *  
+ */
+
+#include <QAction>
+#include <QStringListModel>
+#include <HbMenu>
+
+#include "memspythreaddetailindexview.h"
+#include "viewmanager.cpp"
+
+void MemSpyThreadDetailIndexView::initialize(const QVariantMap& params)
+{
+	setTitle(tr("Details"));
+	
+	mProcessName = params["pname"].toString();
+	mThreadName = params["tname"].toString();
+	
+	MemSpyView::initialize(params);
+	
+	mThreadId = qVariantValue<ThreadId>(params["tid"]);
+	
+	QStringList lines = QStringList() << tr("General") << tr("Heap") << tr("Stack") 
+			<< tr("Chunks") << tr("Code Segments") << tr("Open Files") << tr("Active Objects")
+			<< tr("Handles to other Threads") << tr("Handles to other Processes") 
+			<< tr("Servers Running in Thread") << tr("Client <-> Server connections")
+			<< tr("Semaphores") << tr("References this Thread") << tr("References this Process")
+			<< tr("Mutexes") << tr("Timers") << tr("Logical DD Channels") 
+			<< tr("Change Notifiers") << tr("Undertakers") << tr("Logical Device Drivers")
+			<< tr("Physical Device Drivers");
+	
+	mListView.setModel(new QStringListModel(lines, this));
+	
+	connect(&mListView, SIGNAL(activated(QModelIndex)), this, SLOT(itemClicked(QModelIndex)));
+}
+
+HbMenu* MemSpyThreadDetailIndexView::createToolMenu()
+{
+	HbMenu* menu = new HbMenu(tr("Thread"));
+	mPriorityMenu = menu->addMenu("Change Priority");
+	
+	mPriorityMenu->addAction(tr("Abs. Very Low"), this, SLOT(changePriority()));
+	mPriorityMenu->addAction(tr("Abs. Low Normal"), this, SLOT(changePriority()));
+	mPriorityMenu->addAction(tr("Abs. Low"), this, SLOT(changePriority()));
+	mPriorityMenu->addAction(tr("Abs. Background Normal"), this, SLOT(changePriority()));
+	mPriorityMenu->addAction(tr("Abs. Background"), this, SLOT(changePriority()));
+	mPriorityMenu->addAction(tr("Abs. Foreground Normal"), this, SLOT(changePriority()));
+	mPriorityMenu->addAction(tr("Abs. Foreground"), this, SLOT(changePriority()));
+	mPriorityMenu->addAction(tr("Abs. High Normal"), this, SLOT(changePriority()));
+	mPriorityMenu->addAction(tr("Abs. High"), this, SLOT(changePriority()));
+	mPriorityMenu->addAction(tr("Abs. Real Time 1"), this, SLOT(changePriority()));
+	mPriorityMenu->addAction(tr("Abs. Real Time 2"), this, SLOT(changePriority()));
+	mPriorityMenu->addAction(tr("Abs. Real Time 3"), this, SLOT(changePriority()));
+	mPriorityMenu->addAction(tr("Abs. Real Time 4"), this, SLOT(changePriority()));
+	mPriorityMenu->addAction(tr("Abs. Real Time 5"), this, SLOT(changePriority()));
+	mPriorityMenu->addAction(tr("Abs. Real Time 6"), this, SLOT(changePriority()));
+	mPriorityMenu->addAction(tr("Abs. Real Time 7"), this, SLOT(changePriority()));
+	mPriorityMenu->addAction(tr("Abs. Real Time 8"), this, SLOT(changePriority()));
+	
+	return menu;
+}
+
+bool MemSpyThreadDetailIndexView::isBreadCrumbVisible() const
+{
+    return true;
+}
+
+QString MemSpyThreadDetailIndexView::getBreadCrumbText() const
+{
+    return tr("Processes > %1 > Threads > %2").arg(mProcessName).arg(mThreadName);
+}
+
+void MemSpyThreadDetailIndexView::changePriority()
+{
+	QAction *s = qobject_cast<QAction*>(sender());
+	int index = mPriorityMenu->actions().indexOf(s);
+	
+	ThreadPriority priorities[] = {
+		ThreadPriorityAbsoluteVeryLow,
+		ThreadPriorityAbsoluteLowNormal,
+		ThreadPriorityAbsoluteLow,
+		ThreadPriorityAbsoluteBackgroundNormal,
+		ThreadPriorityAbsoluteBackground,
+		ThreadPriorityAbsoluteForegroundNormal,
+		ThreadPriorityAbsoluteForeground,
+		ThreadPriorityAbsoluteHighNormal,
+		ThreadPriorityAbsoluteHigh,
+		ThreadPriorityAbsoluteRealTime1,
+		ThreadPriorityAbsoluteRealTime2,
+		ThreadPriorityAbsoluteRealTime3,
+		ThreadPriorityAbsoluteRealTime4,
+		ThreadPriorityAbsoluteRealTime5,
+		ThreadPriorityAbsoluteRealTime6,
+		ThreadPriorityAbsoluteRealTime7, 
+		ThreadPriorityAbsoluteRealTime8 };
+	
+	mEngine.setThreadPriority(mThreadId, priorities[index]);
+}
+
+void MemSpyThreadDetailIndexView::itemClicked(const QModelIndex& index)
+{
+	ThreadInfoType types[] = { ThreadInfoTypeGeneral, ThreadInfoTypeHeap, 
+			ThreadInfoTypeStack, ThreadInfoTypeChunk, ThreadInfoTypeCodeSeg, 
+			ThreadInfoTypeOpenFiles, ThreadInfoTypeActiveObjects, ThreadInfoTypeOwnedThreadHandles,
+			ThreadInfoTypeOwnedProcessHandles, ThreadInfoTypeServer, ThreadInfoTypeSession, 
+			ThreadInfoTypeSemaphore, ThreadInfoTypeOtherThreads, ThreadInfoTypeOtherProcesses,
+			ThreadInfoTypeMutex, ThreadInfoTypeTimer, ThreadInfoTypeChannel,
+			ThreadInfoTypeChangeNotifier, ThreadInfoTypeUndertaker,
+			ThreadInfoTypeLDD, ThreadInfoTypePDD };
+	
+	QVariantMap map;
+	map.insert("tid", mThreadId);
+	map.insert("type", types[index.row()]);
+	map.insert("pname", mProcessName);
+	map.insert("tname", mThreadName);
+	mViewManager.showView(ThreadDetailView, map);
+}
+
--- a/memspyui/ui/hb/src/memspythreaddetailview.cpp	Fri Jun 11 16:29:34 2010 +0100
+++ b/memspyui/ui/hb/src/memspythreaddetailview.cpp	Thu Jul 22 16:33:59 2010 +0100
@@ -21,76 +21,90 @@
 
 #include "memspythreaddetailview.h"
 
-void MemSpyThreadDetailView::initialize(const QVariantMap& params)
+MemSpyThreadDetailModel::MemSpyThreadDetailModel(EngineWrapper &engine, ThreadId threadId, ThreadInfoType type, QObject *parent) :
+	QAbstractListModel(parent),
+	mThreadInfo(engine.getThreadInfo(threadId, type))
 {
-	MemSpyView::initialize(params);
+}
+
+MemSpyThreadDetailModel::~MemSpyThreadDetailModel()
+{
+	qDeleteAll(mThreadInfo);
+}
 	
-	setTitle(tr("Thread Details"));
-	
-	mThreadId = qVariantValue<ThreadId>(params["tid"]);
+int MemSpyThreadDetailModel::rowCount(const QModelIndex &parent) const
+{
+	Q_UNUSED(parent);
+	return qMax(mThreadInfo.count(), 1);
+}
 	
-	QStringList lines = QStringList() << tr("General") << tr("Heap") << tr("Stack") 
-			<< tr("Chunks") << tr("Code Segments") << tr("Open Files") << tr("Active Objects")
-			<< tr("Handles to other Threads") << tr("Handles to other Processes") 
-			<< tr("Servers Running in Thread") << tr("Client <-> Server connections")
-			<< tr("Semaphores") << tr("References this Thread") << tr("References this Process")
-			<< tr("Mutexes") << tr("Timers") << tr("Logical DD Channels") 
-			<< tr("Change Notifiers") << tr("Undertakers") << tr("Logical Device Drivers")
-			<< tr("Physical Device Drivers") << tr("Memory Tracking");
+QVariant MemSpyThreadDetailModel::data(const QModelIndex &index, int role) const
+{
+	if (role == Qt::DisplayRole) {
+	    
+	    if (mThreadInfo.count()) {
+            QStringList lines;
+            lines << mThreadInfo.at(index.row())->caption();
+            lines << mThreadInfo.at(index.row())->value();
+            return lines;
+	    }
+	    
+	    return tr("(no items found)");
+	}
 	
-	mListView.setModel(new QStringListModel(lines, this));
+	if (role == Qt::TextAlignmentRole && mThreadInfo.count() == 0) {
+	    
+	    return Qt::AlignHCenter;
+	}
+	
+	return QVariant();
 }
 
-HbMenu* MemSpyThreadDetailView::createToolMenu()
+void MemSpyThreadDetailView::initialize(const QVariantMap& params)
 {
-	HbMenu* menu = new HbMenu(tr("Thread"));
-	mPriorityMenu = menu->addMenu("Change Priority");
-	
-	mPriorityMenu->addAction(tr("Abs. Very Low"), this, SLOT(changePriority()));
-	mPriorityMenu->addAction(tr("Abs. Low Normal"), this, SLOT(changePriority()));
-	mPriorityMenu->addAction(tr("Abs. Low"), this, SLOT(changePriority()));
-	mPriorityMenu->addAction(tr("Abs. Background Normal"), this, SLOT(changePriority()));
-	mPriorityMenu->addAction(tr("Abs. Background"), this, SLOT(changePriority()));
-	mPriorityMenu->addAction(tr("Abs. Foreground Normal"), this, SLOT(changePriority()));
-	mPriorityMenu->addAction(tr("Abs. Foreground"), this, SLOT(changePriority()));
-	mPriorityMenu->addAction(tr("Abs. High Normal"), this, SLOT(changePriority()));
-	mPriorityMenu->addAction(tr("Abs. High"), this, SLOT(changePriority()));
-	mPriorityMenu->addAction(tr("Abs. Real Time 1"), this, SLOT(changePriority()));
-	mPriorityMenu->addAction(tr("Abs. Real Time 2"), this, SLOT(changePriority()));
-	mPriorityMenu->addAction(tr("Abs. Real Time 3"), this, SLOT(changePriority()));
-	mPriorityMenu->addAction(tr("Abs. Real Time 4"), this, SLOT(changePriority()));
-	mPriorityMenu->addAction(tr("Abs. Real Time 5"), this, SLOT(changePriority()));
-	mPriorityMenu->addAction(tr("Abs. Real Time 6"), this, SLOT(changePriority()));
-	mPriorityMenu->addAction(tr("Abs. Real Time 7"), this, SLOT(changePriority()));
-	mPriorityMenu->addAction(tr("Abs. Real Time 8"), this, SLOT(changePriority()));
-	
-	return menu;
-}
+    mProcessName = params["pname"].toString();
+    mThreadName = params["tname"].toString();
+    
+    // TODO: Remove duplicates with memspythreaddetailindexview
+    QMap<int, QString> titleMap;
+    titleMap[ThreadInfoTypeGeneral] = tr("General");
+    titleMap[ThreadInfoTypeHeap] = tr("Heap");
+    titleMap[ThreadInfoTypeStack] = tr("Stack");
+    titleMap[ThreadInfoTypeChunk] = tr("Chunks");
+    titleMap[ThreadInfoTypeCodeSeg] = tr("Code Segments"); 
+    titleMap[ThreadInfoTypeOpenFiles] = tr("Open Files");
+    titleMap[ThreadInfoTypeActiveObjects] = tr("Active Objects");
+    titleMap[ThreadInfoTypeOwnedThreadHandles] = tr("Handles to other Threads");
+    titleMap[ThreadInfoTypeOwnedProcessHandles] = tr("Handles to other Processes");
+    titleMap[ThreadInfoTypeServer] = tr("Servers Running in Thread");
+    titleMap[ThreadInfoTypeSession] = tr("Client <-> Server connections");
+    titleMap[ThreadInfoTypeSemaphore] = tr("Semaphores");
+    titleMap[ThreadInfoTypeOtherThreads] = tr("References this Thread");
+    titleMap[ThreadInfoTypeOtherProcesses] = tr("References this Process");
+    titleMap[ThreadInfoTypeMutex] = tr("Mutexes");
+    titleMap[ThreadInfoTypeTimer] = tr("Timers");
+    titleMap[ThreadInfoTypeChannel] = tr("Logical DD Channels");
+    titleMap[ThreadInfoTypeChangeNotifier] = tr("Change Notifiers"); 
+    titleMap[ThreadInfoTypeUndertaker] = tr("Undertakers");
+    titleMap[ThreadInfoTypeLDD] = tr("Logical Device Drivers");
+    titleMap[ThreadInfoTypePDD] = tr("Physical Device Drivers");
+    
+    setTitle(titleMap.value(params["type"].toInt()));
+    
+	MemSpyView::initialize(params);
 	
-void MemSpyThreadDetailView::changePriority()
-{
-	QAction *s = qobject_cast<QAction*>(sender());
-	int index = mPriorityMenu->actions().indexOf(s);
+	ThreadId threadId = qVariantValue<ThreadId>(params["tid"]);
+	ThreadInfoType type = static_cast<ThreadInfoType>(qVariantValue<int>(params["type"]));
 	
-	ThreadPriority priorities[] = {
-		ThreadPriorityAbsoluteVeryLow,
-		ThreadPriorityAbsoluteLowNormal,
-		ThreadPriorityAbsoluteLow,
-		ThreadPriorityAbsoluteBackgroundNormal,
-		ThreadPriorityAbsoluteBackground,
-		ThreadPriorityAbsoluteForegroundNormal,
-		ThreadPriorityAbsoluteForeground,
-		ThreadPriorityAbsoluteHighNormal,
-		ThreadPriorityAbsoluteHigh,
-		ThreadPriorityAbsoluteRealTime1,
-		ThreadPriorityAbsoluteRealTime2,
-		ThreadPriorityAbsoluteRealTime3,
-		ThreadPriorityAbsoluteRealTime4,
-		ThreadPriorityAbsoluteRealTime5,
-		ThreadPriorityAbsoluteRealTime6,
-		ThreadPriorityAbsoluteRealTime7, 
-		ThreadPriorityAbsoluteRealTime8 };
-	
-	mEngine.setThreadPriority(mThreadId, priorities[index]);
+	mListView.setModel(new MemSpyThreadDetailModel(mEngine, threadId, type, this));
 }
 
+bool MemSpyThreadDetailView::isBreadCrumbVisible() const
+{
+    return true;
+}
+
+QString MemSpyThreadDetailView::getBreadCrumbText() const
+{
+    return tr("Processes > %1 > Threads > %2").arg(mProcessName).arg(mThreadName);
+}
--- a/memspyui/ui/hb/src/memspythreadview.cpp	Fri Jun 11 16:29:34 2010 +0100
+++ b/memspyui/ui/hb/src/memspythreadview.cpp	Thu Jul 22 16:33:59 2010 +0100
@@ -22,9 +22,11 @@
 #include "memspythreadview.h"
 #include "viewmanager.h"
 
-MemSpyThreadModel::MemSpyThreadModel(EngineWrapper &engine, ProcessId threadId, QObject *parent) :
+MemSpyThreadModel::MemSpyThreadModel(EngineWrapper &engine, ProcessId processId, QObject *parent) :
 	QAbstractListModel(parent),
-	mThreads(engine.getThreads(threadId))
+	mProcessId(processId),
+	mEngine(engine),
+	mThreads(engine.getThreads(processId))
 {
 	mPriorityMap.insert(ThreadPriorityNull, tr("[Null]"));
 	mPriorityMap.insert(ThreadPriorityMuchLess, tr("[Much Less]"));
@@ -78,11 +80,21 @@
 	return QVariant();
 }
 
+void MemSpyThreadModel::refresh()
+{
+    beginResetModel();
+    QList<MemSpyThread*> data = mEngine.getThreads(mProcessId);
+    qDeleteAll(mThreads);
+    mThreads = data;
+    endResetModel();
+}
+
 MemSpyThreadView::MemSpyThreadView(EngineWrapper &engine, ViewManager &viewManager) : 
-	MemSpyView(engine, viewManager), 
+	MemSpyListView(engine, viewManager), 
 	mContextMenu(0), 
 	mPriorityMenu(0),
-	mThreadId(0)
+	mThreadId(0),
+	mModel(0)
 {
 }
 
@@ -94,13 +106,15 @@
 
 void MemSpyThreadView::initialize(const QVariantMap& params)
 {
+	ProcessId pid = qVariantValue<ProcessId>(params["pid"]);
+	setTitle(tr("Threads"));
+	
+	mProcessName = params["pname"].toString();
+	
 	MemSpyView::initialize(params);
 	
-	ProcessId pid = qVariantValue<ProcessId>(params["pid"]);
-	setTitle(tr("Threads").arg(pid));
-	
-	mListView.setModel(new MemSpyThreadModel(mEngine, pid, this));
-	mListView.setLongPressEnabled(true);
+	mModel = new MemSpyThreadModel(mEngine, pid, this);
+	mListView.setModel(mModel);
 	
 	connect(&mListView, SIGNAL(activated(QModelIndex)), this, SLOT(itemClicked(QModelIndex)));
 	connect(&mListView, SIGNAL(longPressed(HbAbstractViewItem*,QPointF)),
@@ -128,16 +142,30 @@
 	mPriorityMenu->addAction(tr("Abs. Real Time 8"), this, SLOT(changePriority()));
 }
 
+
+bool MemSpyThreadView::isBreadCrumbVisible() const
+{
+    return true;
+}
+
+QString MemSpyThreadView::getBreadCrumbText() const
+{
+    return tr("Processes > %1").arg(mProcessName);
+}
+
 void MemSpyThreadView::itemClicked(const QModelIndex& index)
 {
 	QVariantMap map;
 	map["tid"] = index.data(Qt::UserRole);
-	mViewManager.showView(ThreadDetailView, map);
+	map.insert("pname", mProcessName);
+	map.insert("tname", index.data(Qt::DisplayRole).toStringList().at(0));
+	
+	mViewManager.showView(ThreadDetailIndexView, map);
 }
 
 void MemSpyThreadView::catchLongPress(HbAbstractViewItem *item, const QPointF &coords)
 {
-	mThreadId = qVariantValue<ThreadId>(item->data(Qt::UserRole));
+	mThreadId = qVariantValue<ThreadId>(item->modelIndex().data(Qt::UserRole));
 	mContextMenu->setPreferredPos(coords);
 	mContextMenu->open();
 }
@@ -167,4 +195,10 @@
 		ThreadPriorityAbsoluteRealTime8 };
 	
 	mEngine.setThreadPriority(mThreadId, priorities[index]);
+	refresh();
 }
+
+void MemSpyThreadView::refresh()
+{ 
+    mModel->refresh(); 
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/memspyui/ui/hb/src/memspytrackingview.cpp	Thu Jul 22 16:33:59 2010 +0100
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description:
+ *  
+ */
+
+#include "memspytrackingview.h"
+#include "viewmanager.h"
+
+#include <QStringListModel>
+#include <QDebug>
+
+void MemSpyTrackingView::initialize(const QVariantMap& params)
+{
+	setTitle("MemSpy");
+	
+	MemSpyView::initialize(params);
+	
+	QStringList items = QStringList() 
+			<< tr("System Wide Memory Tracking")
+			<< tr("Heap Dumps");
+	mListView.setModel(new QStringListModel(items, this));
+    
+	QObject::connect(&mListView, SIGNAL(released(QModelIndex)), this, SLOT(itemClicked(QModelIndex)));
+}
+
+void MemSpyTrackingView::itemClicked(const QModelIndex& index)
+{
+	Q_UNUSED(index);
+	ViewIndex indexes[] = { SwmtView, HeapDumpsView };
+    mViewManager.showView(indexes[index.row()]);
+}
+
+bool MemSpyTrackingView::isBreadCrumbVisible() const
+{
+	return false;
+}
+
--- a/memspyui/ui/hb/src/memspyview.cpp	Fri Jun 11 16:29:34 2010 +0100
+++ b/memspyui/ui/hb/src/memspyview.cpp	Thu Jul 22 16:33:59 2010 +0100
@@ -15,14 +15,21 @@
 * 
 */
 
+#include <QSignalMapper>
+#include <QGraphicsLinearLayout>
+#include <QDebug>
 #include <HbMenu>
+#include <HbAction>
 #include <HbToolBar>
 #include <HbApplication>
 #include <HbMessageBox>
+#include <HbMainWindow>
 #include <HbLabel>
 
 #include "memspyview.h"
+#include "enginewrapper.h"
 
+#include "memspysettingsview.h"
 
 MemSpyView::MemSpyView(EngineWrapper &engine, ViewManager &viewManager) : 
 	HbView(),
@@ -32,13 +39,14 @@
 	mOutputGenInfoMenu(0), 
 	mOutputHeapInfoMenu(0),
 	mOutputStackInfoMenu(0),
-	mToolBar(0)
+	mToolBar(0),
+	mBreadCrumb(0)
 {
-	setWidget(&mListView);
 }
 
 MemSpyView::~MemSpyView()
 {
+	delete mBreadCrumb;
 	delete mToolBar;
 	delete mOutputStackInfoMenu;
 	delete mOutputHeapInfoMenu;
@@ -48,32 +56,29 @@
 
 void MemSpyView::initialize(const QVariantMap& params)
 {
+	Q_UNUSED(params);
+	QGraphicsLinearLayout *layout = new QGraphicsLinearLayout(Qt::Vertical, this);
+	
+	if (isBreadCrumbVisible()) {
+		mBreadCrumb = new HbLabel(this);
+		mBreadCrumb->setTextWrapping(Hb::TextWordWrap);
+		mBreadCrumb->setElideMode(Qt::ElideLeft);
+		mBreadCrumb->setPlainText(getBreadCrumbText());
+		HbFontSpec spec(HbFontSpec::PrimarySmall);
+		mBreadCrumb->setFontSpec(spec);
+		layout->addItem(mBreadCrumb);
+	}
+	layout->addItem(createCentralWidget());
+	setLayout(layout); 
+	
 	if (isRefreshable())
-		menu()->addAction(tr("Refresh"));
+		menu()->addAction(tr("Refresh"), this, SLOT(refresh()));
 	
 	HbMenu* toolMenu = createToolMenu();
 	if (toolMenu)
 		menu()->addMenu(toolMenu);
 	
-	mOutputMenu = menu()->addMenu(tr("Output"));
-	mOutputMenu->addActions(createOutputActions());
-	mOutputGenInfoMenu = mOutputMenu->addMenu(tr("General Info"));
-	mOutputHeapInfoMenu = mOutputMenu->addMenu(tr("Heap Info"));
-	mOutputStackInfoMenu = mOutputMenu->addMenu(tr("Stack Info"));
-	mOutputGenInfoMenu->addAction(tr("Summary"));
-	mOutputGenInfoMenu->addAction(tr("Detailed Info"));
-	mOutputGenInfoMenu->addAction(tr("Handle Info"));
-	mOutputGenInfoMenu->addAction(tr("Kernel Containters"));
-	mOutputHeapInfoMenu->addAction(tr("Detailed Summary"));
-	mOutputHeapInfoMenu->addAction(tr("Compact Summary"));
-	mOutputHeapInfoMenu->addAction(tr("Cell Listing"));
-	mOutputHeapInfoMenu->addAction(tr("Data (Binary)"));
-	mOutputStackInfoMenu->addAction(tr("Detailed Summary"));
-	mOutputStackInfoMenu->addAction(tr("Compact Summary"));
-	mOutputStackInfoMenu->addAction(tr("User Stacks (Binary)"));
-	mOutputStackInfoMenu->addAction(tr("Kernel Stacks (Binary)"));
-	menu()->addAction(tr("Start Auto Capture"));
-	menu()->addAction(tr("Settings ..."));
+	menu()->addAction(tr("Settings ..."), this, SLOT(showSettings()));
 	menu()->addAction(tr("About ..."), this, SLOT(showAbout()));
 	menu()->addAction(tr("Exit"), qApp, SLOT(quit()));
 	
@@ -102,18 +107,51 @@
 	return false;
 }
 
+bool MemSpyView::isBreadCrumbVisible() const
+{
+    return false;
+}
+
+QString MemSpyView::getBreadCrumbText() const
+{
+	QStringList views;
+	for (int i=1; i<mainWindow()->views().count() - 1; i++)	{
+		const HbView *view = mainWindow()->views().at(i);
+		if (view == this)
+			break;
+		views.append(view->title());
+	}
+	views.append(title());
+	
+	return views.join(" > ");
+}
+
 void MemSpyView::refresh()
 {
 	// Empty default implementation
 }
 
+void MemSpyView::showSettings()
+{
+	MemSpySettingsView* settings = new MemSpySettingsView(mEngine);
+	connect(settings, SIGNAL(finished(bool)), this, SLOT(closeSettings()));
+	mainWindow()->addView(settings);
+	mainWindow()->setCurrentView(settings);
+}
+
 void MemSpyView::showAbout()
 {
 	HbMessageBox *messageBox = new HbMessageBox(HbMessageBox::MessageTypeInformation);
-	messageBox->setText("Version 2.0.0 - 23th April 2010. Copyright © 2010 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. Licensed under Eclipse Public License v1.0.");
+	messageBox->setText("Version 2.1.0 - 15th June 2010. Copyright © 2010 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. Licensed under Eclipse Public License v1.0.");
 	HbLabel *header = new HbLabel("About MemSpy", messageBox);
 	messageBox->setHeadingWidget(header);
 	messageBox->setAttribute(Qt::WA_DeleteOnClose);
 	messageBox->setTimeout(HbPopup::NoTimeout);
 	messageBox->open();
 }
+
+void MemSpyView::closeSettings()
+{
+	sender()->deleteLater();
+	mainWindow()->setCurrentView(this);
+}
--- a/memspyui/ui/hb/src/viewmanager.cpp	Fri Jun 11 16:29:34 2010 +0100
+++ b/memspyui/ui/hb/src/viewmanager.cpp	Thu Jul 22 16:33:59 2010 +0100
@@ -17,6 +17,8 @@
 
 #include <HbMainWindow>
 #include <HbAction>
+#include <HbMessageBox>
+#include <HbLabel>
 
 #include "viewmanager.h"
 
@@ -25,10 +27,14 @@
 #include "memspymainview.h"
 #include "memspyprocessview.h"
 #include "memspythreadview.h"
+#include "memspythreaddetailindexview.h"
 #include "memspythreaddetailview.h"
 #include "memspykernelobjecttypeview.h"
 #include "memspykernelobjectview.h"
 #include "memspykernelobjectdetailview.h"
+#include "memspytrackingview.h"
+#include "memspyswmtview.h"
+#include "memspyheapdumpsview.h"
 
 template <typename T>
 static MemSpyView* factory(EngineWrapper &engine, ViewManager &viewManager)
@@ -40,10 +46,14 @@
 	&factory<MemSpyMainView>,
 	&factory<MemSpyProcessView>,
 	&factory<MemSpyThreadView>,
+	&factory<MemSpyThreadDetailIndexView>,
 	&factory<MemSpyThreadDetailView>,
 	&factory<MemSpyKernelObjectTypeView>,
 	&factory<MemSpyKernelObjectView>,
-	&factory<MemSpyKernelObjectDetailView>
+	&factory<MemSpyKernelObjectDetailView>,
+	&factory<MemSpyTrackingView>,
+	&factory<MemSpySwmtView>,
+	&factory<MemSpyHeapDumpsView>
 };
 
 
@@ -57,8 +67,30 @@
 
 void ViewManager::showView(ViewIndex viewIndex, const QVariantMap &params)
 {
-	MemSpyView* view = sFactories[viewIndex](mEngine, *this);
-	view->initialize(params);
+    MemSpyView* view;
+    try {
+        view = sFactories[viewIndex](mEngine, *this);
+        view->initialize(params);
+    }
+    catch (std::exception& ex)
+    {
+        // show message box with exception
+        // TODO: qt_symbian_exception2Error shouldn't probably be here
+        QString error = tr("An error occured during the operation. Error code: %1").arg(
+                qt_symbian_exception2Error(ex));
+        
+        HbMessageBox *messageBox = new HbMessageBox(HbMessageBox::MessageTypeWarning);
+        messageBox->setText(error);
+        HbLabel *header = new HbLabel(tr("Error"), messageBox);
+        messageBox->setHeadingWidget(header);
+        messageBox->setAttribute(Qt::WA_DeleteOnClose);
+        messageBox->setTimeout(HbPopup::StandardTimeout);
+        messageBox->open();
+        
+        delete view;
+        return;
+    }
+    
 	if (viewIndex != MainView) {
 		HbAction* action = new HbAction(Hb::BackNaviAction, this);
 		connect(action, SIGNAL(triggered()), this, SLOT(goBack()));
--- a/perfmon/group/ReleaseNotes_PerfMon.txt	Fri Jun 11 16:29:34 2010 +0100
+++ b/perfmon/group/ReleaseNotes_PerfMon.txt	Thu Jul 22 16:33:59 2010 +0100
@@ -1,9 +1,9 @@
 ===============================================================================
 
-RELEASE NOTES - PERFORMANCE MONITOR v1.0.0
-RELEASED 6th March 2008 
+RELEASE NOTES - PERFORMANCE MONITOR v1.1.1
+RELEASED 21st May 2010 
 
-SUPPORTS S60 3.0+
+SUPPORTS S60 5.2+
 
 ===============================================================================
 
@@ -26,9 +26,10 @@
 
 ===============================================================================
 
-What's New in v1.0.0
+What's New in v1.1.1
 ====================
-- Initial version
+- Improved Orbit UI
+- Error corrections
 
 ===============================================================================
 
--- a/perfmon/ui/hb/app/app.pro	Fri Jun 11 16:29:34 2010 +0100
+++ b/perfmon/ui/hb/app/app.pro	Thu Jul 22 16:33:59 2010 +0100
@@ -46,13 +46,20 @@
 RESOURCES +=
 
 symbian: {
+    INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE 
     INCLUDEPATH += ../../../engine/inc
     HEADERS += ../../../engine/inc/perfmon_engine.h
 
     SOURCES += ../../../engine/src/perfmon_engine.cpp
 
     LIBS += -lestor \
-        -lbafl
+        -lbafl \
+        -lefsrv \
+        -lavkon \
+        -lapparc \
+        -lapgrfx \
+        -lgdi \
+        -lcone
 
     TARGET.CAPABILITY = WriteDeviceData
 
--- a/perfmon/ui/hb/app/src/mainview.cpp	Fri Jun 11 16:29:34 2010 +0100
+++ b/perfmon/ui/hb/app/src/mainview.cpp	Thu Jul 22 16:33:59 2010 +0100
@@ -20,7 +20,7 @@
 #include <HbMenu>
 #include <HbToolBar>
 #include <HbAction>
-#include <HbMessagebox>
+#include <HbMessageBox>
 #include <HbLabel>
 
 #include "mainview.h"
@@ -128,7 +128,7 @@
 void MainView::showAbout()
 {
     HbMessageBox *messageBox = new HbMessageBox(HbMessageBox::MessageTypeInformation);
-    messageBox->setText("Version 1.1.0 - 15th March 2010. Copyright © 2010 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. Licensed under Eclipse Public License v1.0.");
+    messageBox->setText("Version 1.1.1 - 21st May 2010. Copyright © 2010 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. Licensed under Eclipse Public License v1.0.");
     HbLabel *header = new HbLabel("About PerfMon", messageBox);
     messageBox->setHeadingWidget(header);
     messageBox->setAttribute(Qt::WA_DeleteOnClose);
--- a/perfmon/ui/hb/app/src/valuedatacontainer.cpp	Fri Jun 11 16:29:34 2010 +0100
+++ b/perfmon/ui/hb/app/src/valuedatacontainer.cpp	Thu Jul 22 16:33:59 2010 +0100
@@ -42,7 +42,10 @@
     // set proper font and prepare font metrics for text height calculation
     painter->setFont(mFont);
 
-    painter->setPen(HbColorScheme::color("foreground"));
+    QColor col = HbColorScheme::color("qtc_textedit_normal");
+    if(col.isValid())
+        painter->setPen(col);
+    
     QFontMetricsF metrics(mFont);
 
     QList<SampleEntry> entries = engine().sampleEntries();
--- a/perfmon/ui/hb/datapopup/datapopup.pro	Fri Jun 11 16:29:34 2010 +0100
+++ b/perfmon/ui/hb/datapopup/datapopup.pro	Thu Jul 22 16:33:59 2010 +0100
@@ -32,6 +32,7 @@
 SOURCES += src/perfmondatapopupwidget.cpp
 
 symbian {
+		INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE
     TARGET.EPOCALLOWDLLDATA = 1
     TARGET.CAPABILITY = CAP_GENERAL_DLL
     TARGET.UID3 = 0x2002E6B0
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/piprofilerui/group/bld.inf	Thu Jul 22 16:33:59 2010 +0100
@@ -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	Thu Jul 22 16:33:59 2010 +0100
@@ -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	Thu Jul 22 16:33:59 2010 +0100
@@ -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	Thu Jul 22 16:33:59 2010 +0100
@@ -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	Thu Jul 22 16:33:59 2010 +0100
@@ -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	Thu Jul 22 16:33:59 2010 +0100
@@ -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	Thu Jul 22 16:33:59 2010 +0100
@@ -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	Thu Jul 22 16:33:59 2010 +0100
@@ -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	Thu Jul 22 16:33:59 2010 +0100
@@ -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	Thu Jul 22 16:33:59 2010 +0100
@@ -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	Thu Jul 22 16:33:59 2010 +0100
@@ -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	Thu Jul 22 16:33:59 2010 +0100
@@ -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	Thu Jul 22 16:33:59 2010 +0100
@@ -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	Thu Jul 22 16:33:59 2010 +0100
@@ -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	Thu Jul 22 16:33:59 2010 +0100
@@ -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	Thu Jul 22 16:33:59 2010 +0100
@@ -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	Thu Jul 22 16:33:59 2010 +0100
@@ -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	Thu Jul 22 16:33:59 2010 +0100
@@ -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	Thu Jul 22 16:33:59 2010 +0100
@@ -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	Thu Jul 22 16:33:59 2010 +0100
@@ -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	Thu Jul 22 16:33:59 2010 +0100
@@ -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	Thu Jul 22 16:33:59 2010 +0100
@@ -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	Thu Jul 22 16:33:59 2010 +0100
@@ -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	Thu Jul 22 16:33:59 2010 +0100
@@ -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	Thu Jul 22 16:33:59 2010 +0100
@@ -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	Thu Jul 22 16:33:59 2010 +0100
@@ -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	Thu Jul 22 16:33:59 2010 +0100
@@ -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	Thu Jul 22 16:33:59 2010 +0100
@@ -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	Thu Jul 22 16:33:59 2010 +0100
@@ -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	Thu Jul 22 16:33:59 2010 +0100
@@ -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	Thu Jul 22 16:33:59 2010 +0100
@@ -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	Thu Jul 22 16:33:59 2010 +0100
@@ -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	Thu Jul 22 16:33:59 2010 +0100
@@ -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	Thu Jul 22 16:33:59 2010 +0100
@@ -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	Thu Jul 22 16:33:59 2010 +0100
@@ -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	Thu Jul 22 16:33:59 2010 +0100
@@ -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	Thu Jul 22 16:33:59 2010 +0100
@@ -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	Thu Jul 22 16:33:59 2010 +0100
@@ -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	Thu Jul 22 16:33:59 2010 +0100
@@ -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 -lefsrv
+    
+    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	Thu Jul 22 16:33:59 2010 +0100
@@ -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	Thu Jul 22 16:33:59 2010 +0100
@@ -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	Thu Jul 22 16:33:59 2010 +0100
@@ -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	Thu Jul 22 16:33:59 2010 +0100
@@ -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	Thu Jul 22 16:33:59 2010 +0100
@@ -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	Thu Jul 22 16:33:59 2010 +0100
@@ -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	Thu Jul 22 16:33:59 2010 +0100
@@ -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	Thu Jul 22 16:33:59 2010 +0100
@@ -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	Thu Jul 22 16:33:59 2010 +0100
@@ -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	Thu Jul 22 16:33:59 2010 +0100
@@ -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	Thu Jul 22 16:33:59 2010 +0100
@@ -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	Thu Jul 22 16:33:59 2010 +0100
@@ -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	Thu Jul 22 16:33:59 2010 +0100
@@ -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	Thu Jul 22 16:33:59 2010 +0100
@@ -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	Thu Jul 22 16:33:59 2010 +0100
@@ -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	Thu Jul 22 16:33:59 2010 +0100
@@ -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	Thu Jul 22 16:33:59 2010 +0100
@@ -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	Thu Jul 22 16:33:59 2010 +0100
@@ -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	Thu Jul 22 16:33:59 2010 +0100
@@ -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	Thu Jul 22 16:33:59 2010 +0100
@@ -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	Thu Jul 22 16:33:59 2010 +0100
@@ -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	Thu Jul 22 16:33:59 2010 +0100
@@ -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/screengrabber/inc/enginewrapper.h	Fri Jun 11 16:29:34 2010 +0100
+++ b/screengrabber/inc/enginewrapper.h	Thu Jul 22 16:33:59 2010 +0100
@@ -18,7 +18,7 @@
 #ifndef ENGINEWRAPPER_H
 #define ENGINEWRAPPER_H
 
-#include <S32FILE.H>
+#include <s32file.h>
 #include <hbapplication.h>
 
 
--- a/screengrabber/inc/sgengine.h	Fri Jun 11 16:29:34 2010 +0100
+++ b/screengrabber/inc/sgengine.h	Thu Jul 22 16:33:59 2010 +0100
@@ -23,8 +23,8 @@
 #include <e32std.h>
 #include <e32base.h>
 #include <f32file.h>
-#include <W32STD.H>
-#include <MdaAudioTonePlayer.h> 
+#include <w32std.h>
+#include <mdaaudiotoneplayer.h> 
 #include <qsymbianevent.h>
 
 
--- a/screengrabber/screengrabber.pro	Fri Jun 11 16:29:34 2010 +0100
+++ b/screengrabber/screengrabber.pro	Thu Jul 22 16:33:59 2010 +0100
@@ -49,7 +49,7 @@
         
     BLD_INF_RULES.prj_extensions += screengrabber_buildstubsis_extension
         
-		LIBS += -lestor -lws32 -lPlatformEnv -limageconversion  -lapgrfx -lcommonengine  -lfbscli -lgdi -leikcore -lbafl
+		LIBS += -lestor -lws32 -lPlatformEnv -limageconversion  -lapgrfx -lcommonengine  -lfbscli -lgdi -leikcore -lbafl -lefsrv -lapparc -lcone
 
 		HEADERS += inc/sgengine.h \
    				   inc/enginewrapper.h \
--- a/screengrabber/src/enginewrapper.cpp	Fri Jun 11 16:29:34 2010 +0100
+++ b/screengrabber/src/enginewrapper.cpp	Thu Jul 22 16:33:59 2010 +0100
@@ -15,7 +15,7 @@
 *
 */
 #include <eikenv.h>
-#include <APGTASK.H>
+#include <apgtask.h>
 #include <hbdeviceprogressdialog.h>
 #include "enginewrapper.h"
 
--- a/screengrabber/src/gifanimator.cpp	Fri Jun 11 16:29:34 2010 +0100
+++ b/screengrabber/src/gifanimator.cpp	Thu Jul 22 16:33:59 2010 +0100
@@ -19,10 +19,10 @@
 
 #include "gifanimator.h"
 
-#include <S32FILE.H>
-#include <FBS.H>
-#include <GDI.H>
-#include <ImageConversion.h>
+#include <s32file.h>
+#include <fbs.h>
+#include <gdi.h>
+#include <imageconversion.h>
 #include "enginewrapper.h"
 
     
--- a/screengrabber/src/mainview.cpp	Fri Jun 11 16:29:34 2010 +0100
+++ b/screengrabber/src/mainview.cpp	Thu Jul 22 16:33:59 2010 +0100
@@ -25,7 +25,7 @@
 #include <hbmessagebox.h>
 #include <qgraphicslinearlayout.h>
 #include "enginewrapper.h"
-#include "settingsView.h"
+#include "settingsview.h"
 #include "mainview.h"
 #include "notifications.h"
 #include "hbtoolbar.h"
--- a/screengrabber/src/sgengine.cpp	Fri Jun 11 16:29:34 2010 +0100
+++ b/screengrabber/src/sgengine.cpp	Thu Jul 22 16:33:59 2010 +0100
@@ -15,13 +15,13 @@
 *
 */
 
-#include <S32FILE.H> 
-#include <BAUTILS.H>
-#include <PATHINFO.H>
-#include <APPARC.H> 
-#include <IMAGECONVERSION.H>
-#include <TEXTRESOLVER.H>
-#include <APGTASK.H> 
+#include <s32file.h> 
+#include <bautils.h>
+#include <pathinfo.h>
+#include <apparc.h> 
+#include <imageconversion.h>
+#include <textresolver.h>
+#include <apgtask.h> 
 
 #include <hblabel.h>
 #include <hbmessagebox.h>
--- a/stifui/avkon/group/ReleaseNote.txt	Fri Jun 11 16:29:34 2010 +0100
+++ b/stifui/avkon/group/ReleaseNote.txt	Thu Jul 22 16:33:59 2010 +0100
@@ -1,5 +1,5 @@
 ========================================================================
-RELEASE NOTE FOR STIF UI - STIF_201016 (7.3.31)
+RELEASE NOTE FOR STIF UI - STIF_201024 (7.3.35)
 SUPPORTING SERIES 60 3.0 ->
 ========================================================================
 
Binary file stifui/avkon/sis/Stifui_31.sis has changed
--- a/stifui/avkon/stifui/inc/AppUIApp.h	Fri Jun 11 16:29:34 2010 +0100
+++ b/stifui/avkon/stifui/inc/AppUIApp.h	Thu Jul 22 16:33:59 2010 +0100
@@ -54,5 +54,3 @@
 #endif
 
 // End of File
-
-// End of File
--- a/stifui/avkon/stifui/inc/AppUIDocument.h	Fri Jun 11 16:29:34 2010 +0100
+++ b/stifui/avkon/stifui/inc/AppUIDocument.h	Thu Jul 22 16:33:59 2010 +0100
@@ -69,5 +69,3 @@
 #endif
 
 // End of File
-
-// End of File
--- a/stifui/avkon/stifui/inc/MenuListBox.h	Fri Jun 11 16:29:34 2010 +0100
+++ b/stifui/avkon/stifui/inc/MenuListBox.h	Thu Jul 22 16:33:59 2010 +0100
@@ -73,3 +73,5 @@
     };
 
 #endif /*MENULISTBOX_H_*/
+
+// End of File
--- a/stifui/avkon/stifui/inc/Stifui.hrh	Fri Jun 11 16:29:34 2010 +0100
+++ b/stifui/avkon/stifui/inc/Stifui.hrh	Thu Jul 22 16:33:59 2010 +0100
@@ -109,4 +109,5 @@
     };
 
 #endif      // STIF_UI_HRH
+
 // End of File
--- a/stifui/avkon/stifui/inc/Stifui_loc.hrh	Fri Jun 11 16:29:34 2010 +0100
+++ b/stifui/avkon/stifui/inc/Stifui_loc.hrh	Thu Jul 22 16:33:59 2010 +0100
@@ -142,4 +142,3 @@
 #define qtn_testcase_state_unknown      "Undefined state!"
 
 // End of File
-
--- a/stifui/avkon/stifui/inc/TestSetMenuView.h	Fri Jun 11 16:29:34 2010 +0100
+++ b/stifui/avkon/stifui/inc/TestSetMenuView.h	Thu Jul 22 16:33:59 2010 +0100
@@ -164,4 +164,4 @@
 
 #endif // TESTSETMENUVIEW_H
 
-// End of File
\ No newline at end of file
+// End of File
--- a/stifui/avkon/stifui/inc/version.h	Fri Jun 11 16:29:34 2010 +0100
+++ b/stifui/avkon/stifui/inc/version.h	Thu Jul 22 16:33:59 2010 +0100
@@ -20,10 +20,12 @@
 
 #define STIFUI_MAJOR_VERSION 7
 #define STIFUI_MINOR_VERSION 3
-#define STIFUI_BUILD_VERSION 31
+#define STIFUI_BUILD_VERSION 35
 
-#define STIFUI_REL_DATE "20th Apr 2010"
+#define STIFUI_REL_DATE "15th June 2010"
 
 #define TO_UNICODE(text) _L(text) 
 
 #endif /*VERSION_H_*/
+
+// End of File
--- a/stifui/avkon/stifui/src/AppUIApp.cpp	Fri Jun 11 16:29:34 2010 +0100
+++ b/stifui/avkon/stifui/src/AppUIApp.cpp	Thu Jul 22 16:33:59 2010 +0100
@@ -67,5 +67,4 @@
 		return EikStart::RunApplication(NewApplication);
 		}
 
-
 // End of File
--- a/stifui/avkon/stifui/src/AppUIDocument.cpp	Fri Jun 11 16:29:34 2010 +0100
+++ b/stifui/avkon/stifui/src/AppUIDocument.cpp	Thu Jul 22 16:33:59 2010 +0100
@@ -59,4 +59,4 @@
     return new (ELeave) CAppUIAppUi;
     }
 
-// End of File  
+// End of File
--- a/stifui/avkon/stifui/src/CreatedTestSetMenuView.cpp	Fri Jun 11 16:29:34 2010 +0100
+++ b/stifui/avkon/stifui/src/CreatedTestSetMenuView.cpp	Thu Jul 22 16:33:59 2010 +0100
@@ -188,12 +188,10 @@
 		substracted.Set(substracted.Right(substracted.Length()-2));
 		// Creating new view containing 		
        	CTestSetMenuView* testSetMenu = (CTestSetMenuView*)AppUi()->View( TUid::Uid(ETestSetMenuViewId) ); 
-       	TInt	error = testSetMenu->LoadTestSetL( substracted );
-		AppUi()->HandleCommandL(ECmdGoToTestSetView);
-		
+       	User::LeaveIfError( testSetMenu->LoadTestSetL( substracted ) );
+		AppUi()->HandleCommandL(ECmdGoToTestSetView);		
         }
  
     }
 
-
 // End of File
--- a/stifui/avkon/stifui/src/MainMenuContainer.cpp	Fri Jun 11 16:29:34 2010 +0100
+++ b/stifui/avkon/stifui/src/MainMenuContainer.cpp	Thu Jul 22 16:33:59 2010 +0100
@@ -214,4 +214,4 @@
 	((CMenuListBox*)iListBox)->SaveFocusPosition();
 	}
 
-// End of File  
+// End of File
--- a/stifui/avkon/stifui/src/MainMenuView.cpp	Fri Jun 11 16:29:34 2010 +0100
+++ b/stifui/avkon/stifui/src/MainMenuView.cpp	Thu Jul 22 16:33:59 2010 +0100
@@ -159,5 +159,3 @@
     }
 
 // End of File
-
-// End of File
--- a/stifui/avkon/stifui/src/MenuListBox.cpp	Fri Jun 11 16:29:34 2010 +0100
+++ b/stifui/avkon/stifui/src/MenuListBox.cpp	Thu Jul 22 16:33:59 2010 +0100
@@ -106,3 +106,5 @@
 		this->SetTopItemIndex(0);
 		}
 	}
+
+// End of File
--- a/stifui/avkon/stifui/src/ShowStartedCasesContainer.cpp	Fri Jun 11 16:29:34 2010 +0100
+++ b/stifui/avkon/stifui/src/ShowStartedCasesContainer.cpp	Thu Jul 22 16:33:59 2010 +0100
@@ -551,10 +551,8 @@
 //
 void CShowStartedCasesContainer::RemoveAllExecutionsInViewL()
     {
-    TInt exutionsInViewCount = iStartedTestsPtrs.Count();
-    iStartedTestsPtrs.Reset(); //Empties the array, does not delete the objects whose pointers are contained in the array
+    iStartedTestsPtrs.Reset(); // Empties the array, does not delete the objects whose pointers are contained in the array
     HandleItemRemovalL();
-
     }
 
 // ----------------------------------------------------------------------------
@@ -645,4 +643,4 @@
 	((CMenuListBox*)iListBox)->SaveFocusPosition();
 	}
 
-// End of File  
+// End of File
--- a/stifui/avkon/stifui/src/StartedCasesMenuContainer.cpp	Fri Jun 11 16:29:34 2010 +0100
+++ b/stifui/avkon/stifui/src/StartedCasesMenuContainer.cpp	Thu Jul 22 16:33:59 2010 +0100
@@ -230,5 +230,4 @@
 	((CMenuListBox*)iListBox)->SaveFocusPosition();
 	}
 
-
-// End of File  
+// End of File
--- a/stifui/avkon/stifui/src/StartedCasesMenuView.cpp	Fri Jun 11 16:29:34 2010 +0100
+++ b/stifui/avkon/stifui/src/StartedCasesMenuView.cpp	Thu Jul 22 16:33:59 2010 +0100
@@ -157,4 +157,3 @@
     }
 
 // End of File
-
--- a/stifui/avkon/stifui/src/TestCaseMenuContainer.cpp	Fri Jun 11 16:29:34 2010 +0100
+++ b/stifui/avkon/stifui/src/TestCaseMenuContainer.cpp	Thu Jul 22 16:33:59 2010 +0100
@@ -221,4 +221,4 @@
 	((CMenuListBox*)iListBox)->SaveFocusPosition();
 	}
 
-// End of File  
+// End of File
--- a/stifui/avkon/stifui/src/TestSetBaseMenuContainer.cpp	Fri Jun 11 16:29:34 2010 +0100
+++ b/stifui/avkon/stifui/src/TestSetBaseMenuContainer.cpp	Thu Jul 22 16:33:59 2010 +0100
@@ -185,4 +185,5 @@
 	{
 	((CMenuListBox*)iListBox)->SaveFocusPosition();
 	}
-// End of File  
+
+// End of File
--- a/stifui/avkon/stifui/src/TestSetInsertMenuContainer.cpp	Fri Jun 11 16:29:34 2010 +0100
+++ b/stifui/avkon/stifui/src/TestSetInsertMenuContainer.cpp	Thu Jul 22 16:33:59 2010 +0100
@@ -220,5 +220,5 @@
 	{
 	((CMenuListBox*)iListBox)->SaveFocusPosition();
 	}
-    
+
 // End of File
--- a/stifui/avkon/stifui/src/TestSetMenuView.cpp	Fri Jun 11 16:29:34 2010 +0100
+++ b/stifui/avkon/stifui/src/TestSetMenuView.cpp	Thu Jul 22 16:33:59 2010 +0100
@@ -550,5 +550,4 @@
         }
     }
 
-
 // End of File
--- a/stifui/avkon/stifui/src/TestSetStartedCasesContainer.cpp	Fri Jun 11 16:29:34 2010 +0100
+++ b/stifui/avkon/stifui/src/TestSetStartedCasesContainer.cpp	Thu Jul 22 16:33:59 2010 +0100
@@ -446,7 +446,6 @@
 //
 void CTestSetStartedCasesContainer::RemoveAllExecutionsInViewL()
     {
-    TInt exutionsInViewCount = iStartedTestsPtrs.Count();
     iStartedTestsPtrs.Reset(); //Empties the array, does not delete the objects whose pointers are contained in the array
     HandleItemRemovalL();
 
@@ -463,4 +462,4 @@
 	((CMenuListBox*)iListBox)->SaveFocusPosition();
 	}
 
-// End of File  
+// End of File
--- a/stifui/avkon/stifui/src/Testmodulesmenuview.cpp	Fri Jun 11 16:29:34 2010 +0100
+++ b/stifui/avkon/stifui/src/Testmodulesmenuview.cpp	Thu Jul 22 16:33:59 2010 +0100
@@ -277,4 +277,3 @@
     }
 
 // End of File
-
--- a/stifui/avkon/stifui/src/UIStoreHandler.cpp	Fri Jun 11 16:29:34 2010 +0100
+++ b/stifui/avkon/stifui/src/UIStoreHandler.cpp	Thu Jul 22 16:33:59 2010 +0100
@@ -137,4 +137,4 @@
 // ================= OTHER EXPORTED FUNCTIONS =================================
 // None
 
-//  End of File
+// End of File
--- a/stifui/avkon/uitestserverstarter/inc/UITestServerStarter.hrh	Fri Jun 11 16:29:34 2010 +0100
+++ b/stifui/avkon/uitestserverstarter/inc/UITestServerStarter.hrh	Thu Jul 22 16:33:59 2010 +0100
@@ -21,3 +21,5 @@
 #define _UID3 0x2000F8E8
 
 #endif // __UITESTSERVERSTARTER_HRH__
+
+// End of File
--- a/stifui/avkon/uitestserverstarter/inc/UITestServerStarterApplication.h	Fri Jun 11 16:29:34 2010 +0100
+++ b/stifui/avkon/uitestserverstarter/inc/UITestServerStarterApplication.h	Thu Jul 22 16:33:59 2010 +0100
@@ -109,3 +109,5 @@
 
 
 #endif /*UITESTSERVERSTARTERAPPLICATION_H_*/
+
+// End of File
--- a/stifui/avkon/uitestserverstarter/inc/UITestServerStarterDocument.h	Fri Jun 11 16:29:34 2010 +0100
+++ b/stifui/avkon/uitestserverstarter/inc/UITestServerStarterDocument.h	Thu Jul 22 16:33:59 2010 +0100
@@ -142,3 +142,5 @@
 
 
 #endif /*UITESTSERVERSTARTERDOCUMENT_H_*/
+
+// End of File
--- a/stifui/avkon/uitestserverstarter/src/EventUtil.cpp	Fri Jun 11 16:29:34 2010 +0100
+++ b/stifui/avkon/uitestserverstarter/src/EventUtil.cpp	Thu Jul 22 16:33:59 2010 +0100
@@ -884,7 +884,7 @@
 	int keyScanCodeNamesCount = (sizeof( keyScanCodeNames )/sizeof(TText*));
 	
 	for ( int i = 0; i < keyScanCodeNamesCount; i++ ) {
-		if ( keyScanCodes[ i ] == aKeyScanCode ) 
+		if ( keyScanCodes[ i ] == (TUint)aKeyScanCode ) 
 			{
 			return keyScanCodeNames[ i ];
 			}
--- a/stifui/avkon/uitestserverstarter/src/UITestServerStarterAppContainer.cpp	Fri Jun 11 16:29:34 2010 +0100
+++ b/stifui/avkon/uitestserverstarter/src/UITestServerStarterAppContainer.cpp	Thu Jul 22 16:33:59 2010 +0100
@@ -287,5 +287,4 @@
 	return CCoeControl::MopSupplyObject( aId );
 	}
 
-
 // End of File
--- a/stifui/avkon/uitestserverstarter/src/UITestServerStarterAppUi.cpp	Fri Jun 11 16:29:34 2010 +0100
+++ b/stifui/avkon/uitestserverstarter/src/UITestServerStarterAppUi.cpp	Thu Jul 22 16:33:59 2010 +0100
@@ -240,6 +240,9 @@
 					}
 				}
 				break;
+			default: 
+			    // Do nothing
+			    break;
 			}
 		}
 	else if ( aEvent.Type() == EEventPointer )
@@ -247,7 +250,7 @@
 		if ( iEventType == EPointerEvent )
 			{
 			PointerEventHandled();
-			}
+			}		
 		}
 	}
 
@@ -504,5 +507,4 @@
 	iEventStatus = aStatus;
 	}
 
-
 // End of File
--- a/stifui/qt/ReleaseNote.txt	Fri Jun 11 16:29:34 2010 +0100
+++ b/stifui/qt/ReleaseNote.txt	Thu Jul 22 16:33:59 2010 +0100
@@ -1,11 +1,11 @@
 ========================================================================
-RELEASE NOTE FOR STIFQTUI - STIF_201016 (7.3.31)
+RELEASE NOTE FOR STFUI_201024 (7.3.35)
 ========================================================================
 
 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/cstfcase.h	Fri Jun 11 16:29:34 2010 +0100
+++ b/stifui/qt/inc/cstfcase.h	Thu Jul 22 16:33:59 2010 +0100
@@ -61,3 +61,5 @@
     QString moduleName;
 };
 #endif // CSTFCASE_H
+
+// End of File
--- a/stifui/qt/inc/cstfmodule.h	Fri Jun 11 16:29:34 2010 +0100
+++ b/stifui/qt/inc/cstfmodule.h	Thu Jul 22 16:33:59 2010 +0100
@@ -48,3 +48,5 @@
 
 };
 #endif // CSTFMODULE_H
+
+// End of File
--- a/stifui/qt/inc/dlgoutput.h	Fri Jun 11 16:29:34 2010 +0100
+++ b/stifui/qt/inc/dlgoutput.h	Thu Jul 22 16:33:59 2010 +0100
@@ -51,6 +51,7 @@
 private slots:
     void on_btnPause_clicked();
     void on_btnAbort_clicked();
+    void on_btnClose_clicked();
     
     
 private:
@@ -58,13 +59,12 @@
     QTabWidget* tabMain;
     QPushButton* btnPause;
     QPushButton* btnAbort;
+    QPushButton* btnClose;
     QHash<QString , QPlainTextEdit*> tabList;
     
-private:
-    void on_btnClose_clicked();
-    
-    
 };
 
 
 #endif /* DLGOUTPUT_H_ */
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/qt/inc/dlgrepeatrun.h	Thu Jul 22 16:33:59 2010 +0100
@@ -0,0 +1,64 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: QT C++ based Class.
+*/
+
+#ifndef DLGREPEATRUN_H_
+#define DLGREPEATRUN_H_
+#include <QDialog>
+#include <QLineEdit>
+
+QT_BEGIN_NAMESPACE
+class QTabWidget;
+class QGridLayout;
+class QRadioButton;
+class QPushButton;
+QT_END_NAMESPACE
+
+class DlgRepeatRun : public QDialog {    
+    Q_OBJECT
+    
+public:
+    DlgRepeatRun(QWidget *parent = 0);
+    inline bool isRepeatInfinitely() {return isInfinite;};
+    inline int  GetLoopTimes() {return loopTimes;};
+    
+    
+private:
+    void SetupUI();
+    
+private:
+    QPushButton* btnOk;
+    QPushButton* btnCancel;
+    QLineEdit* lineEdit;
+    QRadioButton* rdoLoopInfinitely;
+    QRadioButton* rdoGiveLoopTimes;
+    
+    int loopTimes;
+    bool isInfinite;
+    
+private slots:
+    //on button clicked
+    void on_btnOk_clicked();
+    void on_btnCancel_clicked();
+    
+    //on check box state changed
+    void on_rdoLoopInfinitely_stateChanged(bool checked);
+    void on_rdoGiveLoopTimes_stateChanged(bool checked);
+    
+    };
+
+#endif /* DLGREPEATRUN_H_ */
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/qt/inc/dlgsetselector.h	Thu Jul 22 16:33:59 2010 +0100
@@ -0,0 +1,66 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: QT C++ based Class.
+*              DlgSetSelector is a QT based dialog.
+*              Used to display available test set for select to add cases into.
+*
+*/
+#ifndef DLGSETSELECTOR_H_
+#define DLGSETSELECTOR_H_
+
+#include <QDialog>
+#include <QList>
+
+QT_BEGIN_NAMESPACE
+class QGridLayout;
+class QPushButton;
+class QRadioButton;
+class QListWidget;
+QT_END_NAMESPACE
+
+class DlgSetSelector : public QDialog {
+    Q_OBJECT
+
+public:
+    DlgSetSelector(QList<QString> setList, QWidget *parent = 0);
+    
+public:
+    inline QString SelectName(){return selectName;}
+    
+private:
+    void SetupUI();
+    
+private slots:
+    void on_btnOk_clicked();
+    void on_btnCancel_clicked();
+    void on_radio1Selection_Changed(bool checked);
+    void on_radio2Selection_Changed(bool checked);
+    
+private:
+    QString selectName;
+    
+    QRadioButton* rdoNewSet;
+    QRadioButton* rdoOldSet;
+    QListWidget* lstSet;
+    QPushButton* btnOk;
+    QPushButton* btnCancel;
+    QList<QString> setList;
+    
+    
+};
+
+
+#endif /* DLGSETSELECTOR_H_ */
+
+// End of File
--- a/stifui/qt/inc/dlgsetting.h	Fri Jun 11 16:29:34 2010 +0100
+++ b/stifui/qt/inc/dlgsetting.h	Thu Jul 22 16:33:59 2010 +0100
@@ -25,6 +25,8 @@
 class QGridLayout;
 class QCheckBox;
 class QPushButton;
+class QLabel;
+class QLineEdit;
 QT_END_NAMESPACE
 
 class DlgSetting : public QDialog {    
@@ -40,6 +42,9 @@
     QPushButton* btnOk;
     QPushButton* btnCancel;
     QCheckBox* chkShowoutput;
+    QLabel* lblFilter;
+    QLineEdit* ledFilter;
+    QCheckBox* chkFilterCaseSens;
     
 private slots:
     void on_btnOk_clicked();
@@ -51,3 +56,5 @@
     };
 
 #endif /* DLGSETTING_H_ */
+
+// End of File
--- a/stifui/qt/inc/frmmain.h	Fri Jun 11 16:29:34 2010 +0100
+++ b/stifui/qt/inc/frmmain.h	Thu Jul 22 16:33:59 2010 +0100
@@ -20,11 +20,15 @@
 #define FRMMAIN_H
 
 #include <QMainWindow>
+#include <QtGui>
 #include "istfqtuicontroller.h"
 #include "istfqtuimodel.h"
 #include "dlgoutput.h"
 #include "uisetting.h"
 #include "dlgsetting.h"
+#include "dlgsetselector.h"
+#include "uiversion.h"
+#include "dlgrepeatrun.h"
 
 QT_BEGIN_NAMESPACE
 class QAction;
@@ -43,15 +47,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 +68,9 @@
     void OnCaseStatisticChanged() ;
     void OnRunningCaseChanged() ;
     
+protected:
+    void paintEvent(QPaintEvent *event);
+    
 protected slots:
     void onTabWidgetSelectIndexChanged();
 
@@ -79,16 +86,24 @@
     QList<CSTFCase> getSelectedCases();
     void reloadStatisticItem(QString name, QTreeWidgetItem* item, TSTFCaseStatusType type);
     void setSetting();
+    void startRunning();
+    void setItemClicked(QTreeWidgetItem* item);
     
 private:
     IStfQtUIController* controller;
     IStfQtUIModel* model;
     DlgOutput* dlgOutput;
     UiSetting* uiSetting; 
-    
+    bool layoutType;
+    QTreeWidgetItem* lastItemSelected;
+    QString currentFilter;
+    QString currentFilterCaseSens;
 
 private: //UI Components
-    QWidget *MainWidget;
+    QWidget* centerWidget;
+    QGridLayout *mainLayout;
+    QGroupBox *groupBox;
+    
     //menus and actions
     QMenu *operateMenu;
     //output panel
@@ -120,7 +135,7 @@
     QListWidget *lstStartedCases;
     QPushButton *btnPauseCase;
     QPushButton *btnAbortCase;
-    QPlainTextEdit *txtCaseOutput;
+    QPushButton *btnShowOutput;
 
     //menu actions
     QAction *actExit;
@@ -130,19 +145,24 @@
     QAction *actOpenFile;
     QAction *actRunCaseSeq;
     QAction *actRunCasePar;
+    QAction *actReapeatRunSeq;
     QAction *actAddtoSet;
     QAction *actSelectAll;
     QAction *actExpandAll;
     QAction *actCollapseAll;
     QAction *actSetting;
+    QMenu *menuRunCase; 
     //sets actions
     QAction *actRunSetSeq;
     QAction *actRunSetPar;
     QAction *actNewSet;
     QAction *actDelSet;
+    QMenu *menuRunSet;
     //running actions.
     QAction *actPause;
     QAction *actAbort;
+    QAction *actOutput;
+    
     //statistics actions
     QAction *actClearStatistics;
 
@@ -153,10 +173,13 @@
     void on_actOpenFile_triggered();
     void on_actRunCaseSeq_triggered();
     void on_actRunCasePar_triggered();
+    void on_actReapeatRunSeq_triggered();
     void on_actAddtoSet_triggered();
     void on_actSelectAll_triggered();
     void on_actExpandAll_triggered();
     void on_actCollapseAll_triggered();
+    void on_actExpand_triggered();
+    void on_actCollapse_triggered();
     void on_actSetting_triggered();
         
     void on_actRunSetSeq_triggered();
@@ -165,6 +188,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 +200,6 @@
 
 };
 
-#endif // FRMMAIN_H
+#endif // FrmMain_H
+
+// End of File
--- a/stifui/qt/inc/istfqtuicontroller.h	Fri Jun 11 16:29:34 2010 +0100
+++ b/stifui/qt/inc/istfqtuicontroller.h	Thu Jul 22 16:33:59 2010 +0100
@@ -48,19 +48,21 @@
     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 void RepeatRunCases(const QList<CSTFCase>& aCaseList, const bool aIsLoopInfinitely, const int aLoopTimes = 1) = 0;
+    virtual bool AddCaseToSet(const QList<CSTFCase>& aCase, const QString& setName) = 0;
     
     //for set
     virtual QList<QString> GetSetList() = 0;
     virtual QList<QString> GetCaseListBySet(const QString& setName) = 0;
-    virtual 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;
     
@@ -71,9 +73,14 @@
     virtual void AddStfEventListener(IStfEventListener* listener) = 0;
     virtual void RemoveStfEventListener(IStfEventListener* listener) = 0;
     
+    //for repeat execution setting
+    virtual void InitRepeatSetting(const bool aIsLoopInfinitely, const int aLoopTimes) = 0;
+    virtual void ResetRepeatSetting() = 0;
 
 };
 
 
 
 #endif // ISTFQTUICONTROLLER_H
+
+// End of File
--- a/stifui/qt/inc/istfqtuimodel.h	Fri Jun 11 16:29:34 2010 +0100
+++ b/stifui/qt/inc/istfqtuimodel.h	Thu Jul 22 16:33:59 2010 +0100
@@ -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;
@@ -53,3 +53,5 @@
 };
 
 #endif // ISTFQTUIMODEL_H
+
+// End of File
--- a/stifui/qt/inc/stfqtuicontroller.h	Fri Jun 11 16:29:34 2010 +0100
+++ b/stifui/qt/inc/stfqtuicontroller.h	Thu Jul 22 16:33:59 2010 +0100
@@ -35,13 +35,14 @@
     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);
+    void RepeatRunCases(const QList<CSTFCase>& aCaseList, const bool aIsLoopInfinitely, const int aLoopTimes = 1);
+    bool AddCaseToSet(const QList<CSTFCase>& aCase, const QString& setName);
     
     //for set
     QList<QString> GetSetList();
     QList<QString> GetCaseListBySet(const QString& setName);
-    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 +50,7 @@
     void ResumeCase();
     void AbortCase();
     bool ShowOutput();
+    CSTFCase GetRunningCase(int index);
     void SetShowOutput(bool isShow);
     
     //for staticstic
@@ -57,6 +59,10 @@
     //listener
     void AddStfEventListener(IStfEventListener* listener);
     void RemoveStfEventListener(IStfEventListener* listener);
+    
+    //for repeat execution setting
+    void InitRepeatSetting(const bool aIsLoopInfinitely, const int aLoopTimes);
+    void ResetRepeatSetting();
 
 public://implement IStifCaseUpdateListener
     void OnGetCaseUpdated(CStartedTestCase* aCase, CSTFCase& stfcase, int flags);
@@ -67,8 +73,11 @@
     void FireOnSetListChanged();
     void FireOnCaseOutputChanged(IStfEventListener::CaseOutputCommand cmd, int index, QString msg);
     
-private://help methods
+private:
+    // help methods
     CSTFModule GetModuleByName(const QString& moduleName);
+    // Repeat execution cases
+    void Execution();
     
 private:
     CStifExecutor* executor;
@@ -76,11 +85,21 @@
     QList<IStfEventListener*> listenerList;
     bool isShowOutput;
     
+    // repeat run case related member 
+    // repeat execution case list   
+    QList<CSTFCase> repeatRunCaseList;
+    // current position of the case list
+    int iCurrentRunPos;
+    // is loop infinitely
+    bool isLoopInfinitely;
+    // loop times
+    int loopTimes;
     
-        
     };
 
 
 
 
 #endif /* STFQTUICONTROLLER_H_ */
+
+// End of File
--- a/stifui/qt/inc/stfqtuimodel.h	Fri Jun 11 16:29:34 2010 +0100
+++ b/stifui/qt/inc/stfqtuimodel.h	Thu Jul 22 16:33:59 2010 +0100
@@ -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();
@@ -55,3 +56,5 @@
     
     
     };
+
+// End of File
--- a/stifui/qt/inc/stifexecutor.h	Fri Jun 11 16:29:34 2010 +0100
+++ b/stifui/qt/inc/stifexecutor.h	Thu Jul 22 16:33:59 2010 +0100
@@ -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,11 +63,18 @@
      TPtrC QString2TPtrC(const QString& aString);
      QString TDesC2QString(const TDesC& des);
      //CTestInfo* GetTestInfo(CSTFCase aCase);
+     
+private:
+     bool LogResult(const TInt result,const QString str);
 private:
    QList<IStifCaseUpdateListener*> *listenerList;
    HBufC*  iBuffer;
+   // Pointer to logger
+   CStifLogger * iLog;
     };
 
 
 
 #endif /* STIFEXECUTOR_H_ */
+
+// End of File
--- a/stifui/qt/inc/uisetting.h	Fri Jun 11 16:29:34 2010 +0100
+++ b/stifui/qt/inc/uisetting.h	Thu Jul 22 16:33:59 2010 +0100
@@ -18,6 +18,11 @@
 #define UISETTING_H_
 #include <QHash>
 
+const QString KShowOutput = "showoutput";
+const QString KStyleSheet = "StyleSheet";
+const QString KFilter = "filter";
+const QString KFilterCaseSens = "filtercasesens";
+
 class UiSetting
     {
 public:
@@ -32,9 +37,12 @@
     bool load();
     bool save();
     void loadDefault();
+    QString getDefaultValue(const QString& item);
     
 private:
     QHash<QString, QString> settingList;
     };
 
 #endif /* UISETTING_H_ */
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/qt/inc/uiversion.h	Thu Jul 22 16:33:59 2010 +0100
@@ -0,0 +1,28 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: QT C++ based Class.
+*              frmMain is a QT based Window.
+*              Used to display STF executor main GUI.
+*
+*/
+
+#ifndef UIVERSION_H_
+#define UIVERSION_H_
+
+const QString QtUIVersion = "v1.1.1";
+const QString QtUIName = "STFUI";
+
+#endif /* UIVERSION_H_ */
+
+// End of File
--- a/stifui/qt/inc/version.h	Fri Jun 11 16:29:34 2010 +0100
+++ b/stifui/qt/inc/version.h	Thu Jul 22 16:33:59 2010 +0100
@@ -11,7 +11,7 @@
 *
 * Contributors:
 * 
-* Description: STIF QT UI version declaration
+* Description: STIF version declaration
 *
 */
 
@@ -20,10 +20,12 @@
 
 #define STIF_MAJOR_VERSION 7
 #define STIF_MINOR_VERSION 3
-#define STIF_BUILD_VERSION 26
+#define STIF_BUILD_VERSION 35
 
-#define STIF_REL_DATE "09th Feb 2010"
+#define STIF_REL_DATE "15th June 2010"
 
 #define TO_UNICODE(text) _L(text) 
 
 #endif /*VERSION_H_*/
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/qt/qss/coffee.qss	Thu Jul 22 16:33:59 2010 +0100
@@ -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	Thu Jul 22 16:33:59 2010 +0100
@@ -0,0 +1,5 @@
+<RCC>
+<qresource prefix="/">
+<file>../qss/coffee.qss</file>
+</qresource>
+</RCC>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/qt/rom/stfui.iby	Thu Jul 22 16:33:59 2010 +0100
@@ -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: Stifui.iby file specifies needed STIF and STIF UI 
+* and UITetsServerstarter components for ROM image
+*
+*/
+
+#ifndef __STIF_UI_IBY__
+#define __STIF_UI_IBY__
+
+S60_APP_EXE(Stfqtui)
+
+#ifdef S60_UPGRADABLE_APP_REG_RSC
+  S60_UPGRADABLE_APP_REG_RSC(Stfqtui)
+#else
+  S60_APP_AIF_RSC(Stfqtui)
+#endif
+
+S60_APP_RESOURCE(Stfqtui)
+
+#endif
+// End of File
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/qt/sis/stifqtui.pkg	Thu Jul 22 16:33:59 2010 +0100
@@ -0,0 +1,27 @@
+; stifqtui_armv5_urel.pkg generated by qmake at 2010-05-31T09:56:39
+; This file is generated by qmake and should not be modified by the user
+;
+
+; Language
+&EN
+
+; SIS header: name, uid, version
+#{"STFUI"},(0x2002BCA0),1,0,0
+
+; Localised Vendor name
+%{"Nokia, Qt Software"}
+
+; Unique Vendor name
+:"Nokia, Qt Software"
+
+; Dependencies
+[0x101F7961],0,0,0,{"S60ProductID"}
+[0x102032BE],0,0,0,{"S60ProductID"}
+[0x102752AE],0,0,0,{"S60ProductID"}
+[0x1028315F],0,0,0,{"S60ProductID"}
+(0x2001E61C), 4, 5, 2, {"QtLibs pre-release"}
+
+; Executable and default resource files
+"/epoc32/release/armv5/urel/STFUI.exe"    - "!:\sys\bin\STFUI.exe"
+"/epoc32/data/z/resource/apps/STFUI.rsc"    - "!:\resource\apps\STFUI.rsc"
+"/epoc32/data/z/private/10003a3f/import/apps/STFUI_reg.rsc"    - "!:\private\10003a3f\import\apps\STFUI_reg.rsc"
Binary file stifui/qt/sis/stifqtui.sis has changed
Binary file stifui/qt/sis/stifqtui.sisx has changed
--- a/stifui/qt/src/dlgoutput.cpp	Fri Jun 11 16:29:34 2010 +0100
+++ b/stifui/qt/src/dlgoutput.cpp	Thu Jul 22 16:33:59 2010 +0100
@@ -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);
@@ -65,9 +69,8 @@
 
 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 +83,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 +111,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:
@@ -120,3 +139,4 @@
 
     }
 
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/qt/src/dlgrepeatrun.cpp	Thu Jul 22 16:33:59 2010 +0100
@@ -0,0 +1,133 @@
+/*
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description: QT C++ based Class.
+ * 
+ */
+
+#include "dlgrepeatrun.h"
+#include <QtGui>
+
+DlgRepeatRun::DlgRepeatRun(QWidget *parent)
+    : QDialog(parent),
+      loopTimes(0),
+      isInfinite(true)
+    {
+    SetupUI();
+    }
+
+void DlgRepeatRun::SetupUI()
+    {
+    this->setContextMenuPolicy(Qt::NoContextMenu);
+    QGridLayout *mainLayout = new QGridLayout(this);
+    this->setLayout(mainLayout);
+    
+    //nullWidget is just place holder for better looking.
+    QWidget *nullWidget = new QWidget(this);
+    nullWidget->setMinimumHeight(30);
+    mainLayout->addWidget(nullWidget, 0, 0);
+    
+    // check box LoopInfinitely
+    rdoLoopInfinitely = new QRadioButton(this);
+    rdoLoopInfinitely->setMinimumHeight(40);
+    rdoLoopInfinitely->setText(tr("Repeat infinitely."));
+    rdoLoopInfinitely->setChecked(Qt::Checked);
+    QObject::connect(rdoLoopInfinitely, SIGNAL(clicked(bool)), this,
+                SLOT(on_rdoLoopInfinitely_stateChanged(bool)));
+    
+
+    // check box LoopTime
+    rdoGiveLoopTimes = new QRadioButton(this);
+    rdoGiveLoopTimes->setMinimumHeight(40);
+    rdoGiveLoopTimes->setText(tr("Give loop times:"));
+    rdoGiveLoopTimes->setChecked(Qt::Unchecked);
+    QObject::connect(rdoGiveLoopTimes, SIGNAL(clicked(bool)), this,
+                SLOT(on_rdoGiveLoopTimes_stateChanged(bool)));
+    
+    // lineEdit, 
+    QValidator *validator = new QIntValidator(1, 999999, this); 
+    lineEdit = new QLineEdit(this);
+    lineEdit->setValidator(validator);
+    lineEdit->setMinimumHeight(40);
+    lineEdit->setMaxLength(6);
+    lineEdit->setMaximumWidth(60);
+    lineEdit->setEchoMode(QLineEdit::NoEcho);
+    lineEdit->setReadOnly(true);
+    
+    // add check box and lineEdit to layout. 
+    QWidget *toolWidgetForLoopTimes = new QWidget(this);
+    QGridLayout *toolLayoutForLoopTimes = new QGridLayout(this);
+    toolWidgetForLoopTimes->setLayout(toolLayoutForLoopTimes);
+    toolLayoutForLoopTimes->addWidget(rdoLoopInfinitely, 0, 0);
+    toolLayoutForLoopTimes->addWidget(rdoGiveLoopTimes, 1, 0);
+    toolLayoutForLoopTimes->addWidget(lineEdit, 1, 1);
+    mainLayout->addWidget(toolWidgetForLoopTimes, 1, 0);
+    
+    // add button
+    QWidget *toolWidgetForButtons = new QWidget(this);
+    QGridLayout *toolLayoutForButtons = new QGridLayout(this);
+    toolWidgetForButtons->setLayout(toolLayoutForButtons);
+    btnOk = new QPushButton(tr("Ok"), toolWidgetForButtons);
+    QObject::connect(btnOk, SIGNAL(clicked()), this,
+            SLOT(on_btnOk_clicked()));
+    btnCancel = new QPushButton(tr("Cancel"), toolWidgetForButtons);
+    QObject::connect(btnCancel, SIGNAL(clicked()), this,
+            SLOT(on_btnCancel_clicked()));
+    toolLayoutForButtons->addWidget(btnOk, 0, 0);
+    toolLayoutForButtons->addWidget(btnCancel, 0, 1);
+    mainLayout->addWidget(toolWidgetForButtons, 2, 0);
+    }
+
+void DlgRepeatRun::on_btnOk_clicked()
+    {
+    if(!isRepeatInfinitely())
+        {
+        loopTimes = lineEdit->text().toInt();
+        if (loopTimes < 0)
+            {
+            loopTimes = 0;
+            }
+        }
+    else
+        {
+        loopTimes = 0;
+        }
+    this->accept();
+    }
+
+void DlgRepeatRun::on_btnCancel_clicked()
+    {
+    this->reject();    
+    }
+
+void DlgRepeatRun::on_rdoLoopInfinitely_stateChanged(bool checked)
+    {
+    if(checked)
+        {
+        isInfinite = true;
+        lineEdit->setEchoMode(QLineEdit::NoEcho);
+        lineEdit->setReadOnly(true);
+        }
+    }
+
+void DlgRepeatRun::on_rdoGiveLoopTimes_stateChanged(bool checked)
+    {
+    if(checked)
+        {
+        isInfinite = false;
+        lineEdit->setEchoMode(QLineEdit::Normal); 
+        lineEdit->setReadOnly(false);
+        }
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/stifui/qt/src/dlgsetselector.cpp	Thu Jul 22 16:33:59 2010 +0100
@@ -0,0 +1,116 @@
+/*
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description: QT C++ based Class.
+ * 
+ */
+
+#include "dlgsetselector.h"
+#include <QtGui>
+
+DlgSetSelector::DlgSetSelector(QList<QString> list, QWidget* parent):
+        QDialog(parent), selectName(""), setList(list)
+    {
+    SetupUI();
+    }
+
+void DlgSetSelector::SetupUI()
+    {
+     QGridLayout *mainLayout = new QGridLayout(this);
+     this->setLayout(mainLayout);
+     this->setContextMenuPolicy(Qt::NoContextMenu);
+     
+     rdoNewSet = new QRadioButton(this);
+     rdoNewSet->setChecked(true);
+     rdoNewSet->setText(tr("Create a new Set"));
+     QObject::connect(rdoNewSet, SIGNAL(clicked(bool)), this, 
+             SLOT(on_radio1Selection_Changed(bool)));
+     rdoOldSet = new QRadioButton(this);
+     rdoOldSet->setChecked(false);
+     rdoOldSet->setText(tr("Select a exist set:"));
+     QObject::connect(rdoOldSet, SIGNAL(clicked(bool)), this, 
+             SLOT(on_radio2Selection_Changed(bool)));
+     
+     lstSet = new QListWidget(this);
+     for(int i=0;i<setList.count();i++)
+         {
+         lstSet->addItem(setList[i]);
+         }
+     lstSet->setEnabled(false);
+     
+     QWidget *toolWidget = new QWidget(this);
+     toolWidget->setContextMenuPolicy(Qt::NoContextMenu);
+     QGridLayout *toolLayout = new QGridLayout(this);
+     toolWidget->setLayout(toolLayout);
+     btnOk = new QPushButton(tr("Ok"), toolWidget);
+     btnOk->setContextMenuPolicy(Qt::NoContextMenu);
+     QObject::connect(btnOk, SIGNAL(clicked()), this,
+             SLOT(on_btnOk_clicked()));
+     btnCancel = new QPushButton(tr("Cancel"), toolWidget);
+     btnCancel->setContextMenuPolicy(Qt::NoContextMenu);
+     QObject::connect(btnCancel, SIGNAL(clicked()), this,
+             SLOT(on_btnCancel_clicked()));
+     toolLayout->addWidget(btnOk, 0, 0);
+     toolLayout->addWidget(btnCancel, 0, 1);
+         
+
+     mainLayout->addWidget(rdoNewSet, 0, 0);
+     mainLayout->addWidget(rdoOldSet, 1, 0);
+     mainLayout->addWidget(lstSet, 2, 0);
+            
+     mainLayout->addWidget(toolWidget, 3, 0);
+     this->showMaximized();
+     
+    }
+void DlgSetSelector::on_radio1Selection_Changed(bool /* checked */)
+    {
+    lstSet->setEnabled(false);
+    }
+
+
+void DlgSetSelector::on_radio2Selection_Changed(bool checked)
+    {
+    lstSet->setEnabled(true);
+    if(checked)
+        {
+        if(setList.count() == 0)
+            {
+            rdoNewSet->setChecked(true);
+            }
+        else
+            {
+            lstSet->setCurrentRow(0);
+            }
+        }
+    
+    }
+
+void DlgSetSelector::on_btnOk_clicked()
+    {
+    if(rdoOldSet->isChecked())
+        {
+        selectName = lstSet->selectedItems()[0]->text();
+        }
+    else
+        {
+        selectName = "";
+        }
+    this->accept();
+    }
+
+void DlgSetSelector::on_btnCancel_clicked()
+    {
+    this->reject();
+    }
+
+// End of File
--- a/stifui/qt/src/dlgsetting.cpp	Fri Jun 11 16:29:34 2010 +0100
+++ b/stifui/qt/src/dlgsetting.cpp	Thu Jul 22 16:33:59 2010 +0100
@@ -32,37 +32,54 @@
     
     chkShowoutput = new QCheckBox(this);
     chkShowoutput->setText(tr("Show output in execution."));
-    chkShowoutput->setChecked(setting->ReadSetting("showoutput") == "true");
+    chkShowoutput->setChecked(setting->ReadSetting(KShowOutput) == "true");
+    
+    lblFilter = new QLabel(this);
+    lblFilter->setText(tr("Filter for displayed titles."));
+    ledFilter = new QLineEdit(this);
+    ledFilter->setFrame(true);
+    ledFilter->setText(setting->ReadSetting(KFilter));
+    chkFilterCaseSens = new QCheckBox(this);
+    chkFilterCaseSens->setText(tr("Filter is case sensitive."));
+    chkFilterCaseSens->setChecked(setting->ReadSetting(KFilterCaseSens) == "true");
     
     QWidget *toolWidget = new QWidget(this);
-    QGridLayout *toolLayout = new QGridLayout();
+    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(lblFilter, 3, 0);
+    mainLayout->addWidget(ledFilter, 4, 0);
+    mainLayout->addWidget(chkFilterCaseSens, 5, 0);
+    mainLayout->addWidget(toolWidget, 7, 0); 
+    
     }
 
 void DlgSetting::on_btnOk_clicked()
     {
     if(chkShowoutput->checkState() == Qt::Checked)
         {
-        setting->SetSetting("showoutput", "true");
+        setting->SetSetting(KShowOutput, "true");
         }
     else
         {
-        setting->SetSetting("showoutput", "false");    
+        setting->SetSetting(KShowOutput, "false");    
         }
+    setting->SetSetting(KFilter, ledFilter->text());
+    setting->SetSetting(KFilterCaseSens, (chkFilterCaseSens->checkState() == Qt::Checked) ? ("true") : ("false"));
     this->accept();
     }
 
@@ -70,3 +87,5 @@
     {
     this->reject();
     }
+
+// End of File
--- a/stifui/qt/src/frmmain.cpp	Fri Jun 11 16:29:34 2010 +0100
+++ b/stifui/qt/src/frmmain.cpp	Thu Jul 22 16:33:59 2010 +0100
@@ -21,16 +21,27 @@
 #include <QList>
 #include "version.h"
 #include <QCursor>
+#include <QDesktopWidget>
 
 const QString SELECTITEMHEADER = " * ";
 const QString UNSELECTITEMHEADER = "   ";
 
-frmMain::frmMain()
+FrmMain::FrmMain()
     {
+    lastItemSelected = NULL;
     uiSetting = new UiSetting();
     createMenus();
     load();
     LoadSubMenu();
+    
+    QFile file(uiSetting->ReadSetting(KStyleSheet));
+    bool rst = file.open(QFile::ReadOnly);    
+    if(rst)
+        {
+        QString styleSheet = QLatin1String(file.readAll());    
+        qApp->setStyleSheet(styleSheet);    
+        }
+        
     model = new StfQtUIModel();
     model->AddStifModelEventListener(this);
     controller = new StfQtUIController(model);
@@ -40,29 +51,116 @@
     setSetting();
     }
 
-frmMain::~frmMain()
+FrmMain::~FrmMain()
     {
     model->AbortCase();
     controller->RemoveStfEventListener(this);
     model->RemoveStifModelEventListener(this);
     
+    //lastItemSelected does not own any memory, don't need to delete.
+    lastItemSelected = NULL;
     delete uiSetting;
     delete dlgOutput;
     delete controller;
     delete model;
     }
 
-void frmMain::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");    
+    // Apply filter changes
+    QString newFilter = uiSetting->ReadSetting(KFilter);
+    QString newFilterCaseSens = uiSetting->ReadSetting(KFilterCaseSens); 
+    if(currentFilter != newFilter || currentFilterCaseSens != newFilterCaseSens)
+        {
+        // Store new filter for further use
+        currentFilter = newFilter;
+        currentFilterCaseSens = newFilterCaseSens;
+        
+        // Create and setup regular expression for wildcard searching
+        QRegExp filter;
+        filter.setPattern((newFilter == "") ? ("*") : (tr("*") + newFilter + tr("*")));
+        filter.setCaseSensitivity((newFilterCaseSens == "true") ? (Qt::CaseSensitive) : (Qt::CaseInsensitive));
+        filter.setPatternSyntax(QRegExp::Wildcard);
+
+        // Go through top level entries (modules)
+        bool isAnythingHidden = false;
+        for(int i = 0; i < treeModuleList->topLevelItemCount(); i++)
+            {
+            QTreeWidgetItem* top = treeModuleList->topLevelItem(i);
+            // And through test cases for each module
+            for(int j = 0; j < top->childCount(); j++)
+                {                
+                QTreeWidgetItem *child = top->child(j);
+                // Remove first three chars to get valid test case title
+                QString title = (child->text(0)).mid(3);
+                // Check if title is matching to filter and show or hide it
+                if(filter.exactMatch(title))
+                    {
+                    child->setHidden(false);
+                    }
+                else
+                    {
+                    child->setHidden(true);
+                    child->setText(0, child->text(0).replace(0, 3, UNSELECTITEMHEADER));
+                    isAnythingHidden = true;
+                    }
+                }
+            }
+
+        if(isAnythingHidden)
+            treeModuleList->headerItem()->setText(0, tr("Module List (filtered)"));
+        else
+            treeModuleList->headerItem()->setText(0, tr("Module List"));
+        }
+    }
+
+void FrmMain::OnGetMessage(const QString& aMessage)
     {
     txtOutput->appendPlainText(aMessage);
     }
 
-void frmMain::OnRunningCaseChanged()
+void FrmMain::OnRunningCaseChanged()
     {
     QList<CSTFCase> caseList = controller->GetCasesByStatus(EStatusRunning);
     lstStartedCases->clear();
@@ -74,34 +172,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,14 +217,21 @@
     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()));
 
+    ////////////////////
+    actReapeatRunSeq = new QAction(tr("Repeat run sequentially"), this);
+    connect(actReapeatRunSeq, SIGNAL(triggered()), this,
+            SLOT(on_actReapeatRunSeq_triggered()));
+    
     actAddtoSet = new QAction(tr("Add cases to Set"), this);
     connect(actAddtoSet, SIGNAL(triggered()), this,
             SLOT(on_actAddtoSet_triggered()));
@@ -139,15 +248,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 +279,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 +291,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 +326,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 +343,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 +388,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 +454,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 +491,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 +540,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 +555,10 @@
         {
         //Cases Tab
         menuBar()->addAction(actOpenFile);
-        menuBar()->addAction(actRunCaseSeq);
-        menuBar()->addAction(actRunCasePar);
+        menuBar()->addMenu(menuRunCase);
+        menuRunCase->addAction(actRunCaseSeq);
+        menuRunCase->addAction(actRunCasePar);
+        menuBar()->addAction(actReapeatRunSeq);
         menuBar()->addSeparator();
         menuBar()->addAction(actAddtoSet);
         menuBar()->addSeparator();
@@ -433,8 +569,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 +581,7 @@
         //Started Tab
         menuBar()->addAction(actPause);
         menuBar()->addAction(actAbort);
+        menuBar()->addAction(actOutput);
         
         }
     else
@@ -458,12 +596,12 @@
 
     }
 
-void frmMain::onTabWidgetSelectIndexChanged()
+void FrmMain::onTabWidgetSelectIndexChanged()
     {
     LoadSubMenu();
     }
 
-void frmMain::loadContent()
+void FrmMain::loadContent()
     {
     //Load ModuleList
     loadModuleList();
@@ -473,7 +611,7 @@
     loadStatistic();
     }
 
-void frmMain::loadModuleList()
+void FrmMain::loadModuleList()
     {
     treeModuleList->clear();
     
@@ -498,7 +636,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 +652,7 @@
             }
     }
 
-void frmMain::loadStatistic()
+void FrmMain::loadStatistic()
     {
     //executedItems;
     reloadStatisticItem("Executed Cases", executedItems, EStatusExecuted);
@@ -533,7 +671,7 @@
 
     }
 
-void frmMain::loadSetList()
+void FrmMain::loadSetList()
     {
     cboSetList->clear();
 
@@ -549,7 +687,7 @@
 //        }
     }
 
-QList<CSTFCase> frmMain::getSelectedCases()
+QList<CSTFCase> FrmMain::getSelectedCases()
     {
     int index = 0;
     QTreeWidgetItem* item = treeModuleList->topLevelItem(index);
@@ -574,7 +712,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 +722,114 @@
             }
     }
 
-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_actReapeatRunSeq_triggered()
     {
+    DlgRepeatRun dlgRepeatRun(this);
+    int result = dlgRepeatRun.exec();
+    if(result == QDialog::Accepted)
+        {
+        QList<CSTFCase> selectedCases = getSelectedCases();
+        if(selectedCases.count() > 0)
+            {
+            startRunning();
+            controller->RepeatRunCases( selectedCases, 
+                                        dlgRepeatRun.isRepeatInfinitely(),
+                                        dlgRepeatRun.GetLoopTimes() );
+            }
+        
+        }
+    }
 
+void FrmMain::on_actAddtoSet_triggered()
+    {
     QList<CSTFCase> list = getSelectedCases();
     if (list.size() == 0)
         {
         QErrorMessage *errorMessageDialog = new QErrorMessage(this);
+        errorMessageDialog->setAutoFillBackground(true);
         errorMessageDialog->showMessage(tr(
-                "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")
@@ -642,30 +846,53 @@
     QTreeWidgetItem* item = treeModuleList->topLevelItem(index);
     while (item != 0)
         {
-        item->setText(0, item->text(0).replace(0,3, header));
+        if(!item->isHidden())
+            item->setText(0, item->text(0).replace(0,3, header));
         for (int i = 0; i < item->childCount(); i++)
             {
             QTreeWidgetItem* child = item->child(i);
-            child->setText(0,child->text(0).replace(0,3,header));
+            if(!child->isHidden())
+                child->setText(0,child->text(0).replace(0,3,header));
             }
         index++;
         item = treeModuleList->topLevelItem(index);
         }
     }
 
-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);
+    currentFilter = uiSetting->ReadSetting(KFilter);
+    currentFilterCaseSens = uiSetting->ReadSetting(KFilterCaseSens);
     int result = dlgSet.exec();
     if(result == QDialog::Accepted)
         {
@@ -673,75 +900,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 +980,102 @@
         }
     }
 
-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*/)
+    {
+    //Check if shift key is pressed
+    bool isShiftPressed = false;
+    Qt::KeyboardModifiers keyMod = QApplication::keyboardModifiers();
+    isShiftPressed=keyMod.testFlag(Qt::ShiftModifier);
+    
+    //Handle shift key.
+    //Shift not pressed.
+    if(!isShiftPressed)
+        {
+        setItemClicked(item);
+        }
+    //Shift pressed.
+    else
+        {
+        enum Direction
+            {
+            Item_NoDirection,
+            Item_Above,
+            Item_Below
+            };
+        Direction direction = Item_NoDirection;
+        QTreeWidgetItem* tempItem = item;
+        //check direction of last selected item comparing current one.
+        while(tempItem)
+            {
+            tempItem = treeModuleList->itemAbove(tempItem);
+            if(tempItem == lastItemSelected)
+                {
+                direction = Item_Above;
+                break;
+                }
+            }
+        if (direction != Item_Above)
+            {
+            tempItem = item;
+            while(tempItem)
+                {
+                tempItem = treeModuleList->itemBelow(tempItem);
+                if(tempItem == lastItemSelected)
+                    {
+                    direction = Item_Below;
+                    break;
+                    }
+                }
+            }
+        
+        // Select all items between current item and last selected item.
+        tempItem = item;
+        if(direction != Item_NoDirection)
+            {
+            while(tempItem)
+                {
+                //check if this item been selected.
+                bool isItemSelected = false;
+                if ( tempItem->text(0).left(3).compare(SELECTITEMHEADER)==0 )
+                    {
+                    isItemSelected = true;
+                    }
+                // If not selected, set to selected.
+                if (!isItemSelected )
+                    {
+                    setItemClicked(tempItem);
+                    }
+                
+                //Go above/below
+                if (direction == Item_Above)
+                    {
+                    tempItem = treeModuleList->itemAbove(tempItem);             
+                    }
+                if (direction == Item_Below)
+                    {
+                    tempItem = treeModuleList->itemBelow(tempItem);             
+                    }
+                
+                if (tempItem == lastItemSelected)
+                    {
+                    break;
+                    }
+                }
+            }
+        }
+    
+    // Set current clicked item to last selected item.
+    lastItemSelected = item;
+
+      
+    }
+
+void FrmMain::setItemClicked(QTreeWidgetItem* item)
     {
     QString header = UNSELECTITEMHEADER;
     if(item->text(0).startsWith(UNSELECTITEMHEADER))
@@ -776,34 +1089,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);
+    }
+
+// End of File
--- a/stifui/qt/src/main.cpp	Fri Jun 11 16:29:34 2010 +0100
+++ b/stifui/qt/src/main.cpp	Thu Jul 22 16:33:59 2010 +0100
@@ -20,9 +20,11 @@
 
 int main(int argc, char* argv[])
 {
+    Q_INIT_RESOURCE(StfQtUI);
     QApplication app(argc, argv);
-    frmMain win;
+    FrmMain win;
     win.showMaximized();
     return app.exec();
 }
 
+// End of File
--- a/stifui/qt/src/stfqtuicontroller.cpp	Fri Jun 11 16:29:34 2010 +0100
+++ b/stifui/qt/src/stfqtuicontroller.cpp	Thu Jul 22 16:33:59 2010 +0100
@@ -18,18 +18,21 @@
 #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)
+    model(aModel), 
+    isShowOutput(false), 
+    iCurrentRunPos(0),
+    isLoopInfinitely(false),
+    loopTimes(0)
+       
     {
-//    __OPENLOGL ("\\STFQtUI\\", "StifQtUi.log" );
     executor = new CStifExecutor();
     executor->OpenIniFile(DEFAULTINI);
     executor->AddStifCaseUpdateListener(this);
@@ -40,15 +43,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 +140,71 @@
         }
     }
 
-void StfQtUIController::AddCaseToSet(const QList<CSTFCase>& caseList,
-        const QString& /*setName*/)
+// run cases repeatly. 
+// By default, loopTimes = -1 means loop infinitely util user stop it.
+void StfQtUIController::RepeatRunCases(const QList<CSTFCase>& aCaseList, const bool aIsLoopInfinitely, const int aLoopTimes)
+    {
+    InitRepeatSetting(aIsLoopInfinitely, aLoopTimes);
+    repeatRunCaseList = aCaseList;
+    
+    Execution();
+    
+    }
+
+void StfQtUIController::InitRepeatSetting(const bool aIsLoopInfinitely, const int aLoopTimes)
+    {
+    loopTimes = aLoopTimes;
+    isLoopInfinitely = aIsLoopInfinitely;
+    iCurrentRunPos = 0;
+    }
+
+void StfQtUIController::ResetRepeatSetting()
     {
-    QString setName = QDateTime::currentDateTime().toString("hh_mm_ss");
-    setName.append(".set");
-    executor->CreateSet(setName);
+    iCurrentRunPos = 0;
+    isLoopInfinitely = false;
+    loopTimes = 0;
+    }
+
+// Repeat execution cases
+void StfQtUIController::Execution()
+    {
+    if(loopTimes > 0  || isLoopInfinitely)
+        {
+        int count = repeatRunCaseList.count();
+        CSTFCase aCase = repeatRunCaseList.at(iCurrentRunPos);
+        QString msg = "Start execute case:" + aCase.Name();
+        FireOnGetOutput(msg);
+        executor->ExecuteSingleCase(aCase.ModuleName(), aCase.Index());
+        
+        iCurrentRunPos++;
+        if( iCurrentRunPos >= count )
+            {
+            iCurrentRunPos = 0;
+            loopTimes --;
+            }    
+        }
+    }
+
+bool StfQtUIController::AddCaseToSet(const QList<CSTFCase>& caseList,
+        const QString& setName)
+    {
+    QString name = setName;
+    bool rst = true;
     foreach(CSTFCase aCase, caseList)
             {
-            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 +224,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 +274,12 @@
     FireOnGetOutput("Case Aborted");
     }
 
+CSTFCase StfQtUIController::GetRunningCase(int index)
+    {
+    CStartedTestCase* startedCase = (CStartedTestCase*) index;
+    return model->GetRunningCase(startedCase);
+    }
+
 bool StfQtUIController::ShowOutput()
     {
     return isShowOutput;
@@ -256,6 +333,9 @@
         model->RemoveRunningCase(aCase);
         model->AddCaseByStatus(EStatusAborted, stfcase);
         msg += "aborted";
+        
+        //reset repeat execution information
+        ResetRepeatSetting();
 
         }
     else if (flags & CUIStoreIf::EStatusExecuted)
@@ -279,7 +359,12 @@
             model->AddCaseByStatus(EStatusPassed, stfcase);
             msg += "passed";
             }
-
+        
+        // if repeat execution is choosed, start to execution again.
+        if(loopTimes > 0 || isLoopInfinitely)
+            {
+            Execution();
+            }
         }
     else
         {
@@ -297,7 +382,7 @@
 void StfQtUIController::FireOnCaseOutputChanged(
         IStfEventListener::CaseOutputCommand cmd, int index, QString msg)
     {
-    if (ShowOutput())
+    if (true)//ShowOutput
         {
         foreach(IStfEventListener* listener, listenerList)
                 {
@@ -322,3 +407,5 @@
             listener->OnSetListChanged();
             }
     }
+
+// End of File
--- a/stifui/qt/src/stfqtuimodel.cpp	Fri Jun 11 16:29:34 2010 +0100
+++ b/stifui/qt/src/stfqtuimodel.cpp	Thu Jul 22 16:33:59 2010 +0100
@@ -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)
@@ -86,6 +91,8 @@
         case EStatusCrashed:
             crashedCaseList.append(aCase);
             break;
+        default:
+            break;            
         }
     FireOnCaseStatisticChangedEvent();
     }
@@ -106,6 +113,8 @@
             return abortCaseList;
         case EStatusCrashed:
             return crashedCaseList;
+        default:
+            break;
         }
     QList<CSTFCase> list;
     return list;
@@ -154,3 +163,5 @@
     crashedCaseList.clear();
     FireOnCaseStatisticChangedEvent();
     }
+
+// End of File
--- a/stifui/qt/src/stifexecutor.cpp	Fri Jun 11 16:29:34 2010 +0100
+++ b/stifui/qt/src/stifexecutor.cpp	Thu Jul 22 16:33:59 2010 +0100
@@ -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);
     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++)
@@ -358,3 +404,4 @@
 
     }
 
+// End of File
--- a/stifui/qt/src/uisetting.cpp	Fri Jun 11 16:29:34 2010 +0100
+++ b/stifui/qt/src/uisetting.cpp	Thu Jul 22 16:33:59 2010 +0100
@@ -40,6 +40,11 @@
         {
         value = settingList.value(item);
         }
+    else
+        {
+        value = getDefaultValue(item);
+        settingList.insert(item, value);
+        }
     return value;
     }
 
@@ -58,10 +63,34 @@
 void UiSetting::loadDefault()
     {
     settingList.clear();
-    settingList.insert("showoutput", "true");
+    settingList.insert(KShowOutput, getDefaultValue(KShowOutput));
+    settingList.insert(KStyleSheet, getDefaultValue(KStyleSheet));
+    settingList.insert(KFilter, getDefaultValue(KFilter));
+    settingList.insert(KFilterCaseSens, getDefaultValue(KFilterCaseSens));
     //add mor default setting here.
     }
 
+QString UiSetting::getDefaultValue(const QString& item)
+    {
+    QString result = "";
+    if(item == KShowOutput)
+        {
+        result = "true";
+        }
+    else if(item == KStyleSheet)
+        {
+        result = ":/qss/coffee.qss";
+        }
+    else if(item == KFilter)
+        {
+        result = "";
+        }
+    else if(item == KFilterCaseSens)
+        {
+        result = "false";
+        }
+    return result;
+    }
 
 bool UiSetting::load()
     {
@@ -75,7 +104,7 @@
     int index;
     while(!in.atEnd())
         {
-        line = in.readLine().trimmed().toLower();
+        line = in.readLine().trimmed();
         if(!line.startsWith("//"))
             {
             index = line.indexOf("=");
@@ -83,6 +112,8 @@
                 {
                 item = line.left(index).trimmed();
                 value = line.right(line.length() - index  -1);
+                if(item == KFilter) //For filter do not care about stored value
+                    value = "";
                 settingList.insert(item, value);
                 }
             }
@@ -112,3 +143,4 @@
     return true;    
     }
 
+// End of File
--- a/stifui/qt/stifqtui.pro	Fri Jun 11 16:29:34 2010 +0100
+++ b/stifui/qt/stifqtui.pro	Thu Jul 22 16:33:59 2010 +0100
@@ -1,20 +1,17 @@
-#
 # Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
 # All rights reserved.
 # This component and the accompanying materials are made available
 # under the terms of "Eclipse Public License v1.0"
 # which accompanies 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/dlgrepeatrun.h \
+    inc/dlgsetselector.h \
+    inc\version.h \
     inc\frmmain.h \
     inc\istfqtuicontroller.h \
     inc\stfqtuicontroller.h \
@@ -25,16 +22,17 @@
     inc\dlgoutput.h \
     inc\uisetting.h \
     inc\dlgsetting.h \
-   
-SOURCES += src\frmmain.cpp \
+    inc\uiversion.h
+SOURCES += src/dlgrepeatrun.cpp \
+    src\dlgsetselector.cpp \
+    src\frmmain.cpp \
     src\main.cpp \
     src\stfqtuimodel.cpp \
     src\stfqtuicontroller.cpp \
     src\dlgoutput.cpp \
     src\uisetting.cpp \
-    src\dlgsetting.cpp \
-    
-RESOURCES += 
+    src\dlgsetting.cpp
+RESOURCES += resource\StfQtUI.qrc
 symbian { 
     TARGET.UID3 = 0x2002BCA0
     TARGET.EPOCALLOWDLLDATA = 1
@@ -46,21 +44,11 @@
     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)"
 }