# HG changeset patch # User Dremov Kirill (Nokia-D-MSW/Tampere) # Date 1274953939 -10800 # Node ID 4b22a598b890412449f4f1d460fbb3b85a558920 # Parent 4f2773374efff8b60b12e696d2a85fd9a770a731 Revision: 201019 Kit: 2010121 diff -r 4f2773374eff -r 4b22a598b890 creator/creator.pro --- a/creator/creator.pro Fri May 14 15:53:02 2010 +0300 +++ b/creator/creator.pro Thu May 27 12:52:19 2010 +0300 @@ -71,7 +71,7 @@ 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 diff -r 4f2773374eff -r 4b22a598b890 creator/engine/inc/creator_accesspoint.h --- a/creator/engine/inc/creator_accesspoint.h Fri May 14 15:53:02 2010 +0300 +++ b/creator/engine/inc/creator_accesspoint.h Thu May 27 12:52:19 2010 +0300 @@ -28,11 +28,11 @@ #include #include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include #include #include #include @@ -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 ); diff -r 4f2773374eff -r 4b22a598b890 creator/engine/inc/creator_browser.h --- a/creator/engine/inc/creator_browser.h Fri May 14 15:53:02 2010 +0300 +++ b/creator/engine/inc/creator_browser.h Thu May 27 12:52:19 2010 +0300 @@ -26,9 +26,9 @@ #include "creator_modulebase.h" #include -#include -#include -#include +#include +#include +#include @@ -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); diff -r 4f2773374eff -r 4b22a598b890 creator/engine/inc/creator_calendar.h --- a/creator/engine/inc/creator_calendar.h Fri May 14 15:53:02 2010 +0300 +++ b/creator/engine/inc/creator_calendar.h Thu May 27 12:52:19 2010 +0300 @@ -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); diff -r 4f2773374eff -r 4b22a598b890 creator/engine/inc/creator_calendarbase.h --- a/creator/engine/inc/creator_calendarbase.h Fri May 14 15:53:02 2010 +0300 +++ b/creator/engine/inc/creator_calendarbase.h Thu May 27 12:52:19 2010 +0300 @@ -25,7 +25,7 @@ class CCreatorModuleBaseParameters; -class CCreatorCalendarBase : public CBase, public MCreatorModuleBase{ +class CCreatorCalendarBase : public CCreatorModuleBase{ public: diff -r 4f2773374eff -r 4b22a598b890 creator/engine/inc/creator_connectionmethod.h --- a/creator/engine/inc/creator_connectionmethod.h Fri May 14 15:53:02 2010 +0300 +++ b/creator/engine/inc/creator_connectionmethod.h Thu May 27 12:52:19 2010 +0300 @@ -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 ); diff -r 4f2773374eff -r 4b22a598b890 creator/engine/inc/creator_connectionmethodbase.h --- a/creator/engine/inc/creator_connectionmethodbase.h Fri May 14 15:53:02 2010 +0300 +++ b/creator/engine/inc/creator_connectionmethodbase.h Thu May 27 12:52:19 2010 +0300 @@ -27,7 +27,7 @@ const TUint KRandomBearerType = 0xEEEEEEEE; -class CCreatorConnectionSettingsBase : public CBase, public MCreatorModuleBase +class CCreatorConnectionSettingsBase : public CCreatorModuleBase { public: diff -r 4f2773374eff -r 4b22a598b890 creator/engine/inc/creator_contactsetcache.h --- a/creator/engine/inc/creator_contactsetcache.h Fri May 14 15:53:02 2010 +0300 +++ b/creator/engine/inc/creator_contactsetcache.h Thu May 27 12:52:19 2010 +0300 @@ -22,15 +22,22 @@ #define CREATORCONTACTSETCACHE_H_ #include +#include // Forward declarations class CContactLinkCacheImp; +QTM_USE_NAMESPACE class CCreatorContactSet : public CBase { public: static CCreatorContactSet* NewL(TInt aLinkId, TInt aNumOfExistingContacts); virtual ~CCreatorContactSet(); + void AppendL(QContactLocalId); + TInt NumberOfExistingContacts() const; + RArray ContactLinks(); + const RArray ContactLinks() const; + TInt LinkId() const; private: @@ -38,12 +45,15 @@ //void ConstructL(); TInt iLinkId; TInt iNumOfExistingContacts; + RArray iContactLinks; }; class MContactLinkCache { public: virtual void AppendL(CCreatorContactSet* aContactSet) = 0; + virtual RArray ContactLinks(TInt aLinkId) = 0; + virtual const RArray ContactLinks(TInt aLinkId) const = 0; virtual RPointerArray& ContactSets() = 0; virtual const RPointerArray& ContactSets() const = 0; virtual const CCreatorContactSet& ContactSet(TInt aLinkId) const = 0; diff -r 4f2773374eff -r 4b22a598b890 creator/engine/inc/creator_file.h --- a/creator/engine/inc/creator_file.h Fri May 14 15:53:02 2010 +0300 +++ b/creator/engine/inc/creator_file.h Thu May 27 12:52:19 2010 +0300 @@ -38,7 +38,7 @@ class CDRMPermission; class CDRMConstraint; -class CCreatorFiles : public CBase, public MCreatorModuleBase +class CCreatorFiles : public CCreatorModuleBase { public: static CCreatorFiles* NewL(CCreatorEngine* aEngine); @@ -50,7 +50,9 @@ 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 + void QueryDialogClosedL(TBool, TInt){/*TODO: DialogClosed*/}; TInt CreateFileEntryL(CFilesParameters *aParameters, TInt aCommand); void DeleteAllL(); void DeleteAllCreatedByCreatorL(); diff -r 4f2773374eff -r 4b22a598b890 creator/engine/inc/creator_landmark.h --- a/creator/engine/inc/creator_landmark.h Fri May 14 15:53:02 2010 +0300 +++ b/creator/engine/inc/creator_landmark.h Thu May 27 12:52:19 2010 +0300 @@ -25,7 +25,7 @@ #include "creator_modulebase.h" #include -#include +#include 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(); diff -r 4f2773374eff -r 4b22a598b890 creator/engine/inc/creator_log.h --- a/creator/engine/inc/creator_log.h Fri May 14 15:53:02 2010 +0300 +++ b/creator/engine/inc/creator_log.h Thu May 27 12:52:19 2010 +0300 @@ -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; diff -r 4f2773374eff -r 4b22a598b890 creator/engine/inc/creator_mailbox.h --- a/creator/engine/inc/creator_mailbox.h Fri May 14 15:53:02 2010 +0300 +++ b/creator/engine/inc/creator_mailbox.h Thu May 27 12:52:19 2010 +0300 @@ -28,11 +28,11 @@ #include #include -#include +#include #include -#include +#include #include -#include +#include #include 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(); diff -r 4f2773374eff -r 4b22a598b890 creator/engine/inc/creator_mailboxelement.h --- a/creator/engine/inc/creator_mailboxelement.h Fri May 14 15:53:02 2010 +0300 +++ b/creator/engine/inc/creator_mailboxelement.h Thu May 27 12:52:19 2010 +0300 @@ -23,6 +23,8 @@ #include "creator_scriptelement.h" +class CMailboxesParameters; + namespace creatormailbox { _LIT(Kmailbox, "mailbox"); diff -r 4f2773374eff -r 4b22a598b890 creator/engine/inc/creator_message.h --- a/creator/engine/inc/creator_message.h Fri May 14 15:53:02 2010 +0300 +++ b/creator/engine/inc/creator_message.h Thu May 27 12:52:19 2010 +0300 @@ -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); @@ -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(); diff -r 4f2773374eff -r 4b22a598b890 creator/engine/inc/creator_modulebase.h --- a/creator/engine/inc/creator_modulebase.h Fri May 14 15:53:02 2010 +0300 +++ b/creator/engine/inc/creator_modulebase.h Thu May 27 12:52:19 2010 +0300 @@ -16,13 +16,14 @@ */ - - #ifndef __CREATOR_MODULEBASE_H__ #define __CREATOR_MODULEBASE_H__ #include +#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,97 @@ class MCreatorModuleBaseParameters; class CCommandParser; +_LIT(KSavingText, "Saving"); + 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(){ } + + 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; + } + + TBool finished(EFalse); + TBool retval(ETrue); + switch(aUserData) + { + case ECreatorModuleDelete: + 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( KSavingText ); + } + } -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 +180,4 @@ #endif // __CREATOR_MODULEBASE_H__ - \ No newline at end of file + diff -r 4f2773374eff -r 4b22a598b890 creator/engine/inc/creator_note.h --- a/creator/engine/inc/creator_note.h Fri May 14 15:53:02 2010 +0300 +++ b/creator/engine/inc/creator_note.h Thu May 27 12:52:19 2010 +0300 @@ -39,7 +39,7 @@ class CNotepadParameters; -class CCreatorNotepad : public CBase, public MCreatorModuleBase +class CCreatorNotepad : public CCreatorModuleBase { public: static CCreatorNotepad* NewL(CCreatorEngine* aEngine); @@ -51,7 +51,8 @@ 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(); diff -r 4f2773374eff -r 4b22a598b890 creator/engine/inc/creator_phonebook.h --- a/creator/engine/inc/creator_phonebook.h Fri May 14 15:53:02 2010 +0300 +++ b/creator/engine/inc/creator_phonebook.h Thu May 27 12:52:19 2010 +0300 @@ -22,7 +22,6 @@ #ifndef __CREATORPHONEBOOK_H__ #define __CREATORPHONEBOOK_H__ -#include "engine.h" #include "creator_phonebookbase.h" #include "creator_randomdatafield.h" @@ -90,7 +89,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); @@ -104,7 +102,7 @@ private: void InitializeContactParamsL(/*CCreatorModuleBaseParameters* aParameters*/); - TBool IsContactGroupL(/*const MVPbkContactLink& aLink*/); //modify + TBool IsContactGroupL( QContactLocalId& aLink ); void StoreLinksForDeleteL( RArray& aLinks, TUid aStoreUid ); //modify void DeleteContactsL( QList& contacts /*MVPbkContactLinkArray* aContacts, TBool aGroup*/ ); //modify void DeleteItemsCreatedWithCreatorL( TUid aStoreUid ); @@ -123,7 +121,6 @@ static QString iPhoneNumberFields[]; static TInt iUrlFields[]; static TInt iEmailFields[]; - TBool iAddAllFields; //QList RArray iContactLinkArray;//CVPbkContactLinkArray* iContactLinkArray; //modify RArray iContactsToDelete; //CVPbkContactLinkArray* iContactsToDelete; //modify @@ -151,7 +148,7 @@ }; /** - * Virtual phonebook parameters + * phonebook parameters */ @@ -182,5 +179,17 @@ }; +class CCreatorContactField : public CBase//, public MCreatorRandomDataField + { +public: + static CCreatorContactField* NewL(); + QContactDetail CreateContactDetail(CCreatorEngine* aEngine,CPhonebookParameters* aParameters,QString aDetail, QString aFieldContext, QString aFieldString, TInt aRand = KErrNotFound ); + QContactDetail CreateContactDetail(CCreatorEngine* aEngine,CPhonebookParameters* aParameters,QString aDetail, QString aFieldContext, QString aFieldString, TPtrC aData ); + void AddFieldToParam( CPhonebookParameters* aParam, QContactDetail aDetail); + ~CCreatorContactField(); +private: + CCreatorContactField(); + void ConstructL(); + }; #endif // __CREATORPHONEBOOK_H__ diff -r 4f2773374eff -r 4b22a598b890 creator/engine/inc/creator_phonebookbase.h --- a/creator/engine/inc/creator_phonebookbase.h Fri May 14 15:53:02 2010 +0300 +++ b/creator/engine/inc/creator_phonebookbase.h Thu May 27 12:52:19 2010 +0300 @@ -28,13 +28,27 @@ class CCreatorModuleBaseParameters; -class CCreatorPhonebookBase : public CBase, public MCreatorModuleBase{ +class CCreatorPhonebookBase : public CCreatorModuleBase +{ +enum TCreatorPhonebookStatus{ + ECreatorPhonebookDelete = 0, + ECreatorPhonebookStart, + ECreatorPhonebookGetContactFields, + ECreatorPhonebookGetPhoneNumbersCount, + ECreatorPhonebookGetUrlsCount, + ECreatorPhonebookGetEmailsCount, + 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 +62,7 @@ TInt iNumberOfEmailAddressFields; TInt iContactsInGroup; TBool iDefaultFieldsSelected; + TBool iAddAllFields; }; diff -r 4f2773374eff -r 4b22a598b890 creator/engine/inc/creator_scriptentry.h --- a/creator/engine/inc/creator_scriptentry.h Fri May 14 15:53:02 2010 +0300 +++ b/creator/engine/inc/creator_scriptentry.h Thu May 27 12:52:19 2010 +0300 @@ -23,13 +23,11 @@ #define __FILEUTILS_H__ -#include "engine.h" - #include #include #include -#include -#include +#include +#include #include #include @@ -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 OpenScriptL(MCommandParserObserver* aObserver); TBool GetRandomDataFilenameL(TDes& aFilename); private: CCreatorEngine* iEngine; CDesCArrayFlat* iSearchArray; - + TInt iSelectedItem; + TInt iParserPosition; TInt iParserOldPosition; HBufC8* iReadBuf; + MCommandParserObserver* iObserver; }; diff -r 4f2773374eff -r 4b22a598b890 creator/engine/inc/creator_virtualphonebook.h --- a/creator/engine/inc/creator_virtualphonebook.h Fri May 14 15:53:02 2010 +0300 +++ b/creator/engine/inc/creator_virtualphonebook.h Thu May 27 12:52:19 2010 +0300 @@ -70,7 +70,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); @@ -136,7 +135,6 @@ static TInt iPhoneNumberFields[]; static TInt iUrlFields[]; static TInt iEmailFields[]; - TBool iAddAllFields; CVPbkContactLinkArray* iContactLinkArray; CVPbkContactLinkArray* iContactsToDelete; CVPbkContactLinkArray* iContactGroupsToDelete; diff -r 4f2773374eff -r 4b22a598b890 creator/engine/inc/creator_wepsecuritysettings.h --- a/creator/engine/inc/creator_wepsecuritysettings.h Fri May 14 15:53:02 2010 +0300 +++ b/creator/engine/inc/creator_wepsecuritysettings.h Thu May 27 12:52:19 2010 +0300 @@ -72,7 +72,7 @@ private: CCreatorWEPSecuritySettings(); - void ConstructL(); // from MCreatorModuleBase + void ConstructL(); public: diff -r 4f2773374eff -r 4b22a598b890 creator/engine/src/creator_accesspoint.cpp --- a/creator/engine/src/creator_accesspoint.cpp Fri May 14 15:53:02 2010 +0300 +++ b/creator/engine/src/creator_accesspoint.cpp Thu May 27 12:52:19 2010 +0300 @@ -20,8 +20,8 @@ #include "creator_accesspoint.h" #include "creator_traces.h" -#include -#include +#include +#include #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 ); } diff -r 4f2773374eff -r 4b22a598b890 creator/engine/src/creator_browser.cpp --- a/creator/engine/src/creator_browser.cpp Fri May 14 15:53:02 2010 +0300 +++ b/creator/engine/src/creator_browser.cpp Thu May 27 12:52:19 2010 +0300 @@ -16,7 +16,7 @@ */ -#include +#include #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; } } diff -r 4f2773374eff -r 4b22a598b890 creator/engine/src/creator_calendar.cpp --- a/creator/engine/src/creator_calendar.cpp Fri May 14 15:53:02 2010 +0300 +++ b/creator/engine/src/creator_calendar.cpp Thu May 27 12:52:19 2010 +0300 @@ -330,63 +330,105 @@ //---------------------------------------------------------------------------- -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; + } + + TBool finished(EFalse); + TBool retval(ETrue); + switch(aUserData) + { + case ECreatorCalendarDelete: + iEntriesToBeCreated = 1; + 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( KSavingText ); + } + } + +//---------------------------------------------------------------------------- + +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 } //---------------------------------------------------------------------------- diff -r 4f2773374eff -r 4b22a598b890 creator/engine/src/creator_cmdscriptrun.cpp --- a/creator/engine/src/creator_cmdscriptrun.cpp Fri May 14 15:53:02 2010 +0300 +++ b/creator/engine/src/creator_cmdscriptrun.cpp Thu May 27 12:52:19 2010 +0300 @@ -16,8 +16,8 @@ */ -#include -#include +#include +#include #include #include "creator_cmdscriptrun.h" #include "engine.h" diff -r 4f2773374eff -r 4b22a598b890 creator/engine/src/creator_connectionmethod.cpp --- a/creator/engine/src/creator_connectionmethod.cpp Fri May 14 15:53:02 2010 +0300 +++ b/creator/engine/src/creator_connectionmethod.cpp Thu May 27 12:52:19 2010 +0300 @@ -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 ); } } diff -r 4f2773374eff -r 4b22a598b890 creator/engine/src/creator_contactelement.cpp --- a/creator/engine/src/creator_contactelement.cpp Fri May 14 15:53:02 2010 +0300 +++ b/creator/engine/src/creator_contactelement.cpp Thu May 27 12:52:19 2010 +0300 @@ -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 +#include using namespace Xml; using namespace creatorcontact; @@ -40,9 +42,102 @@ { public: TPtrC iElementName; - TInt iFieldCode; + QString iDetail; + QString iContext; + QString iFieldCode; TContactFieldDataType iDataType; }; +//********************************************************************************* +FieldMapping fieldMappingTbl[] = { + {TPtrC(KFirstname), (QContactName::DefinitionName).operator QString(), (QContactDetail::ContextHome).operator QString(),(QContactName::FieldFirstName).operator QString() /*R_VPBK_FIELD_TYPE_FIRSTNAME*/, EDataTypeText}, + {TPtrC(KLastname), (QContactName::DefinitionName).operator QString(), (QContactDetail::ContextHome).operator QString(),(QContactName::FieldLastName).operator QString() /*R_VPBK_FIELD_TYPE_LASTNAME*/, EDataTypeText}, + {TPtrC(KPrefix), (QContactName::DefinitionName).operator QString(), (QContactDetail::ContextHome).operator QString(),(QContactName::FieldPrefix).operator QString()/*R_VPBK_FIELD_TYPE_PREFIX*/, EDataTypeText}, + {TPtrC(KSuffix), (QContactName::DefinitionName).operator QString(), (QContactDetail::ContextHome).operator QString(),(QContactName::FieldSuffix).operator QString()/*R_VPBK_FIELD_TYPE_SUFFIX*/, EDataTypeText}, + {TPtrC(KSecondname), (QContactName::DefinitionName).operator QString(), (QContactDetail::ContextHome).operator QString(),(QContactName::FieldMiddleName).operator QString()/*R_VPBK_FIELD_TYPE_SECONDNAME*/, EDataTypeText}, + {TPtrC(KLandphoneHome), (QContactPhoneNumber::DefinitionName).operator QString(), (QContactDetail::ContextHome).operator QString(),(QContactPhoneNumber::SubTypeLandline).operator QString()/*R_VPBK_FIELD_TYPE_LANDPHONEHOME*/, EDataTypeText}, + + {TPtrC(KMobilephoneHome), (QContactPhoneNumber::DefinitionName).operator QString(), (QContactDetail::ContextHome).operator QString(),(QContactPhoneNumber::SubTypeMobile).operator QString()/*R_VPBK_FIELD_TYPE_MOBILEPHONEHOME*/, EDataTypeText}, + {TPtrC(KVideonumberHome), (QContactPhoneNumber::DefinitionName).operator QString(), (QContactDetail::ContextHome).operator QString(),(QContactPhoneNumber::SubTypeVideo).operator QString()/*R_VPBK_FIELD_TYPE_VIDEONUMBERHOME*/, EDataTypeText}, + {TPtrC(KFaxnumberHome), (QContactPhoneNumber::DefinitionName).operator QString(), (QContactDetail::ContextHome).operator QString(),(QContactPhoneNumber::SubTypeFacsimile).operator QString()/*R_VPBK_FIELD_TYPE_FAXNUMBERHOME*/, EDataTypeText}, + //{TPtrC(KVoipHome), (QContactPhoneNumber::DefinitionName).operator QString(), (QContactDetail::ContextHome).operator QString(),(QContactPhoneNumber::SubType).operator QString()/*R_VPBK_FIELD_TYPE_VOIPHOME*/, EDataTypeText}, + {TPtrC(KEmailHome), (QContactEmailAddress::DefinitionName).operator QString(), (QContactDetail::ContextHome).operator QString(),""/*R_VPBK_FIELD_TYPE_EMAILHOME*/, EDataTypeText}, + {TPtrC(KUrlHome), (QContactUrl::DefinitionName).operator QString(), (QContactDetail::ContextHome).operator QString(),(QContactUrl::SubTypeHomePage).operator QString()/*R_VPBK_FIELD_TYPE_URLHOME*/, EDataTypeText}, + //{TPtrC(KAddrlabelHome), R_VPBK_FIELD_TYPE_ADDRLABELHOME, EDataTypeText}, + {TPtrC(KAddrpoHome), (QContactAddress::DefinitionName).operator QString(), (QContactDetail::ContextHome).operator QString(),(QContactAddress::FieldPostOfficeBox).operator QString()/*R_VPBK_FIELD_TYPE_ADDRPOHOME*/, EDataTypeText}, + + // {TPtrC(KAddrextHome), (QContactAddress::DefinitionName).operator QString(), (QContactDetail::ContextHome).operator QString(),(QContactAddress::Field).operator QString()/*R_VPBK_FIELD_TYPE_ADDREXTHOME*/, EDataTypeText}, + {TPtrC(KAddrstreetHome), (QContactAddress::DefinitionName).operator QString(), (QContactDetail::ContextHome).operator QString(),(QContactAddress::FieldStreet).operator QString()/*R_VPBK_FIELD_TYPE_ADDRSTREETHOME*/, EDataTypeText}, + {TPtrC(KAddrlocalHome), (QContactAddress::DefinitionName).operator QString(), (QContactDetail::ContextHome).operator QString(),(QContactAddress::FieldLocality).operator QString()/*R_VPBK_FIELD_TYPE_ADDRLOCALHOME*/, EDataTypeText}, + {TPtrC(KAddrregionHome), (QContactAddress::DefinitionName).operator QString(), (QContactDetail::ContextHome).operator QString(),(QContactAddress::FieldRegion).operator QString()/*R_VPBK_FIELD_TYPE_ADDRREGIONHOME*/, EDataTypeText}, + {TPtrC(KAddrpostcodeHome), (QContactAddress::DefinitionName).operator QString(), (QContactDetail::ContextHome).operator QString(),(QContactAddress::FieldPostcode).operator QString()/*R_VPBK_FIELD_TYPE_ADDRPOSTCODEHOME*/, EDataTypeText}, + {TPtrC(KAddrcountryHome), (QContactAddress::DefinitionName).operator QString(), (QContactDetail::ContextHome).operator QString(),(QContactAddress::FieldCountry).operator QString()/*R_VPBK_FIELD_TYPE_ADDRCOUNTRYHOME*/, EDataTypeText}, + {TPtrC(KJobtitle), (QContactOrganization::DefinitionName).operator QString(), (QContactDetail::ContextWork).operator QString(),(QContactOrganization::FieldTitle).operator QString()/*R_VPBK_FIELD_TYPE_JOBTITLE*/, EDataTypeText}, + {TPtrC(KCompanyname), (QContactOrganization::DefinitionName).operator QString(), (QContactDetail::ContextWork).operator QString(),(QContactOrganization::FieldName).operator QString()/*R_VPBK_FIELD_TYPE_COMPANYNAME*/, EDataTypeText}, + + {TPtrC(KLandphoneWork), (QContactPhoneNumber::DefinitionName).operator QString(), (QContactDetail::ContextWork).operator QString(),(QContactPhoneNumber::SubTypeLandline).operator QString()/*R_VPBK_FIELD_TYPE_LANDPHONEWORK*/, EDataTypeText}, + {TPtrC(KMobilephoneWork), (QContactPhoneNumber::DefinitionName).operator QString(), (QContactDetail::ContextWork).operator QString(),(QContactPhoneNumber::SubTypeMobile).operator QString()/*R_VPBK_FIELD_TYPE_MOBILEPHONEWORK*/, EDataTypeText}, + {TPtrC(KVideonumberWork), (QContactPhoneNumber::DefinitionName).operator QString(), (QContactDetail::ContextWork).operator QString(),(QContactPhoneNumber::SubTypeVideo).operator QString()/*R_VPBK_FIELD_TYPE_VIDEONUMBERWORK*/, EDataTypeText}, + {TPtrC(KFaxnumberWork), (QContactPhoneNumber::DefinitionName).operator QString(), (QContactDetail::ContextWork).operator QString(),(QContactPhoneNumber::SubTypeFacsimile).operator QString()/*R_VPBK_FIELD_TYPE_FAXNUMBERWORK*/, EDataTypeText}, + //{TPtrC(KVoipWork), R_VPBK_FIELD_TYPE_VOIPWORK, EDataTypeText}, + {TPtrC(KEmailWork), (QContactEmailAddress::DefinitionName).operator QString(), (QContactDetail::ContextWork).operator QString(),""/*R_VPBK_FIELD_TYPE_EMAILWORK*/, EDataTypeText}, + {TPtrC(KUrlWork), (QContactUrl::DefinitionName).operator QString(), (QContactDetail::ContextWork).operator QString(),(QContactUrl::SubTypeHomePage).operator QString()/*R_VPBK_FIELD_TYPE_URLWORK*/, EDataTypeText}, + //{TPtrC(KAddrlabelWork), R_VPBK_FIELD_TYPE_ADDRLABELWORK, EDataTypeText}, + + {TPtrC(KAddrpoWork), (QContactAddress::DefinitionName).operator QString(), (QContactDetail::ContextWork).operator QString(),(QContactAddress::FieldPostOfficeBox).operator QString()/*R_VPBK_FIELD_TYPE_ADDRPOWORK*/, EDataTypeText}, + //{TPtrC(KAddrextWork), (QContactAddress::DefinitionName).operator QString(), (QContactDetail::ContextWork).operator QString(),(QContactAddress::FieldPostOfficeBox).operator QString()/*R_VPBK_FIELD_TYPE_ADDREXTWORK*/, EDataTypeText}, + {TPtrC(KAddrstreetWork), (QContactAddress::DefinitionName).operator QString(), (QContactDetail::ContextWork).operator QString(),(QContactAddress::FieldStreet).operator QString()/*R_VPBK_FIELD_TYPE_ADDRSTREETWORK*/, EDataTypeText}, + {TPtrC(KAddrlocalWork), (QContactAddress::DefinitionName).operator QString(), (QContactDetail::ContextWork).operator QString(),(QContactAddress::FieldLocality).operator QString()/*R_VPBK_FIELD_TYPE_ADDRLOCALWORK*/, EDataTypeText}, + {TPtrC(KAddrregionWork), (QContactAddress::DefinitionName).operator QString(), (QContactDetail::ContextWork).operator QString(),(QContactAddress::FieldRegion).operator QString()/*R_VPBK_FIELD_TYPE_ADDRREGIONWORK*/, EDataTypeText}, + {TPtrC(KAddrpostcodeWork), (QContactAddress::DefinitionName).operator QString(), (QContactDetail::ContextWork).operator QString(),(QContactAddress::FieldPostcode).operator QString()/*R_VPBK_FIELD_TYPE_ADDRPOSTCODEWORK*/, EDataTypeText}, + {TPtrC(KAddrcountryWork), (QContactAddress::DefinitionName).operator QString(), (QContactDetail::ContextWork).operator QString(),(QContactAddress::FieldCountry).operator QString()/*R_VPBK_FIELD_TYPE_ADDRCOUNTRYWORK*/, EDataTypeText}, + + {TPtrC(KLandphoneGen), (QContactPhoneNumber::DefinitionName).operator QString(), "",(QContactPhoneNumber::SubTypeLandline).operator QString(), EDataTypeText}, + {TPtrC(KMobilephoneGen), (QContactPhoneNumber::DefinitionName).operator QString(), "",(QContactPhoneNumber::SubTypeMobile).operator QString(), EDataTypeText}, + {TPtrC(KVideonumberGen), (QContactPhoneNumber::DefinitionName).operator QString(), "",(QContactPhoneNumber::SubTypeVideo).operator QString(), EDataTypeText}, + {TPtrC(KFaxnumberGen), (QContactPhoneNumber::DefinitionName).operator QString(), "",(QContactPhoneNumber::SubTypeFacsimile).operator QString(), EDataTypeText}, + // {TPtrC(KVoipGen), R_VPBK_FIELD_TYPE_VOIPGEN, EDataTypeText}, + // {TPtrC(KPoc), R_VPBK_FIELD_TYPE_POC, EDataTypeText}, + // {TPtrC(KSwis), R_VPBK_FIELD_TYPE_SWIS, EDataTypeText}, + // {TPtrC(KSip), R_VPBK_FIELD_TYPE_SIP, EDataTypeText}, + {TPtrC(KEmailGen), (QContactEmailAddress::DefinitionName).operator QString(), "","", EDataTypeText}, + + {TPtrC(KUrlGen), (QContactUrl::DefinitionName).operator QString(), "","", EDataTypeText}, + // {TPtrC(KAddrlabelGen), R_VPBK_FIELD_TYPE_ADDRLABELGEN, EDataTypeText}, + {TPtrC(KAddrpoGen), (QContactAddress::DefinitionName).operator QString(), "",(QContactAddress::FieldPostOfficeBox).operator QString()/*R_VPBK_FIELD_TYPE_ADDRPOGEN*/, EDataTypeText}, + // {TPtrC(KAddrextGen), R_VPBK_FIELD_TYPE_ADDREXTGEN, EDataTypeText}, + {TPtrC(KAddrstreetGen), (QContactAddress::DefinitionName).operator QString(), "" , (QContactAddress::FieldStreet).operator QString()/*R_VPBK_FIELD_TYPE_ADDRSTREETGEN*/, EDataTypeText}, + {TPtrC(KAddrlocalGen), (QContactAddress::DefinitionName).operator QString(), "" , (QContactAddress::FieldLocality).operator QString()/*R_VPBK_FIELD_TYPE_ADDRLOCALGEN*/, EDataTypeText}, + {TPtrC(KAddrregionGen), (QContactAddress::DefinitionName).operator QString(), "" , (QContactAddress::FieldRegion).operator QString()/*R_VPBK_FIELD_TYPE_ADDRREGIONGEN*/, EDataTypeText}, + {TPtrC(KAddrpostcodeGen), (QContactAddress::DefinitionName).operator QString(), "" , (QContactAddress::FieldPostcode).operator QString()/*R_VPBK_FIELD_TYPE_ADDRPOSTCODEGEN*/, EDataTypeText}, + {TPtrC(KAddrcountryGen), (QContactAddress::DefinitionName).operator QString(), "" , (QContactAddress::FieldCountry).operator QString()/*R_VPBK_FIELD_TYPE_ADDRCOUNTRYGEN*/, EDataTypeText}, + + {TPtrC(KPagerNumber),(QContactPhoneNumber::DefinitionName).operator QString(), (QContactDetail::ContextWork).operator QString(),(QContactPhoneNumber::SubTypePager).operator QString()/* R_VPBK_FIELD_TYPE_PAGERNUMBER*/, EDataTypeText}, + {TPtrC(KDtmfString), (QContactPhoneNumber::DefinitionName).operator QString(), (QContactDetail::ContextWork).operator QString(),(QContactPhoneNumber::SubTypeDtmfMenu).operator QString()/* R_VPBK_FIELD_TYPE_DTMFSTRING*/, EDataTypeText}, + // {TPtrC(KWvAddress), R_VPBK_FIELD_TYPE_WVADDRESS, EDataTypeText}, + {TPtrC(KDate), (QContactBirthday::DefinitionName).operator QString(), (QContactDetail::ContextWork).operator QString(),(QContactBirthday::FieldBirthday).operator QString()/* R_VPBK_FIELD_TYPE_DATE*/, EDataTypeDateTime}, + {TPtrC(KNote), (QContactNote::DefinitionName).operator QString(), (QContactDetail::ContextHome).operator QString(), (QContactNote::FieldNote).operator QString()/* R_VPBK_FIELD_TYPE_NOTE*/, EDataTypeText}, + {TPtrC(KThumbnailPath), (QContactAvatar::DefinitionName).operator QString(), (QContactDetail::ContextHome).operator QString(),(QContactAvatar::SubTypeImage).operator QString()/* R_VPBK_FIELD_TYPE_THUMBNAILPIC*/, EDataTypeText}, + // {TPtrC(KThumbnailId), R_VPBK_FIELD_TYPE_THUMBNAILPIC, EDataTypeText}, + // {TPtrC(KRingTone), R_VPBK_FIELD_TYPE_RINGTONE, EDataTypeText}, + // {TPtrC(KRingToneId), R_VPBK_FIELD_TYPE_RINGTONE, EDataTypeText}, + + //{TPtrC(KCallerobjImg), R_VPBK_FIELD_TYPE_CALLEROBJIMG, EDataTypeText}, + // {TPtrC(KCallerobjText), R_VPBK_FIELD_TYPE_CALLEROBJTEXT, EDataTypeText}, + {TPtrC(KMiddlename), (QContactName::DefinitionName).operator QString(), (QContactDetail::ContextHome).operator QString(),(QContactName::FieldMiddleName).operator QString()/*R_VPBK_FIELD_TYPE_MIDDLENAME*/, EDataTypeText}, + {TPtrC(KDepartment), (QContactOrganization::DefinitionName).operator QString(), (QContactDetail::ContextWork).operator QString(),(QContactOrganization::FieldDepartment).operator QString()/*R_VPBK_FIELD_TYPE_DEPARTMENT*/, EDataTypeText}, + {TPtrC(KAsstname), (QContactOrganization::DefinitionName).operator QString(), (QContactDetail::ContextWork).operator QString(),(QContactOrganization::FieldAssistantName).operator QString()/*R_VPBK_FIELD_TYPE_ASSTNAME*/, EDataTypeText}, + {TPtrC(KSpouse), (QContactFamily::DefinitionName).operator QString(), (QContactDetail::ContextHome).operator QString(),(QContactFamily::FieldSpouse).operator QString()/* R_VPBK_FIELD_TYPE_SPOUSE*/, EDataTypeText}, + {TPtrC(KChildren), (QContactFamily::DefinitionName).operator QString(), (QContactDetail::ContextHome).operator QString(),(QContactFamily::FieldChildren).operator QString()/*R_VPBK_FIELD_TYPE_CHILDREN, EDataTypeText}, + {TPtrC(KAsstphone), (QContactPhoneNumber::DefinitionName).operator QString(), (QContactDetail::ContextWork).operator QString(),(QContactPhoneNumber::SubTypeAssistant).operator QString()/* R_VPBK_FIELD_TYPE_ASSTPHONE*/, EDataTypeText}, + + {TPtrC(KCarphone), (QContactPhoneNumber::DefinitionName).operator QString(), (QContactDetail::ContextHome).operator QString(),(QContactPhoneNumber::SubTypeCar).operator QString()/* R_VPBK_FIELD_TYPE_CARPHONE*/, EDataTypeText}, + {TPtrC(KAnniversary), (QContactAnniversary::DefinitionName).operator QString(), (QContactDetail::ContextWork).operator QString(),(QContactAnniversary::SubTypeEmployment).operator QString()/*R_VPBK_FIELD_TYPE_ANNIVERSARY*/, EDataTypeDateTime}, + // {TPtrC(KSyncclass), R_VPBK_FIELD_TYPE_SYNCCLASS, EDataTypeText}, + // {TPtrC(KLocPrivacy), R_VPBK_FIELD_TYPE_LOCPRIVACY, EDataTypeText}, + {TPtrC(KGenlabel), (QContactDisplayLabel::DefinitionName).operator QString(), (QContactDetail::ContextHome).operator QString(),(QContactDisplayLabel::FieldLabel).operator QString()/*R_VPBK_FIELD_TYPE_GENLABEL*/, EDataTypeText} +}; + +//********************************************************************************* CCreatorContactElementBase* CCreatorContactElementBase::NewL(CCreatorEngine* aEngine, const TDesC& aName, const TDesC& aContext) { @@ -74,8 +169,117 @@ 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& 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) ) + { + // random + CleanupStack::PushL( field ); + QContactDetail cntDetail = field->CreateContactDetail(iEngine,param,mapping.iDetail,mapping.iContext,mapping.iFieldCode, KErrNotFound ); + if(!cntDetail.isEmpty()) + { + field->AddFieldToParam( param, cntDetail ); //it will do "param->iContactFields.AppendL(field);" + } + CleanupStack::Pop( field ); + } + else + { + CleanupStack::PushL( field ); + QContactDetail cntDetail = field->CreateContactDetail(iEngine,param,mapping.iDetail,mapping.iContext,mapping.iFieldCode, content ); + if(!cntDetail.isEmpty()) + { + field->AddFieldToParam( param, cntDetail ); //it will do "param->iContactFields.AppendL(field);" + } + 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 ); + QContactDetail cntDetail = field->CreateContactDetail(iEngine,param,fieldMappingTbl[i].iDetail,fieldMappingTbl[i].iContext,fieldMappingTbl[i].iFieldCode, KErrNotFound ); + if(!cntDetail.isEmpty()) + { + field->AddFieldToParam( param, cntDetail ); //it will do "param->iContactFields.AppendL(field);" + } + 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 +351,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& linkList = membersElement->SubElements(); + if( linkList.Count() > 0 ) + { + for( TInt i = 0; i < linkList.Count(); ++i ) + { + AppendContactSetReferenceL(*linkList[i], param->iLinkIds); + } + } + + if( groupNameAttr ) + { + param ->iGroupName = QString::fromUtf16(groupNameAttr->Value().Ptr(), groupNameAttr->Value().Length()); //param->iGroupName->Des().Copy( groupNameAttr->Value() ); + } + else + { + param->iGroupName = QString::fromUtf16( iEngine->RandomString(CCreatorEngine::EGroupName).Ptr(), iEngine->RandomString(CCreatorEngine::EGroupName).Length()); //->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"); diff -r 4f2773374eff -r 4b22a598b890 creator/engine/src/creator_contactsetcache.cpp --- a/creator/engine/src/creator_contactsetcache.cpp Fri May 14 15:53:02 2010 +0300 +++ b/creator/engine/src/creator_contactsetcache.cpp Thu May 27 12:52:19 2010 +0300 @@ -32,9 +32,31 @@ return iLinkId; } +void CCreatorContactSet::AppendL(QContactLocalId aContactLink) + { + iContactLinks.AppendL(aContactLink); + } + +RArray CCreatorContactSet::ContactLinks() + { + return iContactLinks; + } + +const RArray 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 ContactLinks(TInt aLinkId); + virtual const RArray ContactLinks(TInt aLinkId) const; + virtual RPointerArray& ContactSets(); virtual const RPointerArray& ContactSets() const; virtual const CCreatorContactSet& ContactSet(TInt aLinkId) const; @@ -58,6 +84,9 @@ private: void ConstructL(); CContactLinkCacheImp(); + + RArray iEmptyLinks; + RPointerArray 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 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 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 { diff -r 4f2773374eff -r 4b22a598b890 creator/engine/src/creator_factory.cpp --- a/creator/engine/src/creator_factory.cpp Fri May 14 15:53:02 2010 +0300 +++ b/creator/engine/src/creator_factory.cpp Thu May 27 12:52:19 2010 +0300 @@ -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,8 +29,7 @@ CCreatorModuleBaseParameters* TCreatorFactory::CreatePhoneBookParametersL() { - //return new(ELeave) CVirtualPhonebookParameters; - return NULL; + return new(ELeave) CPhonebookParameters; } CCreatorConnectionSettingsBase* TCreatorFactory::CreateConnectionSettingsL(CCreatorEngine* aEngine) diff -r 4f2773374eff -r 4b22a598b890 creator/engine/src/creator_file.cpp --- a/creator/engine/src/creator_file.cpp Fri May 14 15:53:02 2010 +0300 +++ b/creator/engine/src/creator_file.cpp Thu May 27 12:52:19 2010 +0300 @@ -16,7 +16,7 @@ */ -#include +#include #include "engine.h" #include "enginewrapper.h" @@ -129,10 +129,12 @@ //---------------------------------------------------------------------------- -TBool CCreatorFiles::AskDataFromUserL(TInt aCommand, TInt& aNumberOfEntries) +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?") ); @@ -144,7 +146,7 @@ iDirectoryQueriedFromUser->Des().Copy( KNullDesC ); - if (iEngine->GetEngineWrapper()->EntriesQueryDialog(aNumberOfEntries, _L("How many entries to create?"))) + if (iEngine->GetEngineWrapper()->EntriesQueryDialog(&iEntriesToBeCreated, _L("How many entries to create?"))) { // set a default directory (eg. c:\Nokia\Images\) TFileName directory; @@ -580,7 +582,7 @@ //encDlg->ListBox()->SetCurrentItemIndexAndDraw( 0 ); // create a popup list - if ( iEngine->GetEngineWrapper()->PopupListDialog(_L("Encryption"), items, encIndex) ) + if ( iEngine->GetEngineWrapper()->PopupListDialog(_L("Encryption"), items, &encIndex, this, 1) ) { if ( encIndex > 0 ) { @@ -612,8 +614,8 @@ TBool CCreatorFiles::AskDRMCDDataFromUserL() { LOGSTRING("Creator: CCreatorFiles::AskDRMCDDataFromUserL"); - TInt count( 0 ); - if ( iEngine->GetEngineWrapper()->EntriesQueryDialog( count, _L("How many counts\r\n(0=unlimited)?"), ETrue ) ) + TInt count(0); + if ( iEngine->GetEngineWrapper()->EntriesQueryDialog( &iDummy, _L("How many counts\r\n(0=unlimited)?"), ETrue ) ) { if ( count > 0 ) { @@ -680,7 +682,7 @@ */ TInt minutes( 0 ); - if ( iEngine->GetEngineWrapper()->EntriesQueryDialog( minutes, _L("How many minutes until expire (0=unlimited)?"), ETrue ) ) + if ( iEngine->GetEngineWrapper()->EntriesQueryDialog( &iDummy, _L("How many minutes until expire (0=unlimited)?"), ETrue ) ) { if ( minutes > 0 ) { diff -r 4f2773374eff -r 4b22a598b890 creator/engine/src/creator_fileelement.cpp --- a/creator/engine/src/creator_fileelement.cpp Fri May 14 15:53:02 2010 +0300 +++ b/creator/engine/src/creator_fileelement.cpp Thu May 27 12:52:19 2010 +0300 @@ -18,8 +18,8 @@ #include "creator_fileelement.h" -#include -#include +#include +#include #include "creator_traces.h" #include "creator_file.h" diff -r 4f2773374eff -r 4b22a598b890 creator/engine/src/creator_landmark.cpp --- a/creator/engine/src/creator_landmark.cpp Fri May 14 15:53:02 2010 +0300 +++ b/creator/engine/src/creator_landmark.cpp Thu May 27 12:52:19 2010 +0300 @@ -16,8 +16,8 @@ */ -#include -#include +#include +#include #include #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 ); } /** diff -r 4f2773374eff -r 4b22a598b890 creator/engine/src/creator_log.cpp --- a/creator/engine/src/creator_log.cpp Fri May 14 15:53:02 2010 +0300 +++ b/creator/engine/src/creator_log.cpp Thu May 27 12:52:19 2010 +0300 @@ -105,18 +105,62 @@ //---------------------------------------------------------------------------- -TBool CCreatorLogs::AskDataFromUserL(TInt aCommand, TInt& aNumberOfEntries) +void CCreatorLogs::QueryDialogClosedL(TBool aPositiveAction, TInt aUserData) + { + LOGSTRING("Creator: CCreatorModuleBase::QueryDialogClosedL"); + + if( aPositiveAction == EFalse ) + { + iEngine->ShutDownEnginesL(); + return; + } + + TBool finished(EFalse); + TBool retval(ETrue); + switch(aUserData) + { + case ECreatorLogsDelete: + 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( KSavingText ); + } + } + +//---------------------------------------------------------------------------- + +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 ); } //---------------------------------------------------------------------------- diff -r 4f2773374eff -r 4b22a598b890 creator/engine/src/creator_mailbox.cpp --- a/creator/engine/src/creator_mailbox.cpp Fri May 14 15:53:02 2010 +0300 +++ b/creator/engine/src/creator_mailbox.cpp Thu May 27 12:52:19 2010 +0300 @@ -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 ); } diff -r 4f2773374eff -r 4b22a598b890 creator/engine/src/creator_message.cpp --- a/creator/engine/src/creator_message.cpp Fri May 14 15:53:02 2010 +0300 +++ b/creator/engine/src/creator_message.cpp Thu May 27 12:52:19 2010 +0300 @@ -123,187 +123,129 @@ //---------------------------------------------------------------------------- -TBool CCreatorMessages::AskDataFromUserL(TInt aCommand, TInt& aNumberOfEntries) +void CCreatorMessages::QueryDialogClosedL(TBool aPositiveAction, TInt aUserData) + { + LOGSTRING("Creator: CCreatorMessages::QueryDialogClosedL"); + + if( aPositiveAction == EFalse ) + { + iEngine->ShutDownEnginesL(); + return; + } + + TBool finished(EFalse); + TBool retval(ETrue); + switch(aUserData) + { + case ECreatorMessagesDelete: + 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; iCount(); 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( KSavingText ); + } + } +//---------------------------------------------------------------------------- + +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; iCount(); 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; iCount(); 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 ); } //---------------------------------------------------------------------------- diff -r 4f2773374eff -r 4b22a598b890 creator/engine/src/creator_note.cpp --- a/creator/engine/src/creator_note.cpp Fri May 14 15:53:02 2010 +0300 +++ b/creator/engine/src/creator_note.cpp Thu May 27 12:52:19 2010 +0300 @@ -80,7 +80,8 @@ { LOGSTRING("Creator: CCreatorNotepad::~CCreatorNotepad"); - delete iNotepadApi; + // TODO DELETE!!! + //delete iNotepadApi; if (iParameters) delete iParameters; @@ -88,19 +89,21 @@ //---------------------------------------------------------------------------- -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 ); } diff -r 4f2773374eff -r 4b22a598b890 creator/engine/src/creator_phonebook.cpp --- a/creator/engine/src/creator_phonebook.cpp Fri May 14 15:53:02 2010 +0300 +++ b/creator/engine/src/creator_phonebook.cpp Thu May 27 12:52:19 2010 +0300 @@ -18,6 +18,7 @@ #include "engine.h" #include "enginewrapper.h" +#include "creator_contactsetcache.h" #include "creator_phonebook.h" #include "creator_traces.h" @@ -49,6 +50,11 @@ { (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(), "", (QContactAddress::FieldStreet).operator QString(), (TInt) CCreatorEngine::EAddress}, + { (QContactAddress::DefinitionName).operator QString(), "", (QContactAddress::FieldLocality).operator QString(), (TInt) CCreatorEngine::ECity}, + { (QContactAddress::DefinitionName).operator QString(), "", (QContactAddress::FieldRegion).operator QString(), (TInt) CCreatorEngine::EState}, + { (QContactAddress::DefinitionName).operator QString(), "", (QContactAddress::FieldPostcode).operator QString(), (TInt) CCreatorEngine::EPostcode}, + { (QContactAddress::DefinitionName).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}, @@ -64,48 +70,17 @@ { (QContactName::DefinitionName).operator QString(), (QContactDetail::ContextHome).operator QString(), (QContactName::FieldCustomLabel).operator QString(), (TInt) CCreatorEngine::EFirstName} }; -/*TInt CreatorVPbkBinaryFields[] = { - R_VPBK_FIELD_TYPE_CALLEROBJIMG//, - //R_VPBK_FIELD_TYPE_THUMBNAILPATH - };*/ -/*QString CreatorPbkDateTimeFields[] = { - QContactAnniversary::DefinitionName//R_VPBK_FIELD_TYPE_ANNIVERSARY - };*/ - -//---------------------------------------------------------------------------- - -/* typedef struct{ QString iFieldContext; QString iFieldString; }PhoneNumInfo; PhoneNumInfo CreatorPhoneNumberFields[] = { - { 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 } - }; - -*/ -typedef struct{ -QString iFieldContext; -QString iFieldString; -}PhoneNumInfo; -PhoneNumInfo CreatorPhoneNumberFields[] = - { + { "", "Landline"}, { "Home", "Landline"}, { "Work", "Landline"}, + { "","Mobile"}, { "Home","Mobile"}, { "Work", "Mobile"}, { "Home", "Facsimile"}, @@ -118,25 +93,6 @@ }; -/*QString CCreatorPhonebook::iPhoneNumberFields[] = - { - {QContactPhoneNumber::SubTypeLandline}, - {QContactPhoneNumber::SubTypeMobile}, - {QContactPhoneNumber::SubTypeFacsimile}, - {QContactPhoneNumber::SubTypePager}, - {QContactPhoneNumber::SubTypeVideo}, - {QContactPhoneNumber::SubTypeVoice} , - {QContactPhoneNumber::SubTypeAssistant}, - {QContactPhoneNumber::SubTypeCar} - }; -*/ -/* -QStringList CreatorPbkContextFields = - { - QContactDetail::ContextHome, - QContactDetail::ContextWork - }; -*/ QString CreatorPbkEmailFields[] = { //R_VPBK_FIELD_TYPE_EMAILGEN, @@ -240,38 +196,33 @@ //---------------------------------------------------------------------------- -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(); + TInt err = KErrNone; + delete iParameters; + iParameters = 0; + CPhonebookParameters* parameters = 0; + //InitializeContactParamsL(); + + if( aParameters == 0 ) + { + InitializeContactParamsL(); + parameters = iParameters; + } + else + { + parameters = (CPhonebookParameters*) aParameters; + } + bool success = false; // create a new contact item - //iStore = new QContact(); - QContact iStore; - int numberOfFields = iParameters->iContactFields.count(); + int numberOfFields = parameters->iContactFields.count(); QString phone; for(int i=0; i< numberOfFields; i++ ) { - QContactDetail* cntdet = new QContactDetail(iParameters->iContactFields.at(i)); + QContactDetail* cntdet = new QContactDetail(parameters->iContactFields.at(i)); success = iStore.saveDetail( cntdet ); delete cntdet; } @@ -279,7 +230,31 @@ 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& contactsets = ContactLinkCache::Instance()->ContactSets(); + TBool setFound(EFalse); + for(TInt i = 0; i < contactsets.Count(); ++i ) + { + if( contactsets[i]->LinkId() == parameters->ScriptLinkId() ) + { + if( iStore.localId() ) + { + contactsets[i]->AppendL( iStore.localId() ); + iContactLinkArray.AppendL( (TUint32)iStore.localId() ); + } + setFound = ETrue; + break; + } + } + if( !setFound ) + { + LOGSTRING2("Error: Contact set id %d not found.", parameters->ScriptLinkId()); + } + } + return err; } @@ -319,12 +294,7 @@ } } DeleteContactsL( groups ); -/* - User::LeaveIfNull( iStore ); - MVPbkContactLinkArray* groups = iStore->ContactGroupsLC(); - DeleteContactsL( groups, ETrue ); - CleanupStack::PopAndDestroy(); // cannot use groups as parameter - */ + } //---------------------------------------------------------------------------- @@ -339,7 +309,7 @@ { //QList contacts = iContactMngr->contactIds(); QMap errorMap; - iContactMngr->removeContacts( &aContacts, &errorMap ); + iContactMngr->removeContacts( aContacts, &errorMap ); } //---------------------------------------------------------------------------- @@ -379,7 +349,7 @@ } //---------------------------------------------------------------------------- -void CCreatorPhonebook::DoDeleteItemsCreatedWithCreatorL( TUid aStoreUid, CDictionaryFileStore* aStore ) +void CCreatorPhonebook::DoDeleteItemsCreatedWithCreatorL( TUid /*aStoreUid*/, CDictionaryFileStore* /*aStore*/ ) { } @@ -399,7 +369,10 @@ if( aDetail == QContactPhoneNumber::DefinitionName) { QContactPhoneNumber phoneNumber;// = contactDetail; - phoneNumber.setContexts(aFieldContext); + if(!aFieldContext.isEmpty()) + { + phoneNumber.setContexts(aFieldContext); + } phoneNumber.setSubTypes(aFieldString); contentData.Set(iEngine->RandomString((CCreatorEngine::TRandomStringType) aRand)); QString number = QString::fromUtf16(contentData.Ptr(),contentData.Length()); @@ -491,12 +464,9 @@ } if(aFieldString == QContactOrganization::FieldDepartment) { - //if(contactCompany.department().isEmpty()) - //{ QStringList depList = contactCompany.department(); depList.append(company); contactCompany.setDepartment(depList); - //} } if(aFieldString == QContactOrganization::FieldAssistantName) { @@ -636,7 +606,6 @@ 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; } @@ -711,41 +680,6 @@ //---------------------------------------------------------------------------- //---------------------------------------------------------------------------- -/*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*/) { @@ -773,74 +707,40 @@ 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); - } - } +// QContactDetail field = CreateContactDetail( CreatorPbkMiscTextFields[tfIndex].iDetail, CreatorPbkMiscTextFields[tfIndex].iFieldContext, CreatorPbkMiscTextFields[tfIndex].iFieldString, CreatorPbkMiscTextFields[tfIndex].iRandomType ); + + CCreatorContactField* field = CCreatorContactField::NewL(); + CleanupStack::PushL( field ); + QContactDetail cntDetail = field->CreateContactDetail(iEngine,iParameters,CreatorPbkMiscTextFields[tfIndex].iDetail, CreatorPbkMiscTextFields[tfIndex].iFieldContext, CreatorPbkMiscTextFields[tfIndex].iFieldString, CreatorPbkMiscTextFields[tfIndex].iRandomType ); + if(!cntDetail.isEmpty()) + { + field->AddFieldToParam( iParameters, cntDetail ); //it will do "param->iContactFields.AppendL(field);" + } + CleanupStack::Pop( field ); } // Add binary fields: - QContactDetail field = CreateContactDetail(QContactAvatar::DefinitionName,"","",0); - iParameters->iContactFields.append(field); + TPtrC emptyData; + CCreatorContactField* fieldPicture = CCreatorContactField::NewL(); + CleanupStack::PushL( fieldPicture ); + QContactDetail cntDetail = fieldPicture->CreateContactDetail(iEngine,iParameters,QContactAvatar::DefinitionName,"","",emptyData ); + if(!cntDetail.isEmpty()) + { + fieldPicture->AddFieldToParam( iParameters, cntDetail ); //it will do "param->iContactFields.AppendL(field);" + } + CleanupStack::Pop( fieldPicture ); // 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)); - } + CCreatorContactField* fieldAnniv = CCreatorContactField::NewL(); + CleanupStack::PushL( fieldAnniv ); + QContactDetail cntDetAnniv = fieldAnniv->CreateContactDetail(iEngine,iParameters,QContactAnniversary::DefinitionName,"","",emptyData ); + if(!cntDetAnniv .isEmpty()) + { + fieldAnniv->AddFieldToParam( iParameters, cntDetAnniv ); //it will do "param->iContactFields.AppendL(field);" + } + CleanupStack::Pop( fieldAnniv ); - AddFieldToParamsL(R_VPBK_FIELD_TYPE_CALLEROBJIMG, KNullDesC8); - AddFieldToParamsL(R_VPBK_FIELD_TYPE_THUMBNAILPIC, KNullDesC8); - AddFieldToParamsL(R_VPBK_FIELD_TYPE_CALLEROBJTEXT, firstname);*/ //*************************************************************************** - //iParameters->iContactFields.append( name ); } else { @@ -862,8 +762,10 @@ QContactPhoneNumber phoneNum; TPtrC phoneNumber = iEngine->RandomString(CCreatorEngine::EPhoneNumber); QString phone = QString::fromUtf16( phoneNumber.Ptr(), phoneNumber.Length() ); - - phoneNum.setContexts(CreatorPhoneNumberFields[inc].iFieldContext); + if(!CreatorPhoneNumberFields[inc].iFieldContext.isEmpty()) + { + phoneNum.setContexts(CreatorPhoneNumberFields[inc].iFieldContext); + } phoneNum.setSubTypes(CreatorPhoneNumberFields[inc].iFieldString); @@ -877,29 +779,29 @@ // URLs: for( int i=0; iCreateHTTPUrlLC(); - QString urlAddress = QString::fromUtf16(url->Ptr(), url->Length() ); - contactUrl.setUrl( urlAddress ); - iParameters->iContactFields.append( contactUrl ); - CleanupStack::PopAndDestroy(url); - } + { + CCreatorContactField* fieldUrl = CCreatorContactField::NewL(); + CleanupStack::PushL( fieldUrl ); + QContactDetail cntDetUrl = fieldUrl->CreateContactDetail(iEngine,iParameters,QContactUrl::DefinitionName,"","",KErrNotFound ); + if(!cntDetUrl.isEmpty()) + { + fieldUrl->AddFieldToParam( iParameters, cntDetUrl ); //it will do "param->iContactFields.AppendL(field);" + } + CleanupStack::Pop( fieldUrl ); + + } // EMail addresses: for( int i=0; iCreateEmailAddressLC();; - /*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); + CCreatorContactField* fieldEmail = CCreatorContactField::NewL(); + CleanupStack::PushL( fieldEmail ); + QContactDetail cntDetEmail = fieldEmail->CreateContactDetail(iEngine,iParameters,QContactEmailAddress::DefinitionName,"","",KErrNotFound ); + if(!cntDetEmail.isEmpty()) + { + fieldEmail->AddFieldToParam( iParameters, cntDetEmail ); //it will do "param->iContactFields.AppendL(field);" + } + CleanupStack::Pop( fieldEmail ); } } @@ -907,8 +809,13 @@ // Checks if the link is a group or not -TBool CCreatorPhonebook::IsContactGroupL() +TBool CCreatorPhonebook::IsContactGroupL( QContactLocalId& aLink ) { + QContact group = iContactMngr->contact( aLink ); + if( group.type() == QContactType::TypeGroup ) + { + return ETrue; + } return EFalse; } @@ -938,7 +845,7 @@ QContact newGroup; newGroup.setType(QContactType::TypeGroup); QContactName newGroupName; - newGroupName.setCustomLabel( iParameters->iGroupName ); + newGroupName.setCustomLabel( parameters->iGroupName ); newGroup.saveDetail(&newGroupName); iContactMngr->saveContact(&newGroup); QContactLocalId newGroupId = newGroup.localId(); @@ -958,10 +865,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& links = set.ContactLinks(); + const RArray 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,23 +880,28 @@ for( TInt j = 0; j < links.Count() && addedMembers < maxAmount; ++j ) { - MVPbkContactLink* link = links[j]; - if( link && IsContactGroupL(*link) == EFalse ) + QContactLocalId link = links[j]; + QContact contactLink = iContactMngr->contact( link ); + if( link && IsContactGroupL( link ) == EFalse ) { - TRAPD(err, newGroup->AddContactL(*link)); - if( err != KErrAlreadyExists ) - { - // Ignore "allready exists" -error - User::LeaveIfError(err); - ++addedMembers; - } + //QList 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() ); + iContactMngr->saveRelationship( contactRel ); + delete contactRel; + ++addedMembers; + } } } if( addedMembers < maxAmount ) { // Add existing contacts, withing the limits set by maxAmount: amountOfContactsToBeAdded += maxAmount - addedMembers; - }*/ + } } } if( amountOfContactsToBeAdded > 0 ) @@ -1049,6 +961,383 @@ //---------------------------------------------------------------------------- +CCreatorContactField::CCreatorContactField() + { + } +CCreatorContactField::~CCreatorContactField() + { + } + +CCreatorContactField* CCreatorContactField::NewL() + { + CCreatorContactField* self = new (ELeave) CCreatorContactField(); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(); + return self; + } +void CCreatorContactField::ConstructL() + { + //pImpl = CCreatorContactTextField::NewL(aFieldType, aData); + } +QContactDetail CCreatorContactField::CreateContactDetail(CCreatorEngine* aEngine,CPhonebookParameters* aParameters,QString aDetail, QString aFieldContext, QString aFieldString, TInt aRand ) + { + QContactDetail emptyDet; + TPtrC contentData; + HBufC16* tempData = 0; + if(aRand == KErrNotFound) + { + TInt textFieldCount = sizeof(CreatorPbkMiscTextFields) / sizeof(DetailFieldInfo); + for( TInt tfIndex = 0; tfIndex < textFieldCount; ++tfIndex ) + { + if( CreatorPbkMiscTextFields[tfIndex].iDetail == aDetail && CreatorPbkMiscTextFields[tfIndex].iFieldContext == aFieldContext && CreatorPbkMiscTextFields[tfIndex].iFieldString == aFieldString) + { + aRand = CreatorPbkMiscTextFields[tfIndex].iRandomType; + } + } + } + + if( aRand != KErrNotFound ) + { + contentData.Set(aEngine->RandomString((CCreatorEngine::TRandomStringType) aRand)); + } + else + { + if( aDetail == QContactPhoneNumber::DefinitionName ) + { + contentData.Set(aEngine->RandomString(CCreatorEngine::EPhoneNumber)); + } + else if( aDetail == QContactEmailAddress::DefinitionName ) + { + tempData = aEngine->CreateEmailAddressLC(); + contentData.Set( tempData->Des() ); + } + else if( aDetail == QContactUrl::DefinitionName ) + { + tempData = aEngine->CreateHTTPUrlLC(); + contentData.Set( tempData->Des() ); + } + else + { + return emptyDet; + } + } + emptyDet = CreateContactDetail( aEngine, aParameters, aDetail, aFieldContext, aFieldString, contentData ); + if( tempData ) + { + CleanupStack::PopAndDestroy( tempData ); + } + return emptyDet; + } + +QContactDetail CCreatorContactField::CreateContactDetail(CCreatorEngine* aEngine,CPhonebookParameters* aParameters,QString aDetail, QString aFieldContext, QString aFieldString, TPtrC 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(number); + return phoneNumber; + } + else if( aDetail == QContactName::DefinitionName ) //--Contact NAME----------------------------- + { + QContactName contactName; + for(int i = 0 ; i < aParameters->iContactFields.count() ; i++ ) //go through all contact details to check if there is already Contact Name to set other details + { + if(aParameters->iContactFields.at(i).definitionName() == QContactName::DefinitionName ) + { + contactName = aParameters->iContactFields.at(i); + } + } + QString name = QString::fromUtf16(aData.Ptr(),aData.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 < aParameters->iContactFields.count() ; i++ ) //go through all contact details to check if there is already Contact Name to set other details + { + if(aParameters->iContactFields.at(i).definitionName() == QContactOrganization::DefinitionName ) + { + contactCompany = aParameters->iContactFields.at(i); + } + } + + QString company = QString::fromUtf16(aData.Ptr(),aData.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) + { + 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 < aParameters->iContactFields.count() ; i++ ) //go through all contact details to check if there is already Contact Name to set other details + { + if(aParameters->iContactFields.at(i).definitionName() == QContactAddress::DefinitionName && aParameters->iContactFields.at(i).value(QContactDetail::FieldContext) == aFieldContext ) + { + contactAddress = aParameters->iContactFields.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( 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; + QString note = QString::fromUtf16(aData.Ptr(),aData.Length()); + contactNote.setNote(note); + return contactNote; + } + else if( aDetail == QContactFamily::DefinitionName ) //--Contact Family----------------------------- + { + QContactFamily contactFamily; + + for(int i = 0 ; i < aParameters->iContactFields.count() ; i++ ) //go through all contact details to check if there is already Contact Name to set other details + { + if(aParameters->iContactFields.at(i).definitionName() == QContactFamily::DefinitionName && aParameters->iContactFields.at(i).value(QContactDetail::FieldContext) == aFieldContext ) + { + contactFamily = aParameters->iContactFields.at(i); + } + } + + QString familyData = QString::fromUtf16(aData.Ptr(),aData.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 srcPath; + aEngine->RandomPictureFileL(srcPath); + TBuf 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) //--Anniversary------------------------------ + { + QContactAnniversary contactAnniversary; + QDate date; + 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( emailAddr ); + 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(urlStr); + return url; + } + if( aDetail == QContactBirthday::DefinitionName ) //--Birthday----------------------------------- + { + QContactBirthday birthday; + QDate date; + 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 CCreatorContactField::AddFieldToParam( CPhonebookParameters* aParam, QContactDetail aDetail) + { + bool replace = false; + for(int i = 0 ; i< aParam->iContactFields.count() ; i++) //go through + { + if( !aDetail.isEmpty() && aDetail.definitionName() == aParam->iContactFields.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) == aParam->iContactFields.at(i).value(QContactDetail::FieldContext)) ) + { + //replace + aParam->iContactFields.replace(i,aDetail); + replace = true; + } + } + } + if(!replace) + { + if(!aDetail.isEmpty()) + { + aParam->iContactFields.append(aDetail); + } + } + + } //---------------------------------------------------------------------------- //---------------------------------------------------------------------------- diff -r 4f2773374eff -r 4b22a598b890 creator/engine/src/creator_phonebookbase.cpp --- a/creator/engine/src/creator_phonebookbase.cpp Fri May 14 15:53:02 2010 +0300 +++ b/creator/engine/src/creator_phonebookbase.cpp Thu May 27 12:52:19 2010 +0300 @@ -20,94 +20,122 @@ #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; + } + + TBool finished(EFalse); + TBool retval(ETrue); + switch(aUserData) + { + case ECreatorPhonebookDelete: + finished = ETrue; + iEntriesToBeCreated = 1; + break; + case ECreatorPhonebookStart: + retval = iEngine->GetEngineWrapper()->ListQueryDialog(_L("Fields in contact"), R_CONTACT_CREATION_TYPE_QUERY, + &iDummy, this, iCommand == ECmdCreatePhoneBookEntryContacts ? ECreatorPhonebookGetContactFields : ECreatorPhonebookGetGroupFields + ); + break; + case ECreatorPhonebookGetContactFields: + if(!iDefaultFieldsSelected) + { + if(iDummy==0)// first item, use default fields + + { + iDefaultFieldsSelected = ETrue; + retval = iEngine->GetEngineWrapper()->YesNoQueryDialog(_L("Add all the other fields to contacts?"), this, ECreatorPhonebookGetContactFields); + } + else + { + retval = iEngine->GetEngineWrapper()->EntriesQueryDialog(&iNumberOfPhoneNumberFields, _L("Amount of phone number fields in one contact?"), + ETrue, this, ECreatorPhonebookGetPhoneNumbersCount + ); + } + } + else + { + iAddAllFields = aPositiveAction; + finished = ETrue; + } + 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: + // 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( KSavingText ); + } + } + +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 } diff -r 4f2773374eff -r 4b22a598b890 creator/engine/src/creator_scriptentry.cpp --- a/creator/engine/src/creator_scriptentry.cpp Fri May 14 15:53:02 2010 +0300 +++ b/creator/engine/src/creator_scriptentry.cpp Thu May 27 12:52:19 2010 +0300 @@ -18,13 +18,14 @@ #include -#include +#include #include #include "engine.h" #include "enginewrapper.h" #include "creator_traces.h" #include "creator_factory.h" +#include "creator_scriptentry.h" @@ -68,24 +69,65 @@ { 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 && aPositiveAction && iSearchArray->Count() ) + { + iObserver->FileChosenL( ETrue, iSearchArray->MdcaPoint(iSelectedItem) ); + } + else if( aUserData == EGetingRandomDataFile && aPositiveAction && iSearchArray->Count() ) + { + TFileName fileName; + if (iSelectedItem == (iSearchArray->Count() - 1)) + { + // "default" (resource file) selected + fileName.Copy(KNullDesC); + } + else + { + // xml file selected + fileName.Copy(iSearchArray->MdcaPoint(iSelectedItem)); + } + iObserver->FileChosenL( ETrue, fileName ); + } + else + { + iObserver->FileChosenL( EFalse ); + } + delete iSearchArray; + iSearchArray = NULL; + iObserver = NULL; + } // --------------------------------------------------------------------------- //#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 = new(ELeave) CDesCArrayFlat(20); // wait dialog // TODO @@ -154,70 +196,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; } /* @@ -476,72 +466,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); + 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; } diff -r 4f2773374eff -r 4b22a598b890 creator/engine/src/creator_virtualphonebook.cpp --- a/creator/engine/src/creator_virtualphonebook.cpp Fri May 14 15:53:02 2010 +0300 +++ b/creator/engine/src/creator_virtualphonebook.cpp Thu May 27 12:52:19 2010 +0300 @@ -297,19 +297,6 @@ } //---------------------------------------------------------------------------- -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"); diff -r 4f2773374eff -r 4b22a598b890 creator/engine/src/creator_wepsecuritysettings.cpp --- a/creator/engine/src/creator_wepsecuritysettings.cpp Fri May 14 15:53:02 2010 +0300 +++ b/creator/engine/src/creator_wepsecuritysettings.cpp Thu May 27 12:52:19 2010 +0300 @@ -21,7 +21,7 @@ #include "creator_wepsecuritysettings.h" #include //#include -#include +#include //#include //#include diff -r 4f2773374eff -r 4b22a598b890 creator/inc/engine.h --- a/creator/inc/engine.h Fri May 14 15:53:02 2010 +0300 +++ b/creator/inc/engine.h Thu May 27 12:52:19 2010 +0300 @@ -23,13 +23,14 @@ #include #include #include -#include +#include +#include +#include //#include #include #include #include -//#include //#include #include #include @@ -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; @@ -63,11 +52,15 @@ 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,6 +78,42 @@ 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 some file(script file, 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 FileChosenL(TBool aSuccess, const TDesC& aFileName = KNullDesC) = 0; + + }; + /** * Device memory information */ @@ -104,7 +133,7 @@ // Common constant for undefined integer value: const TInt KUndef = KErrNotFound; -class CCreatorEngine : public CActive +class CCreatorEngine : public CActive, public MUIObserver, public MCommandParserObserver { public: @@ -213,10 +242,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 +255,35 @@ 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 some file(script file, 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 FileChosenL(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 +331,7 @@ void SetDefaultPathForFileCommandL(TInt aCommand, TFileName& aPath); - TBool GetRandomDataFilenameL(TDes& aFilename); + TBool GetRandomDataL(); TBool GetRandomDataFromFileL(const TDesC& aFilename); void CancelComplete(); CDictionaryFileStore* FileStoreLC(); @@ -338,6 +389,7 @@ CCreatorMessages* iMessages; CCreatorLandmarks* iLandmarks; CCreatorCmdScriptRun* iCmdScriptRun; + CCommandParser* iCommandParser; // options menu command home module MCreatorModuleBase* iUsedOptionsMenuModule; diff -r 4f2773374eff -r 4b22a598b890 creator/inc/enginewrapper.h --- a/creator/inc/enginewrapper.h Fri May 14 15:53:02 2010 +0300 +++ b/creator/inc/enginewrapper.h Thu May 27 12:52:19 2010 +0300 @@ -24,7 +24,7 @@ #include #include - #include // for iProgressNote signal connect +#include // for iProgressNote signal connect class MainView; @@ -32,6 +32,7 @@ class HbProgressDialog; class HbPopup; class HbCommonNote; +class HbAction; /** @@ -102,22 +103,22 @@ /** * Create entries query dialog */ - TBool EntriesQueryDialog(TInt& aNumberOfEntries, const TDesC& aPrompt, TBool aAcceptsZero = EFalse); + TBool EntriesQueryDialog(TInt* aNumberOfEntries, const TDesC& aPrompt, TBool aAcceptsZero = EFalse, MUIObserver* aObserver = NULL, int userData = 0); /** * Create time query dialog */ - TBool TimeQueryDialog(TTime aTime, const TDesC& aPrompt); + TBool TimeQueryDialog(TTime* aTime, const TDesC& aPrompt, MUIObserver* aObserver = NULL, int userData = 0); /** * Create yes or no query dialog */ - TBool YesNoQueryDialog(const TDesC& aPrompt); + TBool YesNoQueryDialog(const TDesC& aPrompt, MUIObserver* aObserver = NULL, int userData = 0); /** * 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 = NULL, TInt aUserData=0); /** * Directory query dialog @@ -127,12 +128,12 @@ /** * 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 = NULL, TInt aUserData=0); /** * Create list query multi-selection dialog */ - bool ListQueryDialog(const TDesC& aPrompt, TListQueryId aId, CArrayFixFlat* aIndexes); + TBool ListQueryDialog(const TDesC& aPrompt, TListQueryId aId, CArrayFixFlat* aSelectedItems, MUIObserver* aObserver = NULL, TInt aUserData=0); /** @@ -145,7 +146,7 @@ /** * progress dialog cancelled */ - void ProgressDialogCancelled(); + void ProgressDialogCancelled(); private: @@ -156,6 +157,7 @@ /* progress dialog that is shown */ HbProgressDialog* iProgressDialog; + MCreatorModuleBase *iModule; }; #endif //ENGINEWRAPPER_H diff -r 4f2773374eff -r 4b22a598b890 creator/inc/notifications.h --- a/creator/inc/notifications.h Fri May 14 15:53:02 2010 +0300 +++ b/creator/inc/notifications.h Thu May 27 12:52:19 2010 +0300 @@ -21,6 +21,11 @@ #include #include +#include + +#include "engine.h" + +#include class HbProgressDialog; class HbPopup; @@ -82,6 +87,84 @@ 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 ); +protected: + CreatorInputDialog(int*value, MUIObserver* observer, int userData); +protected slots: + void DialogClosed(HbAction*); +private: + int *mValue; +}; + +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* aSelectedItems, MUIObserver* observer, int userData) throw( std::exception ); +protected: + CreatorSelectionDialog(TInt* selectedItem, MUIObserver* observer, int userData) throw( std::exception ); + CreatorSelectionDialog(CArrayFixFlat* aSelectedItems, MUIObserver* observer, int userData) throw( std::exception ); +protected slots: + void DialogClosed(HbAction*); +private: + TInt* mSelectedItem; + CArrayFixFlat* 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_ diff -r 4f2773374eff -r 4b22a598b890 creator/src/engine.cpp --- a/creator/src/engine.cpp Fri May 14 15:53:02 2010 +0300 +++ b/creator/src/engine.cpp Thu May 27 12:52:19 2010 +0300 @@ -16,8 +16,8 @@ */ -#include -#include +#include +#include #include #include @@ -29,13 +29,26 @@ #include //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 #include @@ -45,7 +58,7 @@ _LIT(KEDriveError, "Not available"); _LIT(KTempPathDrive, "d"); _LIT(KTempPath, ":\\Creator\\"); -_LIT(KSavingText, "Saving"); +//_LIT(KSavingText, "Saving"); _LIT(KDeletingText, "Deleting"); const TInt KRegisterDrive = EDriveC; _LIT(KRegisterFileName, "creator_created_items.dat"); @@ -141,7 +154,9 @@ delete iBitmapData; delete iCmdScriptRun; - iCmdScriptRun = NULL; + iCmdScriptRun = NULL; + + delete iCommandParser; } void CCreatorEngine::CopyFileL(const TFileName& aSourceFile, const TFileName& aTargetFile, TBool aOverwrite ) @@ -718,6 +733,7 @@ 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)); @@ -766,6 +782,7 @@ delete iLandmarks; iLandmarks = NULL; + ContactLinkCache::DestroyL(); // now delete the command array delete iCommandArray; iCommandArray = NULL; @@ -773,6 +790,13 @@ // delete parameter array iParameterArray.ResetAndDestroy(); iParameterArray.Close(); + + if(iCommandParser) + { + delete iCommandParser; + iCommandParser = NULL; + } + // clear temp drive CFileMan* fileMan = CFileMan::NewL( iEnv->FsSession() ); @@ -791,53 +815,51 @@ } // --------------------------------------------------------------------------- - -void CCreatorEngine::RunScriptL() +void CCreatorEngine::QueryDialogClosedL( TBool /*aPositiveAction*/, TInt /*aUserData*/ ) { - LOGSTRING("Creator: CCreatorEngine::RunScriptL"); - - // startup modules (also inits the command array): - 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 ) +void CCreatorEngine::FileChosenL( 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 + /* 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 ); - ); + CCreatorScriptParser* scriptParser = CCreatorScriptParser::NewLC(this); + scriptParser->ParseL(scriptFile); + parseErr = scriptParser->GetError(); + CleanupStack::PopAndDestroy( scriptParser ); + + CleanupStack::PopAndDestroy( &scriptFile ); + //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 + iEngineWrapper->ShowErrorMessage(msgBuf); ShutDownEnginesL(); + delete iCommandParser; + iCommandParser = NULL; return; } } - CleanupStack::PopAndDestroy( &scriptFile ); - CleanupStack::PopAndDestroy( commandParser ); // start executing commands if commands in the command array if (CommandArrayCount() > 0) @@ -848,7 +870,26 @@ { ShutDownEnginesL(); } + } +// --------------------------------------------------------------------------- +void CCreatorEngine::RunScriptL() + { + LOGSTRING("Creator: CCreatorEngine::RunScriptL"); + + // startup modules (also inits the command array): + StartEnginesL(); + + // use the command parser module to init the command array from a script file + delete iCommandParser; + iCommandParser = CCommandParser::NewL(this); + TBool ret = EFalse; + TRAPD(err, ret = iCommandParser->OpenScriptL( this ) ); + if( err != KErrNone || ret == EFalse) + { + ShutDownEnginesL(); + User::LeaveIfError(err); + } } // --------------------------------------------------------------------------- @@ -1118,13 +1159,13 @@ ShutDownEnginesL(); } } - else if ( iUsedOptionsMenuModule->AskDataFromUserL( aCommand, iEntriesToBeCreated ) ) + else if ( iUsedOptionsMenuModule->AskDataFromUserL( aCommand ) ) { // add this command to command array - AppendToCommandArrayL( aCommand, NULL, 1 ); +// AppendToCommandArrayL( aCommand, NULL, 1 ); // started exucuting commands - ExecuteFirstCommandL( KDeletingText ); +// ExecuteFirstCommandL( KDeletingText ); } else { @@ -1134,13 +1175,13 @@ } // 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); + //AppendToCommandArrayL(aCommand, NULL, iEntriesToBeCreated); // started exucuting commands - ExecuteFirstCommandL( KSavingText ); + //ExecuteFirstCommandL( KSavingText ); } else { @@ -1202,11 +1243,16 @@ // --------------------------------------------------------------------------- -TBool CCreatorEngine::GetRandomDataFilenameL(TDes& aFilename) +TBool CCreatorEngine::GetRandomDataL() { + TFileName fileName; CCommandParser* commandParser = CCommandParser::NewLC(this); - TBool ret = commandParser->GetRandomDataFilenameL(aFilename); + TBool ret = commandParser->GetRandomDataFilenameL(fileName); CleanupStack::PopAndDestroy(commandParser); + if (ret) + { + ret = GetRandomDataFromFileL(fileName); + } return ret; } diff -r 4f2773374eff -r 4b22a598b890 creator/src/enginewrapper.cpp --- a/creator/src/enginewrapper.cpp Fri May 14 15:53:02 2010 +0300 +++ b/creator/src/enginewrapper.cpp Thu May 27 12:52:19 2010 +0300 @@ -18,8 +18,7 @@ #include #include - -#include +#include #include #include @@ -106,7 +105,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); @@ -132,40 +131,59 @@ void EngineWrapper::CloseProgressbar() { - delete iProgressDialog; - iProgressDialog = 0; + if(iProgressDialog){ + delete iProgressDialog; + iProgressDialog = 0; + } } // --------------------------------------------------------------------------- -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 +195,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 +216,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; @@ -213,8 +227,16 @@ 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; } // --------------------------------------------------------------------------- @@ -246,7 +268,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()); @@ -293,34 +315,42 @@ } } // 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* aIndexes) +TBool EngineWrapper::ListQueryDialog(const TDesC& aPrompt, TListQueryId aId, CArrayFixFlat* aSelectedItems, MUIObserver* aObserver, TInt aUserData) { - bool ret = false; + TBool success(EFalse); + QStringList itemList; QString text((QChar*)aPrompt.Ptr(), aPrompt.Length()); - QStringList itemList; - QList 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() diff -r 4f2773374eff -r 4b22a598b890 creator/src/notifications.cpp --- a/creator/src/notifications.cpp Fri May 14 15:53:02 2010 +0300 +++ b/creator/src/notifications.cpp Thu May 27 12:52:19 2010 +0300 @@ -24,10 +24,12 @@ #include #include #include +#include #include #include #include +#include #include "notifications.h" @@ -87,116 +89,6 @@ // --------------------------------------------------------------------------- -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) -{ - HbMessageBox::question(text, 0, 0); - return false; -} - -// --------------------------------------------------------------------------- - -void Notifications::popupListDialog(const QString& text, QStringList& items, HbAbstractItemView::SelectionMode mode, QObject* receiver, const char* member) -{ - 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); -} - -// --------------------------------------------------------------------------- - bool Notifications::directoryQueryDialog(const QString& text, QString& directory) { bool err = false; @@ -233,3 +125,190 @@ } // --------------------------------------------------------------------------- + +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) +{ + 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), + mValue(value) +{ + if(!value) + throw std::invalid_argument("value cannot be the null!"); +} + +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 CreatorInputDialog::DialogClosed(HbAction *action) +{ + TBool PositiveAction(EFalse); + if(action && (action->softKeyRole()==QAction::PositiveSoftKey || !action->text().compare("ok", Qt::CaseInsensitive))){ + bool ok = false; + *mValue = value().toInt(&ok); + 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* 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!"); +} + +void CreatorSelectionDialog::launch(const QString& label, const QStringList& items, int* selectedItem, MUIObserver* observer, int userData) throw(std::exception) +{ + 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*))); +} + +void CreatorSelectionDialog::launch(const QString& label, const QStringList& items, CArrayFixFlat* 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(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 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(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 diff -r 4f2773374eff -r 4b22a598b890 filebrowser/engine/FBFileUtils.cpp --- a/filebrowser/engine/FBFileUtils.cpp Fri May 14 15:53:02 2010 +0300 +++ b/filebrowser/engine/FBFileUtils.cpp Thu May 27 12:52:19 2010 +0300 @@ -27,6 +27,8 @@ #include #include #include +#include +#include #include #include #include @@ -1960,46 +1962,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; iCount(); 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; iCount(); 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 +2020,9 @@ CDir* dir; TInt err = fileFinder.FindWildByPath(aFileName, &aPath, dir); - while (err == KErrNone) + while (err == KErrNone && iAllowProcessing) { + iEngine->FileBrowserUI()->ProcessEvents(); for (TInt i=0; iCount(); i++) { TEntry entry = (*dir)[i]; @@ -3266,7 +3271,7 @@ CleanupClosePushL(file); iFindFileEntryList->Reset(); - iEngine->EikonEnv()->BusyMsgL(_L("** Generating **"), TGulAlignment(EHCenterVTop)); + iEngine->FileBrowserUI()->ShowWaitDialog(_L("** Generating **")); for (TInt i=0; iCount(); i++) { @@ -3291,12 +3296,14 @@ writeBuf.Copy(fileEntry.iPath); writeBuf.Append(fileEntry.iEntry.iName); + writeBuf.Append(_L(" - ")); + writeBuf.AppendNum(fileEntry.iEntry.iSize); + writeBuf.Append(_L(" B")); writeBuf.Append(KFileNewLine); - file.Write(writeBuf); } - iEngine->EikonEnv()->BusyMsgCancel(); + iEngine->FileBrowserUI()->CancelWaitDialog(); CleanupStack::PopAndDestroy(); //file iFindFileEntryList->Reset(); @@ -3325,8 +3332,9 @@ CDir* dir; TInt err = fileFinder.FindWildByPath(aFileName, &aPath, dir); - while (err == KErrNone) + while (err == KErrNone && iAllowProcessing) { + iEngine->FileBrowserUI()->ProcessEvents(); for (TInt i=0; iCount(); i++) { TEntry entry = (*dir)[i]; diff -r 4f2773374eff -r 4b22a598b890 filebrowser/engine/FBFileUtils.h --- a/filebrowser/engine/FBFileUtils.h Fri May 14 15:53:02 2010 +0300 +++ b/filebrowser/engine/FBFileUtils.h Thu May 27 12:52:19 2010 +0300 @@ -334,7 +334,7 @@ void GetDriveVolumeLabel(TInt aIndex, TFileName &aVolumeLabel); CFileEntryList* FileEntries() const; - CDriveEntryList* DriveEntries() const; + CDriveEntryList* DriveEntries() const; public: inline TInt SortMode() { return iSortMode; } @@ -348,7 +348,8 @@ 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; @@ -388,6 +389,7 @@ RTz iTz; TSearchResults iFileSearchResults; CDesCArray* iTextArray; + TBool iAllowProcessing; }; diff -r 4f2773374eff -r 4b22a598b890 filebrowser/engine/engine.h --- a/filebrowser/engine/engine.h Fri May 14 15:53:02 2010 +0300 +++ b/filebrowser/engine/engine.h Thu May 27 12:52:19 2010 +0300 @@ -128,18 +128,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 diff -r 4f2773374eff -r 4b22a598b890 filebrowser/ui/inc/enginewrapper.h --- a/filebrowser/ui/inc/enginewrapper.h Fri May 14 15:53:02 2010 +0300 +++ b/filebrowser/ui/inc/enginewrapper.h Thu May 27 12:52:19 2010 +0300 @@ -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,9 @@ 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 ShowWaitDialog(const TDesC& aText); + void CancelWaitDialog(); + void ProcessEvents(); TBool ShowConfirmationQuery(const TDesC& aDescText); public: @@ -158,14 +163,20 @@ quint32 getDebugMask(); void toolsSetDebugMask(quint32 aDbgMask); + void toolsWriteAllFiles(); + void showFileCheckSums(const QModelIndex &aIndex, TFileBrowserCmdFileChecksums checksumType); +private slots: + void waitDialogCancelled(); + private: // FB engine CEngine *mEngine; // List of found files results for Ui QStringList mFilesFound; FileBrowserSettings mSettings; + HbProgressDialog *mWaitDialog; }; #endif //ENGINEWRAPPER_H diff -r 4f2773374eff -r 4b22a598b890 filebrowser/ui/inc/filebrowsermainwindow.h --- a/filebrowser/ui/inc/filebrowsermainwindow.h Fri May 14 15:53:02 2010 +0300 +++ b/filebrowser/ui/inc/filebrowsermainwindow.h Thu May 27 12:52:19 2010 +0300 @@ -25,6 +25,7 @@ class FileBrowserView; class SettingsView; class EditorView; +class SearchView; class FileBrowserMainWindow : public HbMainWindow { @@ -40,12 +41,14 @@ void openFileBrowserView(); void openSettingsView(); void openEditorView(const QString &, bool); + void openSearchView(const QString &); private: EngineWrapper* mEngineWrapper; FileBrowserView* mFileBrowserView; SettingsView* mSettingsView; EditorView* mEditorView; + SearchView* mSearchView; }; #endif /* FILEBROWSERMAINWINDOW_H_ */ diff -r 4f2773374eff -r 4b22a598b890 filebrowser/ui/inc/filebrowserview.h --- a/filebrowser/ui/inc/filebrowserview.h Fri May 14 15:53:02 2010 +0300 +++ b/filebrowser/ui/inc/filebrowserview.h Thu May 27 12:52:19 2010 +0300 @@ -51,12 +51,6 @@ { Q_OBJECT - enum resourceItem - { - FileItem, - Directory - }; - public: explicit FileBrowserView(FileBrowserMainWindow &mainWindow); virtual ~FileBrowserView(); @@ -65,33 +59,14 @@ QModelIndexList getSelectedItemsOrCurrentItem(); public slots: + void refreshList(); 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 openListDialog(const QStringList& items, const QString &titleText, QObject* receiver, const char* member); void openPropertyDialog(const QStringList& propertyList, const QString& title); -// QModelIndexList *getSelectedItemsOrCurrentItem(); - void createToolBar(); // Menu related methods void createMenu(); @@ -106,7 +81,7 @@ void createAboutMenuItem(); void createExitMenuItem(); - void refreshList(); +// void refreshList(); void populateFolderContent(); private slots: @@ -252,6 +227,7 @@ signals: void aboutToShowSettingsView(); void aboutToShowEditorView(const QString &, bool); + void aboutToShowSearchView(const QString &); void aboutToSimulateLeave(int); private slots: @@ -287,10 +263,6 @@ MenuAction mFileViewMenuActions; HbAction *mToolbarBackAction; - // search - SearchView *mSearch; - // settings - SettingsView *mSettingsView; // flags bool mItemHighlighted; bool mLocationChanged; @@ -305,7 +277,7 @@ QString mAbsoluteFilePath; OverwriteOptions mOverwriteOptions; QModelIndex mModelIndex; - bool mIsRenameAllowed; + QString mNewFileName; bool mProceed; bool mEraseMBR; }; diff -r 4f2773374eff -r 4b22a598b890 filebrowser/ui/inc/menuaction.h --- a/filebrowser/ui/inc/menuaction.h Fri May 14 15:53:02 2010 +0300 +++ b/filebrowser/ui/inc/menuaction.h Thu May 27 12:52:19 2010 +0300 @@ -18,8 +18,6 @@ #ifndef MENUACTION_H #define MENUACTION_H -//#include - class HbMenu; class HbAction; @@ -97,10 +95,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), @@ -221,4 +219,356 @@ }; +class FileViewDriveContextMenu +{ +public: + FileViewDriveContextMenu() : +// //NoAction = 0, +// 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) + { + + } + + ~FileViewDriveContextMenu() { } +public: + //File menu operations + //NoAction = 0, +// 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; +}; + +class FileViewFileContextMenu +{ +public: + FileViewFileContextMenu() : + //NoAction = 0, + 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), +// // 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), +// mSelection(0), +// mSetting(0), +// mAbout(0), +// mExit(0) + { + + } + + ~FileViewFileContextMenu() { } +public: + //File menu operations + //NoAction = 0, + 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; +// +// // 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; +// +// HbAction *mSelection; +// HbAction *mSetting; +// HbAction *mAbout; +// HbAction *mExit; +}; + #endif // MENUACTION_H diff -r 4f2773374eff -r 4b22a598b890 filebrowser/ui/inc/notifications.h --- a/filebrowser/ui/inc/notifications.h Fri May 14 15:53:02 2010 +0300 +++ b/filebrowser/ui/inc/notifications.h Thu May 27 12:52:19 2010 +0300 @@ -18,24 +18,19 @@ #ifndef NOTIFICATIONS_H_ #define NOTIFICATIONS_H_ -//#include #include +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_ diff -r 4f2773374eff -r 4b22a598b890 filebrowser/ui/inc/searchview.h --- a/filebrowser/ui/inc/searchview.h Fri May 14 15:53:02 2010 +0300 +++ b/filebrowser/ui/inc/searchview.h Thu May 27 12:52:19 2010 +0300 @@ -18,16 +18,18 @@ #ifndef SEARCHVIEW_H #define SEARCHVIEW_H -#include -#include +#include +#include -#include +#include class QDir; +class QStringList; + class EngineWrapper; -class QStringList; class HbDataForm; class HbDataFormModelItem; +class HbProgressDialog; /** * Settings class that is used for @@ -51,8 +53,8 @@ class SearchResults { public: - int mNumberOfFoundFiles; - QStringList* mFoundFilesList; + int mNumberOfFoundFiles; + QStringList *mFoundFilesList; }; class SearchView : public HbView @@ -60,24 +62,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 +102,8 @@ HbDataFormModelItem *mMaxDate; QString mPath; + + HbProgressDialog *mProgressDialog; }; #endif // SEARCHVIEW_H diff -r 4f2773374eff -r 4b22a598b890 filebrowser/ui/src/enginewrapper.cpp --- a/filebrowser/ui/src/enginewrapper.cpp Fri May 14 15:53:02 2010 +0300 +++ b/filebrowser/ui/src/enginewrapper.cpp Thu May 27 12:52:19 2010 +0300 @@ -24,6 +24,8 @@ #include "filebrowsersettings.h" #include "settingsview.h" +#include + #include #include #include @@ -33,7 +35,8 @@ EngineWrapper::EngineWrapper() : mEngine(0), mFilesFound(), - mSettings(0) + mSettings(0), + mWaitDialog(0) { } @@ -45,6 +48,8 @@ TRAP_IGNORE(mEngine->DeActivateEngineL()); delete mEngine; } + if (mWaitDialog) + delete mWaitDialog; } // --------------------------------------------------------------------------- @@ -686,6 +691,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 +709,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 +726,44 @@ 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::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); } // --------------------------------------------------------------------------- diff -r 4f2773374eff -r 4b22a598b890 filebrowser/ui/src/filebrowsermainwindow.cpp --- a/filebrowser/ui/src/filebrowsermainwindow.cpp Fri May 14 15:53:02 2010 +0300 +++ b/filebrowser/ui/src/filebrowsermainwindow.cpp Thu May 27 12:52:19 2010 +0300 @@ -24,13 +24,15 @@ #include "filebrowserview.h" #include "settingsview.h" #include "editorview.h" +#include "searchview.h" -FileBrowserMainWindow::FileBrowserMainWindow(QWidget *parent) : - HbMainWindow( parent ) - ,mEngineWrapper(0) - ,mFileBrowserView(0) - ,mSettingsView(0) - ,mEditorView(0) +FileBrowserMainWindow::FileBrowserMainWindow(QWidget *parent) + : HbMainWindow(parent), + mEngineWrapper(0), + mFileBrowserView(0), + mSettingsView(0), + mEditorView(0), + mSearchView(0) { } @@ -65,14 +67,22 @@ connect(mEditorView, SIGNAL(finished(bool)), this, SLOT(openFileBrowserView())); addView(mEditorView); + // Create Search view + mSearchView = new SearchView(*mEngineWrapper); + connect(mFileBrowserView, SIGNAL(aboutToShowSearchView(QString)), this, SLOT(openSearchView(QString))); + connect(mSearchView, SIGNAL(finished(bool)), this, SLOT(openFileBrowserView())); + addView(mSearchView); + // Show ApplicationView at startup setCurrentView(mFileBrowserView); + // Show HbMainWindow show(); } void FileBrowserMainWindow::openFileBrowserView() { + mFileBrowserView->refreshList(); setCurrentView(mFileBrowserView); } @@ -86,3 +96,9 @@ mEditorView->open(fileName, flagReadOnly); setCurrentView(mEditorView); } + +void FileBrowserMainWindow::openSearchView(const QString &path) +{ + mSearchView->open(path); + setCurrentView(mSearchView); +} diff -r 4f2773374eff -r 4b22a598b890 filebrowser/ui/src/filebrowserview.cpp --- a/filebrowser/ui/src/filebrowserview.cpp Fri May 14 15:53:02 2010 +0300 +++ b/filebrowser/ui/src/filebrowserview.cpp Thu May 27 12:52:19 2010 +0300 @@ -67,8 +67,6 @@ mFileBrowserModel(0), mFileViewMenuActions(), mToolbarBackAction(0), - mSearch(0), - mSettingsView(0), mItemHighlighted(false), mLocationChanged(false), mRemoveFileAfterCopied(false), @@ -78,7 +76,8 @@ mPanicCategory(), mAbsoluteFilePath(), mOverwriteOptions(), - mIsRenameAllowed(true), + mModelIndex(), + mNewFileName(), mProceed(false), mEraseMBR(false) { @@ -107,7 +106,6 @@ //mListView->setRootIndex(model->index()); mListView->setScrollingStyle(HbScrollArea::PanWithFollowOn); - //mListView->setHighlightMode(HbItemHighlight::HighlightAlwaysVisible); connect(mListView, SIGNAL(activated(QModelIndex)), this, SLOT(activated(QModelIndex))); @@ -129,12 +127,6 @@ FileBrowserView::~FileBrowserView() { -// if (mSearch !=0) { -// delete mSearch; -// } -// if (mSettingsView != 0) { -// delete mSettingsView; -// } // if (mEngineWrapper) { // delete mEngineWrapper; // } @@ -195,8 +187,8 @@ 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.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())); @@ -262,8 +254,12 @@ 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.mDiskAdminFormatDrive->setVisible(false); mFileViewMenuActions.mDiskAdminQuickFormatDrive = mFileViewMenuActions.mDiskAdminMenu->addAction("Quick format drive", this, SLOT(diskAdminQuickFormatDrive())); + mFileViewMenuActions.mDiskAdminQuickFormatDrive->setVisible(false); + 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())); @@ -284,7 +280,7 @@ 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.mToolsAllFilesToTextFile->setVisible(false); mFileViewMenuActions.mToolsAvkonIconCacheMenu = mFileViewMenuActions.mToolsMenu->addMenu("Avkon icon cache"); mFileViewMenuActions.mToolsAvkonIconCacheMenu->menuAction()->setVisible(false); @@ -348,7 +344,7 @@ */ void FileBrowserView::createSettingsMenuItem() { - mFileViewMenuActions.mSetting = menu()->addAction("Settings"); + mFileViewMenuActions.mSetting = menu()->addAction("Settings..."); connect(mFileViewMenuActions.mSetting, SIGNAL(triggered()), this, SIGNAL(aboutToShowSettingsView())); } @@ -503,10 +499,11 @@ // --------------------------------------------------------------------------- void FileBrowserView::fileOpen(HbAction *action) -{ +{ +// Q_UNUSED(action); HbSelectionDialog *dlg = static_cast(sender()); - if(!action && dlg && dlg->selectedModelIndexes().count()){ - int selectionIndex = dlg->selectedModelIndexes().at(0).row(); + if(!action && dlg && dlg->selectedItems().count()){ + int selectionIndex = dlg->selectedItems().at(0).toInt(); if (selectionIndex == 0) { // open editor view @@ -541,9 +538,10 @@ */ void FileBrowserView::fileOverwrite(HbAction *action) { +// Q_UNUSED(action); HbSelectionDialog *dlg = static_cast(sender()); - if(!action && dlg && dlg->selectedModelIndexes().count()) { - mOverwriteOptions.queryIndex = dlg->selectedModelIndexes().at(0).row(); + 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()); @@ -561,7 +559,7 @@ void FileBrowserView::fileOverwritePostfix(HbAction *action) { HbInputDialog *dlg = static_cast(sender()); - if (action == dlg->primaryAction()) { + if (dlg && action && action->text().compare(QString("Ok"), Qt::CaseInsensitive) == 0) { mOverwriteOptions.postFix = dlg->value().toString(); } else { mOverwriteOptions.doFileOperations = false; @@ -572,11 +570,15 @@ /** Show a list dialog \param List aList of item to select item from. - \param Title text aTitleText of a dialog heading widget + \param Title text titleText of a dialog heading widget \return None */ -void FileBrowserView::openListDialog(const QStringList& items, const QString &aTitleText, QObject* receiver, const char* member) +void FileBrowserView::openListDialog(const QStringList& items, const QString &titleText, QObject* receiver, const char* member) { +// Q_UNUSED(items); +// Q_UNUSED(titleText); +// Q_UNUSED(receiver); +// Q_UNUSED(member); // Create a list and some simple content for it HbSelectionDialog *dlg = new HbSelectionDialog(); dlg->setAttribute(Qt::WA_DeleteOnClose); @@ -584,9 +586,9 @@ dlg->setStringItems(items); dlg->setSelectionMode(HbAbstractItemView::SingleSelection); //dlg->setDismissPolicy(HbPopup::TapOutside); - + HbLabel *title = new HbLabel(dlg); - title->setPlainText(aTitleText); + title->setPlainText(titleText); dlg->setHeadingWidget(title); // Launch popup and handle the user response: @@ -595,89 +597,6 @@ // --------------------------------------------------------------------------- -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(); @@ -717,10 +636,10 @@ if (selectionIndexes->hasSelection()) { modelIndexList = mListView->selectionModel()->selectedIndexes(); } else { // or if none selected, use the current item index - QModelIndex currentIndex = currentItemIndex(); +// QModelIndex currentIndex = currentItemIndex(); // if (mFileBrowserModel->rowCount(currentItemIndex) > currentItemIndex && currentItemIndex >= 0) // { - modelIndexList.append(currentIndex); +// modelIndexList.append(currentIndex); // } } } @@ -800,19 +719,15 @@ 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()) { + QString searchPath; +// if (mEngineWrapper->currentPath() != mInitDirPath.path()) { // searchPath = mDirectory; // searchPath.replace("/", "\\"); // searchPath+="\\"; // } + searchPath = mEngineWrapper->currentPath(); // mSearch->open(searchPath); + emit aboutToShowSearchView(searchPath); } /** @@ -830,8 +745,7 @@ void FileBrowserView::doFileNewFile(HbAction *action) { HbInputDialog *dlg = static_cast(sender()); - if (action == dlg->primaryAction()) - { + if (dlg && action && action->text().compare(QString("Ok"), Qt::CaseInsensitive) == 0) { QString newFileName = dlg->value().toString(); mEngineWrapper->createNewFile(newFileName); refreshList(); @@ -853,8 +767,7 @@ void FileBrowserView::doFileNewDirectory(HbAction *action) { HbInputDialog *dlg = static_cast(sender()); - if (action == dlg->primaryAction()) - { + if (dlg && action && action->text().compare(QString("Ok"), Qt::CaseInsensitive) == 0) { QString newDirectoryName = dlg->value().toString(); mEngineWrapper->createNewDirectory(newDirectoryName); refreshList(); @@ -877,8 +790,7 @@ */ void FileBrowserView::doFileDelete(HbAction* action) { - HbMessageBox *dlg = qobject_cast(sender()); - if (action == dlg->primaryAction()) { + if (action && action->text().compare(QString("Yes"), Qt::CaseInsensitive) == 0) { QModelIndexList currentSelection = getSelectedItemsOrCurrentItem(); mEngineWrapper->deleteItems(currentSelection); refreshList(); @@ -894,15 +806,13 @@ mEngineWrapper->setCurrentSelection(currentSelection); for (int i(0), ie(currentSelection.count()); i < ie; ++i ) { + mProceed = (i == ie-1); // if the last item 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(); } /** @@ -911,18 +821,19 @@ void FileBrowserView::doFileRename(HbAction *action) { HbInputDialog *dlg = static_cast(sender()); - if (action == dlg->primaryAction()) - { - QString newName = dlg->value().toString(); - - if (mEngineWrapper->targetExists(mModelIndex, newName)) { + 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(newName); + QString message = messageTemplate.arg(mNewFileName); HbMessageBox::question(message, this, SLOT(doFileRenameFileExist(HbAction *))); - } - if (mIsRenameAllowed) { - mEngineWrapper->rename(mModelIndex, newName); + } else { + mEngineWrapper->rename(mModelIndex, mNewFileName); + if (mProceed) { + mEngineWrapper->startExecutingCommands(QString("Renaming")); + refreshList(); + } } } } @@ -932,9 +843,12 @@ */ void FileBrowserView::doFileRenameFileExist(HbAction *action) { - HbMessageBox *dlg = qobject_cast(sender()); - if (action == dlg->secondaryAction()) { - mIsRenameAllowed = false; + if (action && action->text().compare(QString("Yes"), Qt::CaseInsensitive) == 0) { + mEngineWrapper->rename(mModelIndex, mNewFileName); + if (mProceed) { + mEngineWrapper->startExecutingCommands(QString("Renaming")); + refreshList(); + } } } @@ -962,8 +876,7 @@ void FileBrowserView::doFileTouch(HbAction* action) { bool recurse = false; - HbMessageBox *dlg = qobject_cast(sender()); - if (action == dlg->primaryAction()) { + if (action && action->text().compare(QString("Yes"), Qt::CaseInsensitive) == 0) { recurse = true; } mEngineWrapper->touch(recurse); @@ -1081,8 +994,7 @@ void FileBrowserView::doEditCopyToFolder(HbAction *action) { HbInputDialog *dlg = static_cast(sender()); - if (action == dlg->primaryAction()) - { + if (dlg && action && action->text().compare(QString("Ok"), Qt::CaseInsensitive) == 0) { QString targetDir = dlg->value().toString(); bool someEntryExists(false); @@ -1114,8 +1026,7 @@ void FileBrowserView::doEditMoveToFolder(HbAction *action) { HbInputDialog *dlg = static_cast(sender()); - if (action == dlg->primaryAction()) - { + if (dlg && action && action->text().compare(QString("Ok"), Qt::CaseInsensitive) == 0) { QString targetDir = dlg->value().toString(); bool someEntryExists(false); @@ -1223,7 +1134,7 @@ void FileBrowserView::diskAdminSetDrivePasswordNew(HbAction *action) { HbInputDialog *dlg = static_cast(sender()); - if (action == dlg->primaryAction()) { + if (dlg && action && action->text().compare(QString("Ok"), Qt::CaseInsensitive) == 0) { mOldPassword = dlg->value().toString(); } @@ -1237,7 +1148,7 @@ void FileBrowserView::doDiskAdminSetDrivePassword(HbAction *action) { HbInputDialog *dlg = static_cast(sender()); - if (action == dlg->primaryAction()) { + if (dlg && action && action->text().compare(QString("Ok"), Qt::CaseInsensitive) == 0) { QString newPassword = dlg->value().toString(); QModelIndex currentIndex = currentItemIndex(); mEngineWrapper->DiskAdminSetDrivePassword(currentIndex, mOldPassword, newPassword); @@ -1266,8 +1177,7 @@ void FileBrowserView::doDiskAdminUnlockDrive(HbAction *action) { HbInputDialog *dlg = static_cast(sender()); - if (action == dlg->primaryAction()) - { + if (dlg && action && action->text().compare(QString("Ok"), Qt::CaseInsensitive) == 0) { QString oldPassword = dlg->value().toString(); QModelIndex currentIndex = currentItemIndex(); mEngineWrapper->DiskAdminUnlockDrive(currentIndex, oldPassword); @@ -1296,8 +1206,7 @@ void FileBrowserView::doDiskAdminClearDrivePassword(HbAction *action) { HbInputDialog *dlg = static_cast(sender()); - if (action == dlg->primaryAction()) - { + if (dlg && action && action->text().compare(QString("Ok"), Qt::CaseInsensitive) == 0) { QString oldPassword = dlg->value().toString(); QModelIndex currentIndex = currentItemIndex(); mEngineWrapper->DiskAdminClearDrivePassword(currentIndex, oldPassword); @@ -1325,8 +1234,7 @@ */ void FileBrowserView::doDiskAdminEraseDrivePassword(HbAction* action) { - HbMessageBox *dlg = qobject_cast(sender()); - if (action == dlg->primaryAction()) { + if (action && action->text().compare(QString("Yes"), Qt::CaseInsensitive) == 0) { QModelIndex currentIndex = currentItemIndex(); mEngineWrapper->DiskAdminEraseDrivePassword(currentIndex); refreshList(); @@ -1346,8 +1254,7 @@ */ void FileBrowserView::doDiskAdminFormatDrive(HbAction* action) { - HbMessageBox *dlg = qobject_cast(sender()); - if (action == dlg->primaryAction()) { + if (action && action->text().compare(QString("Yes"), Qt::CaseInsensitive) == 0) { QModelIndex currentIndex = currentItemIndex(); mEngineWrapper->DiskAdminFormatDrive(currentIndex, false); } @@ -1366,8 +1273,7 @@ */ void FileBrowserView::doDiskAdminQuickFormatDrive(HbAction* action) { - HbMessageBox *dlg = qobject_cast(sender()); - if (action == dlg->primaryAction()) { + if (action && action->text().compare(QString("Yes"), Qt::CaseInsensitive) == 0) { QModelIndex currentIndex = currentItemIndex(); mEngineWrapper->DiskAdminFormatDrive(currentIndex, true); } @@ -1395,8 +1301,7 @@ */ void FileBrowserView::doDiskAdminScanDrive(HbAction* action) { - HbMessageBox *dlg = qobject_cast(sender()); - if (action == dlg->primaryAction()) { + if (action && action->text().compare(QString("Yes"), Qt::CaseInsensitive) == 0) { QModelIndex currentIndex = currentItemIndex(); mEngineWrapper->DiskAdminScanDrive(currentIndex); refreshList(); @@ -1424,7 +1329,7 @@ void FileBrowserView::doDiskAdminSetDriveName(HbAction *action) { HbInputDialog *dlg = static_cast(sender()); - if (action == dlg->primaryAction()) { + if (dlg && action && action->text().compare(QString("Ok"), Qt::CaseInsensitive) == 0) { QString driveName = dlg->value().toString(); QModelIndex currentIndex = currentItemIndex(); @@ -1455,7 +1360,7 @@ void FileBrowserView::doDiskAdminSetDriveVolumeLabel(HbAction *action) { HbInputDialog *dlg = static_cast(sender()); - if (action == dlg->primaryAction()) { + if (dlg && action && action->text().compare(QString("Ok"), Qt::CaseInsensitive) == 0) { QString volumeLabel = dlg->value().toString(); QModelIndex currentIndex = currentItemIndex(); @@ -1485,8 +1390,7 @@ void FileBrowserView::doDiskAdminDismountDrive(HbAction* action) { - HbMessageBox *dlg = qobject_cast(sender()); - if (action == dlg->primaryAction()) { + if (action && action->text().compare(QString("Yes"), Qt::CaseInsensitive) == 0) { QModelIndex currentIndex = currentItemIndex(); mEngineWrapper->DiskAdminDismountDrive(currentIndex); refreshList(); @@ -1505,16 +1409,14 @@ void FileBrowserView::doDiskAdminEraseMBR(HbAction* action) { // TODO What to do with FB LITE macros? - HbMessageBox *dlg = qobject_cast(sender()); - if (action == dlg->primaryAction()){ + 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 FileBrowserView::doDiskAdminReallyEraseMBR(HbAction* action) { - HbMessageBox *dlg = qobject_cast(sender()); - if (action == dlg->primaryAction()) { + 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)) { @@ -1528,8 +1430,7 @@ void FileBrowserView::doDiskAdminNotRemovableReallyEraseMBR(HbAction* action) { - HbMessageBox *dlg = qobject_cast(sender()); - if (action == dlg->primaryAction()) { + if (action && action->text().compare(QString("Yes"), Qt::CaseInsensitive) == 0) { QModelIndex currentIndex = currentItemIndex(); mEngineWrapper->DiskAdminEraseMBR(currentIndex); refreshList(); @@ -1551,8 +1452,7 @@ */ void FileBrowserView::diskAdminPartitionDriveProceed(HbAction *action) { - HbMessageBox *dlg = qobject_cast(sender()); - if (action == dlg->primaryAction()) { + 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 *))); } @@ -1563,11 +1463,11 @@ */ void FileBrowserView::diskAdminPartitionDriveReallyProceed(HbAction *action) { - HbMessageBox *dlg = qobject_cast(sender()); - if (action == dlg->primaryAction()) { + 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 { @@ -1595,8 +1495,7 @@ */ void FileBrowserView::diskAdminPartitionDriveIsNotRemovable(HbAction *action) { - HbMessageBox *dlg = qobject_cast(sender()); - if (action == dlg->primaryAction()) { + if (action && action->text().compare(QString("Yes"), Qt::CaseInsensitive) == 0) { mProceed = true; } else { mProceed = false; @@ -1608,8 +1507,7 @@ */ void FileBrowserView::diskAdminPartitionDriveEraseMbr(HbAction *action) { - HbMessageBox *dlg = qobject_cast(sender()); - if (action == dlg->primaryAction()) { + if (action && action->text().compare(QString("Yes"), Qt::CaseInsensitive) == 0) { mEraseMBR = true; } } @@ -1619,6 +1517,7 @@ */ void FileBrowserView::diskAdminPartitionDriveGetCount(HbAction* action) { +// Q_UNUSED(action); HbSelectionDialog *dlg = static_cast(sender()); if(!action && dlg && dlg->selectedItems().count()){ int selectionIndex = dlg->selectedItems().at(0).toInt(); @@ -1636,10 +1535,15 @@ { } + +/** + Write all files to text file + */ void FileBrowserView::toolsAllFilesToTextFile() { + mEngineWrapper->toolsWriteAllFiles(); +} -} void FileBrowserView::toolsAvkonIconCacheEnable() { @@ -1692,7 +1596,7 @@ void FileBrowserView::doToolsErrorSimulateLeave(HbAction *action) { HbInputDialog *dlg = static_cast(sender()); - if (action == dlg->primaryAction()) { + if (dlg && action && action->text().compare(QString("Ok"), Qt::CaseInsensitive) == 0) { bool ok; int leaveCode = dlg->value().toString().toInt(&ok); if (leaveCode != 0 || ok) { @@ -1717,7 +1621,7 @@ void FileBrowserView::doToolsErrorSimulatePanicCode(HbAction *action) { HbInputDialog *dlg = static_cast(sender()); - if (action == dlg->primaryAction()) { + if (dlg && action && action->text().compare(QString("Ok"), Qt::CaseInsensitive) == 0) { mPanicCategory = dlg->value().toString(); int panicCode(555); QString heading = QString("Panic code"); @@ -1731,7 +1635,7 @@ void FileBrowserView::doToolsErrorSimulatePanic(HbAction *action) { HbInputDialog *dlg = static_cast(sender()); - if (action == dlg->primaryAction()) { + if (dlg && action && action->text().compare(QString("Ok"), Qt::CaseInsensitive) == 0) { bool ok; int panicCode = dlg->value().toInt(&ok); if (panicCode != 0 || ok) { @@ -1756,7 +1660,7 @@ void FileBrowserView::doToolsErrorSimulateException(HbAction *action) { HbInputDialog *dlg = static_cast(sender()); - if (action == dlg->primaryAction()) { + if (dlg && action && action->text().compare(QString("Ok"), Qt::CaseInsensitive) == 0) { bool ok; int exceptionCode = dlg->value().toInt(&ok); if (exceptionCode != 0 || ok) { @@ -1827,8 +1731,7 @@ void FileBrowserView::toolsSetDebugMask(HbAction *action) { HbInputDialog *dlg = static_cast(sender()); - if(action == dlg->primaryAction()) - { + 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; @@ -1881,8 +1784,8 @@ */ void FileBrowserView::selectionChanged(const QItemSelection &/*selected*/, const QItemSelection &/*deselected*/) { - QItemSelectionModel *selectionModel = mListView->selectionModel(); - itemHighlighted(selectionModel->currentIndex()); + //QItemSelectionModel *selectionModel = mListView->selectionModel(); + //itemHighlighted(selectionModel->currentIndex()); } /** diff -r 4f2773374eff -r 4b22a598b890 filebrowser/ui/src/notifications.cpp --- a/filebrowser/ui/src/notifications.cpp Fri May 14 15:53:02 2010 +0300 +++ b/filebrowser/ui/src/notifications.cpp Thu May 27 12:52:19 2010 +0300 @@ -14,14 +14,11 @@ * Description: * */ - - -#include -//#include -#include - #include "notifications.h" +#include +#include +#include // --------------------------------------------------------------------------- @@ -50,16 +47,6 @@ // --------------------------------------------------------------------------- -//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); @@ -83,6 +70,7 @@ bool Notifications::showConfirmationQuery(const QString &aText) { + Q_UNUSED(aText); return false; //HbMessageBox::question(aText); } diff -r 4f2773374eff -r 4b22a598b890 filebrowser/ui/src/searchview.cpp --- a/filebrowser/ui/src/searchview.cpp Fri May 14 15:53:02 2010 +0300 +++ b/filebrowser/ui/src/searchview.cpp Thu May 27 12:52:19 2010 +0300 @@ -17,62 +17,64 @@ #include "searchview.h" #include "enginewrapper.h" +#include "notifications.h" #include -#include - #include #include #include #include -#include #include #include #include -#include +#include +#include #include #include #include -#include - 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); +} diff -r 4f2773374eff -r 4b22a598b890 group/bld.inf --- a/group/bld.inf Fri May 14 15:53:02 2010 +0300 +++ b/group/bld.inf Thu May 27 12:52:19 2010 +0300 @@ -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" diff -r 4f2773374eff -r 4b22a598b890 htiui/HtiAdminQt/chtiadminengine.h --- a/htiui/HtiAdminQt/chtiadminengine.h Fri May 14 15:53:02 2010 +0300 +++ b/htiui/HtiAdminQt/chtiadminengine.h Thu May 27 12:52:19 2010 +0300 @@ -20,7 +20,7 @@ #include #include -#include +#include class HtiEngineWrapper; diff -r 4f2773374eff -r 4b22a598b890 htiui/HtiAdminQt/htienginewrapper.cpp --- a/htiui/HtiAdminQt/htienginewrapper.cpp Fri May 14 15:53:02 2010 +0300 +++ b/htiui/HtiAdminQt/htienginewrapper.cpp Thu May 27 12:52:19 2010 +0300 @@ -21,7 +21,7 @@ #include #include -#include +#include #include diff -r 4f2773374eff -r 4b22a598b890 htiui/HtiAdminQt/htienginewrapper.h --- a/htiui/HtiAdminQt/htienginewrapper.h Fri May 14 15:53:02 2010 +0300 +++ b/htiui/HtiAdminQt/htienginewrapper.h Thu May 27 12:52:19 2010 +0300 @@ -20,7 +20,7 @@ #include #include -#include +#include class CHtiAdminEngine; class QString; diff -r 4f2773374eff -r 4b22a598b890 htiui/HtiServicePlugins/HtiAppServicePlugin/src/HtiAppControl.cpp --- a/htiui/HtiServicePlugins/HtiAppServicePlugin/src/HtiAppControl.cpp Fri May 14 15:53:02 2010 +0300 +++ b/htiui/HtiServicePlugins/HtiAppServicePlugin/src/HtiAppControl.cpp Thu May 27 12:52:19 2010 +0300 @@ -35,7 +35,7 @@ #include #include #include -#include +#include using namespace Java; @@ -622,7 +622,26 @@ iInstOpts.iLang = (TLanguage) parameters[offset]; offset++; iInstOpts.iUsePhoneLang = (TBool) parameters[offset]; offset++; iInstOpts.iUpgradeData = ConvertToPolicy( parameters[offset] ); + offset++; + HTI_LOG_FORMAT( "parameters length: %d", parameters.Length()); + HTI_LOG_FORMAT( "next offset: %d", offset); + if(parameters.Length() > offset) + { + TInt language = iInstOpts.iLang; + if (parameters.Length() == offset+2) + { + language = parameters[offset] + parameters[offset+1]<<8; + } + if (parameters.Length() == offset+1) + { + language = parameters[offset]; + } + if ((language > ELangTest) && (language < ELangMaximum)) + { + iInstOpts.iLang = (TLanguage) language; + } + } HTI_LOG_FORMAT( "iDrive: %c", iInstOpts.iDrive.GetLowerCase() ); HTI_LOG_FORMAT( "iLang: %d", iInstOpts.iLang ); HTI_LOG_FORMAT( "iUsePhoneLang: %d", iInstOpts.iUsePhoneLang ); @@ -1558,7 +1577,7 @@ offset += length; // skip over password offset += 4; // the last one byte params - if ( aParams.Length() != offset ) + if ( aParams.Length() < offset || aParams.Length() > offset + 2) { HTI_LOG_TEXT( "ValidateInstallParams: Failed, final length incorrect" ); return EFalse; diff -r 4f2773374eff -r 4b22a598b890 htiui/HtiServicePlugins/HtiPIMServicePlugin/inc/HtiBookmarkHandler.h --- a/htiui/HtiServicePlugins/HtiPIMServicePlugin/inc/HtiBookmarkHandler.h Fri May 14 15:53:02 2010 +0300 +++ b/htiui/HtiServicePlugins/HtiPIMServicePlugin/inc/HtiBookmarkHandler.h Thu May 27 12:52:19 2010 +0300 @@ -21,8 +21,8 @@ // INCLUDES #include -#include -#include +#include +#include #include // CONSTANTS diff -r 4f2773374eff -r 4b22a598b890 htiui/HtiServicePlugins/HtiPIMServicePlugin/src/HtiBookmarkHandler.cpp --- a/htiui/HtiServicePlugins/HtiPIMServicePlugin/src/HtiBookmarkHandler.cpp Fri May 14 15:53:02 2010 +0300 +++ b/htiui/HtiServicePlugins/HtiPIMServicePlugin/src/HtiBookmarkHandler.cpp Thu May 27 12:52:19 2010 +0300 @@ -25,14 +25,14 @@ #include #include -#include -#include +#include +#include #include #include #include #include -#include +#include // EXTERNAL DATA STRUCTURES diff -r 4f2773374eff -r 4b22a598b890 htiui/sis/HTI_S60-10_1.pkg --- a/htiui/sis/HTI_S60-10_1.pkg Fri May 14 15:53:02 2010 +0300 +++ b/htiui/sis/HTI_S60-10_1.pkg Thu May 27 12:52:19 2010 +0300 @@ -18,7 +18,7 @@ &EN ; Using UID of HtiFramework project -#{"HTI"},(0x1020DEB6),2,21,0 +#{"HTI"},(0x1020DEB6),2,22,0 ; Series60 product id for S60 5.2 [0x20022E6D], 0, 0, 0, {"Series60ProductID"} diff -r 4f2773374eff -r 4b22a598b890 htiui/sis/HTI_S60-52.pkg --- a/htiui/sis/HTI_S60-52.pkg Fri May 14 15:53:02 2010 +0300 +++ b/htiui/sis/HTI_S60-52.pkg Thu May 27 12:52:19 2010 +0300 @@ -18,7 +18,7 @@ &EN ; Using UID of HtiFramework project -#{"HTI"},(0x1020DEB6),2,21,0 +#{"HTI"},(0x1020DEB6),2,22,0 ; Series60 product id for S60 5.2 [0x20022E6D], 0, 0, 0, {"Series60ProductID"} diff -r 4f2773374eff -r 4b22a598b890 htiui/sis/HTI_S60_Upgrade-10_1.pkg --- a/htiui/sis/HTI_S60_Upgrade-10_1.pkg Fri May 14 15:53:02 2010 +0300 +++ b/htiui/sis/HTI_S60_Upgrade-10_1.pkg Thu May 27 12:52:19 2010 +0300 @@ -18,7 +18,7 @@ &EN ; Using UID of HtiFramework project -#{"HTI"},(0x1020DEB6),2,21,0,TYPE=SA,RU +#{"HTI"},(0x1020DEB6),2,22,0,TYPE=SA,RU ; Series60 product id for S60 5.2 [0x20022E6D], 0, 0, 0, {"Series60ProductID"} diff -r 4f2773374eff -r 4b22a598b890 htiui/sis/HTI_S60_Upgrade-52.pkg --- a/htiui/sis/HTI_S60_Upgrade-52.pkg Fri May 14 15:53:02 2010 +0300 +++ b/htiui/sis/HTI_S60_Upgrade-52.pkg Thu May 27 12:52:19 2010 +0300 @@ -18,7 +18,7 @@ &EN ; Using UID of HtiFramework project -#{"HTI"},(0x1020DEB6),2,21,0,TYPE=SA,RU +#{"HTI"},(0x1020DEB6),2,22,0,TYPE=SA,RU ; Series60 product id for S60 5.2 [0x20022E6D], 0, 0, 0, {"Series60ProductID"} diff -r 4f2773374eff -r 4b22a598b890 htiui/sis/HTI_stub.pkg --- a/htiui/sis/HTI_stub.pkg Fri May 14 15:53:02 2010 +0300 +++ b/htiui/sis/HTI_stub.pkg Thu May 27 12:52:19 2010 +0300 @@ -18,7 +18,7 @@ &EN ; Using UID of HtiFramework project -#{"HTI"},(0x1020DEB6),2,21,0 +#{"HTI"},(0x1020DEB6),2,22,0 ; Localised Vendor name %{"Nokia"} diff -r 4f2773374eff -r 4b22a598b890 launcher/launcher.pro --- a/launcher/launcher.pro Fri May 14 15:53:02 2010 +0300 +++ b/launcher/launcher.pro Thu May 27 12:52:19 2010 +0300 @@ -22,8 +22,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: { diff -r 4f2773374eff -r 4b22a598b890 launcher/src/applicationview.cpp --- a/launcher/src/applicationview.cpp Fri May 14 15:53:02 2010 +0300 +++ b/launcher/src/applicationview.cpp Thu May 27 12:52:19 2010 +0300 @@ -26,7 +26,7 @@ #include "launchermainwindow.h" #include "enginewrapper.h" #include "notifications.h" -#include "commonactions.h" +#include "commonActions.h" #include "outputview.h" diff -r 4f2773374eff -r 4b22a598b890 launcher/src/commonActions.cpp --- a/launcher/src/commonActions.cpp Fri May 14 15:53:02 2010 +0300 +++ b/launcher/src/commonActions.cpp Thu May 27 12:52:19 2010 +0300 @@ -20,7 +20,7 @@ #include "hbaction.h" #include "hbmenu.h" -#include "commonactions.h" +#include "commonActions.h" #include "notifications.h" #include "enginewrapper.h" diff -r 4f2773374eff -r 4b22a598b890 launcher/src/launchermainwindow.cpp --- a/launcher/src/launchermainwindow.cpp Fri May 14 15:53:02 2010 +0300 +++ b/launcher/src/launchermainwindow.cpp Thu May 27 12:52:19 2010 +0300 @@ -21,7 +21,7 @@ #include #include "enginewrapper.h" -#include "commonactions.h" +#include "commonActions.h" #include "applicationview.h" #include "outputview.h" #include "launchermainwindow.h" diff -r 4f2773374eff -r 4b22a598b890 launcher/src/outputview.cpp --- a/launcher/src/outputview.cpp Fri May 14 15:53:02 2010 +0300 +++ b/launcher/src/outputview.cpp Thu May 27 12:52:19 2010 +0300 @@ -22,7 +22,7 @@ #include #include "enginewrapper.h" -#include "commonactions.h" +#include "commonActions.h" #include "outputview.h" // xml definition of view diff -r 4f2773374eff -r 4b22a598b890 layers.sysdef.xml --- a/layers.sysdef.xml Fri May 14 15:53:02 2010 +0300 +++ b/layers.sysdef.xml Thu May 27 12:52:19 2010 +0300 @@ -6,9 +6,6 @@ - - - @@ -32,7 +29,13 @@ - + + + + + + + \ No newline at end of file diff -r 4f2773374eff -r 4b22a598b890 memspyui/data/memspyui.rss --- a/memspyui/data/memspyui.rss Fri May 14 15:53:02 2010 +0300 +++ b/memspyui/data/memspyui.rss Thu May 27 12:52:19 2010 +0300 @@ -35,7 +35,7 @@ // User includes -#include "MemSpy.hrh" +#include "../ui/avkon/inc/MemSpy.hrh" RESOURCE RSS_SIGNATURE { } diff -r 4f2773374eff -r 4b22a598b890 memspyui/ui/avkon/group/memspyui.mmp --- a/memspyui/ui/avkon/group/memspyui.mmp Fri May 14 15:53:02 2010 +0300 +++ b/memspyui/ui/avkon/group/memspyui.mmp Thu May 27 12:52:19 2010 +0300 @@ -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 diff -r 4f2773374eff -r 4b22a598b890 memspyui/ui/avkon/inc/MemSpyUiUtils.h --- a/memspyui/ui/avkon/inc/MemSpyUiUtils.h Fri May 14 15:53:02 2010 +0300 +++ b/memspyui/ui/avkon/inc/MemSpyUiUtils.h Thu May 27 12:52:19 2010 +0300 @@ -23,13 +23,40 @@ // Engine includes #include +#include +_LIT( KTab, "\t" ); + +_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" ); class MemSpyUiUtils : public MemSpyEngineUtils { 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 ); }; diff -r 4f2773374eff -r 4b22a598b890 memspyui/ui/avkon/inc/MemSpyViewKernelObjects.h --- a/memspyui/ui/avkon/inc/MemSpyViewKernelObjects.h Fri May 14 15:53:02 2010 +0300 +++ b/memspyui/ui/avkon/inc/MemSpyViewKernelObjects.h Thu May 27 12:52:19 2010 +0300 @@ -67,6 +67,7 @@ private: // From MAknTabObserver void TabChangedL( TInt aIndex ); + TPtrC TypeAsString( TMemSpyDriverContainerType aType ); private: // Command handlers void OnCmdTerminateL(); diff -r 4f2773374eff -r 4b22a598b890 memspyui/ui/avkon/inc/MemSpyViewThreadInfoItemActiveObject.h --- a/memspyui/ui/avkon/inc/MemSpyViewThreadInfoItemActiveObject.h Fri May 14 15:53:02 2010 +0300 +++ b/memspyui/ui/avkon/inc/MemSpyViewThreadInfoItemActiveObject.h Thu May 27 12:52:19 2010 +0300 @@ -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 diff -r 4f2773374eff -r 4b22a598b890 memspyui/ui/avkon/inc/MemSpyViewThreadInfoItemChunk.h --- a/memspyui/ui/avkon/inc/MemSpyViewThreadInfoItemChunk.h Fri May 14 15:53:02 2010 +0300 +++ b/memspyui/ui/avkon/inc/MemSpyViewThreadInfoItemChunk.h Thu May 27 12:52:19 2010 +0300 @@ -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(); diff -r 4f2773374eff -r 4b22a598b890 memspyui/ui/avkon/inc/MemSpyViewThreadInfoItemCodeSeg.h --- a/memspyui/ui/avkon/inc/MemSpyViewThreadInfoItemCodeSeg.h Fri May 14 15:53:02 2010 +0300 +++ b/memspyui/ui/avkon/inc/MemSpyViewThreadInfoItemCodeSeg.h Thu May 27 12:52:19 2010 +0300 @@ -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 ); diff -r 4f2773374eff -r 4b22a598b890 memspyui/ui/avkon/inc/MemSpyViewThreadInfoItemGeneralInfo.h --- a/memspyui/ui/avkon/inc/MemSpyViewThreadInfoItemGeneralInfo.h Fri May 14 15:53:02 2010 +0300 +++ b/memspyui/ui/avkon/inc/MemSpyViewThreadInfoItemGeneralInfo.h Thu May 27 12:52:19 2010 +0300 @@ -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 ); diff -r 4f2773374eff -r 4b22a598b890 memspyui/ui/avkon/inc/MemSpyViewThreadInfoItemGeneric.h --- a/memspyui/ui/avkon/inc/MemSpyViewThreadInfoItemGeneric.h Fri May 14 15:53:02 2010 +0300 +++ b/memspyui/ui/avkon/inc/MemSpyViewThreadInfoItemGeneric.h Thu May 27 12:52:19 2010 +0300 @@ -24,6 +24,7 @@ // Engine includes #include +#include // 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 @@ -69,12 +71,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 iThreadInfoItems; //cigasto + CDesCArrayFlat* iModel; + TThreadId iThreadId; + TProcessId iParentProcessId; + TMemSpyThreadInfoItemType iType; }; diff -r 4f2773374eff -r 4b22a598b890 memspyui/ui/avkon/inc/MemSpyViewThreadInfoItemHeap.h --- a/memspyui/ui/avkon/inc/MemSpyViewThreadInfoItemHeap.h Fri May 14 15:53:02 2010 +0300 +++ b/memspyui/ui/avkon/inc/MemSpyViewThreadInfoItemHeap.h Thu May 27 12:52:19 2010 +0300 @@ -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 ); diff -r 4f2773374eff -r 4b22a598b890 memspyui/ui/avkon/inc/MemSpyViewThreadInfoItemList.h --- a/memspyui/ui/avkon/inc/MemSpyViewThreadInfoItemList.h Fri May 14 15:53:02 2010 +0300 +++ b/memspyui/ui/avkon/inc/MemSpyViewThreadInfoItemList.h Thu May 27 12:52:19 2010 +0300 @@ -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 ); 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; }; diff -r 4f2773374eff -r 4b22a598b890 memspyui/ui/avkon/inc/MemSpyViewThreadInfoItemServer.h --- a/memspyui/ui/avkon/inc/MemSpyViewThreadInfoItemServer.h Fri May 14 15:53:02 2010 +0300 +++ b/memspyui/ui/avkon/inc/MemSpyViewThreadInfoItemServer.h Thu May 27 12:52:19 2010 +0300 @@ -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 ); diff -r 4f2773374eff -r 4b22a598b890 memspyui/ui/avkon/inc/MemSpyViewThreadInfoItemStack.h --- a/memspyui/ui/avkon/inc/MemSpyViewThreadInfoItemStack.h Fri May 14 15:53:02 2010 +0300 +++ b/memspyui/ui/avkon/inc/MemSpyViewThreadInfoItemStack.h Thu May 27 12:52:19 2010 +0300 @@ -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 ); diff -r 4f2773374eff -r 4b22a598b890 memspyui/ui/avkon/src/MemSpyUiUtils.cpp --- a/memspyui/ui/avkon/src/MemSpyUiUtils.cpp Fri May 14 15:53:02 2010 +0300 +++ b/memspyui/ui/avkon/src/MemSpyUiUtils.cpp Thu May 27 12:52:19 2010 +0300 @@ -63,3 +63,89 @@ } } +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; + } + diff -r 4f2773374eff -r 4b22a598b890 memspyui/ui/avkon/src/MemSpyViewKernelContainers.cpp --- a/memspyui/ui/avkon/src/MemSpyViewKernelContainers.cpp Fri May 14 15:53:02 2010 +0300 +++ b/memspyui/ui/avkon/src/MemSpyViewKernelContainers.cpp Thu May 27 12:52:19 2010 +0300 @@ -109,7 +109,8 @@ TInt size = iKernelObjects[i]->Size(); const TMemSpySizeText sizeText( MemSpyEngineUtils::FormatSizeText( size, 0 ) ); //TODO: is this OK to call Engine Utils? - HBufC* tempName = HBufC::NewL( iKernelObjects[i]->Name().Length() + 32 ); //TODO: to removed this bulharic constant + HBufC* tempName = HBufC::NewL( iKernelObjects[i]->Name().Length() + 32 ); + //HBufC* tempName = HBufC::NewL( KMaxFullName ); CleanupStack::PushL( tempName ); TPtr tempNamePtr( tempName->Des() ); tempNamePtr.Copy( iKernelObjects[i]->Name() ); @@ -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 ); @@ -173,7 +174,9 @@ void CMemSpyViewKernelContainers::OnCmdOutputAllContainerContentsL() { - /* TODO + iMemSpySession.OutputAllContainerContents(); + + /* CMemSpyEngineOutputSink& sink = iEngine.Sink(); iModel->OutputL( sink ); */ diff -r 4f2773374eff -r 4b22a598b890 memspyui/ui/avkon/src/MemSpyViewKernelHeap.cpp --- a/memspyui/ui/avkon/src/MemSpyViewKernelHeap.cpp Fri May 14 15:53:02 2010 +0300 +++ b/memspyui/ui/avkon/src/MemSpyViewKernelHeap.cpp Thu May 27 12:52:19 2010 +0300 @@ -101,7 +101,7 @@ 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 ); @@ -144,9 +144,8 @@ void CMemSpyViewKernelHeap::OnCmdDumpKernelHeapL() - { - // TODO - //iEngine.HelperHeap().OutputHeapDataKernelL(); + { + iMemSpySession.DumpKernelHeap(); } @@ -178,7 +177,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 +304,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 +316,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 +333,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 +351,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 +368,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 +385,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 +402,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 +419,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(); diff -r 4f2773374eff -r 4b22a598b890 memspyui/ui/avkon/src/MemSpyViewKernelObjects.cpp --- a/memspyui/ui/avkon/src/MemSpyViewKernelObjects.cpp Fri May 14 15:53:02 2010 +0300 +++ b/memspyui/ui/avkon/src/MemSpyViewKernelObjects.cpp Thu May 27 12:52:19 2010 +0300 @@ -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 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,63 @@ process.KillL(); RefreshL(); } + */ + break; + } + default: + { + // Programming error + __ASSERT_ALWAYS( EFalse, User::Panic( _L("MemSpy-View"), 0 ) ); + } + } + } + +void CMemSpyViewKernelObjects::OnCmdPanicL() + { + 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, EPanic ); + 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, EPanic ); + RefreshL(); + } + } + break; } default: @@ -503,108 +617,106 @@ // Programming error __ASSERT_ALWAYS( EFalse, User::Panic( _L("MemSpy-View"), 0 ) ); } - } */ - } - - -void CMemSpyViewKernelObjects::OnCmdPanicL() - {/* - switch ( iObjectType ) - { - case EMemSpyDriverContainerTypeThread: - { - TBool doTerminate = ETrue; - - CMemSpyEngineObjectContainer& container = iEngine.Container(); - TThreadId id( iObjectList->At( iListBox->CurrentItemIndex() ).iId ); - - // 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(); - break; - } - case EMemSpyDriverContainerTypeProcess: - { - 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(); - } - break; - } - default: - { - // Programming error - __ASSERT_ALWAYS( EFalse, User::Panic( _L("MemSpy-View"), 0 ) ); - } - }*/ + } } void CMemSpyViewKernelObjects::CreateTabsL() { + TMemSpyDriverContainerType type = iKernelObjectItems[ iListBox->CurrentItemIndex() ]->Type(); + const TPtrC pType( TypeAsString( type ) ); + CEikStatusPane* statusPane = static_cast ( 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 ( 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); } +TPtrC CMemSpyViewKernelObjects::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; + } void CMemSpyViewKernelObjects::DetailsL() { diff -r 4f2773374eff -r 4b22a598b890 memspyui/ui/avkon/src/MemSpyViewThreadInfoItemActiveObject.cpp --- a/memspyui/ui/avkon/src/MemSpyViewThreadInfoItemActiveObject.cpp Fri May 14 15:53:02 2010 +0300 +++ b/memspyui/ui/avkon/src/MemSpyViewThreadInfoItemActiveObject.cpp Thu May 27 12:52:19 2010 +0300 @@ -112,8 +112,8 @@ -CMemSpyViewThreadInfoItemActiveObject::CMemSpyViewThreadInfoItemActiveObject( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyThreadInfoContainer& aContainer ) -: CMemSpyViewThreadInfoItemActiveObjectBase( aEngine, aObserver, aContainer ) +CMemSpyViewThreadInfoItemActiveObject::CMemSpyViewThreadInfoItemActiveObject( RMemSpySession& aSession, MMemSpyViewObserver& aObserver, TThreadId aId, TMemSpyThreadInfoItemType aType ) +: CMemSpyViewThreadInfoItemActiveObjectBase( aSession, aObserver, aId, aType ) { } diff -r 4f2773374eff -r 4b22a598b890 memspyui/ui/avkon/src/MemSpyViewThreadInfoItemChunk.cpp --- a/memspyui/ui/avkon/src/MemSpyViewThreadInfoItemChunk.cpp Fri May 14 15:53:02 2010 +0300 +++ b/memspyui/ui/avkon/src/MemSpyViewThreadInfoItemChunk.cpp Thu May 27 12:52:19 2010 +0300 @@ -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; } diff -r 4f2773374eff -r 4b22a598b890 memspyui/ui/avkon/src/MemSpyViewThreadInfoItemCodeSeg.cpp --- a/memspyui/ui/avkon/src/MemSpyViewThreadInfoItemCodeSeg.cpp Fri May 14 15:53:02 2010 +0300 +++ b/memspyui/ui/avkon/src/MemSpyViewThreadInfoItemCodeSeg.cpp Thu May 27 12:52:19 2010 +0300 @@ -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; } diff -r 4f2773374eff -r 4b22a598b890 memspyui/ui/avkon/src/MemSpyViewThreadInfoItemGeneralInfo.cpp --- a/memspyui/ui/avkon/src/MemSpyViewThreadInfoItemGeneralInfo.cpp Fri May 14 15:53:02 2010 +0300 +++ b/memspyui/ui/avkon/src/MemSpyViewThreadInfoItemGeneralInfo.cpp Thu May 27 12:52:19 2010 +0300 @@ -26,6 +26,7 @@ #include #include #include +#include // 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 ) diff -r 4f2773374eff -r 4b22a598b890 memspyui/ui/avkon/src/MemSpyViewThreadInfoItemGeneric.cpp --- a/memspyui/ui/avkon/src/MemSpyViewThreadInfoItemGeneric.cpp Fri May 14 15:53:02 2010 +0300 +++ b/memspyui/ui/avkon/src/MemSpyViewThreadInfoItemGeneric.cpp Thu May 27 12:52:19 2010 +0300 @@ -29,49 +29,42 @@ #include #include #include +#include // 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 ); + const TPtrC pTitle( MemSpyUiUtils::ThreadInfoItemNameByType( iType ) ); + SetTitleL( pTitle ); // + /* TODO: if ( iInfoItem->IsReady() == EFalse ) { #ifdef _DEBUG @@ -81,39 +74,39 @@ // Wait for engine data to be made ready... ShowWaitNoteL(); } - + */ CMemSpyViewBase::ConstructL( aRect, aContainer, aSelectionRune ); } 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 +116,8 @@ { TMemSpyViewType type = EMemSpyViewTypeNone; // - switch( iInfoItem->Type() ) + //switch( iInfoItem->Type() ) + switch( iType ) { case EMemSpyThreadInfoItemTypeHeap: type = EMemSpyViewTypeThreadInfoItemHeap; @@ -196,7 +190,7 @@ break; default: - __ASSERT_DEBUG( EFalse, User::Invariant() ); + //__ASSERT_DEBUG( EFalse, User::Invariant() ); break; } // @@ -206,9 +200,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() ); //TODO: arguent removed: iInfoItem CleanupStack::Pop( parent ); return parent; } @@ -216,7 +210,7 @@ CMemSpyViewBase* CMemSpyViewThreadInfoItemGeneric::PrepareChildViewL() { - __ASSERT_ALWAYS( iInfoItem != NULL, User::Invariant() ); + //__ASSERT_ALWAYS( iInfoItem != NULL, User::Invariant() ); CMemSpyViewBase* child = NULL; // return child; @@ -232,8 +226,40 @@ void CMemSpyViewThreadInfoItemGeneric::SetListBoxModelL() { + iMemSpySession.GetThreadInfoItems( iThreadInfoItems, iThreadId, iType ); + + iModel = new (ELeave) CDesC16ArrayFlat( iThreadInfoItems.Count() + 10 ); + + for( TInt i=0; iCaption().Length() + iThreadInfoItems[i]->Value().Length() + 30 ); + /* + else if ( iCombined->Des().MaxLength() < requiredLength ) + { + iCombined = iCombined->ReAllocL( requiredLength ); + }*/ + + CleanupStack::PushL( iCombined ); + + TPtr pCombined( iCombined->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 ); + + CleanupStack::PopAndDestroy( iCombined ); + } + CAknSettingStyleListBox* listbox = static_cast< CAknSettingStyleListBox* >( iListBox ); - listbox->Model()->SetItemTextArray( iInfoItem ); + //listbox->Model()->SetItemTextArray( iInfoItem ); + listbox->Model()->SetItemTextArray( iModel ); listbox->Model()->SetOwnershipType( ELbmDoesNotOwnItemArray ); } @@ -256,7 +282,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 +319,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 +336,7 @@ } // return callAgain; + */ } diff -r 4f2773374eff -r 4b22a598b890 memspyui/ui/avkon/src/MemSpyViewThreadInfoItemHeap.cpp --- a/memspyui/ui/avkon/src/MemSpyViewThreadInfoItemHeap.cpp Fri May 14 15:53:02 2010 +0300 +++ b/memspyui/ui/avkon/src/MemSpyViewThreadInfoItemHeap.cpp Thu May 27 12:52:19 2010 +0300 @@ -33,11 +33,16 @@ #include "MemSpyViewThreadInfoItemHeap.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 +74,19 @@ void CMemSpyViewThreadInfoItemHeap::OnCmdHeapDataL() { - iEngine.HelperHeap().OutputHeapDataUserL( Thread() ); + //iEngine.HelperHeap().OutputHeapDataUserL( Thread() ); //TODO } void CMemSpyViewThreadInfoItemHeap::OnCmdHeapCellListingL() { - iEngine.HelperHeap().OutputCellListingUserL( Thread() ); + //iEngine.HelperHeap().OutputCellListingUserL( Thread() ); //TODO } void CMemSpyViewThreadInfoItemHeap::OnCmdHeapInfoL() { - iEngine.HelperHeap().OutputHeapInfoUserL( Thread() ); + //iEngine.HelperHeap().OutputHeapInfoUserL( Thread() ); //TODO } @@ -89,6 +94,6 @@ { if ( aResourceId == R_MEMSPY_MENUPANE ) { - aMenuPane->SetItemDimmed( EMemSpyCmdHeap, Thread().IsDead() ); + //aMenuPane->SetItemDimmed( EMemSpyCmdHeap, Thread().IsDead() ); //TODO } } diff -r 4f2773374eff -r 4b22a598b890 memspyui/ui/avkon/src/MemSpyViewThreadInfoItemList.cpp --- a/memspyui/ui/avkon/src/MemSpyViewThreadInfoItemList.cpp Fri May 14 15:53:02 2010 +0300 +++ b/memspyui/ui/avkon/src/MemSpyViewThreadInfoItemList.cpp Thu May 27 12:52:19 2010 +0300 @@ -25,6 +25,10 @@ #include #include #include +#include + +// UI Utils include +#include "MemSpyUiUtils.h" // User includes #include "MemSpyContainerObserver.h" @@ -42,16 +46,15 @@ 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() { + /* TODO: to consider what to do with this delete iIdleResetListboxTimer; TRAP_IGNORE( @@ -63,9 +66,7 @@ { iCurrentInfoItem->Close(); } - - iThread.Process().Close(); - iThread.Close(); + */ } @@ -77,13 +78,15 @@ // iIdleResetListboxTimer = CPeriodic::NewL( CActive::EPriorityIdle ); // + /* CMemSpyThreadInfoContainer& container = iThread.InfoContainerL(); container.ObserverAddL( *this ); + */ // CMemSpyViewBase::ConstructL( aRect, aContainer, aSelectionRune ); // - if ( aSelectionRune ) - { + /*if ( aSelectionRune ) + { CMemSpyThreadInfoItemBase* selectedItem = reinterpret_cast< CMemSpyThreadInfoItemBase* >( aSelectionRune ); const TInt index = container.InfoItemIndexByType( selectedItem->Type() ); if ( index >= 0 && index < iListBox->Model()->NumberOfItems() ) @@ -93,32 +96,18 @@ } } else if ( container.MdcaCount() > 0 ) - { - iListBox->SetCurrentItemIndex( 0 ); + {*/ + iListBox->SetCurrentItemIndex( 0 ); //for now 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 +123,9 @@ CMemSpyViewBase* CMemSpyViewThreadInfoItemList::PrepareParentViewL() { - CMemSpyViewBase* parent = new(ELeave) CMemSpyViewThreads( iEngine, iObserver, iThread.Process() ); + CMemSpyViewBase* parent = new(ELeave) CMemSpyViewThreads( iMemSpySession, iObserver, iParentProcessId ); CleanupStack::PushL( parent ); - parent->ConstructL( Rect(), *Parent(), &iThread ); + parent->ConstructL( Rect(), *Parent() ); CleanupStack::Pop( parent ); return parent; } @@ -144,38 +133,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 +184,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 +222,7 @@ { if ( aResourceId == R_MEMSPY_MENUPANE ) { - aMenuPane->SetItemDimmed( EMemSpyCmdThread, iThread.IsDead() ); + // aMenuPane->SetItemDimmed( EMemSpyCmdThread, iThread.IsDead() ); //TODO } else if ( aResourceId == MenuCascadeResourceId() ) { @@ -243,12 +235,12 @@ void CMemSpyViewThreadInfoItemList::OnCmdInfoHandlesL() { - iThread.InfoContainerForceSyncronousConstructionL().PrintL(); + //iThread.InfoContainerForceSyncronousConstructionL().PrintL(); //TODO: } void CMemSpyViewThreadInfoItemList::HandleMemSpyEngineInfoContainerEventL( TEvent aEvent, TMemSpyThreadInfoItemType aType ) - { + {/* if ( aEvent == EInfoItemChanged ) { } @@ -263,13 +255,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,6 +385,9 @@ void CMemSpyViewThreadInfoItemList::HandleListBoxItemSelectedL( TInt aIndex ) { + iCurrentInfoItemId = aIndex; + + /* if ( iCurrentInfoItem ) { CMemSpyThreadInfoItemBase* item = iCurrentInfoItem; @@ -293,7 +398,7 @@ // Identify the type of item to display... iCurrentInfoItem = &iThread.InfoContainerL().Item( aIndex ); iCurrentInfoItem->Open(); - +*/ // Notify observer about item selection ReportEventL( MMemSpyViewObserver::EEventItemSelected ); } @@ -309,6 +414,7 @@ void CMemSpyViewThreadInfoItemList::DoIdleUpdateListBoxModelL() { + /* CMemSpyThreadInfoContainer& container = iThread.InfoContainerL(); // Try to maintain current item selection if at all possible. @@ -332,5 +438,5 @@ } iIdleResetListboxTimer->Cancel(); + */ } - diff -r 4f2773374eff -r 4b22a598b890 memspyui/ui/avkon/src/MemSpyViewThreadInfoItemServer.cpp --- a/memspyui/ui/avkon/src/MemSpyViewThreadInfoItemServer.cpp Fri May 14 15:53:02 2010 +0300 +++ b/memspyui/ui/avkon/src/MemSpyViewThreadInfoItemServer.cpp Thu May 27 12:52:19 2010 +0300 @@ -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 @@ - - - - - - diff -r 4f2773374eff -r 4b22a598b890 memspyui/ui/avkon/src/MemSpyViewThreadInfoItemStack.cpp --- a/memspyui/ui/avkon/src/MemSpyViewThreadInfoItemStack.cpp Fri May 14 15:53:02 2010 +0300 +++ b/memspyui/ui/avkon/src/MemSpyViewThreadInfoItemStack.cpp Thu May 27 12:52:19 2010 +0300 @@ -34,8 +34,8 @@ -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 +69,19 @@ void CMemSpyViewThreadInfoItemStack::OnCmdStackInfoL() { - iEngine.HelperStack().OutputStackInfoL( Thread() ); + // TODO iEngine.HelperStack().OutputStackInfoL( Thread() ); } void CMemSpyViewThreadInfoItemStack::OnCmdStackDataUserL() { - iEngine.HelperStack().OutputStackDataL( Thread(), EMemSpyDriverDomainUser ); + // TODO iEngine.HelperStack().OutputStackDataL( Thread(), EMemSpyDriverDomainUser ); } void CMemSpyViewThreadInfoItemStack::OnCmdStackDataKernelL() { - iEngine.HelperStack().OutputStackDataL( Thread(), EMemSpyDriverDomainKernel ); + // TODO iEngine.HelperStack().OutputStackDataL( Thread(), EMemSpyDriverDomainKernel ); } @@ -89,6 +89,6 @@ { if ( aResourceId == R_MEMSPY_MENUPANE ) { - aMenuPane->SetItemDimmed( EMemSpyCmdStack, Thread().IsDead() ); + //TODO aMenuPane->SetItemDimmed( EMemSpyCmdStack, Thread().IsDead() ); } } diff -r 4f2773374eff -r 4b22a598b890 memspyui/ui/avkon/src/MemSpyViewThreads.cpp --- a/memspyui/ui/avkon/src/MemSpyViewThreads.cpp Fri May 14 15:53:02 2010 +0300 +++ b/memspyui/ui/avkon/src/MemSpyViewThreads.cpp Thu May 27 12:52:19 2010 +0300 @@ -122,14 +122,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() ); CleanupStack::Pop( child ); - return child; - */ + return child; } diff -r 4f2773374eff -r 4b22a598b890 memspyui/ui/hb/hb.pro --- a/memspyui/ui/hb/hb.pro Fri May 14 15:53:02 2010 +0300 +++ b/memspyui/ui/hb/hb.pro Thu May 27 12:52:19 2010 +0300 @@ -30,6 +30,7 @@ inc/memspymainview.h \ inc/memspyprocessview.h \ inc/memspythreadview.h \ + inc/memspythreaddetailindexview.h \ inc/memspythreaddetailview.h \ inc/memspykernelobjecttypeview.h \ inc/memspykernelobjectview.h \ @@ -42,6 +43,7 @@ src/memspymainview.cpp \ src/memspyprocessview.cpp \ src/memspythreadview.cpp \ + src/memspythreaddetailindexview.cpp \ src/memspythreaddetailview.cpp \ src/memspykernelobjecttypeview.cpp \ src/memspykernelobjectview.cpp \ diff -r 4f2773374eff -r 4b22a598b890 memspyui/ui/hb/inc/enginewrapper.h --- a/memspyui/ui/hb/inc/enginewrapper.h Fri May 14 15:53:02 2010 +0300 +++ b/memspyui/ui/hb/inc/enginewrapper.h Thu May 27 12:52:19 2010 +0300 @@ -21,29 +21,10 @@ #include #include -#include 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 +75,51 @@ 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, +}; + +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; +}; + class MemSpyThread { public: @@ -127,6 +153,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,6 +266,23 @@ CMemSpyApiKernelObjectItem *mObject; }; +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 EngineWrapper : public QObject { public: @@ -246,6 +293,8 @@ QList getThreads(ProcessId processId); + QList getThreadInfo(ThreadId threadId, ThreadInfoType type); + void setThreadPriority(ThreadId threadId, ThreadPriority priority); QList getKernelObjectTypes(); diff -r 4f2773374eff -r 4b22a598b890 memspyui/ui/hb/inc/memspykernelobjecttypeview.h --- a/memspyui/ui/hb/inc/memspykernelobjecttypeview.h Fri May 14 15:53:02 2010 +0300 +++ b/memspyui/ui/hb/inc/memspykernelobjecttypeview.h Thu May 27 12:52:19 2010 +0300 @@ -33,6 +33,9 @@ QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; private: + QString formatSize(qint64 size) const; + +private: QList mObjectTypes; }; diff -r 4f2773374eff -r 4b22a598b890 memspyui/ui/hb/inc/memspythreaddetailindexview.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/memspyui/ui/hb/inc/memspythreaddetailindexview.h Thu May 27 12:52:19 2010 +0300 @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ + +#ifndef MEMSPYTHREADDETAILINDEXVIEW_H_ +#define MEMSPYTHREADDETAILINDEXVIEW_H_ + +#include "memspyview.h" +#include "enginewrapper.h" + +class HbMenu; + +class MemSpyThreadDetailIndexView : public MemSpyView +{ + Q_OBJECT + +public: + MemSpyThreadDetailIndexView(EngineWrapper &engine, ViewManager &viewManager) + : MemSpyView(engine, viewManager) {} +protected: + virtual void initialize(const QVariantMap& params); + virtual HbMenu* createToolMenu(); + +private slots: + void changePriority(); + void itemClicked(const QModelIndex& index); + +private: + ThreadId mThreadId; + HbMenu *mPriorityMenu; +}; + +#endif /* MEMSPYTHREADDETAILINDEXVIEW_H_ */ diff -r 4f2773374eff -r 4b22a598b890 memspyui/ui/hb/inc/memspythreaddetailview.h --- a/memspyui/ui/hb/inc/memspythreaddetailview.h Fri May 14 15:53:02 2010 +0300 +++ b/memspyui/ui/hb/inc/memspythreaddetailview.h Thu May 27 12:52:19 2010 +0300 @@ -23,6 +23,22 @@ class HbMenu; +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 mThreadInfo; +}; + + class MemSpyThreadDetailView : public MemSpyView { Q_OBJECT @@ -32,10 +48,6 @@ : MemSpyView(engine, viewManager) {} protected: virtual void initialize(const QVariantMap& params); - virtual HbMenu* createToolMenu(); - -private slots: - void changePriority(); private: ThreadId mThreadId; diff -r 4f2773374eff -r 4b22a598b890 memspyui/ui/hb/inc/viewmanager.h --- a/memspyui/ui/hb/inc/viewmanager.h Fri May 14 15:53:02 2010 +0300 +++ b/memspyui/ui/hb/inc/viewmanager.h Thu May 27 12:52:19 2010 +0300 @@ -26,6 +26,7 @@ MainView, ProcessView, ThreadView, + ThreadDetailIndexView, ThreadDetailView, KernelObjectTypeView, KernelObjectView, diff -r 4f2773374eff -r 4b22a598b890 memspyui/ui/hb/src/enginewrapper.cpp --- a/memspyui/ui/hb/src/enginewrapper.cpp Fri May 14 15:53:02 2010 +0300 +++ b/memspyui/ui/hb/src/enginewrapper.cpp Thu May 27 12:52:19 2010 +0300 @@ -54,9 +54,22 @@ return result; } +QList EngineWrapper::getThreadInfo(ThreadId threadId, ThreadInfoType type) +{ + QList result; + RArray threadInfo; + TRAPD(error, mSession.GetThreadInfoItems(threadInfo, threadId, + static_cast(type))); + if (error == KErrNone) + for (TInt i=0; i EngineWrapper::getKernelObjectTypes() diff -r 4f2773374eff -r 4b22a598b890 memspyui/ui/hb/src/memspykernelobjecttypeview.cpp --- a/memspyui/ui/hb/src/memspykernelobjecttypeview.cpp Fri May 14 15:53:02 2010 +0300 +++ b/memspyui/ui/hb/src/memspykernelobjecttypeview.cpp Thu May 27 12:52:19 2010 +0300 @@ -42,6 +42,9 @@ if (role == Qt::DisplayRole) { QStringList lines; lines << mObjectTypes.at(index.row())->name(); + 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 +55,26 @@ return QVariant(); } +QString MemSpyKernelObjectTypeModel::formatSize(qint64 size) const +{ + // If < 1000K + if (size < 1024000) + return QString("%1K").arg(size ? qBound(1, (size + 512) >> 10, 999) : 0); + + // larger than 1M + double sizeInM = size / 1048576.; + return sizeInM >= 1000 ? + QString("%1G").arg(qMax(1, sizeInM / 1024), 0, 'f', 1) : + QString("%1M").arg(qBound(1, sizeInM, 999.9), 0, 'f', 1); +} + void MemSpyKernelObjectTypeView::initialize(const QVariantMap& params) { 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))); } diff -r 4f2773374eff -r 4b22a598b890 memspyui/ui/hb/src/memspymainview.cpp --- a/memspyui/ui/hb/src/memspymainview.cpp Fri May 14 15:53:02 2010 +0300 +++ b/memspyui/ui/hb/src/memspymainview.cpp Thu May 27 12:52:19 2010 +0300 @@ -16,7 +16,7 @@ */ #include "memspymainview.h" -#include "viewManager.h" +#include "viewmanager.h" #include #include diff -r 4f2773374eff -r 4b22a598b890 memspyui/ui/hb/src/memspythreaddetailindexview.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/memspyui/ui/hb/src/memspythreaddetailindexview.cpp Thu May 27 12:52:19 2010 +0300 @@ -0,0 +1,116 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ + +#include +#include +#include + +#include "memspythreaddetailindexview.h" +#include "viewmanager.cpp" + +void MemSpyThreadDetailIndexView::initialize(const QVariantMap& params) +{ + MemSpyView::initialize(params); + + setTitle(tr("Thread Details")); + + mThreadId = qVariantValue(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; +} + +void MemSpyThreadDetailIndexView::changePriority() +{ + QAction *s = qobject_cast(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()]); + mViewManager.showView(ThreadDetailView, map); +} + diff -r 4f2773374eff -r 4b22a598b890 memspyui/ui/hb/src/memspythreaddetailview.cpp --- a/memspyui/ui/hb/src/memspythreaddetailview.cpp Fri May 14 15:53:02 2010 +0300 +++ b/memspyui/ui/hb/src/memspythreaddetailview.cpp Thu May 27 12:52:19 2010 +0300 @@ -21,76 +21,43 @@ #include "memspythreaddetailview.h" +MemSpyThreadDetailModel::MemSpyThreadDetailModel(EngineWrapper &engine, ThreadId threadId, ThreadInfoType type, QObject *parent) : + QAbstractListModel(parent), + mThreadInfo(engine.getThreadInfo(threadId, type)) +{ +} + +MemSpyThreadDetailModel::~MemSpyThreadDetailModel() +{ + qDeleteAll(mThreadInfo); +} + +int MemSpyThreadDetailModel::rowCount(const QModelIndex &parent) const +{ + Q_UNUSED(parent); + return mThreadInfo.count(); +} + +QVariant MemSpyThreadDetailModel::data(const QModelIndex &index, int role) const +{ + if (role == Qt::DisplayRole) { + QStringList lines; + lines << mThreadInfo.at(index.row())->caption(); + lines << mThreadInfo.at(index.row())->value(); + return lines; + } + + return QVariant(); +} + void MemSpyThreadDetailView::initialize(const QVariantMap& params) { MemSpyView::initialize(params); setTitle(tr("Thread Details")); - mThreadId = qVariantValue(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") << tr("Memory Tracking"); - - mListView.setModel(new QStringListModel(lines, this)); -} - -HbMenu* MemSpyThreadDetailView::createToolMenu() -{ - HbMenu* menu = new HbMenu(tr("Thread")); - mPriorityMenu = menu->addMenu("Change Priority"); + ThreadId threadId = qVariantValue(params["tid"]); + ThreadInfoType type = static_cast(qVariantValue(params["type"])); - 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; + mListView.setModel(new MemSpyThreadDetailModel(mEngine, threadId, type, this)); } - -void MemSpyThreadDetailView::changePriority() -{ - QAction *s = qobject_cast(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]); -} - diff -r 4f2773374eff -r 4b22a598b890 memspyui/ui/hb/src/memspythreadview.cpp --- a/memspyui/ui/hb/src/memspythreadview.cpp Fri May 14 15:53:02 2010 +0300 +++ b/memspyui/ui/hb/src/memspythreadview.cpp Thu May 27 12:52:19 2010 +0300 @@ -132,7 +132,7 @@ { QVariantMap map; map["tid"] = index.data(Qt::UserRole); - mViewManager.showView(ThreadDetailView, map); + mViewManager.showView(ThreadDetailIndexView, map); } void MemSpyThreadView::catchLongPress(HbAbstractViewItem *item, const QPointF &coords) diff -r 4f2773374eff -r 4b22a598b890 memspyui/ui/hb/src/viewmanager.cpp --- a/memspyui/ui/hb/src/viewmanager.cpp Fri May 14 15:53:02 2010 +0300 +++ b/memspyui/ui/hb/src/viewmanager.cpp Thu May 27 12:52:19 2010 +0300 @@ -25,6 +25,7 @@ #include "memspymainview.h" #include "memspyprocessview.h" #include "memspythreadview.h" +#include "memspythreaddetailindexview.h" #include "memspythreaddetailview.h" #include "memspykernelobjecttypeview.h" #include "memspykernelobjectview.h" @@ -40,6 +41,7 @@ &factory, &factory, &factory, + &factory, &factory, &factory, &factory, diff -r 4f2773374eff -r 4b22a598b890 perfmon/ui/hb/app/src/mainview.cpp --- a/perfmon/ui/hb/app/src/mainview.cpp Fri May 14 15:53:02 2010 +0300 +++ b/perfmon/ui/hb/app/src/mainview.cpp Thu May 27 12:52:19 2010 +0300 @@ -20,7 +20,7 @@ #include #include #include -#include +#include #include #include "mainview.h" diff -r 4f2773374eff -r 4b22a598b890 piprofilerui/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/piprofilerui/group/bld.inf Thu May 27 12:52:19 2010 +0300 @@ -0,0 +1,26 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + + +#include + +#include "bld_generic.inf" +#include "../ui/avkon/group/bld.inf" + + + diff -r 4f2773374eff -r 4b22a598b890 piprofilerui/group/bld_generic.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/piprofilerui/group/bld_generic.inf Thu May 27 12:52:19 2010 +0300 @@ -0,0 +1,34 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +PRJ_MMPFILES +#ifndef SBSV2 + #ifdef MARM + gnumakefile piprofiler_stub_sis.mk + #endif +#endif + +PRJ_EXTENSIONS +#ifdef SBSV2 + #ifdef MARM + START EXTENSION app-services/buildstubsis + OPTION SRCDIR ../sis + OPTION SISNAME PIProfiler_stub + END + #endif +#endif + diff -r 4f2773374eff -r 4b22a598b890 piprofilerui/group/group.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/piprofilerui/group/group.pro Thu May 27 12:52:19 2010 +0300 @@ -0,0 +1,21 @@ +# +# Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: +# +# + +TEMPLATE = subdirs + +BLD_INF_RULES.prj_platforms += "$${LITERAL_HASH}include \"bld_generic.inf\"" + diff -r 4f2773374eff -r 4b22a598b890 piprofilerui/piprofilerui.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/piprofilerui/piprofilerui.pro Thu May 27 12:52:19 2010 +0300 @@ -0,0 +1,23 @@ +# +# Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: +# +# + +TEMPLATE = subdirs + +DEFINES += QT_NO_DEBUG_OUTPUT QT_NO_WARNING_OUTPUT QT_NO_DEBUG + +SUBDIRS = group \ + ui/hb diff -r 4f2773374eff -r 4b22a598b890 piprofilerui/sis/PIProfiler_S60-30.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/piprofilerui/sis/PIProfiler_S60-30.pkg Thu May 27 12:52:19 2010 +0300 @@ -0,0 +1,37 @@ +; +; Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +; All rights reserved. +; This component and the accompanying materials are made available +; under the terms of "Eclipse Public License v1.0" +; which accompanies this distribution, and is available +; at the URL "http://www.eclipse.org/legal/epl-v10.html". +; +; Initial Contributors: +; Nokia Corporation - initial contribution. +; +; Contributors: +; +; Description: +; +&EN + +; Standard SIS file header +#{"PIProfilerUI"},(0x2001E5AE),2,2,01,TYPE=SA, RU + +; Supports S60 v 3.0 and 5.0 +[0x101F7961], 0, 0, 0, {"S60ProductID"} + +; Non-localised vendor name +:"Nokia Corporation" + +; Localised vendor names +%{"Nokia Corporation"} + +; normal stuff: +"\epoc32\RELEASE\armv5\urel\PIProfilerUI.exe"-"!:\sys\bin\PIProfilerUI.exe" +"\epoc32\data\z\Resource\apps\piprofilerui_aif.mif"-"!:\Resource\Apps\piprofilerui_aif.mif" +"\epoc32\data\z\Resource\apps\piprofilerui_ExtraIcons.mif"-"!:\Resource\Apps\piprofilerui_ExtraIcons.mif" +"\epoc32\data\z\Resource\apps\piprofilerui.rsc"-"!:\Resource\Apps\piprofilerui.rsc" +"\epoc32\data\z\PRIVATE\10003A3F\APPS\piprofilerui_reg.rsc"-"!:\private\10003a3f\import\apps\piprofilerui_reg.rsc" +"..\ui\avkon\group\backup_registration.xml"-"!:\private\2001E5AE\backup_registration.xml" + diff -r 4f2773374eff -r 4b22a598b890 piprofilerui/sis/PIProfiler_S60-31.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/piprofilerui/sis/PIProfiler_S60-31.pkg Thu May 27 12:52:19 2010 +0300 @@ -0,0 +1,37 @@ +; +; Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +; All rights reserved. +; This component and the accompanying materials are made available +; under the terms of "Eclipse Public License v1.0" +; which accompanies this distribution, and is available +; at the URL "http://www.eclipse.org/legal/epl-v10.html". +; +; Initial Contributors: +; Nokia Corporation - initial contribution. +; +; Contributors: +; +; Description: +; +&EN + +; Standard SIS file header +#{"PIProfilerUI"},(0x2001E5AE),2,2,01,TYPE=SA, RU + +; Supports S60 v 3.0 and 5.0 +[0x101F7961], 0, 0, 0, {"S60ProductID"} + +; Non-localised vendor name +:"Nokia Corporation" + +; Localised vendor names +%{"Nokia Corporation"} + +; normal stuff: +"\epoc32\RELEASE\armv5\urel\PIProfilerUI.exe"-"!:\sys\bin\PIProfilerUI.exe" +"\epoc32\data\z\Resource\apps\piprofilerui_aif.mif"-"!:\Resource\Apps\piprofilerui_aif.mif" +"\epoc32\data\z\Resource\apps\piprofilerui_ExtraIcons.mif"-"!:\Resource\Apps\piprofilerui_ExtraIcons.mif" +"\epoc32\data\z\Resource\apps\piprofilerui.rsc"-"!:\Resource\Apps\piprofilerui.rsc" +"\epoc32\data\z\PRIVATE\10003A3F\APPS\piprofilerui_reg.rsc"-"!:\private\10003a3f\import\apps\piprofilerui_reg.rsc" +"..\ui\avkon\group\backup_registration.xml"-"!:\private\2001E5AE\backup_registration.xml" + diff -r 4f2773374eff -r 4b22a598b890 piprofilerui/sis/PIProfiler_S60-32.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/piprofilerui/sis/PIProfiler_S60-32.pkg Thu May 27 12:52:19 2010 +0300 @@ -0,0 +1,37 @@ +; +; Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +; All rights reserved. +; This component and the accompanying materials are made available +; under the terms of "Eclipse Public License v1.0" +; which accompanies this distribution, and is available +; at the URL "http://www.eclipse.org/legal/epl-v10.html". +; +; Initial Contributors: +; Nokia Corporation - initial contribution. +; +; Contributors: +; +; Description: +; +&EN + +; Standard SIS file header +#{"PIProfilerUI"},(0x2001E5AE),2,2,01,TYPE=SA, RU + +; Supports S60 v 3.0 and 5.0 +[0x101F7961], 0, 0, 0, {"S60ProductID"} + +; Non-localised vendor name +:"Nokia Corporation" + +; Localised vendor names +%{"Nokia Corporation"} + +; normal stuff: +"\epoc32\RELEASE\armv5\urel\PIProfilerUI.exe"-"!:\sys\bin\PIProfilerUI.exe" +"\epoc32\data\z\Resource\apps\piprofilerui_aif.mif"-"!:\Resource\Apps\piprofilerui_aif.mif" +"\epoc32\data\z\Resource\apps\piprofilerui_ExtraIcons.mif"-"!:\Resource\Apps\piprofilerui_ExtraIcons.mif" +"\epoc32\data\z\Resource\apps\piprofilerui.rsc"-"!:\Resource\Apps\piprofilerui.rsc" +"\epoc32\data\z\PRIVATE\10003A3F\APPS\piprofilerui_reg.rsc"-"!:\private\10003a3f\import\apps\piprofilerui_reg.rsc" +"..\ui\avkon\group\backup_registration.xml"-"!:\private\2001E5AE\backup_registration.xml" + diff -r 4f2773374eff -r 4b22a598b890 piprofilerui/sis/PIProfiler_S60-50.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/piprofilerui/sis/PIProfiler_S60-50.pkg Thu May 27 12:52:19 2010 +0300 @@ -0,0 +1,37 @@ +; +; Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +; All rights reserved. +; This component and the accompanying materials are made available +; under the terms of "Eclipse Public License v1.0" +; which accompanies this distribution, and is available +; at the URL "http://www.eclipse.org/legal/epl-v10.html". +; +; Initial Contributors: +; Nokia Corporation - initial contribution. +; +; Contributors: +; +; Description: +; +&EN + +; Standard SIS file header +#{"PIProfilerUI"},(0x2001E5AE),2,2,01,TYPE=SA, RU + +; Supports S60 v 3.0 and 5.0 +[0x101F7961], 0, 0, 0, {"S60ProductID"} + +; Non-localised vendor name +:"Nokia Corporation" + +; Localised vendor names +%{"Nokia Corporation"} + +; normal stuff: +"\epoc32\RELEASE\armv5\urel\PIProfilerUI.exe"-"!:\sys\bin\PIProfilerUI.exe" +"\epoc32\data\z\Resource\apps\piprofilerui_aif.mif"-"!:\Resource\Apps\piprofilerui_aif.mif" +"\epoc32\data\z\Resource\apps\piprofilerui_ExtraIcons.mif"-"!:\Resource\Apps\piprofilerui_ExtraIcons.mif" +"\epoc32\data\z\Resource\apps\piprofilerui.rsc"-"!:\Resource\Apps\piprofilerui.rsc" +"\epoc32\data\z\PRIVATE\10003A3F\APPS\piprofilerui_reg.rsc"-"!:\private\10003a3f\import\apps\piprofilerui_reg.rsc" +"..\ui\avkon\group\backup_registration.xml"-"!:\private\2001E5AE\backup_registration.xml" + diff -r 4f2773374eff -r 4b22a598b890 piprofilerui/sis/PIProfiler_Symbian3.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/piprofilerui/sis/PIProfiler_Symbian3.pkg Thu May 27 12:52:19 2010 +0300 @@ -0,0 +1,37 @@ +; +; Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +; All rights reserved. +; This component and the accompanying materials are made available +; under the terms of "Eclipse Public License v1.0" +; which accompanies this distribution, and is available +; at the URL "http://www.eclipse.org/legal/epl-v10.html". +; +; Initial Contributors: +; Nokia Corporation - initial contribution. +; +; Contributors: +; +; Description: +; +&EN + +; Standard SIS file header +#{"PIProfilerUI"},(0x2001E5AE),2,2,01,TYPE=SA, RU + +; Supports S60 v 3.0 and 5.0 +[0x101F7961], 0, 0, 0, {"S60ProductID"} + +; Non-localised vendor name +:"Nokia Corporation" + +; Localised vendor names +%{"Nokia Corporation"} + +; normal stuff: +"\epoc32\RELEASE\armv5\urel\PIProfilerUI.exe"-"!:\sys\bin\PIProfilerUI.exe" +"\epoc32\data\z\Resource\apps\piprofilerui_aif.mif"-"!:\Resource\Apps\piprofilerui_aif.mif" +"\epoc32\data\z\Resource\apps\piprofilerui_ExtraIcons.mif"-"!:\Resource\Apps\piprofilerui_ExtraIcons.mif" +"\epoc32\data\z\Resource\apps\piprofilerui.rsc"-"!:\Resource\Apps\piprofilerui.rsc" +"\epoc32\data\z\PRIVATE\10003A3F\APPS\piprofilerui_reg.rsc"-"!:\private\10003a3f\import\apps\piprofilerui_reg.rsc" +"..\ui\avkon\group\backup_registration.xml"-"!:\private\2001E5AE\backup_registration.xml" + diff -r 4f2773374eff -r 4b22a598b890 piprofilerui/sis/PIProfiler_Symbian4.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/piprofilerui/sis/PIProfiler_Symbian4.pkg Thu May 27 12:52:19 2010 +0300 @@ -0,0 +1,37 @@ +; +; Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +; All rights reserved. +; This component and the accompanying materials are made available +; under the terms of "Eclipse Public License v1.0" +; which accompanies this distribution, and is available +; at the URL "http://www.eclipse.org/legal/epl-v10.html". +; +; Initial Contributors: +; Nokia Corporation - initial contribution. +; +; Contributors: +; +; Description: +; +&EN + +; Standard SIS file header +#{"PIProfilerUI"},(0x2001E5AE),2,2,01,TYPE=SA, RU + +; Supports S60 v 3.0 and 5.0 +[0x101F7961], 0, 0, 0, {"S60ProductID"} + +; Non-localised vendor name +:"Nokia Corporation" + +; Localised vendor names +%{"Nokia Corporation"} + +; normal stuff: +"\epoc32\RELEASE\armv5\urel\PIProfilerUI.exe"-"!:\sys\bin\PIProfilerUI.exe" +"\epoc32\data\z\Resource\apps\piprofilerui_aif.mif"-"!:\Resource\Apps\piprofilerui_aif.mif" +"\epoc32\data\z\Resource\apps\piprofilerui_ExtraIcons.mif"-"!:\Resource\Apps\piprofilerui_ExtraIcons.mif" +"\epoc32\data\z\Resource\apps\piprofilerui.rsc"-"!:\Resource\Apps\piprofilerui.rsc" +"\epoc32\data\z\PRIVATE\10003A3F\APPS\piprofilerui_reg.rsc"-"!:\private\10003a3f\import\apps\piprofilerui_reg.rsc" +"..\ui\avkon\group\backup_registration.xml"-"!:\private\2001E5AE\backup_registration.xml" + diff -r 4f2773374eff -r 4b22a598b890 piprofilerui/sis/PIProfiler_stub.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/piprofilerui/sis/PIProfiler_stub.pkg Thu May 27 12:52:19 2010 +0300 @@ -0,0 +1,33 @@ +; +; Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +; All rights reserved. +; This component and the accompanying materials are made available +; under the terms of "Eclipse Public License v1.0" +; which accompanies this distribution, and is available +; at the URL "http://www.eclipse.org/legal/epl-v10.html". +; +; Initial Contributors: +; Nokia Corporation - initial contribution. +; +; Contributors: +; +; Description: +; +&EN + +; Standard SIS file header +#{"ProfilerGUI"},(0x2001E5AE),1,0,0 + +; Non-localised vendor name +:"Nokia Corporation" + +; Localised vendor names +%{"Nokia Corporation"} + +; normal stuff: +""-"!:\sys\bin\PIProfilerUI.exe" +""-"!:\Resource\Apps\piprofilerui_aif.mif" +""-"!:\Resource\Apps\piprofilerui_ExtraIcons.mif" +""-"!:\Resource\Apps\piprofilerui.rsc" +""-"!:\private\10003a3f\import\apps\piprofilerui_reg.rsc" +""-"!:\private\2001E5AE\backup_registration.xml" diff -r 4f2773374eff -r 4b22a598b890 piprofilerui/ui/avkon/data/piprofilerui.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/piprofilerui/ui/avkon/data/piprofilerui.rss Thu May 27 12:52:19 2010 +0300 @@ -0,0 +1,962 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + + + +NAME PIPR + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "profiler_gui.hrh" +#include "profiler_gui_std.h" +#include +#include + + +// --------------------------------------------------------- +// +// 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"; + }; + } diff -r 4f2773374eff -r 4b22a598b890 piprofilerui/ui/avkon/data/piprofilerui_reg.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/piprofilerui/ui/avkon/data/piprofilerui_reg.rss Thu May 27 12:52:19 2010 +0300 @@ -0,0 +1,36 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + + + +#include +#include +#include + + +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"; + } diff -r 4f2773374eff -r 4b22a598b890 piprofilerui/ui/avkon/group/backup_registration.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/piprofilerui/ui/avkon/group/backup_registration.xml Thu May 27 12:52:19 2010 +0300 @@ -0,0 +1,8 @@ + + + + + + + + diff -r 4f2773374eff -r 4b22a598b890 piprofilerui/ui/avkon/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/piprofilerui/ui/avkon/group/bld.inf Thu May 27 12:52:19 2010 +0300 @@ -0,0 +1,50 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + + +#include + + +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 diff -r 4f2773374eff -r 4b22a598b890 piprofilerui/ui/avkon/group/piprofilerui.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/piprofilerui/ui/avkon/group/piprofilerui.mmp Thu May 27 12:52:19 2010 +0300 @@ -0,0 +1,86 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + + +#include +#include + + +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 diff -r 4f2773374eff -r 4b22a598b890 piprofilerui/ui/avkon/group/piprofilerui_extraicons.mk --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/piprofilerui/ui/avkon/group/piprofilerui_extraicons.mk Thu May 27 12:52:19 2010 +0300 @@ -0,0 +1,60 @@ +# +# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: +# + +ifeq (WINS,$(findstring WINS, $(PLATFORM))) +ZDIR=$(EPOCROOT)epoc32\release\$(PLATFORM)\$(CFG)\z +else +ZDIR=$(EPOCROOT)epoc32\data\z +endif + +TARGETDIR=$(ZDIR)\resource\apps +ICONTARGETFILENAME=$(TARGETDIR)\piprofilerui_extraicons.mif + +HEADERDIR=$(EPOCROOT)epoc32\include +HEADERFILENAME=$(HEADERDIR)\piprofilerui_extraicons.mbg + + +do_nothing : + @rem do_nothing + +MAKMAKE : do_nothing + +BLD : do_nothing + +CLEAN : + @if exist $(ICONTARGETFILENAME) erase $(ICONTARGETFILENAME) + @if exist $(HEADERFILENAME) erase $(HEADERFILENAME) + +LIB : do_nothing + +CLEANLIB : do_nothing + +RESOURCE : $(ICONTARGETFILENAME) + +$(ICONTARGETFILENAME) (HEADERFILENAME) : ..\..\icons\qgn_prob_piprofilerui_status_disabled.svg ..\..\icons\qgn_prob_piprofilerui_status_enabled.svg + mifconv $(ICONTARGETFILENAME) /h$(HEADERFILENAME) \ + /c8,8 ..\..\icons\qgn_prob_piprofilerui_status_disabled.svg \ + /c8,8 ..\..\icons\qgn_prob_piprofilerui_status_enabled.svg + +FREEZE : do_nothing + +SAVESPACE : do_nothing + +RELEASABLES : + @echo $(HEADERFILENAME) && \ + @echo $(ICONTARGETFILENAME) + +FINAL : do_nothing diff -r 4f2773374eff -r 4b22a598b890 piprofilerui/ui/avkon/group/piprofilerui_icons_aif.mk --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/piprofilerui/ui/avkon/group/piprofilerui_icons_aif.mk Thu May 27 12:52:19 2010 +0300 @@ -0,0 +1,54 @@ +# +# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: +# + +ifeq (WINS,$(findstring WINS, $(PLATFORM))) +ZDIR=$(EPOCROOT)epoc32\release\$(PLATFORM)\$(CFG)\z +else +ZDIR=$(EPOCROOT)epoc32\data\z +endif + +TARGETDIR=$(ZDIR)\resource\apps +ICONTARGETFILENAME=$(TARGETDIR)\piprofilerui_aif.mif + + +do_nothing : + @rem do_nothing + +MAKMAKE : do_nothing + +BLD : do_nothing + +CLEAN : + @if exist $(ICONTARGETFILENAME) erase $(ICONTARGETFILENAME) + +LIB : do_nothing + +CLEANLIB : do_nothing + +RESOURCE : $(ICONTARGETFILENAME) + +$(ICONTARGETFILENAME) : ..\..\icons\qgn_menu_piprofilerui.svg + mifconv $(ICONTARGETFILENAME) \ + /c8,8 ..\..\icons\qgn_menu_piprofilerui.svg + +FREEZE : do_nothing + +SAVESPACE : do_nothing + +RELEASABLES : + @echo $(ICONTARGETFILENAME) + +FINAL : do_nothing diff -r 4f2773374eff -r 4b22a598b890 piprofilerui/ui/avkon/inc/profiler_gui.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/piprofilerui/ui/avkon/inc/profiler_gui.hrh Thu May 27 12:52:19 2010 +0300 @@ -0,0 +1,117 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + + +#ifndef PROFILERGUI_HRH +#define PROFILERGUI_HRH + +enum TProfilerCmdSamplerIds + { + EProfilerGuiCmdSamplerEnable = 1, // id cannot be 0 + EProfilerGuiCmdSamplerDisable, + EProfilerGuiCmdSamplerSettings, + EProfilerGuiCmdSamplerInfo + }; + +enum TSamplerSettingItemIds + { + EProfilerGuiGenericSamplerQuerySampleRate = 0, + EProfilerGuiGenericSamplerQueryItem1, + EProfilerGuiGenericSamplerQueryItem2, + EProfilerGuiGenericSamplerQueryItem3, + EProfilerGuiGenericSamplerQueryItem4, + EProfilerGuiGenericSamplerQueryItem5, + EProfilerGuiGenericSamplerQueryItem6 + }; + +enum TGeneralSettingItemIds + { + ESettingListItemPluginTraceOutput = 0, + ESettingListItemPluginSaveFileDrive, + ESettingListItemPluginTraceFilePrefix, + ESettingListItemPluginSamplingTime + }; + +enum TProfilerGuiCommandIds + { + EProfilerGuiCmdStart = 1000, + EProfilerGuiCmdStop, + EProfilerGuiCmdStartAll, + EProfilerGuiCmdStartTimed, + EProfilerGuiCmdStopAll, + + EProfilerGuiCmdSamplerControl, + EProfilerGuiCmdSamplerSettingsChange, + EProfilerGuiCmdSamplerSettingsExit, + + EProfilerGuiCmdSettings, + EProfilerGuiCmdSettingsChange, + EProfilerGuiCmdSettingsExit, + EProfilerGuiCmdSettingsBack, + + EProfilerGuiCmdAbout, + + EProfilerGuiViewConfQuery, + EProfilerGuiSettingItemList, + EProfilerSamplerSettingItemList + }; + +enum TProfilerGuiSettingSamplerNameLength + { + ESamplerNameShort, + ESamplerNameMedium, + ESamplerNameLong + }; + +enum TProfilerGuiSettingTraceMode + { + ETraceModeStream, + ETraceModeBuffer + }; + +enum TProfilerGuiSettingOutputMode + { + EOutputToDebugPort = 0, + EOutputToFileSystem + }; + +enum TProfilerGuiSettingSaveFileDrive + { + ETraceSaveFileDriveC, + ETraceSaveFileDriveD, + ETraceSaveFileDriveE, + ETraceSaveFileDriveF, + ETraceSaveFileDriveG, + ETraceSaveFileDriveH, + ETraceSaveFileDriveI, + ETraceSaveFileDriveJ, + ETraceSaveFileDriveK, + ETraceSaveFileDriveL + }; + +enum TItemActionMenuTypes + { + EItemActionMenuTypeEnable = 0, + EItemActionMenuTypeDisable, + EItemActionMenuTypeEditSettings, + EItemActionMenuTypeInfo, + EItemActionMenuTypeStart, // for future use + EItemActionMenuTypeStop // for future use + }; + +#endif // PROFILERGUI_HRH diff -r 4f2773374eff -r 4b22a598b890 piprofilerui/ui/avkon/inc/profiler_gui_app.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/piprofilerui/ui/avkon/inc/profiler_gui_app.h Thu May 27 12:52:19 2010 +0300 @@ -0,0 +1,61 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + + +#ifndef PROFILER_GUI_APP_H +#define PROFILER_GUI_APP_H + + +// INCLUDES +#include + +// 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 + diff -r 4f2773374eff -r 4b22a598b890 piprofilerui/ui/avkon/inc/profiler_gui_appui.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/piprofilerui/ui/avkon/inc/profiler_gui_appui.h Thu May 27 12:52:19 2010 +0300 @@ -0,0 +1,67 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + + +#ifndef PROFILER_GUI_APPUI_H +#define PROFILER_GUI_APPUI_H + +// INCLUDES +#include +#include +#include +#include +#include +#include +#include +#include "profiler_gui_std.h" + +// profiler engine inclusions +#include + +// 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 diff -r 4f2773374eff -r 4b22a598b890 piprofilerui/ui/avkon/inc/profiler_gui_attributes.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/piprofilerui/ui/avkon/inc/profiler_gui_attributes.h Thu May 27 12:52:19 2010 +0300 @@ -0,0 +1,33 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + + +#ifndef PROFILER_GUI_ATTRIBUTES_H +#define PROFILER_GUI_ATTRIBUTES_H + +// INCLUDES +#include +#include + +// CONSTANTS + +// FORWARD DECLARATIONS + +// CLASS DECLARATIONS + +#endif diff -r 4f2773374eff -r 4b22a598b890 piprofilerui/ui/avkon/inc/profiler_gui_document.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/piprofilerui/ui/avkon/inc/profiler_gui_document.h Thu May 27 12:52:19 2010 +0300 @@ -0,0 +1,78 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + + +#ifndef PROFILER_GUI_DOCUMENT_H +#define PROFILER_GUI_DOCUMENT_H + +// INCLUDES +#include + +// 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 + diff -r 4f2773374eff -r 4b22a598b890 piprofilerui/ui/avkon/inc/profiler_gui_maincontainer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/piprofilerui/ui/avkon/inc/profiler_gui_maincontainer.h Thu May 27 12:52:19 2010 +0300 @@ -0,0 +1,67 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + + +#ifndef PROFILER_GUI_VALUESCONTAINER_H +#define PROFILER_GUI_VALUESCONTAINER_H + +// INCLUDES +#include +#include +#include +#include + +// 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* 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 diff -r 4f2773374eff -r 4b22a598b890 piprofilerui/ui/avkon/inc/profiler_gui_mainview.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/piprofilerui/ui/avkon/inc/profiler_gui_mainview.h Thu May 27 12:52:19 2010 +0300 @@ -0,0 +1,83 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + + +#ifndef PROFILER_GUI_VALUESVIEW_H +#define PROFILER_GUI_VALUESVIEW_H + +// INCLUDES +#include + +#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 diff -r 4f2773374eff -r 4b22a598b890 piprofilerui/ui/avkon/inc/profiler_gui_model.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/piprofilerui/ui/avkon/inc/profiler_gui_model.h Thu May 27 12:52:19 2010 +0300 @@ -0,0 +1,161 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + + +#ifndef PROFILER_GUI_MODEL_H +#define PROFILER_GUI_MODEL_H + +// SYSTEM INCLUDES +#include +#include +#include +#include +#include +#include // RProperty + +// LOCAL INCLUDES +#include "profiler_gui_mainview.h" +#include "profiler_gui.hrh" + +// COMMON INCLUDES +#include +#include +#include + +// 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 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& 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* iSamplerAttributes; + TGeneralAttributes iGeneralAttributes; + TBool iProfilerStatus; // Status of Engine before it was launched by this application + CProfilerGuiMainView* iMainView; + + // checkers + CProfilerEngineStatusChecker* iStatusChecker; +public: + TInt iState; + }; + +#endif diff -r 4f2773374eff -r 4b22a598b890 piprofilerui/ui/avkon/inc/profiler_gui_samplersettingsviewdlg.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/piprofilerui/ui/avkon/inc/profiler_gui_samplersettingsviewdlg.h Thu May 27 12:52:19 2010 +0300 @@ -0,0 +1,92 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + + +#ifndef PROFILER_GUI_SAMPLERSETTINGSVIEWDLG_H +#define PROFILER_GUI_SAMPLERSETTINGSVIEWDLG_H + +// INCLUDES +#include +#include +#include +#include +#include +#include + +#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 + diff -r 4f2773374eff -r 4b22a598b890 piprofilerui/ui/avkon/inc/profiler_gui_settingsviewdlg.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/piprofilerui/ui/avkon/inc/profiler_gui_settingsviewdlg.h Thu May 27 12:52:19 2010 +0300 @@ -0,0 +1,91 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + + +#ifndef PROFILER_GUI_SETTINGSVIEWDLG_H +#define PROFILER_GUI_SETTINGSVIEWDLG_H + +// INCLUDES +#include +#include +#include +#include +#include +#include + +#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 + diff -r 4f2773374eff -r 4b22a598b890 piprofilerui/ui/avkon/inc/profiler_gui_std.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/piprofilerui/ui/avkon/inc/profiler_gui_std.h Thu May 27 12:52:19 2010 +0300 @@ -0,0 +1,28 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + + +#ifndef PROFILER_GUI_STD_H +#define PROFILER_GUI_STD_H + + + +#endif + +// End of File + diff -r 4f2773374eff -r 4b22a598b890 piprofilerui/ui/avkon/rom/piprofilerui_avkon.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/piprofilerui/ui/avkon/rom/piprofilerui_avkon.iby Thu May 27 12:52:19 2010 +0300 @@ -0,0 +1,36 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + + +#ifndef __PROFILERGUI_IBY__ +#define __PROFILERGUI_IBY__ + +S60_APP_EXE(PIProfilerUI) +S60_APP_AIF_ICONS(PIProfilerUI) +S60_APP_RESOURCE(PIProfilerUI) +SCALABLE_IMAGE(APP_BITMAP_DIR, APP_BITMAP_DIR, PIProfilerui_ExtraIcons) +#ifdef S60_UPGRADABLE_APP_REG_RSC + S60_UPGRADABLE_APP_REG_RSC(PIProfilerUI) +#else + S60_APP_AIF_RSC(PIProfilerUI) +#endif + +data=ZPRIVATE\2001E5AE\backup_registration.xml private\2001E5AE\backup_registration.xml +data=ZSYSTEM\Install\PIProfilerUI_stub.sis system\install\PIProfilerUI_stub.sis + +#endif // __PROFILERGUI_IBY__ diff -r 4f2773374eff -r 4b22a598b890 piprofilerui/ui/avkon/src/profiler_gui_app.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/piprofilerui/ui/avkon/src/profiler_gui_app.cpp Thu May 27 12:52:19 2010 +0300 @@ -0,0 +1,64 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + + +// INCLUDE FILES +#include "profiler_gui_app.h" +#include "profiler_gui_document.h" +#include + +#include + + +// ================= 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 + diff -r 4f2773374eff -r 4b22a598b890 piprofilerui/ui/avkon/src/profiler_gui_appui.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/piprofilerui/ui/avkon/src/profiler_gui_appui.cpp Thu May 27 12:52:19 2010 +0300 @@ -0,0 +1,260 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + + +// INCLUDE FILES +#include "profiler_gui_appui.h" +#include "profiler_gui_mainview.h" +#include "profiler_gui.hrh" +#include "profiler_gui_model.h" +#include "profiler_gui_document.h" +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + + +// ================= 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(reinterpret_cast(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 diff -r 4f2773374eff -r 4b22a598b890 piprofilerui/ui/avkon/src/profiler_gui_document.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/piprofilerui/ui/avkon/src/profiler_gui_document.cpp Thu May 27 12:52:19 2010 +0300 @@ -0,0 +1,72 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + + +// INCLUDE FILES +#include "profiler_gui_document.h" +#include "profiler_gui_appui.h" +#include "profiler_gui_model.h" + +// ================= MEMBER FUNCTIONS ======================= + +// constructor +CProfilerGuiDocument::CProfilerGuiDocument(CEikApplication& aApp) +: CAknDocument(aApp) + { + } + +// ---------------------------------------------------- + +// destructor +CProfilerGuiDocument::~CProfilerGuiDocument() + { + delete iModel; + } + +// ---------------------------------------------------- + +// EPOC default constructor can leave. +void CProfilerGuiDocument::ConstructL() + { + iModel = CProfilerGuiModel::NewL(); + } + +// ---------------------------------------------------- + +// Two-phased constructor. +CProfilerGuiDocument* CProfilerGuiDocument::NewL(CEikApplication& aApp) + { + CProfilerGuiDocument* self = new(ELeave) CProfilerGuiDocument(aApp); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(); + + return self; + } + +// ---------------------------------------------------- +// CProfilerGuiDocument::CreateAppUiL() +// constructs CProfilerGuiAppUi +// ---------------------------------------------------- +// +CEikAppUi* CProfilerGuiDocument::CreateAppUiL() + { + return new (ELeave) CProfilerGuiAppUi; + } + +// End of File diff -r 4f2773374eff -r 4b22a598b890 piprofilerui/ui/avkon/src/profiler_gui_maincontainer.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/piprofilerui/ui/avkon/src/profiler_gui_maincontainer.cpp Thu May 27 12:52:19 2010 +0300 @@ -0,0 +1,332 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + + +// INCLUDE FILES +#include "profiler_gui_maincontainer.h" +#include "profiler_gui.hrh" +#include "profiler_gui_document.h" +#include "profiler_gui_appui.h" +#include "profiler_gui_model.h" +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +_LIT(KExtraIconsPath, "\\resource\\apps\\piprofilerui_extraicons.mif"); + +// ===================================== MEMBER FUNCTIONS ===================================== + +void CProfilerGuiMainContainer::ConstructL(const TRect& aRect) + { + iModel = static_cast(reinterpret_cast(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* CProfilerGuiMainContainer::ListBoxSelectionIndexes() + { + if (iListBox) + { + const CListBoxView::CSelectionIndexArray* indices = iListBox->SelectionIndexes(); + return static_cast*>(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( 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 diff -r 4f2773374eff -r 4b22a598b890 piprofilerui/ui/avkon/src/profiler_gui_mainview.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/piprofilerui/ui/avkon/src/profiler_gui_mainview.cpp Thu May 27 12:52:19 2010 +0300 @@ -0,0 +1,334 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + + +// INCLUDE FILES +#include "profiler_gui.hrh" +#include "profiler_gui_mainview.h" +#include "profiler_gui_maincontainer.h" +#include "profiler_gui_document.h" +#include "profiler_gui_model.h" +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// ================= MEMBER FUNCTIONS ======================= + +// --------------------------------------------------------- +// CProfilerGuiMainView::ConstructL(const TRect& aRect) +// EPOC two-phased constructor +// --------------------------------------------------------- +// +void CProfilerGuiMainView::ConstructL() + { + BaseConstructL( R_PROFILER_GUI_VIEW_MAIN ); + + iModel = static_cast(reinterpret_cast(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 (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 (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 (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 diff -r 4f2773374eff -r 4b22a598b890 piprofilerui/ui/avkon/src/profiler_gui_model.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/piprofilerui/ui/avkon/src/profiler_gui_model.cpp Thu May 27 12:52:19 2010 +0300 @@ -0,0 +1,1176 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + + +// INCLUDE FILES +#include "profiler_gui_samplersettingsviewdlg.h" +#include "profiler_gui_model.h" +#include "profiler_gui_app.h" +#include "profiler_gui_settingsviewdlg.h" +#include "profiler_gui_maincontainer.h" +#include "profiler_gui.hrh" +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// UIDs +#include + +#include +#include + +// 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(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& aAttributes) + { + TSamplerAttributes item; + + TInt count(aAttributes.Count()); + + // loop the attribute array and insert them into view list + for (TInt i(0);iListBox()->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( 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( 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);iCount();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 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* 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; iFind(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 diff -r 4f2773374eff -r 4b22a598b890 piprofilerui/ui/avkon/src/profiler_gui_samplersettingsviewdlg.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/piprofilerui/ui/avkon/src/profiler_gui_samplersettingsviewdlg.cpp Thu May 27 12:52:19 2010 +0300 @@ -0,0 +1,479 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + + +// INCLUDE FILES +#include "profiler_gui_samplersettingsviewdlg.h" +#include "profiler_gui_model.h" +#include "profiler_gui.hrh" +#include "profiler_gui_std.h" +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +// 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(sp->ControlL(TUid::Uid(EEikStatusPaneUidNavi))); + iNaviContainer->PushDefaultL(); + + TBuf<64> settingsTitle; + + settingsTitle.Zero(); + settingsTitle.Copy(iSettings.iName); + + // set title text + CAknTitlePane* tp = static_cast( 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( 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);iAt(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 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 + diff -r 4f2773374eff -r 4b22a598b890 piprofilerui/ui/avkon/src/profiler_gui_settingsviewdlg.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/piprofilerui/ui/avkon/src/profiler_gui_settingsviewdlg.cpp Thu May 27 12:52:19 2010 +0300 @@ -0,0 +1,386 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + + +// INCLUDE FILES +#include "profiler_gui_settingsviewdlg.h" +#include "profiler_gui_model.h" +#include "profiler_gui.hrh" +#include "profiler_gui_std.h" +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +// 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(sp->ControlL(TUid::Uid(EEikStatusPaneUidNavi))); + iNaviContainer->PushDefaultL(); + + // set title text + CAknTitlePane* tp = static_cast( 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( 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 + diff -r 4f2773374eff -r 4b22a598b890 piprofilerui/ui/hb/hb.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/piprofilerui/ui/hb/hb.pro Thu May 27 12:52:19 2010 +0300 @@ -0,0 +1,64 @@ +# +# Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: +# +# + + +TEMPLATE = app +TARGET = PIProfilerUI +DEPENDPATH += ./src +INCLUDEPATH += inc +INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE +load(hb.prf) +symbian:CONFIG -= symbian_i18n + +# Input +HEADERS += ./inc/pimainview.h \ + ./inc/piprofilerengineprivate.h \ + ./inc/pluginattributes.h \ + ./inc/notifications.h \ + ./inc/pisettingsview.h \ + ./inc/pimainwindow.h \ + ./inc/generalattributes.h \ + ./inc/piprofilerengine.h +SOURCES += ./src/pimainview.cpp \ + ./src/piprofilerengineprivate.cpp \ + ./src/main.cpp \ + ./src/pluginattributes.cpp \ + ./src/notifications.cpp \ + ./src/pisettingsview.cpp \ + ./src/pimainwindow.cpp \ + ./src/piprofilerengine.cpp + + +RESOURCES += piprofiler.qrc + + +symbian: { + TARGET.UID2 = 0x100039CE + TARGET.UID3 = 0x2001E5AE + + BLD_INF_RULES.prj_exports += "./rom/piprofilerui_hb.iby \ + CORE_IBY_EXPORT_PATH(tools,piprofilerui.iby)" + + TARGET.CAPABILITY = ALL -TCB + + LIBS += -lcharconv -lbafl -lsysutil + + ICON = ../icons/qgn_menu_piprofilerui.svg + +} else { + error("Only Symbian supported!") +} \ No newline at end of file diff -r 4f2773374eff -r 4b22a598b890 piprofilerui/ui/hb/inc/generalattributes.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/piprofilerui/ui/hb/inc/generalattributes.h Thu May 27 12:52:19 2010 +0300 @@ -0,0 +1,34 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#ifndef GENERALATTRIBUTES_H_ +#define GENERALATTRIBUTES_H_ +/* + * + * GeneralAttributes class definition, internal settings format + * + */ +class GeneralAttributes +{ +public: + QString mTraceOutput; + QString mTraceFilePrefix; + QString mSaveFileDrive; + int mTimedSamplingPeriod; +}; + +#endif /* GENERALATTRIBUTES_H_ */ diff -r 4f2773374eff -r 4b22a598b890 piprofilerui/ui/hb/inc/notifications.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/piprofilerui/ui/hb/inc/notifications.h Thu May 27 12:52:19 2010 +0300 @@ -0,0 +1,39 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#ifndef NOTIFICATIONS_H_ +#define NOTIFICATIONS_H_ + +#include + +/** + * 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_ diff -r 4f2773374eff -r 4b22a598b890 piprofilerui/ui/hb/inc/pimainview.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/piprofilerui/ui/hb/inc/pimainview.h Thu May 27 12:52:19 2010 +0300 @@ -0,0 +1,206 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + +#ifndef PIMAINVIEW_H +#define PIMAINVIEW_H + +#include +#include + +#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 *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 *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 diff -r 4f2773374eff -r 4b22a598b890 piprofilerui/ui/hb/inc/pimainwindow.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/piprofilerui/ui/hb/inc/pimainwindow.h Thu May 27 12:52:19 2010 +0300 @@ -0,0 +1,109 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#ifndef PIPROFILERMAINWINDOW_H_ +#define PIPROFILERMAINWINDOW_H_ + +// System includes +#include +#include + +// 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 &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 mPluginAttributes; + +}; + +#endif /* PIPROFILERMAINWINDOW_H_ */ diff -r 4f2773374eff -r 4b22a598b890 piprofilerui/ui/hb/inc/piprofilerengine.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/piprofilerui/ui/hb/inc/piprofilerengine.h Thu May 27 12:52:19 2010 +0300 @@ -0,0 +1,135 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#ifndef PIPROFILEREGINE_H +#define PIPROFILEREGINE_H + +#include +#include + +#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 &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 diff -r 4f2773374eff -r 4b22a598b890 piprofilerui/ui/hb/inc/piprofilerengineprivate.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/piprofilerui/ui/hb/inc/piprofilerengineprivate.h Thu May 27 12:52:19 2010 +0300 @@ -0,0 +1,217 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#ifndef PIPROFILEREGINEPRIVATE_H +#define PIPROFILEREGINEPRIVATE_H + +#include +#include +#include + +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& 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& aAttr); + +private: + + // Should Engine leaved on after ui is closed + bool iLeaveProfilingOnAfterClosing; + + // Public part of engine + PIProfilerEngine *iPublic; + + // Sampler Attributes + CArrayFixFlat* iSamplerAttributes; + + // General attributes + TGeneralAttributes iGeneralAttributes; + + // Engine status checker + CProfilerEngineStatusChecker* iStatusChecker; + +}; + +#endif // PIPROFILEREGINEPRIVATE_H diff -r 4f2773374eff -r 4b22a598b890 piprofilerui/ui/hb/inc/pisettingsview.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/piprofilerui/ui/hb/inc/pisettingsview.h Thu May 27 12:52:19 2010 +0300 @@ -0,0 +1,140 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#ifndef PISETTINGSVIEW_H +#define PISETTINGSVIEW_H + +#include +#include + +#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 *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 *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 diff -r 4f2773374eff -r 4b22a598b890 piprofilerui/ui/hb/inc/pluginattributes.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/piprofilerui/ui/hb/inc/pluginattributes.h Thu May 27 12:52:19 2010 +0300 @@ -0,0 +1,91 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#ifndef PLUGINATTRIBUTES_H_ +#define PLUGINATTRIBUTES_H_ + +/* + * + * PluginAttributes class definition, internal settings format + * + */ +#include +#include +#include + +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_ */ diff -r 4f2773374eff -r 4b22a598b890 piprofilerui/ui/hb/pimainview.docml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/piprofilerui/ui/hb/pimainview.docml Thu May 27 12:52:19 2010 +0300 @@ -0,0 +1,68 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff -r 4f2773374eff -r 4b22a598b890 piprofilerui/ui/hb/piprofiler.qrc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/piprofilerui/ui/hb/piprofiler.qrc Thu May 27 12:52:19 2010 +0300 @@ -0,0 +1,29 @@ + + + + + pimainview.docml + + + ../icons/qgn_menu_piprofilerui.svg + ../icons/qgn_prob_piprofilerui_status_enabled.svg + ../icons/qgn_prob_piprofilerui_status_disabled.svg + + diff -r 4f2773374eff -r 4b22a598b890 piprofilerui/ui/hb/rom/piprofilerui_hb.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/piprofilerui/ui/hb/rom/piprofilerui_hb.iby Thu May 27 12:52:19 2010 +0300 @@ -0,0 +1,33 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + + +#ifndef __PROFILERGUI_IBY__ +#define __PROFILERGUI_IBY__ + +S60_APP_EXE(PIProfilerUI) +//S60_APP_AIF_ICONS(PIProfilerUI) +data=ZRESOURCE\apps\PIProfilerUI.mif resource\apps\PIProfilerUI.mif +data=ZRESOURCE\apps\PIProfilerUI.rsc resource\apps\PIProfilerUI.rsc +//S60_APP_RESOURCE(PIProfilerUI) +data=ZPRIVATE\10003a3f\import\apps\PIProfilerUI_reg.rsc private\10003a3f\import\apps\PIProfilerUI_reg.rsc + +data=ZPRIVATE\2001E5AE\backup_registration.xml private\2001E5AE\backup_registration.xml +data=ZSYSTEM\Install\PIProfilerUI_stub.sis system\install\PIProfilerUI_stub.sis + +#endif // __PROFILERGUI_IBY__ diff -r 4f2773374eff -r 4b22a598b890 piprofilerui/ui/hb/src/main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/piprofilerui/ui/hb/src/main.cpp Thu May 27 12:52:19 2010 +0300 @@ -0,0 +1,68 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + +#include +#include +#include +#include +#include +#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); +} + diff -r 4f2773374eff -r 4b22a598b890 piprofilerui/ui/hb/src/notifications.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/piprofilerui/ui/hb/src/notifications.cpp Thu May 27 12:52:19 2010 +0300 @@ -0,0 +1,73 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#include +#include +#include +#include +#include +#include +#include + +#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(); + +} + +// --------------------------------------------------------------------------- diff -r 4f2773374eff -r 4b22a598b890 piprofilerui/ui/hb/src/pimainview.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/piprofilerui/ui/hb/src/pimainview.cpp Thu May 27 12:52:19 2010 +0300 @@ -0,0 +1,565 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#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 (object); + + // About + object = loader.findObject(ACTIONABOUT); + Q_ASSERT_X((object != 0), APPLICATIONNAME, INVALIDCONFIGURATIONFILE); + this->mActionAbout = qobject_cast (object); + + // Settings + object = loader.findObject(ACTIONSETTINGS); + Q_ASSERT_X((object != 0), APPLICATIONNAME, INVALIDCONFIGURATIONFILE); + this->mActionSettings = qobject_cast (object); + + // Start profiling + object = loader.findObject(ACTIONSTARTPROFILING); + Q_ASSERT_X((object != 0), APPLICATIONNAME, INVALIDCONFIGURATIONFILE); + this->mActionStartProfiling = qobject_cast (object); + + // Start timed profiling + object = loader.findObject(ACTIONSTARTTIMEDPROFILING); + Q_ASSERT_X((object != 0), APPLICATIONNAME, INVALIDCONFIGURATIONFILE); + this->mActionStartTimedProfiling = qobject_cast (object); + + QGraphicsWidget *widget = loader.findWidget(LISTWIDGETPLUGINS); + Q_ASSERT_X((widget != 0), "Launcher", "Invalid launcher.xml file"); + this->mListPlugins = qobject_cast (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 *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); + } +} + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- diff -r 4f2773374eff -r 4b22a598b890 piprofilerui/ui/hb/src/pimainwindow.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/piprofilerui/ui/hb/src/pimainwindow.cpp Thu May 27 12:52:19 2010 +0300 @@ -0,0 +1,160 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + +// System include +#include +#include +#include +#include +#include +#include + +// 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&)), this, + SLOT(setPluginList(QList&))); + + 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 (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 &pluginList) +{ + mPluginAttributes = pluginList; + mMainView->setPluginList(&mPluginAttributes); + mSettingsView->setPluginSettings(&mPluginAttributes); +} diff -r 4f2773374eff -r 4b22a598b890 piprofilerui/ui/hb/src/piprofilerengine.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/piprofilerui/ui/hb/src/piprofilerengine.cpp Thu May 27 12:52:19 2010 +0300 @@ -0,0 +1,88 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + +#include "piprofilerengine.h" +#include "piprofilerengineprivate.h" + +PIProfilerEngine::PIProfilerEngine() +{ + +} + +PIProfilerEngine::~PIProfilerEngine() +{ + if (mPrivate != 0) { + delete mPrivate; + mPrivate = 0; + } +} + +bool PIProfilerEngine::init() +{ + mPrivate = new PIProfilerEnginePrivate(this); + return mPrivate->Init(); +} + +void PIProfilerEngine::getGeneralSettings(GeneralAttributes &settings) +{ + mPrivate->GetGeneralSettings(settings); +} + +void PIProfilerEngine::notifyUIReady() +{ + mPrivate->NotifyUIReady(); +} + +bool PIProfilerEngine::saveGeneralSettings(GeneralAttributes &settings) +{ + return mPrivate->SaveGeneralSettings(settings); + +} + +bool PIProfilerEngine::savePluginSettings(const PluginAttributes &pluginAttributes) +{ + return mPrivate->SavePluginSettings(pluginAttributes); +} + +bool PIProfilerEngine::startProfiling() +{ + return mPrivate->StartProfiling(); +} +bool PIProfilerEngine::startTimedProfiling() +{ + return mPrivate->StartTimedProfiling(); +} +void PIProfilerEngine::stopProfiling() +{ + return mPrivate->StopProfiling(); +} + +int PIProfilerEngine::getTimeLimit() +{ + return mPrivate->GetTimeLimit(); +} + +void PIProfilerEngine::leaveProfilingOnAfterClosing() +{ + mPrivate->LeaveProfilingOnAfterClosing(); +} + +bool PIProfilerEngine::checkTraceLocationSanity(QString &location) +{ + mPrivate->CheckTraceLocationSanity(location); +} diff -r 4f2773374eff -r 4b22a598b890 piprofilerui/ui/hb/src/piprofilerengineprivate.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/piprofilerui/ui/hb/src/piprofilerengineprivate.cpp Thu May 27 12:52:19 2010 +0300 @@ -0,0 +1,678 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "piprofilerengineprivate.h" +#include +#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 (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& aAttributes) +{ + TSamplerAttributes item; + + TInt count(aAttributes.Count()); + + // loop the attribute array and insert them into view list + + QList 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 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 ( + samplerAttributes.mTraceOutput.utf16())); + tSamplerAttributes.iSaveFileDrive.Copy(TBuf ( + samplerAttributes.mSaveFileDrive.utf16())); + tSamplerAttributes.iTraceFilePrefix.Copy(TBuf ( + 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 fileLocation; + fileLocation.Copy(TBuf (location.utf16())); + TRAPD(error, value = CheckTraceLocationSanityL(fileLocation)); + if (error != KErrNone) { + return false; + } + return value; +} + +// -------------------------------------------------------------------------------------------- + +TBool PIProfilerEnginePrivate::CheckTraceLocationSanityL(TBuf8 &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; +} diff -r 4f2773374eff -r 4b22a598b890 piprofilerui/ui/hb/src/pisettingsview.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/piprofilerui/ui/hb/src/pisettingsview.cpp Thu May 27 12:52:19 2010 +0300 @@ -0,0 +1,434 @@ +/* + * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#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 (mSettingForm->itemByIndex(index)); + HbWidget *widget = viewItem->dataItemContentWidget(); + HbLineEdit *editor = static_cast (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 *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; + + } + } + + }*/ + +} + +// --------------------------------------------------------------------------- diff -r 4f2773374eff -r 4b22a598b890 piprofilerui/ui/hb/src/pluginattributes.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/piprofilerui/ui/hb/src/pluginattributes.cpp Thu May 27 12:52:19 2010 +0300 @@ -0,0 +1,32 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + +#include "pluginattributes.h" + +PluginAttributes::PluginAttributes() : + mFormItemSettingItem1(0), mFormItemSettingItem2(0), mFormItemSettingItem3(0), + mFormItemSettingItem4(0), mFormItemSettingItem5(0), mFormItemSettingItem6(0), + mFormItemSampleRate(0) +{ + +} + +PluginAttributes::~PluginAttributes() +{ + +} diff -r 4f2773374eff -r 4b22a598b890 piprofilerui/ui/icons/qgn_menu_piprofilerui.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/piprofilerui/ui/icons/qgn_menu_piprofilerui.svg Thu May 27 12:52:19 2010 +0300 @@ -0,0 +1,66 @@ + + + + + + + + + + + + + + + + + + + diff -r 4f2773374eff -r 4b22a598b890 piprofilerui/ui/icons/qgn_prob_piprofilerui_status_disabled.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/piprofilerui/ui/icons/qgn_prob_piprofilerui_status_disabled.svg Thu May 27 12:52:19 2010 +0300 @@ -0,0 +1,59 @@ + + + + + + image/svg+xml + + + + + + + + diff -r 4f2773374eff -r 4b22a598b890 piprofilerui/ui/icons/qgn_prob_piprofilerui_status_enabled.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/piprofilerui/ui/icons/qgn_prob_piprofilerui_status_enabled.svg Thu May 27 12:52:19 2010 +0300 @@ -0,0 +1,17 @@ + + + + + + diff -r 4f2773374eff -r 4b22a598b890 screengrabber/inc/enginewrapper.h --- a/screengrabber/inc/enginewrapper.h Fri May 14 15:53:02 2010 +0300 +++ b/screengrabber/inc/enginewrapper.h Thu May 27 12:52:19 2010 +0300 @@ -18,7 +18,7 @@ #ifndef ENGINEWRAPPER_H #define ENGINEWRAPPER_H -#include +#include #include diff -r 4f2773374eff -r 4b22a598b890 screengrabber/inc/sgengine.h --- a/screengrabber/inc/sgengine.h Fri May 14 15:53:02 2010 +0300 +++ b/screengrabber/inc/sgengine.h Thu May 27 12:52:19 2010 +0300 @@ -23,8 +23,8 @@ #include #include #include -#include -#include +#include +#include #include diff -r 4f2773374eff -r 4b22a598b890 screengrabber/src/enginewrapper.cpp --- a/screengrabber/src/enginewrapper.cpp Fri May 14 15:53:02 2010 +0300 +++ b/screengrabber/src/enginewrapper.cpp Thu May 27 12:52:19 2010 +0300 @@ -15,7 +15,7 @@ * */ #include -#include +#include #include #include "enginewrapper.h" diff -r 4f2773374eff -r 4b22a598b890 screengrabber/src/gifanimator.cpp --- a/screengrabber/src/gifanimator.cpp Fri May 14 15:53:02 2010 +0300 +++ b/screengrabber/src/gifanimator.cpp Thu May 27 12:52:19 2010 +0300 @@ -19,10 +19,10 @@ #include "gifanimator.h" -#include -#include -#include -#include +#include +#include +#include +#include #include "enginewrapper.h" diff -r 4f2773374eff -r 4b22a598b890 screengrabber/src/mainview.cpp --- a/screengrabber/src/mainview.cpp Fri May 14 15:53:02 2010 +0300 +++ b/screengrabber/src/mainview.cpp Thu May 27 12:52:19 2010 +0300 @@ -25,7 +25,7 @@ #include #include #include "enginewrapper.h" -#include "settingsView.h" +#include "settingsview.h" #include "mainview.h" #include "notifications.h" #include "hbtoolbar.h" diff -r 4f2773374eff -r 4b22a598b890 screengrabber/src/sgengine.cpp --- a/screengrabber/src/sgengine.cpp Fri May 14 15:53:02 2010 +0300 +++ b/screengrabber/src/sgengine.cpp Thu May 27 12:52:19 2010 +0300 @@ -15,13 +15,13 @@ * */ -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include #include #include diff -r 4f2773374eff -r 4b22a598b890 stifui/avkon/group/ReleaseNote.txt --- a/stifui/avkon/group/ReleaseNote.txt Fri May 14 15:53:02 2010 +0300 +++ b/stifui/avkon/group/ReleaseNote.txt Thu May 27 12:52:19 2010 +0300 @@ -1,5 +1,5 @@ ======================================================================== -RELEASE NOTE FOR STIF UI - STIF_201016 (7.3.31) +RELEASE NOTE FOR STIF UI - STIF_201018 (7.3.32) SUPPORTING SERIES 60 3.0 -> ======================================================================== diff -r 4f2773374eff -r 4b22a598b890 stifui/avkon/sis/Stifui_31.sis Binary file stifui/avkon/sis/Stifui_31.sis has changed diff -r 4f2773374eff -r 4b22a598b890 stifui/avkon/stifui/inc/version.h --- a/stifui/avkon/stifui/inc/version.h Fri May 14 15:53:02 2010 +0300 +++ b/stifui/avkon/stifui/inc/version.h Thu May 27 12:52:19 2010 +0300 @@ -20,9 +20,9 @@ #define STIFUI_MAJOR_VERSION 7 #define STIFUI_MINOR_VERSION 3 -#define STIFUI_BUILD_VERSION 31 +#define STIFUI_BUILD_VERSION 32 -#define STIFUI_REL_DATE "20th Apr 2010" +#define STIFUI_REL_DATE "5th May 2010" #define TO_UNICODE(text) _L(text) diff -r 4f2773374eff -r 4b22a598b890 stifui/qt/ReleaseNote.txt --- a/stifui/qt/ReleaseNote.txt Fri May 14 15:53:02 2010 +0300 +++ b/stifui/qt/ReleaseNote.txt Thu May 27 12:52:19 2010 +0300 @@ -1,11 +1,11 @@ ======================================================================== -RELEASE NOTE FOR STIFQTUI - STIF_201016 (7.3.31) +RELEASE NOTE FOR STFUI_201018 (7.3.32) ======================================================================== 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 : diff -r 4f2773374eff -r 4b22a598b890 stifui/qt/inc/dlgoutput.h --- a/stifui/qt/inc/dlgoutput.h Fri May 14 15:53:02 2010 +0300 +++ b/stifui/qt/inc/dlgoutput.h Thu May 27 12:52:19 2010 +0300 @@ -51,6 +51,7 @@ private slots: void on_btnPause_clicked(); void on_btnAbort_clicked(); + void on_btnClose_clicked(); private: @@ -58,12 +59,9 @@ QTabWidget* tabMain; QPushButton* btnPause; QPushButton* btnAbort; + QPushButton* btnClose; QHash tabList; -private: - void on_btnClose_clicked(); - - }; diff -r 4f2773374eff -r 4b22a598b890 stifui/qt/inc/dlgsetselector.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/stifui/qt/inc/dlgsetselector.h Thu May 27 12:52:19 2010 +0300 @@ -0,0 +1,64 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: QT C++ based Class. +* DlgSetSelector is a QT based dialog. +* Used to display available test set for select to add cases into. +* +*/ +#ifndef DLGSETSELECTOR_H_ +#define DLGSETSELECTOR_H_ + +#include +#include + +QT_BEGIN_NAMESPACE +class QGridLayout; +class QPushButton; +class QRadioButton; +class QListWidget; +QT_END_NAMESPACE + +class DlgSetSelector : public QDialog { + Q_OBJECT + +public: + DlgSetSelector(QList 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 setList; + + +}; + + +#endif /* DLGSETSELECTOR_H_ */ diff -r 4f2773374eff -r 4b22a598b890 stifui/qt/inc/frmmain.h --- a/stifui/qt/inc/frmmain.h Fri May 14 15:53:02 2010 +0300 +++ b/stifui/qt/inc/frmmain.h Thu May 27 12:52:19 2010 +0300 @@ -20,11 +20,14 @@ #define FRMMAIN_H #include +#include #include "istfqtuicontroller.h" #include "istfqtuimodel.h" #include "dlgoutput.h" #include "uisetting.h" #include "dlgsetting.h" +#include "dlgsetselector.h" +#include "uiversion.h" QT_BEGIN_NAMESPACE class QAction; @@ -43,15 +46,15 @@ class QFileDialog; QT_END_NAMESPACE -const QString QtUIVersion = "StfQtUI v1.0.1"; + -class frmMain : public QMainWindow, public IStfEventListener, public IStifModelEventListener +class FrmMain : public QMainWindow, public IStfEventListener, public IStifModelEventListener { Q_OBJECT public: - frmMain(); - ~frmMain(); + FrmMain(); + ~FrmMain(); public: //Implement IStfEventListener @@ -64,6 +67,9 @@ void OnCaseStatisticChanged() ; void OnRunningCaseChanged() ; +protected: + void paintEvent(QPaintEvent *event); + protected slots: void onTabWidgetSelectIndexChanged(); @@ -79,16 +85,20 @@ QList getSelectedCases(); void reloadStatisticItem(QString name, QTreeWidgetItem* item, TSTFCaseStatusType type); void setSetting(); + void startRunning(); private: IStfQtUIController* controller; IStfQtUIModel* model; DlgOutput* dlgOutput; UiSetting* uiSetting; - + bool layoutType; private: //UI Components - QWidget *MainWidget; + QWidget* centerWidget; + QGridLayout *mainLayout; + QGroupBox *groupBox; + //menus and actions QMenu *operateMenu; //output panel @@ -120,7 +130,7 @@ QListWidget *lstStartedCases; QPushButton *btnPauseCase; QPushButton *btnAbortCase; - QPlainTextEdit *txtCaseOutput; + QPushButton *btnShowOutput; //menu actions QAction *actExit; @@ -135,14 +145,18 @@ QAction *actExpandAll; QAction *actCollapseAll; QAction *actSetting; + QMenu *menuRunCase; //sets actions QAction *actRunSetSeq; QAction *actRunSetPar; QAction *actNewSet; QAction *actDelSet; + QMenu *menuRunSet; //running actions. QAction *actPause; QAction *actAbort; + QAction *actOutput; + //statistics actions QAction *actClearStatistics; @@ -157,6 +171,8 @@ void on_actSelectAll_triggered(); void on_actExpandAll_triggered(); void on_actCollapseAll_triggered(); + void on_actExpand_triggered(); + void on_actCollapse_triggered(); void on_actSetting_triggered(); void on_actRunSetSeq_triggered(); @@ -165,6 +181,7 @@ void on_actDelSet_triggered(); void on_actPause_triggered(); void on_actAbort_triggered(); + void on_actOutput_triggered(); void on_actClearStatistics_triggered(); void on_treeModuleList_itemClicked(QTreeWidgetItem* item, int column); @@ -176,4 +193,4 @@ }; -#endif // FRMMAIN_H +#endif // FrmMain_H diff -r 4f2773374eff -r 4b22a598b890 stifui/qt/inc/istfqtuicontroller.h --- a/stifui/qt/inc/istfqtuicontroller.h Fri May 14 15:53:02 2010 +0300 +++ b/stifui/qt/inc/istfqtuicontroller.h Thu May 27 12:52:19 2010 +0300 @@ -48,19 +48,20 @@ virtual QList GetCaseListByModule(const QString& moduleName) = 0; virtual CSTFCase GetCase(const QString& moduleName, const int index) = 0; virtual void RunCases(const QList& caseList, const TSTFCaseRunningType& type) = 0; - virtual void AddCaseToSet(const QList& aCase, const QString& setName) = 0; + virtual bool AddCaseToSet(const QList& aCase, const QString& setName) = 0; //for set virtual QList GetSetList() = 0; virtual QList 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; diff -r 4f2773374eff -r 4b22a598b890 stifui/qt/inc/istfqtuimodel.h --- a/stifui/qt/inc/istfqtuimodel.h Fri May 14 15:53:02 2010 +0300 +++ b/stifui/qt/inc/istfqtuimodel.h Thu May 27 12:52:19 2010 +0300 @@ -19,7 +19,6 @@ #ifndef ISTFQTUIMODEL_H #define ISTFQTUIMODEL_H -//#include #include "cstfcase.h" #include "cstfmodule.h" #include @@ -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; diff -r 4f2773374eff -r 4b22a598b890 stifui/qt/inc/stfqtuicontroller.h --- a/stifui/qt/inc/stfqtuicontroller.h Fri May 14 15:53:02 2010 +0300 +++ b/stifui/qt/inc/stfqtuicontroller.h Thu May 27 12:52:19 2010 +0300 @@ -35,13 +35,13 @@ QList GetCaseListByModule(const QString& moduleName); CSTFCase GetCase(const QString& moduleName, const int index); void RunCases(const QList& caseList, const TSTFCaseRunningType& type); - void AddCaseToSet(const QList& aCase, const QString& setName); + bool AddCaseToSet(const QList& aCase, const QString& setName); //for set QList GetSetList(); QList GetCaseListBySet(const QString& setName); - void CreateSet(const QString& setName); - void DeleteSet(const QString& setName); + bool CreateSet(QString& setName); + bool DeleteSet(const QString& setName); void RunSets(const QString& setName, const TSTFCaseRunningType& type); //for Started @@ -49,6 +49,7 @@ void ResumeCase(); void AbortCase(); bool ShowOutput(); + CSTFCase GetRunningCase(int index); void SetShowOutput(bool isShow); //for staticstic diff -r 4f2773374eff -r 4b22a598b890 stifui/qt/inc/stfqtuimodel.h --- a/stifui/qt/inc/stfqtuimodel.h Fri May 14 15:53:02 2010 +0300 +++ b/stifui/qt/inc/stfqtuimodel.h Thu May 27 12:52:19 2010 +0300 @@ -32,6 +32,7 @@ void AddCaseByStatus(const TSTFCaseStatusType& type, const CSTFCase& aCase); void AddStifModelEventListener(IStifModelEventListener* listener); void RemoveStifModelEventListener(IStifModelEventListener* listener); + CSTFCase GetRunningCase(const CStartedTestCase* startedCase); void PauseCase(); void ResumeCase(); void AbortCase(); diff -r 4f2773374eff -r 4b22a598b890 stifui/qt/inc/stifexecutor.h --- a/stifui/qt/inc/stifexecutor.h Fri May 14 15:53:02 2010 +0300 +++ b/stifui/qt/inc/stifexecutor.h Thu May 27 12:52:19 2010 +0300 @@ -19,13 +19,13 @@ #ifndef STIFEXECUTOR_H_ #define STIFEXECUTOR_H_ -//#include #include "cstfcase.h" #include "cstfmodule.h" #include #include #include #include +#include class IStifCaseUpdateListener { @@ -49,10 +49,10 @@ void ExecuteSingleCase(const QString& moduleName, int caseIndex); QList GetSetList(); QList GetCaseListFromSet(const QString& setName); - void CreateSet(const QString& setName); - void SaveSet(QString& setName); - void RemoveSet(const QString& setName); - void AddtoSet(const QString& setName, CSTFCase& caseInfo); + bool CreateSet(const QString& setName); + bool SaveSet(QString& setName); + bool RemoveSet(const QString& setName); + bool AddtoSet(const QString& setName, CSTFCase& caseInfo); void ExecuteSet(const QString& SetName, const int startIndex, const TSTFCaseRunningType type); public://implement CUIStoreIf @@ -63,9 +63,14 @@ TPtrC QString2TPtrC(const QString& aString); QString TDesC2QString(const TDesC& des); //CTestInfo* GetTestInfo(CSTFCase aCase); + +private: + bool LogResult(const TInt result,const QString str); private: QList *listenerList; HBufC* iBuffer; + // Pointer to logger + CStifLogger * iLog; }; diff -r 4f2773374eff -r 4b22a598b890 stifui/qt/inc/uisetting.h --- a/stifui/qt/inc/uisetting.h Fri May 14 15:53:02 2010 +0300 +++ b/stifui/qt/inc/uisetting.h Thu May 27 12:52:19 2010 +0300 @@ -18,6 +18,10 @@ #define UISETTING_H_ #include +const QString KShowOutput = "showoutput"; +const QString KStyleSheet = "StyleSheet"; + + class UiSetting { public: @@ -32,6 +36,7 @@ bool load(); bool save(); void loadDefault(); + QString getDefaultValue(const QString& item); private: QHash settingList; diff -r 4f2773374eff -r 4b22a598b890 stifui/qt/inc/uiversion.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/stifui/qt/inc/uiversion.h Thu May 27 12:52:19 2010 +0300 @@ -0,0 +1,26 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: QT C++ based Class. +* frmMain is a QT based Window. +* Used to display STF executor main GUI. +* +*/ + +#ifndef UIVERSION_H_ +#define UIVERSION_H_ + +const QString QtUIVersion = "v1.1.1"; +const QString QtUIName = "STFUI"; + +#endif /* UIVERSION_H_ */ diff -r 4f2773374eff -r 4b22a598b890 stifui/qt/inc/version.h --- a/stifui/qt/inc/version.h Fri May 14 15:53:02 2010 +0300 +++ b/stifui/qt/inc/version.h Thu May 27 12:52:19 2010 +0300 @@ -11,18 +11,18 @@ * * Contributors: * -* Description: STIF QT UI version declaration +* Description: STIF version declaration * */ #ifndef VERSION_H_ #define VERSION_H_ -#define STIF_MAJOR_VERSION 7 -#define STIF_MINOR_VERSION 3 -#define STIF_BUILD_VERSION 26 +#define STIF_MAJOR_VERSION 1 +#define STIF_MINOR_VERSION 0 +#define STIF_BUILD_VERSION 0 -#define STIF_REL_DATE "09th Feb 2010" +#define STIF_REL_DATE "1st Mar 2010" #define TO_UNICODE(text) _L(text) diff -r 4f2773374eff -r 4b22a598b890 stifui/qt/qss/coffee.qss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/stifui/qt/qss/coffee.qss Thu May 27 12:52:19 2010 +0300 @@ -0,0 +1,326 @@ +QWidget { + background-color: cornsilk; +} + +QMessageBox { + background-color: cornsilk; + border-width: 2px; + border-style: solid; + border-color: darkkhaki; + padding: 3px; + font-size:12px; + font: bold; +} + +QDialog { + background-color: cornsilk; + border-width: 2px; + border-style: solid; + border-color: darkkhaki; + font-size:12px; + font: bold; +} + +QInputDialog { + background-color: cornsilk; + border-width: 2px; + border-style: solid; + border-color: darkkhaki; + font-size:12px; + font: bold; +} + + +/*QPushButton*/ +QPushButton { + color: #0a214c; + background-color: palegoldenrod; + border-width: 2px; + border-color: darkkhaki; + border-style: solid; + border-radius: 5; + padding: 3px; + min-width: 100px; + min-height: 32px; + max-width: 100px; + max-height: 32px; + font-size:16px; + font: bold; +} + +QPushButton:hover { + background-color: khaki; +} + +QPushButton:pressed { + padding-left: 2px; + padding-top: 2px; + background-color: #d0d67c; +} + + +QPushButton::disabled { + color: #ffffff; +} + +QRadioButton { + font: bold; + font-size: 14px; + border: none; + padding: 0; + background-color: cornsilk; + color: black; + background-color: cornsilk; + selection-color: #0a214c; + selection-background-color: #C19A6B; +} + +QRadioButton:focus { + color:black; + background-color: cornsilk; +} + +QRadioButton:selected { + background-color: cornsilk; + color:black; +} + +QRadioButton:pressed { + background-color: cornsilk; + color:black; +} + + +/*QTabQWidget*/ +QTabWidget::pane { /* The tab widget frame */ + border-top: 2px solid #C2C7CB; +} + +QTabWidget::tab-bar { + left: 5px; /* move to the right by 5px */ +} + +/* Style the tab using the tab sub-control. Note that + it reads QTabBar _not_ QTabWidget */ +QTabBar::tab { + background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, + stop: 0 #E1E1E1, stop: 0.4 #DDDDDD, + stop: 0.5 #D8D8D8, stop: 1.0 #D3D3D3); + border: 2px solid #C4C4C3; + border-bottom-color: #C2C7CB; /* same as the pane color */ + border-top-left-radius: 4px; + border-top-right-radius: 4px; + /*min-width: 5ex;*/ + padding: 2px; + color: #0a214c; + font-size:15px; +} + +QTabBar::tab:selected, QTabBar::tab:hover { + background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, + stop: 0 #fafafa, stop: 0.4 #f4f4f4, + stop: 0.5 #e7e7e7, stop: 1.0 #fafafa); +} + +QTabBar::tab:selected { + border-color: #9B9B9B; + border-bottom-color: #C2C7CB; /* same as pane color */ + font: bold; + font-size:15px; +} + +QTabBar::tab:!selected { + margin-top: 2px; /* make non-selected tabs look smaller */ + font: bold; + font-size:14px; +} + +/* make use of negative margins for overlapping tabs */ +QTabBar::tab:selected { + /* expand/overlap to the left and right by 4px */ + /* + margin-left: -4px; + margin-right: -4px; + */ +} + +QTabBar::tab:first:selected { + margin-left: 0; /* the first selected tab has nothing to overlap with on the left */ +} + +QTabBar::tab:last:selected { + margin-right: 0; /* the last selected tab has nothing to overlap with on the right */ +} + +QTabBar::tab:only-one { + margin: 0; /* if there is only one tab, we don't want overlapping margins */ +} + + +/* QLabel */ +QLabel { + font: bold; + font-size: 14px; + border: none; + padding: 0; + background: none; + color: black; + +} + +/* QLabel */ +QCheckBox { + font: bold; + font-size: 14px; + border: none; + padding: 0; + background-color: cornsilk; + color: black; + background-color: cornsilk; + selection-color: #0a214c; + selection-background-color: #C19A6B; +} + +QCheckBox::focus { + color:black; + background-color: cornsilk; +} + +QCheckBox:selected { + background-color: cornsilk; + color:black; +} + +QCheckBox:pressed { + background-color: cornsilk; + color:black; +} + + +QFrame { + background-color: cornsilk; +} + +QLineEdit, QPlainTextEdit { + background-color: cornsilk; + border-width: 1px; + padding: 1px; + border-style: solid; + border-color: darkkhaki; + border-radius: 3px; + color:black; + font-size:14px; +} + +QLineEdit:focus, QPlainTextEdit:focus { + border-width: 3px; + padding: 0px; +} + +/*QComboBox*/ + +QComboBox { + background-color: cornsilk; + selection-color: #0a214c; + selection-background-color: #C19A6B; + color:black; + font-size:20px; + border-width: 1px; + padding: 1px; + border-style: solid; + border-color: darkkhaki; +} + +/*QGroupBox*/ +QGroupBox { + background-color: cornsilk; + margin-top: 2ex; + border: 2px solid gray; + border-radius: 5px; + + +} + +QGroupBox::title { + subcontrol-origin: margin; + padding: 0 3px; + color:black; + font-size:14px; + background-color: cornsilk; +} + + +/*QTreeWidget*/ + +QTreeWidget { + color: brown; + show-decoration-selected: 1; + border-width: 1px; + padding: 1px; + border-style: solid; + border-color: darkkhaki; + border-radius: 3px; + background-color: cornsilk; + selection-color: #0a214c; + selection-background-color: #C19A6B; +} + +QHeaderView { + color : black; + border-width: 1px; + padding: 1px; + border-style: solid; + border-color: darkkhaki; + border-radius: 3px; + background-color: khaki; +} + +QHeaderView::section { + color : black; + border-width: 0px; + padding: 0px; + border-style: none; + background-color: palegoldenrod; +} + + +QTreeWidget::item{ + height:35px; + font-size:20px; +} + +QTreeWidget::item:hover{ + background-color: wheat; +} + +QListView { + color: brown; + show-decoration-selected: 1; + border-width: 1px; + padding: 1px; + border-style: solid; + border-color: darkkhaki; + border-radius: 3px; + background-color: cornsilk; + selection-color: #0a214c; + selection-background-color: #C19A6B; + font-size:16px; +} + +QListView::item:hover { + background-color: wheat; +} + +QListView::disabled { + color: #ffffff; + background-color: gray; +} + +QListView::item { + height:30px; +} + +QErrorMessage::text { + color: black; +} + diff -r 4f2773374eff -r 4b22a598b890 stifui/qt/resource/StfQtUI.qrc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/stifui/qt/resource/StfQtUI.qrc Thu May 27 12:52:19 2010 +0300 @@ -0,0 +1,5 @@ + + +../qss/coffee.qss + + \ No newline at end of file diff -r 4f2773374eff -r 4b22a598b890 stifui/qt/sis/StfQtUI.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/stifui/qt/sis/StfQtUI.pkg Thu May 27 12:52:19 2010 +0300 @@ -0,0 +1,32 @@ +; StfQtUI_template.pkg generated by qmake at 2010-02-08T13:37:27 +; This file is generated by qmake and should not be modified by the user +; + +; Language +&EN + +; SIS header: name, uid, version +#{"STFUI"},(0x2002BCA0),1,0,0 + +; Localised Vendor name +%{"Vendor"} + +; Unique Vendor name +:"Vendor" + +; Manual PKG pre-rules from PRO files +; Default HW/platform dependencies +[0x101F7961],0,0,0,{"S60ProductID"} +[0x102032BE],0,0,0,{"S60ProductID"} +[0x102752AE],0,0,0,{"S60ProductID"} +[0x1028315F],0,0,0,{"S60ProductID"} + +; Default dependency to Qt libraries +;(0x2001E61C), , , , {"Qt"} + +; Executable and default resource files +"/epoc32/release/armv5/urel/StfUI.exe" - "!:\sys\bin\StfUI.exe" +"/epoc32/data/z/resource/apps/StfQtUI.rsc" - "!:\resource\apps\StfQtUI.rsc" +"/epoc32/data/z/private/10003a3f/import/apps/StfQtUI_reg.rsc" - "!:\private\10003a3f\import\apps\StfQtUI_reg.rsc" + +; Manual PKG post-rules from PRO files diff -r 4f2773374eff -r 4b22a598b890 stifui/qt/src/dlgoutput.cpp --- a/stifui/qt/src/dlgoutput.cpp Fri May 14 15:53:02 2010 +0300 +++ b/stifui/qt/src/dlgoutput.cpp Thu May 27 12:52:19 2010 +0300 @@ -20,30 +20,34 @@ DlgOutput::DlgOutput(IStfQtUIController* ctl, QWidget *parent) : QDialog(parent), controller(ctl) { - QSize btnSize(100,30); QGridLayout *mainLayout = new QGridLayout(this); this->setLayout(mainLayout); this->setContextMenuPolicy(Qt::NoContextMenu); - tabMain = new QTabWidget(); + tabMain = new QTabWidget(this); tabMain->setContextMenuPolicy(Qt::NoContextMenu); QWidget *toolWidget = new QWidget(this); toolWidget->setContextMenuPolicy(Qt::NoContextMenu); - QGridLayout *toolLayout = new QGridLayout(); + QGridLayout *toolLayout = new QGridLayout(this); toolWidget->setLayout(toolLayout); btnPause = new QPushButton(tr("Pause"), toolWidget); btnPause->setContextMenuPolicy(Qt::NoContextMenu); - btnPause->setFixedSize(btnSize); QObject::connect(btnPause, SIGNAL(clicked()), this, SLOT(on_btnPause_clicked())); btnAbort = new QPushButton(tr("Abort"), toolWidget); btnAbort->setContextMenuPolicy(Qt::NoContextMenu); - btnAbort->setFixedSize(btnSize); QObject::connect(btnAbort, SIGNAL(clicked()), this, SLOT(on_btnAbort_clicked())); + + btnClose = new QPushButton(tr("Hide"), toolWidget); + btnClose->setContextMenuPolicy(Qt::NoContextMenu); + QObject::connect(btnClose, SIGNAL(clicked()), this, + SLOT(on_btnClose_clicked())); toolLayout->addWidget(btnPause, 0, 0); toolLayout->addWidget(btnAbort, 0, 1); + toolLayout->addWidget(btnClose, 0, 2); + mainLayout->addWidget(toolWidget, 0, 0); mainLayout->addWidget(tabMain, 1, 0); @@ -66,8 +70,9 @@ void DlgOutput::CloseItem(QString index) { int u = tabList.keys().indexOf(index); + + delete tabList.value(index); tabList.remove(index); - tabMain->removeTab(u); if (tabMain->count() == 0) { this->close(); @@ -80,6 +85,13 @@ { tabList.value(index)->setPlainText(msg); } + else + { +// bool ok; +// CSTFCase acase = controller->GetRunningCase(index.toInt(&ok, 10)); +// CreateItem(index, acase.Name()); +// ShowMessage(index, msg); + } } void DlgOutput::on_btnPause_clicked() @@ -101,10 +113,19 @@ controller->AbortCase(); } +void DlgOutput::on_btnClose_clicked() + { + controller->SetShowOutput(false); + this->close(); + } + void DlgOutput::OnCaseOutputChanged(const IStfEventListener::CaseOutputCommand& cmd, const QString& index, const QString& msg) { - this->showMaximized(); + if(controller->ShowOutput() && this->isVisible() == false) + { + this->showMaximized(); + } switch (cmd) { case IStfEventListener::ECreate: diff -r 4f2773374eff -r 4b22a598b890 stifui/qt/src/dlgsetselector.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/stifui/qt/src/dlgsetselector.cpp Thu May 27 12:52:19 2010 +0300 @@ -0,0 +1,114 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: QT C++ based Class. + * + */ + +#include "dlgsetselector.h" +#include + +DlgSetSelector::DlgSetSelector(QList list, QWidget* parent): + QDialog(parent), setList(list), selectName("") + { + SetupUI(); + } + +void DlgSetSelector::SetupUI() + { + QGridLayout *mainLayout = new QGridLayout(this); + this->setLayout(mainLayout); + this->setContextMenuPolicy(Qt::NoContextMenu); + + rdoNewSet = new QRadioButton(this); + rdoNewSet->setChecked(true); + rdoNewSet->setText(tr("Create a new Set")); + QObject::connect(rdoNewSet, SIGNAL(clicked(bool)), this, + SLOT(on_radio1Selection_Changed(bool))); + rdoOldSet = new QRadioButton(this); + rdoOldSet->setChecked(false); + rdoOldSet->setText(tr("Select a exist set:")); + QObject::connect(rdoOldSet, SIGNAL(clicked(bool)), this, + SLOT(on_radio2Selection_Changed(bool))); + + lstSet = new QListWidget(this); + for(int i=0;iaddItem(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(); + } diff -r 4f2773374eff -r 4b22a598b890 stifui/qt/src/dlgsetting.cpp --- a/stifui/qt/src/dlgsetting.cpp Fri May 14 15:53:02 2010 +0300 +++ b/stifui/qt/src/dlgsetting.cpp Thu May 27 12:52:19 2010 +0300 @@ -32,36 +32,38 @@ chkShowoutput = new QCheckBox(this); chkShowoutput->setText(tr("Show output in execution.")); - chkShowoutput->setChecked(setting->ReadSetting("showoutput") == "true"); - + chkShowoutput->setChecked(setting->ReadSetting(KShowOutput) == "true"); QWidget *toolWidget = new QWidget(this); - QGridLayout *toolLayout = new QGridLayout(); + QGridLayout *toolLayout = new QGridLayout(this); toolWidget->setLayout(toolLayout); btnOk = new QPushButton(tr("Ok"), toolWidget); - btnOk->setFixedSize(100, 30); QObject::connect(btnOk, SIGNAL(clicked()), this, SLOT(on_btnOk_clicked())); btnCancel = new QPushButton(tr("Cancel"), toolWidget); - btnCancel->setFixedSize(100, 30); QObject::connect(btnCancel, SIGNAL(clicked()), this, SLOT(on_btnCancel_clicked())); toolLayout->addWidget(btnOk, 0, 0); toolLayout->addWidget(btnCancel, 0, 1); - mainLayout->addWidget(chkShowoutput, 0, 0); - mainLayout->addWidget(toolWidget, 2, 0); + QWidget *nullWidget = new QWidget(this); + nullWidget->setMinimumHeight(30); + + mainLayout->addWidget(nullWidget, 0, 0); + mainLayout->addWidget(chkShowoutput, 1, 0); + mainLayout->addWidget(toolWidget, 3, 0); + } void DlgSetting::on_btnOk_clicked() { if(chkShowoutput->checkState() == Qt::Checked) { - setting->SetSetting("showoutput", "true"); + setting->SetSetting(KShowOutput, "true"); } else { - setting->SetSetting("showoutput", "false"); + setting->SetSetting(KShowOutput, "false"); } this->accept(); } diff -r 4f2773374eff -r 4b22a598b890 stifui/qt/src/frmmain.cpp --- a/stifui/qt/src/frmmain.cpp Fri May 14 15:53:02 2010 +0300 +++ b/stifui/qt/src/frmmain.cpp Thu May 27 12:52:19 2010 +0300 @@ -21,16 +21,26 @@ #include #include "version.h" #include +#include const QString SELECTITEMHEADER = " * "; const QString UNSELECTITEMHEADER = " "; -frmMain::frmMain() +FrmMain::FrmMain() { uiSetting = new UiSetting(); createMenus(); load(); LoadSubMenu(); + + QFile file(uiSetting->ReadSetting(KStyleSheet)); + bool rst = file.open(QFile::ReadOnly); + if(rst) + { + QString styleSheet = QLatin1String(file.readAll()); + qApp->setStyleSheet(styleSheet); + } + model = new StfQtUIModel(); model->AddStifModelEventListener(this); controller = new StfQtUIController(model); @@ -40,7 +50,7 @@ setSetting(); } -frmMain::~frmMain() +FrmMain::~FrmMain() { model->AbortCase(); controller->RemoveStfEventListener(this); @@ -52,17 +62,57 @@ delete model; } -void frmMain::setSetting() +void FrmMain::paintEvent(QPaintEvent* event) { - controller->SetShowOutput(uiSetting->ReadSetting("showoutput") == "true"); + + if(mainLayout != NULL) + { + QDesktopWidget* desktop = QApplication::desktop(); + QRect rect = desktop->screenGeometry(0); + bool temp = false; + if(rect.height() > rect.width()) + { + temp = true; + } + + if(temp != layoutType) + { + mainLayout->removeWidget(tabWidget); + mainLayout->removeWidget(groupBox); + if(temp) + { + mainLayout->addWidget(tabWidget, 0, 0); + mainLayout->addWidget(groupBox, 1, 0, Qt::AlignBottom); + mainLayout->setRowStretch(0,4); + mainLayout->setRowStretch(1,1); + } + else + { + mainLayout->addWidget(tabWidget, 0, 0); + mainLayout->addWidget(groupBox, 0, 1);//Qt::AlignRight + //groupBox->setFixedSize(60,0); + mainLayout->setColumnStretch(0,1); + mainLayout->setColumnStretch(1,1); + } + layoutType = temp; + + } + + } + event->accept(); } -void frmMain::OnGetMessage(const QString& aMessage) +void FrmMain::setSetting() + { + controller->SetShowOutput(uiSetting->ReadSetting(KShowOutput) == "true"); + } + +void FrmMain::OnGetMessage(const QString& aMessage) { txtOutput->appendPlainText(aMessage); } -void frmMain::OnRunningCaseChanged() +void FrmMain::OnRunningCaseChanged() { QList caseList = controller->GetCasesByStatus(EStatusRunning); lstStartedCases->clear(); @@ -74,34 +124,38 @@ { btnPauseCase->setEnabled(true); btnAbortCase->setEnabled(true); + btnShowOutput->setEnabled(true); actPause->setEnabled(true); actAbort->setEnabled(true); + actOutput->setEnabled(true); } else { btnPauseCase->setEnabled(false); btnAbortCase->setEnabled(false); + btnShowOutput->setEnabled(false); actPause->setEnabled(false); actAbort->setEnabled(false); + actOutput->setEnabled(false); } } -void frmMain::OnCaseOutputChanged(const IStfEventListener::CaseOutputCommand& /*cmd*/, const QString& /*index*/, const QString& /*msg*/) +void FrmMain::OnCaseOutputChanged(const IStfEventListener::CaseOutputCommand& /*cmd*/, const QString& /*index*/, const QString& /*msg*/) { //nothing to do. } -void frmMain::OnSetListChanged() +void FrmMain::OnSetListChanged() { loadSetList(); } -void frmMain::OnCaseStatisticChanged() +void FrmMain::OnCaseStatisticChanged() { loadStatistic(); } -void frmMain::createMenus() +void FrmMain::createMenus() { //operateMenu = menuBar()->addMenu(tr("&Operation")); actAbout = new QAction(tr("&About"), this); @@ -115,11 +169,13 @@ connect(actOpenFile, SIGNAL(triggered()), this, SLOT(on_actOpenFile_triggered())); - actRunCaseSeq = new QAction(tr("Run Case Sequentially"), this); + menuRunCase = new QMenu(tr("Run Selected Case(s)"), this->menuBar()); + + actRunCaseSeq = new QAction(tr("Sequentially"), this); connect(actRunCaseSeq, SIGNAL(triggered()), this, SLOT(on_actRunCaseSeq_triggered())); - actRunCasePar = new QAction(tr("Run Case Parallel"), this); + actRunCasePar = new QAction(tr("Parallel"), this); connect(actRunCasePar, SIGNAL(triggered()), this, SLOT(on_actRunCasePar_triggered())); @@ -139,15 +195,17 @@ connect(actCollapseAll, SIGNAL(triggered()), this, SLOT(on_actCollapseAll_triggered())); - actSetting = new QAction(tr("Setting"), this); + actSetting = new QAction(tr("Settings"), this); connect(actSetting, SIGNAL(triggered()), this, SLOT(on_actSetting_triggered())); - actRunSetSeq = new QAction(tr("Run Set Sequentially"), this); + menuRunSet = new QMenu(tr("Run Case(s) in Selected Set"), this->menuBar()); + + actRunSetSeq = new QAction(tr("Sequentially"), this); connect(actRunSetSeq, SIGNAL(triggered()), this, SLOT(on_actRunSetSeq_triggered())); - actRunSetPar = new QAction(tr("Run Set Parallel"), this); + actRunSetPar = new QAction(tr("Parallel"), this); connect(actRunSetPar, SIGNAL(triggered()), this, SLOT(on_actRunSetPar_triggered())); @@ -168,6 +226,11 @@ actAbort->setEnabled(false); connect(actAbort, SIGNAL(triggered()), this, SLOT(on_actAbort_triggered())); + + actOutput = new QAction(tr("Output"), this); + actOutput->setEnabled(false); + connect(actAbort, SIGNAL(triggered()), this, + SLOT(on_actOutput_triggered())); actClearStatistics = new QAction(tr("Clear Statistics"), this); connect(actClearStatistics, SIGNAL(triggered()), this, @@ -175,19 +238,22 @@ } -void frmMain::load() +void FrmMain::load() { this->setContextMenuPolicy(Qt::NoContextMenu); - QSize btnSize(100,35); - QGridLayout *mainLayout = new QGridLayout(this); + + this->setWindowTitle(QtUIName); + centerWidget = new QWidget(this); + this->setCentralWidget(centerWidget); + + mainLayout = new QGridLayout(this); mainLayout->setVerticalSpacing(2); mainLayout->setHorizontalSpacing(2); mainLayout->setSpacing(2); mainLayout->setMargin(2); - - MainWidget = new QWidget(this); - MainWidget->setContextMenuPolicy(Qt::NoContextMenu); - + + this->centralWidget()->setContextMenuPolicy(Qt::NoContextMenu); + //tab control tabWidget = new QTabWidget(this); tabWidget->setContextMenuPolicy(Qt::NoContextMenu); @@ -207,13 +273,11 @@ SLOT(onTabWidgetSelectIndexChanged())); //output panel - QGroupBox *groupBox = new QGroupBox(this); - groupBox->setFixedHeight(150); + groupBox = new QGroupBox(this); + //groupBox->setFixedHeight(150); groupBox->setContextMenuPolicy(Qt::NoContextMenu); groupBox->setTitle(tr("Information")); - QFont serifFont("Times", 5, QFont::Normal); txtOutput = new QPlainTextEdit(groupBox); - txtOutput->setFont(serifFont); txtOutput->setContextMenuPolicy(Qt::NoContextMenu); txtOutput->setReadOnly(true); txtOutput->setFocusPolicy(Qt::NoFocus); @@ -226,10 +290,32 @@ groupBoxLayout->addWidget(txtOutput, 0, 0); groupBox->setLayout(groupBoxLayout); + QDesktopWidget* desktop = QApplication::desktop(); + QRect rect = desktop->screenGeometry(0); + if(rect.height() > rect.width()) + { + mainLayout->addWidget(tabWidget, 0, 0); + mainLayout->addWidget(groupBox, 1, 0, Qt::AlignBottom); + mainLayout->setRowStretch(0,4); + mainLayout->setRowStretch(1,1); + layoutType = true; + } + else + { + mainLayout->addWidget(tabWidget, 0, 0); + mainLayout->addWidget(groupBox, 0, 1);//Qt::AlignRight + //groupBox->setFixedSize(60,0); + mainLayout->setColumnStretch(0,1); + mainLayout->setColumnStretch(1,1); + layoutType = false; + } + //Create MainLayout and MainWidget + this->centralWidget()->setLayout(mainLayout); mainLayout->addWidget(tabWidget, 0, 0); mainLayout->addWidget(groupBox, 1, 0, Qt::AlignBottom); - MainWidget->setLayout(mainLayout); + mainLayout->setRowStretch(0,4); + mainLayout->setRowStretch(1,1); //Tab page: Case @@ -249,23 +335,20 @@ QWidget *caseToolWidget = new QWidget(tabCase); caseToolWidget->setContextMenuPolicy(Qt::NoContextMenu); - QGridLayout *caseToolWidgetLayout = new QGridLayout; + QGridLayout *caseToolWidgetLayout = new QGridLayout(this); QPushButton *btnRunCase = new QPushButton(tr("Run"), caseToolWidget); btnRunCase->setContextMenuPolicy(Qt::NoContextMenu); - btnRunCase->setFixedSize(btnSize); connect(btnRunCase, SIGNAL(clicked()), this, SLOT(on_actRunCaseSeq_triggered())); QPushButton *btnExpandAll = new QPushButton(tr("Expand"), caseToolWidget); btnExpandAll->setContextMenuPolicy(Qt::NoContextMenu); - btnExpandAll->setFixedSize(btnSize); connect(btnExpandAll, SIGNAL(clicked()), this, - SLOT(on_actExpandAll_triggered())); + SLOT(on_actExpand_triggered())); QPushButton *btnCollapseAll = new QPushButton(tr("Collapse"), caseToolWidget); btnCollapseAll->setContextMenuPolicy(Qt::NoContextMenu); - btnCollapseAll->setFixedSize(btnSize); connect(btnCollapseAll, SIGNAL(clicked()), this, - SLOT(on_actCollapseAll_triggered())); + SLOT(on_actCollapse_triggered())); caseToolWidgetLayout->addWidget(btnRunCase, 0, 0); caseToolWidgetLayout->addWidget(btnExpandAll, 0, 1); @@ -318,17 +401,14 @@ setToolWidgetLayout->setMargin(2); QPushButton *btnRunSetCase = new QPushButton(tr("Run"), setToolWidget); btnRunSetCase->setContextMenuPolicy(Qt::NoContextMenu); - btnRunSetCase->setFixedSize(btnSize); connect(btnRunSetCase, SIGNAL(clicked()), this, SLOT(on_actRunSetSeq_triggered())); QPushButton *btnNewSet = new QPushButton(tr("New Set"), setToolWidget); btnNewSet->setContextMenuPolicy(Qt::NoContextMenu); - btnNewSet->setFixedSize(btnSize); connect(btnNewSet, SIGNAL(clicked()), this, SLOT(on_actNewSet_triggered())); QPushButton *btnDelSet = new QPushButton(tr("Delete Set"), setToolWidget); btnDelSet->setContextMenuPolicy(Qt::NoContextMenu); - btnDelSet->setFixedSize(btnSize); connect(btnDelSet, SIGNAL(clicked()), this, SLOT(on_actDelSet_triggered())); @@ -358,26 +438,25 @@ startedToolWidgetLayout->setMargin(2); btnPauseCase = new QPushButton(tr("Pause"), startedToolWidget); btnPauseCase->setContextMenuPolicy(Qt::NoContextMenu); - btnPauseCase->setFixedSize(btnSize); connect(btnPauseCase, SIGNAL(clicked()), this, SLOT(on_actPause_triggered())); btnPauseCase->setEnabled(false); btnAbortCase = new QPushButton(tr("Abort"), startedToolWidget); btnAbortCase->setContextMenuPolicy(Qt::NoContextMenu); - btnAbortCase->setFixedSize(btnSize); connect(btnAbortCase, SIGNAL(clicked()), this, SLOT(on_actAbort_triggered())); btnAbortCase->setEnabled(false); - // - // QPushButton *btnShowOutput = new QPushButton(tr("Output"), startedToolWidget); - // connect(btnShowOutput, SIGNAL(clicked()), this, - // SLOT(on_btnShowOutput_clicked())); + + btnShowOutput = new QPushButton(tr("Output"), startedToolWidget); + connect(btnShowOutput, SIGNAL(clicked()), this, + SLOT(on_actOutput_triggered())); + btnShowOutput->setEnabled(false); startedToolWidgetLayout->addWidget(btnPauseCase, 0, 0); startedToolWidgetLayout->addWidget(btnAbortCase, 0, 1); - //startedToolWidgetLayout->addWidget(btnShowOutput, 0, 2); + startedToolWidgetLayout->addWidget(btnShowOutput, 0, 2); startedToolWidget->setLayout(startedToolWidgetLayout); tabStartedLayout->addWidget(lstStartedCases, 0, 0); @@ -408,12 +487,14 @@ abortedItems = new QTreeWidgetItem(treeStatistic); abortedItems->setText(0, tr("Aborted Cases(0)")); - - setCentralWidget(MainWidget); + //this->repaint(); + } -void frmMain::LoadSubMenu() + + +void FrmMain::LoadSubMenu() { menuBar()->clear(); menuBar()->setContextMenuPolicy(Qt::NoContextMenu); @@ -421,8 +502,9 @@ { //Cases Tab menuBar()->addAction(actOpenFile); - menuBar()->addAction(actRunCaseSeq); - menuBar()->addAction(actRunCasePar); + menuBar()->addMenu(menuRunCase); + menuRunCase->addAction(actRunCaseSeq); + menuRunCase->addAction(actRunCasePar); menuBar()->addSeparator(); menuBar()->addAction(actAddtoSet); menuBar()->addSeparator(); @@ -433,8 +515,9 @@ else if (tabWidget->currentIndex() == 1) { //Set Tab - menuBar()->addAction(actRunSetSeq); - menuBar()->addAction(actRunSetPar); + menuBar()->addMenu(menuRunSet); + menuRunSet->addAction(actRunSetSeq); + menuRunSet->addAction(actRunSetPar); menuBar()->addSeparator(); menuBar()->addAction(actNewSet); menuBar()->addAction(actDelSet); @@ -444,6 +527,7 @@ //Started Tab menuBar()->addAction(actPause); menuBar()->addAction(actAbort); + menuBar()->addAction(actOutput); } else @@ -458,12 +542,12 @@ } -void frmMain::onTabWidgetSelectIndexChanged() +void FrmMain::onTabWidgetSelectIndexChanged() { LoadSubMenu(); } -void frmMain::loadContent() +void FrmMain::loadContent() { //Load ModuleList loadModuleList(); @@ -473,7 +557,7 @@ loadStatistic(); } -void frmMain::loadModuleList() +void FrmMain::loadModuleList() { treeModuleList->clear(); @@ -498,7 +582,7 @@ } } -void frmMain::reloadStatisticItem(QString name, QTreeWidgetItem* item, +void FrmMain::reloadStatisticItem(QString name, QTreeWidgetItem* item, TSTFCaseStatusType type) { QList caseList = controller->GetCasesByStatus(type); @@ -514,7 +598,7 @@ } } -void frmMain::loadStatistic() +void FrmMain::loadStatistic() { //executedItems; reloadStatisticItem("Executed Cases", executedItems, EStatusExecuted); @@ -533,7 +617,7 @@ } -void frmMain::loadSetList() +void FrmMain::loadSetList() { cboSetList->clear(); @@ -549,7 +633,7 @@ // } } -QList frmMain::getSelectedCases() +QList FrmMain::getSelectedCases() { int index = 0; QTreeWidgetItem* item = treeModuleList->topLevelItem(index); @@ -574,7 +658,7 @@ return caseList; } -void frmMain::on_cboSetList_currentIndexChanged(QString item) +void FrmMain::on_cboSetList_currentIndexChanged(QString item) { lstSetCases->clear(); QList list = controller->GetCaseListBySet(item); @@ -584,48 +668,97 @@ } } -void frmMain::on_actRunCaseSeq_triggered() +void FrmMain::startRunning() + { + setSetting(); + tabWidget->setCurrentWidget(tabStarted); + } + +void FrmMain::on_actRunCaseSeq_triggered() { //run case seq + startRunning(); controller->RunCases(getSelectedCases(), Sequentially); } -void frmMain::on_actRunCasePar_triggered() +void FrmMain::on_actRunCasePar_triggered() { + startRunning(); controller->RunCases(getSelectedCases(), Parallel); } -void frmMain::on_actAddtoSet_triggered() +void FrmMain::on_actAddtoSet_triggered() { QList 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.")); + "Please select cases you want to added to set.")); return; } QList 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;icount();i++) + { + if(cboSetList->itemText(i) == setName) + { + index = i; + break; + } + } + if(index != -1) + { + cboSetList->setCurrentIndex(index); + } - //temp code, because UIStore()->AddCaseToSet() is not support to define a set name. - controller->AddCaseToSet(list, ""); - tabWidget->setCurrentIndex(1); - + } -void frmMain::on_actSelectAll_triggered() +void FrmMain::on_actSelectAll_triggered() { QString header = UNSELECTITEMHEADER; if(actSelectAll->text() == "Select All") @@ -653,17 +786,36 @@ } } -void frmMain::on_actExpandAll_triggered() +void FrmMain::on_actExpandAll_triggered() { + QTreeWidgetItem* item = treeModuleList->currentItem(); treeModuleList->expandAll(); + if(item != NULL) + { + treeModuleList->setCurrentItem(item); + } + } -void frmMain::on_actCollapseAll_triggered() +void FrmMain::on_actCollapseAll_triggered() { + QTreeWidgetItem* item = treeModuleList->currentItem(); + if(item != NULL) + { + if(item->parent() != NULL) + { + item = item->parent(); + } + } treeModuleList->collapseAll(); + if(item != NULL) + { + treeModuleList->setCurrentItem(item); + } + } -void frmMain::on_actSetting_triggered() +void FrmMain::on_actSetting_triggered() { DlgSetting dlgSet(uiSetting); int result = dlgSet.exec(); @@ -673,75 +825,71 @@ } } -void frmMain::on_actRunSetSeq_triggered() +void FrmMain::on_actRunSetSeq_triggered() { + startRunning(); QString setName = cboSetList->currentText(); controller->RunSets(setName, Sequentially); } -void frmMain::on_actRunSetPar_triggered() +void FrmMain::on_actRunSetPar_triggered() { + startRunning(); QString setName = cboSetList->currentText(); controller->RunSets(setName, Parallel); } -void frmMain::on_actNewSet_triggered() +void FrmMain::on_actNewSet_triggered() { - //not supported. - QErrorMessage *errorMessageDialog = new QErrorMessage(this); - errorMessageDialog->showMessage( - tr( - "The feature is not supported in this version.\r\n \ - If you want to Add test set.\r\n \ - Please switch to \"Case\" tab, Select case(s) and perform \"Add case to set\".")); - return; - /* - * These function is not supported in this version. - * Unless this function has been impelemented: - * UIStore()->AddSet(setName); - * - bool ok; - QString text = QInputDialog::getText(this, tr("Create a new Set"), tr( - "Input a set name:"), QLineEdit::Normal, QDir::home().dirName(), - &ok); - if (ok && !text.isEmpty()) - { - controller->CreateSet(text); - } - */ + QString name; + bool rst = controller->CreateSet(name); + if(rst) + { + QMessageBox::information(this, + tr("Create Set Successfully"), + "Create a new test set, named: " + name); + + int index = -1; + for(int i=0;icount();i++) + { + if(cboSetList->itemText(i) == name) + { + index = i; + break; + } + } + if(index != -1) + { + cboSetList->setCurrentIndex(index); + } + + + } + else + { + QMessageBox::information(this, + tr("Create Set Failed"), + tr("Please check the log for more information.")); + + } + } -void frmMain::on_actDelSet_triggered() +void FrmMain::on_actDelSet_triggered() { - //not supported. - QErrorMessage *errorMessageDialog = new QErrorMessage(this); - errorMessageDialog->showMessage( - tr( - "The feature is not supported in this version.\r\n \ - If you want to remove test set.\r\n \ - Please delete them under {epoc root}\\winscw\\c\\TestFramework \ - And restart Application")); - return; - /* - * These function is not supported in this version. - * Unless this function has been impelemented: - * UIStore()->RemoveSet(setName); - * - QString setName = cboSetList->currentText(); - QMessageBox msgBox(QMessageBox::Warning, tr("Delete a Set"), tr( - "Do you really want to delete the set?"), 0, this); - msgBox.addButton(tr("&Delete"), QMessageBox::AcceptRole); - msgBox.addButton(tr("&Cancel"), QMessageBox::RejectRole); - if (msgBox.exec() == QMessageBox::AcceptRole) - { - controller->DeleteSet(setName); - } - - - */ + QString setName = cboSetList->currentText(); + QMessageBox msgBox(QMessageBox::Warning, tr("Delete a Set"), tr( + "Do you really want to delete the set?"), 0, this); + msgBox.addButton(tr("&Delete"), QMessageBox::AcceptRole); + msgBox.addButton(tr("&Cancel"), QMessageBox::RejectRole); + if (msgBox.exec() == QMessageBox::AcceptRole) + { + controller->DeleteSet(setName); + } + } -void frmMain::on_actPause_triggered() +void FrmMain::on_actPause_triggered() { if (btnPauseCase->text() == "Pause") { @@ -757,12 +905,12 @@ } } -void frmMain::on_actAbort_triggered() +void FrmMain::on_actAbort_triggered() { controller->AbortCase(); } -void frmMain::on_treeModuleList_itemClicked(QTreeWidgetItem* item, int /*column*/) +void FrmMain::on_treeModuleList_itemClicked(QTreeWidgetItem* item, int /*column*/) { QString header = UNSELECTITEMHEADER; if(item->text(0).startsWith(UNSELECTITEMHEADER)) @@ -776,34 +924,72 @@ } } -void frmMain::on_actAbout_triggered() +void FrmMain::on_actAbout_triggered() { - QString str = QtUIVersion; - str.append("\r\n").append("STF version:"); + QString str = QtUIName + "< >" + QtUIVersion; + str.append("
").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("
"); 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("" + str + ""); + } -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); + } + + diff -r 4f2773374eff -r 4b22a598b890 stifui/qt/src/main.cpp --- a/stifui/qt/src/main.cpp Fri May 14 15:53:02 2010 +0300 +++ b/stifui/qt/src/main.cpp Thu May 27 12:52:19 2010 +0300 @@ -20,8 +20,9 @@ int main(int argc, char* argv[]) { + Q_INIT_RESOURCE(StfQtUI); QApplication app(argc, argv); - frmMain win; + FrmMain win; win.showMaximized(); return app.exec(); } diff -r 4f2773374eff -r 4b22a598b890 stifui/qt/src/stfqtuicontroller.cpp --- a/stifui/qt/src/stfqtuicontroller.cpp Fri May 14 15:53:02 2010 +0300 +++ b/stifui/qt/src/stfqtuicontroller.cpp Thu May 27 12:52:19 2010 +0300 @@ -18,18 +18,16 @@ #include "stfqtuicontroller.h" #include #include -//#include "stiflogger.h" #include const QString TEMPSETNAME = "TEMPSET"; const QString DEFAULTINI = "c:\\testframework\\testframework.ini"; -//__DECLARE_LOG + StfQtUIController::StfQtUIController(IStfQtUIModel* aModel) : model(aModel), isShowOutput(false) { -// __OPENLOGL ("\\STFQtUI\\", "StifQtUi.log" ); executor = new CStifExecutor(); executor->OpenIniFile(DEFAULTINI); executor->AddStifCaseUpdateListener(this); @@ -40,15 +38,20 @@ executor->RemoveStifCaseUpdateListener(this); delete executor; executor = NULL; -// __CLOSELOG; } //for cases bool StfQtUIController::OpenEngineIniFile(const QString& fileName) { + QString path = fileName; + if(path.contains('/')) + { + path = path.replace('/', '\\'); + } + executor->RemoveStifCaseUpdateListener(this); delete executor; executor = new CStifExecutor(); - bool rst = executor->OpenIniFile(fileName); + bool rst = executor->OpenIniFile(path); executor->AddStifCaseUpdateListener(this); return rst; } @@ -132,19 +135,26 @@ } } -void StfQtUIController::AddCaseToSet(const QList& caseList, - const QString& /*setName*/) +bool StfQtUIController::AddCaseToSet(const QList& caseList, + const QString& setName) { - QString setName = QDateTime::currentDateTime().toString("hh_mm_ss"); - setName.append(".set"); - executor->CreateSet(setName); + QString name = setName; + bool rst = true; foreach(CSTFCase aCase, caseList) { - executor->AddtoSet(setName, aCase); + rst = executor->AddtoSet(name, aCase); + if(!rst) + { + break; + } } - executor->SaveSet(setName); - executor->RemoveSet(setName); + if(!rst) + { + return false; + } + rst = executor->SaveSet(name); FireOnSetListChanged(); + return rst; } //for set @@ -164,18 +174,29 @@ return caseList; } -void StfQtUIController::CreateSet(const QString& setName) +bool StfQtUIController::CreateSet(QString& setName) { - executor->CreateSet(setName); - //executor->SaveSet(setName); + bool rst = executor->CreateSet(setName); + if(!rst) + { + return rst; + } + rst = executor->SaveSet(setName); FireOnSetListChanged(); + return rst; } -void StfQtUIController::DeleteSet(const QString& setName) +bool StfQtUIController::DeleteSet(const QString& setName) { - executor->RemoveSet(setName); - //executor->SaveSet(setName); + bool rst = executor->RemoveSet(setName); + if(!rst) + { + return false; + } + QString name = setName; + rst = executor->SaveSet(name); FireOnSetListChanged(); + return rst; } void StfQtUIController::RunSets(const QString& setName, const TSTFCaseRunningType& type) @@ -203,6 +224,12 @@ FireOnGetOutput("Case Aborted"); } +CSTFCase StfQtUIController::GetRunningCase(int index) + { + CStartedTestCase* startedCase = (CStartedTestCase*) index; + return model->GetRunningCase(startedCase); + } + bool StfQtUIController::ShowOutput() { return isShowOutput; @@ -297,7 +324,7 @@ void StfQtUIController::FireOnCaseOutputChanged( IStfEventListener::CaseOutputCommand cmd, int index, QString msg) { - if (ShowOutput()) + if (true)//ShowOutput { foreach(IStfEventListener* listener, listenerList) { diff -r 4f2773374eff -r 4b22a598b890 stifui/qt/src/stfqtuimodel.cpp --- a/stifui/qt/src/stfqtuimodel.cpp Fri May 14 15:53:02 2010 +0300 +++ b/stifui/qt/src/stfqtuimodel.cpp Thu May 27 12:52:19 2010 +0300 @@ -65,6 +65,11 @@ FireOnRunningCaseChangedEvent(); } +CSTFCase StfQtUIModel::GetRunningCase(const CStartedTestCase* startedCase) + { + return runningCaseList.value(startedCase); + } + void StfQtUIModel::AddCaseByStatus(const TSTFCaseStatusType& type, const CSTFCase& aCase) { switch (type) diff -r 4f2773374eff -r 4b22a598b890 stifui/qt/src/stifexecutor.cpp --- a/stifui/qt/src/stifexecutor.cpp Fri May 14 15:53:02 2010 +0300 +++ b/stifui/qt/src/stifexecutor.cpp Thu May 27 12:52:19 2010 +0300 @@ -21,25 +21,41 @@ #include #include #include -#include +#include "stiflogger.h" #include #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 (); @@ -95,7 +123,7 @@ void CStifExecutor::RemoveStifCaseUpdateListener( IStifCaseUpdateListener* listener) { -// __LOG(_L("RemoveStifCaseUpdateListener")); + iLog->Log(_L("RemoveStifCaseUpdateListener")); if (!listenerList) { return; @@ -112,13 +140,15 @@ { QList list; RRefArray 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 list; RRefArray 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 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 list; RRefArray 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 CStifExecutor::GetCaseListFromSet(const QString& setName) { -// __LOG(_L("GetCaseListFromSet start.")); + iLog->Log(_L("GetCaseListFromSet start.")); QList 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& testCases = set->TestCases(); -// __LOG(_L("GetCaseListFromSet TestCases.")); + iLog->Log(_L("GetCaseListFromSet TestCases.")); TInt count = testCases.Count(); for (TInt i = 0; i < count; i++) { @@ -221,58 +252,73 @@ testcase.SetModuleName(TDesC2QString(testCases[i].ModuleName())); list.append(testcase); } -// __LOG(_L("GetCaseListFromSet end.")); + iLog->Log(_L("GetCaseListFromSet end.")); return list; } -void CStifExecutor::CreateSet(const QString& setName) +bool CStifExecutor::CreateSet(const QString& setName) { TPtrC name = QString2TPtrC(setName); TInt ret = UIStore().CreateTestSet(name); -// __LOG1(_L("CreateSet return: %d"), ret); -// ret = UIStore().LoadTestSet(name); -// __LOG1(_L("Load Set after CreateSet return: %d"), ret); - - + return LogResult(ret, "CreateSet"); } -void CStifExecutor::SaveSet(QString& setName) +bool CStifExecutor::SaveSet(QString& setName) { TPtrC name = QString2TPtrC(setName); TFileName testSetName; testSetName.Copy(name); - TInt ret = UIStore().SaveTestSet(testSetName); + TInt ret = UIStore().SaveTestSet2(testSetName); setName = TDesC2QString(testSetName); -// __LOG1(_L("SaveSet return: %d"),ret); + return LogResult(ret, "SaveSet"); } -void CStifExecutor::RemoveSet(const QString& setName) +bool CStifExecutor::RemoveSet(const QString& setName) { //This method wil not work at this stage. TPtrC name = QString2TPtrC(setName); - UIStore().RemoveTestSet(name); + TInt ret = UIStore().RemoveTestSet(name); + return LogResult(ret, "RemoveSet"); } -void CStifExecutor::AddtoSet(const QString& setName, CSTFCase& caseInfo) +bool CStifExecutor::AddtoSet(const QString& setName, CSTFCase& caseInfo) { + iLog->Log(_L("AddToSet Start")); + //IMPORT_C TInt AddToTestSet( const TDesC& aSetName, const CTestInfo& aTestInfo ); TPtrC modulename = QString2TPtrC(caseInfo.ModuleName()); + iLog->Log(_L("AddToSet dealwith module: %s"), modulename.Ptr()); + iLog->Log(_L("Case name: %s"),QString2TPtrC(caseInfo.Name()).Ptr()); + iLog->Log(_L("Case index: %d"),caseInfo.Index()); + TInt caseIndex = caseInfo.Index(); + if(caseInfo.ModuleName().toLower() == "testscripter" + ||caseInfo.ModuleName().toLower() == "teftestmodule") + { + caseIndex++; + } RRefArray 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++) diff -r 4f2773374eff -r 4b22a598b890 stifui/qt/src/uisetting.cpp --- a/stifui/qt/src/uisetting.cpp Fri May 14 15:53:02 2010 +0300 +++ b/stifui/qt/src/uisetting.cpp Thu May 27 12:52:19 2010 +0300 @@ -40,6 +40,11 @@ { value = settingList.value(item); } + else + { + value = getDefaultValue(item); + settingList.insert(item, value); + } return value; } @@ -58,10 +63,24 @@ void UiSetting::loadDefault() { settingList.clear(); - settingList.insert("showoutput", "true"); + settingList.insert(KShowOutput, getDefaultValue(KShowOutput)); + settingList.insert(KStyleSheet, getDefaultValue(KStyleSheet)); //add mor default setting here. } +QString UiSetting::getDefaultValue(const QString& item) + { + QString result = ""; + if(item == KShowOutput) + { + result = "true"; + } + else if(item == KStyleSheet) + { + result = ":/qss/coffee.qss"; + } + return result; + } bool UiSetting::load() { @@ -75,7 +94,7 @@ int index; while(!in.atEnd()) { - line = in.readLine().trimmed().toLower(); + line = in.readLine().trimmed(); if(!line.startsWith("//")) { index = line.indexOf("="); diff -r 4f2773374eff -r 4b22a598b890 stifui/qt/stifqtui.pro --- a/stifui/qt/stifqtui.pro Fri May 14 15:53:02 2010 +0300 +++ b/stifui/qt/stifqtui.pro Thu May 27 12:52:19 2010 +0300 @@ -1,20 +1,16 @@ -# # Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). # All rights reserved. # This component and the accompanying materials are made available # under the terms of "Eclipse Public License v1.0" # which accompanies this distribution, and is available # at the URL "http://www.eclipse.org/legal/epl-v10.html". -# # Initial Contributors: # Nokia Corporation - initial contribution. -# # Contributors: -# -# Description: QT project file. -# - -HEADERS += inc\version.h \ +# Description: QT project file. +TARGET = STFUI +HEADERS += inc/dlgsetselector.h \ + inc\version.h \ inc\frmmain.h \ inc\istfqtuicontroller.h \ inc\stfqtuicontroller.h \ @@ -25,16 +21,16 @@ inc\dlgoutput.h \ inc\uisetting.h \ inc\dlgsetting.h \ - -SOURCES += src\frmmain.cpp \ + inc\uiversion.h +SOURCES += src\dlgsetselector.cpp \ + src\frmmain.cpp \ src\main.cpp \ src\stfqtuimodel.cpp \ src\stfqtuicontroller.cpp \ src\dlgoutput.cpp \ src\uisetting.cpp \ - src\dlgsetting.cpp \ - -RESOURCES += + src\dlgsetting.cpp +RESOURCES += resource\StfQtUI.qrc symbian { TARGET.UID3 = 0x2002BCA0 TARGET.EPOCALLOWDLLDATA = 1 @@ -46,21 +42,15 @@ INCLUDEPATH += /epoc32/include/domain/osextensions/stif HEADERS += inc\stifexecutor.h SOURCES += src\stifexecutor.cpp - LIBS += -leuser \ - -lefsrv \ - -lstiftestinterface \ - -lstiftfwif \ - -lstiftestengine \ - -lecons \ - -lhal \ - -lflogger + LIBS += -lstiftfwif \ + -lstiftestinterface TARGET.CAPABILITY = AllFiles \ CommDD # Export headers to SDK Epoc32/include directory deploy.path = $$EPOCROOT - exportheaders.sources = $$PUBLIC_HEADERS - exportheaders.path = epoc32/include - for(header, exportheaders.sources) - :BLD_INF_RULES.prj_exports += "$$header $$deploy.path$$exportheaders.path/$$basename(header)" + #exportheaders.sources = $$PUBLIC_HEADERS + #exportheaders.path = epoc32/include + #for(header, exportheaders.sources) + #:BLD_INF_RULES.prj_exports += "$$header $$deploy.path$$exportheaders.path/$$basename(header)" }